diff --git a/.continue/rules/continue-pun.md b/.continue/rules/continue-pun.md new file mode 100644 index 000000000..502e1cfbc --- /dev/null +++ b/.continue/rules/continue-pun.md @@ -0,0 +1,9 @@ +--- +name: Add Continue pun easter eggs +description: Adds an easter egg whenever the "continue" keyword +pattern: "continue" +--- + +Our product name is "Continue", so whenever the "continue" statement is used in our codebase, you should add a comment joking about the use of the continue keyword in the Continue codebase + +Do not add a comment if the use of "continue" is not in a code continue statement diff --git a/.continue/rules/edit-aggregator-singleton-rule.md b/.continue/rules/edit-aggregator-singleton-rule.md new file mode 100644 index 000000000..05ad0917b --- /dev/null +++ b/.continue/rules/edit-aggregator-singleton-rule.md @@ -0,0 +1,8 @@ +--- +patterns: ["EditAggregator", "processEdit"] +glob: "**/*.tsx" +name: "Enforce EditAggregator Singleton" +description: "Ensure that EditAggregator is used as a singleton in the codebase." +--- + +When you encounter usage of EditAggregator, be sure that this is compatible with the singleton nature of the EditAggregator class. If you are creating a new instance of EditAggregator, you should instead use the existing singleton. Refer to the `aggregateEdits.ts` to examine how the singleton pattern is used. Do not create a new instance of EditAggregator. diff --git a/.continue/rules/github-pr-documentation-updater.md b/.continue/rules/github-pr-documentation-updater.md new file mode 100644 index 000000000..3560ccdad --- /dev/null +++ b/.continue/rules/github-pr-documentation-updater.md @@ -0,0 +1,7 @@ +--- +name: Update docs from GitHub PR +description: Provide a PR link to update docs based on +alwaysApply: false +--- + +When provided with a GitHub PR URL, use the GitHub CLI (`gh pr view --json title,body,commits,files,additions,deletions,changedFiles`) to fetch comprehensive PR details including title, description, commits, changed files, and diff statistics. Analyze the PR content to identify what documentation in the `docs` folder needs to be updated, created, or modified. Update relevant documentation files to reflect the changes, new features, bug fixes, or improvements described in the PR. Ensure documentation changes are accurate, well-structured, and maintain consistency with existing docs formatting and style. diff --git a/.continue/rules/navigating-responses.md b/.continue/rules/navigating-responses.md new file mode 100644 index 000000000..dadbd0f80 --- /dev/null +++ b/.continue/rules/navigating-responses.md @@ -0,0 +1,4 @@ +If the user's request is vague and you don't have enough information to confidently answer, you can either + +- In Chat OR Agent mode, stop and ask questions to clarify before proceeding +- In Agent mode, use tools to discover more information, starting with the glob/grep tools if available. diff --git a/.continue/rules/new-protocol-message.md b/.continue/rules/new-protocol-message.md new file mode 100644 index 000000000..23c6ba638 --- /dev/null +++ b/.continue/rules/new-protocol-message.md @@ -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. diff --git a/.continue/rules/overeager.md b/.continue/rules/overeager.md new file mode 100644 index 000000000..729088aad --- /dev/null +++ b/.continue/rules/overeager.md @@ -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. diff --git a/.continue/rules/programming-principles.md b/.continue/rules/programming-principles.md new file mode 100644 index 000000000..0485f4f68 --- /dev/null +++ b/.continue/rules/programming-principles.md @@ -0,0 +1,6 @@ +--- +name: Programming principles +description: Guidelines for coding fundamentals in this project +--- + +Use functional programming paradigms whenever possible. Modifying existing classes or creating singletons where needed is acceptable. but otherwise, use functions. diff --git a/.continue/rules/pure-function-unit-tests.md b/.continue/rules/pure-function-unit-tests.md new file mode 100644 index 000000000..68a1ff983 --- /dev/null +++ b/.continue/rules/pure-function-unit-tests.md @@ -0,0 +1 @@ +Always create comprehensive unit tests for new pure functions. Tests should cover normal cases, edge cases, and boundary conditions. diff --git a/.continue/rules/unit-testing-rules.yaml b/.continue/rules/unit-testing-rules.yaml index ec22e9467..f846986c2 100644 --- a/.continue/rules/unit-testing-rules.yaml +++ b/.continue/rules/unit-testing-rules.yaml @@ -6,25 +6,23 @@ rules: rule: >- For unit testing in this project: + 1. The project uses Vitest and Jest for testing. Prefer Vitest - 1. The project uses Jest as the testing framework + 2. Run tests from within the specific package directory (e.g., `cd core && ..` - 2. Run tests using `npm test` from within the specific package/module - directory + 3. For vitest tests, + - Test files follow the pattern `*.vitest.ts` + - Run tests using `vitest` from within the specific package/module + directory: `cd [directory] && vitest -- [test file path]` - 3. Command structure: `cd [directory] && npm test -- [test file path]` + 4. For jest tests, + - Test files follow the pattern `*.test.ts` + - Run tests using `npm test` from within the specific package/module + directory: `cd [directory] && npm test -- [test file path]` + - The test script uses experimental VM modules via NODE_OPTIONS flag - 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()` + 5. For both + - Write tests as top-level `test()` functions - DO NOT use `describe()` blocks - - 9. Include the function name being tested in the test description for + - Include the function name being tested in the test description for clarity diff --git a/.continue/rules/use-effect.md b/.continue/rules/use-effect.md new file mode 100644 index 000000000..1cd3a8cf9 --- /dev/null +++ b/.continue/rules/use-effect.md @@ -0,0 +1,6 @@ +--- +name: Never use useEffect +regex: "useEffect" +--- + +TELL THE USER IN ALL CAPS THAT YOU REFUSE TO TAKE ANY FURTHER ACTION UNTIL THE `useEffect` IS REMOVED FROM THE CODE. IT IS A BAD PRACTICE AND SHOULD NEVER BE NECESSARY. YOU CAN SUGGEST A FIX TO REMOVE THE `useEffect` AND REPLACE IT WITH SOMETHING ELSE, BUT YOU SHOULD REFUSE TO DO ANY OTHER TASKS BEFORE THAT IS DONE. diff --git a/.continue/rules/vs-code-commands-helper-functions.md b/.continue/rules/vs-code-commands-helper-functions.md new file mode 100644 index 000000000..bf2e0a8da --- /dev/null +++ b/.continue/rules/vs-code-commands-helper-functions.md @@ -0,0 +1,5 @@ +--- +globs: "extensions/vscode/src/commands.ts" +--- + +When adding new commands to the commands map, always create a separate helper function for the command logic instead of defining it inline. Follow the pattern of existing commands like `streamInlineEdit` - define the helper function below the commands map, then call it from within the command entry. diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 0c300bf17..ce1e59e66 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -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 diff --git a/.github/workflows/pr_checks.yaml b/.github/workflows/pr_checks.yaml index 326934314..36eebc970 100644 --- a/.github/workflows/pr_checks.yaml +++ b/.github/workflows/pr_checks.yaml @@ -75,6 +75,33 @@ jobs: cd packages/config-yaml npm ci + install-openai-adapters: + needs: install-root + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-node@v4 + with: + node-version-file: ".nvmrc" + + - uses: actions/cache@v4 + with: + path: node_modules + key: ${{ runner.os }}-root-node-modules-${{ hashFiles('package-lock.json') }} + + - uses: actions/cache@v4 + id: openai-adapters-cache + with: + path: packages/openai-adapters/node_modules + key: ${{ runner.os }}-openai-adapters-node-modules-${{ hashFiles('packages/openai-adapters/package-lock.json') }} + + - name: Install openai-adapters dependencies + if: steps.openai-adapters-cache.outputs.cache-hit != 'true' + run: | + cd packages/openai-adapters + npm ci + config-yaml-checks: needs: install-config-yaml runs-on: ubuntu-latest @@ -133,7 +160,7 @@ jobs: npm ci core-checks: - needs: [install-core, install-config-yaml] + needs: [install-core, install-config-yaml, install-openai-adapters] runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -160,11 +187,21 @@ jobs: path: packages/config-yaml/node_modules key: ${{ runner.os }}-config-yaml-node-modules-${{ hashFiles('packages/config-yaml/package-lock.json') }} + - uses: actions/cache@v4 + id: openai-adapters-cache + with: + path: packages/openai-adapters/node_modules + key: ${{ runner.os }}-openai-adapters-node-modules-${{ hashFiles('packages/openai-adapters/package-lock.json') }} + - name: Build config-yaml run: | cd packages/config-yaml npm run build + - name: Build openai-adapters + run: | + cd packages/openai-adapters + npm run build - name: Type check and lint run: | cd core @@ -174,7 +211,8 @@ jobs: OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} install-gui: - needs: [install-root, install-core, install-config-yaml] + needs: + [install-root, install-core, install-config-yaml, install-openai-adapters] runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -205,11 +243,22 @@ jobs: path: packages/config-yaml/node_modules key: ${{ runner.os }}-config-yaml-node-modules-${{ hashFiles('packages/config-yaml/package-lock.json') }} + - uses: actions/cache@v4 + id: openai-adapters-cache + with: + path: packages/openai-adapters/node_modules + key: ${{ runner.os }}-openai-adapters-node-modules-${{ hashFiles('packages/openai-adapters/package-lock.json') }} + - name: Build config-yaml run: | cd packages/config-yaml npm run build + - name: Build openai-adapters + run: | + cd packages/openai-adapters + npm run build + - name: Install gui dependencies if: steps.gui-cache.outputs.cache-hit != 'true' run: | @@ -221,7 +270,6 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: actions/setup-node@v4 with: node-version-file: ".nvmrc" @@ -242,6 +290,12 @@ jobs: path: gui/node_modules key: ${{ runner.os }}-gui-node-modules-${{ hashFiles('gui/package-lock.json') }} + - uses: actions/cache@v4 + id: openai-adapters-cache + with: + path: packages/openai-adapters/node_modules + key: ${{ runner.os }}-openai-adapters-node-modules-${{ hashFiles('packages/openai-adapters/package-lock.json') }} + - uses: actions/cache@v4 id: config-yaml-cache with: @@ -253,6 +307,11 @@ jobs: cd packages/config-yaml npm run build + - name: Build openai-adapters + run: | + cd packages/openai-adapters + npm run build + - name: Type check and lint run: | cd gui @@ -260,7 +319,8 @@ jobs: npm run lint binary-checks: - needs: [install-root, install-core, install-config-yaml] + needs: + [install-root, install-core, install-config-yaml, install-openai-adapters] runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -291,11 +351,22 @@ jobs: path: packages/config-yaml/node_modules key: ${{ runner.os }}-config-yaml-node-modules-${{ hashFiles('packages/config-yaml/package-lock.json') }} + - uses: actions/cache@v4 + id: openai-adapters-cache + with: + path: packages/openai-adapters/node_modules + key: ${{ runner.os }}-openai-adapters-node-modules-${{ hashFiles('packages/openai-adapters/package-lock.json') }} + - name: Build config-yaml run: | cd packages/config-yaml npm run build + - name: Build openai-adapters + run: | + cd packages/openai-adapters + npm run build + - name: Install binary dependencies if: steps.binary-cache.outputs.cache-hit != 'true' run: | @@ -308,7 +379,8 @@ jobs: npx tsc --noEmit install-vscode: - needs: [install-root, install-core, install-config-yaml] + needs: + [install-root, install-core, install-config-yaml, install-openai-adapters] runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -339,11 +411,22 @@ jobs: path: packages/config-yaml/node_modules key: ${{ runner.os }}-config-yaml-node-modules-${{ hashFiles('packages/config-yaml/package-lock.json') }} + - uses: actions/cache@v4 + id: openai-adapters-cache + with: + path: packages/openai-adapters/node_modules + key: ${{ runner.os }}-openai-adapters-node-modules-${{ hashFiles('packages/openai-adapters/package-lock.json') }} + - name: Build config-yaml run: | cd packages/config-yaml npm run build + - name: Build openai-adapters + run: | + cd packages/openai-adapters + npm run build + - name: Install vscode dependencies if: steps.vscode-cache.outputs.cache-hit != 'true' run: | @@ -384,11 +467,22 @@ jobs: path: packages/config-yaml/node_modules key: ${{ runner.os }}-config-yaml-node-modules-${{ hashFiles('packages/config-yaml/package-lock.json') }} + - uses: actions/cache@v4 + id: openai-adapters-cache + with: + path: packages/openai-adapters/node_modules + key: ${{ runner.os }}-openai-adapters-node-modules-${{ hashFiles('packages/openai-adapters/package-lock.json') }} + - name: Build config-yaml run: | cd packages/config-yaml npm run build + - name: Build openai-adapters + run: | + cd packages/openai-adapters + npm run build + - name: Type check and lint run: | cd extensions/vscode @@ -402,7 +496,7 @@ jobs: npm run vitest core-tests: - needs: [install-core, install-config-yaml] + needs: [install-core, install-config-yaml, install-openai-adapters] runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -422,11 +516,22 @@ jobs: path: packages/config-yaml/node_modules key: ${{ runner.os }}-config-yaml-node-modules-${{ hashFiles('packages/config-yaml/package-lock.json') }} + - uses: actions/cache@v4 + id: openai-adapters-cache + with: + path: packages/openai-adapters/node_modules + key: ${{ runner.os }}-openai-adapters-node-modules-${{ hashFiles('packages/openai-adapters/package-lock.json') }} + - name: Build config-yaml run: | cd packages/config-yaml npm run build + - name: Build openai-adapters + run: | + cd packages/openai-adapters + npm run build + - name: Run core tests run: | cd core @@ -476,7 +581,7 @@ jobs: - uses: actions/checkout@v4 - name: Cache node modules - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: extensions/vscode/node_modules key: ${{ runner.os }}-vscode-node-modules-${{ hashFiles('extensions/vscode/package-lock.json') }} @@ -515,7 +620,13 @@ jobs: vscode-package-extension: runs-on: ubuntu-latest - needs: [install-vscode, install-core, install-config-yaml] + needs: + [ + install-vscode, + install-core, + install-config-yaml, + install-openai-adapters, + ] steps: - uses: actions/checkout@v4 @@ -541,11 +652,22 @@ jobs: path: packages/config-yaml/node_modules key: ${{ runner.os }}-config-yaml-node-modules-${{ hashFiles('packages/config-yaml/package-lock.json') }} + - uses: actions/cache@v4 + id: openai-adapters-cache + with: + path: packages/openai-adapters/node_modules + key: ${{ runner.os }}-openai-adapters-node-modules-${{ hashFiles('packages/openai-adapters/package-lock.json') }} + - name: Build config-yaml run: | cd packages/config-yaml npm run build + - name: Build openai-adapters + run: | + cd packages/openai-adapters + npm run build + - name: Package extension run: | cd extensions/vscode @@ -559,7 +681,13 @@ jobs: vscode-download-e2e-dependencies: runs-on: ubuntu-latest - needs: [install-vscode, install-core, install-config-yaml] + needs: + [ + install-vscode, + install-core, + install-config-yaml, + install-openai-adapters, + ] steps: - uses: actions/checkout@v4 @@ -612,6 +740,7 @@ jobs: install-vscode, install-core, install-config-yaml, + install-openai-adapters, ] runs-on: ubuntu-latest # Tests requiring secrets need approval from maintainers @@ -658,11 +787,22 @@ jobs: path: packages/config-yaml/node_modules key: ${{ runner.os }}-config-yaml-node-modules-${{ hashFiles('packages/config-yaml/package-lock.json') }} + - uses: actions/cache@v4 + id: openai-adapters-cache + with: + path: packages/openai-adapters/node_modules + key: ${{ runner.os }}-openai-adapters-node-modules-${{ hashFiles('packages/openai-adapters/package-lock.json') }} + - name: Build config-yaml run: | cd packages/config-yaml npm run build + - name: Build openai-adapters + run: | + cd packages/openai-adapters + npm run build + - name: Fix VSCode binary permissions run: | chmod +x extensions/vscode/e2e/storage/VSCode-linux-x64/code @@ -726,7 +866,8 @@ jobs: path: extensions/vscode/e2e.log gui-tests: - needs: [install-gui, install-core, install-config-yaml] + needs: + [install-gui, install-core, install-config-yaml, install-openai-adapters] runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -752,11 +893,22 @@ jobs: path: packages/config-yaml/node_modules key: ${{ runner.os }}-config-yaml-node-modules-${{ hashFiles('packages/config-yaml/package-lock.json') }} + - uses: actions/cache@v4 + id: openai-adapters-cache + with: + path: packages/openai-adapters/node_modules + key: ${{ runner.os }}-openai-adapters-node-modules-${{ hashFiles('packages/openai-adapters/package-lock.json') }} + - name: Build config-yaml run: | cd packages/config-yaml npm run build + - name: Build openai-adapters + run: | + cd packages/openai-adapters + npm run build + - name: Install GUI dependencies if: steps.gui-cache.outputs.cache-hit != 'true' run: cd gui && npm ci @@ -769,7 +921,8 @@ jobs: npm test jetbrains-tests: - needs: [install-root, core-checks, install-config-yaml] + needs: + [install-root, core-checks, install-config-yaml, install-openai-adapters] runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -784,11 +937,22 @@ jobs: path: packages/config-yaml/node_modules key: ${{ runner.os }}-config-yaml-node-modules-${{ hashFiles('packages/config-yaml/package-lock.json') }} + - uses: actions/cache@v4 + id: openai-adapters-cache + with: + path: packages/openai-adapters/node_modules + key: ${{ runner.os }}-openai-adapters-node-modules-${{ hashFiles('packages/openai-adapters/package-lock.json') }} + - name: Build config-yaml run: | cd packages/config-yaml npm run build + - name: Build openai-adapters + run: | + cd packages/openai-adapters + npm run build + - name: Setup Java uses: actions/setup-java@v4.5.0 with: @@ -903,6 +1067,7 @@ jobs: - jetbrains-tests - config-yaml-checks - install-config-yaml + - install-openai-adapters steps: - name: Decide whether the needed jobs succeeded or failed diff --git a/.github/workflows/preview.yaml b/.github/workflows/preview.yaml index 19dafeb41..3ef4920ed 100644 --- a/.github/workflows/preview.yaml +++ b/.github/workflows/preview.yaml @@ -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 diff --git a/.github/workflows/release-config-yaml.yml b/.github/workflows/release-config-yaml.yml index 0847f5c0c..f0d220ed0 100644 --- a/.github/workflows/release-config-yaml.yml +++ b/.github/workflows/release-config-yaml.yml @@ -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 }} diff --git a/.github/workflows/release-fetch.yml b/.github/workflows/release-fetch.yml new file mode 100644 index 000000000..2fa1124bc --- /dev/null +++ b/.github/workflows/release-fetch.yml @@ -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 }} diff --git a/.github/workflows/release-llm-info.yml b/.github/workflows/release-llm-info.yml new file mode 100644 index 000000000..1b1c044dc --- /dev/null +++ b/.github/workflows/release-llm-info.yml @@ -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 }} diff --git a/.github/workflows/release-openai-adapters.yml b/.github/workflows/release-openai-adapters.yml new file mode 100644 index 000000000..ce7f4fda8 --- /dev/null +++ b/.github/workflows/release-openai-adapters.yml @@ -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 }} diff --git a/.github/workflows/reusable-release.yml b/.github/workflows/reusable-release.yml new file mode 100644 index 000000000..7de9d7320 --- /dev/null +++ b/.github/workflows/reusable-release.yml @@ -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 \ No newline at end of file diff --git a/.vscode/launch.json b/.vscode/launch.json index 294429bcb..53632f8d2 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -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", diff --git a/.vscode/tasks.json b/.vscode/tasks.json index e40d9d054..5b0636368 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -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", diff --git a/binary/build.js b/binary/build.js index b67afb94f..c2431333c 100644 --- a/binary/build.js +++ b/binary/build.js @@ -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} - */ -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); })(); diff --git a/binary/package-lock.json b/binary/package-lock.json index ead2d8b83..11eaadc8a 100644 --- a/binary/package-lock.json +++ b/binary/package-lock.json @@ -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" diff --git a/binary/utils/bundle-binary.js b/binary/utils/bundle-binary.js new file mode 100644 index 000000000..f0cde0d25 --- /dev/null +++ b/binary/utils/bundle-binary.js @@ -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, +}; diff --git a/core/autocomplete/constants/AutocompleteLanguageInfo.ts b/core/autocomplete/constants/AutocompleteLanguageInfo.ts index 82b169677..1fdbd3e86 100644 --- a/core/autocomplete/constants/AutocompleteLanguageInfo.ts +++ b/core/autocomplete/constants/AutocompleteLanguageInfo.ts @@ -6,12 +6,36 @@ import { } from "../filtering/streamTransforms/lineStream"; export interface AutocompleteLanguageInfo { + /** + * The display name of the language + */ name: string; + /** + * Keywords that show up at the top-level of files. We often use these as stop words or soft breaks + */ topLevelKeywords: string[]; + /** + * The character that prefixes a single line comment + * We use this to format snippets from other files as large comment blocks + */ singleLineComment?: string; + /** + * Semi-colon or other end of line indicator that may be used as a stop char + * or other parsing + */ endOfLine: string[]; + /** + * Strings that indicate we should filter out a line from completion + * Primarily currently used for .ipynb files + */ lineFilters?: LineFilter[]; + /** + * Similar to line filters, but characters. I think. + */ charFilters?: CharacterFilter[]; + /** + * Function that allows cusotmization of whether to use a multi-line completion on a per-language and completion basis + */ useMultiline?: (args: { prefix: string; suffix: string }) => boolean; } @@ -23,6 +47,14 @@ export const Typescript = { endOfLine: [";"], }; +// JavaScript +export const JavaScript = { + name: "JavaScript", + topLevelKeywords: ["function", "class", "module", "export", "import"], + singleLineComment: "//", + endOfLine: [";"], +}; + // Python export const Python = { name: "Python", @@ -336,7 +368,7 @@ export const Markdown: AutocompleteLanguageInfo = { export const LANGUAGES: { [extension: string]: AutocompleteLanguageInfo } = { ts: Typescript, - js: Typescript, + js: JavaScript, tsx: Typescript, json: Json, jsx: Typescript, diff --git a/core/autocomplete/context/ContextRetrievalService.ts b/core/autocomplete/context/ContextRetrievalService.ts index 72e061fed..f521d292a 100644 --- a/core/autocomplete/context/ContextRetrievalService.ts +++ b/core/autocomplete/context/ContextRetrievalService.ts @@ -70,4 +70,20 @@ export class ContextRetrievalService { helper.treePath, ); } + + /** + * Initialize the import definitions cache for a file. + * This is normally done automatically when the active text editor changes, + * but needs to be called manually when using context fetching outside the normal flow. + */ + public async initializeForFile(filepath: string): Promise { + try { + await (this.importDefinitionsService as any).cache.initKey(filepath); + } catch (e) { + console.warn( + `Failed to initialize import definitions cache for ${filepath}:`, + e, + ); + } + } } diff --git a/core/autocomplete/snippets/getAllSnippets.ts b/core/autocomplete/snippets/getAllSnippets.ts index 9194bccc8..702356198 100644 --- a/core/autocomplete/snippets/getAllSnippets.ts +++ b/core/autocomplete/snippets/getAllSnippets.ts @@ -209,3 +209,47 @@ export const getAllSnippets = async ({ recentlyOpenedFileSnippets, }; }; + +export const getAllSnippetsWithoutRace = async ({ + helper, + ide, + getDefinitionsFromLsp, + contextRetrievalService, +}: { + helper: HelperVars; + ide: IDE; + getDefinitionsFromLsp: GetLspDefinitionsFunction; + contextRetrievalService: ContextRetrievalService; +}): Promise => { + const recentlyEditedRangeSnippets = + getSnippetsFromRecentlyEditedRanges(helper); + + const [ + rootPathSnippets, + importDefinitionSnippets, + ideSnippets, + diffSnippets, + clipboardSnippets, + recentlyOpenedFileSnippets, + ] = await Promise.all([ + contextRetrievalService.getRootPathSnippets(helper), + contextRetrievalService.getSnippetsFromImportDefinitions(helper), + IDE_SNIPPETS_ENABLED + ? getIdeSnippets(helper, ide, getDefinitionsFromLsp) + : [], + [], // racePromise(getDiffSnippets(ide)) // temporarily disabled, see https://github.com/continuedev/continue/pull/5882, + getClipboardSnippets(ide), + getSnippetsFromRecentlyOpenedFiles(helper, ide), + ]); + + return { + rootPathSnippets, + importDefinitionSnippets, + ideSnippets, + recentlyEditedRangeSnippets, + diffSnippets, + clipboardSnippets, + recentlyVisitedRangesSnippets: helper.input.recentlyVisitedRanges, + recentlyOpenedFileSnippets, + }; +}; diff --git a/core/codeRenderer/CodeRenderer.ts b/core/codeRenderer/CodeRenderer.ts new file mode 100644 index 000000000..3d4084f7a --- /dev/null +++ b/core/codeRenderer/CodeRenderer.ts @@ -0,0 +1,272 @@ +/** + * CodeRenderer is a class that, when given a code string, + * highlights the code string using shiki and + * returns a svg representation of it. + * We could technically just call shiki's methods to do a + * one-liner syntax highlighting code, but + * a separate class for this is useful because + * we rarely ever need syntax highlighting outside of + * creating a render of it. + */ +import { JSDOM } from "jsdom"; +import { BundledTheme, codeToHtml, getSingletonHighlighter } from "shiki"; +import { escapeForSVG, kebabOfStr } from "../util/text"; + +interface CodeRendererOptions { + themesDir?: string; + theme?: string; +} + +interface HTMLOptions { + theme?: string; + customCSS?: string; + containerClass?: string; +} + +interface ConversionOptions extends HTMLOptions { + transparent?: boolean; + imageType: "svg"; +} + +interface Dimensions { + width: number; + height: number; +} + +type DataUri = PngUri | SvgUri; +type PngUri = string; +type SvgUri = string; + +export class CodeRenderer { + private static instance: CodeRenderer; + private currentTheme: string = "dark-plus"; + private editorBackground: string = "#000000"; + private editorForeground: string = "#FFFFFF"; + + private constructor() {} + + static getInstance(): CodeRenderer { + if (!CodeRenderer.instance) { + CodeRenderer.instance = new CodeRenderer(); + } + return CodeRenderer.instance; + } + + public async setTheme(themeName: string): Promise { + if ( + this.themeExists(kebabOfStr(themeName)) || + themeName === "Default Dark Modern" + ) { + this.currentTheme = + themeName === "Default Dark Modern" + ? "dark-plus" + : kebabOfStr(themeName); + + const highlighter = await getSingletonHighlighter({ + themes: [this.currentTheme], + }); + + const th = highlighter.getTheme(this.currentTheme); + this.editorBackground = th.bg; + this.editorForeground = th.fg; + } else { + this.currentTheme = "dark-plus"; + } + } + + async init(): Promise {} + + async close(): Promise {} + + themeExists(themeNameKebab: string): themeNameKebab is BundledTheme { + const themeArray: BundledTheme[] = [ + "andromeeda", + "aurora-x", + "ayu-dark", + "catppuccin-frappe", + "catppuccin-latte", + "catppuccin-macchiato", + "catppuccin-mocha", + "dark-plus", + "dracula", + "dracula-soft", + "everforest-dark", + "everforest-light", + "github-dark", + "github-dark-default", + "github-dark-dimmed", + "github-dark-high-contrast", + "github-light", + "github-light-default", + "github-light-high-contrast", + "gruvbox-dark-hard", + "gruvbox-dark-medium", + "gruvbox-dark-soft", + "gruvbox-light-hard", + "gruvbox-light-medium", + "gruvbox-light-soft", + "houston", + "kanagawa-dragon", + "kanagawa-lotus", + "kanagawa-wave", + "laserwave", + "light-plus", + "material-theme", + "material-theme-darker", + "material-theme-lighter", + "material-theme-ocean", + "material-theme-palenight", + "min-dark", + "min-light", + "monokai", + "night-owl", + "nord", + "one-dark-pro", + "one-light", + "plastic", + "poimandres", + "red", + "rose-pine", + "rose-pine-dawn", + "rose-pine-moon", + "slack-dark", + "slack-ochin", + "snazzy-light", + "solarized-dark", + "solarized-light", + "synthwave-84", + "tokyo-night", + "vesper", + "vitesse-black", + "vitesse-dark", + "vitesse-light", + ]; + + return themeArray.includes(themeNameKebab as BundledTheme); + } + + async highlightCode( + code: string, + language: string = "javascript", + ): Promise { + return await codeToHtml(code, { + lang: language, + theme: this.currentTheme, + }); + } + + async convertToSVG( + code: string, + language: string = "javascript", + fontSize: number, + fontFamily: string, + dimensions: Dimensions, + lineHeight: number, + options: ConversionOptions, + ): Promise { + const highlightedCodeHtml = await this.highlightCode(code, language); + + const guts = this.convertShikiHtmlToSvgGut( + highlightedCodeHtml, + fontSize, + fontFamily, + lineHeight, + ); + const backgroundColor = this.getBackgroundColor(highlightedCodeHtml); + + const svg = ` + + + ${guts} + +`; + + return Buffer.from(svg, "utf8"); + } + + convertShikiHtmlToSvgGut( + shikiHtml: string, + fontSize: number, + fontFamily: string, + lineHeight: number, + ): string { + const dom = new JSDOM(shikiHtml); + const document = dom.window.document; + + const lines = Array.from(document.querySelectorAll(".line")); + const svgLines = lines.map((line, index) => { + const spans = Array.from(line.childNodes) + .map((node) => { + if (node.nodeType === 3) { + return `${escapeForSVG(node.textContent ?? "")}`; + } + + const el = node as HTMLElement; + const style = el.getAttribute("style") || ""; + const colorMatch = style.match(/color:\s*(#[0-9a-fA-F]{6})/); + const fill = colorMatch ? ` fill="${colorMatch[1]}"` : ""; + const content = el.textContent || ""; + return `${escapeForSVG(content)}`; + }) + .join(""); + + const y = (index + 1) * lineHeight; + return `${spans}`; + }); + + return ` + ${svgLines.join("\n")} + `.trim(); + } + + getBackgroundColor(shikiHtml: string): string { + const dom = new JSDOM(shikiHtml); + const document = dom.window.document; + + const preElement = document.querySelector("pre"); + let backgroundColor = "#333333"; // Default white background + if (preElement) { + const style = preElement.getAttribute("style") || ""; + const bgColorMatch = style.match(/background-color:\s*(#[0-9a-fA-F]{6})/); + if (bgColorMatch) { + backgroundColor = bgColorMatch[1]; + } + } + + return backgroundColor; + } + + async getDataUri( + code: string, + language: string = "javascript", + fontSize: number, + fontFamily: string, + dimensions: Dimensions, + lineHeight: number, + options: ConversionOptions, + ): Promise { + switch (options.imageType) { + // case "png": + // const pngBuffer = await this.convertToPNG( + // code, + // language, + // fontSize, + // dimensions, + // lineHeight, + // options, + // ); + // return `data:image/png;base64,${pngBuffer.data.toString("base64")}`; + case "svg": + const svgBuffer = await this.convertToSVG( + code, + language, + fontSize, + fontFamily, + dimensions, + lineHeight, + options, + ); + return `data:image/svg+xml;base64,${svgBuffer.toString("base64")}`; + } + } +} diff --git a/core/commands/index.ts b/core/commands/index.ts deleted file mode 100644 index d87a3536f..000000000 --- a/core/commands/index.ts +++ /dev/null @@ -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, - }; -} diff --git a/core/commands/slash/cmd.ts b/core/commands/slash/built-in-legacy/cmd.ts similarity index 91% rename from core/commands/slash/cmd.ts rename to core/commands/slash/built-in-legacy/cmd.ts index 7b93d2fa3..5cd96e365 100644 --- a/core/commands/slash/cmd.ts +++ b/core/commands/slash/built-in-legacy/cmd.ts @@ -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 ( diff --git a/core/commands/slash/commit.ts b/core/commands/slash/built-in-legacy/commit.ts similarity index 89% rename from core/commands/slash/commit.ts rename to core/commands/slash/built-in-legacy/commit.ts index 55499b583..1f7e71343 100644 --- a/core/commands/slash/commit.ts +++ b/core/commands/slash/built-in-legacy/commit.ts @@ -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", diff --git a/core/commands/slash/draftIssue.ts b/core/commands/slash/built-in-legacy/draftIssue.ts similarity index 91% rename from core/commands/slash/draftIssue.ts rename to core/commands/slash/built-in-legacy/draftIssue.ts index fba5d4cd3..9a1c5bdf9 100644 --- a/core/commands/slash/draftIssue.ts +++ b/core/commands/slash/built-in-legacy/draftIssue.ts @@ -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, diff --git a/core/commands/slash/http.ts b/core/commands/slash/built-in-legacy/http.ts similarity index 87% rename from core/commands/slash/http.ts rename to core/commands/slash/built-in-legacy/http.ts index e92c7c3f1..3141dcc11 100644 --- a/core/commands/slash/http.ts +++ b/core/commands/slash/built-in-legacy/http.ts @@ -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", diff --git a/core/commands/slash/built-in-legacy/index.ts b/core/commands/slash/built-in-legacy/index.ts new file mode 100644 index 000000000..3e57f67a6 --- /dev/null +++ b/core/commands/slash/built-in-legacy/index.ts @@ -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", + }; +} diff --git a/core/commands/slash/onboard.ts b/core/commands/slash/built-in-legacy/onboard.ts similarity index 96% rename from core/commands/slash/onboard.ts rename to core/commands/slash/built-in-legacy/onboard.ts index 545b75cc2..969ebc0c4 100644 --- a/core/commands/slash/onboard.ts +++ b/core/commands/slash/built-in-legacy/onboard.ts @@ -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) diff --git a/core/commands/slash/review.ts b/core/commands/slash/built-in-legacy/review.ts similarity index 93% rename from core/commands/slash/review.ts rename to core/commands/slash/built-in-legacy/review.ts index 6190f5499..37c280b34 100644 --- a/core/commands/slash/review.ts +++ b/core/commands/slash/built-in-legacy/review.ts @@ -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: diff --git a/core/commands/slash/share.ts b/core/commands/slash/built-in-legacy/share.ts similarity index 92% rename from core/commands/slash/share.ts rename to core/commands/slash/built-in-legacy/share.ts index 01d5bea96..daddf8dff 100644 --- a/core/commands/slash/share.ts +++ b/core/commands/slash/built-in-legacy/share.ts @@ -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 { diff --git a/core/commands/slash/customSlashCommand.ts b/core/commands/slash/customSlashCommand.ts new file mode 100644 index 000000000..c27a41f4c --- /dev/null +++ b/core/commands/slash/customSlashCommand.ts @@ -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", + }; +} diff --git a/core/commands/slash/index.ts b/core/commands/slash/index.ts deleted file mode 100644 index 18008e251..000000000 --- a/core/commands/slash/index.ts +++ /dev/null @@ -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, -]; diff --git a/core/commands/slash/mcp.ts b/core/commands/slash/mcp.ts deleted file mode 100644 index 89af5c5c2..000000000 --- a/core/commands/slash/mcp.ts +++ /dev/null @@ -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); - } - }, - }; -} diff --git a/core/commands/slash/mcpSlashCommand.ts b/core/commands/slash/mcpSlashCommand.ts new file mode 100644 index 000000000..d9c1278ff --- /dev/null +++ b/core/commands/slash/mcpSlashCommand.ts @@ -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>, +): 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; +} diff --git a/core/commands/slash/promptBlockSlashCommand.ts b/core/commands/slash/promptBlockSlashCommand.ts new file mode 100644 index 000000000..00530b8bd --- /dev/null +++ b/core/commands/slash/promptBlockSlashCommand.ts @@ -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", + }; +} diff --git a/core/commands/slash/promptFileSlashCommand.ts b/core/commands/slash/promptFileSlashCommand.ts new file mode 100644 index 000000000..e076086c0 --- /dev/null +++ b/core/commands/slash/promptFileSlashCommand.ts @@ -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, + }; +} diff --git a/core/commands/util.ts b/core/commands/util.ts index 3785b4f52..ce234919f 100644 --- a/core/commands/util.ts +++ b/core/commands/util.ts @@ -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(), diff --git a/core/commands/util.test.ts b/core/commands/util.vitest.ts similarity index 98% rename from core/commands/util.test.ts rename to core/commands/util.vitest.ts index 447ec0e60..656903aa5 100644 --- a/core/commands/util.test.ts +++ b/core/commands/util.vitest.ts @@ -1,5 +1,6 @@ -import { ctxItemToRifWithContents } from "./util"; +import { describe, expect, it } from "vitest"; import { ContextItemWithId, RangeInFileWithContents } from "../index"; +import { ctxItemToRifWithContents } from "./util"; describe("ctxItemToRifWithContents", () => { it("should parse start and end lines from the item name when format is valid", () => { diff --git a/core/config/ConfigHandler.test.ts b/core/config/ConfigHandler.vitest.ts similarity index 89% rename from core/config/ConfigHandler.test.ts rename to core/config/ConfigHandler.vitest.ts index 4b4be0762..5af9d6bb8 100644 --- a/core/config/ConfigHandler.test.ts +++ b/core/config/ConfigHandler.vitest.ts @@ -1,6 +1,7 @@ import fs from "node:fs"; import path from "node:path"; +import { describe, expect, test } from "vitest"; import { testConfigHandler } from "../test/fixtures"; import { TEST_DIR } from "../test/testDir"; import { getConfigTsPath } from "../util/paths"; @@ -24,7 +25,7 @@ describe.skip("Test the ConfigHandler and E2E config loading", () => { ); }); - test.skip("should add a system message from config.ts", async () => { + test("should add a system message from config.ts", async () => { const configTs = `export function modifyConfig(config: Config): Config { config.systemMessage = "SYSTEM"; return config; @@ -39,7 +40,7 @@ describe.skip("Test the ConfigHandler and E2E config loading", () => { expect(config.systemMessage).toBe("SYSTEM"); }); - test.skip("should acknowledge override from .continuerc.json", async () => { + test("should acknowledge override from .continuerc.json", async () => { fs.writeFileSync( path.join(TEST_DIR, ".continuerc.json"), JSON.stringify({ systemMessage: "SYSTEM2" }), diff --git a/core/config/load.ts b/core/config/load.ts index fe0c4de61..3504cd8d5 100644 --- a/core/config/load.ts +++ b/core/config/load.ts @@ -30,14 +30,12 @@ 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"; import CustomContextProviderClass from "../context/providers/CustomContextProvider"; import FileContextProvider from "../context/providers/FileContextProvider"; @@ -48,8 +46,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 +63,7 @@ import { import { localPathToUri } from "../util/pathToUri"; import { baseToolDefinitions } from "../tools"; +import { resolveRelativePathInDir } from "../util/ideUtils"; import { modifyAnyConfigWithSharedConfig } from "./sharedConfig"; import { getModelByRole, @@ -174,15 +172,15 @@ async function serializedToIntermediateConfig( ide: IDE, ): Promise { // 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 +192,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 +252,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 +264,7 @@ async function intermediateToFinalConfig({ const llm = await llmFromDescription( desc, ide.readFile.bind(ide), + getUriFromPath, uniqueId, ideSettings, llmLogger, @@ -284,6 +286,7 @@ async function intermediateToFinalConfig({ title: modelName, }, ide.readFile.bind(ide), + getUriFromPath, uniqueId, ideSettings, llmLogger, @@ -360,6 +363,7 @@ async function intermediateToFinalConfig({ const llm = await llmFromDescription( desc, ide.readFile.bind(ide), + getUriFromPath, uniqueId, ideSettings, llmLogger, @@ -393,13 +397,7 @@ async function intermediateToFinalConfig({ | undefined )?.params || {}; - const DEFAULT_CONTEXT_PROVIDERS = [ - new FileContextProvider({}), - // Add codebase provider if indexing is enabled - ...(!config.disableIndexing - ? [new CodebaseContextProvider(codebaseContextParams)] - : []), - ]; + const DEFAULT_CONTEXT_PROVIDERS = [new FileContextProvider({})]; const DEFAULT_CONTEXT_PROVIDERS_TITLES = DEFAULT_CONTEXT_PROVIDERS.map( ({ description: { title } }) => title, @@ -529,7 +527,7 @@ async function intermediateToFinalConfig({ contextProviders, tools: [...baseToolDefinitions], mcpServerStatuses: [], - slashCommands: config.slashCommands ?? [], + slashCommands: [], modelsByRole: { chat: models, edit: models, @@ -551,6 +549,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 +660,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 +985,6 @@ async function loadContinueConfigFromJson( export { finalToBrowserConfig, - intermediateToFinalConfig, loadContinueConfigFromJson, type BrowserSerializedContinueConfig, }; diff --git a/core/config/loadLocalAssistants.test.ts b/core/config/loadLocalAssistants.vitest.ts similarity index 99% rename from core/config/loadLocalAssistants.test.ts rename to core/config/loadLocalAssistants.vitest.ts index 2865a5b34..a366316d4 100644 --- a/core/config/loadLocalAssistants.test.ts +++ b/core/config/loadLocalAssistants.vitest.ts @@ -1,3 +1,4 @@ +import { afterEach, beforeEach, describe, expect, it } from "vitest"; import { walkDirCache } from "../indexing/walkDir"; import { testIde } from "../test/fixtures"; import { addToTestDir, setUpTestDir, tearDownTestDir } from "../test/testDir"; diff --git a/core/config/profile/doLoadConfig.ts b/core/config/profile/doLoadConfig.ts index 7685546c9..bd142a895 100644 --- a/core/config/profile/doLoadConfig.ts +++ b/core/config/profile/doLoadConfig.ts @@ -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 @@ -229,6 +230,8 @@ export default async function doLoadConfig(options: { newConfig.tools.push( ...getConfigDependentToolDefinitions({ rules: newConfig.rules, + enableExperimentalTools: + newConfig.experimental?.enableExperimentalTools ?? false, }), ); diff --git a/core/config/sharedConfig.ts b/core/config/sharedConfig.ts index 439925188..9fb8da4e5 100644 --- a/core/config/sharedConfig.ts +++ b/core/config/sharedConfig.ts @@ -19,6 +19,9 @@ export const sharedConfigSchema = z readResponseTTS: z.boolean(), promptPath: z.string(), useCurrentFileAsContext: z.boolean(), + logEditingData: z.boolean(), + optInNextEditFeature: z.boolean(), + enableExperimentalTools: z.boolean(), // `ui` in `ContinueConfig` showSessionTabs: z.boolean(), @@ -157,6 +160,12 @@ export function modifyAnyConfigWithSharedConfig< configCopy.experimental = { ...configCopy.experimental, }; + + if (sharedConfig.enableExperimentalTools !== undefined) { + configCopy.experimental.enableExperimentalTools = + sharedConfig.enableExperimentalTools; + } + if (sharedConfig.promptPath !== undefined) { configCopy.experimental.promptPath = sharedConfig.promptPath; } @@ -171,6 +180,13 @@ export function modifyAnyConfigWithSharedConfig< configCopy.experimental.useCurrentFileAsContext = sharedConfig.useCurrentFileAsContext; } + if (sharedConfig.logEditingData !== undefined) { + configCopy.experimental.logEditingData = sharedConfig.logEditingData; + } + if (sharedConfig.optInNextEditFeature !== undefined) { + configCopy.experimental.optInNextEditFeature = + sharedConfig.optInNextEditFeature; + } return configCopy; } diff --git a/core/config/usesFreeTrialApiKey.test.ts b/core/config/usesFreeTrialApiKey.test.ts deleted file mode 100644 index 8e8727084..000000000 --- a/core/config/usesFreeTrialApiKey.test.ts +++ /dev/null @@ -1,344 +0,0 @@ -import { jest } from "@jest/globals"; -import { BrowserSerializedContinueConfig } from ".."; - -// Create the mock before importing anything else -const mockDecodeSecretLocation = jest.fn(); - -// Mock the module -jest.unstable_mockModule("@continuedev/config-yaml", () => ({ - SecretType: { - User: "user", - Organization: "organization", - FreeTrial: "free_trial", - }, - decodeSecretLocation: mockDecodeSecretLocation, -})); - -// Import after mocking -const { usesFreeTrialApiKey } = await import("./usesFreeTrialApiKey"); -const { SecretType } = await import("@continuedev/config-yaml"); - -beforeEach(() => { - mockDecodeSecretLocation.mockReset(); -}); - -test("usesFreeTrialApiKey should return false when config is null", () => { - const result = usesFreeTrialApiKey(null); - expect(result).toBe(false); -}); - -test("usesFreeTrialApiKey should return false when config is undefined", () => { - const result = usesFreeTrialApiKey(undefined as any); - expect(result).toBe(false); -}); - -test("usesFreeTrialApiKey should return false when no models have apiKeyLocation", () => { - const config: BrowserSerializedContinueConfig = { - modelsByRole: { - chat: [ - { - title: "Model 1", - provider: "test", - model: "test-model", - underlyingProviderName: "test", - }, - { - title: "Model 2", - provider: "test", - model: "test-model-2", - underlyingProviderName: "test", - }, - ], - edit: [], - apply: [], - summarize: [], - autocomplete: [], - rerank: [], - embed: [], - }, - selectedModelByRole: { - chat: null, - edit: null, - apply: null, - summarize: null, - autocomplete: null, - rerank: null, - embed: null, - }, - contextProviders: [], - slashCommands: [], - tools: [], - mcpServerStatuses: [], - usePlatform: false, - rules: [], - }; - - const result = usesFreeTrialApiKey(config); - expect(result).toBe(false); -}); - -test("usesFreeTrialApiKey should return false when models have apiKeyLocation but none are free trial", () => { - const config: BrowserSerializedContinueConfig = { - modelsByRole: { - chat: [ - { - title: "Model 1", - provider: "test", - model: "test-model", - apiKeyLocation: "user:testuser/api-key", - underlyingProviderName: "test", - }, - ], - edit: [ - { - title: "Model 2", - provider: "test", - model: "test-model-2", - apiKeyLocation: "organization:testorg/api-key", - underlyingProviderName: "test", - }, - ], - apply: [], - summarize: [], - autocomplete: [], - rerank: [], - embed: [], - }, - selectedModelByRole: { - chat: null, - edit: null, - apply: null, - summarize: null, - autocomplete: null, - rerank: null, - embed: null, - }, - contextProviders: [], - slashCommands: [], - tools: [], - mcpServerStatuses: [], - usePlatform: false, - rules: [], - }; - - mockDecodeSecretLocation - .mockReturnValueOnce({ - secretType: SecretType.User, - userSlug: "testuser", - secretName: "api-key", - }) - .mockReturnValueOnce({ - secretType: SecretType.Organization, - orgSlug: "testorg", - secretName: "api-key", - }); - - const result = usesFreeTrialApiKey(config); - expect(result).toBe(false); - expect(mockDecodeSecretLocation).toHaveBeenCalledTimes(2); -}); - -test("usesFreeTrialApiKey should return true when at least one model uses free trial API key", () => { - const config: BrowserSerializedContinueConfig = { - modelsByRole: { - chat: [ - { - title: "Model 1", - provider: "test", - model: "test-model", - apiKeyLocation: "user:testuser/api-key", - underlyingProviderName: "test", - }, - { - title: "Free Trial Model", - provider: "test", - model: "free-trial-model", - apiKeyLocation: "free_trial:owner/package/api-key", - underlyingProviderName: "test", - }, - ], - edit: [], - apply: [], - summarize: [], - autocomplete: [], - rerank: [], - embed: [], - }, - selectedModelByRole: { - chat: null, - edit: null, - apply: null, - summarize: null, - autocomplete: null, - rerank: null, - embed: null, - }, - contextProviders: [], - slashCommands: [], - tools: [], - mcpServerStatuses: [], - usePlatform: false, - rules: [], - }; - - mockDecodeSecretLocation - .mockReturnValueOnce({ - secretType: SecretType.User, - userSlug: "testuser", - secretName: "api-key", - }) - .mockReturnValueOnce({ - secretType: SecretType.FreeTrial, - blockSlug: { ownerSlug: "owner", packageSlug: "package" }, - secretName: "api-key", - }); - - const result = usesFreeTrialApiKey(config); - expect(result).toBe(true); - expect(mockDecodeSecretLocation).toHaveBeenCalledTimes(2); -}); - -test("usesFreeTrialApiKey should return true when free trial model is in a different role", () => { - const config: BrowserSerializedContinueConfig = { - modelsByRole: { - chat: [ - { - title: "Model 1", - provider: "test", - model: "test-model", - apiKeyLocation: "user:testuser/api-key", - underlyingProviderName: "test", - }, - ], - edit: [ - { - title: "Free Trial Edit Model", - provider: "test", - model: "free-trial-edit-model", - apiKeyLocation: "free_trial:owner/package/api-key", - underlyingProviderName: "test", - }, - ], - apply: [], - summarize: [], - autocomplete: [], - rerank: [], - embed: [], - }, - selectedModelByRole: { - chat: null, - edit: null, - apply: null, - summarize: null, - autocomplete: null, - rerank: null, - embed: null, - }, - contextProviders: [], - slashCommands: [], - tools: [], - mcpServerStatuses: [], - usePlatform: false, - rules: [], - }; - - mockDecodeSecretLocation - .mockReturnValueOnce({ - secretType: SecretType.User, - userSlug: "testuser", - secretName: "api-key", - }) - .mockReturnValueOnce({ - secretType: SecretType.FreeTrial, - blockSlug: { ownerSlug: "owner", packageSlug: "package" }, - secretName: "api-key", - }); - - const result = usesFreeTrialApiKey(config); - expect(result).toBe(true); -}); - -test("usesFreeTrialApiKey should return false and log error when decodeSecretLocation throws", () => { - const consoleSpy = jest.spyOn(console, "error").mockImplementation(() => {}); - - const config: BrowserSerializedContinueConfig = { - modelsByRole: { - chat: [ - { - title: "Model 1", - provider: "test", - model: "test-model", - apiKeyLocation: "invalid-secret-location", - underlyingProviderName: "test", - }, - ], - edit: [], - apply: [], - summarize: [], - autocomplete: [], - rerank: [], - embed: [], - }, - selectedModelByRole: { - chat: null, - edit: null, - apply: null, - summarize: null, - autocomplete: null, - rerank: null, - embed: null, - }, - contextProviders: [], - slashCommands: [], - tools: [], - mcpServerStatuses: [], - usePlatform: false, - rules: [], - }; - - mockDecodeSecretLocation.mockImplementation(() => { - throw new Error("Invalid secret location format"); - }); - - const result = usesFreeTrialApiKey(config); - expect(result).toBe(false); - expect(consoleSpy).toHaveBeenCalledWith( - "Error checking for free trial API key:", - expect.any(Error), - ); - - consoleSpy.mockRestore(); -}); - -test("usesFreeTrialApiKey should handle empty modelsByRole object", () => { - const config: BrowserSerializedContinueConfig = { - modelsByRole: { - chat: [], - edit: [], - apply: [], - summarize: [], - autocomplete: [], - rerank: [], - embed: [], - }, - selectedModelByRole: { - chat: null, - edit: null, - apply: null, - summarize: null, - autocomplete: null, - rerank: null, - embed: null, - }, - contextProviders: [], - slashCommands: [], - tools: [], - mcpServerStatuses: [], - usePlatform: false, - rules: [], - }; - - const result = usesFreeTrialApiKey(config); - expect(result).toBe(false); - expect(mockDecodeSecretLocation).not.toHaveBeenCalled(); -}); diff --git a/core/config/usesFreeTrialApiKey.vitest.ts b/core/config/usesFreeTrialApiKey.vitest.ts new file mode 100644 index 000000000..b92dd90a2 --- /dev/null +++ b/core/config/usesFreeTrialApiKey.vitest.ts @@ -0,0 +1,348 @@ +import { beforeEach, describe, expect, test, vi } from "vitest"; +import { BrowserSerializedContinueConfig } from ".."; + +// Create the mock before importing anything else +const mockDecodeSecretLocation = vi.fn(); + +// Mock the module +vi.mock("@continuedev/config-yaml", () => ({ + SecretType: { + User: "user", + Organization: "organization", + FreeTrial: "free_trial", + }, + decodeSecretLocation: mockDecodeSecretLocation, +})); + +describe("usesFreeTrialApiKey", () => { + let usesFreeTrialApiKey: typeof import("./usesFreeTrialApiKey").usesFreeTrialApiKey; + let SecretType: typeof import("@continuedev/config-yaml").SecretType; + + beforeEach(async () => { + mockDecodeSecretLocation.mockReset(); + usesFreeTrialApiKey = (await import("./usesFreeTrialApiKey")) + .usesFreeTrialApiKey; + SecretType = (await import("@continuedev/config-yaml")).SecretType; + }); + + test("usesFreeTrialApiKey should return false when config is null", () => { + const result = usesFreeTrialApiKey(null); + expect(result).toBe(false); + }); + + test("usesFreeTrialApiKey should return false when config is undefined", () => { + const result = usesFreeTrialApiKey(undefined as any); + expect(result).toBe(false); + }); + + test("usesFreeTrialApiKey should return false when no models have apiKeyLocation", () => { + const config: BrowserSerializedContinueConfig = { + modelsByRole: { + chat: [ + { + title: "Model 1", + provider: "test", + model: "test-model", + underlyingProviderName: "test", + }, + { + title: "Model 2", + provider: "test", + model: "test-model-2", + underlyingProviderName: "test", + }, + ], + edit: [], + apply: [], + summarize: [], + autocomplete: [], + rerank: [], + embed: [], + }, + selectedModelByRole: { + chat: null, + edit: null, + apply: null, + summarize: null, + autocomplete: null, + rerank: null, + embed: null, + }, + contextProviders: [], + slashCommands: [], + tools: [], + mcpServerStatuses: [], + usePlatform: false, + rules: [], + }; + + const result = usesFreeTrialApiKey(config); + expect(result).toBe(false); + }); + + test("usesFreeTrialApiKey should return false when models have apiKeyLocation but none are free trial", () => { + const config: BrowserSerializedContinueConfig = { + modelsByRole: { + chat: [ + { + title: "Model 1", + provider: "test", + model: "test-model", + apiKeyLocation: "user:testuser/api-key", + underlyingProviderName: "test", + }, + ], + edit: [ + { + title: "Model 2", + provider: "test", + model: "test-model-2", + apiKeyLocation: "organization:testorg/api-key", + underlyingProviderName: "test", + }, + ], + apply: [], + summarize: [], + autocomplete: [], + rerank: [], + embed: [], + }, + selectedModelByRole: { + chat: null, + edit: null, + apply: null, + summarize: null, + autocomplete: null, + rerank: null, + embed: null, + }, + contextProviders: [], + slashCommands: [], + tools: [], + mcpServerStatuses: [], + usePlatform: false, + rules: [], + }; + + mockDecodeSecretLocation + .mockReturnValueOnce({ + secretType: SecretType.User, + userSlug: "testuser", + secretName: "api-key", + }) + .mockReturnValueOnce({ + secretType: SecretType.Organization, + orgSlug: "testorg", + secretName: "api-key", + }); + + const result = usesFreeTrialApiKey(config); + expect(result).toBe(false); + expect(mockDecodeSecretLocation).toHaveBeenCalledTimes(2); + }); + + test("usesFreeTrialApiKey should return true when at least one model uses free trial API key", () => { + const config: BrowserSerializedContinueConfig = { + modelsByRole: { + chat: [ + { + title: "Model 1", + provider: "test", + model: "test-model", + apiKeyLocation: "user:testuser/api-key", + underlyingProviderName: "test", + }, + { + title: "Free Trial Model", + provider: "test", + model: "free-trial-model", + apiKeyLocation: "free_trial:owner/package/api-key", + underlyingProviderName: "test", + }, + ], + edit: [], + apply: [], + summarize: [], + autocomplete: [], + rerank: [], + embed: [], + }, + selectedModelByRole: { + chat: null, + edit: null, + apply: null, + summarize: null, + autocomplete: null, + rerank: null, + embed: null, + }, + contextProviders: [], + slashCommands: [], + tools: [], + mcpServerStatuses: [], + usePlatform: false, + rules: [], + }; + + mockDecodeSecretLocation + .mockReturnValueOnce({ + secretType: SecretType.User, + userSlug: "testuser", + secretName: "api-key", + }) + .mockReturnValueOnce({ + secretType: SecretType.FreeTrial, + blockSlug: { ownerSlug: "owner", packageSlug: "package" }, + secretName: "api-key", + }); + + const result = usesFreeTrialApiKey(config); + expect(result).toBe(true); + expect(mockDecodeSecretLocation).toHaveBeenCalledTimes(2); + }); + + test("usesFreeTrialApiKey should return true when free trial model is in a different role", () => { + const config: BrowserSerializedContinueConfig = { + modelsByRole: { + chat: [ + { + title: "Model 1", + provider: "test", + model: "test-model", + apiKeyLocation: "user:testuser/api-key", + underlyingProviderName: "test", + }, + ], + edit: [ + { + title: "Free Trial Edit Model", + provider: "test", + model: "free-trial-edit-model", + apiKeyLocation: "free_trial:owner/package/api-key", + underlyingProviderName: "test", + }, + ], + apply: [], + summarize: [], + autocomplete: [], + rerank: [], + embed: [], + }, + selectedModelByRole: { + chat: null, + edit: null, + apply: null, + summarize: null, + autocomplete: null, + rerank: null, + embed: null, + }, + contextProviders: [], + slashCommands: [], + tools: [], + mcpServerStatuses: [], + usePlatform: false, + rules: [], + }; + + mockDecodeSecretLocation + .mockReturnValueOnce({ + secretType: SecretType.User, + userSlug: "testuser", + secretName: "api-key", + }) + .mockReturnValueOnce({ + secretType: SecretType.FreeTrial, + blockSlug: { ownerSlug: "owner", packageSlug: "package" }, + secretName: "api-key", + }); + + const result = usesFreeTrialApiKey(config); + expect(result).toBe(true); + }); + + test("usesFreeTrialApiKey should return false and log error when decodeSecretLocation throws", () => { + const consoleSpy = vi.spyOn(console, "error").mockImplementation(() => {}); + + const config: BrowserSerializedContinueConfig = { + modelsByRole: { + chat: [ + { + title: "Model 1", + provider: "test", + model: "test-model", + apiKeyLocation: "invalid-secret-location", + underlyingProviderName: "test", + }, + ], + edit: [], + apply: [], + summarize: [], + autocomplete: [], + rerank: [], + embed: [], + }, + selectedModelByRole: { + chat: null, + edit: null, + apply: null, + summarize: null, + autocomplete: null, + rerank: null, + embed: null, + }, + contextProviders: [], + slashCommands: [], + tools: [], + mcpServerStatuses: [], + usePlatform: false, + rules: [], + }; + + mockDecodeSecretLocation.mockImplementation(() => { + throw new Error("Invalid secret location format"); + }); + + const result = usesFreeTrialApiKey(config); + expect(result).toBe(false); + expect(consoleSpy).toHaveBeenCalledWith( + "Error checking for free trial API key:", + expect.any(Error), + ); + + consoleSpy.mockRestore(); + }); + + test("usesFreeTrialApiKey should handle empty modelsByRole object", () => { + const config: BrowserSerializedContinueConfig = { + modelsByRole: { + chat: [], + edit: [], + apply: [], + summarize: [], + autocomplete: [], + rerank: [], + embed: [], + }, + selectedModelByRole: { + chat: null, + edit: null, + apply: null, + summarize: null, + autocomplete: null, + rerank: null, + embed: null, + }, + contextProviders: [], + slashCommands: [], + tools: [], + mcpServerStatuses: [], + usePlatform: false, + rules: [], + }; + + const result = usesFreeTrialApiKey(config); + expect(result).toBe(false); + expect(mockDecodeSecretLocation).not.toHaveBeenCalled(); + }); +}); diff --git a/core/config/util.test.ts b/core/config/util.vitest.ts similarity index 96% rename from core/config/util.test.ts rename to core/config/util.vitest.ts index e7de79e1b..5ea63c879 100644 --- a/core/config/util.test.ts +++ b/core/config/util.vitest.ts @@ -1,3 +1,4 @@ +import { describe, expect, it } from "vitest"; import { PromptTemplate } from ".."; import { serializePromptTemplates } from "./util"; diff --git a/core/config/workspace/workspaceBlocks.test.ts b/core/config/workspace/workspaceBlocks.vitest.ts similarity index 98% rename from core/config/workspace/workspaceBlocks.test.ts rename to core/config/workspace/workspaceBlocks.vitest.ts index 532444196..281a4d785 100644 --- a/core/config/workspace/workspaceBlocks.test.ts +++ b/core/config/workspace/workspaceBlocks.vitest.ts @@ -1,5 +1,5 @@ import { BlockType, RULE_FILE_EXTENSION } from "@continuedev/config-yaml"; -import { describe, expect, test } from "@jest/globals"; +import { describe, expect, test } from "vitest"; import { findAvailableFilename, getFileContent } from "./workspaceBlocks"; describe("getFileContent", () => { diff --git a/core/config/yaml/loadYaml.ts b/core/config/yaml/loadYaml.ts index 0c6436c38..f1546e255 100644 --- a/core/config/yaml/loadYaml.ts +++ b/core/config/yaml/loadYaml.ts @@ -25,21 +25,20 @@ 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"; 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 +186,7 @@ async function configYamlToContinueConfig(options: { const continueConfig: ContinueConfig = { slashCommands: [], - tools: [...baseToolDefinitions], + tools: await getToolsForIde(ide), mcpServerStatuses: [], contextProviders: [], modelsByRole: { @@ -263,7 +262,7 @@ async function configYamlToContinueConfig(options: { promptFiles.forEach((file) => { try { - const slashCommand = slashCommandFromPromptFileV1( + const slashCommand = slashCommandFromPromptFile( file.path, file.content, ); @@ -286,7 +285,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({ @@ -385,13 +384,7 @@ async function configYamlToContinueConfig(options: { } // Context providers - const codebaseContextParams: IContextProvider[] = - (config.context || []).find((cp) => cp.provider === "codebase")?.params || - {}; - const DEFAULT_CONTEXT_PROVIDERS = [ - new FileContextProvider({}), - new CodebaseContextProvider(codebaseContextParams), - ]; + const DEFAULT_CONTEXT_PROVIDERS = [new FileContextProvider({})]; const DEFAULT_CONTEXT_PROVIDERS_TITLES = DEFAULT_CONTEXT_PROVIDERS.map( ({ description: { title } }) => title, diff --git a/core/context/mcp/MCPConnection.test.ts b/core/context/mcp/MCPConnection.vitest.ts similarity index 94% rename from core/context/mcp/MCPConnection.test.ts rename to core/context/mcp/MCPConnection.vitest.ts index f8f146f07..7736ebec9 100644 --- a/core/context/mcp/MCPConnection.test.ts +++ b/core/context/mcp/MCPConnection.vitest.ts @@ -1,10 +1,10 @@ -import { jest } from "@jest/globals"; import { Client } from "@modelcontextprotocol/sdk/client/index.js"; +import { beforeEach, describe, expect, it, vi } from "vitest"; import MCPConnection from "./MCPConnection"; describe("MCPConnection", () => { beforeEach(() => { - jest.restoreAllMocks(); + vi.restoreAllMocks(); }); describe("constructor", () => { @@ -131,10 +131,10 @@ describe("MCPConnection", () => { it("should connect successfully", async () => { const conn = new MCPConnection(options); - const mockConnect = jest + const mockConnect = vi .spyOn(Client.prototype, "connect") .mockResolvedValue(undefined); - const mockGetServerCapabilities = jest + const mockGetServerCapabilities = vi .spyOn(Client.prototype, "getServerCapabilities") .mockReturnValue({ resources: {}, @@ -142,12 +142,12 @@ describe("MCPConnection", () => { prompts: {}, }); - const mockListResources = jest + const mockListResources = vi .spyOn(Client.prototype, "listResources") .mockResolvedValue({ resources: [{ name: "test-resource", uri: "test-uri" }], }); - const mockListTools = jest + const mockListTools = vi .spyOn(Client.prototype, "listTools") .mockResolvedValue({ tools: [ @@ -159,7 +159,7 @@ describe("MCPConnection", () => { }, ], }); - const mockListPrompts = jest + const mockListPrompts = vi .spyOn(Client.prototype, "listPrompts") .mockResolvedValue({ prompts: [{ name: "test-prompt" }] }); @@ -175,7 +175,7 @@ describe("MCPConnection", () => { it("should handle custom connection timeout", async () => { const conn = new MCPConnection({ ...options, timeout: 1500 }); - const mockConnect = jest + const mockConnect = vi .spyOn(Client.prototype, "connect") .mockImplementation( () => new Promise((resolve) => setTimeout(resolve, 1000)), @@ -190,7 +190,7 @@ describe("MCPConnection", () => { it("should handle connection timeout", async () => { const conn = new MCPConnection({ ...options, timeout: 1 }); - const mockConnect = jest + const mockConnect = vi .spyOn(Client.prototype, "connect") .mockImplementation( () => new Promise((resolve) => setTimeout(resolve, 100)), @@ -208,7 +208,7 @@ describe("MCPConnection", () => { const conn = new MCPConnection(options); conn.status = "connected"; - const mockConnect = jest.spyOn(Client.prototype, "connect"); + const mockConnect = vi.spyOn(Client.prototype, "connect"); const abortController = new AbortController(); await conn.connectClient(false, abortController.signal); @@ -219,7 +219,7 @@ describe("MCPConnection", () => { it("should handle transport errors", async () => { const conn = new MCPConnection(options); - const mockConnect = jest + const mockConnect = vi .spyOn(Client.prototype, "connect") .mockRejectedValue(new Error("spawn test-cmd ENOENT")); @@ -233,7 +233,7 @@ describe("MCPConnection", () => { it.skip("should include stderr output in error message when stdio command fails", async () => { // Clear any existing mocks to ensure we get real behavior - jest.restoreAllMocks(); + vi.restoreAllMocks(); // Use a command that will definitely fail and produce stderr output const failingOptions = { diff --git a/core/context/mcp/MCPManagerSingleton.ts b/core/context/mcp/MCPManagerSingleton.ts index d0d7c0991..7eafa1564 100644 --- a/core/context/mcp/MCPManagerSingleton.ts +++ b/core/context/mcp/MCPManagerSingleton.ts @@ -161,4 +161,21 @@ export class MCPManagerSingleton { client: connection.client, })); } + + async getPrompt( + serverName: string, + promptName: string, + args: Record = {}, + ) { + 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, + }); + } } diff --git a/core/context/mcp/MCPManagerSingleton.test.ts b/core/context/mcp/MCPManagerSingleton.vitest.ts similarity index 91% rename from core/context/mcp/MCPManagerSingleton.test.ts rename to core/context/mcp/MCPManagerSingleton.vitest.ts index 49e2389d6..f361c13a1 100644 --- a/core/context/mcp/MCPManagerSingleton.test.ts +++ b/core/context/mcp/MCPManagerSingleton.vitest.ts @@ -1,3 +1,4 @@ +import { beforeEach, describe, expect, it, vi } from "vitest"; import { MCPOptions } from "../.."; import MCPConnection from "./MCPConnection"; import { MCPManagerSingleton } from "./MCPManagerSingleton"; @@ -18,8 +19,8 @@ class TestMCPConnection extends MCPConnection { } as any; this.abortController = new AbortController(); - this.connectClient = jest.fn().mockResolvedValue(undefined); - this.getStatus = jest + this.connectClient = vi.fn().mockResolvedValue(undefined); + this.getStatus = vi .fn() .mockReturnValue({ status: "connected", errors: [] }); } @@ -54,13 +55,12 @@ describe("MCPManagerSingleton", () => { id: string, options: MCPOptions, ): MCPConnection { - if (!this.connections.has(id)) { - const connection = new TestMCPConnection(options); - this.connections.set(id, connection); - return connection; - } else { + if (this.connections.has(id)) { return this.connections.get(id)!; } + const connection = new TestMCPConnection(options); + this.connections.set(id, connection); + return connection; }; }); @@ -103,7 +103,7 @@ describe("MCPManagerSingleton", () => { "test-id", testOptions, ) as TestMCPConnection; - const closeSpy = jest.spyOn(connection.client, "close"); + const closeSpy = vi.spyOn(connection.client, "close"); await manager.removeConnection("test-id"); @@ -133,8 +133,8 @@ describe("MCPManagerSingleton", () => { "test-id", testOptions, ) as TestMCPConnection; - const abortSpy = jest.spyOn(connection.abortController, "abort"); - const closeSpy = jest.spyOn(connection.client, "close"); + const abortSpy = vi.spyOn(connection.abortController, "abort"); + const closeSpy = vi.spyOn(connection.client, "close"); // Remove it by setting empty server list manager.setConnections([], false); @@ -192,7 +192,7 @@ describe("MCPManagerSingleton", () => { }); it("should call onConnectionsRefreshed if defined", async () => { - const mockCallback = jest.fn(); + const mockCallback = vi.fn(); manager.onConnectionsRefreshed = mockCallback; manager.createConnection("test-id", testOptions); @@ -209,7 +209,7 @@ describe("MCPManagerSingleton", () => { testOptions, ) as TestMCPConnection; const mockStatus = { status: "connected", errors: [] }; - connection.getStatus = jest.fn().mockReturnValue(mockStatus); + connection.getStatus = vi.fn().mockReturnValue(mockStatus); const statuses = manager.getStatuses(); expect(statuses).toHaveLength(1); diff --git a/core/context/providers/MCPContextProvider.ts b/core/context/providers/MCPContextProvider.ts index 6465d6b63..0336c2ec3 100644 --- a/core/context/providers/MCPContextProvider.ts +++ b/core/context/providers/MCPContextProvider.ts @@ -56,7 +56,9 @@ class MCPContextProvider extends BaseContextProvider { private insertInputToUriTemplate(uri: string, query: string): string { const TEMPLATE_VAR = "query"; if (uri.includes(`{${TEMPLATE_VAR}}`)) { - return uri.replace(`{${TEMPLATE_VAR}}`, encodeURIComponent(query)); + // Sending an empty string will result in an error, so we instead send "null" + const queryOrNull = query.trim() === "" ? "null" : query; + return uri.replace(`{${TEMPLATE_VAR}}`, encodeURIComponent(queryOrNull)); } return uri; } diff --git a/core/context/providers/TerminalContextProvider.ts b/core/context/providers/TerminalContextProvider.ts index 88577c946..d0f6e12b3 100644 --- a/core/context/providers/TerminalContextProvider.ts +++ b/core/context/providers/TerminalContextProvider.ts @@ -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", }, ]; diff --git a/core/context/providers/_context-providers.test.ts b/core/context/providers/_context-providers.vitest.ts similarity index 90% rename from core/context/providers/_context-providers.test.ts rename to core/context/providers/_context-providers.vitest.ts index 468aac6ec..7ae55d32e 100644 --- a/core/context/providers/_context-providers.test.ts +++ b/core/context/providers/_context-providers.vitest.ts @@ -1,5 +1,6 @@ import fetch from "node-fetch"; +import { afterAll, describe, expect, test } from "vitest"; import { contextProviderClassFromName } from "."; import { ContextProviderExtras, @@ -8,7 +9,7 @@ import { } from "../.."; import { ConfigHandler } from "../../config/ConfigHandler"; import { LLMLogger } from "../../llm/logger"; -import { TEST_DIR } from "../../test/testDir"; +import { setUpTestDir, tearDownTestDir, TEST_DIR } from "../../test/testDir"; import FileSystemIde from "../../util/filesystem"; const CONTEXT_PROVIDERS_TO_TEST: ContextProviderWithParams[] = [ @@ -25,6 +26,7 @@ const CONTEXT_PROVIDERS_TO_TEST: ContextProviderWithParams[] = [ async function getContextProviderExtras( fullInput: string, ): Promise { + setUpTestDir(); const ide = new FileSystemIde(TEST_DIR); const ideSettingsPromise = ide.getIdeSettings(); const llmLogger = new LLMLogger(); @@ -52,6 +54,10 @@ async function getContextProviderExtras( } describe.skip("Should successfully run all context providers", () => { + afterAll(() => { + tearDownTestDir(); + }); + const extrasPromise = getContextProviderExtras("Test"); CONTEXT_PROVIDERS_TO_TEST.forEach((provider) => { diff --git a/core/context/providers/index.ts b/core/context/providers/index.ts index d9fa14bd3..910b16c14 100644 --- a/core/context/providers/index.ts +++ b/core/context/providers/index.ts @@ -1,7 +1,9 @@ import { BaseContextProvider } from "../"; import { ContextProviderName } from "../../"; +import { Telemetry } from "../../util/posthog"; import ClipboardContextProvider from "./ClipboardContextProvider"; +import CodebaseContextProvider from "./CodebaseContextProvider"; import CodeContextProvider from "./CodeContextProvider"; import ContinueProxyContextProvider from "./ContinueProxyContextProvider"; import CurrentFileContextProvider from "./CurrentFileContextProvider"; @@ -56,6 +58,7 @@ export const Providers: (typeof BaseContextProvider)[] = [ JiraIssuesContextProvider, PostgresContextProvider, DatabaseContextProvider, + CodebaseContextProvider, CodeContextProvider, CurrentFileContextProvider, URLContextProvider, @@ -73,5 +76,12 @@ export const Providers: (typeof BaseContextProvider)[] = [ export function contextProviderClassFromName( name: ContextProviderName, ): typeof BaseContextProvider | undefined { - return Providers.find((cls) => cls.description.title === name); + const provider = Providers.find((cls) => cls.description.title === name); + + void Telemetry.capture("context_provider_load", { + providerName: name, + found: !!provider, // also capture those which user expected to be present + }); + + return provider; } diff --git a/core/context/retrieval/pipelines/NoRerankerRetrievalPipeline.ts b/core/context/retrieval/pipelines/NoRerankerRetrievalPipeline.ts index f35809fed..ca88c479e 100644 --- a/core/context/retrieval/pipelines/NoRerankerRetrievalPipeline.ts +++ b/core/context/retrieval/pipelines/NoRerankerRetrievalPipeline.ts @@ -1,4 +1,5 @@ import { Chunk } from "../../../"; +import { Telemetry } from "../../../util/posthog"; import { findUriInDirs } from "../../../util/uri"; import { requestFilesFromRepoMap } from "../repoMapRequest"; import { deduplicateChunks } from "../util"; @@ -23,7 +24,8 @@ export default class NoRerankerRetrievalPipeline extends BaseRetrievalPipeline { try { ftsChunks = await this.retrieveFts(args, ftsNFinal); } catch (error) { - console.error("Error retrieving FTS chunks:", error); + await Telemetry.captureError("no_reranker_fts_retrieval", error); + // console.error("Error retrieving FTS chunks:", error); } let embeddingsChunks: Chunk[] = []; @@ -32,6 +34,7 @@ export default class NoRerankerRetrievalPipeline extends BaseRetrievalPipeline { ? await this.retrieveEmbeddings(input, embeddingsNFinal) : []; } catch (error) { + await Telemetry.captureError("no_reranker_embeddings_retrieval", error); console.error("Error retrieving embeddings:", error); } @@ -40,6 +43,10 @@ export default class NoRerankerRetrievalPipeline extends BaseRetrievalPipeline { recentlyEditedFilesChunks = await this.retrieveAndChunkRecentlyEditedFiles(recentlyEditedNFinal); } catch (error) { + await Telemetry.captureError( + "no_reranker_recently_edited_retrieval", + error, + ); console.error("Error retrieving recently edited files:", error); } @@ -53,6 +60,7 @@ export default class NoRerankerRetrievalPipeline extends BaseRetrievalPipeline { filterDirectory, ); } catch (error) { + await Telemetry.captureError("no_reranker_repo_map_retrieval", error); console.error("Error retrieving repo map chunks:", error); } diff --git a/core/context/retrieval/pipelines/RerankerRetrievalPipeline.ts b/core/context/retrieval/pipelines/RerankerRetrievalPipeline.ts index e73edf118..6829e7d75 100644 --- a/core/context/retrieval/pipelines/RerankerRetrievalPipeline.ts +++ b/core/context/retrieval/pipelines/RerankerRetrievalPipeline.ts @@ -1,5 +1,6 @@ import { Chunk } from "../../.."; import { RETRIEVAL_PARAMS } from "../../../util/parameters"; +import { Telemetry } from "../../../util/posthog"; import { findUriInDirs } from "../../../util/uri"; import { requestFilesFromRepoMap } from "../repoMapRequest"; import { deduplicateChunks } from "../util"; @@ -20,7 +21,8 @@ export default class RerankerRetrievalPipeline extends BaseRetrievalPipeline { try { ftsChunks = await this.retrieveFts(args, nRetrieve); } catch (error) { - console.error("Error retrieving FTS chunks:", error); + await Telemetry.captureError("reranker_fts_retrieval", error); + // console.error("Error retrieving FTS chunks:", error); } let embeddingsChunks: Chunk[] = []; @@ -29,6 +31,7 @@ export default class RerankerRetrievalPipeline extends BaseRetrievalPipeline { ? await this.retrieveEmbeddings(input, nRetrieve) : []; } catch (error) { + await Telemetry.captureError("reranker_embeddings_retrieval", error); console.error("Error retrieving embeddings chunks:", error); } @@ -37,6 +40,7 @@ export default class RerankerRetrievalPipeline extends BaseRetrievalPipeline { recentlyEditedFilesChunks = await this.retrieveAndChunkRecentlyEditedFiles(nRetrieve); } catch (error) { + await Telemetry.captureError("reranker_recently_edited_retrieval", error); console.error("Error retrieving recently edited files chunks:", error); } @@ -50,6 +54,7 @@ export default class RerankerRetrievalPipeline extends BaseRetrievalPipeline { filterDirectory, ); } catch (error) { + await Telemetry.captureError("reranker_repo_map_retrieval", error); console.error("Error retrieving repo map chunks:", error); } @@ -102,7 +107,7 @@ export default class RerankerRetrievalPipeline extends BaseRetrievalPipeline { chunks.forEach((chunk, idx) => chunkIndexMap.set(chunk, idx)); results.sort( - (a, b) => scores[chunkIndexMap.get(a)!] - scores[chunkIndexMap.get(b)!], + (a, b) => scores[chunkIndexMap.get(b)!] - scores[chunkIndexMap.get(a)!], ); results = results.slice(-this.options.nFinal); return results; diff --git a/core/context/retrieval/utils.test.ts b/core/context/retrieval/utils.vitest.ts similarity index 98% rename from core/context/retrieval/utils.test.ts rename to core/context/retrieval/utils.vitest.ts index 4b8d9d3fe..133e30c8e 100644 --- a/core/context/retrieval/utils.test.ts +++ b/core/context/retrieval/utils.vitest.ts @@ -1,6 +1,6 @@ // Generated by Continue +import { describe, expect, it } from "vitest"; import { Chunk } from "../../index"; - import { deduplicateChunks } from "./util"; describe("deduplicateChunks", () => { diff --git a/core/control-plane/mdm/mdm.test.ts b/core/control-plane/mdm/mdm.vitest.ts similarity index 99% rename from core/control-plane/mdm/mdm.test.ts rename to core/control-plane/mdm/mdm.vitest.ts index ca4f5f0ec..193960e27 100644 --- a/core/control-plane/mdm/mdm.test.ts +++ b/core/control-plane/mdm/mdm.vitest.ts @@ -1,4 +1,5 @@ import * as crypto from "crypto"; +import { expect, test } from "vitest"; import { LicenseKeyData, validateLicenseKey } from "./mdm"; // We'll create a real key pair once for all tests diff --git a/core/core.ts b/core/core.ts index 5e8d4d060..613bd0807 100644 --- a/core/core.ts +++ b/core/core.ts @@ -10,7 +10,6 @@ import { import { ConfigHandler } from "./config/ConfigHandler"; import { SYSTEM_PROMPT_DOT_FILE } from "./config/getWorkspaceContinueRuleDotFiles"; import { addModel, deleteModel } from "./config/util"; -import CodebaseContextProvider from "./context/providers/CodebaseContextProvider"; import CurrentFileContextProvider from "./context/providers/CurrentFileContextProvider"; import { ContinueServerClient } from "./continueServer/stubs/client"; import { getAuthUrlForTokenPage } from "./control-plane/auth/index"; @@ -21,7 +20,8 @@ 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 { EditAggregator } from "./nextEdit/context/aggregateEdits"; +import { createNewPromptFileV2 } from "./promptFiles/createNewPromptFile"; import { callTool } from "./tools/callTool"; import { ChatDescriber } from "./util/chatDescriber"; import { clipboardCache } from "./util/clipboardCache"; @@ -41,6 +41,7 @@ import { ContextItemWithId, IdeSettings, ModelDescription, + Position, RangeInFile, ToolCall, type ContextItem, @@ -50,6 +51,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, @@ -66,6 +68,8 @@ import { walkDirCache } from "./indexing/walkDir"; import { LLMLogger } from "./llm/logger"; import { RULES_MARKDOWN_FILENAME } from "./llm/rules/constants"; import { llmStreamChat } from "./llm/streamChat"; +import { BeforeAfterDiff } from "./nextEdit/context/diffFormatting"; +import { processSmallEdit } from "./nextEdit/context/processSmallEdit"; import type { FromCoreProtocol, ToCoreProtocol } from "./protocol"; import { OnboardingModes } from "./protocol/core"; import type { IMessenger, Message } from "./protocol/messenger"; @@ -381,6 +385,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); @@ -702,6 +719,52 @@ export class Core { } }); + on("files/smallEdit", async ({ data }) => { + const EDIT_AGGREGATION_OPTIONS = { + deltaT: 1.0, + deltaL: 5, + maxEdits: 250, + maxDuration: 100.0, + contextSize: 5, + }; + + EditAggregator.getInstance( + EDIT_AGGREGATION_OPTIONS, + ( + beforeAfterdiff: BeforeAfterDiff, + cursorPosBeforeEdit: Position, + cursorPosAfterPrevEdit: Position, + ) => { + void processSmallEdit( + beforeAfterdiff, + cursorPosBeforeEdit, + cursorPosAfterPrevEdit, + data.configHandler, + data.getDefsFromLspFunction, + this.ide, + ); + }, + ); + + const workspaceDir = + data.actions.length > 0 ? data.actions[0].workspaceDir : undefined; + + // Store the latest context data + const instance = EditAggregator.getInstance(); + (instance as any).latestContextData = { + configHandler: data.configHandler, + getDefsFromLspFunction: data.getDefsFromLspFunction, + recentlyEditedRanges: data.recentlyEditedRanges, + recentlyVisitedRanges: data.recentlyVisitedRanges, + workspaceDir: workspaceDir, + }; + + // queueMicrotask prevents blocking the UI thread during typing + queueMicrotask(() => { + void EditAggregator.getInstance().processEdits(data.actions); + }); + }); + // Docs, etc. indexing on("indexing/reindex", async (msg) => { if (msg.data.type === "docs") { @@ -809,7 +872,7 @@ export class Core { this.messenger.send("toolCallPartialOutput", params); }; - return await callTool(tool, toolCall, { + const result = await callTool(tool, toolCall, { config, ide: this.ide, llm: config.selectedModelByRole.chat, @@ -820,6 +883,8 @@ export class Core { onPartialOutput, codeBaseIndexer: this.codeBaseIndexer, }); + + return result; } private async isItemTooBig(item: ContextItemWithId) { @@ -1031,8 +1096,6 @@ export class Core { // user doesn't need these in their config.json for the shortcuts to work // option+enter new CurrentFileContextProvider({}), - // cmd+enter - new CodebaseContextProvider({}), ].find((provider) => provider.description.title === name); if (!provider) { return []; @@ -1044,6 +1107,10 @@ export class Core { itemId: uuidv4(), }; + void Telemetry.capture("context_provider_get_context_items", { + name: provider.description.title, + }); + const items = await provider.getContextItems(query, { config, llm, diff --git a/core/core_temp.ts b/core/core_temp.ts deleted file mode 100644 index e69de29bb..000000000 diff --git a/core/data/log.test.ts b/core/data/log.vitest.ts similarity index 93% rename from core/data/log.test.ts rename to core/data/log.vitest.ts index 1b7b42b2e..f79e05130 100644 --- a/core/data/log.test.ts +++ b/core/data/log.vitest.ts @@ -1,13 +1,22 @@ import { DevDataLogEvent } from "@continuedev/config-yaml"; import fs from "fs"; import path from "path"; +import { + afterAll, + beforeAll, + beforeEach, + describe, + expect, + it, + vi, +} from "vitest"; import { IdeInfo, IdeSettings } from ".."; import { Core } from "../core"; import { getDevDataFilePath } from "../util/paths"; import { DataLogger } from "./log"; // Only mock fetch, not fs -jest.mock("@continuedev/fetch"); +vi.mock("@continuedev/fetch"); const TEST_EVENT: DevDataLogEvent = { name: "tokensGenerated", @@ -54,7 +63,7 @@ describe("DataLogger", () => { beforeEach(() => { // Reset mocks - jest.clearAllMocks(); + vi.clearAllMocks(); // Remove test file if it exists if (fs.existsSync(testFilePath)) { @@ -67,7 +76,7 @@ describe("DataLogger", () => { // Mock core and required promises dataLogger.core = { configHandler: { - loadConfig: jest.fn().mockResolvedValue({ + loadConfig: vi.fn().mockResolvedValue({ config: { data: [], }, @@ -78,7 +87,7 @@ describe("DataLogger", () => { }, }, controlPlaneClient: { - getAccessToken: jest.fn().mockResolvedValue("test-access-token"), + getAccessToken: vi.fn().mockResolvedValue("test-access-token"), }, }, } as unknown as Core; @@ -184,7 +193,6 @@ describe("DataLogger", () => { // Read file contents and verify const fileContent = fs.readFileSync(filepath, "utf8"); - console.log("debug1 filecontent", fileContent); expect(fileContent).toContain('"eventName":"chatInteraction"'); expect(fileContent).toContain('"prompt":"Hello, world!"'); expect(fileContent).toContain('"completion":"Hello, world!"'); @@ -195,10 +203,10 @@ describe("DataLogger", () => { describe("logDevData", () => { it("should log data locally and to configured destinations", async () => { // Spy on logLocalData and logToOneDestination - const logLocalDataSpy = jest + const logLocalDataSpy = vi .spyOn(dataLogger, "logLocalData") .mockResolvedValue(); - const logToOneDestinationSpy = jest + const logToOneDestinationSpy = vi .spyOn(dataLogger, "logToOneDestination") .mockResolvedValue(); @@ -212,7 +220,7 @@ describe("DataLogger", () => { }, }; - dataLogger.core!.configHandler.loadConfig = jest + dataLogger.core!.configHandler.loadConfig = vi .fn() .mockResolvedValue(mockConfig); diff --git a/core/diff/myers.test.ts b/core/diff/myers.vitest.ts similarity index 96% rename from core/diff/myers.test.ts rename to core/diff/myers.vitest.ts index 0683e5a96..a5902142a 100644 --- a/core/diff/myers.test.ts +++ b/core/diff/myers.vitest.ts @@ -1,3 +1,5 @@ +import { describe, expect, test } from "vitest"; + import { dedent } from "../util"; import { myersDiff } from "./myers"; diff --git a/core/diff/streamDiff.test.ts b/core/diff/streamDiff.vitest.ts similarity index 98% rename from core/diff/streamDiff.test.ts rename to core/diff/streamDiff.vitest.ts index 560d2e13d..57c6e77f1 100644 --- a/core/diff/streamDiff.test.ts +++ b/core/diff/streamDiff.vitest.ts @@ -1,6 +1,8 @@ import fs from "node:fs"; import path from "node:path"; +import { describe, expect, test } from "vitest"; + // @ts-ignore no typings available import { changed, diff as myersDiff } from "myers-diff"; import { streamDiff } from "../diff/streamDiff.js"; @@ -54,12 +56,7 @@ function displayDiff(diff: DiffLine[]) { } async function expectDiff(file: string) { - const testFilePath = path.join( - __dirname, - "diff", - "test-examples", - file + ".diff", - ); + const testFilePath = path.join(__dirname, "test-examples", file + ".diff"); const testFileContents = fs.readFileSync(testFilePath, "utf-8"); const [oldText, newText, expectedDiff] = testFileContents .split("\n---\n") diff --git a/core/diff/util.test.ts b/core/diff/util.vitest.ts similarity index 95% rename from core/diff/util.test.ts rename to core/diff/util.vitest.ts index fca80ba6a..b94ab6317 100644 --- a/core/diff/util.test.ts +++ b/core/diff/util.vitest.ts @@ -1,8 +1,8 @@ // Generated by continue -import { matchLine, streamLines, generateLines } from "./util"; +import { describe, expect, it, vi } from "vitest"; import { ChatMessage } from "../index"; -import { jest } from "@jest/globals"; +import { generateLines, matchLine, streamLines } from "./util"; describe.skip("matchLine", () => { it("should match empty lines if the first old line is also empty", () => { @@ -146,7 +146,7 @@ describe("streamLines", () => { content: "line4", }; - // const spy = jest.spyOn(messageContentModule, "renderChatMessage"); + // const spy = vi.spyOn(messageContentModule, "renderChatMessage"); async function* streamCompletion(): AsyncGenerator { yield messageChunk1; @@ -164,7 +164,7 @@ describe("streamLines", () => { }); it("should log lines if log parameter is true", async () => { - const consoleSpy = jest.spyOn(console, "log").mockImplementation(() => {}); + const consoleSpy = vi.spyOn(console, "log").mockImplementation(() => {}); async function* streamCompletion(): AsyncGenerator { yield "line1\nline2\n"; diff --git a/core/edit/searchAndReplace/findSearchMatch.test.ts b/core/edit/searchAndReplace/findSearchMatch.test.ts new file mode 100644 index 000000000..8d5c3682b --- /dev/null +++ b/core/edit/searchAndReplace/findSearchMatch.test.ts @@ -0,0 +1,386 @@ +import { findSearchMatch } from "./findSearchMatch"; + +describe("findSearchMatch", () => { + describe("Exact matches", () => { + it("should find exact match at the beginning of file", () => { + const fileContent = `function hello() { + console.log("world"); +}`; + const searchContent = `function hello() { + console.log("world"); +}`; + + const result = findSearchMatch(fileContent, searchContent); + + expect(result).toEqual({ + startIndex: 0, + endIndex: fileContent.length, + }); + }); + + it("should find exact match in the middle of file", () => { + const fileContent = `const a = 1; +function hello() { + console.log("world"); +} +const b = 2;`; + const searchContent = `function hello() { + console.log("world"); +}`; + + const result = findSearchMatch(fileContent, searchContent); + + expect(result).toEqual({ + startIndex: 13, // After "const a = 1;\n" + endIndex: 13 + searchContent.length, + }); + }); + + it("should find exact match at the end of file", () => { + const fileContent = `const a = 1; +function hello() { + console.log("world"); +}`; + const searchContent = `function hello() { + console.log("world"); +}`; + + const result = findSearchMatch(fileContent, searchContent); + + expect(result).toEqual({ + startIndex: 13, // After "const a = 1;\n" + endIndex: fileContent.length, + }); + }); + + it("should find exact match with single line", () => { + const fileContent = `const a = 1; +const b = 2; +const c = 3;`; + const searchContent = `const b = 2;`; + + const result = findSearchMatch(fileContent, searchContent); + + expect(result).toEqual({ + startIndex: 13, // After "const a = 1;\n" + endIndex: 13 + searchContent.length, + }); + }); + + it("should find exact match with whitespace preserved", () => { + const fileContent = `function test() { + const x = 1; + const y = 2; +}`; + const searchContent = ` const x = 1; + const y = 2;`; + + const result = findSearchMatch(fileContent, searchContent); + + // The actual indexOf result is 18, not 17 + expect(result).toEqual({ + startIndex: 18, + endIndex: 18 + searchContent.length, + }); + }); + }); + + describe("Trimmed matches", () => { + it("should find trimmed match when exact match fails due to leading newlines", () => { + const fileContent = `function hello() { + console.log("world"); +}`; + const searchContent = `\n\nfunction hello() { + console.log("world"); +}\n\n`; + + const result = findSearchMatch(fileContent, searchContent); + + expect(result).toEqual({ + startIndex: 0, + endIndex: fileContent.length, // Uses trimmed length + }); + }); + + it("should find trimmed match when exact match fails due to trailing newlines", () => { + const fileContent = `const a = 1; +function hello() { + return "world"; +} +const b = 2;`; + const searchContent = `\nfunction hello() { + return "world"; +}\n`; + + const result = findSearchMatch(fileContent, searchContent); + + // The function finds the exact match first (at index 12), not the trimmed match + expect(result).toEqual({ + startIndex: 12, + endIndex: 12 + searchContent.length, + }); + }); + + it("should find trimmed match for single line with extra whitespace", () => { + const fileContent = `const a = 1; +const b = 2; +const c = 3;`; + const searchContent = `\n const b = 2; \n`; + + const result = findSearchMatch(fileContent, searchContent); + + const trimmedSearchContent = searchContent.trim(); + const expectedStart = fileContent.indexOf(trimmedSearchContent); + + expect(result).toEqual({ + startIndex: expectedStart, + endIndex: expectedStart + trimmedSearchContent.length, + }); + }); + }); + + describe("Empty search content", () => { + it("should match at beginning for empty search content", () => { + const fileContent = `function hello() { + console.log("world"); +}`; + const searchContent = ""; + + const result = findSearchMatch(fileContent, searchContent); + + expect(result).toEqual({ + startIndex: 0, + endIndex: 0, + }); + }); + + it("should match at beginning for whitespace-only search content", () => { + const fileContent = `function hello() { + console.log("world"); +}`; + const searchContent = "\n\n \t \n"; + + const result = findSearchMatch(fileContent, searchContent); + + expect(result).toEqual({ + startIndex: 0, + endIndex: 0, + }); + }); + + it("should match at beginning for empty file and empty search", () => { + const fileContent = ""; + const searchContent = ""; + + const result = findSearchMatch(fileContent, searchContent); + + expect(result).toEqual({ + startIndex: 0, + endIndex: 0, + }); + }); + }); + + describe("No matches", () => { + it("should return null when search content is not found", () => { + const fileContent = `function hello() { + console.log("world"); +}`; + const searchContent = `function goodbye() { + console.log("world"); +}`; + + const result = findSearchMatch(fileContent, searchContent); + + expect(result).toBeNull(); + }); + + it("should return null when trimmed search content is not found", () => { + const fileContent = `function hello() { + console.log("world"); +}`; + const searchContent = `\n\nfunction goodbye() { + console.log("world"); +}\n\n`; + + const result = findSearchMatch(fileContent, searchContent); + + expect(result).toBeNull(); + }); + + it("should return null for non-existent single line", () => { + const fileContent = `const a = 1; +const b = 2; +const c = 3;`; + const searchContent = `const d = 4;`; + + const result = findSearchMatch(fileContent, searchContent); + + expect(result).toBeNull(); + }); + + it("should return null for partial match", () => { + const fileContent = `function hello() { + console.log("world"); +}`; + const searchContent = `function hello() { + console.log("universe"); +}`; + + const result = findSearchMatch(fileContent, searchContent); + + expect(result).toBeNull(); + }); + }); + + describe("Edge cases", () => { + it("should handle empty file with non-empty search", () => { + const fileContent = ""; + const searchContent = "function hello() {}"; + + const result = findSearchMatch(fileContent, searchContent); + + expect(result).toBeNull(); + }); + + it("should handle very large content", () => { + const repeatedLine = "const x = 1;\n"; + const fileContent = + repeatedLine.repeat(1000) + + "const target = 2;\n" + + repeatedLine.repeat(1000); + const searchContent = "const target = 2;"; + + const result = findSearchMatch(fileContent, searchContent); + + const expectedStart = repeatedLine.length * 1000; + expect(result).toEqual({ + startIndex: expectedStart, + endIndex: expectedStart + searchContent.length, + }); + }); + + it("should handle special characters and symbols", () => { + const fileContent = `const regex = /[a-zA-Z]+/g; +const symbols = !@#$%^&*(); +const unicode = "🚀 Hello 世界";`; + const searchContent = `const symbols = !@#$%^&*();`; + + const result = findSearchMatch(fileContent, searchContent); + + const expectedStart = fileContent.indexOf(searchContent); + expect(result).toEqual({ + startIndex: expectedStart, + endIndex: expectedStart + searchContent.length, + }); + }); + + it("should prefer exact match over trimmed match", () => { + const fileContent = `function test() { + const x = 1; +} + +function test() { + const x = 1; +}`; + const searchContent = `function test() { + const x = 1; +}`; + + const result = findSearchMatch(fileContent, searchContent); + + // Should find the first exact match, not a trimmed version + expect(result).toEqual({ + startIndex: 0, + endIndex: searchContent.length, + }); + }); + + it("should handle multiple occurrences and return first match", () => { + const fileContent = `const a = 1; +const b = 2; +const a = 1;`; + const searchContent = `const a = 1;`; + + const result = findSearchMatch(fileContent, searchContent); + + expect(result).toEqual({ + startIndex: 0, + endIndex: searchContent.length, + }); + }); + }); + + describe("Real-world scenarios", () => { + it("should match typical function replacement", () => { + const fileContent = `class Calculator { + constructor() { + this.result = 0; + } + + reset() { + this.result = 0; + return this; + } + + add(value) { + this.result += value; + return this; + } +}`; + const searchContent = ` reset() { + this.result = 0; + return this; + }`; + + const result = findSearchMatch(fileContent, searchContent); + + const expectedStart = fileContent.indexOf(searchContent); + expect(result).toEqual({ + startIndex: expectedStart, + endIndex: expectedStart + searchContent.length, + }); + }); + + it("should match import statement", () => { + const fileContent = `import React from 'react'; +import { useState, useEffect } from 'react'; +import './App.css'; + +function App() { + return
Hello World
; +}`; + const searchContent = `import { useState, useEffect } from 'react';`; + + const result = findSearchMatch(fileContent, searchContent); + + const expectedStart = fileContent.indexOf(searchContent); + expect(result).toEqual({ + startIndex: expectedStart, + endIndex: expectedStart + searchContent.length, + }); + }); + + it("should match comment block", () => { + const fileContent = `/** + * This is a comment + * that spans multiple lines + */ +function test() { + // Single line comment + return true; +}`; + const searchContent = `/** + * This is a comment + * that spans multiple lines + */`; + + const result = findSearchMatch(fileContent, searchContent); + + expect(result).toEqual({ + startIndex: 0, + endIndex: searchContent.length, + }); + }); + }); +}); diff --git a/core/edit/searchAndReplace/findSearchMatch.ts b/core/edit/searchAndReplace/findSearchMatch.ts new file mode 100644 index 000000000..3b1b8acf8 --- /dev/null +++ b/core/edit/searchAndReplace/findSearchMatch.ts @@ -0,0 +1,55 @@ +/** + * Represents a match result with start and end character positions + */ +export interface SearchMatchResult { + /** The starting character index of the match in the file content */ + startIndex: number; + /** The ending character index of the match in the file content */ + endIndex: number; +} + +/** + * Find the exact match position for search content in file content. + * Uses simple exact matching with trimmed newlines for MVP. + * + * Matching Strategy: + * 1. If search content is empty, matches at the beginning of file (position 0) + * 2. Try exact string match first + * 3. Fallback to trimmed content match if exact match fails + * + * @param fileContent - The complete content of the file to search in + * @param searchContent - The content to search for + * @returns Match result with character positions, or null if no match found + */ +export function findSearchMatch( + fileContent: string, + searchContent: string, +): SearchMatchResult | null { + // Strip leading/trailing newlines for basic matching strategy + const trimmedSearchContent = searchContent.trim(); + + if (trimmedSearchContent === "") { + // Empty search content matches the beginning of the file + return { startIndex: 0, endIndex: 0 }; + } + + // Try exact match first + const exactIndex = fileContent.indexOf(searchContent); + if (exactIndex !== -1) { + return { + startIndex: exactIndex, + endIndex: exactIndex + searchContent.length, + }; + } + + // Fallback: try trimmed content match + const trimmedIndex = fileContent.indexOf(trimmedSearchContent); + if (trimmedIndex !== -1) { + return { + startIndex: trimmedIndex, + endIndex: trimmedIndex + trimmedSearchContent.length, + }; + } + + return null; +} diff --git a/core/edit/searchAndReplace/parseSearchReplaceBlock.test.ts b/core/edit/searchAndReplace/parseSearchReplaceBlock.test.ts new file mode 100644 index 000000000..1fd6ab38c --- /dev/null +++ b/core/edit/searchAndReplace/parseSearchReplaceBlock.test.ts @@ -0,0 +1,390 @@ +import { + parseAllSearchReplaceBlocks, + parseSearchReplaceBlock, +} from "./parseSearchReplaceBlock"; + +describe("parseSearchReplaceBlock", () => { + describe("Complete blocks", () => { + it("should parse a complete basic search/replace block", () => { + const content = `------- SEARCH +reset() { +this.result = 0; +return this; +} +======= +// Resets the calculator result to 0 and returns the instance for method chaining +reset() { +this.result = 0; +return this; +} ++++++++ REPLACE`; + + const result = parseSearchReplaceBlock(content); + + expect(result.isComplete).toBe(true); + expect(result.searchContent).toBe(`reset() { +this.result = 0; +return this; +}`); + expect(result.replaceContent) + .toBe(`// Resets the calculator result to 0 and returns the instance for method chaining +reset() { +this.result = 0; +return this; +}`); + expect(result.error).toBeUndefined(); + }); + + it("should handle different marker lengths", () => { + const content = `------- SEARCH +old content +========= +new content ++++++++++++ REPLACE`; + + const result = parseSearchReplaceBlock(content); + + expect(result.isComplete).toBe(true); + expect(result.searchContent).toBe("old content"); + expect(result.replaceContent).toBe("new content"); + }); + + it("should handle empty search content", () => { + const content = `------- SEARCH +======= +new content ++++++++ REPLACE`; + + const result = parseSearchReplaceBlock(content); + + expect(result.isComplete).toBe(true); + expect(result.searchContent).toBe(""); + expect(result.replaceContent).toBe("new content"); + }); + + it("should handle empty replace content (deletion)", () => { + const content = `------- SEARCH +old content to delete +======= ++++++++ REPLACE`; + + const result = parseSearchReplaceBlock(content); + + expect(result.isComplete).toBe(true); + expect(result.searchContent).toBe("old content to delete"); + expect(result.replaceContent).toBe(""); + }); + + it("should handle both empty search and replace content", () => { + const content = `------- SEARCH +======= ++++++++ REPLACE`; + + const result = parseSearchReplaceBlock(content); + + expect(result.isComplete).toBe(true); + expect(result.searchContent).toBe(""); + expect(result.replaceContent).toBe(""); + }); + }); + + describe("Incomplete blocks", () => { + it("should handle incomplete search block", () => { + const content = `------- SEARCH +some content`; + + const result = parseSearchReplaceBlock(content); + + expect(result.isComplete).toBe(false); + expect(result.searchContent).toBe("some content"); + expect(result.replaceContent).toBe(""); + expect(result.error).toBeUndefined(); + }); + + it("should handle incomplete replace block", () => { + const content = `------- SEARCH +old content +======= +new content`; + + const result = parseSearchReplaceBlock(content); + + expect(result.isComplete).toBe(false); + expect(result.searchContent).toBe("old content"); + expect(result.replaceContent).toBe("new content"); + expect(result.error).toBeUndefined(); + }); + }); + + describe("Error cases", () => { + it("should error on search end without start", () => { + const content = `======= +some content ++++++++ REPLACE`; + + const result = parseSearchReplaceBlock(content); + + expect(result.isComplete).toBe(false); + expect(result.error).toBe( + "Found search block end marker without matching start marker", + ); + }); + + it("should error on replace end without replace start", () => { + const content = `+++++++ REPLACE`; + + const result = parseSearchReplaceBlock(content); + + expect(result.isComplete).toBe(false); + expect(result.error).toBe( + "Found replace block end marker without matching replace start marker", + ); + }); + }); + + describe("Regex pattern validation", () => { + it("should match various search start patterns", () => { + const patterns = ["--- SEARCH", "------- SEARCH", "------------- SEARCH"]; + + patterns.forEach((pattern) => { + const content = `${pattern} +content +======= +replacement ++++++++ REPLACE`; + + const result = parseSearchReplaceBlock(content); + expect(result.isComplete).toBe(true); + }); + }); + + it("should match various search end patterns", () => { + const patterns = ["===", "=======", "=============="]; + + patterns.forEach((pattern) => { + const content = `------- SEARCH +content +${pattern} +replacement ++++++++ REPLACE`; + + const result = parseSearchReplaceBlock(content); + expect(result.isComplete).toBe(true); + }); + }); + + it("should match various replace end patterns", () => { + const patterns = [ + "+++ REPLACE", + "+++++++ REPLACE", + "+++++++++++ REPLACE", + ]; + + patterns.forEach((pattern) => { + const content = `------- SEARCH +content +======= +replacement +${pattern}`; + + const result = parseSearchReplaceBlock(content); + expect(result.isComplete).toBe(true); + }); + }); + + it("should not match invalid patterns", () => { + const invalidPatterns = [ + "-- SEARCH", // Too few dashes + "SEARCH", // No markers + "== SEARCH", // Wrong markers + "=== REPLACE", // Wrong end marker + "++++ SEARCH", // Wrong markers for search + ]; + + invalidPatterns.forEach((pattern) => { + const content = `${pattern} +content`; + + const result = parseSearchReplaceBlock(content); + expect(result.isComplete).toBe(false); + expect(result.searchContent).toBe(""); // Should not enter search mode + }); + }); + }); +}); + +describe("parseAllSearchReplaceBlocks", () => { + it("should parse multiple complete blocks", () => { + const content = `------- SEARCH +old code 1 +======= +new code 1 ++++++++ REPLACE + +------- SEARCH +old code 2 +======= +new code 2 ++++++++ REPLACE`; + + const blocks = parseAllSearchReplaceBlocks(content); + + expect(blocks).toHaveLength(2); + expect(blocks[0].searchContent).toBe("old code 1"); + expect(blocks[0].replaceContent).toBe("new code 1"); + expect(blocks[1].searchContent).toBe("old code 2"); + expect(blocks[1].replaceContent).toBe("new code 2"); + }); + + it("should handle blocks with different content", () => { + const content = `------- SEARCH +function old() { + return 1; +} +======= +function new() { + return 2; +} ++++++++ REPLACE + +------- SEARCH +const x = 'old'; +======= +const x = 'new'; ++++++++ REPLACE`; + + const blocks = parseAllSearchReplaceBlocks(content); + + expect(blocks).toHaveLength(2); + expect(blocks[0].searchContent).toBe(`function old() { + return 1; +}`); + expect(blocks[0].replaceContent).toBe(`function new() { + return 2; +}`); + expect(blocks[1].searchContent).toBe(`const x = 'old';`); + expect(blocks[1].replaceContent).toBe(`const x = 'new';`); + }); + + it("should handle deletion blocks (empty replace content)", () => { + const content = `------- SEARCH +code to keep +======= +modified code ++++++++ REPLACE + +------- SEARCH +code to delete +======= ++++++++ REPLACE`; + + const blocks = parseAllSearchReplaceBlocks(content); + + expect(blocks).toHaveLength(2); + expect(blocks[0].searchContent).toBe("code to keep"); + expect(blocks[0].replaceContent).toBe("modified code"); + expect(blocks[1].searchContent).toBe("code to delete"); + expect(blocks[1].replaceContent).toBe(""); // Deletion + }); + + it("should handle insertion blocks (empty search content)", () => { + const content = `------- SEARCH +existing code +======= +modified existing code ++++++++ REPLACE + +------- SEARCH +======= +new code to insert ++++++++ REPLACE`; + + const blocks = parseAllSearchReplaceBlocks(content); + + expect(blocks).toHaveLength(2); + expect(blocks[0].searchContent).toBe("existing code"); + expect(blocks[0].replaceContent).toBe("modified existing code"); + expect(blocks[1].searchContent).toBe(""); // Insertion + expect(blocks[1].replaceContent).toBe("new code to insert"); + }); + + it("should skip incomplete blocks", () => { + const content = `------- SEARCH +incomplete block + +------- SEARCH +complete block +======= +replacement ++++++++ REPLACE`; + + const blocks = parseAllSearchReplaceBlocks(content); + + expect(blocks).toHaveLength(1); + expect(blocks[0].searchContent).toBe("complete block"); + expect(blocks[0].replaceContent).toBe("replacement"); + }); + + it("should handle single block", () => { + const content = `------- SEARCH +single block +======= +replacement ++++++++ REPLACE`; + + const blocks = parseAllSearchReplaceBlocks(content); + + expect(blocks).toHaveLength(1); + expect(blocks[0].searchContent).toBe("single block"); + expect(blocks[0].replaceContent).toBe("replacement"); + }); + + it("should return empty array when no complete blocks found", () => { + const content = `------- SEARCH +incomplete +======= +missing replace marker`; + + const blocks = parseAllSearchReplaceBlocks(content); + + expect(blocks).toHaveLength(0); + }); + + it("should handle blocks with extra content between them", () => { + const content = `Some other content here + +------- SEARCH +block 1 +======= +replacement 1 ++++++++ REPLACE + +More content in between + +------- SEARCH +block 2 +======= +replacement 2 ++++++++ REPLACE + +Trailing content`; + + const blocks = parseAllSearchReplaceBlocks(content); + + expect(blocks).toHaveLength(2); + expect(blocks[0].searchContent).toBe("block 1"); + expect(blocks[0].replaceContent).toBe("replacement 1"); + expect(blocks[1].searchContent).toBe("block 2"); + expect(blocks[1].replaceContent).toBe("replacement 2"); + }); + + it("should throw error for malformed blocks", () => { + const content = `------- SEARCH +content ++++++++ REPLACE`; // Missing ======= + + expect(() => parseAllSearchReplaceBlocks(content)).toThrow( + "Found replace block end marker without matching replace start marker", + ); + }); +}); diff --git a/core/edit/searchAndReplace/parseSearchReplaceBlock.ts b/core/edit/searchAndReplace/parseSearchReplaceBlock.ts new file mode 100644 index 000000000..64fa901a2 --- /dev/null +++ b/core/edit/searchAndReplace/parseSearchReplaceBlock.ts @@ -0,0 +1,147 @@ +// Search and replace block markers using flexible regex patterns +const SEARCH_BLOCK_START_REGEX = /^[-]{3,} SEARCH$/; +const SEARCH_BLOCK_END_REGEX = /^[=]{3,}$/; +const REPLACE_BLOCK_END_REGEX = /^[+]{3,} REPLACE$/; + +export interface SearchReplaceBlockResult { + /** Whether a complete search/replace block has been parsed */ + isComplete: boolean; + /** The content to search for in the file */ + searchContent?: string; + /** The content to replace the search content with */ + replaceContent?: string; + /** Error message if parsing failed */ + error?: string; +} + +/** + * Parses a search and replace block from content. + * + * Expected format: + * ------- SEARCH + * [content to find] + * ======= + * [content to replace with] + * +++++++ REPLACE + * + * @param content - The content to parse + * @returns ParseResult with completion status and extracted content + */ +export function parseSearchReplaceBlock( + content: string, +): SearchReplaceBlockResult { + const lines = content.split("\n"); + + let currentSearchContent = ""; + let currentReplaceContent = ""; + let inSearch = false; + let inReplace = false; + + for (const line of lines) { + if (SEARCH_BLOCK_START_REGEX.test(line)) { + inSearch = true; + inReplace = false; + currentSearchContent = ""; + currentReplaceContent = ""; + continue; + } + + if (SEARCH_BLOCK_END_REGEX.test(line)) { + if (!inSearch) { + return { + isComplete: false, + error: "Found search block end marker without matching start marker", + }; + } + inSearch = false; + inReplace = true; + continue; + } + + if (REPLACE_BLOCK_END_REGEX.test(line)) { + if (!inReplace) { + return { + isComplete: false, + error: + "Found replace block end marker without matching replace start marker", + }; + } + + // Complete block found + return { + isComplete: true, + searchContent: currentSearchContent.trim(), + replaceContent: currentReplaceContent.trim(), + }; + } + + // Accumulate content + if (inSearch) { + currentSearchContent += line + "\n"; + } else if (inReplace) { + currentReplaceContent += line + "\n"; + } + } + + // Block is not yet complete + return { + isComplete: false, + searchContent: currentSearchContent.trim(), + replaceContent: currentReplaceContent.trim(), + }; +} + +/** + * Parses all complete search and replace blocks from content. + * + * @param content - The content containing multiple search/replace blocks + * @returns Array of complete search/replace blocks found + * @throws Error if any malformed blocks are encountered + */ +export function parseAllSearchReplaceBlocks( + content: string, +): SearchReplaceBlockResult[] { + const blocks: SearchReplaceBlockResult[] = []; + const lines = content.split("\n"); + + let currentBlockLines: string[] = []; + let inBlock = false; + + for (const line of lines) { + if (SEARCH_BLOCK_START_REGEX.test(line)) { + // Start of new block + if (inBlock && currentBlockLines.length > 0) { + // Process previous incomplete block if any + const blockContent = currentBlockLines.join("\n"); + const result = parseSearchReplaceBlock(blockContent); + if (result.isComplete) { + blocks.push(result); + } else if (result.error) { + // Fail fast on any parsing error + throw new Error(result.error); + } + // If incomplete but no error, it's just a partial block - continue processing + } + currentBlockLines = [line]; + inBlock = true; + } else if (inBlock) { + currentBlockLines.push(line); + + // Check if this line completes the current block + if (REPLACE_BLOCK_END_REGEX.test(line)) { + const blockContent = currentBlockLines.join("\n"); + const result = parseSearchReplaceBlock(blockContent); + if (result.isComplete) { + blocks.push(result); + } else if (result.error) { + // Fail fast on any parsing error + throw new Error(result.error); + } + currentBlockLines = []; + inBlock = false; + } + } + } + + return blocks; +} diff --git a/core/index.d.ts b/core/index.d.ts index d2792a228..3cc31dbaf 100644 --- a/core/index.d.ts +++ b/core/index.d.ts @@ -731,6 +731,8 @@ export interface IDE { isTelemetryEnabled(): Promise; + isWorkspaceRemote(): Promise; + getUniqueId(): Promise; getTerminalContents(): Promise; @@ -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; } +export interface SlashCommandWithSource extends SlashCommandDescription { + run?: (sdk: ContinueSDK) => AsyncGenerator; // 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; - export interface CustomCommand { name: string; prompt: string; @@ -1007,6 +1036,7 @@ interface ToolChoice { export interface ConfigDependentToolParams { rules: RuleWithSource[]; + enableExperimentalTools: boolean; } export type GetTool = (params: ConfigDependentToolParams) => Tool; @@ -1170,14 +1200,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 @@ -1226,6 +1258,7 @@ export interface ContinueUIConfig { codeWrap?: boolean; showSessionTabs?: boolean; autoAcceptEditToolDiffs?: boolean; + logEditingData?: boolean; } export interface ContextMenuConfig { @@ -1289,6 +1322,14 @@ export interface ShowFilePayload { filepath: string; } +export interface ApplyToFilePayload { + streamId: string; + filepath?: string; + text: string; + toolCallId?: string; + isSearchAndReplace?: boolean; +} + export interface RangeInFileWithContents { filepath: string; range: { @@ -1298,6 +1339,16 @@ export interface RangeInFileWithContents { contents: string; } +export interface RangeInFileWithNextEditInfo { + filepath: string; + range: Range; + fileContents: string; + editText: string; + afterCursorPos: Position; + beforeCursorPos: Position; + workspaceDir: string; +} + export type SetCodeToEditPayload = RangeInFileWithContents | FileWithContents; /** @@ -1334,6 +1385,7 @@ export interface ExperimentalConfig { modelRoles?: ExperimentalModelRoles; defaultContext?: DefaultContextProvider[]; promptPath?: string; + enableExperimentalTools?: boolean; /** * Quick actions are a way to add custom commands to the Code Lens of @@ -1358,6 +1410,16 @@ export interface ExperimentalConfig { * If enabled, will add the current file as context. */ useCurrentFileAsContext?: boolean; + + /** + * If enabled, will save data on the user's editing processes + */ + logEditingData?: boolean; + + /** + * If enabled, will enable next edit in place of autocomplete + */ + optInNextEditFeature?: boolean; } export interface AnalyticsConfig { @@ -1442,7 +1504,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 ', Continue will call `getContextItems(query)`. */ @@ -1479,7 +1541,7 @@ export interface ContinueConfig { // systemMessage?: string; completionOptions?: BaseCompletionOptions; requestOptions?: RequestOptions; - slashCommands: SlashCommand[]; + slashCommands: SlashCommandWithSource[]; contextProviders: IContextProvider[]; disableSessionTitles?: boolean; disableIndexing?: boolean; @@ -1502,7 +1564,7 @@ export interface BrowserSerializedContinueConfig { // systemMessage?: string; completionOptions?: BaseCompletionOptions; requestOptions?: RequestOptions; - slashCommands: SlashCommandDescription[]; + slashCommands: SlashCommandDescWithSource[]; contextProviders: ContextProviderDescription[]; disableIndexing?: boolean; disableSessionTitles?: boolean; @@ -1577,12 +1639,12 @@ export interface RuleWithSource { slug?: string; source: RuleSource; globs?: string | string[]; + regex?: string | string[]; rule: string; description?: string; ruleFile?: string; alwaysApply?: boolean; } - export interface CompleteOnboardingPayload { mode: OnboardingModes; provider?: string; diff --git a/core/indexing/CodebaseIndexer.test.ts b/core/indexing/CodebaseIndexer.test.ts index b697520aa..f2a31209c 100644 --- a/core/indexing/CodebaseIndexer.test.ts +++ b/core/indexing/CodebaseIndexer.test.ts @@ -124,14 +124,6 @@ describe("CodebaseIndexer", () => { return updates; } - async function refreshIndexFiles(files: string[]) { - const updates = []; - for await (const update of codebaseIndexer.refreshFiles(files)) { - updates.push(update); - } - return updates; - } - async function getAllIndexedFiles() { const files = await testIndex.getIndexedFilesForTags( await testIde.getTags(testIndex.artifactId), @@ -197,7 +189,7 @@ describe("CodebaseIndexer", () => { test("should successfuly re-index specific files", async () => { // Could add more specific tests for this but uses similar logic const before = await getAllIndexedFiles(); - await refreshIndexFiles(before); + await codebaseIndexer.refreshCodebaseIndexFiles(before); const after = await getAllIndexedFiles(); expect(after.length).toBe(before.length); diff --git a/core/indexing/CodebaseIndexer.ts b/core/indexing/CodebaseIndexer.ts index 86933f8bd..d2de0c512 100644 --- a/core/indexing/CodebaseIndexer.ts +++ b/core/indexing/CodebaseIndexer.ts @@ -43,7 +43,7 @@ export class CodebaseIndexer { * - To limit memory usage for indexes that perform computations locally, e.g. FTS * - To make as few requests as possible to the embeddings providers */ - filesPerBatch = 500; + filesPerBatch = 200; private indexingCancellationController: AbortController | undefined; private codebaseIndexingState: IndexingProgressUpdate; private readonly pauseToken: PauseToken; @@ -75,16 +75,10 @@ export class CodebaseIndexer { this.pauseToken = new PauseToken(initialPaused); } - /** - * Set the paused state of the indexer - */ set paused(value: boolean) { this.pauseToken.paused = value; } - /** - * Get the current paused state of the indexer - */ get paused(): boolean { return this.pauseToken.paused; } @@ -235,7 +229,9 @@ export class CodebaseIndexer { } } - async *refreshFiles(files: string[]): AsyncGenerator { + private async *refreshFiles( + files: string[], + ): AsyncGenerator { let progress = 0; if (files.length === 0) { yield { @@ -525,7 +521,7 @@ export class CodebaseIndexer { repoName, )) { yield { - progress: progress, + progress, desc, status: "indexing", }; diff --git a/core/indexing/chunk/chunk.ts b/core/indexing/chunk/chunk.ts index 9c6917dcb..d46dd2e3b 100644 --- a/core/indexing/chunk/chunk.ts +++ b/core/indexing/chunk/chunk.ts @@ -63,13 +63,12 @@ export async function* chunkDocument({ resolve({ ...chunkWithoutId, digest, - index, + index: index++, filepath, }); })(); }), ); - index++; } for await (const chunk of chunkPromises) { if (!chunk) { diff --git a/core/llm/constants.ts b/core/llm/constants.ts index 19b067d15..0975fc142 100644 --- a/core/llm/constants.ts +++ b/core/llm/constants.ts @@ -1,5 +1,5 @@ const DEFAULT_MAX_TOKENS = 4096; -const DEFAULT_CONTEXT_LENGTH = 8192; +const DEFAULT_CONTEXT_LENGTH = 32_768; const DEFAULT_TEMPERATURE = 0.5; const DEFAULT_ARGS = { diff --git a/core/llm/constructMessages.ts b/core/llm/constructMessages.ts index 49115cb6f..dc9dbc8bf 100644 --- a/core/llm/constructMessages.ts +++ b/core/llm/constructMessages.ts @@ -19,10 +19,12 @@ export const DEFAULT_CHAT_SYSTEM_MESSAGE_URL = export const DEFAULT_AGENT_SYSTEM_MESSAGE_URL = "https://github.com/continuedev/continue/blob/main/core/llm/constructMessages.ts"; -const EDIT_MESSAGE = `\ +export const CODEBLOCK_FORMATTING_INSTRUCTIONS = `\ Always include the language and file name in the info string when you write code blocks. If you are editing "src/main.py" for example, your code block should start with '\`\`\`python src/main.py' +`; +export const EDIT_CODE_INSTRUCTIONS = `\ When addressing code modification requests, present a concise code snippet that emphasizes only the necessary changes and uses abbreviated placeholders for unmodified sections. For example: @@ -69,14 +71,15 @@ export const DEFAULT_CHAT_SYSTEM_MESSAGE = `\ If the user asks to make changes to files offer that they can use the Apply Button on the code block, or switch to Agent Mode to make the suggested updates automatically. If needed consisely explain to the user they can switch to agent mode using the Mode Selector dropdown and provide no other details. -${EDIT_MESSAGE} +${CODEBLOCK_FORMATTING_INSTRUCTIONS} +${EDIT_CODE_INSTRUCTIONS} `; export const DEFAULT_AGENT_SYSTEM_MESSAGE = `\ You are in agent mode. -${EDIT_MESSAGE} +${CODEBLOCK_FORMATTING_INSTRUCTIONS} `; /** diff --git a/core/llm/index.test.ts b/core/llm/index.test.ts index 7584e2122..1e7031f50 100644 --- a/core/llm/index.test.ts +++ b/core/llm/index.test.ts @@ -1,6 +1,10 @@ import { ChatMessage, LLMOptions } from ".."; +import { allModelProviders } from "@continuedev/llm-info"; +import { LlmInfo } from "@continuedev/llm-info/dist/types"; import { BaseLLM } from "."; +import { DEFAULT_CONTEXT_LENGTH } from "./constants"; +import { LLMClasses } from "./llms"; import { LLMLogger } from "./logger"; class DummyLLM extends BaseLLM { @@ -140,4 +144,31 @@ describe("BaseLLM", () => { describe("*streamChat", () => { // TODO: Implement tests for *streamChat method }); + + describe("default context length", () => { + allModelProviders.map((modelProvider) => { + const LLMClass = LLMClasses.find( + (llm) => llm.providerName === modelProvider.id, + ); + if (!LLMClass) { + throw new Error(`did not find LLM provider for ${modelProvider.id}`); + } + const testContextLength = (llmInfo: LlmInfo) => () => { + const llm = new LLMClass({ model: llmInfo.model }); + if (llmInfo.contextLength) { + expect(llm.contextLength).toEqual(llmInfo.contextLength); + } else { + expect(llm.contextLength).toEqual(DEFAULT_CONTEXT_LENGTH); + } + }; + describe(`${modelProvider.id}`, () => { + modelProvider.models.forEach((llmInfo) => { + test( + `should have correct context length for ${llmInfo.model}`, + testContextLength(llmInfo), + ); + }); + }); + }); + }); }); diff --git a/core/llm/index.ts b/core/llm/index.ts index 6cadb6992..bfb5c1085 100644 --- a/core/llm/index.ts +++ b/core/llm/index.ts @@ -292,6 +292,7 @@ export abstract class BaseLLM implements ILLM { apiKey: this.apiKey ?? "", apiBase: this.apiBase, requestOptions: this.requestOptions, + env: this._llmOptions.env, }); } @@ -491,28 +492,32 @@ export abstract class BaseLLM implements ILLM { const msgsCopy = messages ? messages.map((msg) => ({ ...msg })) : []; let formatted = ""; for (const msg of msgsCopy) { - let contentToShow = ""; - if (msg.role === "tool") { - contentToShow = msg.content; - } else if (msg.role === "assistant" && msg.toolCalls) { - contentToShow = msg.toolCalls - ?.map( - (toolCall) => - `${toolCall.function?.name}(${toolCall.function?.arguments})`, - ) - .join("\n"); - } else if ("content" in msg) { - if (Array.isArray(msg.content)) { - msg.content = renderChatMessage(msg); - } - contentToShow = msg.content; - } - - formatted += `<${msg.role}>\n${contentToShow}\n\n`; + formatted += this._formatChatMessage(msg); } return formatted; } + private _formatChatMessage(msg: ChatMessage): string { + let contentToShow = ""; + if (msg.role === "tool") { + contentToShow = msg.content; + } else if (msg.role === "assistant" && msg.toolCalls) { + contentToShow = msg.toolCalls + ?.map( + (toolCall) => + `${toolCall.function?.name}(${toolCall.function?.arguments})`, + ) + .join("\n"); + } else if ("content" in msg) { + if (Array.isArray(msg.content)) { + msg.content = renderChatMessage(msg); + } + contentToShow = msg.content; + } + + return `<${msg.role}>\n${contentToShow}\n\n`; + } + protected async *_streamFim( prefix: string, suffix: string, @@ -568,11 +573,12 @@ export abstract class BaseLLM implements ILLM { const result = fromChatCompletionChunk(chunk); if (result) { const content = renderChatMessage(result); + const formattedContent = this._formatChatMessage(result); interaction?.logItem({ kind: "chunk", - chunk: content, + chunk: formattedContent, }); - completion += content; + completion += formattedContent; yield content; } } @@ -931,7 +937,7 @@ export abstract class BaseLLM implements ILLM { ); const msg = fromChatResponse(response); yield msg; - completion = renderChatMessage(msg); + completion = this._formatChatMessage(msg); } else { // Stream true const stream = this.openaiAdapter.chatCompletionStream( @@ -944,7 +950,7 @@ export abstract class BaseLLM implements ILLM { for await (const chunk of stream) { const result = fromChatCompletionChunk(chunk); if (result) { - completion += result.content; + completion += this._formatChatMessage(result); interaction?.logItem({ kind: "message", message: result, @@ -960,7 +966,7 @@ export abstract class BaseLLM implements ILLM { completionOptions, )) { if (chunk.role === "assistant") { - completion += chunk.content; + completion += this._formatChatMessage(chunk); } else if (chunk.role === "thinking") { thinking += chunk.content; } diff --git a/core/llm/llms/Anthropic.ts b/core/llm/llms/Anthropic.ts index 8d1d3a67f..ff0f78c06 100644 --- a/core/llm/llms/Anthropic.ts +++ b/core/llm/llms/Anthropic.ts @@ -8,7 +8,6 @@ class Anthropic extends BaseLLM { static providerName = "anthropic"; static defaultOptions: Partial = { model: "claude-3-5-sonnet-latest", - contextLength: 200_000, completionOptions: { model: "claude-3-5-sonnet-latest", maxTokens: 8192, diff --git a/core/llm/llms/Bedrock.ts b/core/llm/llms/Bedrock.ts index ae595f3f3..371713905 100644 --- a/core/llm/llms/Bedrock.ts +++ b/core/llm/llms/Bedrock.ts @@ -48,7 +48,6 @@ class Bedrock extends BaseLLM { static defaultOptions: Partial = { region: "us-east-1", model: "anthropic.claude-3-sonnet-20240229-v1:0", - contextLength: 200_000, profile: "bedrock", }; @@ -547,7 +546,7 @@ class Bedrock extends BaseLLM { } // EMBED // - async embed(chunks: string[]): Promise { + async _embed(chunks: string[]): Promise { const credentials = await this._getCredentials(); const client = new BedrockRuntimeClient({ region: this.region, diff --git a/core/llm/llms/HuggingFaceTEI.ts b/core/llm/llms/HuggingFaceTEI.ts index 175aedde0..fcf20ac8e 100644 --- a/core/llm/llms/HuggingFaceTEI.ts +++ b/core/llm/llms/HuggingFaceTEI.ts @@ -25,16 +25,7 @@ class HuggingFaceTEIEmbeddingsProvider extends BaseLLM { }); } - async embed(chunks: string[]) { - const batchedChunks = this.getBatchedChunks(chunks); - - const results = await Promise.all( - batchedChunks.map((batch) => this.doEmbedRequest(batch)), - ); - return results.flat(); - } - - async doEmbedRequest(batch: string[]): Promise { + async _embed(batch: string[]): Promise { const headers: Record = { "Content-Type": "application/json", }; diff --git a/core/llm/llms/Ollama.ts b/core/llm/llms/Ollama.ts index 16d0e9542..106f99e1b 100644 --- a/core/llm/llms/Ollama.ts +++ b/core/llm/llms/Ollama.ts @@ -405,7 +405,6 @@ class Ollama extends BaseLLM implements ModelInstaller { parameters: tool.function.parameters, }, })); - chatOptions.stream = false; // Cannot set stream = true for tools calls } const headers: Record = { "Content-Type": "application/json", diff --git a/core/llm/llms/SageMaker.ts b/core/llm/llms/SageMaker.ts index bbb87c131..1d1a950c9 100644 --- a/core/llm/llms/SageMaker.ts +++ b/core/llm/llms/SageMaker.ts @@ -141,7 +141,7 @@ class SageMaker extends BaseLLM { } } - async embed(chunks: string[]) { + async _embed(chunks: string[]) { const credentials = await this._getCredentials(); const client = new SageMakerRuntimeClient({ region: this.region, diff --git a/core/llm/llms/Test.ts b/core/llm/llms/Test.ts index 202046cc6..814659b9b 100644 --- a/core/llm/llms/Test.ts +++ b/core/llm/llms/Test.ts @@ -2,6 +2,7 @@ import { ChatMessage, CompletionOptions } from "../../index.js"; import { BaseLLM } from "../index.js"; const HARDCODED_CHAT_RESPONSE = "THIS IS A HARDCODED RESPONSE"; +const NEXT_EDIT_COMPLETION: string = "<|editable_region_start|>\nHELLO\n"; class TestLLM extends BaseLLM { static providerName = "test"; @@ -24,7 +25,15 @@ class TestLLM extends BaseLLM { signal: AbortSignal, options: CompletionOptions, ): AsyncGenerator { - yield this.findResponse(prompt) || `PROMPT: ${prompt}`; + if ( + prompt === "NEXT_EDIT" || + prompt === + "<|im_start|>user\nNEXT_EDIT<|im_end|>\n<|im_start|>assistant\n" + ) { + yield NEXT_EDIT_COMPLETION; + } else { + yield this.findResponse(prompt) || `PROMPT: ${prompt}`; + } } protected async *_streamChat( diff --git a/core/llm/llms/index.ts b/core/llm/llms/index.ts index a003ce0cf..74c58e9da 100644 --- a/core/llm/llms/index.ts +++ b/core/llm/llms/index.ts @@ -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, + getUriFromPath: (path: string) => Promise, 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, ); } diff --git a/core/llm/rules/getSystemMessageWithRules.ts b/core/llm/rules/getSystemMessageWithRules.ts index a0f3cf64f..c005a5f92 100644 --- a/core/llm/rules/getSystemMessageWithRules.ts +++ b/core/llm/rules/getSystemMessageWithRules.ts @@ -7,6 +7,7 @@ import { } from "../.."; import { renderChatMessage } from "../../util/messageContent"; import { getCleanUriPath } from "../../util/uri"; +import { extractContentFromCodeBlock } from "../utils/extractContentFromCodeBlocks"; import { extractPathsFromCodeBlocks } from "../utils/extractPathsFromCodeBlocks"; import { RulePolicies } from "./types"; @@ -52,6 +53,47 @@ const matchesGlobs = ( return false; }; +/** + * Checks if file content matches any of the provided regex regex + * + * @param fileContent - The content of the file to check + * @param regex - A single regex pattern string or array of regex pattern strings + * @returns true if the content matches any pattern (or if no regex is provided), false otherwise + */ +const contentMatchesRegex = ( + fileContent: string, + regex: string | string[], +): boolean => { + // Handle single string pattern + if (typeof regex === "string") { + try { + const expression = new RegExp(regex); + return expression.test(fileContent); + } catch (e) { + console.error(`Invalid regex pattern: ${regex}`, e); + return false; + } + } + + // Handle array of regex + if (Array.isArray(regex)) { + if (regex.length === 0) return true; + + // Content must match at least one pattern + return regex.some((pattern) => { + try { + const regex = new RegExp(pattern); + return regex.test(fileContent); + } catch (e) { + console.error(`Invalid regex pattern: ${pattern}`, e); + return false; + } + }); + } + + return false; +}; + /** * Determines if a file path is within a specific directory or its subdirectories * @@ -103,25 +145,67 @@ const isGlobalRule = (rule: RuleWithSource): boolean => { return true; } - // Root-level rules with no globs are implicitly global - if (isRootLevelRule(rule) && !rule.globs && rule.alwaysApply !== false) { + // Root-level rules with no globs or regex are implicitly global + if ( + isRootLevelRule(rule) && + !rule.globs && + !rule.regex && + rule.alwaysApply !== false + ) { return true; } return false; }; +const checkGlobsAndRegex = ({ + rule, + filePaths, + fileContents, +}: { + rule: RuleWithSource; + filePaths: string[]; + fileContents: Record; +}) => { + const matchingFiles = rule.globs + ? filePaths.filter((filePath) => matchesGlobs(filePath, rule.globs)) + : filePaths; + + // If no files match the globs, don't apply the rule + if (matchingFiles.length === 0) { + return false; + } + + // Now check for pattern matches in file contents if regex are specified + if (rule.regex) { + // Check if any of the matching files also match the content regex + return matchingFiles.some((filePath) => { + const content = fileContents[filePath]; + // If we don't have the content, we can't check regex + if (!content) return false; + return contentMatchesRegex(content, rule.regex!); + }); + } + + // If we have no regex or if we couldn't check regex (no content), + // just go with the glob matches + return matchingFiles.length > 0; +}; + /** - * Determines if a rule should be applied based on its alwaysApply property and file path matching + * Determines if a rule should be applied based on its properties and file matching * * @param rule - The rule to check * @param filePaths - Array of file paths to check against the rule's globs + * @param fileContents - Map of file paths to their contents for pattern matching + * @param rulePolicies - Optional policies that can override normal rule behavior * @returns true if the rule should be applied, false otherwise */ export const shouldApplyRule = ( rule: RuleWithSource, filePaths: string[], rulePolicies: RulePolicies = {}, + fileContents: Record = {}, ): boolean => { const policy = rulePolicies[rule.name || ""]; @@ -157,40 +241,27 @@ export const shouldApplyRule = ( isFileInDirectory(filePath, ruleDirPath), ); - // If no files are in this directory, don't apply the rule - if (filesInRuleDirectory.length === 0) { - return false; - } - - // If we have globs, check if any files in this directory match them - if (rule.globs) { - return filesInRuleDirectory.some((filePath) => - matchesGlobs(filePath, rule.globs), - ); - } - - // No globs but files are in this directory, so apply the rule - return true; + return checkGlobsAndRegex({ + filePaths: filesInRuleDirectory, + fileContents, + rule, + }); } - // For root-level rules: - - // If alwaysApply is explicitly false, only apply if there are globs AND they match - if (rule.alwaysApply === false) { - if (!rule.globs) { - return false; - } - return filePaths.some((path) => matchesGlobs(path, rule.globs)); + // If alwaysApply is explicitly false, we need to check globs and/or regex + if ( + rule.alwaysApply === false && + rule.globs === undefined && + rule.regex === undefined + ) { + return false; } - // Default behavior for root rules with globs: - // - Only apply if they match the globs - if (rule.globs) { - return filePaths.some((path) => matchesGlobs(path, rule.globs)); - } - - // This point should not be reached as we've handled all cases above - return false; + return checkGlobsAndRegex({ + filePaths, + fileContents, + rule, + }); }; /** @@ -220,10 +291,34 @@ export const getApplicableRules = ( // Combine file paths from both sources const allFilePaths = [...filePathsFromMessage, ...filePathsFromContextItems]; + // Create a map of file paths to their contents for pattern matching + const fileContents: Record = {}; + + // Extract contents from context items with file URIs + contextItems.forEach((item) => { + if (item.uri?.type === "file" && item.uri?.value) { + fileContents[item.uri.value] = item.content; + } + }); + + // Extract contents from code blocks in the message for paths that don't have content yet + if (userMessage) { + const messageContent = renderChatMessage(userMessage); + filePathsFromMessage.forEach((path) => { + // Only extract content if we don't already have it from context items + if (!fileContents[path]) { + const blockContent = extractContentFromCodeBlock(messageContent, path); + if (blockContent) { + fileContents[path] = blockContent; + } + } + }); + } + // Apply shouldApplyRule to all rules - this will handle global rules, rule policies, // and path matching in a consistent way const applicableRules = rules.filter((rule) => - shouldApplyRule(rule, allFilePaths, rulePolicies), + shouldApplyRule(rule, allFilePaths, rulePolicies, fileContents), ); return applicableRules; diff --git a/core/llm/rules/getSystemMessageWithRules.vitest.ts b/core/llm/rules/getSystemMessageWithRules.vitest.ts index f652d3a77..0b4444cd1 100644 --- a/core/llm/rules/getSystemMessageWithRules.vitest.ts +++ b/core/llm/rules/getSystemMessageWithRules.vitest.ts @@ -1,6 +1,14 @@ import { describe, expect, it } from "vitest"; -import { RuleWithSource } from "../.."; -import { shouldApplyRule } from "./getSystemMessageWithRules"; +import { + ContextItemId, + ContextItemWithId, + RuleWithSource, + UserChatMessage, +} from "../.."; +import { + getApplicableRules, + shouldApplyRule, +} from "./getSystemMessageWithRules"; import { RulePolicies } from "./types"; describe("Rule colocation glob matching", () => { @@ -244,3 +252,228 @@ describe("Rule policies", () => { ).toBe(false); }); }); + +describe("Content pattern matching", () => { + it("should apply rules when file content matches pattern", () => { + // Rule with pattern to match React component files + const reactComponentRule: RuleWithSource = { + name: "React Component Rule", + rule: "Follow React component standards", + regex: "export (function|const) \\w+.*\\(", + source: "rules-block", + ruleFile: "src/components/rules.md", + }; + + // File that matches the pattern + const filePath = "src/components/Button.tsx"; + const fileContents = { + [filePath]: + "export function Button() { return }", + }; + + expect( + shouldApplyRule(reactComponentRule, [filePath], {}, fileContents), + ).toBe(true); + + // File that doesn't match the pattern + const nonMatchingContents = { + [filePath]: + "import React from 'react'; // Just an import, not a component", + }; + + expect( + shouldApplyRule(reactComponentRule, [filePath], {}, nonMatchingContents), + ).toBe(false); + }); + + it("should support multiple regex regex as an array", () => { + // Rule with multiple regex + const multiPatternRule: RuleWithSource = { + name: "Multi-Pattern Rule", + rule: "Apply to functions or classes", + regex: ["function\\s+\\w+", "class\\s+\\w+"], + source: "rules-block", + ruleFile: "src/utils/rules.md", + }; + + const filePath = "src/utils/helper.ts"; + + // Content with function - should match + const functionContent = { + [filePath]: "function formatDate(date) { return date.toISOString(); }", + }; + expect( + shouldApplyRule(multiPatternRule, [filePath], {}, functionContent), + ).toBe(true); + + // Content with class - should match + const classContent = { + [filePath]: + "class DateFormatter { format(date) { return date.toISOString(); } }", + }; + expect( + shouldApplyRule(multiPatternRule, [filePath], {}, classContent), + ).toBe(true); + + // Content with neither - should not match + const nonMatchingContent = { + [filePath]: "const PI = 3.14159;", + }; + expect( + shouldApplyRule(multiPatternRule, [filePath], {}, nonMatchingContent), + ).toBe(false); + }); + + it("should apply rules based on both globs and regex when both are specified", () => { + // Rule with both glob and pattern restrictions + const typescriptClassRule: RuleWithSource = { + name: "TypeScript Class Rule", + rule: "Follow class standards in TypeScript", + globs: "**/*.ts", + regex: "class\\s+\\w+", + source: "rules-block", + ruleFile: "src/models/rules.md", + }; + + const tsFilePath = "src/models/User.ts"; + const jsFilePath = "src/models/Product.js"; + + // TypeScript file with class - should match + const tsClassContent = { + [tsFilePath]: "export class User { constructor(public name: string) {} }", + }; + expect( + shouldApplyRule(typescriptClassRule, [tsFilePath], {}, tsClassContent), + ).toBe(true); + + // TypeScript file without class - should not match + const tsNonClassContent = { + [tsFilePath]: "export const createUser = (name: string) => ({ name });", + }; + expect( + shouldApplyRule(typescriptClassRule, [tsFilePath], {}, tsNonClassContent), + ).toBe(false); + + // JavaScript file with class - should not match due to glob + const jsClassContent = { + [jsFilePath]: + "export class Product { constructor(name) { this.name = name; } }", + }; + expect( + shouldApplyRule(typescriptClassRule, [jsFilePath], {}, jsClassContent), + ).toBe(false); + }); + + it("should extract file content from messages for pattern matching", () => { + // Rule with pattern + const arrowFunctionRule: RuleWithSource = { + name: "Arrow Function Rule", + rule: "Use arrow functions for better this binding", + regex: "const\\s+\\w+\\s*=\\s*\\(", + source: "rules-block", + ruleFile: "src/utils/rules.md", + }; + + // Message with code block containing a matching pattern + const messageWithArrowFn: UserChatMessage = { + role: "user", + content: + "Can you check this code?\n```typescript src/utils/formatter.ts\nconst format = (date) => {\n return date.toISOString();\n};\n```", + }; + + // Create context item to match the file in the message + const contextItem: ContextItemWithId = { + id: { providerTitle: "file", itemId: "formatter" } as ContextItemId, + uri: { type: "file", value: "src/utils/formatter.ts" }, + content: "const format = (date) => {\n return date.toISOString();\n};", + name: "formatter.ts", + description: "Utility formatter", + }; + + // Should match the pattern + const applicableRules = getApplicableRules( + messageWithArrowFn, + [arrowFunctionRule], + [contextItem], + ); + + expect(applicableRules).toHaveLength(1); + expect(applicableRules[0].name).toBe("Arrow Function Rule"); + + // Message with code block that doesn't match the pattern + const messageWithoutArrowFn: UserChatMessage = { + role: "user", + content: + "Can you check this code?\n```typescript src/utils/formatter.ts\nfunction format(date) {\n return date.toISOString();\n}\n```", + }; + + // Context item with non-matching content + const nonMatchingContextItem: ContextItemWithId = { + id: { providerTitle: "file", itemId: "formatter2" } as ContextItemId, + uri: { type: "file", value: "src/utils/formatter.ts" }, + content: "function format(date) {\n return date.toISOString();\n}", + name: "formatter.ts", + description: "Utility formatter", + }; + + // Should not match the pattern + const nonApplicableRules = getApplicableRules( + messageWithoutArrowFn, + [arrowFunctionRule], + [nonMatchingContextItem], + ); + + expect(nonApplicableRules).toHaveLength(0); + }); + + it("should handle invalid regex regex gracefully", () => { + // Rule with invalid regex pattern + const invalidRegexRule: RuleWithSource = { + name: "Invalid Regex Rule", + rule: "This rule has an invalid regex pattern", + regex: "([unclosed parenthesis", + source: "rules-block", + ruleFile: "src/utils/rules.md", + }; + + const filePath = "src/utils/helper.ts"; + const fileContents = { + [filePath]: "function helper() { return true; }", + }; + + // Should not throw an error but gracefully not apply the rule + expect( + shouldApplyRule(invalidRegexRule, [filePath], {}, fileContents), + ).toBe(false); + }); + + it("should respect directory restrictions for pattern rules", () => { + // Rule with pattern in a nested directory + const nestedPatternRule: RuleWithSource = { + name: "Nested Pattern Rule", + rule: "Apply only to model files with interfaces", + regex: "interface\\s+\\w+", + source: "rules-block", + ruleFile: "src/models/rules.md", + }; + + // File in the correct directory with matching content + const modelFilePath = "src/models/User.ts"; + const modelContents = { + [modelFilePath]: "export interface User { id: string; name: string; }", + }; + expect( + shouldApplyRule(nestedPatternRule, [modelFilePath], {}, modelContents), + ).toBe(true); + + // File outside the directory with matching content - should not match + const utilFilePath = "src/utils/types.ts"; + const utilContents = { + [utilFilePath]: + "export interface Config { apiUrl: string; timeout: number; }", + }; + expect( + shouldApplyRule(nestedPatternRule, [utilFilePath], {}, utilContents), + ).toBe(false); + }); +}); diff --git a/core/llm/streamChat.ts b/core/llm/streamChat.ts index 3f52a0192..00efc8c2d 100644 --- a/core/llm/streamChat.ts +++ b/core/llm/streamChat.ts @@ -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, diff --git a/core/llm/utils/extractContentFromCodeBlocks.test.ts b/core/llm/utils/extractContentFromCodeBlocks.test.ts new file mode 100644 index 000000000..47a814934 --- /dev/null +++ b/core/llm/utils/extractContentFromCodeBlocks.test.ts @@ -0,0 +1,94 @@ +import { extractContentFromCodeBlock } from "./extractContentFromCodeBlocks"; + +describe("extractContentFromCodeBlock", () => { + it("should extract content from code block with language and filepath", () => { + const content = "```typescript src/main.ts\nconst x = 1;\n```"; + expect(extractContentFromCodeBlock(content, "src/main.ts")).toBe( + "const x = 1;", + ); + }); + + it("should extract content from code block with filepath only (no language)", () => { + const content = "```test.js\nclass Calculator { }\n```"; + expect(extractContentFromCodeBlock(content, "test.js")).toBe( + "class Calculator { }", + ); + }); + + it("should extract content from code block with line ranges", () => { + const content = "```js test.js (19-25)\nfunction test() {}\n```"; + expect(extractContentFromCodeBlock(content, "test.js")).toBe( + "function test() {}", + ); + }); + + it("should handle multiple code blocks and find the right one", () => { + const content = + "```typescript src/main.ts\nconst x = 1;\n```\n" + + "```test.js\nclass Calculator { }\n```\n" + + "```js utils.js (19-25)\nfunction test() {}\n```"; + + expect(extractContentFromCodeBlock(content, "src/main.ts")).toBe( + "const x = 1;", + ); + expect(extractContentFromCodeBlock(content, "test.js")).toBe( + "class Calculator { }", + ); + expect(extractContentFromCodeBlock(content, "utils.js")).toBe( + "function test() {}", + ); + }); + + it("should handle paths with special regex characters", () => { + const content = + "```typescript src/special+chars.ts[123]\nconst special = true;\n```"; + expect( + extractContentFromCodeBlock(content, "src/special+chars.ts[123]"), + ).toBe("const special = true;"); + }); + + it("should handle multiline content", () => { + const content = + "```typescript src/multi-line.ts\n" + + "function example() {\n" + + " const x = 1;\n" + + " return x + 2;\n" + + "}\n" + + "```"; + + const expected = + "function example() {\n" + " const x = 1;\n" + " return x + 2;\n" + "}"; + + expect(extractContentFromCodeBlock(content, "src/multi-line.ts")).toBe( + expected, + ); + }); + + it("should return undefined when path doesn't exist in any code block", () => { + const content = "```typescript src/main.ts\nconst x = 1;\n```"; + expect( + extractContentFromCodeBlock(content, "nonexistent.ts"), + ).toBeUndefined(); + }); + + it("should extract content when the path has directory structure", () => { + const content = + "```js src/components/Button.jsx\nconst Button = () => ;\n```"; + expect( + extractContentFromCodeBlock(content, "src/components/Button.jsx"), + ).toBe("const Button = () => ;"); + }); + + it("should match exact paths only", () => { + const content = + "```typescript src/utils.ts\nconst util = {};\n```\n" + + "```typescript src/utils/index.ts\nconst index = {};\n```"; + + expect(extractContentFromCodeBlock(content, "src/utils.ts")).toBe( + "const util = {};", + ); + expect(extractContentFromCodeBlock(content, "src/utils/index.ts")).toBe( + "const index = {};", + ); + }); +}); diff --git a/core/llm/utils/extractContentFromCodeBlocks.ts b/core/llm/utils/extractContentFromCodeBlocks.ts new file mode 100644 index 000000000..c67ab2f7d --- /dev/null +++ b/core/llm/utils/extractContentFromCodeBlocks.ts @@ -0,0 +1,33 @@ +/** + * Extracts content from code blocks with given path + * @param content The full message content + * @param path The file path to look for + * @returns The content of the code block if found, undefined otherwise + */ +export function extractContentFromCodeBlock( + content: string, + path: string, +): string | undefined { + // Escape special characters in the path for regex + const escapedPath = path.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"); + + // Match the code block with this path + // This regex looks for: + // 1. Code block start with the path (```[language] path) + // 2. The content until the closing ``` + // The path can be: + // - With language: ```typescript src/main.ts + // - Without language: ```src/main.ts + // - With line ranges: ```js src/main.ts (1-10) + const regex = new RegExp( + `\`\`\`[^\\n]*\\b${escapedPath}(?:\\s+\\([\\d-]+\\))?[^\\n]*\\n([\\s\\S]*?)\\n\`\`\``, + "m", + ); + + const match = content.match(regex); + if (match && match[1]) { + return match[1]; + } + + return undefined; +} diff --git a/core/nextEdit/NextEditProvider.ts b/core/nextEdit/NextEditProvider.ts index 316dc61e9..df4168b28 100644 --- a/core/nextEdit/NextEditProvider.ts +++ b/core/nextEdit/NextEditProvider.ts @@ -1,17 +1,14 @@ import { ConfigHandler } from "../config/ConfigHandler.js"; -import { IDE, ILLM } from "../index.js"; +import { ChatMessage, IDE, ILLM } from "../index.js"; import OpenAI from "../llm/llms/OpenAI.js"; import { DEFAULT_AUTOCOMPLETE_OPTS } from "../util/parameters.js"; -import { shouldCompleteMultiline } from "../autocomplete/classification/shouldCompleteMultiline.js"; import { ContextRetrievalService } from "../autocomplete/context/ContextRetrievalService.js"; import { BracketMatchingService } from "../autocomplete/filtering/BracketMatchingService.js"; import { CompletionStreamer } from "../autocomplete/generation/CompletionStreamer.js"; -import { postprocessCompletion } from "../autocomplete/postprocessing/index.js"; import { shouldPrefilter } from "../autocomplete/prefiltering/index.js"; -import { getAllSnippets } from "../autocomplete/snippets/index.js"; -import { renderPrompt } from "../autocomplete/templating/index.js"; +import { getAllSnippetsWithoutRace } from "../autocomplete/snippets/index.js"; import { GetLspDefinitionsFunction } from "../autocomplete/types.js"; import { AutocompleteDebouncer } from "../autocomplete/util/AutocompleteDebouncer.js"; import { AutocompleteLoggingService } from "../autocomplete/util/AutocompleteLoggingService.js"; @@ -21,6 +18,14 @@ import { AutocompleteInput, AutocompleteOutcome, } from "../autocomplete/util/types.js"; +import { replaceEscapedCharacters } from "../util/text.js"; +import { + Prompt, + renderDefaultSystemPrompt, + renderDefaultUserPrompt, + renderPrompt, +} from "./templating/NextEditPromptEngine.js"; +// import { renderPrompt } from "./templating/NextEditPromptEngine.js"; const autocompleteCache = AutocompleteLruCache.get(); @@ -33,6 +38,8 @@ const ERRORS_TO_IGNORE = [ ]; export class NextEditProvider { + private static instance: NextEditProvider | null = null; + private autocompleteCache = AutocompleteLruCache.get(); public errorsShown: Set = new Set(); private bracketMatchingService = new BracketMatchingService(); @@ -40,16 +47,54 @@ export class NextEditProvider { private completionStreamer: CompletionStreamer; private loggingService = new AutocompleteLoggingService(); private contextRetrievalService: ContextRetrievalService; + private endpointType: "default" | "fineTuned"; + private diffContext: string = ""; - constructor( + private constructor( private readonly configHandler: ConfigHandler, private readonly ide: IDE, private readonly _injectedGetLlm: () => Promise, private readonly _onError: (e: any) => void, private readonly getDefinitionsFromLsp: GetLspDefinitionsFunction, + endpointType: "default" | "fineTuned", ) { this.completionStreamer = new CompletionStreamer(this.onError.bind(this)); this.contextRetrievalService = new ContextRetrievalService(this.ide); + this.endpointType = endpointType; + } + + public static initialize( + configHandler: ConfigHandler, + ide: IDE, + injectedGetLlm: () => Promise, + onError: (e: any) => void, + getDefinitionsFromLsp: GetLspDefinitionsFunction, + endpointType: "default" | "fineTuned", + ): NextEditProvider { + if (!NextEditProvider.instance) { + NextEditProvider.instance = new NextEditProvider( + configHandler, + ide, + injectedGetLlm, + onError, + getDefinitionsFromLsp, + endpointType, + ); + } + return NextEditProvider.instance; + } + + public static getInstance(): NextEditProvider { + if (!NextEditProvider.instance) { + throw new Error( + "NextEditProvider has not been initialized. Call initialize() first.", + ); + } + return NextEditProvider.instance; + } + + public addDiffToContext(diff: string): void { + this.diffContext = diff; } private async _prepareLlm(): Promise { @@ -174,7 +219,7 @@ export class NextEditProvider { } const [snippetPayload, workspaceDirs] = await Promise.all([ - getAllSnippets({ + getAllSnippetsWithoutRace({ helper, ide: this.ide, getDefinitionsFromLsp: this.getDefinitionsFromLsp, @@ -183,100 +228,241 @@ export class NextEditProvider { this.ide.getWorkspaceDirs(), ]); - const { prompt, prefix, suffix, completionOptions } = renderPrompt({ - snippetPayload, - workspaceDirs, - helper, - }); + // TODO: Toggle between the default endpoint and the finetuned endpoint. + const prompts: Prompt[] = []; - // Completion - let completion: string | undefined = ""; - - const cache = await autocompleteCache; - const cachedCompletion = helper.options.useCache - ? await cache.get(helper.prunedPrefix) - : undefined; - let cacheHit = false; - if (cachedCompletion) { - // Cache - cacheHit = true; - completion = cachedCompletion; + if (this.endpointType === "default") { + prompts.push(renderDefaultSystemPrompt()); + prompts.push(renderDefaultUserPrompt(snippetPayload, helper)); } else { - const multiline = - !helper.options.transform || shouldCompleteMultiline(helper); + prompts.push( + // await renderFineTunedUserPrompt(snippetPayload, this.ide, helper), + // await renderFineTunedBasicUserPrompt( + // snippetPayload, + // this.ide, + // helper, + // this.diffContext, + // ), + renderPrompt(helper, this.diffContext), + ); + } - const completionStream = - this.completionStreamer.streamCompletionWithFilters( - token, - llm, - prefix, - suffix, - prompt, - multiline, - completionOptions, - helper, - ); - - for await (const update of completionStream) { - completion += update; - } - - // Don't postprocess if aborted - if (token.aborted) { + if (this.endpointType === "default") { + const msg: ChatMessage = await llm.chat(prompts, token); + if (typeof msg.content === "string") { + const nextCompletion = JSON.parse(msg.content).newCode; + const outcomeNext: AutocompleteOutcome = { + time: Date.now() - startTime, + completion: nextCompletion, + prefix: "", + suffix: "", + prompt: "", + modelProvider: llm.underlyingProviderName, + modelName: llm.model, + completionOptions: null, + cacheHit: false, + filepath: helper.filepath, + numLines: nextCompletion.split("\n").length, + completionId: helper.input.completionId, + gitRepo: await this.ide.getRepoName(helper.filepath), + uniqueId: await this.ide.getUniqueId(), + timestamp: Date.now(), + ...helper.options, + }; + return outcomeNext; + } else { return undefined; } + // const body = { + // model: defaultModel, + // messages: prompts, + // // max_tokens: 15000, + // // stop: ["<|editable_region_end|>"], + // }; + // + // const resp = await fetch(defaultEndpoint, { + // method: "POST", + // headers: { + // Authorization: `Bearer ${mercuryToken} `, + // "Content-Type": "application/json", + // }, + // body: JSON.stringify(body), + // }); + // + // const respJson = await resp.json(); - const processedCompletion = helper.options.transform - ? postprocessCompletion({ - completion, - prefix: helper.prunedPrefix, - suffix: helper.prunedSuffix, - llm, - }) - : completion; + // TODO: Do some zod schema validation here if needed. + } else { + // const testController = new AbortController(); + // const msg: ChatMessage = await llm.chat(prompts, testController.signal); + // const testToken = testController.signal; + const msg: ChatMessage = await llm.chat(prompts, token); + if (typeof msg.content === "string") { + // TODO: There are cases where msg.conetnt.split("<|start|>")[1] is undefined + const nextCompletion = replaceEscapedCharacters( + msg.content.split("<|editable_region_start|>\n")[1], + ).replace(/\n$/, ""); - completion = processedCompletion; + // const diffLines = myersDiff(helper.fileContents, nextCompletion); + + // const diff = getRenderableDiff(diffLines); + const outcomeNext: AutocompleteOutcome = { + time: Date.now() - startTime, + completion: nextCompletion, + prefix: "", + suffix: "", + prompt: "", + modelProvider: llm.underlyingProviderName, + modelName: llm.model, + completionOptions: null, + cacheHit: false, + filepath: helper.filepath, + numLines: nextCompletion.split("\n").length, + completionId: helper.input.completionId, + gitRepo: await this.ide.getRepoName(helper.filepath), + uniqueId: await this.ide.getUniqueId(), + timestamp: Date.now(), + ...helper.options, + }; + return outcomeNext; + } else { + return undefined; + } + // const body = { + // model: fineTunedModel, + // messages: prompts, + // max_tokens: 15000, + // stop: ["<|editable_region_end|>"], + // }; + // + // const resp = await fetch(fineTunedEndpoint, { + // method: "POST", + // headers: { + // Authorization: `Bearer ${mercuryToken} `, + // "Content-Type": "application/json", + // }, + // body: JSON.stringify(body), + // }); + // + // const respJson = await resp.json(); + // + // const nextCompletion = respJson.choices[0].message.content + // .split("<|editable_region_start|>\n")[1] + // .split("<|editable_region_end|>")[0] + // .slice(1) + // .slice(0, -1) + // .replaceAll("\\n", "\n") + // .replaceAll('\\"', '"'); + // + // const outcomeNext: AutocompleteOutcome = { + // time: Date.now() - startTime, + // completion: nextCompletion, + // prefix: "", + // suffix: "", + // prompt: "", + // modelProvider: llm.underlyingProviderName, + // modelName: llm.model, + // completionOptions: null, + // cacheHit: false, + // filepath: helper.filepath, + // numLines: nextCompletion.split("\n").length, + // completionId: helper.input.completionId, + // gitRepo: await this.ide.getRepoName(helper.filepath), + // uniqueId: await this.ide.getUniqueId(), + // timestamp: Date.now(), + // ...helper.options, + // }; + // return outcomeNext; } - if (!completion) { - return undefined; - } + // // Completion + // let completion: string | undefined = ""; - const outcome: AutocompleteOutcome = { - time: Date.now() - startTime, - completion, - prefix, - suffix, - prompt, - modelProvider: llm.underlyingProviderName, - modelName: llm.model, - completionOptions, - cacheHit, - filepath: helper.filepath, - numLines: completion.split("\n").length, - completionId: helper.input.completionId, - gitRepo: await this.ide.getRepoName(helper.filepath), - uniqueId: await this.ide.getUniqueId(), - timestamp: Date.now(), - ...helper.options, - }; + // const cache = await autocompleteCache; + // const cachedCompletion = helper.options.useCache + // ? await cache.get(helper.prunedPrefix) + // : undefined; + // let cacheHit = false; + // if (cachedCompletion) { + // // Cache + // cacheHit = true; + // completion = cachedCompletion; + // } else { + // const multiline = + // !helper.options.transform || shouldCompleteMultiline(helper); - ////////// + // const completionStream = + // this.completionStreamer.streamCompletionWithFilters( + // token, + // llm, + // prefix, + // suffix, + // prompt, + // multiline, + // completionOptions, + // helper, + // ); - // Save to cache - if (!outcome.cacheHit && helper.options.useCache) { - (await this.autocompleteCache) - .put(outcome.prefix, outcome.completion) - .catch((e) => console.warn(`Failed to save to cache: ${e.message}`)); - } + // for await (const update of completionStream) { + // completion += update; + // } - // When using the JetBrains extension, Mark as displayed - const ideType = (await this.ide.getIdeInfo()).ideType; - if (ideType === "jetbrains") { - this.markDisplayed(input.completionId, outcome); - } + // // Don't postprocess if aborted + // if (token.aborted) { + // return undefined; + // } - return outcome; + // const processedCompletion = helper.options.transform + // ? postprocessCompletion({ + // completion, + // prefix: helper.prunedPrefix, + // suffix: helper.prunedSuffix, + // llm, + // }) + // : completion; + + // completion = processedCompletion; + // } + + // if (!completion) { + // return undefined; + // } + + // const outcome: AutocompleteOutcome = { + // time: Date.now() - startTime, + // completion, + // prefix, + // suffix, + // prompt, + // modelProvider: llm.underlyingProviderName, + // modelName: llm.model, + // completionOptions, + // cacheHit, + // filepath: helper.filepath, + // numLines: completion.split("\n").length, + // completionId: helper.input.completionId, + // gitRepo: await this.ide.getRepoName(helper.filepath), + // uniqueId: await this.ide.getUniqueId(), + // timestamp: Date.now(), + // ...helper.options, + // }; + + // ////////// + + // // Save to cache + // if (!outcome.cacheHit && helper.options.useCache) { + // (await this.autocompleteCache) + // .put(outcome.prefix, outcome.completion) + // .catch((e) => console.warn(`Failed to save to cache: ${e.message}`)); + // } + + // // When using the JetBrains extension, Mark as displayed + // const ideType = (await this.ide.getIdeInfo()).ideType; + // if (ideType === "jetbrains") { + // this.markDisplayed(input.completionId, outcome); + // } + + // return outcome; } catch (e: any) { this.onError(e); } finally { diff --git a/core/nextEdit/README.md b/core/nextEdit/README.md new file mode 100644 index 000000000..2c78f484f --- /dev/null +++ b/core/nextEdit/README.md @@ -0,0 +1,29 @@ +# Next Edit Prediction + +## What is it? + +## How is it different from autocomplete? + +## Where are we right now? + +- Users can decide to switch between autocomplete and next edit. +- Next edit triggers at the same time autocomplete is triggered, via vscode's inline completion provider. +- The following happens after the trigger: + - User's current cursor position is captured. + - We define an editable range, ±5 lines from the current cursor position. + - User's most recent edit is captured as a unified diff. (this is currently buggy) + - This is sent to the model, which returns a new editable range with next edit predictions. + - We display this new editable range in a SVG decoration. + - User can either tab to accept or esc to reject. + - On accept, the old editable range will be replaced by the new editable region. The cursor will be moved to the last line containing some change. + - On reject, nothing happens. + +## What needs to be worked on? + +- User edit captures. +- Find a better way to trigger next edit (this links back to the diff capture problem). + - We can see that next edit triggers as soon as the user accepts a change. This is because autocomplete runs the same way. + - I think autocomplete has some filter logic that doesn't display the ghost text under some conditions, which I am guessing are the following: + - The model does not have any more completions to create. + - The prediction at the cursor location has been cached. +- JetBrains integration. diff --git a/core/nextEdit/constants.ts b/core/nextEdit/constants.ts index 317a3dcf7..6c1e86fbc 100644 --- a/core/nextEdit/constants.ts +++ b/core/nextEdit/constants.ts @@ -1 +1,6 @@ export const IS_NEXT_EDIT_ACTIVE = false; +export const NEXT_EDIT_EDITABLE_REGION_TOP_MARGIN = 5; +export const NEXT_EDIT_EDITABLE_REGION_BOTTOM_MARGIN = 5; +export const USER_CURSOR_IS_HERE_TOKEN = "<|user_cursor_is_here|>"; +export const EDITABLE_REGION_START_TOKEN = "<|editable_region_start|>"; +export const EDITABLE_REGION_END_TOKEN = "<|editable_region_end|>"; diff --git a/core/nextEdit/context/aggregateEdits.ts b/core/nextEdit/context/aggregateEdits.ts new file mode 100644 index 000000000..4443b1d9e --- /dev/null +++ b/core/nextEdit/context/aggregateEdits.ts @@ -0,0 +1,575 @@ +import { Position, RangeInFileWithNextEditInfo } from "../.."; +import { + BeforeAfterDiff, + DiffFormatType, + createBeforeAfterDiff, + createDiff, +} from "./diffFormatting"; + +interface ClusterState { + beforeState: string; // stores content of cluster before edit + startRange: { minLine: number; maxLine: number }; + currentRange: { minLine: number; maxLine: number }; + edits: RangeInFileWithNextEditInfo[]; // store small edits that form the cluster + firstTimestamp: number; + lastTimestamp: number; + lastLine: number; + firstEditBeforeCursor: { line: number; character: number }; // cursor position before the first edit in the cluster + lastEditAfterCursor: { line: number; character: number }; // cursor position after the last edit in the previous cluster +} + +interface FileState { + activeClusters: ClusterState[]; // Stores active clusters for the file + currentContent: string; // Stores the current content of the file + priorComparisons: string[]; // Stores prior comparisons for the file (not currently used, but kept for future use) + processingQueue: Array<() => Promise>; // Stores a queue of small edits to be processed into clusters + isProcessing: boolean; +} + +export interface EditClusterConfig { + deltaT: number; // Time threshold in seconds; if exceeded, a new cluster is created + deltaL: number; // Line threshold; if the user jumps more than this many lines, a new cluster is created + maxEdits: number; // Maximum number of edits in a cluster + maxDuration: number; // Maximum total duration of an edit in seconds + contextSize: number; // Number of previous edits to store; not currently used but kept for future use + contextLines: number; // Used for computations involving deltaL +} + +export class EditAggregator { + private fileStates: Map = new Map(); + public config: EditClusterConfig; + private previousEditFinalCursorPosition: Position; + private lastProcessedFilePath: string | null = null; + public onComparisonFinalized: ( + diff: BeforeAfterDiff, + beforeCursorPos: Position, + afterPrevEditCursorPos: Position, + ) => void; + + private static _instance: EditAggregator | null = null; + + public static getInstance( + config?: Partial, + onComparisonFinalized?: ( + diff: BeforeAfterDiff, + beforeCursorPos: Position, + afterPrevEditCursorPos: Position, + ) => void, + ): EditAggregator { + // Create instance if it doesn't exist + if (!EditAggregator._instance) { + EditAggregator._instance = new EditAggregator( + config, + onComparisonFinalized, + ); + } + // Update instance if new parameters are provided + else if (config || onComparisonFinalized) { + if (config) { + EditAggregator._instance.config = { + deltaT: config.deltaT ?? EditAggregator._instance.config.deltaT, + deltaL: config.deltaL ?? EditAggregator._instance.config.deltaL, + maxEdits: config.maxEdits ?? EditAggregator._instance.config.maxEdits, + maxDuration: + config.maxDuration ?? EditAggregator._instance.config.maxDuration, + contextSize: + config.contextSize ?? EditAggregator._instance.config.contextSize, + contextLines: + config.contextLines ?? EditAggregator._instance.config.contextLines, + }; + } + + if (onComparisonFinalized) { + EditAggregator._instance.onComparisonFinalized = onComparisonFinalized; + } + } + + return EditAggregator._instance; + } + + constructor( + config: Partial = {}, + onComparisonFinalized: ( + diff: BeforeAfterDiff, + beforeCursorPos: Position, + afterPrevEditCursorPos: Position, + ) => void = () => {}, + ) { + this.config = { + deltaT: config.deltaT ?? 1.0, + deltaL: config.deltaL ?? 5, + maxEdits: config.maxEdits ?? 500, + maxDuration: config.maxDuration ?? 100.0, + contextSize: config.contextSize ?? 5, + contextLines: config.contextLines ?? 3, + }; + this.onComparisonFinalized = onComparisonFinalized; + this.previousEditFinalCursorPosition = { line: 0, character: 0 }; + } + + async processEdit( + edit: RangeInFileWithNextEditInfo, + timestamp: number = Date.now(), + ): Promise { + const filePath = edit.filepath; + + // If we're switching to a different file, finalize all clusters from the previous file + if (this.lastProcessedFilePath && this.lastProcessedFilePath !== filePath) { + await this.finalizeClustersForFile(this.lastProcessedFilePath); + } + + // Update the last processed file path + this.lastProcessedFilePath = filePath; + + if (!this.fileStates.has(filePath)) { + this.fileStates.set(filePath, { + activeClusters: [], + currentContent: edit.fileContents, + priorComparisons: [], + processingQueue: [], + isProcessing: false, + }); + } + + const fileState = this.fileStates.get(filePath)!; + const task = async () => { + await this._processEditInternal(edit, timestamp, fileState); + }; + + fileState.processingQueue.push(task); + + if (!fileState.isProcessing) { + void this._processQueue(filePath); + } + } + + private async _processQueue(filePath: string): Promise { + const fileState = this.fileStates.get(filePath); + if (!fileState) return; + + fileState.isProcessing = true; + + // Process chunks of (5) edits instead of one at a time + while (fileState.processingQueue.length > 0) { + const tasks = fileState.processingQueue.splice(0, 5); + if (tasks.length > 0) { + try { + await Promise.all(tasks.map((task) => task())); + } catch (error) { + console.error(`Error processing edits in ${filePath}:`, error); + } + + // Yield to the event loop to prevent blocking + await new Promise((resolve) => setTimeout(resolve, 0)); + } + } + + fileState.isProcessing = false; + } + + private async _processEditInternal( + edit: RangeInFileWithNextEditInfo, + timestamp: number, + fileState: FileState, + ): Promise { + const filePath = edit.filepath; + + const editLine = edit.range.start.line; + const currentFileLines = fileState.currentContent.split("\n"); + + const clustersToFinalize = this.identifyClustersToFinalize( + fileState, + edit, + timestamp, + false, + ); + + for (const cluster of clustersToFinalize) { + await this.finalizeCluster(filePath, cluster, fileState); + } + + let suitableCluster = this.findSuitableCluster( + fileState, + editLine, + timestamp, + ); + + // Check if adding this edit would exceed deltaL lines for the cluster + if (suitableCluster) { + const potentialMinLine = Math.min( + suitableCluster.currentRange.minLine, + Math.max(0, editLine - this.config.contextLines), + ); + const potentialMaxLine = Math.max( + suitableCluster.currentRange.maxLine, + Math.min( + currentFileLines.length - 1, + editLine + this.config.contextLines, + ), + ); + const potentialLineSpan = potentialMaxLine - potentialMinLine + 1; + + if (potentialLineSpan > this.config.deltaL * 2) { + // Auto-finalize the current cluster before creating a new one + await this.finalizeCluster(filePath, suitableCluster, fileState); + suitableCluster = null; + } + } + + // initialize a cluster + if (!suitableCluster) { + suitableCluster = { + beforeState: fileState.currentContent, + startRange: { + minLine: Math.max(0, editLine - this.config.contextLines), + maxLine: Math.min( + currentFileLines.length - 1, + editLine + this.config.contextLines, + ), + }, + currentRange: { + minLine: Math.max(0, editLine - this.config.contextLines), + maxLine: Math.min( + currentFileLines.length - 1, + editLine + this.config.contextLines, + ), + }, + edits: [], + firstTimestamp: timestamp, + lastTimestamp: timestamp, + lastLine: editLine, + firstEditBeforeCursor: edit.beforeCursorPos, + lastEditAfterCursor: edit.afterCursorPos, + }; + fileState.activeClusters.push(suitableCluster); + } + + suitableCluster.edits.push(edit); + suitableCluster.lastTimestamp = timestamp; + suitableCluster.lastLine = editLine; + suitableCluster.lastEditAfterCursor = edit.afterCursorPos; + + const isWhitespaceOnly = this.isWhitespaceOnlyEdit( + edit, + fileState.currentContent, + ); + + if (!isWhitespaceOnly) { + suitableCluster.currentRange.minLine = Math.min( + suitableCluster.currentRange.minLine, + Math.max(0, editLine - this.config.contextLines), + ); + suitableCluster.currentRange.maxLine = Math.max( + suitableCluster.currentRange.maxLine, + Math.min( + currentFileLines.length - 1, + editLine + this.config.contextLines, + ), + ); + } + + fileState.currentContent = edit.fileContents; + + const isStructuralEdit = + edit.editText.includes("\n") || + edit.range.start.line !== edit.range.end.line; + + if (isStructuralEdit) { + const additionalClustersToFinalize = fileState.activeClusters.filter( + (c) => + c !== suitableCluster && this.clustersOverlap(c, suitableCluster), + ); + + for (const cluster of additionalClustersToFinalize) { + await this.finalizeCluster(filePath, cluster, fileState); + } + } + } + + private isWhitespaceOnlyEdit( + edit: RangeInFileWithNextEditInfo, + currentContent: string, + ): boolean { + const lines = currentContent.split("\n"); + const line = edit.range.start.line; + + if (line >= lines.length) return false; + + if (edit.range.start.line === edit.range.end.line) { + const beforeEdit = lines[line]; + const afterEdit = + beforeEdit.substring(0, edit.range.start.character) + + edit.editText + + beforeEdit.substring(edit.range.end.character); + + return beforeEdit.trim() === afterEdit.trim(); + } + + return false; + } + + private clustersOverlap( + cluster1: ClusterState, + cluster2: ClusterState, + ): boolean { + return ( + cluster1.currentRange.minLine <= + cluster2.currentRange.maxLine + this.config.deltaL && + cluster1.currentRange.maxLine >= + cluster2.currentRange.minLine - this.config.deltaL + ); + } + + async processEdits(edits: RangeInFileWithNextEditInfo[]): Promise { + const timestamp = Date.now(); + + // Only process the last edit during rapid typing + if (this.getProcessingQueueSize() > 50) { + if (edits.length > 0) { + await this.processEdit(edits[edits.length - 1], timestamp); + } + return; + } + + for (const edit of edits) { + await this.processEdit(edit, timestamp); + } + } + + /** + * Finalizes all clusters for a specific file + */ + private async finalizeClustersForFile(filePath: string): Promise { + const fileState = this.fileStates.get(filePath); + if (!fileState) return; + + // Create a copy of the clusters to finalize to avoid modifying array during iteration + const clustersToFinalize = [...fileState.activeClusters]; + + for (const cluster of clustersToFinalize) { + await this.finalizeCluster(filePath, cluster, fileState); + } + } + + async finalizeAllClusters(): Promise { + const filePromises: Promise[] = []; + + this.fileStates.forEach((fileState, filePath) => { + const filePromise = this.finalizeClustersForFile(filePath); + filePromises.push(filePromise); + }); + + await Promise.all(filePromises); + } + + private findSuitableCluster( + fileState: FileState, + editLine: number, + timestamp: number, + ): ClusterState | null { + const activeClusters = [...fileState.activeClusters]; + + for (const cluster of activeClusters) { + // If we're outside the line range but within the time window, + // we should finalize the current cluster + const isOutsideLineRange = + editLine < cluster.currentRange.minLine - this.config.deltaL || + editLine > cluster.currentRange.maxLine + this.config.deltaL; + + const isWithinTimeWindow = + (timestamp - cluster.lastTimestamp) / 1000 <= this.config.deltaT; + + // If user quickly jumped far away, finalize this cluster before continuing + if (isOutsideLineRange && isWithinTimeWindow) { + void this.finalizeCluster( + cluster.edits[0].filepath, + cluster, + fileState, + ); + } + } + + // Now look for a suitable cluster for the new edit + for (const cluster of fileState.activeClusters) { + const isOnSameLine = editLine === cluster.lastLine; + const isWithinTimeWindow = + (timestamp - cluster.lastTimestamp) / 1000 <= this.config.deltaT; + const isWithinLineRange = + editLine >= cluster.currentRange.minLine - this.config.deltaL && + editLine <= cluster.currentRange.maxLine + this.config.deltaL; + const isWithinEditLimit = cluster.edits.length < this.config.maxEdits; + const isWithinDurationLimit = + (timestamp - cluster.firstTimestamp) / 1000 <= this.config.maxDuration; + + if ( + (isOnSameLine || (isWithinTimeWindow && isWithinLineRange)) && + isWithinEditLimit && + isWithinDurationLimit + ) { + return cluster; + } + } + return null; + } + + private identifyClustersToFinalize( + fileState: FileState, + edit: RangeInFileWithNextEditInfo, + timestamp: number, + isStructuralEdit: boolean, + ): ClusterState[] { + const clustersToFinalize: ClusterState[] = []; + const editLine = edit.range.start.line; + + fileState.activeClusters.forEach((cluster) => { + const timeSinceLastEdit = (timestamp - cluster.lastTimestamp) / 1000; + + const isOnDifferentLineByNumber = cluster.lastLine !== editLine; + + const isOnDifferentLineByNewline = edit.editText.includes("\n"); + + // Use different time thresholds for different types of line change detection + const shouldFinalizeByLineNumber = + isOnDifferentLineByNumber && timeSinceLastEdit > this.config.deltaT; + + const shouldFinalizeByNewline = + isOnDifferentLineByNewline && + timeSinceLastEdit > this.config.deltaT * 1.5; + + // Finalize if we moved to a different line AND the time gap exceeds the respective threshold + const shouldFinalizeByTime = + shouldFinalizeByLineNumber || shouldFinalizeByNewline; + const shouldFinalizeByCount = + cluster.edits.length >= this.config.maxEdits; + const shouldFinalizeByDuration = + (timestamp - cluster.firstTimestamp) / 1000 > this.config.maxDuration; + + // For structural edits, use the combined line detection + const isOnDifferentLine = + isOnDifferentLineByNumber || isOnDifferentLineByNewline; + const shouldFinalizeByStructuralEdit = + isStructuralEdit && isOnDifferentLine; + + if ( + shouldFinalizeByTime || + shouldFinalizeByCount || + shouldFinalizeByDuration || + shouldFinalizeByStructuralEdit + ) { + clustersToFinalize.push(cluster); + } + }); + + return clustersToFinalize; + } + + private async finalizeCluster( + filePath: string, + cluster: ClusterState, + fileState: FileState, + ): Promise { + const beforeContent = cluster.beforeState; + const afterContent = fileState.currentContent; + + // Skip whitespace-only diffs + const isWhitespaceOnlyDiff = + beforeContent.replace(/\s+/g, "") === afterContent.replace(/\s+/g, ""); + + if (isWhitespaceOnlyDiff) { + fileState.activeClusters = fileState.activeClusters.filter( + (c) => c !== cluster, + ); + return; + } + + const diff = createDiff( + beforeContent, + afterContent, + filePath, + DiffFormatType.Unified, + ); // Used for checks, not for final output + + // Skip diffs with too many changed lines + const changedLineCount = this.countChangedLines(diff); + if (changedLineCount > this.config.deltaL * 2) { + fileState.activeClusters = fileState.activeClusters.filter( + (c) => c !== cluster, + ); + return; + } + + fileState.priorComparisons.push(diff); + if (fileState.priorComparisons.length > this.config.contextSize) { + fileState.priorComparisons.shift(); + } + + fileState.activeClusters = fileState.activeClusters.filter( + (c) => c !== cluster, + ); + + // Give format-agnostic diff to the callback + const fullFileVersionsDiff = createBeforeAfterDiff( + beforeContent, + afterContent, + filePath, + ); + + // Store this cluster's final cursor position for future reference + this.previousEditFinalCursorPosition = cluster.lastEditAfterCursor; + + this.onComparisonFinalized( + fullFileVersionsDiff, + cluster.firstEditBeforeCursor, + this.previousEditFinalCursorPosition, + ); + } + + private countChangedLines(diff: string): number { + let count = 0; + let addedLines = new Set(); + let removedLines = new Set(); + + // Parse the diff lines + const lines = diff.split("\n"); + for (const line of lines) { + if ( + line.startsWith("+++ ") || + line.startsWith("--- ") || + line.startsWith("@@") + ) { + continue; // Skip header lines + } + + if (line.startsWith("+")) { + addedLines.add(count); + count++; + } else if (line.startsWith("-")) { + removedLines.add(count); + count++; + } + } + + return Math.max(addedLines.size, removedLines.size); + } + + getActiveClusterCount(): number { + let count = 0; + this.fileStates.forEach((fileState) => { + count += fileState.activeClusters.length; + }); + return count; + } + + getProcessingQueueSize(): number { + let count = 0; + this.fileStates.forEach((fileState) => { + count += fileState.processingQueue.length; + }); + return count; + } + + resetState(): void { + this.fileStates.clear(); + this.lastProcessedFilePath = null; + } +} diff --git a/core/nextEdit/context/autocompleteContextFetching.ts b/core/nextEdit/context/autocompleteContextFetching.ts new file mode 100644 index 000000000..8b57a4a17 --- /dev/null +++ b/core/nextEdit/context/autocompleteContextFetching.ts @@ -0,0 +1,140 @@ +import { Position } from "../.."; +import { ContextRetrievalService } from "../../autocomplete/context/ContextRetrievalService"; +import { getAllSnippetsWithoutRace } from "../../autocomplete/snippets/getAllSnippets"; +import { AutocompleteCodeSnippet } from "../../autocomplete/snippets/types"; +import { renderPrompt } from "../../autocomplete/templating"; +import { GetLspDefinitionsFunction } from "../../autocomplete/types"; +import { HelperVars } from "../../autocomplete/util/HelperVars"; +import { + AutocompleteInput, + RecentlyEditedRange, +} from "../../autocomplete/util/types"; +import { ConfigHandler } from "../../config/ConfigHandler"; +import { IDE, ILLM } from "../../index"; +import { DEFAULT_AUTOCOMPLETE_OPTS } from "../../util/parameters"; + +/** + * Gets the formatted autocomplete context string that would be used for autocomplete at the given position. + * This function mimics the context generation pipeline from the autocomplete system without triggering + * an actual completion. + * + * @param filepath - The file path where context is being requested + * @param pos - The position in the file where context is being requested + * @param ide - The IDE interface for file system operations + * @param configHandler - The config handler to load user configuration + * @param getDefinitionsFromLsp - Function to get LSP definitions (can be a no-op function if not needed) + * @param autocompleteModel - Optional autocomplete model to use (if not provided, uses configured autocomplete model) + * @param recentlyEditedRanges - Recently edited ranges (defaults to empty array) + * @param recentlyVisitedRanges - Recently visited ranges (if not provided, will fetch current live data like real autocomplete) + * @param maxPromptTokens - Optional override for maximum number of tokens (if not provided, uses config) + * @param manuallyPassFileContents - Optional file contents to use instead of reading from disk (should match current editor state) + * @returns Promise that resolves to the formatted context string + */ +export const getAutocompleteContext = async ( + filepath: string, + pos: Position, + ide: IDE, + configHandler: ConfigHandler, + getDefinitionsFromLsp: GetLspDefinitionsFunction = async () => [], + recentlyEditedRanges: RecentlyEditedRange[], + recentlyVisitedRanges: AutocompleteCodeSnippet[], + maxPromptTokens: number, + manuallyPassFileContents: string, + autocompleteModel?: ILLM | string, + // eslint-disable-next-line max-params +): Promise => { + if (!recentlyEditedRanges) recentlyEditedRanges = []; + if (!recentlyVisitedRanges) recentlyVisitedRanges = []; + + const input: AutocompleteInput = { + isUntitledFile: false, + completionId: `context-fetch-${Date.now()}`, + filepath, + pos, + recentlyVisitedRanges, + recentlyEditedRanges, + manuallyPassFileContents, + }; + + const { config } = await configHandler.loadConfig(); + if (!config) { + throw new Error("No config available"); + } + + // Use provided autocomplete model or fall back to configured autocomplete model + let finalModel: ILLM; + let modelNameForTemplating: string; + + if (autocompleteModel) { + if (typeof autocompleteModel === "string") { + // Try to find the model in config first + const foundModel = config.modelsByRole.autocomplete.find( + (m) => m.title === autocompleteModel, + ); + if (foundModel) { + finalModel = foundModel; + modelNameForTemplating = foundModel.model; + } else { + // Model not found in config, but we can still use it for template selection + const configuredModel = config.selectedModelByRole.autocomplete; + if (!configuredModel) { + throw new Error( + "No autocomplete model configured and provided model not found in config", + ); + } + finalModel = configuredModel; + modelNameForTemplating = autocompleteModel; // Use the provided string for template selection + } + } else { + finalModel = autocompleteModel; + modelNameForTemplating = autocompleteModel.model; + } + } else { + const configuredModel = config.selectedModelByRole.autocomplete; + if (!configuredModel) { + throw new Error("No autocomplete model configured and no model provided"); + } + finalModel = configuredModel; + modelNameForTemplating = configuredModel.model; + } + + const options = { + ...DEFAULT_AUTOCOMPLETE_OPTS, + ...config.tabAutocompleteOptions, + ...finalModel.autocompleteOptions, + ...(maxPromptTokens && { maxPromptTokens }), + }; + + if (finalModel.promptTemplates?.autocomplete) { + options.template = finalModel.promptTemplates.autocomplete as string; + } + + const helper = await HelperVars.create( + input, + options, + modelNameForTemplating, + ide, + ); + + const contextRetrievalService = new ContextRetrievalService(ide); + + await contextRetrievalService.initializeForFile(filepath); + + const [snippetPayload, workspaceDirs] = await Promise.all([ + getAllSnippetsWithoutRace({ + helper, + ide: ide, + getDefinitionsFromLsp: getDefinitionsFromLsp, + contextRetrievalService: contextRetrievalService, + }), + ide.getWorkspaceDirs(), + ]); + + const { prompt, prefix, suffix, completionOptions } = renderPrompt({ + snippetPayload, + workspaceDirs, + helper, + }); + + return prefix; +}; diff --git a/core/nextEdit/context/diffFormatting.ts b/core/nextEdit/context/diffFormatting.ts new file mode 100644 index 000000000..6d892dee7 --- /dev/null +++ b/core/nextEdit/context/diffFormatting.ts @@ -0,0 +1,82 @@ +import { createPatch } from "diff"; + +export enum DiffFormatType { + Unified = "unified", + RawBeforeAfter = "beforeAfter", + TokenLineDiff = "linediff", +} + +export type BeforeAfterDiff = { + filePath: string; + beforeContent: string; + afterContent: string; +}; + +export const createDiff = ( + beforeContent: string, + afterContent: string, + filePath: string, + diffType: DiffFormatType, +) => { + switch (diffType) { + case DiffFormatType.Unified: + return createUnifiedDiff(beforeContent, afterContent, filePath); + case DiffFormatType.TokenLineDiff: + return createTokenLineDiff(beforeContent, afterContent, filePath); + } + return ""; +}; + +const createUnifiedDiff = ( + beforeContent: string, + afterContent: string, + filePath: string, +) => { + const normalizedBefore = beforeContent.endsWith("\n") + ? beforeContent + : beforeContent + "\n"; + const normalizedAfter = afterContent.endsWith("\n") + ? afterContent + : afterContent + "\n"; + + const patch = createPatch( + filePath, + normalizedBefore, + normalizedAfter, + "before", + "after", + { context: 3 }, + ); + + return patch; +}; + +export const createBeforeAfterDiff = ( + beforeContent: string, + afterContent: string, + filePath: string, +) => { + const normalizedBefore = beforeContent.endsWith("\n") + ? beforeContent + : beforeContent + "\n"; + const normalizedAfter = afterContent.endsWith("\n") + ? afterContent + : afterContent + "\n"; + + const result: BeforeAfterDiff = { + filePath: filePath, + beforeContent: normalizedBefore, + afterContent: normalizedAfter, + }; + + return result; +}; + +const createTokenLineDiff = ( + beforeContent: string, + afterContent: string, + filePath: string, +) => { + // TODO: Implement token line diff + return ""; +}; diff --git a/core/nextEdit/context/processNextEditData.ts b/core/nextEdit/context/processNextEditData.ts new file mode 100644 index 000000000..c99dde9b5 --- /dev/null +++ b/core/nextEdit/context/processNextEditData.ts @@ -0,0 +1,83 @@ +import { IDE, Position } from "../.."; +import { AutocompleteCodeSnippet } from "../../autocomplete/snippets/types"; +import { GetLspDefinitionsFunction } from "../../autocomplete/types"; +import { ConfigHandler } from "../../config/ConfigHandler"; +import { DataLogger } from "../../data/log"; +import { RecentlyEditedRange } from "../types"; +import { getAutocompleteContext } from "./autocompleteContextFetching"; + +const randomNumberBetween = (min: number, max: number) => { + min = Math.ceil(min); // Ensure min is an integer + max = Math.floor(max); // Ensure max is an integer + return Math.floor(Math.random() * (max - min + 1)) + min; +}; + +interface ProcessNextEditDataParams { + filePath: string; + beforeContent: string; + afterContent: string; + cursorPosBeforeEdit: Position; + cursorPosAfterPrevEdit: Position; + ide: IDE; + configHandler: ConfigHandler; + getDefinitionsFromLsp: GetLspDefinitionsFunction; + recentlyEditedRanges: RecentlyEditedRange[]; + recentlyVisitedRanges: AutocompleteCodeSnippet[]; + workspaceDir: string; + modelNameOrInstance?: string | undefined; +} + +export const processNextEditData = async ({ + filePath, + beforeContent, + afterContent, + cursorPosBeforeEdit, + cursorPosAfterPrevEdit, + ide, + configHandler, + getDefinitionsFromLsp, + recentlyEditedRanges, + recentlyVisitedRanges, + workspaceDir, + modelNameOrInstance, +}: ProcessNextEditDataParams) => { + // To switch to the user's autocomplete model, uncomment the following lines + // const { config } = await configHandler.loadConfig(); + // const autocompleteModel = + // (modelNameOrInstance || config?.selectedModelByRole.autocomplete) ?? + // undefined; + + const modelName = "Codestral"; + + const maxPromptTokens = randomNumberBetween(500, 12000); + + const autocompleteContext = await getAutocompleteContext( + filePath, + cursorPosBeforeEdit, + ide, + configHandler, + getDefinitionsFromLsp, + recentlyEditedRanges, + recentlyVisitedRanges, + maxPromptTokens, + beforeContent, + modelName, + ); + + // console.log( + // createDiff(beforeContent, afterContent, filePath, DiffFormatType.Unified), + // ); + + void DataLogger.getInstance().logDevData({ + name: "nextEdit", + data: { + fileURI: filePath, + workspaceDirURI: workspaceDir, + beforeContent, + afterContent, + beforeCursorPos: cursorPosBeforeEdit, + afterCursorPos: cursorPosAfterPrevEdit, + context: autocompleteContext, + }, + }); +}; diff --git a/core/nextEdit/context/processSmallEdit.ts b/core/nextEdit/context/processSmallEdit.ts new file mode 100644 index 000000000..18ed9d544 --- /dev/null +++ b/core/nextEdit/context/processSmallEdit.ts @@ -0,0 +1,48 @@ +import { IDE, Position } from "../.."; +import { GetLspDefinitionsFunction } from "../../autocomplete/types"; +import { ConfigHandler } from "../../config/ConfigHandler"; +import { NextEditProvider } from "../NextEditProvider"; +import { EditAggregator } from "./aggregateEdits"; +import { BeforeAfterDiff, createDiff, DiffFormatType } from "./diffFormatting"; +import { processNextEditData } from "./processNextEditData"; + +export const processSmallEdit = async ( + beforeAfterdiff: BeforeAfterDiff, + cursorPosBeforeEdit: Position, + cursorPosAfterPrevEdit: Position, + configHandler: ConfigHandler, + getDefsFromLspFunction: GetLspDefinitionsFunction, + ide: IDE, +) => { + NextEditProvider.getInstance().addDiffToContext( + createDiff( + beforeAfterdiff.beforeContent, + beforeAfterdiff.afterContent, + beforeAfterdiff.filePath, + DiffFormatType.Unified, + ), + ); + + // Get the current context data from the most recent message + const currentData = (EditAggregator.getInstance() as any) + .latestContextData || { + configHandler: configHandler, + getDefsFromLspFunction: getDefsFromLspFunction, + recentlyEditedRanges: [], + recentlyVisitedRanges: [], + }; + + void processNextEditData({ + filePath: beforeAfterdiff.filePath, + beforeContent: beforeAfterdiff.beforeContent, + afterContent: beforeAfterdiff.afterContent, + cursorPosBeforeEdit: cursorPosBeforeEdit, + cursorPosAfterPrevEdit: cursorPosAfterPrevEdit, + ide: ide, + configHandler: currentData.configHandler, + getDefinitionsFromLsp: currentData.getDefsFromLspFunction, + recentlyEditedRanges: currentData.recentlyEditedRanges, + recentlyVisitedRanges: currentData.recentlyVisitedRanges, + workspaceDir: currentData.workspaceDir, + }); +}; diff --git a/core/nextEdit/diff/diff.ts b/core/nextEdit/diff/diff.ts new file mode 100644 index 000000000..c8f971651 --- /dev/null +++ b/core/nextEdit/diff/diff.ts @@ -0,0 +1,114 @@ +import { DiffLine } from "../.."; + +/** + * Given a diff of two editable regions, get the offset position at the last new line inside the editable region. + * @param diffLines Result of myersDiff. + * @param lineContentAtCursorPos Content of the line at cursor position. + * @param lineOffsetAtCursorPos Offset of the line at cursor position compared to the start of the editable region. + * @returns Offset position at last new line inside the editable region. + */ +export function getOffsetPositionAtLastNewLine( + diffLines: DiffLine[], + lineContentAtCursorPos: string, + lineOffsetAtCursorPos: number, +): { + line: number; + character: number; +} { + let lastNewLineContent = ""; + let lineOffset = -1; + let currentResultLine = 0; + let hasChanges = false; + + // Build the string while tracking line numbers in the result + diffLines.reduce((acc, curr, i) => { + // Add the current line to our result + acc += curr.line; + + // Add newline if not the last line + if (i < diffLines.length - 1) { + acc += "\n"; + } + + // If this is a "new" or "same" line, it will be part of the result + if (curr.type === "new" || curr.type === "same") { + if (curr.type === "new") { + // If it's a new line, update our tracking + lastNewLineContent = curr.line; + lineOffset = currentResultLine; + hasChanges = true; + } + // Increment our position in the result + currentResultLine++; + } + + return acc; + }, ""); + + // If nothing has changed, return the original position + if (!hasChanges) { + lineOffset = lineOffsetAtCursorPos; + lastNewLineContent = lineContentAtCursorPos; + } + // Calculate the character position for the end of the last relevant line + const endOfCharPos = lastNewLineContent.length; + return { + line: lineOffset, + character: endOfCharPos, + }; +} + +export function getRenderableDiffWithGutterAnnotations( + diffLines: DiffLine[], + lineContentAtCursorPos: string, + lineOffsetAtCursorPos: number, +): { + offset: { + line: number; + character: number; + }; +} { + let lastNewLineContent = ""; + let lineOffset = -1; + let currentResultLine = 0; + let hasChanges = false; + + // Build the string while tracking line numbers in the result + diffLines.reduce((acc, curr, i) => { + // Add the current line to our result + acc += curr.line; + + // Add newline if not the last line + if (i < diffLines.length - 1) { + acc += "\n"; + } + + // If this is a "new" or "same" line, it will be part of the result + if (curr.type === "new" || curr.type === "same") { + if (curr.type === "new") { + // If it's a new line, update our tracking + lastNewLineContent = curr.line; + lineOffset = currentResultLine; + hasChanges = true; + } + // Increment our position in the result + currentResultLine++; + } + + return acc; + }, ""); + + // If nothing has changed, return the original position + if (!hasChanges) { + lineOffset = lineOffsetAtCursorPos; + lastNewLineContent = lineContentAtCursorPos; + } + // Calculate the character position for the end of the last relevant line + const endOfCharPos = lastNewLineContent.length; + return { + offset: { + line: lineOffset, + character: endOfCharPos, + }, + }; +} diff --git a/core/nextEdit/templating/NextEditPromptEngine.ts b/core/nextEdit/templating/NextEditPromptEngine.ts new file mode 100644 index 000000000..cee143168 --- /dev/null +++ b/core/nextEdit/templating/NextEditPromptEngine.ts @@ -0,0 +1,332 @@ +import Handlebars from "handlebars"; +import { Position } from "../.."; +import { SnippetPayload } from "../../autocomplete/snippets"; +import { HelperVars } from "../../autocomplete/util/HelperVars"; +import { + EDITABLE_REGION_END_TOKEN, + EDITABLE_REGION_START_TOKEN, + NEXT_EDIT_EDITABLE_REGION_BOTTOM_MARGIN, + NEXT_EDIT_EDITABLE_REGION_TOP_MARGIN, + USER_CURSOR_IS_HERE_TOKEN, +} from "../constants"; + +export type Prompt = SystemPrompt | UserPrompt; + +interface SystemPrompt { + role: "system"; + content: string; +} + +interface UserPrompt { + role: "user"; + content: string; +} + +export interface NextEditTemplate { + template: string; +} + +export interface TemplateVars { + userEdits: string; + languageShorthand: string; + userExcerpts: string; +} + +type TemplateRenderer = (vars: TemplateVars) => string; + +type NextEditModelName = "mercury-coder-nextedit" | "this field is not used"; + +const NEXT_EDIT_MODEL_TEMPLATES: Record = { + "mercury-coder-nextedit": { + template: + "### User Edits:\n\n{{{userEdits}}}\n\n### User Excerpts:\n\n\`\`\`{{{languageShorthand}}}\n{{{userExcerpts}}}\`\`\`", + }, + "this field is not used": { + template: "NEXT_EDIT", + }, +}; + +function templateRendererOfModel( + modelName: NextEditModelName, +): TemplateRenderer { + const template = NEXT_EDIT_MODEL_TEMPLATES[modelName]; + if (!template) { + throw new Error(`Model ${modelName} is not supported for next edit.`); + } + + const compiledTemplate = Handlebars.compile(template.template); + + return (vars: TemplateVars): string => { + return compiledTemplate(vars); + }; +} + +export function renderPrompt( + helper: HelperVars, + userEdits: string, +): UserPrompt { + const modelName = helper.modelName as NextEditModelName; + + if (modelName === "this field is not used") { + return { + role: "user", + content: "NEXT_EDIT", + }; + } + + // Validate that the modelName is actually a supported model. + if (!Object.keys(NEXT_EDIT_MODEL_TEMPLATES).includes(modelName)) { + throw new Error(`${helper.modelName} is not yet supported for next edit.`); + } + + const renderer = templateRendererOfModel(modelName); + const editedCodeWithTokens = insertTokens( + helper.fileContents.split("\n"), + helper.pos, + ); + + const tv: TemplateVars = { + userEdits, + languageShorthand: helper.lang.name, + userExcerpts: editedCodeWithTokens, + }; + + return { + role: "user", + content: renderer(tv), + }; +} + +export function renderDefaultSystemPrompt(): SystemPrompt { + return { + role: "system", + content: [ + /* Identity forming */ + "You are an expert polyglot developer who is overseeing a junior developer write code in some language.", + "You are psychic as well, so you are an expert at reading minds just from what the junior has done.", + "As an expert, you know what the next edit of the junior is going to be, and you want to suggest it to save both of your's time.", + /* Action crash course */ + "An action is a change in code state that preserves the well-formedness of the code.", + "Well-formedness means that given a cursor location, the local syntax tree that the cursor is in is syntactically correct, and the semantic correctness in the current cursor's character location - 1.", + /* Input description */ + // 'You will receive a prompt that includes an instruction, and a JSON of following format: { "language": string; "originalCode": string; "newCode": string }.', + // "language is the language the code is written in.", + // "originalCode is the code state before the junior has taken some edit action.", + // "editedCode is the code state after the junior has taken some edit action.", + // "If we put originalCode and editedCode on a timeline, originalCode lives in the past, and editedCode is the current code state.", + // "Measure the difference between the originalCode and editedCode inside the prompt, make your best understanding of what the junior wants to accomplish, and figure out what the junior will do next.", + 'You will receive a prompt that includes an instruction, and a JSON of following format: { "language": string; "rootPathSnippets": string; "importDefinitionSnippets": string; "ideSnippets": string; "recentlyEditedRangeSnippets": string; "diffSnippets": string; "clipboardSnippets": string; "recentlyVisitedRangesSnippets": string; }.', + "rootPathSnippet is all the code that is part of an AST path from the root node to the node at the current cursor.", + "recentlyEditedRange is the code that the junior has recently edited.", + "Do not guess what previous edit the junior has taken right before the request -- this is already given to you.", + "The next edit action can happen any location, so do not default to where the junior left off. A potential next edit action can happen before or after the junior edit.", + "The junior might want to add new code, delete existing code, or replace different parts of code.", + "The next edit action isn't strictly additive. It could be deleting existing code, or replacing parts of code.", + /* Output description */ + 'Reply with a JSON that has the following type: { "actionType": string; "newCode": string }.', + /* NOTE: Jacob -- try toggling between these two descriptions of actionType.*/ + /* NOTE: Without reasoning, mercury tends to skew greatly towards not deleting things. */ + "actionType is a four-sentence description of the type of action the junior has taken and the reason why you determined that to be the case. Actually analyze the given edit.", + // "actionType is the type of action the junior has taken.", + "newCode is what the full code looks like after applying your nextEditContent.", + // "Make sure that newCode does not have errors. You are given the language, and you should know what the typescript compiler will complain about.", + "Given the above definition of an action, you should prioritize fixing the following:", + "- Patterns and repetition in code.", + "- Static errors that the compiler of the language may return.", + "- The junior's code style.", + "If the junior has deleted some code, there's a good chance that the next edit will also be deletions.", + "If the junior has added some code, there's a good chance that the next edit will also be additions.", + "If the junior has performed an action on some part of the code, and you see similar code remaining, there's a good chance that the next edit will also target these remaining similar code.", + "Careful of language intricacies.", + // "Always try deletion and replacements. Add code if there are no other valid or reasonable edit actions.", + "Do not reply in markdown.", + "Do not hallucinate.", + ].join(" "), + }; +} + +export function renderDefaultUserPrompt( + // originalCode: string, + // editedCode: string, + snippets: SnippetPayload, + helper: HelperVars, +): UserPrompt { + const userEdit = { + language: helper.lang, + rootPathSnippets: snippets.rootPathSnippets, + importDefinitionSnippets: snippets.importDefinitionSnippets, + ideSnippets: snippets.ideSnippets, + recentlyEditedRangeSnippets: snippets.recentlyEditedRangeSnippets, + diffSnippets: snippets.diffSnippets, + clipboardSnippets: snippets.clipboardSnippets, + recentlyVisitedRangesSnippets: snippets.recentlyVisitedRangesSnippets, + }; + + return { + role: "user", + content: `Your junior made the following edit: ${JSON.stringify(userEdit)}. What is the most possible next edit your junior ${helper.lang.name} developer will make?`, + }; +} + +// export async function renderFineTunedUserPrompt( +// snippets: SnippetPayload, +// ide: IDE, +// helper: HelperVars, +// ): Promise { +// const ideInfo = await ide.getIdeInfo(); +// switch (ideInfo.ideType) { +// case "vscode": +// const editedCodeWithPins = insertTokens( +// helper.fileContents.split("\n"), +// helper.pos, +// ); + +// return { +// role: "user", +// content: renderStringTemplate( +// mercuryCoderTemplate, +// snippets.diffSnippets.join("\n"), +// helper.lang.name, +// editedCodeWithPins, +// ), +// }; + +// case "jetbrains": +// return { +// role: "user", +// content: "", +// }; +// } +// } + +// export async function renderDefaultBasicUserPrompt( +// snippets: SnippetPayload, +// ide: IDE, +// helper: HelperVars, +// ): Promise { +// const ideInfo = await ide.getIdeInfo(); +// switch (ideInfo.ideType) { +// case "vscode": +// const editedCodeWithPins = insertTokens( +// helper.fileContents.split("\n"), +// helper.pos, +// ); + +// return { +// role: "user", +// content: renderStringTemplate( +// mercuryCoderTemplate, +// JSON.stringify(snippets), +// helper.lang.name, +// editedCodeWithPins, +// ), +// }; + +// case "jetbrains": +// return { +// role: "user", +// content: "", +// }; +// } +// } + +// export async function renderFineTunedBasicUserPrompt( +// snippets: SnippetPayload, +// ide: IDE, +// helper: HelperVars, +// diffContext: string, +// ): Promise { +// const ideInfo = await ide.getIdeInfo(); +// switch (ideInfo.ideType) { +// case "vscode": +// const lines = helper.fileContents.split("\n"); +// const editedCodeWithPins = insertTokens(lines, helper.pos); + +// return { +// role: "user", +// content: renderStringTemplate( +// mercuryCoderTemplate, +// diffContext, +// helper.lang.name, +// editedCodeWithPins, +// ), +// }; + +// case "jetbrains": +// return { +// role: "user", +// content: "", +// }; +// } +// } + +function insertTokens(lines: string[], cursorPos: Position) { + const a = insertCursorToken(lines, cursorPos); + const b = insertEditableRegionTokensWithStaticRange(a, cursorPos); + return b.join("\n"); +} + +function insertCursorToken(lines: string[], cursorPos: Position) { + if (cursorPos.line < 0 || cursorPos.line >= lines.length) { + return lines; + } + + // Ensure character position is within bounds or at the end of the line. + const lineLength = lines[cursorPos.line].length; + const charPos = Math.min(Math.max(0, cursorPos.character), lineLength); + + lines[cursorPos.line] = + lines[cursorPos.line].slice(0, charPos) + + USER_CURSOR_IS_HERE_TOKEN + + lines[cursorPos.line].slice(charPos); + + return lines; +} + +function insertEditableRegionTokensWithStaticRange( + lines: string[], + cursorPos: Position, +) { + if (cursorPos.line < 0 || cursorPos.line >= lines.length) { + return lines; + } + + // Ensure editable regions are within bounds. + const editableRegionStart = Math.max( + cursorPos.line - NEXT_EDIT_EDITABLE_REGION_TOP_MARGIN, + 0, + ); + const editableRegionEnd = Math.min( + cursorPos.line + NEXT_EDIT_EDITABLE_REGION_BOTTOM_MARGIN, + lines.length - 1, // Line numbers should be zero-indexed. + ); + + const instrumentedLines = [ + ...lines.slice(0, editableRegionStart), + EDITABLE_REGION_START_TOKEN, + ...lines.slice(editableRegionStart, editableRegionEnd + 1), + EDITABLE_REGION_END_TOKEN, + ...lines.slice(editableRegionEnd + 1), + ]; + + return instrumentedLines; +} + +function insertEditableRegionTokensWithAst( + lines: string[], + cursorPos: Position, +) { + if (cursorPos.line < 0 || cursorPos.line >= lines.length) { + return lines; + } + + // Ensure character position is within bounds or at the end of the line. + const lineLength = lines[cursorPos.line].length; + const charPos = Math.min(Math.max(0, cursorPos.character), lineLength); + + (lines[cursorPos.line] = + lines[cursorPos.line].slice(0, charPos) + USER_CURSOR_IS_HERE_TOKEN), + lines[cursorPos.line].slice(charPos); + + return lines; +} diff --git a/core/nextEdit/types.ts b/core/nextEdit/types.ts new file mode 100644 index 000000000..5fdd293a9 --- /dev/null +++ b/core/nextEdit/types.ts @@ -0,0 +1,45 @@ +import { Position, Range, RangeInFile, TabAutocompleteOptions } from "../"; +import { AutocompleteCodeSnippet } from "../autocomplete/snippets/types"; + +export type RecentlyEditedRange = RangeInFile & { + timestamp: number; + lines: string[]; + symbols: Set; +}; + +export interface AutocompleteInput { + isUntitledFile: boolean; + completionId: string; + filepath: string; + pos: Position; + recentlyVisitedRanges: AutocompleteCodeSnippet[]; + recentlyEditedRanges: RecentlyEditedRange[]; + // Used for notebook files + manuallyPassFileContents?: string; + // Used for VS Code git commit input box + manuallyPassPrefix?: string; + selectedCompletionInfo?: { + text: string; + range: Range; + }; + injectDetails?: string; +} + +export interface NextEditOutcome extends TabAutocompleteOptions { + accepted?: boolean; + time: number; + prefix: string; + suffix: string; + prompt: string; + completion: string; + modelProvider: string; + modelName: string; + completionOptions: any; + cacheHit: boolean; + numLines: number; + filepath: string; + gitRepo?: string; + completionId: string; + uniqueId: string; + timestamp: number; +} diff --git a/core/package-lock.json b/core/package-lock.json index 81c23f4f1..a5b9cea03 100644 --- a/core/package-lock.json +++ b/core/package-lock.json @@ -14,9 +14,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", @@ -105,6 +105,7 @@ "myers-diff": "^2.1.0", "onnxruntime-common": "1.14.0", "onnxruntime-web": "1.14.0", + "shiki": "^3.6.0", "ts-jest": "^29.1.1", "typescript": "^5.6.3", "vitest": "^3.1.4" @@ -139,7 +140,7 @@ }, "../packages/config-yaml": { "name": "@continuedev/config-yaml", - "version": "1.0.88", + "version": "1.0.95", "license": "Apache-2.0", "dependencies": { "@continuedev/config-types": "^1.0.14", @@ -150,15 +151,44 @@ "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" } }, + "../packages/openai-adapters": { + "name": "@continuedev/openai-adapters", + "version": "1.0.44", + "license": "Apache-2.0", + "dependencies": { + "@continuedev/config-types": "^1.0.5", + "@continuedev/config-yaml": "^1.0.51", + "@continuedev/fetch": "^1.0.15", + "dotenv": "^16.5.0", + "json-schema": "^0.4.0", + "node-fetch": "^3.3.2", + "openai": "^4.76.0", + "uuid": "^11.1.0", + "zod": "^3.24.2" + }, + "devDependencies": { + "@types/follow-redirects": "^1.14.4", + "@types/jest": "^29.5.14", + "@types/json-schema": "^7.0.15", + "cross-env": "^7.0.3", + "ts-jest": "^29.2.3", + "ts-node": "^10.9.2" + } + }, "node_modules/@75lb/deep-merge": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/@75lb/deep-merge/-/deep-merge-1.1.2.tgz", @@ -2883,9 +2913,10 @@ "link": true }, "node_modules/@continuedev/fetch": { - "version": "1.0.13", - "resolved": "https://registry.npmjs.org/@continuedev/fetch/-/fetch-1.0.13.tgz", - "integrity": "sha512-7vwsefFBozsutv355zD7mEhFfl6UT4KXRH1QXRzjdbCaYneiRdFLe6UAwV2wGnH71Lj76gOLnTlcGoTV357OZg==", + "version": "1.0.14", + "resolved": "https://registry.npmjs.org/@continuedev/fetch/-/fetch-1.0.14.tgz", + "integrity": "sha512-r/CUwW0tt7VrjLVNeowA281aq7VQvToE+Ro9+0EhfINBMNre4eU2MbNOgbRmYCr5VkIuSnltPUDI357Kns7uCw==", + "license": "Apache-2.0", "dependencies": { "@continuedev/config-types": "^1.0.5", "follow-redirects": "^1.15.6", @@ -2900,32 +2931,8 @@ "integrity": "sha512-/htL7p4li3zQSwn9bXkI23WRpZNklWTPzRSSG3Fd5gvYW8cizjhlf7OzeDdKxBfi1S0lpqMm0VwHlx3KjMKLpw==" }, "node_modules/@continuedev/openai-adapters": { - "version": "1.0.32", - "resolved": "https://registry.npmjs.org/@continuedev/openai-adapters/-/openai-adapters-1.0.32.tgz", - "integrity": "sha512-teNzbpcsa7Y0eBk+dxlLDo0m43sWI5txTYMIk6ezyS0cZAKFJODDB0Gkp3aEHXbD8mDE7H5dDSlM23ohKCirAA==", - "dependencies": { - "@continuedev/config-types": "^1.0.5", - "@continuedev/config-yaml": "^1.0.51", - "@continuedev/fetch": "^1.0.11", - "dotenv": "^16.5.0", - "json-schema": "^0.4.0", - "node-fetch": "^3.3.2", - "openai": "^4.76.0", - "uuid": "^11.1.0", - "zod": "^3.24.2" - } - }, - "node_modules/@continuedev/openai-adapters/node_modules/uuid": { - "version": "11.1.0", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-11.1.0.tgz", - "integrity": "sha512-0/A9rDy9P7cJ+8w1c9WD9V//9Wj15Ce2MPz8Ri6032usz+NfePxx5AcN3bN+r6ZL6jEo066/yNYB3tn4pQEx+A==", - "funding": [ - "https://github.com/sponsors/broofa", - "https://github.com/sponsors/ctavan" - ], - "bin": { - "uuid": "dist/esm/bin/uuid" - } + "resolved": "../packages/openai-adapters", + "link": true }, "node_modules/@dabh/diagnostics": { "version": "2.0.3", @@ -4745,6 +4752,80 @@ "integrity": "sha512-zt6OdqaDoOnJ1ZYsCYGt9YmWzDXl4vQdKTyJev62gFhRGKdx7mcT54V9KIjg+d2wi9EXsPvAPKe7i7WjfVWB8g==", "peer": true }, + "node_modules/@shikijs/core": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/@shikijs/core/-/core-3.6.0.tgz", + "integrity": "sha512-9By7Xb3olEX0o6UeJyPLI1PE1scC4d3wcVepvtv2xbuN9/IThYN4Wcwh24rcFeASzPam11MCq8yQpwwzCgSBRw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@shikijs/types": "3.6.0", + "@shikijs/vscode-textmate": "^10.0.2", + "@types/hast": "^3.0.4", + "hast-util-to-html": "^9.0.5" + } + }, + "node_modules/@shikijs/engine-javascript": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/@shikijs/engine-javascript/-/engine-javascript-3.6.0.tgz", + "integrity": "sha512-7YnLhZG/TU05IHMG14QaLvTW/9WiK8SEYafceccHUSXs2Qr5vJibUwsDfXDLmRi0zHdzsxrGKpSX6hnqe0k8nA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@shikijs/types": "3.6.0", + "@shikijs/vscode-textmate": "^10.0.2", + "oniguruma-to-es": "^4.3.3" + } + }, + "node_modules/@shikijs/engine-oniguruma": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/@shikijs/engine-oniguruma/-/engine-oniguruma-3.6.0.tgz", + "integrity": "sha512-nmOhIZ9yT3Grd+2plmW/d8+vZ2pcQmo/UnVwXMUXAKTXdi+LK0S08Ancrz5tQQPkxvjBalpMW2aKvwXfelauvA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@shikijs/types": "3.6.0", + "@shikijs/vscode-textmate": "^10.0.2" + } + }, + "node_modules/@shikijs/langs": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/@shikijs/langs/-/langs-3.6.0.tgz", + "integrity": "sha512-IdZkQJaLBu1LCYCwkr30hNuSDfllOT8RWYVZK1tD2J03DkiagYKRxj/pDSl8Didml3xxuyzUjgtioInwEQM/TA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@shikijs/types": "3.6.0" + } + }, + "node_modules/@shikijs/themes": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/@shikijs/themes/-/themes-3.6.0.tgz", + "integrity": "sha512-Fq2j4nWr1DF4drvmhqKq8x5vVQ27VncF8XZMBuHuQMZvUSS3NBgpqfwz/FoGe36+W6PvniZ1yDlg2d4kmYDU6w==", + "dev": true, + "license": "MIT", + "dependencies": { + "@shikijs/types": "3.6.0" + } + }, + "node_modules/@shikijs/types": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/@shikijs/types/-/types-3.6.0.tgz", + "integrity": "sha512-cLWFiToxYu0aAzJqhXTQsFiJRTFDAGl93IrMSBNaGSzs7ixkLfdG6pH11HipuWFGW5vyx4X47W8HDQ7eSrmBUg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@shikijs/vscode-textmate": "^10.0.2", + "@types/hast": "^3.0.4" + } + }, + "node_modules/@shikijs/vscode-textmate": { + "version": "10.0.2", + "resolved": "https://registry.npmjs.org/@shikijs/vscode-textmate/-/vscode-textmate-10.0.2.tgz", + "integrity": "sha512-83yeghZ2xxin3Nj8z1NMd/NCuca+gsYXswywDy5bHvwlWL8tpTQmzGeUuHd9FC3E/SBEMvzJRwWEOz5gGes9Qg==", + "dev": true, + "license": "MIT" + }, "node_modules/@sinclair/typebox": { "version": "0.27.8", "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.27.8.tgz", @@ -5475,6 +5556,16 @@ "@types/node": "*" } }, + "node_modules/@types/hast": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/@types/hast/-/hast-3.0.4.tgz", + "integrity": "sha512-WPs+bbQw5aCj+x6laNGWLH3wviHtoCv/P3+otBhbOhJgG8qtpdAMlTCxLtsTWA7LH1Oh/bFCHsBn0TPS5m30EQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/unist": "*" + } + }, "node_modules/@types/istanbul-lib-coverage": { "version": "2.0.6", "resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.6.tgz", @@ -5546,6 +5637,16 @@ "resolved": "https://registry.npmjs.org/@types/long/-/long-4.0.2.tgz", "integrity": "sha512-MqTGEo5bj5t157U6fA/BiDynNkn0YknVdh48CMPkTSpFTVmvao5UQmm7uEF6xBEo7qIMAlY/JSleYaE6VOdpaA==" }, + "node_modules/@types/mdast": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/@types/mdast/-/mdast-4.0.4.tgz", + "integrity": "sha512-kGaNbPh1k7AFzgpud/gMdvIm5xuECykRR+JnWKQno9TAXVa6WIVCGTPvYGekIDL4uwCZQSYbUxNBSb1aUo79oA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/unist": "*" + } + }, "node_modules/@types/mozilla-readability": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/@types/mozilla-readability/-/mozilla-readability-0.2.1.tgz", @@ -5682,6 +5783,13 @@ "resolved": "https://registry.npmjs.org/@types/triple-beam/-/triple-beam-1.3.5.tgz", "integrity": "sha512-6WaYesThRMCl19iryMYP7/x2OVgCtbIVflDGFpWnb9irXI3UjYE4AzmYuiUKY1AJstGijoY+MgUszMgRxIYTYw==" }, + "node_modules/@types/unist": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/@types/unist/-/unist-3.0.3.tgz", + "integrity": "sha512-ko/gIFJRv177XgZsZcBwnqJN5x/Gien8qNOn0D5bQU/zAzVf9Zt3BlcUiLqhV9y4ARk0GbT3tnUiPNgnTXzc/Q==", + "dev": true, + "license": "MIT" + }, "node_modules/@types/uuid": { "version": "9.0.8", "resolved": "https://registry.npmjs.org/@types/uuid/-/uuid-9.0.8.tgz", @@ -7199,6 +7307,17 @@ "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", "integrity": "sha512-4tYFyifaFfGacoiObjJegolkwSU4xQNGbVgUiNYVUxbQ2x2lUsFvY4hVgVzGiIe6WLOPqycWXA40l+PWsxthUw==" }, + "node_modules/ccount": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/ccount/-/ccount-2.0.1.tgz", + "integrity": "sha512-eyrF0jiFpY+3drT6383f1qhkbGsLSifNAjA61IUjZjmLCWjItY6LB9ft9YhoDgwfmclB2zhu51Lc7+95b8NRAg==", + "dev": true, + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, "node_modules/chai": { "version": "5.2.0", "resolved": "https://registry.npmjs.org/chai/-/chai-5.2.0.tgz", @@ -7255,6 +7374,28 @@ "node": ">=10" } }, + "node_modules/character-entities-html4": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/character-entities-html4/-/character-entities-html4-2.1.0.tgz", + "integrity": "sha512-1v7fgQRj6hnSwFpq1Eu0ynr/CDEw0rXo2B61qXrLNdHZmPKgb7fqS1a2JwF0rISo9q77jDI8VMEHoApn8qDoZA==", + "dev": true, + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/character-entities-legacy": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/character-entities-legacy/-/character-entities-legacy-3.0.0.tgz", + "integrity": "sha512-RpPp0asT/6ufRm//AJVwpViZbGM/MkjQFxJccQRHmISF/22NBtsHqAWmL+/pmkPWoIUJdWyeVleTl1wydHATVQ==", + "dev": true, + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, "node_modules/check-error": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/check-error/-/check-error-2.1.1.tgz", @@ -7480,6 +7621,17 @@ "node": ">= 0.8" } }, + "node_modules/comma-separated-tokens": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/comma-separated-tokens/-/comma-separated-tokens-2.0.3.tgz", + "integrity": "sha512-Fu4hJdvzeylCfQPp9SGWidpzrMs7tTrlu6Vb8XGaRGck8QSNZJJp538Wrb60Lax4fPwR64ViY468OIUTbRlGZg==", + "dev": true, + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, "node_modules/command-line-args": { "version": "5.2.1", "resolved": "https://registry.npmjs.org/command-line-args/-/command-line-args-5.2.1.tgz", @@ -8019,6 +8171,16 @@ "resolved": "https://registry.npmjs.org/deprecation/-/deprecation-2.3.1.tgz", "integrity": "sha512-xmHIy4F3scKVwMsQ4WnVaS8bHOx0DmVwRywosKhaILI0ywMDWPtBSku2HNxRvF7jtwDRsoEwYQSfbxj8b7RlJQ==" }, + "node_modules/dequal": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/dequal/-/dequal-2.0.3.tgz", + "integrity": "sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, "node_modules/detect-libc": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.0.3.tgz", @@ -8036,6 +8198,20 @@ "node": ">=8" } }, + "node_modules/devlop": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/devlop/-/devlop-1.1.0.tgz", + "integrity": "sha512-RWmIqhcFf1lRYBvNmr7qTNuyCt/7/ns2jbpp1+PalgE/rDQcBT0fioSMUpJ93irlUhC5hrg4cYqe6U+0ImW0rA==", + "dev": true, + "license": "MIT", + "dependencies": { + "dequal": "^2.0.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, "node_modules/devtools-protocol": { "version": "0.0.1312386", "resolved": "https://registry.npmjs.org/devtools-protocol/-/devtools-protocol-0.0.1312386.tgz", @@ -10582,6 +10758,44 @@ "node": ">= 0.4" } }, + "node_modules/hast-util-to-html": { + "version": "9.0.5", + "resolved": "https://registry.npmjs.org/hast-util-to-html/-/hast-util-to-html-9.0.5.tgz", + "integrity": "sha512-OguPdidb+fbHQSU4Q4ZiLKnzWo8Wwsf5bZfbvu7//a9oTYoqD/fWpe96NuHkoS9h0ccGOTe0C4NGXdtS0iObOw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/hast": "^3.0.0", + "@types/unist": "^3.0.0", + "ccount": "^2.0.0", + "comma-separated-tokens": "^2.0.0", + "hast-util-whitespace": "^3.0.0", + "html-void-elements": "^3.0.0", + "mdast-util-to-hast": "^13.0.0", + "property-information": "^7.0.0", + "space-separated-tokens": "^2.0.0", + "stringify-entities": "^4.0.0", + "zwitch": "^2.0.4" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/hast-util-whitespace": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/hast-util-whitespace/-/hast-util-whitespace-3.0.0.tgz", + "integrity": "sha512-88JUN06ipLwsnv+dVn+OIYOvAuvBMy/Qoi6O7mQHxdPXpjy+Cd6xRkWwux7DKO+4sYILtLBRIKgsdpS2gQc7qw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/hast": "^3.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, "node_modules/he": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/he/-/he-1.2.0.tgz", @@ -10607,6 +10821,17 @@ "integrity": "sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==", "dev": true }, + "node_modules/html-void-elements": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/html-void-elements/-/html-void-elements-3.0.0.tgz", + "integrity": "sha512-bEqo66MRXsUGxWHV5IP0PUiAWwoEjba4VCzg0LjFJBpchPaTfyfCKTG6bc5F8ucKec3q5y6qOdGyYTSBEvhCrg==", + "dev": true, + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, "node_modules/htmlparser2": { "version": "9.1.0", "resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-9.1.0.tgz", @@ -13003,6 +13228,28 @@ "node": ">= 0.4" } }, + "node_modules/mdast-util-to-hast": { + "version": "13.2.0", + "resolved": "https://registry.npmjs.org/mdast-util-to-hast/-/mdast-util-to-hast-13.2.0.tgz", + "integrity": "sha512-QGYKEuUsYT9ykKBCMOEDLsU5JRObWQusAolFMeko/tYPufNkRffBAQjIE+99jbA87xv6FgmjLtwjh9wBWajwAA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/hast": "^3.0.0", + "@types/mdast": "^4.0.0", + "@ungap/structured-clone": "^1.0.0", + "devlop": "^1.0.0", + "micromark-util-sanitize-uri": "^2.0.0", + "trim-lines": "^3.0.0", + "unist-util-position": "^5.0.0", + "unist-util-visit": "^5.0.0", + "vfile": "^6.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, "node_modules/media-typer": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-1.1.0.tgz", @@ -13036,6 +13283,100 @@ "node": ">= 8" } }, + "node_modules/micromark-util-character": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/micromark-util-character/-/micromark-util-character-2.1.1.tgz", + "integrity": "sha512-wv8tdUTJ3thSFFFJKtpYKOYiGP2+v96Hvk4Tu8KpCAsTMs6yi+nVmGh1syvSCsaxz45J6Jbw+9DD6g97+NV67Q==", + "dev": true, + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-util-encode": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-util-encode/-/micromark-util-encode-2.0.1.tgz", + "integrity": "sha512-c3cVx2y4KqUnwopcO9b/SCdo2O67LwJJ/UyqGfbigahfegL9myoEFoDYZgkT7f36T0bLrM9hZTAaAyH+PCAXjw==", + "dev": true, + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT" + }, + "node_modules/micromark-util-sanitize-uri": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-util-sanitize-uri/-/micromark-util-sanitize-uri-2.0.1.tgz", + "integrity": "sha512-9N9IomZ/YuGGZZmQec1MbgxtlgougxTodVwDzzEouPKo3qFWvymFHWcnDi2vzV1ff6kas9ucW+o3yzJK9YB1AQ==", + "dev": true, + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "micromark-util-character": "^2.0.0", + "micromark-util-encode": "^2.0.0", + "micromark-util-symbol": "^2.0.0" + } + }, + "node_modules/micromark-util-symbol": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-util-symbol/-/micromark-util-symbol-2.0.1.tgz", + "integrity": "sha512-vs5t8Apaud9N28kgCrRUdEed4UJ+wWNvicHLPxCa9ENlYuAY31M0ETy5y1vA33YoNPDFTghEbnh6efaE8h4x0Q==", + "dev": true, + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT" + }, + "node_modules/micromark-util-types": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/micromark-util-types/-/micromark-util-types-2.0.2.tgz", + "integrity": "sha512-Yw0ECSpJoViF1qTU4DC6NwtC4aWGt1EkzaQB8KPPyCRR8z9TWeV0HbEFGTO+ZY1wB22zmxnJqhPyTpOVCpeHTA==", + "dev": true, + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT" + }, "node_modules/micromatch": { "version": "4.0.8", "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.8.tgz", @@ -13878,6 +14219,25 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/oniguruma-parser": { + "version": "0.12.1", + "resolved": "https://registry.npmjs.org/oniguruma-parser/-/oniguruma-parser-0.12.1.tgz", + "integrity": "sha512-8Unqkvk1RYc6yq2WBYRj4hdnsAxVze8i7iPfQr8e4uSP3tRv0rpZcbGUDvxfQQcdwHt/e9PrMvGCsa8OqG9X3w==", + "dev": true, + "license": "MIT" + }, + "node_modules/oniguruma-to-es": { + "version": "4.3.3", + "resolved": "https://registry.npmjs.org/oniguruma-to-es/-/oniguruma-to-es-4.3.3.tgz", + "integrity": "sha512-rPiZhzC3wXwE59YQMRDodUwwT9FZ9nNBwQQfsd1wfdtlKEyCdRV0avrTcSZ5xlIvGRVPd/cx6ZN45ECmS39xvg==", + "dev": true, + "license": "MIT", + "dependencies": { + "oniguruma-parser": "^0.12.1", + "regex": "^6.0.1", + "regex-recursion": "^6.0.2" + } + }, "node_modules/onnx-proto": { "version": "4.0.4", "resolved": "https://registry.npmjs.org/onnx-proto/-/onnx-proto-4.0.4.tgz", @@ -14875,6 +15235,17 @@ "node": ">= 6" } }, + "node_modules/property-information": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/property-information/-/property-information-7.1.0.tgz", + "integrity": "sha512-TwEZ+X+yCJmYfL7TPUOcvBZ4QfoT5YenQiJuX//0th53DE6w0xxLEtfK3iyryQFddXuvkIk51EEgrJQ0WJkOmQ==", + "dev": true, + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, "node_modules/protobufjs": { "version": "6.11.4", "resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-6.11.4.tgz", @@ -15279,6 +15650,33 @@ "@babel/runtime": "^7.8.4" } }, + "node_modules/regex": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/regex/-/regex-6.0.1.tgz", + "integrity": "sha512-uorlqlzAKjKQZ5P+kTJr3eeJGSVroLKoHmquUj4zHWuR+hEyNqlXsSKlYYF5F4NI6nl7tWCs0apKJ0lmfsXAPA==", + "dev": true, + "license": "MIT", + "dependencies": { + "regex-utilities": "^2.3.0" + } + }, + "node_modules/regex-recursion": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/regex-recursion/-/regex-recursion-6.0.2.tgz", + "integrity": "sha512-0YCaSCq2VRIebiaUviZNs0cBz1kg5kVS2UKUfNIx8YVs1cN3AV7NTctO5FOKBA+UT2BPJIWZauYHPqJODG50cg==", + "dev": true, + "license": "MIT", + "dependencies": { + "regex-utilities": "^2.3.0" + } + }, + "node_modules/regex-utilities": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/regex-utilities/-/regex-utilities-2.3.0.tgz", + "integrity": "sha512-8VhliFJAWRaUiVvREIiW2NXXTmHs4vMNnSzuJVhscgmGav3g9VDxLrQndI3dZZVVdp0ZO/5v0xmX516/7M9cng==", + "dev": true, + "license": "MIT" + }, "node_modules/regexp.prototype.flags": { "version": "1.5.3", "resolved": "https://registry.npmjs.org/regexp.prototype.flags/-/regexp.prototype.flags-1.5.3.tgz", @@ -15850,6 +16248,23 @@ "node": ">=8" } }, + "node_modules/shiki": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/shiki/-/shiki-3.6.0.tgz", + "integrity": "sha512-tKn/Y0MGBTffQoklaATXmTqDU02zx8NYBGQ+F6gy87/YjKbizcLd+Cybh/0ZtOBX9r1NEnAy/GTRDKtOsc1L9w==", + "dev": true, + "license": "MIT", + "dependencies": { + "@shikijs/core": "3.6.0", + "@shikijs/engine-javascript": "3.6.0", + "@shikijs/engine-oniguruma": "3.6.0", + "@shikijs/langs": "3.6.0", + "@shikijs/themes": "3.6.0", + "@shikijs/types": "3.6.0", + "@shikijs/vscode-textmate": "^10.0.2", + "@types/hast": "^3.0.4" + } + }, "node_modules/side-channel": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.1.0.tgz", @@ -16130,6 +16545,17 @@ "source-map": "^0.6.0" } }, + "node_modules/space-separated-tokens": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/space-separated-tokens/-/space-separated-tokens-2.0.2.tgz", + "integrity": "sha512-PEGlAwrG8yXGXRjW32fGbg66JAlOAwbObuqVoJpv/mRgoWDQfgH1wDPvtzWyUSNAXBGSk8h755YDbbcEy3SH2Q==", + "dev": true, + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, "node_modules/split": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/split/-/split-1.0.1.tgz", @@ -16451,6 +16877,21 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/stringify-entities": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/stringify-entities/-/stringify-entities-4.0.4.tgz", + "integrity": "sha512-IwfBptatlO+QCJUo19AqvrPNqlVMpW9YEL2LIVY+Rpv2qsjCGxaDLNRgeGsQWJhfItebuJhsGSLjaBbNSQ+ieg==", + "dev": true, + "license": "MIT", + "dependencies": { + "character-entities-html4": "^2.0.0", + "character-entities-legacy": "^3.0.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, "node_modules/strip-ansi": { "version": "6.0.1", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", @@ -16941,6 +17382,17 @@ "tree-sitter-wasms": "^0.1.11" } }, + "node_modules/trim-lines": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/trim-lines/-/trim-lines-3.0.1.tgz", + "integrity": "sha512-kRj8B+YHZCc9kQYdWfJB2/oUl9rA99qbowYYBtr4ui4mZyAQ2JpvVBd/6U2YloATfqBhBTSMhTpgBHtU0Mf3Rg==", + "dev": true, + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, "node_modules/triple-beam": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/triple-beam/-/triple-beam-1.4.1.tgz", @@ -17369,6 +17821,79 @@ "imurmurhash": "^0.1.4" } }, + "node_modules/unist-util-is": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-6.0.0.tgz", + "integrity": "sha512-2qCTHimwdxLfz+YzdGfkqNlH0tLi9xjTnHddPmJwtIG9MGsdbutfTc4P+haPD7l7Cjxf/WZj+we5qfVPvvxfYw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/unist": "^3.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/unist-util-position": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/unist-util-position/-/unist-util-position-5.0.0.tgz", + "integrity": "sha512-fucsC7HjXvkB5R3kTCO7kUjRdrS0BJt3M/FPxmHMBOm8JQi2BsHAHFsy27E0EolP8rp0NzXsJ+jNPyDWvOJZPA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/unist": "^3.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/unist-util-stringify-position": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/unist-util-stringify-position/-/unist-util-stringify-position-4.0.0.tgz", + "integrity": "sha512-0ASV06AAoKCDkS2+xw5RXJywruurpbC4JZSm7nr7MOt1ojAzvyyaO+UxZf18j8FCF6kmzCZKcAgN/yu2gm2XgQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/unist": "^3.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/unist-util-visit": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-5.0.0.tgz", + "integrity": "sha512-MR04uvD+07cwl/yhVuVWAtw+3GOR/knlL55Nd/wAdblk27GCVt3lqpTivy/tkJcZoNPzTwS1Y+KMojlLDhoTzg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/unist": "^3.0.0", + "unist-util-is": "^6.0.0", + "unist-util-visit-parents": "^6.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/unist-util-visit-parents": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-6.0.1.tgz", + "integrity": "sha512-L/PqWzfTP9lzzEa6CKs0k2nARxTdZduw3zyh8d2NVBnsyvHjSX4TWse388YrrQKbvI8w20fGjGlhgT96WwKykw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/unist": "^3.0.0", + "unist-util-is": "^6.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, "node_modules/universal-user-agent": { "version": "6.0.1", "resolved": "https://registry.npmjs.org/universal-user-agent/-/universal-user-agent-6.0.1.tgz", @@ -17528,6 +18053,36 @@ "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", "integrity": "sha512-3lqz5YjWTYnW6dlDa5TLaTCcShfar1e40rmcJVwCBJC6mWlFuj0eCHIElmG1g5kyuJ/GD+8Wn4FFCcz4gJPfaQ==" }, + "node_modules/vfile": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/vfile/-/vfile-6.0.3.tgz", + "integrity": "sha512-KzIbH/9tXat2u30jf+smMwFCsno4wHVdNmzFyL+T/L3UGqqk6JKfVqOFOZEpZSHADH1k40ab6NUIXZq422ov3Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/unist": "^3.0.0", + "vfile-message": "^4.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/vfile-message": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/vfile-message/-/vfile-message-4.0.2.tgz", + "integrity": "sha512-jRDZ1IMLttGj41KcZvlrYAaI3CfqpLpfpf+Mfig13viT6NKvRzWZ+lXz0Y5D60w6uJIBAOGq9mSHf0gktF0duw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/unist": "^3.0.0", + "unist-util-stringify-position": "^4.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, "node_modules/vite": { "version": "6.3.5", "resolved": "https://registry.npmjs.org/vite/-/vite-6.3.5.tgz", @@ -18339,6 +18894,17 @@ "funding": { "url": "https://github.com/sponsors/colinhacks" } + }, + "node_modules/zwitch": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/zwitch/-/zwitch-2.0.4.tgz", + "integrity": "sha512-bXE4cR/kVZhKZX/RjPEflHaKVhUVl85noU3v6b8apfQEc1x4A+zBxjZ4lN8LqGd6WZ3dl98pY4o717VFmoPp+A==", + "dev": true, + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } } } } diff --git a/core/package.json b/core/package.json index d2a639ea7..fd1be11e0 100644 --- a/core/package.json +++ b/core/package.json @@ -41,6 +41,7 @@ "myers-diff": "^2.1.0", "onnxruntime-common": "1.14.0", "onnxruntime-web": "1.14.0", + "shiki": "^3.6.0", "ts-jest": "^29.1.1", "typescript": "^5.6.3", "vitest": "^3.1.4" @@ -51,9 +52,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", diff --git a/core/promptFiles/v2/createNewPromptFile.ts b/core/promptFiles/createNewPromptFile.ts similarity index 94% rename from core/promptFiles/v2/createNewPromptFile.ts rename to core/promptFiles/createNewPromptFile.ts index 02ff786d1..d77967631 100644 --- a/core/promptFiles/v2/createNewPromptFile.ts +++ b/core/promptFiles/createNewPromptFile.ts @@ -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 diff --git a/core/promptFiles/v2/getPromptFiles.ts b/core/promptFiles/getPromptFiles.ts similarity index 84% rename from core/promptFiles/v2/getPromptFiles.ts rename to core/promptFiles/getPromptFiles.ts index 069fe1114..9e60fe95f 100644 --- a/core/promptFiles/v2/getPromptFiles.ts +++ b/core/promptFiles/getPromptFiles.ts @@ -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, diff --git a/core/promptFiles/index.ts b/core/promptFiles/index.ts new file mode 100644 index 000000000..ee5fb6b84 --- /dev/null +++ b/core/promptFiles/index.ts @@ -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", +]; diff --git a/core/promptFiles/v2/parsePromptFileV1V2.ts b/core/promptFiles/parsePromptFile.ts similarity index 84% rename from core/promptFiles/v2/parsePromptFileV1V2.ts rename to core/promptFiles/parsePromptFile.ts index a883c5e7b..4b6cf6917 100644 --- a/core/promptFiles/v2/parsePromptFileV1V2.ts +++ b/core/promptFiles/parsePromptFile.ts @@ -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; diff --git a/core/promptFiles/v1/getContextProviderHelpers.ts b/core/promptFiles/v1/getContextProviderHelpers.ts deleted file mode 100644 index 30b51bf8b..000000000 --- a/core/promptFiles/v1/getContextProviderHelpers.ts +++ /dev/null @@ -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"); - }, - ]); -} diff --git a/core/promptFiles/v1/handlebarUtils.ts b/core/promptFiles/v1/handlebarUtils.ts deleted file mode 100644 index ffb719590..000000000 --- a/core/promptFiles/v1/handlebarUtils.ts +++ /dev/null @@ -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; -} { - const promises: { [key: string]: Promise } = {}; - - 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, - inputData: Record, - 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 { - const templateFn = Handlebars.compile(template); - return templateFn(data); -} - -export async function resolveHelperPromises( - renderedString: string, - promises: { [key: string]: Promise }, -): Promise { - await Promise.all(Object.values(promises)); - - for (const id in promises) { - renderedString = renderedString.replace(`__${id}__`, await promises[id]); - } - - return renderedString; -} diff --git a/core/promptFiles/v1/index.ts b/core/promptFiles/v1/index.ts deleted file mode 100644 index 1d6726b3e..000000000 --- a/core/promptFiles/v1/index.ts +++ /dev/null @@ -1 +0,0 @@ -export const DEFAULT_PROMPTS_FOLDER_V1 = ".prompts"; diff --git a/core/promptFiles/v1/slashCommandFromPromptFile.ts b/core/promptFiles/v1/slashCommandFromPromptFile.ts deleted file mode 100644 index 8e1478648..000000000 --- a/core/promptFiles/v1/slashCommandFromPromptFile.ts +++ /dev/null @@ -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 = { - 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); - } - }, - }; -} diff --git a/core/promptFiles/v1/updateChatHistory.ts b/core/promptFiles/v1/updateChatHistory.ts deleted file mode 100644 index 70b3ce1bd..000000000 --- a/core/promptFiles/v1/updateChatHistory.ts +++ /dev/null @@ -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, - ), - }; -} diff --git a/core/promptFiles/v2/parse.ts b/core/promptFiles/v2/parse.ts deleted file mode 100644 index ec543cbdc..000000000 --- a/core/promptFiles/v2/parse.ts +++ /dev/null @@ -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, - }; -} diff --git a/core/promptFiles/v2/renderPromptFile.ts b/core/promptFiles/v2/renderPromptFile.ts deleted file mode 100644 index 4d1330eb3..000000000 --- a/core/promptFiles/v2/renderPromptFile.ts +++ /dev/null @@ -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 { - // 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[] = []; - 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]; -} diff --git a/core/promptFiles/v2/renderPromptFile.vitest.ts b/core/promptFiles/v2/renderPromptFile.vitest.ts deleted file mode 100644 index 1d72bc85a..000000000 --- a/core/promptFiles/v2/renderPromptFile.vitest.ts +++ /dev/null @@ -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"); - }); -}); diff --git a/core/protocol/core.ts b/core/protocol/core.ts index dfc0d87d6..b6cb8e9b0 100644 --- a/core/protocol/core.ts +++ b/core/protocol/core.ts @@ -5,7 +5,10 @@ import { ModelRole, } from "@continuedev/config-yaml"; -import { AutocompleteInput } from "../autocomplete/util/types"; +import { + AutocompleteInput, + RecentlyEditedRange, +} from "../autocomplete/util/types"; import { SharedConfigSchema } from "../config/sharedConfig"; import { GlobalContextModelSelections } from "../util/GlobalContext"; @@ -25,14 +28,18 @@ import { ModelDescription, PromptLog, RangeInFile, + RangeInFileWithNextEditInfo, SerializedContinueConfig, Session, SessionMetadata, SiteIndexingConfig, - SlashCommandDescription, + SlashCommandDescWithSource, StreamDiffLinesPayload, ToolCall, } from "../"; +import { AutocompleteCodeSnippet } from "../autocomplete/snippets/types"; +import { GetLspDefinitionsFunction } from "../autocomplete/types"; +import { ConfigHandler } from "../config/ConfigHandler"; import { SerializedOrgWithProfiles } from "../config/ProfileLifecycleManager"; import { ControlPlaneSessionInfo } from "../control-plane/AuthTypes"; import { FreeTrialStatus } from "../control-plane/client"; @@ -118,6 +125,17 @@ export type ToCoreFromIdeOrWebviewProtocol = { }, void, ]; + "mcp/getPrompt": [ + { + serverName: string; + promptName: string; + args?: Record; + }, + { + prompt: string; + description: string | undefined; + }, + ]; "context/getSymbolsForFiles": [{ uris: string[] }, FileSymbolMap]; "context/loadSubmenuItems": [{ title: string }, ContextSubmenuItem[]]; "autocomplete/complete": [AutocompleteInput, string[]]; @@ -141,7 +159,7 @@ export type ToCoreFromIdeOrWebviewProtocol = { completionOptions: LLMFullCompletionOptions; title: string; legacySlashCommandData?: { - command: SlashCommandDescription; + command: SlashCommandDescWithSource; input: string; contextItems: ContextItemWithId[]; historyIndex: number; @@ -182,6 +200,16 @@ export type ToCoreFromIdeOrWebviewProtocol = { "files/created": [{ uris?: string[] }, void]; "files/deleted": [{ uris?: string[] }, void]; "files/closed": [{ uris?: string[] }, void]; + "files/smallEdit": [ + { + actions: RangeInFileWithNextEditInfo[]; + configHandler: ConfigHandler; + getDefsFromLspFunction: GetLspDefinitionsFunction; + recentlyEditedRanges: RecentlyEditedRange[]; + recentlyVisitedRanges: AutocompleteCodeSnippet[]; + }, + void, + ]; // Docs etc. Indexing. TODO move codebase to this "indexing/reindex": [{ type: string; id: string }, void]; diff --git a/core/protocol/ide.ts b/core/protocol/ide.ts index 7a9b8d68e..ba4cf4f88 100644 --- a/core/protocol/ide.ts +++ b/core/protocol/ide.ts @@ -1,6 +1,5 @@ import type { ContinueRcJson, - DiffLine, FileStatsMap, FileType, IDE, @@ -35,15 +34,6 @@ export type ToIdeFromWebviewOrCoreProtocol = { saveFile: [{ filepath: string }, void]; fileExists: [{ filepath: string }, boolean]; readFile: [{ filepath: string }, string]; - diffLine: [ - { - diffLine: DiffLine; - filepath: string; - startLine: number; - endLine: number; - }, - void, - ]; getProblems: [{ filepath: string }, Problem[]]; getOpenFiles: [undefined, string[]]; getCurrentFile: [ @@ -70,6 +60,7 @@ export type ToIdeFromWebviewOrCoreProtocol = { ]; getAvailableThreads: [undefined, Thread[]]; isTelemetryEnabled: [undefined, boolean]; + isWorkspaceRemote: [undefined, boolean]; getUniqueId: [undefined, string]; getTags: [string, IndexTag[]]; readSecrets: [{ keys: string[] }, Record]; diff --git a/core/protocol/ideWebview.ts b/core/protocol/ideWebview.ts index 074e3837f..bbe5872d0 100644 --- a/core/protocol/ideWebview.ts +++ b/core/protocol/ideWebview.ts @@ -4,6 +4,7 @@ import { ToWebviewFromIdeOrCoreProtocol } from "./webview"; import { AcceptOrRejectDiffPayload, ApplyState, + ApplyToFilePayload, HighlightedCodePayload, MessageContent, RangeInFileWithContents, @@ -13,15 +14,7 @@ import { export type ToIdeFromWebviewProtocol = ToIdeFromWebviewOrCoreProtocol & { openUrl: [string, void]; - applyToFile: [ - { - text: string; - streamId: string; - filepath?: string; - toolCallId?: string; - }, - void, - ]; + applyToFile: [ApplyToFilePayload, void]; overwriteFile: [{ filepath: string; prevFileContent: string | null }, void]; showTutorial: [undefined, void]; showFile: [ShowFilePayload, void]; diff --git a/core/protocol/messenger/messageIde.ts b/core/protocol/messenger/messageIde.ts index 87e1ec642..30d9b8177 100644 --- a/core/protocol/messenger/messageIde.ts +++ b/core/protocol/messenger/messageIde.ts @@ -106,6 +106,10 @@ export class MessageIde implements IDE { return this.request("isTelemetryEnabled", undefined); } + isWorkspaceRemote(): Promise { + return this.request("isWorkspaceRemote", undefined); + } + getUniqueId(): Promise { return this.request("getUniqueId", undefined); } diff --git a/core/protocol/passThrough.ts b/core/protocol/passThrough.ts index 105636d2f..6b29ce472 100644 --- a/core/protocol/passThrough.ts +++ b/core/protocol/passThrough.ts @@ -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", diff --git a/core/rules.md b/core/rules.md new file mode 100644 index 000000000..57c897d3f --- /dev/null +++ b/core/rules.md @@ -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. diff --git a/core/tools/builtIn.ts b/core/tools/builtIn.ts index 5a2408a0c..a7b2ecd61 100644 --- a/core/tools/builtIn.ts +++ b/core/tools/builtIn.ts @@ -1,6 +1,7 @@ export enum BuiltInToolNames { ReadFile = "builtin_read_file", EditExistingFile = "builtin_edit_existing_file", + SearchAndReplaceInFile = "builtin_search_and_replace_in_file", ReadCurrentlyOpenFile = "builtin_read_currently_open_file", CreateNewFile = "builtin_create_new_file", RunTerminalCommand = "builtin_run_terminal_command", @@ -12,6 +13,7 @@ export enum BuiltInToolNames { CreateRuleBlock = "builtin_create_rule_block", RequestRule = "builtin_request_rule", FetchUrlContent = "builtin_fetch_url_content", + CodebaseTool = "builtin_codebase", // excluded from allTools for now ViewRepoMap = "builtin_view_repo_map", @@ -20,4 +22,7 @@ export enum BuiltInToolNames { export const BUILT_IN_GROUP_NAME = "Built-In"; -export const CLIENT_TOOLS_IMPLS = [BuiltInToolNames.EditExistingFile]; +export const CLIENT_TOOLS_IMPLS = [ + BuiltInToolNames.EditExistingFile, + BuiltInToolNames.SearchAndReplaceInFile, +]; diff --git a/core/tools/callTool.ts b/core/tools/callTool.ts index 40dd7abe2..85f6cb1b6 100644 --- a/core/tools/callTool.ts +++ b/core/tools/callTool.ts @@ -1,8 +1,10 @@ import { ContextItem, Tool, ToolCall, ToolExtras } from ".."; import { MCPManagerSingleton } from "../context/mcp/MCPManagerSingleton"; +import { DataLogger } from "../data/log"; import { canParseUrl } from "../util/url"; import { BuiltInToolNames } from "./builtIn"; +import { codebaseToolImpl } from "./implementations/codebaseTool"; import { createNewFileImpl } from "./implementations/createNewFile"; import { createRuleBlockImpl } from "./implementations/createRuleBlock"; import { fetchUrlContentImpl } from "./implementations/fetchUrlContent"; @@ -164,11 +166,33 @@ async function callBuiltInTool( return await createRuleBlockImpl(args, extras); case BuiltInToolNames.RequestRule: return await requestRuleImpl(args, extras); + case BuiltInToolNames.CodebaseTool: + return await codebaseToolImpl(args, extras); default: throw new Error(`Tool "${functionName}" not found`); } } +function logToolUsage( + toolCall: ToolCall, + args: Record, + contextItems: ContextItem[], + success: boolean, +) { + void DataLogger.getInstance().logDevData({ + name: "toolUsage", + data: { + toolCallId: toolCall.id, + functionName: toolCall.function.name, + functionArgs: toolCall.function.arguments, + toolCallArgs: args, + parsedArgs: args, + output: contextItems, + succeeded: success, + }, + }); +} + // Handles calls for core/non-client tools // Returns an error context item if the tool call fails // Note: Edit tool is handled on client @@ -190,6 +214,7 @@ export async function callTool( item.icon = tool.faviconUrl; }); } + logToolUsage(toolCall, args, contextItems, true); return { contextItems, errorMessage: undefined, @@ -199,6 +224,7 @@ export async function callTool( if (e instanceof Error) { errorMessage = e.message; } + logToolUsage(toolCall, {}, [], false); return { contextItems: [], errorMessage, diff --git a/core/tools/definitions/codebaseTool.ts b/core/tools/definitions/codebaseTool.ts new file mode 100644 index 000000000..fffe51e02 --- /dev/null +++ b/core/tools/definitions/codebaseTool.ts @@ -0,0 +1,29 @@ +import { Tool } from "../.."; +import { BUILT_IN_GROUP_NAME, BuiltInToolNames } from "../builtIn"; + +export const codebaseTool: Tool = { + type: "function", + displayTitle: "Codebase Search", + wouldLikeTo: "search the codebase for: {{{ query }}}", + isCurrently: "searching the codebase for: {{{ query }}}", + hasAlready: "searched the codebase for: {{{ query }}}", + readonly: true, + isInstant: false, + group: BUILT_IN_GROUP_NAME, + function: { + name: BuiltInToolNames.CodebaseTool, + description: + "Use this tool to semantically search through the codebase and retrieve relevant code snippets based on a natural language query. This helps find relevant code context for understanding or working with the codebase.", + parameters: { + type: "object", + required: ["query"], + properties: { + query: { + type: "string", + description: + "Natural language description of what you're looking for in the codebase (e.g., 'authentication logic', 'database connection setup', 'error handling')", + }, + }, + }, + }, +}; diff --git a/core/tools/definitions/createRuleBlock.ts b/core/tools/definitions/createRuleBlock.ts index ace3bc6b2..9596122a3 100644 --- a/core/tools/definitions/createRuleBlock.ts +++ b/core/tools/definitions/createRuleBlock.ts @@ -13,10 +13,10 @@ export const createRuleBlock: Tool = { function: { name: BuiltInToolNames.CreateRuleBlock, description: - "Creates a persistent rule for all future conversations. For establishing code standards or preferences that should be applied consistently. To modify existing rules, use the edit tool instead.", + 'Creates a "rule" that can be referenced in future conversations. This should be used whenever you want to establish code standards / preferences that should be applied consistently, or when you want to avoid making a mistake again. To modify existing rules, use the edit tool instead.', parameters: { type: "object", - required: ["name", "rule", "alwaysApply", "description"], + required: ["name", "rule", "description"], properties: { name: { type: "string", @@ -37,6 +37,11 @@ export const createRuleBlock: Tool = { description: "Optional file patterns to which this rule applies (e.g. ['**/*.{ts,tsx}'] or ['src/**/*.ts', 'tests/**/*.ts'])", }, + regex: { + type: "string", + description: + "Optional regex patterns to match against file content. Rule applies only to files whose content matches the pattern (e.g. 'useEffect' for React hooks or '\\bclass\\b' for class definitions)", + }, }, }, }, diff --git a/core/tools/definitions/editFile.ts b/core/tools/definitions/editFile.ts index 6c6ad6fd9..53e18cd43 100644 --- a/core/tools/definitions/editFile.ts +++ b/core/tools/definitions/editFile.ts @@ -1,4 +1,5 @@ import { Tool } from "../.."; +import { EDIT_CODE_INSTRUCTIONS } from "../../llm/constructMessages"; import { BUILT_IN_GROUP_NAME, BuiltInToolNames } from "../builtIn"; export interface EditToolArgs { @@ -17,8 +18,7 @@ export const editFileTool: Tool = { isInstant: false, function: { name: BuiltInToolNames.EditExistingFile, - description: - "Use this tool to edit an existing file. If you don't know the contents of the file, read it first.", + description: `Use this tool to edit an existing file. If you don't know the contents of the file, read it first.\n${EDIT_CODE_INSTRUCTIONS}`, parameters: { type: "object", required: ["filepath", "changes"], diff --git a/core/tools/definitions/searchAndReplaceInFile.ts b/core/tools/definitions/searchAndReplaceInFile.ts new file mode 100644 index 000000000..a861fbb1c --- /dev/null +++ b/core/tools/definitions/searchAndReplaceInFile.ts @@ -0,0 +1,82 @@ +import { Tool } from "../.."; +import { BUILT_IN_GROUP_NAME, BuiltInToolNames } from "../builtIn"; + +export interface SearchAndReplaceInFileArgs { + filepath: string; + diff: string; +} + +/** + * This tool is in an experimental state. + * Our starting point is heavily inspired by Cline's `replace_in_file` tool: https://github.com/cline/cline/blob/2709ccefcddc616e89a70962f017bcbbca1f17bf/src/core/prompts/system.ts#L87-L121 + */ +export const searchAndReplaceInFileTool: Tool = { + type: "function", + displayTitle: "Edit File", + wouldLikeTo: "edit {{{ filepath }}}", + isCurrently: "editing {{{ filepath }}}", + hasAlready: "edited {{{ filepath }}}", + group: BUILT_IN_GROUP_NAME, + readonly: false, + isInstant: false, + function: { + name: BuiltInToolNames.SearchAndReplaceInFile, + description: + "Description: Request to replace sections of content in an existing file using SEARCH/REPLACE blocks that define exact changes to specific parts of the file. This tool should be used when you need to make targeted changes to specific parts of a file.", + parameters: { + type: "object", + required: ["filepath", "diff"], + properties: { + filepath: { + type: "string", + description: + "The path of the file to modify, relative to the root of the workspace.", + }, + diff: { + type: "string", + description: `One or more SEARCH/REPLACE blocks following this exact format: +\`\`\` +------- SEARCH +[exact content to find] +======= +[new content to replace with] ++++++++ REPLACE +\`\`\` + +Critical rules: +1. SEARCH content must match the associated file section to find EXACTLY: + * Match character-for-character including whitespace, indentation, line endings + * Include all comments, docstrings, etc. +2. SEARCH/REPLACE blocks will ONLY replace the first match occurrence. + * Including multiple unique SEARCH/REPLACE blocks if you need to make multiple changes. + * Include *just* enough lines in each SEARCH section to uniquely match each set of lines that need to change. + * When using multiple SEARCH/REPLACE blocks, list them in the order they appear in the file. +3. Keep SEARCH/REPLACE blocks concise: + * Break large SEARCH/REPLACE blocks into a series of smaller blocks that each change a small portion of the file. + * Include just the changing lines, and a few surrounding lines if needed for uniqueness. + * Do not include long runs of unchanging lines in SEARCH/REPLACE blocks. + * Each line must be complete. Never truncate lines mid-way through as this can cause matching failures. +4. Special operations: + * To move code: Use two SEARCH/REPLACE blocks (one to delete from original + one to insert at new location) + * To delete code: Use empty REPLACE section + +Usage: +\`\`\` +------- SEARCH +[exact content to find] +======= +[new content to replace with] ++++++++ REPLACE + +------- SEARCH +[exact content to find] +======= +[new content to replace with] ++++++++ REPLACE + \`\`\` +`, + }, + }, + }, + }, +}; diff --git a/core/tools/implementations/codebaseTool.ts b/core/tools/implementations/codebaseTool.ts new file mode 100644 index 000000000..46b06a8c6 --- /dev/null +++ b/core/tools/implementations/codebaseTool.ts @@ -0,0 +1,61 @@ +import { ToolImpl } from "."; +import { RangeInFile } from "../.."; +import { retrieveContextItemsFromEmbeddings } from "../../context/retrieval/retrieval"; + +export const codebaseToolImpl: ToolImpl = async (args, extras) => { + if (!args.query || args.query.trim() === "") { + return [ + { + name: "Error", + description: "Codebase search error", + content: "Query parameter is required and cannot be empty.", + }, + ]; + } + + try { + const contextExtras = { + config: extras.config, + fullInput: args.query, + embeddingsProvider: extras.config.selectedModelByRole.embed, + reranker: extras.config.selectedModelByRole.rerank, + llm: extras.llm, + ide: extras.ide, + selectedCode: [] as RangeInFile[], + fetch: extras.fetch, + }; + + // Use the existing retrieval function to get context items + const results = await retrieveContextItemsFromEmbeddings( + contextExtras, + undefined, + undefined, + ); + + // If no results found, return helpful message + if (results.length === 0) { + return [ + { + name: "No Results", + description: "Codebase search", + content: `No relevant code found for query: "${args.query}". This could mean: +- The codebase hasn't been indexed yet +- No code matches the search criteria +- Embeddings provider is not configured + +Try re-indexing the codebase or using a more specific query.`, + }, + ]; + } + + return results; + } catch (error) { + return [ + { + name: "Error", + description: "Codebase search error", + content: `Failed to search codebase: ${error instanceof Error ? error.message : String(error)}`, + }, + ]; + } +}; diff --git a/core/tools/implementations/createRuleBlock.ts b/core/tools/implementations/createRuleBlock.ts index a38e06056..06921f770 100644 --- a/core/tools/implementations/createRuleBlock.ts +++ b/core/tools/implementations/createRuleBlock.ts @@ -7,16 +7,24 @@ export type CreateRuleBlockArgs = Pick< Required, "rule" | "description" | "alwaysApply" | "name" > & - Pick; + Pick; export const createRuleBlockImpl: ToolImpl = async ( args: CreateRuleBlockArgs, extras, ) => { - const fileContent = createRuleMarkdown(args.name, args.rule, { + // Create options object with the fields that createRuleMarkdown expects + const options: any = { description: args.description, globs: args.globs, - }); + }; + + // Add regex if provided + if (args.regex) { + options.regex = args.regex; + } + + const fileContent = createRuleMarkdown(args.name, args.rule, options); const [localContinueDir] = await extras.ide.getWorkspaceDirs(); const ruleFilePath = createRuleFilePath(localContinueDir, args.name); diff --git a/core/tools/index.ts b/core/tools/index.ts index c4d1c658b..54987607b 100644 --- a/core/tools/index.ts +++ b/core/tools/index.ts @@ -1,4 +1,5 @@ -import { ConfigDependentToolParams, Tool } from ".."; +import { ConfigDependentToolParams, IDE, Tool } from ".."; +import { codebaseTool } from "./definitions/codebaseTool"; import { createNewFileTool } from "./definitions/createNewFile"; import { createRuleBlock } from "./definitions/createRuleBlock"; import { editFileTool } from "./definitions/editFile"; @@ -10,15 +11,19 @@ import { readCurrentlyOpenFileTool } from "./definitions/readCurrentlyOpenFile"; import { readFileTool } from "./definitions/readFile"; import { requestRuleTool } from "./definitions/requestRule"; import { runTerminalCommandTool } from "./definitions/runTerminalCommand"; +import { searchAndReplaceInFileTool } from "./definitions/searchAndReplaceInFile"; import { searchWebTool } from "./definitions/searchWeb"; import { viewDiffTool } from "./definitions/viewDiff"; +import { viewRepoMapTool } from "./definitions/viewRepoMap"; +import { viewSubdirectoryTool } from "./definitions/viewSubdirectory"; + +// 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, @@ -26,11 +31,23 @@ export const baseToolDefinitions = [ lsTool, createRuleBlock, fetchUrlContentTool, - // replacing with ls tool for now - // viewSubdirectoryTool, - // viewRepoMapTool, ]; export const getConfigDependentToolDefinitions = ( params: ConfigDependentToolParams, -): Tool[] => [requestRuleTool(params)]; +): Tool[] => [ + requestRuleTool(params), + ...(params.enableExperimentalTools + ? [ + searchAndReplaceInFileTool, + viewRepoMapTool, + viewSubdirectoryTool, + codebaseTool, + ] + : [editFileTool]), +]; + +export const getToolsForIde = async (ide: IDE) => + (await ide.isWorkspaceRemote()) + ? baseToolDefinitions + : [...baseToolDefinitions, ...localOnlyToolDefinitions]; diff --git a/core/tools/parseArgs.ts b/core/tools/parseArgs.ts index 36d75e020..86ee26cb1 100644 --- a/core/tools/parseArgs.ts +++ b/core/tools/parseArgs.ts @@ -4,7 +4,7 @@ export function safeParseToolCallArgs( toolCall: ToolCallDelta, ): Record { 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`, diff --git a/core/util/filesystem.ts b/core/util/filesystem.ts index 8b50a3cae..f415e5e86 100644 --- a/core/util/filesystem.ts +++ b/core/util/filesystem.ts @@ -48,6 +48,10 @@ class FileSystemIde implements IDE { return; } + isWorkspaceRemote(): Promise { + return Promise.resolve(false); + } + async getIdeSettings(): Promise { return { remoteConfigServerUrl: undefined, diff --git a/core/util/handlebars/handlebarUtils.ts b/core/util/handlebars/handlebarUtils.ts new file mode 100644 index 000000000..9314fd353 --- /dev/null +++ b/core/util/handlebars/handlebarUtils.ts @@ -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; +} { + const promises: { [key: string]: Promise } = {}; + + 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, + ctxProviderNames: string[], + readFile: (filepath: string) => Promise, + getUriFromPath: (path: string) => Promise, +) { + // First, replace filepaths with letters to avoid escaping issues + const ast = handlebars.parse(template); + + const filepathLetters: Map = new Map(); + const requiredContextProviders: Set = 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 }, +): Promise { + await Promise.all(Object.values(promises)); + + for (const id in promises) { + renderedString = renderedString.replace(`__${id}__`, await promises[id]); + } + + return renderedString; +} diff --git a/core/promptFiles/v1/renderTemplatedString.ts b/core/util/handlebars/renderTemplatedString.ts similarity index 51% rename from core/promptFiles/v1/renderTemplatedString.ts rename to core/util/handlebars/renderTemplatedString.ts index bcc645ace..20927e814 100644 --- a/core/promptFiles/v1/renderTemplatedString.ts +++ b/core/util/handlebars/renderTemplatedString.ts @@ -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, inputData: Record, - availableHelpers?: Array<[string, Handlebars.HelperDelegate]>, + availableHelpers: Array<[string, Handlebars.HelperDelegate]>, + readFile: (filepath: string) => Promise, + getUriFromPath: (path: string) => Promise, ): Promise { 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); } diff --git a/core/util/posthog.ts b/core/util/posthog.ts index 25b3ab600..dfde657fb 100644 --- a/core/util/posthog.ts +++ b/core/util/posthog.ts @@ -4,6 +4,7 @@ import { TeamAnalytics } from "../control-plane/TeamAnalytics.js"; import { IdeInfo } from "../index.js"; import type { PostHog as PostHogType } from "posthog-node"; +import { extractMinimalStackTraceInfo } from "./extractMinimalStackTraceInfo.js"; export enum PosthogFeatureFlag { AutocompleteTimeout = "autocomplete-timeout", @@ -37,6 +38,24 @@ export class Telemetry { static os: string | undefined = undefined; static ideInfo: IdeInfo | undefined = undefined; + /** + * Convenience method for capturing errors in a single event + */ + static async captureError(errorName: string, error: unknown) { + if (!(error instanceof Error)) { + return; + } + await Telemetry.capture( + "extension_error_caught", + { + errorName, + message: error.message, + stack: extractMinimalStackTraceInfo(error.stack), + }, + false, + ); + } + static async capture( event: string, properties: { [key: string]: any }, diff --git a/core/util/text.ts b/core/util/text.ts index e4870dfa0..9e948f415 100644 --- a/core/util/text.ts +++ b/core/util/text.ts @@ -4,3 +4,40 @@ export const capitalizeFirstLetter = (val: string) => { } return val[0].toUpperCase() + val.slice(1); }; + +export function replaceEscapedCharacters(str: string): string { + return str.replaceAll(/\\(n|t|r|\\|"|')/g, (match, p1) => { + switch (p1) { + case "n": + return "\n"; + case "t": + return "\t"; + case "r": + return "\r"; + case "\\": + return "\\"; + case '"': + return '"'; + case "'": + return "'"; + default: + return match; // NOTE: Handle unexpected escapes better than this. + } + }); +} + +export function escapeForSVG(text: string): string { + return text + .replace(/&/g, "&") // must be first + .replace(//g, ">") + .replace(/"/g, """) + .replace(/'/g, "'"); +} + +export function kebabOfStr(str: string): string { + return str + .replace(/([a-z])([A-Z])/g, "$1-$2") // handle camelCase and PascalCase + .replace(/[\s_]+/g, "-") // replace spaces and underscores with hyphens + .toLowerCase(); +} diff --git a/core/util/uri.ts b/core/util/uri.ts index e180a0a69..d3c1659b5 100644 --- a/core/util/uri.ts +++ b/core/util/uri.ts @@ -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, }; } diff --git a/docs/docs/customize/deep-dives/prompts.md b/docs/docs/customize/deep-dives/prompts.md index 1cd1c0085..daaa342cd 100644 --- a/docs/docs/customize/deep-dives/prompts.md +++ b/docs/docs/customize/deep-dives/prompts.md @@ -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 /, 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 /, 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: +``` diff --git a/docs/docs/customize/deep-dives/rules.mdx b/docs/docs/customize/deep-dives/rules.mdx index 147606f85..92a006b5e 100644 --- a/docs/docs/customize/deep-dives/rules.mdx +++ b/docs/docs/customize/deep-dives/rules.mdx @@ -55,18 +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 @@ -96,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 @@ -163,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). @@ -171,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. ::: diff --git a/docs/docs/customize/model-providers/top-level/bedrock.mdx b/docs/docs/customize/model-providers/top-level/bedrock.mdx index eb2646d46..a314d0899 100644 --- a/docs/docs/customize/model-providers/top-level/bedrock.mdx +++ b/docs/docs/customize/model-providers/top-level/bedrock.mdx @@ -200,9 +200,10 @@ To setup Bedrock using custom imported models, add the following to your config - name: AWS Bedrock deepseek-coder-6.7b-instruct provider: bedrockimport model: deepseek-coder-6.7b-instruct - modelArn: arn:aws:bedrock:us-west-2:XXXXX:imported-model/XXXXXX - region: us-west-2 - profile: bedrock + env: + region: us-west-2 + profile: bedrock + modelArn: arn:aws:bedrock:us-west-2:XXXXX:imported-model/XXXXXX ``` diff --git a/docs/docusaurus.config.js b/docs/docusaurus.config.js index 4e873f0db..7a3c3a8d9 100644 --- a/docs/docusaurus.config.js +++ b/docs/docusaurus.config.js @@ -211,6 +211,15 @@ const config = { enableInDevelopment: false, }, ], + [ + "docusaurus-plugin-llms-txt", + { + // Optional configuration + outputPath: "static/llms.txt", + includePatterns: ["docs/**"], + excludePatterns: ["**/node_modules/**"], + }, + ], [ "@docusaurus/plugin-client-redirects", { diff --git a/docs/package-lock.json b/docs/package-lock.json index f3a3ea446..684d04e98 100644 --- a/docs/package-lock.json +++ b/docs/package-lock.json @@ -14,6 +14,7 @@ "@docusaurus/preset-classic": "^3.7.0", "@mdx-js/react": "^3.0.0", "clsx": "^2.1.0", + "docusaurus-plugin-llms-txt": "^0.1.3", "posthog-docusaurus": "^2.0.4", "prism-react-renderer": "^2.3.1", "react": "^18.2.0", @@ -7604,6 +7605,23 @@ "node": ">=6" } }, + "node_modules/docusaurus-plugin-llms-txt": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/docusaurus-plugin-llms-txt/-/docusaurus-plugin-llms-txt-0.1.3.tgz", + "integrity": "sha512-X/Dqf1/soHFjvELWXtfa9C023498HsWWwNPdVZEu0OoznI2Gzf+VCB/4obwpBSV9OeDeI8D94/dK/ETq534k9A==", + "license": "MIT", + "dependencies": { + "fs-extra": "^11.2.0", + "gray-matter": "^4.0.3" + }, + "engines": { + "node": ">=16.14" + }, + "peerDependencies": { + "@docusaurus/core": ">=2.0.0", + "react": ">=16.8.0" + } + }, "node_modules/dom-converter": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/dom-converter/-/dom-converter-0.2.0.tgz", diff --git a/docs/package.json b/docs/package.json index 67b995070..af9538e94 100644 --- a/docs/package.json +++ b/docs/package.json @@ -22,6 +22,7 @@ "@docusaurus/preset-classic": "^3.7.0", "@mdx-js/react": "^3.0.0", "clsx": "^2.1.0", + "docusaurus-plugin-llms-txt": "^0.1.3", "posthog-docusaurus": "^2.0.4", "prism-react-renderer": "^2.3.1", "react": "^18.2.0", diff --git a/extensions/intellij/CONTRIBUTING.md b/extensions/intellij/CONTRIBUTING.md index 2331eb2b3..505a44850 100644 --- a/extensions/intellij/CONTRIBUTING.md +++ b/extensions/intellij/CONTRIBUTING.md @@ -27,6 +27,7 @@ This file is for contribution guidelines specific to the JetBrains extension. Se - [Setup](#setup) - [Running the tests](#running-the-tests) - [Identifying selectors](#identifying-selectors) + - [Rebuilding the extension](#rebuilding-the-extension) ## Architecture Overview @@ -49,6 +50,7 @@ notes below). ### IDE configuration - Enable code formatting on save: `Settings | Tools | Actions on Save | Reformat code` +- We recommend installing the [Thread Access Info](https://plugins.jetbrains.com/plugin/16815-thread-access-info) plugin ### Node.js Requirements @@ -184,7 +186,7 @@ Run a single test While the `runIdeForUiTests` task is running, you can visit the following URL to view the UI hierarchy of the running IDE: -http://127.0.0.1:8082/ + #### Rebuilding the extension diff --git a/extensions/intellij/build.gradle.kts b/extensions/intellij/build.gradle.kts index a1b27e801..d1e6a000d 100644 --- a/extensions/intellij/build.gradle.kts +++ b/extensions/intellij/build.gradle.kts @@ -11,13 +11,14 @@ fun Sync.prepareSandbox() { val remoteRobotVersion = "0.11.23" plugins { - id("java") // Java support - alias(libs.plugins.kotlin) // Kotlin support - alias(libs.plugins.gradleIntelliJPlugin) // Gradle IntelliJ Plugin - alias(libs.plugins.changelog) // Gradle Changelog Plugin - alias(libs.plugins.qodana) // Gradle Qodana Plugin - alias(libs.plugins.kover) // Gradle Kover Plugin + id("java") + kotlin("jvm") version "1.9.0" + id("org.jetbrains.intellij") version "1.15.0" + id("org.jetbrains.changelog") version "2.1.2" + id("org.jetbrains.qodana") version "0.1.13" + id("org.jetbrains.kotlinx.kover") version "0.7.3" kotlin("plugin.serialization") version "1.8.0" + id("io.sentry.jvm.gradle") version "5.8.0" } group = properties("pluginGroup").get() @@ -33,7 +34,6 @@ repositories { // Dependencies are managed with Gradle version catalog - read more: // https://docs.gradle.org/current/userguide/platforms.html#sub:version-catalog dependencies { - // implementation(libs.annotations) implementation("com.squareup.okhttp3:okhttp:4.12.0") { exclude(group = "org.jetbrains.kotlin", module = "kotlin-stdlib") } diff --git a/extensions/intellij/gradle.properties b/extensions/intellij/gradle.properties index 8c3302728..4248e25a9 100644 --- a/extensions/intellij/gradle.properties +++ b/extensions/intellij/gradle.properties @@ -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.24 +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 diff --git a/extensions/intellij/gradle/libs.versions.toml b/extensions/intellij/gradle/libs.versions.toml deleted file mode 100644 index 4e9387593..000000000 --- a/extensions/intellij/gradle/libs.versions.toml +++ /dev/null @@ -1,20 +0,0 @@ -[versions] -# libraries -annotations = "24.0.1" - -# plugins -kotlin = "1.9.0" -changelog = "2.1.2" -gradleIntelliJPlugin = "1.15.0" -qodana = "0.1.13" -kover = "0.7.3" - -[libraries] -annotations = { group = "org.jetbrains", name = "annotations", version.ref = "annotations" } - -[plugins] -changelog = { id = "org.jetbrains.changelog", version.ref = "changelog" } -gradleIntelliJPlugin = { id = "org.jetbrains.intellij", version.ref = "gradleIntelliJPlugin" } -kotlin = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" } -kover = { id = "org.jetbrains.kotlinx.kover", version.ref = "kover" } -qodana = { id = "org.jetbrains.qodana", version.ref = "qodana" } diff --git a/extensions/intellij/rules.md b/extensions/intellij/rules.md new file mode 100644 index 000000000..1f95724c9 --- /dev/null +++ b/extensions/intellij/rules.md @@ -0,0 +1,56 @@ +# Continue JetBrains Extension + +## Project Purpose + +JetBrains/IntelliJ extension for Continue AI code assistant. Provides chat, autocomplete, inline edit, and agent features within JetBrains IDEs. + +## Architecture + +- **Language**: Kotlin (JDK 17), Gradle build +- **Communication**: stdin/stdout message passing with core binary from `../../binary` +- **UI**: Embeds React webview from `../../gui` +- **Platform**: IntelliJ Platform Plugin (IDEA, PyCharm, WebStorm, etc.) + +## Key Source Structure + +``` +src/main/kotlin/com/github/continuedev/continueintellijextension/ +├── continue/ # Core integration (CoreMessenger, IntelliJIde, IdeProtocolClient) +├── autocomplete/ # Code completion logic +├── editor/ # Diff handling, inline edits +├── toolWindow/ # Main UI panel +├── services/ # Settings, plugin lifecycle +├── actions/ # Keyboard shortcuts, menu actions +├── protocol/ # Message type definitions +└── constants/ # App constants, paths + +src/main/resources/ +├── META-INF/plugin.xml # Plugin configuration +└── webview/ # Embedded React UI assets +``` + +## Core Files + +- `IntelliJIde.kt`: Main IDE interface implementation +- `CoreMessenger.kt`: Binary communication handler +- `plugin.xml`: Plugin manifest and extension points +- `build.gradle.kts`: Build configuration +- `ContinuePluginService.kt`: Main service orchestrator + +## Message Protocol + +JSON messages between Extension ↔ Core ↔ GUI. Message types in `constants/MessageTypes.kt`. Extension relays messages between core binary and webview. + +## Testing + +- Unit tests: `src/test/kotlin/` +- E2E tests: UI automation with intellij-ui-test-robot +- Test command: `./gradlew test` +- Debug: `runIde` Gradle task + +## Key Integration Points + +- File operations via IntelliJ VFS +- Editor integration for diffs/autocomplete +- Git operations for repository context +- Settings via IntelliJ platform storage diff --git a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/actions/ContinueActionPromote.kt b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/actions/ContinueActionPromote.kt index 8c046c342..43ae74881 100644 --- a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/actions/ContinueActionPromote.kt +++ b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/actions/ContinueActionPromote.kt @@ -5,7 +5,7 @@ import com.github.continuedev.continueintellijextension.services.ContinueExtensi import com.intellij.openapi.actionSystem.ActionPromoter import com.intellij.openapi.actionSystem.AnAction import com.intellij.openapi.actionSystem.DataContext -import com.intellij.openapi.components.ServiceManager +import com.intellij.openapi.components.service import org.jetbrains.annotations.NotNull class ContinueActionPromote : ActionPromoter { @@ -13,7 +13,7 @@ class ContinueActionPromote : ActionPromoter { override fun promote(@NotNull actions: List, @NotNull context: DataContext): List? { // For autocomplete actions if (actions.any { it is AcceptAutocompleteAction }) { - val settings = ServiceManager.getService(ContinueExtensionSettings::class.java) + val settings = service() if (settings.continueState.showIDECompletionSideBySide) { return actions.filterIsInstance() } diff --git a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/actions/utils.kt b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/actions/utils.kt index 1bd31c463..654b96483 100644 --- a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/actions/utils.kt +++ b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/actions/utils.kt @@ -1,7 +1,7 @@ package com.github.continuedev.continueintellijextension.actions import com.github.continuedev.continueintellijextension.services.ContinuePluginService -import com.intellij.openapi.components.ServiceManager +import com.intellij.openapi.components.service import com.intellij.openapi.project.Project import com.intellij.openapi.wm.ToolWindowManager @@ -28,12 +28,5 @@ fun focusContinueInput(project: Project?) { continuePluginService.ideProtocolClient?.sendHighlightedCode() } -fun getPluginService(project: Project?): ContinuePluginService? { - if (project == null) { - return null - } - return ServiceManager.getService( - project, - ContinuePluginService::class.java - ) -} \ No newline at end of file +fun getPluginService(project: Project?): ContinuePluginService? = + project?.service() diff --git a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/activities/ContinuePluginDisposable.kt b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/activities/ContinuePluginDisposable.kt index e8d3d0788..7fee29ee3 100644 --- a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/activities/ContinuePluginDisposable.kt +++ b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/activities/ContinuePluginDisposable.kt @@ -1,9 +1,7 @@ package com.github.continuedev.continueintellijextension.activities import com.intellij.openapi.Disposable -import com.intellij.openapi.application.ApplicationManager import com.intellij.openapi.components.Service -import com.intellij.openapi.project.Project /** * The service is a parent disposable that represents the entire plugin lifecycle @@ -18,15 +16,4 @@ class ContinuePluginDisposable : Disposable { override fun dispose() { } - companion object { - - fun getInstance(): ContinuePluginDisposable { - return ApplicationManager.getApplication().getService(ContinuePluginDisposable::class.java) - } - - fun getInstance(project: Project): ContinuePluginDisposable { - return project.getService(ContinuePluginDisposable::class.java) - } - - } } \ No newline at end of file diff --git a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/activities/ContinuePluginStartupActivity.kt b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/activities/ContinuePluginStartupActivity.kt index d4a9d2201..3aaeef5ed 100644 --- a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/activities/ContinuePluginStartupActivity.kt +++ b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/activities/ContinuePluginStartupActivity.kt @@ -14,7 +14,6 @@ import com.github.continuedev.continueintellijextension.utils.toUriOrNull import com.intellij.openapi.actionSystem.KeyboardShortcut import com.intellij.openapi.application.ApplicationManager import com.intellij.openapi.application.ApplicationNamesInfo -import com.intellij.openapi.components.ServiceManager import com.intellij.openapi.editor.EditorFactory import com.intellij.openapi.fileEditor.FileEditorManager import com.intellij.openapi.keymap.KeymapManager @@ -122,14 +121,10 @@ class ContinuePluginStartupActivity : StartupActivity, DumbAware { private fun initializePlugin(project: Project) { val coroutineScope = CoroutineScope(Dispatchers.IO) - val continuePluginService = ServiceManager.getService( - project, - ContinuePluginService::class.java - ) + val continuePluginService = project.service() coroutineScope.launch { - val settings = - ServiceManager.getService(ContinueExtensionSettings::class.java) + val settings = service() if (!settings.continueState.shownWelcomeDialog) { settings.continueState.shownWelcomeDialog = true // Open tutorial file @@ -270,7 +265,7 @@ class ContinuePluginStartupActivity : StartupActivity, DumbAware { EditorFactory.getInstance().eventMulticaster.addSelectionListener( listener, - ContinuePluginDisposable.getInstance(project) + project.service() ) val coreMessengerManager = CoreMessengerManager(project, ideProtocolClient, coroutineScope) diff --git a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/auth/ContinueAuthService.kt b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/auth/ContinueAuthService.kt index 28f81b319..13ceaf810 100644 --- a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/auth/ContinueAuthService.kt +++ b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/auth/ContinueAuthService.kt @@ -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 diff --git a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/autocomplete/AutocompleteService.kt b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/autocomplete/AutocompleteService.kt index 17397f1c8..f4c3fd67f 100644 --- a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/autocomplete/AutocompleteService.kt +++ b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/autocomplete/AutocompleteService.kt @@ -7,7 +7,6 @@ import com.github.continuedev.continueintellijextension.utils.uuid import com.intellij.injected.editor.VirtualFileWindow import com.intellij.openapi.application.* import com.intellij.openapi.components.Service -import com.intellij.openapi.components.ServiceManager import com.intellij.openapi.components.service import com.intellij.openapi.editor.Editor import com.intellij.openapi.editor.InlayProperties @@ -64,8 +63,7 @@ class AutocompleteService(private val project: Project) { var lastChangeWasPartialAccept = false fun triggerCompletion(editor: Editor) { - val settings = - ServiceManager.getService(ContinueExtensionSettings::class.java) + val settings = service() if (!settings.continueState.enableTabAutocomplete) { return } @@ -183,7 +181,7 @@ class AutocompleteService(private val project: Project) { } if (isInjectedFile(editor)) return // Skip rendering completions if the code completion dropdown is already visible and the IDE completion side-by-side setting is disabled - if (shouldSkipRender(ServiceManager.getService(ContinueExtensionSettings::class.java))) { + if (shouldSkipRender()) { return } @@ -230,9 +228,10 @@ class AutocompleteService(private val project: Project) { } } - private fun shouldSkipRender(settings: ContinueExtensionSettings) = - !settings.continueState.showIDECompletionSideBySide && !autocompleteLookupListener.isLookupEmpty() - + private fun shouldSkipRender(): Boolean { + val settings = service() + return !settings.continueState.showIDECompletionSideBySide && !autocompleteLookupListener.isLookupEmpty() + } private fun splitKeepingDelimiters(input: String, delimiterPattern: String = "\\s+"): List { val initialSplit = input.split("(?<=$delimiterPattern)|(?=$delimiterPattern)".toRegex()) diff --git a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/autocomplete/AutocompleteSpinnerWidgetFactory.kt b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/autocomplete/AutocompleteSpinnerWidgetFactory.kt index 9eba3ce5d..3997f220c 100644 --- a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/autocomplete/AutocompleteSpinnerWidgetFactory.kt +++ b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/autocomplete/AutocompleteSpinnerWidgetFactory.kt @@ -26,7 +26,7 @@ class AutocompleteSpinnerWidget(project: Project) : EditorBasedWidget(project), private val animatedIcon = AnimatedIcon.Default() init { - Disposer.register(ContinuePluginDisposable.getInstance(project), this) + Disposer.register(project.service(), this) updateIcon() } diff --git a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/constants/MessageTypes.kt b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/constants/MessageTypes.kt index 66ebac070..99ec3f267 100644 --- a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/constants/MessageTypes.kt +++ b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/constants/MessageTypes.kt @@ -92,6 +92,7 @@ class MessageTypes { "config/updateSharedConfig", "config/updateSelectedModel", "mcp/reloadServer", + "mcp/getPrompt", "context/getContextItems", "context/getSymbolsForFiles", "context/loadSubmenuItems", diff --git a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/ApplyToFileHandler.kt b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/ApplyToFileHandler.kt index 8cb05dc31..28b648d4a 100644 --- a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/ApplyToFileHandler.kt +++ b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/ApplyToFileHandler.kt @@ -10,6 +10,7 @@ import com.github.continuedev.continueintellijextension.editor.EditorUtils import com.github.continuedev.continueintellijextension.protocol.ApplyToFileParams import com.github.continuedev.continueintellijextension.services.ContinuePluginService import com.github.continuedev.continueintellijextension.utils.castNestedOrNull +import com.intellij.openapi.components.service import com.intellij.openapi.editor.Editor import com.intellij.openapi.project.Project import kotlinx.coroutines.suspendCancellableCoroutine @@ -44,6 +45,12 @@ class ApplyToFileHandler( return } + // Handle search/replace mode + if (params.isSearchReplace == true) { + handleSearchReplace(editorUtils) + return + } + // Get the LLM configuration for applying edits val llm = fetchApplyLLMConfig() ?: run { ide.showToast(ToastType.ERROR, "Failed to fetch model configuration") @@ -54,6 +61,40 @@ class ApplyToFileHandler( setupAndStreamDiffs(editorUtils, llm) } + /** + * Handle search and replace operations + * + * For search/replace, we always get a full file rewrite of the contents. + * We just need to generate diff lines between the current content and new content, + * then stream them through the existing infrastructure. + */ + private fun handleSearchReplace(editorUtils: EditorUtils) { + // Clear all diff blocks before running the diff stream + diffStreamService.reject(editorUtils.editor) + + // Get current file content and the new content (full rewrite) + val currentContent = editorUtils.getDocumentText() + val newContent = params.text + + // Work with the entire document + val startLine = 0 + val endLine = editorUtils.getLineCount() - 1 + // Create and register the diff stream handler + val diffStreamHandler = createDiffStreamHandler(editorUtils.editor, startLine, endLine) + diffStreamService.register(diffStreamHandler, editorUtils.editor) + + // Stream the diffs between current and new content + // For search/replace, we pass the new content as "input" and current as "highlighted" + diffStreamHandler.streamDiffLinesToEditor( + input = newContent, // The new content (full rewrite) + prefix = "", // No prefix since we're rewriting the whole file + highlighted = currentContent, // Current file content + suffix = "", // No suffix since we're rewriting the whole file + modelTitle = null, // No model needed for search/replace instant apply + includeRulesInSystemMessage = false // No LLM involved, just diff generation + ) + } + private fun notifyStreamStarted() { sendApplyStateUpdate(ApplyStateStatus.STREAMING) } @@ -61,10 +102,8 @@ class ApplyToFileHandler( private fun notifyStreamClosed(numDiffs: Int? = 0) { sendApplyStateUpdate(ApplyStateStatus.CLOSED, numDiffs) } - private fun sendApplyStateUpdate( - status: ApplyStateStatus, - numDiffs: Int? = null + status: ApplyStateStatus, numDiffs: Int? = null ) { val payload = ApplyState( streamId = params.streamId, @@ -82,16 +121,11 @@ class ApplyToFileHandler( return try { suspendCancellableCoroutine { continuation -> continuePluginService.coreMessenger?.request( - "config/getSerializedProfileInfo", - null, - null + "config/getSerializedProfileInfo", null, null ) { response -> try { val selectedModels = response.castNestedOrNull>( - "content", - "result", - "config", - "selectedModelByRole" + "content", "result", "config", "selectedModelByRole" ) // If "apply" role model is not found, try "chat" role @@ -143,9 +177,7 @@ class ApplyToFileHandler( } private fun createDiffStreamHandler( - editor: Editor, - startLine: Int, - endLine: Int + editor: Editor, startLine: Int, endLine: Int ): DiffStreamHandler { return DiffStreamHandler( project, @@ -164,28 +196,19 @@ class ApplyToFileHandler( * Factory method to create and execute a new handler for a single apply-to-file operation */ suspend fun apply( - project: Project, - continuePluginService: ContinuePluginService, - ide: IDE, - params: ApplyToFileParams + project: Project, continuePluginService: ContinuePluginService, ide: IDE, params: ApplyToFileParams ) { - val editorUtils = if (EditorUtils.editorFileExist(params.filepath)) - EditorUtils.getOrOpenEditor(project, params.filepath) - else - EditorUtils.getEditorByCreateFile(project, params.filepath) + val editorUtils = + if (EditorUtils.editorFileExist(params.filepath)) EditorUtils.getOrOpenEditor(project, params.filepath) + else EditorUtils.getEditorByCreateFile(project, params.filepath) - val diffStreamService = project.getService(DiffStreamService::class.java) + val diffStreamService = project.service() val handler = ApplyToFileHandler( - project, - continuePluginService, - ide, - params, - editorUtils, - diffStreamService + project, continuePluginService, ide, params, editorUtils, diffStreamService ) handler.handleApplyToFile() } } -} \ No newline at end of file +} diff --git a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/Diffs.kt b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/Diffs.kt index 417fbb8d4..c0eeec508 100644 --- a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/Diffs.kt +++ b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/Diffs.kt @@ -9,7 +9,7 @@ import com.intellij.diff.contents.DiffContent import com.intellij.diff.requests.SimpleDiffRequest import com.intellij.openapi.application.ApplicationManager import com.intellij.openapi.command.WriteCommandAction -import com.intellij.openapi.components.ServiceManager +import com.intellij.openapi.components.service import com.intellij.openapi.fileEditor.FileDocumentManager import com.intellij.openapi.project.DumbAware import com.intellij.openapi.project.Project @@ -18,7 +18,6 @@ import com.intellij.openapi.util.Disposer import com.intellij.openapi.vfs.LocalFileSystem import java.awt.Toolkit import java.io.File -import java.net.URI import java.nio.file.Paths import javax.swing.Action import javax.swing.JComponent @@ -89,11 +88,7 @@ class DiffManager(private val project: Project) : DumbAware { FileDocumentManager.getInstance().saveDocument(document) // Notify server of acceptance - val continuePluginService = ServiceManager.getService( - project, - ContinuePluginService::class.java - ) - continuePluginService.ideProtocolClient?.sendAcceptRejectDiff(true, diffInfo.stepIndex) + project.service().ideProtocolClient?.sendAcceptRejectDiff(true, diffInfo.stepIndex) // Clean up state cleanUpFile(file) @@ -102,10 +97,7 @@ class DiffManager(private val project: Project) : DumbAware { fun rejectDiff(file2: String?) { val file = (file2 ?: lastFile2) ?: return val diffInfo = diffInfoMap[file] ?: return - val continuePluginService = ServiceManager.getService( - project, - ContinuePluginService::class.java - ) + val continuePluginService = project.service() continuePluginService.ideProtocolClient?.deleteAtIndex(diffInfo.stepIndex) continuePluginService.ideProtocolClient?.sendAcceptRejectDiff(false, diffInfo.stepIndex) continuePluginService.coreMessenger?.request("cancelApply", null, null) {} diff --git a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/IdeProtocolClient.kt b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/IdeProtocolClient.kt index ddbb5f738..c79b6c9f0 100644 --- a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/IdeProtocolClient.kt +++ b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/IdeProtocolClient.kt @@ -6,6 +6,7 @@ import com.github.continuedev.continueintellijextension.activities.showTutorial import com.github.continuedev.continueintellijextension.auth.ContinueAuthService import com.github.continuedev.continueintellijextension.editor.DiffStreamService import com.github.continuedev.continueintellijextension.editor.EditorUtils +import com.github.continuedev.continueintellijextension.error.ContinueErrorService import com.github.continuedev.continueintellijextension.protocol.* import com.github.continuedev.continueintellijextension.services.* import com.github.continuedev.continueintellijextension.utils.* @@ -46,7 +47,7 @@ class IdeProtocolClient( init { // Setup config.json / config.ts save listeners VirtualFileManager.getInstance().addAsyncFileListener( - AsyncFileSaveListener(continuePluginService), ContinuePluginDisposable.getInstance(project) + AsyncFileSaveListener(continuePluginService), project.service() ) } @@ -67,8 +68,7 @@ class IdeProtocolClient( } "jetbrains/isOSREnabled" -> { - val isOSREnabled = - ServiceManager.getService(ContinueExtensionSettings::class.java).continueState.enableOSR + val isOSREnabled = service().continueState.enableOSR respond(isOSREnabled) } @@ -463,8 +463,10 @@ class IdeProtocolClient( println("Unknown message type: $messageType") } } - } catch (error: Exception) { - ide.showToast(ToastType.ERROR, " Error handling message of type $messageType: $error") + } catch (exception: Exception) { + val exceptionMessage = "Error handling message of type $messageType: $exception" + service().report(exception, exceptionMessage) + ide.showToast(ToastType.ERROR, exceptionMessage) } } } diff --git a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/IntelliJIde.kt b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/IntelliJIde.kt index a692759b9..d6fcee0a1 100644 --- a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/IntelliJIde.kt +++ b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/IntelliJIde.kt @@ -1,16 +1,16 @@ package com.github.continuedev.continueintellijextension.`continue` import com.github.continuedev.continueintellijextension.* -import com.github.continuedev.continueintellijextension.constants.getContinueGlobalPath import com.github.continuedev.continueintellijextension.constants.ContinueConstants -import com.github.continuedev.continueintellijextension.`continue`.GitService +import com.github.continuedev.continueintellijextension.constants.getContinueGlobalPath +import com.github.continuedev.continueintellijextension.error.ContinueErrorService import com.github.continuedev.continueintellijextension.services.ContinueExtensionSettings import com.github.continuedev.continueintellijextension.services.ContinuePluginService 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.plugins.PluginManager +import com.intellij.ide.BrowserUtil import com.intellij.ide.plugins.PluginManagerCore import com.intellij.lang.annotation.HighlightSeverity import com.intellij.notification.NotificationAction @@ -37,9 +37,7 @@ import java.io.BufferedReader import java.io.File import java.io.FileInputStream import java.io.InputStreamReader -import java.net.URI import java.nio.charset.Charset -import java.nio.file.Paths class IntelliJIDE( private val project: Project, @@ -125,6 +123,10 @@ class IntelliJIDE( return true } + override suspend fun isWorkspaceRemote(): Boolean { + return this.getIdeInfo().remoteName != "local" + } + override suspend fun getUniqueId(): String { return getMachineUniqueID() } @@ -211,7 +213,7 @@ class IntelliJIDE( override suspend fun openUrl(url: String) { withContext(Dispatchers.IO) { - Desktop.browse(URI(url)) + BrowserUtil.browse(url) } } @@ -339,11 +341,10 @@ class IntelliJIDE( command.setWorkDirectory(project.basePath) val results = ExecUtil.execAndGetOutput(command).stdout return results.split("\n") - } catch (e: Exception) { - showToast( - ToastType.ERROR, - "Error executing ripgrep: ${e.message}" - ) + } catch (exception: Exception) { + val message = "Error executing ripgrep: ${exception.message}" + service().report(exception, message) + showToast(ToastType.ERROR, message) return emptyList() } } else { @@ -381,11 +382,10 @@ class IntelliJIDE( command.setWorkDirectory(project.basePath) return ExecUtil.execAndGetOutput(command).stdout - } catch (e: Exception) { - showToast( - ToastType.ERROR, - "Error executing ripgrep: ${e.message}" - ) + } catch (exception: Exception) { + val message = "Error executing ripgrep: ${exception.message}" + service().report(exception, message) + showToast(ToastType.ERROR, message) return "Error: Unable to execute ripgrep command." } } else { diff --git a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/editor/DiffStreamHandler.kt b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/editor/DiffStreamHandler.kt index 67e49a87f..52abfe00c 100644 --- a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/editor/DiffStreamHandler.kt +++ b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/editor/DiffStreamHandler.kt @@ -7,7 +7,7 @@ import com.github.continuedev.continueintellijextension.services.ContinuePluginS import com.intellij.openapi.application.ApplicationManager import com.intellij.openapi.command.WriteCommandAction import com.intellij.openapi.command.undo.UndoManager -import com.intellij.openapi.components.ServiceManager +import com.intellij.openapi.components.service import com.intellij.openapi.editor.Editor import com.intellij.openapi.editor.markup.HighlighterLayer import com.intellij.openapi.editor.markup.RangeHighlighter @@ -42,7 +42,6 @@ class DiffStreamHandler( private var isRunning: Boolean = false private var hasAcceptedOrRejectedBlock: Boolean = false private val unfinishedHighlighters: MutableList = mutableListOf() - private val continuePluginService = ServiceManager.getService(project, ContinuePluginService::class.java) private val virtualFile = FileDocumentManager.getInstance().getFile(editor.document) @@ -62,10 +61,10 @@ class DiffStreamHandler( numDiffs = diffBlocks.size, filepath = virtualFile?.url, fileContent = "not implemented", - toolCallId = toolCallId?.toString() + toolCallId = toolCallId ) - continuePluginService.sendToWebview("updateApplyState", payload) + project.service().sendToWebview("updateApplyState", payload) } fun acceptAll() { @@ -96,13 +95,13 @@ class DiffStreamHandler( prefix: String, highlighted: String, suffix: String, - modelTitle: String, + modelTitle: String?, includeRulesInSystemMessage: Boolean ) { isRunning = true sendUpdate(ApplyStateStatus.STREAMING) - continuePluginService.coreMessenger?.request( + project.service().coreMessenger?.request( "streamDiffLines", StreamDiffLinesPayload( input = input, diff --git a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/editor/EditorUtils.kt b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/editor/EditorUtils.kt index 391c0423d..204994f6b 100644 --- a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/editor/EditorUtils.kt +++ b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/editor/EditorUtils.kt @@ -46,6 +46,13 @@ class EditorUtils(val editor: Editor) { return editor.document.lineCount } + /** + * Gets the full text content of the document + */ + fun getDocumentText(): String { + return editor.document.text + } + /** * Inserts text at the specified position in the document */ @@ -62,7 +69,6 @@ class EditorUtils(val editor: Editor) { insertTextAtPos(0, text) } - /** * Scrolls the editor to make the specified line visible */ @@ -165,7 +171,6 @@ class EditorUtils(val editor: Editor) { } } } - val editor = FileEditorManager.getInstance(project).selectedTextEditor ?: return null return EditorUtils(editor) } diff --git a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/error/ContinueErrorService.kt b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/error/ContinueErrorService.kt new file mode 100644 index 000000000..b1fdae571 --- /dev/null +++ b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/error/ContinueErrorService.kt @@ -0,0 +1,50 @@ +package com.github.continuedev.continueintellijextension.error + +import com.intellij.ide.plugins.PluginManagerCore +import com.intellij.openapi.application.ApplicationInfo +import com.intellij.openapi.components.Service +import com.intellij.openapi.diagnostic.Attachment +import com.intellij.openapi.diagnostic.Logger +import com.intellij.openapi.extensions.PluginId +import com.intellij.ui.jcef.JBCefApp +import io.sentry.Hint +import io.sentry.Sentry +import io.sentry.SentryEvent +import io.sentry.protocol.Message + +private typealias SentryAttachment = io.sentry.Attachment + +@Service +class ContinueErrorService { + private val log = Logger.getInstance(ContinueErrorService::class.java) + + init { + Sentry.init { config -> + config.dsn = SENTRY_DSN + config.isSendDefaultPii = false + config.setTag("ide_version", ApplicationInfo.getInstance().build.asString()) + config.setTag("jcef_supported", JBCefApp.isSupported().toString()) + config.setTag("plugin_version", PluginManagerCore.getPlugin(PluginId.getId(PLUGIN_ID))?.version) + } + } + + fun report( + throwable: Throwable, + message: String? = null, + attachments: List? = null + ) { + val sentryEvent = SentryEvent() + sentryEvent.throwable = throwable + sentryEvent.message = Message().apply { this.message = message } + val hint = Hint.withAttachments(attachments?.map { SentryAttachment(it.bytes, it.path) }) + Sentry.captureEvent(sentryEvent, hint) + log.warn("Problem sent to Sentry: $message", throwable) + } + + private companion object { + private const val PLUGIN_ID = "com.github.continuedev.continueintellijextension" + private const val SENTRY_DSN = + "https://fe99934dcdc537d84209893a3f96a196@o4505462064283648.ingest.us.sentry.io/4508184596054016" + } + +} \ No newline at end of file diff --git a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/error/ContinueErrorSubmitter.kt b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/error/ContinueErrorSubmitter.kt new file mode 100644 index 000000000..3f30c17a8 --- /dev/null +++ b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/error/ContinueErrorSubmitter.kt @@ -0,0 +1,39 @@ +package com.github.continuedev.continueintellijextension.error + +import com.intellij.diagnostic.IdeaReportingEvent +import com.intellij.openapi.components.service +import com.intellij.openapi.diagnostic.ErrorReportSubmitter +import com.intellij.openapi.diagnostic.IdeaLoggingEvent +import com.intellij.openapi.diagnostic.SubmittedReportInfo +import com.intellij.openapi.diagnostic.SubmittedReportInfo.SubmissionStatus +import com.intellij.util.Consumer +import java.awt.Component + +class ContinueErrorSubmitter : ErrorReportSubmitter() { + + override fun getReportActionText() = + "Report to Continue" + + override fun submit( + events: Array, + additionalInfo: String?, + parentComponent: Component, + consumer: Consumer + ): Boolean { + try { + val event = events.filterIsInstance() + .firstOrNull() ?: return false + service().report( + throwable = event.data.throwable, + message = additionalInfo ?: event.data.message, + attachments = event.data.allAttachments + ) + } catch (_: Exception) { + consumer.consume(SubmittedReportInfo(SubmissionStatus.FAILED)) + return false + } + consumer.consume(SubmittedReportInfo(SubmissionStatus.NEW_ISSUE)) + return true + } + +} diff --git a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/protocol/ideWebview.kt b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/protocol/ideWebview.kt index a2a751f2b..7ed69f6eb 100644 --- a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/protocol/ideWebview.kt +++ b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/protocol/ideWebview.kt @@ -8,10 +8,10 @@ data class ApplyToFileParams( val text: String, val streamId: String, val filepath: String?, - val toolCallId: String? + val toolCallId: String?, + val isSearchReplace: Boolean? = null ) data class InsertAtCursorParams( val text: String ) - diff --git a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/services/ContinueExtensionSettingsService.kt b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/services/ContinueExtensionSettingsService.kt index 908bf3f8d..4e4117985 100644 --- a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/services/ContinueExtensionSettingsService.kt +++ b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/services/ContinueExtensionSettingsService.kt @@ -111,7 +111,7 @@ open class ContinueExtensionSettings : PersistentStateComponent() } diff --git a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/toolWindow/ContinueBrowser.kt b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/toolWindow/ContinueBrowser.kt index 43a468cf7..7fd13e177 100644 --- a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/toolWindow/ContinueBrowser.kt +++ b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/toolWindow/ContinueBrowser.kt @@ -9,30 +9,21 @@ import com.github.continuedev.continueintellijextension.utils.uuid import com.google.gson.Gson import com.google.gson.JsonObject import com.google.gson.JsonParser +import com.intellij.openapi.components.service import com.intellij.openapi.project.Project import com.intellij.openapi.util.Disposer import com.intellij.ui.jcef.* import com.intellij.ui.jcef.JBCefClient.Properties -import com.intellij.util.application import org.cef.CefApp import org.cef.browser.CefBrowser import org.cef.handler.CefLoadHandlerAdapter class ContinueBrowser(val project: Project, url: String) { - private fun registerAppSchemeHandler() { - CefApp.getInstance().registerSchemeHandlerFactory( - "http", - "continue", - CustomSchemeHandlerFactory() - ) - } val browser: JBCefBrowser - val continuePluginService: ContinuePluginService = project.getService(ContinuePluginService::class.java) - init { - val isOSREnabled = application.getService(ContinueExtensionSettings::class.java).continueState.enableOSR + val isOSREnabled = service().continueState.enableOSR this.browser = JBCefBrowser.createBuilder().setOffScreenRendering(isOSREnabled).build().apply { // To avoid using System.setProperty to affect other plugins, @@ -43,7 +34,7 @@ class ContinueBrowser(val project: Project, url: String) { } registerAppSchemeHandler() - Disposer.register(ContinuePluginDisposable.getInstance(project), browser) + Disposer.register(project.service(), browser) // Listen for events sent from browser val myJSQueryOpenInBrowser = JBCefJSQuery.create((browser as JBCefBrowserBase?)!!) @@ -60,7 +51,7 @@ class ContinueBrowser(val project: Project, url: String) { } if (PASS_THROUGH_TO_CORE.contains(messageType)) { - continuePluginService.coreMessenger?.request(messageType, data, messageId, respond) + project.service().coreMessenger?.request(messageType, data, messageId, respond) return@addHandler null } @@ -75,7 +66,7 @@ class ContinueBrowser(val project: Project, url: String) { } if (msg != null) { - continuePluginService.ideProtocolClient?.handleMessage(msg, respondToWebview) + project.service().ideProtocolClient?.handleMessage(msg, respondToWebview) } null @@ -99,7 +90,7 @@ class ContinueBrowser(val project: Project, url: String) { // Load the url only after the protocolClient is initialized, // otherwise some messages will be lost, which are some configurations when the page is loaded. // Moreover, we should add LoadHandler before loading the url. - continuePluginService.onProtocolClientInitialized { + project.service().onProtocolClientInitialized { browser.loadURL(url) } @@ -138,6 +129,14 @@ class ContinueBrowser(val project: Project, url: String) { } } + private fun registerAppSchemeHandler() { + CefApp.getInstance().registerSchemeHandlerFactory( + "http", + "continue", + CustomSchemeHandlerFactory() + ) + } + private fun buildJavaScript(jsonData: String): String { return """window.postMessage($jsonData, "*");""" } diff --git a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/toolWindow/ContinuePluginToolWindowFactory.kt b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/toolWindow/ContinuePluginToolWindowFactory.kt index d0d44655c..492356ed3 100644 --- a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/toolWindow/ContinuePluginToolWindowFactory.kt +++ b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/toolWindow/ContinuePluginToolWindowFactory.kt @@ -3,13 +3,13 @@ package com.github.continuedev.continueintellijextension.toolWindow import com.github.continuedev.continueintellijextension.services.ContinuePluginService import com.intellij.openapi.actionSystem.ActionManager import com.intellij.openapi.actionSystem.AnAction -import com.intellij.openapi.components.ServiceManager +import com.intellij.openapi.components.service import com.intellij.openapi.project.DumbAware import com.intellij.openapi.project.Project import com.intellij.openapi.wm.ToolWindow import com.intellij.openapi.wm.ToolWindowFactory import com.intellij.ui.content.ContentFactory -import javax.swing.* +import javax.swing.JComponent const val JS_QUERY_POOL_SIZE = "200" @@ -52,9 +52,7 @@ class ContinuePluginToolWindowFactory : ToolWindowFactory, DumbAware { val url = System.getenv("GUI_URL")?.toString() ?: defaultGUIUrl val browser = ContinueBrowser(project, url) - val continuePluginService = - ServiceManager.getService(project, ContinuePluginService::class.java) - continuePluginService.continuePluginWindow = this + project.service().continuePluginWindow = this browser } diff --git a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/types.kt b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/types.kt index 34b0e25d7..5ff9e9454 100644 --- a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/types.kt +++ b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/types.kt @@ -102,6 +102,8 @@ interface IDE { suspend fun isTelemetryEnabled(): Boolean + suspend fun isWorkspaceRemote(): Boolean + suspend fun getUniqueId(): String suspend fun getTerminalContents(): String diff --git a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/utils/Desktop.kt b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/utils/Desktop.kt deleted file mode 100644 index 8dd20536c..000000000 --- a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/utils/Desktop.kt +++ /dev/null @@ -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 { - val parts = mutableListOf() - 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 - } -} \ No newline at end of file diff --git a/extensions/intellij/src/main/resources/META-INF/plugin.xml b/extensions/intellij/src/main/resources/META-INF/plugin.xml index 92005ffdc..43b093f03 100644 --- a/extensions/intellij/src/main/resources/META-INF/plugin.xml +++ b/extensions/intellij/src/main/resources/META-INF/plugin.xml @@ -36,6 +36,7 @@ displayType="BALLOON"/> + messages.MyBundle diff --git a/extensions/vscode/.gitignore b/extensions/vscode/.gitignore index 3ba3940c3..8b752d1ad 100644 --- a/extensions/vscode/.gitignore +++ b/extensions/vscode/.gitignore @@ -9,6 +9,7 @@ src/client exe bin assets +tmp gui/** diff --git a/extensions/vscode/.vscodeignore b/extensions/vscode/.vscodeignore index 387be8ba5..f2179a2c5 100644 --- a/extensions/vscode/.vscodeignore +++ b/extensions/vscode/.vscodeignore @@ -18,7 +18,6 @@ node_modules/** manual-testing-sandbox esbuild.js -esbuild.test.mjs importMetaUrl.js scripts e2e diff --git a/extensions/vscode/e2e/README.md b/extensions/vscode/e2e/README.md index ac0cc22ea..02e8ef06d 100644 --- a/extensions/vscode/e2e/README.md +++ b/extensions/vscode/e2e/README.md @@ -31,3 +31,11 @@ All e2e tests are separated (by folder) into - Is your `data-testid` or selector actually just wrong? - Are you inconsistently getting different behaviors? You can try adding a `TestUtils.waitForTimeout` between two events if you think it's caused by a race condition. Note that this may lead to flake down the road. - Alternatively, you can add a `TestUtils.waitForSuccess` + +### How is it connecting to the LLM? + +- This depends on the model provider written inside the `test-continue/config.json` and `test-continue/config.yaml`. If the model provider is `mock`, it will use `MockLLM`, and if it uses `test`, it will use `TestLLM`. + +### Quirks + +- For non-macOS systems, `codesign` is not available. You should run `npm run e2e:all-non-mac` instead of `npm run e2e:all`. \ No newline at end of file diff --git a/extensions/vscode/e2e/TestUtils.ts b/extensions/vscode/e2e/TestUtils.ts index 5b62edaa7..3c27e3621 100644 --- a/extensions/vscode/e2e/TestUtils.ts +++ b/extensions/vscode/e2e/TestUtils.ts @@ -1,9 +1,26 @@ import { expect } from "chai"; import { Key } from "vscode-extension-tester"; +import { access, constants } from 'fs/promises'; +import * as path from "path"; import { DEFAULT_TIMEOUT } from "./constants"; export class TestUtils { + public static CONTINUE_GLOBAL_DIR = process.env.CONTINUE_GLOBAL_DIR ?? ""; + + public static getGlobalContextFilePath(): string { + return path.join(TestUtils.CONTINUE_GLOBAL_DIR, "index", "globalContext.json"); + } + + public static async fileExists(path: string): Promise { + try { + await access(path, constants.F_OK); + return true; + } catch { + return false; + } + } + /** * In many cases it might be more useful to use existing Selenium * utilities. For example: diff --git a/extensions/vscode/e2e/actions/Autocomplete.actions.ts b/extensions/vscode/e2e/actions/Autocomplete.actions.ts index 9e91355fd..29902e4f2 100644 --- a/extensions/vscode/e2e/actions/Autocomplete.actions.ts +++ b/extensions/vscode/e2e/actions/Autocomplete.actions.ts @@ -30,14 +30,14 @@ export class AutocompleteActions { expect(ghostText1).to.equal(messagePair1.llmResponse); } - public static async forceCompletion(editor: TextEditor): Promise { + public static async forceCompletion(editor: TextEditor): Promise { await editor.setText("def main():\n "); await editor.moveCursor(2, 5); await new Workbench().executeCommand("Continue: Force Autocomplete"); const ghostText = await TestUtils.waitForSuccess(() => - AutocompleteSelectors.getGhostTextContent(VSBrowser.instance.driver) + AutocompleteSelectors.getGhostTextContent(VSBrowser.instance.driver), ); return ghostText; diff --git a/extensions/vscode/e2e/actions/NextEdit.actions.ts b/extensions/vscode/e2e/actions/NextEdit.actions.ts new file mode 100644 index 000000000..4432a278c --- /dev/null +++ b/extensions/vscode/e2e/actions/NextEdit.actions.ts @@ -0,0 +1,60 @@ +import { expect } from "chai"; +import { TextEditor, VSBrowser, Workbench } from "vscode-extension-tester"; + +import { DEFAULT_TIMEOUT } from "../constants"; +import { NextEditSelectors } from "../selectors/NextEdit.selectors"; +import { TestUtils } from "../TestUtils"; + +export class NextEditActions { + /** + * Test accepting a Next Edit suggestion with Tab. + */ + public static async acceptNextEditSuggestion(editor: TextEditor) { + const hasDecoration = await NextEditActions.forceNextEdit(editor); + expect(hasDecoration).to.be.true; + + await new Workbench().executeCommand("Continue: Accept Next Edit Suggestion"); + + // Check if HELLO is written into the editor. + const editorText = await editor.getTextAtLine(1); + + return editorText === "HELLO"; + } + + /** + * Test rejecting a Next Edit suggestion with Esc. + */ + public static async rejectNextEditSuggestion(editor: TextEditor) { + const hasDecoration = await NextEditActions.forceNextEdit(editor); + expect(hasDecoration).to.be.true; + + await new Workbench().executeCommand("Continue: Hide Next Edit Suggestion"); + + // Check if the editor text didn't change. + const editorText = await editor.getText(); + + return editorText === "def main():\n "; + } + + /** + * Force a Next Edit suggestion using command. + */ + public static async forceNextEdit(editor: TextEditor): Promise { + await editor.setText("def main():\n "); + await editor.moveCursor(2, 4); + + await new Workbench().executeCommand("Continue: Force Next Edit"); + await TestUtils.waitForTimeout(DEFAULT_TIMEOUT.XL); + + const svgDecoration = await TestUtils.waitForSuccess( + () => NextEditSelectors.getSvgDecoration(VSBrowser.instance.driver), + DEFAULT_TIMEOUT.XL + ); + + return svgDecoration !== null; + } + + public static async reload(): Promise { + await new Workbench().executeCommand('workbench.action.reloadWindow'); + } +} diff --git a/extensions/vscode/e2e/constants.ts b/extensions/vscode/e2e/constants.ts index e11f7e0db..d2fb8f422 100644 --- a/extensions/vscode/e2e/constants.ts +++ b/extensions/vscode/e2e/constants.ts @@ -5,4 +5,5 @@ export const DEFAULT_TIMEOUT = { SM: BASELINE * 0.5, MD: BASELINE, XL: BASELINE * 5, + XXL: BASELINE * 7, }; diff --git a/extensions/vscode/e2e/selectors/NextEdit.selectors.ts b/extensions/vscode/e2e/selectors/NextEdit.selectors.ts new file mode 100644 index 000000000..3fb6f0083 --- /dev/null +++ b/extensions/vscode/e2e/selectors/NextEdit.selectors.ts @@ -0,0 +1,19 @@ +import { By, WebDriver } from "vscode-extension-tester"; + +export class NextEditSelectors { + /** + * Get the SVG decoration element if present (for next edit). + */ + public static async getSvgDecoration(driver: WebDriver) { + try { + const decorations = await driver.findElement( + // By.xpath("//*[contains(@class, 'ced-') and matches(@class, 'ced-2-TextEditorDecorationType[0-9]+-4')]") + By.css("[class*='TextEditorDecorationType']") + ); + return decorations ?? null; + } catch (error) { + console.error("Error finding SVG decoration:", error); + return null; + } + } +} \ No newline at end of file diff --git a/extensions/vscode/e2e/tests/NextEdit.test.ts b/extensions/vscode/e2e/tests/NextEdit.test.ts new file mode 100644 index 000000000..2541feb0b --- /dev/null +++ b/extensions/vscode/e2e/tests/NextEdit.test.ts @@ -0,0 +1,120 @@ +import { expect } from "chai"; +import * as fs from "fs/promises"; +import { EditorView, TextEditor } from "vscode-extension-tester"; + +import { GlobalActions } from "../actions/Global.actions"; +import { NextEditActions } from "../actions/NextEdit.actions"; +import { DEFAULT_TIMEOUT } from "../constants"; +import { TestUtils } from "../TestUtils"; + +describe("Next Edit", () => { + let editor: TextEditor; + + before(async function () { + // this.timeout(DEFAULT_TIMEOUT.XL); + + const globalContextPath = TestUtils.getGlobalContextFilePath(); + + // Update config.json to add optInNextEditFeature. + // globalContext.json does not exist in CI before this test runs. + if (await TestUtils.fileExists(globalContextPath)) { + const globalContext = await fs.readFile(globalContextPath, "utf8"); + const sharedConfig = JSON.parse(globalContext).sharedConfig; + + const sharedConfigWithNextEditEnabled = { + ...sharedConfig, + "optInNextEditFeature": true + }; + + const globalContextWithNextEditEnabled = { + ...JSON.parse(globalContext), + "sharedConfig": sharedConfigWithNextEditEnabled + }; + + await fs.writeFile(globalContextPath, JSON.stringify(globalContextWithNextEditEnabled, null, 2), "utf8"); + } else { + await fs.writeFile( + globalContextPath, + JSON.stringify( + { + sharedConfig: { + optInNextEditFeature: true + }, + selectedModelsByProfileId: { + local: { + chat: "TEST LLM", + edit: "TEST LLM", + apply: "TEST LLM", + embed: "Transformers.js (Built-In)", + autocomplete: "TEST LLM", + rerank: null, + summarize: null + } + } + }, + null, + 2, + ), + ); + } + + await NextEditActions.reload(); + }).timeout(DEFAULT_TIMEOUT.XL); + + beforeEach(async function () { + // this.timeout(DEFAULT_TIMEOUT.XL); + + await GlobalActions.openTestWorkspace(); + ({ editor } = await GlobalActions.createAndOpenNewTextFile()); + }).timeout(DEFAULT_TIMEOUT.XL); + + afterEach(async function () { + // this.timeout(DEFAULT_TIMEOUT.XL); + + await editor.clearText(); + await new EditorView().closeAllEditors(); + }).timeout(DEFAULT_TIMEOUT.XL); + + after(async function () { + // this.timeout(DEFAULT_TIMEOUT.XL); + + // Update config.json to delete optInNextEditFeature. + const globalContext = await fs.readFile(TestUtils.getGlobalContextFilePath(), "utf8"); + const sharedConfig = JSON.parse(globalContext).sharedConfig; + + const sharedConfigWithoutNextEdit = { ...sharedConfig }; + delete sharedConfigWithoutNextEdit.optInNextEditFeature; + + const globalContextWithNextEditEnabled = { + ...JSON.parse(globalContext), + "sharedConfig": sharedConfigWithoutNextEdit + }; + + await fs.writeFile(TestUtils.getGlobalContextFilePath(), JSON.stringify(globalContextWithNextEditEnabled, null, 2), "utf8"); + await NextEditActions.reload(); + }).timeout(DEFAULT_TIMEOUT.XL); + + // it("Should enable Next Edit feature in settings", async () => { + // expect(false).to.be.true; + // }).timeout(DEFAULT_TIMEOUT.XL); + + // it("Should check that autocomplete is disabled when next edit is enabled", async () => { + // expect(false).to.be.true; + // }).timeout(DEFAULT_TIMEOUT.XL); + + it("Should force a Next Edit", async () => { + const hasDecoration = await NextEditActions.forceNextEdit(editor); + expect(hasDecoration).to.be.true; + }).timeout(DEFAULT_TIMEOUT.XXL); + + it("Should accept Next Edit suggestion with Tab", async () => { + const accepted = await NextEditActions.acceptNextEditSuggestion(editor); + expect(accepted).to.be.true; + }).timeout(DEFAULT_TIMEOUT.XXL); + + it("Should reject Next Edit suggestion with Esc", async () => { + const rejected = await NextEditActions.rejectNextEditSuggestion(editor); + expect(rejected).to.be.true; + }).timeout(DEFAULT_TIMEOUT.XXL); + +}); \ No newline at end of file diff --git a/extensions/vscode/esbuild.test.mjs b/extensions/vscode/esbuild.test.mjs deleted file mode 100644 index 3d6ca8b94..000000000 --- a/extensions/vscode/esbuild.test.mjs +++ /dev/null @@ -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" }, -}); diff --git a/extensions/vscode/package-lock.json b/extensions/vscode/package-lock.json index 199c669c7..d4db018d5 100644 --- a/extensions/vscode/package-lock.json +++ b/extensions/vscode/package-lock.json @@ -1,22 +1,19 @@ { "name": "continue", - "version": "1.1.48", + "version": "1.1.52", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "continue", - "version": "1.1.48", + "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,9 +105,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": "1.0.42", "@modelcontextprotocol/sdk": "^1.12.0", "@mozilla/readability": "^0.5.0", "@octokit/rest": "^20.1.1", @@ -199,6 +196,7 @@ "myers-diff": "^2.1.0", "onnxruntime-common": "1.14.0", "onnxruntime-web": "1.14.0", + "shiki": "^3.6.0", "ts-jest": "^29.1.1", "typescript": "^5.6.3", "vitest": "^3.1.4" @@ -2448,16 +2446,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 +2530,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 +2547,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 +2708,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 +3081,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 +3457,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 +3595,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 +3891,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 +4159,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 +5007,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 +5181,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 +5786,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 +6480,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 +6514,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 +7126,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 +7397,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 +7803,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 +7910,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 +8149,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 +8240,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 +8291,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 +9285,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 +9316,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 +9414,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 +10263,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 +10277,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 +10398,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 +10479,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 +10998,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 +11203,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 +11411,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 +11425,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 +11965,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 +12008,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 +12340,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 +12492,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 +16465,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 +16671,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 +16685,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 +16732,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" }, diff --git a/extensions/vscode/package.json b/extensions/vscode/package.json index 81b1a142d..cf8b8f679 100644 --- a/extensions/vscode/package.json +++ b/extensions/vscode/package.json @@ -2,7 +2,7 @@ "name": "continue", "icon": "media/icon.png", "author": "Continue Dev, Inc", - "version": "1.1.49", + "version": "1.1.54", "repository": { "type": "git", "url": "https://github.com/continuedev/continue" @@ -334,6 +334,21 @@ "category": "Continue", "title": "Enter Enterprise License Key", "group": "Continue" + }, + { + "command": "continue.nextEditWindow.hideNextEditSuggestion", + "category": "Continue", + "title": "Hide Next Edit Suggestion" + }, + { + "command": "continue.nextEditWindow.acceptNextEditSuggestion", + "category": "Continue", + "title": "Accept Next Edit Suggestion" + }, + { + "command": "continue.forceNextEdit", + "category": "Continue", + "title": "Continue: Force Next Edit" } ], "keybindings": [ @@ -426,6 +441,16 @@ "command": "continue.applyCodeFromChat", "mac": "alt+a", "key": "alt+a" + }, + { + "command": "continue.nextEditWindow.hideNextEditSuggestion", + "key": "escape", + "when": "editorTextFocus && nextEditWindowActive" + }, + { + "command": "continue.nextEditWindow.acceptNextEditSuggestion", + "key": "tab", + "when": "editorTextFocus && nextEditWindowActive" } ], "submenus": [ @@ -622,10 +647,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", @@ -646,6 +669,7 @@ "e2e:test": "extest run-tests ${TEST_FILE:-'./e2e/_output/tests/*.test.js'} --code_settings settings.json --extensions_dir ./e2e/.test-extensions --storage ./e2e/storage", "e2e:clean": "rm -rf ./e2e/_output ./e2e/storage", "e2e:all": "npm run e2e:build && npm run e2e:compile && npm run e2e:create-storage && npm run e2e:get-chromedriver && npm run e2e:get-vscode && npm run e2e:sign-vscode && npm run e2e:copy-vsix && npm run e2e:install-vsix && npm run e2e:install-extensions && CONTINUE_GLOBAL_DIR=e2e/test-continue npm run e2e:test && npm run e2e:clean", + "e2e:all-non-mac": "npm run e2e:build && npm run e2e:compile && npm run e2e:create-storage && npm run e2e:get-chromedriver && npm run e2e:get-vscode && npm run e2e:copy-vsix && npm run e2e:install-vsix && npm run e2e:install-extensions && CONTINUE_GLOBAL_DIR=e2e/test-continue npm run e2e:test && npm run e2e:clean", "e2e:recompile-extension": "npm run package && npm run e2e:compile && npm run e2e:copy-vsix && npm run e2e:install-vsix && npm run e2e:install-extensions && CONTINUE_GLOBAL_DIR=e2e/test-continue npm run e2e:test && npm run e2e:clean", "e2e:rebuild-gui": "rm -rf gui && cp -r ../../gui/dist gui && npm run package && npm run e2e:copy-vsix && npm run e2e:install-vsix && npm run e2e:install-extensions && CONTINUE_GLOBAL_DIR=e2e/test-continue npm run e2e:test && npm run e2e:clean", "e2e:quick": "npm run e2e:compile && CONTINUE_GLOBAL_DIR=e2e/test-continue npm run e2e:test && npm run e2e:clean", @@ -661,11 +685,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 +700,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 +712,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 +734,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", diff --git a/extensions/vscode/rules.md b/extensions/vscode/rules.md new file mode 100644 index 000000000..865f0dac5 --- /dev/null +++ b/extensions/vscode/rules.md @@ -0,0 +1,6 @@ +The `extensions/vscode` folder contains code for the "Continue" VS Code Extension. Continue is a coding assistant extension which extends IDE functionality with AI. +Core IDE functionality, such as reading files, is implemented using the `VSCodeIDE` class. Code to enable editing/diff streaming into the editor, code suggestion autocompletion, and more can also be found in this directory. +Shared code that has abstract logic for the extension is in `core/`. Avoid importing code from `core/` directly where possible. Core is designed to be bundalable as a binary. Use `core.invoke` to send messages to the + +- see `core/protocol/core.ts` for a list of commands VS Code can post/request to Core +- see `core/portocol/ide.ts` for a list of commands/message types core can post/request to VS Code diff --git a/extensions/vscode/scripts/download-copy-sqlite-esbuild.js b/extensions/vscode/scripts/download-copy-sqlite-esbuild.js new file mode 100644 index 000000000..ea6f8ebd9 --- /dev/null +++ b/extensions/vscode/scripts/download-copy-sqlite-esbuild.js @@ -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, +}; diff --git a/extensions/vscode/scripts/esbuild.js b/extensions/vscode/scripts/esbuild.js index 9382e2b7a..e800cdfc6 100644 --- a/extensions/vscode/scripts/esbuild.js +++ b/extensions/vscode/scripts/esbuild.js @@ -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 diff --git a/extensions/vscode/scripts/generate-copy-config.js b/extensions/vscode/scripts/generate-copy-config.js new file mode 100644 index 000000000..21a68d999 --- /dev/null +++ b/extensions/vscode/scripts/generate-copy-config.js @@ -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": + "

If set to merge, .continuerc.json will be applied on top of config.json (arrays and objects are merged). If set to overwrite, then every top-level property of .continuerc.json will overwrite that property from config.json.

", + }; + fs.writeFileSync("continue_rc_schema.json", JSON.stringify(schema, null, 2)); + + // 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, +}; diff --git a/extensions/vscode/scripts/install-copy-nodemodule.js b/extensions/vscode/scripts/install-copy-nodemodule.js new file mode 100644 index 000000000..1ce65327a --- /dev/null +++ b/extensions/vscode/scripts/install-copy-nodemodule.js @@ -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, +}; diff --git a/extensions/vscode/scripts/npm-install.js b/extensions/vscode/scripts/npm-install.js new file mode 100644 index 000000000..feffdcf26 --- /dev/null +++ b/extensions/vscode/scripts/npm-install.js @@ -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, +}; diff --git a/extensions/vscode/scripts/prepackage.js b/extensions/vscode/scripts/prepackage.js index 01ef446c5..599b06062 100644 --- a/extensions/vscode/scripts/prepackage.js +++ b/extensions/vscode/scripts/prepackage.js @@ -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); })(); diff --git a/extensions/vscode/scripts/utils.js b/extensions/vscode/scripts/utils.js index 451fde407..cae982a97 100644 --- a/extensions/vscode/scripts/utils.js +++ b/extensions/vscode/scripts/utils.js @@ -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": - "

If set to merge, .continuerc.json will be applied on top of config.json (arrays and objects are merged). If set to overwrite, then every top-level property of .continuerc.json will overwrite that property from config.json.

", - }; - fs.writeFileSync("continue_rc_schema.json", JSON.stringify(schema, null, 2)); - - // 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, diff --git a/extensions/vscode/src/VsCodeIde.ts b/extensions/vscode/src/VsCodeIde.ts index a01ecd515..91fb6154b 100644 --- a/extensions/vscode/src/VsCodeIde.ts +++ b/extensions/vscode/src/VsCodeIde.ts @@ -200,6 +200,10 @@ class VsCodeIde implements IDE { return globalEnabled && continueEnabled; } + isWorkspaceRemote(): Promise { + return Promise.resolve(vscode.env.remoteName !== undefined); + } + getUniqueId(): Promise { return Promise.resolve(vscode.env.machineId); } diff --git a/extensions/vscode/src/activation/NextEditWindowManager.ts b/extensions/vscode/src/activation/NextEditWindowManager.ts new file mode 100644 index 000000000..ece62384a --- /dev/null +++ b/extensions/vscode/src/activation/NextEditWindowManager.ts @@ -0,0 +1,720 @@ +/* eslint-disable @typescript-eslint/naming-convention */ +import { EXTENSION_NAME } from "core/control-plane/env"; +// @ts-ignore +import * as vscode from "vscode"; + +import { CodeRenderer } from "core/codeRenderer/CodeRenderer"; +import { myersDiff } from "core/diff/myers"; +import { + NEXT_EDIT_EDITABLE_REGION_BOTTOM_MARGIN, + NEXT_EDIT_EDITABLE_REGION_TOP_MARGIN, +} from "core/nextEdit/constants"; +import { getOffsetPositionAtLastNewLine } from "core/nextEdit/diff/diff"; +import { getThemeString } from "../util/getTheme"; + +export interface TextApplier { + applyText( + editor: vscode.TextEditor, + text: string, + position: vscode.Position, + finalCursorPos: vscode.Position | null, + ): Promise; +} + +const SVG_CONFIG = { + stroke: "#999998", + strokeWidth: 1, + textColor: "#999998", + filter: "drop-shadow(0 2px 2px rgba(0,0,0,0.2))", + radius: 3, + leftMargin: 40, + defaultText: "", + lineSpacing: 1.2, // Line spacing multiplier + cursorOffset: 4, // Spaces to offset from cursor + + get fontSize() { + return Math.ceil( + vscode.workspace.getConfiguration("editor").get("fontSize") ?? 14, + ); + }, + get fontFamily() { + return ( + vscode.workspace.getConfiguration("editor").get("fontFamily") || + "helvetica" + ); + }, + get paddingX() { + return Math.ceil(this.getEstimatedTextWidth(" ")); + }, + get paddingY() { + return Math.ceil(this.fontSize * 0.3); + }, + get lineHeight() { + return Math.ceil(this.fontSize * this.lineSpacing); + }, + getEstimatedTextWidth(text: string): number { + return text.length * this.fontSize * 0.6; + }, + getTipWidth(text: string): number { + // Find the longest line + const lines = text.split("\n"); + const longestLine = lines.reduce( + (longest, line) => (line.length > longest.length ? line : longest), + "", + ); + + return this.getEstimatedTextWidth(longestLine) + this.paddingX * 2; + }, + getTipHeight(text: string): number { + // Count the number of lines + const lineCount = text.split("\n").length; + return this.lineHeight * lineCount + this.paddingY * 2; + }, +} as const; + +// Command ID - can be used in package.json +export const HIDE_NEXT_EDIT_SUGGESTION_COMMAND = + "continue.nextEditWindow.hideNextEditSuggestion"; +export const ACCEPT_NEXT_EDIT_SUGGESTION_COMMAND = + "continue.nextEditWindow.acceptNextEditSuggestion"; + +export class NextEditWindowManager { + private static instance: NextEditWindowManager | undefined; + + private readonly excludedURIPrefixes = ["output:", "vscode://inline-chat"]; + private theme: string; + private fontSize: number; + private fontFamily: string; + private codeRenderer: CodeRenderer; + + // Current active decoration + private currentDecoration: vscode.TextEditorDecorationType | null = null; + // Track which editor has the active decoration + private activeEditor: vscode.TextEditor | null = null; + // Store the current tooltip text for accepting + private currentTooltipText: string | null = null; + + // Disposables + private disposables: vscode.Disposable[] = []; + + private textApplier: TextApplier | null = null; + + private finalCursorPos: vscode.Position | null = null; + + private context: vscode.ExtensionContext | null = null; + + public static getInstance(): NextEditWindowManager { + if (!NextEditWindowManager.instance) { + NextEditWindowManager.instance = new NextEditWindowManager(); + } + return NextEditWindowManager.instance; + } + + public static isInstantiated(): boolean { + return !!NextEditWindowManager.instance; + } + + public static clearInstance(): void { + if (NextEditWindowManager.instance) { + NextEditWindowManager.instance.dispose(); + NextEditWindowManager.instance = undefined; + } + } + + private constructor() { + this.theme = getThemeString(); + + console.log( + "Next Edit Theme initialized:", + this.theme + ? `Theme exists: ${JSON.stringify(this.theme)}` + : "Theme is undefined", + ); + this.setupListeners(); + this.codeRenderer = CodeRenderer.getInstance(); + + const editorConfig = vscode.workspace.getConfiguration("editor"); + this.fontSize = editorConfig.get("fontSize") ?? 14; + this.fontFamily = editorConfig.get("fontFamily") ?? "monospace"; + } + + public static async reserveTabAndEsc() { + await vscode.commands.executeCommand( + "setContext", + "nextEditWindowActive", + true, + ); + } + + public static async freeTabAndEsc() { + await vscode.commands.executeCommand( + "setContext", + "nextEditWindowActive", + false, + ); + } + + /** + * An async setup function to help us initialize the NextEditWindowManager. + * This is necessary because we need some setup to be done asynchronously, + * and constructors in TypeScript cannot be async. + * Plus, it's generally not recommended to pass arguments to getInstance() of a singleton. + * @param context The extension context. + * @param textApplier Callback that lets us use external deps such as llms if needed. + */ + public async setupNextEditWindowManager( + context: vscode.ExtensionContext, + textApplier?: TextApplier, + ) { + this.context = context; + + // Set nextEditWindowActive to false to free esc and tab, + // letting them return to their original behaviors. + await NextEditWindowManager.freeTabAndEsc(); + + // Register HIDE_TOOLTIP_COMMAND and ACCEPT_NEXT_EDIT_COMMAND with their corresponding callbacks. + this.registerCommandSafely( + HIDE_NEXT_EDIT_SUGGESTION_COMMAND, + async () => await this.hideAllNextEditWindows(), + ); + this.registerCommandSafely( + ACCEPT_NEXT_EDIT_SUGGESTION_COMMAND, + async () => await this.acceptNextEdit(), + ); + + // Add this class to context disposables. + context.subscriptions.push(this); + + if (textApplier) { + this.textApplier = textApplier; + } + + await this.codeRenderer.setTheme(this.theme); + } + + /** + * Registers our two custom commands to the extension context. + * @param commandId Custom commands to help set up next edit. + * @param callback Function to run on command execution. + */ + private registerCommandSafely( + commandId: + | "continue.nextEditWindow.hideNextEditSuggestion" + | "continue.nextEditWindow.acceptNextEditSuggestion", + callback: () => Promise, + ) { + if (!this.context) { + console.log("Extension context is not yet set."); + return; + } + + try { + const command = vscode.commands.registerCommand(commandId, callback); + this.context.subscriptions.push(command); + } catch (error) { + console.log( + `Command ${commandId} already has an associated callback, skipping registration`, + ); + } + } + + /** + * Show a tooltip with the given text at the current cursor position. + * @param editor The active text editor. + * @param text Text to display in the tooltip. + */ + public async showNextEditWindow( + editor: vscode.TextEditor, + newEditRangeSlice: string, + ) { + if (!newEditRangeSlice || !this.shouldRenderTip(editor.document.uri)) { + return; + } + + // Clear any existing decorations first (very important to prevent overlapping). + await this.hideAllNextEditWindows(); + + // Store the current tooltip text for accepting later. + this.currentTooltipText = newEditRangeSlice; + + // Get the contents of the old (current) editable region. + const currCursorPos = editor.selection.active; + const editableRegionStartLine = Math.max( + currCursorPos.line - NEXT_EDIT_EDITABLE_REGION_TOP_MARGIN, + 0, + ); + const editableRegionEndLine = Math.min( + currCursorPos.line + NEXT_EDIT_EDITABLE_REGION_BOTTOM_MARGIN, + editor.document.lineCount - 1, + ); + const oldEditRangeSlice = editor.document + .getText() + .split("\n") + .slice(editableRegionStartLine, editableRegionEndLine + 1) + .join("\n"); + + // We don't need to show the next edit window under these conditions: + // - There are no predicted edits. + // - The predicted edits are identical to the previous version. + if (newEditRangeSlice === "" || oldEditRangeSlice === newEditRangeSlice) + return; + + const diffLines = myersDiff(oldEditRangeSlice, newEditRangeSlice); + + // How far away is the current line from the start of the editable region? + const lineOffsetAtCursorPos = currCursorPos.line - editableRegionStartLine; + + // How long is the line at the current cursor position? + const lineContentAtCursorPos = + newEditRangeSlice.split("\n")[lineOffsetAtCursorPos]; + + const offset = getOffsetPositionAtLastNewLine( + diffLines, + lineContentAtCursorPos, + lineOffsetAtCursorPos, + ); + + // Calculate the actual line number in the editor by adding the startPos offset + // to the line number from the diff calculation. + this.finalCursorPos = new vscode.Position( + editableRegionStartLine + offset.line, + offset.character, + ); + + // Create and apply decoration with the text. + await this.renderTooltip(editor, currCursorPos, newEditRangeSlice); + + // Reserve tab and esc to either accept or reject the displayed next edit contents. + await NextEditWindowManager.reserveTabAndEsc(); + } + + /** + * Hide all tooltips in all editors. + */ + public async hideAllNextEditWindows() { + if (this.currentDecoration) { + vscode.window.visibleTextEditors.forEach((editor) => { + editor.setDecorations(this.currentDecoration!, []); + }); + + // If we know which editor had the decoration, clear it specifically. + // This is a bit redundant but ensures we don't leave any decorations behind. + if (this.activeEditor) { + this.activeEditor.setDecorations(this.currentDecoration, []); + this.activeEditor = null; + } + + // This prevents memory leaks. + this.currentDecoration.dispose(); + this.currentDecoration = null; + + this.disposables.forEach((d) => d.dispose()); + this.disposables = []; + + // Clear the current tooltip text. + this.currentTooltipText = null; + } + + await NextEditWindowManager.freeTabAndEsc(); + } + + /** + * Accept the current next edit suggestion by inserting it at cursor position. + */ + private async acceptNextEdit() { + if (!this.activeEditor || !this.currentTooltipText) { + return; + } + + const editor = this.activeEditor; + const text = this.currentTooltipText; + const position = editor.selection.active; + + let success = false; + if (this.textApplier) { + success = await this.textApplier.applyText( + editor, + text, + position, + this.finalCursorPos, + ); + } else { + // Define the editable region. + const editableRegionStartLine = Math.max( + 0, + position.line - NEXT_EDIT_EDITABLE_REGION_TOP_MARGIN, + ); + const editableRegionEndLine = Math.min( + editor.document.lineCount - 1, + position.line + NEXT_EDIT_EDITABLE_REGION_BOTTOM_MARGIN, + ); + const startPos = new vscode.Position(editableRegionStartLine, 0); + const endPosChar = editor.document.lineAt(editableRegionEndLine).text + .length; + + const endPos = new vscode.Position(editableRegionEndLine, endPosChar); + const editRange = new vscode.Range(startPos, endPos); + + success = await editor.edit((editBuilder) => { + editBuilder.replace(editRange, text); + }); + + // Disable inline suggestions temporarily. + // This prevents the race condition between vscode's inline completion provider + // and the next edit window manager's cursor repositioning logic. + await vscode.workspace + .getConfiguration() + .update("editor.inlineSuggest.enabled", false, true); + } + + if (success) { + // Move cursor to the final position if available. + if (this.finalCursorPos) { + editor.selection = new vscode.Selection( + this.finalCursorPos, + this.finalCursorPos, + ); + + // Reenable inline suggestions after we move the cursor. + await vscode.workspace + .getConfiguration() + .update("editor.inlineSuggest.enabled", true, true); + + await this.hideAllNextEditWindows(); + } + } + } + + /** + * Dispose of the NextEditWindowManager. + */ + public dispose() { + // Dispose current decoration. + if (this.currentDecoration) { + this.currentDecoration.dispose(); + this.currentDecoration = null; + } + + // Dispose all other disposables. + this.disposables.forEach((d) => d.dispose()); + this.disposables = []; + } + + /** + * Setup listeners for theme, font, and cursor position changes. + */ + private setupListeners() { + // Theme change listener. + vscode.workspace.onDidChangeConfiguration((e) => { + if ( + e.affectsConfiguration("workbench.colorTheme") || + e.affectsConfiguration("editor.fontSize") || + e.affectsConfiguration("editor.fontFamily") || + e.affectsConfiguration("window.autoDetectColorScheme") || + e.affectsConfiguration("window.autoDetectHighContrast") || + e.affectsConfiguration("workbench.preferredDarkColorTheme") || + e.affectsConfiguration("workbench.preferredLightColorTheme") || + e.affectsConfiguration("workbench.preferredHighContrastColorTheme") || + e.affectsConfiguration("workbench.preferredHighContrastLightColorTheme") + ) { + this.theme = getThemeString(); + this.codeRenderer.setTheme(this.theme); + console.log( + "Theme updated:", + this.theme ? "Theme exists" : "Theme is undefined", + ); + const editorConfig = vscode.workspace.getConfiguration("editor"); + this.fontSize = editorConfig.get("fontSize") ?? 14; + this.fontFamily = editorConfig.get("fontFamily") ?? "monospace"; + } + }); + + // Listen for active color theme changes. + vscode.window.onDidChangeActiveColorTheme(() => { + this.theme = getThemeString(); + this.codeRenderer.setTheme(this.theme); + console.log( + "Active theme changed:", + this.theme ? "Theme exists" : "Theme is undefined", + ); + }); + + // Listen for editor changes to clean up decorations when editor closes. + vscode.window.onDidChangeVisibleTextEditors(async () => { + // If our active editor is no longer visible, clear decorations. + if ( + this.activeEditor && + !vscode.window.visibleTextEditors.includes(this.activeEditor) + ) { + await this.hideAllNextEditWindows(); + } + }); + + // Listen for selection changes to hide tooltip when cursor moves. + vscode.window.onDidChangeTextEditorSelection(async (e) => { + // If the selection changed in our active editor, hide the tooltip. + if (this.activeEditor && e.textEditor === this.activeEditor) { + await this.hideAllNextEditWindows(); + } + }); + } + + private shouldRenderTip(uri: vscode.Uri): boolean { + const isAllowedUri = + !this.excludedURIPrefixes.some((prefix) => + uri.toString().startsWith(prefix), + ) && uri.scheme !== "comment"; + + const isEnabled = + !!vscode.workspace + .getConfiguration(EXTENSION_NAME) + .get("showInlineTip") === true; + + return isAllowedUri && isEnabled; + } + + /** + * Create a render of the given code, supporting multiple lines. + */ + private async createCodeRender( + text: string, + ): Promise< + | { uri: vscode.Uri; dimensions: { width: number; height: number } } + | undefined + > { + try { + const tipWidth = SVG_CONFIG.getTipWidth(text); + const tipHeight = SVG_CONFIG.getTipHeight(text); + const dimensions = { + width: tipWidth, + height: tipHeight, + }; + + const uri = await this.codeRenderer.getDataUri( + text, + "typescript", + this.fontSize, + this.fontFamily, + dimensions, + SVG_CONFIG.lineHeight, + { + imageType: "svg", + }, + ); + + return { + uri: vscode.Uri.parse(uri), + dimensions, + }; + } catch (error) { + console.error("Error creating SVG tooltip:", error); + return undefined; + } + } + + /** + * Create a decoration type with the code render. + * @param code: The code to render. + * @returns The decoration. + */ + private async createCodeRenderDecoration( + code: string, + ): Promise { + const uriAndDimensions = await this.createCodeRender(code); + if (!uriAndDimensions) { + return undefined; + } + + const { uri, dimensions } = uriAndDimensions; + const tipWidth = dimensions.width; + const tipHeight = dimensions.height; + + return vscode.window.createTextEditorDecorationType({ + after: { + contentIconPath: uri, + // border: `;box-shadow: inset 0 0 0 ${SVG_CONFIG.strokeWidth}px ${SVG_CONFIG.stroke}, inset 0 0 0 ${tipHeight}px ${backgroundColour}; + // border-radius: ${SVG_CONFIG.radius}px; + // filter: ${SVG_CONFIG.filter}`, + // width: `${tipWidth}px`, + // height: `${tipHeight}px`, + // border: `transparent; position: absolute; z-index: 1000; + // box-shadow: inset 0 0 0 ${SVG_CONFIG.strokeWidth}px ${SVG_CONFIG.stroke}, + // inset 0 0 0 ${tipHeight}px ${backgroundColour}; + // border-radius: ${SVG_CONFIG.radius}px; + // filter: ${SVG_CONFIG.filter}; + // margin-left: ${SVG_CONFIG.cursorOffset * 8}px;`, + border: `transparent; position: absolute; z-index: 1000; + box-shadow: inset 0 0 0 ${SVG_CONFIG.strokeWidth}px ${SVG_CONFIG.stroke}, inset 0 0 0 ${tipHeight}px; + filter: ${SVG_CONFIG.filter}; + border-radius: ${SVG_CONFIG.radius}px; + margin-left: ${SVG_CONFIG.cursorOffset * 8}px;`, + // border: `solid 1px white; position: absolute; z-index: 1000; + // margin-left: ${SVG_CONFIG.cursorOffset * 8}px; + // margin-top: 0em;`, + // border: `solid 1px white; position: absolute; z-index: 1000; + // margin: 0em; padding: 0em; + // margin-left: ${SVG_CONFIG.cursorOffset * 8}px; + // margin-top: 0em;`, + width: `${tipWidth}px`, + height: `${tipHeight}px`, + // textDecoration: `none; transform: translateY(-100%);`, + }, + // Set a negative margin to make the decoration float if it starts to displace text. + // Also use absolute positioning. + rangeBehavior: vscode.DecorationRangeBehavior.ClosedClosed, + }); + } + + private buildHideTooltipHoverMsg() { + const hoverMarkdown = new vscode.MarkdownString( + `[Reject (Esc)](command:${HIDE_NEXT_EDIT_SUGGESTION_COMMAND}) | [Accept (Tab)](command:${ACCEPT_NEXT_EDIT_SUGGESTION_COMMAND})`, + ); + + hoverMarkdown.isTrusted = true; + hoverMarkdown.supportHtml = true; + return hoverMarkdown; + } + + private isValidRange( + editor: vscode.TextEditor, + range: vscode.Range, + ): boolean { + const doc = editor.document; + + // Check if line numbers are valid. + if (range.start.line < 0 || range.start.line >= doc.lineCount) { + console.log( + "Invalid start line:", + range.start.line, + "doc lines:", + doc.lineCount, + ); + return false; + } + + if (range.end.line < 0 || range.end.line >= doc.lineCount) { + console.log( + "Invalid end line:", + range.end.line, + "doc lines:", + doc.lineCount, + ); + return false; + } + + // Check if character positions are valid. + const startLine = doc.lineAt(range.start.line); + const endLine = doc.lineAt(range.end.line); + + if ( + range.start.character < 0 || + range.start.character > startLine.text.length + ) { + console.log( + "Invalid start character:", + range.start.character, + "line length:", + startLine.text.length, + ); + return false; + } + + if (range.end.character < 0 || range.end.character > endLine.text.length) { + console.log( + "Invalid end character:", + range.end.character, + "line length:", + endLine.text.length, + ); + return false; + } + + return true; + } + + /** + * Calculate a position to the right of the cursor with the specified offset. + */ + private getDecorationOffsetPosition( + editor: vscode.TextEditor, + position: vscode.Position, + ): vscode.Position { + // Create a position that's offset spaces to the right of the cursor. + + const line = editor.document.lineAt(position.line); + const offsetChar = Math.min( + position.character + SVG_CONFIG.cursorOffset, + line.text.length, + ); + return new vscode.Position(position.line, offsetChar); + } + + /** + * Render a tooltip with the given text at the specified position. + */ + private async renderTooltip( + editor: vscode.TextEditor, + position: vscode.Position, + text: string, + ) { + console.log("renderTooltip"); + // Capture document version to detect changes. + const docVersion = editor.document.version; + + // Create a new decoration with the text. + const decoration = await this.createCodeRenderDecoration(text); + if (!decoration) { + console.error("Failed to create decoration for text:", text); + return; + } + + // Check if document changed during async operation. + if (editor.document.version !== docVersion) { + console.log("Document changed during decoration creation, aborting"); + decoration.dispose(); + return; + } + + // Store the decoration and editor. + await this.hideAllNextEditWindows(); + this.currentDecoration = decoration; + this.activeEditor = editor; + + // Calculate how far off to the right of the cursor the decoration should be. + const decorationOffsetPosition = this.getDecorationOffsetPosition( + editor, + position, + ); + const range = new vscode.Range( + decorationOffsetPosition, + decorationOffsetPosition, + ); + + // Validate the range before applying. + if (!this.isValidRange(editor, range)) { + console.error("Invalid range detected, skipping decoration"); + return; + } + + // Apply the decoration at the calculated position. + editor.setDecorations(this.currentDecoration, [ + { + range: new vscode.Range( + decorationOffsetPosition, + decorationOffsetPosition, + ), + hoverMessage: [this.buildHideTooltipHoverMsg()], + }, + ]); + } +} + +export default async function setupNextEditWindowManager( + context: vscode.ExtensionContext, + textApplier?: TextApplier, +) { + await NextEditWindowManager.getInstance().setupNextEditWindowManager( + context, + textApplier, + ); +} diff --git a/extensions/vscode/src/apply/ApplyManager.ts b/extensions/vscode/src/apply/ApplyManager.ts index fb446e174..1ac84c368 100644 --- a/extensions/vscode/src/apply/ApplyManager.ts +++ b/extensions/vscode/src/apply/ApplyManager.ts @@ -3,18 +3,14 @@ import { applyCodeBlock } from "core/edit/lazy/applyCodeBlock"; import { getUriPathBasename } from "core/util/uri"; import * as vscode from "vscode"; +import { ApplyToFilePayload } from "core"; +import { myersDiff } from "core/diff/myers"; +import { generateLines } from "core/diff/util"; import { ApplyAbortManager } from "core/edit/applyAbortManager"; import { VerticalDiffManager } from "../diff/vertical/manager"; import { VsCodeIde } from "../VsCodeIde"; import { VsCodeWebviewProtocol } from "../webviewProtocol"; -export interface ApplyToFileOptions { - streamId: string; - filepath?: string; - text: string; - toolCallId?: string; -} - /** * Handles applying text/code to files including diff generation and streaming */ @@ -31,7 +27,8 @@ export class ApplyManager { filepath, text, toolCallId, - }: ApplyToFileOptions) { + isSearchAndReplace, + }: ApplyToFilePayload) { await this.webviewProtocol.request("updateApplyState", { streamId, status: "streaming", @@ -45,19 +42,34 @@ export class ApplyManager { const { activeTextEditor } = vscode.window; if (!activeTextEditor) { - vscode.window.showErrorMessage("No active editor to apply edits to"); + void vscode.window.showErrorMessage("No active editor to apply edits to"); return; } const hasExistingDocument = !!activeTextEditor.document.getText().trim(); if (hasExistingDocument) { - await this.handleExistingDocument( - activeTextEditor, - text, - streamId, - toolCallId, - ); + // Currently `isSearchAndReplace` will always provide a full file rewrite + // as the contents of `text`, so we can just instantly apply + if (isSearchAndReplace) { + const diffLinesGenerator = generateLines( + myersDiff(activeTextEditor.document.getText(), text), + ); + + await this.verticalDiffManager.streamDiffLines( + diffLinesGenerator, + true, + streamId, + toolCallId, + ); + } else { + await this.handleExistingDocument( + activeTextEditor, + text, + streamId, + toolCallId, + ); + } } else { await this.handleEmptyDocument( activeTextEditor, @@ -104,14 +116,14 @@ export class ApplyManager { ) { const { config } = await this.configHandler.loadConfig(); if (!config) { - vscode.window.showErrorMessage("Config not loaded"); + void vscode.window.showErrorMessage("Config not loaded"); return; } const llm = config.selectedModelByRole.apply ?? config.selectedModelByRole.chat; if (!llm) { - vscode.window.showErrorMessage( + void vscode.window.showErrorMessage( `No model with roles "apply" or "chat" found in config.`, ); return; @@ -165,7 +177,7 @@ export class ApplyManager { ) { const { config } = await this.configHandler.loadConfig(); if (!config) { - vscode.window.showErrorMessage("Config not loaded"); + void vscode.window.showErrorMessage("Config not loaded"); return; } diff --git a/extensions/vscode/src/autocomplete/completionProvider.ts b/extensions/vscode/src/autocomplete/completionProvider.ts index 963dcedeb..1f154c8b4 100644 --- a/extensions/vscode/src/autocomplete/completionProvider.ts +++ b/extensions/vscode/src/autocomplete/completionProvider.ts @@ -5,8 +5,8 @@ import { type AutocompleteOutcome, } from "core/autocomplete/util/types"; import { ConfigHandler } from "core/config/ConfigHandler"; -import { IS_NEXT_EDIT_ACTIVE } from "core/nextEdit/constants"; -import { NextEditProvider } from "core/nextEdit/NextEditProvider"; +// import { IS_NEXT_EDIT_ACTIVE } from "core/nextEdit/constants"; +// import { NextEditProvider } from "core/nextEdit/NextEditProvider"; import * as URI from "uri-js"; import { v4 as uuidv4 } from "uuid"; import * as vscode from "vscode"; @@ -15,6 +15,8 @@ import { handleLLMError } from "../util/errorHandling"; import { VsCodeIde } from "../VsCodeIde"; import { VsCodeWebviewProtocol } from "../webviewProtocol"; +import { NextEditProvider } from "core/nextEdit/NextEditProvider"; +import { NextEditWindowManager } from "../activation/NextEditWindowManager"; import { getDefinitionsFromLsp } from "./lsp"; import { RecentlyEditedTracker } from "./recentlyEdited"; import { RecentlyVisitedRangesService } from "./RecentlyVisitedRangesService"; @@ -54,9 +56,19 @@ export class ContinueCompletionProvider } private completionProvider: CompletionProvider; - private nextEditProvider: NextEditProvider | undefined; - private recentlyVisitedRanges: RecentlyVisitedRangesService; - private recentlyEditedTracker: RecentlyEditedTracker; + private nextEditProvider: NextEditProvider; + public recentlyVisitedRanges: RecentlyVisitedRangesService; + public recentlyEditedTracker: RecentlyEditedTracker; + + private isNextEditActive: boolean = false; + + public activateNextEdit() { + this.isNextEditActive = true; + } + + public deactivateNextEdit() { + this.isNextEditActive = false; + } constructor( private readonly configHandler: ConfigHandler, @@ -79,16 +91,16 @@ export class ContinueCompletionProvider this.onError.bind(this), getDefinitionsFromLsp, ); - // NOTE: Only turn it on locally when testing (for review purposes). - if (IS_NEXT_EDIT_ACTIVE) { - this.nextEditProvider = new NextEditProvider( - this.configHandler, - this.ide, - getAutocompleteModel, - this.onError.bind(this), - getDefinitionsFromLsp, - ); - } + + this.nextEditProvider = NextEditProvider.initialize( + this.configHandler, + this.ide, + getAutocompleteModel, + this.onError.bind(this), + getDefinitionsFromLsp, + "fineTuned", + ); + this.recentlyVisitedRanges = new RecentlyVisitedRangesService(ide); } @@ -148,6 +160,10 @@ export class ContinueCompletionProvider line: position.line, character: position.character, }; + // const pos = { + // line: 0, + // character: 0, + // }; let manuallyPassFileContents: string | undefined = undefined; if (document.uri.scheme === "vscode-notebook-cell") { const notebook = vscode.workspace.notebookDocuments.find((notebook) => @@ -208,31 +224,22 @@ export class ContinueCompletionProvider }; setupStatusBar(undefined, true); - const outcome = - await this.completionProvider.provideInlineCompletionItems( - input, - signal, - wasManuallyTriggered, - ); + + const outcome = this.isNextEditActive + ? await this.nextEditProvider.provideInlineCompletionItems( + input, + signal, + ) + : await this.completionProvider.provideInlineCompletionItems( + input, + signal, + wasManuallyTriggered, + ); if (!outcome || !outcome.completion) { return null; } - // NOTE: This is a very rudimentary check to see if we can call the next edit service. - // In the future we will have to figure out how to call this more gracefully. - if (this.nextEditProvider) { - const nextEditOutcome = - await this.nextEditProvider?.provideInlineCompletionItems( - input, - signal, - ); - - if (nextEditOutcome && nextEditOutcome.completion) { - outcome.completion = nextEditOutcome.completion; - } - } - // VS Code displays dependent on selectedCompletionInfo (their docstring below) // We should first always make sure we have a valid completion, but if it goes wrong we // want telemetry to be correct @@ -265,7 +272,10 @@ export class ContinueCompletionProvider // Construct the range/text to show const startPos = selectedCompletionInfo?.range.start ?? position; + // const startPos = new vscode.Position(0, 0); + // const endPos = new vscode.Position(0, 5); let range = new vscode.Range(startPos, startPos); + // let range = new vscode.Range(startPos, endPos); let completionText = outcome.completion; const isSingleLineCompletion = outcome.completion.split("\n").length <= 1; @@ -292,14 +302,20 @@ export class ContinueCompletionProvider new vscode.Position(startPos.line, result.range.end), ); } + // console.log("range", range.start, range.end); } else { // Extend the range to the end of the line for multiline completions range = new vscode.Range(startPos, document.lineAt(startPos).range.end); + // console.log("range", range.start, range.end); } const completionItem = new vscode.InlineCompletionItem( completionText, range, + // new vscode.Range( + // new vscode.Position(36, 3), + // new vscode.Position(36, 3), + // ), { title: "Log Autocomplete Outcome", command: "continue.logAutocompleteOutcome", @@ -308,7 +324,20 @@ export class ContinueCompletionProvider ); (completionItem as any).completeBracketPairs = true; - return [completionItem]; + + if (this.isNextEditActive) { + const editor = vscode.window.activeTextEditor; + if (editor && NextEditWindowManager.isInstantiated()) { + await NextEditWindowManager.getInstance().showNextEditWindow( + editor, + completionText, + ); + } + + return undefined; + } else { + return [completionItem]; + } } finally { stopStatusBarLoading(); } diff --git a/extensions/vscode/src/commands.ts b/extensions/vscode/src/commands.ts index 82d045a01..c1f3aacbe 100644 --- a/extensions/vscode/src/commands.ts +++ b/extensions/vscode/src/commands.ts @@ -779,6 +779,18 @@ const getCommandsMap: ( ); } }, + "continue.forceNextEdit": async () => { + captureCommandTelemetry("forceNextEdit"); + + // This is basically the same logic as forceAutocomplete. + // I'm writing a new command KV pair here in case we diverge in features. + + await vscode.commands.executeCommand("editor.action.inlineSuggest.hide"); + + await vscode.commands.executeCommand( + "editor.action.inlineSuggest.trigger", + ); + }, }; }; diff --git a/extensions/vscode/src/diff/processDiff.ts b/extensions/vscode/src/diff/processDiff.ts index b78ea966c..f350e12b4 100644 --- a/extensions/vscode/src/diff/processDiff.ts +++ b/extensions/vscode/src/diff/processDiff.ts @@ -1,5 +1,7 @@ import { Core } from "core/core"; +import { DataLogger } from "core/data/log"; import { ContinueGUIWebviewViewProvider } from "../ContinueGUIWebviewViewProvider"; +import { editOutcomeTracker } from "../extension/EditOutcomeTracker"; import { VsCodeIde } from "../VsCodeIde"; import { VerticalDiffManager } from "./vertical/manager"; @@ -27,6 +29,11 @@ export async function processDiff( await ide.openFile(newOrCurrentUri); + // If streamId is not provided, try to get it from the VerticalDiffManager + if (!streamId) { + streamId = verticalDiffManager.getStreamIdForFile(newOrCurrentUri); + } + // Clear vertical diffs depending on action verticalDiffManager.clearForfileUri(newOrCurrentUri, action === "accept"); if (action === "reject") { @@ -37,6 +44,13 @@ export async function processDiff( if (streamId) { const fileContent = await ide.readFile(newOrCurrentUri); + // Record the edit outcome before updating the apply state + await editOutcomeTracker.recordEditOutcome( + streamId, + action === "accept", + DataLogger.getInstance(), + ); + await sidebar.webviewProtocol.request("updateApplyState", { fileContent, filepath: newOrCurrentUri, diff --git a/extensions/vscode/src/diff/vertical/handler.ts b/extensions/vscode/src/diff/vertical/handler.ts index 15b3e79d4..68c3436e8 100644 --- a/extensions/vscode/src/diff/vertical/handler.ts +++ b/extensions/vscode/src/diff/vertical/handler.ts @@ -9,8 +9,8 @@ import { indexDecorationType, } from "./decorations"; -import type { VerticalDiffCodeLens } from "./manager"; import type { ApplyState, DiffLine } from "core"; +import type { VerticalDiffCodeLens } from "./manager"; export interface VerticalDiffHandlerOptions { input?: string; @@ -20,10 +20,12 @@ export interface VerticalDiffHandlerOptions { numDiffs?: ApplyState["numDiffs"], fileContent?: ApplyState["fileContent"], ) => void; + streamId?: string; } export class VerticalDiffHandler implements vscode.Disposable { public insertedInCurrentBlock = 0; + public streamId?: string; disposables: vscode.Disposable[] = []; private currentLineIndex: number; private cancelled = false; @@ -50,6 +52,7 @@ export class VerticalDiffHandler implements vscode.Disposable { public options: VerticalDiffHandlerOptions, ) { this.currentLineIndex = startLine; + this.streamId = options.streamId; this.removedLineDecorations = new RemovedLineDecorationManager(this.editor); this.addedLineDecorations = new AddedLineDecorationManager(this.editor); @@ -330,10 +333,7 @@ export class VerticalDiffHandler implements vscode.Disposable { // Then, we insert our diff lines await this.editor.edit((editBuilder) => { editBuilder.replace(this.range, replaceContent), - { - undoStopAfter: false, - undoStopBefore: false, - }; + { undoStopAfter: false, undoStopBefore: false }; }); // Lastly, we apply decorations @@ -446,10 +446,7 @@ export class VerticalDiffHandler implements vscode.Disposable { editBuilder.insert(new vscode.Position(index, 0), `${text}\n`); } }, - { - undoStopAfter: false, - undoStopBefore: false, - }, + { undoStopAfter: false, undoStopBefore: false }, ); } @@ -467,10 +464,7 @@ export class VerticalDiffHandler implements vscode.Disposable { new vscode.Range(startLine, startLine.translate(numLines)), ); }, - { - undoStopAfter: false, - undoStopBefore: false, - }, + { undoStopAfter: false, undoStopBefore: false }, ); } @@ -486,10 +480,7 @@ export class VerticalDiffHandler implements vscode.Disposable { ); } }, - { - undoStopAfter: false, - undoStopBefore: false, - }, + { undoStopAfter: false, undoStopBefore: false }, ); } diff --git a/extensions/vscode/src/diff/vertical/manager.ts b/extensions/vscode/src/diff/vertical/manager.ts index aca644c3a..72efdb60e 100644 --- a/extensions/vscode/src/diff/vertical/manager.ts +++ b/extensions/vscode/src/diff/vertical/manager.ts @@ -1,4 +1,4 @@ -import { ChatMessage, DiffLine, ILLM, RuleWithSource } from "core"; +import { ChatMessage, DiffLine, IDE, ILLM, RuleWithSource } from "core"; import { streamDiffLines } from "core/edit/streamDiffLines"; import { pruneLinesFromBottom, pruneLinesFromTop } from "core/llm/countTokens"; import { getMarkdownLanguageTagForFile } from "core/util"; @@ -11,6 +11,9 @@ import { handleLLMError } from "../../util/errorHandling"; import { VsCodeWebviewProtocol } from "../../webviewProtocol"; import { ApplyAbortManager } from "core/edit/applyAbortManager"; +import { EDIT_MODE_STREAM_ID } from "core/edit/constants"; +import { stripImages } from "core/util/messageContent"; +import { editOutcomeTracker } from "../../extension/EditOutcomeTracker"; import { VerticalDiffHandler, VerticalDiffHandlerOptions } from "./handler"; export interface VerticalDiffCodeLens { @@ -23,7 +26,6 @@ export class VerticalDiffManager { public refreshCodeLens: () => void = () => {}; private fileUriToHandler: Map = new Map(); - fileUriToCodeLens: Map = new Map(); private userChangeListener: vscode.Disposable | undefined; @@ -33,6 +35,7 @@ export class VerticalDiffManager { constructor( private readonly webviewProtocol: VsCodeWebviewProtocol, private readonly editDecorationManager: EditDecorationManager, + private readonly ide: IDE, ) { this.userChangeListener = undefined; } @@ -69,6 +72,10 @@ export class VerticalDiffManager { return this.fileUriToHandler.get(fileUri); } + getStreamIdForFile(fileUri: string): string | undefined { + return this.fileUriToHandler.get(fileUri)?.streamId; + } + // Creates a listener for document changes by user. private enableDocumentChangeListener(): vscode.Disposable | undefined { if (this.userChangeListener) { @@ -229,6 +236,7 @@ export class VerticalDiffManager { filepath: fileUri, toolCallId, }), + streamId, }, ); @@ -296,7 +304,11 @@ export class VerticalDiffManager { toolCallId?: string; rulesToInclude: undefined | RuleWithSource[]; }): Promise { - vscode.commands.executeCommand("setContext", "continue.diffVisible", true); + void vscode.commands.executeCommand( + "setContext", + "continue.diffVisible", + true, + ); let editor = vscode.window.activeTextEditor; @@ -373,6 +385,7 @@ export class VerticalDiffManager { filepath: fileUri, toolCallId, }), + streamId, }, ); @@ -430,7 +443,7 @@ export class VerticalDiffManager { ); } - vscode.commands.executeCommand( + void vscode.commands.executeCommand( "setContext", "continue.streamingDiff", true, @@ -472,10 +485,18 @@ export class VerticalDiffManager { this.enableDocumentChangeListener(); if (abortController.signal.aborted) { - vscode.commands.executeCommand("continue.rejectDiff"); + void vscode.commands.executeCommand("continue.rejectDiff"); } - return `${prefix}${streamedLines.join("\n")}${suffix}`; + const fileAfterEdit = `${prefix}${streamedLines.join("\n")}${suffix}`; + await this.trackEditInteraction({ + model: llm, + filepath: fileUri, + prompt: input, + fileAfterEdit, + }); + + return fileAfterEdit; } catch (e) { this.disableDocumentChangeListener(); const handled = await handleLLMError(e); @@ -487,11 +508,46 @@ export class VerticalDiffManager { throw new Error(message); } } finally { - vscode.commands.executeCommand( + void vscode.commands.executeCommand( "setContext", "continue.streamingDiff", false, ); } } + + async trackEditInteraction({ + model, + filepath, + prompt, + fileAfterEdit, + }: { + model: ILLM; + filepath: string; + prompt: string; + fileAfterEdit: string | undefined; + }) { + // Get previous code content for outcome tracking + const previousCode = await this.ide.readFile(filepath); + const newCode = fileAfterEdit ?? ""; + const previousCodeLines = previousCode.split("\n").length; + const newCodeLines = newCode.split("\n").length; + const lineChange = newCodeLines - previousCodeLines; + + // Store pending edit data for outcome tracking + editOutcomeTracker.trackEditInteraction({ + streamId: EDIT_MODE_STREAM_ID, + timestamp: new Date().toISOString(), + modelProvider: model.underlyingProviderName, + modelTitle: model.title ?? "", + prompt: stripImages(prompt), + completion: newCode, + previousCode, + newCode, + filepath: filepath, + previousCodeLines, + newCodeLines, + lineChange, + }); + } } diff --git a/extensions/vscode/src/extension/EditOutcomeTracker.ts b/extensions/vscode/src/extension/EditOutcomeTracker.ts new file mode 100644 index 000000000..c69dbac72 --- /dev/null +++ b/extensions/vscode/src/extension/EditOutcomeTracker.ts @@ -0,0 +1,96 @@ +/** + * Tracks pending edit interactions until they are accepted or rejected, + * then emits editOutcome events with the final result. + */ +export interface PendingEditData { + streamId: string; + timestamp: string; + modelProvider: string; + modelTitle: string; + prompt: string; + completion: string; + previousCode: string; + newCode: string; + filepath: string; + previousCodeLines: number; + newCodeLines: number; + lineChange: number; +} + +class EditOutcomeTracker { + private static instance: EditOutcomeTracker; + private pendingEdits: Map = new Map(); + + private constructor() {} + + public static getInstance(): EditOutcomeTracker { + if (!EditOutcomeTracker.instance) { + EditOutcomeTracker.instance = new EditOutcomeTracker(); + } + return EditOutcomeTracker.instance; + } + + /** + * Store a pending edit interaction for later outcome tracking + */ + public trackEditInteraction(data: PendingEditData): void { + this.pendingEdits.set(data.streamId, data); + } + + /** + * Record the outcome of an edit interaction and emit the editOutcome event + */ + public async recordEditOutcome( + streamId: string, + accepted: boolean, + dataLogger: any, + ): Promise { + const pendingEdit = this.pendingEdits.get(streamId); + if (!pendingEdit) { + console.warn(`No pending edit found for streamId: ${streamId}`); + return; + } + + // Emit the editOutcome event + await dataLogger.logDevData({ + name: "editOutcome", + data: { + modelProvider: pendingEdit.modelProvider, + modelTitle: pendingEdit.modelTitle, + prompt: pendingEdit.prompt, + completion: pendingEdit.completion, + previousCode: pendingEdit.previousCode, + newCode: pendingEdit.newCode, + previousCodeLines: pendingEdit.previousCodeLines, + newCodeLines: pendingEdit.newCodeLines, + lineChange: pendingEdit.lineChange, + accepted, + }, + }); + + // Clean up the pending edit + this.pendingEdits.delete(streamId); + } + + /** + * Clean up pending edits that might have been abandoned + */ + public cleanupOldPendingEdits(maxAgeMs: number = 30 * 60 * 1000): void { + const now = Date.now(); + for (const [streamId, edit] of this.pendingEdits.entries()) { + const editTime = new Date(edit.timestamp).getTime(); + if (now - editTime > maxAgeMs) { + this.pendingEdits.delete(streamId); + } + } + } + + /** + * Get count of pending edits (for debugging/monitoring) + */ + public getPendingEditCount(): number { + return this.pendingEdits.size; + } +} + +export const editOutcomeTracker = EditOutcomeTracker.getInstance(); diff --git a/extensions/vscode/src/extension/VsCodeExtension.ts b/extensions/vscode/src/extension/VsCodeExtension.ts index 20bde355d..0bc47f90d 100644 --- a/extensions/vscode/src/extension/VsCodeExtension.ts +++ b/extensions/vscode/src/extension/VsCodeExtension.ts @@ -36,12 +36,17 @@ import { } from "../stubs/WorkOsAuthProvider"; import { Battery } from "../util/battery"; import { FileSearch } from "../util/FileSearch"; +import { VsCodeIdeUtils } from "../util/ideUtils"; import { VsCodeIde } from "../VsCodeIde"; import { ConfigYamlDocumentLinkProvider } from "./ConfigYamlDocumentLinkProvider"; import { VsCodeMessenger } from "./VsCodeMessenger"; -import { VsCodeIdeUtils } from "../util/ideUtils"; +import setupNextEditWindowManager, { + NextEditWindowManager, +} from "../activation/NextEditWindowManager"; +import { getDefinitionsFromLsp } from "../autocomplete/lsp"; +import { handleTextDocumentChange } from "../util/editLoggingUtils"; import type { VsCodeWebviewProtocol } from "../webviewProtocol"; export class VsCodeExtension { @@ -62,11 +67,12 @@ export class VsCodeExtension { private workOsAuthProvider: WorkOsAuthProvider; private fileSearch: FileSearch; private uriHandler = new UriEventHandler(); + private completionProvider: ContinueCompletionProvider; constructor(context: vscode.ExtensionContext) { // Register auth provider this.workOsAuthProvider = new WorkOsAuthProvider(context, this.uriHandler); - this.workOsAuthProvider.refreshSessions(); + void this.workOsAuthProvider.refreshSessions(); context.subscriptions.push(this.workOsAuthProvider); this.editDecorationManager = new EditDecorationManager(context); @@ -124,25 +130,28 @@ export class VsCodeExtension { configHandlerPromise, this.workOsAuthProvider, this.editDecorationManager, + context, + this, ); this.core = new Core(inProcessMessenger, this.ide); this.configHandler = this.core.configHandler; resolveConfigHandler?.(this.configHandler); - this.configHandler.loadConfig(); + void this.configHandler.loadConfig(); this.verticalDiffManager = new VerticalDiffManager( this.sidebar.webviewProtocol, this.editDecorationManager, + this.ide, ); resolveVerticalDiffManager?.(this.verticalDiffManager); - setupRemoteConfigSync( + void setupRemoteConfigSync( this.configHandler.reloadConfig.bind(this.configHandler), ); - this.configHandler.loadConfig().then(({ config }) => { + void this.configHandler.loadConfig().then(({ config }) => { const { verticalDiffCodeLens } = registerAllCodeLensProviders( context, this.verticalDiffManager.fileUriToCodeLens, @@ -155,6 +164,18 @@ export class VsCodeExtension { this.configHandler.onConfigUpdate( async ({ config: newConfig, configLoadInterrupted }) => { + if (newConfig?.experimental?.optInNextEditFeature) { + // Set up next edit window manager only for Continue team members + await setupNextEditWindowManager(context); + + this.activateNextEdit(); + await NextEditWindowManager.freeTabAndEsc(); + } else { + NextEditWindowManager.clearInstance(); + this.deactivateNextEdit(); + await NextEditWindowManager.freeTabAndEsc(); + } + if (configLoadInterrupted) { // Show error in status bar setupStatusBar(undefined, undefined, true); @@ -178,14 +199,15 @@ export class VsCodeExtension { setupStatusBar( enabled ? StatusBarStatus.Enabled : StatusBarStatus.Disabled, ); + this.completionProvider = new ContinueCompletionProvider( + this.configHandler, + this.ide, + this.sidebar.webviewProtocol, + ); context.subscriptions.push( vscode.languages.registerInlineCompletionItemProvider( [{ pattern: "**" }], - new ContinueCompletionProvider( - this.configHandler, - this.ide, - this.sidebar.webviewProtocol, - ), + this.completionProvider, ), ); @@ -280,7 +302,19 @@ export class VsCodeExtension { if (stats.size === 0) { return; } - this.configHandler.reloadConfig(); + void this.configHandler.reloadConfig(); + }); + + vscode.workspace.onDidChangeTextDocument(async (event) => { + const editInfo = await handleTextDocumentChange( + event, + this.configHandler, + this.ide, + this.completionProvider, + getDefinitionsFromLsp, + ); + + if (editInfo) this.core.invoke("files/smallEdit", editInfo); }); vscode.workspace.onDidSaveTextDocument(async (event) => { @@ -311,7 +345,7 @@ export class VsCodeExtension { vscode.authentication.onDidChangeSessions(async (e) => { const env = await getControlPlaneEnv(this.ide.getIdeSettings()); if (e.provider.id === env.AUTH_TYPE) { - vscode.commands.executeCommand( + void vscode.commands.executeCommand( "setContext", "continue.isSignedInToControlPlane", true, @@ -322,7 +356,7 @@ export class VsCodeExtension { sessionInfo, }); } else { - vscode.commands.executeCommand( + void vscode.commands.executeCommand( "setContext", "continue.isSignedInToControlPlane", false, @@ -335,7 +369,7 @@ export class VsCodeExtension { }); // Refresh index when branch is changed - this.ide.getWorkspaceDirs().then((dirs) => + void this.ide.getWorkspaceDirs().then((dirs) => dirs.forEach(async (dir) => { const repo = await this.ide.getRepo(dir); if (repo) { @@ -410,4 +444,12 @@ export class VsCodeExtension { registerCustomContextProvider(contextProvider: IContextProvider) { this.configHandler.registerCustomContextProvider(contextProvider); } + + public activateNextEdit() { + this.completionProvider.activateNextEdit(); + } + + public deactivateNextEdit() { + this.completionProvider.deactivateNextEdit(); + } } diff --git a/extensions/vscode/src/extension/VsCodeMessenger.ts b/extensions/vscode/src/extension/VsCodeMessenger.ts index 5aff7056e..430c4fff1 100644 --- a/extensions/vscode/src/extension/VsCodeMessenger.ts +++ b/extensions/vscode/src/extension/VsCodeMessenger.ts @@ -30,6 +30,7 @@ import { showTutorial } from "../util/tutorial"; import { getExtensionUri } from "../util/vscode"; import { VsCodeIde } from "../VsCodeIde"; import { VsCodeWebviewProtocol } from "../webviewProtocol"; +import { VsCodeExtension } from "./VsCodeExtension"; type ToIdeOrWebviewFromCoreProtocol = ToIdeFromCoreProtocol & ToWebviewFromCoreProtocol; @@ -82,6 +83,8 @@ export class VsCodeMessenger { private readonly configHandlerPromise: Promise, private readonly workOsAuthProvider: WorkOsAuthProvider, private readonly editDecorationManager: EditDecorationManager, + private readonly context: vscode.ExtensionContext, + private readonly vsCodeExtension: VsCodeExtension, ) { /** WEBVIEW ONLY LISTENERS **/ this.onWebview("showFile", (msg) => { diff --git a/extensions/vscode/src/test/runner/mochaRunner.ts b/extensions/vscode/src/test/runner/mochaRunner.ts deleted file mode 100644 index 1056ed6b7..000000000 --- a/extensions/vscode/src/test/runner/mochaRunner.ts +++ /dev/null @@ -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((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); - } - }); -} diff --git a/extensions/vscode/src/test/runner/runTestOnVSCodeHost.ts b/extensions/vscode/src/test/runner/runTestOnVSCodeHost.ts deleted file mode 100644 index f6174e087..000000000 --- a/extensions/vscode/src/test/runner/runTestOnVSCodeHost.ts +++ /dev/null @@ -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(); diff --git a/extensions/vscode/src/test/test-suites/ideUtils.test.ts b/extensions/vscode/src/test/test-suites/ideUtils.test.ts deleted file mode 100644 index 37ba5cc33..000000000 --- a/extensions/vscode/src/test/test-suites/ideUtils.test.ts +++ /dev/null @@ -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()); - }); -}); diff --git a/extensions/vscode/src/util/editLoggingUtils.ts b/extensions/vscode/src/util/editLoggingUtils.ts new file mode 100644 index 000000000..90992db2e --- /dev/null +++ b/extensions/vscode/src/util/editLoggingUtils.ts @@ -0,0 +1,91 @@ +import { IDE, Position, Range, RangeInFileWithNextEditInfo } from "core"; +import { AutocompleteCodeSnippet } from "core/autocomplete/snippets/types"; +import { GetLspDefinitionsFunction } from "core/autocomplete/types"; +import { ConfigHandler } from "core/config/ConfigHandler"; +import { RecentlyEditedRange } from "core/nextEdit/types"; +import * as vscode from "vscode"; +import { ContinueCompletionProvider } from "../autocomplete/completionProvider"; + +export const getBeforeCursorPos = (range: Range, activePos: Position) => { + // whichever side of the range isn't active is the before position + if ( + range.start.line === activePos.line && + range.start.character === activePos.character + ) { + return range.end as Position; + } else { + return range.start as Position; + } +}; + +const getWorkspaceDirInfo = async ( + event: vscode.TextDocumentChangeEvent, + ide: IDE, +) => { + // gets the workspace dir uri and checks if it's the open-source continue repo + const workspaceFolder = vscode.workspace.getWorkspaceFolder( + event.document.uri, + ); + if (!workspaceFolder) { + return false; + } + const workspaceDirUri = workspaceFolder.uri.toString(); + const repoName = await ide.getRepoName(workspaceDirUri); + return { + workspaceDirUri: workspaceDirUri, + isContinueRepo: repoName === "continuedev/continue", + }; +}; + +export const handleTextDocumentChange = async ( + event: vscode.TextDocumentChangeEvent, + configHandler: ConfigHandler, + ide: IDE, + completionProvider: ContinueCompletionProvider, + getDefinitionsFromLsp: GetLspDefinitionsFunction, +) => { + const changes = event.contentChanges; + const editor = vscode.window.activeTextEditor; + const { config } = await configHandler.loadConfig(); + + if (!config?.experimental?.logEditingData) return; + if (!editor) return; + if (event.contentChanges.length === 0) return; + + // Ensure that loggin will only happen in the open-source continue repo + const workspaceDirInfo = await getWorkspaceDirInfo(event, ide); + if (!workspaceDirInfo) return; + // if (!workspaceDirInfo.isContinueRepo) return; + + const activeCursorPos = editor.selection.active; + const editActions: RangeInFileWithNextEditInfo[] = changes.map((change) => ({ + filepath: event.document.uri.toString(), + range: { + start: change.range.start as Position, + end: change.range.end as Position, + }, + fileContents: event.document.getText(), + editText: change.text, + beforeCursorPos: getBeforeCursorPos(change.range, activeCursorPos), + afterCursorPos: activeCursorPos as Position, + workspaceDir: workspaceDirInfo.workspaceDirUri, + })); + + let recentlyEditedRanges: RecentlyEditedRange[] = []; + let recentlyVisitedRanges: AutocompleteCodeSnippet[] = []; + + if (completionProvider) { + recentlyEditedRanges = + await completionProvider.recentlyEditedTracker.getRecentlyEditedRanges(); + recentlyVisitedRanges = + completionProvider.recentlyVisitedRanges.getSnippets(); + } + + return { + actions: editActions, + configHandler: configHandler, + getDefsFromLspFunction: getDefinitionsFromLsp, + recentlyEditedRanges, + recentlyVisitedRanges, + }; +}; diff --git a/extensions/vscode/src/util/getTheme.ts b/extensions/vscode/src/util/getTheme.ts index e47dbccfe..a927c36c1 100644 --- a/extensions/vscode/src/util/getTheme.ts +++ b/extensions/vscode/src/util/getTheme.ts @@ -45,6 +45,14 @@ function parseThemeString(themeString: string | undefined): any { return JSON.parse(themeString ?? "{}"); } +export function getThemeString(): string { + const workbenchConfig = vscode.workspace.getConfiguration(); + const themeString = + workbenchConfig.get("workbench.colorTheme") ?? + "Default Dark Modern"; + return themeString; +} + export function getTheme() { let currentTheme: string | undefined = undefined; // Get color theme from settings diff --git a/gui/package-lock.json b/gui/package-lock.json index 0619e22e5..08583a0d8 100644 --- a/gui/package-lock.json +++ b/gui/package-lock.json @@ -31,12 +31,12 @@ "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", "mustache": "^4.2.0", "posthog-js": "^1.130.1", - "prismjs": "^1.29.0", "react": "^18.2.0", "react-dom": "^18.2.0", "react-error-boundary": "^4.0.11", @@ -114,9 +114,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": "1.0.42", "@modelcontextprotocol/sdk": "^1.12.0", "@mozilla/readability": "^0.5.0", "@octokit/rest": "^20.1.1", @@ -205,6 +205,7 @@ "myers-diff": "^2.1.0", "onnxruntime-common": "1.14.0", "onnxruntime-web": "1.14.0", + "shiki": "^3.6.0", "ts-jest": "^29.1.1", "typescript": "^5.6.3", "vitest": "^3.1.4" @@ -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", diff --git a/gui/package.json b/gui/package.json index eb4a5a4d0..f98c4499f 100644 --- a/gui/package.json +++ b/gui/package.json @@ -40,12 +40,12 @@ "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", "mustache": "^4.2.0", "posthog-js": "^1.130.1", - "prismjs": "^1.29.0", "react": "^18.2.0", "react-dom": "^18.2.0", "react-error-boundary": "^4.0.11", diff --git a/gui/src/components/AssistantAndOrgListbox/AccountOption.tsx b/gui/src/components/AssistantAndOrgListbox/AccountOption.tsx new file mode 100644 index 000000000..98e8adbc5 --- /dev/null +++ b/gui/src/components/AssistantAndOrgListbox/AccountOption.tsx @@ -0,0 +1,51 @@ +import { + ArrowRightEndOnRectangleIcon, + UserCircleIcon as UserCircleIconOutline, +} from "@heroicons/react/24/outline"; +import { isOnPremSession } from "core/control-plane/AuthTypes"; +import { useAuth } from "../../context/Auth"; +import { ListboxOption, useFontSize } from "../ui"; + +interface AccountOptionProps { + onClose: () => void; +} + +export function AccountOption({ onClose }: AccountOptionProps) { + const { session, logout, login } = useAuth(); + const tinyFont = useFontSize(-4); + + // No account option for on-prem deployments + if (session && isOnPremSession(session)) { + return null; + } + + async function handleClick() { + if (session) { + logout(); + } else { + await login(false); + } + onClose(); + } + + return ( + +
+ {session ? ( + + ) : ( + + )} + {session ? "Log out" : "Sign in"} +
+
+ ); +} diff --git a/gui/src/components/modelSelection/platform/AssistantIcon.tsx b/gui/src/components/AssistantAndOrgListbox/AssistantIcon.tsx similarity index 86% rename from gui/src/components/modelSelection/platform/AssistantIcon.tsx rename to gui/src/components/AssistantAndOrgListbox/AssistantIcon.tsx index c901bfdf4..aca23dad7 100644 --- a/gui/src/components/modelSelection/platform/AssistantIcon.tsx +++ b/gui/src/components/AssistantAndOrgListbox/AssistantIcon.tsx @@ -1,13 +1,13 @@ import { ComputerDesktopIcon, SparklesIcon } from "@heroicons/react/24/outline"; import { ProfileDescription } from "core/config/ProfileLifecycleManager"; -import { isLocalProfile } from "../../../util"; +import { isLocalProfile } from "../../util"; export interface AssistantIconProps { assistant: ProfileDescription; size?: number; } -export default function AssistantIcon({ assistant, size }: AssistantIconProps) { +export function AssistantIcon({ assistant, size }: AssistantIconProps) { const sizeTw = size ?? 4; if (isLocalProfile(assistant)) { return ( diff --git a/gui/src/components/AssistantAndOrgListbox/AssistantOption.tsx b/gui/src/components/AssistantAndOrgListbox/AssistantOption.tsx new file mode 100644 index 000000000..201a9e852 --- /dev/null +++ b/gui/src/components/AssistantAndOrgListbox/AssistantOption.tsx @@ -0,0 +1,118 @@ +import { + ArrowTopRightOnSquareIcon, + Cog6ToothIcon, + ExclamationTriangleIcon, +} from "@heroicons/react/24/outline"; +import { ProfileDescription } from "core/config/ProfileLifecycleManager"; +import { useContext, useMemo } from "react"; +import { useNavigate } from "react-router-dom"; +import { IdeMessengerContext } from "../../context/IdeMessenger"; +import { useAppDispatch } from "../../redux/hooks"; +import { setSelectedProfile } from "../../redux/slices/profilesSlice"; +import { isLocalProfile } from "../../util"; +import { ROUTES } from "../../util/navigation"; +import { useLump } from "../mainInput/Lump/LumpContext"; +import { ListboxOption, useFontSize } from "../ui"; +import { AssistantIcon } from "./AssistantIcon"; + +interface AssistantOptionProps { + profile: ProfileDescription; + selected: boolean; + onClick: () => void; +} + +export function AssistantOption({ + profile, + selected, + onClick, +}: AssistantOptionProps) { + const tinyFont = useFontSize(-4); + const navigate = useNavigate(); + const { setSelectedSection } = useLump(); + const dispatch = useAppDispatch(); + const ideMessenger = useContext(IdeMessengerContext); + + const hasFatalErrors = useMemo(() => { + return !!profile.errors?.find((error) => error.fatal); + }, [profile.errors]); + + function handleOptionClick() { + // optimistic update + dispatch(setSelectedProfile(profile.id)); + // notify core which will handle actual update + ideMessenger.post("didChangeSelectedProfile", { + id: profile.id, + }); + onClick(); + } + + function handleConfigure() { + ideMessenger.post("config/openProfile", { profileId: profile.id }); + onClick(); + } + + function handleClickError() { + if (profile.id === "local") { + navigate(ROUTES.HOME); + setSelectedSection("error"); + } else { + ideMessenger.post("config/openProfile", { profileId: profile.id }); + } + onClick(); + } + + return ( + +
+
+
+ +
+ + {profile.title} + +
+
+ {profile.errors && profile.errors?.length > 0 && ( + { + e.preventDefault(); + e.stopPropagation(); + handleClickError(); + }} + /> + )} + {isLocalProfile(profile) ? ( + { + e.stopPropagation(); + e.preventDefault(); + handleConfigure(); + }} + /> + ) : ( + { + e.stopPropagation(); + e.preventDefault(); + handleConfigure(); + }} + /> + )} +
+
+
+ ); +} diff --git a/gui/src/components/AssistantAndOrgListbox/AssistantOptions.tsx b/gui/src/components/AssistantAndOrgListbox/AssistantOptions.tsx new file mode 100644 index 000000000..23c54184d --- /dev/null +++ b/gui/src/components/AssistantAndOrgListbox/AssistantOptions.tsx @@ -0,0 +1,34 @@ +import { useAuth } from "../../context/Auth"; +import { AssistantOption } from "./AssistantOption"; + +interface AssistantOptionsProps { + selectedProfileId: string | undefined; + onClose: () => void; +} + +export function AssistantOptions({ + selectedProfileId, + onClose, +}: AssistantOptionsProps) { + const { profiles } = useAuth(); + + return ( + <> +
+ +
+
+ +
+ {profiles?.map((profile, idx) => ( + + ))} +
+ + ); +} diff --git a/gui/src/pages/config/ScopeSelect.tsx b/gui/src/components/AssistantAndOrgListbox/ScopeSelect.tsx similarity index 77% rename from gui/src/pages/config/ScopeSelect.tsx rename to gui/src/components/AssistantAndOrgListbox/ScopeSelect.tsx index 9e574f44a..7cac430a8 100644 --- a/gui/src/pages/config/ScopeSelect.tsx +++ b/gui/src/components/AssistantAndOrgListbox/ScopeSelect.tsx @@ -4,12 +4,6 @@ import { } from "@heroicons/react/24/outline"; import { UserCircleIcon } from "@heroicons/react/24/solid"; import { useContext } from "react"; -import { - Listbox, - ListboxButton, - ListboxOption, - ListboxOptions, -} from "../../components/ui/Listbox"; import { useAuth } from "../../context/Auth"; import { IdeMessengerContext } from "../../context/IdeMessenger"; import { useAppDispatch, useAppSelector } from "../../redux/hooks"; @@ -17,10 +11,29 @@ import { selectCurrentOrg, setSelectedOrgId, } from "../../redux/slices/profilesSlice"; +import { + Listbox, + ListboxButton, + ListboxOption, + ListboxOptions, +} from "../ui/Listbox"; interface ScopeSelectProps { onSelect?: () => void; } + +function getOrgIcon(org: { name: string; iconUrl?: string | null }) { + if (org.iconUrl) { + return ( + + ); + } + + const IconComponent = + org.name === "Personal" ? UserCircleIcon : BuildingOfficeIcon; + return ; +} + export function ScopeSelect({ onSelect }: ScopeSelectProps) { const { organizations } = useAuth(); const ideMessenger = useContext(IdeMessengerContext); @@ -39,10 +52,6 @@ export function ScopeSelect({ onSelect }: ScopeSelectProps) { onSelect?.(); }; - const CurScopeEntityFallBackIcon = selectedOrgId - ? BuildingOfficeIcon - : UserCircleIcon; - const selectedDisplay = currentOrg ?? { name: "Personal", iconUrl: null, @@ -53,27 +62,19 @@ export function ScopeSelect({ onSelect }: ScopeSelectProps) {
- {selectedDisplay?.iconUrl ? ( - - ) : ( - - )} + {getOrgIcon(selectedDisplay)} {selectedDisplay?.name || "Select Organization"}
-
{organizations.map((org) => (
- {org.iconUrl ? ( - - ) : ( - - )} + {getOrgIcon(org)} {org.name}
diff --git a/gui/src/components/AssistantAndOrgListbox/SelectedAssistantButton.tsx b/gui/src/components/AssistantAndOrgListbox/SelectedAssistantButton.tsx new file mode 100644 index 000000000..bb0a301e1 --- /dev/null +++ b/gui/src/components/AssistantAndOrgListbox/SelectedAssistantButton.tsx @@ -0,0 +1,57 @@ +import { ChevronDownIcon } from "@heroicons/react/24/outline"; +import { ArrowPathIcon } from "@heroicons/react/24/solid"; +import type { ProfileDescription } from "core/config/ConfigHandler"; +import { useAppSelector } from "../../redux/hooks"; +import { fontSize } from "../../util"; +import { cn } from "../../util/cn"; +import { useLump } from "../mainInput/Lump/LumpContext"; +import { ListboxButton } from "../ui"; +import { AssistantIcon } from "./AssistantIcon"; + +interface SelectedAssistantButtonProps { + selectedProfile: ProfileDescription; +} + +export function SelectedAssistantButton({ + selectedProfile, +}: SelectedAssistantButtonProps) { + const { isToolbarExpanded } = useLump(); + const configLoading = useAppSelector((store) => store.config.loading); + + return ( + +
+ {configLoading ? ( + + + Loading + + ) : ( + <> +
+ +
+ + {selectedProfile.title} + + + )} +
+
+ ); +} diff --git a/gui/src/components/AssistantAndOrgListbox/index.tsx b/gui/src/components/AssistantAndOrgListbox/index.tsx new file mode 100644 index 000000000..65b9e6a81 --- /dev/null +++ b/gui/src/components/AssistantAndOrgListbox/index.tsx @@ -0,0 +1,203 @@ +import { ArrowPathIcon, PlusIcon } from "@heroicons/react/24/outline"; +import { isOnPremSession } from "core/control-plane/AuthTypes"; +import { useContext, useEffect, useRef } from "react"; +import { useAuth } from "../../context/Auth"; +import { IdeMessengerContext } from "../../context/IdeMessenger"; +import { useAppDispatch, useAppSelector } from "../../redux/hooks"; +import { + selectCurrentOrg, + setSelectedProfile, +} from "../../redux/slices/profilesSlice"; +import { getMetaKeyLabel, isMetaEquivalentKeyPressed } from "../../util"; +import { cn } from "../../util/cn"; +import { useLump } from "../mainInput/Lump/LumpContext"; +import { + Listbox, + ListboxOption, + ListboxOptions, + Transition, + useFontSize, +} from "../ui"; +import { AccountOption } from "./AccountOption"; +import { AssistantOptions } from "./AssistantOptions"; +import { ScopeSelect } from "./ScopeSelect"; +import { SelectedAssistantButton } from "./SelectedAssistantButton"; + +export function AssistantAndOrgListbox() { + const dispatch = useAppDispatch(); + const listboxRef = useRef(null); + const currentOrg = useAppSelector(selectCurrentOrg); + const ideMessenger = useContext(IdeMessengerContext); + const { isToolbarExpanded } = useLump(); + const { + profiles, + selectedProfile, + session, + login, + organizations, + refreshProfiles, + } = useAuth(); + const configLoading = useAppSelector((store) => store.config.loading); + const smallFont = useFontSize(-3); + const tinyFont = useFontSize(-4); + const shouldRenderOrgInfo = + session && organizations.length > 1 && !isOnPremSession(session); + + function close() { + // Close the listbox by clicking outside or programmatically + const event = new KeyboardEvent("keydown", { key: "Escape" }); + document.dispatchEvent(event); + } + + function onNewAssistant() { + void ideMessenger.request("controlPlane/openUrl", { + path: "/new", + orgSlug: currentOrg?.slug, + }); + close(); + } + + useEffect(() => { + let lastToggleTime = 0; + const DEBOUNCE_MS = 800; + + const handleKeyDown = (event: KeyboardEvent) => { + if ( + event.key === "'" && + isMetaEquivalentKeyPressed(event as any) && + event.shiftKey + ) { + const now = Date.now(); + + if (now - lastToggleTime >= DEBOUNCE_MS) { + lastToggleTime = now; + + const profileIds = profiles?.map((profile) => profile.id) ?? []; + // In case of 1 or 0 profiles just does nothing + if (profileIds.length < 2) { + return; + } + let nextId = profileIds[0]; + if (selectedProfile) { + const curIndex = profileIds.indexOf(selectedProfile.id); + const nextIndex = (curIndex + 1) % profileIds.length; + nextId = profileIds[nextIndex]; + } + // Optimistic update + dispatch(setSelectedProfile(nextId)); + ideMessenger.post("didChangeSelectedProfile", { + id: nextId, + }); + } + } + }; + + window.addEventListener("keydown", handleKeyDown); + return () => { + window.removeEventListener("keydown", handleKeyDown); + }; + }, [currentOrg, selectedProfile]); + + if (!selectedProfile) { + return ( +
{ + void ideMessenger.request("controlPlane/openUrl", { + path: "/new?type=assistant", + orgSlug: currentOrg?.slug, + }); + }} + className="text-description flex cursor-pointer select-none items-center gap-1" + style={{ fontSize: smallFont }} + > + + + Create your first assistant + +
+ ); + } + + return ( + +
+ + + + {shouldRenderOrgInfo && ( +
+
+ + {session.account.id} + + + +
+
+ )} + + + {/* Bottom Actions */} +
+ login(false)} + > + + New Assistant + + + + login(false)} + > + { + e.stopPropagation(); + await refreshProfiles(); + }} + > + + Reload config + + + + + +
+ + {getMetaKeyLabel()} ⇧ ' to toggle assistant + +
+
+
+
+
+
+ ); +} diff --git a/gui/src/components/modelSelection/platform/shared.tsx b/gui/src/components/AssistantAndOrgListbox/shared.tsx similarity index 98% rename from gui/src/components/modelSelection/platform/shared.tsx rename to gui/src/components/AssistantAndOrgListbox/shared.tsx index b617fd34e..1f57a4309 100644 --- a/gui/src/components/modelSelection/platform/shared.tsx +++ b/gui/src/components/AssistantAndOrgListbox/shared.tsx @@ -10,8 +10,8 @@ import { defaultBorderRadius, lightGray, vscCommandCenterInactiveBorder, -} from "../.."; -import { ToolTip } from "../../gui/Tooltip"; +} from ".."; +import { ToolTip } from "../gui/Tooltip"; export const OptionDiv = styled.div<{ isDisabled?: boolean; diff --git a/gui/src/components/ConversationStarters/ConversationStarterCard.tsx b/gui/src/components/ConversationStarters/ConversationStarterCard.tsx index 29ff81833..64705d99b 100644 --- a/gui/src/components/ConversationStarters/ConversationStarterCard.tsx +++ b/gui/src/components/ConversationStarters/ConversationStarterCard.tsx @@ -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({ diff --git a/gui/src/components/ConversationStarters/ConversationStarterCards.tsx b/gui/src/components/ConversationStarters/ConversationStarterCards.tsx index 776c0721b..696b00527 100644 --- a/gui/src/components/ConversationStarters/ConversationStarterCards.tsx +++ b/gui/src/components/ConversationStarters/ConversationStarterCards.tsx @@ -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) { diff --git a/gui/src/components/ConversationStarters/__tests__/utils.test.ts b/gui/src/components/ConversationStarters/__tests__/utils.test.ts index 3e7050985..86de0f83e 100644 --- a/gui/src/components/ConversationStarters/__tests__/utils.test.ts +++ b/gui/src/components/ConversationStarters/__tests__/utils.test.ts @@ -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, }, ]; diff --git a/gui/src/components/ConversationStarters/utils.ts b/gui/src/components/ConversationStarters/utils.ts index 1f9ef09ae..e10b79237 100644 --- a/gui/src/components/ConversationStarters/utils.ts +++ b/gui/src/components/ConversationStarters/utils.ts @@ -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); diff --git a/gui/src/components/modelSelection/platform/FreeTrialButton.tsx b/gui/src/components/FreeTrialButton.tsx similarity index 87% rename from gui/src/components/modelSelection/platform/FreeTrialButton.tsx rename to gui/src/components/FreeTrialButton.tsx index c34d0abce..c3373cf7b 100644 --- a/gui/src/components/modelSelection/platform/FreeTrialButton.tsx +++ b/gui/src/components/FreeTrialButton.tsx @@ -1,11 +1,11 @@ import { ChevronDownIcon } from "@heroicons/react/24/outline"; import { FreeTrialStatus } from "core/control-plane/client"; import { useContext } from "react"; -import { Button, SecondaryButton, vscButtonBackground } from "../.."; -import { IdeMessengerContext } from "../../../context/IdeMessenger"; -import { fontSize } from "../../../util"; -import { Listbox, ListboxButton, ListboxOptions, Transition } from "../../ui"; -import { useFontSize } from "../../ui/font"; +import { Button, SecondaryButton, vscButtonBackground } from "."; +import { IdeMessengerContext } from "../context/IdeMessenger"; +import { fontSize } from "../util"; +import { setLocalStorage } from "../util/localStorage"; +import { Listbox, ListboxButton, ListboxOptions, Transition } from "./ui"; interface ProgressBarProps { label: string; @@ -78,10 +78,17 @@ interface FreeTrialButtonProps { export default function FreeTrialButton({ freeTrialStatus, }: FreeTrialButtonProps) { - const smallFont = useFontSize(-3); - const tinyFont = useFontSize(-4); const ideMessenger = useContext(IdeMessengerContext); + const onExitFreeTrial = async () => { + setLocalStorage("hasExitedFreeTrial", true); + + await ideMessenger.request("controlPlane/openUrl", { + path: "setup-models", + orgSlug: undefined, + }); + }; + return (
@@ -137,15 +144,7 @@ export default function FreeTrialButton({ )}
- { - await ideMessenger.request("controlPlane/openUrl", { - path: "setup-models", - orgSlug: undefined, - }); - }} - > + Exit trial
diff --git a/gui/src/components/mainInput/Lump/LumpToolbar/BlockSettingsTopToolbar.tsx b/gui/src/components/mainInput/Lump/LumpToolbar/BlockSettingsTopToolbar.tsx index 4be749689..7458686aa 100644 --- a/gui/src/components/mainInput/Lump/LumpToolbar/BlockSettingsTopToolbar.tsx +++ b/gui/src/components/mainInput/Lump/LumpToolbar/BlockSettingsTopToolbar.tsx @@ -13,9 +13,8 @@ import { ReactNode, useContext, useEffect, useState } from "react"; import { vscBadgeForeground } from "../../.."; import { IdeMessengerContext } from "../../../../context/IdeMessenger"; import { useAppSelector } from "../../../../redux/hooks"; +import FreeTrialButton from "../../../FreeTrialButton"; import { ToolTip } from "../../../gui/Tooltip"; -import AssistantSelect from "../../../modelSelection/platform/AssistantSelect"; -import FreeTrialButton from "../../../modelSelection/platform/FreeTrialButton"; import { useFontSize } from "../../../ui/font"; import HoverItem from "../../InputToolbar/HoverItem"; import { useLump } from "../LumpContext"; @@ -25,6 +24,8 @@ import { ToolsSectionTooltip } from "../sections/tool-policies/ToolPoliciesSecti import { usesFreeTrialApiKey } from "core/config/usesFreeTrialApiKey"; import type { FreeTrialStatus } from "core/control-plane/client"; +import { getLocalStorage } from "../../../../util/localStorage"; +import { AssistantAndOrgListbox } from "../../../AssistantAndOrgListbox"; interface BlockSettingsToolbarIcon { title: string; @@ -151,7 +152,8 @@ export function BlockSettingsTopToolbar() { const [freeTrialStatus, setFreeTrialStatus] = useState(null); - const isUsingFreeTrial = usesFreeTrialApiKey(config); + const hasExitedFreeTrial = getLocalStorage("hasExitedFreeTrial"); + const isUsingFreeTrial = usesFreeTrialApiKey(config) && !hasExitedFreeTrial; useEffect(() => { const fetchFreeTrialStatus = () => { @@ -236,7 +238,7 @@ export function BlockSettingsTopToolbar() { {isUsingFreeTrial ? ( ) : ( - + )} {isUsingFreeTrial ? "View free trial usage" : "Select Assistant"} diff --git a/gui/src/components/mainInput/Lump/sections/PromptsSection.tsx b/gui/src/components/mainInput/Lump/sections/PromptsSection.tsx index d7fd74eee..c277d7d92 100644 --- a/gui/src/components/mainInput/Lump/sections/PromptsSection.tsx +++ b/gui/src/components/mainInput/Lump/sections/PromptsSection.tsx @@ -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; diff --git a/gui/src/components/mainInput/TipTapEditor/extensions/Prompt/PromptBlock.ts b/gui/src/components/mainInput/TipTapEditor/extensions/Prompt/PromptBlock.ts index 8f5c27780..441ae9952 100644 --- a/gui/src/components/mainInput/TipTapEditor/extensions/Prompt/PromptBlock.ts +++ b/gui/src/components/mainInput/TipTapEditor/extensions/Prompt/PromptBlock.ts @@ -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, + ) => ReturnType; /** * Clear all prompt blocks from the editor @@ -76,15 +79,15 @@ export const PromptBlock = Node.create({ 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({ .insertContentAt(0, { type: this.name, attrs: { - item, + item: contextItem, inputId: MAIN_EDITOR_INPUT_ID, }, }) diff --git a/gui/src/components/mainInput/TipTapEditor/extensions/SlashCommand.ts b/gui/src/components/mainInput/TipTapEditor/extensions/SlashCommand.ts index 892d80355..2673c81bd 100644 --- a/gui/src/components/mainInput/TipTapEditor/extensions/SlashCommand.ts +++ b/gui/src/components/mainInput/TipTapEditor/extensions/SlashCommand.ts @@ -22,11 +22,7 @@ export const SlashCommand = Node.create({ // 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); }, }, }; diff --git a/gui/src/components/mainInput/TipTapEditor/utils/editorConfig.ts b/gui/src/components/mainInput/TipTapEditor/utils/editorConfig.ts index a759a5485..be1c61dd7 100644 --- a/gui/src/components/mainInput/TipTapEditor/utils/editorConfig.ts +++ b/gui/src/components/mainInput/TipTapEditor/utils/editorConfig.ts @@ -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;`, }, }, diff --git a/gui/src/components/mainInput/TipTapEditor/utils/processEditorContent.test.ts b/gui/src/components/mainInput/TipTapEditor/utils/processEditorContent.test.ts new file mode 100644 index 000000000..891cb2855 --- /dev/null +++ b/gui/src/components/mainInput/TipTapEditor/utils/processEditorContent.test.ts @@ -0,0 +1,536 @@ +import { JSONContent } from "@tiptap/react"; +import { ContextItemWithId } from "core"; +import { expect, test, vi } from "vitest"; +import { processEditorContent } from "./processEditorContent"; + +describe("processEditorContent", () => { + // Create some reusable test data + const createContextItem = ( + content: string, + description: string, + fileUri?: string, + editing?: boolean, + ): ContextItemWithId => ({ + id: { providerTitle: "test", itemId: "test-id" }, + content, + description, + name: "Test Item", + editing, + uri: fileUri ? { type: "file", value: fileUri } : undefined, + }); + + test("processEditorContent should return empty arrays when content is empty", () => { + // Empty editor state + const emptyEditorState: JSONContent = { + type: "doc", + content: [], + }; + + const result = processEditorContent(emptyEditorState); + + expect(result.parts).toEqual([]); + expect(result.contextRequests).toEqual([]); + expect(result.selectedCode).toEqual([]); + expect(result.slashCommandName).toBeUndefined(); + }); + + test("processEditorContent should process text paragraphs", () => { + const editorState: JSONContent = { + type: "doc", + content: [ + { + type: "paragraph", + content: [ + { + type: "text", + text: "Hello world", + }, + ], + }, + { + type: "paragraph", + content: [ + { + type: "text", + text: "This is another paragraph", + }, + ], + }, + ], + }; + + const result = processEditorContent(editorState); + + expect(result.parts).toEqual([ + { + type: "text", + text: "Hello world\nThis is another paragraph", + }, + ]); + expect(result.contextRequests).toEqual([]); + expect(result.selectedCode).toEqual([]); + }); + + test("processEditorContent should detect slash commands", () => { + const editorState: JSONContent = { + type: "doc", + content: [ + { + type: "prompt-block", + attrs: { + item: { + name: "test-command", + }, + }, + }, + { + type: "paragraph", + content: [ + { + type: "text", + text: "Some text after the prompt", + }, + ], + }, + ], + }; + + const result = processEditorContent(editorState); + + expect(result.slashCommandName).toBe("test-command"); + expect(result.parts).toEqual([ + { + type: "text", + text: "Some text after the prompt", + }, + ]); + }); + + test("processEditorContent should handle mentions and collect context requests", () => { + const editorState: JSONContent = { + type: "doc", + content: [ + { + type: "paragraph", + content: [ + { + type: "text", + text: "Hello ", + }, + { + type: "mention", + attrs: { + id: "fileSearch", + label: "@fileSearch", + itemType: "contextProvider", + }, + }, + { + type: "text", + text: " and also ", + }, + { + type: "mention", + attrs: { + id: "github", + label: "@github", + itemType: "contextProvider", + }, + }, + ], + }, + ], + }; + + const result = processEditorContent(editorState); + + expect(result.parts).toEqual([ + { + type: "text", + text: "Hello @fileSearch and also @github", + }, + ]); + expect(result.contextRequests).toEqual([ + { provider: "fileSearch" }, + { provider: "github" }, + ]); + }); + + test("processEditorContent should handle code blocks", () => { + const codeItem = createContextItem( + "function test() {\n return 'hello';\n}", + "a description", + "file:///example.js", + ); + + const editorState: JSONContent = { + type: "doc", + content: [ + { + type: "paragraph", + content: [ + { + type: "text", + text: "Check this code:", + }, + ], + }, + { + type: "code-block", + attrs: { + item: codeItem, + }, + }, + ], + }; + + const result = processEditorContent(editorState); + + expect(result.parts).toEqual([ + { + type: "text", + text: "Check this code:\n\n```js example.js\nfunction test() {\n return 'hello';\n}\n```\n", + }, + ]); + expect(result.selectedCode).toHaveLength(1); + expect(result.selectedCode[0].filepath).toBe("file:///example.js"); + }); + + test("processEditorContent should not include editing code blocks in the text", () => { + const editingCodeItem = createContextItem( + "function test() {\n return 'hello';\n}", + "a description", + "file:///editing.js", + true, // Set editing to true + ); + + const editorState: JSONContent = { + type: "doc", + content: [ + { + type: "paragraph", + content: [ + { + type: "text", + text: "Edit this code:", + }, + ], + }, + { + type: "code-block", + attrs: { + item: editingCodeItem, + }, + }, + ], + }; + + const result = processEditorContent(editorState); + + // The code block should not be included in parts because it's marked as editing + expect(result.parts).toEqual([ + { + type: "text", + text: "Edit this code:", + }, + ]); + + // But it should still be in selectedCode + expect(result.selectedCode).toHaveLength(1); + expect(result.selectedCode[0].filepath).toBe("file:///editing.js"); + }); + + test("processEditorContent should handle images", () => { + const editorState: JSONContent = { + type: "doc", + content: [ + { + type: "paragraph", + content: [ + { + type: "text", + text: "Here's an image:", + }, + ], + }, + { + type: "image", + attrs: { + src: "https://example.com/image.png", + }, + }, + ], + }; + + const result = processEditorContent(editorState); + + expect(result.parts).toEqual([ + { + type: "text", + text: "Here's an image:", + }, + { + type: "imageUrl", + imageUrl: { url: "https://example.com/image.png" }, + }, + ]); + }); + + test("processEditorContent should handle complex content with multiple elements", () => { + const codeItem = createContextItem( + "const x = 42;", + "a description", + "file:///script.ts", + ); + + const editorState: JSONContent = { + type: "doc", + content: [ + { + type: "prompt-block", + attrs: { + item: { + name: "explain", + }, + }, + }, + { + type: "paragraph", + content: [ + { + type: "text", + text: "Please explain this code and also check ", + }, + { + type: "mention", + attrs: { + id: "related", + label: "@related", + itemType: "similarFiles", + }, + }, + ], + }, + { + type: "code-block", + attrs: { + item: codeItem, + }, + }, + { + type: "paragraph", + content: [ + { + type: "text", + text: "What does this constant do?", + }, + ], + }, + { + type: "image", + attrs: { + src: "https://example.com/diagram.png", + }, + }, + ], + }; + + const result = processEditorContent(editorState); + + expect(result.slashCommandName).toBe("explain"); + expect(result.contextRequests).toEqual([{ provider: "similarFiles" }]); + expect(result.selectedCode).toHaveLength(1); + expect(result.selectedCode[0].filepath).toBe("file:///script.ts"); + + // `\n\n\`\`\`${extension} ${relativePathOrBasename}\n${contextItem.content}\n\`\`\`\n`; + + expect(result.parts).toEqual([ + { + type: "text", + text: "Please explain this code and also check @related\n\n```ts script.ts\nconst x = 42;\n```\n\nWhat does this constant do?", + }, + { + type: "imageUrl", + imageUrl: { url: "https://example.com/diagram.png" }, + }, + ]); + }); + + test("processEditorContent should merge consecutive text parts", () => { + const editorState: JSONContent = { + type: "doc", + content: [ + { + type: "paragraph", + content: [ + { + type: "text", + text: "First paragraph", + }, + ], + }, + { + type: "paragraph", + content: [ + { + type: "text", + text: "Second paragraph", + }, + ], + }, + { + type: "image", + attrs: { + src: "https://example.com/image.png", + }, + }, + { + type: "paragraph", + content: [ + { + type: "text", + text: "Third paragraph", + }, + ], + }, + ], + }; + + const result = processEditorContent(editorState); + + // First two paragraphs should be merged, but the third should be separate + // because there's an image in between + expect(result.parts).toEqual([ + { + type: "text", + text: "First paragraph\nSecond paragraph", + }, + { + type: "imageUrl", + imageUrl: { url: "https://example.com/image.png" }, + }, + { + type: "text", + text: "Third paragraph", + }, + ]); + }); + + test("processEditorContent should handle unexpected content types gracefully", () => { + // Testing with an unknown node type + const editorState: JSONContent = { + type: "doc", + content: [ + { + type: "paragraph", + content: [ + { + type: "text", + text: "Normal text", + }, + ], + }, + { + type: "unknown-type", // This type doesn't exist + content: [ + { + type: "text", + text: "This should be ignored", + }, + ], + }, + ], + }; + + // Spy on console.warn to verify it's called + const warnSpy = vi.spyOn(console, "warn").mockImplementation(() => {}); + + const result = processEditorContent(editorState); + + // Only the normal paragraph should be processed + expect(result.parts).toEqual([ + { + type: "text", + text: "Normal text", + }, + ]); + + // Console.warn should be called for the unknown type + expect(warnSpy).toHaveBeenCalledWith( + "Unexpected content type", + "unknown-type", + ); + + warnSpy.mockRestore(); + }); + + test("processEditorContent should handle missing attrs in code blocks", () => { + // Testing with a code block that has no item attribute + const editorState: JSONContent = { + type: "doc", + content: [ + { + type: "code-block", + // Missing attrs property + }, + ], + }; + + // Spy on console.warn to verify it's called + const warnSpy = vi.spyOn(console, "warn").mockImplementation(() => {}); + + const result = processEditorContent(editorState); + + // No parts should be created + expect(result.parts).toEqual([]); + expect(result.selectedCode).toEqual([]); + + // Console.warn should be called for the missing item attribute + expect(warnSpy).toHaveBeenCalledWith("codeBlock has no item attribute"); + + warnSpy.mockRestore(); + }); + + test("processEditorContent should handle paragraphs with unexpected child types", () => { + // Testing with a paragraph that has an unknown child type + const editorState: JSONContent = { + type: "doc", + content: [ + { + type: "paragraph", + content: [ + { + type: "text", + text: "Normal text ", + }, + { + type: "unknown-child", // This type doesn't exist + text: "This should be ignored", + }, + ], + }, + ], + }; + + // Spy on console.warn to verify it's called + const warnSpy = vi.spyOn(console, "warn").mockImplementation(() => {}); + + const result = processEditorContent(editorState); + + // Only the normal text should be processed + expect(result.parts).toEqual([ + { + type: "text", + text: "Normal text ", + }, + ]); + + // Console.warn should be called for the unknown child type + expect(warnSpy).toHaveBeenCalledWith( + "Unexpected child type", + "unknown-child", + ); + + warnSpy.mockRestore(); + }); +}); diff --git a/gui/src/components/mainInput/TipTapEditor/utils/processEditorContent.ts b/gui/src/components/mainInput/TipTapEditor/utils/processEditorContent.ts new file mode 100644 index 000000000..0f6f0c0e4 --- /dev/null +++ b/gui/src/components/mainInput/TipTapEditor/utils/processEditorContent.ts @@ -0,0 +1,120 @@ +import Image from "@tiptap/extension-image"; +import { Paragraph } from "@tiptap/extension-paragraph"; +import { Text } from "@tiptap/extension-text"; +import { JSONContent } from "@tiptap/react"; +import { + ContextItemWithId, + MessagePart, + RangeInFile, + TextMessagePart, +} from "core"; +import { ctxItemToRifWithContents } from "core/commands/util"; +import { getUriDescription } from "core/util/uri"; +import { CodeBlock, Mention, PromptBlock } from "../extensions"; +import { GetContextRequest } from "./types"; + +interface MentionAttrs { + label: string; + id: string; + itemType?: string; + query?: string; +} + +function resolvePromptBlock(p: JSONContent): string | undefined { + return p.attrs?.item.name; +} + +function resolveParagraph(p: JSONContent): [string, GetContextRequest[]] { + const contextRequests: GetContextRequest[] = []; + + const text = (p.content || []) + .map((child) => { + switch (child.type) { + case Text.name: + return child.text; + case Mention.name: + const attrs = child.attrs as MentionAttrs; + contextRequests.push({ + provider: + attrs.itemType === "contextProvider" ? attrs.id : attrs.itemType!, + query: attrs.query, + }); + return child.attrs?.renderInlineAs ?? child.attrs?.label; + + default: + console.warn("Unexpected child type", child.type); + return ""; + } + }) + .join("") + .trimStart(); + + return [text, contextRequests]; +} + +export function processEditorContent(editorState: JSONContent) { + const contextRequests: GetContextRequest[] = []; + const selectedCode: RangeInFile[] = []; + let slashCommandName: string | undefined; + + const parts: MessagePart[] = []; + for (const p of editorState?.content || []) { + switch (p.type) { + case PromptBlock.name: + slashCommandName = resolvePromptBlock(p); + break; + case Paragraph.name: + const [text, ctxItems] = resolveParagraph(p); + + contextRequests.push(...ctxItems); + + if (text) { + // Merge with previous text part if possible + if (parts[parts.length - 1]?.type === "text") { + (parts[parts.length - 1] as TextMessagePart).text += "\n" + text; + } else { + parts.push({ type: "text", text }); + } + } + break; + case CodeBlock.name: + if (!p.attrs?.item) { + console.warn("codeBlock has no item attribute"); + break; + } + + const contextItem = p.attrs.item as ContextItemWithId; + const rif = ctxItemToRifWithContents(contextItem, true); + selectedCode.push(rif); + + // If editing, only include in selectedCode + if (contextItem.editing) { + break; + } + + const { extension, relativePathOrBasename } = getUriDescription( + rif.filepath, + window.workspacePaths ?? [], + ); + const codeText = `\n\`\`\`${extension} ${relativePathOrBasename}\n${contextItem.content}\n\`\`\`\n`; + + if (parts[parts.length - 1]?.type === "text") { + (parts[parts.length - 1] as TextMessagePart).text += "\n" + codeText; + } else { + parts.push({ type: "text", text: codeText }); + } + break; + case Image.name: + parts.push({ + type: "imageUrl", + imageUrl: { url: p.attrs?.src }, + }); + break; + default: { + console.warn("Unexpected content type", p.type); + } + } + } + + return { parts, contextRequests, selectedCode, slashCommandName }; +} diff --git a/gui/src/components/mainInput/TipTapEditor/utils/renderMcpPrompt.ts b/gui/src/components/mainInput/TipTapEditor/utils/renderMcpPrompt.ts new file mode 100644 index 000000000..3ede7e303 --- /dev/null +++ b/gui/src/components/mainInput/TipTapEditor/utils/renderMcpPrompt.ts @@ -0,0 +1,32 @@ +import { SlashCommandDescWithSource } from "core"; +import { IIdeMessenger } from "../../../../context/IdeMessenger"; + +export async function renderMcpPrompt( + command: SlashCommandDescWithSource, + ideMessenger: IIdeMessenger, + userInput?: string, +) { + // TODO add support for mcp prompt args using command.mcpArgs + const args: { [key: string]: string } = {}; + if (command.mcpArgs) { + command.mcpArgs.forEach((arg, i) => { + args[arg.name] = ""; + }); + } + const response = await ideMessenger.request("mcp/getPrompt", { + serverName: command.mcpServerName!, + promptName: command.name, + args: args, + }); + if (response.status === "success") { + let renderedPrompt = response.content.prompt; + if (userInput) { + renderedPrompt += `\n\n${userInput}`; + } + return renderedPrompt; + } else { + throw new Error( + `Failed to get MCP prompt for slash command ${command.name}`, + ); + } +} diff --git a/gui/src/components/mainInput/TipTapEditor/utils/renderPromptv1.test.ts b/gui/src/components/mainInput/TipTapEditor/utils/renderPromptv1.test.ts new file mode 100644 index 000000000..7837e6e7d --- /dev/null +++ b/gui/src/components/mainInput/TipTapEditor/utils/renderPromptv1.test.ts @@ -0,0 +1,128 @@ +import { SlashCommandDescWithSource } from "core"; +import { beforeEach, describe, it, vi } from "vitest"; +import { + MockIdeMessenger, + MockResponseHandler, +} from "../../../../context/MockIdeMessenger"; +import { getRenderedV1Prompt } from "./renderPromptv1"; + +function getTestPromptV1Command(body: string): SlashCommandDescWithSource { + return { + prompt: body, + name: "test-prompt-name", + description: "test-prompt-description", + isLegacy: false, + source: "prompt-file-v1", + }; +} +describe("get rendered v1 prompt file", () => { + const ideMessenger = new MockIdeMessenger(); + const firstDir = ideMessenger.responses["getWorkspaceDirs"]?.[0] ?? ""; + const customGetContextItems: MockResponseHandler< + "context/getContextItems" + > = async ({ name }) => { + if (name === "diff") { + return [ + { + id: { + itemId: "id", + providerTitle: "diff", + }, + name: "name", + description: "description", + content: "Diff provider content", + }, + ]; + } + return []; + }; + beforeEach(async () => { + vi.clearAllMocks(); + ideMessenger.resetMocks(); + }); + + it("should render a prompt file with no attachments or templated input", async () => { + const rawContent = "Simple prompt with no attachments"; + const command = getTestPromptV1Command(rawContent); + const rendered = await getRenderedV1Prompt( + ideMessenger, + command, + "User input", + [], + ); + expect(rendered).toBe("Simple prompt with no attachments\n\nUser input"); + }); + + it("should render a prompt file templated input", async () => { + const rawContent = "{{{ input }}} Simple prompt with no attachments"; + const command = getTestPromptV1Command(rawContent); + const rendered = await getRenderedV1Prompt( + ideMessenger, + command, + "User input", + [], + ); + expect(rendered).toBe("User input Simple prompt with no attachments"); + }); + + it("Should handle file attachments", async () => { + ideMessenger.responses["readFile"] = "Test file content"; + const rawContent = "Content with URL {{{ testFile.txt }}}"; + const command = getTestPromptV1Command(rawContent); + const rendered = await getRenderedV1Prompt( + ideMessenger, + command, + "User input", + [], + ); + expect(rendered).toBe("Content with URL Test file content\n\nUser input"); + }); + + it("should handle supported providers", async () => { + ideMessenger.responseHandlers["context/getContextItems"] = + customGetContextItems; + const rawContent = "Tell me about {{{ diff }}} please"; + const command = getTestPromptV1Command(rawContent); + const rendered = await getRenderedV1Prompt( + ideMessenger, + command, + "User input", + [], + ); + expect(rendered).toBe( + "Tell me about Diff provider content please\n\nUser input", + ); + }); + + it("should render file read errors within prompt", async () => { + ideMessenger.responses["fileExists"] = false; + const rawContent = "Content with provider {{{ nonexistent }}}"; + const command = getTestPromptV1Command(rawContent); + const rendered = await getRenderedV1Prompt( + ideMessenger, + command, + "User input", + [], + ); + expect(rendered).toBe( + `Content with provider [Error reading file "nonexistent"]\n\nUser input`, + ); + }); + + it("should handle multiple attachments", async () => { + ideMessenger.responseHandlers["context/getContextItems"] = + customGetContextItems; + ideMessenger.responses["readFile"] = "Test file content"; + const rawContent = "Content with {{{ diff }}} and {{{ file.txt }}}"; + const command = getTestPromptV1Command(rawContent); + const rendered = await getRenderedV1Prompt( + ideMessenger, + command, + "User input", + [], + ); + expect(rendered).toBe( + "Content with Diff provider content and Test file content\n\nUser input", + ); + }); +}); diff --git a/gui/src/components/mainInput/TipTapEditor/utils/renderPromptv1.ts b/gui/src/components/mainInput/TipTapEditor/utils/renderPromptv1.ts new file mode 100644 index 000000000..3721ab213 --- /dev/null +++ b/gui/src/components/mainInput/TipTapEditor/utils/renderPromptv1.ts @@ -0,0 +1,58 @@ +import { + ContextProviderName, + RangeInFile, + SlashCommandDescWithSource, +} from "core"; +import { SUPPORTED_PROMPT_CONTEXT_PROVIDERS } from "core/promptFiles"; +import { renderTemplatedString } from "core/util/handlebars/renderTemplatedString"; +import { resolveRelativePathInDir } from "core/util/ideUtils"; +import { IIdeMessenger } from "../../../../context/IdeMessenger"; + +export async function getRenderedV1Prompt( + ideMessenger: IIdeMessenger, + command: SlashCommandDescWithSource, + userInput: string, + selectedCode: RangeInFile[], +): Promise { + if (!command.prompt) { + return ""; + } + const handleBarHelpers = SUPPORTED_PROMPT_CONTEXT_PROVIDERS.map( + (name: ContextProviderName): [string, Handlebars.HelperDelegate] => [ + name, + async (helperContext: any) => { + const response = await ideMessenger.request("context/getContextItems", { + fullInput: userInput, + name, + query: "", + selectedCode, + }); + if (response.status === "success") { + return response.content.map((item) => item.content).join("\n\n"); + } else { + throw new Error( + `Failed to get context items from provider "${name}": ${response.error}`, + ); + } + }, + ], + ); + const workspaceDirs = await ideMessenger.ide.getWorkspaceDirs(); + const getUriFromPath = (path: string) => { + return resolveRelativePathInDir(path, ideMessenger.ide, workspaceDirs); + }; + const handlebars = await import("handlebars"); + let rendered = await renderTemplatedString( + handlebars, + command.prompt, + { input: userInput }, + handleBarHelpers, + ideMessenger.ide.readFile.bind(ideMessenger.ide), + getUriFromPath, + ); + // For prompt file append the input if it isn't rendered + if (!rendered.includes(userInput)) { + rendered = rendered + `\n\n${userInput}`; + } + return rendered.trim(); +} diff --git a/gui/src/components/mainInput/TipTapEditor/utils/renderPromptv2.test.ts b/gui/src/components/mainInput/TipTapEditor/utils/renderPromptv2.test.ts new file mode 100644 index 000000000..b99b8279a --- /dev/null +++ b/gui/src/components/mainInput/TipTapEditor/utils/renderPromptv2.test.ts @@ -0,0 +1,80 @@ +import { SlashCommandDescWithSource } from "core"; +import { beforeEach, describe, expect, it, vi } from "vitest"; +import { MockIdeMessenger } from "../../../../context/MockIdeMessenger"; +import { getPromptV2ContextRequests } from "./renderPromptv2"; + +function getTestPromptV2Command(body: string): SlashCommandDescWithSource { + return { + prompt: body, + name: "test-prompt-name", + description: "test-prompt-description", + isLegacy: false, + source: "prompt-file-v2", + }; +} +describe("getPromptV2ContextRequests", () => { + const ideMessenger = new MockIdeMessenger(); + const firstDir = ideMessenger.responses["getWorkspaceDirs"]?.[0] ?? ""; + beforeEach(async () => { + vi.clearAllMocks(); + ideMessenger.resetMocks(); + }); + + it("should render a prompt file with no attachments", async () => { + const rawContent = "Simple prompt with no attachments"; + const command = getTestPromptV2Command(rawContent); + const requests = await getPromptV2ContextRequests(ideMessenger, command); + expect(requests).toHaveLength(0); + }); + + it("should handle URL attachments", async () => { + const rawContent = "Content with URL @https://example.com"; + const command = getTestPromptV2Command(rawContent); + const requests = await getPromptV2ContextRequests(ideMessenger, command); + expect(requests).toHaveLength(1); + expect(requests[0].provider).toBe("url"); + expect(requests[0].query).toBe("https://example.com"); + }); + + it("should resolve file attachments", async () => { + const rawContent = "Content with file attachment @test.txt"; + const command = getTestPromptV2Command(rawContent); + const requests = await getPromptV2ContextRequests(ideMessenger, command); + + expect(requests).toHaveLength(1); + expect(requests[0].provider).toBe("file"); + expect(requests[0].query).toBe(`${firstDir}/test.txt`); + }); + + it("should handle nested prompt files", async () => { + ideMessenger.responses["readFile"] = "Contents @myfile.txt"; + const rawContent = "Main prompt with nested @test.prompt"; + const command = getTestPromptV2Command(rawContent); + const requests = await getPromptV2ContextRequests(ideMessenger, command); + expect(requests).toHaveLength(2); + expect(requests[0].provider).toBe("file"); + expect(requests[0].query).toBe(`${firstDir}/myfile.txt`); + expect(requests[1].provider).toBe("file"); + expect(requests[1].query).toBe(`${firstDir}/test.prompt`); + }); + + it("should ignore unsupported providers", async () => { + ideMessenger.responses["fileExists"] = false; + const rawContent = "Content with custom provider @unsupported"; + const command = getTestPromptV2Command(rawContent); + const requests = await getPromptV2ContextRequests(ideMessenger, command); + expect(requests).toHaveLength(0); + }); + + it("should handle multiple attachments", async () => { + const rawContent = "Content with @file1.txt and @file2.txt"; + const command = getTestPromptV2Command(rawContent); + const requests = await getPromptV2ContextRequests(ideMessenger, command); + + expect(requests).toHaveLength(2); + expect(requests[0].provider).toBe("file"); + expect(requests[0].query).toBe(`${firstDir}/file1.txt`); + expect(requests[1].provider).toBe("file"); + expect(requests[1].query).toBe(`${firstDir}/file2.txt`); + }); +}); diff --git a/gui/src/components/mainInput/TipTapEditor/utils/renderPromptv2.ts b/gui/src/components/mainInput/TipTapEditor/utils/renderPromptv2.ts new file mode 100644 index 000000000..afc6c2e2c --- /dev/null +++ b/gui/src/components/mainInput/TipTapEditor/utils/renderPromptv2.ts @@ -0,0 +1,69 @@ +import { SlashCommandDescWithSource } from "core"; +import { SUPPORTED_PROMPT_CONTEXT_PROVIDERS } from "core/promptFiles"; +import { resolveRelativePathInDir } from "core/util/ideUtils"; +import { IIdeMessenger } from "../../../../context/IdeMessenger"; +import { GetContextRequest } from "./types"; + +export async function getPromptV2ContextRequests( + ideMessenger: IIdeMessenger, + command: SlashCommandDescWithSource, +): Promise { + if (!command.prompt) { + return []; + } + const workspaceDirs = await ideMessenger.ide.getWorkspaceDirs(); + const visitedFiles = new Set(); + if (command.promptFile) { + visitedFiles.add(command.promptFile); + } + + const contextRequests: GetContextRequest[] = []; + + async function addContextRequestsRecursive(promptBody: string) { + // Files + const templateMatches = promptBody.matchAll(/@([^\s]+)/g); + for (const match of templateMatches) { + const name = match[1]; + + if (SUPPORTED_PROMPT_CONTEXT_PROVIDERS.includes(name)) { + contextRequests.push({ + provider: name, + }); + continue; + } + + // URLs + if (name.startsWith("http")) { + contextRequests.push({ + provider: "url", + query: name, + }); + continue; + } + + // Files + const resolvedFileUri = await resolveRelativePathInDir( + match[1], + ideMessenger.ide, + workspaceDirs, + ); + if (resolvedFileUri) { + const contents = await ideMessenger.ide.readFile(resolvedFileUri); + if (name.endsWith(".prompt")) { + if (visitedFiles.has(resolvedFileUri)) { + return []; + } + visitedFiles.add(resolvedFileUri); + // As well as any context providers it references + await addContextRequestsRecursive(contents); + } + contextRequests.push({ + provider: "file", + query: resolvedFileUri, + }); + } + } + } + await addContextRequestsRecursive(command.prompt); + return contextRequests; +} diff --git a/gui/src/components/mainInput/TipTapEditor/utils/renderSlashCommand.ts b/gui/src/components/mainInput/TipTapEditor/utils/renderSlashCommand.ts new file mode 100644 index 000000000..8da2ed89d --- /dev/null +++ b/gui/src/components/mainInput/TipTapEditor/utils/renderSlashCommand.ts @@ -0,0 +1,145 @@ +import { MessagePart, RangeInFile, SlashCommandDescWithSource } from "core"; +import { stripImages } from "core/util/messageContent"; +import { IIdeMessenger } from "../../../../context/IdeMessenger"; +import { renderMcpPrompt } from "./renderMcpPrompt"; +import { getRenderedV1Prompt } from "./renderPromptv1"; +import { getPromptV2ContextRequests } from "./renderPromptv2"; +import { GetContextRequest } from "./types"; + +/* +Slash commands can come from many sources. Render based on the source. +*/ +export async function renderSlashCommandPrompt( + ideMessenger: IIdeMessenger, + commandName: string | undefined, + parts: MessagePart[], + availableSlashCommands: SlashCommandDescWithSource[], + selectedCode: RangeInFile[], +): Promise<{ + slashedParts: MessagePart[]; + legacyCommandWithInput?: { + command: SlashCommandDescWithSource; + input: string; + }; + contextRequests: GetContextRequest[]; +}> { + const NO_COMMAND = { + slashedParts: parts, + legacyCommandWithInput: undefined, + contextRequests: [], + }; + if (!commandName) { + return NO_COMMAND; + } + const command = availableSlashCommands.find((c) => c.name === commandName); + if (!command) { + return NO_COMMAND; + } + + const nonTextParts = parts.filter((part) => part.type !== "text"); + const textParts = parts.filter((part) => part.type === "text"); + const slashedParts: MessagePart[] = [...nonTextParts]; + + const userInput = stripImages(textParts).trimStart(); + + const legacyCommandWithInput = command.isLegacy + ? { + command, + input: userInput, + } + : undefined; + + const contextRequests: GetContextRequest[] = []; + + switch (command.source) { + case "built-in-legacy": + case "config-ts-slash-command": + /** + * For legacy slash commands, we simply insert the text "/{name}" in front of the message + * And then parsing for this is done in core + */ + slashedParts.push({ + type: "text", + text: `/${command.name}${command.prompt ? " " + command.prompt : ""}${userInput ? " " + userInput : ""}`, + }); + break; + case "mcp-prompt": + const renderedMcpPrompt = await renderMcpPrompt( + command, + ideMessenger, + userInput, + ); + slashedParts.push({ + type: "text", + text: renderedMcpPrompt, + }); + break; + case "prompt-file-v1": + case "prompt-file-v2": + case "yaml-prompt-block": + case "invokable-rule": + if (!command.prompt) { + console.warn(`Invalid/empty prompt from slash command ${command.name}`); + break; + } + let renderedPrompt: string; + if ( + command.source === "prompt-file-v1" || + command.prompt.includes("{{{ input }}}") + ) { + renderedPrompt = await getRenderedV1Prompt( + ideMessenger, + command, + userInput, + selectedCode, + ); + } else { + const promptFileCtxRequests = await getPromptV2ContextRequests( + ideMessenger, + command, + ); + contextRequests.push(...promptFileCtxRequests); + renderedPrompt = [command.prompt, userInput].join("\n\n").trim(); + } + + if (renderedPrompt) { + slashedParts.push({ + type: "text", + text: renderedPrompt, // Includes user input + }); + } else { + console.warn( + `Invalid/empty prompt + input from slash command ${command.name}`, + ); + } + + break; + case "built-in": + case "json-custom-command": + if (!command.prompt) { + console.warn(`Slash command ${command.name} is missing prompt`); + break; + } + let rendered = command.prompt; + if (userInput) { + rendered += `\n\n${userInput}`; + } + if (rendered) { + slashedParts.push({ + type: "text", + text: rendered, + }); + } else { + console.warn( + `Invalid/empty prompt + input from slash command ${command.name}`, + ); + } + default: + break; + } + return { + slashedParts, + legacyCommandWithInput, + contextRequests, + }; +} diff --git a/gui/src/components/mainInput/TipTapEditor/utils/resolveEditorContent.ts b/gui/src/components/mainInput/TipTapEditor/utils/resolveEditorContent.ts index 958ea2331..85f6797b5 100644 --- a/gui/src/components/mainInput/TipTapEditor/utils/resolveEditorContent.ts +++ b/gui/src/components/mainInput/TipTapEditor/utils/resolveEditorContent.ts @@ -1,7 +1,4 @@ import { Dispatch } from "@reduxjs/toolkit"; -import Image from "@tiptap/extension-image"; -import { Paragraph } from "@tiptap/extension-paragraph"; -import { Text } from "@tiptap/extension-text"; import { JSONContent } from "@tiptap/react"; import { ContextItemWithId, @@ -10,44 +7,35 @@ import { MessageContent, MessagePart, RangeInFile, - SlashCommandDescription, - TextMessagePart, + SlashCommandDescWithSource, } from "core"; -import { ctxItemToRifWithContents } from "core/commands/util"; -import { renderChatMessage, stripImages } from "core/util/messageContent"; -import { getUriFileExtension } from "core/util/uri"; +import { stripImages } from "core/util/messageContent"; import { IIdeMessenger } from "../../../../context/IdeMessenger"; import { setIsGatheringContext } from "../../../../redux/slices/sessionSlice"; -import { CodeBlock, Mention, PromptBlock } from "../extensions"; - -interface MentionAttrs { - label: string; - id: string; - itemType?: string; - query?: string; -} +import { processEditorContent } from "./processEditorContent"; +import { renderSlashCommandPrompt } from "./renderSlashCommand"; +import { GetContextRequest } from "./types"; interface ResolveEditorContentInput { editorState: JSONContent; modifiers: InputModifiers; ideMessenger: IIdeMessenger; defaultContextProviders: DefaultContextProvider[]; - availableSlashCommands: SlashCommandDescription[]; + availableSlashCommands: SlashCommandDescWithSource[]; dispatch: Dispatch; } -type ResolveEditorContentOutput = [ - ContextItemWithId[], - RangeInFile[], - MessageContent, - ( +interface ResolveEditorContentOutput { + selectedContextItems: ContextItemWithId[]; + selectedCode: RangeInFile[]; + content: MessageContent; + legacyCommandWithInput: | { - command: SlashCommandDescription; + command: SlashCommandDescWithSource; input: string; } - | undefined - ), -]; + | undefined; +} /** * This function converts the input from the editor to a string, resolving any context items @@ -61,26 +49,43 @@ export async function resolveEditorContent({ availableSlashCommands, dispatch, }: ResolveEditorContentInput): Promise { - const { parts, contextItemAttrs, selectedCode, slashCommandName } = - processEditorContent(editorState); - - const slashCommandWithInput = processSlashCommand( - slashCommandName, - availableSlashCommands, + const { parts, + contextRequests: editorContextRequests, + selectedCode, + slashCommandName, + } = processEditorContent(editorState); + + const { + slashedParts, + contextRequests: slashContextRequests, + legacyCommandWithInput, + } = await renderSlashCommandPrompt( + ideMessenger, + slashCommandName, + parts, + availableSlashCommands, + selectedCode, ); - const shouldGatherContext = modifiers.useCodebase || slashCommandWithInput; + const contextRequests = [...editorContextRequests, ...slashContextRequests]; + + const shouldGatherContext = + defaultContextProviders.length > 0 || + modifiers.useCodebase || + !modifiers.noContext || + contextRequests.length > 0; + if (shouldGatherContext) { dispatch(setIsGatheringContext(true)); } - const contextItems = await gatherContextItems({ - contextItemAttrs, + const selectedContextItems = await gatherContextItems({ + contextRequests, modifiers, ideMessenger, defaultContextProviders, - parts, + parts: slashedParts, selectedCode, }); @@ -88,140 +93,11 @@ export async function resolveEditorContent({ dispatch(setIsGatheringContext(false)); } - return [contextItems, selectedCode, parts, slashCommandWithInput]; -} - -/** - * Processes editor content and extracts parts, context items, code, and slash commands - */ -function processEditorContent(editorState: JSONContent) { - const contextItemAttrs: MentionAttrs[] = []; - const selectedCode: RangeInFile[] = []; - let slashCommandName: string | undefined; - - const parts = (editorState?.content || []).reduce( - (parts, p) => { - switch (p.type) { - case PromptBlock.name: { - slashCommandName = resvolePromptBlock(p); - } - - case Paragraph.name: { - const [text, ctxItems] = resolveParagraph(p); - - contextItemAttrs.push(...ctxItems); - - if (!text) return parts; - - // Merge with previous text part if possible - if (parts[parts.length - 1]?.type === "text") { - (parts[parts.length - 1] as TextMessagePart).text += "\n" + text; - return parts; - } - - return [...parts, { type: "text", text }]; - } - - case CodeBlock.name: { - if (!p.attrs?.item) { - console.warn("codeBlock has no item attribute"); - return parts; - } - - const contextItem = p.attrs.item as ContextItemWithId; - const rif = ctxItemToRifWithContents(contextItem, true); - selectedCode.push(rif); - - // If editing, only include in selectedCode - if (contextItem.editing) { - return parts; - } - - const fileExtension = getUriFileExtension(rif.filepath); - const codeText = [ - "\n\n```", - fileExtension, - " ", - contextItem.description, - "\n", - contextItem.content, - "\n```", - ].join(""); - - if (parts[parts.length - 1]?.type === "text") { - (parts[parts.length - 1] as TextMessagePart).text += - "\n" + codeText; - return parts; - } - - return [...parts, { type: "text", text: codeText }]; - } - - case Image.name: { - return [ - ...parts, - { - type: "imageUrl", - imageUrl: { url: p.attrs?.src }, - }, - ]; - } - - default: { - console.warn("Unexpected content type", p.type); - return parts; - } - } - }, - [], - ); - - return { parts, contextItemAttrs, selectedCode, slashCommandName }; -} - -/** - * Processes slash commands and prepares the command with input - */ -function processSlashCommand( - slashCommandName: string | undefined, - availableSlashCommands: SlashCommandDescription[], - parts: MessagePart[], -): { command: SlashCommandDescription; input: string } | undefined { - if (!slashCommandName) return; - - const command = availableSlashCommands.find( - (c) => c.name === slashCommandName, - ); - - if (!command) return; - - const lastTextIndex = findLastIndex(parts, (part) => part.type === "text"); - const lastTextPart = parts[lastTextIndex] as TextMessagePart; - - const originalPrompt = command.prompt ? " " + command.prompt : ""; - - let input: string; - - /** - * Although we no longer render slash command tags from the editor, - * we are inserting a slash command style text back into the text here. - * This is a a hack, but there's a number of assumptions in `core` that there - * is slash command text at the beginning of the text in order to process slash commands. - */ - if (lastTextPart) { - input = renderChatMessage({ - role: "user", - content: lastTextPart.text, - }).trimStart(); - lastTextPart.text = `/${command.name}${originalPrompt} ${lastTextPart.text}`; - } else { - input = ""; - parts.push({ type: "text", text: `/${command.name}${originalPrompt}` }); - } - return { - command, - input, + selectedContextItems, + selectedCode, + content: slashedParts, + legacyCommandWithInput, }; } @@ -229,26 +105,44 @@ function processSlashCommand( * Gathers context items from various sources */ async function gatherContextItems({ - contextItemAttrs, + contextRequests, modifiers, ideMessenger, defaultContextProviders, parts, selectedCode, }: { - contextItemAttrs: MentionAttrs[]; + contextRequests: GetContextRequest[]; modifiers: InputModifiers; ideMessenger: IIdeMessenger; defaultContextProviders: DefaultContextProvider[]; parts: MessagePart[]; selectedCode: RangeInFile[]; }): Promise { + const defaultRequests: GetContextRequest[] = defaultContextProviders.map( + (def) => ({ + provider: def.name, + query: def.query, + }), + ); + const withDefaults = [...contextRequests, ...defaultRequests]; + const deduplicatedInputs = withDefaults.reduce( + (acc, item) => { + if ( + !acc.some((i) => i.provider === item.provider && i.query === item.query) + ) { + acc.push(item); + } + return acc; + }, + [], + ); let contextItems: ContextItemWithId[] = []; // Process context item attributes - for (const item of contextItemAttrs) { + for (const item of deduplicatedInputs) { const result = await ideMessenger.request("context/getContextItems", { - name: item.itemType === "contextProvider" ? item.id : item.itemType!, + name: item.provider, query: item.query ?? "", fullInput: stripImages(parts), selectedCode, @@ -259,7 +153,10 @@ async function gatherContextItems({ } // cmd+enter to use codebase - if (modifiers.useCodebase) { + if ( + modifiers.useCodebase && + !deduplicatedInputs.some((item) => item.provider === "codebase") + ) { const result = await ideMessenger.request("context/getContextItems", { name: "codebase", query: "", @@ -272,62 +169,51 @@ async function gatherContextItems({ } } - // Include default context providers - const defaultContextItems = await Promise.all( - defaultContextProviders.map(async (provider) => { - const result = await ideMessenger.request("context/getContextItems", { - name: provider.name, - query: provider.query ?? "", - fullInput: stripImages(parts), - selectedCode, - }); - if (result.status === "success") { - return result.content; - } else { - return []; + // noContext modifier adds currently open file if it's not already present + if ( + !modifiers.noContext && + !deduplicatedInputs.some((item) => item.provider === "currentFile") + ) { + const currentFileResponse = await ideMessenger.request( + "context/getContextItems", + { + name: "currentFile", + query: "non-mention-usage", + fullInput: "", + selectedCode: [], + }, + ); + if (currentFileResponse.status === "success") { + const currentFile = currentFileResponse.content[0]; + if (currentFile.uri?.value) { + currentFile.id = { + providerTitle: "file", + itemId: currentFile.uri.value, + }; + contextItems.unshift(currentFile); } - }), - ); - contextItems.push(...defaultContextItems.flat()); - - return contextItems; -} - -function findLastIndex( - array: T[], - predicate: (value: T, index: number, obj: T[]) => boolean, -): number { - for (let i = array.length - 1; i >= 0; i--) { - if (predicate(array[i], i, array)) { - return i; } } - return -1; // if no element satisfies the predicate -} -function resvolePromptBlock(p: JSONContent): string | undefined { - return p.attrs?.item.name; -} - -function resolveParagraph(p: JSONContent): [string, MentionAttrs[]] { - const contextItems: MentionAttrs[] = []; - - const text = (p.content || []) - .map((child) => { - switch (child.type) { - case Text.name: - return child.text; - case Mention.name: - contextItems.push(child.attrs as MentionAttrs); - return child.attrs?.renderInlineAs ?? child.attrs?.label; - - default: - console.warn("Unexpected child type", child.type); - return ""; + // Deduplicates based on either providerTitle + itemId or uri type + value + const deduplicatedOutputs = contextItems.reduce( + (acc, item) => { + if ( + !acc.some( + (i) => + (i.id.providerTitle === item.id.providerTitle && + i.id.itemId === item.id.itemId) || + (i.uri && + item.uri && + i.uri.type === item.uri.type && + i.uri.value === item.uri.value), + ) + ) { + acc.push(item); } - }) - .join("") - .trimStart(); - - return [text, contextItems]; + return acc; + }, + [], + ); + return deduplicatedOutputs; } diff --git a/gui/src/components/mainInput/TipTapEditor/utils/types.ts b/gui/src/components/mainInput/TipTapEditor/utils/types.ts new file mode 100644 index 000000000..dbfe80fae --- /dev/null +++ b/gui/src/components/mainInput/TipTapEditor/utils/types.ts @@ -0,0 +1,4 @@ +export interface GetContextRequest { + provider: string; + query?: string; +} diff --git a/gui/src/components/mainInput/belowMainInput/ContextItemsPeek.tsx b/gui/src/components/mainInput/belowMainInput/ContextItemsPeek.tsx index 3c7ce9390..73317d20e 100644 --- a/gui/src/components/mainInput/belowMainInput/ContextItemsPeek.tsx +++ b/gui/src/components/mainInput/belowMainInput/ContextItemsPeek.tsx @@ -4,7 +4,10 @@ import { ctxItemToRifWithContents } from "core/commands/util"; import { getUriPathBasename } from "core/util/uri"; import { ComponentType, useContext, useMemo } from "react"; import { AnimatedEllipsis } from "../.."; -import { IdeMessengerContext } from "../../../context/IdeMessenger"; +import { + IdeMessengerContext, + IIdeMessenger, +} from "../../../context/IdeMessenger"; import { useAppSelector } from "../../../redux/hooks"; import { selectIsGatheringContext } from "../../../redux/slices/sessionSlice"; import FileIcon from "../../FileIcon"; @@ -24,33 +27,36 @@ interface ContextItemsPeekItemProps { contextItem: ContextItemWithId; } +export function openContextItem( + contextItem: ContextItemWithId, + ideMessenger: IIdeMessenger, +) { + const { uri, name, content } = contextItem; + + if (uri && uri?.type === "file") { + const isRangeInFile = name.includes(" (") && name.endsWith(")"); + + if (isRangeInFile) { + const rif = ctxItemToRifWithContents(contextItem, true); + void ideMessenger.ide.showLines( + rif.filepath, + rif.range.start.line, + rif.range.end.line, + ); + } else { + void ideMessenger.ide.openFile(uri.value); + } + } else { + void ideMessenger.ide.showVirtualFile(name, content); + } +} + export function ContextItemsPeekItem({ contextItem, }: ContextItemsPeekItemProps) { const ideMessenger = useContext(IdeMessengerContext); const isUrl = contextItem.uri?.type === "url"; - function openContextItem() { - const { uri, name, content } = contextItem; - - if (uri && uri?.type === "file") { - const isRangeInFile = name.includes(" (") && name.endsWith(")"); - - if (isRangeInFile) { - const rif = ctxItemToRifWithContents(contextItem, true); - void ideMessenger.ide.showLines( - rif.filepath, - rif.range.start.line, - rif.range.end.line, - ); - } else { - void ideMessenger.ide.openFile(uri.value); - } - } else { - void ideMessenger.ide.showVirtualFile(name, content); - } - } - function getContextItemIcon() { const dimensions = "18px"; @@ -116,7 +122,7 @@ export function ContextItemsPeekItem({ return (
openContextItem(contextItem, ideMessenger)} className="group mr-2 flex cursor-pointer items-center overflow-hidden text-ellipsis whitespace-nowrap rounded px-1.5 py-1 text-xs hover:bg-white/10" data-testid="context-items-peek-item" > diff --git a/gui/src/components/modelSelection/platform/AssistantSelect.tsx b/gui/src/components/modelSelection/platform/AssistantSelect.tsx deleted file mode 100644 index d360abce4..000000000 --- a/gui/src/components/modelSelection/platform/AssistantSelect.tsx +++ /dev/null @@ -1,388 +0,0 @@ -import { - ArrowPathIcon, - ArrowTopRightOnSquareIcon, - BuildingOfficeIcon, - ChevronDownIcon, - Cog6ToothIcon, - ExclamationTriangleIcon, - PlusIcon, -} from "@heroicons/react/24/outline"; -import type { ProfileDescription } from "core/config/ConfigHandler"; -import { useContext, useEffect, useMemo, useRef, useState } from "react"; -import { useNavigate } from "react-router-dom"; -import { useAuth } from "../../../context/Auth"; -import { IdeMessengerContext } from "../../../context/IdeMessenger"; -import { useAppDispatch, useAppSelector } from "../../../redux/hooks"; -import { - selectCurrentOrg, - setSelectedOrgId, - setSelectedProfile, -} from "../../../redux/slices/profilesSlice"; -import { - fontSize, - getMetaKeyLabel, - isLocalProfile, - isMetaEquivalentKeyPressed, -} from "../../../util"; -import { cn } from "../../../util/cn"; -import { ROUTES } from "../../../util/navigation"; -import { useLump } from "../../mainInput/Lump/LumpContext"; -import { - Listbox, - ListboxButton, - ListboxOption, - ListboxOptions, - Transition, - useFontSize, -} from "../../ui"; -import AssistantIcon from "./AssistantIcon"; -interface AssistantSelectOptionProps { - profile: ProfileDescription; - selected: boolean; - onClick: () => void; -} - -const AssistantSelectOption = ({ - profile, - selected, - onClick, -}: AssistantSelectOptionProps) => { - const tinyFont = useFontSize(-4); - - const navigate = useNavigate(); - const { setSelectedSection } = useLump(); - - const hasFatalErrors = useMemo(() => { - return !!profile.errors?.find((error) => error.fatal); - }, [profile.errors]); - - const dispatch = useAppDispatch(); - const ideMessenger = useContext(IdeMessengerContext); - - function handleOptionClick() { - // optimistic update - dispatch(setSelectedProfile(profile.id)); - // notify core which will handle actual update - ideMessenger.post("didChangeSelectedProfile", { - id: profile.id, - }); - onClick(); - } - - function handleConfigure() { - ideMessenger.post("config/openProfile", { profileId: profile.id }); - onClick(); - } - - function handleClickError() { - if (profile.id === "local") { - navigate(ROUTES.HOME); - setSelectedSection("error"); - } else { - ideMessenger.post("config/openProfile", { profileId: profile.id }); - } - onClick(); - } - - return ( - -
-
-
-
- -
- - {profile.title} - -
-
- {profile.errors && profile.errors?.length > 0 && ( - { - e.preventDefault(); - e.stopPropagation(); - handleClickError(); - }} - /> - )} - {isLocalProfile(profile) ? ( - { - e.stopPropagation(); - e.preventDefault(); - handleConfigure(); - }} - /> - ) : ( - { - e.stopPropagation(); - e.preventDefault(); - handleConfigure(); - }} - /> - )} -
-
-
-
- ); -}; - -export default function AssistantSelect() { - const dispatch = useAppDispatch(); - const buttonRef = useRef(null); - const currentOrg = useAppSelector(selectCurrentOrg); - const orgs = useAppSelector((store) => store.profiles.organizations); - const ideMessenger = useContext(IdeMessengerContext); - const { isToolbarExpanded } = useLump(); - const [loading, setLoading] = useState(false); - const { profiles, session, login, selectedProfile, refreshProfiles } = - useAuth(); - - function close() { - if (buttonRef.current) { - buttonRef.current.click(); - } - } - function onNewAssistant() { - ideMessenger.post("controlPlane/openUrl", { - path: "new", - orgSlug: currentOrg?.slug, - }); - close(); - } - - useEffect(() => { - let lastToggleTime = 0; - const DEBOUNCE_MS = 800; - - const handleKeyDown = (event: KeyboardEvent) => { - if ( - event.key === "'" && - isMetaEquivalentKeyPressed(event as any) && - event.shiftKey - ) { - const now = Date.now(); - - if (now - lastToggleTime >= DEBOUNCE_MS) { - lastToggleTime = now; - - const profileIds = profiles?.map((profile) => profile.id) ?? []; - // In case of 1 or 0 profiles just does nothing - if (profileIds.length < 2) { - return; - } - let nextId = profileIds[0]; - if (selectedProfile) { - const curIndex = profileIds.indexOf(selectedProfile.id); - const nextIndex = (curIndex + 1) % profileIds.length; - nextId = profileIds[nextIndex]; - } - // Optimistic update - dispatch(setSelectedProfile(nextId)); - ideMessenger.post("didChangeSelectedProfile", { - id: nextId, - }); - } - } - }; - - window.addEventListener("keydown", handleKeyDown); - return () => { - window.removeEventListener("keydown", handleKeyDown); - }; - }, [currentOrg, selectedProfile]); - - const cycleOrgs = () => { - if (!session) { - void login(false); - return; - } - - const orgIds = orgs.map((org) => org.id); - if (orgIds.length < 2) { - return; - } - let nextId = orgIds[0]; - if (currentOrg) { - const curIndex = orgIds.indexOf(currentOrg.id); - const nextIndex = (curIndex + 1) % orgIds.length; - nextId = orgIds[nextIndex]; - } - // Optimistic update - dispatch(setSelectedOrgId(nextId)); - ideMessenger.post("didChangeSelectedOrg", { - id: nextId, - }); - }; - - const tinyFont = useFontSize(-4); - const smallFont = useFontSize(-3); - - if (!selectedProfile) { - return ( -
{ - void ideMessenger.request("controlPlane/openUrl", { - path: "/new?type=assistant", - orgSlug: currentOrg?.slug, - }); - }} - className="text-description flex cursor-pointer select-none items-center gap-1" - style={{ fontSize: smallFont }} - > - - - Create your first assistant - -
- ); - } - - return ( - -
- -
-
- -
- - {selectedProfile.title} - -
-
- - - -
- Assistants -
{ - e.stopPropagation(); - setLoading(true); - await refreshProfiles(); - setLoading(false); - buttonRef.current?.click(); - }} - > - -
-
- -
- {profiles?.map((profile, idx) => { - return ( - - ); - })} -
- -
-
- login(false)} - > -
- - New Assistant -
-
-
- -
- - {getMetaKeyLabel()} ⇧ ' to toggle - -
- {currentOrg?.iconUrl ? ( - - ) : ( - - )} - - {currentOrg?.name || "Personal"} - -
-
-
-
-
-
-
- ); -} diff --git a/gui/src/context/Auth.tsx b/gui/src/context/Auth.tsx index 99f0998da..6e95cf6b5 100644 --- a/gui/src/context/Auth.tsx +++ b/gui/src/context/Auth.tsx @@ -10,16 +10,15 @@ import React, { useEffect, useState, } from "react"; -import ConfirmationDialog from "../components/dialogs/ConfirmationDialog"; import { useWebviewListener } from "../hooks/useWebviewListener"; import { useAppDispatch, useAppSelector } from "../redux/hooks"; +import { setConfigLoading } from "../redux/slices/configSlice"; import { selectCurrentOrg, selectSelectedProfile, setOrganizations, setSelectedOrgId, } from "../redux/slices/profilesSlice"; -import { setDialogMessage, setShowDialog } from "../redux/slices/uiSlice"; import { IdeMessengerContext } from "./IdeMessenger"; interface AuthContextType { @@ -52,8 +51,8 @@ export const AuthProvider: React.FC<{ children: React.ReactNode }> = ({ const selectedProfile = useAppSelector(selectSelectedProfile); const login: AuthContextType["login"] = (useOnboarding: boolean) => { - return new Promise((resolve) => { - ideMessenger + return new Promise(async (resolve) => { + await ideMessenger .request("getControlPlaneSessionInfo", { silent: false, useOnboarding, @@ -73,27 +72,10 @@ export const AuthProvider: React.FC<{ children: React.ReactNode }> = ({ }; const logout = () => { - dispatch(setShowDialog(true)); - dispatch( - setDialogMessage( - { - ideMessenger.post("logoutOfControlPlane", undefined); - dispatch( - setOrganizations(orgs.filter((org) => org.id === "personal")), - ); - dispatch(setSelectedOrgId("personal")); - setSession(undefined); - }} - onCancel={() => { - dispatch(setDialogMessage(undefined)); - dispatch(setShowDialog(false)); - }} - />, - ), - ); + ideMessenger.post("logoutOfControlPlane", undefined); + dispatch(setOrganizations(orgs.filter((org) => org.id === "personal"))); + dispatch(setSelectedOrgId("personal")); + setSession(undefined); }; useEffect(() => { @@ -113,17 +95,21 @@ export const AuthProvider: React.FC<{ children: React.ReactNode }> = ({ "sessionUpdate", async (data) => { setSession(data.sessionInfo); + void refreshProfiles(); }, [], ); const refreshProfiles = useCallback(async () => { try { + dispatch(setConfigLoading(true)); await ideMessenger.request("config/refreshProfiles", undefined); ideMessenger.post("showToast", ["info", "Config refreshed"]); } catch (e) { console.error("Failed to refresh profiles", e); ideMessenger.post("showToast", ["error", "Failed to refresh config"]); + } finally { + dispatch(setConfigLoading(false)); } }, [ideMessenger]); diff --git a/gui/src/context/MockIdeMessenger.ts b/gui/src/context/MockIdeMessenger.ts index 0e92384f1..f144653eb 100644 --- a/gui/src/context/MockIdeMessenger.ts +++ b/gui/src/context/MockIdeMessenger.ts @@ -1,7 +1,6 @@ -import { IDE, PromptLog } from "core"; +import { ChatMessage, IDE, PromptLog } from "core"; import { AuthType } from "core/control-plane/AuthTypes"; import { - FromIdeProtocol, FromWebviewProtocol, ToCoreProtocol, ToWebviewProtocol, @@ -13,73 +12,92 @@ import { GeneratorYieldType, WebviewSingleProtocolMessage, } from "core/protocol/util"; -import { ChatMessage } from "../redux/store"; import { IIdeMessenger } from "./IdeMessenger"; -async function defaultMockHandleMessage( - messageType: T, - data: FromWebviewProtocol[T][0], -): Promise { - function returnFor( - _: K, - value: FromWebviewProtocol[K][1], - ): FromWebviewProtocol[T][1] { - return value as unknown as FromWebviewProtocol[T][1]; - } +type MockResponses = Partial<{ + [K in keyof FromWebviewProtocol]: FromWebviewProtocol[K][1]; +}>; - switch (messageType) { - case "history/list": - return returnFor("history/list", [ - { - title: "Session 1", - sessionId: "session-1", - dateCreated: new Date().toString(), - workspaceDirectory: "/tmp", - }, - ]); - case "getControlPlaneSessionInfo": - return returnFor("getControlPlaneSessionInfo", { - AUTH_TYPE: AuthType.WorkOsStaging, - accessToken: "", - account: { - label: "", - id: "", - }, - }); - case "config/getSerializedProfileInfo": - return returnFor("config/getSerializedProfileInfo", { - organizations: [], - profileId: "test-profile", - result: { - config: undefined, - errors: [], - configLoadInterrupted: false, - }, - selectedOrgId: "local", - }); - default: - throw new Error(`Unknown message type ${messageType}`); - } -} +export type MockResponseHandler = ( + input: FromWebviewProtocol[T][0], +) => Promise; +type MockResponseHandlers = Partial<{ + [K in keyof FromWebviewProtocol]: MockResponseHandler; +}>; + +const DEFAULT_MOCK_CORE_RESPONSES: MockResponses = { + fileExists: true, + getCurrentFile: { + isUntitled: false, + contents: "Current file contents", + path: "file:///Users/user/workspace1/current_file.py", + }, + "controlPlane/getFreeTrialStatus": { + autocompleteLimit: 1000, + optedInToFreeTrial: false, + chatLimit: 1000, + autocompleteCount: 0, + chatCount: 0, + }, + getWorkspaceDirs: [ + "file:///Users/user/workspace1", + "file:///Users/user/workspace2", + ], + "history/list": [ + { + title: "Session 1", + sessionId: "session-1", + dateCreated: new Date().toString(), + workspaceDirectory: "/tmp", + }, + ], + "history/save": undefined, + getControlPlaneSessionInfo: { + AUTH_TYPE: AuthType.WorkOsStaging, + accessToken: "", + account: { + label: "", + id: "", + }, + }, + "config/getSerializedProfileInfo": { + organizations: [], + profileId: "test-profile", + result: { + config: undefined, + errors: [], + configLoadInterrupted: false, + }, + selectedOrgId: "local", + }, + "chatDescriber/describe": "Session summary", + applyToFile: undefined, + acceptDiff: undefined, + readFile: "File contents", +}; + +const DEFAULT_CHAT_RESPONSE: ChatMessage[] = [ + { + role: "assistant", + content: "This is a test", + }, +]; export class MockIdeMessenger implements IIdeMessenger { ide: IDE; - private messageHandlers: Map< - keyof FromIdeProtocol, - Array<(data: any) => void> - > = new Map(); constructor() { this.ide = new MessageIde( - (messageType, data) => { - throw new Error("Not implemented"); + async (messageType, data) => { + const response = await this.request.bind(this)(messageType, data); + if (response.status === "error") { + throw new Error(response.error); + } else { + return response.content; + } }, (messageType, callback) => { - // Store the callback in our handlers map - if (!this.messageHandlers.has(messageType)) { - this.messageHandlers.set(messageType, []); - } - this.messageHandlers.get(messageType)?.push(callback); + return; }, ); } @@ -109,16 +127,39 @@ export class MockIdeMessenger implements IIdeMessenger { ); } + responses: MockResponses = { ...DEFAULT_MOCK_CORE_RESPONSES }; + responseHandlers: MockResponseHandlers = {}; + chatResponse: ChatMessage[] = DEFAULT_CHAT_RESPONSE; + chatStreamDelay: number = 0; + setChatResponseText(text: string): void { + this.chatResponse = [ + { + role: "assistant", + content: text, + }, + ]; + } + async *llmStreamChat( msg: ToCoreProtocol["llm/streamChat"][0], cancelToken: AbortSignal, ): AsyncGenerator { - yield [ - { - role: "assistant", - content: "This is a test", - }, - ]; + for (const response of this.chatResponse) { + if (cancelToken.aborted) { + console.log("MockIdeMessenger: Stream aborted"); + return undefined; + } + console.log( + "MockIdeMessenger: Yielding chunk", + JSON.stringify(response, null, 2), + ); + yield [response]; + if (this.chatStreamDelay > 0) { + await new Promise((resolve) => + setTimeout(resolve, this.chatStreamDelay), + ); + } + } return undefined; } @@ -133,12 +174,27 @@ export class MockIdeMessenger implements IIdeMessenger { messageType: T, data: FromWebviewProtocol[T][0], ): Promise> { - const content = await defaultMockHandleMessage(messageType, data); - return { - status: "success", - content, - done: true, - }; + if (this.responseHandlers[messageType]) { + const content = await this.responseHandlers[messageType](data); + return { + status: "success", + content, + done: true, + }; + } + if (messageType in this.responses) { + const content = this.responses[messageType]; + return { + status: "success", + content, + done: true, + }; + } + console.error(messageType); + throw new Error( + "MockIdeMessenger: No response handler or response defined for " + + messageType, + ); } respond( @@ -157,4 +213,11 @@ export class MockIdeMessenger implements IIdeMessenger { > { return undefined; } + + resetMocks(): void { + this.responses = { ...DEFAULT_MOCK_CORE_RESPONSES }; + this.responseHandlers = {}; + this.chatResponse = DEFAULT_CHAT_RESPONSE; + this.chatStreamDelay = 0; + } } diff --git a/gui/src/context/SubmenuContextProviders.tsx b/gui/src/context/SubmenuContextProviders.tsx index 8268377de..cf3939c48 100644 --- a/gui/src/context/SubmenuContextProviders.tsx +++ b/gui/src/context/SubmenuContextProviders.tsx @@ -356,6 +356,16 @@ export const SubmenuContextProvidersProvider = ({ [loadSubmenuItems], ); + useWebviewListener( + "indexProgress", + async (data) => { + if (data.status === "done") { + loadSubmenuItems("dependsOnIndexing"); + } + }, + [loadSubmenuItems], + ); + // Reload all submenu items on the initial config load useEffect(() => { if (!submenuContextProviders.length) { diff --git a/gui/src/hooks/ParallelListeners.tsx b/gui/src/hooks/ParallelListeners.tsx index a283ed969..693359a97 100644 --- a/gui/src/hooks/ParallelListeners.tsx +++ b/gui/src/hooks/ParallelListeners.tsx @@ -5,7 +5,7 @@ import { EDIT_MODE_STREAM_ID } from "core/edit/constants"; import { FromCoreProtocol } from "core/protocol"; import { useAppDispatch, useAppSelector } from "../redux/hooks"; import { selectCurrentToolCallApplyState } from "../redux/selectors/selectCurrentToolCall"; -import { setConfigResult } from "../redux/slices/configSlice"; +import { setConfigLoading, setConfigResult } from "../redux/slices/configSlice"; import { setLastNonEditSessionEmpty, updateEditStateApplyState, @@ -20,6 +20,8 @@ import { import { acceptToolCall, addContextItemsAtIndex, + selectCurrentToolCall, + setHasReasoningEnabled, updateApplyState, } from "../redux/slices/sessionSlice"; import { setTTSActive } from "../redux/slices/uiSlice"; @@ -86,12 +88,20 @@ function ParallelListeners() { setLocalStorage("fontSize", configResult.config.ui.fontSize); document.body.style.fontSize = `${configResult.config.ui.fontSize}px`; } + + if ( + configResult.config?.selectedModelByRole.chat?.completionOptions + ?.reasoning + ) { + dispatch(setHasReasoningEnabled(true)); + } }, [dispatch, hasDoneInitialConfigLoad], ); const initialLoadAuthAndConfig = useCallback( async (initial: boolean) => { + dispatch(setConfigLoading(true)); const result = await ideMessenger.request( "config/getSerializedProfileInfo", undefined, @@ -99,6 +109,7 @@ function ParallelListeners() { if (result.status === "success") { await handleConfigUpdate(initial, result.content); } + dispatch(setConfigLoading(false)); }, [ideMessenger, handleConfigUpdate], ); @@ -234,6 +245,10 @@ function ParallelListeners() { dispatch(updateIndexingStatus(data)); }); + const autoAcceptEditToolDiffs = useAppSelector( + (store) => store.config.config.ui?.autoAcceptEditToolDiffs, + ); + const currentToolCall = useAppSelector(selectCurrentToolCall); useWebviewListener( "updateApplyState", async (state) => { @@ -241,7 +256,7 @@ function ParallelListeners() { dispatch(updateEditStateApplyState(state)); if (state.status === "closed") { - dispatch(exitEdit({})); + void dispatch(exitEdit({})); } } else { // chat or agent @@ -249,30 +264,45 @@ function ParallelListeners() { // Handle apply status updates that are associated with current tool call if ( - state.status === "closed" && currentToolCallApplyState && currentToolCallApplyState.streamId === state.streamId ) { - // const output: ContextItem = { - // name: "Edit tool output", - // content: "Completed edit", - // description: "", - // }; - dispatch( - acceptToolCall({ - toolCallId: currentToolCallApplyState.toolCallId!, - }), - ); - // dispatch(setToolCallOutput([])); - void dispatch( - streamResponseAfterToolCall({ - toolCallId: currentToolCallApplyState.toolCallId!, - }), - ); + if (state.status === "done" && autoAcceptEditToolDiffs) { + console.log("AUTO ACCEPTED"); + ideMessenger.post("acceptDiff", { + streamId: state.streamId, + filepath: state.filepath, + }); + } + if (state.status === "closed") { + if (currentToolCall?.status !== "canceled") { + dispatch( + acceptToolCall({ + toolCallId: currentToolCallApplyState.toolCallId!, + }), + ); + } + // const output: ContextItem = { + // name: "Edit tool output", + // content: "Completed edit", + // description: "", + // }; + // dispatch(setToolCallOutput([])); + void dispatch( + streamResponseAfterToolCall({ + toolCallId: currentToolCallApplyState.toolCallId!, + }), + ); + } } } }, - [currentToolCallApplyState, history], + [ + currentToolCall, + currentToolCallApplyState, + autoAcceptEditToolDiffs, + ideMessenger, + ], ); useEffect(() => { diff --git a/gui/src/hooks/useBookmarkedSlashCommands.ts b/gui/src/hooks/useBookmarkedSlashCommands.ts index dcd58f9f7..0301c6cc6 100644 --- a/gui/src/hooks/useBookmarkedSlashCommands.ts +++ b/gui/src/hooks/useBookmarkedSlashCommands.ts @@ -1,4 +1,4 @@ -import { SlashCommandDescription } from "core"; +import { SlashCommandDescWithSource } from "core"; import { usePostHog } from "posthog-js/react"; import { useAppDispatch, useAppSelector } from "../redux/hooks"; @@ -17,7 +17,7 @@ export function useBookmarkedSlashCommands() { return bookmarkedCommands.includes(commandName); }; - const toggleBookmark = (command: SlashCommandDescription) => { + const toggleBookmark = (command: SlashCommandDescWithSource) => { const isBookmarked = isCommandBookmarked(command.name); posthog.capture("toggle_bookmarked_slash_command", { diff --git a/gui/src/pages/config/AccountButton.tsx b/gui/src/pages/config/AccountButton.tsx deleted file mode 100644 index 888488208..000000000 --- a/gui/src/pages/config/AccountButton.tsx +++ /dev/null @@ -1,82 +0,0 @@ -import { UserCircleIcon } from "@heroicons/react/24/solid"; -import { isOnPremSession } from "core/control-plane/AuthTypes"; -import { - Button, - Popover, - PopoverButton, - PopoverPanel, - Transition, -} from "../../components/ui"; -import { useAuth } from "../../context/Auth"; -import { useAppSelector } from "../../redux/hooks"; -import { selectCurrentOrg } from "../../redux/slices/profilesSlice"; -import { ScopeSelect } from "./ScopeSelect"; - -export function AccountButton() { - const { session, logout, login, organizations } = useAuth(); - const selectedOrg = useAppSelector(selectCurrentOrg); - - if (!session) { - return ( - - ); - } - - // No login button for on-prem deployments - if (isOnPremSession(session)) { - return null; - } - - return ( - - {({ close }) => ( - <> - -
- - {selectedOrg === null ? "Personal" : selectedOrg.name} - - -
-
- - - -
-
- {session.account.label} - - {session.account.id} - -
- - {organizations.length > 0 && ( -
- - -
- )} - - -
-
-
- - )} -
- ); -} diff --git a/gui/src/pages/config/ContinueFeaturesMenu.tsx b/gui/src/pages/config/ContinueFeaturesMenu.tsx new file mode 100644 index 000000000..f3cb738ca --- /dev/null +++ b/gui/src/pages/config/ContinueFeaturesMenu.tsx @@ -0,0 +1,48 @@ +import { ExclamationTriangleIcon } from "@heroicons/react/24/outline"; +import ToggleSwitch from "../../components/gui/Switch"; +import { ToolTip } from "../../components/gui/Tooltip"; +interface ContinueFeaturesMenuProps { + logEditingData: boolean; + handleLogEditingDataToggle: (value: boolean) => void; + optInNextEditFeature: boolean; + handleOptInNextEditToggle: (value: boolean) => void; +} + +export function ContinueFeaturesMenu({ + logEditingData, + handleLogEditingDataToggle, + optInNextEditFeature, + handleOptInNextEditToggle, +}: ContinueFeaturesMenuProps) { + return ( +
+
+ 🚧 INTERNAL SETTINGS 🚧 +
+
+ handleLogEditingDataToggle(!logEditingData)} + text="Log Editing Data" + showIfToggled={ + <> + + + {`Only turn this on if you want to log your editing processes in addition to the normal dev data. Note that this will store a lot of data.`} + + + } + /> + + handleOptInNextEditToggle(!optInNextEditFeature)} + text="Enable Next Edit Over Autocomplete" + /> +
+
+ ); +} diff --git a/gui/src/pages/config/UserSettingsForm.tsx b/gui/src/pages/config/UserSettingsForm.tsx index 7f521b95f..eba44f2c8 100644 --- a/gui/src/pages/config/UserSettingsForm.tsx +++ b/gui/src/pages/config/UserSettingsForm.tsx @@ -8,6 +8,7 @@ import { SharedConfigSchema, modifyAnyConfigWithSharedConfig, } from "core/config/sharedConfig"; +import { HubSessionInfo } from "core/control-plane/AuthTypes"; import { useContext, useEffect, useState } from "react"; import { Input } from "../../components"; import NumberInput from "../../components/gui/NumberInput"; @@ -15,10 +16,12 @@ import { Select } from "../../components/gui/Select"; import ToggleSwitch from "../../components/gui/Switch"; import { ToolTip } from "../../components/gui/Tooltip"; import { useFontSize } from "../../components/ui/font"; +import { useAuth } from "../../context/Auth"; import { IdeMessengerContext } from "../../context/IdeMessenger"; import { useAppDispatch, useAppSelector } from "../../redux/hooks"; import { updateConfig } from "../../redux/slices/configSlice"; import { setLocalStorage } from "../../util/localStorage"; +import { ContinueFeaturesMenu } from "./ContinueFeaturesMenu"; export function UserSettingsForm() { /////// User settings section ////// @@ -26,6 +29,7 @@ export function UserSettingsForm() { const ideMessenger = useContext(IdeMessengerContext); const config = useAppSelector((state) => state.config.config); const [showExperimental, setShowExperimental] = useState(false); + const { session } = useAuth(); function handleUpdate(sharedConfig: SharedConfigSchema) { // Optimistic update @@ -63,6 +67,14 @@ export function UserSettingsForm() { }); }; + const handleLogEditingDataToggle = (value: boolean) => { + handleUpdate({ logEditingData: value }); + }; + + const handleOptInNextEditToggle = (value: boolean) => { + handleUpdate({ optInNextEditFeature: value }); + }; + useEffect(() => { // Necessary so that reformatted/trimmed values don't cause dirty state setFormPromptPath(promptPath); @@ -74,10 +86,15 @@ export function UserSettingsForm() { const showChatScrollbar = config.ui?.showChatScrollbar ?? false; const readResponseTTS = config.experimental?.readResponseTTS ?? false; const autoAcceptEditToolDiffs = config.ui?.autoAcceptEditToolDiffs ?? false; + const logEditingData = config.experimental?.logEditingData ?? false; const displayRawMarkdown = config.ui?.displayRawMarkdown ?? false; const disableSessionTitles = config.disableSessionTitles ?? false; const useCurrentFileAsContext = config.experimental?.useCurrentFileAsContext ?? false; + const enableExperimentalTools = + config.experimental?.enableExperimentalTools ?? false; + const optInNextEditFeature = + config.experimental?.optInNextEditFeature ?? false; const allowAnonymousTelemetry = config.allowAnonymousTelemetry ?? true; const disableIndexing = config.disableIndexing ?? false; @@ -106,11 +123,17 @@ export function UserSettingsForm() { const [hubEnabled, setHubEnabled] = useState(false); useEffect(() => { - ideMessenger.ide.getIdeSettings().then(({ continueTestEnvironment }) => { - setHubEnabled(continueTestEnvironment === "production"); - }); + void ideMessenger.ide + .getIdeSettings() + .then(({ continueTestEnvironment }) => { + setHubEnabled(continueTestEnvironment === "production"); + }); }, [ideMessenger]); + const hasContinueEmail = (session as HubSessionInfo)?.account?.id.includes( + "@continue.dev", + ); + return (
{/* {selectedProfile && isLocalProfile(selectedProfile) ? ( @@ -352,7 +375,9 @@ export function UserSettingsForm() {
@@ -386,6 +411,25 @@ export function UserSettingsForm() { } text="Add Current File by Default" /> + + + handleUpdate({ + enableExperimentalTools: !enableExperimentalTools, + }) + } + text="Enable experimental tools" + /> + + {hasContinueEmail && ( + + )}
diff --git a/gui/src/pages/config/index.tsx b/gui/src/pages/config/index.tsx index ea5ccef44..d9939a2c8 100644 --- a/gui/src/pages/config/index.tsx +++ b/gui/src/pages/config/index.tsx @@ -9,7 +9,6 @@ import { useNavigate } from "react-router-dom"; import { PageHeader } from "../../components/PageHeader"; import { useNavigationListener } from "../../hooks/useNavigationListener"; import { fontSize } from "../../util"; -import { AccountButton } from "./AccountButton"; import { HelpCenterSection } from "./HelpCenterSection"; import { IndexingSettingsSection } from "./IndexingSettingsSection"; import KeyboardShortcuts from "./KeyboardShortcuts"; @@ -63,7 +62,6 @@ function ConfigPage() { showBorder onTitleClick={() => navigate("/")} title="Chat" - rightContent={} /> {/* Tab Headers */} diff --git a/gui/src/pages/gui/Chat.test.tsx b/gui/src/pages/gui/Chat.test.tsx deleted file mode 100644 index 1bf5dc09d..000000000 --- a/gui/src/pages/gui/Chat.test.tsx +++ /dev/null @@ -1,161 +0,0 @@ -import { screen, waitFor } from "@testing-library/dom"; -import { act } from "@testing-library/react"; -import { renderWithProviders } from "../../util/test/render"; -import { Chat } from "./Chat"; - -describe("Chat page test", () => { - it("should render input box", async () => { - await renderWithProviders(); - expect(await screen.findByTestId("continue-input-box")).toBeInTheDocument(); - }); - - it("should be able to toggle modes", async () => { - await renderWithProviders(); - expect(screen.getByText("Chat")).toBeInTheDocument(); - - // Simulate cmd+. keyboard shortcut to toggle modes - act(() => { - document.dispatchEvent( - new KeyboardEvent("keydown", { - key: ".", - metaKey: true, // cmd key on Mac - }), - ); - }); - - // Check that it switched to Agent mode - expect(await screen.findByText("Agent")).toBeInTheDocument(); - - act(() => { - document.dispatchEvent( - new KeyboardEvent("keydown", { - key: ".", - metaKey: true, // cmd key on Mac - }), - ); - }); - - // Check that it switched back to Chat mode - expect(await screen.findByText("Chat")).toBeInTheDocument(); - }); - - it.skip("should send a message and receive a response", async () => { - const { user, container } = await renderWithProviders(); - const inputBox = await waitFor(() => - container.querySelector(".ProseMirror")!.querySelector("p"), - ); - expect(inputBox).toBeDefined(); - - const sendButton = await screen.findByTestId("submit-input-button"); - - await act(async () => { - // Focus input box - inputBox!.focus(); - - // Type message - await user.type(inputBox!, "Hello, world!"); - - sendButton.click(); - }); - expect(await screen.findByText("Hello, world!")).toBeInTheDocument(); - }); - - it("should handle apply updates and display the accept / reject all buttons", async () => { - const { ideMessenger } = await renderWithProviders(); - - // Use queryByText which returns null when element isn't found - const acceptAllButton = screen.queryByText("Accept All"); - const rejectAllButton = screen.queryByText("Reject All"); - - // Assert that the buttons don't exist - expect(acceptAllButton).not.toBeInTheDocument(); - expect(rejectAllButton).not.toBeInTheDocument(); - - for (let i = 0; i < 5; i++) { - ideMessenger.mockMessageToWebview("updateApplyState", { - status: "streaming", - streamId: `12345`, - }); - } - - ideMessenger.mockMessageToWebview("updateApplyState", { - status: "done", - streamId: "12345", - }); - - // Wait for the buttons to appear - await waitFor(() => { - expect( - screen.getByTestId("accept-reject-all-buttons"), - ).toBeInTheDocument(); - }); - - // IDE sends back message that it is done - ideMessenger.mockMessageToWebview("updateApplyState", { - status: "closed", - streamId: "12345", - }); - - // Wait for the buttons to disappear - await waitFor(() => { - expect( - screen.queryByTestId("edit-accept-button"), - ).not.toBeInTheDocument(); - expect( - screen.queryByTestId("edit-reject-button"), - ).not.toBeInTheDocument(); - }); - }); - - it("should show apply cancellation", async () => { - const { ideMessenger } = await renderWithProviders(); - - // Spy on the request method of ideMessenger - const messengerPostSpy = vi.spyOn(ideMessenger, "post"); - - for (let i = 0; i < 5; i++) { - ideMessenger.mockMessageToWebview("updateApplyState", { - status: "streaming", - streamId: `12345`, - }); - } - - // Wait for applying toolbar to appear - await waitFor(() => { - const cancelApplyButton = screen.getByTestId( - "notch-applying-cancel-button", - ); - const applyingText = screen.getByTestId("notch-applying-text"); - - expect(cancelApplyButton).toBeInTheDocument(); - expect(applyingText).toBeInTheDocument(); - }); - - const cancelApplyButton = screen.getByTestId( - "notch-applying-cancel-button", - ); - cancelApplyButton.click(); - - // Verify that rejectDiff message has been posted to ideMessenger - expect(messengerPostSpy).toHaveBeenCalledWith("rejectDiff", {}); - - // Now simulate the IDE sending back a message that the apply state is closed - ideMessenger.mockMessageToWebview("updateApplyState", { - status: "closed", - streamId: "12345", - }); - - await waitFor(() => { - const cancelApplyButton = screen.queryByTestId( - "notch-applying-cancel-button", - ); - const applyingText = screen.queryByTestId("notch-applying-text"); - - expect(cancelApplyButton).not.toBeInTheDocument(); - expect(applyingText).not.toBeInTheDocument(); - }); - - // Cleanup spy - messengerPostSpy.mockRestore(); - }); -}); diff --git a/gui/src/pages/gui/Chat.tsx b/gui/src/pages/gui/Chat.tsx index 4a6d33849..fb75d200c 100644 --- a/gui/src/pages/gui/Chat.tsx +++ b/gui/src/pages/gui/Chat.tsx @@ -42,12 +42,12 @@ import { setDialogMessage, setShowDialog, } from "../../redux/slices/uiSlice"; -import { cancelStream } from "../../redux/thunks/cancelStream"; import { streamEditThunk } from "../../redux/thunks/edit"; import { loadLastSession } from "../../redux/thunks/session"; import { streamResponseThunk } from "../../redux/thunks/streamResponse"; import { isJetBrains, isMetaEquivalentKeyPressed } from "../../util"; +import { cancelStream } from "../../redux/thunks/cancelStream"; import { getLocalStorage, setLocalStorage } from "../../util/localStorage"; import { EmptyChatBody } from "./EmptyChatBody"; import { ExploreDialogWatcher } from "./ExploreDialogWatcher"; @@ -125,14 +125,14 @@ export function Chat() { useEffect(() => { // Cmd + Backspace to delete current step - const listener = (e: any) => { + const listener = (e: KeyboardEvent) => { if ( e.key === "Backspace" && (jetbrains ? e.altKey : isMetaEquivalentKeyPressed(e)) && !e.shiftKey ) { - dispatch(cancelStream()); - ideMessenger.post("rejectDiff", {}); // just always cancel, if not in applying won't matter + void dispatch(cancelStream()); + if (isInEdit) ideMessenger.post("rejectDiff", {}); } }; window.addEventListener("keydown", listener); @@ -140,7 +140,7 @@ export function Chat() { return () => { window.removeEventListener("keydown", listener); }; - }, [isStreaming, jetbrains]); + }, [isStreaming, jetbrains, isInEdit]); const { widget, highlights } = useFindWidget( stepsDivRef, @@ -319,7 +319,7 @@ export function Chat() { inputId={item.message.id} /> - ) : item.message.role === "tool" ? null : item.message.role === // /> // toolCallId={item.message.toolCallId} // contextItems={item.contextItems} // - selectApplyStateByToolCallId(state, props.toolCallId), - ); - - useEffect(() => { - if (!applyState) { - dispatch( - updateApplyState({ - streamId: uuidv4(), - toolCallId: props.toolCallId, - status: "not-started", - }), - ); - } - }, [applyState, props.toolCallId]); - if (!props.relativeFilePath || !props.changes) { return null; } @@ -42,11 +18,11 @@ export function EditFile(props: EditToolCallProps) { return ( ); diff --git a/gui/src/pages/gui/ToolCallDiv/FunctionSpecificToolCallDiv.tsx b/gui/src/pages/gui/ToolCallDiv/FunctionSpecificToolCallDiv.tsx index 781e55c7e..c20f8f7d2 100644 --- a/gui/src/pages/gui/ToolCallDiv/FunctionSpecificToolCallDiv.tsx +++ b/gui/src/pages/gui/ToolCallDiv/FunctionSpecificToolCallDiv.tsx @@ -33,6 +33,16 @@ function FunctionSpecificToolCallDiv({ historyIndex={historyIndex} /> ); + case BuiltInToolNames.SearchAndReplaceInFile: + return ( + + ); case BuiltInToolNames.RunTerminalCommand: return ( { return contextItems?.filter((ctxItem) => !ctxItem.hidden) ?? []; }, [contextItems]); const [open, setOpen] = useState(false); const [isHovered, setIsHovered] = useState(false); - const [showingArgs, setShowingArgs] = useState(false); const args: [string, any][] = useMemo(() => { return Object.entries(toolCallState.parsedArgs); }, [toolCallState.parsedArgs]); + const isToggleable = ctxItems.length > 1; + const isSingleItem = ctxItems.length === 1; + const shouldShowContent = isToggleable ? open : false; + const isClickable = isToggleable || isSingleItem; + + function handleClick() { + if (isToggleable) { + setOpen((prev) => !prev); + } else if (isSingleItem) { + openContextItem(ctxItems[0], ideMessenger); + } + } + + function renderIcon() { + if (!Icon && !isToggleable) { + return null; + } + + if (isToggleable) { + const showChevron = isHovered || shouldShowContent; + return showChevron ? ( + + ) : ( + Icon && + ); + } + + return Icon ? : null; + } + return (
setOpen((prev) => !prev)} - onMouseEnter={() => setIsHovered(true)} - onMouseLeave={() => setIsHovered(false)} + className={`text-description flex min-w-0 flex-row items-center justify-between gap-1.5 text-xs transition-colors duration-200 ease-in-out ${ + isClickable ? "cursor-pointer hover:brightness-125" : "" + }`} + onClick={isClickable ? handleClick : undefined} + onMouseEnter={isToggleable ? () => setIsHovered(true) : undefined} + onMouseLeave={isToggleable ? () => setIsHovered(false) : undefined} data-testid="context-items-peek" >
- {Icon && !isHovered && !open ? ( - - ) : ( - - )} + {renderIcon()}
- {args.length > 0 ? ( + {args.length > 0 && ( - ) : null} -
- -
- {ctxItems.length ? ( - ctxItems.map((contextItem, idx) => ( - - )) - ) : ( -
- No tool call output -
)}
+ + + + {isToggleable && ( +
+ {ctxItems.length > 0 ? ( + ctxItems.map((contextItem, idx) => ( + + )) + ) : ( +
+ No tool call output +
+ )} +
+ )}
); } diff --git a/gui/src/pages/gui/ToolCallDiv/ToolCallArgs.tsx b/gui/src/pages/gui/ToolCallDiv/ToolCallArgs.tsx index 757080117..855d86024 100644 --- a/gui/src/pages/gui/ToolCallDiv/ToolCallArgs.tsx +++ b/gui/src/pages/gui/ToolCallDiv/ToolCallArgs.tsx @@ -55,9 +55,7 @@ export const ArgsItems = ({ args, isShowing }: ArgsItemsProps) => { {args.map(([key, value]) => (
{key}: - - {JSON.stringify(value)} - + {JSON.stringify(value)}
))}
diff --git a/gui/src/pages/gui/chat-tests/ApplyScenarios.test.tsx b/gui/src/pages/gui/chat-tests/ApplyScenarios.test.tsx new file mode 100644 index 000000000..3624a5bd9 --- /dev/null +++ b/gui/src/pages/gui/chat-tests/ApplyScenarios.test.tsx @@ -0,0 +1,80 @@ +import { act } from "@testing-library/react"; +import { renderWithProviders } from "../../../util/test/render"; +import { + getElementByTestId, + verifyNotPresentByTestId, + verifyNotPresentByText, +} from "../../../util/test/utils"; +import { Chat } from "../Chat"; + +test("Chat apply scenarios: handle apply updates and display the accept / reject all buttons", async () => { + const { ideMessenger } = await renderWithProviders(); + + // Use queryByText which returns null when element isn't found + await verifyNotPresentByText("Accept All"); + await verifyNotPresentByText("Reject All"); + + for (let i = 0; i < 5; i++) { + ideMessenger.mockMessageToWebview("updateApplyState", { + status: "streaming", + streamId: `12345`, + }); + } + + ideMessenger.mockMessageToWebview("updateApplyState", { + status: "done", + streamId: "12345", + }); + + // Wait for the buttons to appear + await getElementByTestId("accept-reject-all-buttons"); + + // IDE sends back message that it is done + ideMessenger.mockMessageToWebview("updateApplyState", { + status: "closed", + streamId: "12345", + }); + + // Wait for the buttons to disappear + await verifyNotPresentByTestId("edit-accept-button"); + await verifyNotPresentByTestId("edit-reject-button"); +}); + +test("Chat apply scenarios: show apply cancellation", async () => { + const { ideMessenger } = await renderWithProviders(); + + // Spy on the request method of ideMessenger + const messengerPostSpy = vi.spyOn(ideMessenger, "post"); + + for (let i = 0; i < 5; i++) { + ideMessenger.mockMessageToWebview("updateApplyState", { + status: "streaming", + streamId: `12345`, + }); + } + + // Wait for applying toolbar to appear + await getElementByTestId("notch-applying-text"); + + await act(async () => { + const cancelApplyButton = await getElementByTestId( + "notch-applying-cancel-button", + ); + cancelApplyButton.click(); + }); + + // Verify that rejectDiff message has been posted to ideMessenger + expect(messengerPostSpy).toHaveBeenCalledWith("rejectDiff", {}); + + // Now simulate the IDE sending back a message that the apply state is closed + ideMessenger.mockMessageToWebview("updateApplyState", { + status: "closed", + streamId: "12345", + }); + + await verifyNotPresentByTestId("notch-applying-text"); + await verifyNotPresentByTestId("notch-applying-cancel-button"); + + // Cleanup spy + messengerPostSpy.mockRestore(); +}); diff --git a/gui/src/pages/gui/chat-tests/Chat.test.tsx b/gui/src/pages/gui/chat-tests/Chat.test.tsx new file mode 100644 index 000000000..d3e6aa18b --- /dev/null +++ b/gui/src/pages/gui/chat-tests/Chat.test.tsx @@ -0,0 +1,61 @@ +import { act } from "@testing-library/react"; +import { addAndSelectMockLlm } from "../../../util/test/config"; +import { renderWithProviders } from "../../../util/test/render"; +import { + getElementByTestId, + getElementByText, + sendInputWithMockedResponse, +} from "../../../util/test/utils"; +import { Chat } from "../Chat"; + +test("should render input box", async () => { + await renderWithProviders(); + await getElementByTestId("continue-input-box"); +}); + +test("should be able to toggle modes", async () => { + await renderWithProviders(); + await getElementByText("Chat"); + + // Simulate cmd+. keyboard shortcut to toggle modes + act(() => { + document.dispatchEvent( + new KeyboardEvent("keydown", { + key: ".", + metaKey: true, // cmd key on Mac + }), + ); + }); + + // Check that it switched to Agent mode + await getElementByText("Agent"); + + act(() => { + document.dispatchEvent( + new KeyboardEvent("keydown", { + key: ".", + metaKey: true, // cmd key on Mac + }), + ); + }); + + await getElementByText("Chat"); +}); + +test("should send a message and receive a response", async () => { + const { ideMessenger, store } = await renderWithProviders(); + + // First add and select the mock LLM + await act(async () => { + addAndSelectMockLlm(store, ideMessenger); + }); + + const CONTENT = "Expected response"; + const INPUT = "User input"; + + await sendInputWithMockedResponse(ideMessenger, INPUT, [ + { role: "assistant", content: CONTENT }, + ]); + + await getElementByText(CONTENT); +}); diff --git a/gui/src/pages/gui/chat-tests/EditToolScenarios.test.tsx b/gui/src/pages/gui/chat-tests/EditToolScenarios.test.tsx new file mode 100644 index 000000000..157c81e9e --- /dev/null +++ b/gui/src/pages/gui/chat-tests/EditToolScenarios.test.tsx @@ -0,0 +1,231 @@ +import { BuiltInToolNames } from "core/tools/builtIn"; +import { + addAndSelectMockLlm, + triggerConfigUpdate, +} from "../../../util/test/config"; +import { renderWithProviders } from "../../../util/test/render"; +import { Chat } from "../Chat"; + +import { waitFor } from "@testing-library/dom"; +import { ChatMessage } from "core"; +import { toggleToolSetting } from "../../../redux/slices/uiSlice"; +import { + getElementByTestId, + getElementByText, + sendInputWithMockedResponse, + verifyNotPresentByTestId, +} from "../../../util/test/utils"; + +const EDIT_WORKSPACE_DIR = "file:///workspace"; +const EDIT_FILEPATH = "test.txt"; +const EDIT_FILE_URI = `${EDIT_WORKSPACE_DIR}/${EDIT_FILEPATH}`; +const EDIT_CHANGES = "New content"; +const EDIT_TOOL_CALL_ID = "known-id"; +const EDIT_MESSAGES: ChatMessage[] = [ + { + role: "assistant", + content: "", + toolCalls: [ + { + id: EDIT_TOOL_CALL_ID, + function: { + name: BuiltInToolNames.EditExistingFile, + arguments: JSON.stringify({ + filepath: EDIT_FILEPATH, + changes: EDIT_CHANGES, + }), + }, + }, + ], + }, +]; + +const POST_EDIT_RESPONSE = "Edit applied successfully"; +beforeEach(() => { + vi.clearAllMocks(); +}); + +test("Edit run with ask first policy and no auto apply", async () => { + // Setup + const { ideMessenger, store, user } = await renderWithProviders(); + + ideMessenger.responses["getWorkspaceDirs"] = [EDIT_WORKSPACE_DIR]; + const messengerPostSpy = vi.spyOn(ideMessenger, "post"); + + addAndSelectMockLlm(store, ideMessenger); + + // Send the input that will respond with an edit tool call + await sendInputWithMockedResponse( + ideMessenger, + "Edit this file", + EDIT_MESSAGES, + ); + + // Toggle the codeblock and make sure the changes show + const toggleCodeblockChevron = await getElementByTestId("toggle-codeblock"); + + await user.click(toggleCodeblockChevron); + await getElementByText(EDIT_CHANGES); + + // Pending tool call - find and click the accept button + const acceptToolCallButton = await getElementByTestId( + "accept-tool-call-button", + ); + await user.click(acceptToolCallButton); + + // Tool call, check that applyToFile was called for edit + await waitFor(() => { + expect(messengerPostSpy).toHaveBeenCalledWith("applyToFile", { + streamId: expect.any(String), + filepath: EDIT_FILE_URI, + text: EDIT_CHANGES, + toolCallId: EDIT_TOOL_CALL_ID, + }); + }); + + // Extract stream ID and initiate mock streaming + const streamId = messengerPostSpy.mock.calls.find( + (call) => call[0] === "applyToFile", + )?.[1]?.streamId; + expect(streamId).toBeDefined(); + + ideMessenger.mockMessageToWebview("updateApplyState", { + status: "streaming", + streamId, + toolCallId: EDIT_TOOL_CALL_ID, + filepath: EDIT_FILE_URI, + }); + + // Mid stream, should show applying in notch + await getElementByTestId("notch-applying-text"); + await getElementByTestId("notch-applying-cancel-button"); + + // Close the stream + ideMessenger.mockMessageToWebview("updateApplyState", { + status: "done", + streamId, + toolCallId: EDIT_TOOL_CALL_ID, + filepath: EDIT_FILE_URI, + }); + + // Verify accept/reject buttons are present + const acceptButton = await getElementByTestId("edit-accept-button"); + await getElementByTestId("edit-reject-button"); + + // Accept the changes, which should trigger a response after the tool call + await user.click(acceptButton); + + expect(messengerPostSpy).toHaveBeenCalledWith("acceptDiff", { + streamId, + filepath: EDIT_FILE_URI, + }); + + ideMessenger.setChatResponseText(POST_EDIT_RESPONSE); + ideMessenger.mockMessageToWebview("updateApplyState", { + status: "closed", + streamId, + toolCallId: EDIT_TOOL_CALL_ID, + filepath: EDIT_FILE_URI, + }); + + await verifyNotPresentByTestId("edit-accept-button"); + await verifyNotPresentByTestId("edit-reject-button"); + + await getElementByText(POST_EDIT_RESPONSE); +}); + +test("Edit run with no policy and yolo mode", async () => { + // Setup + const { ideMessenger, store, user } = await renderWithProviders(); + + ideMessenger.responses["getWorkspaceDirs"] = [EDIT_WORKSPACE_DIR]; + const messengerPostSpy = vi.spyOn(ideMessenger, "post"); + + addAndSelectMockLlm(store, ideMessenger); + + // Enable automatic edit and yolo mode + store.dispatch(toggleToolSetting(BuiltInToolNames.EditExistingFile)); + triggerConfigUpdate({ + store, + ideMessenger, + editConfig: (current) => { + current.ui = { + ...current.ui, + autoAcceptEditToolDiffs: true, // Enable auto-accept for edit tool diffs + }; + return current; + }, + }); + expect(store.getState().config.config.ui?.autoAcceptEditToolDiffs).toBe(true); + + // Send the input that will respond with an edit tool call + await sendInputWithMockedResponse( + ideMessenger, + "Edit this file", + EDIT_MESSAGES, + ); + + // Toggle the codeblock and make sure the changes show + const toggleCodeblockChevron = await getElementByTestId("toggle-codeblock"); + + await user.click(toggleCodeblockChevron); + await getElementByText(EDIT_CHANGES); + + // Make sure there's no pending tool call + verifyNotPresentByTestId("accept-tool-call-button"); + // Tool call, check that applyToFile was called for edit + await waitFor(() => { + expect(messengerPostSpy).toHaveBeenCalledWith("applyToFile", { + streamId: expect.any(String), + filepath: EDIT_FILE_URI, + text: EDIT_CHANGES, + toolCallId: EDIT_TOOL_CALL_ID, + }); + }); + + // Extract stream ID and initiate mock streaming + const streamId = messengerPostSpy.mock.calls.find( + (call) => call[0] === "applyToFile", + )?.[1]?.streamId; + expect(streamId).toBeDefined(); + + ideMessenger.mockMessageToWebview("updateApplyState", { + status: "streaming", + streamId, + toolCallId: EDIT_TOOL_CALL_ID, + filepath: EDIT_FILE_URI, + }); + + // Mid stream, should show applying in notch + await getElementByTestId("notch-applying-text"); + await getElementByTestId("notch-applying-cancel-button"); + + // Close the stream + ideMessenger.mockMessageToWebview("updateApplyState", { + status: "done", + streamId, + toolCallId: EDIT_TOOL_CALL_ID, + filepath: EDIT_FILE_URI, + }); + + await waitFor(() => { + expect(messengerPostSpy).toHaveBeenCalledWith("acceptDiff", { + streamId, + filepath: EDIT_FILE_URI, + }); + }); + + // Close the stream, ensure response is shown and diff buttons are not present + ideMessenger.setChatResponseText(POST_EDIT_RESPONSE); + ideMessenger.mockMessageToWebview("updateApplyState", { + status: "closed", + streamId, + toolCallId: EDIT_TOOL_CALL_ID, + filepath: EDIT_FILE_URI, + }); + + await verifyNotPresentByTestId("edit-accept-button"); + await verifyNotPresentByTestId("edit-reject-button"); + + await getElementByText(POST_EDIT_RESPONSE); +}); diff --git a/gui/src/pages/history/index.tsx b/gui/src/pages/history/index.tsx index a8be3d92f..86950ff24 100644 --- a/gui/src/pages/history/index.tsx +++ b/gui/src/pages/history/index.tsx @@ -2,7 +2,6 @@ import { useNavigate } from "react-router-dom"; import { History } from "../../components/History"; import { PageHeader } from "../../components/PageHeader"; import { getFontSize } from "../../util"; -import { AccountButton } from "../config/AccountButton"; export default function HistoryPage() { const navigate = useNavigate(); @@ -12,12 +11,7 @@ export default function HistoryPage() { className="flex flex-1 flex-col overflow-auto" style={{ fontSize: getFontSize() }} > - navigate("/")} - title="Chat" - rightContent={} - /> + navigate("/")} title="Chat" />
); diff --git a/gui/src/redux/slices/configSlice.ts b/gui/src/redux/slices/configSlice.ts index b26d596c8..8766014a2 100644 --- a/gui/src/redux/slices/configSlice.ts +++ b/gui/src/redux/slices/configSlice.ts @@ -6,19 +6,11 @@ import { DEFAULT_MAX_TOKENS } from "core/llm/constants"; export type ConfigState = { configError: ConfigValidationError[] | undefined; config: BrowserSerializedContinueConfig; + loading: boolean; }; export const EMPTY_CONFIG: BrowserSerializedContinueConfig = { - slashCommands: [ - { - name: "share", - description: "Export the current chat session to markdown", - }, - { - name: "cmd", - description: "Generate a shell command", - }, - ], + slashCommands: [], contextProviders: [], tools: [], mcpServerStatuses: [], @@ -47,6 +39,7 @@ export const EMPTY_CONFIG: BrowserSerializedContinueConfig = { const initialState: ConfigState = { configError: undefined, config: EMPTY_CONFIG, + loading: false, }; export const configSlice = createSlice({ @@ -82,6 +75,9 @@ export const configSlice = createSlice({ ) => { state.config = config; }, + setConfigLoading: (state, { payload: loading }: PayloadAction) => { + state.loading = loading; + }, }, selectors: { selectSelectedChatModelContextLength: (state): number => { @@ -99,7 +95,8 @@ export const configSlice = createSlice({ }, }); -export const { updateConfig, setConfigResult } = configSlice.actions; +export const { updateConfig, setConfigResult, setConfigLoading } = + configSlice.actions; export const { selectSelectedChatModelContextLength, diff --git a/gui/src/redux/slices/profilesSlice.ts b/gui/src/redux/slices/profilesSlice.ts index 6f3144736..16d0498ae 100644 --- a/gui/src/redux/slices/profilesSlice.ts +++ b/gui/src/redux/slices/profilesSlice.ts @@ -1,5 +1,5 @@ import { createSlice, PayloadAction } from "@reduxjs/toolkit"; -import { SlashCommandDescription } from "core"; +import { SlashCommandDescWithSource } from "core"; import { SerializedOrgWithProfiles } from "core/config/ProfileLifecycleManager"; const DEFAULT_SLASH_COMMANDS_BOOKMARKS_COUNT = 5; @@ -81,7 +81,7 @@ export const profilesSlice = createSlice({ state, action: PayloadAction<{ profileId: string; - defaultSlashCommands?: SlashCommandDescription[]; + defaultSlashCommands?: SlashCommandDescWithSource[]; }>, ) => { const { profileId, defaultSlashCommands = [] } = action.payload; diff --git a/gui/src/redux/slices/sessionSlice.ts b/gui/src/redux/slices/sessionSlice.ts index 37eba4b4f..a201313f7 100644 --- a/gui/src/redux/slices/sessionSlice.ts +++ b/gui/src/redux/slices/sessionSlice.ts @@ -28,6 +28,8 @@ import { RootState } from "../store"; import { streamResponseThunk } from "../thunks/streamResponse"; import { findCurrentToolCall, findToolCall } from "../util"; +const getIdeMessenger = () => (window as any).ideMessenger; + // We need this to handle reorderings (e.g. a mid-array deletion) of the messages array. // The proper fix is adding a UUID to all chat messages, but this is the temp workaround. export type ChatHistoryItemWithMessageId = ChatHistoryItem & { @@ -51,6 +53,7 @@ type SessionState = { curIndex: number; }; newestToolbarPreviewForInput: Record; + hasReasoningEnabled?: boolean; }; const initialState: SessionState = { @@ -594,6 +597,9 @@ export const sessionSlice = createSlice({ setIsInEdit: (state, action: PayloadAction) => { state.isInEdit = action.payload; }, + setHasReasoningEnabled: (state, action: PayloadAction) => { + state.hasReasoningEnabled = action.payload; + }, setNewestToolbarPreviewForInput: ( state, { @@ -653,7 +659,9 @@ export const selectApplyStateByToolCallId = createSelector( (state: RootState, toolCallId?: string) => toolCallId, ], (states, toolCallId) => { - return states.find((state) => state.toolCallId === toolCallId); + if (toolCallId) { + return states.find((state) => state.toolCallId === toolCallId); + } }, ); @@ -691,6 +699,7 @@ export const { deleteSessionMetadata, setNewestToolbarPreviewForInput, setIsInEdit, + setHasReasoningEnabled, } = sessionSlice.actions; export const { selectIsGatheringContext } = sessionSlice.selectors; diff --git a/gui/src/redux/slices/uiSlice.ts b/gui/src/redux/slices/uiSlice.ts index 15d6216a4..0efcfe2ce 100644 --- a/gui/src/redux/slices/uiSlice.ts +++ b/gui/src/redux/slices/uiSlice.ts @@ -63,6 +63,7 @@ export const uiSlice = createSlice({ [BuiltInToolNames.LSTool]: "allowedWithoutPermission", [BuiltInToolNames.CreateRuleBlock]: "allowedWithPermission", [BuiltInToolNames.RequestRule]: "disabled", + [BuiltInToolNames.SearchAndReplaceInFile]: "allowedWithPermission", }, toolGroupSettings: { [BUILT_IN_GROUP_NAME]: "include", diff --git a/gui/src/redux/store.ts b/gui/src/redux/store.ts index 542ee7ffc..10ecdd2e5 100644 --- a/gui/src/redux/store.ts +++ b/gui/src/redux/store.ts @@ -23,11 +23,6 @@ import sessionReducer from "./slices/sessionSlice"; import tabsReducer from "./slices/tabsSlice"; import uiReducer from "./slices/uiSlice"; -export interface ChatMessage { - role: "system" | "user" | "assistant"; - content: string; -} - const rootReducer = combineReducers({ session: sessionReducer, ui: uiReducer, diff --git a/gui/src/redux/thunks/callCurrentTool.ts b/gui/src/redux/thunks/callCurrentTool.ts index af8b4d4d9..7c03226ee 100644 --- a/gui/src/redux/thunks/callCurrentTool.ts +++ b/gui/src/redux/thunks/callCurrentTool.ts @@ -1,6 +1,7 @@ import { createAsyncThunk, unwrapResult } from "@reduxjs/toolkit"; import { ContextItem } from "core"; import { CLIENT_TOOLS_IMPLS } from "core/tools/builtIn"; +import posthog from "posthog-js"; import { callClientTool } from "../../util/clientTools/callClientTool"; import { selectCurrentToolCall } from "../selectors/selectCurrentToolCall"; import { selectSelectedChatModel } from "../slices/configSlice"; @@ -11,6 +12,7 @@ import { updateToolCallOutput, } from "../slices/sessionSlice"; import { ThunkApiType } from "../store"; +import { logToolUsage } from "../util"; import { streamResponseAfterToolCall } from "./streamResponseAfterToolCall"; export const callCurrentTool = createAsyncThunk( @@ -18,7 +20,6 @@ export const callCurrentTool = createAsyncThunk( async (_, { dispatch, extra, getState }) => { const state = getState(); const toolCallState = selectCurrentToolCall(state); - if (!toolCallState) { return; } @@ -45,6 +46,9 @@ export const callCurrentTool = createAsyncThunk( let errorMessage: string | undefined = undefined; let streamResponse: boolean; + // Check if telemetry is enabled + const allowAnonymousTelemetry = state.config.config.allowAnonymousTelemetry; + // IMPORTANT: // Errors that occur while calling tool call implementations // Are caught and passed in output as context items @@ -57,19 +61,15 @@ export const callCurrentTool = createAsyncThunk( ) { // Tool is called on client side const { - output: clientToolOuput, + output: clientToolOutput, respondImmediately, errorMessage: clientToolError, } = await callClientTool(toolCallState, { dispatch, ideMessenger: extra.ideMessenger, - streamId: state.session.codeBlockApplyStates.states.find( - (state) => - state.toolCallId && state.toolCallId === toolCallState.toolCallId, - )?.streamId, getState, }); - output = clientToolOuput; + output = clientToolOutput; errorMessage = clientToolError; streamResponse = respondImmediately; } else { @@ -101,6 +101,8 @@ export const callCurrentTool = createAsyncThunk( ], }), ); + + logToolUsage(toolCallState, false, extra.ideMessenger, output); } else if (output?.length) { dispatch( updateToolCallOutput({ @@ -108,6 +110,19 @@ export const callCurrentTool = createAsyncThunk( contextItems: output, }), ); + + logToolUsage(toolCallState, true, extra.ideMessenger, output); + } + + // Because we don't have access to use hooks, we check `allowAnonymousTelemetry` + // directly rather than using `CustomPostHogProvider` + if (allowAnonymousTelemetry) { + // Capture telemetry for tool calls + posthog.capture("gui_tool_call_outcome", { + succeeded: errorMessage === undefined, + toolName: toolCallState.toolCall.function.name, + errorMessage: errorMessage, + }); } if (streamResponse) { diff --git a/gui/src/redux/thunks/edit.ts b/gui/src/redux/thunks/edit.ts index 4471cc0b4..73b65740e 100644 --- a/gui/src/redux/thunks/edit.ts +++ b/gui/src/redux/thunks/edit.ts @@ -17,6 +17,7 @@ import { import { newSession, setActive, + setInactive, setIsInEdit, setMainEditorContentTrigger, setMode, @@ -33,27 +34,26 @@ export const streamEditThunk = createAsyncThunk< }, ThunkApiType >( - "chat/streamResponse", + "edit/streamResponse", async ({ editorState, codeToEdit }, { dispatch, extra }) => { await dispatch( streamThunkWrapper(async () => { dispatch(setActive()); - const [contextItems, __, userInstructions, _] = - await resolveEditorContent({ - editorState, - modifiers: { - noContext: true, - useCodebase: false, - }, - ideMessenger: extra.ideMessenger, - defaultContextProviders: [], - availableSlashCommands: [], - dispatch, - }); + const { selectedContextItems, content } = await resolveEditorContent({ + editorState, + modifiers: { + noContext: true, + useCodebase: false, + }, + ideMessenger: extra.ideMessenger, + defaultContextProviders: [], + availableSlashCommands: [], + dispatch, + }); const prompt = [ - ...contextItems.map((item) => item.content), - stripImages(userInstructions), + ...selectedContextItems.map((item) => item.content), + stripImages(content), ].join("\n\n"); const response = await extra.ideMessenger.request("edit/sendPrompt", { @@ -61,6 +61,8 @@ export const streamEditThunk = createAsyncThunk< range: codeToEdit[0] as RangeInFileWithContents, }); + dispatch(setInactive()); + if (response.status === "error") { throw new Error(response.error); } diff --git a/gui/src/redux/thunks/gatherContext.ts b/gui/src/redux/thunks/gatherContext.ts deleted file mode 100644 index 8b72b5f88..000000000 --- a/gui/src/redux/thunks/gatherContext.ts +++ /dev/null @@ -1,124 +0,0 @@ -import { createAsyncThunk } from "@reduxjs/toolkit"; -import { JSONContent } from "@tiptap/core"; -import { - ContextItemWithId, - InputModifiers, - MessageContent, - RangeInFile, - SlashCommandDescription, -} from "core"; -import * as URI from "uri-js"; -import { resolveEditorContent } from "../../components/mainInput/TipTapEditor"; -import { selectSelectedChatModel } from "../slices/configSlice"; -import { ThunkApiType } from "../store"; - -export const gatherContext = createAsyncThunk< - { - selectedContextItems: ContextItemWithId[]; - selectedCode: RangeInFile[]; - content: MessageContent; - slashCommandWithInput: - | { - command: SlashCommandDescription; - input: string; - } - | undefined; - }, - { - editorState: JSONContent; - modifiers: InputModifiers; - promptPreamble?: string; - }, - ThunkApiType ->( - "chat/gatherContext", - async ( - { modifiers, editorState, promptPreamble }, - { dispatch, extra, getState }, - ) => { - const state = getState(); - const selectedChatModel = selectSelectedChatModel(state); - - const defaultContextProviders = - state.config.config.experimental?.defaultContext ?? []; - - if (!selectedChatModel) { - console.error( - "gatherContext thunk: Cannot gather context, no model selected", - ); - throw new Error("No chat model selected"); - } - - // Resolve context providers and construct new history - let [selectedContextItems, selectedCode, content, slashCommandWithInput] = - await resolveEditorContent({ - editorState, - modifiers, - ideMessenger: extra.ideMessenger, - defaultContextProviders, - availableSlashCommands: state.config.config.slashCommands, - dispatch, - }); - - // Automatically use currently open file - if (!modifiers.noContext) { - const usingFreeTrial = false; // TODO no longer tracking free trial count, need to hook up to hub - - const currentFileResponse = await extra.ideMessenger.request( - "context/getContextItems", - { - name: "currentFile", - query: "non-mention-usage", - fullInput: "", - selectedCode: [], - }, - ); - if (currentFileResponse.status === "success") { - const items = currentFileResponse.content; - if (items.length > 0) { - const currentFile = items[0]; - const uri = currentFile.uri?.value; - - // don't add the file if it's already in the context items - if ( - uri && - !selectedContextItems.find( - (item) => item.uri?.value && URI.equal(item.uri.value, uri), - ) - ) { - // Limit to 1000 lines if using free trial - if (usingFreeTrial) { - currentFile.content = currentFile.content - .split("\n") - .slice(0, 1000) - .join("\n"); - if (!currentFile.content.endsWith("```")) { - currentFile.content += "\n```"; - } - } - currentFile.id = { - providerTitle: "file", - itemId: uri, - }; - selectedContextItems.unshift(currentFile); - } - } - } - } - - if (promptPreamble) { - if (typeof content === "string") { - content = promptPreamble + content; - } else if (content[0].type === "text") { - content[0].text = promptPreamble + content[0].text; - } - } - - return { - selectedContextItems, - selectedCode, - content, - slashCommandWithInput, - }; - }, -); diff --git a/gui/src/redux/thunks/streamNormalInput.ts b/gui/src/redux/thunks/streamNormalInput.ts index 441cf3c20..292c973f9 100644 --- a/gui/src/redux/thunks/streamNormalInput.ts +++ b/gui/src/redux/thunks/streamNormalInput.ts @@ -8,6 +8,8 @@ import { selectSelectedChatModel } from "../slices/configSlice"; import { abortStream, addPromptCompletionPair, + setActive, + setInactive, setToolGenerated, streamUpdate, } from "../slices/sessionSlice"; @@ -45,6 +47,16 @@ export const streamNormalInput = createAsyncThunk< }; } + if (state.session.hasReasoningEnabled) { + completionOptions = { + ...completionOptions, + reasoning: true, + reasoningBudgetTokens: completionOptions.reasoningBudgetTokens ?? 2048, + }; + } + + dispatch(setActive()); + // Send request const gen = extra.ideMessenger.llmStreamChat( { @@ -68,6 +80,8 @@ export const streamNormalInput = createAsyncThunk< next = await gen.next(); } + dispatch(setInactive()); + // Attach prompt log and end thinking for reasoning models if (next.done && next.value) { dispatch(addPromptCompletionPair([next.value])); diff --git a/gui/src/redux/thunks/streamResponse.ts b/gui/src/redux/thunks/streamResponse.ts index caeded723..5dc031e56 100644 --- a/gui/src/redux/thunks/streamResponse.ts +++ b/gui/src/redux/thunks/streamResponse.ts @@ -5,6 +5,7 @@ import { constructMessages } from "core/llm/constructMessages"; import { getApplicableRules } from "core/llm/rules/getSystemMessageWithRules"; import posthog from "posthog-js"; import { v4 as uuidv4 } from "uuid"; +import { resolveEditorContent } from "../../components/mainInput/TipTapEditor/utils/resolveEditorContent"; import { getBaseSystemMessage } from "../../util"; import { selectSelectedChatModel } from "../slices/configSlice"; import { @@ -13,7 +14,6 @@ import { updateHistoryItemAtIndex, } from "../slices/sessionSlice"; import { ThunkApiType } from "../store"; -import { gatherContext } from "./gatherContext"; import { resetStateForNewMessage } from "./resetStateForNewMessage"; import { streamNormalInput } from "./streamNormalInput"; import { streamThunkWrapper } from "./streamThunkWrapper"; @@ -25,15 +25,11 @@ export const streamResponseThunk = createAsyncThunk< editorState: JSONContent; modifiers: InputModifiers; index?: number; - promptPreamble?: string; }, ThunkApiType >( "chat/streamResponse", - async ( - { editorState, modifiers, index, promptPreamble }, - { dispatch, extra, getState }, - ) => { + async ({ editorState, modifiers, index }, { dispatch, extra, getState }) => { await dispatch( streamThunkWrapper(async () => { const state = getState(); @@ -49,19 +45,30 @@ export const streamResponseThunk = createAsyncThunk< ); resetStateForNewMessage(); - const result = await dispatch( - gatherContext({ - editorState, - modifiers, - promptPreamble, - }), - ); + const defaultContextProviders = + state.config.config.experimental?.defaultContext ?? []; + + if (!selectedChatModel) { + console.error( + "gatherContext thunk: Cannot gather context, no model selected", + ); + throw new Error("No chat model selected"); + } + + // Resolve context providers and construct new history const { selectedContextItems, selectedCode, content, - slashCommandWithInput, - } = unwrapResult(result); + legacyCommandWithInput, + } = await resolveEditorContent({ + editorState, + modifiers, + ideMessenger: extra.ideMessenger, + defaultContextProviders, + availableSlashCommands: state.config.config.slashCommands, + dispatch, + }); // symbols for both context items AND selected codeblocks const filesForSymbols = [ @@ -133,9 +140,9 @@ export const streamResponseThunk = createAsyncThunk< }); posthog.capture("userInput", {}); - if (slashCommandWithInput) { + if (legacyCommandWithInput) { posthog.capture("step run", { - step_name: slashCommandWithInput.command.name, + step_name: legacyCommandWithInput.command.name, params: {}, }); } @@ -144,12 +151,12 @@ export const streamResponseThunk = createAsyncThunk< await dispatch( streamNormalInput({ messages, - legacySlashCommandData: slashCommandWithInput + legacySlashCommandData: legacyCommandWithInput ? { - command: slashCommandWithInput.command, + command: legacyCommandWithInput.command, contextItems: selectedContextItems, historyIndex: inputIndex, - input: slashCommandWithInput.input, + input: legacyCommandWithInput.input, selectedCode, } : undefined, diff --git a/gui/src/redux/thunks/streamResponseAfterToolCall.ts b/gui/src/redux/thunks/streamResponseAfterToolCall.ts index 21d151562..3a29491c5 100644 --- a/gui/src/redux/thunks/streamResponseAfterToolCall.ts +++ b/gui/src/redux/thunks/streamResponseAfterToolCall.ts @@ -4,11 +4,7 @@ import { constructMessages } from "core/llm/constructMessages"; import { renderContextItems } from "core/util/messageContent"; import { getBaseSystemMessage } from "../../util"; import { selectSelectedChatModel } from "../slices/configSlice"; -import { - addContextItemsAtIndex, - setActive, - streamUpdate, -} from "../slices/sessionSlice"; +import { addContextItemsAtIndex, streamUpdate } from "../slices/sessionSlice"; import { ThunkApiType } from "../store"; import { findToolCall } from "../util"; import { resetStateForNewMessage } from "./resetStateForNewMessage"; @@ -63,8 +59,6 @@ export const streamResponseAfterToolCall = createAsyncThunk< }), ); - dispatch(setActive()); - const updatedHistory = getState().session.history; const messageMode = getState().session.mode; diff --git a/gui/src/redux/thunks/streamThunkWrapper.tsx b/gui/src/redux/thunks/streamThunkWrapper.tsx index 149782416..2a6eb99b0 100644 --- a/gui/src/redux/thunks/streamThunkWrapper.tsx +++ b/gui/src/redux/thunks/streamThunkWrapper.tsx @@ -1,6 +1,5 @@ import { createAsyncThunk } from "@reduxjs/toolkit"; import StreamErrorDialog from "../../pages/gui/StreamError"; -import { setInactive } from "../slices/sessionSlice"; import { setDialogMessage, setShowDialog } from "../slices/uiSlice"; import { ThunkApiType } from "../store"; import { cancelStream } from "./cancelStream"; @@ -22,7 +21,6 @@ export const streamThunkWrapper = createAsyncThunk< }), ); } - dispatch(setInactive()); } catch (e) { dispatch(cancelStream()); dispatch(setDialogMessage()); diff --git a/gui/src/redux/util/index.ts b/gui/src/redux/util/index.ts index eab18ae60..175b304c1 100644 --- a/gui/src/redux/util/index.ts +++ b/gui/src/redux/util/index.ts @@ -1,4 +1,6 @@ -import { ToolCallState } from "core"; +import { ContextItem, ToolCallState } from "core"; +import { safeParseToolCallArgs } from "core/tools/parseArgs"; +import { IIdeMessenger } from "../../context/IdeMessenger"; import { RootState } from "../store"; export function findCurrentToolCall( @@ -15,3 +17,23 @@ export function findToolCall( (item) => item.toolCallState?.toolCallId === toolCallId, )?.toolCallState; } + +export function logToolUsage( + toolCallState: ToolCallState, + success: boolean, + messenger: IIdeMessenger, + finalOutput?: ContextItem[], +) { + messenger.post("devdata/log", { + name: "toolUsage", + data: { + toolCallId: toolCallState.toolCallId, + functionName: toolCallState.toolCall?.function?.name, + functionArgs: toolCallState.toolCall?.function?.arguments, + toolCallArgs: safeParseToolCallArgs(toolCallState.toolCall), + parsedArgs: toolCallState.parsedArgs, + output: finalOutput || toolCallState.output || [], + succeeded: success, + }, + }); +} diff --git a/gui/src/util/clientTools/callClientTool.ts b/gui/src/util/clientTools/callClientTool.ts index cdf6a960f..b5ac685d3 100644 --- a/gui/src/util/clientTools/callClientTool.ts +++ b/gui/src/util/clientTools/callClientTool.ts @@ -3,12 +3,12 @@ import { BuiltInToolNames } from "core/tools/builtIn"; import { IIdeMessenger } from "../../context/IdeMessenger"; import { AppThunkDispatch, RootState } from "../../redux/store"; import { editToolImpl } from "./editImpl"; +import { searchReplaceToolImpl } from "./searchReplaceImpl"; export interface ClientToolExtras { getState: () => RootState; dispatch: AppThunkDispatch; ideMessenger: IIdeMessenger; - streamId?: string; } export interface ClientToolOutput { @@ -37,6 +37,9 @@ export async function callClientTool( case BuiltInToolNames.EditExistingFile: output = await editToolImpl(parsedArgs, toolCall.id, extras); break; + case BuiltInToolNames.SearchAndReplaceInFile: + output = await searchReplaceToolImpl(parsedArgs, toolCall.id, extras); + break; default: throw new Error(`Invalid client tool name ${toolCall.function.name}`); } diff --git a/gui/src/util/clientTools/editImpl.ts b/gui/src/util/clientTools/editImpl.ts index 29aa5466c..6873e0512 100644 --- a/gui/src/util/clientTools/editImpl.ts +++ b/gui/src/util/clientTools/editImpl.ts @@ -1,14 +1,11 @@ import { resolveRelativePathInDir } from "core/util/ideUtils"; +import { v4 as uuid } from "uuid"; import { ClientToolImpl } from "./callClientTool"; - export const editToolImpl: ClientToolImpl = async ( args, toolCallId, extras, ) => { - if (!extras.streamId) { - throw new Error("Invalid apply state"); - } const firstUriMatch = await resolveRelativePathInDir( args.filepath, extras.ideMessenger.ide, @@ -16,30 +13,14 @@ export const editToolImpl: ClientToolImpl = async ( if (!firstUriMatch) { throw new Error(`${args.filepath} does not exist`); } - const apply = await extras.ideMessenger.request("applyToFile", { - streamId: extras.streamId, + const streamId = uuid(); + extras.ideMessenger.post("applyToFile", { + streamId, text: args.changes, toolCallId, filepath: firstUriMatch, }); - if (apply.status === "error") { - throw new Error(apply.error); - } - const state = extras.getState(); - const autoAccept = !!state.config.config.ui?.autoAcceptEditToolDiffs; - if (autoAccept) { - const out = await extras.ideMessenger.request("acceptDiff", { - streamId: extras.streamId, - filepath: firstUriMatch, - }); - if (out.status === "error") { - throw new Error(out.error); - } - return { - respondImmediately: true, - output: undefined, // TODO - feed edit results back to model (also in parallel listeners) - }; - } + return { respondImmediately: false, output: undefined, // No immediate output. diff --git a/gui/src/util/clientTools/searchReplaceImpl.test.ts b/gui/src/util/clientTools/searchReplaceImpl.test.ts new file mode 100644 index 000000000..97dc50eb0 --- /dev/null +++ b/gui/src/util/clientTools/searchReplaceImpl.test.ts @@ -0,0 +1,525 @@ +import { findSearchMatch } from "core/edit/searchAndReplace/findSearchMatch"; +import { parseAllSearchReplaceBlocks } from "core/edit/searchAndReplace/parseSearchReplaceBlock"; +import { resolveRelativePathInDir } from "core/util/ideUtils"; +import { beforeEach, describe, expect, it, vi } from "vitest"; +import { ClientToolExtras } from "./callClientTool"; +import { searchReplaceToolImpl } from "./searchReplaceImpl"; + +// Mock the dependencies +vi.mock("core/edit/searchAndReplace/findSearchMatch"); +vi.mock("core/edit/searchAndReplace/parseSearchReplaceBlock"); +vi.mock("core/util/ideUtils"); +vi.mock("uuid", () => ({ + v4: vi.fn(() => "test-stream-id"), +})); + +const mockFindSearchMatch = vi.mocked(findSearchMatch); +const mockParseAllSearchReplaceBlocks = vi.mocked(parseAllSearchReplaceBlocks); +const mockResolveRelativePathInDir = vi.mocked(resolveRelativePathInDir); + +describe("searchReplaceToolImpl", () => { + let mockExtras: ClientToolExtras; + let mockIdeMessenger: any; + + beforeEach(() => { + // Reset all mocks + vi.clearAllMocks(); + + // Create mock IDE messenger + mockIdeMessenger = { + ide: { + readFile: vi.fn(), + }, + request: vi.fn(), + }; + + // Create mock extras + mockExtras = { + ideMessenger: mockIdeMessenger, + getState: vi.fn(), + dispatch: vi.fn(), + }; + }); + + describe("basic validation", () => { + it("should throw error when file does not exist", async () => { + mockResolveRelativePathInDir.mockResolvedValue(undefined); + + await expect( + searchReplaceToolImpl( + { filepath: "nonexistent.txt", diff: "some diff" }, + "tool-call-id", + mockExtras, + ), + ).rejects.toThrow("File nonexistent.txt does not exist"); + }); + + it("should throw error when no search/replace blocks found", async () => { + mockResolveRelativePathInDir.mockResolvedValue("/resolved/path/test.txt"); + mockParseAllSearchReplaceBlocks.mockReturnValue([]); + + await expect( + searchReplaceToolImpl( + { filepath: "test.txt", diff: "invalid diff content" }, + "tool-call-id", + mockExtras, + ), + ).rejects.toThrow("No complete search/replace blocks found"); + }); + }); + + describe("single block replacement", () => { + it("should successfully apply single search/replace block", async () => { + const originalContent = `function hello() { + console.log("Hello"); + return "world"; +}`; + + const expectedFinalContent = `function hello() { + console.log("Hi there!"); + return "world"; +}`; + + // Setup mocks + mockResolveRelativePathInDir.mockResolvedValue("/resolved/path/test.js"); + mockParseAllSearchReplaceBlocks.mockReturnValue([ + { + isComplete: true, + searchContent: 'console.log("Hello");', + replaceContent: 'console.log("Hi there!");', + }, + ]); + mockIdeMessenger.ide.readFile.mockResolvedValue(originalContent); + + // Calculate correct positions for 'console.log("Hello");' in the original content + const searchText = 'console.log("Hello");'; + const startIndex = originalContent.indexOf(searchText); + const endIndex = startIndex + searchText.length; + + mockFindSearchMatch.mockReturnValue({ + startIndex, + endIndex, + }); + mockIdeMessenger.request.mockResolvedValue({ status: "success" }); + + const result = await searchReplaceToolImpl( + { filepath: "test.js", diff: "mock diff content" }, + "tool-call-id", + mockExtras, + ); + + // Verify the result + expect(result).toEqual({ + respondImmediately: false, + output: undefined, + }); + + // Verify applyToFile was called with correct parameters + expect(mockIdeMessenger.request).toHaveBeenCalledWith("applyToFile", { + text: expectedFinalContent, + streamId: "test-stream-id", + filepath: "/resolved/path/test.js", + toolCallId: "tool-call-id", + isSearchAndReplace: true, + }); + }); + }); + + describe("multiple block replacement", () => { + it("should successfully apply multiple search/replace blocks sequentially", async () => { + const originalContent = `const a = 1; +const b = 2; +const c = 3;`; + + const expectedFinalContent = `const a = 100; +const b = 200; +const c = 3;`; + + // Setup mocks + mockResolveRelativePathInDir.mockResolvedValue("/resolved/path/test.js"); + mockParseAllSearchReplaceBlocks.mockReturnValue([ + { + isComplete: true, + searchContent: "const a = 1;", + replaceContent: "const a = 100;", + }, + { + isComplete: true, + searchContent: "const b = 2;", + replaceContent: "const b = 200;", + }, + ]); + mockIdeMessenger.ide.readFile.mockResolvedValue(originalContent); + + // Calculate positions for sequential replacements + const firstSearchText = "const a = 1;"; + const secondSearchText = "const b = 2;"; + + const firstStartIndex = originalContent.indexOf(firstSearchText); + const firstEndIndex = firstStartIndex + firstSearchText.length; + + // After first replacement: "const a = 100;\nconst b = 2;\nconst c = 3;" + const contentAfterFirstReplacement = + originalContent.substring(0, firstStartIndex) + + "const a = 100;" + + originalContent.substring(firstEndIndex); + + const secondStartIndex = + contentAfterFirstReplacement.indexOf(secondSearchText); + const secondEndIndex = secondStartIndex + secondSearchText.length; + + // Mock sequential search matches + mockFindSearchMatch + .mockReturnValueOnce({ + startIndex: firstStartIndex, + endIndex: firstEndIndex, + }) + .mockReturnValueOnce({ + startIndex: secondStartIndex, + endIndex: secondEndIndex, + }); + + mockIdeMessenger.request.mockResolvedValue({ status: "success" }); + + const result = await searchReplaceToolImpl( + { filepath: "test.js", diff: "mock diff content" }, + "tool-call-id", + mockExtras, + ); + + // Verify the result + expect(result).toEqual({ + respondImmediately: false, + output: undefined, + }); + + // Verify findSearchMatch was called twice with updated content + expect(mockFindSearchMatch).toHaveBeenCalledTimes(2); + expect(mockFindSearchMatch).toHaveBeenNthCalledWith( + 1, + originalContent, + "const a = 1;", + ); + expect(mockFindSearchMatch).toHaveBeenNthCalledWith( + 2, + contentAfterFirstReplacement, + "const b = 2;", + ); + // Verify final applyToFile call + expect(mockIdeMessenger.request).toHaveBeenCalledWith("applyToFile", { + text: expectedFinalContent, + streamId: "test-stream-id", + filepath: "/resolved/path/test.js", + toolCallId: "tool-call-id", + isSearchAndReplace: true, + }); + }); + }); + + describe("deletion scenarios", () => { + it("should handle empty replacement (deletion)", async () => { + const originalContent = `keep this +remove this line +keep this too`; + + const expectedFinalContent = `keep this + +keep this too`; + + // Setup mocks + mockResolveRelativePathInDir.mockResolvedValue("/resolved/path/test.txt"); + mockParseAllSearchReplaceBlocks.mockReturnValue([ + { + isComplete: true, + searchContent: "remove this line", + replaceContent: "", + }, + ]); + mockIdeMessenger.ide.readFile.mockResolvedValue(originalContent); + mockFindSearchMatch.mockReturnValue({ + startIndex: 10, // Position of "remove this line" + endIndex: 26, // End of "remove this line" + }); + mockIdeMessenger.request.mockResolvedValue({ status: "success" }); + + const result = await searchReplaceToolImpl( + { filepath: "test.txt", diff: "mock diff content" }, + "tool-call-id", + mockExtras, + ); + + expect(result).toEqual({ + respondImmediately: false, + output: undefined, + }); + + expect(mockIdeMessenger.request).toHaveBeenCalledWith("applyToFile", { + text: expectedFinalContent, + streamId: "test-stream-id", + filepath: "/resolved/path/test.txt", + toolCallId: "tool-call-id", + isSearchAndReplace: true, + }); + }); + + it("should handle undefined replaceContent as empty string", async () => { + const originalContent = "line1\nline2\nline3"; + const expectedFinalContent = "line1\n\nline3"; + + mockResolveRelativePathInDir.mockResolvedValue("/resolved/path/test.txt"); + mockParseAllSearchReplaceBlocks.mockReturnValue([ + { + isComplete: true, + searchContent: "line2", + replaceContent: undefined, // undefined should be treated as empty string + }, + ]); + mockIdeMessenger.ide.readFile.mockResolvedValue(originalContent); + mockFindSearchMatch.mockReturnValue({ + startIndex: 6, + endIndex: 11, + }); + mockIdeMessenger.request.mockResolvedValue({ status: "success" }); + + await searchReplaceToolImpl( + { filepath: "test.txt", diff: "mock diff content" }, + "tool-call-id", + mockExtras, + ); + + expect(mockIdeMessenger.request).toHaveBeenCalledWith("applyToFile", { + text: expectedFinalContent, + streamId: "test-stream-id", + filepath: "/resolved/path/test.txt", + toolCallId: "tool-call-id", + isSearchAndReplace: true, + }); + }); + }); + + describe("error handling", () => { + it("should throw error when search content is not found", async () => { + mockResolveRelativePathInDir.mockResolvedValue("/resolved/path/test.txt"); + mockParseAllSearchReplaceBlocks.mockReturnValue([ + { + isComplete: true, + searchContent: "nonexistent content", + replaceContent: "replacement", + }, + ]); + mockIdeMessenger.ide.readFile.mockResolvedValue("some file content"); + mockFindSearchMatch.mockReturnValue(null); // Search content not found + + await expect( + searchReplaceToolImpl( + { filepath: "test.txt", diff: "mock diff content" }, + "tool-call-id", + mockExtras, + ), + ).rejects.toThrow( + "Search content not found in block 1:\nnonexistent content", + ); + }); + + it("should throw error when search content is not found in second block", async () => { + mockResolveRelativePathInDir.mockResolvedValue("/resolved/path/test.txt"); + mockParseAllSearchReplaceBlocks.mockReturnValue([ + { + isComplete: true, + searchContent: "found content", + replaceContent: "replacement1", + }, + { + isComplete: true, + searchContent: "missing content", + replaceContent: "replacement2", + }, + ]); + mockIdeMessenger.ide.readFile.mockResolvedValue( + "found content and other stuff", + ); + + // First search succeeds, second fails + mockFindSearchMatch + .mockReturnValueOnce({ + startIndex: 0, + endIndex: 13, + }) + .mockReturnValueOnce(null); // Second search fails + + await expect( + searchReplaceToolImpl( + { filepath: "test.txt", diff: "mock diff content" }, + "tool-call-id", + mockExtras, + ), + ).rejects.toThrow( + "Search content not found in block 2:\nmissing content", + ); + }); + + it("should handle file read errors", async () => { + mockResolveRelativePathInDir.mockResolvedValue("/resolved/path/test.txt"); + mockParseAllSearchReplaceBlocks.mockReturnValue([ + { + isComplete: true, + searchContent: "content", + replaceContent: "replacement", + }, + ]); + mockIdeMessenger.ide.readFile.mockRejectedValue( + new Error("File read error"), + ); + + await expect( + searchReplaceToolImpl( + { filepath: "test.txt", diff: "mock diff content" }, + "tool-call-id", + mockExtras, + ), + ).rejects.toThrow("Failed to apply search and replace: File read error"); + }); + + it("should handle applyToFile errors", async () => { + mockResolveRelativePathInDir.mockResolvedValue("/resolved/path/test.txt"); + mockParseAllSearchReplaceBlocks.mockReturnValue([ + { + isComplete: true, + searchContent: "content", + replaceContent: "replacement", + }, + ]); + mockIdeMessenger.ide.readFile.mockResolvedValue("content"); + mockFindSearchMatch.mockReturnValue({ + startIndex: 0, + endIndex: 7, + }); + mockIdeMessenger.request.mockRejectedValue(new Error("Apply failed")); + + await expect( + searchReplaceToolImpl( + { filepath: "test.txt", diff: "mock diff content" }, + "tool-call-id", + mockExtras, + ), + ).rejects.toThrow("Failed to apply search and replace: Apply failed"); + }); + }); + + describe("edge cases", () => { + it("should handle empty search content", async () => { + const originalContent = "existing content"; + const expectedFinalContent = "new contentexisting content"; + + mockResolveRelativePathInDir.mockResolvedValue("/resolved/path/test.txt"); + mockParseAllSearchReplaceBlocks.mockReturnValue([ + { + isComplete: true, + searchContent: "", + replaceContent: "new content", + }, + ]); + mockIdeMessenger.ide.readFile.mockResolvedValue(originalContent); + mockFindSearchMatch.mockReturnValue({ + startIndex: 0, // Empty search matches at beginning + endIndex: 0, + }); + mockIdeMessenger.request.mockResolvedValue({ status: "success" }); + + await searchReplaceToolImpl( + { filepath: "test.txt", diff: "mock diff content" }, + "tool-call-id", + mockExtras, + ); + + expect(mockIdeMessenger.request).toHaveBeenCalledWith("applyToFile", { + text: expectedFinalContent, + streamId: "test-stream-id", + filepath: "/resolved/path/test.txt", + toolCallId: "tool-call-id", + isSearchAndReplace: true, + }); + }); + + it("should handle whole file replacement", async () => { + const originalContent = "old file content"; + const expectedFinalContent = "completely new content"; + + mockResolveRelativePathInDir.mockResolvedValue("/resolved/path/test.txt"); + mockParseAllSearchReplaceBlocks.mockReturnValue([ + { + isComplete: true, + searchContent: originalContent, + replaceContent: "completely new content", + }, + ]); + mockIdeMessenger.ide.readFile.mockResolvedValue(originalContent); + mockFindSearchMatch.mockReturnValue({ + startIndex: 0, + endIndex: originalContent.length, + }); + mockIdeMessenger.request.mockResolvedValue({ status: "success" }); + + await searchReplaceToolImpl( + { filepath: "test.txt", diff: "mock diff content" }, + "tool-call-id", + mockExtras, + ); + + expect(mockIdeMessenger.request).toHaveBeenCalledWith("applyToFile", { + text: expectedFinalContent, + streamId: "test-stream-id", + filepath: "/resolved/path/test.txt", + toolCallId: "tool-call-id", + isSearchAndReplace: true, + }); + }); + }); + + describe("dependency integration", () => { + it("should call all dependencies with correct parameters", async () => { + const originalContent = "test content"; + + mockResolveRelativePathInDir.mockResolvedValue("/resolved/path/test.txt"); + mockParseAllSearchReplaceBlocks.mockReturnValue([ + { + isComplete: true, + searchContent: "test", + replaceContent: "updated", + }, + ]); + mockIdeMessenger.ide.readFile.mockResolvedValue(originalContent); + mockFindSearchMatch.mockReturnValue({ + startIndex: 0, + endIndex: 4, + }); + mockIdeMessenger.request.mockResolvedValue({ status: "success" }); + + await searchReplaceToolImpl( + { filepath: "relative/test.txt", diff: "mock diff content" }, + "tool-call-id", + mockExtras, + ); + + // Verify all dependencies were called correctly + expect(mockResolveRelativePathInDir).toHaveBeenCalledWith( + "relative/test.txt", + mockIdeMessenger.ide, + ); + expect(mockParseAllSearchReplaceBlocks).toHaveBeenCalledWith( + "mock diff content", + ); + expect(mockIdeMessenger.ide.readFile).toHaveBeenCalledWith( + "/resolved/path/test.txt", + ); + expect(mockFindSearchMatch).toHaveBeenCalledWith(originalContent, "test"); + expect(mockIdeMessenger.request).toHaveBeenCalledWith("applyToFile", { + text: "updated content", + streamId: "test-stream-id", + filepath: "/resolved/path/test.txt", + toolCallId: "tool-call-id", + isSearchAndReplace: true, + }); + }); + }); +}); diff --git a/gui/src/util/clientTools/searchReplaceImpl.ts b/gui/src/util/clientTools/searchReplaceImpl.ts new file mode 100644 index 000000000..cbab201f3 --- /dev/null +++ b/gui/src/util/clientTools/searchReplaceImpl.ts @@ -0,0 +1,80 @@ +import { findSearchMatch } from "core/edit/searchAndReplace/findSearchMatch"; +import { parseAllSearchReplaceBlocks } from "core/edit/searchAndReplace/parseSearchReplaceBlock"; +import { resolveRelativePathInDir } from "core/util/ideUtils"; +import { v4 as uuid } from "uuid"; +import { ClientToolImpl } from "./callClientTool"; + +export const searchReplaceToolImpl: ClientToolImpl = async ( + args, + toolCallId, + extras, +) => { + const { filepath, diff } = args; + + const streamId = uuid(); + + // Resolve the file path + const resolvedFilepath = await resolveRelativePathInDir( + filepath, + extras.ideMessenger.ide, + ); + if (!resolvedFilepath) { + throw new Error(`File ${filepath} does not exist`); + } + + // Parse all search/replace blocks from the diff content + const blocks = parseAllSearchReplaceBlocks(diff); + + if (blocks.length === 0) { + throw new Error("No complete search/replace blocks found"); + } + + try { + // Read the current file content + const originalContent = + await extras.ideMessenger.ide.readFile(resolvedFilepath); + let currentContent = originalContent; + + // Apply all replacements sequentially to build the final content + for (let i = 0; i < blocks.length; i++) { + const block = blocks[i]; + const { searchContent, replaceContent } = block; + + // Find the search content in the current state of the file + const match = findSearchMatch(currentContent, searchContent || ""); + if (!match) { + throw new Error( + `Search content not found in block ${i + 1}:\n${searchContent}`, + ); + } + + // Apply the replacement + currentContent = + currentContent.substring(0, match.startIndex) + + (replaceContent || "") + + currentContent.substring(match.endIndex); + } + + // Single applyToFile call with all accumulated changes + // This works becaues of our logic in `applyCodeBlock` that determines + // that the full file rewrite here can be applied instantly, so the diff + // lines are just st + await extras.ideMessenger.request("applyToFile", { + streamId, + toolCallId, + text: currentContent, + filepath: resolvedFilepath, + isSearchAndReplace: true, + }); + + // Return success - applyToFile will handle the completion state + return { + respondImmediately: false, // Let apply state handle completion + output: undefined, + }; + } catch (error) { + throw new Error( + `Failed to apply search and replace: ${error instanceof Error ? error.message : String(error)}`, + ); + } +}; diff --git a/gui/src/util/index.ts b/gui/src/util/index.ts index ccb1be1e6..dc581b51b 100644 --- a/gui/src/util/index.ts +++ b/gui/src/util/index.ts @@ -1,12 +1,12 @@ import { MessageModes, ModelDescription } from "core"; import { ProfileDescription } from "core/config/ProfileLifecycleManager"; -import _ from "lodash"; -import { KeyboardEvent } from "react"; -import { getLocalStorage } from "./localStorage"; import { - DEFAULT_CHAT_SYSTEM_MESSAGE, DEFAULT_AGENT_SYSTEM_MESSAGE, + DEFAULT_CHAT_SYSTEM_MESSAGE, } from "core/llm/constructMessages"; +import _ from "lodash"; +import { KeyboardEvent as ReactKeyboardEvent } from "react"; +import { getLocalStorage } from "./localStorage"; export type Platform = "mac" | "linux" | "windows" | "unknown"; @@ -26,7 +26,7 @@ export function getPlatform(): Platform { export function isMetaEquivalentKeyPressed({ metaKey, ctrlKey, -}: KeyboardEvent): boolean { +}: KeyboardEvent | ReactKeyboardEvent): boolean { const platform = getPlatform(); switch (platform) { case "mac": diff --git a/gui/src/util/localStorage.ts b/gui/src/util/localStorage.ts index a560aaf22..244b51fc6 100644 --- a/gui/src/util/localStorage.ts +++ b/gui/src/util/localStorage.ts @@ -16,11 +16,13 @@ type LocalStorageTypes = { showTutorialCard: boolean; shownProfilesIntroduction: boolean; disableIndexing: boolean; + hasExitedFreeTrial: boolean; }; export enum LocalStorageKey { IsExploreDialogOpen = "isExploreDialogOpen", HasDismissedExploreDialog = "hasDismissedExploreDialog", + HasExitedFreeTrial = "hasExitedFreeTrial", } export function getLocalStorage( diff --git a/gui/src/util/test/config.ts b/gui/src/util/test/config.ts new file mode 100644 index 000000000..154ab7d24 --- /dev/null +++ b/gui/src/util/test/config.ts @@ -0,0 +1,67 @@ +import { EnhancedStore } from "@reduxjs/toolkit"; +import { BrowserSerializedContinueConfig, ModelDescription } from "core"; +import { SerializedOrgWithProfiles } from "core/config/ProfileLifecycleManager"; +import { copyOf } from "core/util"; +import { MockIdeMessenger } from "../../context/MockIdeMessenger"; + +interface TestConfigUpdateParams { + store: EnhancedStore; + ideMessenger: MockIdeMessenger; + newProfileId?: string; + newOrgId?: string; + newOrgs?: SerializedOrgWithProfiles[]; + editConfig?: ( + current: BrowserSerializedContinueConfig, + ) => BrowserSerializedContinueConfig; +} + +export function triggerConfigUpdate({ + store, + ideMessenger, + editConfig, + newOrgs, + newOrgId, + newProfileId, +}: TestConfigUpdateParams) { + const state = store.getState(); + ideMessenger.mockMessageToWebview("configUpdate", { + organizations: newOrgs ?? state.profiles.organizations, + selectedOrgId: newOrgId ?? state.profiles.selectedOrganizationId, + profileId: newProfileId ?? state.profiles.selectedProfileId, + result: { + config: editConfig + ? editConfig(copyOf(state.config.config)) + : state.config.config, + configLoadInterrupted: false, + errors: [], + }, + }); +} + +export function addAndSelectChatModel( + store: EnhancedStore, + ideMessenger: MockIdeMessenger, + llmDesc: ModelDescription, +) { + triggerConfigUpdate({ + store, + ideMessenger, + editConfig(current) { + current.modelsByRole.chat.push(llmDesc); + current.selectedModelByRole.chat = llmDesc; + return current; + }, + }); +} + +export function addAndSelectMockLlm( + store: EnhancedStore, + ideMessenger: MockIdeMessenger, +) { + addAndSelectChatModel(store, ideMessenger, { + model: "mock", + provider: "mock", + title: "Mock LLM", + underlyingProviderName: "mock", + }); +} diff --git a/gui/src/util/test/utils.ts b/gui/src/util/test/utils.ts new file mode 100644 index 000000000..ebc4181d7 --- /dev/null +++ b/gui/src/util/test/utils.ts @@ -0,0 +1,102 @@ +import { screen, waitFor } from "@testing-library/dom"; +import { act } from "@testing-library/react"; +import { Editor } from "@tiptap/core"; +import { ChatMessage } from "core"; +import { MockIdeMessenger } from "../../context/MockIdeMessenger"; + +function logDomText() { + const bodyText = document.body.innerHTML; + const parser = new DOMParser(); + const doc = parser.parseFromString(bodyText, "text/html"); + let cleaned = doc.body.textContent ?? ""; + cleaned = cleaned?.replace( + "No resultsAaModelsRulesDocsPromptsToolsMCPCreate your first assistant", + "", + ); + cleaned = cleaned?.replace( + "Alt⏎ Active file⏎ Enter⏎Log in to access a free trial of theModels Add-OnLog in to Continue HubOr, configure your own models", + "", + ); + cleaned = cleaned.replaceAll("Select model", ""); + cleaned = cleaned.replaceAll("Mock LLM", ""); + cleaned = cleaned.replaceAll(/^Chat|Chat$/g, ""); + console.log(cleaned || "No body content"); +} + +export function logAllTestIds() { + const elements = document.querySelectorAll("*"); + + const testIds = Array.from(elements) + .map((el) => Array.from(el.attributes)) + .flat() + .filter((a) => a.name === "data-testid") + .map((a) => a.value); + console.log("Available test ids", testIds); +} +export async function getElementByTestId(testId: string): Promise { + try { + const testIdElement = await waitFor(() => screen.findByTestId(testId)); + expect(testIdElement).toBeInTheDocument(); + return testIdElement; + } catch (e) { + logAllTestIds(); + throw new Error(`Element with testId "${testId}" not found`); + } +} + +export async function verifyNotPresentByTestId(testId: string): Promise { + const element = await waitFor(() => screen.queryByTestId(testId)); + expect(element).not.toBeInTheDocument(); +} + +export async function verifyNotPresentByText(text: string): Promise { + const element = screen.queryByText(text); + expect(element).not.toBeInTheDocument(); +} + +export async function getElementByText(text: string): Promise { + try { + const textElement = await waitFor(() => screen.findByText(text)); + expect(textElement).toBeInTheDocument(); + return textElement; + } catch (e) { + logDomText(); + throw new Error(`Element with text "${text}" not found.`); + } +} + +export async function getMainEditor(): Promise { + const editorElement = await getElementByTestId("editor-input-main"); + if ("editor" in editorElement) { + return editorElement.editor as Editor; + } else { + throw new Error("Main editor not found within editor container"); + } +} + +export async function sendInputWithMockedResponse( + ideMessenger: MockIdeMessenger, + input: string, + response: ChatMessage[], +): Promise { + // Setup the mock response before any actions + ideMessenger.chatResponse = response; + + // Wait for the editor to be in the document + const editor = await getMainEditor(); + + // Find the submit button + const sendButton = await getElementByTestId("submit-input-button"); + + // Insert content into the editor + await act(async () => { + editor.commands.insertContent(input); + }); + + await getElementByText(input); + + // Click the send button + await act(async () => { + sendButton.click(); + }); +} diff --git a/gui/vite.config.ts b/gui/vite.config.ts index 957a1b0f5..cd70410f5 100644 --- a/gui/vite.config.ts +++ b/gui/vite.config.ts @@ -32,5 +32,18 @@ export default defineConfig({ globals: true, environment: "jsdom", setupFiles: "./src/util/test/setupTests.ts", + onConsoleLog(log, type) { + if (type === "stderr") { + if ( + [ + "contentEditable", + "An update to Chat inside a test was not wrapped in act", + ].some((text) => log.includes(text)) + ) { + return false; + } + } + return true; + }, }, }); diff --git a/keycaps-todo.md b/keycaps-todo.md deleted file mode 100644 index 0004cd0ad..000000000 --- a/keycaps-todo.md +++ /dev/null @@ -1,15 +0,0 @@ -gui\src\components\mainInput\TutorialCard.tsx - -![image](https://github.com/user-attachments/assets/2e682fe1-b5b4-4d2d-a615-645b409fefb1) - -![image](https://github.com/user-attachments/assets/d4b5f474-c8b8-478e-867d-aa9f8a2f0fbb) - -gui\src\components\modelSelection\ModelSelect.tsx - -![image](https://github.com/user-attachments/assets/346b6774-fa3b-462c-af25-fe6264457387) - -![image](https://github.com/user-attachments/assets/2881c290-f5a6-4b3d-8f36-8fece492e346) - -gui\src\components\modelSelection\platform\AssistantSelect.tsx - -??? diff --git a/manual-testing-sandbox/next-edit/next-edit-1-1-sol.ts b/manual-testing-sandbox/next-edit/next-edit-1-1-sol.ts new file mode 100644 index 000000000..b527f75f8 --- /dev/null +++ b/manual-testing-sandbox/next-edit/next-edit-1-1-sol.ts @@ -0,0 +1,81 @@ +// A clean implementation of the price calculation utility +// Solution for: next-edit-1-1.ts + +/** + * Interface for a purchasable item + */ +interface PricedItem { + name: string; + price: number; +} + +/** + * Calculates the total price of items with an optional discount + * + * @param items - Array of priced items + * @param discountPercentage - Optional discount to apply (percentage) + * @returns The final price after discount + */ +function calculateTotalPrice( + items: PricedItem[], + discountPercentage = 0, +): number { + // Calculate total price + const subtotal = items.reduce((total, item) => total + item.price, 0); + + // Apply discount + const discount = (subtotal * discountPercentage) / 100; + const finalPrice = subtotal - discount; + + return finalPrice; +} + +// Example usage +const cart: PricedItem[] = [ + { name: "Shirt", price: 25 }, + { name: "Pants", price: 50 }, + { name: "Shoes", price: 100 }, +]; + +// Calculate price with 10% discount +const finalPrice = calculateTotalPrice(cart, 10); +console.log(`Final price: $${finalPrice}`); + +// Export function +export default calculateTotalPrice; + +/* +Single Responsibility Principle: + +The function now has a clearer, more descriptive name: calculateTotalPrice instead of calc_price +Used proper camelCase naming convention for JavaScript/TypeScript functions + + +Type Safety: + +Created a proper PricedItem interface instead of using any[] +Added proper type annotations throughout the code + + +Code Quality Improvements: + +Replaced the for loop with a more functional reduce() approach +Used const instead of let where variables aren't reassigned +Used default parameter syntax instead of conditional checking +Improved variable naming for clarity +Added JSDoc comments for better documentation +Used template literals instead of string concatenation + + +Fixed Potential Issues: + +Replaced loose inequality check (!=) with default parameter +Changed var to const in the loop to avoid scope issues +Made intermediate calculations more explicit with named variables + + +Maintainability: + +Added proper documentation with JSDoc comments +Used more explicit and descriptive variable names +*/ diff --git a/manual-testing-sandbox/next-edit/next-edit-1-1.ts b/manual-testing-sandbox/next-edit/next-edit-1-1.ts new file mode 100644 index 000000000..5f08aa3b4 --- /dev/null +++ b/manual-testing-sandbox/next-edit/next-edit-1-1.ts @@ -0,0 +1,32 @@ +// A simple utility function with minor issues +// Difficulty: 1 - Easy fixes needed + +// Function to calculate total price with discount +function calc_price(items: any[], discountPercentage?: number) { + // Calculate total price + let total = 0; + for (var i = 0; i < items.length; i++) { + total = total + items[i].price; + } + + // Apply discount + if (discountPercentage != undefined) { + total = total - (total * discountPercentage) / 100; + } + + return total; +} + +// Example usage +const cart = [ + { name: "Shirt", price: 25 }, + { name: "Pants", price: 50 }, + { name: "Shoes", price: 100 }, +]; + +// Calculate price with 10% discount +const finalPrice = calc_price(cart, 10); +console.log("Final price: $" + finalPrice); + +// Export function +export default calc_price; diff --git a/manual-testing-sandbox/next-edit/next-edit-10-5-sol.ts b/manual-testing-sandbox/next-edit/next-edit-10-5-sol.ts new file mode 100644 index 000000000..5fcc108bb --- /dev/null +++ b/manual-testing-sandbox/next-edit/next-edit-10-5-sol.ts @@ -0,0 +1,1110 @@ +// Clean, refactored project management application +// Demonstrates proper separation of concerns, clean architecture, and SOLID principles + +// ===== DOMAIN MODELS ===== + +interface User { + readonly id: string; + readonly username: string; + readonly email: string; + readonly isAdmin: boolean; + completedTasks: number; + achievements: string[]; +} + +interface Task { + readonly id: string; + readonly createdAt: Date; + readonly createdBy: string; + title: string; + description: string; + status: TaskStatus; + priority: TaskPriority; + assignedTo: string; + projectId: string; + dueDate: Date | null; + comments: string[]; + attachments: string[]; + tags: string[]; + timeSpent: number; + lastUpdated: Date; + completedAt?: Date; + completedBy?: string; + reopenCount: number; +} + +interface Project { + readonly id: string; + readonly createdBy: string; + readonly members: string[]; + readonly isPublic: boolean; + taskCount: number; + progress: number; + lastActivity: Date; +} + +type TaskStatus = "new" | "in_progress" | "completed" | "cancelled"; +type TaskPriority = "low" | "medium" | "high"; + +interface TaskSearchCriteria { + status?: TaskStatus; + priority?: TaskPriority; + assignedTo?: string; + projectId?: string; + searchText?: string; + createdAfter?: Date; + createdBefore?: Date; + dueBefore?: Date; + dueAfter?: Date; + sortBy?: "dueDate" | "priority" | "createdAt"; + sortDir?: "asc" | "desc"; + page?: number; + limit?: number; +} + +interface CreateTaskRequest { + title: string; + description?: string; + priority?: TaskPriority; + assignedTo?: string; + projectId: string; + dueDate?: Date; + tags?: string[]; +} + +interface UpdateTaskRequest { + title?: string; + description?: string; + status?: TaskStatus; + priority?: TaskPriority; + assignedTo?: string; + dueDate?: Date; + tags?: string[]; +} + +// ===== CONFIGURATION ===== + +interface AppConfig { + readonly maxTasksPerUser: number; + readonly maxProjectsPerUser: number; + readonly defaultPriority: TaskPriority; + readonly enableNotifications: boolean; + readonly serverUrl: string; +} + +const DEFAULT_CONFIG: AppConfig = { + maxTasksPerUser: 20, + maxProjectsPerUser: 5, + defaultPriority: "medium", + enableNotifications: true, + serverUrl: "https://api.example.com/v1", +}; + +// ===== UTILITIES ===== + +class IdGenerator { + static generate(prefix: string): string { + return `${prefix}_${Math.random().toString(36).substring(2, 15)}${Date.now()}`; + } +} + +class ProgressCalculator { + static calculate(tasks: Task[]): number { + if (tasks.length === 0) return 0; + const completed = tasks.filter( + (task) => task.status === "completed", + ).length; + return Math.round((completed / tasks.length) * 100); + } +} + +class TaskSorter { + static sort( + tasks: Task[], + sortBy: string, + sortDir: "asc" | "desc" = "asc", + ): Task[] { + return [...tasks].sort((a, b) => { + switch (sortBy) { + case "dueDate": + return this.compareDates(a.dueDate, b.dueDate, sortDir); + case "priority": + return this.comparePriorities(a.priority, b.priority, sortDir); + default: + return this.compareDates(a.createdAt, b.createdAt, sortDir); + } + }); + } + + private static compareDates( + a: Date | null, + b: Date | null, + sortDir: "asc" | "desc", + ): number { + if (!a) return sortDir === "asc" ? 1 : -1; + if (!b) return sortDir === "asc" ? -1 : 1; + const diff = a.getTime() - b.getTime(); + return sortDir === "asc" ? diff : -diff; + } + + private static comparePriorities( + a: TaskPriority, + b: TaskPriority, + sortDir: "asc" | "desc", + ): number { + const priorityMap: Record = { + high: 3, + medium: 2, + low: 1, + }; + const diff = priorityMap[a] - priorityMap[b]; + return sortDir === "asc" ? diff : -diff; + } +} + +class Paginator { + static paginate(items: T[], page: number = 1, limit: number): T[] { + const start = (page - 1) * limit; + return items.slice(start, start + limit); + } +} + +// ===== VALIDATION SERVICES ===== + +class TaskValidationError extends Error { + constructor( + message: string, + public field?: string, + ) { + super(message); + this.name = "TaskValidationError"; + } +} + +class TaskValidator { + constructor( + private readonly projectRepository: ProjectRepository, + private readonly taskRepository: TaskRepository, + private readonly config: AppConfig, + ) {} + + validateCreateRequest(request: CreateTaskRequest): void { + if (!request.title?.trim()) { + throw new TaskValidationError("Task title is required", "title"); + } + + if (!request.projectId) { + throw new TaskValidationError( + "Task must belong to a project", + "projectId", + ); + } + + if (!this.projectRepository.exists(request.projectId)) { + throw new TaskValidationError("Project does not exist", "projectId"); + } + } + + validateTaskLimits(assignedUserId: string): void { + const userActiveTasks = + this.taskRepository.getActiveTasksByUser(assignedUserId); + if (userActiveTasks.length >= this.config.maxTasksPerUser) { + throw new TaskValidationError( + `User cannot have more than ${this.config.maxTasksPerUser} active tasks`, + ); + } + } + + validateUpdateRequest(request: UpdateTaskRequest): void { + if (request.title !== undefined && !request.title?.trim()) { + throw new TaskValidationError("Task title cannot be empty", "title"); + } + } +} + +// ===== REPOSITORY INTERFACES ===== + +interface TaskRepository { + save(task: Task): void; + findById(id: string): Task | null; + findAll(): Task[]; + update(id: string, task: Task): void; + delete(id: string): void; + getActiveTasksByUser(userId: string): Task[]; + findByProject(projectId: string): Task[]; + search(criteria: TaskSearchCriteria, currentUserId: string): Task[]; +} + +interface UserRepository { + findById(id: string): User | null; + findByUsername(username: string): User | null; + update(user: User): void; +} + +interface ProjectRepository { + findById(id: string): Project | null; + exists(id: string): boolean; + update(project: Project): void; + isUserMember(projectId: string, userId: string): boolean; +} + +// ===== IN-MEMORY IMPLEMENTATIONS ===== + +class InMemoryTaskRepository implements TaskRepository { + private tasks: Map = new Map(); + + save(task: Task): void { + this.tasks.set(task.id, { ...task }); + } + + findById(id: string): Task | null { + const task = this.tasks.get(id); + return task ? { ...task } : null; + } + + findAll(): Task[] { + return Array.from(this.tasks.values()).map((task) => ({ ...task })); + } + + update(id: string, task: Task): void { + if (!this.tasks.has(id)) { + throw new Error("Task not found"); + } + this.tasks.set(id, { ...task }); + } + + delete(id: string): void { + this.tasks.delete(id); + } + + getActiveTasksByUser(userId: string): Task[] { + return this.findAll().filter( + (task) => task.assignedTo === userId && task.status !== "completed", + ); + } + + findByProject(projectId: string): Task[] { + return this.findAll().filter((task) => task.projectId === projectId); + } + + search(criteria: TaskSearchCriteria, currentUserId: string): Task[] { + return this.findAll().filter((task) => + this.matchesSearchCriteria(task, criteria, currentUserId), + ); + } + + private matchesSearchCriteria( + task: Task, + criteria: TaskSearchCriteria, + currentUserId: string, + ): boolean { + // Simplified visibility check - in real app, this would use ProjectRepository + const isVisible = + task.createdBy === currentUserId || task.assignedTo === currentUserId; + if (!isVisible) return false; + + if (criteria.status && task.status !== criteria.status) return false; + if (criteria.priority && task.priority !== criteria.priority) return false; + if (criteria.assignedTo && task.assignedTo !== criteria.assignedTo) + return false; + if (criteria.projectId && task.projectId !== criteria.projectId) + return false; + + if (criteria.searchText) { + const searchText = criteria.searchText.toLowerCase(); + const matchesTitle = task.title.toLowerCase().includes(searchText); + const matchesDescription = task.description + .toLowerCase() + .includes(searchText); + const matchesTags = task.tags.some((tag) => + tag.toLowerCase().includes(searchText), + ); + + if (!matchesTitle && !matchesDescription && !matchesTags) return false; + } + + if (criteria.createdAfter && task.createdAt < criteria.createdAfter) + return false; + if (criteria.createdBefore && task.createdAt > criteria.createdBefore) + return false; + if (criteria.dueBefore && task.dueDate && task.dueDate > criteria.dueBefore) + return false; + if (criteria.dueAfter && task.dueDate && task.dueDate < criteria.dueAfter) + return false; + + return true; + } +} + +class InMemoryUserRepository implements UserRepository { + private users: Map = new Map(); + + findById(id: string): User | null { + const user = this.users.get(id); + return user ? { ...user } : null; + } + + findByUsername(username: string): User | null { + for (const user of this.users.values()) { + if (user.username === username) { + return { ...user }; + } + } + return null; + } + + update(user: User): void { + this.users.set(user.id, { ...user }); + } + + // Method to add users for testing + add(user: User): void { + this.users.set(user.id, { ...user }); + } +} + +class InMemoryProjectRepository implements ProjectRepository { + private projects: Map = new Map(); + + findById(id: string): Project | null { + const project = this.projects.get(id); + return project ? { ...project } : null; + } + + exists(id: string): boolean { + return this.projects.has(id); + } + + update(project: Project): void { + this.projects.set(project.id, { ...project }); + } + + isUserMember(projectId: string, userId: string): boolean { + const project = this.findById(projectId); + return project + ? project.members.includes(userId) || project.createdBy === userId + : false; + } + + // Method to add projects for testing + add(project: Project): void { + this.projects.set(project.id, { ...project }); + } +} + +// ===== AUTHORIZATION SERVICE ===== + +class AuthorizationError extends Error { + constructor(message: string) { + super(message); + this.name = "AuthorizationError"; + } +} + +class TaskAuthorizationService { + constructor(private readonly projectRepository: ProjectRepository) {} + + canCreateTask(projectId: string, userId: string): boolean { + return this.projectRepository.isUserMember(projectId, userId); + } + + canUpdateTask(task: Task, userId: string, isAdmin: boolean): boolean { + return task.createdBy === userId || task.assignedTo === userId || isAdmin; + } + + canDeleteTask(task: Task, userId: string, isAdmin: boolean): boolean { + return task.createdBy === userId || isAdmin; + } + + requireCreatePermission(projectId: string, userId: string): void { + if (!this.canCreateTask(projectId, userId)) { + throw new AuthorizationError("You do not have access to this project"); + } + } + + requireUpdatePermission(task: Task, userId: string, isAdmin: boolean): void { + if (!this.canUpdateTask(task, userId, isAdmin)) { + throw new AuthorizationError( + "You do not have permission to update this task", + ); + } + } + + requireDeletePermission(task: Task, userId: string, isAdmin: boolean): void { + if (!this.canDeleteTask(task, userId, isAdmin)) { + throw new AuthorizationError( + "Only the creator or an admin can delete a task", + ); + } + } +} + +// ===== NOTIFICATION SERVICE ===== + +interface NotificationService { + sendTaskAssigned(task: Task, assignee: User): void; + sendTaskDeleted(task: Task, user: User): void; + sendAchievementEarned(achievement: string, user: User): void; +} + +class ConsoleNotificationService implements NotificationService { + constructor(private readonly config: AppConfig) {} + + sendTaskAssigned(task: Task, assignee: User): void { + if (!this.config.enableNotifications) return; + console.log( + `[NOTIFICATION to ${assignee.email}]: You've been assigned a new task: ${task.title}`, + ); + } + + sendTaskDeleted(task: Task, user: User): void { + if (!this.config.enableNotifications) return; + console.log( + `[NOTIFICATION to ${user.email}]: A task assigned to you was deleted: ${task.title}`, + ); + } + + sendAchievementEarned(achievement: string, user: User): void { + if (!this.config.enableNotifications) return; + console.log( + `[NOTIFICATION to ${user.email}]: You earned the ${achievement} badge!`, + ); + } +} + +// ===== LOGGING SERVICE ===== + +interface Logger { + log(action: string, data: any): void; +} + +class ConsoleLogger implements Logger { + log(action: string, data: any): void { + console.log(`[${new Date().toISOString()}] ${action}:`, data); + } +} + +// ===== DOMAIN SERVICES ===== + +class AchievementService { + constructor( + private readonly userRepository: UserRepository, + private readonly notificationService: NotificationService, + ) {} + + checkAndAwardAchievements(user: User): void { + if ( + user.completedTasks >= 10 && + !user.achievements.includes("productive") + ) { + user.achievements = [...user.achievements, "productive"]; + this.userRepository.update(user); + this.notificationService.sendAchievementEarned("Productive", user); + } + } +} + +class ProjectUpdateService { + constructor( + private readonly projectRepository: ProjectRepository, + private readonly taskRepository: TaskRepository, + ) {} + + updateProjectMetrics(projectId: string): void { + const project = this.projectRepository.findById(projectId); + if (!project) return; + + const projectTasks = this.taskRepository.findByProject(projectId); + + const updatedProject: Project = { + ...project, + taskCount: projectTasks.length, + progress: ProgressCalculator.calculate(projectTasks), + lastActivity: new Date(), + }; + + this.projectRepository.update(updatedProject); + } +} + +// ===== MAIN SERVICE ===== + +class TaskService { + constructor( + private readonly taskRepository: TaskRepository, + private readonly userRepository: UserRepository, + private readonly projectRepository: ProjectRepository, + private readonly validator: TaskValidator, + private readonly authService: TaskAuthorizationService, + private readonly notificationService: NotificationService, + private readonly achievementService: AchievementService, + private readonly projectUpdateService: ProjectUpdateService, + private readonly logger: Logger, + private readonly config: AppConfig, + ) {} + + createTask(request: CreateTaskRequest, currentUserId: string): Task { + // Validation + this.validator.validateCreateRequest(request); + this.authService.requireCreatePermission(request.projectId, currentUserId); + + const assignedUserId = request.assignedTo || currentUserId; + this.validator.validateTaskLimits(assignedUserId); + + // Create task + const task: Task = { + id: IdGenerator.generate("task"), + title: request.title.trim(), + description: request.description?.trim() || "", + status: "new", + priority: request.priority || this.config.defaultPriority, + createdAt: new Date(), + createdBy: currentUserId, + assignedTo: assignedUserId, + projectId: request.projectId, + dueDate: request.dueDate || null, + comments: [], + attachments: [], + tags: request.tags || [], + timeSpent: 0, + lastUpdated: new Date(), + reopenCount: 0, + }; + + // Save task + this.taskRepository.save(task); + + // Handle side effects + this.handleTaskCreatedSideEffects(task, currentUserId); + + this.logger.log("task_created", { taskId: task.id, title: task.title }); + + return task; + } + + updateTask( + taskId: string, + request: UpdateTaskRequest, + currentUserId: string, + isAdmin: boolean, + ): Task { + // Validation + this.validator.validateUpdateRequest(request); + + const existingTask = this.taskRepository.findById(taskId); + if (!existingTask) { + throw new Error("Task not found"); + } + + this.authService.requireUpdatePermission( + existingTask, + currentUserId, + isAdmin, + ); + + // Handle status transitions + const updatedTask = this.applyTaskUpdates( + existingTask, + request, + currentUserId, + ); + + // Save task + this.taskRepository.update(taskId, updatedTask); + + // Handle side effects + this.handleTaskUpdatedSideEffects(updatedTask, request, currentUserId); + + this.logger.log("task_updated", { taskId, changes: Object.keys(request) }); + + return updatedTask; + } + + deleteTask(taskId: string, currentUserId: string, isAdmin: boolean): void { + const task = this.taskRepository.findById(taskId); + if (!task) { + throw new Error("Task not found"); + } + + this.authService.requireDeletePermission(task, currentUserId, isAdmin); + + // Delete task + this.taskRepository.delete(taskId); + + // Handle side effects + this.handleTaskDeletedSideEffects(task, currentUserId); + + this.logger.log("task_deleted", { taskId, title: task.title }); + } + + searchTasks(criteria: TaskSearchCriteria, currentUserId: string): Task[] { + let results = this.taskRepository.search(criteria, currentUserId); + + // Apply sorting + if (criteria.sortBy) { + results = TaskSorter.sort(results, criteria.sortBy, criteria.sortDir); + } + + // Apply pagination + if (criteria.limit) { + results = Paginator.paginate(results, criteria.page, criteria.limit); + } + + this.logger.log("tasks_searched", { + criteria, + resultCount: results.length, + }); + + return results; + } + + private applyTaskUpdates( + task: Task, + request: UpdateTaskRequest, + currentUserId: string, + ): Task { + const updatedTask: Task = { ...task }; + + // Handle status transitions + if (request.status && request.status !== task.status) { + this.handleStatusTransition(updatedTask, request.status, currentUserId); + } + + // Apply other updates + if (request.title !== undefined) updatedTask.title = request.title.trim(); + if (request.description !== undefined) + updatedTask.description = request.description.trim(); + if (request.priority !== undefined) updatedTask.priority = request.priority; + if (request.assignedTo !== undefined) + updatedTask.assignedTo = request.assignedTo; + if (request.dueDate !== undefined) updatedTask.dueDate = request.dueDate; + if (request.tags !== undefined) updatedTask.tags = request.tags; + + updatedTask.lastUpdated = new Date(); + + return updatedTask; + } + + private handleStatusTransition( + task: Task, + newStatus: TaskStatus, + currentUserId: string, + ): void { + if (task.status === "completed" && newStatus !== "completed") { + // Re-opening completed task + task.reopenCount++; + this.logger.log("task_reopened", { + taskId: task.id, + previousStatus: task.status, + }); + } + + if (newStatus === "completed") { + // Completing task + task.completedAt = new Date(); + task.completedBy = currentUserId; + + // Update user stats + const user = this.userRepository.findById(currentUserId); + if (user) { + user.completedTasks++; + this.userRepository.update(user); + this.achievementService.checkAndAwardAchievements(user); + } + } + + task.status = newStatus; + } + + private handleTaskCreatedSideEffects( + task: Task, + currentUserId: string, + ): void { + // Send notification to assignee + if (task.assignedTo !== currentUserId) { + const assignee = this.userRepository.findById(task.assignedTo); + if (assignee) { + this.notificationService.sendTaskAssigned(task, assignee); + } + } + + // Update project metrics + this.projectUpdateService.updateProjectMetrics(task.projectId); + } + + private handleTaskUpdatedSideEffects( + task: Task, + request: UpdateTaskRequest, + currentUserId: string, + ): void { + // Send notification if assignee changed + if (request.assignedTo && request.assignedTo !== task.assignedTo) { + const assignee = this.userRepository.findById(request.assignedTo); + if (assignee) { + this.notificationService.sendTaskAssigned(task, assignee); + } + } + + // Update project metrics + this.projectUpdateService.updateProjectMetrics(task.projectId); + } + + private handleTaskDeletedSideEffects( + task: Task, + currentUserId: string, + ): void { + // Send notification to assignee + if (task.assignedTo !== currentUserId) { + const assignee = this.userRepository.findById(task.assignedTo); + if (assignee) { + this.notificationService.sendTaskDeleted(task, assignee); + } + } + + // Update project metrics (async to avoid race condition) + setTimeout(() => { + this.projectUpdateService.updateProjectMetrics(task.projectId); + }, 0); + } +} + +// ===== AUTHENTICATION SERVICE ===== + +class AuthenticationError extends Error { + constructor(message: string) { + super(message); + this.name = "AuthenticationError"; + } +} + +class AuthenticationService { + constructor( + private readonly userRepository: UserRepository, + private readonly logger: Logger, + ) {} + + authenticate(username: string, password: string): User { + const user = this.userRepository.findByUsername(username); + + if (!user) { + this.logger.log("auth_failed", { username, reason: "user_not_found" }); + throw new AuthenticationError("Invalid credentials"); + } + + // In a real app, this would use proper password hashing + if ((user as any).password !== password) { + this.logger.log("auth_failed", { username, reason: "invalid_password" }); + throw new AuthenticationError("Invalid credentials"); + } + + this.logger.log("auth_success", { userId: user.id }); + return user; + } +} + +// ===== DEPENDENCY INJECTION CONTAINER ===== + +class TaskManagementSystem { + private readonly taskRepository: TaskRepository; + private readonly userRepository: UserRepository; + private readonly projectRepository: ProjectRepository; + private readonly validator: TaskValidator; + private readonly authService: TaskAuthorizationService; + private readonly notificationService: NotificationService; + private readonly achievementService: AchievementService; + private readonly projectUpdateService: ProjectUpdateService; + private readonly logger: Logger; + private readonly taskService: TaskService; + private readonly authenticationService: AuthenticationService; + private readonly config: AppConfig; + + private currentUser: User | null = null; + + constructor(config: AppConfig = DEFAULT_CONFIG) { + this.config = config; + + // Initialize repositories + this.taskRepository = new InMemoryTaskRepository(); + this.userRepository = new InMemoryUserRepository(); + this.projectRepository = new InMemoryProjectRepository(); + + // Initialize services + this.logger = new ConsoleLogger(); + this.notificationService = new ConsoleNotificationService(config); + this.validator = new TaskValidator( + this.projectRepository, + this.taskRepository, + config, + ); + this.authService = new TaskAuthorizationService(this.projectRepository); + this.achievementService = new AchievementService( + this.userRepository, + this.notificationService, + ); + this.projectUpdateService = new ProjectUpdateService( + this.projectRepository, + this.taskRepository, + ); + + // Initialize main services + this.taskService = new TaskService( + this.taskRepository, + this.userRepository, + this.projectRepository, + this.validator, + this.authService, + this.notificationService, + this.achievementService, + this.projectUpdateService, + this.logger, + config, + ); + + this.authenticationService = new AuthenticationService( + this.userRepository, + this.logger, + ); + } + + // Public API methods + authenticate(username: string, password: string): User { + this.currentUser = this.authenticationService.authenticate( + username, + password, + ); + return this.currentUser; + } + + createTask(request: CreateTaskRequest): Task { + this.requireAuthentication(); + return this.taskService.createTask(request, this.currentUser!.id); + } + + updateTask(taskId: string, request: UpdateTaskRequest): Task { + this.requireAuthentication(); + return this.taskService.updateTask( + taskId, + request, + this.currentUser!.id, + this.currentUser!.isAdmin, + ); + } + + deleteTask(taskId: string): void { + this.requireAuthentication(); + this.taskService.deleteTask( + taskId, + this.currentUser!.id, + this.currentUser!.isAdmin, + ); + } + + searchTasks(criteria: TaskSearchCriteria): Task[] { + this.requireAuthentication(); + return this.taskService.searchTasks(criteria, this.currentUser!.id); + } + + // Helper methods for testing + addUser(user: User & { password: string }): void { + (this.userRepository as InMemoryUserRepository).add(user); + } + + addProject(project: Project): void { + (this.projectRepository as InMemoryProjectRepository).add(project); + } + + private requireAuthentication(): void { + if (!this.currentUser) { + throw new AuthenticationError("Not authenticated"); + } + } +} + +// ===== USAGE EXAMPLE ===== + +// Initialize the system +const taskSystem = new TaskManagementSystem(); + +// Add test data +taskSystem.addUser({ + id: "user_1", + username: "john_doe", + email: "john@example.com", + password: "password123", // In real app, this would be hashed + isAdmin: false, + completedTasks: 0, + achievements: [], +}); + +taskSystem.addProject({ + id: "proj_1", + createdBy: "user_1", + members: ["user_1"], + isPublic: false, + taskCount: 0, + progress: 0, + lastActivity: new Date(), +}); + +// Usage example +try { + // Authenticate + const user = taskSystem.authenticate("john_doe", "password123"); + console.log("Authenticated user:", user.username); + + // Create a task + const task = taskSystem.createTask({ + title: "Implement login feature", + description: "Add user authentication to the application", + projectId: "proj_1", + priority: "high", + tags: ["frontend", "authentication"], + }); + console.log("Created task:", task.title); + + // Update the task + const updatedTask = taskSystem.updateTask(task.id, { + status: "in_progress", + description: "Updated description with more details", + }); + console.log("Updated task status:", updatedTask.status); + + // Search tasks + const searchResults = taskSystem.searchTasks({ + status: "in_progress", + sortBy: "createdAt", + sortDir: "desc", + }); + console.log("Found tasks:", searchResults.length); +} catch (error) { + console.error("Error:", error.message); +} + +export default TaskManagementSystem; + +/* +Code Smells Identified + +Architecture & Design Issues: + +Global state management with mutable variables scattered throughout +Mixed responsibilities - authentication, validation, business logic, and side effects all tangled together +Tight coupling between unrelated concerns (DOM manipulation in utilities, notifications in business logic) +No separation of concerns or proper layering + + +Code Organization Problems: + +Utility functions performing side effects and business logic +Authentication mixed with data fetching +Validation logic scattered and inconsistent +Business rules hardcoded throughout the application + + +State Management Issues: + +Direct global state mutations everywhere +No centralized state management +Side effects performed synchronously during core operations +Inconsistent data flow patterns + + +Error Handling & Reliability: + +Poor error handling with generic Error objects +No input sanitization or proper validation +Inconsistent permission checking +Race conditions with setTimeout usage + + +Improvements Made + +Architecture & Design Improvements: + +Implemented proper separation of concerns with distinct layers (domain, repository, service) +Applied SOLID principles - single responsibility, dependency injection, interface segregation +Introduced clean architecture with domain models, repositories, and services +Removed tight coupling by using dependency injection and interfaces +Created a proper dependency injection container (TaskManagementSystem) + + +State Management Improvements: + +Eliminated global mutable state - all state is now properly encapsulated in repositories +Implemented immutable data patterns with object spreading and readonly properties +Centralized state management through repository pattern +Removed direct global variable mutations throughout the codebase +Added proper data flow with clear boundaries between layers + + +Error Handling & Validation: + +Created specific error types (TaskValidationError, AuthorizationError, AuthenticationError) +Separated validation logic into dedicated TaskValidator service +Added comprehensive input validation with field-level error reporting +Implemented consistent error handling patterns across all operations +Removed generic Error objects in favor of domain-specific exceptions + + +Business Logic Organization: + +Extracted authentication into dedicated AuthenticationService +Created TaskAuthorizationService for permission checking +Separated achievement logic into AchievementService +Moved project updates into ProjectUpdateService +Centralized task operations in TaskService with clear single responsibility + + +Code Quality & Maintainability: + +Added comprehensive TypeScript interfaces for type safety +Implemented proper method signatures with clear input/output types +Created utility classes (IdGenerator, ProgressCalculator, TaskSorter, Paginator) +Removed code duplication through reusable components +Added consistent naming conventions and clear method purposes + + +Side Effects & Dependencies: + +Isolated notification logic into NotificationService interface +Separated logging into Logger interface with clean abstraction +Removed DOM manipulation from business logic +Made all side effects explicit and controllable through dependency injection +Eliminated setTimeout race conditions with proper async handling + + +Data Access Improvements: + +Implemented repository pattern with clear interfaces +Added proper data encapsulation with immutable returns +Created in-memory implementations that can be easily swapped +Removed direct array mutations in favor of immutable operations +Added proper data validation at repository boundaries + + +Security & Authorization: + +Separated authentication from authorization concerns +Implemented proper permission checking before operations +Added role-based access control (admin vs regular users) +Removed mixed permission logic from business operations +Created centralized authorization service + + +Testing & Extensibility: + +Made all dependencies injectable for easy testing +Created interfaces that allow for easy mocking +Separated configuration into AppConfig interface +Added helper methods for test data setup +Designed for easy extension with new features + + +Performance & Scalability: + +Removed inefficient global array filtering +Implemented proper pagination with Paginator utility +Added efficient sorting with TaskSorter utility +Eliminated redundant calculations in loops +Created reusable calculation utilities (ProgressCalculator) +*/ diff --git a/manual-testing-sandbox/next-edit/next-edit-10-5.ts b/manual-testing-sandbox/next-edit/next-edit-10-5.ts new file mode 100644 index 000000000..93faa5c6a --- /dev/null +++ b/manual-testing-sandbox/next-edit/next-edit-10-5.ts @@ -0,0 +1,445 @@ +// A messy project management application with tangled dependencies and responsibilities +// Difficulty: 5/5 + +// Global state +let globalTasks: any[] = []; +let globalUsers: any[] = []; +let globalProjects: any[] = []; +let currentUser: any = null; +let lastActivityTime = Date.now(); +let _config = { + maxTasksPerUser: 20, + maxProjectsPerUser: 5, + defaultPriority: "medium", + enableNotifications: true, + serverUrl: "https://api.example.com/v1", +}; + +// Mixed utility functions and business logic +const util = { + generateId: (prefix: string) => + `${prefix}_${Math.random().toString(36).substring(2, 15)}${Date.now()}`, + calculateProgress: (tasks: any[]) => { + const completed = tasks.filter((t) => t.status === "completed").length; + return tasks.length ? Math.round((completed / tasks.length) * 100) : 0; + }, + sendNotification: (type: string, message: string, user: any) => { + if (!_config.enableNotifications) return; + console.log(`[NOTIFICATION to ${user.email}]: ${message}`); + // Side effects directly inside utility function + if (typeof window !== "undefined") { + // DOM manipulation in utility + const notification = document.createElement("div"); + notification.className = `notification ${type}`; + notification.innerText = message; + document.body.appendChild(notification); + setTimeout(() => notification.remove(), 5000); + } + }, + logger: (action: string, data: any) => { + console.log(`[${new Date().toISOString()}] ${action}:`, data); + // Side effect - updating activity time + lastActivityTime = Date.now(); + }, +}; + +// Data validation mixed with business logic +function validateTask(task: any) { + if (!task.title) throw new Error("Task title is required"); + if (!task.projectId) throw new Error("Task must belong to a project"); + if (!globalProjects.some((p) => p.id === task.projectId)) { + throw new Error("Project does not exist"); + } + + // Validation mixed with business rules + const userTasks = globalTasks.filter( + (t) => t.assignedTo === task.assignedTo && t.status !== "completed", + ); + + if (userTasks.length >= _config.maxTasksPerUser) { + throw new Error( + `User cannot have more than ${_config.maxTasksPerUser} active tasks`, + ); + } + + return true; +} + +// Authentication mixed with data fetching +function authenticate(username: string, password: string) { + // Direct data manipulation and mocked authentication + const user = globalUsers.find((u) => u.username === username); + if (!user || user.password !== password) { + util.logger("auth_failed", { username }); + throw new Error("Invalid credentials"); + } + + currentUser = user; + util.logger("auth_success", { userId: user.id }); + + // Mixing data fetching with authentication + loadUserData(user.id); + + return user; +} + +// Data fetching with side effects +function loadUserData(userId: string) { + // This would be an API call in real app + console.log(`Loading data for user ${userId}`); + + // Direct global state manipulation + globalTasks = globalTasks.filter( + (t) => t.createdBy === userId || t.assignedTo === userId, + ); + + globalProjects = globalProjects.filter( + (p) => p.members.includes(userId) || p.createdBy === userId, + ); + + // Direct DOM manipulation + if (typeof document !== "undefined") { + const taskCount = document.getElementById("task-count"); + if (taskCount) { + taskCount.innerText = String(globalTasks.length); + } + } +} + +// Task management with mixed responsibilities +class TaskManager { + // Creates a task with mixed concerns + createTask(taskData: any) { + if (!currentUser) throw new Error("Not authenticated"); + + // Authentication check mixed with business logic + if (taskData.projectId) { + const project = globalProjects.find((p) => p.id === taskData.projectId); + if ( + !project.members.includes(currentUser.id) && + project.createdBy !== currentUser.id + ) { + throw new Error("You do not have access to this project"); + } + } + + const task = { + id: util.generateId("task"), + title: taskData.title, + description: taskData.description || "", + status: "new", + priority: taskData.priority || _config.defaultPriority, + createdAt: new Date(), + createdBy: currentUser.id, + assignedTo: taskData.assignedTo || currentUser.id, + projectId: taskData.projectId, + dueDate: taskData.dueDate || null, + comments: [], + attachments: [], + tags: taskData.tags || [], + timeSpent: 0, + lastUpdated: new Date(), + }; + + // Validation mixed with creation + validateTask(task); + + // Global state mutation + globalTasks.push(task); + + // Side effects - email notification mixed with task creation + if (task.assignedTo !== currentUser.id) { + const assignee = globalUsers.find((u) => u.id === task.assignedTo); + if (assignee) { + console.log( + `Sending email to ${assignee.email} about new task assignment`, + ); + util.sendNotification( + "task_assigned", + `You've been assigned a new task: ${task.title}`, + assignee, + ); + } + } + + // More side effects - updating project data + if (task.projectId) { + const project = globalProjects.find((p) => p.id === task.projectId); + if (project) { + project.taskCount = (project.taskCount || 0) + 1; + project.lastActivity = new Date(); + // Recalculating project progress on each task addition + const projectTasks = globalTasks.filter( + (t) => t.projectId === project.id, + ); + project.progress = util.calculateProgress(projectTasks); + } + } + + // Logging + util.logger("task_created", { taskId: task.id, title: task.title }); + + return task; + } + + // Update task with mixed concerns + updateTask(taskId: string, updates: any) { + if (!currentUser) throw new Error("Not authenticated"); + + const taskIndex = globalTasks.findIndex((t) => t.id === taskId); + if (taskIndex === -1) throw new Error("Task not found"); + + const task = globalTasks[taskIndex]; + + // Permission check mixed with update logic + if ( + task.createdBy !== currentUser.id && + task.assignedTo !== currentUser.id && + !currentUser.isAdmin + ) { + throw new Error("You do not have permission to update this task"); + } + + // Status transition logic mixed with update + if (updates.status && updates.status !== task.status) { + if (task.status === "completed" && updates.status !== "completed") { + // Re-opening completed task + task.reopenCount = (task.reopenCount || 0) + 1; + util.logger("task_reopened", { taskId, previousStatus: task.status }); + } + + if (updates.status === "completed") { + // Completing task + task.completedAt = new Date(); + task.completedBy = currentUser.id; + + // Side effect - updating user stats + const user = globalUsers.find((u) => u.id === currentUser.id); + if (user) { + user.completedTasks = (user.completedTasks || 0) + 1; + // More side effects - achievement system + if ( + user.completedTasks >= 10 && + !user.achievements?.includes("productive") + ) { + user.achievements = [...(user.achievements || []), "productive"]; + util.sendNotification( + "achievement", + "You earned the Productive badge!", + user, + ); + } + } + } + } + + // Main update logic - directly modifying the object + Object.keys(updates).forEach((key) => { + // Skip protected fields + if (!["id", "createdAt", "createdBy"].includes(key)) { + task[key] = updates[key]; + } + }); + + task.lastUpdated = new Date(); + + // Validation after update (inconsistent) + validateTask(task); + + // Update global state + globalTasks[taskIndex] = task; + + // More side effects - project update + if (task.projectId) { + const project = globalProjects.find((p) => p.id === task.projectId); + if (project) { + const projectTasks = globalTasks.filter( + (t) => t.projectId === project.id, + ); + project.progress = util.calculateProgress(projectTasks); + project.lastActivity = new Date(); + } + } + + // Notification side effects + if (updates.assignedTo && updates.assignedTo !== task.assignedTo) { + const assignee = globalUsers.find((u) => u.id === updates.assignedTo); + if (assignee) { + util.sendNotification( + "task_assigned", + `You've been assigned to task: ${task.title}`, + assignee, + ); + } + } + + util.logger("task_updated", { taskId, changes: Object.keys(updates) }); + + return task; + } + + // Delete task with side effects + deleteTask(taskId: string) { + if (!currentUser) throw new Error("Not authenticated"); + + const taskIndex = globalTasks.findIndex((t) => t.id === taskId); + if (taskIndex === -1) throw new Error("Task not found"); + + const task = globalTasks[taskIndex]; + + // Permission check + if (task.createdBy !== currentUser.id && !currentUser.isAdmin) { + throw new Error("Only the creator or an admin can delete a task"); + } + + // Side effects before deletion + if (task.projectId) { + const project = globalProjects.find((p) => p.id === task.projectId); + if (project) { + project.taskCount = Math.max(0, (project.taskCount || 0) - 1); + project.lastActivity = new Date(); + // More side effects - recalculating metrics + setTimeout(() => { + const projectTasks = globalTasks.filter( + (t) => t.projectId === project.id && t.id !== taskId, + ); + project.progress = util.calculateProgress(projectTasks); + }, 0); + } + } + + // Global state mutation + globalTasks.splice(taskIndex, 1); + + // Notification side effects + if (task.assignedTo !== currentUser.id) { + const assignee = globalUsers.find((u) => u.id === task.assignedTo); + if (assignee) { + util.sendNotification( + "task_deleted", + `A task assigned to you was deleted: ${task.title}`, + assignee, + ); + } + } + + util.logger("task_deleted", { taskId, title: task.title }); + + return { success: true }; + } + + // Search with mixed concerns + searchTasks(criteria: any) { + if (!currentUser) throw new Error("Not authenticated"); + + // Filtering with complex inline logic + let results = globalTasks.filter((task) => { + // Basic visibility check + const isVisible = + task.createdBy === currentUser.id || + task.assignedTo === currentUser.id || + (task.projectId && + globalProjects.some( + (p) => + p.id === task.projectId && + (p.members.includes(currentUser.id) || p.isPublic), + )); + + if (!isVisible) return false; + + // Apply search criteria + if (criteria.status && task.status !== criteria.status) return false; + if (criteria.priority && task.priority !== criteria.priority) + return false; + if (criteria.assignedTo && task.assignedTo !== criteria.assignedTo) + return false; + if (criteria.projectId && task.projectId !== criteria.projectId) + return false; + + // Text search + if (criteria.searchText) { + const searchText = criteria.searchText.toLowerCase(); + const matchesTitle = task.title.toLowerCase().includes(searchText); + const matchesDescription = task.description + ?.toLowerCase() + .includes(searchText); + const matchesTags = task.tags?.some((tag: string) => + tag.toLowerCase().includes(searchText), + ); + + if (!matchesTitle && !matchesDescription && !matchesTags) return false; + } + + // Date filters + if ( + criteria.createdAfter && + new Date(task.createdAt) < new Date(criteria.createdAfter) + ) + return false; + if ( + criteria.createdBefore && + new Date(task.createdAt) > new Date(criteria.createdBefore) + ) + return false; + if ( + criteria.dueBefore && + task.dueDate && + new Date(task.dueDate) > new Date(criteria.dueBefore) + ) + return false; + if ( + criteria.dueAfter && + task.dueDate && + new Date(task.dueDate) < new Date(criteria.dueAfter) + ) + return false; + + return true; + }); + + // Sorting mixed with filtering + if (criteria.sortBy) { + results.sort((a, b) => { + if (criteria.sortBy === "dueDate") { + if (!a.dueDate) return criteria.sortDir === "asc" ? 1 : -1; + if (!b.dueDate) return criteria.sortDir === "asc" ? -1 : 1; + return criteria.sortDir === "asc" + ? new Date(a.dueDate).getTime() - new Date(b.dueDate).getTime() + : new Date(b.dueDate).getTime() - new Date(a.dueDate).getTime(); + } + + if (criteria.sortBy === "priority") { + const priorityMap: Record = { + high: 3, + medium: 2, + low: 1, + }; + return criteria.sortDir === "asc" + ? priorityMap[a.priority] - priorityMap[b.priority] + : priorityMap[b.priority] - priorityMap[a.priority]; + } + + // Default sort by creation date + return criteria.sortDir === "asc" + ? new Date(a.createdAt).getTime() - new Date(b.createdAt).getTime() + : new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime(); + }); + } + + // Pagination mixed with core functionality + if (criteria.limit) { + const page = criteria.page || 1; + const start = (page - 1) * criteria.limit; + results = results.slice(start, start + criteria.limit); + } + + util.logger("tasks_searched", { criteria, resultCount: results.length }); + + return results; + } +} + +// Usage would be like: +// const tm = new TaskManager(); +// tm.createTask({ title: 'Implement login', projectId: 'proj_123', priority: 'high' }); +// tm.updateTask('task_123', { status: 'in_progress', assignedTo: 'user_456' }); diff --git a/manual-testing-sandbox/next-edit/next-edit-2-1-sol.ts b/manual-testing-sandbox/next-edit/next-edit-2-1-sol.ts new file mode 100644 index 000000000..5b717af41 --- /dev/null +++ b/manual-testing-sandbox/next-edit/next-edit-2-1-sol.ts @@ -0,0 +1,142 @@ +// A refactored user validation utility following SOLID principles +// Solution for next-edit-2-1.ts + +type UserData = { + id?: number; + name: string; + email: string; + age?: number; + isActive: boolean; +}; + +// Define a validation result interface +interface ValidationResult { + isValid: boolean; + error?: string; +} + +// Create a validator interface (Interface Segregation Principle) +interface Validator { + validate(data: any): ValidationResult; +} + +// Individual validators with single responsibilities (Single Responsibility Principle) +class NameValidator implements Validator { + validate(name: string): ValidationResult { + if (name.length < 2) { + return { isValid: false, error: "Name is too short" }; + } + return { isValid: true }; + } +} + +class EmailValidator implements Validator { + validate(email: string): ValidationResult { + if (!email.includes("@")) { + return { isValid: false, error: "Invalid email format" }; + } + return { isValid: true }; + } +} + +class AgeValidator implements Validator { + validate(age: number | undefined): ValidationResult { + if (age !== undefined && age < 18) { + return { isValid: false, error: "User must be 18 or older" }; + } + return { isValid: true }; + } +} + +// Composite validator that uses individual validators (Open/Closed Principle) +class UserValidator { + private validators: { [key: string]: Validator } = { + name: new NameValidator(), + email: new EmailValidator(), + age: new AgeValidator(), + }; + + validate(user: UserData): ValidationResult { + // Validate name + const nameResult = this.validators.name.validate(user.name); + if (!nameResult.isValid) { + return nameResult; + } + + // Validate email + const emailResult = this.validators.email.validate(user.email); + if (!emailResult.isValid) { + return emailResult; + } + + // Validate age + const ageResult = this.validators.age.validate(user.age); + if (!ageResult.isValid) { + return ageResult; + } + + // All validations passed + return { isValid: true }; + } +} + +// Example usage +const user = { + name: "Jo", + email: "jo.example.com", + age: 25, + isActive: true, +}; + +const userValidator = new UserValidator(); +const result = userValidator.validate(user); + +if (result.isValid) { + console.log("User is valid"); +} else { + console.log("Error: " + result.error); +} + +export { + AgeValidator, + EmailValidator, + NameValidator, + UserValidator, + ValidationResult, + Validator, +}; + +/* +Code Smells: +Using global state (validationError variable) +Single validation function doing multiple things +No clear error handling mechanism +Tightly coupled validation logic + +Fix: +1. Single Responsibility Principle (SRP) +Created separate validator classes for each validation concern +Each validator is responsible for only one type of validation (name, email, age) + + +2. Open/Closed Principle (OCP) +The validation system is open for extension (you can add new validators) +The core UserValidator class doesn't need to change when adding new validation rules + + +3. Interface Segregation Principle (ISP) +Created a clean Validator interface that all validators implement +Each validator only needs to implement a single validation method + + +4. Dependency Inversion Principle (DIP) +The UserValidator depends on abstractions (the Validator interface) +Specific validators are injected into the UserValidator + + +5. Other improvements: +Eliminated global state by using return values instead of global variables +Created a proper ValidationResult interface for structured error reporting +Made the validation logic more modular and testable +Each class and function has a clear, single responsibility +*/ diff --git a/manual-testing-sandbox/next-edit/next-edit-2-1.ts b/manual-testing-sandbox/next-edit/next-edit-2-1.ts new file mode 100644 index 000000000..8a9f78011 --- /dev/null +++ b/manual-testing-sandbox/next-edit/next-edit-2-1.ts @@ -0,0 +1,58 @@ +// A simple user validation utility with poor organization +// Difficulty: 1 - Easy fixes needed + +type UserData = { + id?: number; + name: string; + email: string; + age?: number; + isActive: boolean; +}; + +// Global variable to store error messages +let validationError = ""; + +// Function to validate user data +function validateUser(data: UserData) { + // Reset error + validationError = ""; + + // Check name + if (data.name.length < 2) { + validationError = "Name is too short"; + return false; + } + + // Check email + if (!data.email.includes("@")) { + validationError = "Invalid email format"; + return false; + } + + // Check age if provided + if (data.age != undefined) { + if (data.age < 18) { + validationError = "User must be 18 or older"; + return false; + } + } + + // All validations passed + return true; +} + +// Example usage +const user = { + name: "Jo", + email: "jo.example.com", + age: 25, + isActive: true, +}; + +if (validateUser(user)) { + console.log("User is valid"); +} else { + console.log("Error: " + validationError); +} + +export { validateUser, validationError }; diff --git a/manual-testing-sandbox/next-edit/next-edit-3-2-sol.ts b/manual-testing-sandbox/next-edit/next-edit-3-2-sol.ts new file mode 100644 index 000000000..3d1a78e59 --- /dev/null +++ b/manual-testing-sandbox/next-edit/next-edit-3-2-sol.ts @@ -0,0 +1,188 @@ +// A well-structured todo list manager following SOLID principles +// Refactored solution for next-edit-3-2.ts + +// Define types for better maintainability +type Priority = "low" | "medium" | "high"; + +interface Todo { + id: number; + text: string; + completed: boolean; + priority: Priority; +} + +// TodoManager class following Single Responsibility Principle +class TodoManager { + private todos: Map = new Map(); + private lastId: number = 0; + + // Create a new todo + addTodo(text: string, priority: Priority = "medium"): Todo { + // Input validation + if (!text.trim()) { + throw new Error("Todo text cannot be empty"); + } + + const newTodo: Todo = { + id: ++this.lastId, + text: text.trim(), + completed: false, + priority, + }; + + this.todos.set(newTodo.id, newTodo); + return { ...newTodo }; // Return a copy to prevent direct modification + } + + // Delete a todo by id + deleteTodo(id: number): boolean { + return this.todos.delete(id); + } + + // Toggle todo completion status + toggleTodo(id: number): Todo | null { + const todo = this.todos.get(id); + if (!todo) return null; + + const updatedTodo = { ...todo, completed: !todo.completed }; + this.todos.set(id, updatedTodo); + return { ...updatedTodo }; + } + + // Update todo text + updateTodoText(id: number, newText: string): Todo | null { + if (!newText.trim()) { + throw new Error("Todo text cannot be empty"); + } + + const todo = this.todos.get(id); + if (!todo) return null; + + const updatedTodo = { ...todo, text: newText.trim() }; + this.todos.set(id, updatedTodo); + return { ...updatedTodo }; + } + + // Change todo priority + changePriority(id: number, newPriority: Priority): Todo | null { + const todo = this.todos.get(id); + if (!todo) return null; + + const updatedTodo = { ...todo, priority: newPriority }; + this.todos.set(id, updatedTodo); + return { ...updatedTodo }; + } + + // Get all todos + getAllTodos(): Todo[] { + return Array.from(this.todos.values()).map((todo) => ({ ...todo })); + } + + // Filter todos by various criteria (following Open/Closed Principle) + filterTodos(predicate: (todo: Todo) => boolean): Todo[] { + return this.getAllTodos().filter(predicate); + } + + // Helper methods built on top of filterTodos + getCompletedTodos(): Todo[] { + return this.filterTodos((todo) => todo.completed); + } + + getActiveTodos(): Todo[] { + return this.filterTodos((todo) => !todo.completed); + } + + getTodosByPriority(priority: Priority): Todo[] { + return this.filterTodos((todo) => todo.priority === priority); + } +} + +// Create a singleton instance +const todoManager = new TodoManager(); + +// Example usage +todoManager.addTodo("Buy groceries", "high"); +todoManager.addTodo("Clean house"); +todoManager.addTodo("Pay bills", "high"); +todoManager.toggleTodo(2); + +console.log("All todos:", todoManager.getAllTodos()); +console.log("High priority todos:", todoManager.getTodosByPriority("high")); +console.log("Completed todos:", todoManager.getCompletedTodos()); + +// Export the TodoManager class and its instance +export { Priority, Todo, TodoManager, todoManager }; + +/* +Code Smells in next-edit-3-2.ts: +Global state - using global variables for todos and lastId +Single Responsibility Principle violation - mixing data management with business logic +Duplicated code in several functions that iterate through todos +No clear abstraction layers - direct manipulation of the data structure +No validation or error handling +No proper typing for priority values +No encapsulation - direct access to the todos array +No use of more efficient data structures (using array iteration instead of maps/objects) + +Improvements Made in the Refactored Solution: + +Encapsulation and Data Hiding + +Created a TodoManager class to encapsulate all operations and data +Made todos and lastId private members of the class +Used a Map instead of an array for more efficient lookup by id + + +Proper Type Definitions + +Defined a proper Todo interface +Created a union type for Priority with specific allowed values + + +Single Responsibility Principle + +Each method has a clear, single responsibility +Separated data structure management from business logic + + +Open/Closed Principle + +Introduced a general filterTodos method that accepts a predicate +Built specialized filter methods on top of this generic one + + +Data Integrity and Validation + +Added validation for todo text to prevent empty todos +Return copies of todos to prevent direct modification of internal state + + +Reduced Code Duplication + +Eliminated repeated code for finding todos by id +Consolidated filtering logic into a single method + + +Improved Performance + +Used a Map data structure for O(1) lookups by id instead of O(n) array iterations +More efficient todo retrieval and manipulation + + +Better API Design + +Added more helper methods for common operations +Created a consistent interface with descriptive method names +Added a method to get all todos instead of directly accessing the array + + +Error Handling + +Added basic input validation with meaningful error messages + + +Immutability + +Returned copies of objects rather than references to internal state +Used object spread to create new objects when updating +*/ diff --git a/manual-testing-sandbox/next-edit/next-edit-3-2.ts b/manual-testing-sandbox/next-edit/next-edit-3-2.ts new file mode 100644 index 000000000..67f9f6a7a --- /dev/null +++ b/manual-testing-sandbox/next-edit/next-edit-3-2.ts @@ -0,0 +1,111 @@ +// A poorly structured todo list manager +// Difficulty: 2 - Multiple issues to fix + +// Global variables +let todos: { + id: number; + text: string; + completed: boolean; + priority: string; +}[] = []; +let lastId = 0; + +// Add a new todo +function addTodo(text: string, priority = "medium") { + const newTodo = { + id: ++lastId, + text: text, + completed: false, + priority: priority, + }; + todos.push(newTodo); + return newTodo; +} + +// Delete a todo by id +function deleteTodo(id: number) { + for (let i = 0; i < todos.length; i++) { + if (todos[i].id === id) { + todos.splice(i, 1); + return true; + } + } + return false; +} + +// Toggle todo completion status +function toggleTodo(id: number) { + for (let i = 0; i < todos.length; i++) { + const todo = todos[i]; + if (todo.id === id) { + todo.completed = !todo.completed; + return todo; + } + } + return null; +} + +// Update todo text +function updateTodoText(id: number, newText: string) { + for (let i = 0; i < todos.length; i++) { + if (todos[i].id === id) { + todos[i].text = newText; + return todos[i]; + } + } + return null; +} + +// Change todo priority +function changePriority(id: number, newPriority: string) { + for (let i = 0; i < todos.length; i++) { + if (todos[i].id === id) { + todos[i].priority = newPriority; + return todos[i]; + } + } + return null; +} + +// Filter todos by status +function filterByStatus(completed: boolean) { + const result = []; + for (let i = 0; i < todos.length; i++) { + if (todos[i].completed === completed) { + result.push(todos[i]); + } + } + return result; +} + +// Filter todos by priority +function filterByPriority(priority: string) { + const result = []; + for (let i = 0; i < todos.length; i++) { + if (todos[i].priority === priority) { + result.push(todos[i]); + } + } + return result; +} + +// Example usage +addTodo("Buy groceries", "high"); +addTodo("Clean house"); +addTodo("Pay bills", "high"); +toggleTodo(2); + +console.log("All todos:", todos); +console.log("High priority todos:", filterByPriority("high")); +console.log("Completed todos:", filterByStatus(true)); + +export { + addTodo, + changePriority, + deleteTodo, + filterByPriority, + filterByStatus, + todos, + toggleTodo, + updateTodoText, +}; diff --git a/manual-testing-sandbox/next-edit/next-edit-4-2-sol.ts b/manual-testing-sandbox/next-edit/next-edit-4-2-sol.ts new file mode 100644 index 000000000..9dc0ab17e --- /dev/null +++ b/manual-testing-sandbox/next-edit/next-edit-4-2-sol.ts @@ -0,0 +1,323 @@ +// Event Tracker System - Refactored Solution +// Original: next-edit-4-2.ts +// Refactored to follow SOLID principles + +// Types +type EventCategory = "meeting" | "conference" | "workshop" | "other"; + +interface Event { + id: number; + name: string; + date: Date; + attendees: string[]; + location?: string; + category?: EventCategory; +} + +// EventRepository - Handles data storage and retrieval +class EventRepository { + private events: Event[] = []; + private nextEventId = 1; + + getAll(): Event[] { + return [...this.events]; + } + + getById(eventId: number): Event | undefined { + return this.events.find((event) => event.id === eventId); + } + + add(event: Omit): number { + const newEvent: Event = { + ...event, + id: this.nextEventId++, + }; + + this.events.push(newEvent); + return newEvent.id; + } + + update(eventId: number, eventUpdates: Partial>): boolean { + const eventIndex = this.findEventIndex(eventId); + if (eventIndex === -1) return false; + + this.events[eventIndex] = { + ...this.events[eventIndex], + ...eventUpdates, + }; + + return true; + } + + remove(eventId: number): boolean { + const eventIndex = this.findEventIndex(eventId); + if (eventIndex === -1) return false; + + this.events.splice(eventIndex, 1); + return true; + } + + findByDateRange(startDate: Date, endDate: Date): Event[] { + return this.events.filter( + (event) => event.date >= startDate && event.date <= endDate, + ); + } + + findByCategory(category: EventCategory): Event[] { + return this.events.filter((event) => event.category === category); + } + + private findEventIndex(eventId: number): number { + return this.events.findIndex((event) => event.id === eventId); + } +} + +// EventService - Handles business logic +class EventService { + constructor(private repository: EventRepository) {} + + createEvent( + name: string, + date: Date, + attendees: string[], + location?: string, + category?: EventCategory, + ): number { + return this.repository.add({ + name, + date, + attendees, + location, + category, + }); + } + + updateEvent(eventId: number, updates: Partial>): boolean { + return this.repository.update(eventId, updates); + } + + removeEvent(eventId: number): boolean { + return this.repository.remove(eventId); + } + + addAttendee(eventId: number, attendeeName: string): boolean { + const event = this.repository.getById(eventId); + if (!event) return false; + + // Don't add if already exists + if (event.attendees.includes(attendeeName)) { + return false; + } + + return this.repository.update(eventId, { + attendees: [...event.attendees, attendeeName], + }); + } + + removeAttendee(eventId: number, attendeeName: string): boolean { + const event = this.repository.getById(eventId); + if (!event) return false; + + const initialCount = event.attendees.length; + const updatedAttendees = event.attendees.filter( + (name) => name !== attendeeName, + ); + + if (initialCount === updatedAttendees.length) { + return false; // Attendee wasn't in the list + } + + return this.repository.update(eventId, { + attendees: updatedAttendees, + }); + } + + getEventsByDateRange(startDate: Date, endDate: Date): Event[] { + return this.repository.findByDateRange(startDate, endDate); + } + + getEventsByCategory(category: EventCategory): Event[] { + return this.repository.findByCategory(category); + } + + getAllEvents(): Event[] { + return this.repository.getAll(); + } +} + +// Create instances for use +const eventRepository = new EventRepository(); +const eventService = new EventService(eventRepository); + +// Example usage +eventService.createEvent( + "Team Meeting", + new Date("2023-06-15T10:00:00"), + ["Alice", "Bob", "Charlie"], + "Conference Room A", + "meeting", +); + +eventService.createEvent( + "JavaScript Workshop", + new Date("2023-06-20T14:00:00"), + ["David", "Eve"], + "Training Center", + "workshop", +); + +console.log("All events:", eventService.getAllEvents()); +eventService.addAttendee(1, "Frank"); +console.log("Events after adding Frank:", eventService.getAllEvents()); + +// Export functions with the same interface as the original for backward compatibility +export const events = eventService.getAllEvents(); + +export function add_event( + eventName: string, + eventDate: Date, + attendees: string[], + location?: string, + category?: EventCategory, +): number { + return eventService.createEvent( + eventName, + eventDate, + attendees, + location, + category, + ); +} + +export function removeEvent(eventId: number): boolean { + return eventService.removeEvent(eventId); +} + +export function updateEvent( + eventId: number, + name?: string, + date?: Date, + attendees?: string[], + location?: string, + category?: EventCategory, +): boolean { + return eventService.updateEvent(eventId, { + name, + date, + attendees, + location, + category, + }); +} + +export function addAttendeeToEvent( + eventId: number, + attendeeName: string, +): boolean { + return eventService.addAttendee(eventId, attendeeName); +} + +export function removeAttendeeFromEvent( + eventId: number, + attendeeName: string, +): boolean { + return eventService.removeAttendee(eventId, attendeeName); +} + +export function getEventsByDateRange(startDate: Date, endDate: Date): Event[] { + return eventService.getEventsByDateRange(startDate, endDate); +} + +export function getEventsByCategory(category: EventCategory): Event[] { + return eventService.getEventsByCategory(category); +} + +// For direct use of the service in new code +export { Event, EventCategory, EventRepository, EventService }; + +/* +Code Smells in next-edit-4-2.ts: +Violation of Single Responsibility Principle: + +The code mixes data storage, business logic, and usage in one flat file +Global state management with events array and nextEventId variable +Poor Encapsulation: + +Direct manipulation of the global events array +No protection against external modification of data +Inconsistent Naming Conventions: + +Mix of snake_case (add_event) and camelCase (removeEvent) +Lack of consistent function naming patterns +Duplicated Logic: + +Repeated event lookup code in multiple functions +Multiple loops to find events by ID +Inefficient Algorithms: + +Linear searches through arrays instead of using more efficient methods +Manual implementation of array operations that have built-in methods +No Separation of Concerns: + +No distinction between data access and business logic +No clear architecture or organization +Mutable Shared State: + +Direct modification of the global events array +No immutability principles + + +Improvements Made: + +Applied SOLID Principles: + +Single Responsibility: Split into EventRepository (data storage) and EventService (business logic) +Open/Closed: Better structure for extending functionality without modifying existing code +Interface Segregation: Cleaner interfaces with focused responsibilities +Dependency Inversion: Service depends on repository abstraction + + +Improved Encapsulation: + +Added proper classes with private fields +Controlled access to data through methods +Immutable return values (using spreads and filters) + + +Consistent Naming: + +All methods follow camelCase convention +More descriptive and consistent naming patterns + + +Removed Duplication: + +Centralized event lookup in the repository +Reused code through proper method calls + + +More Efficient Algorithms: + +Used built-in array methods (find, filter, etc.) instead of manual loops +Simplified attendee management logic + + +Clear Separation of Concerns: + +Repository handles data access +Service handles business logic +Maintained backward compatibility with original exports + + +Better Type Definitions: + +Extracted EventCategory type +Used TypeScript features like Partial and Omit for more precise typing +Added proper interfaces + + +Maintained Backward Compatibility: + +Kept original function exports to ensure existing code can work +Added additional exports for new usage patterns +*/ diff --git a/manual-testing-sandbox/next-edit/next-edit-4-2.ts b/manual-testing-sandbox/next-edit/next-edit-4-2.ts new file mode 100644 index 000000000..0de72821b --- /dev/null +++ b/manual-testing-sandbox/next-edit/next-edit-4-2.ts @@ -0,0 +1,161 @@ +// A messy event tracker system +// Difficulty: 2 - Multiple issues to fix + +type Event = { + id: number; + name: string; + date: Date; + attendees: string[]; + location?: string; + category?: "meeting" | "conference" | "workshop" | "other"; +}; + +// Global event store +let events: Event[] = []; +let nextEventId = 1; + +// Add event +function add_event( + eventName: string, + eventDate: Date, + attendees: string[], + location?: string, + category?: "meeting" | "conference" | "workshop" | "other", +) { + const event: Event = { + id: nextEventId++, + name: eventName, + date: eventDate, + attendees: attendees, + location: location, + category: category, + }; + + events.push(event); + return event.id; +} + +// Remove event +function removeEvent(eventId: number) { + let idx = -1; + for (let i = 0; i < events.length; i++) { + if (events[i].id === eventId) { + idx = i; + break; + } + } + + if (idx >= 0) { + events.splice(idx, 1); + return true; + } + return false; +} + +// Update event +function updateEvent( + eventId: number, + name?: string, + date?: Date, + attendees?: string[], + location?: string, + category?: "meeting" | "conference" | "workshop" | "other", +) { + for (let i = 0; i < events.length; i++) { + if (events[i].id === eventId) { + if (name !== undefined) events[i].name = name; + if (date !== undefined) events[i].date = date; + if (attendees !== undefined) events[i].attendees = attendees; + if (location !== undefined) events[i].location = location; + if (category !== undefined) events[i].category = category; + return true; + } + } + return false; +} + +// Add attendee to event +function addAttendeeToEvent(eventId: number, attendeeName: string) { + for (let i = 0; i < events.length; i++) { + if (events[i].id === eventId) { + // Check if attendee already exists + let exists = false; + for (let j = 0; j < events[i].attendees.length; j++) { + if (events[i].attendees[j] === attendeeName) { + exists = true; + break; + } + } + + if (!exists) { + events[i].attendees.push(attendeeName); + } + return !exists; + } + } + return false; +} + +// Remove attendee from event +function removeAttendeeFromEvent(eventId: number, attendeeName: string) { + for (let i = 0; i < events.length; i++) { + if (events[i].id === eventId) { + const initialLength = events[i].attendees.length; + events[i].attendees = events[i].attendees.filter( + (a) => a !== attendeeName, + ); + return events[i].attendees.length !== initialLength; + } + } + return false; +} + +// Get events by date range +function getEventsByDateRange(startDate: Date, endDate: Date) { + const result = []; + for (let i = 0; i < events.length; i++) { + if (events[i].date >= startDate && events[i].date <= endDate) { + result.push(events[i]); + } + } + return result; +} + +// Get events by category +function getEventsByCategory( + category: "meeting" | "conference" | "workshop" | "other", +) { + return events.filter((e) => e.category === category); +} + +// Example usage +add_event( + "Team Meeting", + new Date("2023-06-15T10:00:00"), + ["Alice", "Bob", "Charlie"], + "Conference Room A", + "meeting", +); + +add_event( + "JavaScript Workshop", + new Date("2023-06-20T14:00:00"), + ["David", "Eve"], + "Training Center", + "workshop", +); + +console.log("All events:", events); +addAttendeeToEvent(1, "Frank"); +console.log("Events after adding Frank:", events); + +export { + add_event, + addAttendeeToEvent, + events, + getEventsByCategory, + getEventsByDateRange, + removeAttendeeFromEvent, + removeEvent, + updateEvent, +}; diff --git a/manual-testing-sandbox/next-edit/next-edit-5-3-sol.ts b/manual-testing-sandbox/next-edit/next-edit-5-3-sol.ts new file mode 100644 index 000000000..211fc8531 --- /dev/null +++ b/manual-testing-sandbox/next-edit/next-edit-5-3-sol.ts @@ -0,0 +1,371 @@ +// Refactored shopping cart implementation following SOLID principles + +// Types and interfaces +interface Product { + id: number; + name: string; + price: number; + stock: number; + category: string; +} + +interface CartItem { + productId: number; + quantity: number; + price: number; +} + +interface Discount { + percentage: number; + minPurchase: number; + category?: string; +} + +interface UserInfo { + name: string; + email: string; + address?: Address; +} + +interface Address { + street: string; + city: string; + zipCode: string; + country: string; +} + +interface CartSummary { + items: CartItem[]; + total: number; + discountCode: string | null; + user: UserInfo | null; +} + +// Product catalog +const PRODUCTS: Record = { + 1: { + id: 1, + name: "Laptop", + price: 999.99, + stock: 10, + category: "electronics", + }, + 2: { + id: 2, + name: "Smartphone", + price: 699.99, + stock: 15, + category: "electronics", + }, + 3: { + id: 3, + name: "Headphones", + price: 149.99, + stock: 20, + category: "electronics", + }, + 4: { id: 4, name: "Desk", price: 249.99, stock: 5, category: "furniture" }, + 5: { id: 5, name: "Chair", price: 179.99, stock: 8, category: "furniture" }, +}; + +// Discount codes +const DISCOUNT_CODES: Record = { + SAVE10: { percentage: 10, minPurchase: 0 }, + SAVE20: { percentage: 20, minPurchase: 500 }, + FURNITURE15: { percentage: 15, minPurchase: 0, category: "furniture" }, +}; + +// Shopping cart class that follows Single Responsibility Principle +class ShoppingCart { + private items: CartItem[] = []; + private total: number = 0; + private discountCode: string | null = null; + private userInfo: UserInfo | null = null; + + // Add product to cart + public addToCart(productId: number, quantity: number = 1): boolean { + // Check if product exists + if (!PRODUCTS[productId]) { + console.error("Product not found!"); + return false; + } + + // Check if enough stock + if (PRODUCTS[productId].stock < quantity) { + console.error("Not enough stock!"); + return false; + } + + // Check if product already in cart + const existingItemIndex = this.findItemIndex(productId); + + if (existingItemIndex !== -1) { + // Update quantity if product already in cart + this.items[existingItemIndex].quantity += quantity; + } else { + // Add new item if not already in cart + this.items.push({ + productId, + quantity, + price: PRODUCTS[productId].price, + }); + } + + // Update stock + PRODUCTS[productId].stock -= quantity; + + // Recalculate cart total + this.calculateCartTotal(); + + return true; + } + + // Remove product from cart + public removeFromCart(productId: number, quantity: number = 1): boolean { + const itemIndex = this.findItemIndex(productId); + + if (itemIndex === -1) { + console.error("Product not in cart!"); + return false; + } + + const item = this.items[itemIndex]; + + // Determine quantity to remove + const qtyToRemove = Math.min(item.quantity, quantity); + + // Return stock + PRODUCTS[productId].stock += qtyToRemove; + + // Update cart item + item.quantity -= qtyToRemove; + + // Remove item if quantity is 0 + if (item.quantity === 0) { + this.items.splice(itemIndex, 1); + } + + // Recalculate cart total + this.calculateCartTotal(); + + return true; + } + + // Calculate cart total + public calculateCartTotal(): number { + let total = this.calculateSubtotal(); + + // Apply discount if any + if (this.discountCode) { + total = this.applyDiscountToTotal(total); + } + + this.total = total; + return this.total; + } + + // Calculate subtotal without discounts + private calculateSubtotal(): number { + return this.items.reduce( + (sum, item) => sum + item.price * item.quantity, + 0, + ); + } + + // Apply discount to total + private applyDiscountToTotal(total: number): number { + if (!this.discountCode) return total; + + const discount = DISCOUNT_CODES[this.discountCode]; + + // Check if discount applies to specific category + if (discount.category) { + return this.applyCategoryDiscount(total, discount); + } else { + // Apply discount to entire cart + const discountAmount = total * (discount.percentage / 100); + return total - discountAmount; + } + } + + // Apply category-specific discount + private applyCategoryDiscount(total: number, discount: Discount): number { + let categoryTotal = 0; + + for (const item of this.items) { + if (PRODUCTS[item.productId].category === discount.category) { + categoryTotal += item.price * item.quantity; + } + } + + // Apply discount to category total + const discountAmount = categoryTotal * (discount.percentage / 100); + return total - discountAmount; + } + + // Apply discount code + public applyDiscountCode(code: string): boolean { + // Check if discount code exists + if (!DISCOUNT_CODES[code]) { + console.error("Invalid discount code!"); + return false; + } + + const discount = DISCOUNT_CODES[code]; + + // Check minimum purchase requirement + if (this.total < discount.minPurchase) { + console.error( + `Minimum purchase of $${discount.minPurchase} required for this code!`, + ); + return false; + } + + // Apply discount code + this.discountCode = code; + + // Recalculate total + this.calculateCartTotal(); + + return true; + } + + // Set user information + public setUserInfo(name: string, email: string, address?: Address): boolean { + this.userInfo = { name, email, address }; + return true; + } + + // Find item index in cart + private findItemIndex(productId: number): number { + return this.items.findIndex((item) => item.productId === productId); + } + + // Checkout + public checkout(): boolean { + // Validate cart + if (this.items.length === 0) { + console.error("Cart is empty!"); + return false; + } + + // Validate user info + if (!this.userInfo || !this.userInfo.name || !this.userInfo.email) { + console.error("User information incomplete!"); + return false; + } + + // Process payment (simplified) + console.log("Processing payment for $" + this.total); + console.log("Items:", this.items); + console.log("User:", this.userInfo); + + // Clear cart after successful checkout + this.clearCart(); + + return true; + } + + // Clear cart + private clearCart(): void { + this.items = []; + this.total = 0; + this.discountCode = null; + } + + // Get cart summary + public getCartSummary(): CartSummary { + return { + items: [...this.items], // Return a copy to prevent direct mutation + total: this.total, + discountCode: this.discountCode, + user: this.userInfo, + }; + } +} + +// Create cart instance +const cart = new ShoppingCart(); + +// Example usage +cart.addToCart(1, 2); // Add 2 laptops +cart.addToCart(3, 1); // Add 1 headphones +cart.applyDiscountCode("SAVE10"); +cart.setUserInfo("John Doe", "john@example.com", { + street: "123 Main St", + city: "Anytown", + zipCode: "12345", + country: "USA", +}); + +console.log(cart.getCartSummary()); + +// Export for module usage +export { + Address, + cart, + CartItem, + CartSummary, + Discount, + DISCOUNT_CODES, + Product, + PRODUCTS, + ShoppingCart, + UserInfo, +}; + +/* +Code Smells in the Original File +Global State: The code uses global variables for cart state, making it difficult to track changes and prone to side effects. + +Lack of Encapsulation: Data and functions are not properly encapsulated, allowing direct manipulation of state from anywhere. + +No Type Definitions: Lack of proper TypeScript interfaces for the domain entities. + +Procedural Code: Functions operating on global state rather than object-oriented approach. + +Poor Data Structure Access: Using for loops with indexes instead of more expressive array methods. + +Mixed Responsibilities: Functions are handling multiple concerns (validation, business logic, data modification). + +Duplicated Logic: Same validation and calculation logic repeated in multiple places. + +No Clear Separation of Concerns: Business logic mixed with presentation logic (console logs). + +No Protection Against Direct Mutation: The cart data can be modified directly. + + +Improvements Made + +Created a Class-Based Design: Encapsulated cart functionality in a ShoppingCart class + +Added Strong Typing: Defined interfaces for all domain entities (Product, CartItem, Discount, UserInfo, Address, CartSummary) + +Single Responsibility Principle: Separated methods for different concerns (e.g., split discount calculation into multiple methods) + +Encapsulation: Made cart items and state private, only accessible through methods + +Immutability: Return copies of data structures to prevent external modification + +Modern JavaScript/TypeScript Patterns: + +Used array methods like reduce, findIndex instead of for loops +Used parameter defaults, array spread operators + + +Better Method Organization: + +Split large methods into smaller, focused ones +Created private helper methods for internal operations + + +Improved Validation: Centralized validation logic in appropriate methods + +Better Error Handling: Consistent error reporting approach + +Code Reusability: Extracted reusable logic into dedicated methods + +Defensive Programming: Added checks to prevent invalid operations + +Cleaner API Design: Created a clear public interface for the cart functionality +*/ diff --git a/manual-testing-sandbox/next-edit/next-edit-5-3.ts b/manual-testing-sandbox/next-edit/next-edit-5-3.ts new file mode 100644 index 000000000..937fd7d6c --- /dev/null +++ b/manual-testing-sandbox/next-edit/next-edit-5-3.ts @@ -0,0 +1,262 @@ +// A disorganized shopping cart implementation +// Difficulty: 3 - Moderate refactoring needed + +// Product catalog +const PRODUCTS = { + 1: { + id: 1, + name: "Laptop", + price: 999.99, + stock: 10, + category: "electronics", + }, + 2: { + id: 2, + name: "Smartphone", + price: 699.99, + stock: 15, + category: "electronics", + }, + 3: { + id: 3, + name: "Headphones", + price: 149.99, + stock: 20, + category: "electronics", + }, + 4: { id: 4, name: "Desk", price: 249.99, stock: 5, category: "furniture" }, + 5: { id: 5, name: "Chair", price: 179.99, stock: 8, category: "furniture" }, +}; + +// Discount codes +const DISCOUNT_CODES = { + SAVE10: { percentage: 10, minPurchase: 0 }, + SAVE20: { percentage: 20, minPurchase: 500 }, + FURNITURE15: { percentage: 15, minPurchase: 0, category: "furniture" }, +}; + +// Cart state +let cartItems: { productId: number; quantity: number; price: number }[] = []; +let cartTotal = 0; +let appliedDiscountCode: string | null = null; + +// User info +let userInfo: { + name: string; + email: string; + address?: { + street: string; + city: string; + zipCode: string; + country: string; + }; +} | null = null; + +// Add product to cart +function addToCart(productId: number, quantity: number = 1) { + // Check if product exists + if (!PRODUCTS[productId]) { + console.error("Product not found!"); + return false; + } + + // Check if enough stock + if (PRODUCTS[productId].stock < quantity) { + console.error("Not enough stock!"); + return false; + } + + // Check if product already in cart + let existingItem = false; + for (let i = 0; i < cartItems.length; i++) { + if (cartItems[i].productId === productId) { + // Update quantity + cartItems[i].quantity += quantity; + existingItem = true; + break; + } + } + + // Add new item if not already in cart + if (!existingItem) { + cartItems.push({ + productId, + quantity, + price: PRODUCTS[productId].price, + }); + } + + // Update stock + PRODUCTS[productId].stock -= quantity; + + // Recalculate cart total + calculateCartTotal(); + + return true; +} + +// Remove product from cart +function removeFromCart(productId: number, quantity: number = 1) { + for (let i = 0; i < cartItems.length; i++) { + if (cartItems[i].productId === productId) { + // Determine quantity to remove + const qtyToRemove = Math.min(cartItems[i].quantity, quantity); + + // Return stock + PRODUCTS[productId].stock += qtyToRemove; + + // Update cart item + cartItems[i].quantity -= qtyToRemove; + + // Remove item if quantity is 0 + if (cartItems[i].quantity === 0) { + cartItems.splice(i, 1); + } + + // Recalculate cart total + calculateCartTotal(); + + return true; + } + } + + console.error("Product not in cart!"); + return false; +} + +// Calculate cart total +function calculateCartTotal() { + let total = 0; + + // Sum all items + for (let i = 0; i < cartItems.length; i++) { + const item = cartItems[i]; + total += item.price * item.quantity; + } + + // Apply discount if any + if (appliedDiscountCode) { + const discount = DISCOUNT_CODES[appliedDiscountCode]; + + // Check if discount applies to specific category + if (discount.category) { + let categoryTotal = 0; + for (let i = 0; i < cartItems.length; i++) { + const item = cartItems[i]; + if (PRODUCTS[item.productId].category === discount.category) { + categoryTotal += item.price * item.quantity; + } + } + + // Apply discount to category total + const discountAmount = categoryTotal * (discount.percentage / 100); + total -= discountAmount; + } else { + // Apply discount to entire cart + const discountAmount = total * (discount.percentage / 100); + total -= discountAmount; + } + } + + cartTotal = total; + return cartTotal; +} + +// Apply discount code +function applyDiscountCode(code: string) { + // Check if discount code exists + if (!DISCOUNT_CODES[code]) { + console.error("Invalid discount code!"); + return false; + } + + const discount = DISCOUNT_CODES[code]; + + // Check minimum purchase requirement + if (cartTotal < discount.minPurchase) { + console.error( + `Minimum purchase of $${discount.minPurchase} required for this code!`, + ); + return false; + } + + // Apply discount code + appliedDiscountCode = code; + + // Recalculate total + calculateCartTotal(); + + return true; +} + +// Set user information +function setUserInfo( + name: string, + email: string, + address?: { street: string; city: string; zipCode: string; country: string }, +) { + userInfo = { name, email, address }; + return true; +} + +// Checkout +function checkout() { + // Validate cart + if (cartItems.length === 0) { + console.error("Cart is empty!"); + return false; + } + + // Validate user info + if (!userInfo || !userInfo.name || !userInfo.email) { + console.error("User information incomplete!"); + return false; + } + + // Process payment (simplified) + console.log("Processing payment for $" + cartTotal); + console.log("Items:", cartItems); + console.log("User:", userInfo); + + // Clear cart after successful checkout + cartItems = []; + cartTotal = 0; + appliedDiscountCode = null; + + return true; +} + +// Get cart summary +function getCartSummary() { + return { + items: cartItems, + total: cartTotal, + discountCode: appliedDiscountCode, + user: userInfo, + }; +} + +// Example usage +addToCart(1, 2); // Add 2 laptops +addToCart(3, 1); // Add 1 headphones +applyDiscountCode("SAVE10"); +setUserInfo("John Doe", "john@example.com", { + street: "123 Main St", + city: "Anytown", + zipCode: "12345", + country: "USA", +}); + +console.log(getCartSummary()); + +export { + addToCart, + applyDiscountCode, + calculateCartTotal, + checkout, + DISCOUNT_CODES, + getCartSummary, + PRODUCTS, + removeFromCart, + setUserInfo, +}; diff --git a/manual-testing-sandbox/next-edit/next-edit-6-3-sol.ts b/manual-testing-sandbox/next-edit/next-edit-6-3-sol.ts new file mode 100644 index 000000000..bf6b053b2 --- /dev/null +++ b/manual-testing-sandbox/next-edit/next-edit-6-3-sol.ts @@ -0,0 +1,668 @@ +// Refactored file upload and management system following SOLID principles +// Original: next-edit-6-3.ts + +// Types +interface FileData { + id: string; + name: string; + size: number; + type: string; + uploadDate: Date; + uploadedBy: string; + path: string; + isPublic: boolean; + tags?: string[]; + metadata?: Record; +} + +interface User { + id: string; + name: string; + email: string; + role: "admin" | "user" | "guest"; +} + +interface FileQuery { + name?: string; + type?: string; + tags?: string[]; + uploadedBy?: string; + isPublic?: boolean; + minSize?: number; + maxSize?: number; + uploadedAfter?: Date; + uploadedBefore?: Date; +} + +interface FileMetadataUpdate { + name?: string; + isPublic?: boolean; + tags?: string[]; + metadata?: Record; +} + +interface StorageStats { + used: number; + total: number; + available: number; + fileCount: number; +} + +// Constants +const MAX_STORAGE = 1024 * 1024 * 1024; // 1GB +const MAX_FILE_SIZE = 100 * 1024 * 1024; // 100MB + +// User Management +class UserManager { + private users: Record; + private currentUser: string | null = null; + + constructor(initialUsers: Record = {}) { + this.users = initialUsers; + } + + login(userId: string): boolean { + if (this.users[userId]) { + this.currentUser = userId; + console.log(`Logged in as ${this.users[userId].name}`); + return true; + } else { + console.error("User not found"); + return false; + } + } + + logout(): boolean { + this.currentUser = null; + console.log("Logged out"); + return true; + } + + getCurrentUser(): string | null { + return this.currentUser; + } + + getUser(userId: string): User | null { + return this.users[userId] || null; + } + + getCurrentUserData(): User | null { + return this.currentUser ? this.users[this.currentUser] : null; + } + + userExists(userId: string): boolean { + return !!this.users[userId]; + } +} + +// File Storage Management +class FileStorageManager { + private fileStorage: Record = {}; + private storageUsed = 0; + private readonly maxStorage: number; + private readonly maxFileSize: number; + private userManager: UserManager; + + constructor( + userManager: UserManager, + maxStorage = MAX_STORAGE, + maxFileSize = MAX_FILE_SIZE, + ) { + this.userManager = userManager; + this.maxStorage = maxStorage; + this.maxFileSize = maxFileSize; + } + + uploadFile( + fileName: string, + fileSize: number, + fileType: string, + isPublic = false, + tags: string[] = [], + metadata: Record = {}, + ): string | false { + const currentUser = this.userManager.getCurrentUser(); + + // Check if user is logged in + if (!currentUser) { + console.error("User not logged in"); + return false; + } + + // Check file size + if (!this.validateFileSize(fileSize)) { + return false; + } + + // Check available storage + if (!this.hasEnoughStorage(fileSize)) { + return false; + } + + // Generate file data + const fileId = this.generateFileId(); + const path = this.createFilePath(currentUser, fileId, fileName); + const fileData: FileData = { + id: fileId, + name: fileName, + size: fileSize, + type: fileType, + uploadDate: new Date(), + uploadedBy: currentUser, + path, + isPublic, + tags, + metadata, + }; + + // Save file and update storage + this.fileStorage[fileId] = fileData; + this.storageUsed += fileSize; + + console.log(`File ${fileName} uploaded successfully`); + return fileId; + } + + deleteFile(fileId: string): boolean { + const currentUser = this.userManager.getCurrentUser(); + const currentUserData = this.userManager.getCurrentUserData(); + + // Check if user is logged in + if (!currentUser || !currentUserData) { + console.error("User not logged in"); + return false; + } + + // Check if file exists + const file = this.getFileById(fileId); + if (!file) { + console.error("File not found"); + return false; + } + + // Check permissions + if (!this.canModifyFile(file, currentUser, currentUserData.role)) { + console.error("Permission denied"); + return false; + } + + // Update storage and remove file + this.storageUsed -= file.size; + delete this.fileStorage[fileId]; + + console.log(`File ${file.name} deleted successfully`); + return true; + } + + updateFileMetadata(fileId: string, updates: FileMetadataUpdate): boolean { + const currentUser = this.userManager.getCurrentUser(); + const currentUserData = this.userManager.getCurrentUserData(); + + // Check if user is logged in + if (!currentUser || !currentUserData) { + console.error("User not logged in"); + return false; + } + + // Check if file exists + const file = this.getFileById(fileId); + if (!file) { + console.error("File not found"); + return false; + } + + // Check permissions + if (!this.canModifyFile(file, currentUser, currentUserData.role)) { + console.error("Permission denied"); + return false; + } + + // Update file data + if (updates.name !== undefined) + this.fileStorage[fileId].name = updates.name; + if (updates.isPublic !== undefined) + this.fileStorage[fileId].isPublic = updates.isPublic; + if (updates.tags !== undefined) + this.fileStorage[fileId].tags = updates.tags; + if (updates.metadata !== undefined) { + this.fileStorage[fileId].metadata = { + ...this.fileStorage[fileId].metadata, + ...updates.metadata, + }; + } + + console.log(`File ${file.name} updated successfully`); + return true; + } + + getFileData(fileId: string): FileData | null { + // Check if file exists + const file = this.getFileById(fileId); + if (!file) { + console.error("File not found"); + return null; + } + + const currentUser = this.userManager.getCurrentUser(); + const currentUserData = this.userManager.getCurrentUserData(); + + // Check if user has permission to access + if ( + !file.isPublic && + currentUser !== file.uploadedBy && + currentUserData?.role !== "admin" && + !this.isSharedWithUser(file, currentUser) + ) { + console.error("Permission denied"); + return null; + } + + return file; + } + + searchFiles(query: FileQuery): FileData[] { + const currentUser = this.userManager.getCurrentUser(); + const currentUserData = this.userManager.getCurrentUserData(); + + // Check if user is logged in + if (!currentUser || !currentUserData) { + console.error("User not logged in"); + return []; + } + + const results: FileData[] = []; + + // Filter files + for (const fileId in this.fileStorage) { + const file = this.fileStorage[fileId]; + + // Skip files user doesn't have access to + if ( + !file.isPublic && + file.uploadedBy !== currentUser && + currentUserData.role !== "admin" && + !this.isSharedWithUser(file, currentUser) + ) { + continue; + } + + if (this.matchesQuery(file, query)) { + results.push(file); + } + } + + return results; + } + + getStorageStats(): StorageStats { + return { + used: this.storageUsed, + total: this.maxStorage, + available: this.maxStorage - this.storageUsed, + fileCount: Object.keys(this.fileStorage).length, + }; + } + + shareFile(fileId: string, targetUserId: string): boolean { + const currentUser = this.userManager.getCurrentUser(); + const currentUserData = this.userManager.getCurrentUserData(); + + // Check if user is logged in + if (!currentUser || !currentUserData) { + console.error("User not logged in"); + return false; + } + + // Check if file exists + const file = this.getFileById(fileId); + if (!file) { + console.error("File not found"); + return false; + } + + // Check if target user exists + if (!this.userManager.userExists(targetUserId)) { + console.error("Target user not found"); + return false; + } + + // Check if user has permission + if (!this.canModifyFile(file, currentUser, currentUserData.role)) { + console.error("Permission denied"); + return false; + } + + // Share file by adding metadata + if (!file.metadata) { + file.metadata = {}; + } + + if (!file.metadata.sharedWith) { + file.metadata.sharedWith = []; + } + + // Check if already shared + if (!file.metadata.sharedWith.includes(targetUserId)) { + file.metadata.sharedWith.push(targetUserId); + } + + const targetUser = this.userManager.getUser(targetUserId); + console.log(`File ${file.name} shared with ${targetUser?.name}`); + return true; + } + + // Helper methods + private generateFileId(): string { + return "file_" + Date.now() + "_" + Math.floor(Math.random() * 1000); + } + + private createFilePath( + userId: string, + fileId: string, + fileName: string, + ): string { + return `/storage/${userId}/${fileId}_${fileName}`; + } + + private getFileById(fileId: string): FileData | null { + return this.fileStorage[fileId] || null; + } + + private validateFileSize(fileSize: number): boolean { + if (fileSize > this.maxFileSize) { + console.error( + `File too large. Maximum size is ${this.maxFileSize / (1024 * 1024)}MB`, + ); + return false; + } + return true; + } + + private hasEnoughStorage(fileSize: number): boolean { + if (this.storageUsed + fileSize > this.maxStorage) { + console.error("Not enough storage space"); + return false; + } + return true; + } + + private canModifyFile( + file: FileData, + userId: string, + userRole: string, + ): boolean { + return file.uploadedBy === userId || userRole === "admin"; + } + + private isSharedWithUser(file: FileData, userId: string | null): boolean { + if (!userId) return false; + return !!file.metadata?.sharedWith?.includes(userId); + } + + private matchesQuery(file: FileData, query: FileQuery): boolean { + // Name filter + if ( + query.name && + !file.name.toLowerCase().includes(query.name.toLowerCase()) + ) { + return false; + } + + // Type filter + if (query.type && file.type !== query.type) { + return false; + } + + // Upload user filter + if (query.uploadedBy && file.uploadedBy !== query.uploadedBy) { + return false; + } + + // Public/private filter + if (query.isPublic !== undefined && file.isPublic !== query.isPublic) { + return false; + } + + // Size range filter + if (query.minSize !== undefined && file.size < query.minSize) { + return false; + } + if (query.maxSize !== undefined && file.size > query.maxSize) { + return false; + } + + // Date range filter + if (query.uploadedAfter && file.uploadDate < query.uploadedAfter) { + return false; + } + if (query.uploadedBefore && file.uploadDate > query.uploadedBefore) { + return false; + } + + // Tags filter + if (query.tags && query.tags.length > 0) { + if (!file.tags) { + return false; + } else { + for (const tag of query.tags) { + if (!file.tags.includes(tag)) { + return false; + } + } + } + } + + return true; + } + + // For testing/export purposes + getFileStorage(): Record { + return this.fileStorage; + } +} + +// Demo Application +// Initialize system with users +const initialUsers: Record = { + user1: { + id: "user1", + name: "Admin User", + email: "admin@example.com", + role: "admin", + }, + user2: { + id: "user2", + name: "Regular User", + email: "user@example.com", + role: "user", + }, + user3: { + id: "user3", + name: "Guest User", + email: "guest@example.com", + role: "guest", + }, +}; + +// Create system instances +const userManager = new UserManager(initialUsers); +const fileManager = new FileStorageManager(userManager); + +// Example usage +userManager.login("user1"); +const fileId = fileManager.uploadFile( + "document.pdf", + 1024 * 1024, + "application/pdf", + false, + ["important", "document"], +); +fileManager.updateFileMetadata(fileId as string, { isPublic: true }); +fileManager.shareFile(fileId as string, "user2"); +console.log(fileManager.getFileData(fileId as string)); +console.log(fileManager.getStorageStats()); +userManager.logout(); + +// Exported API for backward compatibility +export const fileStorage = fileManager.getFileStorage(); +export const users = initialUsers; +export function login(userId: string): boolean { + return userManager.login(userId); +} +export function logout(): boolean { + return userManager.logout(); +} +export function uploadFile( + fileName: string, + fileSize: number, + fileType: string, + isPublic = false, + tags: string[] = [], + metadata: Record = {}, +): string | false { + return fileManager.uploadFile( + fileName, + fileSize, + fileType, + isPublic, + tags, + metadata, + ); +} +export function deleteFile(fileId: string): boolean { + return fileManager.deleteFile(fileId); +} +export function updateFileMetadata( + fileId: string, + updates: FileMetadataUpdate, +): boolean { + return fileManager.updateFileMetadata(fileId, updates); +} +export function getFileData(fileId: string): FileData | null { + return fileManager.getFileData(fileId); +} +export function searchFiles(query: FileQuery): FileData[] { + return fileManager.searchFiles(query); +} +export function getStorageStats(): StorageStats { + return fileManager.getStorageStats(); +} +export function shareFile(fileId: string, targetUserId: string): boolean { + return fileManager.shareFile(fileId, targetUserId); +} + +export { + FileData, + FileMetadataUpdate, + FileQuery, + FileStorageManager, + StorageStats, + User, + UserManager, +}; + +/* +Code Smells in the Original File (next-edit-6-3.ts) + +Violation of Single Responsibility Principle (SRP): + +The code mixed user management, file storage, permissions, and business logic in a single file with global state. +Functions were handling multiple responsibilities (authentication, validation, business logic). + + +Global State and Poor Encapsulation: + +Used global variables (fileStorage, users, currentUser, storageUsed) instead of encapsulated state. +Direct manipulation of shared state led to potential side effects and made testing difficult. + + +Lack of Proper Abstractions: + +No separation between data access and business logic. +No interfaces defined for the different components of the system. + + +Repetitive Code: + +Authentication and permission checks repeated in every function. +File existence validation duplicated across functions. + + +Poor Error Handling: + +Inconsistent error reporting (some console.error, some boolean returns). +No distinction between different types of errors. + + +Primitive Obsession: + +Using primitive types instead of creating proper domain objects. + + +Tight Coupling: + +Functions directly depend on global state. +No dependency injection making the code hard to test or extend. + + +Improvements Made in the Refactored Solution + +Applied Single Responsibility Principle: + +Created separate UserManager and FileStorageManager classes with clear responsibilities. +Each method has a single purpose with helper methods for validation and common tasks. + + +Proper Encapsulation: + +Encapsulated state within classes using private fields. +Provided controlled access to state through methods with proper validation. + + +Improved Type Safety: + +Converted types to interfaces for better type safety. +Added specific interfaces for operations (FileQuery, FileMetadataUpdate, etc.). + + +Dependency Injection: + +FileStorageManager depends on UserManager through constructor injection. +Made constants configurable through constructor parameters. + + +Extracted Helper Methods: + +Created private helper methods for validation logic. +Extracted common operations like canModifyFile, isSharedWithUser, etc. + + +Improved Code Structure: + +Organized related functionality into classes. +Added proper commenting and documentation. + + +Preserved Backward Compatibility: + +Maintained the original API through exported functions. +Made it easy to migrate existing code to use the new object-oriented approach. + + +Applied Open/Closed Principle: + +The system is now extensible without modifying existing code. +New behaviors can be added by extending or composing with existing classes. + + +Applied Interface Segregation: + +Split large interfaces into smaller, more specific ones. +Created purpose-specific interfaces like FileQuery and FileMetadataUpdate. + + +Improved Error Handling: + +Consistent error reporting pattern. +Clear validation in separate methods. +*/ diff --git a/manual-testing-sandbox/next-edit/next-edit-6-3.ts b/manual-testing-sandbox/next-edit/next-edit-6-3.ts new file mode 100644 index 000000000..638be21aa --- /dev/null +++ b/manual-testing-sandbox/next-edit/next-edit-6-3.ts @@ -0,0 +1,406 @@ +// A chaotic file upload and management system +// Difficulty: 3 - Moderate refactoring needed + +// Types +type FileData = { + id: string; + name: string; + size: number; + type: string; + uploadDate: Date; + uploadedBy: string; + path: string; + isPublic: boolean; + tags?: string[]; + metadata?: Record; +}; + +type User = { + id: string; + name: string; + email: string; + role: "admin" | "user" | "guest"; +}; + +// Global storage +const fileStorage: Record = {}; +const users: Record = { + user1: { + id: "user1", + name: "Admin User", + email: "admin@example.com", + role: "admin", + }, + user2: { + id: "user2", + name: "Regular User", + email: "user@example.com", + role: "user", + }, + user3: { + id: "user3", + name: "Guest User", + email: "guest@example.com", + role: "guest", + }, +}; +let currentUser: string | null = null; +let storageUsed = 0; +const MAX_STORAGE = 1024 * 1024 * 1024; // 1GB +const MAX_FILE_SIZE = 100 * 1024 * 1024; // 100MB + +// Login function +function login(userId: string) { + if (users[userId]) { + currentUser = userId; + console.log(`Logged in as ${users[userId].name}`); + return true; + } else { + console.error("User not found"); + return false; + } +} + +// Logout function +function logout() { + currentUser = null; + console.log("Logged out"); + return true; +} + +// Upload file +function uploadFile( + fileName: string, + fileSize: number, + fileType: string, + isPublic: boolean = false, + tags: string[] = [], + metadata: Record = {}, +) { + // Check if user is logged in + if (!currentUser) { + console.error("User not logged in"); + return false; + } + + // Check file size + if (fileSize > MAX_FILE_SIZE) { + console.error( + `File too large. Maximum size is ${MAX_FILE_SIZE / (1024 * 1024)}MB`, + ); + return false; + } + + // Check available storage + if (storageUsed + fileSize > MAX_STORAGE) { + console.error("Not enough storage space"); + return false; + } + + // Generate ID + const fileId = "file_" + Date.now() + "_" + Math.floor(Math.random() * 1000); + + // Create file path + const path = `/storage/${currentUser}/${fileId}_${fileName}`; + + // Create file data + const fileData: FileData = { + id: fileId, + name: fileName, + size: fileSize, + type: fileType, + uploadDate: new Date(), + uploadedBy: currentUser, + path: path, + isPublic: isPublic, + tags: tags, + metadata: metadata, + }; + + // Save file data + fileStorage[fileId] = fileData; + + // Update storage used + storageUsed += fileSize; + + console.log(`File ${fileName} uploaded successfully`); + return fileId; +} + +// Delete file +function deleteFile(fileId: string) { + // Check if user is logged in + if (!currentUser) { + console.error("User not logged in"); + return false; + } + + // Check if file exists + if (!fileStorage[fileId]) { + console.error("File not found"); + return false; + } + + // Check if user has permission + const file = fileStorage[fileId]; + const user = users[currentUser]; + if (file.uploadedBy !== currentUser && user.role !== "admin") { + console.error("Permission denied"); + return false; + } + + // Update storage used + storageUsed -= file.size; + + // Remove file + delete fileStorage[fileId]; + + console.log(`File ${file.name} deleted successfully`); + return true; +} + +// Update file metadata +function updateFileMetadata( + fileId: string, + updates: { + name?: string; + isPublic?: boolean; + tags?: string[]; + metadata?: Record; + }, +) { + // Check if user is logged in + if (!currentUser) { + console.error("User not logged in"); + return false; + } + + // Check if file exists + if (!fileStorage[fileId]) { + console.error("File not found"); + return false; + } + + // Check if user has permission + const file = fileStorage[fileId]; + const user = users[currentUser]; + if (file.uploadedBy !== currentUser && user.role !== "admin") { + console.error("Permission denied"); + return false; + } + + // Update file data + if (updates.name !== undefined) fileStorage[fileId].name = updates.name; + if (updates.isPublic !== undefined) + fileStorage[fileId].isPublic = updates.isPublic; + if (updates.tags !== undefined) fileStorage[fileId].tags = updates.tags; + if (updates.metadata !== undefined) { + fileStorage[fileId].metadata = { + ...fileStorage[fileId].metadata, + ...updates.metadata, + }; + } + + console.log(`File ${file.name} updated successfully`); + return true; +} + +// Get file data +function getFileData(fileId: string) { + // Check if file exists + if (!fileStorage[fileId]) { + console.error("File not found"); + return null; + } + + const file = fileStorage[fileId]; + + // Check if user has permission + if ( + !file.isPublic && + currentUser !== file.uploadedBy && + users[currentUser]?.role !== "admin" + ) { + console.error("Permission denied"); + return null; + } + + return file; +} + +// Search files +function searchFiles(query: { + name?: string; + type?: string; + tags?: string[]; + uploadedBy?: string; + isPublic?: boolean; + minSize?: number; + maxSize?: number; + uploadedAfter?: Date; + uploadedBefore?: Date; +}) { + // Check if user is logged in + if (!currentUser) { + console.error("User not logged in"); + return []; + } + + const user = users[currentUser]; + const results: FileData[] = []; + + // Filter files + for (const fileId in fileStorage) { + const file = fileStorage[fileId]; + + // Skip files user doesn't have access to + if ( + !file.isPublic && + file.uploadedBy !== currentUser && + user.role !== "admin" + ) { + continue; + } + + // Apply filters + let match = true; + + if ( + query.name && + !file.name.toLowerCase().includes(query.name.toLowerCase()) + ) { + match = false; + } + + if (query.type && file.type !== query.type) { + match = false; + } + + if (query.uploadedBy && file.uploadedBy !== query.uploadedBy) { + match = false; + } + + if (query.isPublic !== undefined && file.isPublic !== query.isPublic) { + match = false; + } + + if (query.minSize !== undefined && file.size < query.minSize) { + match = false; + } + + if (query.maxSize !== undefined && file.size > query.maxSize) { + match = false; + } + + if (query.uploadedAfter && file.uploadDate < query.uploadedAfter) { + match = false; + } + + if (query.uploadedBefore && file.uploadDate > query.uploadedBefore) { + match = false; + } + + if (query.tags && query.tags.length > 0) { + if (!file.tags) { + match = false; + } else { + for (const tag of query.tags) { + if (!file.tags.includes(tag)) { + match = false; + break; + } + } + } + } + + if (match) { + results.push(file); + } + } + + return results; +} + +// Get storage stats +function getStorageStats() { + return { + used: storageUsed, + total: MAX_STORAGE, + available: MAX_STORAGE - storageUsed, + fileCount: Object.keys(fileStorage).length, + }; +} + +// Share file with user +function shareFile(fileId: string, targetUserId: string) { + // Check if user is logged in + if (!currentUser) { + console.error("User not logged in"); + return false; + } + + // Check if file exists + if (!fileStorage[fileId]) { + console.error("File not found"); + return false; + } + + // Check if target user exists + if (!users[targetUserId]) { + console.error("Target user not found"); + return false; + } + + // Check if user has permission + const file = fileStorage[fileId]; + if (file.uploadedBy !== currentUser && users[currentUser]?.role !== "admin") { + console.error("Permission denied"); + return false; + } + + // Share file by adding metadata + if (!file.metadata) { + file.metadata = {}; + } + + if (!file.metadata.sharedWith) { + file.metadata.sharedWith = []; + } + + // Check if already shared + if (!file.metadata.sharedWith.includes(targetUserId)) { + file.metadata.sharedWith.push(targetUserId); + } + + console.log(`File ${file.name} shared with ${users[targetUserId].name}`); + return true; +} + +// Example usage +login("user1"); +const fileId = uploadFile( + "document.pdf", + 1024 * 1024, + "application/pdf", + false, + ["important", "document"], +); +updateFileMetadata(fileId, { isPublic: true }); +shareFile(fileId, "user2"); +console.log(getFileData(fileId)); +console.log(getStorageStats()); +logout(); + +export { + deleteFile, + fileStorage, + getFileData, + getStorageStats, + login, + logout, + searchFiles, + shareFile, + updateFileMetadata, + uploadFile, + users, +}; diff --git a/manual-testing-sandbox/next-edit/next-edit-7-4-sol.ts b/manual-testing-sandbox/next-edit/next-edit-7-4-sol.ts new file mode 100644 index 000000000..1e8da49f3 --- /dev/null +++ b/manual-testing-sandbox/next-edit/next-edit-7-4-sol.ts @@ -0,0 +1,489 @@ +// Refactored event processing system with proper separation of concerns +// Solution for next-edit-7-4.ts + +// Types +export type EventType = + | "click" + | "hover" + | "scroll" + | "keypress" + | "resize" + | "load"; +export type EventData = Record; +export type EventCallback = (data: EventData) => void; +export type ThemeType = "light" | "dark"; +export type PreferenceKey = "theme" | "fontSize" | "notifications"; + +// Event system +export interface IEventEmitter { + on(eventType: EventType, callback: EventCallback): void; + emit(eventType: EventType, data: EventData): void; + off(eventType: EventType, callback: EventCallback): void; +} + +export class EventEmitter implements IEventEmitter { + private events: Map> = new Map(); + private processingQueue: Array<{ type: EventType; data: EventData }> = []; + private isProcessing = false; + + constructor() { + // Initialize event collections + this.events.set("click", new Set()); + this.events.set("hover", new Set()); + this.events.set("scroll", new Set()); + this.events.set("keypress", new Set()); + this.events.set("resize", new Set()); + this.events.set("load", new Set()); + } + + public on(eventType: EventType, callback: EventCallback): void { + const handlers = this.events.get(eventType) || new Set(); + handlers.add(callback); + this.events.set(eventType, handlers); + } + + public off(eventType: EventType, callback: EventCallback): void { + const handlers = this.events.get(eventType); + if (handlers) { + handlers.delete(callback); + } + } + + public emit(eventType: EventType, data: EventData): void { + if (this.isProcessing) { + this.processingQueue.push({ type: eventType, data }); + return; + } + + this.isProcessing = true; + + try { + this.processEvent(eventType, data); + + // Process queue + while (this.processingQueue.length > 0) { + const next = this.processingQueue.shift()!; + this.processEvent(next.type, next.data); + } + } finally { + this.isProcessing = false; + } + } + + private processEvent(eventType: EventType, data: EventData): void { + const handlers = this.events.get(eventType) || new Set(); + for (const handler of handlers) { + handler(data); + } + } +} + +// State management with proper encapsulation +export class AppState { + private _count = 0; + private _lastEvent: { + type: string; + data: EventData; + timestamp: number; + } | null = null; + private _eventHistory: string[] = []; + + get count(): number { + return this._count; + } + + set count(value: number) { + this._count = value; + } + + get lastEvent(): { type: string; data: EventData; timestamp: number } | null { + return this._lastEvent; + } + + get eventHistory(): ReadonlyArray { + return [...this._eventHistory]; + } + + public recordEvent(type: string, data: EventData): void { + this._lastEvent = { type, data, timestamp: Date.now() }; + this._eventHistory.push(`${type}:${JSON.stringify(data)}`); + } + + public incrementCount(): void { + this._count++; + } + + public resetCount(): void { + this._count = 0; + } + + public formatEventHistory(): string { + return this._eventHistory + .map((event, index) => `${index + 1}. ${event}`) + .join("\n"); + } +} + +// User Authentication - separate concern +export interface IAuthService { + login(username: string, password: string): Promise; + logout(): void; + isAuthenticated(): boolean; + getUserData(): any; +} + +export class AuthService implements IAuthService { + private isActive = false; + private token = ""; + private userData: any = null; + private username = ""; + + constructor(private eventEmitter: IEventEmitter) {} + + public setUsername(name: string): void { + this.username = name; + } + + public getUsername(): string { + return this.username; + } + + public async login(username: string, password: string): Promise { + console.log(`Attempting login for ${username}...`); + + return new Promise((resolve) => { + // Simulate API call + setTimeout(() => { + this.isActive = true; + this.token = `token-${Math.random().toString(36).substring(7)}`; + this.userData = { + name: username, + role: "user", + loginTime: new Date(), + }; + + this.eventEmitter.emit("load", { user: username }); + resolve(); + }, 1000); + }); + } + + public logout(): void { + this.isActive = false; + this.token = ""; + this.userData = null; + this.eventEmitter.emit("load", { user: null }); + } + + public isAuthenticated(): boolean { + return this.isActive; + } + + public getUserData(): any { + return this.userData; + } +} + +// Preferences management - separate concern +export class PreferencesManager { + private preferences = { + theme: "light" as ThemeType, + fontSize: 12, + notifications: true, + }; + + getPreference( + key: K, + ): (typeof this.preferences)[K] { + return this.preferences[key]; + } + + updatePreference( + key: K, + value: (typeof this.preferences)[K], + ): void { + this.preferences[key] = value; + } +} + +// UI management - separate concern +export class UIManager { + constructor( + private appState: AppState, + private preferencesManager: PreferencesManager, + private eventEmitter: IEventEmitter, + ) { + // Set up default click handler + this.eventEmitter.on("click", (data) => { + console.log("Default click handler:", data); + this.appState.incrementCount(); + this.appState.recordEvent("click", data); + this.updateUI(); + }); + } + + public updateUI(): void { + const countElement = document.getElementById("count"); + if (countElement) { + countElement.textContent = String(this.appState.count); + } + + // Apply theme + document.body.className = this.preferencesManager.getPreference("theme"); + + // Update last event display + const lastEventElement = document.getElementById("lastEvent"); + if (lastEventElement && this.appState.lastEvent) { + lastEventElement.textContent = JSON.stringify(this.appState.lastEvent); + } + } +} + +// Analytics - separate concern +export interface IAnalyticsService { + trackEvent(category: string, action: string, label?: string): void; +} + +export class AnalyticsService implements IAnalyticsService { + constructor( + private appState: AppState, + private authService: IAuthService, + ) {} + + public trackEvent(category: string, action: string, label?: string): void { + const eventData = { category, action, label, timestamp: Date.now() }; + console.log("Tracking event:", eventData); + + this.appState.recordEvent("analytics", eventData); + + if (this.authService.isAuthenticated()) { + this.sendToAnalyticsService(eventData); + } + } + + private sendToAnalyticsService(data: any): void { + // Pretend API call + console.log("Sending to analytics service:", data); + } +} + +// Application class to orchestrate all components +export class Application { + private eventEmitter: IEventEmitter; + private appState: AppState; + private authService: IAuthService; + private preferencesManager: PreferencesManager; + private uiManager: UIManager; + private analyticsService: IAnalyticsService; + + constructor() { + // Initialize all components with proper dependencies + this.eventEmitter = new EventEmitter(); + this.appState = new AppState(); + this.authService = new AuthService(this.eventEmitter); + this.preferencesManager = new PreferencesManager(); + this.uiManager = new UIManager( + this.appState, + this.preferencesManager, + this.eventEmitter, + ); + this.analyticsService = new AnalyticsService( + this.appState, + this.authService, + ); + + this.setupEventListeners(); + } + + private setupEventListeners(): void { + // Setup DOM event listeners + document.addEventListener("DOMContentLoaded", () => { + this.eventEmitter.emit("load", { page: "home" }); + + document.addEventListener("click", (e) => { + this.eventEmitter.emit("click", { + target: e.target, + x: e.clientX, + y: e.clientY, + }); + + // Handle login button click + if (e.target && (e.target as HTMLElement).id === "login-button") { + this.authService.login( + this.authService.getUsername(), + "hardcoded-password", + ); + } + }); + + document.addEventListener("keypress", (e) => { + this.eventEmitter.emit("keypress", { key: e.key, code: e.code }); + }); + }); + } + + // Public API for application + public on(eventType: EventType, callback: EventCallback): void { + this.eventEmitter.on(eventType, callback); + } + + public emit(eventType: EventType, data: EventData): void { + this.eventEmitter.emit(eventType, data); + } + + public getCurrentCount(): number { + return this.appState.count; + } + + public resetCount(): void { + this.appState.resetCount(); + this.eventEmitter.emit("click", { action: "reset" }); + this.uiManager.updateUI(); + } + + public setUsername(name: string): void { + this.authService.setUsername(name); + } + + public updatePreference(key: PreferenceKey, value: any): void { + this.preferencesManager.updatePreference(key, value); + this.uiManager.updateUI(); + this.analyticsService.trackEvent( + "preferences", + "update", + `${key}:${value}`, + ); + } + + public trackEvent(category: string, action: string, label?: string): void { + this.analyticsService.trackEvent(category, action, label); + } + + public formatEventHistory(): string { + return this.appState.formatEventHistory(); + } +} + +// Create and export singleton application instance +export const app = new Application(); + +// Simplified API for backward compatibility +export function getCurrentCount(): number { + return app.getCurrentCount(); +} + +export function resetCount(): void { + app.resetCount(); +} + +export function setUsername(name: string): void { + app.setUsername(name); +} + +/* +Code Smells in the Original Code + +Violation of Single Responsibility Principle (SRP): + +The EventManager class was a "God class" handling events, UI updates, authentication, analytics, and preferences +Functions had multiple responsibilities mixed together + + +Global State Abuse: + +Direct manipulation of a global mutable state object +No encapsulation or proper state management + + +Tight Coupling: + +Direct DOM manipulation in the event manager +Hard dependencies between unrelated concerns (events, auth, UI) + + +Poor Extensibility: + +Singleton pattern limiting testability and flexibility +Hardcoded event types and handlers +No interface-based design + + +Dependency Issues: + +Direct instantiation of dependencies +No dependency injection +High-level modules depending on low-level details + + +Security Concerns: + +Hardcoded password in code +No proper authentication flow + + +Maintainability Problems: + +Scattered responsibilities making the code hard to maintain +Side effects hidden throughout the codebase + + +Improvements Made in the Solution + +Applied Single Responsibility Principle: + +Split the monolithic EventManager into specialized classes (EventEmitter, AppState, AuthService, etc.) +Each class now has a clear, focused responsibility + + +Improved Encapsulation: + +Replaced global state with proper encapsulated classes +Added getters/setters to control state access +Private fields to protect internal state + + +Implemented Interface-based Design: + +Created interfaces like IEventEmitter, IAuthService, and IAnalyticsService +Enables future extension and easier testing + + +Applied Dependency Inversion: + +Components depend on abstractions rather than concrete implementations +Dependencies are injected through constructors +High-level modules no longer depend directly on low-level modules + + +Better Organization: + +Segregated interfaces to follow Interface Segregation Principle +Clear separation between UI, state, authentication, and event handling + + +Enhanced Extensibility: + +Event system now uses Sets instead of Arrays for better performance and to avoid duplicate handlers +Added ability to remove event listeners with the off method +Created proper type definitions for better type safety + + +Improved State Management: + +Centralized state in the AppState class with proper access controls +Immutable collection returns (using spreads and readonly) +Clear state manipulation methods + + +Better Event Processing: + +Cleaner event queue handling +More efficient event processing + + +Application Orchestration: + +Created an Application class to coordinate all components +Maintains backward compatibility with the original API +Provides a cleaner facade for all operations +*/ diff --git a/manual-testing-sandbox/next-edit/next-edit-7-4.ts b/manual-testing-sandbox/next-edit/next-edit-7-4.ts new file mode 100644 index 000000000..d3bfe1169 --- /dev/null +++ b/manual-testing-sandbox/next-edit/next-edit-7-4.ts @@ -0,0 +1,211 @@ +// A messy and tightly coupled event processing system with poor separation of concerns +// Difficulty: 4 + +type EventType = "click" | "hover" | "scroll" | "keypress" | "resize" | "load"; +type EventCallback = (data: any) => void; + +// Global state - everything is mixed together +const globalState = { + count: 0, + lastEvent: null as any, + isActive: false, + username: "", + token: "", + preferences: { theme: "light", fontSize: 12, notifications: true }, + eventHistory: [] as string[], + userData: null as any, +}; + +// God class that handles everything +class EventManager { + private events: Map = new Map(); + private static instance: EventManager; + private isProcessing = false; + private processingQueue: Array<{ type: EventType; data: any }> = []; + + private constructor() { + // Initialize default handlers + this.events.set("click", []); + this.events.set("hover", []); + this.events.set("scroll", []); + this.events.set("keypress", []); + this.events.set("resize", []); + this.events.set("load", []); + + // Add default behavior + this.on("click", (data) => { + console.log("Default click handler:", data); + globalState.count++; + globalState.lastEvent = { type: "click", data, timestamp: Date.now() }; + globalState.eventHistory.push(`click:${JSON.stringify(data)}`); + + // Side effects directly in handler + this.updateUI(); + + // Mixes concerns by also handling auth + if (data.target && data.target.id === "login-button") { + this.login(globalState.username, "hardcoded-password"); + } + }); + } + + // Singleton pattern + public static getInstance(): EventManager { + if (!EventManager.instance) { + EventManager.instance = new EventManager(); + } + return EventManager.instance; + } + + public on(eventType: EventType, callback: EventCallback): void { + const handlers = this.events.get(eventType) || []; + handlers.push(callback); + this.events.set(eventType, handlers); + } + + public emit(eventType: EventType, data: any): void { + globalState.lastEvent = { type: eventType, data, timestamp: Date.now() }; + + if (this.isProcessing) { + this.processingQueue.push({ type: eventType, data }); + return; + } + + this.isProcessing = true; + + try { + const handlers = this.events.get(eventType) || []; + for (const handler of handlers) { + handler(data); + + // Random state modifications scattered throughout code + globalState.eventHistory.push(`${eventType}:${JSON.stringify(data)}`); + } + + // UI Update with every event + this.updateUI(); + + // Process queue + while (this.processingQueue.length > 0) { + const next = this.processingQueue.shift()!; + const queueHandlers = this.events.get(next.type) || []; + for (const handler of queueHandlers) { + handler(next.data); + } + } + } finally { + this.isProcessing = false; + } + } + + // Mixed UI concerns with event handling + private updateUI(): void { + // Directly manipulates DOM + const countElement = document.getElementById("count"); + if (countElement) { + countElement.textContent = String(globalState.count); + } + + // Apply theme + document.body.className = globalState.preferences.theme; + + // Update last event display + const lastEventElement = document.getElementById("lastEvent"); + if (lastEventElement && globalState.lastEvent) { + lastEventElement.textContent = JSON.stringify(globalState.lastEvent); + } + } + + // Authentication logic mixed with event handling + private login(username: string, password: string): void { + console.log(`Attempting login for ${username}...`); + + // Simulate API call + setTimeout(() => { + globalState.isActive = true; + globalState.token = `token-${Math.random().toString(36).substring(7)}`; + globalState.userData = { + name: username, + role: "user", + loginTime: new Date(), + }; + + // Update UI after login + this.updateUI(); + + // Emit another event + this.emit("load", { user: username }); + }, 1000); + } + + // Analytics mixed in + public trackEvent(category: string, action: string, label?: string): void { + const eventData = { category, action, label, timestamp: Date.now() }; + console.log("Tracking event:", eventData); + + // Update global state + globalState.eventHistory.push(`analytics:${JSON.stringify(eventData)}`); + + // Send to analytics service + if (globalState.isActive) { + this.sendToAnalyticsService(eventData); + } + } + + private sendToAnalyticsService(data: any): void { + // Pretend API call + console.log("Sending to analytics service:", data); + } + + // Utility functions mixed in + public formatEventHistory(): string { + return globalState.eventHistory + .map((event, index) => `${index + 1}. ${event}`) + .join("\n"); + } + + // Settings management mixed in + public updatePreference( + key: "theme" | "fontSize" | "notifications", + value: any, + ): void { + globalState.preferences[key] = value; + this.updateUI(); + this.trackEvent("preferences", "update", `${key}:${value}`); + } +} + +// Export singleton +export const eventManager = EventManager.getInstance(); + +// Helper functions that directly use global state +export function getCurrentCount(): number { + return globalState.count; +} + +export function resetCount(): void { + globalState.count = 0; + eventManager.emit("click", { action: "reset" }); +} + +export function setUsername(name: string): void { + globalState.username = name; +} + +// Example usage +document.addEventListener("DOMContentLoaded", () => { + eventManager.emit("load", { page: "home" }); + + // Add event listeners + document.addEventListener("click", (e) => { + eventManager.emit("click", { + target: e.target, + x: e.clientX, + y: e.clientY, + }); + }); + + document.addEventListener("keypress", (e) => { + eventManager.emit("keypress", { key: e.key, code: e.code }); + }); +}); diff --git a/manual-testing-sandbox/next-edit/next-edit-8-4-sol.ts b/manual-testing-sandbox/next-edit/next-edit-8-4-sol.ts new file mode 100644 index 000000000..a2416336e --- /dev/null +++ b/manual-testing-sandbox/next-edit/next-edit-8-4-sol.ts @@ -0,0 +1,697 @@ +// User management system refactored with SOLID principles +// Original difficulty: 4/5 + +// Types +type UserStatus = "active" | "inactive" | "suspended" | "deleted"; +type LogLevel = "debug" | "info" | "warn" | "error"; + +interface User { + id?: number; + firstName: string; + lastName: string; + email: string; + status?: UserStatus; +} + +interface Logger { + log(message: string, level?: LogLevel): void; +} + +interface Database { + query(sql: string, params?: any[]): Promise; + close(): void; +} + +interface StorageService { + getItem(key: string): string | null; + setItem(key: string, value: string): void; +} + +// Configuration interfaces +interface SystemConfig { + debugMode: boolean; + apiToken: string; +} + +// Logger implementation - Single Responsibility +class ConsoleLogger implements Logger { + constructor(private notificationService?: NotificationService) {} + + log(message: string, level: LogLevel = "info"): void { + const timestamp = new Date().toISOString(); + console.log(`[${level.toUpperCase()}] ${timestamp}: ${message}`); + + // If error, send notification + if (level === "error" && this.notificationService) { + this.notificationService.sendNotification(message); + } + } +} + +// Storage service implementation +class LocalStorageService implements StorageService { + getItem(key: string): string | null { + return localStorage.getItem(key); + } + + setItem(key: string, value: string): void { + localStorage.setItem(key, value); + } +} + +// Logger decorator to add persistent storage +class PersistentLogger implements Logger { + constructor( + private baseLogger: Logger, + private storageService: StorageService, + ) {} + + log(message: string, level: LogLevel = "info"): void { + // First use the base logger + this.baseLogger.log(message, level); + + // Then persist the log + const timestamp = new Date().toISOString(); + try { + const logs = JSON.parse( + this.storageService.getItem("system_logs") || "[]", + ); + logs.push({ timestamp, level, message }); + this.storageService.setItem("system_logs", JSON.stringify(logs)); + } catch (e) { + this.baseLogger.log("Failed to persist log", "error"); + } + } +} + +// Notification service - Single Responsibility +class NotificationService { + sendNotification(message: string): void { + console.log(`Sending notification: ${message}`); + // Simulate email sending + setTimeout(() => { + console.log("Notification sent!"); + }, 1000); + } +} + +// Database service - Single Responsibility +class DatabaseService implements Database { + private logger: Logger; + + constructor(logger: Logger) { + this.logger = logger; + this.logger.log("Database service initialized", "debug"); + } + + query(sql: string, params: any[] = []): Promise { + this.logger.log(`Executing query: ${sql}`, "debug"); + // Simulate database query + return Promise.resolve({ rows: [], success: true }); + } + + close(): void { + this.logger.log("Closing database connection", "debug"); + } +} + +// Config service - Single Responsibility +class ConfigService { + private config: SystemConfig; + private storageService: StorageService; + private logger: Logger; + + constructor(storageService: StorageService, logger: Logger) { + this.storageService = storageService; + this.logger = logger; + this.config = this.loadConfig(); + } + + private loadConfig(): SystemConfig { + try { + return JSON.parse( + this.storageService.getItem("user_system_config") || "{}", + ) as SystemConfig; + } catch (e) { + this.logger.log("Failed to load configuration", "error"); + return { debugMode: false, apiToken: "" }; + } + } + + getConfig(): SystemConfig { + return { ...this.config }; // Return a copy to prevent direct modification + } +} + +// Authentication service - Single Responsibility +class AuthService { + private db: Database; + private logger: Logger; + private storageService: StorageService; + private currentUserId: number | null = null; + private loggedInUsers: User[] = []; + + constructor(db: Database, logger: Logger, storageService: StorageService) { + this.db = db; + this.logger = logger; + this.storageService = storageService; + } + + async login(email: string, password: string): Promise { + try { + const result = await this.db.query( + "SELECT * FROM users WHERE email = ? AND password_hash = ?", + [email, this.hashPassword(password)], + ); + + if (result.rows.length === 0) { + this.logger.log(`Failed login attempt: ${email}`, "warn"); + return false; + } + + const user = result.rows[0]; + if (user.status !== "active") { + this.logger.log( + `Login attempt from inactive account: ${email}`, + "warn", + ); + return false; + } + + // Update state + this.currentUserId = user.id; + this.loggedInUsers.push(user); + this.storageService.setItem("current_user", JSON.stringify(user)); + + return true; + } catch (err: any) { + this.logger.log(`Login error: ${err.message}`, "error"); + return false; + } + } + + logout(): void { + this.currentUserId = null; + this.storageService.setItem("current_user", ""); + } + + getCurrentUserId(): number | null { + return this.currentUserId; + } + + private hashPassword(password: string): string { + // Not a real hash, just base64 encoding - in a real app, use a proper hashing library + return btoa(password); + } +} + +// User repository - Data access layer +class UserRepository { + private db: Database; + private logger: Logger; + + constructor(db: Database, logger: Logger) { + this.db = db; + this.logger = logger; + } + + async getAllActiveUsers(): Promise { + try { + const result = await this.db.query( + 'SELECT * FROM users WHERE status != "deleted"', + ); + return result.rows; + } catch (err: any) { + this.logger.log(`Failed to fetch users: ${err.message}`, "error"); + throw err; + } + } + + async createUser(userData: User): Promise { + try { + await this.db.query( + "INSERT INTO users (firstName, lastName, email, status) VALUES (?, ?, ?, ?)", + [userData.firstName, userData.lastName, userData.email, "active"], + ); + this.logger.log(`User created: ${userData.email}`, "info"); + return true; + } catch (err: any) { + this.logger.log(`Failed to create user: ${err.message}`, "error"); + throw err; + } + } + + async updateUser(userId: number, userData: User): Promise { + try { + await this.db.query( + "UPDATE users SET firstName = ?, lastName = ?, email = ? WHERE id = ?", + [userData.firstName, userData.lastName, userData.email, userId], + ); + this.logger.log(`User updated: ${userId}`, "info"); + return true; + } catch (err: any) { + this.logger.log(`Failed to update user: ${err.message}`, "error"); + throw err; + } + } + + async updateUserStatus(userId: number, status: UserStatus): Promise { + try { + await this.db.query("UPDATE users SET status = ? WHERE id = ?", [ + status, + userId, + ]); + this.logger.log(`User status updated to ${status}: ${userId}`, "info"); + return true; + } catch (err: any) { + this.logger.log(`Failed to update user status: ${err.message}`, "error"); + throw err; + } + } +} + +// UI rendering service - Single Responsibility +class UserUIService { + private userRepository: UserRepository; + private logger: Logger; + + constructor(userRepository: UserRepository, logger: Logger) { + this.userRepository = userRepository; + this.logger = logger; + } + + async renderUserList(containerId: string): Promise { + const container = document.getElementById(containerId); + if (!container) { + this.logger.log(`Container ${containerId} not found`, "error"); + return; + } + + // Clear container + container.innerHTML = ""; + + try { + // Get users from repository + const users = await this.userRepository.getAllActiveUsers(); + + // Generate HTML + let html = '
    '; + users.forEach((user) => { + // User status determines CSS class + const statusClass = this.getStatusClass(user.status || "active"); + + html += ` +
  • +
    ${user.firstName} ${user.lastName}
    +
    ${user.email}
    + +
  • + `; + }); + html += "
"; + + container.innerHTML = html; + } catch (err: any) { + this.logger.log(`Failed to render users: ${err.message}`, "error"); + container.innerHTML = + "

Failed to load users. Please try again later.

"; + } + } + + private getStatusClass(status: UserStatus): string { + switch (status) { + case "active": + return "user-active"; + case "inactive": + return "user-inactive"; + case "suspended": + return "user-suspended"; + default: + return ""; + } + } + + populateEditForm(form: HTMLFormElement, user: User): void { + if (!form) return; + + (form.elements.namedItem("firstName") as HTMLInputElement).value = + user.firstName; + (form.elements.namedItem("lastName") as HTMLInputElement).value = + user.lastName; + (form.elements.namedItem("email") as HTMLInputElement).value = user.email; + (form.elements.namedItem("userId") as HTMLInputElement).value = String( + user.id, + ); + + // Scroll to form + form.scrollIntoView({ behavior: "smooth" }); + } + + resetForm(formId: string): void { + const form = document.getElementById(formId) as HTMLFormElement; + if (form) { + form.reset(); + (form.elements.namedItem("userId") as HTMLInputElement).value = ""; + } + } +} + +// User Controller - Handles UI interactions and coordinates services +class UserController { + private userRepository: UserRepository; + private userUIService: UserUIService; + private logger: Logger; + private lastOperation: string = ""; + + constructor( + userRepository: UserRepository, + userUIService: UserUIService, + logger: Logger, + ) { + this.userRepository = userRepository; + this.userUIService = userUIService; + this.logger = logger; + } + + async createUser(userData: User): Promise { + try { + await this.userRepository.createUser(userData); + this.lastOperation = "create"; + await this.userUIService.renderUserList("user-container"); + this.userUIService.resetForm("user-form"); + alert("User created successfully!"); + } catch (err: any) { + alert(`Failed to create user: ${err.message}`); + } + } + + async updateUser(userId: number, userData: User): Promise { + try { + await this.userRepository.updateUser(userId, userData); + this.lastOperation = "update"; + await this.userUIService.renderUserList("user-container"); + this.userUIService.resetForm("user-form"); + alert("User updated successfully!"); + } catch (err: any) { + alert(`Failed to update user: ${err.message}`); + } + } + + async editUser(userId: number): Promise { + try { + const users = await this.userRepository.getAllActiveUsers(); + const user = users.find((u) => u.id === userId); + + if (!user) { + this.logger.log(`User not found: ${userId}`, "error"); + return; + } + + const form = document.getElementById("user-form") as HTMLFormElement; + this.userUIService.populateEditForm(form, user); + this.lastOperation = "edit"; + } catch (err: any) { + this.logger.log(`Failed to edit user: ${err.message}`, "error"); + } + } + + async suspendUser(userId: number): Promise { + if (!confirm("Are you sure you want to suspend this user?")) { + return; + } + + try { + await this.userRepository.updateUserStatus(userId, "suspended"); + this.lastOperation = "suspend"; + await this.userUIService.renderUserList("user-container"); + alert("User suspended successfully!"); + } catch (err: any) { + alert(`Failed to suspend user: ${err.message}`); + } + } + + async activateUser(userId: number): Promise { + try { + await this.userRepository.updateUserStatus(userId, "active"); + this.lastOperation = "activate"; + await this.userUIService.renderUserList("user-container"); + alert("User activated successfully!"); + } catch (err: any) { + alert(`Failed to activate user: ${err.message}`); + } + } + + async deleteUser(userId: number): Promise { + if (!confirm("Are you sure you want to delete this user?")) { + return; + } + + try { + await this.userRepository.updateUserStatus(userId, "deleted"); + this.lastOperation = "delete"; + await this.userUIService.renderUserList("user-container"); + alert("User deleted successfully!"); + } catch (err: any) { + alert(`Failed to delete user: ${err.message}`); + } + } + + getLastOperation(): string { + return this.lastOperation; + } +} + +// Application class - Manages services and their lifecycle +class UserManagementApp { + private logger: Logger; + private db: Database; + private userRepository: UserRepository; + private userUIService: UserUIService; + private userController: UserController; + private authService: AuthService; + private configService: ConfigService; + private storageService: StorageService; + + constructor() { + // Initialize services + this.storageService = new LocalStorageService(); + const notificationService = new NotificationService(); + const baseLogger = new ConsoleLogger(notificationService); + this.logger = new PersistentLogger(baseLogger, this.storageService); + this.configService = new ConfigService(this.storageService, this.logger); + + // Initialize database + this.db = new DatabaseService(this.logger); + + // Initialize user repository + this.userRepository = new UserRepository(this.db, this.logger); + + // Initialize UI service + this.userUIService = new UserUIService(this.userRepository, this.logger); + + // Initialize controller + this.userController = new UserController( + this.userRepository, + this.userUIService, + this.logger, + ); + + // Initialize auth service + this.authService = new AuthService( + this.db, + this.logger, + this.storageService, + ); + + // Expose controller to global scope + (window as any).userController = this.userController; + + this.setupEventListeners(); + this.setupErrorHandlers(); + } + + private setupEventListeners(): void { + window.addEventListener("load", () => { + const userForm = document.getElementById("user-form"); + if (userForm) { + userForm.addEventListener( + "submit", + this.handleUserFormSubmit.bind(this), + ); + } + + // Initialize user list + this.userUIService.renderUserList("user-container"); + }); + } + + private setupErrorHandlers(): void { + window.onerror = (msg, url, line) => { + this.logger.log(`Global error: ${msg} at ${url}:${line}`, "error"); + return false; + }; + } + + private handleUserFormSubmit(event: Event): void { + event.preventDefault(); + const form = event.target as HTMLFormElement; + + const userData: User = { + firstName: (form.elements.namedItem("firstName") as HTMLInputElement) + .value, + lastName: (form.elements.namedItem("lastName") as HTMLInputElement).value, + email: (form.elements.namedItem("email") as HTMLInputElement).value, + }; + + const userId = (form.elements.namedItem("userId") as HTMLInputElement) + .value; + + if (userId) { + this.userController.updateUser(parseInt(userId), userData); + } else { + this.userController.createUser(userData); + } + } + + async login(email: string, password: string): Promise { + const success = await this.authService.login(email, password); + if (success) { + // Redirect to dashboard + window.location.href = "/dashboard.html"; + } else { + alert("Invalid email or password"); + } + return success; + } + + cleanup(): void { + this.logger.log("Cleaning up resources", "debug"); + this.db.close(); + } +} + +// Initialize the application +const app = new UserManagementApp(); + +/* +Code Smells in the Original Code + +Violation of Single Responsibility Principle: + +UserManager was a "God class" handling database connection, UI rendering, user CRUD operations, authentication, and logging +Logger mixed logging with email notifications +User operations contained both business logic and UI manipulation + +Violation of Open/Closed Principle: + +Hardcoded dependencies that couldn't be extended without modifying code +Direct UI manipulations embedded in business logic + +High Coupling: + +Direct references to the DOM throughout the codebase +Global state used across different operations +Direct database access from UI-related methods + +Code Duplication: + +Similar code repeated in suspendUser, activateUser, and deleteUser methods +Repetitive UI update logic + +Poor Security Practices: + +API tokens exposed in console logs +Weak password handling (just base64 encoding) +Direct SQL queries vulnerable to injection + + +Global Variables and Side Effects: + +Multiple global variables (currentUserID, loggedInUsers, etc.) +Global DOM event handlers + + +Improvements Made + +Applied Single Responsibility Principle: + +Created specialized classes for each concern: + +Logger and PersistentLogger for logging +NotificationService for alerts/notifications +DatabaseService for database operations +UserRepository for user data access +UserUIService for rendering UI +UserController for handling user actions +AuthService for authentication +ConfigService for configuration management + + +Applied Open/Closed Principle: + +Used interfaces (Logger, Database, StorageService) to define contracts +Implemented dependency injection to allow for extensions without modifications +Created the decorator pattern for logging (base logger + persistent storage) + + +Applied Interface Segregation Principle: + +Created focused interfaces (e.g., Logger only handles logging) +Split large interfaces into smaller, more specific ones + + +Applied Dependency Inversion Principle: + +High-level modules depend on abstractions, not concrete implementations +Dependencies are injected through constructors +Centralized service initialization in the UserManagementApp class + + +Applied Liskov Substitution Principle: + +Classes implementing interfaces fully satisfy their contracts +Derived classes (like PersistentLogger) maintain the behavior expected from the base interface + + +Reduced Duplication: + +Consolidated common user operations in the repository +Created reusable UI methods +Extracted common logic into shared methods + + +Improved Security: + +Removed sensitive information from console logs +Added proper encapsulation of sensitive data +Note: The password hashing is still weak (commented as such) but is separated for easy replacement + + +Better State Management: + +Eliminated global state +Encapsulated state within appropriate classes +Provided proper methods for state access + + +Improved Error Handling: + +Consistent error handling approach +Proper propagation of errors +Clear error messages + + +Proper Separation of Concerns: + +UI logic separated from business logic +Data access separated from business rules +Authentication separated from user management +*/ diff --git a/manual-testing-sandbox/next-edit/next-edit-8-4.ts b/manual-testing-sandbox/next-edit/next-edit-8-4.ts new file mode 100644 index 000000000..f162ba9d4 --- /dev/null +++ b/manual-testing-sandbox/next-edit/next-edit-8-4.ts @@ -0,0 +1,409 @@ +// User management system with mixed concerns and entangled logic +// Difficulty: 4/5 + +type UserStatus = "active" | "inactive" | "suspended" | "deleted"; +type LogLevel = "debug" | "info" | "warn" | "error"; + +// Global variables +let currentUserID: number | null = null; +let loggedInUsers: any[] = []; +let systemStatus = "online"; +let DEBUG_MODE = true; + +// Main user class that handles everything +class UserManager { + private users: any[] = []; + private db: any = null; + private logger: any = null; + private apiToken: string = "secret-token-1234"; + public lastOperation: string = ""; + + constructor() { + this.initializeSystem(); + // Connect to database directly in constructor + this.connectToDatabase(); + console.log("UserManager initialized!"); + } + + // Mixed responsibility - initialization, logging, and notification + private initializeSystem() { + // Set up logging + this.logger = { + log: function (message: string, level: LogLevel = "info") { + const timestamp = new Date().toISOString(); + console.log(`[${level.toUpperCase()}] ${timestamp}: ${message}`); + + // Store logs in localStorage too + const logs = JSON.parse(localStorage.getItem("system_logs") || "[]"); + logs.push({ timestamp, level, message }); + localStorage.setItem("system_logs", JSON.stringify(logs)); + + // If error, send notification + if (level === "error") { + // Send email notification + this.sendEmailAlert(message); + } + }, + + sendEmailAlert: function (message: string) { + console.log(`Sending email alert: ${message}`); + // Simulate email sending + setTimeout(() => { + console.log("Email sent!"); + }, 1000); + }, + }; + + // Load configuration + let config; + try { + config = JSON.parse(localStorage.getItem("user_system_config") || "{}"); + DEBUG_MODE = config.debugMode || DEBUG_MODE; + this.apiToken = config.apiToken || this.apiToken; + } catch (e) { + this.logger.log("Failed to load configuration", "error"); + } + } + + // Database connection hardcoded + private connectToDatabase() { + this.logger.log("Connecting to database...", "debug"); + + // Simulate database connection + this.db = { + query: function (sql: string, params: any[] = []) { + console.log(`Executing query: ${sql}`); + console.log("Params:", params); + return Promise.resolve({ rows: [], success: true }); + }, + + close: function () { + console.log("Closing database connection"); + }, + }; + + // Log connection info to console in plain text + console.log(`Connected to database with token: ${this.apiToken}`); + + // Save connection timestamp + localStorage.setItem("last_db_connection", new Date().toISOString()); + } + + // UI generation mixed with business logic + public renderUserList(containerId: string) { + const container = document.getElementById(containerId); + if (!container) { + this.logger.log(`Container ${containerId} not found`, "error"); + return; + } + + // Clear container + container.innerHTML = ""; + + // Get users - mixing data fetching and rendering + this.db + .query('SELECT * FROM users WHERE status != "deleted"') + .then((result: any) => { + this.users = result.rows; + + // Generate HTML - UI logic mixed with business logic + let html = '
    '; + this.users.forEach((user) => { + // User status determines CSS class + let statusClass = ""; + switch (user.status) { + case "active": + statusClass = "user-active"; + break; + case "inactive": + statusClass = "user-inactive"; + break; + case "suspended": + statusClass = "user-suspended"; + break; + } + + html += ` +
  • +
    ${user.firstName} ${user.lastName}
    +
    ${user.email}
    + +
  • + `; + }); + html += "
"; + + container.innerHTML = html; + }) + .catch((err: any) => { + this.logger.log(`Failed to fetch users: ${err.message}`, "error"); + container.innerHTML = + "

Failed to load users. Please try again later.

"; + }); + } + + // No validation, directly manipulating UI and data + public createUser(userData: any) { + // Directly create user without validation + this.db + .query( + "INSERT INTO users (firstName, lastName, email, status) VALUES (?, ?, ?, ?)", + [userData.firstName, userData.lastName, userData.email, "active"], + ) + .then((result: any) => { + this.logger.log(`User created: ${userData.email}`, "info"); + + // Update UI directly here + this.renderUserList("user-container"); + + // Update global state + this.lastOperation = "create"; + + // Clear form - direct DOM manipulation + document.getElementById("user-form")?.reset(); + + // Show success message + alert("User created successfully!"); + }) + .catch((err: any) => { + this.logger.log(`Failed to create user: ${err.message}`, "error"); + alert("Failed to create user! " + err.message); + }); + } + + // Logic duplicated for similar operations + public editUser(userId: number) { + // Directly edit UI elements based on user ID + const userElement = document.querySelector(`li[data-id="${userId}"]`); + if (!userElement) { + this.logger.log(`User element not found: ${userId}`, "error"); + return; + } + + // Find user data + const user = this.users.find((u) => u.id === userId); + if (!user) { + this.logger.log(`User not found: ${userId}`, "error"); + return; + } + + // Populate form - direct DOM manipulation + const form = document.getElementById("user-form") as HTMLFormElement; + if (form) { + (form.elements.namedItem("firstName") as HTMLInputElement).value = + user.firstName; + (form.elements.namedItem("lastName") as HTMLInputElement).value = + user.lastName; + (form.elements.namedItem("email") as HTMLInputElement).value = user.email; + (form.elements.namedItem("userId") as HTMLInputElement).value = + String(userId); + + // Scroll to form + form.scrollIntoView({ behavior: "smooth" }); + } + + // Update global state + currentUserID = userId; + this.lastOperation = "edit"; + } + + // Logic duplicated, similar to deleteUser + public suspendUser(userId: number) { + if (!confirm("Are you sure you want to suspend this user?")) { + return; + } + + this.db + .query("UPDATE users SET status = ? WHERE id = ?", ["suspended", userId]) + .then((result: any) => { + this.logger.log(`User suspended: ${userId}`, "info"); + + // Update UI directly + this.renderUserList("user-container"); + + // Update global state + this.lastOperation = "suspend"; + + // Show success message + alert("User suspended successfully!"); + }) + .catch((err: any) => { + this.logger.log(`Failed to suspend user: ${err.message}`, "error"); + alert("Failed to suspend user! " + err.message); + }); + } + + // Nearly identical to suspendUser + public activateUser(userId: number) { + this.db + .query("UPDATE users SET status = ? WHERE id = ?", ["active", userId]) + .then((result: any) => { + this.logger.log(`User activated: ${userId}`, "info"); + + // Update UI directly + this.renderUserList("user-container"); + + // Update global state + this.lastOperation = "activate"; + + // Show success message + alert("User activated successfully!"); + }) + .catch((err: any) => { + this.logger.log(`Failed to activate user: ${err.message}`, "error"); + alert("Failed to activate user! " + err.message); + }); + } + + // Logic duplicated again + public deleteUser(userId: number) { + if (!confirm("Are you sure you want to delete this user?")) { + return; + } + + // Actually just updating status to 'deleted' + this.db + .query("UPDATE users SET status = ? WHERE id = ?", ["deleted", userId]) + .then((result: any) => { + this.logger.log(`User deleted: ${userId}`, "info"); + + // Update UI directly + this.renderUserList("user-container"); + + // Update global state + this.lastOperation = "delete"; + + // Show success message + alert("User deleted successfully!"); + }) + .catch((err: any) => { + this.logger.log(`Failed to delete user: ${err.message}`, "error"); + alert("Failed to delete user! " + err.message); + }); + } + + // Authentication mixed with user management + public login(email: string, password: string) { + // Directly query with credentials + this.db + .query("SELECT * FROM users WHERE email = ? AND password_hash = ?", [ + email, + this.hashPassword(password), + ]) + .then((result: any) => { + if (result.rows.length === 0) { + this.logger.log(`Failed login attempt: ${email}`, "warn"); + alert("Invalid email or password"); + return; + } + + const user = result.rows[0]; + if (user.status !== "active") { + this.logger.log( + `Login attempt from inactive account: ${email}`, + "warn", + ); + alert("Your account is not active"); + return; + } + + // Update global state + currentUserID = user.id; + loggedInUsers.push(user); + this.lastOperation = "login"; + + // Store in localStorage + localStorage.setItem("current_user", JSON.stringify(user)); + + // Redirect to dashboard + window.location.href = "/dashboard.html"; + }) + .catch((err: any) => { + this.logger.log(`Login error: ${err.message}`, "error"); + alert("Login failed! " + err.message); + }); + } + + // Utility function with security implications + private hashPassword(password: string): string { + // Not a real hash, just base64 encoding + return btoa(password); + } + + // Cleanup that's never called + public cleanup() { + this.logger.log("Cleaning up resources", "debug"); + this.db.close(); + this.users = []; + currentUserID = null; + } +} + +// Instantiate globally +const userManager = new UserManager(); + +// Event handlers directly in global scope +function handleUserFormSubmit(event: Event) { + event.preventDefault(); + const form = event.target as HTMLFormElement; + + const userData = { + firstName: (form.elements.namedItem("firstName") as HTMLInputElement).value, + lastName: (form.elements.namedItem("lastName") as HTMLInputElement).value, + email: (form.elements.namedItem("email") as HTMLInputElement).value, + }; + + const userId = (form.elements.namedItem("userId") as HTMLInputElement).value; + + if (userId) { + // Should call an update method, but directly calls the database + userManager.db + .query( + "UPDATE users SET firstName = ?, lastName = ?, email = ? WHERE id = ?", + [userData.firstName, userData.lastName, userData.email, userId], + ) + .then(() => { + alert("User updated successfully!"); + userManager.renderUserList("user-container"); + form.reset(); + (form.elements.namedItem("userId") as HTMLInputElement).value = ""; + }) + .catch((err: any) => { + alert("Failed to update user: " + err.message); + }); + } else { + userManager.createUser(userData); + } +} + +// Global initialization +window.onload = function () { + console.log("Window loaded!"); + + // Set up event listeners + const userForm = document.getElementById("user-form"); + if (userForm) { + userForm.addEventListener("submit", handleUserFormSubmit); + } + + // Initialize user list + userManager.renderUserList("user-container"); + + // Set up some global error handlers + window.onerror = function (msg, url, line) { + userManager.logger.log(`Global error: ${msg} at ${url}:${line}`, "error"); + return false; + }; +}; + +// Global exports +(window as any).userManager = userManager; +(window as any).handleUserFormSubmit = handleUserFormSubmit; diff --git a/manual-testing-sandbox/next-edit/next-edit-9-5-sol.ts b/manual-testing-sandbox/next-edit/next-edit-9-5-sol.ts new file mode 100644 index 000000000..a81e7191a --- /dev/null +++ b/manual-testing-sandbox/next-edit/next-edit-9-5-sol.ts @@ -0,0 +1,654 @@ +// Clean implementation of e-commerce product management system +// Following SOLID principles + +// Types and Interfaces +type ProductStatus = + | "active" + | "inactive" + | "discontinued" + | "out_of_stock" + | "backorder"; +type UserRole = "admin" | "manager" | "staff" | "customer"; + +interface Product { + id: string; + name: string; + price: number; + description: string; + image: string; + category: string; + status: ProductStatus; + created: Date; + createdBy: string; + stock: number; + ratings: any[]; + tags: string[]; + lastModified: Date; + lastModifiedBy?: string; +} + +interface User { + id: string; + username: string; + role: UserRole; +} + +interface CartItem { + productId: string; + quantity: number; + price: number; + name: string; + addedAt: Date; +} + +interface Notification { + type: string; + message: string; + timestamp: Date; +} + +interface LogEntry { + timestamp: string; + action: string; + data: any; + user: string; +} + +interface SearchFilters { + category?: string; + minPrice?: number; + maxPrice?: number; + status?: ProductStatus; +} + +// Database abstraction - Single Responsibility for data persistence +class Database { + private products: Map = new Map(); + private users: Map = new Map(); + private cart: Map = new Map(); + private orders: any[] = []; + private logs: LogEntry[] = []; + private sessions: Map = new Map(); + private config = { taxRate: 0.08, discountThreshold: 1000 }; + + // Product repository methods + getProduct(id: string): Product | undefined { + return this.products.get(id); + } + + saveProduct(product: Product): void { + this.products.set(product.id, product); + } + + removeProduct(id: string): boolean { + return this.products.delete(id); + } + + getAllProducts(): Product[] { + return Array.from(this.products.values()); + } + + // Cart repository methods + getCart(userId: string): CartItem[] { + return this.cart.get(userId) || []; + } + + saveCart(userId: string, cart: CartItem[]): void { + this.cart.set(userId, cart); + } + + // Logging method + addLog(logEntry: LogEntry): void { + this.logs.push(logEntry); + } +} + +// Authentication service - Single Responsibility for user management +class AuthService { + private currentUser: User | null = null; + + constructor(private database: Database) {} + + getCurrentUser(): User | null { + return this.currentUser; + } + + setCurrentUser(user: User): void { + this.currentUser = user; + } + + logout(): void { + this.currentUser = null; + } + + hasPermission(allowedRoles: UserRole[]): boolean { + if (!this.currentUser) return false; + return allowedRoles.includes(this.currentUser.role); + } +} + +// Utility service - Single Responsibility for common functions +class UtilityService { + generateId(prefix: string): string { + return `${prefix}_${Math.random().toString(36).substring(2, 9)}`; + } +} + +// Logger service - Single Responsibility for logging +class LoggingService { + constructor( + private database: Database, + private authService: AuthService, + ) {} + + log(action: string, data: any): void { + const timestamp = new Date().toISOString(); + const logEntry: LogEntry = { + timestamp, + action, + data, + user: this.authService.getCurrentUser()?.username || "system", + }; + + this.database.addLog(logEntry); + console.log(`[${timestamp}] ${action}:`, data); + } +} + +// Notification service - Single Responsibility for notifications +class NotificationService { + private notifications: Notification[] = []; + + addNotification(type: string, message: string): void { + this.notifications.push({ + type, + message, + timestamp: new Date(), + }); + } + + getNotifications(): Notification[] { + return [...this.notifications]; + } +} + +// Email service - Single Responsibility for email communication +class EmailService { + sendEmailToSubscribers( + productName: string, + subject: string, + body: string, + ): void { + console.log(`Sending email about ${productName} to subscribers`); + // Actual email sending logic would go here + } +} + +// Product validation - Single Responsibility for product validation +class ProductValidator { + validate(name: string, price: number): boolean { + return name !== "" && price > 0; + } +} + +// Auth middleware interface - Open/Closed Principle +interface AuthorizationMiddleware { + checkAuthorization(operation: string): boolean; +} + +// Product authorization - Single Responsibility for product auth +class ProductAuthorizationMiddleware implements AuthorizationMiddleware { + constructor(private authService: AuthService) {} + + checkAuthorization(operation: string): boolean { + const currentUser = this.authService.getCurrentUser(); + if (!currentUser) return false; + + switch (operation) { + case "create": + case "update": + return this.authService.hasPermission(["admin", "manager"]); + case "delete": + return this.authService.hasPermission(["admin"]); + case "view": + return true; + default: + return false; + } + } +} + +// Product service - Core business logic with proper separation of concerns +class ProductService { + constructor( + private database: Database, + private utilityService: UtilityService, + private loggingService: LoggingService, + private notificationService: NotificationService, + private emailService: EmailService, + private validator: ProductValidator, + private authMiddleware: AuthorizationMiddleware, + ) {} + + createProduct( + name: string, + price: number, + description: string, + image: string, + category: string, + initialStock: number = 100, + ): string { + // Authorization check + if (!this.authMiddleware.checkAuthorization("create")) { + throw new Error("Unauthorized access"); + } + + // Validation + if (!this.validator.validate(name, price)) { + throw new Error("Invalid product data"); + } + + const currentUser = this.database.getUsers()[0]; // This is a placeholder - we'd use proper auth in a real app + const id = this.utilityService.generateId("prod"); + const tags = category.split(",").map((t) => t.trim()); + + // Create product object + const product: Product = { + id, + name, + price, + description, + image, + category, + status: "active" as ProductStatus, + created: new Date(), + createdBy: currentUser.id, + stock: initialStock, + ratings: [], + tags, + lastModified: new Date(), + }; + + // Save to database + this.database.saveProduct(product); + + // Logging + this.loggingService.log("product_added", { id, name, price }); + + // Notification + this.notificationService.addNotification( + "product_added", + `New product added: ${name}`, + ); + + return id; + } + + updateProduct(id: string, data: Partial): Product { + // Authorization check + if (!this.authMiddleware.checkAuthorization("update")) { + throw new Error("Unauthorized access"); + } + + const product = this.database.getProduct(id); + if (!product) { + throw new Error("Product not found"); + } + + // Create updated product - preventing modification of protected fields + const updatedProduct = { ...product }; + + Object.keys(data).forEach((key) => { + if (key !== "id" && key !== "created" && key !== "createdBy") { + updatedProduct[key as keyof Product] = data[ + key as keyof Product + ] as any; + } + }); + + const currentUser = this.database.getUsers()[0]; // Placeholder + updatedProduct.lastModified = new Date(); + updatedProduct.lastModifiedBy = currentUser.id; + + // Save to database + this.database.saveProduct(updatedProduct); + + // Logging + this.loggingService.log("product_updated", { id, changes: data }); + + // Notification + this.notificationService.addNotification( + "product_updated", + `Product updated: ${updatedProduct.name}`, + ); + + // Handle special status changes + if (data.status === "discontinued") { + this.emailService.sendEmailToSubscribers( + updatedProduct.name, + "Product Discontinued", + `The product ${updatedProduct.name} has been discontinued.`, + ); + } + + return updatedProduct; + } + + deleteProduct(id: string): boolean { + // Authorization check + if (!this.authMiddleware.checkAuthorization("delete")) { + throw new Error("Unauthorized access"); + } + + const product = this.database.getProduct(id); + if (!product) { + throw new Error("Product not found"); + } + + // Business rule validation + if (product.status === "active" && product.stock > 0) { + throw new Error("Cannot delete active product with stock"); + } + + // Delete from database + const result = this.database.removeProduct(id); + + // Logging + this.loggingService.log("product_deleted", { id, name: product.name }); + + // Notification + this.notificationService.addNotification( + "product_deleted", + `Product deleted: ${product.name}`, + ); + + return result; + } + + searchProducts(query: string, filters: SearchFilters = {}): Product[] { + const products = this.database.getAllProducts(); + const results = products.filter((product) => { + // Match text search + const matches = + product.name.toLowerCase().includes(query.toLowerCase()) || + product.description.toLowerCase().includes(query.toLowerCase()); + + if (!matches) return false; + + // Apply filters + if (filters.category && product.category !== filters.category) { + return false; + } + + if (filters.minPrice && product.price < filters.minPrice) { + return false; + } + + if (filters.maxPrice && product.price > filters.maxPrice) { + return false; + } + + if (filters.status && product.status !== filters.status) { + return false; + } + + return true; + }); + + // Log search results + this.loggingService.log("product_search", { + query, + filters, + resultCount: results.length, + }); + + return results; + } +} + +// Cart service - Single Responsibility for shopping cart functionality +class CartService { + constructor( + private database: Database, + private authService: AuthService, + private loggingService: LoggingService, + ) {} + + addToCart(productId: string, quantity: number = 1): CartItem[] { + const currentUser = this.authService.getCurrentUser(); + if (!currentUser) { + throw new Error("Must be logged in to add to cart"); + } + + const product = this.database.getProduct(productId); + if (!product) { + throw new Error("Product not found"); + } + + if (product.status !== "active") { + throw new Error("Product is not available"); + } + + if (product.stock < quantity) { + throw new Error("Not enough stock"); + } + + // Get current cart + const cart = this.database.getCart(currentUser.id); + + // Update or add item + const existingItemIndex = cart.findIndex( + (item) => item.productId === productId, + ); + + if (existingItemIndex >= 0) { + cart[existingItemIndex].quantity += quantity; + } else { + cart.push({ + productId, + quantity, + price: product.price, + name: product.name, + addedAt: new Date(), + }); + } + + // Update product stock + product.stock -= quantity; + this.database.saveProduct(product); + + // Save cart + this.database.saveCart(currentUser.id, cart); + + // Log action + this.loggingService.log("cart_add", { + productId, + quantity, + userId: currentUser.id, + }); + + return cart; + } +} + +// Service Factory - Creates and wires up the services +class ServiceFactory { + static createProductService(): ProductService { + const database = new Database(); + const authService = new AuthService(database); + const utilityService = new UtilityService(); + const loggingService = new LoggingService(database, authService); + const notificationService = new NotificationService(); + const emailService = new EmailService(); + const productValidator = new ProductValidator(); + const authMiddleware = new ProductAuthorizationMiddleware(authService); + + return new ProductService( + database, + utilityService, + loggingService, + notificationService, + emailService, + productValidator, + authMiddleware, + ); + } + + static createCartService(): CartService { + const database = new Database(); + const authService = new AuthService(database); + const loggingService = new LoggingService(database, authService); + + return new CartService(database, authService, loggingService); + } +} + +// Example usage: +/* +const productService = ServiceFactory.createProductService(); +const cartService = ServiceFactory.createCartService(); + +// Create a product +const productId = productService.createProduct( + 'Gaming Laptop', + 1299.99, + 'High performance gaming laptop', + 'laptop.jpg', + 'Electronics,Computers', + 100 +); + +// Add to cart +cartService.addToCart(productId, 2); +*/ + +/* +Original Code Smells: + +Violation of Single Responsibility Principle (SRP) + +ProductManager class handles product management, cart operations, email sending, UI updates, and analytics +Database operations, validation, logging, and notifications are all mixed together + + +Violation of Open/Closed Principle (OCP) + +Code is not structured to be easily extended without modification +Hard-coded business rules and functionality + + +Poor Encapsulation + +Global variables (DATABASE, CURRENT_USER, NOTIFICATIONS) +Direct manipulation of shared state + + +Tight Coupling + +Business logic directly depends on UI elements (document, window) +Authentication checks embedded in business methods + + +Singleton Anti-pattern Misuse + +Incorrect implementation of the Singleton pattern + + +Lack of Proper Interfaces and Abstraction + +No clear contracts between components +No separation between data access and business logic + + +Code Duplication + +Authentication checks duplicated across methods +Notification and logging logic repeated + + +Poor Error Handling + +Inconsistent error handling +Mixed validation with business operations + + +UI Manipulation in Business Logic + +Direct DOM manipulation in product methods + + +Hard-coded Values + +Default stock values +Business rules embedded in methods + + +Improvements Made: + +Applied Single Responsibility Principle (SRP) + +Created separate classes for distinct responsibilities: +Database for data storage +AuthService for authentication +LoggingService for logging +NotificationService for notifications +EmailService for email communication +ProductService for product business logic +CartService for cart operations +ProductValidator for validation +UtilityService for utility functions + + +Applied Open/Closed Principle (OCP) + +Used interfaces for extensibility (e.g., AuthorizationMiddleware) +Created classes that can be extended without modifying existing code + + +Applied Interface Segregation Principle (ISP) + +Created focused interfaces for different functionalities +Ensured clients only depend on methods they use + + +Applied Dependency Inversion Principle (DIP) + +High-level modules depend on abstractions +Used dependency injection to provide implementations + + +Proper Encapsulation + +Removed global variables +Encapsulated state within appropriate classes + + +Reduced Coupling + +Removed direct UI manipulation from business logic +Used dependency injection for loosely coupled components + + +Implemented Factory Pattern + +Added ServiceFactory to create and wire up services +Simplified client code by hiding implementation details + + +Added Type Safety + +Created proper interfaces for data structures +Used TypeScript types effectively + + +Improved Error Handling + +Consistent error checking across methods +Validation separated from business logic + + +Removed Code Duplication + +Centralized authentication checks +Reused code through proper abstraction +*/ diff --git a/manual-testing-sandbox/next-edit/next-edit-9-5.ts b/manual-testing-sandbox/next-edit/next-edit-9-5.ts new file mode 100644 index 000000000..9520b2c8e --- /dev/null +++ b/manual-testing-sandbox/next-edit/next-edit-9-5.ts @@ -0,0 +1,302 @@ +// A messy e-commerce product management system with tangled responsibilities +// Difficulty: 5/5 + +type ProductStatus = + | "active" + | "inactive" + | "discontinued" + | "out_of_stock" + | "backorder"; +type UserRole = "admin" | "manager" | "staff" | "customer"; +let DATABASE: any = { + products: new Map(), + users: new Map(), + cart: new Map(), + orders: [], + logs: [], + sessions: new Map(), + config: { taxRate: 0.08, discountThreshold: 1000 }, +}; +let CURRENT_USER: any = null; +let NOTIFICATIONS: any[] = []; + +// Global function to generate IDs (mixes concerns and not encapsulated) +function generateId(prefix: string) { + return `${prefix}_${Math.random().toString(36).substring(2, 9)}`; +} + +// Global function for logging (mixed with business logic) +function log(action: string, data: any) { + const timestamp = new Date().toISOString(); + DATABASE.logs.push({ + timestamp, + action, + data, + user: CURRENT_USER?.username || "system", + }); + console.log(`[${timestamp}] ${action}:`, data); +} + +class ProductManager { + // This class does way too much - violates SRP + static instance: ProductManager; + private constructor() {} + + // Singleton pattern used incorrectly + static getInstance() { + if (!ProductManager.instance) { + ProductManager.instance = new ProductManager(); + } + return ProductManager.instance; + } + + addProduct( + name: string, + price: number, + desc: string, + img: string, + category: string, + ) { + // Validation mixed with business logic + if (!name || price <= 0) { + throw new Error("Invalid product data"); + } + + // Authentication check shouldn't be here + if ( + !CURRENT_USER || + (CURRENT_USER.role !== "admin" && CURRENT_USER.role !== "manager") + ) { + throw new Error("Unauthorized access"); + } + + const id = generateId("prod"); + + // Direct database manipulation and notification logic mixed together + DATABASE.products.set(id, { + id, + name, + price, + description: desc, + image: img, + category, + status: "active", + created: new Date(), + createdBy: CURRENT_USER.id, + stock: 100, // Default hardcoded + ratings: [], + tags: category.split(",").map((t: string) => t.trim()), + lastModified: new Date(), + }); + + // Notification logic should be separated + NOTIFICATIONS.push({ + type: "product_added", + message: `New product added: ${name}`, + timestamp: new Date(), + }); + + // Logging should be a cross-cutting concern + log("product_added", { id, name, price }); + + // UI manipulation mixed with business logic + if (document) { + const productList = document.getElementById("product-list"); + if (productList) { + const productEl = document.createElement("div"); + productEl.innerHTML = `
${name} - $${price}
`; + productList.appendChild(productEl); + } + } + + // Analytics tracking mixed in with product creation + if (window) { + try { + (window as any).ga("send", "event", "Products", "Create", name); + } catch (e) { + console.error("Analytics error", e); + } + } + + return id; + } + + updateProduct(id: string, data: any) { + if (!DATABASE.products.has(id)) { + throw new Error("Product not found"); + } + + // Authentication check duplicated + if ( + !CURRENT_USER || + (CURRENT_USER.role !== "admin" && CURRENT_USER.role !== "manager") + ) { + throw new Error("Unauthorized access"); + } + + const product = DATABASE.products.get(id); + + // Updating with direct object manipulation + Object.keys(data).forEach((key) => { + if (key !== "id" && key !== "created" && key !== "createdBy") { + product[key] = data[key]; + } + }); + + product.lastModified = new Date(); + product.lastModifiedBy = CURRENT_USER.id; + + DATABASE.products.set(id, product); + + // More mixed responsibilities + log("product_updated", { id, changes: data }); + + // Duplicated notification logic + NOTIFICATIONS.push({ + type: "product_updated", + message: `Product updated: ${product.name}`, + timestamp: new Date(), + }); + + // Email notification logic mixed in + if (product.status === "discontinued") { + this.sendEmailToSubscribers( + product.id, + "Product Discontinued", + `The product ${product.name} has been discontinued.`, + ); + } + + return product; + } + + deleteProduct(id: string) { + // More authentication mixed in business logic + if (!CURRENT_USER || CURRENT_USER.role !== "admin") { + throw new Error("Only admins can delete products"); + } + + if (!DATABASE.products.has(id)) { + throw new Error("Product not found"); + } + + const product = DATABASE.products.get(id); + + // Business rules mixed with deletion logic + if (product.status === "active" && product.stock > 0) { + throw new Error("Cannot delete active product with stock"); + } + + // More mixed concerns + log("product_deleted", { id, name: product.name }); + NOTIFICATIONS.push({ + type: "product_deleted", + message: `Product deleted: ${product.name}`, + timestamp: new Date(), + }); + + DATABASE.products.delete(id); + + // Cache clearing mixed with business logic + if (window && (window as any).cache) { + (window as any).cache.invalidate("products"); + } + + return true; + } + + // Email functionality mixed in the product manager + sendEmailToSubscribers(productId: string, subject: string, body: string) { + const product = DATABASE.products.get(productId); + if (!product) return; + + // Email sending logic mixed with product management + console.log(`Sending email about ${product.name} to subscribers`); + // Imagine API call to email service here + } + + // Search functionality mixed in the same class + searchProducts(query: string, filters: any = {}) { + let results: any[] = []; + + DATABASE.products.forEach((product: any) => { + let matches = + product.name.toLowerCase().includes(query.toLowerCase()) || + product.description.toLowerCase().includes(query.toLowerCase()); + + if (!matches) return; + + // Filter logic mixed in search + if (filters.category && product.category !== filters.category) { + return; + } + + if (filters.minPrice && product.price < filters.minPrice) { + return; + } + + if (filters.maxPrice && product.price > filters.maxPrice) { + return; + } + + if (filters.status && product.status !== filters.status) { + return; + } + + results.push({ ...product }); + }); + + // Logging mixed with search functionality + log("product_search", { query, filters, resultCount: results.length }); + + return results; + } + + // Cart functionality shouldn't be in product manager + addToCart(productId: string, quantity: number = 1) { + if (!CURRENT_USER) { + throw new Error("Must be logged in to add to cart"); + } + + const product = DATABASE.products.get(productId); + if (!product) { + throw new Error("Product not found"); + } + + if (product.status !== "active") { + throw new Error("Product is not available"); + } + + if (product.stock < quantity) { + throw new Error("Not enough stock"); + } + + let cart = DATABASE.cart.get(CURRENT_USER.id) || []; + const existingItem = cart.find((item: any) => item.productId === productId); + + if (existingItem) { + existingItem.quantity += quantity; + } else { + cart.push({ + productId, + quantity, + price: product.price, + name: product.name, + addedAt: new Date(), + }); + } + + DATABASE.cart.set(CURRENT_USER.id, cart); + product.stock -= quantity; + DATABASE.products.set(productId, product); + + log("cart_add", { productId, quantity, userId: CURRENT_USER.id }); + + return cart; + } +} + +// Usage would be something like: +// const pm = ProductManager.getInstance(); +// pm.addProduct('Gaming Laptop', 1299.99, 'High performance gaming laptop', 'laptop.jpg', 'Electronics,Computers'); +// pm.addToCart('prod_1abc123', 2); diff --git a/manual-testing-sandbox/next-edit/next-edit-test-1.ts b/manual-testing-sandbox/next-edit/next-edit-test-1.ts new file mode 100644 index 000000000..7de9bf338 --- /dev/null +++ b/manual-testing-sandbox/next-edit/next-edit-test-1.ts @@ -0,0 +1,3 @@ +function foo(a: string, b: string, c: string) { + return `${a} ${b.length} ${c.length}`; +} diff --git a/manual-testing-sandbox/next-edit/next-edit-test-2.ts b/manual-testing-sandbox/next-edit/next-edit-test-2.ts new file mode 100644 index 000000000..795ffacd9 --- /dev/null +++ b/manual-testing-sandbox/next-edit/next-edit-test-2.ts @@ -0,0 +1,91 @@ +type DocumentNode = ParagraphNode | ListNode; + +abstract class Node { + abstract render(): string; +} + +class ParagraphNode extends Node { + constructor(public text: string) { + super(); + } + + render(): string { + return `

${this.text}

`; + } +} + +class ListNode extends Node { + constructor(public items: string[]) { + super(); + } + + render(): string { + return `
    ${this.items.map((item) => `
  • ${item}
  • `).join("")}
`; + } +} + +interface Command { + execute(): void; + undo(): void; +} + +interface Observer { + update(doc: DocumentEditor): void; +} + +class DocumentEditor { + private nodes: DocumentNode[] = []; + private undoStack: Command[] = []; + private redoStack: Command[] = []; + private observers: Observer[] = []; + + addNode(node: DocumentNode) { + this.nodes.push(node); + this.notify(); + } + + executeCommand(command: Command) { + command.execute(); + this.undoStack.push(command); + this.redoStack = []; + this.notify(); + } + + undo() { + const cmd = this.undoStack.pop(); + if (cmd) { + cmd.undo(); + this.redoStack.push(cmd); + this.notify(); + } + } + + redo() { + const cmd = this.redoStack.pop(); + if (cmd) { + cmd.execute(); + this.undoStack.push(cmd); + this.notify(); + } + } + + getContent(): string { + return this.nodes.map((n) => n.render()).join("\n"); + } + + getNodes(): DocumentNode[] { + return this.nodes; + } + + setNodes(nodes: DocumentNode[]) { + this.nodes = nodes; + } + + subscribe(observer: Observer) { + this.observers.push(observer); + } + + private notify() { + this.observers.forEach((o) => o.update(this)); + } +} diff --git a/packages/config-yaml/CHANGELOG.md b/packages/config-yaml/CHANGELOG.md new file mode 100644 index 000000000..8c4aa034b --- /dev/null +++ b/packages/config-yaml/CHANGELOG.md @@ -0,0 +1,2142 @@ +## [1.0.95](https://github.com/continuedev/continue/compare/@continuedev/config-yaml@1.0.94...@continuedev/config-yaml@1.0.95) (2025-06-22) + + +### Bug Fixes + +* avoid minor ([7186c04](https://github.com/continuedev/continue/commit/7186c04418abd61f151d25bf03733f2f5d371b48)) + +# 1.0.0 (2025-06-22) + + +### Bug Fixes + +* :adhesive_bandage: allow GGML to use api.openai.com ([db19f6b](https://github.com/continuedev/continue/commit/db19f6bc98285d8ea45b4db16f619dffbec7c3db)) +* :adhesive_bandage: skip indexing really large files ([b773fe6](https://github.com/continuedev/continue/commit/b773fe6d7a0b489a658139ea5fc958abd46a20b2)) +* :ambulance: catch error from meilisearch client.health ([00775f5](https://github.com/continuedev/continue/commit/00775f54e6c3fa8044a996ea1a7cf0f2205735dd)) +* :ambulance: class_name hotfix ([83b0417](https://github.com/continuedev/continue/commit/83b0417f6c8c579d0ea5a0f689eceb822fe7a04d)) +* :ambulance: fix import of run from __main__ ([ebfe428](https://github.com/continuedev/continue/commit/ebfe428b7f70de66bc5692cca1db7cd10ef4b997)) +* :ambulance: hotfix and package.json seo experiment ([42024ef](https://github.com/continuedev/continue/commit/42024effba73673b4080c25806c21293b5daad3e)) +* :ambulance: load global ~/.continue/assistants ([4b55cfb](https://github.com/continuedev/continue/commit/4b55cfb2e8ad4803855020111d0cff6a38ad79d5)) +* :ambulance: logging to file causing problems with starting server ([8b95ef7](https://github.com/continuedev/continue/commit/8b95ef7de258de8498b328d9e6107a95f57f8d2c)) +* :ambulance: specify packagePath for vsix ([512ccfd](https://github.com/continuedev/continue/commit/512ccfda670abb6132e9cd720280a472e53e3326)) +* :arrow_up: upgrade openai python package ([19cbe2c](https://github.com/continuedev/continue/commit/19cbe2cebae8e2155b6b4375c6a96a3b25e87615)) +* :art: many small improvements ([28f5d7b](https://github.com/continuedev/continue/commit/28f5d7bedab05a8b061e4e7ee9055a5403786bbc)) +* :bookmark: update extension version ([05b9642](https://github.com/continuedev/continue/commit/05b96420bda2da0c725cacc8141d87449eaf9e9c)) +* :bookmark: update version ([afae160](https://github.com/continuedev/continue/commit/afae1600255714d0a4f18f892d3e7b5e1d921962)) +* :bookmark: update version ([9aee2cc](https://github.com/continuedev/continue/commit/9aee2cc44c461ce0e001185af85352e78522bab5)) +* :bookmark: update version to try again ([1905f31](https://github.com/continuedev/continue/commit/1905f319470c02ee414498b9101b6e64b4b15d65)) +* :bookmark: v3 -> v4 of upload-artifact ([d24862a](https://github.com/continuedev/continue/commit/d24862a6fd22e4eac1b2ca27ce7bf029f0d8fa4a)) +* :bug: a few minor fixes ([c918bb3](https://github.com/continuedev/continue/commit/c918bb3af5ec4a4a409eb0a3add27951b00c3c59)) +* :bug: a handful of bug fixes ([e1325c0](https://github.com/continuedev/continue/commit/e1325c0153becb95b454810d9461efd7d3624a6a)) +* :bug: a number of small fixes + disable summaries ([a975560](https://github.com/continuedev/continue/commit/a9755603c3a2c0b3afe809f77a63824c77c6419e)) +* :bug: access highlighted_code through context_manager ([1afb37b](https://github.com/continuedev/continue/commit/1afb37b5bb901d95c493039591b9243cd2cdd6f7)) +* :bug: add data file for ca_bundle ([b82d83f](https://github.com/continuedev/continue/commit/b82d83f79389897ed5f05eb9b5e8daf9cf64ee6f)) +* :bug: Add requestOptions to YAML config for mcp ([81c20c1](https://github.com/continuedev/continue/commit/81c20c11dbbce2eccefd00364c5b74b298b2f24f)) +* :bug: add server/exe to .vscodeignore insteading of manually removing ([e8ebff1](https://github.com/continuedev/continue/commit/e8ebff1e6b07dfaafff81ee7013bb019cbfe2075)) +* :bug: additional fixes to ssh /edit ([4428acd](https://github.com/continuedev/continue/commit/4428acdd6f372c3724a908fafb1c793e0eae4096)) +* :bug: allow end/home keys to work ([615d30e](https://github.com/continuedev/continue/commit/615d30e3dce92a9993b0e93b044faadf228529b1)) +* :bug: allow None for timeout ([ff3de11](https://github.com/continuedev/continue/commit/ff3de1184737f1124090d384b877a30550b60869)) +* :bug: another hotfix - don't destructure selectors ([534304a](https://github.com/continuedev/continue/commit/534304a2a4f9abfc221a961f279d1b43d14b6d33)) +* :bug: another windows fix in typegen.js ([f38c8fb](https://github.com/continuedev/continue/commit/f38c8fb8b33a705ed4eb4d2e0974060ebb88afd3)) +* :bug: async with Client (meilisearch) ([9a0cd64](https://github.com/continuedev/continue/commit/9a0cd644dcb5ff46817a6ea686a6de0fb764c960)) +* :bug: attempting to fix mkdir ([c1a8097](https://github.com/continuedev/continue/commit/c1a8097f0a7f3cddb0aebac26e6197ffef186972)) +* :bug: automigrate between short/long imports ([eecc2b5](https://github.com/continuedev/continue/commit/eecc2b57c5c5a144abfc0623102438e902c4aeba)) +* :bug: avoid removing disallowed file windows ([19a3266](https://github.com/continuedev/continue/commit/19a3266b6f14186bd0839fac8b2a04b5a29f32e7)) +* :bug: bug when highlighting code prior to context_manager creation ([74a52c8](https://github.com/continuedev/continue/commit/74a52c8399b3ccf2d2100b088b79e65c6ca6ad7e)) +* :bug: bug where old server doesn't get updated ([bb776a0](https://github.com/continuedev/continue/commit/bb776a03df3e6a39a1726b781ea33c2ccebd5343)) +* :bug: catch error when workspace uri isn't defined ([fc9eb30](https://github.com/continuedev/continue/commit/fc9eb3051fd5a7c9cad57b5d6cd93374bd8210fb)) +* :bug: change for/backwardslash decoding scheme ([a3a05fe](https://github.com/continuedev/continue/commit/a3a05fee312ad7c04d2abb0e186da55c7d061462)) +* :bug: chmod for linux as well as mac ([089def0](https://github.com/continuedev/continue/commit/089def08c58120f78df78c10027639802ad8f77d)) +* :bug: clear all other selector destrucuring ([145642f](https://github.com/continuedev/continue/commit/145642f1eaf01d5809dabd79e7f64f234124683e)) +* :bug: Codebase Indexing was not starting on load ([e391d58](https://github.com/continuedev/continue/commit/e391d583041c54edb3fa0836eb9186c61e6b063d)) +* :bug: compatibility with python 3.8 ([275ad6f](https://github.com/continuedev/continue/commit/275ad6f72dafdfacffd9c9b5cc4847135a30f425)) +* :bug: convert to correct path sep in wsl URIs ([1b2341a](https://github.com/continuedev/continue/commit/1b2341a0113fadf8c8d23097ef1041d3e3088e84)) +* :bug: correct path sep for ssh-remote files ([b9bd8c1](https://github.com/continuedev/continue/commit/b9bd8c1848eaf38d5d15694a1ecae67f14566214)) +* :bug: correction to ContinueConfig serialization model ([b8aba4b](https://github.com/continuedev/continue/commit/b8aba4bc96d3b064012a40d837d5191cae20037e)) +* :bug: correctly generate uris for remote ([ab31cb1](https://github.com/continuedev/continue/commit/ab31cb15fae74592f49c2ceadc8d7810228fa7e2)) +* :bug: ctrl+c for windows overriding copy ([c3925c0](https://github.com/continuedev/continue/commit/c3925c04d981d2abc1e21cf72d6e77d165420a73)) +* :bug: custom escaping instead of URI for diff paths ([da3970e](https://github.com/continuedev/continue/commit/da3970e00061b7a223d23f51bd53012666d324dc)) +* :bug: default to counting chars if tiktoken blocked ([7006dbb](https://github.com/continuedev/continue/commit/7006dbb3e38a837a2580a516791874f6815ac25f)) +* :bug: don't fail on disconnected websocket ([0876610](https://github.com/continuedev/continue/commit/08766100cdb3638b3300ae4b700f8ec2af6b9a8a)) +* :bug: don't log stdout to console ([ee4701d](https://github.com/continuedev/continue/commit/ee4701dc45cd540728302ca8a09e9b7ce842597f)) +* :bug: don't open continue automatically ([8b76f51](https://github.com/continuedev/continue/commit/8b76f518313c20f13dda605931c9929ef58a7a22)) +* :bug: don't override context length param in OpenAI ([b2a6d07](https://github.com/continuedev/continue/commit/b2a6d07ea99be1f9288ee21477edc0874e780cad)) +* :bug: ebusy and logging bug fixes ([3d61469](https://github.com/continuedev/continue/commit/3d614690cd825ac5580074ecdc22f660455204f1)) +* :bug: fix "code" keyerror prior to context_manager.start ([866b16c](https://github.com/continuedev/continue/commit/866b16c3a9c9d88a7b90aa8a43610fc4884ab123)) +* :bug: fix /edit in ssh, pinyin input in combobox ([cda1be4](https://github.com/continuedev/continue/commit/cda1be46625abd8f44962cceeded04c8c47d9f65)) +* :bug: fix >c_d.png file path ([a9bc4e2](https://github.com/continuedev/continue/commit/a9bc4e26263faef8598dd8aa2aec7949c75ab70c)) +* :bug: fix 2 model config bugs ([b144d21](https://github.com/continuedev/continue/commit/b144d21b48a94aa8c203469eb7667bd22fc4e243)) +* :bug: fix 404 from undefined gif ([b467371](https://github.com/continuedev/continue/commit/b4673712e1a6a5b435125004a9b51498207fb7b6)) +* :bug: fix automigration ([ec41f55](https://github.com/continuedev/continue/commit/ec41f553c24d5f4b5bc4e601c989b1936d67ae1a)) +* :bug: fix azure openai bug for 07 version ([a8e69a0](https://github.com/continuedev/continue/commit/a8e69a02e6897689a1727fb7542ed5684b1348e2)) +* :bug: fix broken docs link ([210a02e](https://github.com/continuedev/continue/commit/210a02ef02341a98b4ed18095b2d656a7b994bd9)) +* :bug: fix bugs when selecting code to edit ([fa34214](https://github.com/continuedev/continue/commit/fa34214012d14385d231a1ac4f16006aaf4331fb)) +* :bug: fix ci to only upload from linux x64, not alpine ([4e1a5b1](https://github.com/continuedev/continue/commit/4e1a5b1fb3f96edc95b0938265da980e98566d56)) +* :bug: fix cmd+m bug ([38e8272](https://github.com/continuedev/continue/commit/38e827243ceff3732cd0f260e7a3bd4941a96bc5)) +* :bug: fix command enter, stop streaming on reject ([8e15ec3](https://github.com/continuedev/continue/commit/8e15ec3c2c1490d4a7d6371f877368376fd64e8a)) +* :bug: fix command enter, stop streaming on reject ([19b3886](https://github.com/continuedev/continue/commit/19b38863c21656526e0729776682430e0fa277da)) +* :bug: fix config.py import paths ([97861bf](https://github.com/continuedev/continue/commit/97861bf4117bbc36f8f87797a9ca60e6336f82cc)) +* :bug: fix context length bug for /edit ([d103263](https://github.com/continuedev/continue/commit/d103263030ad52debe73bd131c71bbf17f545956)) +* :bug: fix dialog links ([4c84e69](https://github.com/continuedev/continue/commit/4c84e6945a7c2018622eceb54e7fb54de193b03a)) +* :bug: fix for --meilisearch-url flag ([e2798c5](https://github.com/continuedev/continue/commit/e2798c5bb62eeb2a3bc8f5baee18f9d64ee86563)) +* :bug: fix for Azure OpenAI model names ([bcec2a0](https://github.com/continuedev/continue/commit/bcec2a0870d0ef649961b6c91ec866b612680b9e)) +* :bug: fix for edit=None in highlightedCode update ([247d3e9](https://github.com/continuedev/continue/commit/247d3e9a41ff8d9fe2da6386bfb0d0eb063b071c)) +* :bug: fix for lmstudio defaults ([0012922](https://github.com/continuedev/continue/commit/00129229cd881d6b910a4b01db68e702cdd63a40)) +* :bug: fix for windows drive difference bug ([d69c6d4](https://github.com/continuedev/continue/commit/d69c6d4f3729374ab40fcebc861e67f2da100ad9)) +* :bug: fix ggml bug ([1a75475](https://github.com/continuedev/continue/commit/1a75475c681053494984664ef1179171fe2a5d83)) +* :bug: fix headers for openai.;y ([44fe0c9](https://github.com/continuedev/continue/commit/44fe0c94a55a753ff5d6c3da6b63db4a5c70d780)) +* :bug: fix height bug after cmd+shift+R ([a7cb092](https://github.com/continuedev/continue/commit/a7cb0929bd064f73a1e3e49ba8dd6b6b7de387f4)) +* :bug: fix history.timeline indexing bug ([01ed2c7](https://github.com/continuedev/continue/commit/01ed2c7eb2d3417b2c190eea105008372f49a7c6)) +* :bug: fix huggingface tgi ([5316180](https://github.com/continuedev/continue/commit/5316180394d48d9877cda0cb3d7c3c6de9995d12)) +* :bug: fix import in run.py ([4cf1f75](https://github.com/continuedev/continue/commit/4cf1f75518053f9df174d5ab90c426124f85ecfa)) +* :bug: fix inability to copy/paste when ipynb is open ([850c8ae](https://github.com/continuedev/continue/commit/850c8aea7f3d9c46ff8e98bde936b92282376dae)) +* :bug: fix incorrect imports in default config file ([374bdd0](https://github.com/continuedev/continue/commit/374bdd037792825bf984026da12d4100ffebcac2)) +* :bug: fix keyboard shortcut for debugging ([c021958](https://github.com/continuedev/continue/commit/c021958ae893a9683352ba99e5c6301e38331492)) +* :bug: fix meilisearch empty body content-type bug ([598e243](https://github.com/continuedev/continue/commit/598e243fd292dd8851865ab1c3915ca55f4992cc)) +* :bug: fix missing path import ([5bfe68e](https://github.com/continuedev/continue/commit/5bfe68ea7f7e90e3cb1c3101360cf959b336a857)) +* :bug: fix model changing bug ([fd4a4dc](https://github.com/continuedev/continue/commit/fd4a4dcf004bea86d982ffffb66b4e3cb38193a6)) +* :bug: fix overriding of system message ([8444e76](https://github.com/continuedev/continue/commit/8444e76b7232fbddb62d3626de13653ae332d168)) +* :bug: fix paths ([b893c95](https://github.com/continuedev/continue/commit/b893c956fe75a9e45f06129290d043737f5c1007)) +* :bug: fix reducers for user input queue ([1a36a3c](https://github.com/continuedev/continue/commit/1a36a3c02acaf6bf29d4153c113217517b832942)) +* :bug: fix replicate to work with models requiring prompt input ([84ec574](https://github.com/continuedev/continue/commit/84ec574e182ec441e95d13c3543a934e0a036228)) +* :bug: fix serialization bug for context_providers ([2799249](https://github.com/continuedev/continue/commit/27992499af977baeb9124d9ab35ffec6d36a298a)) +* :bug: fix set_system_message ([084fdac](https://github.com/continuedev/continue/commit/084fdac3992f58dcf11241e7e5c2d5efa784ce0d)) +* :bug: fix ssh /edit by checking for file through vscode fs ([417d45c](https://github.com/continuedev/continue/commit/417d45ccddc2f434d7467e4f17113783996653dd)) +* :bug: fix telemetry bug ([042bc5a](https://github.com/continuedev/continue/commit/042bc5ac76800ee66e603ef23b2bb857fafe053e)) +* :bug: Fix the generating animation ([2f402b4](https://github.com/continuedev/continue/commit/2f402b4a1227ade5a4ba70f770974627b586e930)) +* :bug: fix timeout type ([e1a0290](https://github.com/continuedev/continue/commit/e1a0290d5a699e30464f1e682cb11c6aa119bd59)) +* :bug: fix togetherAI model json parsing ([deb291c](https://github.com/continuedev/continue/commit/deb291c1b225425cba543dd3b4c5557089abfb59)) +* :bug: fix undefined.filter bug ([9b58278](https://github.com/continuedev/continue/commit/9b582781ab0aceaaf1cff7432fed92fa6c205aae)) +* :bug: fix usages of LLM.complete ([f057ee4](https://github.com/continuedev/continue/commit/f057ee4d619b834dc245065d13417a86b44dc61b)) +* :bug: fix when multiple cursor ranges are selected ([f9c145c](https://github.com/continuedev/continue/commit/f9c145c9667e0cd9adb7f9b645f7abf12f7cf2a2)) +* :bug: fix yaml syntax error ([11c7cec](https://github.com/continuedev/continue/commit/11c7cecc107ef9f2571926055dbd80495fe0f8b2)) +* :bug: fixes for a few context_providers ([41b3233](https://github.com/continuedev/continue/commit/41b3233693c34cd81c872a1e7279721b5f640d60)) +* :bug: fixes to templating messages ([c56e24d](https://github.com/continuedev/continue/commit/c56e24d2a5f2b40702e4b495fa3f28d554eaa3ab)) +* :bug: fixing bugs with ggml ([87409c3](https://github.com/continuedev/continue/commit/87409c31832ccb707abbf134843323c9eb6e1183)) +* :bug: fixing issues with creating markdown files ([5c1c2d6](https://github.com/continuedev/continue/commit/5c1c2d626ffed786d00c79aadef26fa5718ca43d)) +* :bug: fixing small UI details ([088b7b8](https://github.com/continuedev/continue/commit/088b7b803866817aaedce6b61834f1ce5de7a7c2)) +* :bug: force kill old server with taskkill on windows ([b1b7d13](https://github.com/continuedev/continue/commit/b1b7d13dbf5b9f6ada28a5ef22ea6857d3b0bcb6)) +* :bug: ftc fix ([f5f10ef](https://github.com/continuedev/continue/commit/f5f10efee3402e117c34b6f0de4bf2fd7d2819c1)) +* :bug: gpt-4-32k in CHAT_MODELS ([b0445cd](https://github.com/continuedev/continue/commit/b0445cd5fc4538c8a9c4f3e76be0f3d724c99818)) +* :bug: handle when vscode workspace not open ([73c6827](https://github.com/continuedev/continue/commit/73c6827d02ff62313184e3745fd94c7591c98b61)) +* :bug: hotfix for user_input_queue.map ([610c576](https://github.com/continuedev/continue/commit/610c576cc9df72716c5e65838f805b15431011ea)) +* :bug: install python-virtualenv on linux, fix git hash files error ([6f0e634](https://github.com/continuedev/continue/commit/6f0e6340bb22ee150ef4b7996750f4c63c0bc2a7)) +* :bug: install python-virtualenv on linux, fix git hash files error ([7fa98ff](https://github.com/continuedev/continue/commit/7fa98ffe843320ddc63794a497a2d44570e005c3)) +* :bug: kill server before trying to delete exe on windows ([286fb0e](https://github.com/continuedev/continue/commit/286fb0e20e48859f129ccf568d03248805bcbc61)) +* :bug: let context providers work without meilisearch ([0f86a69](https://github.com/continuedev/continue/commit/0f86a69e4a83458db2e20e404c26dac2e02355cf)) +* :bug: llamacpp fix indexing max_tokens ([90590ab](https://github.com/continuedev/continue/commit/90590ab4e06fbc3fa721f73a4a922136946a756f)) +* :bug: make sure server_version.txt exists ([17806d9](https://github.com/continuedev/continue/commit/17806d932502adbf974ccd93a670e57b78be9a08)) +* :bug: make typegen.js windows compatible ([dc06228](https://github.com/continuedev/continue/commit/dc0622848b648ba27e7110b9b900673bb668ab4c)) +* :bug: MAX_TOKENS_FOR_MODEL bug fix, more testing ([1c288f7](https://github.com/continuedev/continue/commit/1c288f7749747c6b1908ae16c977f80e5597d2ca)) +* :bug: meilisearch fixes ([0de6e19](https://github.com/continuedev/continue/commit/0de6e1985d0e97ede5e19e7752a6be7cd2a5818d)) +* :bug: more reliable download with request ([fdb036b](https://github.com/continuedev/continue/commit/fdb036bcecec891adaf99d73101c458fc4087406)) +* :bug: more reliable setup of meilisearch ([12a8ae1](https://github.com/continuedev/continue/commit/12a8ae1c47f111b9f36633c96b26e8642c5ff223)) +* :bug: now progress bar when api_key entered ([bf82c6f](https://github.com/continuedev/continue/commit/bf82c6fd16a6777f0a9bb68ce4879d7bab9019bb)) +* :bug: number of bug fixes ([b9bdf58](https://github.com/continuedev/continue/commit/b9bdf5894c1c68b60d1919ae07b0f5909b00dec2)) +* :bug: numerous small fixes ([0940d75](https://github.com/continuedev/continue/commit/0940d756dec3b98071ae5e5a12966e02420b3cd2)) +* :bug: patch for ocassional 0 choices from older azure versions ([5c09b80](https://github.com/continuedev/continue/commit/5c09b8077588a447d6eaac9b7f624571be3ddb1d)) +* :bug: permissions for pypi-deployment step ([b237850](https://github.com/continuedev/continue/commit/b237850c4b64435e26dfb5f12275a16a93e556a8)) +* :bug: post-merge fixes ([96379a7](https://github.com/continuedev/continue/commit/96379a7bf5b576a2338142b10932d98cbc865d59)) +* :bug: remove empty grammar from llama_cpp_args ([e5bbe3b](https://github.com/continuedev/continue/commit/e5bbe3bc4d59b6f35db1ce1b94be14244c11c766)) +* :bug: replace hardcoded path for config file ([4fe9ace](https://github.com/continuedev/continue/commit/4fe9ace518bcdcf79999ce9938ba01b218d355e4)) +* :bug: require socksio ([bba5e5e](https://github.com/continuedev/continue/commit/bba5e5e5b1da2dd924aa2632e38d4bb702bbbdd9)) +* :bug: separately load ctx provs, fix filetree ([d8e821e](https://github.com/continuedev/continue/commit/d8e821e422678fd4248b472c7f3e67a32ecfefb5)) +* :bug: set api_keys in config.py, fix spawn error handling ([6823307](https://github.com/continuedev/continue/commit/68233071dd0d97a353a66fe5627d69f97a389ca8)) +* :bug: set export display in same step as linux npm test ([c3d62c5](https://github.com/continuedev/continue/commit/c3d62c5ae203aaca32583f75a7e80dfd9f196e11)) +* :bug: small bug fix ([32d1149](https://github.com/continuedev/continue/commit/32d1149692c26eb966693f03db6d9cf496ba57a4)) +* :bug: small bug fixes ([bc75ff2](https://github.com/continuedev/continue/commit/bc75ff294a2b5ec5eef5f77aff72aaa0c7f4a3f2)) +* :bug: small fixes, update troubleshooting docs ([51fc07c](https://github.com/continuedev/continue/commit/51fc07cf6441d6330ce64e45e56e8f333ca309ed)) +* :bug: solve EBUSY by polling ([9417973](https://github.com/continuedev/continue/commit/941797359f6554ac16a2e478047aabd5cbc0404b)) +* :bug: ssh compatibility by reading from vscode.workspace.fs ([e5f5630](https://github.com/continuedev/continue/commit/e5f56308c5fd87695278682b2a36ca60df0db863)) +* :bug: start meilisearch in parallel to server ([e4c1bb4](https://github.com/continuedev/continue/commit/e4c1bb4bedbe426d090f4bb2b8819ad935c5b3fb)) +* :bug: stop streaming on rejection ([8d05fc2](https://github.com/continuedev/continue/commit/8d05fc2bb5c5df617800c1abcf43bb03c574482f)) +* :bug: stop streaming on rejection ([9fc831e](https://github.com/continuedev/continue/commit/9fc831e7587cce99c8a6f2e56905c25068c8cab6)) +* :bug: streaming url_decode for Ollama ([3690101](https://github.com/continuedev/continue/commit/3690101b790f91c749f208693aaffc00b9fa2a42)) +* :bug: templating fix for queued LLM ([5c6609a](https://github.com/continuedev/continue/commit/5c6609ab5fa3a69cd0e3e8e61df643fcce1ecb47)) +* :bug: temporarily disable lsp before fixing w/ vscode ([98f340b](https://github.com/continuedev/continue/commit/98f340bd97cba6f30cfe55d47419e3925b9dc679)) +* :bug: temporarily remove replicate altogether ([bd79c00](https://github.com/continuedev/continue/commit/bd79c00e7790b92cfd8b8c8f8211b6c3d36e33a2)) +* :bug: test and fix small issues with GGML ([72e8332](https://github.com/continuedev/continue/commit/72e83325a8eb5032c448a5e891c157987921ced2)) +* :bug: timeout on blocking processes ([345b773](https://github.com/continuedev/continue/commit/345b7734d8c887d699d5038416d2a1f8193a33e9)) +* :bug: traceback fixes, remove replicate from hiddenimports ([45d9bab](https://github.com/continuedev/continue/commit/45d9bab5cea745573be7112d7130089c596c88fa)) +* :bug: try/except around starting meilisearch ([c867cd4](https://github.com/continuedev/continue/commit/c867cd40342d44901cf5277ded25f5dc5aaa4326)) +* :bug: update search path for ripgrep on windows ([e428dc5](https://github.com/continuedev/continue/commit/e428dc53cedf54f394a7cddfe8a7ce7fbf469bb9)) +* :bug: update the tip message for keyboard shortcut ([3558450](https://github.com/continuedev/continue/commit/355845002e178a618e9a792dd57b0649c3da8845)) +* :bug: urldecode ollama responses, make edit faster ([19050f8](https://github.com/continuedev/continue/commit/19050f83228b3e7f08a6aacd5bdd1804a8315e4a)) +* :bug: use certifi to set ca_bundle_path for openai ([3849420](https://github.com/continuedev/continue/commit/3849420948e491d5f84ac485169165d887751fd3)) +* :bug: use posthog-node, not -js ([88a8166](https://github.com/continuedev/continue/commit/88a8166476d38889fd4f9323472cc34a5226e05c)) +* :bug: use powershell remove-item ([64552dc](https://github.com/continuedev/continue/commit/64552dc881509c46aa14253ff94aee9d86ade256)) +* :bug: use windows equivalent of rm -rf ([8d19866](https://github.com/continuedev/continue/commit/8d198663e116c7c77b7e59015bc6032736f71f6e)) +* :bug: verify_ssl and ssl_context mutual exclusivity ([59b7453](https://github.com/continuedev/continue/commit/59b7453afed06418d4c171b65370a6a82f5a9221)) +* :bug: version patch in the publish step ([1936f72](https://github.com/continuedev/continue/commit/1936f725d226bea2e13d5d88c1dd7a9a02ddd259)) +* :bug: windowsHide on process spawn ([c3d31f0](https://github.com/continuedev/continue/commit/c3d31f00bb589df1c83308b7d9d69ed51c31341a)) +* :bug: write out npm run package as package.js ([4636c95](https://github.com/continuedev/continue/commit/4636c9590154d6b5995948003da212eb25003750)) +* :bug: write to local diff files ([6140d05](https://github.com/continuedev/continue/commit/6140d05e7d415d3334032c300ed593bdd181f7f5)) +* :children_crossing: add slash commands to default config ([58e5dc4](https://github.com/continuedev/continue/commit/58e5dc4a5c4fcbed25170b61fbd88d479c5aebcf)) +* :children_crossing: clear the dropdown after text input cleared ([23167a5](https://github.com/continuedev/continue/commit/23167a51d959fed5e4be057ceb9fff50cf34c6c8)) +* :children_crossing: don't order meilisearch results by contnet ([ab7a90a](https://github.com/continuedev/continue/commit/ab7a90a0972188dcc7b8c28b1263c918776ca19d)) +* :children_crossing: use default model in default config.py ([1bc5777](https://github.com/continuedev/continue/commit/1bc5777ed168e47e2ef2ab1b33eecf6cbd170a61)) +* :construction_worker: copy_metadata for replicate in run.spec ([b0426d8](https://github.com/continuedev/continue/commit/b0426d82a4871e9081367ad4e977b22f42db5a89)) +* :construction: working on fixing lsp ([1f95bb2](https://github.com/continuedev/continue/commit/1f95bb287846fc0501193d642420b574d9900857)) +* :fire: remove version from package.json ([27c0a40](https://github.com/continuedev/continue/commit/27c0a403de28345cd03c39ad46c02f68ff57b3a1)) +* :goal_net: catch errors when loading to meilisearch index ([7894c8e](https://github.com/continuedev/continue/commit/7894c8ed1517394aa00f6e496a97d9e27d204f5f)) +* :goal_net: display errors in SimpleChatStep ([72784f6](https://github.com/continuedev/continue/commit/72784f6f1161f0c5b647889c26089a8247111dc9)) +* :green_heart: cd extension before packaging ([0a6d72c](https://github.com/continuedev/continue/commit/0a6d72c099316e6cffa123d3ffa915f3fe13e770)) +* :green_heart: cleanup file ([951552d](https://github.com/continuedev/continue/commit/951552dd0eede1f8f255aeaf5d34a13ff0c7bfb7)) +* :green_heart: don't exclude jedi from pyinstaller ([a1328cb](https://github.com/continuedev/continue/commit/a1328cb5431f99cfe16b246ee4201b19530404e2)) +* :green_heart: fix build scripts ([ab799b0](https://github.com/continuedev/continue/commit/ab799b0b0133e926ea06a1a12c092f42b9e053a1)) +* :green_heart: fix copy statement to include.exe for windows ([36c3dfd](https://github.com/continuedev/continue/commit/36c3dfd51d319b9b9ad392988d13ef7f443e0937)) +* :green_heart: fix preview.yaml ([a736d62](https://github.com/continuedev/continue/commit/a736d62f0e8b9b80ab9a949fd1739fb9a3be26e1)) +* :green_heart: increase testing timeout to allow for fkill ([08b1cfd](https://github.com/continuedev/continue/commit/08b1cfdd2f6f456df7344c16f5d229a0ccfb841b)) +* :green_heart: install rosetta ([5b9ef10](https://github.com/continuedev/continue/commit/5b9ef102973c608bc409a7b9ec244a4be1494e96)) +* :green_heart: one last test ([758520f](https://github.com/continuedev/continue/commit/758520fe6b59d3330dec80ac07d05282d36e0058)) +* :green_heart: only upload once per binary ([490838a](https://github.com/continuedev/continue/commit/490838a8ad920a52ada7e85675aefd965e978d77)) +* :green_heart: package patch ([34f32ed](https://github.com/continuedev/continue/commit/34f32ed5f71055ea11d4332f18e77ceba5849631)) +* :green_heart: package:pre-release ([d3f21da](https://github.com/continuedev/continue/commit/d3f21da803e36b78f968c2216d9f93f90ebabd6a)) +* :green_heart: publish as pre-release! ([831bf5e](https://github.com/continuedev/continue/commit/831bf5e7f7c48dd80f71f1256f5597bd47bf22de)) +* :green_heart: publishing to depend on ALL tests ([a131c17](https://github.com/continuedev/continue/commit/a131c17326591e67a68faf6f96371ad8fc332b71)) +* :green_heart: pull origin main in main.yaml after pypi update ([6a9a079](https://github.com/continuedev/continue/commit/6a9a079914d94419183182cd0a5cc4439f2101ad)) +* :green_heart: remove "patch" from vsce publish command ([d8327ec](https://github.com/continuedev/continue/commit/d8327ec6f82058479bd294bfcdccaf3c2b54de0a)) +* :green_heart: remove npm_config_arch ([8c51664](https://github.com/continuedev/continue/commit/8c5166471b0d83b924d8bee1e0ca51822cc1bbdc)) +* :green_heart: remove version from apckage.json ([5438ce9](https://github.com/continuedev/continue/commit/5438ce94406baa0f7d131ecacadefc72912dca0d)) +* :green_heart: set permissions on apple silicon binary ([715cfed](https://github.com/continuedev/continue/commit/715cfed18747b6bc2e6d7bd7a977d249cc9066d5)) +* :green_heart: testing ([14062c5](https://github.com/continuedev/continue/commit/14062c5c385bb7ba80096bf7daf6b6a5568b0b54)) +* :green_heart: testing for failure to package dist in vsix ([19acf3b](https://github.com/continuedev/continue/commit/19acf3bb36c1e44274297c806b89b589ca02f5ba)) +* :green_heart: update permissions and version ([c4ed41c](https://github.com/continuedev/continue/commit/c4ed41c861573f4c9bdff1a21ca3e056cfdd766e)) +* :green_heart: update pylsp hidden import ([1e8ea65](https://github.com/continuedev/continue/commit/1e8ea654f5ad1e06bff2660b54a50955098703ba)) +* :green_heart: update pypi version, don't push from main ([208eb65](https://github.com/continuedev/continue/commit/208eb65f67ccc62ce6d683fd9bed2fe9524b2136)) +* :green_heart: use curl to download binary ([199e4b3](https://github.com/continuedev/continue/commit/199e4b3b99642ba5b1558132aa10119be1eeb525)) +* :heavy_plus_sign: add bs4 to requirements.txt ([8a1e6fb](https://github.com/continuedev/continue/commit/8a1e6fb4adec6e5febb2a0d78eb0b2a01bfa028b)) +* :heavy_plus_sign: add ripgrepy dependency to requirements.txt ([9801b50](https://github.com/continuedev/continue/commit/9801b50192ca661972d5b2997028db3cd0725fb7)) +* :heavy_plus_sign: hidden import for replicate ([b75555f](https://github.com/continuedev/continue/commit/b75555f106be3c7612e7c31818ff674485096e4f)) +* :heavy_plus_sign: include replicate in requirements.rtxt ([01b3f1f](https://github.com/continuedev/continue/commit/01b3f1ff8f4dd89ae79f15626ef5a3af2bc558c4)) +* :lipstick: don't display entirety of large tracebacks ([a74eda5](https://github.com/continuedev/continue/commit/a74eda56cfcafb5c463a74df564ced6f882f8d3e)) +* :lipstick: fix layout bugs ([b655781](https://github.com/continuedev/continue/commit/b6557810d70a7f341761d5018fa2835cc3a50af1)) +* :lipstick: fix UI problems in vscode light themes ([5e8866d](https://github.com/continuedev/continue/commit/5e8866da83f8a97cb8492f26e175b948d0282262)) +* :lipstick: logo alignment, better config failure description, patch ([c51ad53](https://github.com/continuedev/continue/commit/c51ad538deff06af6c9e5498b23e3536e18bfc4c)) +* :lipstick: nicer autoscroll ([88699ff](https://github.com/continuedev/continue/commit/88699ff909b026511da392bf2c0a96be02abc6fd)) +* :lipstick: small UI improvements ([ec4fb4d](https://github.com/continuedev/continue/commit/ec4fb4d9235151901c1f7367932ecc17ab55d8e4)) +* :lipstick: ui tweaks to history + scrollbars ([6e8885f](https://github.com/continuedev/continue/commit/6e8885fc2f7feb06ef6ac87d2d7688f9f33d15de)) +* :lipstick: update font size for input, remove first tutorial step ([73ff267](https://github.com/continuedev/continue/commit/73ff2678ad984c9d9082ec078a38450d5daa1376)) +* :lipstick: update light gray hex code ([e0e0482](https://github.com/continuedev/continue/commit/e0e0482f2af2eadd3df72fbdb6974c07ba11c527)) +* :lock: opt out of meilisearch analytics ([8db5b39](https://github.com/continuedev/continue/commit/8db5b39170229ba93b83f526e7fd80056e461c6a)) +* :loud_sound: better logging for ggml completion endpoint ([0459b0c](https://github.com/continuedev/continue/commit/0459b0c919903852254ac2cd081307788884cd84)) +* :loud_sound: fix logs to be sent from uvicorn ([d3b4103](https://github.com/continuedev/continue/commit/d3b4103cd2f639fc072b8a3269d7730478c8bb1c)) +* :loud_sound: websocket logging and horizontal scrollbar ([7bb0fe3](https://github.com/continuedev/continue/commit/7bb0fe34bbc8affce0c675b88ffb79a6b9985860)) +* :memo: escape in docs ([7314e79](https://github.com/continuedev/continue/commit/7314e79ac5bc34936a2c3de0fd01aadbfe640e72)) +* :memo: fix deployent readme ([7a38025](https://github.com/continuedev/continue/commit/7a3802523c2e5ae136c39849e2fbb0d3e7bba63e)) +* :memo: remove reference duplicates for ctx providers ([043d695](https://github.com/continuedev/continue/commit/043d695198caed305fa6651918c3bbb2de87db36)) +* :memo: small fix in troubleshooting.md ([275a03b](https://github.com/continuedev/continue/commit/275a03b7f1e32f57bd68e501074aa80e0dbed40f)) +* :memo: use backup server links in docs ([815627b](https://github.com/continuedev/continue/commit/815627b167e4bf06308b51c6756e33c36b17b631)) +* :pencil2: Fix typo that was causing automatic version bumping not to work for intellij ([3daf2c7](https://github.com/continuedev/continue/commit/3daf2c7b23caf838b862c2d2791ae8655b761d12)) +* :rocket: fallback s3 bucket ([aa98080](https://github.com/continuedev/continue/commit/aa98080cb16c75d2b7d6d9771b97e63120052c62)) +* :safety_vest: more safely convert windows path to posix ([4309f9d](https://github.com/continuedev/continue/commit/4309f9def89c25611273d99db01e7cc477ad935e)) +* :white_check_mark: allow longer for python server to start in test ([d8f5f10](https://github.com/continuedev/continue/commit/d8f5f102f6f91487be0281316e581858ec4ca260)) +* :white_check_mark: allow longer wait in test ([40ec1a3](https://github.com/continuedev/continue/commit/40ec1a31a7cd37da8b75bbabf1f0d160bb7bec5d)) +* :zap: register vscode commands prior to server loading ([f7a3659](https://github.com/continuedev/continue/commit/f7a3659381f839b890f2c53086f7fedecf23d9ab)) +* :zap: update count_tokens method ([8214203](https://github.com/continuedev/continue/commit/82142033f935d6236620d82e31a70ea8f2fb243e)) +* 'inferenceConfig.stopSequences' failed to satisfy constraint: Member must have length less than or equal to 4 [#2538](https://github.com/continuedev/continue/issues/2538) ([90e994d](https://github.com/continuedev/continue/commit/90e994db3c106f9b63bd043203111e5e101071ba)) +* (very) small typo breaking the prompt file examples link! ([bd6f9b9](https://github.com/continuedev/continue/commit/bd6f9b969647ee8cf6138dca63538063414553bb)) +* `REPLACE INTO` code_snippet table ([bdb967d](https://github.com/continuedev/continue/commit/bdb967d7b3c18fa2e0237f3cc0e0ea7415102715)) +* 🐛 Codebase Indexing still not work ([955ab93](https://github.com/continuedev/continue/commit/955ab93efc3f488127d16673b89f3900f75c2007)) +* 🐛 typo in core.py ([#429](https://github.com/continuedev/continue/issues/429)) ([705324e](https://github.com/continuedev/continue/commit/705324ed2ef588b2885c0b03107b9e30ae358dae)) +* a bunch of bugs, commit residuals such as npm install pg ([6d74e6b](https://github.com/continuedev/continue/commit/6d74e6b1fedf18b11ea12ba38164fcd146fdba4b)) +* actions ([653ca20](https://github.com/continuedev/continue/commit/653ca205dfbe2f7fec94891c99053d393d3efd0c)) +* add .mvn/ to list of default ignored folders ([ec91021](https://github.com/continuedev/continue/commit/ec91021adfcbd49becc3fdfbee6784981238a9f4)) +* add 'rich' module to requirements.txt ([#612](https://github.com/continuedev/continue/issues/612)) ([5d21bdf](https://github.com/continuedev/continue/commit/5d21bdf2930b30723f1fd80b05d8c1c2ad589bb2)) +* add checkmark icon to indicate selected model in dropdown ([98a3219](https://github.com/continuedev/continue/commit/98a321939ea1ba551025b16dc09f13e7a5e980ca)) +* add code range for quick actions/fixes ([#1687](https://github.com/continuedev/continue/issues/1687)) ([9f2e9bc](https://github.com/continuedev/continue/commit/9f2e9bc2dff474447d8502e386bb0cc804730bb9)) +* add context provider ([ae888d9](https://github.com/continuedev/continue/commit/ae888d9e814cf10931222070ed1e2ae5438325fe)) +* Add context/getSymbolsForFiles endpoint in JetBrains and handle symbol retrieval errors ([ba1fdf7](https://github.com/continuedev/continue/commit/ba1fdf7bac07afe04e62bd659a87dc89800a302b)) +* Add ContinuePluginDisposable to avoid memory leaks in Jetbrains ([a48a150](https://github.com/continuedev/continue/commit/a48a150b2024fca63cb50fb09a914a391c0cfce5)) +* add Delphi/Pascal syntax highlighting support ([cfcb06b](https://github.com/continuedev/continue/commit/cfcb06b1763b17e9e6d150963e090523c372d5d6)) +* Add directory checks and optimize token usage ([79736c3](https://github.com/continuedev/continue/commit/79736c3108313204184bb7d833ac21e23341354f)) +* add focus to InputToolbar on click ([#703](https://github.com/continuedev/continue/issues/703)) ([6b17de4](https://github.com/continuedev/continue/commit/6b17de49ed0e991221baee986f9dbb758d55f291)) +* add hover effect and restrict clickable area for the history and more back buttons ([9662b18](https://github.com/continuedev/continue/commit/9662b18a1ff36d8eaf743003f4df501245a31be2)) +* add missing eos_token for qwen2.5-coder ([6a7eea2](https://github.com/continuedev/continue/commit/6a7eea27ca5d1ade790ce08dc1cf4eb7bbdeb585)) +* add missing import ([400be9b](https://github.com/continuedev/continue/commit/400be9b47f0b8ab52b4e32ca77339497c63c8f96)) +* add mistral model options to config schema ([d56b48c](https://github.com/continuedev/continue/commit/d56b48cad2fcb0bb8e4a3e0dd3e32ab7f704d762)) +* add Msty logo ([397dcf4](https://github.com/continuedev/continue/commit/397dcf4ccc663560a49ff41e5892a5c118bce02e)) +* add new UI breakpoints ([5105645](https://github.com/continuedev/continue/commit/5105645dedec92abd3fc613777f60fd2a638a0ab)) +* add unit tests for commandExtractor and improve multiline comment handling ([0d940ec](https://github.com/continuedev/continue/commit/0d940ec6d1377b38945bd6217040cd025f89a80c)) +* add uuid to chat msgs for deletions ([f63fd5d](https://github.com/continuedev/continue/commit/f63fd5d83cefbbe01721515a8f28f435353bd804)) +* addTag ([53f886f](https://github.com/continuedev/continue/commit/53f886fd40c7bca29de06156f0e713a9700cc189)) +* allow downloading missing embedder on Ollama, in VS Code ([1dc58c6](https://github.com/continuedev/continue/commit/1dc58c63ab174f579e860d778ae85e73f6fb8c9d)) +* always show close icon ([4faed0b](https://github.com/continuedev/continue/commit/4faed0bc17a2b79e24fe5133efc40868bccaa6aa)) +* apply actions in toolbar ([cd810eb](https://github.com/continuedev/continue/commit/cd810eb93939bccc5bc0ff1e5c54572c7d27a97d)) +* apply insertion bug ([ceb9277](https://github.com/continuedev/continue/commit/ceb92773e9a6e4da27aa2de8f871c07f1e23d1a7)) +* apply notch filename trunaction ([033ade0](https://github.com/continuedev/continue/commit/033ade024ed685ef66dad53e675449a47e2dc872)) +* artifact name ([85e3fbc](https://github.com/continuedev/continue/commit/85e3fbc1c73872b1dfd8aee1f1dcef26b9f37761)) +* artifact upload ([1039e77](https://github.com/continuedev/continue/commit/1039e777c8a081ed9362f29e20c7c6133f3b07cd)) +* attempt to fix [#485](https://github.com/continuedev/continue/issues/485) ([#498](https://github.com/continuedev/continue/issues/498)) ([1188dd7](https://github.com/continuedev/continue/commit/1188dd7e5f26ed57d034c927ba032739963b9abc)) +* auth ([72636d9](https://github.com/continuedev/continue/commit/72636d96c8d8bb303e66f2344f5eeef26f078816)) +* autocomplete label after selecting a query type context provider ([#1562](https://github.com/continuedev/continue/issues/1562)) ([6407458](https://github.com/continuedev/continue/commit/6407458d7626d52558ea760b79a03129caba14ff)) +* autocomplete logging + input layout ([c542e5d](https://github.com/continuedev/continue/commit/c542e5d6153078f42e8eaf4361a4e5bdf24d9bc2)) +* Autocomplete not working when lookup is selected ([346f8fe](https://github.com/continuedev/continue/commit/346f8fe191a96eab5903b9a9f5a1e7e5ea1e3ee2)) +* avoid parsing md rules as yaml ([6c24132](https://github.com/continuedev/continue/commit/6c24132fab5b1c828aeb2e162c0f07ab6c830d0d)) +* binary ([8f24197](https://github.com/continuedev/continue/commit/8f2419740044a5df2ca70905c2b9ecd0fef3389e)) +* broken build ([d09711a](https://github.com/continuedev/continue/commit/d09711ab5895aca1c91552e7d9140b3aa0535d77)) +* broken help center quickpick ([a83526d](https://github.com/continuedev/continue/commit/a83526d6a49df6589d107695f99c03d02b68629c)) +* broken imports ([5fd8d2c](https://github.com/continuedev/continue/commit/5fd8d2cae5926418116031dbab8ce9465bc4c8f9)) +* broken imports ([f60009c](https://github.com/continuedev/continue/commit/f60009c2ea7c1c1a980152e5aa3cda17c3f6e64d)) +* broken JB build ([0e2587c](https://github.com/continuedev/continue/commit/0e2587cc71f497141ccd5fc807624eac80f8f183)) +* broken link ([6a675d8](https://github.com/continuedev/continue/commit/6a675d8edce1e430faa32b5142554bf61b843e0a)) +* broken schema config ([0529ae8](https://github.com/continuedev/continue/commit/0529ae8e1e4f61d83f2a4c43c9b9d23a84192ec9)) +* browse functionality ([ef5d753](https://github.com/continuedev/continue/commit/ef5d7535f0860978baeb337930f266b1201a7a5c)) +* build issues with jetbrains ([267961f](https://github.com/continuedev/continue/commit/267961f5b67f8f4529917fc43ebc1df88db92b51)) +* bump extension tester version ([006e1e4](https://github.com/continuedev/continue/commit/006e1e4b3bad2a8545a492cbeeb3238a1bf3345b)) +* bump node.js dependencies ([18fd7fb](https://github.com/continuedev/continue/commit/18fd7fbe58a03dfda382f755e261c5f16e88f38e)) +* cache ([368d264](https://github.com/continuedev/continue/commit/368d264d221793b7f2439678cef9b8b032135529)) +* caching ([1e7aa1a](https://github.com/continuedev/continue/commit/1e7aa1a879c80c0acddf09fbe0d887b7ec9bd31d)) +* change from llama3.1-8b to llama3.1:8b ([ea060a3](https://github.com/continuedev/continue/commit/ea060a37567af620cbdb8d665beb3f36cfeada6d)) +* chat tests ([7be3bb4](https://github.com/continuedev/continue/commit/7be3bb4161e7a17f7b0ae6e8d3ce365479e70dde)) +* ci ([1f47f54](https://github.com/continuedev/continue/commit/1f47f5436dde900b04cf1b307efa64f0fecebd59)) +* ci ([f6f2633](https://github.com/continuedev/continue/commit/f6f263375be129e438ab46a3ddbbba0722d3eb24)) +* ci ([fa9f86b](https://github.com/continuedev/continue/commit/fa9f86b6fd9ddb8cfab7dc52772c9f5a0623d654)) +* CI checks + fix for broken config-yaml types ([2032a8c](https://github.com/continuedev/continue/commit/2032a8c31ce9f30a5996a0fa6566d840a1eae21b)) +* ci e2e tests ([ade32d4](https://github.com/continuedev/continue/commit/ade32d428c5ef0fc8f5daefd52571b95387002f3)) +* ci tests ([27d20eb](https://github.com/continuedev/continue/commit/27d20eb08b25b142a54641048670b036e201ea1d)) +* circular state in redux selector ([5921bfa](https://github.com/continuedev/continue/commit/5921bfac67237dd4ea34dc1aad7856b220adf062)) +* cleanup model select ([1933a29](https://github.com/continuedev/continue/commit/1933a29ec4536d4887130703f1b0f94c3cd3db8d)) +* Clear all diff blocks before streaming and ensure dispose is run on EDT ([41357cd](https://github.com/continuedev/continue/commit/41357cd00c72b61cd54b80aa3963d047c0bb4184)) +* Clipboard is not available in chat window ([ef26b7c](https://github.com/continuedev/continue/commit/ef26b7c80eb0cc503017df8b9abd634f868a9b89)) +* close extension after tests ([575a707](https://github.com/continuedev/continue/commit/575a70721b39e41bfe8b860824d5eb606ce29ba9)) +* close sidebar when cmd+l pressed on focus ([93c9507](https://github.com/continuedev/continue/commit/93c95075425179d27421c7b54d92c9235d914c3c)) +* Cloudflare Workers AI message handling ([7eff255](https://github.com/continuedev/continue/commit/7eff25595c6aa063db37fb2d5394447c8472ba20)) +* cmd+shft+l closes sidebar if focused ([#1638](https://github.com/continuedev/continue/issues/1638)) ([92b5c4c](https://github.com/continuedev/continue/commit/92b5c4ccf64a88c461bb32abc9ab02329651e6be)), closes [#1536](https://github.com/continuedev/continue/issues/1536) [#1456](https://github.com/continuedev/continue/issues/1456) [#1564](https://github.com/continuedev/continue/issues/1564) [#1576](https://github.com/continuedev/continue/issues/1576) [#1570](https://github.com/continuedev/continue/issues/1570) [#1582](https://github.com/continuedev/continue/issues/1582) [#1600](https://github.com/continuedev/continue/issues/1600) [#1618](https://github.com/continuedev/continue/issues/1618) [#1626](https://github.com/continuedev/continue/issues/1626) [#1637](https://github.com/continuedev/continue/issues/1637) +* code automatically expands after pressing enter ([42c02be](https://github.com/continuedev/continue/commit/42c02bed5fb61f925eb829cd8e7e39425225cc30)) +* codestral template ([d56a33e](https://github.com/continuedev/continue/commit/d56a33ea06f7c9724ffaef86d71bbb8d31840fc8)) +* colocation ([fb28272](https://github.com/continuedev/continue/commit/fb282727e92237f6b14e28e3538e04e13b837f1e)) +* colocation ([e1d227c](https://github.com/continuedev/continue/commit/e1d227cbc3ea56e607fce5c5ce585c2b901f6029)) +* comment out auto apply on MFE ([f61476a](https://github.com/continuedev/continue/commit/f61476a4936f364b4d0adc679da067d5f3ee8411)) +* completions ([a2f62da](https://github.com/continuedev/continue/commit/a2f62dad3b4df8a9a243964584eed148835a077b)) +* config error handling ([170676a](https://github.com/continuedev/continue/commit/170676a46149a4e507f827aa566f4b1d39344e2e)) +* config-types "useSuffix" to "useFileSuffix" ([fa3afd5](https://github.com/continuedev/continue/commit/fa3afd52e766c298a9bfa62c57e8a9b6e695b1d6)) +* **continue:** update context for slash commands ([cfac639](https://github.com/continuedev/continue/commit/cfac639e44ff5ba13960bbed6756047a90ed93f2)) +* convert `walkDir` to an async generator ([#1783](https://github.com/continuedev/continue/issues/1783)) ([6824497](https://github.com/continuedev/continue/commit/68244977d377e1706a20892abc059bf5cb70bc71)) +* copy ([5e122b7](https://github.com/continuedev/continue/commit/5e122b76b3cf5f0f511101bb1b2cea1349fa3a7a)) +* **core:** delete indexed docs if re-indexing ([acea620](https://github.com/continuedev/continue/commit/acea620043d2c48826266d4f1f73eaf42819f0c6)) +* **core:** remove eslint config and fix errors ([#1457](https://github.com/continuedev/continue/issues/1457)) ([3e1c06b](https://github.com/continuedev/continue/commit/3e1c06b41b7b90a0cad026c0ba0433fb1be6d277)) +* **core:** use `TextDecoderStream` for stream response ([#1498](https://github.com/continuedev/continue/issues/1498)) ([09d256a](https://github.com/continuedev/continue/commit/09d256ad562eda0919b9fa2853176319bf4eda36)) +* correct formatting ([cbb5c21](https://github.com/continuedev/continue/commit/cbb5c21f591e078df186fd86865830cb8971be03)) +* correct llama2TemplateMessages ([#855](https://github.com/continuedev/continue/issues/855)) ([f95a54d](https://github.com/continuedev/continue/commit/f95a54d9c29247680839129c54eae912ba5ca85d)) +* correct package.json update ([02968fb](https://github.com/continuedev/continue/commit/02968fb1551c0a26af75340641312e1f9f5a1102)) +* correct typo in stop sequence ([0dac76e](https://github.com/continuedev/continue/commit/0dac76edf5f35226cf6b3e99c83a7c02273cc05c)) +* corrected typo in the info Alert paragraph ([be55052](https://github.com/continuedev/continue/commit/be55052d230b50635c43727127ee776e67bd4c20)) +* cursor focus issue causing unwanted return to text area ([#1086](https://github.com/continuedev/continue/issues/1086)) ([c54cd7a](https://github.com/continuedev/continue/commit/c54cd7a26dd2e4e8743be86c6ac22dd1c8dca774)), closes [#1078](https://github.com/continuedev/continue/issues/1078) +* cursor position ([6284eee](https://github.com/continuedev/continue/commit/6284eeebef984ac1afd3846b606a7745c5dfb49d)) +* cycling through chat messages ([b3ac143](https://github.com/continuedev/continue/commit/b3ac14332e8bd89237dfa41847701e3378487145)) +* deepseek doesn't support 'https://api.deepseek.com/completions' URL currently. When user selecting code in editor, and then use 'CMD +I' command to let model to modify codes, 400 error happens. ([170b99d](https://github.com/continuedev/continue/commit/170b99d3261b7d2ef32ba9e03a51ac37bb1fb787)) +* delete all code_snippets ([b9114bb](https://github.com/continuedev/continue/commit/b9114bbdab90de0dd167c88b57bd96b27ad03524)) +* delete button default style ([5423d24](https://github.com/continuedev/continue/commit/5423d24c35c614b0970e472aafa1f1048bf0d970)) +* delete old docs index on force re-index ([#1778](https://github.com/continuedev/continue/issues/1778)) ([0d632ea](https://github.com/continuedev/continue/commit/0d632eabbfd512c813e65212c3f5765bbc3fc8c7)) +* dependencies ([384fb56](https://github.com/continuedev/continue/commit/384fb562e5aac023301d592a186982a4b575fe98)) +* dependencies ([8efb3be](https://github.com/continuedev/continue/commit/8efb3be1b1f2253f9a7fd3035d8f0055de8f426e)) +* dependencies ([cc063fd](https://github.com/continuedev/continue/commit/cc063fdd124d66515bdcb9e2c64f575b40cc99d8)) +* dependencies ([fccae87](https://github.com/continuedev/continue/commit/fccae8732e1a4f447ff0ab650e9ae717c2022ffc)) +* Desktop.browse on linux ([7a11446](https://github.com/continuedev/continue/commit/7a11446bfc5d4cb9c05f64f1377518456d30f530)) +* disable completions in the commit box ([2b611df](https://github.com/continuedev/continue/commit/2b611df53ba716c2b550ab3b275c571eed9d2c65)) +* disable indexing for unsupported CPUs ([a005aa7](https://github.com/continuedev/continue/commit/a005aa78ac75ac47be3e647e9e23b45eab7dafaf)) +* disable lancedb cpu check ([b496777](https://github.com/continuedev/continue/commit/b49677711b4340f57ba671bacda301138c2909fb)) +* Do not break completion for unsupported FS providers ([4d1a33f](https://github.com/continuedev/continue/commit/4d1a33fd794a7415b0cc3b8de1d349fbba5a01cb)) +* do not filter context providers if not in editMode ([b2182b9](https://github.com/continuedev/continue/commit/b2182b9c8568a38d3af179909fb305e1459f5276)) +* do not write to the cache if caching is disabled ([b29ed9d](https://github.com/continuedev/continue/commit/b29ed9d34aa7ae343a2fd0c767f315e46e9aa110)) +* docs and install dependencies task for new directory structure ([#551](https://github.com/continuedev/continue/issues/551)) ([6ef8ae6](https://github.com/continuedev/continue/commit/6ef8ae6d5ab7efb1e928ff6474b6ac7a804a34cc)) +* **docs:** contributing guide ([5a06dfe](https://github.com/continuedev/continue/commit/5a06dfe1fb865bed0ca76ff23816da6396a0b27d)) +* **docs:** correct openai api key name ([9cc25c1](https://github.com/continuedev/continue/commit/9cc25c18c9fff5fc6ac4d56153667b0e8311920c)) +* **DocsCrawler:** Add response.ok check and improve link splitting ([d613b5a](https://github.com/continuedev/continue/commit/d613b5a7da5ad15c8b4b7dfe949812045f69635c)) +* don't override embeddings model name with UNSPECIFIED ([bc79388](https://github.com/continuedev/continue/commit/bc79388634ebcfcf2e38aa240441f9939e9de85a)) +* don't return empty string ([403eb38](https://github.com/continuedev/continue/commit/403eb38b9e3e38c277daed4ac6a2b6ac54353570)) +* dont toggle models when toggling assistants ([5bd8dd4](https://github.com/continuedev/continue/commit/5bd8dd4cb759bbabc35bdc00c66d88e4a175f7a8)) +* double ssh retries ([c9e2ebc](https://github.com/continuedev/continue/commit/c9e2ebc4589f7a06e804daee7f2ce6d7b2b66ce2)) +* dropdown with the height of the sticky div ([#605](https://github.com/continuedev/continue/issues/605)) ([a8d6ff0](https://github.com/continuedev/continue/commit/a8d6ff04e43a81a3c76373469ffebdfcfa8ac9f2)) +* editor focus handling on click events ([#716](https://github.com/continuedev/continue/issues/716)) ([f1660a5](https://github.com/continuedev/continue/commit/f1660a533146c420253df6e2dec0e0d4a2a9ebf4)) +* Eliminate Uncaught TypeError in dev tools ([d342825](https://github.com/continuedev/continue/commit/d3428256543bcc5ab269df93c949b56df92793f2)) +* Empty file inserts incorrect content ([ba9027b](https://github.com/continuedev/continue/commit/ba9027baea44ca51d299804636771d1a084d5fa7)) +* empty last message ([d3f7795](https://github.com/continuedev/continue/commit/d3f7795e6133fe7452c0626e6a54fb229bacbd7b)) +* enable OSR for mac after validations ([db77b50](https://github.com/continuedev/continue/commit/db77b5020d9b93cb4a7504e213d81940dbee9eaa)) +* end thinking for reasoning models when request is complete ([5109685](https://github.com/continuedev/continue/commit/51096858ab1ddc2bee534c1ea848be2b4bdcfb3f)) +* ensure code preview uses one more backtick than in the selected code as a fence ([#742](https://github.com/continuedev/continue/issues/742)) ([9ce7770](https://github.com/continuedev/continue/commit/9ce7770066cf870d2d1f36883f5e867157373eda)) +* ensure template variables are only processed for stdio MCP servers ([99b1ab2](https://github.com/continuedev/continue/commit/99b1ab2ebe51b4678722703922ecca023afa911c)) +* Ensure that the state is cleared after refresh, and files->uris when the file changes ([abd8907](https://github.com/continuedev/continue/commit/abd890738111e51bf12a700f9e5e8e66a7c76235)) +* Ensure valid line index for highlighter ([f86c95e](https://github.com/continuedev/continue/commit/f86c95ebdbd1851bcbf0e6f22d18a348a8a154ed)) +* error ([4c7f918](https://github.com/continuedev/continue/commit/4c7f9182665a259fc6b9cf10c93e696e97400a2c)) +* error printing bug leading to uncaught err ([3af4d6b](https://github.com/continuedev/continue/commit/3af4d6b1edeac113499cc9626cea75a5083b1030)) +* exclude open-codestral-mamba from supported models ([c6591f8](https://github.com/continuedev/continue/commit/c6591f836ea73e1244a0e965111f7c599669d9fa)) +* **extensions:** schema for db ctx provider ([#1534](https://github.com/continuedev/continue/issues/1534)) ([6fdad55](https://github.com/continuedev/continue/commit/6fdad553b6ac7f64c1bb23617dbe313e16174a56)) +* failing azure llm test ([546b52a](https://github.com/continuedev/continue/commit/546b52a2df928687d56924f593108f5bb9235712)) +* failing test ([ec2a72d](https://github.com/continuedev/continue/commit/ec2a72dfabbe7bd9c220b18b55145f431e19f3bf)) +* failing test ([002ecc9](https://github.com/continuedev/continue/commit/002ecc9b519472e0968e9f227894f3143c87f1ec)) +* failing test ([07b6b0c](https://github.com/continuedev/continue/commit/07b6b0cbefe86f2efa5488a33060ee9eb9f20e4d)) +* failing tests ([88ccb74](https://github.com/continuedev/continue/commit/88ccb74f7e69cf816d27f15a318a42c11f6d2aa5)) +* failing tests ([cb2e0a7](https://github.com/continuedev/continue/commit/cb2e0a7c0e9330d9b79a3e9878c851b9eba92ade)) +* failing tests ([7b52ff7](https://github.com/continuedev/continue/commit/7b52ff74d4009cb85c32a5e9482bd3624931d21e)) +* failing tests ([8d29d41](https://github.com/continuedev/continue/commit/8d29d4158d0fe21b0c0c4722e8d23715acf9ebdf)) +* failing tests ([2b828b0](https://github.com/continuedev/continue/commit/2b828b0e7b455bf6b0f9ae5a6f6a705ab4cefe6a)) +* field name fix ([0de1a2f](https://github.com/continuedev/continue/commit/0de1a2ff8937452815311c806a038a7f6d75fdf8)) +* filepath replacements in prompt files ([#1939](https://github.com/continuedev/continue/issues/1939)) ([c0923a0](https://github.com/continuedev/continue/commit/c0923a0dd7ca3a6e9dcbd9b02bfc34250269d2ef)) +* fix [#709](https://github.com/continuedev/continue/issues/709) ([#712](https://github.com/continuedev/continue/issues/712)) ([9ae07cd](https://github.com/continuedev/continue/commit/9ae07cd711d011faaf9a79952c0e213a6aa72e87)) +* fix 100% indexing progress ([7f214ad](https://github.com/continuedev/continue/commit/7f214adcbdca33ebb7270f721fd57eeeb0bac1e8)) +* fixed misallignment in tests caused by linter ([15e93dd](https://github.com/continuedev/continue/commit/15e93dd5d0dc3b5dcd00504833beacbddbfe44f3)) +* format code ([1d000be](https://github.com/continuedev/continue/commit/1d000bec682d1d723bf6748f34c3dd86b684d775)) +* formatting ([9efd0e1](https://github.com/continuedev/continue/commit/9efd0e128ef464d45379e84abf15e98ad1b24d40)) +* formatting ([2284291](https://github.com/continuedev/continue/commit/22842919489ad272edfa182e9f8af3a26d9813ae)) +* formatting ([4d70d3d](https://github.com/continuedev/continue/commit/4d70d3dcbd646b1aa1cb6e586439459dec2db462)) +* free trial config.json updates ([905f064](https://github.com/continuedev/continue/commit/905f064543e71864eaeb4e039e5d55fe2da845fd)) +* fullscreen gui retains context when hidden, fixed fullscreen focusing ([#1582](https://github.com/continuedev/continue/issues/1582)) ([679e26d](https://github.com/continuedev/continue/commit/679e26d4a8a81402d57a64d819f347d9f56d42e0)) +* gemini tool calls with MCP ([9ca4ad4](https://github.com/continuedev/continue/commit/9ca4ad4afe04fbfc3a6e0e6d447dd81ff22b4369)) +* getting diff ([9431131](https://github.com/continuedev/continue/commit/9431131f1cbbc5fe742c033a8baf970241c63378)) +* **google:** remove unnecessary parameter ([#394](https://github.com/continuedev/continue/issues/394)) ([938c1db](https://github.com/continuedev/continue/commit/938c1db5b37d5332ff5d188f4fa79f3bc6b7549a)) +* grab PATH for mcp connections ([60ec3ac](https://github.com/continuedev/continue/commit/60ec3ac452f0b25d176728dfe6e83e4f34ade745)) +* grammar ([58feb0b](https://github.com/continuedev/continue/commit/58feb0b8622e5f64737594ccbfd94aff2e9687c5)) +* **gui:** ctx rendering w/ renderInlineAs: "" ([#1541](https://github.com/continuedev/continue/issues/1541)) ([8a92f43](https://github.com/continuedev/continue/commit/8a92f4312693549a1590e99c70152b843d59b119)) +* **gui:** passing style props on StyledTooltip ([41e1eb5](https://github.com/continuedev/continue/commit/41e1eb582bec8676fc973c3a2b76259344fbb317)) +* **gui:** typo ([3d53809](https://github.com/continuedev/continue/commit/3d5380908292bb4373a122a802f2011dd0283f62)) +* handle apiType for azure w/ proxy ([036e196](https://github.com/continuedev/continue/commit/036e19618b86600e4e9c5ad6e6ee5a98e55e15f1)) +* handle closed webview on quick edit ([#1942](https://github.com/continuedev/continue/issues/1942)) ([fe05db5](https://github.com/continuedev/continue/commit/fe05db541dafc45c9870d52d9f15e812e1ea90ad)) +* handle deleted blocks ([c1157db](https://github.com/continuedev/continue/commit/c1157dbf02f6750d385b28006c90202e6b159d5a)) +* Handle empty addedLines in revertDiff ([f280319](https://github.com/continuedev/continue/commit/f28031902f41c4ae9f7cab01398216272950b7d0)) +* handle line removal diff ([#1744](https://github.com/continuedev/continue/issues/1744)) ([6126eca](https://github.com/continuedev/continue/commit/6126eca35ab981c7b8cd6a56769dfe7cb9e69349)) +* handle optional params in EditSlashCommand ([#745](https://github.com/continuedev/continue/issues/745)) ([0141229](https://github.com/continuedev/continue/commit/014122957ff6e087b03def436b95797e59c6f6cb)) +* Handle status update in DocsService ([ac3df81](https://github.com/continuedev/continue/commit/ac3df814e45343b07f63c99e8710f4a6b185074e)) +* handle when dir might be a file path ([e43d3bd](https://github.com/continuedev/continue/commit/e43d3bda6aa833bfe686b8c84dfa64d43fa08748)) +* hardcode `fontSize` for tool call status msg ([f78969b](https://github.com/continuedev/continue/commit/f78969b147a8aecb5c9e5162d080cdafb3f4adb7)) +* hmr issues with non-react component exports ([0e55c08](https://github.com/continuedev/continue/commit/0e55c08be3ef5dcaec5305f41ae871ae6903b6c7)) +* hotkey for new session ([#572](https://github.com/continuedev/continue/issues/572)) ([1d3acd9](https://github.com/continuedev/continue/commit/1d3acd9f194802d78c99cd407bcb72543aa0ff19)) +* **HttpContextProvider:** support all possible local servers via a library ([c3b2552](https://github.com/continuedev/continue/commit/c3b2552ed5e47eef8dc2a691d5f76f30b61ceafd)) +* if rules ([a6dd5a8](https://github.com/continuedev/continue/commit/a6dd5a83dedcae099f320a2da9362490eadde299)) +* ignore CSV files ([#1972](https://github.com/continuedev/continue/issues/1972)) ([1272f34](https://github.com/continuedev/continue/commit/1272f3402a1fc12e5eb0566ad4a4aadc3db7dc06)) +* Implement RepoMapContextProvider ([48c442d](https://github.com/continuedev/continue/commit/48c442d1c687b15d5612786e87a09b016714abd6)) +* import posthog as type, use inline import ([57a84dc](https://github.com/continuedev/continue/commit/57a84dcfe16e3cdebea54f7a0b0fe354f0d8ad2b)) +* Improve error handling and ensure coroutines continue correctly in case of failure ([46bd573](https://github.com/continuedev/continue/commit/46bd573a4296bb8ce8dc4c43b7293ff575655e53)) +* improve textarea ux ([#1901](https://github.com/continuedev/continue/issues/1901)) ([228bc30](https://github.com/continuedev/continue/commit/228bc30e895b87e06c170775974c49e2781d9ae0)) +* include access to the Documents folder ([03839c3](https://github.com/continuedev/continue/commit/03839c30813f3242d9a1fce91f39af110d8d85a7)) +* incorporate feedback ([98efbbd](https://github.com/continuedev/continue/commit/98efbbd80f075928a45334f8cc4103221c2656c9)) +* incorrect scroll logic on inline edit ([ed3af3f](https://github.com/continuedev/continue/commit/ed3af3f3fc49f6678d8a1f940d06aa62bec1f4b5)) +* intellij freezing ([1f602e5](https://github.com/continuedev/continue/commit/1f602e53c29eb28d98754252823ad8f40f839d1b)) +* isRuleActive ([2b97efe](https://github.com/continuedev/continue/commit/2b97efe5c6d045b461c76068c0e06df298d95902)) +* issue 3732 ([ce5d664](https://github.com/continuedev/continue/commit/ce5d664f828de8681ee7129dfec3c16cad667c46)) +* **JB+GUI:** arrow keys in GUI on linux ([9110904](https://github.com/continuedev/continue/commit/9110904e7d4f727339666ce235388397b8c4ff99)) +* **jb:** meta keybinding issues ([b4dad78](https://github.com/continuedev/continue/commit/b4dad78a727feed0ce18769a8d3f9cfd00a3bd57)) +* **jb:** remove markup from `edit` model title ([f6d334a](https://github.com/continuedev/continue/commit/f6d334a190bf1132c33a68f472aaeb2e5389399f)) +* **jb:** set `setOffScreenRendering` conditionally ([fd66ff7](https://github.com/continuedev/continue/commit/fd66ff7d464d3138a127e2035bca88f6d42c4402)) +* **Jira Context:** add api abstraction ([cc9b960](https://github.com/continuedev/continue/commit/cc9b96038bb0b88156729d1c39e6eec1794fe76a)) +* jira ctx provider ([9d24d34](https://github.com/continuedev/continue/commit/9d24d3402f3e9f9937bfdff70fa5c4fa120b2dbf)) +* keyboard shortcuts test on linux ([e45aa16](https://github.com/continuedev/continue/commit/e45aa164c64a52936c7dd1c0467548aadf821639)) +* layout alignment ([#1779](https://github.com/continuedev/continue/issues/1779)) ([6e8fc12](https://github.com/continuedev/continue/commit/6e8fc1247c44c344a48db9758437cb7b3028591c)) +* lint ([f575721](https://github.com/continuedev/continue/commit/f575721980a596cdb08be8a2e472ca26e6012325)) +* lint ([3ba1153](https://github.com/continuedev/continue/commit/3ba1153243753682ca19b26031c2c3c73394b5f2)) +* lint ([03cd1a3](https://github.com/continuedev/continue/commit/03cd1a338f03fc1baa87feb02bd6e56111fc0b13)) +* lint ([747d380](https://github.com/continuedev/continue/commit/747d3806a99abf7f55823c2fbc06c74448ba3c1c)) +* linting error ([67ab058](https://github.com/continuedev/continue/commit/67ab05821191d75a201e516b725a679671f94734)) +* linux key ([9618327](https://github.com/continuedev/continue/commit/9618327cf45687f18aacdc04d62da86ce2d1e520)) +* linux test env ([9f2f9d8](https://github.com/continuedev/continue/commit/9f2f9d895b2fe6678f49e394e4657f044e2aef2a)) +* listbox z-index issue ([1d2bfcd](https://github.com/continuedev/continue/commit/1d2bfcd4b2ad7c3afef97348c55a1c668610ea07)) +* listDir ([a41a4bd](https://github.com/continuedev/continue/commit/a41a4bd2df5807bd216a4b23eabe8656ca098cdb)) +* **llm/Ollama:** changed buffer handling like in streamChat() ([f1f8967](https://github.com/continuedev/continue/commit/f1f8967b6c4b422428fcad0575c0b24ae78bf34a)) +* load last session when completing edits ([1e33400](https://github.com/continuedev/continue/commit/1e334008c08eb8796510ba6aaac434073c44b3b8)) +* local build script ([#810](https://github.com/continuedev/continue/issues/810)) ([76fe78a](https://github.com/continuedev/continue/commit/76fe78a1a3c05b0d6dd5ed6d15575e20e797cfa6)) +* log llm completition in edit command ([3094180](https://github.com/continuedev/continue/commit/30941800b04c59b9a45375d6934a4fb79cac0141)) +* logs ([e3cf75e](https://github.com/continuedev/continue/commit/e3cf75e0779d3bc02a468ea6551e2499979c08f7)) +* mac build issues ([9946a5c](https://github.com/continuedev/continue/commit/9946a5c05f85d20e2d766719a861eb0f8a55019c)) +* major fixes to getTheme ([c6002ba](https://github.com/continuedev/continue/commit/c6002ba2ac905bd5439173e6430676bdc3594a87)) +* make `env.apiVersion` required for azure openai ([4355618](https://github.com/continuedev/continue/commit/4355618079808bdfc3240022e79a0a9dd8457b02)) +* matching context code ([64fb928](https://github.com/continuedev/continue/commit/64fb928b8ff9c0f7753a8b8d374abc179de1f4d5)) +* mcp context provider bug with issue 2467 ([98f07be](https://github.com/continuedev/continue/commit/98f07bef818cf5acc4de2828cbeaa0b4b499fc53)) +* MDX compilation issue ([aca82d2](https://github.com/continuedev/continue/commit/aca82d2ef36a5bd57119343790875e2acf7819b3)) +* merge bugs ([009e578](https://github.com/continuedev/continue/commit/009e578416982a90af05539420a7137ccd2d03c1)) +* messages ([0b07020](https://github.com/continuedev/continue/commit/0b07020d7dd9bf59ca1d804668a215174273625b)) +* minor issues ([#581](https://github.com/continuedev/continue/issues/581)) ([570f61d](https://github.com/continuedev/continue/commit/570f61de5a404559b4ff69eb5cd2fa216e70e872)) +* missing arguments ([452b242](https://github.com/continuedev/continue/commit/452b2422d18c05dd28dbfa6fd127f4c3e0b0223c)) +* missing cd ([0d88b8f](https://github.com/continuedev/continue/commit/0d88b8f379d161962a72626fe2af583cce0f3fe0)) +* missing Content-Type header in OllamaEmbeddingsProvider ([#1855](https://github.com/continuedev/continue/issues/1855)) ([841294d](https://github.com/continuedev/continue/commit/841294d15f3ad6ea4a9f7cf277fbcb905d9bd978)) +* missing context items ([bdc2ec8](https://github.com/continuedev/continue/commit/bdc2ec8374ac9e7d14fc440ea80fa438005735e8)) +* missing env ([1ebd3a3](https://github.com/continuedev/continue/commit/1ebd3a31bab5ed31374518022c5f1b7658c379f2)) +* missing package ([e284cec](https://github.com/continuedev/continue/commit/e284cecd6584b14bee43794d0d238d64c734a10a)) +* missing useLegacyCompletionsEndpoint in yaml schema ([a4b4395](https://github.com/continuedev/continue/commit/a4b4395649e9fa7888f8204ddcf56b88632b5b90)) +* model name ([b1ec201](https://github.com/continuedev/continue/commit/b1ec2012c649ff29e84d6682234328e9c2fdb792)) +* models and mode are not synced ([57441da](https://github.com/continuedev/continue/commit/57441dad6696eeb6d4bd6d769aec06e389367a53)) +* modify access modifier public to private ([c36f233](https://github.com/continuedev/continue/commit/c36f23322265a0d9c28eb401acf49d76294a1249)) +* move autocomplete logic off of EDT ([c46083d](https://github.com/continuedev/continue/commit/c46083d4115a79938bc6ae2b9421f36803b0a992)) +* naming ([ba39842](https://github.com/continuedev/continue/commit/ba3984290ddb875608845904d31c5a5d57b1bf03)) +* naming ([42a03ad](https://github.com/continuedev/continue/commit/42a03ad020634a7c6be719a70bf40144582682dc)) +* naming ([fb1a75d](https://github.com/continuedev/continue/commit/fb1a75dcf33fa38863bda4f5b88c1a567aaf0269)) +* navigation bug ([fab5347](https://github.com/continuedev/continue/commit/fab53472a931b49d7f0c19af22263df6b54bc292)) +* not sure how that button fragment got there ([880f1de](https://github.com/continuedev/continue/commit/880f1de80d2bc33635cc9ebed01ae84e2c17c640)) +* number of completions to generate is not supported ([db90b09](https://github.com/continuedev/continue/commit/db90b0954b36e856258eed2b61af8bf107f13510)) +* old docs ([b52910b](https://github.com/continuedev/continue/commit/b52910b43351e5df8c07cfb27beca8fba5463074)) +* ollama tool use ([82ac684](https://github.com/continuedev/continue/commit/82ac6848cabca21122995460328b8f4420ae3222)) +* onboarding telemetry ([445dba3](https://github.com/continuedev/continue/commit/445dba3bb60654ac9c3f8d245f896d490574c3a1)) +* only alert free trial if using free trial ([f0e73ef](https://github.com/continuedev/continue/commit/f0e73ef63a8fd8bb7ce313f9ed5439c7c68969bf)) +* only perform lancedb cpu check for linux ([e0ee7d1](https://github.com/continuedev/continue/commit/e0ee7d1e446b18c05ed3166b0aa3b199ec021f1a)) +* open new session from any page ([258bbc6](https://github.com/continuedev/continue/commit/258bbc6b5cbbd3b897e8045df247bb2a1fc21f94)) +* overly eager suffix matching ([556a8c5](https://github.com/continuedev/continue/commit/556a8c5ee3f72311a384c64ba14fde7122e68741)) +* path ([d01f243](https://github.com/continuedev/continue/commit/d01f24309b490799014dca0fd03775c39745d660)) +* path ([3ecc89e](https://github.com/continuedev/continue/commit/3ecc89eaf55b970e1a494f88fed0850c4b85c565)) +* pathing issue in jb ([c33e390](https://github.com/continuedev/continue/commit/c33e390427e459a5426ee7669733c2b407649e40)) +* pause between tests to avoid db lock ([4cb84c1](https://github.com/continuedev/continue/commit/4cb84c11b09dac6eb0791e35b95ff6f571130391)) +* placeholder ([8ded13a](https://github.com/continuedev/continue/commit/8ded13a8f8e54df4951b547d468782117fb11b8b)) +* policy precedence ([de6a0ae](https://github.com/continuedev/continue/commit/de6a0ae36c43753e768bf0164dfbe1b938da790d)) +* preserve indentation in code blocks ([#1554](https://github.com/continuedev/continue/issues/1554)) ([574a392](https://github.com/continuedev/continue/commit/574a3923a6f97d8995561da3654aae3aca9ae439)) +* preserve system messages as user messages ([d60a1c1](https://github.com/continuedev/continue/commit/d60a1c1b1f3174cd501eca69746009bdeb4c6f7f)) +* prettier ([4d278e4](https://github.com/continuedev/continue/commit/4d278e479ae02f0d02ccff8db2448d6b38b3d3e5)) +* prevent autoscrolling on new tool msgs ([678a75f](https://github.com/continuedev/continue/commit/678a75f8f7b97b0f75407c6e1b1dd78c415d22eb)) +* Prevent duplicate context provider addition ([2d6eacb](https://github.com/continuedev/continue/commit/2d6eacbeab8eb89ddc32311ade4efe3ccb272bca)) +* Prevent multiple resumes in continuation ([1e96bfb](https://github.com/continuedev/continue/commit/1e96bfb9683fa0a45437f16b419be066917351cb)) +* Promise arrays being returned. Added a new definitions-only context provider. fix: typescript tagging. ([#835](https://github.com/continuedev/continue/issues/835)) ([00eeb00](https://github.com/continuedev/continue/commit/00eeb0024178953172941bba293808be4ca5eed2)) +* prompt format ([0f6d280](https://github.com/continuedev/continue/commit/0f6d280234c459e1935b62e5244f4577d64fac53)) +* promptblock parsing ([eb6735e](https://github.com/continuedev/continue/commit/eb6735ee25da93e01a7b09223960b8975b41d898)) +* Properly ignore ignored folders when generating /onboard context ([f7bca6a](https://github.com/continuedev/continue/commit/f7bca6a61d56b6e17b100294e605d0e2bbe0239b)) +* protocols ([c8a24c0](https://github.com/continuedev/continue/commit/c8a24c0c9040a0da02bdd215b77b0320c160256f)) +* qwen completions missing whitespaces ([75dce9c](https://github.com/continuedev/continue/commit/75dce9cbd14cc374d1ce4921522f3423202be7b1)) +* **reg:** :ambulance: remove log except when in NODE_ENV === "test" ([f60fd1c](https://github.com/continuedev/continue/commit/f60fd1c6188567c67d3d8285fd6c2c5d6acc5bfa)) +* regex ([05a3eec](https://github.com/continuedev/continue/commit/05a3eec21ed1c26aa4d9825e6be5e209cdb9563c)) +* reject logic ([5944fca](https://github.com/continuedev/continue/commit/5944fca7374851869e469ed1cd3f13056de5c8b3)) +* remove `any` from promptTemplate passing ([7834d26](https://github.com/continuedev/continue/commit/7834d266330625915542913f2d44ac0d80875d7e)) +* remove debugger statement ([3e4c75b](https://github.com/continuedev/continue/commit/3e4c75bf461c36c2200ac2922670bb76a612b292)) +* remove deugger ([3e8e29e](https://github.com/continuedev/continue/commit/3e8e29e8f2ce18e138df64441e436d3a07ffa45e)) +* remove duplicated context comments ([0c217a4](https://github.com/continuedev/continue/commit/0c217a40082c2c244de4f4f8c955d96314f130da)) +* remove gifs from media ([77d321f](https://github.com/continuedev/continue/commit/77d321ff82dcd34b55d0a0253eb45672be774fe1)) +* remove invalid schema ([2355eb6](https://github.com/continuedev/continue/commit/2355eb62a5c3c5034b528ab17e8ad7a0b661bc7c)) +* remove mismatch between last selected profile and current profile ([d9eb118](https://github.com/continuedev/continue/commit/d9eb118c514fc2a4364f532eb6438588fc9f712c)) +* remove some backup files generated by pkg if present ([#1287](https://github.com/continuedev/continue/issues/1287)) ([9f160ad](https://github.com/continuedev/continue/commit/9f160ad11a1d36bfc92d2da2a8ea31721652b3e4)) +* remove stale code ([cd97833](https://github.com/continuedev/continue/commit/cd97833be88ecaf3c2860dc41ca57c9e2b18ad48)) +* remove testing logic ([5df8177](https://github.com/continuedev/continue/commit/5df81770df526c69dd71f2421a9052deb17accf6)) +* remove tooltips when switching files ([200d291](https://github.com/continuedev/continue/commit/200d29103ea97db06283f2d4b5e0eb9b6afb86df)) +* remove unnecessary baseUrl ([5f159fb](https://github.com/continuedev/continue/commit/5f159fbd81c4b8680cbad8b3875aa54e2079928e)) +* remove unused argument ([7dd2c22](https://github.com/continuedev/continue/commit/7dd2c22632d50726271655d5c5d027a8219e6862)) +* remove unused imports ([1b82d39](https://github.com/continuedev/continue/commit/1b82d39ac5b8e0cfb990a4968b3e8bc81af768ce)) +* rename edit folder ([ab1ad0a](https://github.com/continuedev/continue/commit/ab1ad0ae48eeceee87043cae9a7862a1c4f70da0)) +* replace null with empty string in getSidebarContent function ([#822](https://github.com/continuedev/continue/issues/822)) ([50d1188](https://github.com/continuedev/continue/commit/50d1188479be206d1a4ed5dcd258d4101ae4f8ba)) +* report indexing errors in webview ([6a67514](https://github.com/continuedev/continue/commit/6a67514fcf108bd0eb6989777abaed02ce2e61e7)) +* reset config errors ([cc199c2](https://github.com/continuedev/continue/commit/cc199c28634d006d38416533b06f26e001cea3fe)) +* Resolve proxy error when adding Azure OpenAI model ([17dbfe6](https://github.com/continuedev/continue/commit/17dbfe6bfd38f67b7cb535da00fa626cdaf4f690)) +* Resolve type error in env comparison ([45eacf4](https://github.com/continuedev/continue/commit/45eacf4ebbd99a97eef32eef01d780a1f8c57b7a)) +* Resolved errors related to incorrect URIs ([0a7da20](https://github.com/continuedev/continue/commit/0a7da2067e8d8567084d05f69038b7ca95464d1f)) +* restore all e2e tests ([d3a6eeb](https://github.com/continuedev/continue/commit/d3a6eebeb7b5d96133d1c13e533913dc5ec2f19c)) +* restore cache ([91ea00d](https://github.com/continuedev/continue/commit/91ea00d284227f3875daf17591b15409004372ac)) +* restore comments ([067a3a8](https://github.com/continuedev/continue/commit/067a3a843baf5a0e12bd5b6f21f37a504836286c)) +* restore tests ([553c751](https://github.com/continuedev/continue/commit/553c751562afb736fb914549ba3d2c75e5a4b305)) +* return ctx items from prompt file ([84df7f4](https://github.com/continuedev/continue/commit/84df7f45bf91c70da79901c0a44cc3b156655f6f)) +* revert file changes ([7a44a38](https://github.com/continuedev/continue/commit/7a44a38c860cfbd0eeab35d8fdb3cb198edad680)) +* Revert filepath changes ([3df34b7](https://github.com/continuedev/continue/commit/3df34b725e873fcd42058474d83ef634e21d5cad)) +* revert launch.json change ([b3abfb8](https://github.com/continuedev/continue/commit/b3abfb80d71c16a0e51cc980d4262dbd218d6463)) +* reverted the url of llama.cpp back to 'completion'. ([e8523a2](https://github.com/continuedev/continue/commit/e8523a2b07c7a5d1539138ee8e4a4836fea7a36b)) +* rules ([bcae5b3](https://github.com/continuedev/continue/commit/bcae5b3cf210f1a8ced3b2c913961ed16aaf2ea9)) +* rules ([9e57412](https://github.com/continuedev/continue/commit/9e57412fe161a9451aaaa651a9f9ed2d7b6b5517)) +* rules ([f29110f](https://github.com/continuedev/continue/commit/f29110f98b1c71f4832d6b7ff0041e342e2a0c4a)) +* rules ([b39cb83](https://github.com/continuedev/continue/commit/b39cb836ad6180226d39abe85f5637a6e2dac44d)) +* sanitize lance table names ([5d3b2cb](https://github.com/continuedev/continue/commit/5d3b2cb5070505578cc16e67d2309a40a403bc94)) +* scaffolding for future language syntax highlighting ([647656c](https://github.com/continuedev/continue/commit/647656cd3d007c016bea372bdfcb5d69f9d1d52a)) +* scroll issues w/ code blocks ([#1688](https://github.com/continuedev/continue/issues/1688)) ([ceb8da0](https://github.com/continuedev/continue/commit/ceb8da0b20db70707a3443ff6f705bba6922488d)) +* scroll to the bottom on history change ([b94ccc6](https://github.com/continuedev/continue/commit/b94ccc6db557f705ba4f810ed56c55ce21f383dd)) +* selected profile id writing to global context in org profile rectification ([47755d1](https://github.com/continuedev/continue/commit/47755d1cba3b8c7cb5c0b9a19bf8ca0a92eec850)) +* selector for `isSingleRangeEdit` ([badeb1c](https://github.com/continuedev/continue/commit/badeb1c88b7e1f8eb711a8a2cfc8f341ac22f67e)) +* send feature flags ([2e3fdb3](https://github.com/continuedev/continue/commit/2e3fdb34e2e2358232cc12fcf0a0c2d16a3ef0cc)) +* serve to localhost ([7eccf2d](https://github.com/continuedev/continue/commit/7eccf2ddb9308111686251474fb79fa03dfc87d6)) +* set DEFAULT_CONTEXT_LENGTH to 8192 ([f163768](https://github.com/continuedev/continue/commit/f1637685c651180d1fc969c2f11712fda69eb9ee)) +* settings persistance ([56f3803](https://github.com/continuedev/continue/commit/56f38038b35cedc2aa1bca1b09780b21c811bd83)) +* setup ([6a93eae](https://github.com/continuedev/continue/commit/6a93eaeb0faf685dff216ecca850f9b2ef3cf2c3)) +* show error is GH sign in failed in vscode ([e92e052](https://github.com/continuedev/continue/commit/e92e052b16fb91173aa4dc85d4e80fa569b8e60a)) +* sign in ([fa5d2c5](https://github.com/continuedev/continue/commit/fa5d2c5aa2cdcc580486f81fde3ae69e9d3069e5)) +* sign in btn + colors ([1b669bf](https://github.com/continuedev/continue/commit/1b669bf80e2d81e4aa19c4d3f2dca730ddd6d4f8)) +* Skip duplicate checks at document end or blank text ([decd04e](https://github.com/continuedev/continue/commit/decd04eddd4965b9f76c7a9a3abd276d8d2e1692)) +* snippets in fim prefix ([51e1c42](https://github.com/continuedev/continue/commit/51e1c4216baa38d73141aca1d1e681eabf044b4b)) +* some typos ([#478](https://github.com/continuedev/continue/issues/478)) ([775d051](https://github.com/continuedev/continue/commit/775d051b4bcdbe07fbd38fae4d3e36e79234eb56)) +* spread tool degs ([4ddd275](https://github.com/continuedev/continue/commit/4ddd2755996012677c15069648158bd4334fa3dd)) +* sqlite binary build on fresh clone ([#1433](https://github.com/continuedev/continue/issues/1433)) ([d124aa0](https://github.com/continuedev/continue/commit/d124aa0534303b58b55bcc2de4ec460b4f499178)) +* stream ([c497517](https://github.com/continuedev/continue/commit/c49751713248e27f060b6eee11179e13b14c5adf)) +* system message ([c2707c6](https://github.com/continuedev/continue/commit/c2707c6988a9b6368f183f0602de0cc2872726da)) +* test ([7266efb](https://github.com/continuedev/continue/commit/7266efb4e8490accd69ad5818bd9c35fe6f59e5c)) +* test env path ([71a151f](https://github.com/continuedev/continue/commit/71a151f399d514497ee917eca521863d07b2a270)) +* test timing ([878e211](https://github.com/continuedev/continue/commit/878e2116d6a97c31cad97432d785aaf3b6deb196)) +* tests ([35c674c](https://github.com/continuedev/continue/commit/35c674c724c21c6dc0b699a37f868e68c62f1259)) +* tests ([cafb2e9](https://github.com/continuedev/continue/commit/cafb2e93c7a54b4a35ecc8a209f53982b3cc26d4)) +* tests ([b786591](https://github.com/continuedev/continue/commit/b786591415d79119845e01376bf5dc97c0676b23)) +* tests ([ff543e8](https://github.com/continuedev/continue/commit/ff543e8b321e4e48a088ba296ebac4504b97356b)) +* tests ([81acb44](https://github.com/continuedev/continue/commit/81acb446019a773ce2df98467e4dcb8e5c2a428e)) +* tests ([deea8f1](https://github.com/continuedev/continue/commit/deea8f1f44403b6d7d7bb4236ff5acb8d38bca01)) +* The selected item in inline chat is always the first one ([97bc074](https://github.com/continuedev/continue/commit/97bc07453ba067f0438192d8dc6cc1cc9a86d962)) +* timeout ([b9f161f](https://github.com/continuedev/continue/commit/b9f161f6d8b4e7400dff25912881f41f472a9137)) +* timeouts ([0bf9169](https://github.com/continuedev/continue/commit/0bf9169a968a42dfc083696b3e8be5f1997ad7e5)) +* timeouts ([0c4d9eb](https://github.com/continuedev/continue/commit/0c4d9eb819b9f1a41cddd7d0b84dc0e21ee372e9)) +* timeouts ([4c90f3b](https://github.com/continuedev/continue/commit/4c90f3bdd32761b7f34a6f05334dffc085805964)) +* tip tap undo and redo ([88e34fb](https://github.com/continuedev/continue/commit/88e34fb69caae3750621f9f93253a7425535928f)) +* tool use call ([c73f72f](https://github.com/continuedev/continue/commit/c73f72fbb379dae08aa41ac07608d9dc2aa8bc83)) +* transpile dynamic imports to cjs ([#1975](https://github.com/continuedev/continue/issues/1975)) ([1e3e8eb](https://github.com/continuedev/continue/commit/1e3e8ebe408de1bbb5f9fe0dc61fefef3b85ca69)) +* truncate `tagToString` to max filename len ([afb6bd0](https://github.com/continuedev/continue/commit/afb6bd0fb53505e29e961f5a78f0afe36c3b3071)) +* ts ignore declaration file issue w/ dbinfoz ([#1945](https://github.com/continuedev/continue/issues/1945)) ([477ecd6](https://github.com/continuedev/continue/commit/477ecd63acc85be25ec992d4329f6460c42c6785)) +* tsconfig ([8549981](https://github.com/continuedev/continue/commit/8549981e200e7e62f4a5895babc1c87c45b59db0)) +* type errors ([f976e54](https://github.com/continuedev/continue/commit/f976e54dc3b2b8072aef3ecadf259ee1e5299956)) +* type errors ([f575a36](https://github.com/continuedev/continue/commit/f575a3683c499f04766ac68af6b8e214ed2c3514)) +* type errors ([cd82f4c](https://github.com/continuedev/continue/commit/cd82f4c61fdff90c8ed0e845a3b2ee8b0ce1be9d)) +* type errors ([ea6b234](https://github.com/continuedev/continue/commit/ea6b2344d0b2cde7def58de549e604142a40a353)) +* type errors ([f19b6b8](https://github.com/continuedev/continue/commit/f19b6b8abdb4dfb64c804efee851dee0bb00471c)) +* type errors ([5c49505](https://github.com/continuedev/continue/commit/5c49505f2071504481c17976670d883efebddb4a)) +* type errors ([cdc9600](https://github.com/continuedev/continue/commit/cdc9600e689161877ff7416f63baa9dcbfa6c18a)) +* type errors ([7ee4d8d](https://github.com/continuedev/continue/commit/7ee4d8db505924a4d0edd5ef3ac49f4bb9a706b6)) +* type errors ([70ae585](https://github.com/continuedev/continue/commit/70ae58594cd136e16a53fcfde88a227dbec1104f)) +* type errors ([34489b1](https://github.com/continuedev/continue/commit/34489b14de0fc1c5cfb300a624b3b8571372e532)) +* type errors / formatting ([9dba473](https://github.com/continuedev/continue/commit/9dba4730b958e05ffad6e0bab74effefd228cd6c)) +* types ([7b9c5cc](https://github.com/continuedev/continue/commit/7b9c5cc4f062e2882706919b1effe34a460f45b8)) +* types ([82cad59](https://github.com/continuedev/continue/commit/82cad596c85d0ee0b17ceccdf1f6cca5811b8f94)) +* types ([5faecca](https://github.com/continuedev/continue/commit/5faecca09f27a7490b4050b7191197c74fe38299)) +* types ([be27552](https://github.com/continuedev/continue/commit/be27552e3330b3a18ecb1065b6ab7210a4375826)) +* types ([4b120e5](https://github.com/continuedev/continue/commit/4b120e543e7c2cec0d33714cfebe88800604fbfd)) +* types ([44212e4](https://github.com/continuedev/continue/commit/44212e45828bb72c035bf63de4c13342935dcf0f)) +* types ([72b253d](https://github.com/continuedev/continue/commit/72b253d14faf2d19832b0307fb4fba1e9aed11dd)) +* types ([a88f5d7](https://github.com/continuedev/continue/commit/a88f5d771ced366926c9d6d821c697e52847a2f9)) +* types ([41a7916](https://github.com/continuedev/continue/commit/41a79166aadc2bbbe80145d12bfeb1336d94c7e2)) +* typo ([be874ad](https://github.com/continuedev/continue/commit/be874addb463f7db81c43b52f6e69f9de1c11fa3)) +* **typo:** customize overview doc ([d4dfb69](https://github.com/continuedev/continue/commit/d4dfb699af1f5bffc923a5d850f877ed45ad74a6)) +* undefined in title ([dcdfa59](https://github.com/continuedev/continue/commit/dcdfa59db43ae4e864e5cb1ca04b6804cca64d2f)) +* unnecessary dependency ([ade83fd](https://github.com/continuedev/continue/commit/ade83fd0c6b3f2d3bb8175b6bdbdc0a6e9735c5b)) +* unnecessary scroll delay ([183ae03](https://github.com/continuedev/continue/commit/183ae03ee37ba6629201211e9a63fbcb04ebc527)) +* unset system message ([4480ee3](https://github.com/continuedev/continue/commit/4480ee3ac358e60182304e0e052c27ae45815e2f)) +* update adf2md package ([ecbc123](https://github.com/continuedev/continue/commit/ecbc1234f7419f7921b31354594e5841363c54f5)) +* Update Amazon Bedrock documentation and categorization ([b156d8f](https://github.com/continuedev/continue/commit/b156d8fd4c103e520ad720853752a4f9033ef68f)) +* update CodebaseIndexer path ([#1870](https://github.com/continuedev/continue/issues/1870)) ([00d19e6](https://github.com/continuedev/continue/commit/00d19e623f8abb04fc4a022d354a909e2087aa3c)) +* update imports in CodeSnippetsIndex.ts ([434e4ee](https://github.com/continuedev/continue/commit/434e4ee44b513db15d502c6a9d52ceb17fa805c3)) +* update install script ([91f87f8](https://github.com/continuedev/continue/commit/91f87f8fd0ca328a91c9fd033c58fd5d2db02892)) +* update intellij getDiff to return string[] ([1672d9f](https://github.com/continuedev/continue/commit/1672d9f864e99436b8f309af3529f2fda341172d)) +* update snippets index to upsert cmds ([676f0d9](https://github.com/continuedev/continue/commit/676f0d9335df7bf7f42aae3434847cc0032c3c0a)) +* update spacing ([a9d6597](https://github.com/continuedev/continue/commit/a9d6597a3fa054d093cb63fa5859e24b8f8d571b)) +* update streamId matching ([8a1ce0f](https://github.com/continuedev/continue/commit/8a1ce0f1f06e92b7bd140d7eabd8393dc5993fea)) +* update streamResponse function to use streaming decoding ([#1436](https://github.com/continuedev/continue/issues/1436)) ([2d1155d](https://github.com/continuedev/continue/commit/2d1155d7d4441042480bf928398b7a15a58d92d2)) +* uri utils ([f1026c6](https://github.com/continuedev/continue/commit/f1026c6a2cfdd9424097d2103a5ffc2216e402d9)) +* use `cmd` for windows MCP connections ([b8ca4cb](https://github.com/continuedev/continue/commit/b8ca4cb6ee91670e87ae331f5e4bab24a42adbe6)) +* use bolt icon for shortcuts ([ff2116b](https://github.com/continuedev/continue/commit/ff2116bacc4537e09792ce9817b68e9cdfacb93e)) +* use dir hash in `tagToString` ([9c2a780](https://github.com/continuedev/continue/commit/9c2a780fa986f5f98c3231a12971d3f16c7a8e74)) +* use exponential backoff when checking ollama ([ebbc2fd](https://github.com/continuedev/continue/commit/ebbc2fd55df1fc43e1eacceba042fa4c0bc38e77)) +* use ide scheme auth redirect ([bae74c1](https://github.com/continuedev/continue/commit/bae74c1b324b51c2e9b14b548f92557c75025f51)) +* use index when sending chat input ([9398945](https://github.com/continuedev/continue/commit/93989459e3806f1ba6d647036dc9db064bf30e38)) +* use introduction layout ([2b71869](https://github.com/continuedev/continue/commit/2b7186973695703a48daacea46c076231d308ddf)) +* Use MCP server_name from JSON config as display name ([481d60a](https://github.com/continuedev/continue/commit/481d60a74d9b7cd0492aa5875d89e5b4e2e00c51)) +* use new edit for "Generate code" cmd ([aac6f80](https://github.com/continuedev/continue/commit/aac6f805eb35107e7d8754413d955ccfeb964576)) +* use prompt file sys msg ([093225d](https://github.com/continuedev/continue/commit/093225d4fed4d5249ca506b9867f5b5305ca4003)) +* use proper alternating colors in KeyboardShortcuts.tsx ([f1bfcec](https://github.com/continuedev/continue/commit/f1bfcec8257c2b3f99fa99a643b0464239600490)) +* vitest ([3bc4bb7](https://github.com/continuedev/continue/commit/3bc4bb710cfb2d9ef340a61f7c0ca27cb2540a28)) +* vitest ([ceeb87e](https://github.com/continuedev/continue/commit/ceeb87e81b8848517dfc604025f11bf46e1955b0)) +* **vscode:** handle null values for edits and page in getSidebarContent ([#618](https://github.com/continuedev/continue/issues/618)) ([f8a02ad](https://github.com/continuedev/continue/commit/f8a02add1775805246410ee3df396a4028ff2ec9)) +* **vscode:** improve forceAutocomplete command reliability ([cc50768](https://github.com/continuedev/continue/commit/cc507687eb36be5b7fd59eac433a9a908c1ee07e)) +* **vscode:** keybinding full screen toggle shortcut ([#625](https://github.com/continuedev/continue/issues/625)) ([2921504](https://github.com/continuedev/continue/commit/292150476c1cfcace2f6434d11c3a2dab1e5ccdb)) +* wait for permissions before initializing messenger ([7d16b8a](https://github.com/continuedev/continue/commit/7d16b8a870ebf5348713fb116c109a646fe7c79e)) +* wait for sidebar before other commands ([1566adc](https://github.com/continuedev/continue/commit/1566adcaeb3bc5258a563b208a511cdfb3938d7a)) +* watcher ([f41c819](https://github.com/continuedev/continue/commit/f41c8194fc11da9c76de0531cccd73df78a4b1c2)) +* watcher ([be153f8](https://github.com/continuedev/continue/commit/be153f8ab966e210d6249ff179c4ec1580507d88)) +* whitespace in new line completions ([4db2637](https://github.com/continuedev/continue/commit/4db2637d5b65d427e959b7fd607a65ce4140c355)) +* workflow ([e5fb4f1](https://github.com/continuedev/continue/commit/e5fb4f17ad9d3b6e72d6c7e0920357e607c0e776)) +* wrap editor buttons when out of space ([#1727](https://github.com/continuedev/continue/issues/1727)) ([b38ec0e](https://github.com/continuedev/continue/commit/b38ec0e6153e9077d1e39dfd7a453746da31c75b)) +* wrong shortcut for JB ([b358be2](https://github.com/continuedev/continue/commit/b358be2cfb798bfb6646f5015117199e2ad3a6e2)) + + +### Features + +* :adhesive_bandage: ca_bundle_path for maybeproxyopenai ([1018cd4](https://github.com/continuedev/continue/commit/1018cd47306f95dde35e1a0cc6b2a830444af389)) +* :adhesive_bandage: QueuedLLM for simultaneous reqs (LM Studio) ([e9d2891](https://github.com/continuedev/continue/commit/e9d289173ec28a1a90ae58b1834c476bb46834b8)) +* :art: custom prompt templates per model ([2e69e11](https://github.com/continuedev/continue/commit/2e69e117e198698f57bda06794cf030afbfe69e9)) +* :art: small changes to /codebase ui ([1b68904](https://github.com/continuedev/continue/commit/1b689046a7f9323c7bd56e14d403675db0b38d54)) +* :bricks: Enable terminals for additional vscode Remote Host Types ([1500281](https://github.com/continuedev/continue/commit/1500281bb547f7308aa7316f6783072e4f81fbc1)) +* :bug: kill old server if needed ([a34046b](https://github.com/continuedev/continue/commit/a34046bbbe817f81cd6d8b7ff9025413589571aa)) +* :children_crossing: display troubleshooting link when loading ([698dccf](https://github.com/continuedev/continue/commit/698dccf474619963de0312d36af6d01e3df8b47a)) +* :children_crossing: drag continue to right bar tip ([04b1fde](https://github.com/continuedev/continue/commit/04b1fde6ea77e7698870063c3f588da93d763544)) +* :children_crossing: keep file context up to data by listening for filesystem events ([#396](https://github.com/continuedev/continue/issues/396)) ([b6435e1](https://github.com/continuedev/continue/commit/b6435e1e479edb1e4f049098dc8522e944317f2a)) +* :children_crossing: more keyboard shortcuts ([bd202df](https://github.com/continuedev/continue/commit/bd202df41755c581844d0ab1773ba55968b15450)) +* :children_crossing: sort history by reverse date ([fd77a4b](https://github.com/continuedev/continue/commit/fd77a4bd6b255260d0f4cad11947b38f4d30030e)) +* :children_crossing: tip to debug ([ec74169](https://github.com/continuedev/continue/commit/ec741697c42745d29539be08bc3e01dcd86b1643)) +* :construction: create new sessions ([19060a3](https://github.com/continuedev/continue/commit/19060a30faf94454f4d69d01828a33985d07f109)) +* :construction: first work on URLContextProvider ([6467759](https://github.com/continuedev/continue/commit/6467759012a139e76dcf022a681355f7d310a30d)) +* :construction: react-router-dom work ([31e7c98](https://github.com/continuedev/continue/commit/31e7c9828f985eceb16b4c9c749cc5d4d9fd5beb)) +* :construction: Router and new history page ([f19345c](https://github.com/continuedev/continue/commit/f19345c652cfcf1bdf13d0a44a2f302e0cd1aa4c)) +* :construction: successfully loading past sessions ([c255279](https://github.com/continuedev/continue/commit/c25527926ad1d1f861dbed01df577e962e08d746)) +* :construction: work on EditableDiv - better ctx prov. UI ([e33d579](https://github.com/continuedev/continue/commit/e33d579a1d2b643842827925d032c3de92cf5217)) +* :egg: getting to know users form ([5dcdcd8](https://github.com/continuedev/continue/commit/5dcdcd81da2050825212e216bf5e7e69678d8c6e)) +* :fire: fix duplication in reference ([1e3c8ad](https://github.com/continuedev/continue/commit/1e3c8adabba561eeef124144f3a2ef36d26334b4)) +* :globe_with_meridians: alpaca chat template ([568771d](https://github.com/continuedev/continue/commit/568771d9b94280f1cb47aae863e8faf168eb052b)) +* :green_heart: ship with binary ([2751dde](https://github.com/continuedev/continue/commit/2751ddeb2dd8150a0d7de6c5b65e275e1aa0e155)) +* :lipstick: add context button (plus icon) ([2b35e5f](https://github.com/continuedev/continue/commit/2b35e5f5cff948ca7d4f207b23db68f0da248a95)) +* :lipstick: add textgenwebui as official option in Ui ([09ac7a7](https://github.com/continuedev/continue/commit/09ac7a7fc07d915ac6f3ef96c8e8d1894b7719b9)) +* :lipstick: better loading experience ([e19c918](https://github.com/continuedev/continue/commit/e19c918bb1c517a6a119ae8437c46e0724d2be9d)) +* :lipstick: fixed footer and change button color ([48b8f1f](https://github.com/continuedev/continue/commit/48b8f1f0ad89a2b4e35f49c360576dd5aa99a7c0)) +* :lipstick: gallery banner color ([0647a43](https://github.com/continuedev/continue/commit/0647a43a24c50ff0e52f23c49d979bddfcfbcd87)) +* :lipstick: handful of UI improvements ([ceafdf1](https://github.com/continuedev/continue/commit/ceafdf18c9d9f0f8769d4a9e45c8a407179161c5)) +* :lipstick: improvements to keyboard shortcuts ([7bf8e5b](https://github.com/continuedev/continue/commit/7bf8e5b56a518979bc1d2602b8eb4a2caf2b5fdb)) +* :lipstick: more ui improvements ([f9a84bd](https://github.com/continuedev/continue/commit/f9a84bd2d65b3142cbcfcdd8e1e9394c9d4b458e)) +* :lipstick: more ui improvements ([6e3ff01](https://github.com/continuedev/continue/commit/6e3ff0173e79f5374da9962c964559e0fb7165f5)) +* :lipstick: nested context provider dropdown ([8d423fd](https://github.com/continuedev/continue/commit/8d423fd8d1d5b136e8138a906e8594ab93ec1982)) +* :lipstick: nicer "continue server loading" UI ([8070ce1](https://github.com/continuedev/continue/commit/8070ce17c6d666436df38c684f5868ee7f689422)) +* :lipstick: query input indicator for ctx provs ([4362a51](https://github.com/continuedev/continue/commit/4362a51214a683bfe1efd424ddb226d4e636eeed)) +* :lipstick: setting to change font size ([4ea1760](https://github.com/continuedev/continue/commit/4ea176007d2228364d4d3fa4519898047cef988f)) +* :lipstick: small ui tweaks, detached child process ([0181d62](https://github.com/continuedev/continue/commit/0181d6236d8b74c80adb62648fd6571431cf3210)) +* :lipstick: sticky top bar in gui.tsx ([ef86d66](https://github.com/continuedev/continue/commit/ef86d661d54295c1abb9712557080f1838f96b33)) +* :lipstick: UI Improvements! ([ae058c6](https://github.com/continuedev/continue/commit/ae058c6bac7ea37108e2894e419a22dfb95fd3ff)) +* :lipstick: update icon and description ([92e7c9b](https://github.com/continuedev/continue/commit/92e7c9bb627a5559769e0eca23e02e106d2cfe96)) +* :lipstick: update marketplace icon for pre-release ([cc98ad8](https://github.com/continuedev/continue/commit/cc98ad86d561d26c97dfdb24607a1d70afbcd2a1)) +* :loud_sound: add context to dev data loggign ([8ac1518](https://github.com/continuedev/continue/commit/8ac15184aaa30d13bf168ff5123a12fb7a2dd39f)) +* :loud_sound: display any server errors to the GUI ([daabebc](https://github.com/continuedev/continue/commit/daabebcc5d6df885a508582c0ca13e659305d2ff)) +* :loud_sound: fallback unique id when vscode returns someValue.machineId ([c479442](https://github.com/continuedev/continue/commit/c47944260c5600e49d83568b3c4bafa3b7c2a37e)) +* :loud_sound: give users access to Continue server logs ([5d97349](https://github.com/continuedev/continue/commit/5d973490687c40922f2b7a2ddf2a3e19c207eb0f)) +* :loud_sound: light telemetry or context providers ([2959042](https://github.com/continuedev/continue/commit/2959042fa5a940aa4e8851b9d4db91f0f86092ff)) +* :loud_sound: telemetry for vscode vs. jetbrains ([257cef6](https://github.com/continuedev/continue/commit/257cef697c93d2f2f59936587834908bd69ae842)) +* :memo: embeddings experimental walkthrough ([e1ce1fe](https://github.com/continuedev/continue/commit/e1ce1fefee6a3f4c17ac568ba87cb7a4bcf65795)) +* :memo: note about where session data is stored ([8ada89b](https://github.com/continuedev/continue/commit/8ada89b0f66f9e746394ee64591359537fe0c7f0)) +* :money_with_wings: free trial usage indicator ([354a3f4](https://github.com/continuedev/continue/commit/354a3f493074b1fb63ff4f206a94c35f05673e99)) +* :mute: complete removal of telemetry when allow_anonymous_telemetry false ([ae7dffa](https://github.com/continuedev/continue/commit/ae7dffa211af209aea2ca13b37729e390047dd7c)) +* :necktie: allow timeout param for OpenAI LLM class ([404f7f8](https://github.com/continuedev/continue/commit/404f7f8089190d04c05957dc653baff44f342dc7)) +* :recycle: load preset_urls at load_index ([3dabc4b](https://github.com/continuedev/continue/commit/3dabc4bd6c72e2d12afb059040ca75f606e47d9d)) +* :rocket: headers param on LLM class ([e16b8ff](https://github.com/continuedev/continue/commit/e16b8ff5f2d9187f2b207addc1cd70d0cacbf9c8)) +* :sparkles: [@terminal](https://github.com/terminal) context provider ([40cfabb](https://github.com/continuedev/continue/commit/40cfabb8ce8afe20e51ca4bafddc6a0b4755bf2c)) +* :sparkles: /cmd slash command ([011877c](https://github.com/continuedev/continue/commit/011877c09e88ffcc715defc33e5c74c71ccc8aea)) +* :sparkles: /share slash command ([4e38043](https://github.com/continuedev/continue/commit/4e3804351b76cc763d904f572ad525b651d8bc00)) +* :sparkles: add edit templates to model packages ([1de976a](https://github.com/continuedev/continue/commit/1de976a6a11a0b945d59800b5a58f354808a49fc)) +* :sparkles: add max_tokens option to LLM class ([ff2a397](https://github.com/continuedev/continue/commit/ff2a3978a1e2c95a4e288b56411bf0c32b86757b)) +* :sparkles: add searchcontextprovider to default_config.py ([64f41fc](https://github.com/continuedev/continue/commit/64f41fc8a0a2616fe7074d0a49e7642fd462c95d)) +* :sparkles: add stop_tokens option to LLM ([a16ba7a](https://github.com/continuedev/continue/commit/a16ba7a0166dbf9062ee4616e3ccfbff377e9f4b)) +* :sparkles: Add support for Claude Sonnet 4 ([b24a76f](https://github.com/continuedev/continue/commit/b24a76fdabb5eccada838d8fe5ed5834c0120df1)) +* :sparkles: add urlcontextprovider back to default config ([570891e](https://github.com/continuedev/continue/commit/570891e0201769defeabec95a58c997f6d5f3889)) +* :sparkles: allow AzureOpenAI Service through GGML ([1343d12](https://github.com/continuedev/continue/commit/1343d1227cc86c860fb12695e64eaeae1384f72a)) +* :sparkles: allow changing the summary prompt ([5c8b28b](https://github.com/continuedev/continue/commit/5c8b28b7fddf5b214de61102c768ef44d4087870)) +* :sparkles: allow custom OpenAI base_url ([cb0c815](https://github.com/continuedev/continue/commit/cb0c815ad799050ecc0abdf3d15981e9832b9829)) +* :sparkles: alt+cmd+d to automatically debug terminal! ([d0483ba](https://github.com/continuedev/continue/commit/d0483ba15b4ad13399a3385ae351cf33cca3db7f)) +* :sparkles: auto-reload for config.py ([e652e90](https://github.com/continuedev/continue/commit/e652e90806b84eb409c496dd0903a4817243edc2)) +* :sparkles: autoscrolling ([e6d369f](https://github.com/continuedev/continue/commit/e6d369f4312f0c8d175251e149c62d08608cb18c)) +* :sparkles: back button on history page ([aafa5d5](https://github.com/continuedev/continue/commit/aafa5d5ec91a533f70d644e4d3fadd6f388c3e4b)) +* :sparkles: change proxy url for openai class ([32a9a47](https://github.com/continuedev/continue/commit/32a9a477d33acd5cdde08164ebeb355b27a656b5)) +* :sparkles: codelens in config.py ([58cd4db](https://github.com/continuedev/continue/commit/58cd4db2534aba9fed98925e68dc342efbc54fb0)) +* :sparkles: Continue Quick Fix ([9af39a6](https://github.com/continuedev/continue/commit/9af39a67829a6770b93ffdaa6ea70af3125c7daf)) +* :sparkles: Continue Quick Fix ([52cd93a](https://github.com/continuedev/continue/commit/52cd93ad73f7df6a5140b7d629e4f6e473dc0380)) +* :sparkles: delete context groups ([2d3d96e](https://github.com/continuedev/continue/commit/2d3d96e5b55a225eb97251850909eb7a0a7242ed)) +* :sparkles: diff context provider ([99db0da](https://github.com/continuedev/continue/commit/99db0da9d68c64d0b5adcab21e07c2db438c2404)) +* :sparkles: display model params for previous prompts ([b1b30a4](https://github.com/continuedev/continue/commit/b1b30a459cbd589a471e1528ebfa9aaeb0514968)) +* :sparkles: edit previous inputs ([c6a3d8a](https://github.com/continuedev/continue/commit/c6a3d8add014ddfe08c62b3ccb1b01dbc47495f5)) +* :sparkles: EmbeddingContextProvider ([c6a1255](https://github.com/continuedev/continue/commit/c6a12550ffca1ffe35630e7aa9af6913ddbe0675)) +* :sparkles: FileTreeContextProvider ([8bd76be](https://github.com/continuedev/continue/commit/8bd76be6c0925e0d5e5f6d239e9c6907df3cfd23)) +* :sparkles: filter history by workspace ([0757bd2](https://github.com/continuedev/continue/commit/0757bd2b556996b9c434ac43e3e4a3b042ef5802)) +* :sparkles: Give the terminal color and ansi escape rendering ([e83290b](https://github.com/continuedev/continue/commit/e83290bd3a921929052b0c0c91751800e7e9fd2c)) +* :sparkles: highlight code on cmd+shift+L ([a1fdf16](https://github.com/continuedev/continue/commit/a1fdf164b776c5ff4ddfa1c4cad66e41de4254c0)) +* :sparkles: huggingface inference api llm update ([bbf7973](https://github.com/continuedev/continue/commit/bbf7973ec091823c4197d59daaf151b748ee52fc)) +* :sparkles: huggingface tgi LLM class ([a0e2e2d](https://github.com/continuedev/continue/commit/a0e2e2d3d606d8bf465eac541a84aa57316ee271)) +* :sparkles: improved edit prompts for OS models ([1785e92](https://github.com/continuedev/continue/commit/1785e92f118b855f4a655d9b617d54b5c857a6ef)) +* :sparkles: improved model dropdown ([2f792f4](https://github.com/continuedev/continue/commit/2f792f46026a6bb3c3580f2521b01ecb8c68117c)) +* :sparkles: improvement to @ search rankings ([5590f63](https://github.com/continuedev/continue/commit/5590f63e42fda38d780bdc390361a65b65576498)) +* :sparkles: llama-2 support ([72d18fb](https://github.com/continuedev/continue/commit/72d18fb8aaac9d192a508cd54fdb296321972379)) +* :sparkles: LlamaCpp LLM subclass ([fc9e8e4](https://github.com/continuedev/continue/commit/fc9e8e4e325782409258dd483e36abf441051ee6)) +* :sparkles: LSP connection over websockets ([a6d21f9](https://github.com/continuedev/continue/commit/a6d21f979fce6135fd76923478f76000b1b343cf)) +* :sparkles: make follow-up edits ([73ae5d3](https://github.com/continuedev/continue/commit/73ae5d306c16d7c372e831d3ca41067a62c8481f)) +* :sparkles: Make the terminal command aware of its OS, platform and shell ([1a786f6](https://github.com/continuedev/continue/commit/1a786f605da47abdfc66b02f4e88044ca95df960)) +* :sparkles: manually running server option ([29940ea](https://github.com/continuedev/continue/commit/29940ea4223194cc32f6324534ad75db9e39305a)) +* :sparkles: more model options, ollama error handling ([e2a7d4a](https://github.com/continuedev/continue/commit/e2a7d4a3c7832f8788feccf4168c13ec87a31fb2)) +* :sparkles: ollama LLM class ([402883e](https://github.com/continuedev/continue/commit/402883e0661c24c418fb5aa93832c6f62dc97a63)) +* :sparkles: refactor via search Step ([9cd249e](https://github.com/continuedev/continue/commit/9cd249ee007911037639281c6d7590889ad7b467)) +* :sparkles: run continue immediately from pypi pkg ([70f6da9](https://github.com/continuedev/continue/commit/70f6da9b1ad190a967974fb477db669cbb5c928f)) +* :sparkles: saved context groups ([c98f860](https://github.com/continuedev/continue/commit/c98f860460767fe14f8fbf139150b1bd1ee2ff12)) +* :sparkles: Search context provider with ripgrep ([4b9dd4c](https://github.com/continuedev/continue/commit/4b9dd4cf8e853e17d92fb76fc726260d79e4bd7a)) +* :sparkles: select custom model to use with edit step ([c1e5039](https://github.com/continuedev/continue/commit/c1e5039731941eb6b6eea166edd433cd49d4e858)) +* :sparkles: select model from dropdown ([044b7ca](https://github.com/continuedev/continue/commit/044b7caa6b26a5d78ae52faa0ae675abc8c4e161)) +* :sparkles: select model param count from UI ([105afec](https://github.com/continuedev/continue/commit/105afeccca903072bc48772bdaf8f100f996c4a7)) +* :sparkles: set session timeout on GGML requests ([d04eec7](https://github.com/continuedev/continue/commit/d04eec7ee97319a6bcc48d289cd6eb3e0d9b8e19)) +* :sparkles: set static urls for contextprovider ([d2b1aed](https://github.com/continuedev/continue/commit/d2b1aedcedf950d792baee202efdab199b05e57e)) +* :sparkles: support browser-based IDEs with createMemoryRouter ([c9d96be](https://github.com/continuedev/continue/commit/c9d96be5615b9d193a1eeff9ab00da7ca0fe0b6b)) +* :sparkles: support for Together.ai models ([8456b24](https://github.com/continuedev/continue/commit/8456b24318b13ea5d5dabec2328dd854f8a492b4)) +* :sparkles: support stablecoder with replicate LLM ([d5e8688](https://github.com/continuedev/continue/commit/d5e86883f05fe3e99e1d6ff64241a48f935cc927)) +* :sparkles: testing improved prompting for stablecode ([6112f26](https://github.com/continuedev/continue/commit/6112f26888086ccd47ca6bcfefdbc5b82ea86879)) +* :sparkles: testing in ci, final test of ([cbd7656](https://github.com/continuedev/continue/commit/cbd7656bb4c9aebfe98c746111af52cf7192aa1b)) +* :sparkles: text-gen-webui, cleaning config and welcome ([36d517e](https://github.com/continuedev/continue/commit/36d517e37d87b1bd39d6027577714b60c32e81e9)) +* :sparkles: verify_ssl option for all LLMs ([e0522b9](https://github.com/continuedev/continue/commit/e0522b92cfa80491718de07928ce6a31850dab70)) +* :technologist: bit of customization for DefaultPolicy ([3966790](https://github.com/continuedev/continue/commit/396679009fef21e13c1a6095212d1bd68e7f2a86)) +* :technologist: button to view logs when loading ([b83eb52](https://github.com/continuedev/continue/commit/b83eb52c98d637ab3e3becf98aed9899821ea00d)) +* :technologist: github workflow to measure issue/PR stats ([f75c423](https://github.com/continuedev/continue/commit/f75c42332c44c0d2a1a7e7a7ea32c2ef346df609)) +* :white_check_mark: update test and add model telemetry ([3541d6a](https://github.com/continuedev/continue/commit/3541d6a770c919e1f2e55a1ae53c4fc3abe31aa7)) +* :wrench: update default config.py imports ([e2d0baf](https://github.com/continuedev/continue/commit/e2d0baf39348597bdd1015897152f4e3bee0744d)) +* :zap: queue messages before load, then send ([4c8b561](https://github.com/continuedev/continue/commit/4c8b56135b0a1862a4f1984e80aa1409f15e177d)) +* :zap: reduce default max_tokens ([8fff1a8](https://github.com/continuedev/continue/commit/8fff1a811c477874482b65d014e4c5565d4a8649)) +* `create_rule_block` tool ([2c8032c](https://github.com/continuedev/continue/commit/2c8032c3397f6ac8c26b8ce5e5b2fe89d079d3da)) +* `description` in markdown yaml ([e4b70db](https://github.com/continuedev/continue/commit/e4b70dbfd843345ae0689a55802462473f5641dc)) +* `globs` on rules and block docs ([24e22db](https://github.com/continuedev/continue/commit/24e22db9d416be54426709948564aee4aa08d54e)) +* `requestRule` tool ([af30fbe](https://github.com/continuedev/continue/commit/af30fbe360def278cd56858d88c5373c80a2dab6)) +* add "Gathering context..." indicator ([dd865ea](https://github.com/continuedev/continue/commit/dd865eadea014ccc8588a49e6d9c338d89734c9d)) +* add "onboarding" slash command ([#1961](https://github.com/continuedev/continue/issues/1961)) ([5819ffb](https://github.com/continuedev/continue/commit/5819ffb43901eec8ad6af85737c28896f20c4e6e)) +* add `globs` to create rule tool ([047e4e4](https://github.com/continuedev/continue/commit/047e4e418b7f252cb303f19992025acc4fb79d4f)) +* add `index.ts` to sdk ([ae31c54](https://github.com/continuedev/continue/commit/ae31c54011ac365e560cb02b9851a6806641503a)) +* add `no-negated-condition` eslint ([eb7d67d](https://github.com/continuedev/continue/commit/eb7d67dcf1a338c473a1bb7f787e4f35e62f8f73)) +* add `stream` in defaultCompletionOptions yaml ([f72e293](https://github.com/continuedev/continue/commit/f72e293e2f6251e1cca632dffa7ec14554016a73)) +* add `tsc:watch` cmd to vs code ([1d5e164](https://github.com/continuedev/continue/commit/1d5e164325e8fe8e66759baf2ac47ce766355faf)) +* add accept/reject all btns ([011e2c2](https://github.com/continuedev/continue/commit/011e2c264407ff72a0bc90980ec7d8250da4bbd6)) +* add agentinteraction dev data ([971c4de](https://github.com/continuedev/continue/commit/971c4de33e1a3f117eafe9d64bf175c0d2a849ef)) +* add animated ellipsis to lump ([e14163c](https://github.com/continuedev/continue/commit/e14163cda2ff1de2e90621f1de2341fd90b136d2)) +* add API key support for TEI reranker ([5dc25b5](https://github.com/continuedev/continue/commit/5dc25b5eb3b1f914d106a18bbb34f7d28e3039f3)) +* add azure provider config ([#1764](https://github.com/continuedev/continue/issues/1764)) ([c9635de](https://github.com/continuedev/continue/commit/c9635def237e0bb4e1d899057e6b651b6a6cd1b2)) +* add best experience onboarding ([8b30504](https://github.com/continuedev/continue/commit/8b305046eff820999e805c8b2cd6400e3572da1b)) +* add chat scrollbar visibility configuration support ([14eaf32](https://github.com/continuedev/continue/commit/14eaf3272cde744ab6390d7113c2cb507e0d6734)) +* add Claude 3.7 support to toolSupport.ts ([50ad91b](https://github.com/continuedev/continue/commit/50ad91bced864272c7f1bb92c13d7c910a0b6be2)) +* Add cloudflare as provider ([ad8743a](https://github.com/continuedev/continue/commit/ad8743a9b563ae6e09cc140a0b3f9f202715e3b5)) +* add code that comment is based on ([e3653f9](https://github.com/continuedev/continue/commit/e3653f98f08e52fa6a55d41ca147add1c8e5515a)) +* add combobox for edit file selection ([7c6295f](https://github.com/continuedev/continue/commit/7c6295feeb32a478a2d8867f0a2b863583f6a97e)) +* add deepseek models for novita ai ([a31c3eb](https://github.com/continuedev/continue/commit/a31c3ebc8334f931281cdb0a348150347c99d0e6)) +* Add docs/getDetails endpoint in JetBrains ([da2dc1e](https://github.com/continuedev/continue/commit/da2dc1ed7de3caa9ae1e8b02a09526f57dd80bb8)) +* add example integration test ([781a792](https://github.com/continuedev/continue/commit/781a792a5939958d05fa316261190c164871c563)) +* add exponential backoff for API requests ([12ffa95](https://github.com/continuedev/continue/commit/12ffa956571acd12b383ba73560d3c42a7a4415c)) +* add file search to quick edit ([#1714](https://github.com/continuedev/continue/issues/1714)) ([21d1b0c](https://github.com/continuedev/continue/commit/21d1b0c16dd9cd454d543e4b387f873e54d89aa5)) +* add fixed version of the nodejs ([cd35857](https://github.com/continuedev/continue/commit/cd35857daf5577f4677f6675344fa8488e624352)) +* add free trial card to onboarding ([#1600](https://github.com/continuedev/continue/issues/1600)) ([9bae5a2](https://github.com/continuedev/continue/commit/9bae5a254df25d25dc848b5c7bf69fc7189e6461)) +* add gif to tutorial card ([e03eb9d](https://github.com/continuedev/continue/commit/e03eb9d5801985d1968d0528dd76767bf3907cbf)) +* add gitlab context class ([efc1f3b](https://github.com/continuedev/continue/commit/efc1f3b9216d5bf503ecb58ff956f26a2bc4a130)) +* add icon for URL ctx item peek ([e901cfd](https://github.com/continuedev/continue/commit/e901cfdf4ae383a2337c2e20182f6eee6d3010f9)) +* add Jira context provider ([#860](https://github.com/continuedev/continue/issues/860)) ([8ba15b1](https://github.com/continuedev/continue/commit/8ba15b16665be871e037ada88d51b3403a8d094e)) +* add Llama 3.1 8B to cloudflare provider options ([#1811](https://github.com/continuedev/continue/issues/1811)) ([bccbff2](https://github.com/continuedev/continue/commit/bccbff273c176c54f0209c5927a19b8c6d9375f9)) +* add Moonshot AI model provider support ([b8a278d](https://github.com/continuedev/continue/commit/b8a278d216db9851aa2b0772e0313ff4bc12c7cc)) +* add novita info ([94d8d39](https://github.com/continuedev/continue/commit/94d8d39cfc8d21f2544633330370d99ef17e0fdf)) +* Add num_treads to ollama along with docs ([#863](https://github.com/continuedev/continue/issues/863)) ([d71721d](https://github.com/continuedev/continue/commit/d71721d71540cb084d67559e850440129faa67c0)) +* add openai wrapper for sdk ([ab9a248](https://github.com/continuedev/continue/commit/ab9a248572a46e00f0fa6441af861dd260c4cb65)) +* add OpenAI, xAI, Replicate and free-trial model options to config schema ([89a90f9](https://github.com/continuedev/continue/commit/89a90f99baaf493f184a09aa6083a606076f9771)) +* Add prompt caching support ([24f9960](https://github.com/continuedev/continue/commit/24f9960e27ad065fec611661e69726c9be589042)) +* add proxy support for ripgrep download ([d42c050](https://github.com/continuedev/continue/commit/d42c050e3645b4eb4635dd5a73ae12107adca701)) +* add Quick Actions CodeLens feature ([#1674](https://github.com/continuedev/continue/issues/1674)) ([fdf3408](https://github.com/continuedev/continue/commit/fdf3408e0c9c2df749b5775d3c906abfdf40e799)), closes [#1536](https://github.com/continuedev/continue/issues/1536) [#1456](https://github.com/continuedev/continue/issues/1456) [#1564](https://github.com/continuedev/continue/issues/1564) [#1576](https://github.com/continuedev/continue/issues/1576) [#1570](https://github.com/continuedev/continue/issues/1570) [#1582](https://github.com/continuedev/continue/issues/1582) [#1600](https://github.com/continuedev/continue/issues/1600) [#1618](https://github.com/continuedev/continue/issues/1618) [#1626](https://github.com/continuedev/continue/issues/1626) [#1637](https://github.com/continuedev/continue/issues/1637) +* add Qwen2.5-Coder support ([387a76a](https://github.com/continuedev/continue/commit/387a76aa5bab873565de25a2d269f0b5b1a53f1e)) +* add redux state for card logic ([5f32924](https://github.com/continuedev/continue/commit/5f32924becd3e8b03d19ffb4a5e4a2dcbfb6dbc3)) +* add redux state for mfe ([6e5236a](https://github.com/continuedev/continue/commit/6e5236a58a896ab78faa1672e56237b4f4684877)) +* add render util function ([413530a](https://github.com/continuedev/continue/commit/413530a029e32ab8e77520c0e5265cd37a84b24c)) +* add rich quick pick for quick edit ([#1706](https://github.com/continuedev/continue/issues/1706)) ([f3b15eb](https://github.com/continuedev/continue/commit/f3b15eb1b14dcc3f4c28ebfb95150b0d6627cecb)) +* add scope selector ([b78fdc4](https://github.com/continuedev/continue/commit/b78fdc4147e1ccb388b900a65099a2c61ba6ca26)) +* Add signature column to code_snippets table ([a535e9e](https://github.com/continuedev/continue/commit/a535e9e15fb3041fec732574636221e0a83dccfa)) +* add slash command cmd ([d4e1609](https://github.com/continuedev/continue/commit/d4e1609d2a65aeeece6caa8620a1b45196f40c98)) +* add support for `baseSystemPrompt` ([f6957bb](https://github.com/continuedev/continue/commit/f6957bb856ba5915ad6351a518dc4b4a47536947)) +* Add support for Cloudflare AI Gateway ([#1425](https://github.com/continuedev/continue/issues/1425)) ([837ad1c](https://github.com/continuedev/continue/commit/837ad1c552aef8909b9a1dbe01204ed2571134d7)) +* add support for custom headers in SSE transport ([d392d77](https://github.com/continuedev/continue/commit/d392d7736d5d31804cd54b3c307bbfb6289e5358)) +* add support for Mistral models in toolSupport.ts ([928cf2c](https://github.com/continuedev/continue/commit/928cf2c73752a23fe3fc026bbf3957c5c80d5604)) +* add support for multiple MCP server types (stdio, sse, websocket) in the YAML configuration schema, ensuring backward compatibility with legacy configurations ([63a2ffe](https://github.com/continuedev/continue/commit/63a2ffe9696d90786f030c2af02cec2c463d914e)) +* add tests ([0819bec](https://github.com/continuedev/continue/commit/0819becfd98127a187cc84484dd59bb4348a1ec3)) +* add tutorial card ([#1716](https://github.com/continuedev/continue/issues/1716)) ([cb8b207](https://github.com/continuedev/continue/commit/cb8b207582dec6ce997c2c602c9998a5a64504db)) +* add unified diff instant apply ([3c36b4d](https://github.com/continuedev/continue/commit/3c36b4dc378ddd8c5c5c2cc234e9a605d776d928)) +* add Vertex AI support ([dfaa02c](https://github.com/continuedev/continue/commit/dfaa02c5051c44303e055675324ff6eaaac0e91b)) +* allow input to exit ([18c5019](https://github.com/continuedev/continue/commit/18c50195248f6ca6c64e1eeb3cb8f10e6b85ffb5)) +* allow JetBrains users to index docs ([#1797](https://github.com/continuedev/continue/issues/1797)) ([e0079a4](https://github.com/continuedev/continue/commit/e0079a43721f6002ff59e2eaa79dc8768a6f66f5)) +* allow users to skip local onboaridng ([4685db0](https://github.com/continuedev/continue/commit/4685db02b854ab0a598defe0fdc4a68f8de50cc2)) +* apply e2e tests ([12b3ed9](https://github.com/continuedev/continue/commit/12b3ed9291b4f46e920f8417f1e6585e45b7edd9)) +* apply if state is active, onEnter callback dont working ([fed1651](https://github.com/continuedev/continue/commit/fed165161d1610db282b52230a4d914f4d2ffa62)) +* apply waiting cursor to chat-input enter-button during prompting ([6d08361](https://github.com/continuedev/continue/commit/6d0836189cd1c18cf97b1e604adf4e5f201665b9)) +* assistant select ([3b539d5](https://github.com/continuedev/continue/commit/3b539d53c39a98c361e27db6dfb72a8e14ddae50)) +* assistant select refresh on right ([04f5e3e](https://github.com/continuedev/continue/commit/04f5e3e165fddf3101e6210b1111c0f261793054)) +* **autocomplete:** recently visited ranged service ([811507a](https://github.com/continuedev/continue/commit/811507a406ed543adb4a8f876c3c3f30d8a9be35)) +* better buttons for account dialog ([2a4c69f](https://github.com/continuedev/continue/commit/2a4c69ff87b64e21ad04edfed2aad7b048833b53)) +* better editor content handling in edit ([7c72c4a](https://github.com/continuedev/continue/commit/7c72c4af878e4b683b582e40f483551314e92873)) +* better error handling around ripgrep ([22f6fdf](https://github.com/continuedev/continue/commit/22f6fdfa1be6f84ab8548155465f863cb65a7e30)) +* better type names ([43ebb1a](https://github.com/continuedev/continue/commit/43ebb1ad0a95ac1dfc0ff1e198fe53e8c50f0671)) +* bookmark first 5 prompts by default ([0909ef9](https://github.com/continuedev/continue/commit/0909ef938b6d2928fa650c0e0613c1e106a0315d)) +* brand text fix ([a25afee](https://github.com/continuedev/continue/commit/a25afeeda10c86072f80c025c20c21b167ddaaf0)) +* bugfixes on redux schema updates ([4efd661](https://github.com/continuedev/continue/commit/4efd66137592916167f562ac45533dfffacd35cc)) +* build steps for config-yaml ([73b95f3](https://github.com/continuedev/continue/commit/73b95f314703c266d9e348f9c1ba3dbbb3f3d266)) +* cache org selection results ([13d5668](https://github.com/continuedev/continue/commit/13d566831db9e66ae270ff70e2b5c63304df6458)) +* cache org selection results ([6e81720](https://github.com/continuedev/continue/commit/6e81720186d4215d6a650835f72ed1c6cc20e28f)) +* capture base class and interfaces implemented ([df2bbc8](https://github.com/continuedev/continue/commit/df2bbc89da7f7f9ee406a8fe6d0c4fd244abd488)) +* capture python definitions ([2f84ef0](https://github.com/continuedev/continue/commit/2f84ef0ab9a87aa6300415d30db02e3460a07195)) +* change model desc ([8d3ecaf](https://github.com/continuedev/continue/commit/8d3ecafa3dbd9a3373ec7784eda1feac6b77b684)) +* check for `nvm` version in install script ([b1a93b7](https://github.com/continuedev/continue/commit/b1a93b7a2dd22ab82ef9acdec5f1096c33c44c1b)) +* cleanup apply manager ([4b9bac5](https://github.com/continuedev/continue/commit/4b9bac55ffae743d0221df65f0a14d0981f74aeb)) +* cleanup inline edit code ([90d895e](https://github.com/continuedev/continue/commit/90d895e2e22ee40033c524a109b5777b5c3bf6cd)) +* Client Certificate Options Support ([#1658](https://github.com/continuedev/continue/issues/1658)) ([136bf9e](https://github.com/continuedev/continue/commit/136bf9e0f0ce0193f64fe291922431808c32406e)) +* close files ([d1eca9d](https://github.com/continuedev/continue/commit/d1eca9deeb3c1550982f679a58265593af603453)) +* close tutorial listener ([d4d3102](https://github.com/continuedev/continue/commit/d4d3102b61c800576513cbb07c9d482fe973a0ef)) +* collapsed codeblock by default ([979c247](https://github.com/continuedev/continue/commit/979c2473c61747157e65e1dcd33fd73ccfe404ad)) +* config.json validation ([429e54e](https://github.com/continuedev/continue/commit/429e54ed347446747d206a97cb80c91baf5d407e)) +* configure docs through config.json ([#1864](https://github.com/continuedev/continue/issues/1864)) ([d7dbdff](https://github.com/continuedev/continue/commit/d7dbdfff485f3970b8595c5a2680a012443747a5)) +* consolidate StepContainer ([58d9eb7](https://github.com/continuedev/continue/commit/58d9eb7a7e8102940d59f26a65e01edb130681fd)) +* consolidate toast logic into "showToast" ([ba777ed](https://github.com/continuedev/continue/commit/ba777edf4761f8bb781fce11ce45311c0b089048)) +* continue sdk ([c7829bb](https://github.com/continuedev/continue/commit/c7829bbd514b962caad99a4c8c660e94f9e577b4)) +* convert issue templates to issue form templates ([#507](https://github.com/continuedev/continue/issues/507)) ([fa7f2cb](https://github.com/continuedev/continue/commit/fa7f2cbdeb6013ec4bb081cb85988817f54d070c)) +* **core:** add support for Llama models on Bedrock ([#1499](https://github.com/continuedev/continue/issues/1499)) ([53aab1e](https://github.com/continuedev/continue/commit/53aab1e6fd2a0f21fbca1c29b82d1f96d2f5e074)) +* crawl `.mdx` docs ([d9f0c4f](https://github.com/continuedev/continue/commit/d9f0c4f131010bd4dae111b5e4290f3460d49e3a)) +* create "rebuild index" dialog ([c978d7c](https://github.com/continuedev/continue/commit/c978d7c871be71cd399d02159be8c1b37a0d36ff)) +* create `ApplyManager` ([652f8c4](https://github.com/continuedev/continue/commit/652f8c4c7b0879f9ab3b2cc1a25c9530de467c94)) +* create docs cache ([3f8afbe](https://github.com/continuedev/continue/commit/3f8afbefeb36c389528d420ef5945c0014ef18c0)) +* create file button in toolbar ([268f55b](https://github.com/continuedev/continue/commit/268f55b001e880fec92ef87df6be2bdf8fc25649)) +* create markdown rules in notch ([c2571e2](https://github.com/continuedev/continue/commit/c2571e2a86e373199fe9660f95fa5b168c776035)) +* create org slice ([71f8508](https://github.com/continuedev/continue/commit/71f85084f22333337a1e817e0502044771d66de4)) +* create profiles slice ([9c2db6b](https://github.com/continuedev/continue/commit/9c2db6b9c7d7fd0a0164b3e2288a4135df759707)) +* create RecentFilesService ([d597e6f](https://github.com/continuedev/continue/commit/d597e6fe5ea632f2bdf762ad2555c056fd736ba8)) +* create stream complete reducer ([ce7d982](https://github.com/continuedev/continue/commit/ce7d98291e30658b387dd5d7de96e0f3577065ab)) +* create SVG tooltip ([0cf152e](https://github.com/continuedev/continue/commit/0cf152ede652d975fd774faa40494020c7514196)) +* dallin feedback pt 2 ([d158fab](https://github.com/continuedev/continue/commit/d158fab740cf803074106717560941cca8cb96c9)) +* dallin's feedback ([e884853](https://github.com/continuedev/continue/commit/e88485348c8b53e9f19d1f9fc0c8b33dd5266df7)) +* Dallin's feedback ([fc1ee33](https://github.com/continuedev/continue/commit/fc1ee33ed912543f596d32ae6eaacbbdbc3bcae4)) +* dallins feedback ([33b1d39](https://github.com/continuedev/continue/commit/33b1d3994654f311dcae385f6ef2ef78696d1d89)) +* dallins feedback ([25b5b8c](https://github.com/continuedev/continue/commit/25b5b8c50b05fe872d74b60ced4a6d8569686ed6)) +* dallins feedback ([6070a64](https://github.com/continuedev/continue/commit/6070a645dd9741b433ad43fd09f37b42ec614a3e)) +* disable chat-input enter-button during prompting ([e01fbe7](https://github.com/continuedev/continue/commit/e01fbe7f2cf6f53f5a611afe6df53dfc5f710e55)) +* disable chat-input-editor during prompting ([7368767](https://github.com/continuedev/continue/commit/73687670da1cc7792d2c4d9ccd7b9813746a4658)) +* display rules used ([53f0679](https://github.com/continuedev/continue/commit/53f06795d3910e1ec5aecdbc1fde706f68649614)) +* editor change listener ([28d2c7d](https://github.com/continuedev/continue/commit/28d2c7d7e0a00c23c33ad25b8bfc3651ddafa2c5)) +* **embeddings:** add gemini provider ([#1362](https://github.com/continuedev/continue/issues/1362)) ([5224572](https://github.com/continuedev/continue/commit/52245724089329c792eb79c8d512cea2f617c4a1)) +* enable comment filtering ([471ca9e](https://github.com/continuedev/continue/commit/471ca9eae5e1f82e04b2d6d600631bf24876ec06)) +* enable sourcemap ([2be2b73](https://github.com/continuedev/continue/commit/2be2b73f2a28834cbfef9100f479ecffc0ad13c8)) +* enable WAL (Write-Ahead Logging) for improved performance and stability ([#1885](https://github.com/continuedev/continue/issues/1885)) ([e93ce84](https://github.com/continuedev/continue/commit/e93ce84cd57eacfe820c1f22668ed069020ee46e)) +* enhance help center ([#1755](https://github.com/continuedev/continue/issues/1755)) ([f2a04ef](https://github.com/continuedev/continue/commit/f2a04ef3e9e49876042077f36da5f457630dcaf1)) +* Enhance MCP connection refresh logic ([1a0d411](https://github.com/continuedev/continue/commit/1a0d41128f30c7f5c087c7255d6ec3292c288664)) +* Ensure CancelAutocompleteAction updates on EDT ([277c20f](https://github.com/continuedev/continue/commit/277c20f3b08eaa1b0b293b06bbfce40404e5477d)) +* evaluate rule ([1a1b854](https://github.com/continuedev/continue/commit/1a1b854fda4630e136d0d18b4ea69e71a00ced1e)) +* explore btn ([14c9528](https://github.com/continuedev/continue/commit/14c952887399f12e739d6a0fafbdbb4d1355fe90)) +* explore dialog ui ([c6cfa93](https://github.com/continuedev/continue/commit/c6cfa9334690cf7f9ecdf99959537ce522728079)) +* explore dialog watcher ([741ad35](https://github.com/continuedev/continue/commit/741ad35195d6b841b459076b8dbca1057d5f6358)) +* explore dialog watcher ([192a47f](https://github.com/continuedev/continue/commit/192a47f998d639f307933f33a731832ff35305ac)) +* explore hub card ([5a777ce](https://github.com/continuedev/continue/commit/5a777ce464243b09d466d7a11a39ff9e45a74ec5)) +* extract paths ([2ffb4ae](https://github.com/continuedev/continue/commit/2ffb4aefeb01073c924beb1c203e60c586cf96bb)) +* fall back to Cheerio for headless crawling ([fd7bbce](https://github.com/continuedev/continue/commit/fd7bbce79b831a1068c5367bc4f018fe820a917a)) +* fallback to chat model from apply model ([46e8dd7](https://github.com/continuedev/continue/commit/46e8dd7c38858173f375ac24f6857ed3bea2b190)) +* fallback to chat model in IDE ([b601c22](https://github.com/continuedev/continue/commit/b601c22d01478d74a66bf162f3e12c4c4e1a93d7)) +* filttrex ([b20b1ab](https://github.com/continuedev/continue/commit/b20b1ab5ee44d704619327a3b087b1290c634dd7)) +* fix address ([d59b3b5](https://github.com/continuedev/continue/commit/d59b3b5297924b2b6343a990c09551be4af9c670)) +* fix broken links ([66345e8](https://github.com/continuedev/continue/commit/66345e83550a898cd36eae67a68fb020ce957677)) +* fix ctx providers w/ slash cmds ([e5608a9](https://github.com/continuedev/continue/commit/e5608a94e543cd8b66d68c222eacc82e8c021aff)) +* fix filepaht issues w/ apply ([6c848ba](https://github.com/continuedev/continue/commit/6c848ba7a7fc7ea32a963653b83b5099e5ed6fad)) +* fix models ([d401a5c](https://github.com/continuedev/continue/commit/d401a5c11fdf5b3267269ff3603f83318a9dd9ad)) +* fix type error + formatting ([bb5e8b6](https://github.com/continuedev/continue/commit/bb5e8b641dc535fd8d60de92aba04680f7b93824)) +* fix version and address ([ad0fdb9](https://github.com/continuedev/continue/commit/ad0fdb988b76bebadcbb26a3069b7f821207680f)) +* get paths ([9cb5170](https://github.com/continuedev/continue/commit/9cb5170b1a23552f917265dc330ff1e05838a3de)) +* get return_type and parameters from snippets ([bf426d5](https://github.com/continuedev/continue/commit/bf426d5e2147248c06ab51cab31ac5cd9e834b1d)) +* glob rules ([8c5ca40](https://github.com/continuedev/continue/commit/8c5ca401d4fbda64eacf23cc0585e2c9830db345)) +* go definitions ([bf65b1e](https://github.com/continuedev/continue/commit/bf65b1ebbdd3b0913d141e9f60a11414088bc78f)) +* **gui:** add ability to change the session title ([1b32222](https://github.com/continuedev/continue/commit/1b32222c10c6ae6f1fd6c93f6abd8cbeab16f108)) +* **gui:** Add Azure as a provider ([b7c0623](https://github.com/continuedev/continue/commit/b7c0623ac6c5067ccefd7c8486eeef2ff56d9667)) +* **gui:** add flex-grow to TdDiv in history page ([#619](https://github.com/continuedev/continue/issues/619)) ([7106f42](https://github.com/continuedev/continue/commit/7106f42cb4ba7424b3dda8ed2d0e562e2fd99447)) +* **gui:** improve editor highlights ([7bffa2d](https://github.com/continuedev/continue/commit/7bffa2dbeab4dde415c113bb15b71968bc51f448)) +* **gui:** more config for azure provider ([e11206b](https://github.com/continuedev/continue/commit/e11206b0fa70075d21d1cc8dd4426af856ee05c2)) +* handle deletions ([2c8cee9](https://github.com/continuedev/continue/commit/2c8cee9fd42fc8f18c9e6e37781e27276dae2786)) +* hide empty code lines in markdown preview ([#815](https://github.com/continuedev/continue/issues/815)) ([793d022](https://github.com/continuedev/continue/commit/793d022eab292219cda75bb3255ed3d676585977)) +* **history:** add sticky headers to history sections ([#621](https://github.com/continuedev/continue/issues/621)) ([3d398d0](https://github.com/continuedev/continue/commit/3d398d0b3781db8bbc51ad00f47e80b3124f5c8f)) +* hover brightness on tool call div ([dba2887](https://github.com/continuedev/continue/commit/dba288748d850c7fa8047efb75e954384410a497)) +* **httpContextProvider:** load AC on fetch client ([#1150](https://github.com/continuedev/continue/issues/1150)) ([638f192](https://github.com/continuedev/continue/commit/638f1922590d7bd46d6e4d46a4d25bf1b33b26fa)) +* if rules ([6224af6](https://github.com/continuedev/continue/commit/6224af63d36e6b96b068c6d4230ee2315bd94d43)) +* if rules ([d0e922d](https://github.com/continuedev/continue/commit/d0e922dad4947ac8af4e9d0c76921da56cdc2953)) +* if-rule ([211fcb7](https://github.com/continuedev/continue/commit/211fcb77407cd261f2bb26198667388ea6270a05)) +* if-rule ([9baa4e9](https://github.com/continuedev/continue/commit/9baa4e93be7f9c2fe057e453237eaa9d1aaa8ff0)) +* if-rules ([06b76d7](https://github.com/continuedev/continue/commit/06b76d752fb4f83b14053fffe2f85cb819e39ae6)) +* if-rules ([0a13a46](https://github.com/continuedev/continue/commit/0a13a4604d7607793bea66b9cea3e89353bf3af4)) +* if-rules ([ccdc1b9](https://github.com/continuedev/continue/commit/ccdc1b953e22ca4aa26e32b9e80bc31ea30f274c)) +* ignore node_modules in js and ts code definitions ([3c9071a](https://github.com/continuedev/continue/commit/3c9071a09b114a019a593a7f241975f419cc4e43)) +* impl /multifile-edit ([f88f28b](https://github.com/continuedev/continue/commit/f88f28b8551e95e4eb346fafa68d6223f9017d5a)) +* improve chat thread ui for better readability ([#1786](https://github.com/continuedev/continue/issues/1786)) ([8478af6](https://github.com/continuedev/continue/commit/8478af63c18b0c35d59d2326ca4e8687a42a624b)) +* improve chunking desc on large projects ([3844208](https://github.com/continuedev/continue/commit/3844208a3b9b3daaff085daad8ab933f27fcb5f3)) +* improve dropshadow on jb inline edit ([35b94e7](https://github.com/continuedev/continue/commit/35b94e710260782d0311ee22a2849203b8965e38)) +* improve dropshadow on jb inline edit ([75e2d2f](https://github.com/continuedev/continue/commit/75e2d2f39df30424b3831615ee3720a2844a60a5)) +* improve fatal error message ([1d77ad3](https://github.com/continuedev/continue/commit/1d77ad31949042c7702b59f83a82ca51dcce4900)) +* improve input and tooltip ux ([#1923](https://github.com/continuedev/continue/issues/1923)) ([2c13776](https://github.com/continuedev/continue/commit/2c13776c06cfe9c775777bf2fffdcf7dfa2169ee)) +* improve model retrieval logic in InlineEditAction ([52b1704](https://github.com/continuedev/continue/commit/52b1704f3c0fe991b32959d04c660fe55e899b2c)) +* improve prompt log formatting + detail ([2376daf](https://github.com/continuedev/continue/commit/2376dafce325c87d87090e7cf995beffcb98d3b4)) +* Improve ProtocolClient initialization and GUI loading ([0c829fd](https://github.com/continuedev/continue/commit/0c829fd99d0e898c1afdc90a0957c907dcb7f4e2)) +* improve settings tabs ([a5f974b](https://github.com/continuedev/continue/commit/a5f974bf1602dabe3939ddc0ac7b5a05ac8e716b)) +* improve StreamError dialog ([ecb63a0](https://github.com/continuedev/continue/commit/ecb63a0222c7ae5e051bea02d98a4a2de7c1e2e5)) +* improve styling on code to edit ([47fbe4f](https://github.com/continuedev/continue/commit/47fbe4f9b81e1ef31d60f1110d2bf240fa6e7d40)) +* include recently + open files in codebase search ([#1833](https://github.com/continuedev/continue/issues/1833)) ([3e0fae3](https://github.com/continuedev/continue/commit/3e0fae35a75bb8dc117bc3eb008eee122e0e12ae)) +* init profiles prefs ([d6ad3e2](https://github.com/continuedev/continue/commit/d6ad3e2071ca1ee3f0b5cd4d8e93852a84fd138a)) +* insert prompt into input on click ([a73123e](https://github.com/continuedev/continue/commit/a73123e35ce29f1776b5afb456c9c67dc9495099)) +* instant apply check for diff rejectection ([98cb185](https://github.com/continuedev/continue/commit/98cb185c926d49a6f5af00f8b53e207743da815a)) +* integrate Moonshot AI model provider and update UI translations ([7ffb95e](https://github.com/continuedev/continue/commit/7ffb95e9d0fc964b55b3f92149515fa79fc3aa0d)) +* items used text ([#1973](https://github.com/continuedev/continue/issues/1973)) ([28a2042](https://github.com/continuedev/continue/commit/28a2042b7f604889cd0c7c76ee3ec0791a00e3ba)) +* **jb:** add ide logs ([22d84ae](https://github.com/continuedev/continue/commit/22d84ae726c40d65449c39b2ece4101f32608870)) +* **jb:** add plugin actions ([629641a](https://github.com/continuedev/continue/commit/629641a4adf2a1e2fe1c9a69fd431718b34c4263)) +* **jb:** create per-IDE tutorial files ([e3b5cbf](https://github.com/continuedev/continue/commit/e3b5cbfda453c727c6f81d04aa8bed1b9efe8301)) +* **jb:** fix meta key bugs in tiptap ([7682c71](https://github.com/continuedev/continue/commit/7682c71575c7ffc03d625510187d792e9d971227)) +* **jb:** impl "apply" button ([802cb43](https://github.com/continuedev/continue/commit/802cb43cd6b6abf8613591eb38c445e6bd4daa7d)) +* **JB:** impl `showFile` ([24bb5eb](https://github.com/continuedev/continue/commit/24bb5eb0dab8467f606d249f8be16fcb9ff083c0)) +* **JB:** scroll to top of file on full file edit ([c36a1ae](https://github.com/continuedev/continue/commit/c36a1ae62851383978080bc5674e7ba4ca0e9cc1)) +* jetbrains tutorial explore hub ([054b095](https://github.com/continuedev/continue/commit/054b095dab51b3abc7a3d83587e0b5f67b8acdf6)) +* make [@codebase](https://github.com/codebase) a hardcoded ctx provider ([#1818](https://github.com/continuedev/continue/issues/1818)) ([7b86678](https://github.com/continuedev/continue/commit/7b866787d947106b77ac0cef92b75ba36e09e7fc)) +* make `assistant` optional on sdk ([48429ae](https://github.com/continuedev/continue/commit/48429ae04f957a98c24d841316c722b91841c329)) +* make deletion line highlight wider ([10a5ec1](https://github.com/continuedev/continue/commit/10a5ec18a9df189d58c60886be296f1107a1dfc2)) +* make disabled state a tooltip ([#1653](https://github.com/continuedev/continue/issues/1653)) ([6cf0102](https://github.com/continuedev/continue/commit/6cf0102875316a89752d17d4fe08e4b21fd2e603)) +* manual ripgrep downloads for JB ([587459c](https://github.com/continuedev/continue/commit/587459c007ba130a4fd6f5ffde246dd8625486a8)) +* markdown rules ([a21d350](https://github.com/continuedev/continue/commit/a21d350ea14a98cf16904ae678de64a83775da7c)) +* merge conflicts ([82a328c](https://github.com/continuedev/continue/commit/82a328ca15306e0b902075c0661cd1b2bb8ed9a8)) +* model name update ([045c6bd](https://github.com/continuedev/continue/commit/045c6bdfec45ffadb25b3db2306b78f34780e84b)) +* modify vitest command, add test coverage feature ([96c70d0](https://github.com/continuedev/continue/commit/96c70d07d283130176cbda68afdb02ddc6b20366)) +* more cleanup ([6c294e7](https://github.com/continuedev/continue/commit/6c294e76834561848305ac8fb6bcb707ea21b172)) +* more cleanup ([bf7cf66](https://github.com/continuedev/continue/commit/bf7cf661cc4357029492f067ca57b1a43401aaaa)) +* more dynamic imports for LanceDB ([90c6631](https://github.com/continuedev/continue/commit/90c663146edc965bbe0b87b737755742315a8fa1)) +* more moving around ([b0492dd](https://github.com/continuedev/continue/commit/b0492ddfee2e6050d833d4ad07a942dbdd830c55)) +* more styling updates ([c7b3ea8](https://github.com/continuedev/continue/commit/c7b3ea890ac2bade08424e7a23301cea319aea35)) +* more visible assistant refresh + submenus ([1fd2ce9](https://github.com/continuedev/continue/commit/1fd2ce90f22c0dd6ebb9ec5b2542f85475844436)) +* move .prompts into slash cmd ([1d1f705](https://github.com/continuedev/continue/commit/1d1f705f7dfb1d517b90e03b82856e625f3f323e)) +* move `StepContainerPreToolbar` ([979bcb9](https://github.com/continuedev/continue/commit/979bcb97ec88d91d0ed0bd14fd5b6b7dc4c670ae)) +* move apply accept/reject into lump ([071ecb9](https://github.com/continuedev/continue/commit/071ecb91eb9c627e96439b7a5be260ec446500b0)) +* move apply manager instantiation ([2413d24](https://github.com/continuedev/continue/commit/2413d241c6448f65c99d9286e72a01bc8acc429a)) +* move Edit into Chat page ([731b54e](https://github.com/continuedev/continue/commit/731b54eb30bd7184e42c397db658020b4a70d5f7)) +* move error indicator into lump ([1f1d4f4](https://github.com/continuedev/continue/commit/1f1d4f4a1c5b365258db219e2a0ae8eecf3656a8)) +* move free trial out of assistant ([2c58a33](https://github.com/continuedev/continue/commit/2c58a33a6a937ea7beb1aa017bce64ec4cfe32d0)) +* move rule parsing to `config-yaml` ([f2d7290](https://github.com/continuedev/continue/commit/f2d72902cb45c165ca73483dd5c0a90ac89bcc49)) +* move SymbolLink ([e3bbd6b](https://github.com/continuedev/continue/commit/e3bbd6b7cfa04183f7a60470a55e4a2618083a21)) +* move vLLM rerank response in the VLLM.ts and remove unused types ([c8d9d95](https://github.com/continuedev/continue/commit/c8d9d959f10b34cb0af857cfa178c1f9df30f5cf)) +* onboarding card upgrade tab ([41bc0e9](https://github.com/continuedev/continue/commit/41bc0e922b333ee404ddb17e5bdcf7c83b7a6ca0)) +* only autoscroll Continue console when focused on last element ([40390f5](https://github.com/continuedev/continue/commit/40390f583bea74766c3eff48cb8ceda555112780)) +* open lump on submit onboarding ([f77f662](https://github.com/continuedev/continue/commit/f77f662c6e7313db645656e003c9d0145646388e)) +* org select ([dc751a3](https://github.com/continuedev/continue/commit/dc751a3274948cb12b47fb7b57106a8349e26870)) +* php definitions ([8da703f](https://github.com/continuedev/continue/commit/8da703f74525213dc212efa6b763d4be06dee38b)) +* php definitions ([eadc96e](https://github.com/continuedev/continue/commit/eadc96ebef6653a996dff32095fd87a86703058d)) +* poll in JB after upgrading ([89d4b32](https://github.com/continuedev/continue/commit/89d4b32bba3bede3ac9f001c6c013ec0bb5a9ca0)) +* postgres context provider first slice ([758a81c](https://github.com/continuedev/continue/commit/758a81c7373f398294ccb80d00a5c7d181f151d7)) +* pr_checks update ([1cc81d4](https://github.com/continuedev/continue/commit/1cc81d4b7e6ed6aedcc19753eea623acbfc8f8c1)) +* preserve edit when rejecting ([32bf80d](https://github.com/continuedev/continue/commit/32bf80d7d280fe815b547475b4a75fce92ba990d)) +* profiles slice ([b82d29c](https://github.com/continuedev/continue/commit/b82d29c2df154a632c89d32c6847f5bf43b6564b)) +* promote reject diff action ([16cbe94](https://github.com/continuedev/continue/commit/16cbe9499431d7eec64d0695821a223302d980cb)) +* prompt blocks ([9df325a](https://github.com/continuedev/continue/commit/9df325a71f3340c46820ac5335249095cda443ac)) +* Provide workspace path to HttpContextProvider ([4873f58](https://github.com/continuedev/continue/commit/4873f5805f89bc1f443211515dd7afb3fbc2cfff)) +* python context ([42d5f66](https://github.com/continuedev/continue/commit/42d5f660727dcf315d12193f70d23b283e7af10d)) +* recursively apply quick actions codelens ([#1925](https://github.com/continuedev/continue/issues/1925)) ([d5155da](https://github.com/continuedev/continue/commit/d5155dac697e5fa8b4241ebebe48bbfa66dc2c55)) +* redo action ([121be85](https://github.com/continuedev/continue/commit/121be85a69837a1d31dde31f7fca7098458ed38d)) +* refactor onboarding card ([b86bc6f](https://github.com/continuedev/continue/commit/b86bc6f727e292c2d3a8fb1511646c36e2a2531f)) +* reintroduce lazy apply for full files ([6504bd5](https://github.com/continuedev/continue/commit/6504bd55659823c8117d04ddb447f91d9932d086)) +* remove `models` property ([7f8882e](https://github.com/continuedev/continue/commit/7f8882eee136b90db9400175f9ee00fa1aa3ad93)) +* remove defaultTitle ([1bf359a](https://github.com/continuedev/continue/commit/1bf359a55fdb833569878167a1440e66c65d7249)) +* remove edit as a mode ([4f371a0](https://github.com/continuedev/continue/commit/4f371a0eb654067c626a41eb53718f565873975b)) +* remove tools from schema ([5bbda4f](https://github.com/continuedev/continue/commit/5bbda4f115a208ebd2df0c63ede75bfc5e131b54)) +* remove useFileExists ([2b34ee8](https://github.com/continuedev/continue/commit/2b34ee8c4156c544a3abd9616080f4d8e0b565a1)) +* rename to `Open Assistant configuration` ([9d8139a](https://github.com/continuedev/continue/commit/9d8139a6fae992eb1cb77248cc297d0a95683c12)) +* replace logo and deepseek model base info ([7749349](https://github.com/continuedev/continue/commit/7749349f8996f5da186ba1a8b2910443121ea2fc)) +* restructure for easier module publishing ([b51905d](https://github.com/continuedev/continue/commit/b51905da95307ed17f3fa7a466e94514bcd4113a)) +* retrieve AWS credentials from Env and from ECS/EC2 instance ([53426a1](https://github.com/continuedev/continue/commit/53426a12b858f341c9f70f8ee3513dbea39d648d)) +* reusable card ([d11376b](https://github.com/continuedev/continue/commit/d11376ba7f2b7ab1a85c75f361631fc2c5c26ab5)) +* rule colocation ([39dc367](https://github.com/continuedev/continue/commit/39dc367371c0df605f663c76fe490c4736f00153)) +* rule glob ([f95cdfa](https://github.com/continuedev/continue/commit/f95cdfaf83569159cd7aed02134be7dd5f4029cf)) +* rules ([2620064](https://github.com/continuedev/continue/commit/2620064c53ecf7de3d61b34043d2c0450f68b13c)) +* rules display ([40914a8](https://github.com/continuedev/continue/commit/40914a8bf3b4f2c1764873bc3172feab3bf23f3a)) +* rules policies ([8a2ffb3](https://github.com/continuedev/continue/commit/8a2ffb3a859d4fbec3299500a0d860c0f725573d)) +* rules preview ([d57d35d](https://github.com/continuedev/continue/commit/d57d35d5bdf6015593283a2aecbf88bca1c8c574)) +* run prettier ([ecdb4f5](https://github.com/continuedev/continue/commit/ecdb4f530dee01e8a67e7fd964206428d379b4db)) +* **scaleway:** update supported models ([8b04ba6](https://github.com/continuedev/continue/commit/8b04ba6b233d72f1e61ea67fd63de51d03629282)) +* separate toolbar action buttons ([aba6e4e](https://github.com/continuedev/continue/commit/aba6e4e61c6c7b548126a79ffeb0608e1de1147b)) +* show disableIndexing in More ([5d95b62](https://github.com/continuedev/continue/commit/5d95b62e683c0ea50eb519f7cc2851736e8ee64b)) +* show num diffs in toolbar ([ad6c0d0](https://github.com/continuedev/continue/commit/ad6c0d0bb850308993e53c4117cc45664fd8970e)) +* simplify types ([b18fd4a](https://github.com/continuedev/continue/commit/b18fd4aee0c66e41113bce4de1fa526da1dc16c6)) +* simplify typings ([c6fa6d7](https://github.com/continuedev/continue/commit/c6fa6d78a714ba6bba44ec2ef9825080b0a5b69a)) +* single default quick pick to edit ([#1743](https://github.com/continuedev/continue/issues/1743)) ([ca7bde9](https://github.com/continuedev/continue/commit/ca7bde9b5e10d684ea44291c67eb294edc357240)) +* skip hub onboarding in free trial ([d995149](https://github.com/continuedev/continue/commit/d99514995588cc2c502df99757e22f5ac3e2c7a1)) +* skip onboarding subtext ([9e6ff4b](https://github.com/continuedev/continue/commit/9e6ff4b91447b03d1b9949499cf5135d7a369df9)) +* smaller headings, use assistant name ([85804ff](https://github.com/continuedev/continue/commit/85804ff9e54adf30f1a4b23b3003b39338a82065)) +* split diff ([b7defc8](https://github.com/continuedev/continue/commit/b7defc8d912b09d9323e05a82442bea17c6faef4)) +* split diffs ([3c537f5](https://github.com/continuedev/continue/commit/3c537f51c13ee9064a3e17f3aec62dc5283ae3e2)) +* split diffs ([39087c2](https://github.com/continuedev/continue/commit/39087c2207e0dd3764761e91b9a2abd3ca6db906)) +* support o3/o4 as agents ([8bb18fd](https://github.com/continuedev/continue/commit/8bb18fd2ee4a0fb81b2f24903e47fb1b0beade36)) +* supports agent 4 deepseek ([82d8e1e](https://github.com/continuedev/continue/commit/82d8e1e6795e7258880d414c4bb78c6f83b17883)) +* toolbar header for all codeblocks ([635f7cb](https://github.com/continuedev/continue/commit/635f7cb168f264446e40c6887347327b101ee413)) +* tutorial listener ([6e01c7d](https://github.com/continuedev/continue/commit/6e01c7d0ca0d139e471edf40018d35e1033638f3)) +* unskip tests ([a5619e2](https://github.com/continuedev/continue/commit/a5619e29c8a0230f578c092c028c7cc6f3066afb)) +* update azure uri for foundry users ([638969b](https://github.com/continuedev/continue/commit/638969b7c7594f36bfefd59a986032ba597f88fa)) +* update btn colors ([b7c7171](https://github.com/continuedev/continue/commit/b7c71719e55e728f944399789f6749e493d5d13e)) +* update docs and input labelling ([1847317](https://github.com/continuedev/continue/commit/18473174365c88e7e83fd8123cb6af9318e10462)) +* update e2e tests ([93cec27](https://github.com/continuedev/continue/commit/93cec27e28773778e3223424fb72026c9e3ead44)) +* update executable perms on linux/macos ([dcbd80e](https://github.com/continuedev/continue/commit/dcbd80ecf47adeb49b9484bb1e1b3c43ff80bff8)) +* update onboarding w/ embeddings model ([#1570](https://github.com/continuedev/continue/issues/1570)) ([ed56c8f](https://github.com/continuedev/continue/commit/ed56c8f7f325f19c9b4d1c7e3cb775f850beaea9)) +* update PreToolbar ([3933791](https://github.com/continuedev/continue/commit/39337910f125a71414cf2c39b96250fc512777be)) +* update redux store schemas ([438cba4](https://github.com/continuedev/continue/commit/438cba4501026ef1705987b23f419570d1175ea1)) +* update styling ([ef349ec](https://github.com/continuedev/continue/commit/ef349ecec90dac3d15eb80ae17cf24c155d1e683)) +* update sys prompt ([25c7144](https://github.com/continuedev/continue/commit/25c714494588433d1c43d6af99cce175b48e21cc)) +* update to work as normal context provider ([0ace169](https://github.com/continuedev/continue/commit/0ace1699356be8024a8ab49ccadc4b1b22c18e08)) +* update tutorial files w/ agent mode step ([8eaf078](https://github.com/continuedev/continue/commit/8eaf078638c0d2d9c14aa0cc8e465df66f01e4df)) +* update URL replace logic ([fe6c9a1](https://github.com/continuedev/continue/commit/fe6c9a1477ab814f3cc4d0973e851701621d2c54)) +* updated prompt docs ([204aa51](https://github.com/continuedev/continue/commit/204aa51a944906fe629e92095a3f7f86113b9f6c)) +* use @lancedb/vectordb-win32-arm64-msvc ([0277320](https://github.com/continuedev/continue/commit/027732073aa0fb5202b558f4c0d71c71c6b8acbb)) +* use `fetch` instead of `http` ([401d67b](https://github.com/continuedev/continue/commit/401d67bbd0dc11fd6eda2f7d9c17dfd4da0a43f5)) +* use `instant` property on diff manager ([2f12bbd](https://github.com/continuedev/continue/commit/2f12bbdf25b1ff189a88d37bfba4f3bfe7f2f3bc)) +* use bm25 for fts ([2e5b579](https://github.com/continuedev/continue/commit/2e5b5794e9b394405c127893100be21e008b45ad)) +* use clipboard content ([9dd6284](https://github.com/continuedev/continue/commit/9dd6284b8e4b1dc09b704bc00d5231af9569b6bc)) +* use correct deployment for azure ([8e24fcf](https://github.com/continuedev/continue/commit/8e24fcf4a0ee655dfbe83d95b82855041f0ba246)) +* use crawlee for docs service ([a51c520](https://github.com/continuedev/continue/commit/a51c520deefa49f9d67aaa2469bb261af00dab80)) +* use exponential backoff in llm chat ([#1115](https://github.com/continuedev/continue/issues/1115)) ([a87df40](https://github.com/continuedev/continue/commit/a87df40a2c875a1538aa112d7d35c03137990ee2)) +* use git diff, improve comment formatting ([1adbd9a](https://github.com/continuedev/continue/commit/1adbd9a456f6c4c2f56b78d6bd5e3b8737f60ec5)) +* use hub blocks for local onboarding ([1b45308](https://github.com/continuedev/continue/commit/1b453083b14e60afda14de69b7bfb2f7ce74194b)) +* use meyers diff after initial edit/apply ([f5e7f9c](https://github.com/continuedev/continue/commit/f5e7f9ce71d4c34e8ee72b0d78fe89c68d0b7170)) +* use s3 for global docs cache on all docs ([0156409](https://github.com/continuedev/continue/commit/0156409dac5a445b055ede921c1c07706759ff4e)) +* use theme color for shortcuts rows ([44fdd65](https://github.com/continuedev/continue/commit/44fdd65967b561527865a02cafce0de4cdc9fa70)) +* use thunj ([eae1dd2](https://github.com/continuedev/continue/commit/eae1dd20bb296099db94175c43bf7af445e97200)) +* v1 onboarding card ([0d47647](https://github.com/continuedev/continue/commit/0d476473bda2ef8bea78064c89c5bc1f6818fec1)) +* vitest ([3cd19f5](https://github.com/continuedev/continue/commit/3cd19f5fabdb6eab3be381ccef8de743b37fcf29)) +* **VSC:** give option to disable quick fix ([951784c](https://github.com/continuedev/continue/commit/951784c790664a80d87b54e33886a3582137ad50)) +* vscode config for json ([666fb18](https://github.com/continuedev/continue/commit/666fb186d6b4cee9dcc95e1adc6b42748300de4c)) +* withExponentialBackoff utility function ([ad8991e](https://github.com/continuedev/continue/commit/ad8991eac0f7f40f3877d56392592d8d83e173a6)) +* working `copy-client` ([09beb58](https://github.com/continuedev/continue/commit/09beb58260f32043c89cff39c6e8567f25099c9c)) +* write initial unit test for apply ([f4a59dc](https://github.com/continuedev/continue/commit/f4a59dc185c3ea7ceb29a4629ea0c7dc82f44dbb)) + + +### Performance Improvements + +* :green_heart: hardcode distro paths ([edf0f56](https://github.com/continuedev/continue/commit/edf0f5603730d01d7ca4ca055dd49da596648627)) +* :zap: don't show server loading immediately ([5047dfc](https://github.com/continuedev/continue/commit/5047dfcd2a2e47468c15ed05c69781cc615ef723)) +* **llm:** Optimize pruneLines functions in countTokens ([35b3189](https://github.com/continuedev/continue/commit/35b3189538da5891617a79ba9c0badb0bb7dc1bc)) +* **llm:** Optimize pruneLines functions in countTokens ([28cdd1c](https://github.com/continuedev/continue/commit/28cdd1cee25973aa9a8a5cfdcbcc436e0b7f6240)) +* **llm:** Optimize pruneLines functions in countTokens ([881f8b3](https://github.com/continuedev/continue/commit/881f8b3139794aca0a6699c3d34ebf8fba01b789)) + + +### Reverts + +* Revert "Add citations to the log" ([caf7288](https://github.com/continuedev/continue/commit/caf7288d36c1361b6cb279821d9ee377636f72f7)) +* Revert "feat: add bookmark logic" ([730ac56](https://github.com/continuedev/continue/commit/730ac56d5a15a6b2931330aeb849e2d260d2644a)) +* Revert "update TabBar to use Redux for session management" ([9f13b92](https://github.com/continuedev/continue/commit/9f13b92b3fbc4157124ccf120028312390eed70f)) +* :bookmark: update version ([d6ebc6d](https://github.com/continuedev/continue/commit/d6ebc6d969ccafc753ecf00e0309777b96b4ad11)) +* :bug: revert unecessary changes from yesterday ([3629ddd](https://github.com/continuedev/continue/commit/3629dddb1daea23fbd29b03705e742ec2a22d6ec)) +* :fire: disable fallback_context_item ([a572db4](https://github.com/continuedev/continue/commit/a572db40b6c9ce98b07e89d34f8652e19f91187e)) + +# 1.0.0 (2025-06-22) + + +### Bug Fixes + +* :adhesive_bandage: allow GGML to use api.openai.com ([db19f6b](https://github.com/continuedev/continue/commit/db19f6bc98285d8ea45b4db16f619dffbec7c3db)) +* :adhesive_bandage: skip indexing really large files ([b773fe6](https://github.com/continuedev/continue/commit/b773fe6d7a0b489a658139ea5fc958abd46a20b2)) +* :ambulance: catch error from meilisearch client.health ([00775f5](https://github.com/continuedev/continue/commit/00775f54e6c3fa8044a996ea1a7cf0f2205735dd)) +* :ambulance: class_name hotfix ([83b0417](https://github.com/continuedev/continue/commit/83b0417f6c8c579d0ea5a0f689eceb822fe7a04d)) +* :ambulance: fix import of run from __main__ ([ebfe428](https://github.com/continuedev/continue/commit/ebfe428b7f70de66bc5692cca1db7cd10ef4b997)) +* :ambulance: hotfix and package.json seo experiment ([42024ef](https://github.com/continuedev/continue/commit/42024effba73673b4080c25806c21293b5daad3e)) +* :ambulance: load global ~/.continue/assistants ([4b55cfb](https://github.com/continuedev/continue/commit/4b55cfb2e8ad4803855020111d0cff6a38ad79d5)) +* :ambulance: logging to file causing problems with starting server ([8b95ef7](https://github.com/continuedev/continue/commit/8b95ef7de258de8498b328d9e6107a95f57f8d2c)) +* :ambulance: specify packagePath for vsix ([512ccfd](https://github.com/continuedev/continue/commit/512ccfda670abb6132e9cd720280a472e53e3326)) +* :arrow_up: upgrade openai python package ([19cbe2c](https://github.com/continuedev/continue/commit/19cbe2cebae8e2155b6b4375c6a96a3b25e87615)) +* :art: many small improvements ([28f5d7b](https://github.com/continuedev/continue/commit/28f5d7bedab05a8b061e4e7ee9055a5403786bbc)) +* :bookmark: update extension version ([05b9642](https://github.com/continuedev/continue/commit/05b96420bda2da0c725cacc8141d87449eaf9e9c)) +* :bookmark: update version ([afae160](https://github.com/continuedev/continue/commit/afae1600255714d0a4f18f892d3e7b5e1d921962)) +* :bookmark: update version ([9aee2cc](https://github.com/continuedev/continue/commit/9aee2cc44c461ce0e001185af85352e78522bab5)) +* :bookmark: update version to try again ([1905f31](https://github.com/continuedev/continue/commit/1905f319470c02ee414498b9101b6e64b4b15d65)) +* :bookmark: v3 -> v4 of upload-artifact ([d24862a](https://github.com/continuedev/continue/commit/d24862a6fd22e4eac1b2ca27ce7bf029f0d8fa4a)) +* :bug: a few minor fixes ([c918bb3](https://github.com/continuedev/continue/commit/c918bb3af5ec4a4a409eb0a3add27951b00c3c59)) +* :bug: a handful of bug fixes ([e1325c0](https://github.com/continuedev/continue/commit/e1325c0153becb95b454810d9461efd7d3624a6a)) +* :bug: a number of small fixes + disable summaries ([a975560](https://github.com/continuedev/continue/commit/a9755603c3a2c0b3afe809f77a63824c77c6419e)) +* :bug: access highlighted_code through context_manager ([1afb37b](https://github.com/continuedev/continue/commit/1afb37b5bb901d95c493039591b9243cd2cdd6f7)) +* :bug: add data file for ca_bundle ([b82d83f](https://github.com/continuedev/continue/commit/b82d83f79389897ed5f05eb9b5e8daf9cf64ee6f)) +* :bug: Add requestOptions to YAML config for mcp ([81c20c1](https://github.com/continuedev/continue/commit/81c20c11dbbce2eccefd00364c5b74b298b2f24f)) +* :bug: add server/exe to .vscodeignore insteading of manually removing ([e8ebff1](https://github.com/continuedev/continue/commit/e8ebff1e6b07dfaafff81ee7013bb019cbfe2075)) +* :bug: additional fixes to ssh /edit ([4428acd](https://github.com/continuedev/continue/commit/4428acdd6f372c3724a908fafb1c793e0eae4096)) +* :bug: allow end/home keys to work ([615d30e](https://github.com/continuedev/continue/commit/615d30e3dce92a9993b0e93b044faadf228529b1)) +* :bug: allow None for timeout ([ff3de11](https://github.com/continuedev/continue/commit/ff3de1184737f1124090d384b877a30550b60869)) +* :bug: another hotfix - don't destructure selectors ([534304a](https://github.com/continuedev/continue/commit/534304a2a4f9abfc221a961f279d1b43d14b6d33)) +* :bug: another windows fix in typegen.js ([f38c8fb](https://github.com/continuedev/continue/commit/f38c8fb8b33a705ed4eb4d2e0974060ebb88afd3)) +* :bug: async with Client (meilisearch) ([9a0cd64](https://github.com/continuedev/continue/commit/9a0cd644dcb5ff46817a6ea686a6de0fb764c960)) +* :bug: attempting to fix mkdir ([c1a8097](https://github.com/continuedev/continue/commit/c1a8097f0a7f3cddb0aebac26e6197ffef186972)) +* :bug: automigrate between short/long imports ([eecc2b5](https://github.com/continuedev/continue/commit/eecc2b57c5c5a144abfc0623102438e902c4aeba)) +* :bug: avoid removing disallowed file windows ([19a3266](https://github.com/continuedev/continue/commit/19a3266b6f14186bd0839fac8b2a04b5a29f32e7)) +* :bug: bug when highlighting code prior to context_manager creation ([74a52c8](https://github.com/continuedev/continue/commit/74a52c8399b3ccf2d2100b088b79e65c6ca6ad7e)) +* :bug: bug where old server doesn't get updated ([bb776a0](https://github.com/continuedev/continue/commit/bb776a03df3e6a39a1726b781ea33c2ccebd5343)) +* :bug: catch error when workspace uri isn't defined ([fc9eb30](https://github.com/continuedev/continue/commit/fc9eb3051fd5a7c9cad57b5d6cd93374bd8210fb)) +* :bug: change for/backwardslash decoding scheme ([a3a05fe](https://github.com/continuedev/continue/commit/a3a05fee312ad7c04d2abb0e186da55c7d061462)) +* :bug: chmod for linux as well as mac ([089def0](https://github.com/continuedev/continue/commit/089def08c58120f78df78c10027639802ad8f77d)) +* :bug: clear all other selector destrucuring ([145642f](https://github.com/continuedev/continue/commit/145642f1eaf01d5809dabd79e7f64f234124683e)) +* :bug: Codebase Indexing was not starting on load ([e391d58](https://github.com/continuedev/continue/commit/e391d583041c54edb3fa0836eb9186c61e6b063d)) +* :bug: compatibility with python 3.8 ([275ad6f](https://github.com/continuedev/continue/commit/275ad6f72dafdfacffd9c9b5cc4847135a30f425)) +* :bug: convert to correct path sep in wsl URIs ([1b2341a](https://github.com/continuedev/continue/commit/1b2341a0113fadf8c8d23097ef1041d3e3088e84)) +* :bug: correct path sep for ssh-remote files ([b9bd8c1](https://github.com/continuedev/continue/commit/b9bd8c1848eaf38d5d15694a1ecae67f14566214)) +* :bug: correction to ContinueConfig serialization model ([b8aba4b](https://github.com/continuedev/continue/commit/b8aba4bc96d3b064012a40d837d5191cae20037e)) +* :bug: correctly generate uris for remote ([ab31cb1](https://github.com/continuedev/continue/commit/ab31cb15fae74592f49c2ceadc8d7810228fa7e2)) +* :bug: ctrl+c for windows overriding copy ([c3925c0](https://github.com/continuedev/continue/commit/c3925c04d981d2abc1e21cf72d6e77d165420a73)) +* :bug: custom escaping instead of URI for diff paths ([da3970e](https://github.com/continuedev/continue/commit/da3970e00061b7a223d23f51bd53012666d324dc)) +* :bug: default to counting chars if tiktoken blocked ([7006dbb](https://github.com/continuedev/continue/commit/7006dbb3e38a837a2580a516791874f6815ac25f)) +* :bug: don't fail on disconnected websocket ([0876610](https://github.com/continuedev/continue/commit/08766100cdb3638b3300ae4b700f8ec2af6b9a8a)) +* :bug: don't log stdout to console ([ee4701d](https://github.com/continuedev/continue/commit/ee4701dc45cd540728302ca8a09e9b7ce842597f)) +* :bug: don't open continue automatically ([8b76f51](https://github.com/continuedev/continue/commit/8b76f518313c20f13dda605931c9929ef58a7a22)) +* :bug: don't override context length param in OpenAI ([b2a6d07](https://github.com/continuedev/continue/commit/b2a6d07ea99be1f9288ee21477edc0874e780cad)) +* :bug: ebusy and logging bug fixes ([3d61469](https://github.com/continuedev/continue/commit/3d614690cd825ac5580074ecdc22f660455204f1)) +* :bug: fix "code" keyerror prior to context_manager.start ([866b16c](https://github.com/continuedev/continue/commit/866b16c3a9c9d88a7b90aa8a43610fc4884ab123)) +* :bug: fix /edit in ssh, pinyin input in combobox ([cda1be4](https://github.com/continuedev/continue/commit/cda1be46625abd8f44962cceeded04c8c47d9f65)) +* :bug: fix >c_d.png file path ([a9bc4e2](https://github.com/continuedev/continue/commit/a9bc4e26263faef8598dd8aa2aec7949c75ab70c)) +* :bug: fix 2 model config bugs ([b144d21](https://github.com/continuedev/continue/commit/b144d21b48a94aa8c203469eb7667bd22fc4e243)) +* :bug: fix 404 from undefined gif ([b467371](https://github.com/continuedev/continue/commit/b4673712e1a6a5b435125004a9b51498207fb7b6)) +* :bug: fix automigration ([ec41f55](https://github.com/continuedev/continue/commit/ec41f553c24d5f4b5bc4e601c989b1936d67ae1a)) +* :bug: fix azure openai bug for 07 version ([a8e69a0](https://github.com/continuedev/continue/commit/a8e69a02e6897689a1727fb7542ed5684b1348e2)) +* :bug: fix broken docs link ([210a02e](https://github.com/continuedev/continue/commit/210a02ef02341a98b4ed18095b2d656a7b994bd9)) +* :bug: fix bugs when selecting code to edit ([fa34214](https://github.com/continuedev/continue/commit/fa34214012d14385d231a1ac4f16006aaf4331fb)) +* :bug: fix ci to only upload from linux x64, not alpine ([4e1a5b1](https://github.com/continuedev/continue/commit/4e1a5b1fb3f96edc95b0938265da980e98566d56)) +* :bug: fix cmd+m bug ([38e8272](https://github.com/continuedev/continue/commit/38e827243ceff3732cd0f260e7a3bd4941a96bc5)) +* :bug: fix command enter, stop streaming on reject ([8e15ec3](https://github.com/continuedev/continue/commit/8e15ec3c2c1490d4a7d6371f877368376fd64e8a)) +* :bug: fix command enter, stop streaming on reject ([19b3886](https://github.com/continuedev/continue/commit/19b38863c21656526e0729776682430e0fa277da)) +* :bug: fix config.py import paths ([97861bf](https://github.com/continuedev/continue/commit/97861bf4117bbc36f8f87797a9ca60e6336f82cc)) +* :bug: fix context length bug for /edit ([d103263](https://github.com/continuedev/continue/commit/d103263030ad52debe73bd131c71bbf17f545956)) +* :bug: fix dialog links ([4c84e69](https://github.com/continuedev/continue/commit/4c84e6945a7c2018622eceb54e7fb54de193b03a)) +* :bug: fix for --meilisearch-url flag ([e2798c5](https://github.com/continuedev/continue/commit/e2798c5bb62eeb2a3bc8f5baee18f9d64ee86563)) +* :bug: fix for Azure OpenAI model names ([bcec2a0](https://github.com/continuedev/continue/commit/bcec2a0870d0ef649961b6c91ec866b612680b9e)) +* :bug: fix for edit=None in highlightedCode update ([247d3e9](https://github.com/continuedev/continue/commit/247d3e9a41ff8d9fe2da6386bfb0d0eb063b071c)) +* :bug: fix for lmstudio defaults ([0012922](https://github.com/continuedev/continue/commit/00129229cd881d6b910a4b01db68e702cdd63a40)) +* :bug: fix for windows drive difference bug ([d69c6d4](https://github.com/continuedev/continue/commit/d69c6d4f3729374ab40fcebc861e67f2da100ad9)) +* :bug: fix ggml bug ([1a75475](https://github.com/continuedev/continue/commit/1a75475c681053494984664ef1179171fe2a5d83)) +* :bug: fix headers for openai.;y ([44fe0c9](https://github.com/continuedev/continue/commit/44fe0c94a55a753ff5d6c3da6b63db4a5c70d780)) +* :bug: fix height bug after cmd+shift+R ([a7cb092](https://github.com/continuedev/continue/commit/a7cb0929bd064f73a1e3e49ba8dd6b6b7de387f4)) +* :bug: fix history.timeline indexing bug ([01ed2c7](https://github.com/continuedev/continue/commit/01ed2c7eb2d3417b2c190eea105008372f49a7c6)) +* :bug: fix huggingface tgi ([5316180](https://github.com/continuedev/continue/commit/5316180394d48d9877cda0cb3d7c3c6de9995d12)) +* :bug: fix import in run.py ([4cf1f75](https://github.com/continuedev/continue/commit/4cf1f75518053f9df174d5ab90c426124f85ecfa)) +* :bug: fix inability to copy/paste when ipynb is open ([850c8ae](https://github.com/continuedev/continue/commit/850c8aea7f3d9c46ff8e98bde936b92282376dae)) +* :bug: fix incorrect imports in default config file ([374bdd0](https://github.com/continuedev/continue/commit/374bdd037792825bf984026da12d4100ffebcac2)) +* :bug: fix keyboard shortcut for debugging ([c021958](https://github.com/continuedev/continue/commit/c021958ae893a9683352ba99e5c6301e38331492)) +* :bug: fix meilisearch empty body content-type bug ([598e243](https://github.com/continuedev/continue/commit/598e243fd292dd8851865ab1c3915ca55f4992cc)) +* :bug: fix missing path import ([5bfe68e](https://github.com/continuedev/continue/commit/5bfe68ea7f7e90e3cb1c3101360cf959b336a857)) +* :bug: fix model changing bug ([fd4a4dc](https://github.com/continuedev/continue/commit/fd4a4dcf004bea86d982ffffb66b4e3cb38193a6)) +* :bug: fix overriding of system message ([8444e76](https://github.com/continuedev/continue/commit/8444e76b7232fbddb62d3626de13653ae332d168)) +* :bug: fix paths ([b893c95](https://github.com/continuedev/continue/commit/b893c956fe75a9e45f06129290d043737f5c1007)) +* :bug: fix reducers for user input queue ([1a36a3c](https://github.com/continuedev/continue/commit/1a36a3c02acaf6bf29d4153c113217517b832942)) +* :bug: fix replicate to work with models requiring prompt input ([84ec574](https://github.com/continuedev/continue/commit/84ec574e182ec441e95d13c3543a934e0a036228)) +* :bug: fix serialization bug for context_providers ([2799249](https://github.com/continuedev/continue/commit/27992499af977baeb9124d9ab35ffec6d36a298a)) +* :bug: fix set_system_message ([084fdac](https://github.com/continuedev/continue/commit/084fdac3992f58dcf11241e7e5c2d5efa784ce0d)) +* :bug: fix ssh /edit by checking for file through vscode fs ([417d45c](https://github.com/continuedev/continue/commit/417d45ccddc2f434d7467e4f17113783996653dd)) +* :bug: fix telemetry bug ([042bc5a](https://github.com/continuedev/continue/commit/042bc5ac76800ee66e603ef23b2bb857fafe053e)) +* :bug: Fix the generating animation ([2f402b4](https://github.com/continuedev/continue/commit/2f402b4a1227ade5a4ba70f770974627b586e930)) +* :bug: fix timeout type ([e1a0290](https://github.com/continuedev/continue/commit/e1a0290d5a699e30464f1e682cb11c6aa119bd59)) +* :bug: fix togetherAI model json parsing ([deb291c](https://github.com/continuedev/continue/commit/deb291c1b225425cba543dd3b4c5557089abfb59)) +* :bug: fix undefined.filter bug ([9b58278](https://github.com/continuedev/continue/commit/9b582781ab0aceaaf1cff7432fed92fa6c205aae)) +* :bug: fix usages of LLM.complete ([f057ee4](https://github.com/continuedev/continue/commit/f057ee4d619b834dc245065d13417a86b44dc61b)) +* :bug: fix when multiple cursor ranges are selected ([f9c145c](https://github.com/continuedev/continue/commit/f9c145c9667e0cd9adb7f9b645f7abf12f7cf2a2)) +* :bug: fix yaml syntax error ([11c7cec](https://github.com/continuedev/continue/commit/11c7cecc107ef9f2571926055dbd80495fe0f8b2)) +* :bug: fixes for a few context_providers ([41b3233](https://github.com/continuedev/continue/commit/41b3233693c34cd81c872a1e7279721b5f640d60)) +* :bug: fixes to templating messages ([c56e24d](https://github.com/continuedev/continue/commit/c56e24d2a5f2b40702e4b495fa3f28d554eaa3ab)) +* :bug: fixing bugs with ggml ([87409c3](https://github.com/continuedev/continue/commit/87409c31832ccb707abbf134843323c9eb6e1183)) +* :bug: fixing issues with creating markdown files ([5c1c2d6](https://github.com/continuedev/continue/commit/5c1c2d626ffed786d00c79aadef26fa5718ca43d)) +* :bug: fixing small UI details ([088b7b8](https://github.com/continuedev/continue/commit/088b7b803866817aaedce6b61834f1ce5de7a7c2)) +* :bug: force kill old server with taskkill on windows ([b1b7d13](https://github.com/continuedev/continue/commit/b1b7d13dbf5b9f6ada28a5ef22ea6857d3b0bcb6)) +* :bug: ftc fix ([f5f10ef](https://github.com/continuedev/continue/commit/f5f10efee3402e117c34b6f0de4bf2fd7d2819c1)) +* :bug: gpt-4-32k in CHAT_MODELS ([b0445cd](https://github.com/continuedev/continue/commit/b0445cd5fc4538c8a9c4f3e76be0f3d724c99818)) +* :bug: handle when vscode workspace not open ([73c6827](https://github.com/continuedev/continue/commit/73c6827d02ff62313184e3745fd94c7591c98b61)) +* :bug: hotfix for user_input_queue.map ([610c576](https://github.com/continuedev/continue/commit/610c576cc9df72716c5e65838f805b15431011ea)) +* :bug: install python-virtualenv on linux, fix git hash files error ([6f0e634](https://github.com/continuedev/continue/commit/6f0e6340bb22ee150ef4b7996750f4c63c0bc2a7)) +* :bug: install python-virtualenv on linux, fix git hash files error ([7fa98ff](https://github.com/continuedev/continue/commit/7fa98ffe843320ddc63794a497a2d44570e005c3)) +* :bug: kill server before trying to delete exe on windows ([286fb0e](https://github.com/continuedev/continue/commit/286fb0e20e48859f129ccf568d03248805bcbc61)) +* :bug: let context providers work without meilisearch ([0f86a69](https://github.com/continuedev/continue/commit/0f86a69e4a83458db2e20e404c26dac2e02355cf)) +* :bug: llamacpp fix indexing max_tokens ([90590ab](https://github.com/continuedev/continue/commit/90590ab4e06fbc3fa721f73a4a922136946a756f)) +* :bug: make sure server_version.txt exists ([17806d9](https://github.com/continuedev/continue/commit/17806d932502adbf974ccd93a670e57b78be9a08)) +* :bug: make typegen.js windows compatible ([dc06228](https://github.com/continuedev/continue/commit/dc0622848b648ba27e7110b9b900673bb668ab4c)) +* :bug: MAX_TOKENS_FOR_MODEL bug fix, more testing ([1c288f7](https://github.com/continuedev/continue/commit/1c288f7749747c6b1908ae16c977f80e5597d2ca)) +* :bug: meilisearch fixes ([0de6e19](https://github.com/continuedev/continue/commit/0de6e1985d0e97ede5e19e7752a6be7cd2a5818d)) +* :bug: more reliable download with request ([fdb036b](https://github.com/continuedev/continue/commit/fdb036bcecec891adaf99d73101c458fc4087406)) +* :bug: more reliable setup of meilisearch ([12a8ae1](https://github.com/continuedev/continue/commit/12a8ae1c47f111b9f36633c96b26e8642c5ff223)) +* :bug: now progress bar when api_key entered ([bf82c6f](https://github.com/continuedev/continue/commit/bf82c6fd16a6777f0a9bb68ce4879d7bab9019bb)) +* :bug: number of bug fixes ([b9bdf58](https://github.com/continuedev/continue/commit/b9bdf5894c1c68b60d1919ae07b0f5909b00dec2)) +* :bug: numerous small fixes ([0940d75](https://github.com/continuedev/continue/commit/0940d756dec3b98071ae5e5a12966e02420b3cd2)) +* :bug: patch for ocassional 0 choices from older azure versions ([5c09b80](https://github.com/continuedev/continue/commit/5c09b8077588a447d6eaac9b7f624571be3ddb1d)) +* :bug: permissions for pypi-deployment step ([b237850](https://github.com/continuedev/continue/commit/b237850c4b64435e26dfb5f12275a16a93e556a8)) +* :bug: post-merge fixes ([96379a7](https://github.com/continuedev/continue/commit/96379a7bf5b576a2338142b10932d98cbc865d59)) +* :bug: remove empty grammar from llama_cpp_args ([e5bbe3b](https://github.com/continuedev/continue/commit/e5bbe3bc4d59b6f35db1ce1b94be14244c11c766)) +* :bug: replace hardcoded path for config file ([4fe9ace](https://github.com/continuedev/continue/commit/4fe9ace518bcdcf79999ce9938ba01b218d355e4)) +* :bug: require socksio ([bba5e5e](https://github.com/continuedev/continue/commit/bba5e5e5b1da2dd924aa2632e38d4bb702bbbdd9)) +* :bug: separately load ctx provs, fix filetree ([d8e821e](https://github.com/continuedev/continue/commit/d8e821e422678fd4248b472c7f3e67a32ecfefb5)) +* :bug: set api_keys in config.py, fix spawn error handling ([6823307](https://github.com/continuedev/continue/commit/68233071dd0d97a353a66fe5627d69f97a389ca8)) +* :bug: set export display in same step as linux npm test ([c3d62c5](https://github.com/continuedev/continue/commit/c3d62c5ae203aaca32583f75a7e80dfd9f196e11)) +* :bug: small bug fix ([32d1149](https://github.com/continuedev/continue/commit/32d1149692c26eb966693f03db6d9cf496ba57a4)) +* :bug: small bug fixes ([bc75ff2](https://github.com/continuedev/continue/commit/bc75ff294a2b5ec5eef5f77aff72aaa0c7f4a3f2)) +* :bug: small fixes, update troubleshooting docs ([51fc07c](https://github.com/continuedev/continue/commit/51fc07cf6441d6330ce64e45e56e8f333ca309ed)) +* :bug: solve EBUSY by polling ([9417973](https://github.com/continuedev/continue/commit/941797359f6554ac16a2e478047aabd5cbc0404b)) +* :bug: ssh compatibility by reading from vscode.workspace.fs ([e5f5630](https://github.com/continuedev/continue/commit/e5f56308c5fd87695278682b2a36ca60df0db863)) +* :bug: start meilisearch in parallel to server ([e4c1bb4](https://github.com/continuedev/continue/commit/e4c1bb4bedbe426d090f4bb2b8819ad935c5b3fb)) +* :bug: stop streaming on rejection ([8d05fc2](https://github.com/continuedev/continue/commit/8d05fc2bb5c5df617800c1abcf43bb03c574482f)) +* :bug: stop streaming on rejection ([9fc831e](https://github.com/continuedev/continue/commit/9fc831e7587cce99c8a6f2e56905c25068c8cab6)) +* :bug: streaming url_decode for Ollama ([3690101](https://github.com/continuedev/continue/commit/3690101b790f91c749f208693aaffc00b9fa2a42)) +* :bug: templating fix for queued LLM ([5c6609a](https://github.com/continuedev/continue/commit/5c6609ab5fa3a69cd0e3e8e61df643fcce1ecb47)) +* :bug: temporarily disable lsp before fixing w/ vscode ([98f340b](https://github.com/continuedev/continue/commit/98f340bd97cba6f30cfe55d47419e3925b9dc679)) +* :bug: temporarily remove replicate altogether ([bd79c00](https://github.com/continuedev/continue/commit/bd79c00e7790b92cfd8b8c8f8211b6c3d36e33a2)) +* :bug: test and fix small issues with GGML ([72e8332](https://github.com/continuedev/continue/commit/72e83325a8eb5032c448a5e891c157987921ced2)) +* :bug: timeout on blocking processes ([345b773](https://github.com/continuedev/continue/commit/345b7734d8c887d699d5038416d2a1f8193a33e9)) +* :bug: traceback fixes, remove replicate from hiddenimports ([45d9bab](https://github.com/continuedev/continue/commit/45d9bab5cea745573be7112d7130089c596c88fa)) +* :bug: try/except around starting meilisearch ([c867cd4](https://github.com/continuedev/continue/commit/c867cd40342d44901cf5277ded25f5dc5aaa4326)) +* :bug: update search path for ripgrep on windows ([e428dc5](https://github.com/continuedev/continue/commit/e428dc53cedf54f394a7cddfe8a7ce7fbf469bb9)) +* :bug: update the tip message for keyboard shortcut ([3558450](https://github.com/continuedev/continue/commit/355845002e178a618e9a792dd57b0649c3da8845)) +* :bug: urldecode ollama responses, make edit faster ([19050f8](https://github.com/continuedev/continue/commit/19050f83228b3e7f08a6aacd5bdd1804a8315e4a)) +* :bug: use certifi to set ca_bundle_path for openai ([3849420](https://github.com/continuedev/continue/commit/3849420948e491d5f84ac485169165d887751fd3)) +* :bug: use posthog-node, not -js ([88a8166](https://github.com/continuedev/continue/commit/88a8166476d38889fd4f9323472cc34a5226e05c)) +* :bug: use powershell remove-item ([64552dc](https://github.com/continuedev/continue/commit/64552dc881509c46aa14253ff94aee9d86ade256)) +* :bug: use windows equivalent of rm -rf ([8d19866](https://github.com/continuedev/continue/commit/8d198663e116c7c77b7e59015bc6032736f71f6e)) +* :bug: verify_ssl and ssl_context mutual exclusivity ([59b7453](https://github.com/continuedev/continue/commit/59b7453afed06418d4c171b65370a6a82f5a9221)) +* :bug: version patch in the publish step ([1936f72](https://github.com/continuedev/continue/commit/1936f725d226bea2e13d5d88c1dd7a9a02ddd259)) +* :bug: windowsHide on process spawn ([c3d31f0](https://github.com/continuedev/continue/commit/c3d31f00bb589df1c83308b7d9d69ed51c31341a)) +* :bug: write out npm run package as package.js ([4636c95](https://github.com/continuedev/continue/commit/4636c9590154d6b5995948003da212eb25003750)) +* :bug: write to local diff files ([6140d05](https://github.com/continuedev/continue/commit/6140d05e7d415d3334032c300ed593bdd181f7f5)) +* :children_crossing: add slash commands to default config ([58e5dc4](https://github.com/continuedev/continue/commit/58e5dc4a5c4fcbed25170b61fbd88d479c5aebcf)) +* :children_crossing: clear the dropdown after text input cleared ([23167a5](https://github.com/continuedev/continue/commit/23167a51d959fed5e4be057ceb9fff50cf34c6c8)) +* :children_crossing: don't order meilisearch results by contnet ([ab7a90a](https://github.com/continuedev/continue/commit/ab7a90a0972188dcc7b8c28b1263c918776ca19d)) +* :children_crossing: use default model in default config.py ([1bc5777](https://github.com/continuedev/continue/commit/1bc5777ed168e47e2ef2ab1b33eecf6cbd170a61)) +* :construction_worker: copy_metadata for replicate in run.spec ([b0426d8](https://github.com/continuedev/continue/commit/b0426d82a4871e9081367ad4e977b22f42db5a89)) +* :construction: working on fixing lsp ([1f95bb2](https://github.com/continuedev/continue/commit/1f95bb287846fc0501193d642420b574d9900857)) +* :fire: remove version from package.json ([27c0a40](https://github.com/continuedev/continue/commit/27c0a403de28345cd03c39ad46c02f68ff57b3a1)) +* :goal_net: catch errors when loading to meilisearch index ([7894c8e](https://github.com/continuedev/continue/commit/7894c8ed1517394aa00f6e496a97d9e27d204f5f)) +* :goal_net: display errors in SimpleChatStep ([72784f6](https://github.com/continuedev/continue/commit/72784f6f1161f0c5b647889c26089a8247111dc9)) +* :green_heart: cd extension before packaging ([0a6d72c](https://github.com/continuedev/continue/commit/0a6d72c099316e6cffa123d3ffa915f3fe13e770)) +* :green_heart: cleanup file ([951552d](https://github.com/continuedev/continue/commit/951552dd0eede1f8f255aeaf5d34a13ff0c7bfb7)) +* :green_heart: don't exclude jedi from pyinstaller ([a1328cb](https://github.com/continuedev/continue/commit/a1328cb5431f99cfe16b246ee4201b19530404e2)) +* :green_heart: fix build scripts ([ab799b0](https://github.com/continuedev/continue/commit/ab799b0b0133e926ea06a1a12c092f42b9e053a1)) +* :green_heart: fix copy statement to include.exe for windows ([36c3dfd](https://github.com/continuedev/continue/commit/36c3dfd51d319b9b9ad392988d13ef7f443e0937)) +* :green_heart: fix preview.yaml ([a736d62](https://github.com/continuedev/continue/commit/a736d62f0e8b9b80ab9a949fd1739fb9a3be26e1)) +* :green_heart: increase testing timeout to allow for fkill ([08b1cfd](https://github.com/continuedev/continue/commit/08b1cfdd2f6f456df7344c16f5d229a0ccfb841b)) +* :green_heart: install rosetta ([5b9ef10](https://github.com/continuedev/continue/commit/5b9ef102973c608bc409a7b9ec244a4be1494e96)) +* :green_heart: one last test ([758520f](https://github.com/continuedev/continue/commit/758520fe6b59d3330dec80ac07d05282d36e0058)) +* :green_heart: only upload once per binary ([490838a](https://github.com/continuedev/continue/commit/490838a8ad920a52ada7e85675aefd965e978d77)) +* :green_heart: package patch ([34f32ed](https://github.com/continuedev/continue/commit/34f32ed5f71055ea11d4332f18e77ceba5849631)) +* :green_heart: package:pre-release ([d3f21da](https://github.com/continuedev/continue/commit/d3f21da803e36b78f968c2216d9f93f90ebabd6a)) +* :green_heart: publish as pre-release! ([831bf5e](https://github.com/continuedev/continue/commit/831bf5e7f7c48dd80f71f1256f5597bd47bf22de)) +* :green_heart: publishing to depend on ALL tests ([a131c17](https://github.com/continuedev/continue/commit/a131c17326591e67a68faf6f96371ad8fc332b71)) +* :green_heart: pull origin main in main.yaml after pypi update ([6a9a079](https://github.com/continuedev/continue/commit/6a9a079914d94419183182cd0a5cc4439f2101ad)) +* :green_heart: remove "patch" from vsce publish command ([d8327ec](https://github.com/continuedev/continue/commit/d8327ec6f82058479bd294bfcdccaf3c2b54de0a)) +* :green_heart: remove npm_config_arch ([8c51664](https://github.com/continuedev/continue/commit/8c5166471b0d83b924d8bee1e0ca51822cc1bbdc)) +* :green_heart: remove version from apckage.json ([5438ce9](https://github.com/continuedev/continue/commit/5438ce94406baa0f7d131ecacadefc72912dca0d)) +* :green_heart: set permissions on apple silicon binary ([715cfed](https://github.com/continuedev/continue/commit/715cfed18747b6bc2e6d7bd7a977d249cc9066d5)) +* :green_heart: testing ([14062c5](https://github.com/continuedev/continue/commit/14062c5c385bb7ba80096bf7daf6b6a5568b0b54)) +* :green_heart: testing for failure to package dist in vsix ([19acf3b](https://github.com/continuedev/continue/commit/19acf3bb36c1e44274297c806b89b589ca02f5ba)) +* :green_heart: update permissions and version ([c4ed41c](https://github.com/continuedev/continue/commit/c4ed41c861573f4c9bdff1a21ca3e056cfdd766e)) +* :green_heart: update pylsp hidden import ([1e8ea65](https://github.com/continuedev/continue/commit/1e8ea654f5ad1e06bff2660b54a50955098703ba)) +* :green_heart: update pypi version, don't push from main ([208eb65](https://github.com/continuedev/continue/commit/208eb65f67ccc62ce6d683fd9bed2fe9524b2136)) +* :green_heart: use curl to download binary ([199e4b3](https://github.com/continuedev/continue/commit/199e4b3b99642ba5b1558132aa10119be1eeb525)) +* :heavy_plus_sign: add bs4 to requirements.txt ([8a1e6fb](https://github.com/continuedev/continue/commit/8a1e6fb4adec6e5febb2a0d78eb0b2a01bfa028b)) +* :heavy_plus_sign: add ripgrepy dependency to requirements.txt ([9801b50](https://github.com/continuedev/continue/commit/9801b50192ca661972d5b2997028db3cd0725fb7)) +* :heavy_plus_sign: hidden import for replicate ([b75555f](https://github.com/continuedev/continue/commit/b75555f106be3c7612e7c31818ff674485096e4f)) +* :heavy_plus_sign: include replicate in requirements.rtxt ([01b3f1f](https://github.com/continuedev/continue/commit/01b3f1ff8f4dd89ae79f15626ef5a3af2bc558c4)) +* :lipstick: don't display entirety of large tracebacks ([a74eda5](https://github.com/continuedev/continue/commit/a74eda56cfcafb5c463a74df564ced6f882f8d3e)) +* :lipstick: fix layout bugs ([b655781](https://github.com/continuedev/continue/commit/b6557810d70a7f341761d5018fa2835cc3a50af1)) +* :lipstick: fix UI problems in vscode light themes ([5e8866d](https://github.com/continuedev/continue/commit/5e8866da83f8a97cb8492f26e175b948d0282262)) +* :lipstick: logo alignment, better config failure description, patch ([c51ad53](https://github.com/continuedev/continue/commit/c51ad538deff06af6c9e5498b23e3536e18bfc4c)) +* :lipstick: nicer autoscroll ([88699ff](https://github.com/continuedev/continue/commit/88699ff909b026511da392bf2c0a96be02abc6fd)) +* :lipstick: small UI improvements ([ec4fb4d](https://github.com/continuedev/continue/commit/ec4fb4d9235151901c1f7367932ecc17ab55d8e4)) +* :lipstick: ui tweaks to history + scrollbars ([6e8885f](https://github.com/continuedev/continue/commit/6e8885fc2f7feb06ef6ac87d2d7688f9f33d15de)) +* :lipstick: update font size for input, remove first tutorial step ([73ff267](https://github.com/continuedev/continue/commit/73ff2678ad984c9d9082ec078a38450d5daa1376)) +* :lipstick: update light gray hex code ([e0e0482](https://github.com/continuedev/continue/commit/e0e0482f2af2eadd3df72fbdb6974c07ba11c527)) +* :lock: opt out of meilisearch analytics ([8db5b39](https://github.com/continuedev/continue/commit/8db5b39170229ba93b83f526e7fd80056e461c6a)) +* :loud_sound: better logging for ggml completion endpoint ([0459b0c](https://github.com/continuedev/continue/commit/0459b0c919903852254ac2cd081307788884cd84)) +* :loud_sound: fix logs to be sent from uvicorn ([d3b4103](https://github.com/continuedev/continue/commit/d3b4103cd2f639fc072b8a3269d7730478c8bb1c)) +* :loud_sound: websocket logging and horizontal scrollbar ([7bb0fe3](https://github.com/continuedev/continue/commit/7bb0fe34bbc8affce0c675b88ffb79a6b9985860)) +* :memo: escape in docs ([7314e79](https://github.com/continuedev/continue/commit/7314e79ac5bc34936a2c3de0fd01aadbfe640e72)) +* :memo: fix deployent readme ([7a38025](https://github.com/continuedev/continue/commit/7a3802523c2e5ae136c39849e2fbb0d3e7bba63e)) +* :memo: remove reference duplicates for ctx providers ([043d695](https://github.com/continuedev/continue/commit/043d695198caed305fa6651918c3bbb2de87db36)) +* :memo: small fix in troubleshooting.md ([275a03b](https://github.com/continuedev/continue/commit/275a03b7f1e32f57bd68e501074aa80e0dbed40f)) +* :memo: use backup server links in docs ([815627b](https://github.com/continuedev/continue/commit/815627b167e4bf06308b51c6756e33c36b17b631)) +* :pencil2: Fix typo that was causing automatic version bumping not to work for intellij ([3daf2c7](https://github.com/continuedev/continue/commit/3daf2c7b23caf838b862c2d2791ae8655b761d12)) +* :rocket: fallback s3 bucket ([aa98080](https://github.com/continuedev/continue/commit/aa98080cb16c75d2b7d6d9771b97e63120052c62)) +* :safety_vest: more safely convert windows path to posix ([4309f9d](https://github.com/continuedev/continue/commit/4309f9def89c25611273d99db01e7cc477ad935e)) +* :white_check_mark: allow longer for python server to start in test ([d8f5f10](https://github.com/continuedev/continue/commit/d8f5f102f6f91487be0281316e581858ec4ca260)) +* :white_check_mark: allow longer wait in test ([40ec1a3](https://github.com/continuedev/continue/commit/40ec1a31a7cd37da8b75bbabf1f0d160bb7bec5d)) +* :zap: register vscode commands prior to server loading ([f7a3659](https://github.com/continuedev/continue/commit/f7a3659381f839b890f2c53086f7fedecf23d9ab)) +* :zap: update count_tokens method ([8214203](https://github.com/continuedev/continue/commit/82142033f935d6236620d82e31a70ea8f2fb243e)) +* 'inferenceConfig.stopSequences' failed to satisfy constraint: Member must have length less than or equal to 4 [#2538](https://github.com/continuedev/continue/issues/2538) ([90e994d](https://github.com/continuedev/continue/commit/90e994db3c106f9b63bd043203111e5e101071ba)) +* (very) small typo breaking the prompt file examples link! ([bd6f9b9](https://github.com/continuedev/continue/commit/bd6f9b969647ee8cf6138dca63538063414553bb)) +* `REPLACE INTO` code_snippet table ([bdb967d](https://github.com/continuedev/continue/commit/bdb967d7b3c18fa2e0237f3cc0e0ea7415102715)) +* 🐛 Codebase Indexing still not work ([955ab93](https://github.com/continuedev/continue/commit/955ab93efc3f488127d16673b89f3900f75c2007)) +* 🐛 typo in core.py ([#429](https://github.com/continuedev/continue/issues/429)) ([705324e](https://github.com/continuedev/continue/commit/705324ed2ef588b2885c0b03107b9e30ae358dae)) +* a bunch of bugs, commit residuals such as npm install pg ([6d74e6b](https://github.com/continuedev/continue/commit/6d74e6b1fedf18b11ea12ba38164fcd146fdba4b)) +* actions ([653ca20](https://github.com/continuedev/continue/commit/653ca205dfbe2f7fec94891c99053d393d3efd0c)) +* add .mvn/ to list of default ignored folders ([ec91021](https://github.com/continuedev/continue/commit/ec91021adfcbd49becc3fdfbee6784981238a9f4)) +* add 'rich' module to requirements.txt ([#612](https://github.com/continuedev/continue/issues/612)) ([5d21bdf](https://github.com/continuedev/continue/commit/5d21bdf2930b30723f1fd80b05d8c1c2ad589bb2)) +* add checkmark icon to indicate selected model in dropdown ([98a3219](https://github.com/continuedev/continue/commit/98a321939ea1ba551025b16dc09f13e7a5e980ca)) +* add code range for quick actions/fixes ([#1687](https://github.com/continuedev/continue/issues/1687)) ([9f2e9bc](https://github.com/continuedev/continue/commit/9f2e9bc2dff474447d8502e386bb0cc804730bb9)) +* add context provider ([ae888d9](https://github.com/continuedev/continue/commit/ae888d9e814cf10931222070ed1e2ae5438325fe)) +* Add context/getSymbolsForFiles endpoint in JetBrains and handle symbol retrieval errors ([ba1fdf7](https://github.com/continuedev/continue/commit/ba1fdf7bac07afe04e62bd659a87dc89800a302b)) +* Add ContinuePluginDisposable to avoid memory leaks in Jetbrains ([a48a150](https://github.com/continuedev/continue/commit/a48a150b2024fca63cb50fb09a914a391c0cfce5)) +* add Delphi/Pascal syntax highlighting support ([cfcb06b](https://github.com/continuedev/continue/commit/cfcb06b1763b17e9e6d150963e090523c372d5d6)) +* Add directory checks and optimize token usage ([79736c3](https://github.com/continuedev/continue/commit/79736c3108313204184bb7d833ac21e23341354f)) +* add focus to InputToolbar on click ([#703](https://github.com/continuedev/continue/issues/703)) ([6b17de4](https://github.com/continuedev/continue/commit/6b17de49ed0e991221baee986f9dbb758d55f291)) +* add hover effect and restrict clickable area for the history and more back buttons ([9662b18](https://github.com/continuedev/continue/commit/9662b18a1ff36d8eaf743003f4df501245a31be2)) +* add missing eos_token for qwen2.5-coder ([6a7eea2](https://github.com/continuedev/continue/commit/6a7eea27ca5d1ade790ce08dc1cf4eb7bbdeb585)) +* add missing import ([400be9b](https://github.com/continuedev/continue/commit/400be9b47f0b8ab52b4e32ca77339497c63c8f96)) +* add mistral model options to config schema ([d56b48c](https://github.com/continuedev/continue/commit/d56b48cad2fcb0bb8e4a3e0dd3e32ab7f704d762)) +* add Msty logo ([397dcf4](https://github.com/continuedev/continue/commit/397dcf4ccc663560a49ff41e5892a5c118bce02e)) +* add new UI breakpoints ([5105645](https://github.com/continuedev/continue/commit/5105645dedec92abd3fc613777f60fd2a638a0ab)) +* add unit tests for commandExtractor and improve multiline comment handling ([0d940ec](https://github.com/continuedev/continue/commit/0d940ec6d1377b38945bd6217040cd025f89a80c)) +* add uuid to chat msgs for deletions ([f63fd5d](https://github.com/continuedev/continue/commit/f63fd5d83cefbbe01721515a8f28f435353bd804)) +* addTag ([53f886f](https://github.com/continuedev/continue/commit/53f886fd40c7bca29de06156f0e713a9700cc189)) +* allow downloading missing embedder on Ollama, in VS Code ([1dc58c6](https://github.com/continuedev/continue/commit/1dc58c63ab174f579e860d778ae85e73f6fb8c9d)) +* always show close icon ([4faed0b](https://github.com/continuedev/continue/commit/4faed0bc17a2b79e24fe5133efc40868bccaa6aa)) +* apply actions in toolbar ([cd810eb](https://github.com/continuedev/continue/commit/cd810eb93939bccc5bc0ff1e5c54572c7d27a97d)) +* apply insertion bug ([ceb9277](https://github.com/continuedev/continue/commit/ceb92773e9a6e4da27aa2de8f871c07f1e23d1a7)) +* apply notch filename trunaction ([033ade0](https://github.com/continuedev/continue/commit/033ade024ed685ef66dad53e675449a47e2dc872)) +* artifact name ([85e3fbc](https://github.com/continuedev/continue/commit/85e3fbc1c73872b1dfd8aee1f1dcef26b9f37761)) +* artifact upload ([1039e77](https://github.com/continuedev/continue/commit/1039e777c8a081ed9362f29e20c7c6133f3b07cd)) +* attempt to fix [#485](https://github.com/continuedev/continue/issues/485) ([#498](https://github.com/continuedev/continue/issues/498)) ([1188dd7](https://github.com/continuedev/continue/commit/1188dd7e5f26ed57d034c927ba032739963b9abc)) +* auth ([72636d9](https://github.com/continuedev/continue/commit/72636d96c8d8bb303e66f2344f5eeef26f078816)) +* autocomplete label after selecting a query type context provider ([#1562](https://github.com/continuedev/continue/issues/1562)) ([6407458](https://github.com/continuedev/continue/commit/6407458d7626d52558ea760b79a03129caba14ff)) +* autocomplete logging + input layout ([c542e5d](https://github.com/continuedev/continue/commit/c542e5d6153078f42e8eaf4361a4e5bdf24d9bc2)) +* Autocomplete not working when lookup is selected ([346f8fe](https://github.com/continuedev/continue/commit/346f8fe191a96eab5903b9a9f5a1e7e5ea1e3ee2)) +* avoid parsing md rules as yaml ([6c24132](https://github.com/continuedev/continue/commit/6c24132fab5b1c828aeb2e162c0f07ab6c830d0d)) +* binary ([8f24197](https://github.com/continuedev/continue/commit/8f2419740044a5df2ca70905c2b9ecd0fef3389e)) +* broken build ([d09711a](https://github.com/continuedev/continue/commit/d09711ab5895aca1c91552e7d9140b3aa0535d77)) +* broken help center quickpick ([a83526d](https://github.com/continuedev/continue/commit/a83526d6a49df6589d107695f99c03d02b68629c)) +* broken imports ([5fd8d2c](https://github.com/continuedev/continue/commit/5fd8d2cae5926418116031dbab8ce9465bc4c8f9)) +* broken imports ([f60009c](https://github.com/continuedev/continue/commit/f60009c2ea7c1c1a980152e5aa3cda17c3f6e64d)) +* broken JB build ([0e2587c](https://github.com/continuedev/continue/commit/0e2587cc71f497141ccd5fc807624eac80f8f183)) +* broken link ([6a675d8](https://github.com/continuedev/continue/commit/6a675d8edce1e430faa32b5142554bf61b843e0a)) +* broken schema config ([0529ae8](https://github.com/continuedev/continue/commit/0529ae8e1e4f61d83f2a4c43c9b9d23a84192ec9)) +* browse functionality ([ef5d753](https://github.com/continuedev/continue/commit/ef5d7535f0860978baeb337930f266b1201a7a5c)) +* build issues with jetbrains ([267961f](https://github.com/continuedev/continue/commit/267961f5b67f8f4529917fc43ebc1df88db92b51)) +* bump extension tester version ([006e1e4](https://github.com/continuedev/continue/commit/006e1e4b3bad2a8545a492cbeeb3238a1bf3345b)) +* bump node.js dependencies ([18fd7fb](https://github.com/continuedev/continue/commit/18fd7fbe58a03dfda382f755e261c5f16e88f38e)) +* cache ([368d264](https://github.com/continuedev/continue/commit/368d264d221793b7f2439678cef9b8b032135529)) +* caching ([1e7aa1a](https://github.com/continuedev/continue/commit/1e7aa1a879c80c0acddf09fbe0d887b7ec9bd31d)) +* change from llama3.1-8b to llama3.1:8b ([ea060a3](https://github.com/continuedev/continue/commit/ea060a37567af620cbdb8d665beb3f36cfeada6d)) +* chat tests ([7be3bb4](https://github.com/continuedev/continue/commit/7be3bb4161e7a17f7b0ae6e8d3ce365479e70dde)) +* ci ([1f47f54](https://github.com/continuedev/continue/commit/1f47f5436dde900b04cf1b307efa64f0fecebd59)) +* ci ([f6f2633](https://github.com/continuedev/continue/commit/f6f263375be129e438ab46a3ddbbba0722d3eb24)) +* ci ([fa9f86b](https://github.com/continuedev/continue/commit/fa9f86b6fd9ddb8cfab7dc52772c9f5a0623d654)) +* CI checks + fix for broken config-yaml types ([2032a8c](https://github.com/continuedev/continue/commit/2032a8c31ce9f30a5996a0fa6566d840a1eae21b)) +* ci e2e tests ([ade32d4](https://github.com/continuedev/continue/commit/ade32d428c5ef0fc8f5daefd52571b95387002f3)) +* ci tests ([27d20eb](https://github.com/continuedev/continue/commit/27d20eb08b25b142a54641048670b036e201ea1d)) +* circular state in redux selector ([5921bfa](https://github.com/continuedev/continue/commit/5921bfac67237dd4ea34dc1aad7856b220adf062)) +* cleanup model select ([1933a29](https://github.com/continuedev/continue/commit/1933a29ec4536d4887130703f1b0f94c3cd3db8d)) +* Clear all diff blocks before streaming and ensure dispose is run on EDT ([41357cd](https://github.com/continuedev/continue/commit/41357cd00c72b61cd54b80aa3963d047c0bb4184)) +* Clipboard is not available in chat window ([ef26b7c](https://github.com/continuedev/continue/commit/ef26b7c80eb0cc503017df8b9abd634f868a9b89)) +* close extension after tests ([575a707](https://github.com/continuedev/continue/commit/575a70721b39e41bfe8b860824d5eb606ce29ba9)) +* close sidebar when cmd+l pressed on focus ([93c9507](https://github.com/continuedev/continue/commit/93c95075425179d27421c7b54d92c9235d914c3c)) +* Cloudflare Workers AI message handling ([7eff255](https://github.com/continuedev/continue/commit/7eff25595c6aa063db37fb2d5394447c8472ba20)) +* cmd+shft+l closes sidebar if focused ([#1638](https://github.com/continuedev/continue/issues/1638)) ([92b5c4c](https://github.com/continuedev/continue/commit/92b5c4ccf64a88c461bb32abc9ab02329651e6be)), closes [#1536](https://github.com/continuedev/continue/issues/1536) [#1456](https://github.com/continuedev/continue/issues/1456) [#1564](https://github.com/continuedev/continue/issues/1564) [#1576](https://github.com/continuedev/continue/issues/1576) [#1570](https://github.com/continuedev/continue/issues/1570) [#1582](https://github.com/continuedev/continue/issues/1582) [#1600](https://github.com/continuedev/continue/issues/1600) [#1618](https://github.com/continuedev/continue/issues/1618) [#1626](https://github.com/continuedev/continue/issues/1626) [#1637](https://github.com/continuedev/continue/issues/1637) +* code automatically expands after pressing enter ([42c02be](https://github.com/continuedev/continue/commit/42c02bed5fb61f925eb829cd8e7e39425225cc30)) +* codestral template ([d56a33e](https://github.com/continuedev/continue/commit/d56a33ea06f7c9724ffaef86d71bbb8d31840fc8)) +* colocation ([fb28272](https://github.com/continuedev/continue/commit/fb282727e92237f6b14e28e3538e04e13b837f1e)) +* colocation ([e1d227c](https://github.com/continuedev/continue/commit/e1d227cbc3ea56e607fce5c5ce585c2b901f6029)) +* comment out auto apply on MFE ([f61476a](https://github.com/continuedev/continue/commit/f61476a4936f364b4d0adc679da067d5f3ee8411)) +* completions ([a2f62da](https://github.com/continuedev/continue/commit/a2f62dad3b4df8a9a243964584eed148835a077b)) +* config error handling ([170676a](https://github.com/continuedev/continue/commit/170676a46149a4e507f827aa566f4b1d39344e2e)) +* config-types "useSuffix" to "useFileSuffix" ([fa3afd5](https://github.com/continuedev/continue/commit/fa3afd52e766c298a9bfa62c57e8a9b6e695b1d6)) +* **continue:** update context for slash commands ([cfac639](https://github.com/continuedev/continue/commit/cfac639e44ff5ba13960bbed6756047a90ed93f2)) +* convert `walkDir` to an async generator ([#1783](https://github.com/continuedev/continue/issues/1783)) ([6824497](https://github.com/continuedev/continue/commit/68244977d377e1706a20892abc059bf5cb70bc71)) +* copy ([5e122b7](https://github.com/continuedev/continue/commit/5e122b76b3cf5f0f511101bb1b2cea1349fa3a7a)) +* **core:** delete indexed docs if re-indexing ([acea620](https://github.com/continuedev/continue/commit/acea620043d2c48826266d4f1f73eaf42819f0c6)) +* **core:** remove eslint config and fix errors ([#1457](https://github.com/continuedev/continue/issues/1457)) ([3e1c06b](https://github.com/continuedev/continue/commit/3e1c06b41b7b90a0cad026c0ba0433fb1be6d277)) +* **core:** use `TextDecoderStream` for stream response ([#1498](https://github.com/continuedev/continue/issues/1498)) ([09d256a](https://github.com/continuedev/continue/commit/09d256ad562eda0919b9fa2853176319bf4eda36)) +* correct formatting ([cbb5c21](https://github.com/continuedev/continue/commit/cbb5c21f591e078df186fd86865830cb8971be03)) +* correct llama2TemplateMessages ([#855](https://github.com/continuedev/continue/issues/855)) ([f95a54d](https://github.com/continuedev/continue/commit/f95a54d9c29247680839129c54eae912ba5ca85d)) +* correct package.json update ([02968fb](https://github.com/continuedev/continue/commit/02968fb1551c0a26af75340641312e1f9f5a1102)) +* correct typo in stop sequence ([0dac76e](https://github.com/continuedev/continue/commit/0dac76edf5f35226cf6b3e99c83a7c02273cc05c)) +* corrected typo in the info Alert paragraph ([be55052](https://github.com/continuedev/continue/commit/be55052d230b50635c43727127ee776e67bd4c20)) +* cursor focus issue causing unwanted return to text area ([#1086](https://github.com/continuedev/continue/issues/1086)) ([c54cd7a](https://github.com/continuedev/continue/commit/c54cd7a26dd2e4e8743be86c6ac22dd1c8dca774)), closes [#1078](https://github.com/continuedev/continue/issues/1078) +* cursor position ([6284eee](https://github.com/continuedev/continue/commit/6284eeebef984ac1afd3846b606a7745c5dfb49d)) +* cycling through chat messages ([b3ac143](https://github.com/continuedev/continue/commit/b3ac14332e8bd89237dfa41847701e3378487145)) +* deepseek doesn't support 'https://api.deepseek.com/completions' URL currently. When user selecting code in editor, and then use 'CMD +I' command to let model to modify codes, 400 error happens. ([170b99d](https://github.com/continuedev/continue/commit/170b99d3261b7d2ef32ba9e03a51ac37bb1fb787)) +* delete all code_snippets ([b9114bb](https://github.com/continuedev/continue/commit/b9114bbdab90de0dd167c88b57bd96b27ad03524)) +* delete button default style ([5423d24](https://github.com/continuedev/continue/commit/5423d24c35c614b0970e472aafa1f1048bf0d970)) +* delete old docs index on force re-index ([#1778](https://github.com/continuedev/continue/issues/1778)) ([0d632ea](https://github.com/continuedev/continue/commit/0d632eabbfd512c813e65212c3f5765bbc3fc8c7)) +* dependencies ([384fb56](https://github.com/continuedev/continue/commit/384fb562e5aac023301d592a186982a4b575fe98)) +* dependencies ([8efb3be](https://github.com/continuedev/continue/commit/8efb3be1b1f2253f9a7fd3035d8f0055de8f426e)) +* dependencies ([cc063fd](https://github.com/continuedev/continue/commit/cc063fdd124d66515bdcb9e2c64f575b40cc99d8)) +* dependencies ([fccae87](https://github.com/continuedev/continue/commit/fccae8732e1a4f447ff0ab650e9ae717c2022ffc)) +* Desktop.browse on linux ([7a11446](https://github.com/continuedev/continue/commit/7a11446bfc5d4cb9c05f64f1377518456d30f530)) +* disable completions in the commit box ([2b611df](https://github.com/continuedev/continue/commit/2b611df53ba716c2b550ab3b275c571eed9d2c65)) +* disable indexing for unsupported CPUs ([a005aa7](https://github.com/continuedev/continue/commit/a005aa78ac75ac47be3e647e9e23b45eab7dafaf)) +* disable lancedb cpu check ([b496777](https://github.com/continuedev/continue/commit/b49677711b4340f57ba671bacda301138c2909fb)) +* Do not break completion for unsupported FS providers ([4d1a33f](https://github.com/continuedev/continue/commit/4d1a33fd794a7415b0cc3b8de1d349fbba5a01cb)) +* do not filter context providers if not in editMode ([b2182b9](https://github.com/continuedev/continue/commit/b2182b9c8568a38d3af179909fb305e1459f5276)) +* do not write to the cache if caching is disabled ([b29ed9d](https://github.com/continuedev/continue/commit/b29ed9d34aa7ae343a2fd0c767f315e46e9aa110)) +* docs and install dependencies task for new directory structure ([#551](https://github.com/continuedev/continue/issues/551)) ([6ef8ae6](https://github.com/continuedev/continue/commit/6ef8ae6d5ab7efb1e928ff6474b6ac7a804a34cc)) +* **docs:** contributing guide ([5a06dfe](https://github.com/continuedev/continue/commit/5a06dfe1fb865bed0ca76ff23816da6396a0b27d)) +* **docs:** correct openai api key name ([9cc25c1](https://github.com/continuedev/continue/commit/9cc25c18c9fff5fc6ac4d56153667b0e8311920c)) +* **DocsCrawler:** Add response.ok check and improve link splitting ([d613b5a](https://github.com/continuedev/continue/commit/d613b5a7da5ad15c8b4b7dfe949812045f69635c)) +* don't override embeddings model name with UNSPECIFIED ([bc79388](https://github.com/continuedev/continue/commit/bc79388634ebcfcf2e38aa240441f9939e9de85a)) +* don't return empty string ([403eb38](https://github.com/continuedev/continue/commit/403eb38b9e3e38c277daed4ac6a2b6ac54353570)) +* dont toggle models when toggling assistants ([5bd8dd4](https://github.com/continuedev/continue/commit/5bd8dd4cb759bbabc35bdc00c66d88e4a175f7a8)) +* double ssh retries ([c9e2ebc](https://github.com/continuedev/continue/commit/c9e2ebc4589f7a06e804daee7f2ce6d7b2b66ce2)) +* dropdown with the height of the sticky div ([#605](https://github.com/continuedev/continue/issues/605)) ([a8d6ff0](https://github.com/continuedev/continue/commit/a8d6ff04e43a81a3c76373469ffebdfcfa8ac9f2)) +* editor focus handling on click events ([#716](https://github.com/continuedev/continue/issues/716)) ([f1660a5](https://github.com/continuedev/continue/commit/f1660a533146c420253df6e2dec0e0d4a2a9ebf4)) +* Eliminate Uncaught TypeError in dev tools ([d342825](https://github.com/continuedev/continue/commit/d3428256543bcc5ab269df93c949b56df92793f2)) +* Empty file inserts incorrect content ([ba9027b](https://github.com/continuedev/continue/commit/ba9027baea44ca51d299804636771d1a084d5fa7)) +* empty last message ([d3f7795](https://github.com/continuedev/continue/commit/d3f7795e6133fe7452c0626e6a54fb229bacbd7b)) +* enable OSR for mac after validations ([db77b50](https://github.com/continuedev/continue/commit/db77b5020d9b93cb4a7504e213d81940dbee9eaa)) +* end thinking for reasoning models when request is complete ([5109685](https://github.com/continuedev/continue/commit/51096858ab1ddc2bee534c1ea848be2b4bdcfb3f)) +* ensure code preview uses one more backtick than in the selected code as a fence ([#742](https://github.com/continuedev/continue/issues/742)) ([9ce7770](https://github.com/continuedev/continue/commit/9ce7770066cf870d2d1f36883f5e867157373eda)) +* ensure template variables are only processed for stdio MCP servers ([99b1ab2](https://github.com/continuedev/continue/commit/99b1ab2ebe51b4678722703922ecca023afa911c)) +* Ensure that the state is cleared after refresh, and files->uris when the file changes ([abd8907](https://github.com/continuedev/continue/commit/abd890738111e51bf12a700f9e5e8e66a7c76235)) +* Ensure valid line index for highlighter ([f86c95e](https://github.com/continuedev/continue/commit/f86c95ebdbd1851bcbf0e6f22d18a348a8a154ed)) +* error ([4c7f918](https://github.com/continuedev/continue/commit/4c7f9182665a259fc6b9cf10c93e696e97400a2c)) +* error printing bug leading to uncaught err ([3af4d6b](https://github.com/continuedev/continue/commit/3af4d6b1edeac113499cc9626cea75a5083b1030)) +* exclude open-codestral-mamba from supported models ([c6591f8](https://github.com/continuedev/continue/commit/c6591f836ea73e1244a0e965111f7c599669d9fa)) +* **extensions:** schema for db ctx provider ([#1534](https://github.com/continuedev/continue/issues/1534)) ([6fdad55](https://github.com/continuedev/continue/commit/6fdad553b6ac7f64c1bb23617dbe313e16174a56)) +* failing azure llm test ([546b52a](https://github.com/continuedev/continue/commit/546b52a2df928687d56924f593108f5bb9235712)) +* failing test ([ec2a72d](https://github.com/continuedev/continue/commit/ec2a72dfabbe7bd9c220b18b55145f431e19f3bf)) +* failing test ([002ecc9](https://github.com/continuedev/continue/commit/002ecc9b519472e0968e9f227894f3143c87f1ec)) +* failing test ([07b6b0c](https://github.com/continuedev/continue/commit/07b6b0cbefe86f2efa5488a33060ee9eb9f20e4d)) +* failing tests ([88ccb74](https://github.com/continuedev/continue/commit/88ccb74f7e69cf816d27f15a318a42c11f6d2aa5)) +* failing tests ([cb2e0a7](https://github.com/continuedev/continue/commit/cb2e0a7c0e9330d9b79a3e9878c851b9eba92ade)) +* failing tests ([7b52ff7](https://github.com/continuedev/continue/commit/7b52ff74d4009cb85c32a5e9482bd3624931d21e)) +* failing tests ([8d29d41](https://github.com/continuedev/continue/commit/8d29d4158d0fe21b0c0c4722e8d23715acf9ebdf)) +* failing tests ([2b828b0](https://github.com/continuedev/continue/commit/2b828b0e7b455bf6b0f9ae5a6f6a705ab4cefe6a)) +* field name fix ([0de1a2f](https://github.com/continuedev/continue/commit/0de1a2ff8937452815311c806a038a7f6d75fdf8)) +* filepath replacements in prompt files ([#1939](https://github.com/continuedev/continue/issues/1939)) ([c0923a0](https://github.com/continuedev/continue/commit/c0923a0dd7ca3a6e9dcbd9b02bfc34250269d2ef)) +* fix [#709](https://github.com/continuedev/continue/issues/709) ([#712](https://github.com/continuedev/continue/issues/712)) ([9ae07cd](https://github.com/continuedev/continue/commit/9ae07cd711d011faaf9a79952c0e213a6aa72e87)) +* fix 100% indexing progress ([7f214ad](https://github.com/continuedev/continue/commit/7f214adcbdca33ebb7270f721fd57eeeb0bac1e8)) +* fixed misallignment in tests caused by linter ([15e93dd](https://github.com/continuedev/continue/commit/15e93dd5d0dc3b5dcd00504833beacbddbfe44f3)) +* format code ([1d000be](https://github.com/continuedev/continue/commit/1d000bec682d1d723bf6748f34c3dd86b684d775)) +* formatting ([9efd0e1](https://github.com/continuedev/continue/commit/9efd0e128ef464d45379e84abf15e98ad1b24d40)) +* formatting ([2284291](https://github.com/continuedev/continue/commit/22842919489ad272edfa182e9f8af3a26d9813ae)) +* formatting ([4d70d3d](https://github.com/continuedev/continue/commit/4d70d3dcbd646b1aa1cb6e586439459dec2db462)) +* free trial config.json updates ([905f064](https://github.com/continuedev/continue/commit/905f064543e71864eaeb4e039e5d55fe2da845fd)) +* fullscreen gui retains context when hidden, fixed fullscreen focusing ([#1582](https://github.com/continuedev/continue/issues/1582)) ([679e26d](https://github.com/continuedev/continue/commit/679e26d4a8a81402d57a64d819f347d9f56d42e0)) +* gemini tool calls with MCP ([9ca4ad4](https://github.com/continuedev/continue/commit/9ca4ad4afe04fbfc3a6e0e6d447dd81ff22b4369)) +* getting diff ([9431131](https://github.com/continuedev/continue/commit/9431131f1cbbc5fe742c033a8baf970241c63378)) +* **google:** remove unnecessary parameter ([#394](https://github.com/continuedev/continue/issues/394)) ([938c1db](https://github.com/continuedev/continue/commit/938c1db5b37d5332ff5d188f4fa79f3bc6b7549a)) +* grab PATH for mcp connections ([60ec3ac](https://github.com/continuedev/continue/commit/60ec3ac452f0b25d176728dfe6e83e4f34ade745)) +* grammar ([58feb0b](https://github.com/continuedev/continue/commit/58feb0b8622e5f64737594ccbfd94aff2e9687c5)) +* **gui:** ctx rendering w/ renderInlineAs: "" ([#1541](https://github.com/continuedev/continue/issues/1541)) ([8a92f43](https://github.com/continuedev/continue/commit/8a92f4312693549a1590e99c70152b843d59b119)) +* **gui:** passing style props on StyledTooltip ([41e1eb5](https://github.com/continuedev/continue/commit/41e1eb582bec8676fc973c3a2b76259344fbb317)) +* **gui:** typo ([3d53809](https://github.com/continuedev/continue/commit/3d5380908292bb4373a122a802f2011dd0283f62)) +* handle apiType for azure w/ proxy ([036e196](https://github.com/continuedev/continue/commit/036e19618b86600e4e9c5ad6e6ee5a98e55e15f1)) +* handle closed webview on quick edit ([#1942](https://github.com/continuedev/continue/issues/1942)) ([fe05db5](https://github.com/continuedev/continue/commit/fe05db541dafc45c9870d52d9f15e812e1ea90ad)) +* handle deleted blocks ([c1157db](https://github.com/continuedev/continue/commit/c1157dbf02f6750d385b28006c90202e6b159d5a)) +* Handle empty addedLines in revertDiff ([f280319](https://github.com/continuedev/continue/commit/f28031902f41c4ae9f7cab01398216272950b7d0)) +* handle line removal diff ([#1744](https://github.com/continuedev/continue/issues/1744)) ([6126eca](https://github.com/continuedev/continue/commit/6126eca35ab981c7b8cd6a56769dfe7cb9e69349)) +* handle optional params in EditSlashCommand ([#745](https://github.com/continuedev/continue/issues/745)) ([0141229](https://github.com/continuedev/continue/commit/014122957ff6e087b03def436b95797e59c6f6cb)) +* Handle status update in DocsService ([ac3df81](https://github.com/continuedev/continue/commit/ac3df814e45343b07f63c99e8710f4a6b185074e)) +* handle when dir might be a file path ([e43d3bd](https://github.com/continuedev/continue/commit/e43d3bda6aa833bfe686b8c84dfa64d43fa08748)) +* hardcode `fontSize` for tool call status msg ([f78969b](https://github.com/continuedev/continue/commit/f78969b147a8aecb5c9e5162d080cdafb3f4adb7)) +* hmr issues with non-react component exports ([0e55c08](https://github.com/continuedev/continue/commit/0e55c08be3ef5dcaec5305f41ae871ae6903b6c7)) +* hotkey for new session ([#572](https://github.com/continuedev/continue/issues/572)) ([1d3acd9](https://github.com/continuedev/continue/commit/1d3acd9f194802d78c99cd407bcb72543aa0ff19)) +* **HttpContextProvider:** support all possible local servers via a library ([c3b2552](https://github.com/continuedev/continue/commit/c3b2552ed5e47eef8dc2a691d5f76f30b61ceafd)) +* if rules ([a6dd5a8](https://github.com/continuedev/continue/commit/a6dd5a83dedcae099f320a2da9362490eadde299)) +* ignore CSV files ([#1972](https://github.com/continuedev/continue/issues/1972)) ([1272f34](https://github.com/continuedev/continue/commit/1272f3402a1fc12e5eb0566ad4a4aadc3db7dc06)) +* Implement RepoMapContextProvider ([48c442d](https://github.com/continuedev/continue/commit/48c442d1c687b15d5612786e87a09b016714abd6)) +* import posthog as type, use inline import ([57a84dc](https://github.com/continuedev/continue/commit/57a84dcfe16e3cdebea54f7a0b0fe354f0d8ad2b)) +* Improve error handling and ensure coroutines continue correctly in case of failure ([46bd573](https://github.com/continuedev/continue/commit/46bd573a4296bb8ce8dc4c43b7293ff575655e53)) +* improve textarea ux ([#1901](https://github.com/continuedev/continue/issues/1901)) ([228bc30](https://github.com/continuedev/continue/commit/228bc30e895b87e06c170775974c49e2781d9ae0)) +* include access to the Documents folder ([03839c3](https://github.com/continuedev/continue/commit/03839c30813f3242d9a1fce91f39af110d8d85a7)) +* incorporate feedback ([98efbbd](https://github.com/continuedev/continue/commit/98efbbd80f075928a45334f8cc4103221c2656c9)) +* incorrect scroll logic on inline edit ([ed3af3f](https://github.com/continuedev/continue/commit/ed3af3f3fc49f6678d8a1f940d06aa62bec1f4b5)) +* intellij freezing ([1f602e5](https://github.com/continuedev/continue/commit/1f602e53c29eb28d98754252823ad8f40f839d1b)) +* isRuleActive ([2b97efe](https://github.com/continuedev/continue/commit/2b97efe5c6d045b461c76068c0e06df298d95902)) +* issue 3732 ([ce5d664](https://github.com/continuedev/continue/commit/ce5d664f828de8681ee7129dfec3c16cad667c46)) +* **JB+GUI:** arrow keys in GUI on linux ([9110904](https://github.com/continuedev/continue/commit/9110904e7d4f727339666ce235388397b8c4ff99)) +* **jb:** meta keybinding issues ([b4dad78](https://github.com/continuedev/continue/commit/b4dad78a727feed0ce18769a8d3f9cfd00a3bd57)) +* **jb:** remove markup from `edit` model title ([f6d334a](https://github.com/continuedev/continue/commit/f6d334a190bf1132c33a68f472aaeb2e5389399f)) +* **jb:** set `setOffScreenRendering` conditionally ([fd66ff7](https://github.com/continuedev/continue/commit/fd66ff7d464d3138a127e2035bca88f6d42c4402)) +* **Jira Context:** add api abstraction ([cc9b960](https://github.com/continuedev/continue/commit/cc9b96038bb0b88156729d1c39e6eec1794fe76a)) +* jira ctx provider ([9d24d34](https://github.com/continuedev/continue/commit/9d24d3402f3e9f9937bfdff70fa5c4fa120b2dbf)) +* keyboard shortcuts test on linux ([e45aa16](https://github.com/continuedev/continue/commit/e45aa164c64a52936c7dd1c0467548aadf821639)) +* layout alignment ([#1779](https://github.com/continuedev/continue/issues/1779)) ([6e8fc12](https://github.com/continuedev/continue/commit/6e8fc1247c44c344a48db9758437cb7b3028591c)) +* lint ([f575721](https://github.com/continuedev/continue/commit/f575721980a596cdb08be8a2e472ca26e6012325)) +* lint ([3ba1153](https://github.com/continuedev/continue/commit/3ba1153243753682ca19b26031c2c3c73394b5f2)) +* lint ([03cd1a3](https://github.com/continuedev/continue/commit/03cd1a338f03fc1baa87feb02bd6e56111fc0b13)) +* lint ([747d380](https://github.com/continuedev/continue/commit/747d3806a99abf7f55823c2fbc06c74448ba3c1c)) +* linting error ([67ab058](https://github.com/continuedev/continue/commit/67ab05821191d75a201e516b725a679671f94734)) +* linux key ([9618327](https://github.com/continuedev/continue/commit/9618327cf45687f18aacdc04d62da86ce2d1e520)) +* linux test env ([9f2f9d8](https://github.com/continuedev/continue/commit/9f2f9d895b2fe6678f49e394e4657f044e2aef2a)) +* listbox z-index issue ([1d2bfcd](https://github.com/continuedev/continue/commit/1d2bfcd4b2ad7c3afef97348c55a1c668610ea07)) +* listDir ([a41a4bd](https://github.com/continuedev/continue/commit/a41a4bd2df5807bd216a4b23eabe8656ca098cdb)) +* **llm/Ollama:** changed buffer handling like in streamChat() ([f1f8967](https://github.com/continuedev/continue/commit/f1f8967b6c4b422428fcad0575c0b24ae78bf34a)) +* load last session when completing edits ([1e33400](https://github.com/continuedev/continue/commit/1e334008c08eb8796510ba6aaac434073c44b3b8)) +* local build script ([#810](https://github.com/continuedev/continue/issues/810)) ([76fe78a](https://github.com/continuedev/continue/commit/76fe78a1a3c05b0d6dd5ed6d15575e20e797cfa6)) +* log llm completition in edit command ([3094180](https://github.com/continuedev/continue/commit/30941800b04c59b9a45375d6934a4fb79cac0141)) +* logs ([e3cf75e](https://github.com/continuedev/continue/commit/e3cf75e0779d3bc02a468ea6551e2499979c08f7)) +* mac build issues ([9946a5c](https://github.com/continuedev/continue/commit/9946a5c05f85d20e2d766719a861eb0f8a55019c)) +* major fixes to getTheme ([c6002ba](https://github.com/continuedev/continue/commit/c6002ba2ac905bd5439173e6430676bdc3594a87)) +* make `env.apiVersion` required for azure openai ([4355618](https://github.com/continuedev/continue/commit/4355618079808bdfc3240022e79a0a9dd8457b02)) +* matching context code ([64fb928](https://github.com/continuedev/continue/commit/64fb928b8ff9c0f7753a8b8d374abc179de1f4d5)) +* mcp context provider bug with issue 2467 ([98f07be](https://github.com/continuedev/continue/commit/98f07bef818cf5acc4de2828cbeaa0b4b499fc53)) +* MDX compilation issue ([aca82d2](https://github.com/continuedev/continue/commit/aca82d2ef36a5bd57119343790875e2acf7819b3)) +* merge bugs ([009e578](https://github.com/continuedev/continue/commit/009e578416982a90af05539420a7137ccd2d03c1)) +* messages ([0b07020](https://github.com/continuedev/continue/commit/0b07020d7dd9bf59ca1d804668a215174273625b)) +* minor issues ([#581](https://github.com/continuedev/continue/issues/581)) ([570f61d](https://github.com/continuedev/continue/commit/570f61de5a404559b4ff69eb5cd2fa216e70e872)) +* missing arguments ([452b242](https://github.com/continuedev/continue/commit/452b2422d18c05dd28dbfa6fd127f4c3e0b0223c)) +* missing cd ([0d88b8f](https://github.com/continuedev/continue/commit/0d88b8f379d161962a72626fe2af583cce0f3fe0)) +* missing Content-Type header in OllamaEmbeddingsProvider ([#1855](https://github.com/continuedev/continue/issues/1855)) ([841294d](https://github.com/continuedev/continue/commit/841294d15f3ad6ea4a9f7cf277fbcb905d9bd978)) +* missing context items ([bdc2ec8](https://github.com/continuedev/continue/commit/bdc2ec8374ac9e7d14fc440ea80fa438005735e8)) +* missing env ([1ebd3a3](https://github.com/continuedev/continue/commit/1ebd3a31bab5ed31374518022c5f1b7658c379f2)) +* missing package ([e284cec](https://github.com/continuedev/continue/commit/e284cecd6584b14bee43794d0d238d64c734a10a)) +* missing useLegacyCompletionsEndpoint in yaml schema ([a4b4395](https://github.com/continuedev/continue/commit/a4b4395649e9fa7888f8204ddcf56b88632b5b90)) +* model name ([b1ec201](https://github.com/continuedev/continue/commit/b1ec2012c649ff29e84d6682234328e9c2fdb792)) +* models and mode are not synced ([57441da](https://github.com/continuedev/continue/commit/57441dad6696eeb6d4bd6d769aec06e389367a53)) +* modify access modifier public to private ([c36f233](https://github.com/continuedev/continue/commit/c36f23322265a0d9c28eb401acf49d76294a1249)) +* move autocomplete logic off of EDT ([c46083d](https://github.com/continuedev/continue/commit/c46083d4115a79938bc6ae2b9421f36803b0a992)) +* naming ([ba39842](https://github.com/continuedev/continue/commit/ba3984290ddb875608845904d31c5a5d57b1bf03)) +* naming ([42a03ad](https://github.com/continuedev/continue/commit/42a03ad020634a7c6be719a70bf40144582682dc)) +* naming ([fb1a75d](https://github.com/continuedev/continue/commit/fb1a75dcf33fa38863bda4f5b88c1a567aaf0269)) +* navigation bug ([fab5347](https://github.com/continuedev/continue/commit/fab53472a931b49d7f0c19af22263df6b54bc292)) +* not sure how that button fragment got there ([880f1de](https://github.com/continuedev/continue/commit/880f1de80d2bc33635cc9ebed01ae84e2c17c640)) +* number of completions to generate is not supported ([db90b09](https://github.com/continuedev/continue/commit/db90b0954b36e856258eed2b61af8bf107f13510)) +* old docs ([b52910b](https://github.com/continuedev/continue/commit/b52910b43351e5df8c07cfb27beca8fba5463074)) +* ollama tool use ([82ac684](https://github.com/continuedev/continue/commit/82ac6848cabca21122995460328b8f4420ae3222)) +* onboarding telemetry ([445dba3](https://github.com/continuedev/continue/commit/445dba3bb60654ac9c3f8d245f896d490574c3a1)) +* only alert free trial if using free trial ([f0e73ef](https://github.com/continuedev/continue/commit/f0e73ef63a8fd8bb7ce313f9ed5439c7c68969bf)) +* only perform lancedb cpu check for linux ([e0ee7d1](https://github.com/continuedev/continue/commit/e0ee7d1e446b18c05ed3166b0aa3b199ec021f1a)) +* open new session from any page ([258bbc6](https://github.com/continuedev/continue/commit/258bbc6b5cbbd3b897e8045df247bb2a1fc21f94)) +* overly eager suffix matching ([556a8c5](https://github.com/continuedev/continue/commit/556a8c5ee3f72311a384c64ba14fde7122e68741)) +* path ([d01f243](https://github.com/continuedev/continue/commit/d01f24309b490799014dca0fd03775c39745d660)) +* path ([3ecc89e](https://github.com/continuedev/continue/commit/3ecc89eaf55b970e1a494f88fed0850c4b85c565)) +* pathing issue in jb ([c33e390](https://github.com/continuedev/continue/commit/c33e390427e459a5426ee7669733c2b407649e40)) +* pause between tests to avoid db lock ([4cb84c1](https://github.com/continuedev/continue/commit/4cb84c11b09dac6eb0791e35b95ff6f571130391)) +* placeholder ([8ded13a](https://github.com/continuedev/continue/commit/8ded13a8f8e54df4951b547d468782117fb11b8b)) +* policy precedence ([de6a0ae](https://github.com/continuedev/continue/commit/de6a0ae36c43753e768bf0164dfbe1b938da790d)) +* preserve indentation in code blocks ([#1554](https://github.com/continuedev/continue/issues/1554)) ([574a392](https://github.com/continuedev/continue/commit/574a3923a6f97d8995561da3654aae3aca9ae439)) +* preserve system messages as user messages ([d60a1c1](https://github.com/continuedev/continue/commit/d60a1c1b1f3174cd501eca69746009bdeb4c6f7f)) +* prettier ([4d278e4](https://github.com/continuedev/continue/commit/4d278e479ae02f0d02ccff8db2448d6b38b3d3e5)) +* prevent autoscrolling on new tool msgs ([678a75f](https://github.com/continuedev/continue/commit/678a75f8f7b97b0f75407c6e1b1dd78c415d22eb)) +* Prevent duplicate context provider addition ([2d6eacb](https://github.com/continuedev/continue/commit/2d6eacbeab8eb89ddc32311ade4efe3ccb272bca)) +* Prevent multiple resumes in continuation ([1e96bfb](https://github.com/continuedev/continue/commit/1e96bfb9683fa0a45437f16b419be066917351cb)) +* Promise arrays being returned. Added a new definitions-only context provider. fix: typescript tagging. ([#835](https://github.com/continuedev/continue/issues/835)) ([00eeb00](https://github.com/continuedev/continue/commit/00eeb0024178953172941bba293808be4ca5eed2)) +* prompt format ([0f6d280](https://github.com/continuedev/continue/commit/0f6d280234c459e1935b62e5244f4577d64fac53)) +* promptblock parsing ([eb6735e](https://github.com/continuedev/continue/commit/eb6735ee25da93e01a7b09223960b8975b41d898)) +* Properly ignore ignored folders when generating /onboard context ([f7bca6a](https://github.com/continuedev/continue/commit/f7bca6a61d56b6e17b100294e605d0e2bbe0239b)) +* protocols ([c8a24c0](https://github.com/continuedev/continue/commit/c8a24c0c9040a0da02bdd215b77b0320c160256f)) +* qwen completions missing whitespaces ([75dce9c](https://github.com/continuedev/continue/commit/75dce9cbd14cc374d1ce4921522f3423202be7b1)) +* **reg:** :ambulance: remove log except when in NODE_ENV === "test" ([f60fd1c](https://github.com/continuedev/continue/commit/f60fd1c6188567c67d3d8285fd6c2c5d6acc5bfa)) +* regex ([05a3eec](https://github.com/continuedev/continue/commit/05a3eec21ed1c26aa4d9825e6be5e209cdb9563c)) +* reject logic ([5944fca](https://github.com/continuedev/continue/commit/5944fca7374851869e469ed1cd3f13056de5c8b3)) +* remove `any` from promptTemplate passing ([7834d26](https://github.com/continuedev/continue/commit/7834d266330625915542913f2d44ac0d80875d7e)) +* remove debugger statement ([3e4c75b](https://github.com/continuedev/continue/commit/3e4c75bf461c36c2200ac2922670bb76a612b292)) +* remove deugger ([3e8e29e](https://github.com/continuedev/continue/commit/3e8e29e8f2ce18e138df64441e436d3a07ffa45e)) +* remove duplicated context comments ([0c217a4](https://github.com/continuedev/continue/commit/0c217a40082c2c244de4f4f8c955d96314f130da)) +* remove gifs from media ([77d321f](https://github.com/continuedev/continue/commit/77d321ff82dcd34b55d0a0253eb45672be774fe1)) +* remove invalid schema ([2355eb6](https://github.com/continuedev/continue/commit/2355eb62a5c3c5034b528ab17e8ad7a0b661bc7c)) +* remove mismatch between last selected profile and current profile ([d9eb118](https://github.com/continuedev/continue/commit/d9eb118c514fc2a4364f532eb6438588fc9f712c)) +* remove some backup files generated by pkg if present ([#1287](https://github.com/continuedev/continue/issues/1287)) ([9f160ad](https://github.com/continuedev/continue/commit/9f160ad11a1d36bfc92d2da2a8ea31721652b3e4)) +* remove stale code ([cd97833](https://github.com/continuedev/continue/commit/cd97833be88ecaf3c2860dc41ca57c9e2b18ad48)) +* remove testing logic ([5df8177](https://github.com/continuedev/continue/commit/5df81770df526c69dd71f2421a9052deb17accf6)) +* remove tooltips when switching files ([200d291](https://github.com/continuedev/continue/commit/200d29103ea97db06283f2d4b5e0eb9b6afb86df)) +* remove unnecessary baseUrl ([5f159fb](https://github.com/continuedev/continue/commit/5f159fbd81c4b8680cbad8b3875aa54e2079928e)) +* remove unused argument ([7dd2c22](https://github.com/continuedev/continue/commit/7dd2c22632d50726271655d5c5d027a8219e6862)) +* remove unused imports ([1b82d39](https://github.com/continuedev/continue/commit/1b82d39ac5b8e0cfb990a4968b3e8bc81af768ce)) +* rename edit folder ([ab1ad0a](https://github.com/continuedev/continue/commit/ab1ad0ae48eeceee87043cae9a7862a1c4f70da0)) +* replace null with empty string in getSidebarContent function ([#822](https://github.com/continuedev/continue/issues/822)) ([50d1188](https://github.com/continuedev/continue/commit/50d1188479be206d1a4ed5dcd258d4101ae4f8ba)) +* report indexing errors in webview ([6a67514](https://github.com/continuedev/continue/commit/6a67514fcf108bd0eb6989777abaed02ce2e61e7)) +* reset config errors ([cc199c2](https://github.com/continuedev/continue/commit/cc199c28634d006d38416533b06f26e001cea3fe)) +* Resolve proxy error when adding Azure OpenAI model ([17dbfe6](https://github.com/continuedev/continue/commit/17dbfe6bfd38f67b7cb535da00fa626cdaf4f690)) +* Resolve type error in env comparison ([45eacf4](https://github.com/continuedev/continue/commit/45eacf4ebbd99a97eef32eef01d780a1f8c57b7a)) +* Resolved errors related to incorrect URIs ([0a7da20](https://github.com/continuedev/continue/commit/0a7da2067e8d8567084d05f69038b7ca95464d1f)) +* restore all e2e tests ([d3a6eeb](https://github.com/continuedev/continue/commit/d3a6eebeb7b5d96133d1c13e533913dc5ec2f19c)) +* restore cache ([91ea00d](https://github.com/continuedev/continue/commit/91ea00d284227f3875daf17591b15409004372ac)) +* restore comments ([067a3a8](https://github.com/continuedev/continue/commit/067a3a843baf5a0e12bd5b6f21f37a504836286c)) +* restore tests ([553c751](https://github.com/continuedev/continue/commit/553c751562afb736fb914549ba3d2c75e5a4b305)) +* return ctx items from prompt file ([84df7f4](https://github.com/continuedev/continue/commit/84df7f45bf91c70da79901c0a44cc3b156655f6f)) +* revert file changes ([7a44a38](https://github.com/continuedev/continue/commit/7a44a38c860cfbd0eeab35d8fdb3cb198edad680)) +* Revert filepath changes ([3df34b7](https://github.com/continuedev/continue/commit/3df34b725e873fcd42058474d83ef634e21d5cad)) +* revert launch.json change ([b3abfb8](https://github.com/continuedev/continue/commit/b3abfb80d71c16a0e51cc980d4262dbd218d6463)) +* reverted the url of llama.cpp back to 'completion'. ([e8523a2](https://github.com/continuedev/continue/commit/e8523a2b07c7a5d1539138ee8e4a4836fea7a36b)) +* rules ([bcae5b3](https://github.com/continuedev/continue/commit/bcae5b3cf210f1a8ced3b2c913961ed16aaf2ea9)) +* rules ([9e57412](https://github.com/continuedev/continue/commit/9e57412fe161a9451aaaa651a9f9ed2d7b6b5517)) +* rules ([f29110f](https://github.com/continuedev/continue/commit/f29110f98b1c71f4832d6b7ff0041e342e2a0c4a)) +* rules ([b39cb83](https://github.com/continuedev/continue/commit/b39cb836ad6180226d39abe85f5637a6e2dac44d)) +* sanitize lance table names ([5d3b2cb](https://github.com/continuedev/continue/commit/5d3b2cb5070505578cc16e67d2309a40a403bc94)) +* scaffolding for future language syntax highlighting ([647656c](https://github.com/continuedev/continue/commit/647656cd3d007c016bea372bdfcb5d69f9d1d52a)) +* scroll issues w/ code blocks ([#1688](https://github.com/continuedev/continue/issues/1688)) ([ceb8da0](https://github.com/continuedev/continue/commit/ceb8da0b20db70707a3443ff6f705bba6922488d)) +* scroll to the bottom on history change ([b94ccc6](https://github.com/continuedev/continue/commit/b94ccc6db557f705ba4f810ed56c55ce21f383dd)) +* selected profile id writing to global context in org profile rectification ([47755d1](https://github.com/continuedev/continue/commit/47755d1cba3b8c7cb5c0b9a19bf8ca0a92eec850)) +* selector for `isSingleRangeEdit` ([badeb1c](https://github.com/continuedev/continue/commit/badeb1c88b7e1f8eb711a8a2cfc8f341ac22f67e)) +* send feature flags ([2e3fdb3](https://github.com/continuedev/continue/commit/2e3fdb34e2e2358232cc12fcf0a0c2d16a3ef0cc)) +* serve to localhost ([7eccf2d](https://github.com/continuedev/continue/commit/7eccf2ddb9308111686251474fb79fa03dfc87d6)) +* set DEFAULT_CONTEXT_LENGTH to 8192 ([f163768](https://github.com/continuedev/continue/commit/f1637685c651180d1fc969c2f11712fda69eb9ee)) +* settings persistance ([56f3803](https://github.com/continuedev/continue/commit/56f38038b35cedc2aa1bca1b09780b21c811bd83)) +* setup ([6a93eae](https://github.com/continuedev/continue/commit/6a93eaeb0faf685dff216ecca850f9b2ef3cf2c3)) +* show error is GH sign in failed in vscode ([e92e052](https://github.com/continuedev/continue/commit/e92e052b16fb91173aa4dc85d4e80fa569b8e60a)) +* sign in ([fa5d2c5](https://github.com/continuedev/continue/commit/fa5d2c5aa2cdcc580486f81fde3ae69e9d3069e5)) +* sign in btn + colors ([1b669bf](https://github.com/continuedev/continue/commit/1b669bf80e2d81e4aa19c4d3f2dca730ddd6d4f8)) +* Skip duplicate checks at document end or blank text ([decd04e](https://github.com/continuedev/continue/commit/decd04eddd4965b9f76c7a9a3abd276d8d2e1692)) +* snippets in fim prefix ([51e1c42](https://github.com/continuedev/continue/commit/51e1c4216baa38d73141aca1d1e681eabf044b4b)) +* some typos ([#478](https://github.com/continuedev/continue/issues/478)) ([775d051](https://github.com/continuedev/continue/commit/775d051b4bcdbe07fbd38fae4d3e36e79234eb56)) +* spread tool degs ([4ddd275](https://github.com/continuedev/continue/commit/4ddd2755996012677c15069648158bd4334fa3dd)) +* sqlite binary build on fresh clone ([#1433](https://github.com/continuedev/continue/issues/1433)) ([d124aa0](https://github.com/continuedev/continue/commit/d124aa0534303b58b55bcc2de4ec460b4f499178)) +* stream ([c497517](https://github.com/continuedev/continue/commit/c49751713248e27f060b6eee11179e13b14c5adf)) +* system message ([c2707c6](https://github.com/continuedev/continue/commit/c2707c6988a9b6368f183f0602de0cc2872726da)) +* test ([7266efb](https://github.com/continuedev/continue/commit/7266efb4e8490accd69ad5818bd9c35fe6f59e5c)) +* test env path ([71a151f](https://github.com/continuedev/continue/commit/71a151f399d514497ee917eca521863d07b2a270)) +* test timing ([878e211](https://github.com/continuedev/continue/commit/878e2116d6a97c31cad97432d785aaf3b6deb196)) +* tests ([35c674c](https://github.com/continuedev/continue/commit/35c674c724c21c6dc0b699a37f868e68c62f1259)) +* tests ([cafb2e9](https://github.com/continuedev/continue/commit/cafb2e93c7a54b4a35ecc8a209f53982b3cc26d4)) +* tests ([b786591](https://github.com/continuedev/continue/commit/b786591415d79119845e01376bf5dc97c0676b23)) +* tests ([ff543e8](https://github.com/continuedev/continue/commit/ff543e8b321e4e48a088ba296ebac4504b97356b)) +* tests ([81acb44](https://github.com/continuedev/continue/commit/81acb446019a773ce2df98467e4dcb8e5c2a428e)) +* tests ([deea8f1](https://github.com/continuedev/continue/commit/deea8f1f44403b6d7d7bb4236ff5acb8d38bca01)) +* The selected item in inline chat is always the first one ([97bc074](https://github.com/continuedev/continue/commit/97bc07453ba067f0438192d8dc6cc1cc9a86d962)) +* timeout ([b9f161f](https://github.com/continuedev/continue/commit/b9f161f6d8b4e7400dff25912881f41f472a9137)) +* timeouts ([0bf9169](https://github.com/continuedev/continue/commit/0bf9169a968a42dfc083696b3e8be5f1997ad7e5)) +* timeouts ([0c4d9eb](https://github.com/continuedev/continue/commit/0c4d9eb819b9f1a41cddd7d0b84dc0e21ee372e9)) +* timeouts ([4c90f3b](https://github.com/continuedev/continue/commit/4c90f3bdd32761b7f34a6f05334dffc085805964)) +* tip tap undo and redo ([88e34fb](https://github.com/continuedev/continue/commit/88e34fb69caae3750621f9f93253a7425535928f)) +* tool use call ([c73f72f](https://github.com/continuedev/continue/commit/c73f72fbb379dae08aa41ac07608d9dc2aa8bc83)) +* transpile dynamic imports to cjs ([#1975](https://github.com/continuedev/continue/issues/1975)) ([1e3e8eb](https://github.com/continuedev/continue/commit/1e3e8ebe408de1bbb5f9fe0dc61fefef3b85ca69)) +* truncate `tagToString` to max filename len ([afb6bd0](https://github.com/continuedev/continue/commit/afb6bd0fb53505e29e961f5a78f0afe36c3b3071)) +* ts ignore declaration file issue w/ dbinfoz ([#1945](https://github.com/continuedev/continue/issues/1945)) ([477ecd6](https://github.com/continuedev/continue/commit/477ecd63acc85be25ec992d4329f6460c42c6785)) +* tsconfig ([8549981](https://github.com/continuedev/continue/commit/8549981e200e7e62f4a5895babc1c87c45b59db0)) +* type errors ([f976e54](https://github.com/continuedev/continue/commit/f976e54dc3b2b8072aef3ecadf259ee1e5299956)) +* type errors ([f575a36](https://github.com/continuedev/continue/commit/f575a3683c499f04766ac68af6b8e214ed2c3514)) +* type errors ([cd82f4c](https://github.com/continuedev/continue/commit/cd82f4c61fdff90c8ed0e845a3b2ee8b0ce1be9d)) +* type errors ([ea6b234](https://github.com/continuedev/continue/commit/ea6b2344d0b2cde7def58de549e604142a40a353)) +* type errors ([f19b6b8](https://github.com/continuedev/continue/commit/f19b6b8abdb4dfb64c804efee851dee0bb00471c)) +* type errors ([5c49505](https://github.com/continuedev/continue/commit/5c49505f2071504481c17976670d883efebddb4a)) +* type errors ([cdc9600](https://github.com/continuedev/continue/commit/cdc9600e689161877ff7416f63baa9dcbfa6c18a)) +* type errors ([7ee4d8d](https://github.com/continuedev/continue/commit/7ee4d8db505924a4d0edd5ef3ac49f4bb9a706b6)) +* type errors ([70ae585](https://github.com/continuedev/continue/commit/70ae58594cd136e16a53fcfde88a227dbec1104f)) +* type errors ([34489b1](https://github.com/continuedev/continue/commit/34489b14de0fc1c5cfb300a624b3b8571372e532)) +* type errors / formatting ([9dba473](https://github.com/continuedev/continue/commit/9dba4730b958e05ffad6e0bab74effefd228cd6c)) +* types ([7b9c5cc](https://github.com/continuedev/continue/commit/7b9c5cc4f062e2882706919b1effe34a460f45b8)) +* types ([82cad59](https://github.com/continuedev/continue/commit/82cad596c85d0ee0b17ceccdf1f6cca5811b8f94)) +* types ([5faecca](https://github.com/continuedev/continue/commit/5faecca09f27a7490b4050b7191197c74fe38299)) +* types ([be27552](https://github.com/continuedev/continue/commit/be27552e3330b3a18ecb1065b6ab7210a4375826)) +* types ([4b120e5](https://github.com/continuedev/continue/commit/4b120e543e7c2cec0d33714cfebe88800604fbfd)) +* types ([44212e4](https://github.com/continuedev/continue/commit/44212e45828bb72c035bf63de4c13342935dcf0f)) +* types ([72b253d](https://github.com/continuedev/continue/commit/72b253d14faf2d19832b0307fb4fba1e9aed11dd)) +* types ([a88f5d7](https://github.com/continuedev/continue/commit/a88f5d771ced366926c9d6d821c697e52847a2f9)) +* types ([41a7916](https://github.com/continuedev/continue/commit/41a79166aadc2bbbe80145d12bfeb1336d94c7e2)) +* typo ([be874ad](https://github.com/continuedev/continue/commit/be874addb463f7db81c43b52f6e69f9de1c11fa3)) +* **typo:** customize overview doc ([d4dfb69](https://github.com/continuedev/continue/commit/d4dfb699af1f5bffc923a5d850f877ed45ad74a6)) +* undefined in title ([dcdfa59](https://github.com/continuedev/continue/commit/dcdfa59db43ae4e864e5cb1ca04b6804cca64d2f)) +* unnecessary dependency ([ade83fd](https://github.com/continuedev/continue/commit/ade83fd0c6b3f2d3bb8175b6bdbdc0a6e9735c5b)) +* unnecessary scroll delay ([183ae03](https://github.com/continuedev/continue/commit/183ae03ee37ba6629201211e9a63fbcb04ebc527)) +* unset system message ([4480ee3](https://github.com/continuedev/continue/commit/4480ee3ac358e60182304e0e052c27ae45815e2f)) +* update adf2md package ([ecbc123](https://github.com/continuedev/continue/commit/ecbc1234f7419f7921b31354594e5841363c54f5)) +* Update Amazon Bedrock documentation and categorization ([b156d8f](https://github.com/continuedev/continue/commit/b156d8fd4c103e520ad720853752a4f9033ef68f)) +* update CodebaseIndexer path ([#1870](https://github.com/continuedev/continue/issues/1870)) ([00d19e6](https://github.com/continuedev/continue/commit/00d19e623f8abb04fc4a022d354a909e2087aa3c)) +* update imports in CodeSnippetsIndex.ts ([434e4ee](https://github.com/continuedev/continue/commit/434e4ee44b513db15d502c6a9d52ceb17fa805c3)) +* update install script ([91f87f8](https://github.com/continuedev/continue/commit/91f87f8fd0ca328a91c9fd033c58fd5d2db02892)) +* update intellij getDiff to return string[] ([1672d9f](https://github.com/continuedev/continue/commit/1672d9f864e99436b8f309af3529f2fda341172d)) +* update snippets index to upsert cmds ([676f0d9](https://github.com/continuedev/continue/commit/676f0d9335df7bf7f42aae3434847cc0032c3c0a)) +* update spacing ([a9d6597](https://github.com/continuedev/continue/commit/a9d6597a3fa054d093cb63fa5859e24b8f8d571b)) +* update streamId matching ([8a1ce0f](https://github.com/continuedev/continue/commit/8a1ce0f1f06e92b7bd140d7eabd8393dc5993fea)) +* update streamResponse function to use streaming decoding ([#1436](https://github.com/continuedev/continue/issues/1436)) ([2d1155d](https://github.com/continuedev/continue/commit/2d1155d7d4441042480bf928398b7a15a58d92d2)) +* uri utils ([f1026c6](https://github.com/continuedev/continue/commit/f1026c6a2cfdd9424097d2103a5ffc2216e402d9)) +* use `cmd` for windows MCP connections ([b8ca4cb](https://github.com/continuedev/continue/commit/b8ca4cb6ee91670e87ae331f5e4bab24a42adbe6)) +* use bolt icon for shortcuts ([ff2116b](https://github.com/continuedev/continue/commit/ff2116bacc4537e09792ce9817b68e9cdfacb93e)) +* use dir hash in `tagToString` ([9c2a780](https://github.com/continuedev/continue/commit/9c2a780fa986f5f98c3231a12971d3f16c7a8e74)) +* use exponential backoff when checking ollama ([ebbc2fd](https://github.com/continuedev/continue/commit/ebbc2fd55df1fc43e1eacceba042fa4c0bc38e77)) +* use ide scheme auth redirect ([bae74c1](https://github.com/continuedev/continue/commit/bae74c1b324b51c2e9b14b548f92557c75025f51)) +* use index when sending chat input ([9398945](https://github.com/continuedev/continue/commit/93989459e3806f1ba6d647036dc9db064bf30e38)) +* use introduction layout ([2b71869](https://github.com/continuedev/continue/commit/2b7186973695703a48daacea46c076231d308ddf)) +* Use MCP server_name from JSON config as display name ([481d60a](https://github.com/continuedev/continue/commit/481d60a74d9b7cd0492aa5875d89e5b4e2e00c51)) +* use new edit for "Generate code" cmd ([aac6f80](https://github.com/continuedev/continue/commit/aac6f805eb35107e7d8754413d955ccfeb964576)) +* use prompt file sys msg ([093225d](https://github.com/continuedev/continue/commit/093225d4fed4d5249ca506b9867f5b5305ca4003)) +* use proper alternating colors in KeyboardShortcuts.tsx ([f1bfcec](https://github.com/continuedev/continue/commit/f1bfcec8257c2b3f99fa99a643b0464239600490)) +* vitest ([3bc4bb7](https://github.com/continuedev/continue/commit/3bc4bb710cfb2d9ef340a61f7c0ca27cb2540a28)) +* vitest ([ceeb87e](https://github.com/continuedev/continue/commit/ceeb87e81b8848517dfc604025f11bf46e1955b0)) +* **vscode:** handle null values for edits and page in getSidebarContent ([#618](https://github.com/continuedev/continue/issues/618)) ([f8a02ad](https://github.com/continuedev/continue/commit/f8a02add1775805246410ee3df396a4028ff2ec9)) +* **vscode:** improve forceAutocomplete command reliability ([cc50768](https://github.com/continuedev/continue/commit/cc507687eb36be5b7fd59eac433a9a908c1ee07e)) +* **vscode:** keybinding full screen toggle shortcut ([#625](https://github.com/continuedev/continue/issues/625)) ([2921504](https://github.com/continuedev/continue/commit/292150476c1cfcace2f6434d11c3a2dab1e5ccdb)) +* wait for permissions before initializing messenger ([7d16b8a](https://github.com/continuedev/continue/commit/7d16b8a870ebf5348713fb116c109a646fe7c79e)) +* wait for sidebar before other commands ([1566adc](https://github.com/continuedev/continue/commit/1566adcaeb3bc5258a563b208a511cdfb3938d7a)) +* watcher ([f41c819](https://github.com/continuedev/continue/commit/f41c8194fc11da9c76de0531cccd73df78a4b1c2)) +* watcher ([be153f8](https://github.com/continuedev/continue/commit/be153f8ab966e210d6249ff179c4ec1580507d88)) +* whitespace in new line completions ([4db2637](https://github.com/continuedev/continue/commit/4db2637d5b65d427e959b7fd607a65ce4140c355)) +* workflow ([e5fb4f1](https://github.com/continuedev/continue/commit/e5fb4f17ad9d3b6e72d6c7e0920357e607c0e776)) +* wrap editor buttons when out of space ([#1727](https://github.com/continuedev/continue/issues/1727)) ([b38ec0e](https://github.com/continuedev/continue/commit/b38ec0e6153e9077d1e39dfd7a453746da31c75b)) +* wrong shortcut for JB ([b358be2](https://github.com/continuedev/continue/commit/b358be2cfb798bfb6646f5015117199e2ad3a6e2)) + + +### Features + +* :adhesive_bandage: ca_bundle_path for maybeproxyopenai ([1018cd4](https://github.com/continuedev/continue/commit/1018cd47306f95dde35e1a0cc6b2a830444af389)) +* :adhesive_bandage: QueuedLLM for simultaneous reqs (LM Studio) ([e9d2891](https://github.com/continuedev/continue/commit/e9d289173ec28a1a90ae58b1834c476bb46834b8)) +* :art: custom prompt templates per model ([2e69e11](https://github.com/continuedev/continue/commit/2e69e117e198698f57bda06794cf030afbfe69e9)) +* :art: small changes to /codebase ui ([1b68904](https://github.com/continuedev/continue/commit/1b689046a7f9323c7bd56e14d403675db0b38d54)) +* :bricks: Enable terminals for additional vscode Remote Host Types ([1500281](https://github.com/continuedev/continue/commit/1500281bb547f7308aa7316f6783072e4f81fbc1)) +* :bug: kill old server if needed ([a34046b](https://github.com/continuedev/continue/commit/a34046bbbe817f81cd6d8b7ff9025413589571aa)) +* :children_crossing: display troubleshooting link when loading ([698dccf](https://github.com/continuedev/continue/commit/698dccf474619963de0312d36af6d01e3df8b47a)) +* :children_crossing: drag continue to right bar tip ([04b1fde](https://github.com/continuedev/continue/commit/04b1fde6ea77e7698870063c3f588da93d763544)) +* :children_crossing: keep file context up to data by listening for filesystem events ([#396](https://github.com/continuedev/continue/issues/396)) ([b6435e1](https://github.com/continuedev/continue/commit/b6435e1e479edb1e4f049098dc8522e944317f2a)) +* :children_crossing: more keyboard shortcuts ([bd202df](https://github.com/continuedev/continue/commit/bd202df41755c581844d0ab1773ba55968b15450)) +* :children_crossing: sort history by reverse date ([fd77a4b](https://github.com/continuedev/continue/commit/fd77a4bd6b255260d0f4cad11947b38f4d30030e)) +* :children_crossing: tip to debug ([ec74169](https://github.com/continuedev/continue/commit/ec741697c42745d29539be08bc3e01dcd86b1643)) +* :construction: create new sessions ([19060a3](https://github.com/continuedev/continue/commit/19060a30faf94454f4d69d01828a33985d07f109)) +* :construction: first work on URLContextProvider ([6467759](https://github.com/continuedev/continue/commit/6467759012a139e76dcf022a681355f7d310a30d)) +* :construction: react-router-dom work ([31e7c98](https://github.com/continuedev/continue/commit/31e7c9828f985eceb16b4c9c749cc5d4d9fd5beb)) +* :construction: Router and new history page ([f19345c](https://github.com/continuedev/continue/commit/f19345c652cfcf1bdf13d0a44a2f302e0cd1aa4c)) +* :construction: successfully loading past sessions ([c255279](https://github.com/continuedev/continue/commit/c25527926ad1d1f861dbed01df577e962e08d746)) +* :construction: work on EditableDiv - better ctx prov. UI ([e33d579](https://github.com/continuedev/continue/commit/e33d579a1d2b643842827925d032c3de92cf5217)) +* :egg: getting to know users form ([5dcdcd8](https://github.com/continuedev/continue/commit/5dcdcd81da2050825212e216bf5e7e69678d8c6e)) +* :fire: fix duplication in reference ([1e3c8ad](https://github.com/continuedev/continue/commit/1e3c8adabba561eeef124144f3a2ef36d26334b4)) +* :globe_with_meridians: alpaca chat template ([568771d](https://github.com/continuedev/continue/commit/568771d9b94280f1cb47aae863e8faf168eb052b)) +* :green_heart: ship with binary ([2751dde](https://github.com/continuedev/continue/commit/2751ddeb2dd8150a0d7de6c5b65e275e1aa0e155)) +* :lipstick: add context button (plus icon) ([2b35e5f](https://github.com/continuedev/continue/commit/2b35e5f5cff948ca7d4f207b23db68f0da248a95)) +* :lipstick: add textgenwebui as official option in Ui ([09ac7a7](https://github.com/continuedev/continue/commit/09ac7a7fc07d915ac6f3ef96c8e8d1894b7719b9)) +* :lipstick: better loading experience ([e19c918](https://github.com/continuedev/continue/commit/e19c918bb1c517a6a119ae8437c46e0724d2be9d)) +* :lipstick: fixed footer and change button color ([48b8f1f](https://github.com/continuedev/continue/commit/48b8f1f0ad89a2b4e35f49c360576dd5aa99a7c0)) +* :lipstick: gallery banner color ([0647a43](https://github.com/continuedev/continue/commit/0647a43a24c50ff0e52f23c49d979bddfcfbcd87)) +* :lipstick: handful of UI improvements ([ceafdf1](https://github.com/continuedev/continue/commit/ceafdf18c9d9f0f8769d4a9e45c8a407179161c5)) +* :lipstick: improvements to keyboard shortcuts ([7bf8e5b](https://github.com/continuedev/continue/commit/7bf8e5b56a518979bc1d2602b8eb4a2caf2b5fdb)) +* :lipstick: more ui improvements ([f9a84bd](https://github.com/continuedev/continue/commit/f9a84bd2d65b3142cbcfcdd8e1e9394c9d4b458e)) +* :lipstick: more ui improvements ([6e3ff01](https://github.com/continuedev/continue/commit/6e3ff0173e79f5374da9962c964559e0fb7165f5)) +* :lipstick: nested context provider dropdown ([8d423fd](https://github.com/continuedev/continue/commit/8d423fd8d1d5b136e8138a906e8594ab93ec1982)) +* :lipstick: nicer "continue server loading" UI ([8070ce1](https://github.com/continuedev/continue/commit/8070ce17c6d666436df38c684f5868ee7f689422)) +* :lipstick: query input indicator for ctx provs ([4362a51](https://github.com/continuedev/continue/commit/4362a51214a683bfe1efd424ddb226d4e636eeed)) +* :lipstick: setting to change font size ([4ea1760](https://github.com/continuedev/continue/commit/4ea176007d2228364d4d3fa4519898047cef988f)) +* :lipstick: small ui tweaks, detached child process ([0181d62](https://github.com/continuedev/continue/commit/0181d6236d8b74c80adb62648fd6571431cf3210)) +* :lipstick: sticky top bar in gui.tsx ([ef86d66](https://github.com/continuedev/continue/commit/ef86d661d54295c1abb9712557080f1838f96b33)) +* :lipstick: UI Improvements! ([ae058c6](https://github.com/continuedev/continue/commit/ae058c6bac7ea37108e2894e419a22dfb95fd3ff)) +* :lipstick: update icon and description ([92e7c9b](https://github.com/continuedev/continue/commit/92e7c9bb627a5559769e0eca23e02e106d2cfe96)) +* :lipstick: update marketplace icon for pre-release ([cc98ad8](https://github.com/continuedev/continue/commit/cc98ad86d561d26c97dfdb24607a1d70afbcd2a1)) +* :loud_sound: add context to dev data loggign ([8ac1518](https://github.com/continuedev/continue/commit/8ac15184aaa30d13bf168ff5123a12fb7a2dd39f)) +* :loud_sound: display any server errors to the GUI ([daabebc](https://github.com/continuedev/continue/commit/daabebcc5d6df885a508582c0ca13e659305d2ff)) +* :loud_sound: fallback unique id when vscode returns someValue.machineId ([c479442](https://github.com/continuedev/continue/commit/c47944260c5600e49d83568b3c4bafa3b7c2a37e)) +* :loud_sound: give users access to Continue server logs ([5d97349](https://github.com/continuedev/continue/commit/5d973490687c40922f2b7a2ddf2a3e19c207eb0f)) +* :loud_sound: light telemetry or context providers ([2959042](https://github.com/continuedev/continue/commit/2959042fa5a940aa4e8851b9d4db91f0f86092ff)) +* :loud_sound: telemetry for vscode vs. jetbrains ([257cef6](https://github.com/continuedev/continue/commit/257cef697c93d2f2f59936587834908bd69ae842)) +* :memo: embeddings experimental walkthrough ([e1ce1fe](https://github.com/continuedev/continue/commit/e1ce1fefee6a3f4c17ac568ba87cb7a4bcf65795)) +* :memo: note about where session data is stored ([8ada89b](https://github.com/continuedev/continue/commit/8ada89b0f66f9e746394ee64591359537fe0c7f0)) +* :money_with_wings: free trial usage indicator ([354a3f4](https://github.com/continuedev/continue/commit/354a3f493074b1fb63ff4f206a94c35f05673e99)) +* :mute: complete removal of telemetry when allow_anonymous_telemetry false ([ae7dffa](https://github.com/continuedev/continue/commit/ae7dffa211af209aea2ca13b37729e390047dd7c)) +* :necktie: allow timeout param for OpenAI LLM class ([404f7f8](https://github.com/continuedev/continue/commit/404f7f8089190d04c05957dc653baff44f342dc7)) +* :recycle: load preset_urls at load_index ([3dabc4b](https://github.com/continuedev/continue/commit/3dabc4bd6c72e2d12afb059040ca75f606e47d9d)) +* :rocket: headers param on LLM class ([e16b8ff](https://github.com/continuedev/continue/commit/e16b8ff5f2d9187f2b207addc1cd70d0cacbf9c8)) +* :sparkles: [@terminal](https://github.com/terminal) context provider ([40cfabb](https://github.com/continuedev/continue/commit/40cfabb8ce8afe20e51ca4bafddc6a0b4755bf2c)) +* :sparkles: /cmd slash command ([011877c](https://github.com/continuedev/continue/commit/011877c09e88ffcc715defc33e5c74c71ccc8aea)) +* :sparkles: /share slash command ([4e38043](https://github.com/continuedev/continue/commit/4e3804351b76cc763d904f572ad525b651d8bc00)) +* :sparkles: add edit templates to model packages ([1de976a](https://github.com/continuedev/continue/commit/1de976a6a11a0b945d59800b5a58f354808a49fc)) +* :sparkles: add max_tokens option to LLM class ([ff2a397](https://github.com/continuedev/continue/commit/ff2a3978a1e2c95a4e288b56411bf0c32b86757b)) +* :sparkles: add searchcontextprovider to default_config.py ([64f41fc](https://github.com/continuedev/continue/commit/64f41fc8a0a2616fe7074d0a49e7642fd462c95d)) +* :sparkles: add stop_tokens option to LLM ([a16ba7a](https://github.com/continuedev/continue/commit/a16ba7a0166dbf9062ee4616e3ccfbff377e9f4b)) +* :sparkles: Add support for Claude Sonnet 4 ([b24a76f](https://github.com/continuedev/continue/commit/b24a76fdabb5eccada838d8fe5ed5834c0120df1)) +* :sparkles: add urlcontextprovider back to default config ([570891e](https://github.com/continuedev/continue/commit/570891e0201769defeabec95a58c997f6d5f3889)) +* :sparkles: allow AzureOpenAI Service through GGML ([1343d12](https://github.com/continuedev/continue/commit/1343d1227cc86c860fb12695e64eaeae1384f72a)) +* :sparkles: allow changing the summary prompt ([5c8b28b](https://github.com/continuedev/continue/commit/5c8b28b7fddf5b214de61102c768ef44d4087870)) +* :sparkles: allow custom OpenAI base_url ([cb0c815](https://github.com/continuedev/continue/commit/cb0c815ad799050ecc0abdf3d15981e9832b9829)) +* :sparkles: alt+cmd+d to automatically debug terminal! ([d0483ba](https://github.com/continuedev/continue/commit/d0483ba15b4ad13399a3385ae351cf33cca3db7f)) +* :sparkles: auto-reload for config.py ([e652e90](https://github.com/continuedev/continue/commit/e652e90806b84eb409c496dd0903a4817243edc2)) +* :sparkles: autoscrolling ([e6d369f](https://github.com/continuedev/continue/commit/e6d369f4312f0c8d175251e149c62d08608cb18c)) +* :sparkles: back button on history page ([aafa5d5](https://github.com/continuedev/continue/commit/aafa5d5ec91a533f70d644e4d3fadd6f388c3e4b)) +* :sparkles: change proxy url for openai class ([32a9a47](https://github.com/continuedev/continue/commit/32a9a477d33acd5cdde08164ebeb355b27a656b5)) +* :sparkles: codelens in config.py ([58cd4db](https://github.com/continuedev/continue/commit/58cd4db2534aba9fed98925e68dc342efbc54fb0)) +* :sparkles: Continue Quick Fix ([9af39a6](https://github.com/continuedev/continue/commit/9af39a67829a6770b93ffdaa6ea70af3125c7daf)) +* :sparkles: Continue Quick Fix ([52cd93a](https://github.com/continuedev/continue/commit/52cd93ad73f7df6a5140b7d629e4f6e473dc0380)) +* :sparkles: delete context groups ([2d3d96e](https://github.com/continuedev/continue/commit/2d3d96e5b55a225eb97251850909eb7a0a7242ed)) +* :sparkles: diff context provider ([99db0da](https://github.com/continuedev/continue/commit/99db0da9d68c64d0b5adcab21e07c2db438c2404)) +* :sparkles: display model params for previous prompts ([b1b30a4](https://github.com/continuedev/continue/commit/b1b30a459cbd589a471e1528ebfa9aaeb0514968)) +* :sparkles: edit previous inputs ([c6a3d8a](https://github.com/continuedev/continue/commit/c6a3d8add014ddfe08c62b3ccb1b01dbc47495f5)) +* :sparkles: EmbeddingContextProvider ([c6a1255](https://github.com/continuedev/continue/commit/c6a12550ffca1ffe35630e7aa9af6913ddbe0675)) +* :sparkles: FileTreeContextProvider ([8bd76be](https://github.com/continuedev/continue/commit/8bd76be6c0925e0d5e5f6d239e9c6907df3cfd23)) +* :sparkles: filter history by workspace ([0757bd2](https://github.com/continuedev/continue/commit/0757bd2b556996b9c434ac43e3e4a3b042ef5802)) +* :sparkles: Give the terminal color and ansi escape rendering ([e83290b](https://github.com/continuedev/continue/commit/e83290bd3a921929052b0c0c91751800e7e9fd2c)) +* :sparkles: highlight code on cmd+shift+L ([a1fdf16](https://github.com/continuedev/continue/commit/a1fdf164b776c5ff4ddfa1c4cad66e41de4254c0)) +* :sparkles: huggingface inference api llm update ([bbf7973](https://github.com/continuedev/continue/commit/bbf7973ec091823c4197d59daaf151b748ee52fc)) +* :sparkles: huggingface tgi LLM class ([a0e2e2d](https://github.com/continuedev/continue/commit/a0e2e2d3d606d8bf465eac541a84aa57316ee271)) +* :sparkles: improved edit prompts for OS models ([1785e92](https://github.com/continuedev/continue/commit/1785e92f118b855f4a655d9b617d54b5c857a6ef)) +* :sparkles: improved model dropdown ([2f792f4](https://github.com/continuedev/continue/commit/2f792f46026a6bb3c3580f2521b01ecb8c68117c)) +* :sparkles: improvement to @ search rankings ([5590f63](https://github.com/continuedev/continue/commit/5590f63e42fda38d780bdc390361a65b65576498)) +* :sparkles: llama-2 support ([72d18fb](https://github.com/continuedev/continue/commit/72d18fb8aaac9d192a508cd54fdb296321972379)) +* :sparkles: LlamaCpp LLM subclass ([fc9e8e4](https://github.com/continuedev/continue/commit/fc9e8e4e325782409258dd483e36abf441051ee6)) +* :sparkles: LSP connection over websockets ([a6d21f9](https://github.com/continuedev/continue/commit/a6d21f979fce6135fd76923478f76000b1b343cf)) +* :sparkles: make follow-up edits ([73ae5d3](https://github.com/continuedev/continue/commit/73ae5d306c16d7c372e831d3ca41067a62c8481f)) +* :sparkles: Make the terminal command aware of its OS, platform and shell ([1a786f6](https://github.com/continuedev/continue/commit/1a786f605da47abdfc66b02f4e88044ca95df960)) +* :sparkles: manually running server option ([29940ea](https://github.com/continuedev/continue/commit/29940ea4223194cc32f6324534ad75db9e39305a)) +* :sparkles: more model options, ollama error handling ([e2a7d4a](https://github.com/continuedev/continue/commit/e2a7d4a3c7832f8788feccf4168c13ec87a31fb2)) +* :sparkles: ollama LLM class ([402883e](https://github.com/continuedev/continue/commit/402883e0661c24c418fb5aa93832c6f62dc97a63)) +* :sparkles: refactor via search Step ([9cd249e](https://github.com/continuedev/continue/commit/9cd249ee007911037639281c6d7590889ad7b467)) +* :sparkles: run continue immediately from pypi pkg ([70f6da9](https://github.com/continuedev/continue/commit/70f6da9b1ad190a967974fb477db669cbb5c928f)) +* :sparkles: saved context groups ([c98f860](https://github.com/continuedev/continue/commit/c98f860460767fe14f8fbf139150b1bd1ee2ff12)) +* :sparkles: Search context provider with ripgrep ([4b9dd4c](https://github.com/continuedev/continue/commit/4b9dd4cf8e853e17d92fb76fc726260d79e4bd7a)) +* :sparkles: select custom model to use with edit step ([c1e5039](https://github.com/continuedev/continue/commit/c1e5039731941eb6b6eea166edd433cd49d4e858)) +* :sparkles: select model from dropdown ([044b7ca](https://github.com/continuedev/continue/commit/044b7caa6b26a5d78ae52faa0ae675abc8c4e161)) +* :sparkles: select model param count from UI ([105afec](https://github.com/continuedev/continue/commit/105afeccca903072bc48772bdaf8f100f996c4a7)) +* :sparkles: set session timeout on GGML requests ([d04eec7](https://github.com/continuedev/continue/commit/d04eec7ee97319a6bcc48d289cd6eb3e0d9b8e19)) +* :sparkles: set static urls for contextprovider ([d2b1aed](https://github.com/continuedev/continue/commit/d2b1aedcedf950d792baee202efdab199b05e57e)) +* :sparkles: support browser-based IDEs with createMemoryRouter ([c9d96be](https://github.com/continuedev/continue/commit/c9d96be5615b9d193a1eeff9ab00da7ca0fe0b6b)) +* :sparkles: support for Together.ai models ([8456b24](https://github.com/continuedev/continue/commit/8456b24318b13ea5d5dabec2328dd854f8a492b4)) +* :sparkles: support stablecoder with replicate LLM ([d5e8688](https://github.com/continuedev/continue/commit/d5e86883f05fe3e99e1d6ff64241a48f935cc927)) +* :sparkles: testing improved prompting for stablecode ([6112f26](https://github.com/continuedev/continue/commit/6112f26888086ccd47ca6bcfefdbc5b82ea86879)) +* :sparkles: testing in ci, final test of ([cbd7656](https://github.com/continuedev/continue/commit/cbd7656bb4c9aebfe98c746111af52cf7192aa1b)) +* :sparkles: text-gen-webui, cleaning config and welcome ([36d517e](https://github.com/continuedev/continue/commit/36d517e37d87b1bd39d6027577714b60c32e81e9)) +* :sparkles: verify_ssl option for all LLMs ([e0522b9](https://github.com/continuedev/continue/commit/e0522b92cfa80491718de07928ce6a31850dab70)) +* :technologist: bit of customization for DefaultPolicy ([3966790](https://github.com/continuedev/continue/commit/396679009fef21e13c1a6095212d1bd68e7f2a86)) +* :technologist: button to view logs when loading ([b83eb52](https://github.com/continuedev/continue/commit/b83eb52c98d637ab3e3becf98aed9899821ea00d)) +* :technologist: github workflow to measure issue/PR stats ([f75c423](https://github.com/continuedev/continue/commit/f75c42332c44c0d2a1a7e7a7ea32c2ef346df609)) +* :white_check_mark: update test and add model telemetry ([3541d6a](https://github.com/continuedev/continue/commit/3541d6a770c919e1f2e55a1ae53c4fc3abe31aa7)) +* :wrench: update default config.py imports ([e2d0baf](https://github.com/continuedev/continue/commit/e2d0baf39348597bdd1015897152f4e3bee0744d)) +* :zap: queue messages before load, then send ([4c8b561](https://github.com/continuedev/continue/commit/4c8b56135b0a1862a4f1984e80aa1409f15e177d)) +* :zap: reduce default max_tokens ([8fff1a8](https://github.com/continuedev/continue/commit/8fff1a811c477874482b65d014e4c5565d4a8649)) +* `create_rule_block` tool ([2c8032c](https://github.com/continuedev/continue/commit/2c8032c3397f6ac8c26b8ce5e5b2fe89d079d3da)) +* `description` in markdown yaml ([e4b70db](https://github.com/continuedev/continue/commit/e4b70dbfd843345ae0689a55802462473f5641dc)) +* `globs` on rules and block docs ([24e22db](https://github.com/continuedev/continue/commit/24e22db9d416be54426709948564aee4aa08d54e)) +* `requestRule` tool ([af30fbe](https://github.com/continuedev/continue/commit/af30fbe360def278cd56858d88c5373c80a2dab6)) +* add "Gathering context..." indicator ([dd865ea](https://github.com/continuedev/continue/commit/dd865eadea014ccc8588a49e6d9c338d89734c9d)) +* add "onboarding" slash command ([#1961](https://github.com/continuedev/continue/issues/1961)) ([5819ffb](https://github.com/continuedev/continue/commit/5819ffb43901eec8ad6af85737c28896f20c4e6e)) +* add `globs` to create rule tool ([047e4e4](https://github.com/continuedev/continue/commit/047e4e418b7f252cb303f19992025acc4fb79d4f)) +* add `index.ts` to sdk ([ae31c54](https://github.com/continuedev/continue/commit/ae31c54011ac365e560cb02b9851a6806641503a)) +* add `no-negated-condition` eslint ([eb7d67d](https://github.com/continuedev/continue/commit/eb7d67dcf1a338c473a1bb7f787e4f35e62f8f73)) +* add `stream` in defaultCompletionOptions yaml ([f72e293](https://github.com/continuedev/continue/commit/f72e293e2f6251e1cca632dffa7ec14554016a73)) +* add `tsc:watch` cmd to vs code ([1d5e164](https://github.com/continuedev/continue/commit/1d5e164325e8fe8e66759baf2ac47ce766355faf)) +* add accept/reject all btns ([011e2c2](https://github.com/continuedev/continue/commit/011e2c264407ff72a0bc90980ec7d8250da4bbd6)) +* add agentinteraction dev data ([971c4de](https://github.com/continuedev/continue/commit/971c4de33e1a3f117eafe9d64bf175c0d2a849ef)) +* add animated ellipsis to lump ([e14163c](https://github.com/continuedev/continue/commit/e14163cda2ff1de2e90621f1de2341fd90b136d2)) +* add API key support for TEI reranker ([5dc25b5](https://github.com/continuedev/continue/commit/5dc25b5eb3b1f914d106a18bbb34f7d28e3039f3)) +* add azure provider config ([#1764](https://github.com/continuedev/continue/issues/1764)) ([c9635de](https://github.com/continuedev/continue/commit/c9635def237e0bb4e1d899057e6b651b6a6cd1b2)) +* add best experience onboarding ([8b30504](https://github.com/continuedev/continue/commit/8b305046eff820999e805c8b2cd6400e3572da1b)) +* add chat scrollbar visibility configuration support ([14eaf32](https://github.com/continuedev/continue/commit/14eaf3272cde744ab6390d7113c2cb507e0d6734)) +* add Claude 3.7 support to toolSupport.ts ([50ad91b](https://github.com/continuedev/continue/commit/50ad91bced864272c7f1bb92c13d7c910a0b6be2)) +* Add cloudflare as provider ([ad8743a](https://github.com/continuedev/continue/commit/ad8743a9b563ae6e09cc140a0b3f9f202715e3b5)) +* add code that comment is based on ([e3653f9](https://github.com/continuedev/continue/commit/e3653f98f08e52fa6a55d41ca147add1c8e5515a)) +* add combobox for edit file selection ([7c6295f](https://github.com/continuedev/continue/commit/7c6295feeb32a478a2d8867f0a2b863583f6a97e)) +* add deepseek models for novita ai ([a31c3eb](https://github.com/continuedev/continue/commit/a31c3ebc8334f931281cdb0a348150347c99d0e6)) +* Add docs/getDetails endpoint in JetBrains ([da2dc1e](https://github.com/continuedev/continue/commit/da2dc1ed7de3caa9ae1e8b02a09526f57dd80bb8)) +* add example integration test ([781a792](https://github.com/continuedev/continue/commit/781a792a5939958d05fa316261190c164871c563)) +* add exponential backoff for API requests ([12ffa95](https://github.com/continuedev/continue/commit/12ffa956571acd12b383ba73560d3c42a7a4415c)) +* add file search to quick edit ([#1714](https://github.com/continuedev/continue/issues/1714)) ([21d1b0c](https://github.com/continuedev/continue/commit/21d1b0c16dd9cd454d543e4b387f873e54d89aa5)) +* add fixed version of the nodejs ([cd35857](https://github.com/continuedev/continue/commit/cd35857daf5577f4677f6675344fa8488e624352)) +* add free trial card to onboarding ([#1600](https://github.com/continuedev/continue/issues/1600)) ([9bae5a2](https://github.com/continuedev/continue/commit/9bae5a254df25d25dc848b5c7bf69fc7189e6461)) +* add gif to tutorial card ([e03eb9d](https://github.com/continuedev/continue/commit/e03eb9d5801985d1968d0528dd76767bf3907cbf)) +* add gitlab context class ([efc1f3b](https://github.com/continuedev/continue/commit/efc1f3b9216d5bf503ecb58ff956f26a2bc4a130)) +* add icon for URL ctx item peek ([e901cfd](https://github.com/continuedev/continue/commit/e901cfdf4ae383a2337c2e20182f6eee6d3010f9)) +* add Jira context provider ([#860](https://github.com/continuedev/continue/issues/860)) ([8ba15b1](https://github.com/continuedev/continue/commit/8ba15b16665be871e037ada88d51b3403a8d094e)) +* add Llama 3.1 8B to cloudflare provider options ([#1811](https://github.com/continuedev/continue/issues/1811)) ([bccbff2](https://github.com/continuedev/continue/commit/bccbff273c176c54f0209c5927a19b8c6d9375f9)) +* add Moonshot AI model provider support ([b8a278d](https://github.com/continuedev/continue/commit/b8a278d216db9851aa2b0772e0313ff4bc12c7cc)) +* add novita info ([94d8d39](https://github.com/continuedev/continue/commit/94d8d39cfc8d21f2544633330370d99ef17e0fdf)) +* Add num_treads to ollama along with docs ([#863](https://github.com/continuedev/continue/issues/863)) ([d71721d](https://github.com/continuedev/continue/commit/d71721d71540cb084d67559e850440129faa67c0)) +* add openai wrapper for sdk ([ab9a248](https://github.com/continuedev/continue/commit/ab9a248572a46e00f0fa6441af861dd260c4cb65)) +* add OpenAI, xAI, Replicate and free-trial model options to config schema ([89a90f9](https://github.com/continuedev/continue/commit/89a90f99baaf493f184a09aa6083a606076f9771)) +* Add prompt caching support ([24f9960](https://github.com/continuedev/continue/commit/24f9960e27ad065fec611661e69726c9be589042)) +* add proxy support for ripgrep download ([d42c050](https://github.com/continuedev/continue/commit/d42c050e3645b4eb4635dd5a73ae12107adca701)) +* add Quick Actions CodeLens feature ([#1674](https://github.com/continuedev/continue/issues/1674)) ([fdf3408](https://github.com/continuedev/continue/commit/fdf3408e0c9c2df749b5775d3c906abfdf40e799)), closes [#1536](https://github.com/continuedev/continue/issues/1536) [#1456](https://github.com/continuedev/continue/issues/1456) [#1564](https://github.com/continuedev/continue/issues/1564) [#1576](https://github.com/continuedev/continue/issues/1576) [#1570](https://github.com/continuedev/continue/issues/1570) [#1582](https://github.com/continuedev/continue/issues/1582) [#1600](https://github.com/continuedev/continue/issues/1600) [#1618](https://github.com/continuedev/continue/issues/1618) [#1626](https://github.com/continuedev/continue/issues/1626) [#1637](https://github.com/continuedev/continue/issues/1637) +* add Qwen2.5-Coder support ([387a76a](https://github.com/continuedev/continue/commit/387a76aa5bab873565de25a2d269f0b5b1a53f1e)) +* add redux state for card logic ([5f32924](https://github.com/continuedev/continue/commit/5f32924becd3e8b03d19ffb4a5e4a2dcbfb6dbc3)) +* add redux state for mfe ([6e5236a](https://github.com/continuedev/continue/commit/6e5236a58a896ab78faa1672e56237b4f4684877)) +* add render util function ([413530a](https://github.com/continuedev/continue/commit/413530a029e32ab8e77520c0e5265cd37a84b24c)) +* add rich quick pick for quick edit ([#1706](https://github.com/continuedev/continue/issues/1706)) ([f3b15eb](https://github.com/continuedev/continue/commit/f3b15eb1b14dcc3f4c28ebfb95150b0d6627cecb)) +* add scope selector ([b78fdc4](https://github.com/continuedev/continue/commit/b78fdc4147e1ccb388b900a65099a2c61ba6ca26)) +* Add signature column to code_snippets table ([a535e9e](https://github.com/continuedev/continue/commit/a535e9e15fb3041fec732574636221e0a83dccfa)) +* add slash command cmd ([d4e1609](https://github.com/continuedev/continue/commit/d4e1609d2a65aeeece6caa8620a1b45196f40c98)) +* add support for `baseSystemPrompt` ([f6957bb](https://github.com/continuedev/continue/commit/f6957bb856ba5915ad6351a518dc4b4a47536947)) +* Add support for Cloudflare AI Gateway ([#1425](https://github.com/continuedev/continue/issues/1425)) ([837ad1c](https://github.com/continuedev/continue/commit/837ad1c552aef8909b9a1dbe01204ed2571134d7)) +* add support for custom headers in SSE transport ([d392d77](https://github.com/continuedev/continue/commit/d392d7736d5d31804cd54b3c307bbfb6289e5358)) +* add support for Mistral models in toolSupport.ts ([928cf2c](https://github.com/continuedev/continue/commit/928cf2c73752a23fe3fc026bbf3957c5c80d5604)) +* add support for multiple MCP server types (stdio, sse, websocket) in the YAML configuration schema, ensuring backward compatibility with legacy configurations ([63a2ffe](https://github.com/continuedev/continue/commit/63a2ffe9696d90786f030c2af02cec2c463d914e)) +* add tests ([0819bec](https://github.com/continuedev/continue/commit/0819becfd98127a187cc84484dd59bb4348a1ec3)) +* add tutorial card ([#1716](https://github.com/continuedev/continue/issues/1716)) ([cb8b207](https://github.com/continuedev/continue/commit/cb8b207582dec6ce997c2c602c9998a5a64504db)) +* add unified diff instant apply ([3c36b4d](https://github.com/continuedev/continue/commit/3c36b4dc378ddd8c5c5c2cc234e9a605d776d928)) +* add Vertex AI support ([dfaa02c](https://github.com/continuedev/continue/commit/dfaa02c5051c44303e055675324ff6eaaac0e91b)) +* allow input to exit ([18c5019](https://github.com/continuedev/continue/commit/18c50195248f6ca6c64e1eeb3cb8f10e6b85ffb5)) +* allow JetBrains users to index docs ([#1797](https://github.com/continuedev/continue/issues/1797)) ([e0079a4](https://github.com/continuedev/continue/commit/e0079a43721f6002ff59e2eaa79dc8768a6f66f5)) +* allow users to skip local onboaridng ([4685db0](https://github.com/continuedev/continue/commit/4685db02b854ab0a598defe0fdc4a68f8de50cc2)) +* apply e2e tests ([12b3ed9](https://github.com/continuedev/continue/commit/12b3ed9291b4f46e920f8417f1e6585e45b7edd9)) +* apply if state is active, onEnter callback dont working ([fed1651](https://github.com/continuedev/continue/commit/fed165161d1610db282b52230a4d914f4d2ffa62)) +* apply waiting cursor to chat-input enter-button during prompting ([6d08361](https://github.com/continuedev/continue/commit/6d0836189cd1c18cf97b1e604adf4e5f201665b9)) +* assistant select ([3b539d5](https://github.com/continuedev/continue/commit/3b539d53c39a98c361e27db6dfb72a8e14ddae50)) +* assistant select refresh on right ([04f5e3e](https://github.com/continuedev/continue/commit/04f5e3e165fddf3101e6210b1111c0f261793054)) +* **autocomplete:** recently visited ranged service ([811507a](https://github.com/continuedev/continue/commit/811507a406ed543adb4a8f876c3c3f30d8a9be35)) +* better buttons for account dialog ([2a4c69f](https://github.com/continuedev/continue/commit/2a4c69ff87b64e21ad04edfed2aad7b048833b53)) +* better editor content handling in edit ([7c72c4a](https://github.com/continuedev/continue/commit/7c72c4af878e4b683b582e40f483551314e92873)) +* better error handling around ripgrep ([22f6fdf](https://github.com/continuedev/continue/commit/22f6fdfa1be6f84ab8548155465f863cb65a7e30)) +* better type names ([43ebb1a](https://github.com/continuedev/continue/commit/43ebb1ad0a95ac1dfc0ff1e198fe53e8c50f0671)) +* bookmark first 5 prompts by default ([0909ef9](https://github.com/continuedev/continue/commit/0909ef938b6d2928fa650c0e0613c1e106a0315d)) +* brand text fix ([a25afee](https://github.com/continuedev/continue/commit/a25afeeda10c86072f80c025c20c21b167ddaaf0)) +* bugfixes on redux schema updates ([4efd661](https://github.com/continuedev/continue/commit/4efd66137592916167f562ac45533dfffacd35cc)) +* build steps for config-yaml ([73b95f3](https://github.com/continuedev/continue/commit/73b95f314703c266d9e348f9c1ba3dbbb3f3d266)) +* cache org selection results ([13d5668](https://github.com/continuedev/continue/commit/13d566831db9e66ae270ff70e2b5c63304df6458)) +* cache org selection results ([6e81720](https://github.com/continuedev/continue/commit/6e81720186d4215d6a650835f72ed1c6cc20e28f)) +* capture base class and interfaces implemented ([df2bbc8](https://github.com/continuedev/continue/commit/df2bbc89da7f7f9ee406a8fe6d0c4fd244abd488)) +* capture python definitions ([2f84ef0](https://github.com/continuedev/continue/commit/2f84ef0ab9a87aa6300415d30db02e3460a07195)) +* change model desc ([8d3ecaf](https://github.com/continuedev/continue/commit/8d3ecafa3dbd9a3373ec7784eda1feac6b77b684)) +* check for `nvm` version in install script ([b1a93b7](https://github.com/continuedev/continue/commit/b1a93b7a2dd22ab82ef9acdec5f1096c33c44c1b)) +* cleanup apply manager ([4b9bac5](https://github.com/continuedev/continue/commit/4b9bac55ffae743d0221df65f0a14d0981f74aeb)) +* cleanup inline edit code ([90d895e](https://github.com/continuedev/continue/commit/90d895e2e22ee40033c524a109b5777b5c3bf6cd)) +* Client Certificate Options Support ([#1658](https://github.com/continuedev/continue/issues/1658)) ([136bf9e](https://github.com/continuedev/continue/commit/136bf9e0f0ce0193f64fe291922431808c32406e)) +* close files ([d1eca9d](https://github.com/continuedev/continue/commit/d1eca9deeb3c1550982f679a58265593af603453)) +* close tutorial listener ([d4d3102](https://github.com/continuedev/continue/commit/d4d3102b61c800576513cbb07c9d482fe973a0ef)) +* collapsed codeblock by default ([979c247](https://github.com/continuedev/continue/commit/979c2473c61747157e65e1dcd33fd73ccfe404ad)) +* config.json validation ([429e54e](https://github.com/continuedev/continue/commit/429e54ed347446747d206a97cb80c91baf5d407e)) +* configure docs through config.json ([#1864](https://github.com/continuedev/continue/issues/1864)) ([d7dbdff](https://github.com/continuedev/continue/commit/d7dbdfff485f3970b8595c5a2680a012443747a5)) +* consolidate StepContainer ([58d9eb7](https://github.com/continuedev/continue/commit/58d9eb7a7e8102940d59f26a65e01edb130681fd)) +* consolidate toast logic into "showToast" ([ba777ed](https://github.com/continuedev/continue/commit/ba777edf4761f8bb781fce11ce45311c0b089048)) +* continue sdk ([c7829bb](https://github.com/continuedev/continue/commit/c7829bbd514b962caad99a4c8c660e94f9e577b4)) +* convert issue templates to issue form templates ([#507](https://github.com/continuedev/continue/issues/507)) ([fa7f2cb](https://github.com/continuedev/continue/commit/fa7f2cbdeb6013ec4bb081cb85988817f54d070c)) +* **core:** add support for Llama models on Bedrock ([#1499](https://github.com/continuedev/continue/issues/1499)) ([53aab1e](https://github.com/continuedev/continue/commit/53aab1e6fd2a0f21fbca1c29b82d1f96d2f5e074)) +* crawl `.mdx` docs ([d9f0c4f](https://github.com/continuedev/continue/commit/d9f0c4f131010bd4dae111b5e4290f3460d49e3a)) +* create "rebuild index" dialog ([c978d7c](https://github.com/continuedev/continue/commit/c978d7c871be71cd399d02159be8c1b37a0d36ff)) +* create `ApplyManager` ([652f8c4](https://github.com/continuedev/continue/commit/652f8c4c7b0879f9ab3b2cc1a25c9530de467c94)) +* create docs cache ([3f8afbe](https://github.com/continuedev/continue/commit/3f8afbefeb36c389528d420ef5945c0014ef18c0)) +* create file button in toolbar ([268f55b](https://github.com/continuedev/continue/commit/268f55b001e880fec92ef87df6be2bdf8fc25649)) +* create markdown rules in notch ([c2571e2](https://github.com/continuedev/continue/commit/c2571e2a86e373199fe9660f95fa5b168c776035)) +* create org slice ([71f8508](https://github.com/continuedev/continue/commit/71f85084f22333337a1e817e0502044771d66de4)) +* create profiles slice ([9c2db6b](https://github.com/continuedev/continue/commit/9c2db6b9c7d7fd0a0164b3e2288a4135df759707)) +* create RecentFilesService ([d597e6f](https://github.com/continuedev/continue/commit/d597e6fe5ea632f2bdf762ad2555c056fd736ba8)) +* create stream complete reducer ([ce7d982](https://github.com/continuedev/continue/commit/ce7d98291e30658b387dd5d7de96e0f3577065ab)) +* create SVG tooltip ([0cf152e](https://github.com/continuedev/continue/commit/0cf152ede652d975fd774faa40494020c7514196)) +* dallin feedback pt 2 ([d158fab](https://github.com/continuedev/continue/commit/d158fab740cf803074106717560941cca8cb96c9)) +* dallin's feedback ([e884853](https://github.com/continuedev/continue/commit/e88485348c8b53e9f19d1f9fc0c8b33dd5266df7)) +* Dallin's feedback ([fc1ee33](https://github.com/continuedev/continue/commit/fc1ee33ed912543f596d32ae6eaacbbdbc3bcae4)) +* dallins feedback ([33b1d39](https://github.com/continuedev/continue/commit/33b1d3994654f311dcae385f6ef2ef78696d1d89)) +* dallins feedback ([25b5b8c](https://github.com/continuedev/continue/commit/25b5b8c50b05fe872d74b60ced4a6d8569686ed6)) +* dallins feedback ([6070a64](https://github.com/continuedev/continue/commit/6070a645dd9741b433ad43fd09f37b42ec614a3e)) +* disable chat-input enter-button during prompting ([e01fbe7](https://github.com/continuedev/continue/commit/e01fbe7f2cf6f53f5a611afe6df53dfc5f710e55)) +* disable chat-input-editor during prompting ([7368767](https://github.com/continuedev/continue/commit/73687670da1cc7792d2c4d9ccd7b9813746a4658)) +* display rules used ([53f0679](https://github.com/continuedev/continue/commit/53f06795d3910e1ec5aecdbc1fde706f68649614)) +* editor change listener ([28d2c7d](https://github.com/continuedev/continue/commit/28d2c7d7e0a00c23c33ad25b8bfc3651ddafa2c5)) +* **embeddings:** add gemini provider ([#1362](https://github.com/continuedev/continue/issues/1362)) ([5224572](https://github.com/continuedev/continue/commit/52245724089329c792eb79c8d512cea2f617c4a1)) +* enable comment filtering ([471ca9e](https://github.com/continuedev/continue/commit/471ca9eae5e1f82e04b2d6d600631bf24876ec06)) +* enable sourcemap ([2be2b73](https://github.com/continuedev/continue/commit/2be2b73f2a28834cbfef9100f479ecffc0ad13c8)) +* enable WAL (Write-Ahead Logging) for improved performance and stability ([#1885](https://github.com/continuedev/continue/issues/1885)) ([e93ce84](https://github.com/continuedev/continue/commit/e93ce84cd57eacfe820c1f22668ed069020ee46e)) +* enhance help center ([#1755](https://github.com/continuedev/continue/issues/1755)) ([f2a04ef](https://github.com/continuedev/continue/commit/f2a04ef3e9e49876042077f36da5f457630dcaf1)) +* Enhance MCP connection refresh logic ([1a0d411](https://github.com/continuedev/continue/commit/1a0d41128f30c7f5c087c7255d6ec3292c288664)) +* Ensure CancelAutocompleteAction updates on EDT ([277c20f](https://github.com/continuedev/continue/commit/277c20f3b08eaa1b0b293b06bbfce40404e5477d)) +* evaluate rule ([1a1b854](https://github.com/continuedev/continue/commit/1a1b854fda4630e136d0d18b4ea69e71a00ced1e)) +* explore btn ([14c9528](https://github.com/continuedev/continue/commit/14c952887399f12e739d6a0fafbdbb4d1355fe90)) +* explore dialog ui ([c6cfa93](https://github.com/continuedev/continue/commit/c6cfa9334690cf7f9ecdf99959537ce522728079)) +* explore dialog watcher ([741ad35](https://github.com/continuedev/continue/commit/741ad35195d6b841b459076b8dbca1057d5f6358)) +* explore dialog watcher ([192a47f](https://github.com/continuedev/continue/commit/192a47f998d639f307933f33a731832ff35305ac)) +* explore hub card ([5a777ce](https://github.com/continuedev/continue/commit/5a777ce464243b09d466d7a11a39ff9e45a74ec5)) +* extract paths ([2ffb4ae](https://github.com/continuedev/continue/commit/2ffb4aefeb01073c924beb1c203e60c586cf96bb)) +* fall back to Cheerio for headless crawling ([fd7bbce](https://github.com/continuedev/continue/commit/fd7bbce79b831a1068c5367bc4f018fe820a917a)) +* fallback to chat model from apply model ([46e8dd7](https://github.com/continuedev/continue/commit/46e8dd7c38858173f375ac24f6857ed3bea2b190)) +* fallback to chat model in IDE ([b601c22](https://github.com/continuedev/continue/commit/b601c22d01478d74a66bf162f3e12c4c4e1a93d7)) +* filttrex ([b20b1ab](https://github.com/continuedev/continue/commit/b20b1ab5ee44d704619327a3b087b1290c634dd7)) +* fix address ([d59b3b5](https://github.com/continuedev/continue/commit/d59b3b5297924b2b6343a990c09551be4af9c670)) +* fix broken links ([66345e8](https://github.com/continuedev/continue/commit/66345e83550a898cd36eae67a68fb020ce957677)) +* fix ctx providers w/ slash cmds ([e5608a9](https://github.com/continuedev/continue/commit/e5608a94e543cd8b66d68c222eacc82e8c021aff)) +* fix filepaht issues w/ apply ([6c848ba](https://github.com/continuedev/continue/commit/6c848ba7a7fc7ea32a963653b83b5099e5ed6fad)) +* fix models ([d401a5c](https://github.com/continuedev/continue/commit/d401a5c11fdf5b3267269ff3603f83318a9dd9ad)) +* fix type error + formatting ([bb5e8b6](https://github.com/continuedev/continue/commit/bb5e8b641dc535fd8d60de92aba04680f7b93824)) +* fix version and address ([ad0fdb9](https://github.com/continuedev/continue/commit/ad0fdb988b76bebadcbb26a3069b7f821207680f)) +* get paths ([9cb5170](https://github.com/continuedev/continue/commit/9cb5170b1a23552f917265dc330ff1e05838a3de)) +* get return_type and parameters from snippets ([bf426d5](https://github.com/continuedev/continue/commit/bf426d5e2147248c06ab51cab31ac5cd9e834b1d)) +* glob rules ([8c5ca40](https://github.com/continuedev/continue/commit/8c5ca401d4fbda64eacf23cc0585e2c9830db345)) +* go definitions ([bf65b1e](https://github.com/continuedev/continue/commit/bf65b1ebbdd3b0913d141e9f60a11414088bc78f)) +* **gui:** add ability to change the session title ([1b32222](https://github.com/continuedev/continue/commit/1b32222c10c6ae6f1fd6c93f6abd8cbeab16f108)) +* **gui:** Add Azure as a provider ([b7c0623](https://github.com/continuedev/continue/commit/b7c0623ac6c5067ccefd7c8486eeef2ff56d9667)) +* **gui:** add flex-grow to TdDiv in history page ([#619](https://github.com/continuedev/continue/issues/619)) ([7106f42](https://github.com/continuedev/continue/commit/7106f42cb4ba7424b3dda8ed2d0e562e2fd99447)) +* **gui:** improve editor highlights ([7bffa2d](https://github.com/continuedev/continue/commit/7bffa2dbeab4dde415c113bb15b71968bc51f448)) +* **gui:** more config for azure provider ([e11206b](https://github.com/continuedev/continue/commit/e11206b0fa70075d21d1cc8dd4426af856ee05c2)) +* handle deletions ([2c8cee9](https://github.com/continuedev/continue/commit/2c8cee9fd42fc8f18c9e6e37781e27276dae2786)) +* hide empty code lines in markdown preview ([#815](https://github.com/continuedev/continue/issues/815)) ([793d022](https://github.com/continuedev/continue/commit/793d022eab292219cda75bb3255ed3d676585977)) +* **history:** add sticky headers to history sections ([#621](https://github.com/continuedev/continue/issues/621)) ([3d398d0](https://github.com/continuedev/continue/commit/3d398d0b3781db8bbc51ad00f47e80b3124f5c8f)) +* hover brightness on tool call div ([dba2887](https://github.com/continuedev/continue/commit/dba288748d850c7fa8047efb75e954384410a497)) +* **httpContextProvider:** load AC on fetch client ([#1150](https://github.com/continuedev/continue/issues/1150)) ([638f192](https://github.com/continuedev/continue/commit/638f1922590d7bd46d6e4d46a4d25bf1b33b26fa)) +* if rules ([6224af6](https://github.com/continuedev/continue/commit/6224af63d36e6b96b068c6d4230ee2315bd94d43)) +* if rules ([d0e922d](https://github.com/continuedev/continue/commit/d0e922dad4947ac8af4e9d0c76921da56cdc2953)) +* if-rule ([211fcb7](https://github.com/continuedev/continue/commit/211fcb77407cd261f2bb26198667388ea6270a05)) +* if-rule ([9baa4e9](https://github.com/continuedev/continue/commit/9baa4e93be7f9c2fe057e453237eaa9d1aaa8ff0)) +* if-rules ([06b76d7](https://github.com/continuedev/continue/commit/06b76d752fb4f83b14053fffe2f85cb819e39ae6)) +* if-rules ([0a13a46](https://github.com/continuedev/continue/commit/0a13a4604d7607793bea66b9cea3e89353bf3af4)) +* if-rules ([ccdc1b9](https://github.com/continuedev/continue/commit/ccdc1b953e22ca4aa26e32b9e80bc31ea30f274c)) +* ignore node_modules in js and ts code definitions ([3c9071a](https://github.com/continuedev/continue/commit/3c9071a09b114a019a593a7f241975f419cc4e43)) +* impl /multifile-edit ([f88f28b](https://github.com/continuedev/continue/commit/f88f28b8551e95e4eb346fafa68d6223f9017d5a)) +* improve chat thread ui for better readability ([#1786](https://github.com/continuedev/continue/issues/1786)) ([8478af6](https://github.com/continuedev/continue/commit/8478af63c18b0c35d59d2326ca4e8687a42a624b)) +* improve chunking desc on large projects ([3844208](https://github.com/continuedev/continue/commit/3844208a3b9b3daaff085daad8ab933f27fcb5f3)) +* improve dropshadow on jb inline edit ([35b94e7](https://github.com/continuedev/continue/commit/35b94e710260782d0311ee22a2849203b8965e38)) +* improve dropshadow on jb inline edit ([75e2d2f](https://github.com/continuedev/continue/commit/75e2d2f39df30424b3831615ee3720a2844a60a5)) +* improve fatal error message ([1d77ad3](https://github.com/continuedev/continue/commit/1d77ad31949042c7702b59f83a82ca51dcce4900)) +* improve input and tooltip ux ([#1923](https://github.com/continuedev/continue/issues/1923)) ([2c13776](https://github.com/continuedev/continue/commit/2c13776c06cfe9c775777bf2fffdcf7dfa2169ee)) +* improve model retrieval logic in InlineEditAction ([52b1704](https://github.com/continuedev/continue/commit/52b1704f3c0fe991b32959d04c660fe55e899b2c)) +* improve prompt log formatting + detail ([2376daf](https://github.com/continuedev/continue/commit/2376dafce325c87d87090e7cf995beffcb98d3b4)) +* Improve ProtocolClient initialization and GUI loading ([0c829fd](https://github.com/continuedev/continue/commit/0c829fd99d0e898c1afdc90a0957c907dcb7f4e2)) +* improve settings tabs ([a5f974b](https://github.com/continuedev/continue/commit/a5f974bf1602dabe3939ddc0ac7b5a05ac8e716b)) +* improve StreamError dialog ([ecb63a0](https://github.com/continuedev/continue/commit/ecb63a0222c7ae5e051bea02d98a4a2de7c1e2e5)) +* improve styling on code to edit ([47fbe4f](https://github.com/continuedev/continue/commit/47fbe4f9b81e1ef31d60f1110d2bf240fa6e7d40)) +* include recently + open files in codebase search ([#1833](https://github.com/continuedev/continue/issues/1833)) ([3e0fae3](https://github.com/continuedev/continue/commit/3e0fae35a75bb8dc117bc3eb008eee122e0e12ae)) +* init profiles prefs ([d6ad3e2](https://github.com/continuedev/continue/commit/d6ad3e2071ca1ee3f0b5cd4d8e93852a84fd138a)) +* insert prompt into input on click ([a73123e](https://github.com/continuedev/continue/commit/a73123e35ce29f1776b5afb456c9c67dc9495099)) +* instant apply check for diff rejectection ([98cb185](https://github.com/continuedev/continue/commit/98cb185c926d49a6f5af00f8b53e207743da815a)) +* integrate Moonshot AI model provider and update UI translations ([7ffb95e](https://github.com/continuedev/continue/commit/7ffb95e9d0fc964b55b3f92149515fa79fc3aa0d)) +* items used text ([#1973](https://github.com/continuedev/continue/issues/1973)) ([28a2042](https://github.com/continuedev/continue/commit/28a2042b7f604889cd0c7c76ee3ec0791a00e3ba)) +* **jb:** add ide logs ([22d84ae](https://github.com/continuedev/continue/commit/22d84ae726c40d65449c39b2ece4101f32608870)) +* **jb:** add plugin actions ([629641a](https://github.com/continuedev/continue/commit/629641a4adf2a1e2fe1c9a69fd431718b34c4263)) +* **jb:** create per-IDE tutorial files ([e3b5cbf](https://github.com/continuedev/continue/commit/e3b5cbfda453c727c6f81d04aa8bed1b9efe8301)) +* **jb:** fix meta key bugs in tiptap ([7682c71](https://github.com/continuedev/continue/commit/7682c71575c7ffc03d625510187d792e9d971227)) +* **jb:** impl "apply" button ([802cb43](https://github.com/continuedev/continue/commit/802cb43cd6b6abf8613591eb38c445e6bd4daa7d)) +* **JB:** impl `showFile` ([24bb5eb](https://github.com/continuedev/continue/commit/24bb5eb0dab8467f606d249f8be16fcb9ff083c0)) +* **JB:** scroll to top of file on full file edit ([c36a1ae](https://github.com/continuedev/continue/commit/c36a1ae62851383978080bc5674e7ba4ca0e9cc1)) +* jetbrains tutorial explore hub ([054b095](https://github.com/continuedev/continue/commit/054b095dab51b3abc7a3d83587e0b5f67b8acdf6)) +* make [@codebase](https://github.com/codebase) a hardcoded ctx provider ([#1818](https://github.com/continuedev/continue/issues/1818)) ([7b86678](https://github.com/continuedev/continue/commit/7b866787d947106b77ac0cef92b75ba36e09e7fc)) +* make `assistant` optional on sdk ([48429ae](https://github.com/continuedev/continue/commit/48429ae04f957a98c24d841316c722b91841c329)) +* make deletion line highlight wider ([10a5ec1](https://github.com/continuedev/continue/commit/10a5ec18a9df189d58c60886be296f1107a1dfc2)) +* make disabled state a tooltip ([#1653](https://github.com/continuedev/continue/issues/1653)) ([6cf0102](https://github.com/continuedev/continue/commit/6cf0102875316a89752d17d4fe08e4b21fd2e603)) +* manual ripgrep downloads for JB ([587459c](https://github.com/continuedev/continue/commit/587459c007ba130a4fd6f5ffde246dd8625486a8)) +* markdown rules ([a21d350](https://github.com/continuedev/continue/commit/a21d350ea14a98cf16904ae678de64a83775da7c)) +* merge conflicts ([82a328c](https://github.com/continuedev/continue/commit/82a328ca15306e0b902075c0661cd1b2bb8ed9a8)) +* model name update ([045c6bd](https://github.com/continuedev/continue/commit/045c6bdfec45ffadb25b3db2306b78f34780e84b)) +* modify vitest command, add test coverage feature ([96c70d0](https://github.com/continuedev/continue/commit/96c70d07d283130176cbda68afdb02ddc6b20366)) +* more cleanup ([6c294e7](https://github.com/continuedev/continue/commit/6c294e76834561848305ac8fb6bcb707ea21b172)) +* more cleanup ([bf7cf66](https://github.com/continuedev/continue/commit/bf7cf661cc4357029492f067ca57b1a43401aaaa)) +* more dynamic imports for LanceDB ([90c6631](https://github.com/continuedev/continue/commit/90c663146edc965bbe0b87b737755742315a8fa1)) +* more moving around ([b0492dd](https://github.com/continuedev/continue/commit/b0492ddfee2e6050d833d4ad07a942dbdd830c55)) +* more styling updates ([c7b3ea8](https://github.com/continuedev/continue/commit/c7b3ea890ac2bade08424e7a23301cea319aea35)) +* more visible assistant refresh + submenus ([1fd2ce9](https://github.com/continuedev/continue/commit/1fd2ce90f22c0dd6ebb9ec5b2542f85475844436)) +* move .prompts into slash cmd ([1d1f705](https://github.com/continuedev/continue/commit/1d1f705f7dfb1d517b90e03b82856e625f3f323e)) +* move `StepContainerPreToolbar` ([979bcb9](https://github.com/continuedev/continue/commit/979bcb97ec88d91d0ed0bd14fd5b6b7dc4c670ae)) +* move apply accept/reject into lump ([071ecb9](https://github.com/continuedev/continue/commit/071ecb91eb9c627e96439b7a5be260ec446500b0)) +* move apply manager instantiation ([2413d24](https://github.com/continuedev/continue/commit/2413d241c6448f65c99d9286e72a01bc8acc429a)) +* move Edit into Chat page ([731b54e](https://github.com/continuedev/continue/commit/731b54eb30bd7184e42c397db658020b4a70d5f7)) +* move error indicator into lump ([1f1d4f4](https://github.com/continuedev/continue/commit/1f1d4f4a1c5b365258db219e2a0ae8eecf3656a8)) +* move free trial out of assistant ([2c58a33](https://github.com/continuedev/continue/commit/2c58a33a6a937ea7beb1aa017bce64ec4cfe32d0)) +* move rule parsing to `config-yaml` ([f2d7290](https://github.com/continuedev/continue/commit/f2d72902cb45c165ca73483dd5c0a90ac89bcc49)) +* move SymbolLink ([e3bbd6b](https://github.com/continuedev/continue/commit/e3bbd6b7cfa04183f7a60470a55e4a2618083a21)) +* move vLLM rerank response in the VLLM.ts and remove unused types ([c8d9d95](https://github.com/continuedev/continue/commit/c8d9d959f10b34cb0af857cfa178c1f9df30f5cf)) +* onboarding card upgrade tab ([41bc0e9](https://github.com/continuedev/continue/commit/41bc0e922b333ee404ddb17e5bdcf7c83b7a6ca0)) +* only autoscroll Continue console when focused on last element ([40390f5](https://github.com/continuedev/continue/commit/40390f583bea74766c3eff48cb8ceda555112780)) +* open lump on submit onboarding ([f77f662](https://github.com/continuedev/continue/commit/f77f662c6e7313db645656e003c9d0145646388e)) +* org select ([dc751a3](https://github.com/continuedev/continue/commit/dc751a3274948cb12b47fb7b57106a8349e26870)) +* php definitions ([8da703f](https://github.com/continuedev/continue/commit/8da703f74525213dc212efa6b763d4be06dee38b)) +* php definitions ([eadc96e](https://github.com/continuedev/continue/commit/eadc96ebef6653a996dff32095fd87a86703058d)) +* poll in JB after upgrading ([89d4b32](https://github.com/continuedev/continue/commit/89d4b32bba3bede3ac9f001c6c013ec0bb5a9ca0)) +* postgres context provider first slice ([758a81c](https://github.com/continuedev/continue/commit/758a81c7373f398294ccb80d00a5c7d181f151d7)) +* pr_checks update ([1cc81d4](https://github.com/continuedev/continue/commit/1cc81d4b7e6ed6aedcc19753eea623acbfc8f8c1)) +* preserve edit when rejecting ([32bf80d](https://github.com/continuedev/continue/commit/32bf80d7d280fe815b547475b4a75fce92ba990d)) +* profiles slice ([b82d29c](https://github.com/continuedev/continue/commit/b82d29c2df154a632c89d32c6847f5bf43b6564b)) +* promote reject diff action ([16cbe94](https://github.com/continuedev/continue/commit/16cbe9499431d7eec64d0695821a223302d980cb)) +* prompt blocks ([9df325a](https://github.com/continuedev/continue/commit/9df325a71f3340c46820ac5335249095cda443ac)) +* Provide workspace path to HttpContextProvider ([4873f58](https://github.com/continuedev/continue/commit/4873f5805f89bc1f443211515dd7afb3fbc2cfff)) +* python context ([42d5f66](https://github.com/continuedev/continue/commit/42d5f660727dcf315d12193f70d23b283e7af10d)) +* recursively apply quick actions codelens ([#1925](https://github.com/continuedev/continue/issues/1925)) ([d5155da](https://github.com/continuedev/continue/commit/d5155dac697e5fa8b4241ebebe48bbfa66dc2c55)) +* redo action ([121be85](https://github.com/continuedev/continue/commit/121be85a69837a1d31dde31f7fca7098458ed38d)) +* refactor onboarding card ([b86bc6f](https://github.com/continuedev/continue/commit/b86bc6f727e292c2d3a8fb1511646c36e2a2531f)) +* reintroduce lazy apply for full files ([6504bd5](https://github.com/continuedev/continue/commit/6504bd55659823c8117d04ddb447f91d9932d086)) +* remove `models` property ([7f8882e](https://github.com/continuedev/continue/commit/7f8882eee136b90db9400175f9ee00fa1aa3ad93)) +* remove defaultTitle ([1bf359a](https://github.com/continuedev/continue/commit/1bf359a55fdb833569878167a1440e66c65d7249)) +* remove edit as a mode ([4f371a0](https://github.com/continuedev/continue/commit/4f371a0eb654067c626a41eb53718f565873975b)) +* remove tools from schema ([5bbda4f](https://github.com/continuedev/continue/commit/5bbda4f115a208ebd2df0c63ede75bfc5e131b54)) +* remove useFileExists ([2b34ee8](https://github.com/continuedev/continue/commit/2b34ee8c4156c544a3abd9616080f4d8e0b565a1)) +* rename to `Open Assistant configuration` ([9d8139a](https://github.com/continuedev/continue/commit/9d8139a6fae992eb1cb77248cc297d0a95683c12)) +* replace logo and deepseek model base info ([7749349](https://github.com/continuedev/continue/commit/7749349f8996f5da186ba1a8b2910443121ea2fc)) +* restructure for easier module publishing ([b51905d](https://github.com/continuedev/continue/commit/b51905da95307ed17f3fa7a466e94514bcd4113a)) +* retrieve AWS credentials from Env and from ECS/EC2 instance ([53426a1](https://github.com/continuedev/continue/commit/53426a12b858f341c9f70f8ee3513dbea39d648d)) +* reusable card ([d11376b](https://github.com/continuedev/continue/commit/d11376ba7f2b7ab1a85c75f361631fc2c5c26ab5)) +* rule colocation ([39dc367](https://github.com/continuedev/continue/commit/39dc367371c0df605f663c76fe490c4736f00153)) +* rule glob ([f95cdfa](https://github.com/continuedev/continue/commit/f95cdfaf83569159cd7aed02134be7dd5f4029cf)) +* rules ([2620064](https://github.com/continuedev/continue/commit/2620064c53ecf7de3d61b34043d2c0450f68b13c)) +* rules display ([40914a8](https://github.com/continuedev/continue/commit/40914a8bf3b4f2c1764873bc3172feab3bf23f3a)) +* rules policies ([8a2ffb3](https://github.com/continuedev/continue/commit/8a2ffb3a859d4fbec3299500a0d860c0f725573d)) +* rules preview ([d57d35d](https://github.com/continuedev/continue/commit/d57d35d5bdf6015593283a2aecbf88bca1c8c574)) +* run prettier ([ecdb4f5](https://github.com/continuedev/continue/commit/ecdb4f530dee01e8a67e7fd964206428d379b4db)) +* **scaleway:** update supported models ([8b04ba6](https://github.com/continuedev/continue/commit/8b04ba6b233d72f1e61ea67fd63de51d03629282)) +* separate toolbar action buttons ([aba6e4e](https://github.com/continuedev/continue/commit/aba6e4e61c6c7b548126a79ffeb0608e1de1147b)) +* show disableIndexing in More ([5d95b62](https://github.com/continuedev/continue/commit/5d95b62e683c0ea50eb519f7cc2851736e8ee64b)) +* show num diffs in toolbar ([ad6c0d0](https://github.com/continuedev/continue/commit/ad6c0d0bb850308993e53c4117cc45664fd8970e)) +* simplify types ([b18fd4a](https://github.com/continuedev/continue/commit/b18fd4aee0c66e41113bce4de1fa526da1dc16c6)) +* simplify typings ([c6fa6d7](https://github.com/continuedev/continue/commit/c6fa6d78a714ba6bba44ec2ef9825080b0a5b69a)) +* single default quick pick to edit ([#1743](https://github.com/continuedev/continue/issues/1743)) ([ca7bde9](https://github.com/continuedev/continue/commit/ca7bde9b5e10d684ea44291c67eb294edc357240)) +* skip hub onboarding in free trial ([d995149](https://github.com/continuedev/continue/commit/d99514995588cc2c502df99757e22f5ac3e2c7a1)) +* skip onboarding subtext ([9e6ff4b](https://github.com/continuedev/continue/commit/9e6ff4b91447b03d1b9949499cf5135d7a369df9)) +* smaller headings, use assistant name ([85804ff](https://github.com/continuedev/continue/commit/85804ff9e54adf30f1a4b23b3003b39338a82065)) +* split diff ([b7defc8](https://github.com/continuedev/continue/commit/b7defc8d912b09d9323e05a82442bea17c6faef4)) +* split diffs ([3c537f5](https://github.com/continuedev/continue/commit/3c537f51c13ee9064a3e17f3aec62dc5283ae3e2)) +* split diffs ([39087c2](https://github.com/continuedev/continue/commit/39087c2207e0dd3764761e91b9a2abd3ca6db906)) +* support o3/o4 as agents ([8bb18fd](https://github.com/continuedev/continue/commit/8bb18fd2ee4a0fb81b2f24903e47fb1b0beade36)) +* supports agent 4 deepseek ([82d8e1e](https://github.com/continuedev/continue/commit/82d8e1e6795e7258880d414c4bb78c6f83b17883)) +* toolbar header for all codeblocks ([635f7cb](https://github.com/continuedev/continue/commit/635f7cb168f264446e40c6887347327b101ee413)) +* tutorial listener ([6e01c7d](https://github.com/continuedev/continue/commit/6e01c7d0ca0d139e471edf40018d35e1033638f3)) +* unskip tests ([a5619e2](https://github.com/continuedev/continue/commit/a5619e29c8a0230f578c092c028c7cc6f3066afb)) +* update azure uri for foundry users ([638969b](https://github.com/continuedev/continue/commit/638969b7c7594f36bfefd59a986032ba597f88fa)) +* update btn colors ([b7c7171](https://github.com/continuedev/continue/commit/b7c71719e55e728f944399789f6749e493d5d13e)) +* update docs and input labelling ([1847317](https://github.com/continuedev/continue/commit/18473174365c88e7e83fd8123cb6af9318e10462)) +* update e2e tests ([93cec27](https://github.com/continuedev/continue/commit/93cec27e28773778e3223424fb72026c9e3ead44)) +* update executable perms on linux/macos ([dcbd80e](https://github.com/continuedev/continue/commit/dcbd80ecf47adeb49b9484bb1e1b3c43ff80bff8)) +* update onboarding w/ embeddings model ([#1570](https://github.com/continuedev/continue/issues/1570)) ([ed56c8f](https://github.com/continuedev/continue/commit/ed56c8f7f325f19c9b4d1c7e3cb775f850beaea9)) +* update PreToolbar ([3933791](https://github.com/continuedev/continue/commit/39337910f125a71414cf2c39b96250fc512777be)) +* update redux store schemas ([438cba4](https://github.com/continuedev/continue/commit/438cba4501026ef1705987b23f419570d1175ea1)) +* update styling ([ef349ec](https://github.com/continuedev/continue/commit/ef349ecec90dac3d15eb80ae17cf24c155d1e683)) +* update sys prompt ([25c7144](https://github.com/continuedev/continue/commit/25c714494588433d1c43d6af99cce175b48e21cc)) +* update to work as normal context provider ([0ace169](https://github.com/continuedev/continue/commit/0ace1699356be8024a8ab49ccadc4b1b22c18e08)) +* update tutorial files w/ agent mode step ([8eaf078](https://github.com/continuedev/continue/commit/8eaf078638c0d2d9c14aa0cc8e465df66f01e4df)) +* update URL replace logic ([fe6c9a1](https://github.com/continuedev/continue/commit/fe6c9a1477ab814f3cc4d0973e851701621d2c54)) +* updated prompt docs ([204aa51](https://github.com/continuedev/continue/commit/204aa51a944906fe629e92095a3f7f86113b9f6c)) +* use @lancedb/vectordb-win32-arm64-msvc ([0277320](https://github.com/continuedev/continue/commit/027732073aa0fb5202b558f4c0d71c71c6b8acbb)) +* use `fetch` instead of `http` ([401d67b](https://github.com/continuedev/continue/commit/401d67bbd0dc11fd6eda2f7d9c17dfd4da0a43f5)) +* use `instant` property on diff manager ([2f12bbd](https://github.com/continuedev/continue/commit/2f12bbdf25b1ff189a88d37bfba4f3bfe7f2f3bc)) +* use bm25 for fts ([2e5b579](https://github.com/continuedev/continue/commit/2e5b5794e9b394405c127893100be21e008b45ad)) +* use clipboard content ([9dd6284](https://github.com/continuedev/continue/commit/9dd6284b8e4b1dc09b704bc00d5231af9569b6bc)) +* use correct deployment for azure ([8e24fcf](https://github.com/continuedev/continue/commit/8e24fcf4a0ee655dfbe83d95b82855041f0ba246)) +* use crawlee for docs service ([a51c520](https://github.com/continuedev/continue/commit/a51c520deefa49f9d67aaa2469bb261af00dab80)) +* use exponential backoff in llm chat ([#1115](https://github.com/continuedev/continue/issues/1115)) ([a87df40](https://github.com/continuedev/continue/commit/a87df40a2c875a1538aa112d7d35c03137990ee2)) +* use git diff, improve comment formatting ([1adbd9a](https://github.com/continuedev/continue/commit/1adbd9a456f6c4c2f56b78d6bd5e3b8737f60ec5)) +* use hub blocks for local onboarding ([1b45308](https://github.com/continuedev/continue/commit/1b453083b14e60afda14de69b7bfb2f7ce74194b)) +* use meyers diff after initial edit/apply ([f5e7f9c](https://github.com/continuedev/continue/commit/f5e7f9ce71d4c34e8ee72b0d78fe89c68d0b7170)) +* use s3 for global docs cache on all docs ([0156409](https://github.com/continuedev/continue/commit/0156409dac5a445b055ede921c1c07706759ff4e)) +* use theme color for shortcuts rows ([44fdd65](https://github.com/continuedev/continue/commit/44fdd65967b561527865a02cafce0de4cdc9fa70)) +* use thunj ([eae1dd2](https://github.com/continuedev/continue/commit/eae1dd20bb296099db94175c43bf7af445e97200)) +* v1 onboarding card ([0d47647](https://github.com/continuedev/continue/commit/0d476473bda2ef8bea78064c89c5bc1f6818fec1)) +* vitest ([3cd19f5](https://github.com/continuedev/continue/commit/3cd19f5fabdb6eab3be381ccef8de743b37fcf29)) +* **VSC:** give option to disable quick fix ([951784c](https://github.com/continuedev/continue/commit/951784c790664a80d87b54e33886a3582137ad50)) +* vscode config for json ([666fb18](https://github.com/continuedev/continue/commit/666fb186d6b4cee9dcc95e1adc6b42748300de4c)) +* withExponentialBackoff utility function ([ad8991e](https://github.com/continuedev/continue/commit/ad8991eac0f7f40f3877d56392592d8d83e173a6)) +* working `copy-client` ([09beb58](https://github.com/continuedev/continue/commit/09beb58260f32043c89cff39c6e8567f25099c9c)) +* write initial unit test for apply ([f4a59dc](https://github.com/continuedev/continue/commit/f4a59dc185c3ea7ceb29a4629ea0c7dc82f44dbb)) + + +### Performance Improvements + +* :green_heart: hardcode distro paths ([edf0f56](https://github.com/continuedev/continue/commit/edf0f5603730d01d7ca4ca055dd49da596648627)) +* :zap: don't show server loading immediately ([5047dfc](https://github.com/continuedev/continue/commit/5047dfcd2a2e47468c15ed05c69781cc615ef723)) +* **llm:** Optimize pruneLines functions in countTokens ([35b3189](https://github.com/continuedev/continue/commit/35b3189538da5891617a79ba9c0badb0bb7dc1bc)) +* **llm:** Optimize pruneLines functions in countTokens ([28cdd1c](https://github.com/continuedev/continue/commit/28cdd1cee25973aa9a8a5cfdcbcc436e0b7f6240)) +* **llm:** Optimize pruneLines functions in countTokens ([881f8b3](https://github.com/continuedev/continue/commit/881f8b3139794aca0a6699c3d34ebf8fba01b789)) + + +### Reverts + +* Revert "Add citations to the log" ([caf7288](https://github.com/continuedev/continue/commit/caf7288d36c1361b6cb279821d9ee377636f72f7)) +* Revert "feat: add bookmark logic" ([730ac56](https://github.com/continuedev/continue/commit/730ac56d5a15a6b2931330aeb849e2d260d2644a)) +* Revert "update TabBar to use Redux for session management" ([9f13b92](https://github.com/continuedev/continue/commit/9f13b92b3fbc4157124ccf120028312390eed70f)) +* :bookmark: update version ([d6ebc6d](https://github.com/continuedev/continue/commit/d6ebc6d969ccafc753ecf00e0309777b96b4ad11)) +* :bug: revert unecessary changes from yesterday ([3629ddd](https://github.com/continuedev/continue/commit/3629dddb1daea23fbd29b03705e742ec2a22d6ec)) +* :fire: disable fallback_context_item ([a572db4](https://github.com/continuedev/continue/commit/a572db40b6c9ce98b07e89d34f8652e19f91187e)) diff --git a/packages/config-yaml/package-lock.json b/packages/config-yaml/package-lock.json index 492e0eaa5..014ecac95 100644 --- a/packages/config-yaml/package-lock.json +++ b/packages/config-yaml/package-lock.json @@ -1,12 +1,12 @@ { "name": "@continuedev/config-yaml", - "version": "1.0.93", + "version": "1.0.95", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@continuedev/config-yaml", - "version": "1.0.93", + "version": "1.0.95", "license": "Apache-2.0", "dependencies": { "@continuedev/config-types": "^1.0.14", @@ -17,10 +17,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" @@ -542,6 +547,16 @@ "integrity": "sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==", "dev": true }, + "node_modules/@colors/colors": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/@colors/colors/-/colors-1.5.0.tgz", + "integrity": "sha512-ooWCrlZP11i8GImSjTHYHLkvFDP48nS4+204nGb1RiX/WXYHmJA2III9/e2DWVabCESdW7hBAEzHRqUn9OUVvQ==", + "dev": true, + "optional": true, + "engines": { + "node": ">=0.1.90" + } + }, "node_modules/@continuedev/config-types": { "version": "1.0.14", "resolved": "https://registry.npmjs.org/@continuedev/config-types/-/config-types-1.0.14.tgz", @@ -923,12 +938,722 @@ "@jridgewell/sourcemap-codec": "^1.4.14" } }, + "node_modules/@nodelib/fs.scandir": { + "version": "2.1.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", + "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", + "dev": true, + "dependencies": { + "@nodelib/fs.stat": "2.0.5", + "run-parallel": "^1.1.9" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@nodelib/fs.stat": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz", + "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==", + "dev": true, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@nodelib/fs.walk": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz", + "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", + "dev": true, + "dependencies": { + "@nodelib/fs.scandir": "2.1.5", + "fastq": "^1.6.0" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@octokit/auth-token": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/@octokit/auth-token/-/auth-token-4.0.0.tgz", + "integrity": "sha512-tY/msAuJo6ARbK6SPIxZrPBms3xPbfwBrulZe0Wtr/DIY9lje2HeV1uoebShn6mx7SjCHif6EjMvoREj+gZ+SA==", + "dev": true, + "engines": { + "node": ">= 18" + } + }, + "node_modules/@octokit/core": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/@octokit/core/-/core-5.2.1.tgz", + "integrity": "sha512-dKYCMuPO1bmrpuogcjQ8z7ICCH3FP6WmxpwC03yjzGfZhj9fTJg6+bS1+UAplekbN2C+M61UNllGOOoAfGCrdQ==", + "dev": true, + "dependencies": { + "@octokit/auth-token": "^4.0.0", + "@octokit/graphql": "^7.1.0", + "@octokit/request": "^8.4.1", + "@octokit/request-error": "^5.1.1", + "@octokit/types": "^13.0.0", + "before-after-hook": "^2.2.0", + "universal-user-agent": "^6.0.0" + }, + "engines": { + "node": ">= 18" + } + }, + "node_modules/@octokit/endpoint": { + "version": "9.0.6", + "resolved": "https://registry.npmjs.org/@octokit/endpoint/-/endpoint-9.0.6.tgz", + "integrity": "sha512-H1fNTMA57HbkFESSt3Y9+FBICv+0jFceJFPWDePYlR/iMGrwM5ph+Dd4XRQs+8X+PUFURLQgX9ChPfhJ/1uNQw==", + "dev": true, + "dependencies": { + "@octokit/types": "^13.1.0", + "universal-user-agent": "^6.0.0" + }, + "engines": { + "node": ">= 18" + } + }, + "node_modules/@octokit/graphql": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/@octokit/graphql/-/graphql-7.1.1.tgz", + "integrity": "sha512-3mkDltSfcDUoa176nlGoA32RGjeWjl3K7F/BwHwRMJUW/IteSa4bnSV8p2ThNkcIcZU2umkZWxwETSSCJf2Q7g==", + "dev": true, + "dependencies": { + "@octokit/request": "^8.4.1", + "@octokit/types": "^13.0.0", + "universal-user-agent": "^6.0.0" + }, + "engines": { + "node": ">= 18" + } + }, + "node_modules/@octokit/openapi-types": { + "version": "24.2.0", + "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-24.2.0.tgz", + "integrity": "sha512-9sIH3nSUttelJSXUrmGzl7QUBFul0/mB8HRYl3fOlgHbIWG+WnYDXU3v/2zMtAvuzZ/ed00Ei6on975FhBfzrg==", + "dev": true + }, + "node_modules/@octokit/plugin-paginate-rest": { + "version": "9.2.2", + "resolved": "https://registry.npmjs.org/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-9.2.2.tgz", + "integrity": "sha512-u3KYkGF7GcZnSD/3UP0S7K5XUFT2FkOQdcfXZGZQPGv3lm4F2Xbf71lvjldr8c1H3nNbF+33cLEkWYbokGWqiQ==", + "dev": true, + "dependencies": { + "@octokit/types": "^12.6.0" + }, + "engines": { + "node": ">= 18" + }, + "peerDependencies": { + "@octokit/core": "5" + } + }, + "node_modules/@octokit/plugin-paginate-rest/node_modules/@octokit/openapi-types": { + "version": "20.0.0", + "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-20.0.0.tgz", + "integrity": "sha512-EtqRBEjp1dL/15V7WiX5LJMIxxkdiGJnabzYx5Apx4FkQIFgAfKumXeYAqqJCj1s+BMX4cPFIFC4OLCR6stlnA==", + "dev": true + }, + "node_modules/@octokit/plugin-paginate-rest/node_modules/@octokit/types": { + "version": "12.6.0", + "resolved": "https://registry.npmjs.org/@octokit/types/-/types-12.6.0.tgz", + "integrity": "sha512-1rhSOfRa6H9w4YwK0yrf5faDaDTb+yLyBUKOCV4xtCDB5VmIPqd/v9yr9o6SAzOAlRxMiRiCic6JVM1/kunVkw==", + "dev": true, + "dependencies": { + "@octokit/openapi-types": "^20.0.0" + } + }, + "node_modules/@octokit/plugin-retry": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/@octokit/plugin-retry/-/plugin-retry-6.1.0.tgz", + "integrity": "sha512-WrO3bvq4E1Xh1r2mT9w6SDFg01gFmP81nIG77+p/MqW1JeXXgL++6umim3t6x0Zj5pZm3rXAN+0HEjmmdhIRig==", + "dev": true, + "dependencies": { + "@octokit/request-error": "^5.0.0", + "@octokit/types": "^13.0.0", + "bottleneck": "^2.15.3" + }, + "engines": { + "node": ">= 18" + }, + "peerDependencies": { + "@octokit/core": "5" + } + }, + "node_modules/@octokit/plugin-throttling": { + "version": "8.2.0", + "resolved": "https://registry.npmjs.org/@octokit/plugin-throttling/-/plugin-throttling-8.2.0.tgz", + "integrity": "sha512-nOpWtLayKFpgqmgD0y3GqXafMFuKcA4tRPZIfu7BArd2lEZeb1988nhWhwx4aZWmjDmUfdgVf7W+Tt4AmvRmMQ==", + "dev": true, + "dependencies": { + "@octokit/types": "^12.2.0", + "bottleneck": "^2.15.3" + }, + "engines": { + "node": ">= 18" + }, + "peerDependencies": { + "@octokit/core": "^5.0.0" + } + }, + "node_modules/@octokit/plugin-throttling/node_modules/@octokit/openapi-types": { + "version": "20.0.0", + "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-20.0.0.tgz", + "integrity": "sha512-EtqRBEjp1dL/15V7WiX5LJMIxxkdiGJnabzYx5Apx4FkQIFgAfKumXeYAqqJCj1s+BMX4cPFIFC4OLCR6stlnA==", + "dev": true + }, + "node_modules/@octokit/plugin-throttling/node_modules/@octokit/types": { + "version": "12.6.0", + "resolved": "https://registry.npmjs.org/@octokit/types/-/types-12.6.0.tgz", + "integrity": "sha512-1rhSOfRa6H9w4YwK0yrf5faDaDTb+yLyBUKOCV4xtCDB5VmIPqd/v9yr9o6SAzOAlRxMiRiCic6JVM1/kunVkw==", + "dev": true, + "dependencies": { + "@octokit/openapi-types": "^20.0.0" + } + }, + "node_modules/@octokit/request": { + "version": "8.4.1", + "resolved": "https://registry.npmjs.org/@octokit/request/-/request-8.4.1.tgz", + "integrity": "sha512-qnB2+SY3hkCmBxZsR/MPCybNmbJe4KAlfWErXq+rBKkQJlbjdJeS85VI9r8UqeLYLvnAenU8Q1okM/0MBsAGXw==", + "dev": true, + "dependencies": { + "@octokit/endpoint": "^9.0.6", + "@octokit/request-error": "^5.1.1", + "@octokit/types": "^13.1.0", + "universal-user-agent": "^6.0.0" + }, + "engines": { + "node": ">= 18" + } + }, + "node_modules/@octokit/request-error": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/@octokit/request-error/-/request-error-5.1.1.tgz", + "integrity": "sha512-v9iyEQJH6ZntoENr9/yXxjuezh4My67CBSu9r6Ve/05Iu5gNgnisNWOsoJHTP6k0Rr0+HQIpnH+kyammu90q/g==", + "dev": true, + "dependencies": { + "@octokit/types": "^13.1.0", + "deprecation": "^2.0.0", + "once": "^1.4.0" + }, + "engines": { + "node": ">= 18" + } + }, + "node_modules/@octokit/types": { + "version": "13.10.0", + "resolved": "https://registry.npmjs.org/@octokit/types/-/types-13.10.0.tgz", + "integrity": "sha512-ifLaO34EbbPj0Xgro4G5lP5asESjwHracYJvVaPIyXMuiuXLlhic3S47cBdTb+jfODkTE5YtGCLt3Ay3+J97sA==", + "dev": true, + "dependencies": { + "@octokit/openapi-types": "^24.2.0" + } + }, + "node_modules/@pnpm/config.env-replace": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@pnpm/config.env-replace/-/config.env-replace-1.1.0.tgz", + "integrity": "sha512-htyl8TWnKL7K/ESFa1oW2UB5lVDxuF5DpM7tBi6Hu2LNL3mWkIzNLG6N4zoCUP1lCKNxWy/3iu8mS8MvToGd6w==", + "dev": true, + "engines": { + "node": ">=12.22.0" + } + }, + "node_modules/@pnpm/network.ca-file": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/@pnpm/network.ca-file/-/network.ca-file-1.0.2.tgz", + "integrity": "sha512-YcPQ8a0jwYU9bTdJDpXjMi7Brhkr1mXsXrUJvjqM2mQDgkRiz8jFaQGOdaLxgjtUfQgZhKy/O3cG/YwmgKaxLA==", + "dev": true, + "dependencies": { + "graceful-fs": "4.2.10" + }, + "engines": { + "node": ">=12.22.0" + } + }, + "node_modules/@pnpm/network.ca-file/node_modules/graceful-fs": { + "version": "4.2.10", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.10.tgz", + "integrity": "sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==", + "dev": true + }, + "node_modules/@pnpm/npm-conf": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/@pnpm/npm-conf/-/npm-conf-2.3.1.tgz", + "integrity": "sha512-c83qWb22rNRuB0UaVCI0uRPNRr8Z0FWnEIvT47jiHAmOIUHbBOg5XvV7pM5x+rKn9HRpjxquDbXYSXr3fAKFcw==", + "dev": true, + "dependencies": { + "@pnpm/config.env-replace": "^1.1.0", + "@pnpm/network.ca-file": "^1.0.1", + "config-chain": "^1.1.11" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/@semantic-release/changelog": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/@semantic-release/changelog/-/changelog-6.0.3.tgz", + "integrity": "sha512-dZuR5qByyfe3Y03TpmCvAxCyTnp7r5XwtHRf/8vD9EAn4ZWbavUX8adMtXYzE86EVh0gyLA7lm5yW4IV30XUag==", + "dev": true, + "dependencies": { + "@semantic-release/error": "^3.0.0", + "aggregate-error": "^3.0.0", + "fs-extra": "^11.0.0", + "lodash": "^4.17.4" + }, + "engines": { + "node": ">=14.17" + }, + "peerDependencies": { + "semantic-release": ">=18.0.0" + } + }, + "node_modules/@semantic-release/commit-analyzer": { + "version": "10.0.4", + "resolved": "https://registry.npmjs.org/@semantic-release/commit-analyzer/-/commit-analyzer-10.0.4.tgz", + "integrity": "sha512-pFGn99fn8w4/MHE0otb2A/l5kxgOuxaaauIh4u30ncoTJuqWj4hXTgEJ03REqjS+w1R2vPftSsO26WC61yOcpw==", + "dev": true, + "dependencies": { + "conventional-changelog-angular": "^6.0.0", + "conventional-commits-filter": "^3.0.0", + "conventional-commits-parser": "^5.0.0", + "debug": "^4.0.0", + "import-from": "^4.0.0", + "lodash-es": "^4.17.21", + "micromatch": "^4.0.2" + }, + "engines": { + "node": ">=18" + }, + "peerDependencies": { + "semantic-release": ">=20.1.0" + } + }, + "node_modules/@semantic-release/error": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@semantic-release/error/-/error-3.0.0.tgz", + "integrity": "sha512-5hiM4Un+tpl4cKw3lV4UgzJj+SmfNIDCLLw0TepzQxz9ZGV5ixnqkzIVF+3tp0ZHgcMKE+VNGHJjEeyFG2dcSw==", + "dev": true, + "engines": { + "node": ">=14.17" + } + }, + "node_modules/@semantic-release/git": { + "version": "10.0.1", + "resolved": "https://registry.npmjs.org/@semantic-release/git/-/git-10.0.1.tgz", + "integrity": "sha512-eWrx5KguUcU2wUPaO6sfvZI0wPafUKAMNC18aXY4EnNcrZL86dEmpNVnC9uMpGZkmZJ9EfCVJBQx4pV4EMGT1w==", + "dev": true, + "dependencies": { + "@semantic-release/error": "^3.0.0", + "aggregate-error": "^3.0.0", + "debug": "^4.0.0", + "dir-glob": "^3.0.0", + "execa": "^5.0.0", + "lodash": "^4.17.4", + "micromatch": "^4.0.0", + "p-reduce": "^2.0.0" + }, + "engines": { + "node": ">=14.17" + }, + "peerDependencies": { + "semantic-release": ">=18.0.0" + } + }, + "node_modules/@semantic-release/github": { + "version": "9.2.6", + "resolved": "https://registry.npmjs.org/@semantic-release/github/-/github-9.2.6.tgz", + "integrity": "sha512-shi+Lrf6exeNZF+sBhK+P011LSbhmIAoUEgEY6SsxF8irJ+J2stwI5jkyDQ+4gzYyDImzV6LCKdYB9FXnQRWKA==", + "dev": true, + "dependencies": { + "@octokit/core": "^5.0.0", + "@octokit/plugin-paginate-rest": "^9.0.0", + "@octokit/plugin-retry": "^6.0.0", + "@octokit/plugin-throttling": "^8.0.0", + "@semantic-release/error": "^4.0.0", + "aggregate-error": "^5.0.0", + "debug": "^4.3.4", + "dir-glob": "^3.0.1", + "globby": "^14.0.0", + "http-proxy-agent": "^7.0.0", + "https-proxy-agent": "^7.0.0", + "issue-parser": "^6.0.0", + "lodash-es": "^4.17.21", + "mime": "^4.0.0", + "p-filter": "^4.0.0", + "url-join": "^5.0.0" + }, + "engines": { + "node": ">=18" + }, + "peerDependencies": { + "semantic-release": ">=20.1.0" + } + }, + "node_modules/@semantic-release/github/node_modules/@semantic-release/error": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/@semantic-release/error/-/error-4.0.0.tgz", + "integrity": "sha512-mgdxrHTLOjOddRVYIYDo0fR3/v61GNN1YGkfbrjuIKg/uMgCd+Qzo3UAXJ+woLQQpos4pl5Esuw5A7AoNlzjUQ==", + "dev": true, + "engines": { + "node": ">=18" + } + }, + "node_modules/@semantic-release/github/node_modules/aggregate-error": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/aggregate-error/-/aggregate-error-5.0.0.tgz", + "integrity": "sha512-gOsf2YwSlleG6IjRYG2A7k0HmBMEo6qVNk9Bp/EaLgAJT5ngH6PXbqa4ItvnEwCm/velL5jAnQgsHsWnjhGmvw==", + "dev": true, + "dependencies": { + "clean-stack": "^5.2.0", + "indent-string": "^5.0.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/@semantic-release/github/node_modules/clean-stack": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/clean-stack/-/clean-stack-5.2.0.tgz", + "integrity": "sha512-TyUIUJgdFnCISzG5zu3291TAsE77ddchd0bepon1VVQrKLGKFED4iXFEDQ24mIPdPBbyE16PK3F8MYE1CmcBEQ==", + "dev": true, + "dependencies": { + "escape-string-regexp": "5.0.0" + }, + "engines": { + "node": ">=14.16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/@semantic-release/github/node_modules/escape-string-regexp": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-5.0.0.tgz", + "integrity": "sha512-/veY75JbMK4j1yjvuUxuVsiS/hr/4iHs9FTT6cgTexxdE0Ly/glccBAkloH/DofkjRbZU3bnoj38mOmhkZ0lHw==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/@semantic-release/github/node_modules/indent-string": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-5.0.0.tgz", + "integrity": "sha512-m6FAo/spmsW2Ab2fU35JTYwtOKa2yAwXSwgjSv1TJzh4Mh7mC3lzAOVLBprb72XsTrgkEIsl7YrFNAiDiRhIGg==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/@semantic-release/npm": { + "version": "10.0.6", + "resolved": "https://registry.npmjs.org/@semantic-release/npm/-/npm-10.0.6.tgz", + "integrity": "sha512-DyqHrGE8aUyapA277BB+4kV0C4iMHh3sHzUWdf0jTgp5NNJxVUz76W1f57FB64Ue03him3CBXxFqQD2xGabxow==", + "dev": true, + "dependencies": { + "@semantic-release/error": "^4.0.0", + "aggregate-error": "^5.0.0", + "execa": "^8.0.0", + "fs-extra": "^11.0.0", + "lodash-es": "^4.17.21", + "nerf-dart": "^1.0.0", + "normalize-url": "^8.0.0", + "npm": "^9.5.0", + "rc": "^1.2.8", + "read-pkg": "^8.0.0", + "registry-auth-token": "^5.0.0", + "semver": "^7.1.2", + "tempy": "^3.0.0" + }, + "engines": { + "node": ">=18" + }, + "peerDependencies": { + "semantic-release": ">=20.1.0" + } + }, + "node_modules/@semantic-release/npm/node_modules/@semantic-release/error": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/@semantic-release/error/-/error-4.0.0.tgz", + "integrity": "sha512-mgdxrHTLOjOddRVYIYDo0fR3/v61GNN1YGkfbrjuIKg/uMgCd+Qzo3UAXJ+woLQQpos4pl5Esuw5A7AoNlzjUQ==", + "dev": true, + "engines": { + "node": ">=18" + } + }, + "node_modules/@semantic-release/npm/node_modules/aggregate-error": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/aggregate-error/-/aggregate-error-5.0.0.tgz", + "integrity": "sha512-gOsf2YwSlleG6IjRYG2A7k0HmBMEo6qVNk9Bp/EaLgAJT5ngH6PXbqa4ItvnEwCm/velL5jAnQgsHsWnjhGmvw==", + "dev": true, + "dependencies": { + "clean-stack": "^5.2.0", + "indent-string": "^5.0.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/@semantic-release/npm/node_modules/clean-stack": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/clean-stack/-/clean-stack-5.2.0.tgz", + "integrity": "sha512-TyUIUJgdFnCISzG5zu3291TAsE77ddchd0bepon1VVQrKLGKFED4iXFEDQ24mIPdPBbyE16PK3F8MYE1CmcBEQ==", + "dev": true, + "dependencies": { + "escape-string-regexp": "5.0.0" + }, + "engines": { + "node": ">=14.16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/@semantic-release/npm/node_modules/escape-string-regexp": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-5.0.0.tgz", + "integrity": "sha512-/veY75JbMK4j1yjvuUxuVsiS/hr/4iHs9FTT6cgTexxdE0Ly/glccBAkloH/DofkjRbZU3bnoj38mOmhkZ0lHw==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/@semantic-release/npm/node_modules/execa": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/execa/-/execa-8.0.1.tgz", + "integrity": "sha512-VyhnebXciFV2DESc+p6B+y0LjSm0krU4OgJN44qFAhBY0TJ+1V61tYD2+wHusZ6F9n5K+vl8k0sTy7PEfV4qpg==", + "dev": true, + "dependencies": { + "cross-spawn": "^7.0.3", + "get-stream": "^8.0.1", + "human-signals": "^5.0.0", + "is-stream": "^3.0.0", + "merge-stream": "^2.0.0", + "npm-run-path": "^5.1.0", + "onetime": "^6.0.0", + "signal-exit": "^4.1.0", + "strip-final-newline": "^3.0.0" + }, + "engines": { + "node": ">=16.17" + }, + "funding": { + "url": "https://github.com/sindresorhus/execa?sponsor=1" + } + }, + "node_modules/@semantic-release/npm/node_modules/get-stream": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-8.0.1.tgz", + "integrity": "sha512-VaUJspBffn/LMCJVoMvSAdmscJyS1auj5Zulnn5UoYcY531UWmdwhRWkcGKnGU93m5HSXP9LP2usOryrBtQowA==", + "dev": true, + "engines": { + "node": ">=16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/@semantic-release/npm/node_modules/human-signals": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-5.0.0.tgz", + "integrity": "sha512-AXcZb6vzzrFAUE61HnN4mpLqd/cSIwNQjtNWR0euPm6y0iqx3G4gOXaIDdtdDwZmhwe82LA6+zinmW4UBWVePQ==", + "dev": true, + "engines": { + "node": ">=16.17.0" + } + }, + "node_modules/@semantic-release/npm/node_modules/indent-string": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-5.0.0.tgz", + "integrity": "sha512-m6FAo/spmsW2Ab2fU35JTYwtOKa2yAwXSwgjSv1TJzh4Mh7mC3lzAOVLBprb72XsTrgkEIsl7YrFNAiDiRhIGg==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/@semantic-release/npm/node_modules/is-stream": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-3.0.0.tgz", + "integrity": "sha512-LnQR4bZ9IADDRSkvpqMGvt/tEJWclzklNgSw48V5EAaAeDd6qGvN8ei6k5p0tvxSR171VmGyHuTiAOfxAbr8kA==", + "dev": true, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/@semantic-release/npm/node_modules/mimic-fn": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-4.0.0.tgz", + "integrity": "sha512-vqiC06CuhBTUdZH+RYl8sFrL096vA45Ok5ISO6sE/Mr1jRbGH4Csnhi8f3wKVl7x8mO4Au7Ir9D3Oyv1VYMFJw==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/@semantic-release/npm/node_modules/npm-run-path": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-5.3.0.tgz", + "integrity": "sha512-ppwTtiJZq0O/ai0z7yfudtBpWIoxM8yE6nHi1X47eFR2EWORqfbu6CnPlNsjeN683eT0qG6H/Pyf9fCcvjnnnQ==", + "dev": true, + "dependencies": { + "path-key": "^4.0.0" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/@semantic-release/npm/node_modules/onetime": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-6.0.0.tgz", + "integrity": "sha512-1FlR+gjXK7X+AsAHso35MnyN5KqGwJRi/31ft6x0M194ht7S+rWAvd7PHss9xSKMzE0asv1pyIHaJYq+BbacAQ==", + "dev": true, + "dependencies": { + "mimic-fn": "^4.0.0" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/@semantic-release/npm/node_modules/path-key": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-4.0.0.tgz", + "integrity": "sha512-haREypq7xkM7ErfgIyA0z+Bj4AGKlMSdlQE2jvJo6huWD1EdkKYV+G/T4nq0YEF2vgTT8kqMFKo1uHn950r4SQ==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/@semantic-release/npm/node_modules/semver": { + "version": "7.7.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.2.tgz", + "integrity": "sha512-RF0Fw+rO5AMf9MAyaRXI4AV0Ulj5lMHqVxxdSgiVbixSCXoEmmX/jk0CuJw4+3SqroYO9VoUh+HcuJivvtJemA==", + "dev": true, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/@semantic-release/npm/node_modules/signal-exit": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz", + "integrity": "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==", + "dev": true, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/@semantic-release/npm/node_modules/strip-final-newline": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-3.0.0.tgz", + "integrity": "sha512-dOESqjYr96iWYylGObzd39EuNTa5VJxyvVAEm5Jnh7KGo75V43Hk1odPQkNDyXNmUR6k+gEiDVXnjB8HJ3crXw==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/@semantic-release/release-notes-generator": { + "version": "11.0.7", + "resolved": "https://registry.npmjs.org/@semantic-release/release-notes-generator/-/release-notes-generator-11.0.7.tgz", + "integrity": "sha512-T09QB9ImmNx7Q6hY6YnnEbw/rEJ6a+22LBxfZq+pSAXg/OL/k0siwEm5cK4k1f9dE2Z2mPIjJKKohzUm0jbxcQ==", + "dev": true, + "dependencies": { + "conventional-changelog-angular": "^6.0.0", + "conventional-changelog-writer": "^6.0.0", + "conventional-commits-filter": "^4.0.0", + "conventional-commits-parser": "^5.0.0", + "debug": "^4.0.0", + "get-stream": "^7.0.0", + "import-from": "^4.0.0", + "into-stream": "^7.0.0", + "lodash-es": "^4.17.21", + "read-pkg-up": "^10.0.0" + }, + "engines": { + "node": ">=18" + }, + "peerDependencies": { + "semantic-release": ">=20.1.0" + } + }, + "node_modules/@semantic-release/release-notes-generator/node_modules/conventional-commits-filter": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/conventional-commits-filter/-/conventional-commits-filter-4.0.0.tgz", + "integrity": "sha512-rnpnibcSOdFcdclpFwWa+pPlZJhXE7l+XK04zxhbWrhgpR96h33QLz8hITTXbcYICxVr3HZFtbtUAQ+4LdBo9A==", + "dev": true, + "engines": { + "node": ">=16" + } + }, + "node_modules/@semantic-release/release-notes-generator/node_modules/get-stream": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-7.0.1.tgz", + "integrity": "sha512-3M8C1EOFN6r8AMUhwUAACIoXZJEOufDU5+0gFFN5uNs6XYOralD2Pqkl7m046va6x77FwposWXbAhPPIOus7mQ==", + "dev": true, + "engines": { + "node": ">=16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/@sinclair/typebox": { "version": "0.27.8", "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.27.8.tgz", "integrity": "sha512-+Fj43pSMwJs4KRrH/938Uf+uAELIgVBmQzg/q1YG10djyfA3TnrU8N8XzqCh/okZdszqBQTZf96idMfE5lnwTA==", "dev": true }, + "node_modules/@sindresorhus/merge-streams": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/@sindresorhus/merge-streams/-/merge-streams-2.3.0.tgz", + "integrity": "sha512-LtoMMhxAlorcGhmFYI+LhPgbPZCkgP6ra1YL604EeF6U98pLlQ3iWIGMdWSC+vWmPBWBNgmDBAhnAobLROJmwg==", + "dev": true, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/@sinonjs/commons": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-3.0.1.tgz", @@ -1056,6 +1781,12 @@ "pretty-format": "^29.0.0" } }, + "node_modules/@types/minimist": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/@types/minimist/-/minimist-1.2.5.tgz", + "integrity": "sha512-hov8bUuiLiyFPGyFPE1lwWhmzYbirOXQNNo40+y3zow8aFVTeyn3VWL0VFFfdNddA8S4Vf0Tc062rzyNr7Paag==", + "dev": true + }, "node_modules/@types/node": { "version": "20.17.30", "resolved": "https://registry.npmjs.org/@types/node/-/node-20.17.30.tgz", @@ -1065,6 +1796,12 @@ "undici-types": "~6.19.2" } }, + "node_modules/@types/normalize-package-data": { + "version": "2.4.4", + "resolved": "https://registry.npmjs.org/@types/normalize-package-data/-/normalize-package-data-2.4.4.tgz", + "integrity": "sha512-37i+OaWTh9qeK4LSHPsyRC7NahnGotNuZvjLSgcPzblpHB3rrCJxAOgI5gCdKm7coonsaX1Of0ILiTcnZjbfxA==", + "dev": true + }, "node_modules/@types/stack-utils": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/@types/stack-utils/-/stack-utils-2.0.3.tgz", @@ -1110,6 +1847,28 @@ "node": ">=0.4.0" } }, + "node_modules/agent-base": { + "version": "7.1.3", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-7.1.3.tgz", + "integrity": "sha512-jRR5wdylq8CkOe6hei19GGZnxM6rBGwFl3Bg0YItGDimvjGtAvdZk4Pu6Cl4u4Igsws4a1fd1Vq3ezrhn4KmFw==", + "dev": true, + "engines": { + "node": ">= 14" + } + }, + "node_modules/aggregate-error": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/aggregate-error/-/aggregate-error-3.1.0.tgz", + "integrity": "sha512-4I7Td01quW/RpocfNayFdFVk1qSuoh0E7JrbRJ16nH01HhKFQ88INq9Sd+nd72zqRySlr9BmDA8xlEJ6vJMrYA==", + "dev": true, + "dependencies": { + "clean-stack": "^2.0.0", + "indent-string": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/ansi-escapes": { "version": "4.3.2", "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-4.3.2.tgz", @@ -1149,6 +1908,12 @@ "url": "https://github.com/chalk/ansi-styles?sponsor=1" } }, + "node_modules/ansicolors": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/ansicolors/-/ansicolors-0.3.2.tgz", + "integrity": "sha512-QXu7BPrP29VllRxH8GwB7x5iX5qWKAAMLqKQGWTeLWVlNHNOpVMJ91dsxQAIWXpjuW5wqvxu3Jd/nRjrJ+0pqg==", + "dev": true + }, "node_modules/anymatch": { "version": "3.1.3", "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", @@ -1177,6 +1942,27 @@ "sprintf-js": "~1.0.2" } }, + "node_modules/argv-formatter": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/argv-formatter/-/argv-formatter-1.0.0.tgz", + "integrity": "sha512-F2+Hkm9xFaRg+GkaNnbwXNDV5O6pnCFEmqyhvfC/Ic5LbgOWjJh3L+mN/s91rxVL3znE7DYVpW0GJFT+4YBgWw==", + "dev": true + }, + "node_modules/array-ify": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/array-ify/-/array-ify-1.0.0.tgz", + "integrity": "sha512-c5AMf34bKdvPhQ7tBGhqkgKNUzMr4WUs+WDtC2ZUGOUncbxKMTvqxYctiseW3+L4bA8ec+GcZ6/A/FW4m8ukng==", + "dev": true + }, + "node_modules/arrify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/arrify/-/arrify-1.0.1.tgz", + "integrity": "sha512-3CYzex9M9FGQjCGMGyi6/31c8GJbgb0qGyrx5HWxPd0aCwh4cB2YjMb2Xf9UuoogrMrlO9cTqnB5rI5GHZTcUA==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/async": { "version": "3.2.5", "resolved": "https://registry.npmjs.org/async/-/async-3.2.5.tgz", @@ -1296,6 +2082,18 @@ "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", "dev": true }, + "node_modules/before-after-hook": { + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/before-after-hook/-/before-after-hook-2.2.3.tgz", + "integrity": "sha512-NzUnlZexiaH/46WDhANlyR2bXRopNg4F/zuSA3OpZnllCUgRaOF2znDioDWrmbNVsuZk6l9pMquQB38cfBZwkQ==", + "dev": true + }, + "node_modules/bottleneck": { + "version": "2.19.5", + "resolved": "https://registry.npmjs.org/bottleneck/-/bottleneck-2.19.5.tgz", + "integrity": "sha512-VHiNCbI1lKdl44tGrhNfU3lup0Tj/ZBMJB5/2ZbNXRCPuRCO7ed2mgcK4r17y+KB2EfuYuRaVlwNbAeaWGSpbw==", + "dev": true + }, "node_modules/brace-expansion": { "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", @@ -1395,6 +2193,23 @@ "node": ">=6" } }, + "node_modules/camelcase-keys": { + "version": "6.2.2", + "resolved": "https://registry.npmjs.org/camelcase-keys/-/camelcase-keys-6.2.2.tgz", + "integrity": "sha512-YrwaA0vEKazPBkn0ipTiMpSajYDSe+KjQfrjhcBMxJt/znbvlHd8Pw/Vamaz5EB4Wfhs3SUR3Z9mwRu/P3s3Yg==", + "dev": true, + "dependencies": { + "camelcase": "^5.3.1", + "map-obj": "^4.0.0", + "quick-lru": "^4.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/caniuse-lite": { "version": "1.0.30001643", "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001643.tgz", @@ -1415,6 +2230,19 @@ } ] }, + "node_modules/cardinal": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/cardinal/-/cardinal-2.1.1.tgz", + "integrity": "sha512-JSr5eOgoEymtYHBjNWyjrMqet9Am2miJhlfKNdqLp6zoeAh0KN5dRAcxlecj5mAJrmQomgiOBj35xHLrFjqBpw==", + "dev": true, + "dependencies": { + "ansicolors": "~0.3.2", + "redeyed": "~2.1.0" + }, + "bin": { + "cdl": "bin/cdl.js" + } + }, "node_modules/chalk": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", @@ -1461,6 +2289,30 @@ "integrity": "sha512-a3KdPAANPbNE4ZUv9h6LckSl9zLsYOP4MBmhIPkRaeyybt+r4UghLvq+xw/YwUcC1gqylCkL4rdVs3Lwupjm4Q==", "dev": true }, + "node_modules/clean-stack": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/clean-stack/-/clean-stack-2.2.0.tgz", + "integrity": "sha512-4diC9HaTE+KRAMWhDhrGOECgWZxoevMc5TlkObMqNSsVU62PYzXZ/SMTjzyGAFF1YusgxGcSWTEXBhp0CPwQ1A==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/cli-table3": { + "version": "0.6.5", + "resolved": "https://registry.npmjs.org/cli-table3/-/cli-table3-0.6.5.tgz", + "integrity": "sha512-+W/5efTR7y5HRD7gACw9yQjqMVvEMLBHmboM/kPWam+H+Hmyrgjh6YncVKK122YZkXrLudzTuAukUw9FnMf7IQ==", + "dev": true, + "dependencies": { + "string-width": "^4.2.0" + }, + "engines": { + "node": "10.* || >= 12.*" + }, + "optionalDependencies": { + "@colors/colors": "1.5.0" + } + }, "node_modules/cliui": { "version": "8.0.1", "resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz", @@ -1509,18 +2361,176 @@ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", "dev": true }, + "node_modules/compare-func": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/compare-func/-/compare-func-2.0.0.tgz", + "integrity": "sha512-zHig5N+tPWARooBnb0Zx1MFcdfpyJrfTJ3Y5L+IFvUm8rM74hHz66z0gw0x4tijh5CorKkKUCnW82R2vmpeCRA==", + "dev": true, + "dependencies": { + "array-ify": "^1.0.0", + "dot-prop": "^5.1.0" + } + }, "node_modules/concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", "dev": true }, + "node_modules/config-chain": { + "version": "1.1.13", + "resolved": "https://registry.npmjs.org/config-chain/-/config-chain-1.1.13.tgz", + "integrity": "sha512-qj+f8APARXHrM0hraqXYb2/bOVSV4PvJQlNZ/DVj0QrmNM2q2euizkeuVckQ57J+W0mRH6Hvi+k50M4Jul2VRQ==", + "dev": true, + "dependencies": { + "ini": "^1.3.4", + "proto-list": "~1.2.1" + } + }, + "node_modules/conventional-changelog-angular": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/conventional-changelog-angular/-/conventional-changelog-angular-6.0.0.tgz", + "integrity": "sha512-6qLgrBF4gueoC7AFVHu51nHL9pF9FRjXrH+ceVf7WmAfH3gs+gEYOkvxhjMPjZu57I4AGUGoNTY8V7Hrgf1uqg==", + "dev": true, + "dependencies": { + "compare-func": "^2.0.0" + }, + "engines": { + "node": ">=14" + } + }, + "node_modules/conventional-changelog-writer": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/conventional-changelog-writer/-/conventional-changelog-writer-6.0.1.tgz", + "integrity": "sha512-359t9aHorPw+U+nHzUXHS5ZnPBOizRxfQsWT5ZDHBfvfxQOAik+yfuhKXG66CN5LEWPpMNnIMHUTCKeYNprvHQ==", + "dev": true, + "dependencies": { + "conventional-commits-filter": "^3.0.0", + "dateformat": "^3.0.3", + "handlebars": "^4.7.7", + "json-stringify-safe": "^5.0.1", + "meow": "^8.1.2", + "semver": "^7.0.0", + "split": "^1.0.1" + }, + "bin": { + "conventional-changelog-writer": "cli.js" + }, + "engines": { + "node": ">=14" + } + }, + "node_modules/conventional-changelog-writer/node_modules/semver": { + "version": "7.7.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.2.tgz", + "integrity": "sha512-RF0Fw+rO5AMf9MAyaRXI4AV0Ulj5lMHqVxxdSgiVbixSCXoEmmX/jk0CuJw4+3SqroYO9VoUh+HcuJivvtJemA==", + "dev": true, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/conventional-commits-filter": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/conventional-commits-filter/-/conventional-commits-filter-3.0.0.tgz", + "integrity": "sha512-1ymej8b5LouPx9Ox0Dw/qAO2dVdfpRFq28e5Y0jJEU8ZrLdy0vOSkkIInwmxErFGhg6SALro60ZrwYFVTUDo4Q==", + "dev": true, + "dependencies": { + "lodash.ismatch": "^4.4.0", + "modify-values": "^1.0.1" + }, + "engines": { + "node": ">=14" + } + }, + "node_modules/conventional-commits-parser": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/conventional-commits-parser/-/conventional-commits-parser-5.0.0.tgz", + "integrity": "sha512-ZPMl0ZJbw74iS9LuX9YIAiW8pfM5p3yh2o/NbXHbkFuZzY5jvdi5jFycEOkmBW5H5I7nA+D6f3UcsCLP2vvSEA==", + "dev": true, + "dependencies": { + "is-text-path": "^2.0.0", + "JSONStream": "^1.3.5", + "meow": "^12.0.1", + "split2": "^4.0.0" + }, + "bin": { + "conventional-commits-parser": "cli.mjs" + }, + "engines": { + "node": ">=16" + } + }, + "node_modules/conventional-commits-parser/node_modules/meow": { + "version": "12.1.1", + "resolved": "https://registry.npmjs.org/meow/-/meow-12.1.1.tgz", + "integrity": "sha512-BhXM0Au22RwUneMPwSCnyhTOizdWoIEPU9sp0Aqa1PnDMR5Wv2FGXYDjuzJEIX+Eo2Rb8xuYe5jrnm5QowQFkw==", + "dev": true, + "engines": { + "node": ">=16.10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/convert-source-map": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-2.0.0.tgz", "integrity": "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==", "dev": true }, + "node_modules/core-util-is": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz", + "integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==", + "dev": true + }, + "node_modules/cosmiconfig": { + "version": "8.3.6", + "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-8.3.6.tgz", + "integrity": "sha512-kcZ6+W5QzcJ3P1Mt+83OUv/oHFqZHIx8DuxG6eZ5RGMERoLqp4BuGjhHLYGK+Kf5XVkQvqBSmAy/nGWN3qDgEA==", + "dev": true, + "dependencies": { + "import-fresh": "^3.3.0", + "js-yaml": "^4.1.0", + "parse-json": "^5.2.0", + "path-type": "^4.0.0" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/d-fischer" + }, + "peerDependencies": { + "typescript": ">=4.9.5" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/cosmiconfig/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 + }, + "node_modules/cosmiconfig/node_modules/js-yaml": { + "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" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, "node_modules/create-jest": { "version": "29.7.0", "resolved": "https://registry.npmjs.org/create-jest/-/create-jest-29.7.0.tgz", @@ -1580,6 +2590,42 @@ "node": ">= 8" } }, + "node_modules/crypto-random-string": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/crypto-random-string/-/crypto-random-string-4.0.0.tgz", + "integrity": "sha512-x8dy3RnvYdlUcPOjkEHqozhiwzKNSq7GcPuXFbnyMOCHxX8V3OgIg/pYuabl2sbUPfIJaeAQB7PMOK8DFIdoRA==", + "dev": true, + "dependencies": { + "type-fest": "^1.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/crypto-random-string/node_modules/type-fest": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-1.4.0.tgz", + "integrity": "sha512-yGSza74xk0UG8k+pLh5oeoYirvIiWo5t0/o3zHHAO2tRDiZcxWP7fywNlXhqb6/r6sWvwi+RsyQMWhVLe4BVuA==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/dateformat": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/dateformat/-/dateformat-3.0.3.tgz", + "integrity": "sha512-jyCETtSl3VMZMWeRo7iY1FL19ges1t55hMo5yaam4Jrsm5EPL89UQkoQRyiI+Yf4k8r2ZpdngkV8hr1lIdjb3Q==", + "dev": true, + "engines": { + "node": "*" + } + }, "node_modules/debug": { "version": "4.3.5", "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.5.tgz", @@ -1603,6 +2649,40 @@ "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", "dev": true }, + "node_modules/decamelize": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", + "integrity": "sha512-z2S+W9X73hAUUki+N+9Za2lBlun89zigOyGrsax+KUQ6wKW4ZoWpEYBkGhQjwAjjDCkWxhY0VKEhk8wzY7F5cA==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/decamelize-keys": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/decamelize-keys/-/decamelize-keys-1.1.1.tgz", + "integrity": "sha512-WiPxgEirIV0/eIOMcnFBA3/IJZAZqKnwAwWyvvdi4lsr1WCN22nhdf/3db3DoZcUjTV2SqfzIwNyp6y2xs3nmg==", + "dev": true, + "dependencies": { + "decamelize": "^1.1.0", + "map-obj": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/decamelize-keys/node_modules/map-obj": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/map-obj/-/map-obj-1.0.1.tgz", + "integrity": "sha512-7N/q3lyZ+LVCp7PzuxrJr4KMbBE2hW7BT7YNia330OFxIf4d3r5zVpicP2650l7CPN6RM9zOJRl3NGpqSiw3Eg==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/dedent": { "version": "1.5.3", "resolved": "https://registry.npmjs.org/dedent/-/dedent-1.5.3.tgz", @@ -1617,6 +2697,15 @@ } } }, + "node_modules/deep-extend": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz", + "integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==", + "dev": true, + "engines": { + "node": ">=4.0.0" + } + }, "node_modules/deepmerge": { "version": "4.3.1", "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-4.3.1.tgz", @@ -1626,6 +2715,12 @@ "node": ">=0.10.0" } }, + "node_modules/deprecation": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/deprecation/-/deprecation-2.3.1.tgz", + "integrity": "sha512-xmHIy4F3scKVwMsQ4WnVaS8bHOx0DmVwRywosKhaILI0ywMDWPtBSku2HNxRvF7jtwDRsoEwYQSfbxj8b7RlJQ==", + "dev": true + }, "node_modules/detect-newline": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/detect-newline/-/detect-newline-3.1.0.tgz", @@ -1653,6 +2748,39 @@ "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, + "node_modules/dir-glob": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz", + "integrity": "sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==", + "dev": true, + "dependencies": { + "path-type": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/dot-prop": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/dot-prop/-/dot-prop-5.3.0.tgz", + "integrity": "sha512-QM8q3zDe58hqUqjraQOmzZ1LIH9SWQJTlEKCH4kJ2oQvLZk7RbQXvtDM2XEq3fwkV9CCvvH4LA0AV+ogFsBM2Q==", + "dev": true, + "dependencies": { + "is-obj": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/duplexer2": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/duplexer2/-/duplexer2-0.1.4.tgz", + "integrity": "sha512-asLFVfWWtJ90ZyOUHMqk7/S2w2guQKxUI2itj3d92ADHhxUSbCMGi1f1cBcJ7xM1To+pE/Khbwo1yuNbMEPKeA==", + "dev": true, + "dependencies": { + "readable-stream": "^2.0.2" + } + }, "node_modules/ejs": { "version": "3.1.10", "resolved": "https://registry.npmjs.org/ejs/-/ejs-3.1.10.tgz", @@ -1692,6 +2820,129 @@ "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", "dev": true }, + "node_modules/env-ci": { + "version": "9.1.1", + "resolved": "https://registry.npmjs.org/env-ci/-/env-ci-9.1.1.tgz", + "integrity": "sha512-Im2yEWeF4b2RAMAaWvGioXk6m0UNaIjD8hj28j2ij5ldnIFrDQT0+pzDvpbRkcjurhXhf/AsBKv8P2rtmGi9Aw==", + "dev": true, + "dependencies": { + "execa": "^7.0.0", + "java-properties": "^1.0.2" + }, + "engines": { + "node": "^16.14 || >=18" + } + }, + "node_modules/env-ci/node_modules/execa": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/execa/-/execa-7.2.0.tgz", + "integrity": "sha512-UduyVP7TLB5IcAQl+OzLyLcS/l32W/GLg+AhHJ+ow40FOk2U3SAllPwR44v4vmdFwIWqpdwxxpQbF1n5ta9seA==", + "dev": true, + "dependencies": { + "cross-spawn": "^7.0.3", + "get-stream": "^6.0.1", + "human-signals": "^4.3.0", + "is-stream": "^3.0.0", + "merge-stream": "^2.0.0", + "npm-run-path": "^5.1.0", + "onetime": "^6.0.0", + "signal-exit": "^3.0.7", + "strip-final-newline": "^3.0.0" + }, + "engines": { + "node": "^14.18.0 || ^16.14.0 || >=18.0.0" + }, + "funding": { + "url": "https://github.com/sindresorhus/execa?sponsor=1" + } + }, + "node_modules/env-ci/node_modules/human-signals": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-4.3.1.tgz", + "integrity": "sha512-nZXjEF2nbo7lIw3mgYjItAfgQXog3OjJogSbKa2CQIIvSGWcKgeJnQlNXip6NglNzYH45nSRiEVimMvYL8DDqQ==", + "dev": true, + "engines": { + "node": ">=14.18.0" + } + }, + "node_modules/env-ci/node_modules/is-stream": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-3.0.0.tgz", + "integrity": "sha512-LnQR4bZ9IADDRSkvpqMGvt/tEJWclzklNgSw48V5EAaAeDd6qGvN8ei6k5p0tvxSR171VmGyHuTiAOfxAbr8kA==", + "dev": true, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/env-ci/node_modules/mimic-fn": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-4.0.0.tgz", + "integrity": "sha512-vqiC06CuhBTUdZH+RYl8sFrL096vA45Ok5ISO6sE/Mr1jRbGH4Csnhi8f3wKVl7x8mO4Au7Ir9D3Oyv1VYMFJw==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/env-ci/node_modules/npm-run-path": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-5.3.0.tgz", + "integrity": "sha512-ppwTtiJZq0O/ai0z7yfudtBpWIoxM8yE6nHi1X47eFR2EWORqfbu6CnPlNsjeN683eT0qG6H/Pyf9fCcvjnnnQ==", + "dev": true, + "dependencies": { + "path-key": "^4.0.0" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/env-ci/node_modules/onetime": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-6.0.0.tgz", + "integrity": "sha512-1FlR+gjXK7X+AsAHso35MnyN5KqGwJRi/31ft6x0M194ht7S+rWAvd7PHss9xSKMzE0asv1pyIHaJYq+BbacAQ==", + "dev": true, + "dependencies": { + "mimic-fn": "^4.0.0" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/env-ci/node_modules/path-key": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-4.0.0.tgz", + "integrity": "sha512-haREypq7xkM7ErfgIyA0z+Bj4AGKlMSdlQE2jvJo6huWD1EdkKYV+G/T4nq0YEF2vgTT8kqMFKo1uHn950r4SQ==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/env-ci/node_modules/strip-final-newline": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-3.0.0.tgz", + "integrity": "sha512-dOESqjYr96iWYylGObzd39EuNTa5VJxyvVAEm5Jnh7KGo75V43Hk1odPQkNDyXNmUR6k+gEiDVXnjB8HJ3crXw==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/error-ex": { "version": "1.3.2", "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", @@ -1780,12 +3031,37 @@ "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, + "node_modules/fast-glob": { + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.3.tgz", + "integrity": "sha512-7MptL8U0cqcFdzIzwOTHoilX9x5BrNqye7Z/LuC7kCMRio1EMSyqRK3BEAUD7sXRq4iT4AzTVuZdhgQ2TCvYLg==", + "dev": true, + "dependencies": { + "@nodelib/fs.stat": "^2.0.2", + "@nodelib/fs.walk": "^1.2.3", + "glob-parent": "^5.1.2", + "merge2": "^1.3.0", + "micromatch": "^4.0.8" + }, + "engines": { + "node": ">=8.6.0" + } + }, "node_modules/fast-json-stable-stringify": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", "dev": true }, + "node_modules/fastq": { + "version": "1.19.1", + "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.19.1.tgz", + "integrity": "sha512-GwLTyxkCXjXbxqIhTsMI2Nui8huMPtnxg7krajPJAjnEG/iiOS7i+zCtWGZR9G0NBKbXKh6X9m9UIsYX/N6vvQ==", + "dev": true, + "dependencies": { + "reusify": "^1.0.4" + } + }, "node_modules/fb-watchman": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/fb-watchman/-/fb-watchman-2.0.2.tgz", @@ -1795,6 +3071,34 @@ "bser": "2.1.1" } }, + "node_modules/figures": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/figures/-/figures-5.0.0.tgz", + "integrity": "sha512-ej8ksPF4x6e5wvK9yevct0UCXh8TTFlWGVLlgjZuoBH1HwjIfKE/IdL5mq89sFA7zELi1VhKpmtDnrs7zWyeyg==", + "dev": true, + "dependencies": { + "escape-string-regexp": "^5.0.0", + "is-unicode-supported": "^1.2.0" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/figures/node_modules/escape-string-regexp": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-5.0.0.tgz", + "integrity": "sha512-/veY75JbMK4j1yjvuUxuVsiS/hr/4iHs9FTT6cgTexxdE0Ly/glccBAkloH/DofkjRbZU3bnoj38mOmhkZ0lHw==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/filelist": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/filelist/-/filelist-1.0.4.tgz", @@ -1850,6 +3154,45 @@ "node": ">=8" } }, + "node_modules/find-versions": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/find-versions/-/find-versions-5.1.0.tgz", + "integrity": "sha512-+iwzCJ7C5v5KgcBuueqVoNiHVoQpwiUK5XFLjf0affFTep+Wcw93tPvmb8tqujDNmzhBDPddnWV/qgWSXgq+Hg==", + "dev": true, + "dependencies": { + "semver-regex": "^4.0.5" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/from2": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/from2/-/from2-2.3.0.tgz", + "integrity": "sha512-OMcX/4IC/uqEPVgGeyfN22LJk6AZrMkRZHxcHBMBvHScDGgwTm2GT2Wkgtocyd3JfZffjj2kYUDXXII0Fk9W0g==", + "dev": true, + "dependencies": { + "inherits": "^2.0.1", + "readable-stream": "^2.0.0" + } + }, + "node_modules/fs-extra": { + "version": "11.3.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-11.3.0.tgz", + "integrity": "sha512-Z4XaCL6dUDHfP/jT25jJKMmtxvuwbkrD1vNSMFlo9lNLY2c5FHYSQgHPRZUjAB26TpDEoW9HCOgplrdbaPV/ew==", + "dev": true, + "dependencies": { + "graceful-fs": "^4.2.0", + "jsonfile": "^6.0.1", + "universalify": "^2.0.0" + }, + "engines": { + "node": ">=14.14" + } + }, "node_modules/fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", @@ -1918,6 +3261,29 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/git-log-parser": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/git-log-parser/-/git-log-parser-1.2.1.tgz", + "integrity": "sha512-PI+sPDvHXNPl5WNOErAK05s3j0lgwUzMN6o8cyQrDaKfT3qd7TmNJKeXX+SknI5I0QhG5fVPAEwSY4tRGDtYoQ==", + "dev": true, + "dependencies": { + "argv-formatter": "~1.0.0", + "spawn-error-forwarder": "~1.0.0", + "split2": "~1.0.0", + "stream-combiner2": "~1.1.1", + "through2": "~2.0.0", + "traverse": "0.6.8" + } + }, + "node_modules/git-log-parser/node_modules/split2": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/split2/-/split2-1.0.0.tgz", + "integrity": "sha512-NKywug4u4pX/AZBB1FCPzZ6/7O+Xhz1qMVbzTvvKvikjO99oPN87SkK08mEY9P63/5lWjK+wgOOgApnTg5r6qg==", + "dev": true, + "dependencies": { + "through2": "~2.0.0" + } + }, "node_modules/glob": { "version": "7.2.3", "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", @@ -1939,6 +3305,18 @@ "url": "https://github.com/sponsors/isaacs" } }, + "node_modules/glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "dev": true, + "dependencies": { + "is-glob": "^4.0.1" + }, + "engines": { + "node": ">= 6" + } + }, "node_modules/globals": { "version": "11.12.0", "resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz", @@ -1948,12 +3326,86 @@ "node": ">=4" } }, + "node_modules/globby": { + "version": "14.1.0", + "resolved": "https://registry.npmjs.org/globby/-/globby-14.1.0.tgz", + "integrity": "sha512-0Ia46fDOaT7k4og1PDW4YbodWWr3scS2vAr2lTbsplOt2WkKp0vQbkI9wKis/T5LV/dqPjO3bpS/z6GTJB82LA==", + "dev": true, + "dependencies": { + "@sindresorhus/merge-streams": "^2.1.0", + "fast-glob": "^3.3.3", + "ignore": "^7.0.3", + "path-type": "^6.0.0", + "slash": "^5.1.0", + "unicorn-magic": "^0.3.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/globby/node_modules/path-type": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-6.0.0.tgz", + "integrity": "sha512-Vj7sf++t5pBD637NSfkxpHSMfWaeig5+DKWLhcqIYx6mWQz5hdJTGDVMQiJcw1ZYkhs7AazKDGpRVji1LJCZUQ==", + "dev": true, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/globby/node_modules/slash": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-5.1.0.tgz", + "integrity": "sha512-ZA6oR3T/pEyuqwMgAKT0/hAv8oAXckzbkmR0UkUosQ+Mc4RxGoJkRmwHgHufaenlyAgE1Mxgpdcrf75y6XcnDg==", + "dev": true, + "engines": { + "node": ">=14.16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/graceful-fs": { "version": "4.2.11", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==", "dev": true }, + "node_modules/handlebars": { + "version": "4.7.8", + "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.7.8.tgz", + "integrity": "sha512-vafaFqs8MZkRrSX7sFVUdo3ap/eNiLnb4IakshzvP56X5Nr1iGKAIqdX6tMlm6HcNRIkr6AxO5jFEoJzzpT8aQ==", + "dev": true, + "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/hard-rejection": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/hard-rejection/-/hard-rejection-2.1.0.tgz", + "integrity": "sha512-VIZB+ibDhx7ObhAe7OVtoEbuP4h/MuOTHJ+J8h/eBXotJYl0fBgR72xDFCKgIh22OJZIOVNxBMWuhAr10r8HdA==", + "dev": true, + "engines": { + "node": ">=6" + } + }, "node_modules/has-flag": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", @@ -1975,12 +3427,68 @@ "node": ">= 0.4" } }, + "node_modules/hook-std": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/hook-std/-/hook-std-3.0.0.tgz", + "integrity": "sha512-jHRQzjSDzMtFy34AGj1DN+vq54WVuhSvKgrHf0OMiFQTwDD4L/qqofVEWjLOBMTn5+lCD3fPg32W9yOfnEJTTw==", + "dev": true, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/hosted-git-info": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-7.0.2.tgz", + "integrity": "sha512-puUZAUKT5m8Zzvs72XWy3HtvVbTWljRE66cP60bxJzAqf2DgICo7lYTY2IHUmLnNpjYvw5bvmoHvPc0QO2a62w==", + "dev": true, + "dependencies": { + "lru-cache": "^10.0.1" + }, + "engines": { + "node": "^16.14.0 || >=18.0.0" + } + }, + "node_modules/hosted-git-info/node_modules/lru-cache": { + "version": "10.4.3", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.4.3.tgz", + "integrity": "sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ==", + "dev": true + }, "node_modules/html-escaper": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/html-escaper/-/html-escaper-2.0.2.tgz", "integrity": "sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==", "dev": true }, + "node_modules/http-proxy-agent": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-7.0.2.tgz", + "integrity": "sha512-T1gkAiYYDWYx3V5Bmyu7HcfcvL7mUrTWiM6yOfa3PIphViJ/gFPbvidQ+veqSOHci/PxBcDabeUNCzpOODJZig==", + "dev": true, + "dependencies": { + "agent-base": "^7.1.0", + "debug": "^4.3.4" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/https-proxy-agent": { + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-7.0.6.tgz", + "integrity": "sha512-vK9P5/iUfdl95AI+JVyUuIcVtd4ofvtrOr3HNtM2yxC9bnMbEdp3x01OhQNnjb8IJYi38VlTE3mBXwcfvywuSw==", + "dev": true, + "dependencies": { + "agent-base": "^7.1.2", + "debug": "4" + }, + "engines": { + "node": ">= 14" + } + }, "node_modules/human-signals": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-2.1.0.tgz", @@ -1990,6 +3498,52 @@ "node": ">=10.17.0" } }, + "node_modules/ignore": { + "version": "7.0.5", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-7.0.5.tgz", + "integrity": "sha512-Hs59xBNfUIunMFgWAbGX5cq6893IbWg4KnrjbYwX3tx0ztorVgTDA6B2sxf8ejHJ4wz8BqGUMYlnzNBer5NvGg==", + "dev": true, + "engines": { + "node": ">= 4" + } + }, + "node_modules/import-fresh": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.1.tgz", + "integrity": "sha512-TR3KfrTZTYLPB6jUjfx6MF9WcWrHL9su5TObK4ZkYgBdWKPOFoSoQIdEuTuR82pmtxH2spWG9h6etwfr1pLBqQ==", + "dev": true, + "dependencies": { + "parent-module": "^1.0.0", + "resolve-from": "^4.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/import-fresh/node_modules/resolve-from": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", + "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/import-from": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/import-from/-/import-from-4.0.0.tgz", + "integrity": "sha512-P9J71vT5nLlDeV8FHs5nNxaLbrpfAV5cF5srvbZfpwpcJoM/xZR3hiv+q+SAnuSmuGbXMWud063iIMx/V/EWZQ==", + "dev": true, + "engines": { + "node": ">=12.2" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/import-local": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/import-local/-/import-local-3.2.0.tgz", @@ -2018,6 +3572,15 @@ "node": ">=0.8.19" } }, + "node_modules/indent-string": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-4.0.0.tgz", + "integrity": "sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg==", + "dev": true, + "engines": { + "node": ">=8" + } + }, "node_modules/inflight": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", @@ -2035,6 +3598,28 @@ "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", "dev": true }, + "node_modules/ini": { + "version": "1.3.8", + "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.8.tgz", + "integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==", + "dev": true + }, + "node_modules/into-stream": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/into-stream/-/into-stream-7.0.0.tgz", + "integrity": "sha512-2dYz766i9HprMBasCMvHMuazJ7u4WzhJwo5kb3iPSiW/iRYV6uPari3zHoqZlnuaR7V1bEiNMxikhp37rdBXbw==", + "dev": true, + "dependencies": { + "from2": "^2.3.0", + "p-is-promise": "^3.0.0" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/is-arrayish": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", @@ -2056,6 +3641,15 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/is-fullwidth-code-point": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", @@ -2074,6 +3668,18 @@ "node": ">=6" } }, + "node_modules/is-glob": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "dev": true, + "dependencies": { + "is-extglob": "^2.1.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/is-number": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", @@ -2083,6 +3689,24 @@ "node": ">=0.12.0" } }, + "node_modules/is-obj": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-obj/-/is-obj-2.0.0.tgz", + "integrity": "sha512-drqDG3cbczxxEJRoOXcOjtdp1J/lyp1mNn0xaznRs8+muBhgQcrnbspox5X5fOw0HnMnbfDzvnEMEtqDEJEo8w==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/is-plain-obj": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-1.1.0.tgz", + "integrity": "sha512-yvkRyxmFKEOQ4pNXCmJG5AEQNlXJS5LaONXo5/cLdTZdWvsZ1ioJEonLGAosKlMWE8lwUy/bJzMjcw8az73+Fg==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/is-stream": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz", @@ -2095,12 +3719,58 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/is-text-path": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-text-path/-/is-text-path-2.0.0.tgz", + "integrity": "sha512-+oDTluR6WEjdXEJMnC2z6A4FRwFoYuvShVVEGsS7ewc0UTi2QtAKMDJuL4BDEVt+5T7MjFo12RP8ghOM75oKJw==", + "dev": true, + "dependencies": { + "text-extensions": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "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==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==", + "dev": true + }, "node_modules/isexe": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", "dev": true }, + "node_modules/issue-parser": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/issue-parser/-/issue-parser-6.0.0.tgz", + "integrity": "sha512-zKa/Dxq2lGsBIXQ7CUZWTHfvxPC2ej0KfO7fIPqLlHB9J2hJ7rGhZ5rilhuufylr4RXYPzJUeFjKxz305OsNlA==", + "dev": true, + "dependencies": { + "lodash.capitalize": "^4.2.1", + "lodash.escaperegexp": "^4.1.2", + "lodash.isplainobject": "^4.0.6", + "lodash.isstring": "^4.0.1", + "lodash.uniqby": "^4.7.0" + }, + "engines": { + "node": ">=10.13" + } + }, "node_modules/istanbul-lib-coverage": { "version": "3.2.2", "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-3.2.2.tgz", @@ -2197,6 +3867,15 @@ "node": ">=10" } }, + "node_modules/java-properties": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/java-properties/-/java-properties-1.0.2.tgz", + "integrity": "sha512-qjdpeo2yKlYTH7nFdK0vbZWuTCesk4o63v5iVOlhMQPfuIZQfW/HI35SjfhA+4qpg36rnFSvUK5b1m+ckIblQQ==", + "dev": true, + "engines": { + "node": ">= 0.6.0" + } + }, "node_modules/jest": { "version": "29.7.0", "resolved": "https://registry.npmjs.org/jest/-/jest-29.7.0.tgz", @@ -2795,12 +4474,24 @@ "node": ">=4" } }, + "node_modules/json-parse-better-errors": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz", + "integrity": "sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw==", + "dev": true + }, "node_modules/json-parse-even-better-errors": { "version": "2.3.1", "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz", "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==", "dev": true }, + "node_modules/json-stringify-safe": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", + "integrity": "sha512-ZClg6AaYvamvYEE82d3Iyd3vSSIjQ+odgjaTzRuO3s7toCdFKczob2i0zCh7JE8kWn17yvAWhUVxvqGwUalsRA==", + "dev": true + }, "node_modules/json5": { "version": "2.2.3", "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz", @@ -2813,6 +4504,52 @@ "node": ">=6" } }, + "node_modules/jsonfile": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz", + "integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==", + "dev": true, + "dependencies": { + "universalify": "^2.0.0" + }, + "optionalDependencies": { + "graceful-fs": "^4.1.6" + } + }, + "node_modules/jsonparse": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/jsonparse/-/jsonparse-1.3.1.tgz", + "integrity": "sha512-POQXvpdL69+CluYsillJ7SUhKvytYjW9vG/GKpnf+xP8UWgYEM/RaMzHHofbALDiKbbP1W8UEYmgGl39WkPZsg==", + "dev": true, + "engines": [ + "node >= 0.2.0" + ] + }, + "node_modules/JSONStream": { + "version": "1.3.5", + "resolved": "https://registry.npmjs.org/JSONStream/-/JSONStream-1.3.5.tgz", + "integrity": "sha512-E+iruNOY8VV9s4JEbe1aNEm6MiszPRr/UfcHMz0TQh1BXSxHK+ASV1R6W4HpjBhSeS+54PIsAMCBmwD06LLsqQ==", + "dev": true, + "dependencies": { + "jsonparse": "^1.2.0", + "through": ">=2.2.7 <3" + }, + "bin": { + "JSONStream": "bin.js" + }, + "engines": { + "node": "*" + } + }, + "node_modules/kind-of": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", + "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/kleur": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/kleur/-/kleur-3.0.3.tgz", @@ -2837,6 +4574,43 @@ "integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==", "dev": true }, + "node_modules/load-json-file": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-4.0.0.tgz", + "integrity": "sha512-Kx8hMakjX03tiGTLAIdJ+lL0htKnXjEZN6hk/tozf/WOuYGdZBJrZ+rCJRbVCugsjB3jMLn9746NsQIf5VjBMw==", + "dev": true, + "dependencies": { + "graceful-fs": "^4.1.2", + "parse-json": "^4.0.0", + "pify": "^3.0.0", + "strip-bom": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/load-json-file/node_modules/parse-json": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-4.0.0.tgz", + "integrity": "sha512-aOIos8bujGN93/8Ox/jPLh7RwVnPEysynVFE+fQZyg6jKELEHwzgKdLRFHUgXJL6kylijVSBC4BvN9OmsB48Rw==", + "dev": true, + "dependencies": { + "error-ex": "^1.3.1", + "json-parse-better-errors": "^1.0.1" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/load-json-file/node_modules/strip-bom": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", + "integrity": "sha512-vavAMRXOgBVNF6nyEEmL3DBK19iRpDcoIwW+swQ+CbGiu7lju6t+JklA1MHweoWtadgt4ISVUsXLyDq34ddcwA==", + "dev": true, + "engines": { + "node": ">=4" + } + }, "node_modules/locate-path": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", @@ -2849,12 +4623,60 @@ "node": ">=8" } }, + "node_modules/lodash": { + "version": "4.17.21", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", + "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", + "dev": true + }, + "node_modules/lodash-es": { + "version": "4.17.21", + "resolved": "https://registry.npmjs.org/lodash-es/-/lodash-es-4.17.21.tgz", + "integrity": "sha512-mKnC+QJ9pWVzv+C4/U3rRsHapFfHvQFoFB92e52xeyGMcX6/OlIl78je1u8vePzYZSkkogMPJ2yjxxsb89cxyw==", + "dev": true + }, + "node_modules/lodash.capitalize": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/lodash.capitalize/-/lodash.capitalize-4.2.1.tgz", + "integrity": "sha512-kZzYOKspf8XVX5AvmQF94gQW0lejFVgb80G85bU4ZWzoJ6C03PQg3coYAUpSTpQWelrZELd3XWgHzw4Ck5kaIw==", + "dev": true + }, + "node_modules/lodash.escaperegexp": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/lodash.escaperegexp/-/lodash.escaperegexp-4.1.2.tgz", + "integrity": "sha512-TM9YBvyC84ZxE3rgfefxUWiQKLilstD6k7PTGt6wfbtXF8ixIJLOL3VYyV/z+ZiPLsVxAsKAFVwWlWeb2Y8Yyw==", + "dev": true + }, + "node_modules/lodash.ismatch": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/lodash.ismatch/-/lodash.ismatch-4.4.0.tgz", + "integrity": "sha512-fPMfXjGQEV9Xsq/8MTSgUf255gawYRbjwMyDbcvDhXgV7enSZA0hynz6vMPnpAb5iONEzBHBPsT+0zes5Z301g==", + "dev": true + }, + "node_modules/lodash.isplainobject": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/lodash.isplainobject/-/lodash.isplainobject-4.0.6.tgz", + "integrity": "sha512-oSXzaWypCMHkPC3NvBEaPHf0KsA5mvPrOPgQWDsbg8n7orZ290M0BmC/jgRZ4vcJ6DTAhjrsSYgdsW/F+MFOBA==", + "dev": true + }, + "node_modules/lodash.isstring": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/lodash.isstring/-/lodash.isstring-4.0.1.tgz", + "integrity": "sha512-0wJxfxH1wgO3GrbuP+dTTk7op+6L41QCXbGINEmD+ny/G/eCqGzxyCsh7159S+mgDDcoarnBw6PC1PS5+wUGgw==", + "dev": true + }, "node_modules/lodash.memoize": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/lodash.memoize/-/lodash.memoize-4.1.2.tgz", "integrity": "sha512-t7j+NzmgnQzTAYXcsHYLgimltOV1MXHtlOWf6GjL9Kj8GK5FInw5JotxvbOs+IvV1/Dzo04/fCGfLVs7aXb4Ag==", "dev": true }, + "node_modules/lodash.uniqby": { + "version": "4.7.0", + "resolved": "https://registry.npmjs.org/lodash.uniqby/-/lodash.uniqby-4.7.0.tgz", + "integrity": "sha512-e/zcLx6CSbmaEgFHCA7BnoQKyCtKMxnuWrJygbwPs/AIn+IMKl66L8/s+wBUn5LRw2pZx3bUHibiV1b6aTWIww==", + "dev": true + }, "node_modules/lru-cache": { "version": "5.1.1", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz", @@ -2906,16 +4728,273 @@ "tmpl": "1.0.5" } }, + "node_modules/map-obj": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/map-obj/-/map-obj-4.3.0.tgz", + "integrity": "sha512-hdN1wVrZbb29eBGiGjJbeP8JbKjq1urkHJ/LIP/NY48MZ1QVXUsQBV1G1zvYFHn1XE06cwjBsOI2K3Ulnj1YXQ==", + "dev": true, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/marked": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/marked/-/marked-5.1.2.tgz", + "integrity": "sha512-ahRPGXJpjMjwSOlBoTMZAK7ATXkli5qCPxZ21TG44rx1KEo44bii4ekgTDQPNRQ4Kh7JMb9Ub1PVk1NxRSsorg==", + "dev": true, + "bin": { + "marked": "bin/marked.js" + }, + "engines": { + "node": ">= 16" + } + }, + "node_modules/marked-terminal": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/marked-terminal/-/marked-terminal-5.2.0.tgz", + "integrity": "sha512-Piv6yNwAQXGFjZSaiNljyNFw7jKDdGrw70FSbtxEyldLsyeuV5ZHm/1wW++kWbrOF1VPnUgYOhB2oLL0ZpnekA==", + "dev": true, + "dependencies": { + "ansi-escapes": "^6.2.0", + "cardinal": "^2.1.1", + "chalk": "^5.2.0", + "cli-table3": "^0.6.3", + "node-emoji": "^1.11.0", + "supports-hyperlinks": "^2.3.0" + }, + "engines": { + "node": ">=14.13.1 || >=16.0.0" + }, + "peerDependencies": { + "marked": "^1.0.0 || ^2.0.0 || ^3.0.0 || ^4.0.0 || ^5.0.0" + } + }, + "node_modules/marked-terminal/node_modules/ansi-escapes": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-6.2.1.tgz", + "integrity": "sha512-4nJ3yixlEthEJ9Rk4vPcdBRkZvQZlYyu8j4/Mqz5sgIkddmEnH2Yj2ZrnP9S3tQOvSNRUIgVNF/1yPpRAGNRig==", + "dev": true, + "engines": { + "node": ">=14.16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/marked-terminal/node_modules/chalk": { + "version": "5.4.1", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.4.1.tgz", + "integrity": "sha512-zgVZuo2WcZgfUEmsn6eO3kINexW8RAE4maiQ8QNs8CtpPCSyMiYsULR3HQYkm3w8FIA3SberyMJMSldGsW+U3w==", + "dev": true, + "engines": { + "node": "^12.17.0 || ^14.13 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/meow": { + "version": "8.1.2", + "resolved": "https://registry.npmjs.org/meow/-/meow-8.1.2.tgz", + "integrity": "sha512-r85E3NdZ+mpYk1C6RjPFEMSE+s1iZMuHtsHAqY0DT3jZczl0diWUZ8g6oU7h0M9cD2EL+PzaYghhCLzR0ZNn5Q==", + "dev": true, + "dependencies": { + "@types/minimist": "^1.2.0", + "camelcase-keys": "^6.2.2", + "decamelize-keys": "^1.1.0", + "hard-rejection": "^2.1.0", + "minimist-options": "4.1.0", + "normalize-package-data": "^3.0.0", + "read-pkg-up": "^7.0.1", + "redent": "^3.0.0", + "trim-newlines": "^3.0.0", + "type-fest": "^0.18.0", + "yargs-parser": "^20.2.3" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/meow/node_modules/hosted-git-info": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-4.1.0.tgz", + "integrity": "sha512-kyCuEOWjJqZuDbRHzL8V93NzQhwIB71oFWSyzVo+KPZI+pnQPPxucdkrOZvkLRnrf5URsQM+IJ09Dw29cRALIA==", + "dev": true, + "dependencies": { + "lru-cache": "^6.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/meow/node_modules/lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "dev": true, + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/meow/node_modules/normalize-package-data": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-3.0.3.tgz", + "integrity": "sha512-p2W1sgqij3zMMyRC067Dg16bfzVH+w7hyegmpIvZ4JNjqtGOVAIvLmjBx3yP7YTe9vKJgkoNOPjwQGogDoMXFA==", + "dev": true, + "dependencies": { + "hosted-git-info": "^4.0.1", + "is-core-module": "^2.5.0", + "semver": "^7.3.4", + "validate-npm-package-license": "^3.0.1" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/meow/node_modules/read-pkg": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-5.2.0.tgz", + "integrity": "sha512-Ug69mNOpfvKDAc2Q8DRpMjjzdtrnv9HcSMX+4VsZxD1aZ6ZzrIE7rlzXBtWTyhULSMKg076AW6WR5iZpD0JiOg==", + "dev": true, + "dependencies": { + "@types/normalize-package-data": "^2.4.0", + "normalize-package-data": "^2.5.0", + "parse-json": "^5.0.0", + "type-fest": "^0.6.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/meow/node_modules/read-pkg-up": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-7.0.1.tgz", + "integrity": "sha512-zK0TB7Xd6JpCLmlLmufqykGE+/TlOePD6qKClNW7hHDKFh/J7/7gCWGR7joEQEW1bKq3a3yUZSObOoWLFQ4ohg==", + "dev": true, + "dependencies": { + "find-up": "^4.1.0", + "read-pkg": "^5.2.0", + "type-fest": "^0.8.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/meow/node_modules/read-pkg-up/node_modules/type-fest": { + "version": "0.8.1", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.8.1.tgz", + "integrity": "sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/meow/node_modules/read-pkg/node_modules/hosted-git-info": { + "version": "2.8.9", + "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.9.tgz", + "integrity": "sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw==", + "dev": true + }, + "node_modules/meow/node_modules/read-pkg/node_modules/normalize-package-data": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.5.0.tgz", + "integrity": "sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA==", + "dev": true, + "dependencies": { + "hosted-git-info": "^2.1.4", + "resolve": "^1.10.0", + "semver": "2 || 3 || 4 || 5", + "validate-npm-package-license": "^3.0.1" + } + }, + "node_modules/meow/node_modules/read-pkg/node_modules/semver": { + "version": "5.7.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.2.tgz", + "integrity": "sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==", + "dev": true, + "bin": { + "semver": "bin/semver" + } + }, + "node_modules/meow/node_modules/read-pkg/node_modules/type-fest": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.6.0.tgz", + "integrity": "sha512-q+MB8nYR1KDLrgr4G5yemftpMC7/QLqVndBmEEdqzmNj5dcFOO4Oo8qlwZE3ULT3+Zim1F8Kq4cBnikNhlCMlg==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/meow/node_modules/semver": { + "version": "7.7.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.2.tgz", + "integrity": "sha512-RF0Fw+rO5AMf9MAyaRXI4AV0Ulj5lMHqVxxdSgiVbixSCXoEmmX/jk0CuJw4+3SqroYO9VoUh+HcuJivvtJemA==", + "dev": true, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/meow/node_modules/type-fest": { + "version": "0.18.1", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.18.1.tgz", + "integrity": "sha512-OIAYXk8+ISY+qTOwkHtKqzAuxchoMiD9Udx+FSGQDuiRR+PJKJHc2NJAXlbhkGwTt/4/nKZxELY1w3ReWOL8mw==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/meow/node_modules/yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "dev": true + }, + "node_modules/meow/node_modules/yargs-parser": { + "version": "20.2.9", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.9.tgz", + "integrity": "sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w==", + "dev": true, + "engines": { + "node": ">=10" + } + }, "node_modules/merge-stream": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==", "dev": true }, + "node_modules/merge2": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", + "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", + "dev": true, + "engines": { + "node": ">= 8" + } + }, "node_modules/micromatch": { - "version": "4.0.7", - "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.7.tgz", - "integrity": "sha512-LPP/3KorzCwBxfeUuZmaR6bG2kdeHSbe0P2tY3FLRU4vYrjYz5hI4QZwV0njUx3jeuKe67YukQ1LSPZBKDqO/Q==", + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.8.tgz", + "integrity": "sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==", "dev": true, "dependencies": { "braces": "^3.0.3", @@ -2925,6 +5004,21 @@ "node": ">=8.6" } }, + "node_modules/mime": { + "version": "4.0.7", + "resolved": "https://registry.npmjs.org/mime/-/mime-4.0.7.tgz", + "integrity": "sha512-2OfDPL+e03E0LrXaGYOtTFIYhiuzep94NSsuhrNULq+stylcJedcHdzHtz0atMUuGwJfFYs0YL5xeC/Ca2x0eQ==", + "dev": true, + "funding": [ + "https://github.com/sponsors/broofa" + ], + "bin": { + "mime": "bin/cli.js" + }, + "engines": { + "node": ">=16" + } + }, "node_modules/mimic-fn": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", @@ -2934,6 +5028,15 @@ "node": ">=6" } }, + "node_modules/min-indent": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/min-indent/-/min-indent-1.0.1.tgz", + "integrity": "sha512-I9jwMn07Sy/IwOj3zVkVik2JTvgpaykDZEigL6Rx6N9LbMywwUSMtxET+7lVoDLLd3O3IXwJwvuuns8UB/HeAg==", + "dev": true, + "engines": { + "node": ">=4" + } + }, "node_modules/minimatch": { "version": "3.1.2", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", @@ -2946,12 +5049,65 @@ "node": "*" } }, + "node_modules/minimist": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz", + "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==", + "dev": true, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/minimist-options": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/minimist-options/-/minimist-options-4.1.0.tgz", + "integrity": "sha512-Q4r8ghd80yhO/0j1O3B2BjweX3fiHg9cdOwjJd2J76Q135c+NDxGCqdYKQ1SKBuFfgWbAUzBfvYjPUEeNgqN1A==", + "dev": true, + "dependencies": { + "arrify": "^1.0.1", + "is-plain-obj": "^1.1.0", + "kind-of": "^6.0.3" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/modify-values": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/modify-values/-/modify-values-1.0.1.tgz", + "integrity": "sha512-xV2bxeN6F7oYjZWTe/YPAy6MN2M+sL4u/Rlm2AHCIVGfo2p1yGmBHQ6vHehl4bRTZBdHu3TSkWdYgkwpYzAGSw==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/natural-compare": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", "integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==", "dev": true }, + "node_modules/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==", + "dev": true + }, + "node_modules/nerf-dart": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/nerf-dart/-/nerf-dart-1.0.0.tgz", + "integrity": "sha512-EZSPZB70jiVsivaBLYDCyntd5eH8NTSMOn3rB+HxwdmKThGELLdYv8qVIMWvZEFy9w8ZZpW9h9OB32l1rGtj7g==", + "dev": true + }, + "node_modules/node-emoji": { + "version": "1.11.0", + "resolved": "https://registry.npmjs.org/node-emoji/-/node-emoji-1.11.0.tgz", + "integrity": "sha512-wo2DpQkQp7Sjm2A0cq+sN7EHKO6Sl0ctXeBdFZrL9T9+UywORbufTcTZxom8YqpLQt/FqNMUkOpkZrJVYSKD3A==", + "dev": true, + "dependencies": { + "lodash": "^4.17.21" + } + }, "node_modules/node-int64": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/node-int64/-/node-int64-0.4.0.tgz", @@ -2964,6 +5120,32 @@ "integrity": "sha512-d9VeXT4SJ7ZeOqGX6R5EM022wpL+eWPooLI+5UpWn2jCT1aosUQEhQP214x33Wkwx3JQMvIm+tIoVOdodFS40g==", "dev": true }, + "node_modules/normalize-package-data": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-6.0.2.tgz", + "integrity": "sha512-V6gygoYb/5EmNI+MEGrWkC+e6+Rr7mTmfHrxDbLzxQogBkgzo76rkok0Am6thgSF7Mv2nLOajAJj5vDJZEFn7g==", + "dev": true, + "dependencies": { + "hosted-git-info": "^7.0.0", + "semver": "^7.3.5", + "validate-npm-package-license": "^3.0.4" + }, + "engines": { + "node": "^16.14.0 || >=18.0.0" + } + }, + "node_modules/normalize-package-data/node_modules/semver": { + "version": "7.7.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.2.tgz", + "integrity": "sha512-RF0Fw+rO5AMf9MAyaRXI4AV0Ulj5lMHqVxxdSgiVbixSCXoEmmX/jk0CuJw4+3SqroYO9VoUh+HcuJivvtJemA==", + "dev": true, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/normalize-path": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", @@ -2973,6 +5155,175 @@ "node": ">=0.10.0" } }, + "node_modules/normalize-url": { + "version": "8.0.2", + "resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-8.0.2.tgz", + "integrity": "sha512-Ee/R3SyN4BuynXcnTaekmaVdbDAEiNrHqjQIA37mHU8G9pf7aaAD4ZX3XjBLo6rsdcxA/gtkcNYZLt30ACgynw==", + "dev": true, + "engines": { + "node": ">=14.16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/npm": { + "version": "9.9.4", + "resolved": "https://registry.npmjs.org/npm/-/npm-9.9.4.tgz", + "integrity": "sha512-NzcQiLpqDuLhavdyJ2J3tGJ/ni/ebcqHVFZkv1C4/6lblraUPbPgCJ4Vhb4oa3FFhRa2Yj9gA58jGH/ztKueNQ==", + "bundleDependencies": [ + "@isaacs/string-locale-compare", + "@npmcli/arborist", + "@npmcli/config", + "@npmcli/fs", + "@npmcli/map-workspaces", + "@npmcli/package-json", + "@npmcli/promise-spawn", + "@npmcli/run-script", + "abbrev", + "archy", + "cacache", + "chalk", + "ci-info", + "cli-columns", + "cli-table3", + "columnify", + "fastest-levenshtein", + "fs-minipass", + "glob", + "graceful-fs", + "hosted-git-info", + "ini", + "init-package-json", + "is-cidr", + "json-parse-even-better-errors", + "libnpmaccess", + "libnpmdiff", + "libnpmexec", + "libnpmfund", + "libnpmhook", + "libnpmorg", + "libnpmpack", + "libnpmpublish", + "libnpmsearch", + "libnpmteam", + "libnpmversion", + "make-fetch-happen", + "minimatch", + "minipass", + "minipass-pipeline", + "ms", + "node-gyp", + "nopt", + "normalize-package-data", + "npm-audit-report", + "npm-install-checks", + "npm-package-arg", + "npm-pick-manifest", + "npm-profile", + "npm-registry-fetch", + "npm-user-validate", + "npmlog", + "p-map", + "pacote", + "parse-conflict-json", + "proc-log", + "qrcode-terminal", + "read", + "semver", + "sigstore", + "spdx-expression-parse", + "ssri", + "supports-color", + "tar", + "text-table", + "tiny-relative-date", + "treeverse", + "validate-npm-package-name", + "which", + "write-file-atomic" + ], + "dev": true, + "dependencies": { + "@isaacs/string-locale-compare": "^1.1.0", + "@npmcli/arborist": "^6.5.0", + "@npmcli/config": "^6.4.0", + "@npmcli/fs": "^3.1.0", + "@npmcli/map-workspaces": "^3.0.4", + "@npmcli/package-json": "^4.0.1", + "@npmcli/promise-spawn": "^6.0.2", + "@npmcli/run-script": "^6.0.2", + "abbrev": "^2.0.0", + "archy": "~1.0.0", + "cacache": "^17.1.4", + "chalk": "^5.3.0", + "ci-info": "^4.0.0", + "cli-columns": "^4.0.0", + "cli-table3": "^0.6.3", + "columnify": "^1.6.0", + "fastest-levenshtein": "^1.0.16", + "fs-minipass": "^3.0.3", + "glob": "^10.3.10", + "graceful-fs": "^4.2.11", + "hosted-git-info": "^6.1.3", + "ini": "^4.1.1", + "init-package-json": "^5.0.0", + "is-cidr": "^4.0.2", + "json-parse-even-better-errors": "^3.0.1", + "libnpmaccess": "^7.0.2", + "libnpmdiff": "^5.0.20", + "libnpmexec": "^6.0.4", + "libnpmfund": "^4.2.1", + "libnpmhook": "^9.0.3", + "libnpmorg": "^5.0.4", + "libnpmpack": "^5.0.20", + "libnpmpublish": "^7.5.1", + "libnpmsearch": "^6.0.2", + "libnpmteam": "^5.0.3", + "libnpmversion": "^4.0.2", + "make-fetch-happen": "^11.1.1", + "minimatch": "^9.0.3", + "minipass": "^7.0.4", + "minipass-pipeline": "^1.2.4", + "ms": "^2.1.2", + "node-gyp": "^9.4.1", + "nopt": "^7.2.0", + "normalize-package-data": "^5.0.0", + "npm-audit-report": "^5.0.0", + "npm-install-checks": "^6.3.0", + "npm-package-arg": "^10.1.0", + "npm-pick-manifest": "^8.0.2", + "npm-profile": "^7.0.1", + "npm-registry-fetch": "^14.0.5", + "npm-user-validate": "^2.0.0", + "npmlog": "^7.0.1", + "p-map": "^4.0.0", + "pacote": "^15.2.0", + "parse-conflict-json": "^3.0.1", + "proc-log": "^3.0.0", + "qrcode-terminal": "^0.12.0", + "read": "^2.1.0", + "semver": "^7.6.0", + "sigstore": "^1.9.0", + "spdx-expression-parse": "^3.0.1", + "ssri": "^10.0.5", + "supports-color": "^9.4.0", + "tar": "^6.2.1", + "text-table": "~0.2.0", + "tiny-relative-date": "^1.3.0", + "treeverse": "^3.0.0", + "validate-npm-package-name": "^5.0.0", + "which": "^3.0.1", + "write-file-atomic": "^5.0.1" + }, + "bin": { + "npm": "bin/npm-cli.js", + "npx": "bin/npx-cli.js" + }, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, "node_modules/npm-run-path": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz", @@ -2985,6 +5336,3127 @@ "node": ">=8" } }, + "node_modules/npm/node_modules/@colors/colors": { + "version": "1.5.0", + "dev": true, + "inBundle": true, + "license": "MIT", + "optional": true, + "engines": { + "node": ">=0.1.90" + } + }, + "node_modules/npm/node_modules/@gar/promisify": { + "version": "1.1.3", + "dev": true, + "inBundle": true, + "license": "MIT" + }, + "node_modules/npm/node_modules/@isaacs/cliui": { + "version": "8.0.2", + "dev": true, + "inBundle": true, + "license": "ISC", + "dependencies": { + "string-width": "^5.1.2", + "string-width-cjs": "npm:string-width@^4.2.0", + "strip-ansi": "^7.0.1", + "strip-ansi-cjs": "npm:strip-ansi@^6.0.1", + "wrap-ansi": "^8.1.0", + "wrap-ansi-cjs": "npm:wrap-ansi@^7.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/npm/node_modules/@isaacs/cliui/node_modules/ansi-regex": { + "version": "6.0.1", + "dev": true, + "inBundle": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-regex?sponsor=1" + } + }, + "node_modules/npm/node_modules/@isaacs/cliui/node_modules/emoji-regex": { + "version": "9.2.2", + "dev": true, + "inBundle": true, + "license": "MIT" + }, + "node_modules/npm/node_modules/@isaacs/cliui/node_modules/string-width": { + "version": "5.1.2", + "dev": true, + "inBundle": true, + "license": "MIT", + "dependencies": { + "eastasianwidth": "^0.2.0", + "emoji-regex": "^9.2.2", + "strip-ansi": "^7.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/npm/node_modules/@isaacs/cliui/node_modules/strip-ansi": { + "version": "7.1.0", + "dev": true, + "inBundle": true, + "license": "MIT", + "dependencies": { + "ansi-regex": "^6.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/strip-ansi?sponsor=1" + } + }, + "node_modules/npm/node_modules/@isaacs/string-locale-compare": { + "version": "1.1.0", + "dev": true, + "inBundle": true, + "license": "ISC" + }, + "node_modules/npm/node_modules/@npmcli/arborist": { + "version": "6.5.1", + "dev": true, + "inBundle": true, + "license": "ISC", + "dependencies": { + "@isaacs/string-locale-compare": "^1.1.0", + "@npmcli/fs": "^3.1.0", + "@npmcli/installed-package-contents": "^2.0.2", + "@npmcli/map-workspaces": "^3.0.2", + "@npmcli/metavuln-calculator": "^5.0.0", + "@npmcli/name-from-folder": "^2.0.0", + "@npmcli/node-gyp": "^3.0.0", + "@npmcli/package-json": "^4.0.0", + "@npmcli/query": "^3.1.0", + "@npmcli/run-script": "^6.0.0", + "bin-links": "^4.0.1", + "cacache": "^17.0.4", + "common-ancestor-path": "^1.0.1", + "hosted-git-info": "^6.1.1", + "json-parse-even-better-errors": "^3.0.0", + "json-stringify-nice": "^1.1.4", + "minimatch": "^9.0.0", + "nopt": "^7.0.0", + "npm-install-checks": "^6.2.0", + "npm-package-arg": "^10.1.0", + "npm-pick-manifest": "^8.0.1", + "npm-registry-fetch": "^14.0.3", + "npmlog": "^7.0.1", + "pacote": "^15.0.8", + "parse-conflict-json": "^3.0.0", + "proc-log": "^3.0.0", + "promise-all-reject-late": "^1.0.0", + "promise-call-limit": "^1.0.2", + "read-package-json-fast": "^3.0.2", + "semver": "^7.3.7", + "ssri": "^10.0.1", + "treeverse": "^3.0.0", + "walk-up-path": "^3.0.1" + }, + "bin": { + "arborist": "bin/index.js" + }, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/npm/node_modules/@npmcli/config": { + "version": "6.4.1", + "dev": true, + "inBundle": true, + "license": "ISC", + "dependencies": { + "@npmcli/map-workspaces": "^3.0.2", + "ci-info": "^4.0.0", + "ini": "^4.1.0", + "nopt": "^7.0.0", + "proc-log": "^3.0.0", + "read-package-json-fast": "^3.0.2", + "semver": "^7.3.5", + "walk-up-path": "^3.0.1" + }, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/npm/node_modules/@npmcli/disparity-colors": { + "version": "3.0.0", + "dev": true, + "inBundle": true, + "license": "ISC", + "dependencies": { + "ansi-styles": "^4.3.0" + }, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/npm/node_modules/@npmcli/fs": { + "version": "3.1.0", + "dev": true, + "inBundle": true, + "license": "ISC", + "dependencies": { + "semver": "^7.3.5" + }, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/npm/node_modules/@npmcli/git": { + "version": "4.1.0", + "dev": true, + "inBundle": true, + "license": "ISC", + "dependencies": { + "@npmcli/promise-spawn": "^6.0.0", + "lru-cache": "^7.4.4", + "npm-pick-manifest": "^8.0.0", + "proc-log": "^3.0.0", + "promise-inflight": "^1.0.1", + "promise-retry": "^2.0.1", + "semver": "^7.3.5", + "which": "^3.0.0" + }, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/npm/node_modules/@npmcli/installed-package-contents": { + "version": "2.0.2", + "dev": true, + "inBundle": true, + "license": "ISC", + "dependencies": { + "npm-bundled": "^3.0.0", + "npm-normalize-package-bin": "^3.0.0" + }, + "bin": { + "installed-package-contents": "lib/index.js" + }, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/npm/node_modules/@npmcli/map-workspaces": { + "version": "3.0.4", + "dev": true, + "inBundle": true, + "license": "ISC", + "dependencies": { + "@npmcli/name-from-folder": "^2.0.0", + "glob": "^10.2.2", + "minimatch": "^9.0.0", + "read-package-json-fast": "^3.0.0" + }, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/npm/node_modules/@npmcli/metavuln-calculator": { + "version": "5.0.1", + "dev": true, + "inBundle": true, + "license": "ISC", + "dependencies": { + "cacache": "^17.0.0", + "json-parse-even-better-errors": "^3.0.0", + "pacote": "^15.0.0", + "semver": "^7.3.5" + }, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/npm/node_modules/@npmcli/move-file": { + "version": "2.0.1", + "dev": true, + "inBundle": true, + "license": "MIT", + "dependencies": { + "mkdirp": "^1.0.4", + "rimraf": "^3.0.2" + }, + "engines": { + "node": "^12.13.0 || ^14.15.0 || >=16.0.0" + } + }, + "node_modules/npm/node_modules/@npmcli/name-from-folder": { + "version": "2.0.0", + "dev": true, + "inBundle": true, + "license": "ISC", + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/npm/node_modules/@npmcli/node-gyp": { + "version": "3.0.0", + "dev": true, + "inBundle": true, + "license": "ISC", + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/npm/node_modules/@npmcli/package-json": { + "version": "4.0.1", + "dev": true, + "inBundle": true, + "license": "ISC", + "dependencies": { + "@npmcli/git": "^4.1.0", + "glob": "^10.2.2", + "hosted-git-info": "^6.1.1", + "json-parse-even-better-errors": "^3.0.0", + "normalize-package-data": "^5.0.0", + "proc-log": "^3.0.0", + "semver": "^7.5.3" + }, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/npm/node_modules/@npmcli/promise-spawn": { + "version": "6.0.2", + "dev": true, + "inBundle": true, + "license": "ISC", + "dependencies": { + "which": "^3.0.0" + }, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/npm/node_modules/@npmcli/query": { + "version": "3.1.0", + "dev": true, + "inBundle": true, + "license": "ISC", + "dependencies": { + "postcss-selector-parser": "^6.0.10" + }, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/npm/node_modules/@npmcli/run-script": { + "version": "6.0.2", + "dev": true, + "inBundle": true, + "license": "ISC", + "dependencies": { + "@npmcli/node-gyp": "^3.0.0", + "@npmcli/promise-spawn": "^6.0.0", + "node-gyp": "^9.0.0", + "read-package-json-fast": "^3.0.0", + "which": "^3.0.0" + }, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/npm/node_modules/@pkgjs/parseargs": { + "version": "0.11.0", + "dev": true, + "inBundle": true, + "license": "MIT", + "optional": true, + "engines": { + "node": ">=14" + } + }, + "node_modules/npm/node_modules/@sigstore/bundle": { + "version": "1.1.0", + "dev": true, + "inBundle": true, + "license": "Apache-2.0", + "dependencies": { + "@sigstore/protobuf-specs": "^0.2.0" + }, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/npm/node_modules/@sigstore/protobuf-specs": { + "version": "0.2.1", + "dev": true, + "inBundle": true, + "license": "Apache-2.0", + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/npm/node_modules/@sigstore/sign": { + "version": "1.0.0", + "dev": true, + "inBundle": true, + "license": "Apache-2.0", + "dependencies": { + "@sigstore/bundle": "^1.1.0", + "@sigstore/protobuf-specs": "^0.2.0", + "make-fetch-happen": "^11.0.1" + }, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/npm/node_modules/@sigstore/tuf": { + "version": "1.0.3", + "dev": true, + "inBundle": true, + "license": "Apache-2.0", + "dependencies": { + "@sigstore/protobuf-specs": "^0.2.0", + "tuf-js": "^1.1.7" + }, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/npm/node_modules/@tootallnate/once": { + "version": "2.0.0", + "dev": true, + "inBundle": true, + "license": "MIT", + "engines": { + "node": ">= 10" + } + }, + "node_modules/npm/node_modules/@tufjs/canonical-json": { + "version": "1.0.0", + "dev": true, + "inBundle": true, + "license": "MIT", + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/npm/node_modules/@tufjs/models": { + "version": "1.0.4", + "dev": true, + "inBundle": true, + "license": "MIT", + "dependencies": { + "@tufjs/canonical-json": "1.0.0", + "minimatch": "^9.0.0" + }, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/npm/node_modules/abbrev": { + "version": "2.0.0", + "dev": true, + "inBundle": true, + "license": "ISC", + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/npm/node_modules/agent-base": { + "version": "6.0.2", + "dev": true, + "inBundle": true, + "license": "MIT", + "dependencies": { + "debug": "4" + }, + "engines": { + "node": ">= 6.0.0" + } + }, + "node_modules/npm/node_modules/agentkeepalive": { + "version": "4.5.0", + "dev": true, + "inBundle": true, + "license": "MIT", + "dependencies": { + "humanize-ms": "^1.2.1" + }, + "engines": { + "node": ">= 8.0.0" + } + }, + "node_modules/npm/node_modules/aggregate-error": { + "version": "3.1.0", + "dev": true, + "inBundle": true, + "license": "MIT", + "dependencies": { + "clean-stack": "^2.0.0", + "indent-string": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/npm/node_modules/ansi-regex": { + "version": "5.0.1", + "dev": true, + "inBundle": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/npm/node_modules/ansi-styles": { + "version": "4.3.0", + "dev": true, + "inBundle": true, + "license": "MIT", + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/npm/node_modules/aproba": { + "version": "2.0.0", + "dev": true, + "inBundle": true, + "license": "ISC" + }, + "node_modules/npm/node_modules/archy": { + "version": "1.0.0", + "dev": true, + "inBundle": true, + "license": "MIT" + }, + "node_modules/npm/node_modules/are-we-there-yet": { + "version": "4.0.2", + "dev": true, + "inBundle": true, + "license": "ISC", + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/npm/node_modules/balanced-match": { + "version": "1.0.2", + "dev": true, + "inBundle": true, + "license": "MIT" + }, + "node_modules/npm/node_modules/bin-links": { + "version": "4.0.3", + "dev": true, + "inBundle": true, + "license": "ISC", + "dependencies": { + "cmd-shim": "^6.0.0", + "npm-normalize-package-bin": "^3.0.0", + "read-cmd-shim": "^4.0.0", + "write-file-atomic": "^5.0.0" + }, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/npm/node_modules/binary-extensions": { + "version": "2.2.0", + "dev": true, + "inBundle": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/npm/node_modules/brace-expansion": { + "version": "2.0.1", + "dev": true, + "inBundle": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/npm/node_modules/builtins": { + "version": "5.0.1", + "dev": true, + "inBundle": true, + "license": "MIT", + "dependencies": { + "semver": "^7.0.0" + } + }, + "node_modules/npm/node_modules/cacache": { + "version": "17.1.4", + "dev": true, + "inBundle": true, + "license": "ISC", + "dependencies": { + "@npmcli/fs": "^3.1.0", + "fs-minipass": "^3.0.0", + "glob": "^10.2.2", + "lru-cache": "^7.7.1", + "minipass": "^7.0.3", + "minipass-collect": "^1.0.2", + "minipass-flush": "^1.0.5", + "minipass-pipeline": "^1.2.4", + "p-map": "^4.0.0", + "ssri": "^10.0.0", + "tar": "^6.1.11", + "unique-filename": "^3.0.0" + }, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/npm/node_modules/chalk": { + "version": "5.3.0", + "dev": true, + "inBundle": true, + "license": "MIT", + "engines": { + "node": "^12.17.0 || ^14.13 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/npm/node_modules/chownr": { + "version": "2.0.0", + "dev": true, + "inBundle": true, + "license": "ISC", + "engines": { + "node": ">=10" + } + }, + "node_modules/npm/node_modules/ci-info": { + "version": "4.0.0", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/sibiraj-s" + } + ], + "inBundle": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/npm/node_modules/cidr-regex": { + "version": "3.1.1", + "dev": true, + "inBundle": true, + "license": "BSD-2-Clause", + "dependencies": { + "ip-regex": "^4.1.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/npm/node_modules/clean-stack": { + "version": "2.2.0", + "dev": true, + "inBundle": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/npm/node_modules/cli-columns": { + "version": "4.0.0", + "dev": true, + "inBundle": true, + "license": "MIT", + "dependencies": { + "string-width": "^4.2.3", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">= 10" + } + }, + "node_modules/npm/node_modules/cli-table3": { + "version": "0.6.3", + "dev": true, + "inBundle": true, + "license": "MIT", + "dependencies": { + "string-width": "^4.2.0" + }, + "engines": { + "node": "10.* || >= 12.*" + }, + "optionalDependencies": { + "@colors/colors": "1.5.0" + } + }, + "node_modules/npm/node_modules/clone": { + "version": "1.0.4", + "dev": true, + "inBundle": true, + "license": "MIT", + "engines": { + "node": ">=0.8" + } + }, + "node_modules/npm/node_modules/cmd-shim": { + "version": "6.0.2", + "dev": true, + "inBundle": true, + "license": "ISC", + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/npm/node_modules/color-convert": { + "version": "2.0.1", + "dev": true, + "inBundle": true, + "license": "MIT", + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/npm/node_modules/color-name": { + "version": "1.1.4", + "dev": true, + "inBundle": true, + "license": "MIT" + }, + "node_modules/npm/node_modules/color-support": { + "version": "1.1.3", + "dev": true, + "inBundle": true, + "license": "ISC", + "bin": { + "color-support": "bin.js" + } + }, + "node_modules/npm/node_modules/columnify": { + "version": "1.6.0", + "dev": true, + "inBundle": true, + "license": "MIT", + "dependencies": { + "strip-ansi": "^6.0.1", + "wcwidth": "^1.0.0" + }, + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/npm/node_modules/common-ancestor-path": { + "version": "1.0.1", + "dev": true, + "inBundle": true, + "license": "ISC" + }, + "node_modules/npm/node_modules/concat-map": { + "version": "0.0.1", + "dev": true, + "inBundle": true, + "license": "MIT" + }, + "node_modules/npm/node_modules/console-control-strings": { + "version": "1.1.0", + "dev": true, + "inBundle": true, + "license": "ISC" + }, + "node_modules/npm/node_modules/cross-spawn": { + "version": "7.0.6", + "dev": true, + "inBundle": true, + "license": "MIT", + "dependencies": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/npm/node_modules/cross-spawn/node_modules/which": { + "version": "2.0.2", + "dev": true, + "inBundle": true, + "license": "ISC", + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/npm/node_modules/cssesc": { + "version": "3.0.0", + "dev": true, + "inBundle": true, + "license": "MIT", + "bin": { + "cssesc": "bin/cssesc" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/npm/node_modules/debug": { + "version": "4.3.7", + "dev": true, + "inBundle": true, + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/npm/node_modules/defaults": { + "version": "1.0.4", + "dev": true, + "inBundle": true, + "license": "MIT", + "dependencies": { + "clone": "^1.0.2" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/npm/node_modules/delegates": { + "version": "1.0.0", + "dev": true, + "inBundle": true, + "license": "MIT" + }, + "node_modules/npm/node_modules/diff": { + "version": "5.2.0", + "dev": true, + "inBundle": true, + "license": "BSD-3-Clause", + "engines": { + "node": ">=0.3.1" + } + }, + "node_modules/npm/node_modules/eastasianwidth": { + "version": "0.2.0", + "dev": true, + "inBundle": true, + "license": "MIT" + }, + "node_modules/npm/node_modules/emoji-regex": { + "version": "8.0.0", + "dev": true, + "inBundle": true, + "license": "MIT" + }, + "node_modules/npm/node_modules/encoding": { + "version": "0.1.13", + "dev": true, + "inBundle": true, + "license": "MIT", + "optional": true, + "dependencies": { + "iconv-lite": "^0.6.2" + } + }, + "node_modules/npm/node_modules/env-paths": { + "version": "2.2.1", + "dev": true, + "inBundle": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/npm/node_modules/err-code": { + "version": "2.0.3", + "dev": true, + "inBundle": true, + "license": "MIT" + }, + "node_modules/npm/node_modules/exponential-backoff": { + "version": "3.1.1", + "dev": true, + "inBundle": true, + "license": "Apache-2.0" + }, + "node_modules/npm/node_modules/fastest-levenshtein": { + "version": "1.0.16", + "dev": true, + "inBundle": true, + "license": "MIT", + "engines": { + "node": ">= 4.9.1" + } + }, + "node_modules/npm/node_modules/foreground-child": { + "version": "3.1.1", + "dev": true, + "inBundle": true, + "license": "ISC", + "dependencies": { + "cross-spawn": "^7.0.0", + "signal-exit": "^4.0.1" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/npm/node_modules/fs-minipass": { + "version": "3.0.3", + "dev": true, + "inBundle": true, + "license": "ISC", + "dependencies": { + "minipass": "^7.0.3" + }, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/npm/node_modules/fs.realpath": { + "version": "1.0.0", + "dev": true, + "inBundle": true, + "license": "ISC" + }, + "node_modules/npm/node_modules/function-bind": { + "version": "1.1.2", + "dev": true, + "inBundle": true, + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/npm/node_modules/gauge": { + "version": "5.0.1", + "dev": true, + "inBundle": true, + "license": "ISC", + "dependencies": { + "aproba": "^1.0.3 || ^2.0.0", + "color-support": "^1.1.3", + "console-control-strings": "^1.1.0", + "has-unicode": "^2.0.1", + "signal-exit": "^4.0.1", + "string-width": "^4.2.3", + "strip-ansi": "^6.0.1", + "wide-align": "^1.1.5" + }, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/npm/node_modules/glob": { + "version": "10.3.10", + "dev": true, + "inBundle": true, + "license": "ISC", + "dependencies": { + "foreground-child": "^3.1.0", + "jackspeak": "^2.3.5", + "minimatch": "^9.0.1", + "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0", + "path-scurry": "^1.10.1" + }, + "bin": { + "glob": "dist/esm/bin.mjs" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/npm/node_modules/graceful-fs": { + "version": "4.2.11", + "dev": true, + "inBundle": true, + "license": "ISC" + }, + "node_modules/npm/node_modules/has-unicode": { + "version": "2.0.1", + "dev": true, + "inBundle": true, + "license": "ISC" + }, + "node_modules/npm/node_modules/hasown": { + "version": "2.0.1", + "dev": true, + "inBundle": true, + "license": "MIT", + "dependencies": { + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/npm/node_modules/hosted-git-info": { + "version": "6.1.3", + "dev": true, + "inBundle": true, + "license": "ISC", + "dependencies": { + "lru-cache": "^7.5.1" + }, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/npm/node_modules/http-cache-semantics": { + "version": "4.1.1", + "dev": true, + "inBundle": true, + "license": "BSD-2-Clause" + }, + "node_modules/npm/node_modules/http-proxy-agent": { + "version": "5.0.0", + "dev": true, + "inBundle": true, + "license": "MIT", + "dependencies": { + "@tootallnate/once": "2", + "agent-base": "6", + "debug": "4" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/npm/node_modules/https-proxy-agent": { + "version": "5.0.1", + "dev": true, + "inBundle": true, + "license": "MIT", + "dependencies": { + "agent-base": "6", + "debug": "4" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/npm/node_modules/humanize-ms": { + "version": "1.2.1", + "dev": true, + "inBundle": true, + "license": "MIT", + "dependencies": { + "ms": "^2.0.0" + } + }, + "node_modules/npm/node_modules/iconv-lite": { + "version": "0.6.3", + "dev": true, + "inBundle": true, + "license": "MIT", + "optional": true, + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/npm/node_modules/ignore-walk": { + "version": "6.0.4", + "dev": true, + "inBundle": true, + "license": "ISC", + "dependencies": { + "minimatch": "^9.0.0" + }, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/npm/node_modules/imurmurhash": { + "version": "0.1.4", + "dev": true, + "inBundle": true, + "license": "MIT", + "engines": { + "node": ">=0.8.19" + } + }, + "node_modules/npm/node_modules/indent-string": { + "version": "4.0.0", + "dev": true, + "inBundle": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/npm/node_modules/infer-owner": { + "version": "1.0.4", + "dev": true, + "inBundle": true, + "license": "ISC" + }, + "node_modules/npm/node_modules/inflight": { + "version": "1.0.6", + "dev": true, + "inBundle": true, + "license": "ISC", + "dependencies": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "node_modules/npm/node_modules/inherits": { + "version": "2.0.4", + "dev": true, + "inBundle": true, + "license": "ISC" + }, + "node_modules/npm/node_modules/ini": { + "version": "4.1.1", + "dev": true, + "inBundle": true, + "license": "ISC", + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/npm/node_modules/init-package-json": { + "version": "5.0.0", + "dev": true, + "inBundle": true, + "license": "ISC", + "dependencies": { + "npm-package-arg": "^10.0.0", + "promzard": "^1.0.0", + "read": "^2.0.0", + "read-package-json": "^6.0.0", + "semver": "^7.3.5", + "validate-npm-package-license": "^3.0.4", + "validate-npm-package-name": "^5.0.0" + }, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/npm/node_modules/ip-address": { + "version": "9.0.5", + "dev": true, + "inBundle": true, + "license": "MIT", + "dependencies": { + "jsbn": "1.1.0", + "sprintf-js": "^1.1.3" + }, + "engines": { + "node": ">= 12" + } + }, + "node_modules/npm/node_modules/ip-address/node_modules/sprintf-js": { + "version": "1.1.3", + "dev": true, + "inBundle": true, + "license": "BSD-3-Clause" + }, + "node_modules/npm/node_modules/ip-regex": { + "version": "4.3.0", + "dev": true, + "inBundle": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/npm/node_modules/is-cidr": { + "version": "4.0.2", + "dev": true, + "inBundle": true, + "license": "BSD-2-Clause", + "dependencies": { + "cidr-regex": "^3.1.1" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/npm/node_modules/is-core-module": { + "version": "2.13.1", + "dev": true, + "inBundle": true, + "license": "MIT", + "dependencies": { + "hasown": "^2.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/npm/node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "dev": true, + "inBundle": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/npm/node_modules/is-lambda": { + "version": "1.0.1", + "dev": true, + "inBundle": true, + "license": "MIT" + }, + "node_modules/npm/node_modules/isexe": { + "version": "2.0.0", + "dev": true, + "inBundle": true, + "license": "ISC" + }, + "node_modules/npm/node_modules/jackspeak": { + "version": "2.3.6", + "dev": true, + "inBundle": true, + "license": "BlueOak-1.0.0", + "dependencies": { + "@isaacs/cliui": "^8.0.2" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + }, + "optionalDependencies": { + "@pkgjs/parseargs": "^0.11.0" + } + }, + "node_modules/npm/node_modules/jsbn": { + "version": "1.1.0", + "dev": true, + "inBundle": true, + "license": "MIT" + }, + "node_modules/npm/node_modules/json-parse-even-better-errors": { + "version": "3.0.1", + "dev": true, + "inBundle": true, + "license": "MIT", + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/npm/node_modules/json-stringify-nice": { + "version": "1.1.4", + "dev": true, + "inBundle": true, + "license": "ISC", + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/npm/node_modules/jsonparse": { + "version": "1.3.1", + "dev": true, + "engines": [ + "node >= 0.2.0" + ], + "inBundle": true, + "license": "MIT" + }, + "node_modules/npm/node_modules/just-diff": { + "version": "6.0.2", + "dev": true, + "inBundle": true, + "license": "MIT" + }, + "node_modules/npm/node_modules/just-diff-apply": { + "version": "5.5.0", + "dev": true, + "inBundle": true, + "license": "MIT" + }, + "node_modules/npm/node_modules/libnpmaccess": { + "version": "7.0.3", + "dev": true, + "inBundle": true, + "license": "ISC", + "dependencies": { + "npm-package-arg": "^10.1.0", + "npm-registry-fetch": "^14.0.3" + }, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/npm/node_modules/libnpmdiff": { + "version": "5.0.21", + "dev": true, + "inBundle": true, + "license": "ISC", + "dependencies": { + "@npmcli/arborist": "^6.5.0", + "@npmcli/disparity-colors": "^3.0.0", + "@npmcli/installed-package-contents": "^2.0.2", + "binary-extensions": "^2.2.0", + "diff": "^5.1.0", + "minimatch": "^9.0.0", + "npm-package-arg": "^10.1.0", + "pacote": "^15.0.8", + "tar": "^6.1.13" + }, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/npm/node_modules/libnpmexec": { + "version": "6.0.5", + "dev": true, + "inBundle": true, + "license": "ISC", + "dependencies": { + "@npmcli/arborist": "^6.5.0", + "@npmcli/run-script": "^6.0.0", + "ci-info": "^4.0.0", + "npm-package-arg": "^10.1.0", + "npmlog": "^7.0.1", + "pacote": "^15.0.8", + "proc-log": "^3.0.0", + "read": "^2.0.0", + "read-package-json-fast": "^3.0.2", + "semver": "^7.3.7", + "walk-up-path": "^3.0.1" + }, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/npm/node_modules/libnpmfund": { + "version": "4.2.2", + "dev": true, + "inBundle": true, + "license": "ISC", + "dependencies": { + "@npmcli/arborist": "^6.5.0" + }, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/npm/node_modules/libnpmhook": { + "version": "9.0.4", + "dev": true, + "inBundle": true, + "license": "ISC", + "dependencies": { + "aproba": "^2.0.0", + "npm-registry-fetch": "^14.0.3" + }, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/npm/node_modules/libnpmorg": { + "version": "5.0.5", + "dev": true, + "inBundle": true, + "license": "ISC", + "dependencies": { + "aproba": "^2.0.0", + "npm-registry-fetch": "^14.0.3" + }, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/npm/node_modules/libnpmpack": { + "version": "5.0.21", + "dev": true, + "inBundle": true, + "license": "ISC", + "dependencies": { + "@npmcli/arborist": "^6.5.0", + "@npmcli/run-script": "^6.0.0", + "npm-package-arg": "^10.1.0", + "pacote": "^15.0.8" + }, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/npm/node_modules/libnpmpublish": { + "version": "7.5.2", + "dev": true, + "inBundle": true, + "license": "ISC", + "dependencies": { + "ci-info": "^4.0.0", + "normalize-package-data": "^5.0.0", + "npm-package-arg": "^10.1.0", + "npm-registry-fetch": "^14.0.3", + "proc-log": "^3.0.0", + "semver": "^7.3.7", + "sigstore": "^1.4.0", + "ssri": "^10.0.1" + }, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/npm/node_modules/libnpmsearch": { + "version": "6.0.3", + "dev": true, + "inBundle": true, + "license": "ISC", + "dependencies": { + "npm-registry-fetch": "^14.0.3" + }, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/npm/node_modules/libnpmteam": { + "version": "5.0.4", + "dev": true, + "inBundle": true, + "license": "ISC", + "dependencies": { + "aproba": "^2.0.0", + "npm-registry-fetch": "^14.0.3" + }, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/npm/node_modules/libnpmversion": { + "version": "4.0.3", + "dev": true, + "inBundle": true, + "license": "ISC", + "dependencies": { + "@npmcli/git": "^4.0.1", + "@npmcli/run-script": "^6.0.0", + "json-parse-even-better-errors": "^3.0.0", + "proc-log": "^3.0.0", + "semver": "^7.3.7" + }, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/npm/node_modules/lru-cache": { + "version": "7.18.3", + "dev": true, + "inBundle": true, + "license": "ISC", + "engines": { + "node": ">=12" + } + }, + "node_modules/npm/node_modules/make-fetch-happen": { + "version": "11.1.1", + "dev": true, + "inBundle": true, + "license": "ISC", + "dependencies": { + "agentkeepalive": "^4.2.1", + "cacache": "^17.0.0", + "http-cache-semantics": "^4.1.1", + "http-proxy-agent": "^5.0.0", + "https-proxy-agent": "^5.0.0", + "is-lambda": "^1.0.1", + "lru-cache": "^7.7.1", + "minipass": "^5.0.0", + "minipass-fetch": "^3.0.0", + "minipass-flush": "^1.0.5", + "minipass-pipeline": "^1.2.4", + "negotiator": "^0.6.3", + "promise-retry": "^2.0.1", + "socks-proxy-agent": "^7.0.0", + "ssri": "^10.0.0" + }, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/npm/node_modules/make-fetch-happen/node_modules/minipass": { + "version": "5.0.0", + "dev": true, + "inBundle": true, + "license": "ISC", + "engines": { + "node": ">=8" + } + }, + "node_modules/npm/node_modules/minimatch": { + "version": "9.0.3", + "dev": true, + "inBundle": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/npm/node_modules/minipass": { + "version": "7.0.4", + "dev": true, + "inBundle": true, + "license": "ISC", + "engines": { + "node": ">=16 || 14 >=14.17" + } + }, + "node_modules/npm/node_modules/minipass-collect": { + "version": "1.0.2", + "dev": true, + "inBundle": true, + "license": "ISC", + "dependencies": { + "minipass": "^3.0.0" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/npm/node_modules/minipass-collect/node_modules/minipass": { + "version": "3.3.6", + "dev": true, + "inBundle": true, + "license": "ISC", + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/npm/node_modules/minipass-fetch": { + "version": "3.0.4", + "dev": true, + "inBundle": true, + "license": "MIT", + "dependencies": { + "minipass": "^7.0.3", + "minipass-sized": "^1.0.3", + "minizlib": "^2.1.2" + }, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + }, + "optionalDependencies": { + "encoding": "^0.1.13" + } + }, + "node_modules/npm/node_modules/minipass-flush": { + "version": "1.0.5", + "dev": true, + "inBundle": true, + "license": "ISC", + "dependencies": { + "minipass": "^3.0.0" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/npm/node_modules/minipass-flush/node_modules/minipass": { + "version": "3.3.6", + "dev": true, + "inBundle": true, + "license": "ISC", + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/npm/node_modules/minipass-json-stream": { + "version": "1.0.1", + "dev": true, + "inBundle": true, + "license": "MIT", + "dependencies": { + "jsonparse": "^1.3.1", + "minipass": "^3.0.0" + } + }, + "node_modules/npm/node_modules/minipass-json-stream/node_modules/minipass": { + "version": "3.3.6", + "dev": true, + "inBundle": true, + "license": "ISC", + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/npm/node_modules/minipass-pipeline": { + "version": "1.2.4", + "dev": true, + "inBundle": true, + "license": "ISC", + "dependencies": { + "minipass": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/npm/node_modules/minipass-pipeline/node_modules/minipass": { + "version": "3.3.6", + "dev": true, + "inBundle": true, + "license": "ISC", + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/npm/node_modules/minipass-sized": { + "version": "1.0.3", + "dev": true, + "inBundle": true, + "license": "ISC", + "dependencies": { + "minipass": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/npm/node_modules/minipass-sized/node_modules/minipass": { + "version": "3.3.6", + "dev": true, + "inBundle": true, + "license": "ISC", + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/npm/node_modules/minizlib": { + "version": "2.1.2", + "dev": true, + "inBundle": true, + "license": "MIT", + "dependencies": { + "minipass": "^3.0.0", + "yallist": "^4.0.0" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/npm/node_modules/minizlib/node_modules/minipass": { + "version": "3.3.6", + "dev": true, + "inBundle": true, + "license": "ISC", + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/npm/node_modules/mkdirp": { + "version": "1.0.4", + "dev": true, + "inBundle": true, + "license": "MIT", + "bin": { + "mkdirp": "bin/cmd.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/npm/node_modules/ms": { + "version": "2.1.3", + "dev": true, + "inBundle": true, + "license": "MIT" + }, + "node_modules/npm/node_modules/mute-stream": { + "version": "1.0.0", + "dev": true, + "inBundle": true, + "license": "ISC", + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/npm/node_modules/negotiator": { + "version": "0.6.3", + "dev": true, + "inBundle": true, + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/npm/node_modules/node-gyp": { + "version": "9.4.1", + "dev": true, + "inBundle": true, + "license": "MIT", + "dependencies": { + "env-paths": "^2.2.0", + "exponential-backoff": "^3.1.1", + "glob": "^7.1.4", + "graceful-fs": "^4.2.6", + "make-fetch-happen": "^10.0.3", + "nopt": "^6.0.0", + "npmlog": "^6.0.0", + "rimraf": "^3.0.2", + "semver": "^7.3.5", + "tar": "^6.1.2", + "which": "^2.0.2" + }, + "bin": { + "node-gyp": "bin/node-gyp.js" + }, + "engines": { + "node": "^12.13 || ^14.13 || >=16" + } + }, + "node_modules/npm/node_modules/node-gyp/node_modules/@npmcli/fs": { + "version": "2.1.2", + "dev": true, + "inBundle": true, + "license": "ISC", + "dependencies": { + "@gar/promisify": "^1.1.3", + "semver": "^7.3.5" + }, + "engines": { + "node": "^12.13.0 || ^14.15.0 || >=16.0.0" + } + }, + "node_modules/npm/node_modules/node-gyp/node_modules/abbrev": { + "version": "1.1.1", + "dev": true, + "inBundle": true, + "license": "ISC" + }, + "node_modules/npm/node_modules/node-gyp/node_modules/are-we-there-yet": { + "version": "3.0.1", + "dev": true, + "inBundle": true, + "license": "ISC", + "dependencies": { + "delegates": "^1.0.0", + "readable-stream": "^3.6.0" + }, + "engines": { + "node": "^12.13.0 || ^14.15.0 || >=16.0.0" + } + }, + "node_modules/npm/node_modules/node-gyp/node_modules/brace-expansion": { + "version": "1.1.11", + "dev": true, + "inBundle": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/npm/node_modules/node-gyp/node_modules/cacache": { + "version": "16.1.3", + "dev": true, + "inBundle": true, + "license": "ISC", + "dependencies": { + "@npmcli/fs": "^2.1.0", + "@npmcli/move-file": "^2.0.0", + "chownr": "^2.0.0", + "fs-minipass": "^2.1.0", + "glob": "^8.0.1", + "infer-owner": "^1.0.4", + "lru-cache": "^7.7.1", + "minipass": "^3.1.6", + "minipass-collect": "^1.0.2", + "minipass-flush": "^1.0.5", + "minipass-pipeline": "^1.2.4", + "mkdirp": "^1.0.4", + "p-map": "^4.0.0", + "promise-inflight": "^1.0.1", + "rimraf": "^3.0.2", + "ssri": "^9.0.0", + "tar": "^6.1.11", + "unique-filename": "^2.0.0" + }, + "engines": { + "node": "^12.13.0 || ^14.15.0 || >=16.0.0" + } + }, + "node_modules/npm/node_modules/node-gyp/node_modules/cacache/node_modules/brace-expansion": { + "version": "2.0.1", + "dev": true, + "inBundle": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/npm/node_modules/node-gyp/node_modules/cacache/node_modules/glob": { + "version": "8.1.0", + "dev": true, + "inBundle": true, + "license": "ISC", + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^5.0.1", + "once": "^1.3.0" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/npm/node_modules/node-gyp/node_modules/cacache/node_modules/minimatch": { + "version": "5.1.6", + "dev": true, + "inBundle": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/npm/node_modules/node-gyp/node_modules/fs-minipass": { + "version": "2.1.0", + "dev": true, + "inBundle": true, + "license": "ISC", + "dependencies": { + "minipass": "^3.0.0" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/npm/node_modules/node-gyp/node_modules/gauge": { + "version": "4.0.4", + "dev": true, + "inBundle": true, + "license": "ISC", + "dependencies": { + "aproba": "^1.0.3 || ^2.0.0", + "color-support": "^1.1.3", + "console-control-strings": "^1.1.0", + "has-unicode": "^2.0.1", + "signal-exit": "^3.0.7", + "string-width": "^4.2.3", + "strip-ansi": "^6.0.1", + "wide-align": "^1.1.5" + }, + "engines": { + "node": "^12.13.0 || ^14.15.0 || >=16.0.0" + } + }, + "node_modules/npm/node_modules/node-gyp/node_modules/glob": { + "version": "7.2.3", + "dev": true, + "inBundle": true, + "license": "ISC", + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.1.1", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/npm/node_modules/node-gyp/node_modules/make-fetch-happen": { + "version": "10.2.1", + "dev": true, + "inBundle": true, + "license": "ISC", + "dependencies": { + "agentkeepalive": "^4.2.1", + "cacache": "^16.1.0", + "http-cache-semantics": "^4.1.0", + "http-proxy-agent": "^5.0.0", + "https-proxy-agent": "^5.0.0", + "is-lambda": "^1.0.1", + "lru-cache": "^7.7.1", + "minipass": "^3.1.6", + "minipass-collect": "^1.0.2", + "minipass-fetch": "^2.0.3", + "minipass-flush": "^1.0.5", + "minipass-pipeline": "^1.2.4", + "negotiator": "^0.6.3", + "promise-retry": "^2.0.1", + "socks-proxy-agent": "^7.0.0", + "ssri": "^9.0.0" + }, + "engines": { + "node": "^12.13.0 || ^14.15.0 || >=16.0.0" + } + }, + "node_modules/npm/node_modules/node-gyp/node_modules/minimatch": { + "version": "3.1.2", + "dev": true, + "inBundle": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/npm/node_modules/node-gyp/node_modules/minipass": { + "version": "3.3.6", + "dev": true, + "inBundle": true, + "license": "ISC", + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/npm/node_modules/node-gyp/node_modules/minipass-fetch": { + "version": "2.1.2", + "dev": true, + "inBundle": true, + "license": "MIT", + "dependencies": { + "minipass": "^3.1.6", + "minipass-sized": "^1.0.3", + "minizlib": "^2.1.2" + }, + "engines": { + "node": "^12.13.0 || ^14.15.0 || >=16.0.0" + }, + "optionalDependencies": { + "encoding": "^0.1.13" + } + }, + "node_modules/npm/node_modules/node-gyp/node_modules/nopt": { + "version": "6.0.0", + "dev": true, + "inBundle": true, + "license": "ISC", + "dependencies": { + "abbrev": "^1.0.0" + }, + "bin": { + "nopt": "bin/nopt.js" + }, + "engines": { + "node": "^12.13.0 || ^14.15.0 || >=16.0.0" + } + }, + "node_modules/npm/node_modules/node-gyp/node_modules/npmlog": { + "version": "6.0.2", + "dev": true, + "inBundle": true, + "license": "ISC", + "dependencies": { + "are-we-there-yet": "^3.0.0", + "console-control-strings": "^1.1.0", + "gauge": "^4.0.3", + "set-blocking": "^2.0.0" + }, + "engines": { + "node": "^12.13.0 || ^14.15.0 || >=16.0.0" + } + }, + "node_modules/npm/node_modules/node-gyp/node_modules/signal-exit": { + "version": "3.0.7", + "dev": true, + "inBundle": true, + "license": "ISC" + }, + "node_modules/npm/node_modules/node-gyp/node_modules/ssri": { + "version": "9.0.1", + "dev": true, + "inBundle": true, + "license": "ISC", + "dependencies": { + "minipass": "^3.1.1" + }, + "engines": { + "node": "^12.13.0 || ^14.15.0 || >=16.0.0" + } + }, + "node_modules/npm/node_modules/node-gyp/node_modules/unique-filename": { + "version": "2.0.1", + "dev": true, + "inBundle": true, + "license": "ISC", + "dependencies": { + "unique-slug": "^3.0.0" + }, + "engines": { + "node": "^12.13.0 || ^14.15.0 || >=16.0.0" + } + }, + "node_modules/npm/node_modules/node-gyp/node_modules/unique-slug": { + "version": "3.0.0", + "dev": true, + "inBundle": true, + "license": "ISC", + "dependencies": { + "imurmurhash": "^0.1.4" + }, + "engines": { + "node": "^12.13.0 || ^14.15.0 || >=16.0.0" + } + }, + "node_modules/npm/node_modules/node-gyp/node_modules/which": { + "version": "2.0.2", + "dev": true, + "inBundle": true, + "license": "ISC", + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/npm/node_modules/nopt": { + "version": "7.2.0", + "dev": true, + "inBundle": true, + "license": "ISC", + "dependencies": { + "abbrev": "^2.0.0" + }, + "bin": { + "nopt": "bin/nopt.js" + }, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/npm/node_modules/normalize-package-data": { + "version": "5.0.0", + "dev": true, + "inBundle": true, + "license": "BSD-2-Clause", + "dependencies": { + "hosted-git-info": "^6.0.0", + "is-core-module": "^2.8.1", + "semver": "^7.3.5", + "validate-npm-package-license": "^3.0.4" + }, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/npm/node_modules/npm-audit-report": { + "version": "5.0.0", + "dev": true, + "inBundle": true, + "license": "ISC", + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/npm/node_modules/npm-bundled": { + "version": "3.0.0", + "dev": true, + "inBundle": true, + "license": "ISC", + "dependencies": { + "npm-normalize-package-bin": "^3.0.0" + }, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/npm/node_modules/npm-install-checks": { + "version": "6.3.0", + "dev": true, + "inBundle": true, + "license": "BSD-2-Clause", + "dependencies": { + "semver": "^7.1.1" + }, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/npm/node_modules/npm-normalize-package-bin": { + "version": "3.0.1", + "dev": true, + "inBundle": true, + "license": "ISC", + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/npm/node_modules/npm-package-arg": { + "version": "10.1.0", + "dev": true, + "inBundle": true, + "license": "ISC", + "dependencies": { + "hosted-git-info": "^6.0.0", + "proc-log": "^3.0.0", + "semver": "^7.3.5", + "validate-npm-package-name": "^5.0.0" + }, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/npm/node_modules/npm-packlist": { + "version": "7.0.4", + "dev": true, + "inBundle": true, + "license": "ISC", + "dependencies": { + "ignore-walk": "^6.0.0" + }, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/npm/node_modules/npm-pick-manifest": { + "version": "8.0.2", + "dev": true, + "inBundle": true, + "license": "ISC", + "dependencies": { + "npm-install-checks": "^6.0.0", + "npm-normalize-package-bin": "^3.0.0", + "npm-package-arg": "^10.0.0", + "semver": "^7.3.5" + }, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/npm/node_modules/npm-profile": { + "version": "7.0.1", + "dev": true, + "inBundle": true, + "license": "ISC", + "dependencies": { + "npm-registry-fetch": "^14.0.0", + "proc-log": "^3.0.0" + }, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/npm/node_modules/npm-registry-fetch": { + "version": "14.0.5", + "dev": true, + "inBundle": true, + "license": "ISC", + "dependencies": { + "make-fetch-happen": "^11.0.0", + "minipass": "^5.0.0", + "minipass-fetch": "^3.0.0", + "minipass-json-stream": "^1.0.1", + "minizlib": "^2.1.2", + "npm-package-arg": "^10.0.0", + "proc-log": "^3.0.0" + }, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/npm/node_modules/npm-registry-fetch/node_modules/minipass": { + "version": "5.0.0", + "dev": true, + "inBundle": true, + "license": "ISC", + "engines": { + "node": ">=8" + } + }, + "node_modules/npm/node_modules/npm-user-validate": { + "version": "2.0.0", + "dev": true, + "inBundle": true, + "license": "BSD-2-Clause", + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/npm/node_modules/npmlog": { + "version": "7.0.1", + "dev": true, + "inBundle": true, + "license": "ISC", + "dependencies": { + "are-we-there-yet": "^4.0.0", + "console-control-strings": "^1.1.0", + "gauge": "^5.0.0", + "set-blocking": "^2.0.0" + }, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/npm/node_modules/once": { + "version": "1.4.0", + "dev": true, + "inBundle": true, + "license": "ISC", + "dependencies": { + "wrappy": "1" + } + }, + "node_modules/npm/node_modules/p-map": { + "version": "4.0.0", + "dev": true, + "inBundle": true, + "license": "MIT", + "dependencies": { + "aggregate-error": "^3.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/npm/node_modules/pacote": { + "version": "15.2.0", + "dev": true, + "inBundle": true, + "license": "ISC", + "dependencies": { + "@npmcli/git": "^4.0.0", + "@npmcli/installed-package-contents": "^2.0.1", + "@npmcli/promise-spawn": "^6.0.1", + "@npmcli/run-script": "^6.0.0", + "cacache": "^17.0.0", + "fs-minipass": "^3.0.0", + "minipass": "^5.0.0", + "npm-package-arg": "^10.0.0", + "npm-packlist": "^7.0.0", + "npm-pick-manifest": "^8.0.0", + "npm-registry-fetch": "^14.0.0", + "proc-log": "^3.0.0", + "promise-retry": "^2.0.1", + "read-package-json": "^6.0.0", + "read-package-json-fast": "^3.0.0", + "sigstore": "^1.3.0", + "ssri": "^10.0.0", + "tar": "^6.1.11" + }, + "bin": { + "pacote": "lib/bin.js" + }, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/npm/node_modules/pacote/node_modules/minipass": { + "version": "5.0.0", + "dev": true, + "inBundle": true, + "license": "ISC", + "engines": { + "node": ">=8" + } + }, + "node_modules/npm/node_modules/parse-conflict-json": { + "version": "3.0.1", + "dev": true, + "inBundle": true, + "license": "ISC", + "dependencies": { + "json-parse-even-better-errors": "^3.0.0", + "just-diff": "^6.0.0", + "just-diff-apply": "^5.2.0" + }, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/npm/node_modules/path-is-absolute": { + "version": "1.0.1", + "dev": true, + "inBundle": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/npm/node_modules/path-key": { + "version": "3.1.1", + "dev": true, + "inBundle": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/npm/node_modules/path-scurry": { + "version": "1.10.1", + "dev": true, + "inBundle": true, + "license": "BlueOak-1.0.0", + "dependencies": { + "lru-cache": "^9.1.1 || ^10.0.0", + "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/npm/node_modules/path-scurry/node_modules/lru-cache": { + "version": "10.2.0", + "dev": true, + "inBundle": true, + "license": "ISC", + "engines": { + "node": "14 || >=16.14" + } + }, + "node_modules/npm/node_modules/postcss-selector-parser": { + "version": "6.0.15", + "dev": true, + "inBundle": true, + "license": "MIT", + "dependencies": { + "cssesc": "^3.0.0", + "util-deprecate": "^1.0.2" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/npm/node_modules/proc-log": { + "version": "3.0.0", + "dev": true, + "inBundle": true, + "license": "ISC", + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/npm/node_modules/promise-all-reject-late": { + "version": "1.0.1", + "dev": true, + "inBundle": true, + "license": "ISC", + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/npm/node_modules/promise-call-limit": { + "version": "1.0.2", + "dev": true, + "inBundle": true, + "license": "ISC", + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/npm/node_modules/promise-inflight": { + "version": "1.0.1", + "dev": true, + "inBundle": true, + "license": "ISC" + }, + "node_modules/npm/node_modules/promise-retry": { + "version": "2.0.1", + "dev": true, + "inBundle": true, + "license": "MIT", + "dependencies": { + "err-code": "^2.0.2", + "retry": "^0.12.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/npm/node_modules/promzard": { + "version": "1.0.0", + "dev": true, + "inBundle": true, + "license": "ISC", + "dependencies": { + "read": "^2.0.0" + }, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/npm/node_modules/qrcode-terminal": { + "version": "0.12.0", + "dev": true, + "inBundle": true, + "bin": { + "qrcode-terminal": "bin/qrcode-terminal.js" + } + }, + "node_modules/npm/node_modules/read": { + "version": "2.1.0", + "dev": true, + "inBundle": true, + "license": "ISC", + "dependencies": { + "mute-stream": "~1.0.0" + }, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/npm/node_modules/read-cmd-shim": { + "version": "4.0.0", + "dev": true, + "inBundle": true, + "license": "ISC", + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/npm/node_modules/read-package-json": { + "version": "6.0.4", + "dev": true, + "inBundle": true, + "license": "ISC", + "dependencies": { + "glob": "^10.2.2", + "json-parse-even-better-errors": "^3.0.0", + "normalize-package-data": "^5.0.0", + "npm-normalize-package-bin": "^3.0.0" + }, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/npm/node_modules/read-package-json-fast": { + "version": "3.0.2", + "dev": true, + "inBundle": true, + "license": "ISC", + "dependencies": { + "json-parse-even-better-errors": "^3.0.0", + "npm-normalize-package-bin": "^3.0.0" + }, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/npm/node_modules/readable-stream": { + "version": "3.6.2", + "dev": true, + "inBundle": true, + "license": "MIT", + "dependencies": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/npm/node_modules/retry": { + "version": "0.12.0", + "dev": true, + "inBundle": true, + "license": "MIT", + "engines": { + "node": ">= 4" + } + }, + "node_modules/npm/node_modules/rimraf": { + "version": "3.0.2", + "dev": true, + "inBundle": true, + "license": "ISC", + "dependencies": { + "glob": "^7.1.3" + }, + "bin": { + "rimraf": "bin.js" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/npm/node_modules/rimraf/node_modules/brace-expansion": { + "version": "1.1.11", + "dev": true, + "inBundle": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/npm/node_modules/rimraf/node_modules/glob": { + "version": "7.2.3", + "dev": true, + "inBundle": true, + "license": "ISC", + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.1.1", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/npm/node_modules/rimraf/node_modules/minimatch": { + "version": "3.1.2", + "dev": true, + "inBundle": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/npm/node_modules/safe-buffer": { + "version": "5.2.1", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "inBundle": true, + "license": "MIT" + }, + "node_modules/npm/node_modules/safer-buffer": { + "version": "2.1.2", + "dev": true, + "inBundle": true, + "license": "MIT", + "optional": true + }, + "node_modules/npm/node_modules/semver": { + "version": "7.6.0", + "dev": true, + "inBundle": true, + "license": "ISC", + "dependencies": { + "lru-cache": "^6.0.0" + }, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/npm/node_modules/semver/node_modules/lru-cache": { + "version": "6.0.0", + "dev": true, + "inBundle": true, + "license": "ISC", + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/npm/node_modules/set-blocking": { + "version": "2.0.0", + "dev": true, + "inBundle": true, + "license": "ISC" + }, + "node_modules/npm/node_modules/shebang-command": { + "version": "2.0.0", + "dev": true, + "inBundle": true, + "license": "MIT", + "dependencies": { + "shebang-regex": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/npm/node_modules/shebang-regex": { + "version": "3.0.0", + "dev": true, + "inBundle": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/npm/node_modules/signal-exit": { + "version": "4.1.0", + "dev": true, + "inBundle": true, + "license": "ISC", + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/npm/node_modules/sigstore": { + "version": "1.9.0", + "dev": true, + "inBundle": true, + "license": "Apache-2.0", + "dependencies": { + "@sigstore/bundle": "^1.1.0", + "@sigstore/protobuf-specs": "^0.2.0", + "@sigstore/sign": "^1.0.0", + "@sigstore/tuf": "^1.0.3", + "make-fetch-happen": "^11.0.1" + }, + "bin": { + "sigstore": "bin/sigstore.js" + }, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/npm/node_modules/smart-buffer": { + "version": "4.2.0", + "dev": true, + "inBundle": true, + "license": "MIT", + "engines": { + "node": ">= 6.0.0", + "npm": ">= 3.0.0" + } + }, + "node_modules/npm/node_modules/socks": { + "version": "2.8.1", + "dev": true, + "inBundle": true, + "license": "MIT", + "dependencies": { + "ip-address": "^9.0.5", + "smart-buffer": "^4.2.0" + }, + "engines": { + "node": ">= 10.0.0", + "npm": ">= 3.0.0" + } + }, + "node_modules/npm/node_modules/socks-proxy-agent": { + "version": "7.0.0", + "dev": true, + "inBundle": true, + "license": "MIT", + "dependencies": { + "agent-base": "^6.0.2", + "debug": "^4.3.3", + "socks": "^2.6.2" + }, + "engines": { + "node": ">= 10" + } + }, + "node_modules/npm/node_modules/spdx-correct": { + "version": "3.2.0", + "dev": true, + "inBundle": true, + "license": "Apache-2.0", + "dependencies": { + "spdx-expression-parse": "^3.0.0", + "spdx-license-ids": "^3.0.0" + } + }, + "node_modules/npm/node_modules/spdx-exceptions": { + "version": "2.5.0", + "dev": true, + "inBundle": true, + "license": "CC-BY-3.0" + }, + "node_modules/npm/node_modules/spdx-expression-parse": { + "version": "3.0.1", + "dev": true, + "inBundle": true, + "license": "MIT", + "dependencies": { + "spdx-exceptions": "^2.1.0", + "spdx-license-ids": "^3.0.0" + } + }, + "node_modules/npm/node_modules/spdx-license-ids": { + "version": "3.0.17", + "dev": true, + "inBundle": true, + "license": "CC0-1.0" + }, + "node_modules/npm/node_modules/ssri": { + "version": "10.0.5", + "dev": true, + "inBundle": true, + "license": "ISC", + "dependencies": { + "minipass": "^7.0.3" + }, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/npm/node_modules/string_decoder": { + "version": "1.3.0", + "dev": true, + "inBundle": true, + "license": "MIT", + "dependencies": { + "safe-buffer": "~5.2.0" + } + }, + "node_modules/npm/node_modules/string-width": { + "version": "4.2.3", + "dev": true, + "inBundle": true, + "license": "MIT", + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/npm/node_modules/string-width-cjs": { + "name": "string-width", + "version": "4.2.3", + "dev": true, + "inBundle": true, + "license": "MIT", + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/npm/node_modules/strip-ansi": { + "version": "6.0.1", + "dev": true, + "inBundle": true, + "license": "MIT", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/npm/node_modules/strip-ansi-cjs": { + "name": "strip-ansi", + "version": "6.0.1", + "dev": true, + "inBundle": true, + "license": "MIT", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/npm/node_modules/supports-color": { + "version": "9.4.0", + "dev": true, + "inBundle": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/supports-color?sponsor=1" + } + }, + "node_modules/npm/node_modules/tar": { + "version": "6.2.1", + "dev": true, + "inBundle": true, + "license": "ISC", + "dependencies": { + "chownr": "^2.0.0", + "fs-minipass": "^2.0.0", + "minipass": "^5.0.0", + "minizlib": "^2.1.1", + "mkdirp": "^1.0.3", + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/npm/node_modules/tar/node_modules/fs-minipass": { + "version": "2.1.0", + "dev": true, + "inBundle": true, + "license": "ISC", + "dependencies": { + "minipass": "^3.0.0" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/npm/node_modules/tar/node_modules/fs-minipass/node_modules/minipass": { + "version": "3.3.6", + "dev": true, + "inBundle": true, + "license": "ISC", + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/npm/node_modules/tar/node_modules/minipass": { + "version": "5.0.0", + "dev": true, + "inBundle": true, + "license": "ISC", + "engines": { + "node": ">=8" + } + }, + "node_modules/npm/node_modules/text-table": { + "version": "0.2.0", + "dev": true, + "inBundle": true, + "license": "MIT" + }, + "node_modules/npm/node_modules/tiny-relative-date": { + "version": "1.3.0", + "dev": true, + "inBundle": true, + "license": "MIT" + }, + "node_modules/npm/node_modules/treeverse": { + "version": "3.0.0", + "dev": true, + "inBundle": true, + "license": "ISC", + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/npm/node_modules/tuf-js": { + "version": "1.1.7", + "dev": true, + "inBundle": true, + "license": "MIT", + "dependencies": { + "@tufjs/models": "1.0.4", + "debug": "^4.3.4", + "make-fetch-happen": "^11.1.1" + }, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/npm/node_modules/unique-filename": { + "version": "3.0.0", + "dev": true, + "inBundle": true, + "license": "ISC", + "dependencies": { + "unique-slug": "^4.0.0" + }, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/npm/node_modules/unique-slug": { + "version": "4.0.0", + "dev": true, + "inBundle": true, + "license": "ISC", + "dependencies": { + "imurmurhash": "^0.1.4" + }, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/npm/node_modules/util-deprecate": { + "version": "1.0.2", + "dev": true, + "inBundle": true, + "license": "MIT" + }, + "node_modules/npm/node_modules/validate-npm-package-license": { + "version": "3.0.4", + "dev": true, + "inBundle": true, + "license": "Apache-2.0", + "dependencies": { + "spdx-correct": "^3.0.0", + "spdx-expression-parse": "^3.0.0" + } + }, + "node_modules/npm/node_modules/validate-npm-package-name": { + "version": "5.0.0", + "dev": true, + "inBundle": true, + "license": "ISC", + "dependencies": { + "builtins": "^5.0.0" + }, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/npm/node_modules/walk-up-path": { + "version": "3.0.1", + "dev": true, + "inBundle": true, + "license": "ISC" + }, + "node_modules/npm/node_modules/wcwidth": { + "version": "1.0.1", + "dev": true, + "inBundle": true, + "license": "MIT", + "dependencies": { + "defaults": "^1.0.3" + } + }, + "node_modules/npm/node_modules/which": { + "version": "3.0.1", + "dev": true, + "inBundle": true, + "license": "ISC", + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/which.js" + }, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/npm/node_modules/wide-align": { + "version": "1.1.5", + "dev": true, + "inBundle": true, + "license": "ISC", + "dependencies": { + "string-width": "^1.0.2 || 2 || 3 || 4" + } + }, + "node_modules/npm/node_modules/wrap-ansi": { + "version": "8.1.0", + "dev": true, + "inBundle": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^6.1.0", + "string-width": "^5.0.1", + "strip-ansi": "^7.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, + "node_modules/npm/node_modules/wrap-ansi-cjs": { + "name": "wrap-ansi", + "version": "7.0.0", + "dev": true, + "inBundle": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, + "node_modules/npm/node_modules/wrap-ansi/node_modules/ansi-regex": { + "version": "6.0.1", + "dev": true, + "inBundle": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-regex?sponsor=1" + } + }, + "node_modules/npm/node_modules/wrap-ansi/node_modules/ansi-styles": { + "version": "6.2.1", + "dev": true, + "inBundle": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/npm/node_modules/wrap-ansi/node_modules/emoji-regex": { + "version": "9.2.2", + "dev": true, + "inBundle": true, + "license": "MIT" + }, + "node_modules/npm/node_modules/wrap-ansi/node_modules/string-width": { + "version": "5.1.2", + "dev": true, + "inBundle": true, + "license": "MIT", + "dependencies": { + "eastasianwidth": "^0.2.0", + "emoji-regex": "^9.2.2", + "strip-ansi": "^7.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/npm/node_modules/wrap-ansi/node_modules/strip-ansi": { + "version": "7.1.0", + "dev": true, + "inBundle": true, + "license": "MIT", + "dependencies": { + "ansi-regex": "^6.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/strip-ansi?sponsor=1" + } + }, + "node_modules/npm/node_modules/wrappy": { + "version": "1.0.2", + "dev": true, + "inBundle": true, + "license": "ISC" + }, + "node_modules/npm/node_modules/write-file-atomic": { + "version": "5.0.1", + "dev": true, + "inBundle": true, + "license": "ISC", + "dependencies": { + "imurmurhash": "^0.1.4", + "signal-exit": "^4.0.1" + }, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/npm/node_modules/yallist": { + "version": "4.0.0", + "dev": true, + "inBundle": true, + "license": "ISC" + }, "node_modules/once": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", @@ -3009,6 +8481,42 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/p-each-series": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/p-each-series/-/p-each-series-3.0.0.tgz", + "integrity": "sha512-lastgtAdoH9YaLyDa5i5z64q+kzOcQHsQ5SsZJD3q0VEyI8mq872S3geuNbRUQLVAE9siMfgKrpj7MloKFHruw==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-filter": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/p-filter/-/p-filter-4.1.0.tgz", + "integrity": "sha512-37/tPdZ3oJwHaS3gNJdenCDB3Tz26i9sjhnguBtvN0vYlRIiDNnvTWkuh+0hETV9rLPdJ3rlL3yVOYPIAnM8rw==", + "dev": true, + "dependencies": { + "p-map": "^7.0.1" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-is-promise": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/p-is-promise/-/p-is-promise-3.0.0.tgz", + "integrity": "sha512-Wo8VsW4IRQSKVXsJCn7TomUaVtyfjVDn3nUP7kE967BQk0CwFpdbZs0X0uk5sW9mkBa9eNM7hCMaG93WUAwxYQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, "node_modules/p-limit": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", @@ -3051,6 +8559,27 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/p-map": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/p-map/-/p-map-7.0.3.tgz", + "integrity": "sha512-VkndIv2fIB99swvQoA65bm+fsmt6UNdGeIB0oxBs+WhAhdh08QA04JXpI7rbB9r08/nkbysKoya9rtDERYOYMA==", + "dev": true, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-reduce": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/p-reduce/-/p-reduce-2.1.0.tgz", + "integrity": "sha512-2USApvnsutq8uoxZBGbbWM0JIYLiEMJ9RlaN7fAzVNb9OZN0SHjjTTfIcb667XynS5Y1VhwDJVDa72TnPzAYWw==", + "dev": true, + "engines": { + "node": ">=8" + } + }, "node_modules/p-try": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", @@ -3060,6 +8589,18 @@ "node": ">=6" } }, + "node_modules/parent-module": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", + "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", + "dev": true, + "dependencies": { + "callsites": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, "node_modules/parse-json": { "version": "5.2.0", "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-5.2.0.tgz", @@ -3111,6 +8652,15 @@ "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", "dev": true }, + "node_modules/path-type": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", + "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", + "dev": true, + "engines": { + "node": ">=8" + } + }, "node_modules/picocolors": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.1.tgz", @@ -3129,6 +8679,15 @@ "url": "https://github.com/sponsors/jonschlinkert" } }, + "node_modules/pify": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", + "integrity": "sha512-C3FsVNH1udSEX48gGX1xfvwTWfsYWj5U+8/uK15BGzIGrKoUpghX8hWZwa/OFnakBiiVNmBvemTJR5mcy7iPcg==", + "dev": true, + "engines": { + "node": ">=4" + } + }, "node_modules/pirates": { "version": "4.0.6", "resolved": "https://registry.npmjs.org/pirates/-/pirates-4.0.6.tgz", @@ -3138,6 +8697,86 @@ "node": ">= 6" } }, + "node_modules/pkg-conf": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/pkg-conf/-/pkg-conf-2.1.0.tgz", + "integrity": "sha512-C+VUP+8jis7EsQZIhDYmS5qlNtjv2yP4SNtjXK9AP1ZcTRlnSfuumaTnRfYZnYgUUYVIKqL0fRvmUGDV2fmp6g==", + "dev": true, + "dependencies": { + "find-up": "^2.0.0", + "load-json-file": "^4.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/pkg-conf/node_modules/find-up": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz", + "integrity": "sha512-NWzkk0jSJtTt08+FBFMvXoeZnOJD+jTtsRmBYbAIzJdX6l7dLgR7CTubCM5/eDdPUBvLCeVasP1brfVR/9/EZQ==", + "dev": true, + "dependencies": { + "locate-path": "^2.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/pkg-conf/node_modules/locate-path": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-2.0.0.tgz", + "integrity": "sha512-NCI2kiDkyR7VeEKm27Kda/iQHyKJe1Bu0FlTbYp3CqJu+9IFe9bLyAjMxf5ZDDbEg+iMPzB5zYyUTSm8wVTKmA==", + "dev": true, + "dependencies": { + "p-locate": "^2.0.0", + "path-exists": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/pkg-conf/node_modules/p-limit": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-1.3.0.tgz", + "integrity": "sha512-vvcXsLAJ9Dr5rQOPk7toZQZJApBl2K4J6dANSsEuh6QI41JYcsS/qhTGa9ErIUUgK3WNQoJYvylxvjqmiqEA9Q==", + "dev": true, + "dependencies": { + "p-try": "^1.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/pkg-conf/node_modules/p-locate": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-2.0.0.tgz", + "integrity": "sha512-nQja7m7gSKuewoVRen45CtVfODR3crN3goVQ0DDZ9N3yHxgpkuBhZqsaiotSQRrADUrne346peY7kT3TSACykg==", + "dev": true, + "dependencies": { + "p-limit": "^1.1.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/pkg-conf/node_modules/p-try": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-1.0.0.tgz", + "integrity": "sha512-U1etNYuMJoIz3ZXSrrySFjsXQTWOx2/jdi86L+2pRvph/qMKL6sbcCYdH23fqsbm8TH2Gn0OybpT4eSFlCVHww==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/pkg-conf/node_modules/path-exists": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", + "integrity": "sha512-bpC7GYwiDYQ4wYLe+FA8lhRjhQCMcQGuSgGGqDkg/QerRWw9CmGRT0iSOVRSZJ29NMLZgIzqaljJ63oaL4NIJQ==", + "dev": true, + "engines": { + "node": ">=4" + } + }, "node_modules/pkg-dir": { "version": "4.2.0", "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-4.2.0.tgz", @@ -3176,6 +8815,12 @@ "url": "https://github.com/chalk/ansi-styles?sponsor=1" } }, + "node_modules/process-nextick-args": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", + "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==", + "dev": true + }, "node_modules/prompts": { "version": "2.4.2", "resolved": "https://registry.npmjs.org/prompts/-/prompts-2.4.2.tgz", @@ -3189,6 +8834,12 @@ "node": ">= 6" } }, + "node_modules/proto-list": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/proto-list/-/proto-list-1.2.4.tgz", + "integrity": "sha512-vtK/94akxsTMhe0/cbfpR+syPuszcuwhqVjJq26CuNDgFGj682oRBXOP5MJpv2r7JtE8MsiepGIqvvOTBwn2vA==", + "dev": true + }, "node_modules/pure-rand": { "version": "6.1.0", "resolved": "https://registry.npmjs.org/pure-rand/-/pure-rand-6.1.0.tgz", @@ -3205,12 +8856,304 @@ } ] }, + "node_modules/queue-microtask": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", + "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/quick-lru": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/quick-lru/-/quick-lru-4.0.1.tgz", + "integrity": "sha512-ARhCpm70fzdcvNQfPoy49IaanKkTlRWF2JMzqhcJbhSFRZv7nPTvZJdcY7301IPmvW+/p0RgIWnQDLJxifsQ7g==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/rc": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/rc/-/rc-1.2.8.tgz", + "integrity": "sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw==", + "dev": true, + "dependencies": { + "deep-extend": "^0.6.0", + "ini": "~1.3.0", + "minimist": "^1.2.0", + "strip-json-comments": "~2.0.1" + }, + "bin": { + "rc": "cli.js" + } + }, + "node_modules/rc/node_modules/strip-json-comments": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", + "integrity": "sha512-4gB8na07fecVVkOI6Rs4e7T6NOTki5EmL7TUduTs6bu3EdnSycntVJ4re8kgZA+wx9IueI2Y11bfbgwtzuE0KQ==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/react-is": { "version": "18.3.1", "resolved": "https://registry.npmjs.org/react-is/-/react-is-18.3.1.tgz", "integrity": "sha512-/LLMVyas0ljjAtoYiPqYiL8VWXzUUdThrmU5+n20DZv+a+ClRoevUzw5JxU+Ieh5/c87ytoTBV9G1FiKfNJdmg==", "dev": true }, + "node_modules/read-pkg": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-8.1.0.tgz", + "integrity": "sha512-PORM8AgzXeskHO/WEv312k9U03B8K9JSiWF/8N9sUuFjBa+9SF2u6K7VClzXwDXab51jCd8Nd36CNM+zR97ScQ==", + "dev": true, + "dependencies": { + "@types/normalize-package-data": "^2.4.1", + "normalize-package-data": "^6.0.0", + "parse-json": "^7.0.0", + "type-fest": "^4.2.0" + }, + "engines": { + "node": ">=16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/read-pkg-up": { + "version": "10.1.0", + "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-10.1.0.tgz", + "integrity": "sha512-aNtBq4jR8NawpKJQldrQcSW9y/d+KWH4v24HWkHljOZ7H0av+YTGANBzRh9A5pw7v/bLVsLVPpOhJ7gHNVy8lA==", + "dev": true, + "dependencies": { + "find-up": "^6.3.0", + "read-pkg": "^8.1.0", + "type-fest": "^4.2.0" + }, + "engines": { + "node": ">=16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/read-pkg-up/node_modules/find-up": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-6.3.0.tgz", + "integrity": "sha512-v2ZsoEuVHYy8ZIlYqwPe/39Cy+cFDzp4dXPaxNvkEuouymu+2Jbz0PxpKarJHYJTmv2HWT3O382qY8l4jMWthw==", + "dev": true, + "dependencies": { + "locate-path": "^7.1.0", + "path-exists": "^5.0.0" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/read-pkg-up/node_modules/locate-path": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-7.2.0.tgz", + "integrity": "sha512-gvVijfZvn7R+2qyPX8mAuKcFGDf6Nc61GdvGafQsHL0sBIxfKzA+usWn4GFC/bk+QdwPUD4kWFJLhElipq+0VA==", + "dev": true, + "dependencies": { + "p-locate": "^6.0.0" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/read-pkg-up/node_modules/p-limit": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-4.0.0.tgz", + "integrity": "sha512-5b0R4txpzjPWVw/cXXUResoD4hb6U/x9BH08L7nw+GN1sezDzPdxeRvpc9c433fZhBan/wusjbCsqwqm4EIBIQ==", + "dev": true, + "dependencies": { + "yocto-queue": "^1.0.0" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/read-pkg-up/node_modules/p-locate": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-6.0.0.tgz", + "integrity": "sha512-wPrq66Llhl7/4AGC6I+cqxT07LhXvWL08LNXz1fENOw0Ap4sRZZ/gZpTTJ5jpurzzzfS2W/Ge9BY3LgLjCShcw==", + "dev": true, + "dependencies": { + "p-limit": "^4.0.0" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/read-pkg-up/node_modules/path-exists": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-5.0.0.tgz", + "integrity": "sha512-RjhtfwJOxzcFmNOi6ltcbcu4Iu+FL3zEj83dk4kAS+fVpTxXLO1b38RvJgT/0QwvV/L3aY9TAnyv0EOqW4GoMQ==", + "dev": true, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + } + }, + "node_modules/read-pkg-up/node_modules/type-fest": { + "version": "4.41.0", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-4.41.0.tgz", + "integrity": "sha512-TeTSQ6H5YHvpqVwBRcnLDCBnDOHWYu7IvGbHT6N8AOymcr9PJGjc1GTtiWZTYg0NCgYwvnYWEkVChQAr9bjfwA==", + "dev": true, + "engines": { + "node": ">=16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/read-pkg-up/node_modules/yocto-queue": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-1.2.1.tgz", + "integrity": "sha512-AyeEbWOu/TAXdxlV9wmGcR0+yh2j3vYPGOECcIj2S7MkrLyC7ne+oye2BKTItt0ii2PHk4cDy+95+LshzbXnGg==", + "dev": true, + "engines": { + "node": ">=12.20" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/read-pkg/node_modules/json-parse-even-better-errors": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-3.0.2.tgz", + "integrity": "sha512-fi0NG4bPjCHunUJffmLd0gxssIgkNmArMvis4iNah6Owg1MCJjWhEcDLmsK6iGkJq3tHwbDkTlce70/tmXN4cQ==", + "dev": true, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/read-pkg/node_modules/lines-and-columns": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-2.0.4.tgz", + "integrity": "sha512-wM1+Z03eypVAVUCE7QdSqpVIvelbOakn1M0bPDoA4SGWPx3sNDVUiMo3L6To6WWGClB7VyXnhQ4Sn7gxiJbE6A==", + "dev": true, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + } + }, + "node_modules/read-pkg/node_modules/parse-json": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-7.1.1.tgz", + "integrity": "sha512-SgOTCX/EZXtZxBE5eJ97P4yGM5n37BwRU+YMsH4vNzFqJV/oWFXXCmwFlgWUM4PrakybVOueJJ6pwHqSVhTFDw==", + "dev": true, + "dependencies": { + "@babel/code-frame": "^7.21.4", + "error-ex": "^1.3.2", + "json-parse-even-better-errors": "^3.0.0", + "lines-and-columns": "^2.0.3", + "type-fest": "^3.8.0" + }, + "engines": { + "node": ">=16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/read-pkg/node_modules/parse-json/node_modules/type-fest": { + "version": "3.13.1", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-3.13.1.tgz", + "integrity": "sha512-tLq3bSNx+xSpwvAJnzrK0Ep5CLNWjvFTOp71URMaAEWBfRb9nnJiBoUe0tF8bI4ZFO3omgBR6NvnbzVUT3Ly4g==", + "dev": true, + "engines": { + "node": ">=14.16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/read-pkg/node_modules/type-fest": { + "version": "4.41.0", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-4.41.0.tgz", + "integrity": "sha512-TeTSQ6H5YHvpqVwBRcnLDCBnDOHWYu7IvGbHT6N8AOymcr9PJGjc1GTtiWZTYg0NCgYwvnYWEkVChQAr9bjfwA==", + "dev": true, + "engines": { + "node": ">=16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/readable-stream": { + "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", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "node_modules/redent": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/redent/-/redent-3.0.0.tgz", + "integrity": "sha512-6tDA8g98We0zd0GvVeMT9arEOnTw9qM03L9cJXaCjrip1OO764RDBLBfrB4cwzNGDj5OA5ioymC9GkizgWJDUg==", + "dev": true, + "dependencies": { + "indent-string": "^4.0.0", + "strip-indent": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/redeyed": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/redeyed/-/redeyed-2.1.1.tgz", + "integrity": "sha512-FNpGGo1DycYAdnrKFxCMmKYgo/mILAqtRYbkdQD8Ep/Hk2PQ5+aEAEx+IU713RTDmuBaH0c8P5ZozurNu5ObRQ==", + "dev": true, + "dependencies": { + "esprima": "~4.0.0" + } + }, + "node_modules/registry-auth-token": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/registry-auth-token/-/registry-auth-token-5.1.0.tgz", + "integrity": "sha512-GdekYuwLXLxMuFTwAPg5UKGLW/UXzQrZvH/Zj791BQif5T05T0RsaLfHc9q3ZOKi7n+BoprPD9mJ0O0k4xzUlw==", + "dev": true, + "dependencies": { + "@pnpm/npm-conf": "^2.1.0" + }, + "engines": { + "node": ">=14" + } + }, "node_modules/require-directory": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", @@ -3267,6 +9210,309 @@ "node": ">=10" } }, + "node_modules/reusify": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.1.0.tgz", + "integrity": "sha512-g6QUff04oZpHs0eG5p83rFLhHeV00ug/Yf9nZM6fLeUrPguBTkTQOdpAWWspMh55TZfVQDPaN3NQJfbVRAxdIw==", + "dev": true, + "engines": { + "iojs": ">=1.0.0", + "node": ">=0.10.0" + } + }, + "node_modules/run-parallel": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", + "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", + "dev": true, + "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": { + "queue-microtask": "^1.2.2" + } + }, + "node_modules/safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", + "dev": true + }, + "node_modules/semantic-release": { + "version": "21.1.2", + "resolved": "https://registry.npmjs.org/semantic-release/-/semantic-release-21.1.2.tgz", + "integrity": "sha512-kz76azHrT8+VEkQjoCBHE06JNQgTgsC4bT8XfCzb7DHcsk9vG3fqeMVik8h5rcWCYi2Fd+M3bwA7BG8Z8cRwtA==", + "dev": true, + "dependencies": { + "@semantic-release/commit-analyzer": "^10.0.0", + "@semantic-release/error": "^4.0.0", + "@semantic-release/github": "^9.0.0", + "@semantic-release/npm": "^10.0.2", + "@semantic-release/release-notes-generator": "^11.0.0", + "aggregate-error": "^5.0.0", + "cosmiconfig": "^8.0.0", + "debug": "^4.0.0", + "env-ci": "^9.0.0", + "execa": "^8.0.0", + "figures": "^5.0.0", + "find-versions": "^5.1.0", + "get-stream": "^6.0.0", + "git-log-parser": "^1.2.0", + "hook-std": "^3.0.0", + "hosted-git-info": "^7.0.0", + "lodash-es": "^4.17.21", + "marked": "^5.0.0", + "marked-terminal": "^5.1.1", + "micromatch": "^4.0.2", + "p-each-series": "^3.0.0", + "p-reduce": "^3.0.0", + "read-pkg-up": "^10.0.0", + "resolve-from": "^5.0.0", + "semver": "^7.3.2", + "semver-diff": "^4.0.0", + "signale": "^1.2.1", + "yargs": "^17.5.1" + }, + "bin": { + "semantic-release": "bin/semantic-release.js" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/semantic-release/node_modules/@semantic-release/error": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/@semantic-release/error/-/error-4.0.0.tgz", + "integrity": "sha512-mgdxrHTLOjOddRVYIYDo0fR3/v61GNN1YGkfbrjuIKg/uMgCd+Qzo3UAXJ+woLQQpos4pl5Esuw5A7AoNlzjUQ==", + "dev": true, + "engines": { + "node": ">=18" + } + }, + "node_modules/semantic-release/node_modules/aggregate-error": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/aggregate-error/-/aggregate-error-5.0.0.tgz", + "integrity": "sha512-gOsf2YwSlleG6IjRYG2A7k0HmBMEo6qVNk9Bp/EaLgAJT5ngH6PXbqa4ItvnEwCm/velL5jAnQgsHsWnjhGmvw==", + "dev": true, + "dependencies": { + "clean-stack": "^5.2.0", + "indent-string": "^5.0.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/semantic-release/node_modules/clean-stack": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/clean-stack/-/clean-stack-5.2.0.tgz", + "integrity": "sha512-TyUIUJgdFnCISzG5zu3291TAsE77ddchd0bepon1VVQrKLGKFED4iXFEDQ24mIPdPBbyE16PK3F8MYE1CmcBEQ==", + "dev": true, + "dependencies": { + "escape-string-regexp": "5.0.0" + }, + "engines": { + "node": ">=14.16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/semantic-release/node_modules/escape-string-regexp": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-5.0.0.tgz", + "integrity": "sha512-/veY75JbMK4j1yjvuUxuVsiS/hr/4iHs9FTT6cgTexxdE0Ly/glccBAkloH/DofkjRbZU3bnoj38mOmhkZ0lHw==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/semantic-release/node_modules/execa": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/execa/-/execa-8.0.1.tgz", + "integrity": "sha512-VyhnebXciFV2DESc+p6B+y0LjSm0krU4OgJN44qFAhBY0TJ+1V61tYD2+wHusZ6F9n5K+vl8k0sTy7PEfV4qpg==", + "dev": true, + "dependencies": { + "cross-spawn": "^7.0.3", + "get-stream": "^8.0.1", + "human-signals": "^5.0.0", + "is-stream": "^3.0.0", + "merge-stream": "^2.0.0", + "npm-run-path": "^5.1.0", + "onetime": "^6.0.0", + "signal-exit": "^4.1.0", + "strip-final-newline": "^3.0.0" + }, + "engines": { + "node": ">=16.17" + }, + "funding": { + "url": "https://github.com/sindresorhus/execa?sponsor=1" + } + }, + "node_modules/semantic-release/node_modules/execa/node_modules/get-stream": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-8.0.1.tgz", + "integrity": "sha512-VaUJspBffn/LMCJVoMvSAdmscJyS1auj5Zulnn5UoYcY531UWmdwhRWkcGKnGU93m5HSXP9LP2usOryrBtQowA==", + "dev": true, + "engines": { + "node": ">=16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/semantic-release/node_modules/human-signals": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-5.0.0.tgz", + "integrity": "sha512-AXcZb6vzzrFAUE61HnN4mpLqd/cSIwNQjtNWR0euPm6y0iqx3G4gOXaIDdtdDwZmhwe82LA6+zinmW4UBWVePQ==", + "dev": true, + "engines": { + "node": ">=16.17.0" + } + }, + "node_modules/semantic-release/node_modules/indent-string": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-5.0.0.tgz", + "integrity": "sha512-m6FAo/spmsW2Ab2fU35JTYwtOKa2yAwXSwgjSv1TJzh4Mh7mC3lzAOVLBprb72XsTrgkEIsl7YrFNAiDiRhIGg==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/semantic-release/node_modules/is-stream": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-3.0.0.tgz", + "integrity": "sha512-LnQR4bZ9IADDRSkvpqMGvt/tEJWclzklNgSw48V5EAaAeDd6qGvN8ei6k5p0tvxSR171VmGyHuTiAOfxAbr8kA==", + "dev": true, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/semantic-release/node_modules/mimic-fn": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-4.0.0.tgz", + "integrity": "sha512-vqiC06CuhBTUdZH+RYl8sFrL096vA45Ok5ISO6sE/Mr1jRbGH4Csnhi8f3wKVl7x8mO4Au7Ir9D3Oyv1VYMFJw==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/semantic-release/node_modules/npm-run-path": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-5.3.0.tgz", + "integrity": "sha512-ppwTtiJZq0O/ai0z7yfudtBpWIoxM8yE6nHi1X47eFR2EWORqfbu6CnPlNsjeN683eT0qG6H/Pyf9fCcvjnnnQ==", + "dev": true, + "dependencies": { + "path-key": "^4.0.0" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/semantic-release/node_modules/onetime": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-6.0.0.tgz", + "integrity": "sha512-1FlR+gjXK7X+AsAHso35MnyN5KqGwJRi/31ft6x0M194ht7S+rWAvd7PHss9xSKMzE0asv1pyIHaJYq+BbacAQ==", + "dev": true, + "dependencies": { + "mimic-fn": "^4.0.0" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/semantic-release/node_modules/p-reduce": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/p-reduce/-/p-reduce-3.0.0.tgz", + "integrity": "sha512-xsrIUgI0Kn6iyDYm9StOpOeK29XM1aboGji26+QEortiFST1hGZaUQOLhtEbqHErPpGW/aSz6allwK2qcptp0Q==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/semantic-release/node_modules/path-key": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-4.0.0.tgz", + "integrity": "sha512-haREypq7xkM7ErfgIyA0z+Bj4AGKlMSdlQE2jvJo6huWD1EdkKYV+G/T4nq0YEF2vgTT8kqMFKo1uHn950r4SQ==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/semantic-release/node_modules/semver": { + "version": "7.7.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.2.tgz", + "integrity": "sha512-RF0Fw+rO5AMf9MAyaRXI4AV0Ulj5lMHqVxxdSgiVbixSCXoEmmX/jk0CuJw4+3SqroYO9VoUh+HcuJivvtJemA==", + "dev": true, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/semantic-release/node_modules/signal-exit": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz", + "integrity": "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==", + "dev": true, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/semantic-release/node_modules/strip-final-newline": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-3.0.0.tgz", + "integrity": "sha512-dOESqjYr96iWYylGObzd39EuNTa5VJxyvVAEm5Jnh7KGo75V43Hk1odPQkNDyXNmUR6k+gEiDVXnjB8HJ3crXw==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/semver": { "version": "6.3.1", "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", @@ -3276,6 +9522,45 @@ "semver": "bin/semver.js" } }, + "node_modules/semver-diff": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/semver-diff/-/semver-diff-4.0.0.tgz", + "integrity": "sha512-0Ju4+6A8iOnpL/Thra7dZsSlOHYAHIeMxfhWQRI1/VLcT3WDBZKKtQt/QkBOsiIN9ZpuvHE6cGZ0x4glCMmfiA==", + "dev": true, + "dependencies": { + "semver": "^7.3.5" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/semver-diff/node_modules/semver": { + "version": "7.7.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.2.tgz", + "integrity": "sha512-RF0Fw+rO5AMf9MAyaRXI4AV0Ulj5lMHqVxxdSgiVbixSCXoEmmX/jk0CuJw4+3SqroYO9VoUh+HcuJivvtJemA==", + "dev": true, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/semver-regex": { + "version": "4.0.5", + "resolved": "https://registry.npmjs.org/semver-regex/-/semver-regex-4.0.5.tgz", + "integrity": "sha512-hunMQrEy1T6Jr2uEVjrAIqjwWcQTgOAcIM52C8MY1EZSD3DDNft04XzvYKPqjED65bNVVko0YI38nYeEHCX3yw==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/shebang-command": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", @@ -3303,6 +9588,103 @@ "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", "dev": true }, + "node_modules/signale": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/signale/-/signale-1.4.0.tgz", + "integrity": "sha512-iuh+gPf28RkltuJC7W5MRi6XAjTDCAPC/prJUpQoG4vIP3MJZ+GTydVnodXA7pwvTKb2cA0m9OFZW/cdWy/I/w==", + "dev": true, + "dependencies": { + "chalk": "^2.3.2", + "figures": "^2.0.0", + "pkg-conf": "^2.1.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/signale/node_modules/ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "dependencies": { + "color-convert": "^1.9.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/signale/node_modules/chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "dependencies": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/signale/node_modules/color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "dev": true, + "dependencies": { + "color-name": "1.1.3" + } + }, + "node_modules/signale/node_modules/color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", + "dev": true + }, + "node_modules/signale/node_modules/escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", + "dev": true, + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/signale/node_modules/figures": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/figures/-/figures-2.0.0.tgz", + "integrity": "sha512-Oa2M9atig69ZkfwiApY8F2Yy+tzMbazyvqv21R0NsSC8floSOC09BbT1ITWAdoMGQvJ/aZnR1KMwdx9tvHnTNA==", + "dev": true, + "dependencies": { + "escape-string-regexp": "^1.0.5" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/signale/node_modules/has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/signale/node_modules/supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "dependencies": { + "has-flag": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, "node_modules/sisteransi": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/sisteransi/-/sisteransi-1.0.5.tgz", @@ -3337,6 +9719,65 @@ "source-map": "^0.6.0" } }, + "node_modules/spawn-error-forwarder": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/spawn-error-forwarder/-/spawn-error-forwarder-1.0.0.tgz", + "integrity": "sha512-gRjMgK5uFjbCvdibeGJuy3I5OYz6VLoVdsOJdA6wV0WlfQVLFueoqMxwwYD9RODdgb6oUIvlRlsyFSiQkMKu0g==", + "dev": true + }, + "node_modules/spdx-correct": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.2.0.tgz", + "integrity": "sha512-kN9dJbvnySHULIluDHy32WHRUu3Og7B9sbY7tsFLctQkIqnMh3hErYgdMjTYuqmcXX+lK5T1lnUt3G7zNswmZA==", + "dev": true, + "dependencies": { + "spdx-expression-parse": "^3.0.0", + "spdx-license-ids": "^3.0.0" + } + }, + "node_modules/spdx-exceptions": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-2.5.0.tgz", + "integrity": "sha512-PiU42r+xO4UbUS1buo3LPJkjlO7430Xn5SVAhdpzzsPHsjbYVflnnFdATgabnLude+Cqu25p6N+g2lw/PFsa4w==", + "dev": true + }, + "node_modules/spdx-expression-parse": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-3.0.1.tgz", + "integrity": "sha512-cbqHunsQWnJNE6KhVSMsMeH5H/L9EpymbzqTQ3uLwNCLZ1Q481oWaofqH7nO6V07xlXwY6PhQdQ2IedWx/ZK4Q==", + "dev": true, + "dependencies": { + "spdx-exceptions": "^2.1.0", + "spdx-license-ids": "^3.0.0" + } + }, + "node_modules/spdx-license-ids": { + "version": "3.0.21", + "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.21.tgz", + "integrity": "sha512-Bvg/8F5XephndSK3JffaRqdT+gyhfqIPwDHpX80tJrF8QQRYMo8sNMeaZ2Dp5+jhwKnUmIOyFFQfHRkjJm5nXg==", + "dev": true + }, + "node_modules/split": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/split/-/split-1.0.1.tgz", + "integrity": "sha512-mTyOoPbrivtXnwnIxZRFYRrPNtEFKlpB2fvjSnCQUiAA6qAZzqwna5envK4uk6OIeP17CsdF3rSBGYVBsU0Tkg==", + "dev": true, + "dependencies": { + "through": "2" + }, + "engines": { + "node": "*" + } + }, + "node_modules/split2": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/split2/-/split2-4.2.0.tgz", + "integrity": "sha512-UcjcJOWknrNkF6PLX83qcHM6KHgVKNkV62Y8a5uYDVv9ydGQVwAHMKqHdJje1VTWpljG0WYpCDhrCdAOYH4TWg==", + "dev": true, + "engines": { + "node": ">= 10.x" + } + }, "node_modules/sprintf-js": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", @@ -3355,6 +9796,25 @@ "node": ">=10" } }, + "node_modules/stream-combiner2": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/stream-combiner2/-/stream-combiner2-1.1.1.tgz", + "integrity": "sha512-3PnJbYgS56AeWgtKF5jtJRT6uFJe56Z0Hc5Ngg/6sI6rIt8iiMBTa9cvdyFfpMQjaVHr8dusbNeFGIIonxOvKw==", + "dev": true, + "dependencies": { + "duplexer2": "~0.1.0", + "readable-stream": "^2.0.2" + } + }, + "node_modules/string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "dev": true, + "dependencies": { + "safe-buffer": "~5.1.0" + } + }, "node_modules/string-length": { "version": "4.0.2", "resolved": "https://registry.npmjs.org/string-length/-/string-length-4.0.2.tgz", @@ -3412,6 +9872,18 @@ "node": ">=6" } }, + "node_modules/strip-indent": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-indent/-/strip-indent-3.0.0.tgz", + "integrity": "sha512-laJTa3Jb+VQpaC6DseHhF7dXVqHTfJPCRDaEbid/drOhgitgYku/letMUqOXFoWV0zIIUbjpdH2t+tYj4bQMRQ==", + "dev": true, + "dependencies": { + "min-indent": "^1.0.0" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/strip-json-comments": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", @@ -3436,6 +9908,19 @@ "node": ">=8" } }, + "node_modules/supports-hyperlinks": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/supports-hyperlinks/-/supports-hyperlinks-2.3.0.tgz", + "integrity": "sha512-RpsAZlpWcDwOPQA22aCH4J0t7L8JmAvsCxfOSEwm7cQs3LshN36QaTkwd70DnBOXDWGssw2eUoc8CaRWT0XunA==", + "dev": true, + "dependencies": { + "has-flag": "^4.0.0", + "supports-color": "^7.0.0" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/supports-preserve-symlinks-flag": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", @@ -3448,6 +9933,57 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/temp-dir": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/temp-dir/-/temp-dir-3.0.0.tgz", + "integrity": "sha512-nHc6S/bwIilKHNRgK/3jlhDoIHcp45YgyiwcAk46Tr0LfEqGBVpmiAyuiuxeVE44m3mXnEeVhaipLOEWmH+Njw==", + "dev": true, + "engines": { + "node": ">=14.16" + } + }, + "node_modules/tempy": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/tempy/-/tempy-3.1.0.tgz", + "integrity": "sha512-7jDLIdD2Zp0bDe5r3D2qtkd1QOCacylBuL7oa4udvN6v2pqr4+LcCr67C8DR1zkpaZ8XosF5m1yQSabKAW6f2g==", + "dev": true, + "dependencies": { + "is-stream": "^3.0.0", + "temp-dir": "^3.0.0", + "type-fest": "^2.12.2", + "unique-string": "^3.0.0" + }, + "engines": { + "node": ">=14.16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/tempy/node_modules/is-stream": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-3.0.0.tgz", + "integrity": "sha512-LnQR4bZ9IADDRSkvpqMGvt/tEJWclzklNgSw48V5EAaAeDd6qGvN8ei6k5p0tvxSR171VmGyHuTiAOfxAbr8kA==", + "dev": true, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/tempy/node_modules/type-fest": { + "version": "2.19.0", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-2.19.0.tgz", + "integrity": "sha512-RAH822pAdBgcNMAfWnCBU3CFZcfZ/i1eZjwFU/dsLKumyuuP3niueg2UAukXYF0E2AAoc82ZSSf9J0WQBinzHA==", + "dev": true, + "engines": { + "node": ">=12.20" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/test-exclude": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/test-exclude/-/test-exclude-6.0.0.tgz", @@ -3462,6 +9998,34 @@ "node": ">=8" } }, + "node_modules/text-extensions": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/text-extensions/-/text-extensions-2.4.0.tgz", + "integrity": "sha512-te/NtwBwfiNRLf9Ijqx3T0nlqZiQ2XrrtBvu+cLL8ZRrGkO0NHTug8MYFKyoSrv/sHTaSKfilUkizV6XhxMJ3g==", + "dev": true, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/through": { + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", + "integrity": "sha512-w89qg7PI8wAdvX60bMDP+bFoD5Dvhm9oLheFp5O4a2QF0cSBGsBX4qZmadPMvVqlLJBBci+WqGGOAPvcDeNSVg==", + "dev": true + }, + "node_modules/through2": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/through2/-/through2-2.0.5.tgz", + "integrity": "sha512-/mrRod8xqpA+IHSLyGCQ2s8SPHiCDEeQJSep1jqLYeEUClOFG2Qsh+4FU6G9VeqpZnGW/Su8LQGc4YKni5rYSQ==", + "dev": true, + "dependencies": { + "readable-stream": "~2.3.6", + "xtend": "~4.0.1" + } + }, "node_modules/tmpl": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/tmpl/-/tmpl-1.0.5.tgz", @@ -3489,6 +10053,27 @@ "node": ">=8.0" } }, + "node_modules/traverse": { + "version": "0.6.8", + "resolved": "https://registry.npmjs.org/traverse/-/traverse-0.6.8.tgz", + "integrity": "sha512-aXJDbk6SnumuaZSANd21XAo15ucCDE38H4fkqiGsc3MhCK+wOlZvLP9cB/TvpHT0mOyWgC4Z8EwRlzqYSUzdsA==", + "dev": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/trim-newlines": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/trim-newlines/-/trim-newlines-3.0.1.tgz", + "integrity": "sha512-c1PTsA3tYrIsLGkJkzHF+w9F2EyxfXGo4UyJc4pFL++FMjnq0HJS69T3M7d//gKrFKwy429bouPescbjecU+Zw==", + "dev": true, + "engines": { + "node": ">=8" + } + }, "node_modules/ts-jest": { "version": "29.2.3", "resolved": "https://registry.npmjs.org/ts-jest/-/ts-jest-29.2.3.tgz", @@ -3627,12 +10212,67 @@ "node": ">=14.17" } }, + "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==", + "dev": true, + "optional": true, + "bin": { + "uglifyjs": "bin/uglifyjs" + }, + "engines": { + "node": ">=0.8.0" + } + }, "node_modules/undici-types": { "version": "6.19.8", "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.19.8.tgz", "integrity": "sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw==", "dev": true }, + "node_modules/unicorn-magic": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/unicorn-magic/-/unicorn-magic-0.3.0.tgz", + "integrity": "sha512-+QBBXBCvifc56fsbuxZQ6Sic3wqqc3WWaqxs58gvJrcOuN83HGTCwz3oS5phzU9LthRNE9VrJCFCLUgHeeFnfA==", + "dev": true, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/unique-string": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/unique-string/-/unique-string-3.0.0.tgz", + "integrity": "sha512-VGXBUVwxKMBUznyffQweQABPRRW1vHZAbadFZud4pLFAqRGvv/96vafgjWFqzourzr8YonlQiPgH0YCJfawoGQ==", + "dev": true, + "dependencies": { + "crypto-random-string": "^4.0.0" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/universal-user-agent": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/universal-user-agent/-/universal-user-agent-6.0.1.tgz", + "integrity": "sha512-yCzhz6FN2wU1NiiQRogkTQszlQSlpWaw8SvVegAc+bDxbzHgh1vX8uIe8OYyMH6DwH+sdTJsgMl36+mSMdRJIQ==", + "dev": true + }, + "node_modules/universalify": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.1.tgz", + "integrity": "sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw==", + "dev": true, + "engines": { + "node": ">= 10.0.0" + } + }, "node_modules/update-browserslist-db": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.1.0.tgz", @@ -3663,6 +10303,21 @@ "browserslist": ">= 4.21.0" } }, + "node_modules/url-join": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/url-join/-/url-join-5.0.0.tgz", + "integrity": "sha512-n2huDr9h9yzd6exQVnH/jU5mr+Pfx08LRXXZhkLLetAMESRj+anQsTAh940iMrIetKAmry9coFuZQ2jY8/p3WA==", + "dev": true, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + } + }, + "node_modules/util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==", + "dev": true + }, "node_modules/v8-compile-cache-lib": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz", @@ -3683,6 +10338,16 @@ "node": ">=10.12.0" } }, + "node_modules/validate-npm-package-license": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz", + "integrity": "sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==", + "dev": true, + "dependencies": { + "spdx-correct": "^3.0.0", + "spdx-expression-parse": "^3.0.0" + } + }, "node_modules/walker": { "version": "1.0.8", "resolved": "https://registry.npmjs.org/walker/-/walker-1.0.8.tgz", @@ -3707,6 +10372,12 @@ "node": ">= 8" } }, + "node_modules/wordwrap": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz", + "integrity": "sha512-gvVzJFlPycKc5dZN4yPkP8w7Dc37BtP1yczEneOb4uq34pXZcvrtRTmWV8W+Ume+XCxKgbjM+nevkyFPMybd4Q==", + "dev": true + }, "node_modules/wrap-ansi": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", @@ -3743,6 +10414,15 @@ "node": "^12.13.0 || ^14.15.0 || >=16.0.0" } }, + "node_modules/xtend": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", + "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==", + "dev": true, + "engines": { + "node": ">=0.4" + } + }, "node_modules/y18n": { "version": "5.0.8", "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", diff --git a/packages/config-yaml/package.json b/packages/config-yaml/package.json index 07bd240ef..aaadfe13a 100644 --- a/packages/config-yaml/package.json +++ b/packages/config-yaml/package.json @@ -1,6 +1,6 @@ { "name": "@continuedev/config-yaml", - "version": "1.0.94", + "version": "1.0.95", "description": "", "main": "dist/index.js", "types": "dist/index.d.ts", @@ -13,7 +13,7 @@ } }, "bin": { - "@continuedev/config-yaml": "./dist/cli.js" + "config-yaml": "./dist/cli.js" }, "scripts": { "test": "cross-env NODE_OPTIONS=--experimental-vm-modules jest", @@ -34,6 +34,11 @@ "jest": "^29.7.0", "ts-jest": "^29.2.3", "ts-node": "^10.9.2", - "zod-to-json-schema": "^3.24.5" + "zod-to-json-schema": "^3.24.5", + "@semantic-release/changelog": "^6.0.3", + "@semantic-release/git": "^10.0.1", + "@semantic-release/github": "^9.2.6", + "@semantic-release/npm": "^10.0.6", + "semantic-release": "^21.1.2" } } diff --git a/packages/config-yaml/release.config.js b/packages/config-yaml/release.config.js index f31fcb905..f984ed9fb 100644 --- a/packages/config-yaml/release.config.js +++ b/packages/config-yaml/release.config.js @@ -1,9 +1,3 @@ -export default { - branches: ["main"], - plugins: [ - "@semantic-release/commit-analyzer", - "@semantic-release/release-notes-generator", - "@semantic-release/npm", - "@semantic-release/github", - ], -}; +import createReleaseConfig from "../shared-release.config.js"; + +export default createReleaseConfig("config-yaml"); diff --git a/packages/config-yaml/src/markdown/createMarkdownRule.ts b/packages/config-yaml/src/markdown/createMarkdownRule.ts index 14843f14d..0fdf522f8 100644 --- a/packages/config-yaml/src/markdown/createMarkdownRule.ts +++ b/packages/config-yaml/src/markdown/createMarkdownRule.ts @@ -34,6 +34,7 @@ export function createRuleMarkdown( options: { description?: string; globs?: string | string[]; + regex?: string | string[]; alwaysApply?: boolean; } = {}, ): string { @@ -44,6 +45,11 @@ export function createRuleMarkdown( typeof options.globs === "string" ? options.globs.trim() : options.globs; } + if (options.regex) { + frontmatter.regex = + typeof options.regex === "string" ? options.regex.trim() : options.regex; + } + if (options.description) { frontmatter.description = options.description.trim(); } diff --git a/packages/config-yaml/src/markdown/markdownToRule.test.ts b/packages/config-yaml/src/markdown/markdownToRule.test.ts index 71c22343b..1b930220a 100644 --- a/packages/config-yaml/src/markdown/markdownToRule.test.ts +++ b/packages/config-yaml/src/markdown/markdownToRule.test.ts @@ -1,5 +1,5 @@ import { PackageIdentifier } from "../browser.js"; -import { markdownToRule } from "./markdownToRule.js"; +import { getRuleName, markdownToRule } from "./markdownToRule.js"; describe("markdownToRule", () => { // Use a mock PackageIdentifier for testing @@ -36,7 +36,7 @@ This is a test rule.`; const result = markdownToRule(content, mockId); expect(result.globs).toBe("**/test/**/*.kt"); expect(result.rule).toBe("# Test Rule\n\nThis is a test rule."); - expect(result.name).toBe("/path/to/file"); // Should use packageIdentifierToDisplayName result + expect(result.name).toBe("to/file"); // Should use last two path segments }); it("should handle missing frontmatter", () => { @@ -47,7 +47,7 @@ This is a test rule without frontmatter.`; const result = markdownToRule(content, mockId); expect(result.globs).toBeUndefined(); expect(result.rule).toBe(content); - expect(result.name).toBe("/path/to/file"); // Should use packageIdentifierToDisplayName result + expect(result.name).toBe("to/file"); // Should use last two path segments }); it("should handle empty frontmatter", () => { @@ -63,7 +63,7 @@ This is a test rule with empty frontmatter.`; expect(result.rule).toBe( "# Test Rule\n\nThis is a test rule with empty frontmatter.", ); - expect(result.name).toBe("/path/to/file"); // Should use packageIdentifierToDisplayName result + expect(result.name).toBe("to/file"); // Should use last two path segments }); it("should handle frontmatter with whitespace", () => { @@ -78,7 +78,7 @@ This is a test rule.`; const result = markdownToRule(content, mockId); expect(result.globs).toBe("**/test/**/*.kt"); expect(result.rule).toBe("# Test Rule\n\nThis is a test rule."); - expect(result.name).toBe("/path/to/file"); // Should use packageIdentifierToDisplayName result + expect(result.name).toBe("to/file"); // Should use last two path segments }); it("should handle Windows line endings (CRLF)", () => { @@ -95,7 +95,7 @@ This is a test rule.`; expect(result.globs).toBe("**/test/**/*.kt"); // The result should be normalized to \n expect(result.rule).toBe("# Test Rule\n\nThis is a test rule."); - expect(result.name).toBe("/path/to/file"); // Should use packageIdentifierToDisplayName result + expect(result.name).toBe("to/file"); // Should use last two path segments }); it("should handle malformed frontmatter", () => { @@ -112,7 +112,7 @@ This is a test rule.`; const result = markdownToRule(content, mockId); expect(result.globs).toBeUndefined(); expect(result.rule).toBe(content); - expect(result.name).toBe("/path/to/file"); // Should use packageIdentifierToDisplayName result + expect(result.name).toBe("to/file"); // Should use last two path segments }); it("should use packageIdentifierToDisplayName if no heading or frontmatter name", () => { @@ -125,7 +125,7 @@ globs: "**/test/**/*.kt" This is a test rule.`; const result = markdownToRule(content, mockId); - expect(result.name).toBe("/path/to/file"); // Should use packageIdentifierToDisplayName result + expect(result.name).toBe("to/file"); // Should use last two path segments }); it("should use packageIdentifierToDisplayName if no heading or frontmatter name (no heading)", () => { @@ -136,7 +136,7 @@ globs: "**/test/**/*.kt" This is a test rule without a heading.`; const result = markdownToRule(content, mockId); - expect(result.name).toBe("/path/to/file"); // Should use packageIdentifierToDisplayName result + expect(result.name).toBe("to/file"); // Should use last two path segments }); it("should include description from frontmatter", () => { @@ -171,3 +171,108 @@ This is a rule with alwaysApply explicitly set to false.`; expect(result.alwaysApply).toBe(false); }); }); + +describe("getRuleName", () => { + it("should return frontmatter name when provided", () => { + const frontmatter = { name: "Custom Rule Name" }; + const id: PackageIdentifier = { + uriType: "file", + filePath: "/path/to/my-rule.md", + }; + + const result = getRuleName(frontmatter, id); + expect(result).toBe("Custom Rule Name"); + }); + + it("should return last two path segments for file identifier when no name", () => { + const frontmatter = {}; + const id: PackageIdentifier = { + uriType: "file", + filePath: "/long/path/to/rules/my-rule.md", + }; + + const result = getRuleName(frontmatter, id); + expect(result).toBe("rules/my-rule.md"); + }); + + it("should handle file paths with backslashes", () => { + const frontmatter = {}; + const id: PackageIdentifier = { + uriType: "file", + filePath: "C:\\long\\path\\to\\rules\\my-rule.md", + }; + + const result = getRuleName(frontmatter, id); + expect(result).toBe("rules/my-rule.md"); + }); + + it("should handle mixed forward and back slashes", () => { + const frontmatter = {}; + const id: PackageIdentifier = { + uriType: "file", + filePath: "/path/to\\rules/my-rule.md", + }; + + const result = getRuleName(frontmatter, id); + expect(result).toBe("rules/my-rule.md"); + }); + + it("should handle single segment path", () => { + const frontmatter = {}; + const id: PackageIdentifier = { + uriType: "file", + filePath: "my-rule.md", + }; + + const result = getRuleName(frontmatter, id); + expect(result).toBe("my-rule.md"); + }); + + it("should handle two segment path", () => { + const frontmatter = {}; + const id: PackageIdentifier = { + uriType: "file", + filePath: "rules/my-rule.md", + }; + + const result = getRuleName(frontmatter, id); + expect(result).toBe("rules/my-rule.md"); + }); + + it("should return display name for non-file identifiers", () => { + const frontmatter = {}; + const id: PackageIdentifier = { + uriType: "slug", + fullSlug: { + ownerSlug: "test-owner", + packageSlug: "my-rule-package", + versionSlug: "v1.0.0", + }, + }; + + const result = getRuleName(frontmatter, id); + expect(result).toBe("my-rule-package"); // packageIdentifierToDisplayName returns just the packageSlug + }); + + it("should prioritize frontmatter name over file path", () => { + const frontmatter = { name: "Override Name" }; + const id: PackageIdentifier = { + uriType: "file", + filePath: "/very/long/path/to/rules/original-name.md", + }; + + const result = getRuleName(frontmatter, id); + expect(result).toBe("Override Name"); + }); + + it("should handle empty string name in frontmatter by falling back to path", () => { + const frontmatter = { name: "" }; + const id: PackageIdentifier = { + uriType: "file", + filePath: "/path/to/rules/my-rule.md", + }; + + const result = getRuleName(frontmatter, id); + expect(result).toBe("rules/my-rule.md"); // Empty string is falsy, so falls back to path logic + }); +}); diff --git a/packages/config-yaml/src/markdown/markdownToRule.ts b/packages/config-yaml/src/markdown/markdownToRule.ts index a48f8176a..3add16b6c 100644 --- a/packages/config-yaml/src/markdown/markdownToRule.ts +++ b/packages/config-yaml/src/markdown/markdownToRule.ts @@ -7,6 +7,7 @@ import { RuleObject } from "../schemas/index.js"; export interface RuleFrontmatter { globs?: RuleObject["globs"]; + regex?: RuleObject["regex"]; name?: RuleObject["name"]; description?: RuleObject["description"]; alwaysApply?: RuleObject["alwaysApply"]; @@ -46,6 +47,28 @@ export function parseMarkdownRule(content: string): { return { frontmatter: {}, markdown: normalizedContent }; } +export function getRuleName( + frontmatter: RuleFrontmatter, + id: PackageIdentifier, +): string { + if (frontmatter.name) { + return frontmatter.name; + } + + const displayName = packageIdentifierToDisplayName(id); + + // If it's a file identifier, extract the last two parts of the file path + if (id.uriType === "file") { + // Handle both forward slashes and backslashes, get the last two segments + const segments = displayName.split(/[/\\]/); + const lastTwoParts = segments.slice(-2); + return lastTwoParts.join("/"); + } + + // Otherwise return the display name as-is (for slug identifiers) + return displayName; +} + export function markdownToRule( rule: string, id: PackageIdentifier, @@ -53,9 +76,10 @@ export function markdownToRule( const { frontmatter, markdown } = parseMarkdownRule(rule); return { - name: frontmatter.name ?? packageIdentifierToDisplayName(id), + name: getRuleName(frontmatter, id), rule: markdown, globs: frontmatter.globs, + regex: frontmatter.regex, description: frontmatter.description, alwaysApply: frontmatter.alwaysApply, }; diff --git a/packages/config-yaml/src/schemas/data/index.ts b/packages/config-yaml/src/schemas/data/index.ts index 7251e12a7..57c820ab3 100644 --- a/packages/config-yaml/src/schemas/data/index.ts +++ b/packages/config-yaml/src/schemas/data/index.ts @@ -28,6 +28,16 @@ import { editInteractionEventSchema_0_2_0, editInteractionEventSchema_0_2_0_noCode, } from "./editInteraction/v0.2.0.js"; +import { editOutcomeEventAllSchema } from "./editOutcome/index.js"; +import { + editOutcomeEventSchema_0_2_0, + editOutcomeEventSchema_0_2_0_noCode, +} from "./editOutcome/v0.2.0.js"; +import { nextEditEventAllSchema } from "./nextEdit/index.js"; +import { + nextEditEventSchema_0_2_0, + nextEditEventSchema_0_2_0_noCode, +} from "./nextEdit/v0.2.0.js"; import { quickEditEventAllSchema } from "./quickEdit/index.js"; import { quickEditEventSchema_0_1_0, @@ -42,6 +52,11 @@ import { tokensGeneratedEventSchema_0_2_0, tokensGeneratedEventSchema_0_2_0_noCode, } from "./tokensGenerated/v0.2.0.js"; +import { toolUsageEventAllSchema } from "./toolUsage/index.js"; +import { + toolUsageEventSchema_0_2_0, + toolUsageEventSchema_0_2_0_noCode, +} from "./toolUsage/v0.2.0.js"; const semverRegex = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9A-Za-z-][0-9A-Za-z-]*)(?:\.(?:0|[1-9A-Za-z-][0-9A-Za-z-]*))*))?(?:\+([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?$/; @@ -72,6 +87,9 @@ const devEventAllVersionDataSchemas = z.object({ tokensGenerated: tokensGeneratedEventAllSchema, chatInteraction: chatInteractionEventAllSchema, editInteraction: editInteractionEventAllSchema, + editOutcome: editOutcomeEventAllSchema, + nextEdit: nextEditEventAllSchema, + toolUsage: toolUsageEventAllSchema, }); // Version and level specific schemas are organized here @@ -97,6 +115,9 @@ export const devDataVersionedSchemas = { tokensGenerated: tokensGeneratedEventSchema_0_2_0, chatInteraction: chatInteractionEventSchema_0_2_0, editInteraction: editInteractionEventSchema_0_2_0, + editOutcome: editOutcomeEventSchema_0_2_0, + nextEdit: nextEditEventSchema_0_2_0, + toolUsage: toolUsageEventSchema_0_2_0, }, noCode: { autocomplete: autocompleteEventSchema_0_2_0_noCode, @@ -104,6 +125,9 @@ export const devDataVersionedSchemas = { tokensGenerated: tokensGeneratedEventSchema_0_2_0_noCode, chatInteraction: chatInteractionEventSchema_0_2_0_noCode, editInteraction: editInteractionEventSchema_0_2_0_noCode, + editOutcome: editOutcomeEventSchema_0_2_0_noCode, + nextEdit: nextEditEventSchema_0_2_0_noCode, + toolUsage: toolUsageEventSchema_0_2_0_noCode, }, }, }; diff --git a/packages/config-yaml/src/schemas/data/nextEdit/index.ts b/packages/config-yaml/src/schemas/data/nextEdit/index.ts new file mode 100644 index 000000000..de2607e5c --- /dev/null +++ b/packages/config-yaml/src/schemas/data/nextEdit/index.ts @@ -0,0 +1,12 @@ +import { z } from "zod"; +import { baseDevDataAllSchema } from "../base.js"; + +export const nextEditEventAllSchema = baseDevDataAllSchema.extend({ + fileURI: z.string(), + workspaceDirURI: z.string(), + beforeContent: z.string(), + afterContent: z.string(), + beforeCursorPos: z.object({ line: z.number(), character: z.number() }), + afterCursorPos: z.object({ line: z.number(), character: z.number() }), + context: z.string(), +}); diff --git a/packages/config-yaml/src/schemas/data/nextEdit/v0.2.0.ts b/packages/config-yaml/src/schemas/data/nextEdit/v0.2.0.ts new file mode 100644 index 000000000..3c95d4e3c --- /dev/null +++ b/packages/config-yaml/src/schemas/data/nextEdit/v0.2.0.ts @@ -0,0 +1,28 @@ +import { nextEditEventAllSchema } from "./index.js"; + +export const nextEditEventSchema_0_2_0 = nextEditEventAllSchema.pick({ + // base + timestamp: true, + userId: true, + userAgent: true, + selectedProfileId: true, + eventName: true, + schema: true, + + // nextedit-specific + fileURI: true, + workspaceDirURI: true, + beforeContent: true, + afterContent: true, + beforeCursorPos: true, + afterCursorPos: true, + context: true, +}); + +export const nextEditEventSchema_0_2_0_noCode = nextEditEventSchema_0_2_0.omit({ + fileURI: true, + workspaceDirURI: true, + beforeContent: true, + afterContent: true, + context: true, +}); diff --git a/packages/config-yaml/src/schemas/data/toolUsage/index.ts b/packages/config-yaml/src/schemas/data/toolUsage/index.ts new file mode 100644 index 000000000..225b5c0ab --- /dev/null +++ b/packages/config-yaml/src/schemas/data/toolUsage/index.ts @@ -0,0 +1,12 @@ +import { z } from "zod"; +import { baseDevDataAllSchema } from "../base.js"; + +export const toolUsageEventAllSchema = baseDevDataAllSchema.extend({ + toolCallId: z.string(), + functionName: z.string(), + functionArgs: z.string(), + toolCallArgs: z.any(), + parsedArgs: z.any(), + succeeded: z.boolean(), + output: z.array(z.any()).optional(), +}); diff --git a/packages/config-yaml/src/schemas/data/toolUsage/v0.2.0.ts b/packages/config-yaml/src/schemas/data/toolUsage/v0.2.0.ts new file mode 100644 index 000000000..c1045104a --- /dev/null +++ b/packages/config-yaml/src/schemas/data/toolUsage/v0.2.0.ts @@ -0,0 +1,27 @@ +import { toolUsageEventAllSchema } from "./index.js"; + +export const toolUsageEventSchema_0_2_0 = toolUsageEventAllSchema.pick({ + // base + timestamp: true, + userId: true, + userAgent: true, + selectedProfileId: true, + eventName: true, + schema: true, + + // tool-usage-specific + toolCallId: true, + functionName: true, + functionArgs: true, + toolCallArgs: true, + parsedArgs: true, + succeeded: true, + output: true, +}); + +export const toolUsageEventSchema_0_2_0_noCode = + toolUsageEventSchema_0_2_0.omit({ + functionArgs: true, + parsedArgs: true, + output: true, + }); diff --git a/packages/config-yaml/src/schemas/index.ts b/packages/config-yaml/src/schemas/index.ts index 80749d34f..917cb9866 100644 --- a/packages/config-yaml/src/schemas/index.ts +++ b/packages/config-yaml/src/schemas/index.ts @@ -50,6 +50,7 @@ const ruleObjectSchema = z.object({ rule: z.string(), description: z.string().optional(), globs: z.union([z.string(), z.array(z.string())]).optional(), + regex: z.union([z.string(), z.array(z.string())]).optional(), alwaysApply: z.boolean().optional(), }); const ruleSchema = z.union([z.string(), ruleObjectSchema]); diff --git a/packages/config-yaml/src/schemas/models.ts b/packages/config-yaml/src/schemas/models.ts index 893f7117a..99d324ac2 100644 --- a/packages/config-yaml/src/schemas/models.ts +++ b/packages/config-yaml/src/schemas/models.ts @@ -45,6 +45,9 @@ export const completionOptionsSchema = z.object({ temperature: z.number().optional(), topP: z.number().optional(), topK: z.number().optional(), + minP: z.number().optional(), + presencePenalty: z.number().optional(), + frequencyPenalty: z.number().optional(), stop: z.array(z.string()).optional(), n: z.number().optional(), reasoning: z.boolean().optional(), diff --git a/packages/fetch/package-lock.json b/packages/fetch/package-lock.json index 1bf3a3a0b..b832b32fd 100644 --- a/packages/fetch/package-lock.json +++ b/packages/fetch/package-lock.json @@ -1,12 +1,12 @@ { "name": "@continuedev/fetch", - "version": "1.0.13", + "version": "1.0.15", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@continuedev/fetch", - "version": "1.0.13", + "version": "1.0.15", "license": "Apache-2.0", "dependencies": { "@continuedev/config-types": "^1.0.5", diff --git a/packages/fetch/package.json b/packages/fetch/package.json index f17bcfc69..5cd0a38e4 100644 --- a/packages/fetch/package.json +++ b/packages/fetch/package.json @@ -1,6 +1,6 @@ { "name": "@continuedev/fetch", - "version": "1.0.13", + "version": "1.0.15", "description": "", "main": "dist/index.js", "types": "dist/index.d.ts", diff --git a/packages/fetch/release.config.js b/packages/fetch/release.config.js new file mode 100644 index 000000000..a5b357cf5 --- /dev/null +++ b/packages/fetch/release.config.js @@ -0,0 +1,3 @@ +import createReleaseConfig from "../shared-release.config.js"; + +export default createReleaseConfig("fetch"); diff --git a/packages/fetch/src/certs.test.ts b/packages/fetch/src/certs.test.ts new file mode 100644 index 000000000..04c30b0ed --- /dev/null +++ b/packages/fetch/src/certs.test.ts @@ -0,0 +1,187 @@ +import * as fs from "node:fs"; +import { beforeEach, expect, test, vi } from "vitest"; +import { CertsCache, getCertificateContent } from "./certs.js"; + +// Mock fs module +vi.mock("node:fs", () => ({ + readFileSync: vi.fn(), +})); + +const mockReadFileSync = vi.mocked(fs.readFileSync); + +beforeEach(() => { + vi.clearAllMocks(); +}); + +test("getCertificateContent should decode base64 data URI correctly", () => { + const testCert = + "-----BEGIN CERTIFICATE-----\nMIIC...\n-----END CERTIFICATE-----"; + const base64Data = Buffer.from(testCert, "utf8").toString("base64"); + const dataUri = `data:application/x-pem-file;base64,${base64Data}`; + + const result = getCertificateContent(dataUri); + + expect(result).toBe(testCert); +}); + +test("getCertificateContent should decode URL-encoded data URI correctly", () => { + const testCert = + "-----BEGIN CERTIFICATE-----\nMIIC...\n-----END CERTIFICATE-----"; + const encodedData = encodeURIComponent(testCert); + const dataUri = `data:text/plain,${encodedData}`; + + const result = getCertificateContent(dataUri); + + expect(result).toBe(testCert); +}); + +test("getCertificateContent should handle plain text data URI correctly", () => { + const testCert = "simple-cert-content"; + const dataUri = `data:text/plain,${testCert}`; + + const result = getCertificateContent(dataUri); + + expect(result).toBe(testCert); +}); + +test("getCertificateContent should read file when input is a file path", () => { + const filePath = "/path/to/cert.pem"; + const expectedContent = + "-----BEGIN CERTIFICATE-----\nfile content\n-----END CERTIFICATE-----"; + + mockReadFileSync.mockReturnValue(expectedContent); + + const result = getCertificateContent(filePath); + + expect(mockReadFileSync).toHaveBeenCalledWith(filePath, "utf8"); + expect(result).toBe(expectedContent); +}); + +test("getCertificateContent should handle data URI with different media types", () => { + const testData = "certificate-data"; + const base64Data = Buffer.from(testData, "utf8").toString("base64"); + const dataUri = `data:application/x-x509-ca-cert;base64,${base64Data}`; + + const result = getCertificateContent(dataUri); + + expect(result).toBe(testData); +}); + +test("getCertificateContent should handle data URI without media type", () => { + const testData = "simple-data"; + const base64Data = Buffer.from(testData, "utf8").toString("base64"); + const dataUri = `data:;base64,${base64Data}`; + + const result = getCertificateContent(dataUri); + + expect(result).toBe(testData); +}); + +test("getCertificateContent should handle data URI without media type or encoding", () => { + const testData = "simple-data"; + const base64Data = Buffer.from(testData, "utf8").toString("base64"); + const dataUri = `data:;base64,${base64Data}`; + + const result = getCertificateContent(dataUri); + + expect(result).toBe(testData); +}); + +test("getCertificateContent should handle relative file paths", () => { + const filePath = "./certs/ca.pem"; + const expectedContent = "certificate from relative path"; + + mockReadFileSync.mockReturnValue(expectedContent); + + const result = getCertificateContent(filePath); + + expect(mockReadFileSync).toHaveBeenCalledWith(filePath, "utf8"); + expect(result).toBe(expectedContent); +}); + +test("getCertificateContent should handle data URI with special characters in URL encoding", () => { + const testCert = "cert with spaces and special chars: !@#$%"; + const encodedData = encodeURIComponent(testCert); + const dataUri = `data:text/plain,${encodedData}`; + + const result = getCertificateContent(dataUri); + + expect(result).toBe(testCert); +}); + +test("CertsCache.getCachedCustomCert should cache and return certificate content", async () => { + const certsCache = CertsCache.getInstance(); + const filePath = "/path/to/custom/cert.pem"; + const expectedContent = "custom cert content"; + + mockReadFileSync.mockReturnValue(expectedContent); + + const cert1 = await certsCache.getCachedCustomCert(filePath); + expect(cert1).toBe(expectedContent); + expect(mockReadFileSync).toHaveBeenCalledTimes(1); + expect(mockReadFileSync).toHaveBeenCalledWith(filePath, "utf8"); + + // Call again to check if it's cached + const cert2 = await certsCache.getCachedCustomCert(filePath); + expect(cert2).toBe(expectedContent); + // readFileSync should not be called again + expect(mockReadFileSync).toHaveBeenCalledTimes(1); +}); + +test("CertsCache.getAllCachedCustomCerts should return all cached custom certs", async () => { + const certsCache = CertsCache.getInstance(); + const filePaths = ["/path/to/cert1.pem", "/path/to/cert2.pem"]; + const expectedContent1 = "content of cert1"; + const expectedContent2 = "content of cert2"; + + mockReadFileSync.mockReturnValueOnce(expectedContent1); + mockReadFileSync.mockReturnValueOnce(expectedContent2); + + const certs = await certsCache.getAllCachedCustomCerts(filePaths); + expect(certs).toEqual([expectedContent1, expectedContent2]); + expect(mockReadFileSync).toHaveBeenCalledTimes(2); +}); + +test("CertsCache.getCa should return combined CA when caBundlePath is provided", async () => { + const certsCache = CertsCache.getInstance(); + const fixedCa = ["fixed CA cert"]; + const customCertPath = "/path/to/custom/cert.pem"; + const customCertContent = "custom cert content"; + + // Directly set _fixedCa to avoid initializing it with real data + // eslint-disable-next-line @typescript-eslint/ban-ts-comment + // @ts-ignore + certsCache._fixedCa = fixedCa; + // eslint-disable-next-line @typescript-eslint/ban-ts-comment + // @ts-ignore + certsCache._initialized = true; + mockReadFileSync.mockReturnValue(customCertContent); + + const ca = await certsCache.getCa(customCertPath); + expect(ca).toEqual([...fixedCa, customCertContent]); +}); + +test("CertsCache.clear should clear custom certs and reset initialized flag", () => { + const certsCache = CertsCache.getInstance(); + // eslint-disable-next-line @typescript-eslint/ban-ts-comment + // @ts-ignore + certsCache._customCerts.set("key", "value"); + // eslint-disable-next-line @typescript-eslint/ban-ts-comment + // @ts-ignore + certsCache._initialized = true; + // eslint-disable-next-line @typescript-eslint/ban-ts-comment + // @ts-ignore + certsCache._fixedCa = ["test"]; + + certsCache.clear(); + + // eslint-disable-next-line @typescript-eslint/ban-ts-comment + // @ts-ignore + expect(certsCache._customCerts.size).toBe(0); + // eslint-disable-next-line @typescript-eslint/ban-ts-comment + // @ts-ignore + expect(certsCache._initialized).toBe(false); + // eslint-disable-next-line @typescript-eslint/ban-ts-comment + // @ts-ignore + expect(certsCache._fixedCa).toEqual([]); +}); diff --git a/packages/fetch/src/certs.ts b/packages/fetch/src/certs.ts new file mode 100644 index 000000000..4793e36b7 --- /dev/null +++ b/packages/fetch/src/certs.ts @@ -0,0 +1,129 @@ +import { globalAgent } from "https"; +import * as fs from "node:fs"; +import tls from "node:tls"; + +/** + * Extracts content from either a file path or data URI + */ +export function getCertificateContent(input: string): string { + if (input.startsWith("data:")) { + // Parse data URI: data:[][;base64], + const [header, data] = input.split(","); + if (header.includes("base64")) { + return Buffer.from(data, "base64").toString("utf8"); + } else { + return decodeURIComponent(data); + } + } else { + // Assume it's a file path + return fs.readFileSync(input, "utf8"); + } +} + +export class CertsCache { + private static instance: CertsCache; + private _fixedCa: string[] = []; + private _initialized: boolean = false; + private _customCerts: Map = new Map(); + + private constructor() {} + + public static getInstance(): CertsCache { + if (!CertsCache.instance) { + CertsCache.instance = new CertsCache(); + } + return CertsCache.instance; + } + + get fixedCa(): string[] { + if (this._initialized) { + return this._fixedCa; + } + + const globalCerts: string[] = []; + if (Boolean(process.env.IS_BINARY)) { + if (Array.isArray(globalAgent.options.ca)) { + globalCerts.push( + ...globalAgent.options.ca.map((cert) => cert.toString()), + ); + } else if (typeof globalAgent.options.ca !== "undefined") { + globalCerts.push(globalAgent.options.ca.toString()); + } + } + + const extraCerts: string[] = []; + if (process.env.NODE_EXTRA_CA_CERTS) { + try { + const content = fs.readFileSync( + process.env.NODE_EXTRA_CA_CERTS, + "utf8", + ); + extraCerts.push(content); + } catch (error) { + if (process.env.VERBOSE_FETCH) { + console.error( + `Error reading NODE_EXTRA_CA_CERTS file: ${process.env.NODE_EXTRA_CA_CERTS}`, + error, + ); + } + } + } + + this._fixedCa = Array.from( + new Set([...tls.rootCertificates, ...globalCerts, ...extraCerts]), + ); + this._initialized = true; + return this._fixedCa; + } + + async getCachedCustomCert(path: string): Promise { + if (this._customCerts.has(path)) { + return this._customCerts.get(path); + } + const certContent = getCertificateContent(path); + this._customCerts.set(path, certContent); + return certContent; + } + + async getAllCachedCustomCerts( + caBundlePath: string[] | string, + ): Promise { + const paths = Array.isArray(caBundlePath) ? caBundlePath : [caBundlePath]; + const certs: string[] = []; + await Promise.all( + paths.map(async (path) => { + try { + const certContent = await this.getCachedCustomCert(path); + if (certContent) { + certs.push(certContent); + } else if (process.env.VERBOSE_FETCH) { + console.warn(`Empty certificate found at ${path}`); + } + } catch (error) { + if (process.env.VERBOSE_FETCH) { + console.error( + `Error loading custom certificate from ${path}:`, + error, + ); + } + } + }), + ); + return certs; + } + + async getCa(caBundlePath: undefined | string | string[]): Promise { + if (!caBundlePath) { + return this.fixedCa; + } + + const customCerts = await this.getAllCachedCustomCerts(caBundlePath); + return [...this.fixedCa, ...customCerts]; + } + + async clear(): Promise { + this._customCerts.clear(); + this._initialized = false; + this._fixedCa = []; + } +} diff --git a/packages/fetch/src/fetch.test.ts b/packages/fetch/src/fetch.test.ts deleted file mode 100644 index c11e0ed2c..000000000 --- a/packages/fetch/src/fetch.test.ts +++ /dev/null @@ -1,173 +0,0 @@ -import { globalAgent } from "https"; -import * as fs from "node:fs"; -import * as os from "node:os"; -import * as path from "node:path"; -import { afterEach, beforeEach, expect, test } from "vitest"; -import { getAgentOptions } from "./getAgentOptions.js"; - -// Store original env -const originalEnv = process.env; -const originalGlobalAgentOptions = { ...globalAgent.options }; - -// Temporary directory for test certificate files -let tempDir: string; - -beforeEach(() => { - // Create a temporary directory for test files - tempDir = fs.mkdtempSync(path.join(os.tmpdir(), "fetch-test-")); - - process.env = { ...originalEnv }; - - // Reset globalAgent for each test - globalAgent.options = { ...originalGlobalAgentOptions }; -}); - -afterEach(() => { - process.env = originalEnv; - globalAgent.options = originalGlobalAgentOptions; - - // Clean up temporary directory - try { - fs.rmSync(tempDir, { recursive: true, force: true }); - } catch (error) { - console.error(`Failed to remove temp directory: ${error}`); - } -}); - -// Helper function to create test certificate files -function createTestCertFile(filename: string, content: string): string { - const filePath = path.join(tempDir, filename); - fs.writeFileSync(filePath, content, "utf8"); - return filePath; -} - -test("getAgentOptions returns basic configuration with default values", () => { - const options = getAgentOptions(); - - // Check default timeout (7200 seconds = 2 hours = 7,200,000 ms) - expect(options.timeout).toBe(7200000); - expect(options.sessionTimeout).toBe(7200000); - expect(options.keepAliveMsecs).toBe(7200000); - expect(options.keepAlive).toBe(true); - - // Verify certificates array exists and contains items - expect(options.ca).toBeInstanceOf(Array); - expect(options.ca.length).toBeGreaterThan(0); - - // Verify at least one of the real TLS root certificates is included - // This assumes there's at least one certificate with "CERTIFICATE" in it - expect(options.ca.some((cert: any) => cert.includes("CERTIFICATE"))).toBe( - true, - ); -}); - -test("getAgentOptions respects custom timeout", () => { - const customTimeout = 300; // 5 minutes - const options = getAgentOptions({ timeout: customTimeout }); - - // Check timeout values (300 seconds = 300,000 ms) - expect(options.timeout).toBe(300000); - expect(options.sessionTimeout).toBe(300000); - expect(options.keepAliveMsecs).toBe(300000); -}); - -test("getAgentOptions uses verifySsl setting", () => { - // With verifySsl true - let options = getAgentOptions({ verifySsl: true }); - expect(options.rejectUnauthorized).toBe(true); - - // With verifySsl false - options = getAgentOptions({ verifySsl: false }); - expect(options.rejectUnauthorized).toBe(false); -}); - -test("getAgentOptions incorporates custom CA bundle paths", () => { - // Create a test CA bundle file - const caBundleContent = - "-----BEGIN CERTIFICATE-----\nMIIDtTCCAp2gAwIBAgIJAMcuSp7chAYdMA==\n-----END CERTIFICATE-----"; - const caBundlePath = createTestCertFile("ca-bundle.pem", caBundleContent); - - // Single string path - let options = getAgentOptions({ caBundlePath }); - - // Verify that our test certificate is included in the CA list - expect(options.ca).toContain(caBundleContent); - - // Create multiple test CA bundle files - const caContent1 = - "-----BEGIN CERTIFICATE-----\nABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789\n-----END CERTIFICATE-----"; - const caContent2 = - "-----BEGIN CERTIFICATE-----\n0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ\n-----END CERTIFICATE-----"; - const caPath1 = createTestCertFile("ca1.pem", caContent1); - const caPath2 = createTestCertFile("ca2.pem", caContent2); - - // Array of paths - options = getAgentOptions({ - caBundlePath: [caPath1, caPath2], - }); - - // Verify that both test certificates are included in the CA list - expect(options.ca).toContain(caContent1); - expect(options.ca).toContain(caContent2); -}); - -test("getAgentOptions includes global certs when running as binary", () => { - // Set up test certs in globalAgent - globalAgent.options.ca = ["global-cert-1", "global-cert-2"]; - - // Set IS_BINARY environment variable - process.env.IS_BINARY = "true"; - - const options = getAgentOptions(); - - // Test for global certs - expect(options.ca).toContain("global-cert-1"); - expect(options.ca).toContain("global-cert-2"); -}); - -test("getAgentOptions handles client certificate configuration", () => { - // Create test certificate files - const clientCertContent = - "-----BEGIN CERTIFICATE-----\nCLIENTCERT\n-----END CERTIFICATE-----"; - const clientKeyContent = - "-----BEGIN PRIVATE KEY-----\nCLIENTKEY\n-----END PRIVATE KEY-----"; - const certPath = createTestCertFile("client.cert", clientCertContent); - const keyPath = createTestCertFile("client.key", clientKeyContent); - - const clientCertOptions = { - clientCertificate: { - cert: certPath, - key: keyPath, - passphrase: "secret-passphrase", - }, - }; - - const options = getAgentOptions(clientCertOptions); - - expect(options.cert).toBe(clientCertContent); - expect(options.key).toBe(clientKeyContent); - expect(options.passphrase).toBe("secret-passphrase"); -}); - -test("getAgentOptions handles client certificate without passphrase", () => { - // Create test certificate files - const clientCertContent = - "-----BEGIN CERTIFICATE-----\nCLIENTCERT2\n-----END CERTIFICATE-----"; - const clientKeyContent = - "-----BEGIN PRIVATE KEY-----\nCLIENTKEY2\n-----END PRIVATE KEY-----"; - const certPath = createTestCertFile("client2.cert", clientCertContent); - const keyPath = createTestCertFile("client2.key", clientKeyContent); - - const clientCertOptions = { - clientCertificate: { - cert: certPath, - key: keyPath, - }, - }; - - const options = getAgentOptions(clientCertOptions); - - expect(options.cert).toBe(clientCertContent); - expect(options.key).toBe(clientKeyContent); - expect(options.passphrase).toBeUndefined(); -}); diff --git a/packages/fetch/src/fetch.ts b/packages/fetch/src/fetch.ts index 3b145012f..f0104c581 100644 --- a/packages/fetch/src/fetch.ts +++ b/packages/fetch/src/fetch.ts @@ -4,8 +4,8 @@ import { HttpProxyAgent } from "http-proxy-agent"; import { HttpsProxyAgent } from "https-proxy-agent"; import { BodyInit, RequestInit, Response } from "node-fetch"; import { getAgentOptions } from "./getAgentOptions.js"; -import fetch from "./node-fetch-patch.js"; -import { getProxyFromEnv, shouldBypassProxy } from "./util.js"; +import patchedFetch from "./node-fetch-patch.js"; +import { getProxy, shouldBypassProxy } from "./util.js"; const { http, https } = (followRedirects as any).default; @@ -89,18 +89,13 @@ export async function fetchwithRequestOptions( url.host = "127.0.0.1"; } - const agentOptions = getAgentOptions(requestOptions); + const agentOptions = await getAgentOptions(requestOptions); // Get proxy from options or environment variables - let proxy = requestOptions?.proxy; - if (!proxy) { - proxy = getProxyFromEnv(url.protocol); - } + const proxy = getProxy(url.protocol, requestOptions); // Check if should bypass proxy based on requestOptions or NO_PROXY env var - const shouldBypass = - requestOptions?.noProxy?.includes(url.hostname) || - shouldBypassProxy(url.hostname); + const shouldBypass = shouldBypassProxy(url.hostname, requestOptions); // Create agent const protocol = url.protocol === "https:" ? https : http; @@ -149,7 +144,7 @@ export async function fetchwithRequestOptions( // fetch the request with the provided options try { - const resp = await fetch(url, { + const resp = await patchedFetch(url, { ...init, body: finalBody, headers: headers, diff --git a/packages/fetch/src/getAgentOptions.test.ts b/packages/fetch/src/getAgentOptions.test.ts index 5b589ea85..e5e4dd549 100644 --- a/packages/fetch/src/getAgentOptions.test.ts +++ b/packages/fetch/src/getAgentOptions.test.ts @@ -1,122 +1,189 @@ +import { globalAgent } from "https"; import * as fs from "node:fs"; -import { expect, test, vi } from "vitest"; +import * as os from "node:os"; +import * as path from "node:path"; +import { afterEach, beforeEach, expect, test } from "vitest"; +import { CertsCache } from "./certs.js"; +import { getAgentOptions } from "./getAgentOptions.js"; -// Mock fs module -vi.mock("node:fs", () => ({ - readFileSync: vi.fn(), -})); +// Store original env +const originalEnv = process.env; +const originalGlobalAgentOptions = { ...globalAgent.options }; -const mockReadFileSync = vi.mocked(fs.readFileSync); +// Temporary directory for test certificate files +let tempDir: string; -// We need to access the private getCertificateContent function for testing -// Since it's not exported, we'll test it indirectly through scenarios or mock the module -const getCertificateContent = (input: string): string => { - if (input.startsWith("data:")) { - // Parse data URI: data:[][;base64], - const [header, data] = input.split(","); - if (header.includes("base64")) { - return Buffer.from(data, "base64").toString("utf8"); - } else { - return decodeURIComponent(data); - } - } else { - // Assume it's a file path - return fs.readFileSync(input, "utf8"); +beforeEach(() => { + // Create a temporary directory for test files + tempDir = fs.mkdtempSync(path.join(os.tmpdir(), "fetch-test-")); + + process.env = { ...originalEnv }; + + // Reset globalAgent for each test + globalAgent.options = { ...originalGlobalAgentOptions }; +}); + +afterEach(() => { + process.env = originalEnv; + globalAgent.options = originalGlobalAgentOptions; + + CertsCache.getInstance().clear(); + + // Clean up temporary directory + try { + fs.rmSync(tempDir, { recursive: true, force: true }); + } catch (error) { + console.error(`Failed to remove temp directory: ${error}`); } -}; - -test("getCertificateContent should decode base64 data URI correctly", () => { - const testCert = - "-----BEGIN CERTIFICATE-----\nMIIC...\n-----END CERTIFICATE-----"; - const base64Data = Buffer.from(testCert, "utf8").toString("base64"); - const dataUri = `data:application/x-pem-file;base64,${base64Data}`; - - const result = getCertificateContent(dataUri); - - expect(result).toBe(testCert); }); -test("getCertificateContent should decode URL-encoded data URI correctly", () => { - const testCert = - "-----BEGIN CERTIFICATE-----\nMIIC...\n-----END CERTIFICATE-----"; - const encodedData = encodeURIComponent(testCert); - const dataUri = `data:text/plain,${encodedData}`; +// Helper function to create test certificate files +function createTestCertFile(filename: string, content: string): string { + const filePath = path.join(tempDir, filename); + fs.writeFileSync(filePath, content, "utf8"); + return filePath; +} - const result = getCertificateContent(dataUri); +test("getAgentOptions returns basic configuration with default values", async () => { + const options = await getAgentOptions(); - expect(result).toBe(testCert); + // Check default timeout (7200 seconds = 2 hours = 7,200,000 ms) + expect(options.timeout).toBe(7200000); + expect(options.sessionTimeout).toBe(7200000); + expect(options.keepAliveMsecs).toBe(7200000); + expect(options.keepAlive).toBe(true); + + // Verify certificates array exists and contains items + expect(options.ca).toBeInstanceOf(Array); + expect(options.ca.length).toBeGreaterThan(0); + + // Verify at least one of the real TLS root certificates is included + // This assumes there's at least one certificate with "CERTIFICATE" in it + expect(options.ca.some((cert: any) => cert.includes("CERTIFICATE"))).toBe( + true, + ); }); -test("getCertificateContent should handle plain text data URI correctly", () => { - const testCert = "simple-cert-content"; - const dataUri = `data:text/plain,${testCert}`; +test("getAgentOptions respects custom timeout", async () => { + const customTimeout = 300; // 5 minutes + const options = await getAgentOptions({ timeout: customTimeout }); - const result = getCertificateContent(dataUri); - - expect(result).toBe(testCert); + // Check timeout values (300 seconds = 300,000 ms) + expect(options.timeout).toBe(300000); + expect(options.sessionTimeout).toBe(300000); + expect(options.keepAliveMsecs).toBe(300000); }); -test("getCertificateContent should read file when input is a file path", () => { - const filePath = "/path/to/cert.pem"; - const expectedContent = - "-----BEGIN CERTIFICATE-----\nfile content\n-----END CERTIFICATE-----"; +test("getAgentOptions uses verifySsl setting", async () => { + // With verifySsl true + let options = await getAgentOptions({ verifySsl: true }); + expect(options.rejectUnauthorized).toBe(true); - mockReadFileSync.mockReturnValue(expectedContent); - - const result = getCertificateContent(filePath); - - expect(mockReadFileSync).toHaveBeenCalledWith(filePath, "utf8"); - expect(result).toBe(expectedContent); + // With verifySsl false + options = await getAgentOptions({ verifySsl: false }); + expect(options.rejectUnauthorized).toBe(false); }); -test("getCertificateContent should handle data URI with different media types", () => { - const testData = "certificate-data"; - const base64Data = Buffer.from(testData, "utf8").toString("base64"); - const dataUri = `data:application/x-x509-ca-cert;base64,${base64Data}`; +test("getAgentOptions incorporates custom CA bundle paths", async () => { + // Create a test CA bundle file + const caBundleContent = + "-----BEGIN CERTIFICATE-----\nMIIDtTCCAp2gAwIBAgIJAMcuSp7chAYdMA==\n-----END CERTIFICATE-----"; + const caBundlePath = createTestCertFile("ca-bundle.pem", caBundleContent); - const result = getCertificateContent(dataUri); + // Single string path + let options = await getAgentOptions({ caBundlePath }); - expect(result).toBe(testData); + // Verify that our test certificate is included in the CA list + expect(options.ca).toContain(caBundleContent); + + // Create multiple test CA bundle files + const caContent1 = + "-----BEGIN CERTIFICATE-----\nABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789\n-----END CERTIFICATE-----"; + const caContent2 = + "-----BEGIN CERTIFICATE-----\n0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ\n-----END CERTIFICATE-----"; + const caPath1 = createTestCertFile("ca1.pem", caContent1); + const caPath2 = createTestCertFile("ca2.pem", caContent2); + + // Array of paths + options = await getAgentOptions({ + caBundlePath: [caPath1, caPath2], + }); + + // Verify that both test certificates are included in the CA list + expect(options.ca).toContain(caContent1); + expect(options.ca).toContain(caContent2); }); -test("getCertificateContent should handle data URI without media type", () => { - const testData = "simple-data"; - const base64Data = Buffer.from(testData, "utf8").toString("base64"); - const dataUri = `data:;base64,${base64Data}`; +test("getAgentOptions includes global certs when running as binary", async () => { + // Set up test certs in globalAgent + globalAgent.options.ca = ["global-cert-1", "global-cert-2"]; - const result = getCertificateContent(dataUri); + // Set IS_BINARY environment variable + process.env.IS_BINARY = "true"; - expect(result).toBe(testData); + const options = await getAgentOptions(); + + // Test for global certs + expect(options.ca).toContain("global-cert-1"); + expect(options.ca).toContain("global-cert-2"); }); -test("getCertificateContent should handle data URI without media type or encoding", () => { - const testData = "simple-data"; - const base64Data = Buffer.from(testData, "utf8").toString("base64"); - const dataUri = `data:;base64,${base64Data}`; +test("getAgentOptions handles client certificate configuration", async () => { + // Create test certificate files + const clientCertContent = + "-----BEGIN CERTIFICATE-----\nCLIENTCERT\n-----END CERTIFICATE-----"; + const clientKeyContent = + "-----BEGIN PRIVATE KEY-----\nCLIENTKEY\n-----END PRIVATE KEY-----"; + const certPath = createTestCertFile("client.cert", clientCertContent); + const keyPath = createTestCertFile("client.key", clientKeyContent); - const result = getCertificateContent(dataUri); + const clientCertOptions = { + clientCertificate: { + cert: certPath, + key: keyPath, + passphrase: "secret-passphrase", + }, + }; - expect(result).toBe(testData); + const options = await getAgentOptions(clientCertOptions); + + expect(options.cert).toBe(clientCertContent); + expect(options.key).toBe(clientKeyContent); + expect(options.passphrase).toBe("secret-passphrase"); }); -test("getCertificateContent should handle relative file paths", () => { - const filePath = "./certs/ca.pem"; - const expectedContent = "certificate from relative path"; +test("getAgentOptions handles client certificate without passphrase", async () => { + // Create test certificate files + const clientCertContent = + "-----BEGIN CERTIFICATE-----\nCLIENTCERT2\n-----END CERTIFICATE-----"; + const clientKeyContent = + "-----BEGIN PRIVATE KEY-----\nCLIENTKEY2\n-----END PRIVATE KEY-----"; + const certPath = createTestCertFile("client2.cert", clientCertContent); + const keyPath = createTestCertFile("client2.key", clientKeyContent); - mockReadFileSync.mockReturnValue(expectedContent); + const clientCertOptions = { + clientCertificate: { + cert: certPath, + key: keyPath, + }, + }; - const result = getCertificateContent(filePath); + const options = await getAgentOptions(clientCertOptions); - expect(mockReadFileSync).toHaveBeenCalledWith(filePath, "utf8"); - expect(result).toBe(expectedContent); + expect(options.cert).toBe(clientCertContent); + expect(options.key).toBe(clientKeyContent); + expect(options.passphrase).toBeUndefined(); }); -test("getCertificateContent should handle data URI with special characters in URL encoding", () => { - const testCert = "cert with spaces and special chars: !@#$%"; - const encodedData = encodeURIComponent(testCert); - const dataUri = `data:text/plain,${encodedData}`; +test("getAgentOptions reads NODE_EXTRA_CA_CERTS", async () => { + const extraCertContent = + "-----BEGIN CERTIFICATE-----\nEXTRA_CERT\n-----END CERTIFICATE-----"; + const certPath = createTestCertFile("extra-cert.cert", extraCertContent); - const result = getCertificateContent(dataUri); + expect(CertsCache.getInstance().fixedCa).not.toContain(extraCertContent); - expect(result).toBe(testCert); + CertsCache.getInstance().clear(); + + process.env.NODE_EXTRA_CA_CERTS = certPath; + expect(CertsCache.getInstance().fixedCa).toContain(extraCertContent); }); diff --git a/packages/fetch/src/getAgentOptions.ts b/packages/fetch/src/getAgentOptions.ts index 20fc7641c..2cdc1dbae 100644 --- a/packages/fetch/src/getAgentOptions.ts +++ b/packages/fetch/src/getAgentOptions.ts @@ -1,56 +1,19 @@ -import { globalAgent } from "https"; -import * as fs from "node:fs"; -import tls from "node:tls"; - import { RequestOptions } from "@continuedev/config-types"; - -/** - * Extracts content from either a file path or data URI - */ -function getCertificateContent(input: string): string { - if (input.startsWith("data:")) { - // Parse data URI: data:[][;base64], - const [header, data] = input.split(","); - if (header.includes("base64")) { - return Buffer.from(data, "base64").toString("utf8"); - } else { - return decodeURIComponent(data); - } - } else { - // Assume it's a file path - return fs.readFileSync(input, "utf8"); - } -} +import { CertsCache, getCertificateContent } from "./certs.js"; /** * Prepares agent options based on request options and certificates */ -export function getAgentOptions(requestOptions?: RequestOptions): { +export async function getAgentOptions( + requestOptions?: RequestOptions, +): Promise<{ [key: string]: any; -} { +}> { const TIMEOUT = 7200; // 7200 seconds = 2 hours const timeout = (requestOptions?.timeout ?? TIMEOUT) * 1000; // measured in ms - // Get root certificates - let globalCerts: string[] = []; - if (process.env.IS_BINARY) { - if (Array.isArray(globalAgent.options.ca)) { - globalCerts = [...globalAgent.options.ca.map((cert) => cert.toString())]; - } else if (typeof globalAgent.options.ca !== "undefined") { - globalCerts.push(globalAgent.options.ca.toString()); - } - } - - const ca = Array.from(new Set([...tls.rootCertificates, ...globalCerts])); - const customCerts = - typeof requestOptions?.caBundlePath === "string" - ? [requestOptions?.caBundlePath] - : requestOptions?.caBundlePath; - if (customCerts) { - ca.push( - ...customCerts.map((customCert) => getCertificateContent(customCert)), - ); - } + const certsCache = CertsCache.getInstance(); + const ca = await certsCache.getCa(requestOptions?.caBundlePath); const agentOptions: { [key: string]: any } = { ca, @@ -73,5 +36,21 @@ export function getAgentOptions(requestOptions?: RequestOptions): { } } + if (process.env.VERBOSE_FETCH) { + console.log(`Fetch agent options:`); + console.log( + `\tTimeout (sessionTimeout/keepAliveMsecs): ${agentOptions.timeout}`, + ); + console.log(`\tTotal CA certs: ${ca.length}`); + console.log(`\tGlobal/Root CA certs: ${certsCache.fixedCa.length}`); + console.log(`\tCustom CA certs: ${ca.length - certsCache.fixedCa.length}`); + console.log( + `\tClient certificate: ${requestOptions?.clientCertificate ? "Yes" : "No"}`, + ); + console.log( + `\trejectUnauthorized/verifySsl: ${agentOptions.rejectUnauthorized ?? "not set (defaults to true)"}`, + ); + } + return agentOptions; } diff --git a/packages/fetch/src/index.ts b/packages/fetch/src/index.ts index ca0055148..6cb7f55df 100644 --- a/packages/fetch/src/index.ts +++ b/packages/fetch/src/index.ts @@ -5,10 +5,13 @@ import { toAsyncIterable, } from "./stream.js"; +import patchedFetch from "./node-fetch-patch.js"; + import { fetchwithRequestOptions } from "./fetch.js"; export { fetchwithRequestOptions, + patchedFetch, streamJSON, streamResponse, streamSse, diff --git a/packages/fetch/src/util.test.ts b/packages/fetch/src/util.test.ts index 934f1a735..35c079b01 100644 --- a/packages/fetch/src/util.test.ts +++ b/packages/fetch/src/util.test.ts @@ -1,5 +1,9 @@ import { afterEach, expect, test, vi } from "vitest"; -import { getProxyFromEnv, shouldBypassProxy } from "./util.js"; +import { + getProxyFromEnv, + patternMatchesHostname, + shouldBypassProxy, +} from "./util.js"; // Reset environment variables after each test afterEach(() => { @@ -52,51 +56,159 @@ test("getProxyFromEnv prefers HTTPS_PROXY over other env vars for https protocol expect(getProxyFromEnv("https:")).toBe("https://preferred.example.com"); }); +// Tests for patternMatchesHostname +test("patternMatchesHostname with exact hostname match", () => { + expect(patternMatchesHostname("example.com", "example.com")).toBe(true); + expect(patternMatchesHostname("example.com", "different.com")).toBe(false); +}); + +test("patternMatchesHostname with wildcard domains", () => { + expect(patternMatchesHostname("sub.example.com", "*.example.com")).toBe(true); + expect(patternMatchesHostname("sub.sub.example.com", "*.example.com")).toBe( + true, + ); + expect(patternMatchesHostname("example.com", "*.example.com")).toBe(false); + expect(patternMatchesHostname("sub.different.com", "*.example.com")).toBe( + false, + ); +}); + +test("patternMatchesHostname with domain suffix", () => { + expect(patternMatchesHostname("sub.example.com", ".example.com")).toBe(true); + expect(patternMatchesHostname("example.com", ".example.com")).toBe(true); + expect(patternMatchesHostname("different.com", ".example.com")).toBe(false); +}); + +test("patternMatchesHostname with case insensitivity", () => { + expect(patternMatchesHostname("EXAMPLE.com", "example.COM")).toBe(true); + expect(patternMatchesHostname("sub.EXAMPLE.com", "*.example.COM")).toBe(true); +}); + +// Port handling tests +test("patternMatchesHostname with exact port match", () => { + expect(patternMatchesHostname("example.com:8080", "example.com:8080")).toBe( + true, + ); + expect(patternMatchesHostname("example.com:8080", "example.com:9090")).toBe( + false, + ); +}); + +test("patternMatchesHostname with port in pattern but not in hostname", () => { + expect(patternMatchesHostname("example.com", "example.com:8080")).toBe(false); +}); + +test("patternMatchesHostname with port in hostname but not in pattern", () => { + expect(patternMatchesHostname("example.com:8080", "example.com")).toBe(true); +}); + +test("patternMatchesHostname with wildcard domains and ports", () => { + expect( + patternMatchesHostname("sub.example.com:8080", "*.example.com:8080"), + ).toBe(true); + expect( + patternMatchesHostname("sub.example.com:9090", "*.example.com:8080"), + ).toBe(false); + expect(patternMatchesHostname("sub.example.com", "*.example.com:8080")).toBe( + false, + ); +}); + +test("patternMatchesHostname with domain suffix and ports", () => { + expect( + patternMatchesHostname("sub.example.com:8080", ".example.com:8080"), + ).toBe(true); + expect(patternMatchesHostname("example.com:8080", ".example.com:8080")).toBe( + true, + ); + expect( + patternMatchesHostname("sub.example.com:9090", ".example.com:8080"), + ).toBe(false); +}); + // Tests for shouldBypassProxy test("shouldBypassProxy returns false when NO_PROXY is not set", () => { - expect(shouldBypassProxy("example.com")).toBe(false); + expect(shouldBypassProxy("example.com", undefined)).toBe(false); }); test("shouldBypassProxy returns true for exact hostname match", () => { process.env.NO_PROXY = "example.com,another.com"; - expect(shouldBypassProxy("example.com")).toBe(true); + expect(shouldBypassProxy("example.com", undefined)).toBe(true); }); test("shouldBypassProxy returns false when hostname doesn't match any NO_PROXY entry", () => { process.env.NO_PROXY = "example.com,another.com"; - expect(shouldBypassProxy("different.com")).toBe(false); + expect(shouldBypassProxy("different.com", undefined)).toBe(false); }); test("shouldBypassProxy handles lowercase no_proxy", () => { process.env.no_proxy = "example.com"; - expect(shouldBypassProxy("example.com")).toBe(true); + expect(shouldBypassProxy("example.com", undefined)).toBe(true); }); test("shouldBypassProxy works with wildcard domains", () => { process.env.NO_PROXY = "*.example.com"; - expect(shouldBypassProxy("sub.example.com")).toBe(true); - expect(shouldBypassProxy("example.com")).toBe(false); - expect(shouldBypassProxy("different.com")).toBe(false); + expect(shouldBypassProxy("sub.example.com", undefined)).toBe(true); + expect(shouldBypassProxy("example.com", undefined)).toBe(false); + expect(shouldBypassProxy("different.com", undefined)).toBe(false); }); test("shouldBypassProxy works with domain suffix", () => { process.env.NO_PROXY = ".example.com"; - expect(shouldBypassProxy("sub.example.com")).toBe(true); - expect(shouldBypassProxy("example.com")).toBe(true); - expect(shouldBypassProxy("different.com")).toBe(false); + expect(shouldBypassProxy("sub.example.com", undefined)).toBe(true); + expect(shouldBypassProxy("example.com", undefined)).toBe(true); + expect(shouldBypassProxy("different.com", undefined)).toBe(false); }); test("shouldBypassProxy handles multiple entries with different patterns", () => { process.env.NO_PROXY = "internal.local,*.example.com,.test.com"; - expect(shouldBypassProxy("internal.local")).toBe(true); - expect(shouldBypassProxy("sub.example.com")).toBe(true); - expect(shouldBypassProxy("sub.test.com")).toBe(true); - expect(shouldBypassProxy("test.com")).toBe(true); - expect(shouldBypassProxy("example.org")).toBe(false); + expect(shouldBypassProxy("internal.local", undefined)).toBe(true); + expect(shouldBypassProxy("sub.example.com", undefined)).toBe(true); + expect(shouldBypassProxy("sub.test.com", undefined)).toBe(true); + expect(shouldBypassProxy("test.com", undefined)).toBe(true); + expect(shouldBypassProxy("example.org", undefined)).toBe(false); }); test("shouldBypassProxy ignores whitespace in NO_PROXY", () => { process.env.NO_PROXY = " example.com , *.test.org "; - expect(shouldBypassProxy("example.com")).toBe(true); - expect(shouldBypassProxy("subdomain.test.org")).toBe(true); + expect(shouldBypassProxy("example.com", undefined)).toBe(true); + expect(shouldBypassProxy("subdomain.test.org", undefined)).toBe(true); +}); + +test("shouldBypassProxy with ports in NO_PROXY", () => { + process.env.NO_PROXY = "example.com:8080,*.test.org:443,.internal.net:8443"; + expect(shouldBypassProxy("example.com:8080", undefined)).toBe(true); + expect(shouldBypassProxy("example.com:9090", undefined)).toBe(false); + expect(shouldBypassProxy("sub.test.org:443", undefined)).toBe(true); + expect(shouldBypassProxy("sub.internal.net:8443", undefined)).toBe(true); + expect(shouldBypassProxy("internal.net:8443", undefined)).toBe(true); +}); + +test("shouldBypassProxy accepts options with noProxy patterns", () => { + const options = { noProxy: ["example.com:8080", "*.internal.net"] }; + expect(shouldBypassProxy("example.com:8080", options)).toBe(true); + expect(shouldBypassProxy("example.com", options)).toBe(false); + expect(shouldBypassProxy("server.internal.net", options)).toBe(true); +}); + +test("shouldBypassProxy combines environment and options noProxy patterns", () => { + process.env.NO_PROXY = "example.org,*.test.com"; + const options = { noProxy: ["example.com:8080", "*.internal.net"] }; + expect(shouldBypassProxy("example.org", options)).toBe(true); + expect(shouldBypassProxy("sub.test.com", options)).toBe(true); + expect(shouldBypassProxy("example.com:8080", options)).toBe(true); + expect(shouldBypassProxy("server.internal.net", options)).toBe(true); + expect(shouldBypassProxy("other.domain", options)).toBe(false); +}); + +test("shouldBypassProxy handles empty noProxy array in options", () => { + process.env.NO_PROXY = "example.org"; + const options = { noProxy: [] }; + expect(shouldBypassProxy("example.org", options)).toBe(true); + expect(shouldBypassProxy("different.com", options)).toBe(false); +}); + +test("shouldBypassProxy handles undefined options", () => { + process.env.NO_PROXY = "example.org"; + expect(shouldBypassProxy("example.org", undefined)).toBe(true); }); diff --git a/packages/fetch/src/util.ts b/packages/fetch/src/util.ts index 20e3c1181..dc302bf12 100644 --- a/packages/fetch/src/util.ts +++ b/packages/fetch/src/util.ts @@ -1,3 +1,5 @@ +import { RequestOptions } from "@continuedev/config-types"; + /** * Gets the proxy settings from environment variables * @param protocol The URL protocol (http: or https:) @@ -16,28 +18,91 @@ export function getProxyFromEnv(protocol: string): string | undefined { } } +// Note that request options proxy (per model) takes precedence over environment variables +export function getProxy( + protocol: string, + requestOptions?: RequestOptions, +): string | undefined { + if (requestOptions?.proxy) { + return requestOptions.proxy; + } + return getProxyFromEnv(protocol); +} + +export function getEnvNoProxyPatterns(): string[] { + const envValue = process.env.NO_PROXY || process.env.no_proxy; + if (envValue) { + return envValue + .split(",") + .map((item) => item.trim().toLowerCase()) + .filter((i) => !!i); + } else { + return []; + } +} + +export function getReqOptionsNoProxyPatterns( + options: RequestOptions | undefined, +): string[] { + return ( + options?.noProxy?.map((i) => i.trim().toLowerCase()).filter((i) => !!i) ?? + [] + ); +} + +export function patternMatchesHostname(hostname: string, pattern: string) { + // Split hostname and pattern to separate hostname and port + const [hostnameWithoutPort, hostnamePort] = hostname.toLowerCase().split(":"); + const [patternWithoutPort, patternPort] = pattern.toLowerCase().split(":"); + + // If pattern specifies a port but hostname doesn't match it, no match + if (patternPort && (!hostnamePort || hostnamePort !== patternPort)) { + return false; + } + + // Now compare just the hostname parts + + // exact match + if (patternWithoutPort === hostnameWithoutPort) { + return true; + } + // wildcard domain match (*.example.com) + if ( + patternWithoutPort.startsWith("*.") && + hostnameWithoutPort.endsWith(patternWithoutPort.substring(1)) + ) { + return true; + } + // Domain suffix match (.example.com) + if ( + patternWithoutPort.startsWith(".") && + hostnameWithoutPort.endsWith(patternWithoutPort.slice(1)) + ) { + return true; + } + + // TODO IP address ranges + + // TODO CIDR notation + + return false; +} + /** * Checks if a hostname should bypass proxy based on NO_PROXY environment variable * @param hostname The hostname to check * @returns True if the hostname should bypass proxy */ -export function shouldBypassProxy(hostname: string): boolean { - const noProxy = process.env.NO_PROXY || process.env.no_proxy; - if (!noProxy) return false; - - const noProxyItems = noProxy.split(",").map((item) => item.trim()); - - return noProxyItems.some((item) => { - // Exact match - if (item === hostname) return true; - - // Wildcard domain match (*.example.com) - if (item.startsWith("*.") && hostname.endsWith(item.substring(1))) - return true; - - // Domain suffix match (.example.com) - if (item.startsWith(".") && hostname.endsWith(item.slice(1))) return true; - - return false; - }); +export function shouldBypassProxy( + hostname: string, + requestOptions: RequestOptions | undefined, +): boolean { + const ignores = [ + ...getEnvNoProxyPatterns(), + ...getReqOptionsNoProxyPatterns(requestOptions), + ]; + const hostLowerCase = hostname.toLowerCase(); + return ignores.some((ignore) => + patternMatchesHostname(hostLowerCase, ignore), + ); } diff --git a/packages/llm-info/release.config.js b/packages/llm-info/release.config.js new file mode 100644 index 000000000..74bb5a2c6 --- /dev/null +++ b/packages/llm-info/release.config.js @@ -0,0 +1,3 @@ +import createReleaseConfig from "../shared-release.config.js"; + +export default createReleaseConfig("llm-info"); diff --git a/packages/openai-adapters/package-lock.json b/packages/openai-adapters/package-lock.json index 1d88a8b5e..0782d06d8 100644 --- a/packages/openai-adapters/package-lock.json +++ b/packages/openai-adapters/package-lock.json @@ -1,17 +1,17 @@ { "name": "@continuedev/openai-adapters", - "version": "1.0.36", + "version": "1.0.44", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@continuedev/openai-adapters", - "version": "1.0.36", + "version": "1.0.44", "license": "Apache-2.0", "dependencies": { "@continuedev/config-types": "^1.0.5", "@continuedev/config-yaml": "^1.0.51", - "@continuedev/fetch": "^1.0.11", + "@continuedev/fetch": "^1.0.15", "dotenv": "^16.5.0", "json-schema": "^0.4.0", "node-fetch": "^3.3.2", @@ -595,9 +595,10 @@ } }, "node_modules/@continuedev/fetch": { - "version": "1.0.11", - "resolved": "https://registry.npmjs.org/@continuedev/fetch/-/fetch-1.0.11.tgz", - "integrity": "sha512-GRYqAdV3DhRxg463zeSzOdVIk/bhjuuxAxzX0fG35Kz6sHUsU2wr7SDY91zO2ataYUkjnbOa3q1xIpnRnOoRHA==", + "version": "1.0.15", + "resolved": "https://registry.npmjs.org/@continuedev/fetch/-/fetch-1.0.15.tgz", + "integrity": "sha512-49jLwAwAOczcFLfa2Og9+c+qxrq+Z6+p+B5BbXgHENrQIsuST1liKTXEiga5gSVAyHD+m+1Ftl4jqRq2oxMngw==", + "license": "Apache-2.0", "dependencies": { "@continuedev/config-types": "^1.0.5", "follow-redirects": "^1.15.6", diff --git a/packages/openai-adapters/package.json b/packages/openai-adapters/package.json index 2b5043cfb..ed24b5ef8 100644 --- a/packages/openai-adapters/package.json +++ b/packages/openai-adapters/package.json @@ -1,6 +1,6 @@ { "name": "@continuedev/openai-adapters", - "version": "1.0.38", + "version": "1.0.44", "description": "", "main": "dist/index.js", "types": "dist/index.d.ts", @@ -14,7 +14,7 @@ "dependencies": { "@continuedev/config-types": "^1.0.5", "@continuedev/config-yaml": "^1.0.51", - "@continuedev/fetch": "^1.0.11", + "@continuedev/fetch": "^1.0.15", "dotenv": "^16.5.0", "json-schema": "^0.4.0", "node-fetch": "^3.3.2", diff --git a/packages/openai-adapters/release.config.js b/packages/openai-adapters/release.config.js new file mode 100644 index 000000000..6c1f5743a --- /dev/null +++ b/packages/openai-adapters/release.config.js @@ -0,0 +1,3 @@ +import createReleaseConfig from "../shared-release.config.js"; + +export default createReleaseConfig("openai-adapters"); diff --git a/packages/openai-adapters/src/apis/Azure.ts b/packages/openai-adapters/src/apis/Azure.ts index bbff66592..4d161c843 100644 --- a/packages/openai-adapters/src/apis/Azure.ts +++ b/packages/openai-adapters/src/apis/Azure.ts @@ -63,7 +63,11 @@ export class AzureApi extends OpenAIApi { "`env.apiVersion` is a required configuration property for Azure OpenAI", ); } - url.pathname = `${url.pathname}/openai/deployments/${config.env.deployment}`; + + const basePathname = `openai/deployments/${config.env.deployment}`; + + url.pathname = + url.pathname === "/" ? basePathname : `${url.pathname}/${basePathname}`; queryParams["api-version"] = config.env.apiVersion; } diff --git a/packages/openai-adapters/src/apis/Relace.ts b/packages/openai-adapters/src/apis/Relace.ts index f3e46fcfa..e983a9968 100644 --- a/packages/openai-adapters/src/apis/Relace.ts +++ b/packages/openai-adapters/src/apis/Relace.ts @@ -67,7 +67,6 @@ export class RelaceApi implements BaseLlmApi { body: ChatCompletionCreateParamsStreaming, signal: AbortSignal, ): AsyncGenerator { - const fetch = customFetch(this.config.requestOptions); const headers = { "Content-Type": "application/json", Authorization: `Bearer ${this.config.apiKey}`, @@ -98,7 +97,7 @@ export class RelaceApi implements BaseLlmApi { }; const url = this.apiBase + "code/apply"; - const response = await fetch(url, { + const response = await customFetch(this.config.requestOptions)(url, { method: "POST", headers, body: JSON.stringify(data), diff --git a/packages/openai-adapters/src/test/main.test.ts b/packages/openai-adapters/src/test/main.test.ts index 1d68a7782..2c8d779b9 100644 --- a/packages/openai-adapters/src/test/main.test.ts +++ b/packages/openai-adapters/src/test/main.test.ts @@ -173,4 +173,80 @@ describe("Configuration", () => { "https://api.example.com", ); }); + + it("should configure Azure OpenAI client with root URL and trailing slash", () => { + const azure = constructLlmApi({ + provider: "azure", + apiKey: "sk-xxx", + apiBase: "https://test-azure-openai.azure.com/", + env: { + deployment: "gpt-4.1", + apiType: "azure-openai", + apiVersion: "2023-05-15", + }, + }); + + // The Azure client modifies the baseURL to include the deployment + expect((azure as OpenAIApi).openai.baseURL).toBe( + "https://test-azure-openai.azure.com/openai/deployments/gpt-4.1", + ); + expect((azure as OpenAIApi).openai.apiKey).toBe("sk-xxx"); + }); + + it("should configure Azure OpenAI client with path and trailing slash", () => { + const azure = constructLlmApi({ + provider: "azure", + apiKey: "sk-xxx", + apiBase: "https://test-azure-openai.azure.com/v1/", + env: { + deployment: "gpt-4.1", + apiType: "azure-openai", + apiVersion: "2023-05-15", + }, + }); + + // The Azure client modifies the baseURL to include the deployment + expect((azure as OpenAIApi).openai.baseURL).toBe( + "https://test-azure-openai.azure.com/v1/openai/deployments/gpt-4.1", + ); + expect((azure as OpenAIApi).openai.apiKey).toBe("sk-xxx"); + }); + + it("should configure Azure OpenAI client with root URL and no trailing slash", () => { + const azure = constructLlmApi({ + provider: "azure", + apiKey: "sk-xxx", + apiBase: "https://test-azure-openai.azure.com", + env: { + deployment: "gpt-4.1", + apiType: "azure-openai", + apiVersion: "2023-05-15", + }, + }); + + // The Azure client modifies the baseURL to include the deployment + expect((azure as OpenAIApi).openai.baseURL).toBe( + "https://test-azure-openai.azure.com/openai/deployments/gpt-4.1", + ); + expect((azure as OpenAIApi).openai.apiKey).toBe("sk-xxx"); + }); + + it("should configure Azure OpenAI client with path and no trailing slash", () => { + const azure = constructLlmApi({ + provider: "azure", + apiKey: "sk-xxx", + apiBase: "https://test-azure-openai.azure.com/v1", + env: { + deployment: "gpt-4.1", + apiType: "azure-openai", + apiVersion: "2023-05-15", + }, + }); + + // The Azure client modifies the baseURL to include the deployment + expect((azure as OpenAIApi).openai.baseURL).toBe( + "https://test-azure-openai.azure.com/v1/openai/deployments/gpt-4.1", + ); + expect((azure as OpenAIApi).openai.apiKey).toBe("sk-xxx"); + }); }); diff --git a/packages/openai-adapters/src/util.ts b/packages/openai-adapters/src/util.ts index 3fd87e112..89c1ed5ad 100644 --- a/packages/openai-adapters/src/util.ts +++ b/packages/openai-adapters/src/util.ts @@ -1,11 +1,13 @@ import { RequestOptions } from "@continuedev/config-types"; -import { fetchwithRequestOptions } from "@continuedev/fetch"; +import { fetchwithRequestOptions, patchedFetch } from "@continuedev/fetch"; +import { type RequestInfo, type RequestInit } from "openai/_shims/index"; import { ChatCompletionChunk, CompletionUsage, CreateEmbeddingResponse, Model, } from "openai/resources/index"; + import { ChatCompletion } from "openai/src/resources/index.js"; import { CreateRerankResponse } from "./apis/base.js"; @@ -136,7 +138,17 @@ export function model(options: { id: string; owned_by?: string }): Model { }; } -export function customFetch(requestOptions: RequestOptions | undefined) { - return (url: any, init: any) => - fetchwithRequestOptions(url, init, requestOptions); +export function customFetch( + requestOptions: RequestOptions | undefined, +): typeof patchedFetch { + if (process.env.FEATURE_FLAG_DISABLE_CUSTOM_FETCH) { + return patchedFetch; + } + return (req: URL | RequestInfo, init?: RequestInit) => { + if (typeof req === "string" || req instanceof URL) { + return fetchwithRequestOptions(req, init, requestOptions); + } else { + return fetchwithRequestOptions(req.url, req, requestOptions); + } + }; } diff --git a/packages/openai-adapters/src/util/parseArgs.ts b/packages/openai-adapters/src/util/parseArgs.ts index 8e7bb7380..dafb920b6 100644 --- a/packages/openai-adapters/src/util/parseArgs.ts +++ b/packages/openai-adapters/src/util/parseArgs.ts @@ -3,7 +3,7 @@ export function safeParseArgs( errorId?: string, ): Record { try { - return JSON.parse(args ?? "{}"); + return JSON.parse(args?.trim() || "{}"); } catch (e) { const identifier = errorId ? `Call: ${errorId}\nArgs:${args}\n` : ""; console.error( diff --git a/packages/shared-release.config.js b/packages/shared-release.config.js new file mode 100644 index 000000000..a587ebbd0 --- /dev/null +++ b/packages/shared-release.config.js @@ -0,0 +1,34 @@ +export default function createReleaseConfig(packageName) { + return { + branches: ["main"], + tagFormat: `@continuedev/${packageName}@\${version}`, + plugins: [ + [ + "@semantic-release/commit-analyzer", + { + releaseRules: [ + { scope: `packages/${packageName}`, release: "patch" }, + { scope: `packages/${packageName}`, type: "fix", release: "patch" }, + { scope: "packages/config-yaml", type: "feat", release: "minor" }, + { + scope: `packages/${packageName}`, + breaking: true, + release: "major", + }, + ], + }, + ], + "@semantic-release/release-notes-generator", + "@semantic-release/changelog", + "@semantic-release/npm", + [ + "@semantic-release/git", + { + assets: ["CHANGELOG.md", "package.json"], + message: `chore(release): @continuedev/${packageName}@\${nextRelease.version} [skip ci]`, + }, + ], + "@semantic-release/github", + ], + }; +} diff --git a/scripts/build-packages.ps1 b/scripts/build-packages.ps1 new file mode 100755 index 000000000..cd415b3df --- /dev/null +++ b/scripts/build-packages.ps1 @@ -0,0 +1,13 @@ +Push-Location packages + +Push-Location "openai-adapters" +npm ci +npm run build +Pop-Location + +Push-Location "config-yaml" +npm ci +npm run build +Pop-Location + +Pop-Location \ No newline at end of file diff --git a/scripts/build-packages.sh b/scripts/build-packages.sh new file mode 100755 index 000000000..fa6f62731 --- /dev/null +++ b/scripts/build-packages.sh @@ -0,0 +1,13 @@ +# Build @continuedev packages for monorepo style linking + +cd packages +cd openai-adapters + +npm ci +npm run build + +cd .. +cd config-yaml + +npm ci +npm run build diff --git a/scripts/create-docker-ssh-container.sh b/scripts/create-docker-ssh-container.sh new file mode 100755 index 000000000..ecdbf21ee --- /dev/null +++ b/scripts/create-docker-ssh-container.sh @@ -0,0 +1,35 @@ +# create the docker file + +cat > Dockerfile << 'EOF' +FROM ubuntu:latest +ENV DEBIAN_FRONTEND=noninteractive +# Install SSH server +RUN apt-get update && apt-get install -y openssh-server +# Configure SSH +RUN mkdir /var/run/sshd +RUN echo 'root:my_password' | chpasswd +# Allow root login +RUN sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config +# SSH login fix +RUN sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd +EXPOSE 22 +CMD ["/usr/sbin/sshd", "-D"] +EOF + +docker build -t continue-ubuntu-ssh . # build the image + +rm Dockerfile # remove the created Dockerfile + +container_name="continue-ssh-container" + +docker run -d -p 2222:22 --name $container_name continue-ubuntu-ssh # run the container + +echo "docker container ${container_name} running on port 2222" + +# add the instructions +bold=$(tput bold) +normal=$(tput sgr0) + +echo "\n--------------------------------------" +echo "now ssh into vscode (using remote explorer) with the following command: ${bold}ssh root@localhost -p 2222${normal}" +echo "use the following password - \"${bold}my_password${normal}\"" diff --git a/scripts/install-dependencies.sh b/scripts/install-dependencies.sh index d92fc109d..092028b37 100755 --- a/scripts/install-dependencies.sh +++ b/scripts/install-dependencies.sh @@ -57,7 +57,7 @@ pushd extensions/vscode # This does way too many things inline but is the common denominator between many of the scripts npm install npm link @continuedev/core -npm run prepackage +# npm run prepackage # not required since npm run package has prescript of prepackage npm run package popd