diff --git a/.changes/extensions/intellij/0.0.53.md b/.changes/extensions/intellij/0.0.53.md new file mode 100644 index 000000000..bbc3605ec --- /dev/null +++ b/.changes/extensions/intellij/0.0.53.md @@ -0,0 +1,8 @@ +## 0.0.53 - 2024-07-10 +### Added +* Support for .prompt files +* New onboarding experience +### Fixed +* Indexing fixes from VS Code versions merged into IntelliJ +* Improved codebase indexing reliability and testing +* Fixes for autocomplete text positioning and timing diff --git a/.changes/extensions/intellij/0.0.54.md b/.changes/extensions/intellij/0.0.54.md new file mode 100644 index 000000000..1f0e05f27 --- /dev/null +++ b/.changes/extensions/intellij/0.0.54.md @@ -0,0 +1,6 @@ +## 0.0.54 - 2024-07-13 +### Added +* Partial autocomplete acceptance +* Autocomplete status bar spinner +### Fixed +* Fixed duplicate completion bug and others diff --git a/.changes/extensions/vscode/0.8.40.md b/.changes/extensions/vscode/0.8.40.md deleted file mode 100644 index e273a98df..000000000 --- a/.changes/extensions/vscode/0.8.40.md +++ /dev/null @@ -1,12 +0,0 @@ -## 0.8.40 - 2024-07-02 -### Added -* Support for Gemini 1.5 Pro -* Link to code in the sidebar when using codebase retrieval -* Smoother onboarding experience -* .prompt files, a way of saving and sharing slash commands -* Support for Claude 3.5 Sonnet, Deepseek Coder v2, and other new models -* Support for comments in config.json -* Specify multiple autocomplete models and switch between them -* Improved bracket matching strategy reduces noisy completions -### Fixed -* Numerous reliability upgrades to codebase indexing diff --git a/.changes/extensions/vscode/0.8.42.md b/.changes/extensions/vscode/0.8.42.md new file mode 100644 index 000000000..52bf46f18 --- /dev/null +++ b/.changes/extensions/vscode/0.8.42.md @@ -0,0 +1,16 @@ +## 0.8.42 - 2024-07-02 + +### Added + +- Support for Gemini 1.5 Pro +- Link to code in the sidebar when using codebase retrieval +- Smoother onboarding experience +- .prompt files, a way of saving and sharing slash commands +- Support for Claude 3.5 Sonnet, Deepseek Coder v2, and other new models +- Support for comments in config.json +- Specify multiple autocomplete models and switch between them +- Improved bracket matching strategy reduces noisy completions + +### Fixed + +- Numerous reliability upgrades to codebase indexing diff --git a/.changes/extensions/vscode/0.8.43.md b/.changes/extensions/vscode/0.8.43.md new file mode 100644 index 000000000..ca3a4c9c6 --- /dev/null +++ b/.changes/extensions/vscode/0.8.43.md @@ -0,0 +1,4 @@ +## 0.8.43 - 2024-07-08 +### Added +* Improved indexing reliability and testing +* Quick Actions: use CodeLens to quickly take common actions like adding docstrings diff --git a/.changes/extensions/vscode/0.8.45.md b/.changes/extensions/vscode/0.8.45.md new file mode 100644 index 000000000..bdeb5b698 --- /dev/null +++ b/.changes/extensions/vscode/0.8.45.md @@ -0,0 +1,12 @@ +## 0.8.45 - 2024-08-05 +### Added +* Support for Llama 3.1 and gpt-4o-mini +* Support for WatsonX+Granite models +### Changed +* Significant improvements to indexing performance +* Improved @codebase quality by more accurately searching over file names and paths +* Improved @codebase accuracy +* Further improvements to indexing performance +### Fixed +* Improved docs indexing and management +* Fixed Gemini embeddings provider diff --git a/.changes/extensions/vscode/0.8.46.md b/.changes/extensions/vscode/0.8.46.md new file mode 100644 index 000000000..176439b9e --- /dev/null +++ b/.changes/extensions/vscode/0.8.46.md @@ -0,0 +1,6 @@ +## 0.8.46 - 2024-08-11 +### Added +* new /onboard slash command +### Fixed +* Fixed problem loading config.ts +* Fixed bug causing duplicate indexing work diff --git a/.changes/extensions/vscode/0.8.47.md b/.changes/extensions/vscode/0.8.47.md new file mode 100644 index 000000000..363081c3c --- /dev/null +++ b/.changes/extensions/vscode/0.8.47.md @@ -0,0 +1,8 @@ +## 0.8.47 - 2024-08-27 +### Added +* Use headless browser for crawling to get better results +* TTS support in the chat window +### Changed +* Improved support for WatsonX models +### Fixed +* Fixed several small indexing bugs diff --git a/.changes/server/v0.1.104.md b/.changes/server/v0.1.104.md deleted file mode 100644 index 8cd892433..000000000 --- a/.changes/server/v0.1.104.md +++ /dev/null @@ -1,9 +0,0 @@ -## v0.1.104 - 2023-12-25 - -### Added - -- Continuous and faster syncing of codebase index - -### Removed - -- No longer using Continue Python server diff --git a/.changes/server/v0.1.99.md b/.changes/server/v0.1.99.md deleted file mode 100644 index 57422d151..000000000 --- a/.changes/server/v0.1.99.md +++ /dev/null @@ -1,5 +0,0 @@ -## v0.1.99 - 2023-11-19 - -### Changed - -- migrated to .json config file format diff --git a/.changes/unreleased/Added-20240726-153514.yaml b/.changes/unreleased/Added-20240726-153514.yaml deleted file mode 100644 index f7e781d61..000000000 --- a/.changes/unreleased/Added-20240726-153514.yaml +++ /dev/null @@ -1,4 +0,0 @@ -project: extensions/vscode -kind: Added -body: Support for Llama 3.1 and gpt-4o-mini -time: 2024-07-26T15:35:14.411895-07:00 diff --git a/.changes/unreleased/Changed-20240726-153458.yaml b/.changes/unreleased/Changed-20240726-153458.yaml deleted file mode 100644 index 3b251034c..000000000 --- a/.changes/unreleased/Changed-20240726-153458.yaml +++ /dev/null @@ -1,4 +0,0 @@ -project: extensions/vscode -kind: Changed -body: Significant improvements to indexing performance -time: 2024-07-26T15:34:58.457908-07:00 diff --git a/.changes/unreleased/Changed-20240726-153542.yaml b/.changes/unreleased/Changed-20240726-153542.yaml deleted file mode 100644 index 5e5284e45..000000000 --- a/.changes/unreleased/Changed-20240726-153542.yaml +++ /dev/null @@ -1,5 +0,0 @@ -project: extensions/vscode -kind: Changed -body: Improved @codebase quality by more accurately searching over file names and - paths -time: 2024-07-26T15:35:42.390496-07:00 diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index bad9f55f0..f9a4b0151 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -9,8 +9,8 @@ ## Screenshots -[ "For visual changes, include screenshots." ] +[ For visual changes, include screenshots. ] ## Testing -[ For new or modified features, provide testing instructions. ] +[ For new or modified features, provide step-by-step testing instructions to validate the intended behavior of the change. ] diff --git a/.github/workflows/README.md b/.github/workflows/README.md index f22d06955..ff1b7bd22 100644 --- a/.github/workflows/README.md +++ b/.github/workflows/README.md @@ -7,7 +7,7 @@ When merging to `preview`: - the VS Code extension along with Rust extension is built and uploaded as an artifact - all of the artifacts are downloaded and pushed to the store/registry all at once, as full releases. - the version is bumped and this change is commited to preview -- in the future, the Intellij extension will be built and uploaded to the marketplace here +- in the future, the JetBrains extension will be built and uploaded to the marketplace here ## main @@ -16,4 +16,4 @@ When merging to `main`: - the VS Code extension along with Rust extension is built and uploaded as an artifact - all of the artifacts are downloaded and pushed to the store/registry all at once, as full releases. - the version is bumped and this change is commited to main -- in the future, the Intellij extension will be built and uploaded to the marketplace here +- in the future, the JetBrains extension will be built and uploaded to the marketplace here diff --git a/.github/workflows/dev_pr.yaml b/.github/workflows/dev_pr.yaml new file mode 100644 index 000000000..d909a279a --- /dev/null +++ b/.github/workflows/dev_pr.yaml @@ -0,0 +1,92 @@ +name: Dev PR checks + +on: + pull_request: + branches: + - dev + +jobs: + tsc-check: + runs-on: ubuntu-latest + + steps: + # 1. Check-out repository + - name: Check-out repository + uses: actions/checkout@v4 + + # 2. Install npm dependencies + - name: Use Node.js from .nvmrc + uses: actions/setup-node@v4 + with: + node-version-file: ".nvmrc" + + - name: Cache extension node_modules + uses: actions/cache@v3 + with: + path: extensions/vscode/node_modules + key: ${{ runner.os }}-node-${{ hashFiles('extensions/vscode/package-lock.json') }} + + - name: Cache core node_modules + uses: actions/cache@v3 + with: + path: core/node_modules + key: ${{ runner.os }}-node-${{ hashFiles('core/package-lock.json') }} + + - name: Cache gui node_modules + uses: actions/cache@v3 + with: + path: gui/node_modules + key: ${{ runner.os }}-node-${{ hashFiles('gui/package-lock.json') }} + + - name: Cache binary node_modules + uses: actions/cache@v3 + with: + path: binary/node_modules + key: ${{ runner.os }}-node-${{ hashFiles('binary/package-lock.json') }} + + - name: extensions/vscode install + run: | + cd extensions/vscode + npm ci + env: + # https://github.com/microsoft/vscode-ripgrep/issues/9#issuecomment-643965333 + GITHUB_TOKEN: ${{ secrets.CI_GITHUB_TOKEN }} + + - name: core install + run: | + cd core + npm ci + + - name: gui install + run: | + cd gui + npm ci + + - name: binary install + run: | + cd binary + npm ci + + - name: extensions/vscode checks + run: | + cd extensions/vscode + npx tsc --noEmit + + - name: core checks + run: | + cd core + npm ci + npx tsc --noEmit + npm run lint + env: + OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} + + - name: gui checks + run: | + cd gui + npx tsc --noEmit + + - name: binary checks + run: | + cd binary + npx tsc --noEmit diff --git a/.github/workflows/jetbrains-build.yaml b/.github/workflows/jetbrains-build.yaml deleted file mode 100644 index a9696872d..000000000 --- a/.github/workflows/jetbrains-build.yaml +++ /dev/null @@ -1,476 +0,0 @@ -# GitHub Actions Workflow is created for testing and preparing the plugin release in the following steps: -# - Validate Gradle Wrapper. -# - Run 'test' and 'verifyPlugin' tasks. -# - Run Qodana inspections. -# - Run the 'buildPlugin' task and prepare artifact for further tests. -# - Run the 'runPluginVerifier' task. -# - Create a draft release. -# -# The workflow is triggered on push and pull_request events. -# -# GitHub Actions reference: https://help.github.com/en/actions -# -## JBIJPPTPL - -name: Build -on: - # Trigger the workflow on pushes to only the 'main' branch (this avoids duplicate checks being run e.g., for dependabot pull requests) - push: - branches: [main, preview] - # Trigger the workflow on any pull request - # pull_request: - -concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} - cancel-in-progress: true - -defaults: - run: - working-directory: ./extensions/intellij - -jobs: - # Prepare environment and build the plugin - build: - name: Build - runs-on: macos-latest - outputs: - version: ${{ steps.properties.outputs.version }} - changelog: ${{ steps.properties.outputs.changelog }} - pluginVerifierHomeDir: ${{ steps.properties.outputs.pluginVerifierHomeDir }} - steps: - # Check out current repository - - name: Fetch Sources - uses: actions/checkout@v4 - - # Validate wrapper - - name: Gradle Wrapper Validation - uses: gradle/actions/wrapper-validation@v3 - - # Set up Java environment for the next steps - - name: Setup Java - uses: actions/setup-java@v4 - with: - distribution: zulu - java-version: 17 - - # Setup Gradle - - name: Setup Gradle - uses: gradle/actions/setup-gradle@v3 - with: - gradle-home-cache-cleanup: true - - # Set environment variables - - name: Export Properties - id: properties - shell: bash - run: | - PROPERTIES="$(./gradlew properties --console=plain -q)" - VERSION="$(echo "$PROPERTIES" | grep "^version:" | cut -f2- -d ' ')" - # CHANGELOG="$(./gradlew getChangelog --unreleased --no-header --console=plain -q)" - CHANGELOG="" - - echo "version=$VERSION" >> $GITHUB_OUTPUT - echo "pluginVerifierHomeDir=~/.pluginVerifier" >> $GITHUB_OUTPUT - - echo "changelog<> $GITHUB_OUTPUT - echo "$CHANGELOG" >> $GITHUB_OUTPUT - echo "EOF" >> $GITHUB_OUTPUT - - ./gradlew listProductsReleases # prepare list of IDEs for Plugin Verifier - - # Setup Node.js - - name: Use Node.js from .nvmrc - uses: actions/setup-node@v4 - with: - node-version-file: ".nvmrc" - - # Cache node_modules - - name: Cache core node_modules - uses: actions/cache@v3 - with: - path: core/node_modules - key: ${{ runner.os }}-node-${{ hashFiles('core/package-lock.json') }} - - - name: Cache binary node_modules - uses: actions/cache@v3 - with: - path: binary/node_modules - key: ${{ runner.os }}-node-${{ hashFiles('binary/package-lock.json') }} - - - name: Cache gui node_modules - uses: actions/cache@v3 - with: - path: gui/node_modules - key: ${{ runner.os }}-node-${{ hashFiles('gui/package-lock.json') }} - - # npm install core - - name: Install core node_modules - run: | - cd ../../core - npm ci - - # npm install binary - - name: Install core node_modules - run: | - cd ../../binary - npm ci - - # npm install gui - - name: Install gui node_modules - run: | - cd ../../gui - npm ci - - # build gui - - name: Build gui - run: | - cd ../../gui - npm run build - - # Run prepackage.js script - - name: Run prepackage script - run: | - cd ../../extensions/vscode - npm ci - npm run prepackage - env: - # https://github.com/microsoft/vscode-ripgrep/issues/9#issuecomment-643965333 - GITHUB_TOKEN: ${{ secrets.CI_GITHUB_TOKEN }} - - # Build binaries - - name: Build the binaries - run: | - cd ../../binary - npm run build - - # Build plugin - - name: Build plugin - run: ./gradlew buildPlugin - - # Prepare plugin archive content for creating artifact - - name: Prepare Plugin Artifact - id: artifact - shell: bash - run: | - cd ../../extensions/intellij/build/distributions - FILENAME=`ls *.zip` - unzip "$FILENAME" -d content - - echo "filename=${FILENAME%.????}" >> $GITHUB_OUTPUT - - # Store already-built plugin as an artifact for downloading - - name: Upload artifact - uses: actions/upload-artifact@v4 - with: - name: ${{ steps.artifact.outputs.filename }} - path: ./extensions/intellij/build/distributions/content/*/* - - # Upload binaries as artifacts - - name: Upload artifact (darwin-arm64) - uses: actions/upload-artifact@v4 - with: - name: continue-binary-darwin-arm64 - path: ./binary/bin/darwin-arm64/ - - - name: Upload artifact (darwin-x64) - uses: actions/upload-artifact@v4 - with: - name: continue-binary-darwin-x64 - path: ./binary/bin/darwin-x64/ - - - name: Upload artifact (win32-x64) - uses: actions/upload-artifact@v4 - with: - name: continue-binary-win32-x64 - path: ./binary/bin/win32-x64/ - - - name: Upload artifact (linux-arm64) - uses: actions/upload-artifact@v4 - with: - name: continue-binary-linux-arm64 - path: ./binary/bin/linux-arm64/ - - - name: Upload artifact (linux-x64) - uses: actions/upload-artifact@v4 - with: - name: continue-binary-linux-x64 - path: ./binary/bin/linux-x64/ - - test-binaries: - needs: build - strategy: - matrix: - include: - - os: windows-latest - platform: win32 - arch: x64 - npm_config_arch: x64 - - os: ubuntu-latest - platform: linux - arch: x64 - npm_config_arch: x64 - # arm64 not actually supported by GitHub - # - os: ubuntu-latest - # platform: linux - # arch: arm64 - # npm_config_arch: arm64 - - os: macos-12 - platform: darwin - arch: x64 - npm_config_arch: x64 - - os: macos-latest - platform: darwin - arch: arm64 - npm_config_arch: arm64 - runs-on: ${{ matrix.os }} - steps: - # 1. Check-out repository - - name: Check-out repository - uses: actions/checkout@v4 - - # 2. Install npm dependencies - - name: Use Node.js from .nvmrc - uses: actions/setup-node@v4 - with: - node-version-file: ".nvmrc" - - - name: Cache core node_modules - uses: actions/cache@v3 - with: - path: core/node_modules - key: ${{ runner.os }}-node-${{ hashFiles('core/package-lock.json') }} - - - name: Cache binary node_modules - uses: actions/cache@v3 - with: - path: binary/node_modules - key: ${{ runner.os }}-node-${{ hashFiles('binary/package-lock.json') }} - - - name: Install Core Dependencies - run: | - cd ../../core - npm ci - - - name: Install Binary Dependencies - run: | - cd ../../binary - npm ci - - # Download the binary artifact - - name: Download binary artifact - uses: actions/download-artifact@v4 - with: - name: continue-binary-${{ matrix.platform }}-${{ matrix.arch }} - path: ./binary/bin/${{ matrix.platform }}-${{ matrix.arch }}/ - - # Set execute permissions for the binary (non-Windows) - - name: Set execute permissions - run: | - cd ../../binary/bin/${{ matrix.platform }}-${{ matrix.arch }} - chmod +x continue-binary - chmod +x node_sqlite3.node - chmod +x index.node - chmod +x esbuild - if: ${{ matrix.platform }} != 'win32' - - - name: Copy node_sqlite3.node to necessary location - run: | - cd ../../binary - mkdir build - cp ./bin/${{ matrix.platform }}-${{ matrix.arch }}/node_sqlite3.node ./build/node_sqlite3.node - - # Run tests for binary - - name: Run binary tests - run: | - cd ../../binary - npm run test - - - name: Upload logs - if: ${{ always() }} - uses: actions/upload-artifact@v2 - with: - name: core-logs-${{ matrix.platform }}-${{ matrix.arch }} - path: binary/.continue/logs/core.log - - # Run tests and upload a code coverage report - test: - name: Test - needs: [build] - runs-on: ubuntu-latest - steps: - # Check out current repository - - name: Fetch Sources - uses: actions/checkout@v4 - - # Set up Java environment for the next steps - - name: Setup Java - uses: actions/setup-java@v4 - with: - distribution: zulu - java-version: 17 - - # Setup Gradle - - name: Setup Gradle - uses: gradle/actions/setup-gradle@v3 - with: - gradle-home-cache-cleanup: true - - # Run tests - - name: Run Tests - run: ./gradlew check - - # Collect Tests Result of failed tests - - name: Collect Tests Result - if: ${{ failure() }} - uses: actions/upload-artifact@v4 - with: - name: tests-result - path: ${{ github.workspace }}/extensions/intellij/build/reports/tests - - # Upload the Kover report to CodeCov - # - name: Upload Code Coverage Report - # uses: codecov/codecov-action@v4 - # with: - # files: ${{ github.workspace }}/build/reports/kover/report.xml - - # Run Qodana inspections and provide report - inspectCode: - if: false - name: Inspect code - needs: [build] - runs-on: ubuntu-latest - permissions: - contents: write - checks: write - pull-requests: write - steps: - # Free GitHub Actions Environment Disk Space - - name: Maximize Build Space - uses: jlumbroso/free-disk-space@main - with: - tool-cache: false - large-packages: false - - # Check out current repository - - name: Fetch Sources - uses: actions/checkout@v4 - - # Set up Java environment for the next steps - - name: Setup Java - uses: actions/setup-java@v4 - with: - distribution: zulu - java-version: 17 - - # Run Qodana inspections - - name: Qodana - Code Inspection - uses: JetBrains/qodana-action@v2024.1.5 - with: - cache-default-branch-only: true - - # Run plugin structure verification along with IntelliJ Plugin Verifier - verify: - name: Verify plugin - needs: [build] - runs-on: ubuntu-latest - steps: - # Free GitHub Actions Environment Disk Space - - name: Maximize Build Space - uses: jlumbroso/free-disk-space@main - with: - tool-cache: false - large-packages: false - - # Check out current repository - - name: Fetch Sources - uses: actions/checkout@v4 - - # Set up Java environment for the next steps - - name: Setup Java - uses: actions/setup-java@v4 - with: - distribution: zulu - java-version: 17 - - # Setup Gradle - - name: Setup Gradle - uses: gradle/actions/setup-gradle@v3 - with: - gradle-home-cache-cleanup: true - - # Cache Plugin Verifier IDEs - - name: Setup Plugin Verifier IDEs Cache - uses: actions/cache@v4 - with: - path: ${{ needs.build.outputs.pluginVerifierHomeDir }}/ides - key: plugin-verifier-${{ hashFiles('build/listProductsReleases.txt') }} - - # Run Verify Plugin task and IntelliJ Plugin Verifier tool - - name: Run Plugin Verification tasks - run: ./gradlew runPluginVerifier -Dplugin.verifier.home.dir=${{ needs.build.outputs.pluginVerifierHomeDir }} - - # Collect Plugin Verifier Result - - name: Collect Plugin Verifier Result - if: ${{ always() }} - uses: actions/upload-artifact@v4 - with: - name: pluginVerifier-result - path: ${{ github.workspace }}/build/reports/pluginVerifier - - # Prepare a draft release for GitHub Releases page for the manual verification - # If accepted and published, release workflow would be triggered - releaseDraft: - name: Release draft - if: github.event_name != 'pull_request' - needs: [build, test, test-binaries, verify] - runs-on: ubuntu-latest - permissions: - contents: write - steps: - # Check out current repository - - name: Fetch Sources - uses: actions/checkout@v4 - - - name: Set up Git - run: | - git config --local user.email "action@github.com" - git config --local user.name "GitHub Action" - - - name: Tag the repository - id: tag - run: | - # See https://docs.github.com/en/get-started/using-git/dealing-with-special-characters-in-branch-and-tag-names - TAG=v${{ needs.build.outputs.version }}-jetbrains - echo "$TAG" - echo "tag=$TAG" >> $GITHUB_OUTPUT - git tag -a $TAG -m "Published version $TAG" ${GITHUB_SHA} - git push origin $TAG - - # Remove old release drafts by using the curl request for the available releases with a draft flag - - name: Remove Old Release Drafts - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - gh api repos/{owner}/{repo}/releases \ - --jq '.[] | select(.draft == true) | .id' \ - | xargs -I '{}' gh api -X DELETE repos/{owner}/{repo}/releases/{} - - # Create a new release draft which is not publicly visible and requires manual acceptance - - name: Create Release Draft - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - gh release create "${{ steps.tag.outputs.tag }}" \ - --draft \ - --title "v${{ needs.build.outputs.version }}-jetbrains" \ - --notes "$(cat << 'EOM' - ${{ needs.build.outputs.changelog }} - EOM - )" - - # Download the Gradle build artifact - - name: Download Gradle build artifact - uses: actions/download-artifact@v4 - with: - name: ${{ needs.build.outputs.filename }} - path: ./artifacts diff --git a/.github/workflows/jetbrains-release.yaml b/.github/workflows/jetbrains-release.yaml index 291d9ebef..e4400f20b 100644 --- a/.github/workflows/jetbrains-release.yaml +++ b/.github/workflows/jetbrains-release.yaml @@ -2,14 +2,19 @@ # Running the publishPlugin task requires all following secrets to be provided: PUBLISH_TOKEN, PRIVATE_KEY, PRIVATE_KEY_PASSWORD, CERTIFICATE_CHAIN. # See https://plugins.jetbrains.com/docs/intellij/plugin-signing.html for more information. -name: Release +name: JetBrains Release + on: release: - types: [prereleased, released] + types: [prereleased] defaults: run: - working-directory: ./extensions/intellij + working-directory: extensions/intellij + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true jobs: check_release_name: @@ -18,19 +23,20 @@ jobs: should_run: ${{ steps.check.outputs.should_run }} steps: - id: check + working-directory: . run: | - if [[ "${{ github.event.release.name }}" == *-jetbrains ]]; then + if [[ "${{ github.event.release.tag_name }}" == v0.0.*-jetbrains ]]; then echo "should_run=true" >> $GITHUB_OUTPUT else echo "should_run=false" >> $GITHUB_OUTPUT fi # Prepare and publish the plugin to JetBrains Marketplace repository - release: + build: needs: check_release_name if: needs.check_release_name.outputs.should_run == 'true' - name: Publish Plugin - runs-on: ubuntu-latest + name: Build Plugin + runs-on: macos-latest permissions: contents: write pull-requests: write @@ -41,14 +47,26 @@ jobs: with: ref: ${{ github.event.release.tag_name }} - # Set up Java environment for the next steps + - name: Import Apple certificate + uses: apple-actions/import-codesign-certs@v3 + with: + keychain: ${{ github.run_id }} + keychain-password: ${{ github.run_id }} + p12-file-base64: ${{ secrets.APPLE_CERT_DATA }} + p12-password: ${{ secrets.APPLE_CERT_PASSWORD }} + + # Validate wrapper + - name: Gradle Wrapper Validation + uses: gradle/actions/wrapper-validation@v3 + + # # Set up Java environment for the next steps - name: Setup Java uses: actions/setup-java@v4 with: distribution: zulu java-version: 17 - # Setup Gradle + # # Setup Gradle - name: Setup Gradle uses: gradle/actions/setup-gradle@v3 with: @@ -59,16 +77,21 @@ jobs: id: properties shell: bash run: | - CHANGELOG="$(cat << 'EOM' | sed -e 's/^[[:space:]]*$//g' -e '/./,$!d' - ${{ github.event.release.body }} - EOM - )" + PROPERTIES="$(./gradlew properties --console=plain -q)" + VERSION="$(echo "$PROPERTIES" | grep "^version:" | cut -f2- -d ' ')" + # CHANGELOG="$(./gradlew getChangelog --unreleased --no-header --console=plain -q)" + CHANGELOG="" + + echo "version=$VERSION" >> $GITHUB_OUTPUT + echo "pluginVerifierHomeDir=~/.pluginVerifier" >> $GITHUB_OUTPUT echo "changelog<> $GITHUB_OUTPUT echo "$CHANGELOG" >> $GITHUB_OUTPUT echo "EOF" >> $GITHUB_OUTPUT - # Setup Node.js + ./gradlew listProductsReleases # prepare list of IDEs for Plugin Verifier + + # # Setup Node.js - name: Use Node.js from .nvmrc uses: actions/setup-node@v4 with: @@ -99,22 +122,11 @@ jobs: cd ../../core npm ci - # npm install binary - - name: Install core node_modules - run: | - cd ../../binary - npm ci - # npm install gui - - name: Install gui node_modules + - name: Install gui node_modules and build run: | cd ../../gui npm ci - - # build gui - - name: Build gui - run: | - cd ../../gui npm run build # Run prepackage.js script @@ -123,26 +135,360 @@ jobs: cd ../../extensions/vscode npm ci npm run prepackage + env: + # https://github.com/microsoft/vscode-ripgrep/issues/9#issuecomment-643965333 + GITHUB_TOKEN: ${{ secrets.CI_GITHUB_TOKEN }} + + # npm install binary + - name: Install binary node_modules + run: | + cd ../../binary + npm ci # Build binaries - - name: Install core node_modules + - name: Build the binaries run: | cd ../../binary npm run build - # Update Unreleased section with the current release note - - name: Patch Changelog - if: ${{ steps.properties.outputs.changelog != '' }} + # - name: Code sign darwin binaries + # run: | + # echo "Signing executable with keychain: ${{ github.run_id }}" + # codesign --sign - ../../binary/bin/darwin-x64/continue-binary + # codesign --sign - ../../binary/bin/darwin-arm64/continue-binary + + # - name: Sign darwin-arm64 binary + # uses: lando/code-sign-action@v2 + # with: + # file: ./binary/bin/darwin-arm64/continue-binary + # certificate-data: ${{ secrets.APPLE_CERT_DATA }} + # certificate-password: ${{ secrets.APPLE_CERT_PASSWORD }} + # apple-notary-user: ${{ secrets.APPLE_NOTARY_USER }} + # apple-notary-password: ${{ secrets.APPLE_NOTARY_PASSWORD }} + # apple-notary-tool: altool + # apple-team-id: 43XFLY66ZD + # apple-product-id: dev.continue.continue-binary + # options: --options runtime --entitlements entitlements.xml + + # Build plugin + - name: Build plugin + run: ./gradlew buildPlugin + + # Publish the plugin to JetBrains Marketplace + - name: Publish EAP Plugin env: - CHANGELOG: ${{ steps.properties.outputs.changelog }} + PUBLISH_TOKEN: ${{ secrets.JETBRAINS_PUBLISH_TOKEN }} + CERTIFICATE_CHAIN: ${{ secrets.JETBRAINS_CERTIFICATE_CHAIN }} + PRIVATE_KEY: ${{ secrets.JETBRAINS_PRIVATE_KEY }} + PRIVATE_KEY_PASSWORD: ${{ secrets.JETBRAINS_PRIVATE_KEY_PASSWORD }} + RELEASE_CHANNEL: eap + run: ./gradlew publishPlugin + + - name: Publish Stable Plugin + env: + PUBLISH_TOKEN: ${{ secrets.JETBRAINS_PUBLISH_TOKEN }} + CERTIFICATE_CHAIN: ${{ secrets.JETBRAINS_CERTIFICATE_CHAIN }} + PRIVATE_KEY: ${{ secrets.JETBRAINS_PRIVATE_KEY }} + PRIVATE_KEY_PASSWORD: ${{ secrets.JETBRAINS_PRIVATE_KEY_PASSWORD }} + RELEASE_CHANNEL: default + run: ./gradlew publishPlugin + + # Prepare plugin archive content for creating artifact + - name: Prepare Plugin Artifact + id: artifact + shell: bash run: | - ./gradlew patchChangelog --release-note="$CHANGELOG" + cd ../../extensions/intellij/build/distributions + echo "Contents of distributions folder:" + ls + echo "---" + FILENAME=`ls continue-intellij-extension-*.zip` + unzip "$FILENAME" -d content + + echo "filename=${FILENAME%.????}" >> $GITHUB_OUTPUT + + # Store already-built plugin as an artifact for downloading + - name: Upload artifact + uses: actions/upload-artifact@v4 + with: + name: ${{ steps.artifact.outputs.filename }} + path: ./extensions/intellij/build/distributions/content/*/* + + # Upload binaries as artifacts + - name: Upload artifact (darwin-arm64) + uses: actions/upload-artifact@v4 + with: + name: continue-binary-darwin-arm64 + path: ./binary/bin/darwin-arm64/ + + - name: Upload artifact (darwin-x64) + uses: actions/upload-artifact@v4 + with: + name: continue-binary-darwin-x64 + path: ./binary/bin/darwin-x64/ + + - name: Upload artifact (win32-x64) + uses: actions/upload-artifact@v4 + with: + name: continue-binary-win32-x64 + path: ./binary/bin/win32-x64/ + + - name: Upload artifact (linux-arm64) + uses: actions/upload-artifact@v4 + with: + name: continue-binary-linux-arm64 + path: ./binary/bin/linux-arm64/ + + - name: Upload artifact (linux-x64) + uses: actions/upload-artifact@v4 + with: + name: continue-binary-linux-x64 + path: ./binary/bin/linux-x64/ + + test-binaries: + needs: build + strategy: + matrix: + include: + - os: windows-latest + platform: win32 + arch: x64 + npm_config_arch: x64 + - os: ubuntu-latest + platform: linux + arch: x64 + npm_config_arch: x64 + # arm64 not actually supported by GitHub + # - os: ubuntu-latest + # platform: linux + # arch: arm64 + # npm_config_arch: arm64 + - os: macos-12 + platform: darwin + arch: x64 + npm_config_arch: x64 + - os: macos-latest + platform: darwin + arch: arm64 + npm_config_arch: arm64 + runs-on: ${{ matrix.os }} + steps: + # 1. Check-out repository + - name: Check-out repository + uses: actions/checkout@v4 + + # 2. Install npm dependencies + - name: Use Node.js from .nvmrc + uses: actions/setup-node@v4 + with: + node-version-file: ".nvmrc" + + - name: Cache core node_modules + uses: actions/cache@v3 + with: + path: core/node_modules + key: ${{ runner.os }}-node-${{ hashFiles('core/package-lock.json') }} + + - name: Cache binary node_modules + uses: actions/cache@v3 + with: + path: binary/node_modules + key: ${{ runner.os }}-node-${{ hashFiles('binary/package-lock.json') }} + + - name: Install Core Dependencies + run: | + cd ../../core + npm ci + + - name: Install Binary Dependencies + run: | + cd ../../binary + npm ci + + # Download the binary artifact + - name: Download binary artifact + uses: actions/download-artifact@v4 + with: + name: continue-binary-${{ matrix.platform }}-${{ matrix.arch }} + path: ./binary/bin/${{ matrix.platform }}-${{ matrix.arch }}/ + + # Set execute permissions for the binary (non-Windows) + - name: Set execute permissions + run: | + cd ../../binary/bin/${{ matrix.platform }}-${{ matrix.arch }} + chmod +x continue-binary + chmod +x build/Release/node_sqlite3.node + chmod +x index.node + chmod +x esbuild + if: ${{ matrix.platform }} != 'win32' + + # Run tests for binary + - name: Run binary tests + run: | + cd ../../binary + npm run test + + - name: Upload logs + if: ${{ always() }} + uses: actions/upload-artifact@v2 + with: + name: core-logs-${{ matrix.platform }}-${{ matrix.arch }} + path: binary/.continue/logs/core.log + + # Run tests and upload a code coverage report + test: + name: Test + needs: [build] + runs-on: ubuntu-latest + steps: + # Check out current repository + - name: Fetch Sources + uses: actions/checkout@v4 + + # Set up Java environment for the next steps + - name: Setup Java + uses: actions/setup-java@v4 + with: + distribution: zulu + java-version: 17 + + # Setup Gradle + - name: Setup Gradle + uses: gradle/actions/setup-gradle@v3 + with: + gradle-home-cache-cleanup: true + + # Run tests + - name: Run Tests + run: ./gradlew check + + # Collect Tests Result of failed tests + - name: Collect Tests Result + if: ${{ failure() }} + uses: actions/upload-artifact@v4 + with: + name: tests-result + path: ${{ github.workspace }}/extensions/intellij/build/reports/tests + + # Upload the Kover report to CodeCov + # - name: Upload Code Coverage Report + # uses: codecov/codecov-action@v4 + # with: + # files: ${{ github.workspace }}/build/reports/kover/report.xml + + # Run Qodana inspections and provide report + inspectCode: + if: false + name: Inspect code + needs: [build] + runs-on: ubuntu-latest + permissions: + contents: write + checks: write + pull-requests: write + steps: + # Free GitHub Actions Environment Disk Space + - name: Maximize Build Space + uses: jlumbroso/free-disk-space@main + with: + tool-cache: false + large-packages: false + + # Check out current repository + - name: Fetch Sources + uses: actions/checkout@v4 + + # Set up Java environment for the next steps + - name: Setup Java + uses: actions/setup-java@v4 + with: + distribution: zulu + java-version: 17 + + # Run Qodana inspections + - name: Qodana - Code Inspection + uses: JetBrains/qodana-action@v2024.1.5 + with: + cache-default-branch-only: true + + # Run plugin structure verification along with IntelliJ Plugin Verifier + verify: + if: false + name: Verify plugin + needs: [build] + runs-on: ubuntu-latest + steps: + # Free GitHub Actions Environment Disk Space + - name: Maximize Build Space + uses: jlumbroso/free-disk-space@main + with: + tool-cache: false + large-packages: false + + # Check out current repository + - name: Fetch Sources + uses: actions/checkout@v4 + + # Set up Java environment for the next steps + - name: Setup Java + uses: actions/setup-java@v4 + with: + distribution: zulu + java-version: 17 + + # Setup Gradle + - name: Setup Gradle + uses: gradle/actions/setup-gradle@v3 + with: + gradle-home-cache-cleanup: true + + # Cache Plugin Verifier IDEs + - name: Setup Plugin Verifier IDEs Cache + uses: actions/cache@v4 + with: + path: ${{ needs.build.outputs.pluginVerifierHomeDir }}/ides + key: plugin-verifier-${{ hashFiles('build/listProductsReleases.txt') }} + + # Run Verify Plugin task and IntelliJ Plugin Verifier tool + - name: Run Plugin Verification tasks + run: ./gradlew runPluginVerifier -Dplugin.verifier.home.dir=${{ needs.build.outputs.pluginVerifierHomeDir }} + + # Collect Plugin Verifier Result + - name: Collect Plugin Verifier Result + if: ${{ always() }} + uses: actions/upload-artifact@v4 + with: + name: pluginVerifier-result + path: ${{ github.workspace }}/build/reports/pluginVerifier + + upload-release: + if: false + name: Upload Release + needs: + - build + - test-binaries + - test + runs-on: ubuntu-latest + steps: + # # Update Unreleased section with the current release note + # - name: Patch Changelog + # if: ${{ steps.properties.outputs.changelog != '' }} + # env: + # CHANGELOG: ${{ steps.properties.outputs.changelog }} + # run: | + # ./gradlew patchChangelog --release-note="$CHANGELOG" + + - name: Download the plugin + uses: actions/download-artifact@v4 + with: + name: ${{ steps.artifact.outputs.filename }} + path: ./build/distributions/ # Upload artifact as a release asset - - name: Upload Release Asset - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: gh release upload ${{ github.event.release.tag_name }} ./build/distributions/* + # - name: Upload Release Asset + # env: + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # run: gh release upload ${{ github.event.release.tag_name }} ./build/distributions/* # Publish the plugin to JetBrains Marketplace - name: Publish Plugin diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 107162244..7ce7aeb71 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -1,16 +1,27 @@ name: Publish Extension on: - push: - branches: - - main - pull_request: - types: [closed] - branches: - - main + release: + types: [released] jobs: + check_release_name: + runs-on: ubuntu-latest + outputs: + should_run: ${{ steps.check.outputs.should_run }} + steps: + - id: check + working-directory: . + run: | + if [[ "${{ github.event.release.tag_name }}" == v0.8.*-vscode ]]; then + echo "should_run=true" >> $GITHUB_OUTPUT + else + echo "should_run=false" >> $GITHUB_OUTPUT + fi + build: + needs: check_release_name + if: needs.check_release_name.outputs.should_run == 'true' strategy: matrix: include: @@ -49,8 +60,13 @@ jobs: runs-on: ${{ matrix.os }} steps: # 1. Check-out repository - - name: Check-out repository + - name: Checkout uses: actions/checkout@v4 + with: + fetch-depth: 0 # This ensures all tags are fetched + + - name: Checkout tag + run: git checkout ${GITHUB_REF#refs/tags/} - name: Make sure version isn't odd run: | @@ -94,18 +110,19 @@ jobs: cd gui npm ci + # npm ci doesn't end up capturing the @lancedb/... dep because it's not in the package-lock.json - name: Install Core Dependencies run: | cd core npm ci + npm i vectordb - # 2.25 Run core tests - - name: Run core tests - run: | - cd core - npm run test - env: - OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} + # - name: Run core tests + # run: | + # cd core + # npm run test + # env: + # OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} # 2.5. Pre package - name: Set var for environment info @@ -125,19 +142,19 @@ jobs: # 4. Run tests for the extension # - name: Install Xvfb for Linux and run tests - run: | - sudo apt-get install -y xvfb # Install Xvfb - Xvfb :99 & # Start Xvfb - export DISPLAY=:99 # Export the display number to the environment - cd extensions/vscode - npm run test - if: matrix.os == 'ubuntu-latest' + # run: | + # sudo apt-get install -y xvfb # Install Xvfb + # Xvfb :99 & # Start Xvfb + # export DISPLAY=:99 # Export the display number to the environment + # cd extensions/vscode + # npm run test + # if: matrix.os == 'ubuntu-latest' - - name: Run extension tests - run: | - cd extensions/vscode - npm run test - if: matrix.os != 'ubuntu-latest' + # - name: Run extension tests + # run: | + # cd extensions/vscode + # npm run test + # if: matrix.os != 'ubuntu-latest' # 5. Package the extension - name: Package the extension @@ -167,20 +184,10 @@ jobs: # Download the .vsix artifacts - uses: actions/download-artifact@v3 - - name: Tag the repository - id: tag - run: | - # See https://docs.github.com/en/get-started/using-git/dealing-with-special-characters-in-branch-and-tag-names - TAG=v$(grep -o '"version": "[^"]*' extensions/vscode/package.json | cut -d'"' -f4)-vscode - echo "$TAG" - echo "tag=$TAG" >> $GITHUB_OUTPUT - git tag -a $TAG -m "Published version $TAG" ${GITHUB_SHA} - git push origin $TAG - - name: Release uses: softprops/action-gh-release@v2 with: - tag_name: ${{ steps.tag.outputs.tag }} + tag_name: ${{ github.ref_name }} files: | alpine-x64/*.vsix darwin-arm64/*.vsix diff --git a/.github/workflows/preview.yaml b/.github/workflows/preview.yaml index a04591c89..3958730ec 100644 --- a/.github/workflows/preview.yaml +++ b/.github/workflows/preview.yaml @@ -1,12 +1,27 @@ name: Publish Preview Extension on: - push: - branches: - - preview + release: + types: [prereleased] jobs: + check_release_name: + runs-on: ubuntu-latest + outputs: + should_run: ${{ steps.check.outputs.should_run }} + steps: + - id: check + working-directory: . + run: | + if [[ "${{ github.event.release.tag_name }}" == v0.9.*-vscode ]]; then + echo "should_run=true" >> $GITHUB_OUTPUT + else + echo "should_run=false" >> $GITHUB_OUTPUT + fi + build: + needs: check_release_name + if: needs.check_release_name.outputs.should_run == 'true' strategy: matrix: include: @@ -45,8 +60,13 @@ jobs: runs-on: ${{ matrix.os }} steps: # 1. Check-out repository - - name: Check-out repository + - name: Checkout uses: actions/checkout@v4 + with: + fetch-depth: 0 # This ensures all tags are fetched + + - name: Checkout tag + run: git checkout ${GITHUB_REF#refs/tags/} # 2. Install npm dependencies - name: Use Node.js from .nvmrc @@ -85,18 +105,19 @@ jobs: cd gui npm ci + # npm ci doesn't end up capturing the @lancedb/... dep because it's not in the package-lock.json - name: Install Core Dependencies run: | cd core npm ci + npm i vectordb - # 2.25 Run core tests - - name: Run core tests - run: | - cd core - npm run test - env: - OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} + # - name: Run core tests + # run: | + # cd core + # npm run test + # env: + # OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} # 2.5. Pre package - name: Set var for environment info @@ -158,20 +179,10 @@ jobs: # Download the .vsix artifacts - uses: actions/download-artifact@v3 - - name: Tag the repository - id: tag - run: | - # See https://docs.github.com/en/get-started/using-git/dealing-with-special-characters-in-branch-and-tag-names - TAG=v$(grep -o '"version": "[^"]*' extensions/vscode/package.json | cut -d'"' -f4)-vscode - echo "$TAG" - echo "tag=$TAG" >> $GITHUB_OUTPUT - git tag -a $TAG -m "Published version $TAG" ${GITHUB_SHA} - git push origin $TAG - - name: Release uses: softprops/action-gh-release@v2 with: - tag_name: ${{ steps.tag.outputs.tag }} + tag_name: ${{ github.ref_name }} files: | alpine-x64/*.vsix darwin-arm64/*.vsix @@ -202,7 +213,7 @@ jobs: git config --local user.name "GitHub Action" - name: Pull latest changes - run: git pull origin preview + run: git pull origin dev # 1. Download the artifacts - uses: actions/download-artifact@v3 diff --git a/.github/workflows/ts-check.yaml b/.github/workflows/ts-check.yaml index 193988990..f73016fa5 100644 --- a/.github/workflows/ts-check.yaml +++ b/.github/workflows/ts-check.yaml @@ -5,7 +5,6 @@ on: branches: - main - preview - - dev jobs: tsc-check: diff --git a/.gitignore b/.gitignore index a092b3caa..3fa43ae1a 100644 --- a/.gitignore +++ b/.gitignore @@ -165,5 +165,5 @@ Icon? .continue -# Sandbox env default file -extensions/vscode/manual-testing-sandbox/example.ts \ No newline at end of file + +.prompts/ \ No newline at end of file diff --git a/.prettierignore b/.prettierignore index 5d9bf3359..fcb08552d 100644 --- a/.prettierignore +++ b/.prettierignore @@ -1,2 +1,3 @@ extensions/vscode/continue_rc_schema.json -**/.continueignore \ No newline at end of file +**/.continueignore +CHANGELOG.md \ No newline at end of file diff --git a/.prompts/jest.prompt b/.prompts/jest.prompt deleted file mode 100644 index c4956bbe3..000000000 --- a/.prompts/jest.prompt +++ /dev/null @@ -1,20 +0,0 @@ -temperature: 0.5 -maxTokens: 4096 -name: jest -description: Write Jest unit tests ---- - -You are an expert programmer - - -{{{ input }}} - -Write unit tests for the above selected code, following each of these instructions: -- Use `jest` -- Properly set up and tear down -- Include important edge cases -- The tests should be complete and sophisticated -- Give the tests just as chat output, don't edit any file -- Don't explain how to set up `jest` -- Write a single code block, making sure to label with the language being used (e.g. "```typscript") -- Do not under any circumstances mock any functions or modules \ No newline at end of file diff --git a/.vscode/launch.json b/.vscode/launch.json index 692e94734..896793040 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -5,6 +5,24 @@ "version": "0.2.0", "compounds": [], "configurations": [ + { + "name": "Launch extension", + "type": "extensionHost", + "request": "launch", + "cwd": "${workspaceFolder}/extensions/vscode", + "args": [ + // Pass a directory to manually test in + "${workspaceFolder}/manual-testing-sandbox", + "${workspaceFolder}/manual-testing-sandbox/test.js", + "--extensionDevelopmentPath=${workspaceFolder}/extensions/vscode" + ], + "pauseForSourceMap": false, + "outFiles": ["${workspaceFolder}/extensions/vscode/out/extension.js"], + "preLaunchTask": "vscode-extension:build", + "env": { + // "CONTROL_PLANE_ENV": "local" + } + }, { "type": "node", "request": "launch", @@ -22,7 +40,6 @@ "CONTINUE_GLOBAL_DIR": "${workspaceFolder}/binary/.continue" } }, - { "name": "Debug Jest Tests", "type": "node", @@ -35,6 +52,7 @@ "--config", "${workspaceRoot}/core/jest.config.js" ], + "console": "integratedTerminal", "internalConsoleOptions": "neverOpen" }, @@ -52,27 +70,9 @@ "sourceMaps": true // "preLaunchTask": "gui:dev" }, - { - "name": "Extension (VSCode)", - "type": "extensionHost", - "request": "launch", - "cwd": "${workspaceFolder}/extensions/vscode", - "args": [ - // Pass a directory to manually test in - "${workspaceFolder}/extensions/vscode", - "${workspaceFolder}/extensions/vscode/manual-testing-sandbox/test.js", - "--extensionDevelopmentPath=${workspaceFolder}/extensions/vscode" - ], - "pauseForSourceMap": false, - "outFiles": [ - "${workspaceFolder}/extensions/vscode/out/extension.js", - "/Users/natesesti/.continue/config.ts" - ], - "preLaunchTask": "vscode-extension:build" - }, // Has to be run after starting the server (separately or using the compound configuration) { - "name": "Tests (VSCode)", + "name": "Run tests", "type": "extensionHost", "request": "launch", "cwd": "${workspaceFolder}/extensions/vscode", @@ -110,7 +110,50 @@ ], "cwd": "${workspaceRoot}/core", "console": "integratedTerminal", - "internalConsoleOptions": "neverOpen" + "internalConsoleOptions": "neverOpen", + "env": { + "NODE_OPTIONS": "--experimental-vm-modules", + "CI": "true", + "DEBUG": "jest" + } + }, + { + "name": "[openai-adapters] Jest Test Debugger, Current Open File", + "type": "node", + "request": "launch", + "runtimeArgs": [ + "--inspect-brk", + "${workspaceRoot}/packages/openai-adapters/node_modules/jest/bin/jest.js", + "--runInBand", + "--config", + "${workspaceRoot}/packages/openai-adapters/jest.config.mjs", + "${relativeFile}" + ], + "cwd": "${workspaceRoot}/packages/openai-adapters", + "console": "integratedTerminal", + "internalConsoleOptions": "neverOpen", + "env": { + "NODE_OPTIONS": "--experimental-vm-modules" + } } + // { + // "name": "[openai-adapters] Jest Test Debugger, Current Open File", + // "type": "node", + // "request": "launch", + // "runtimeArgs": [ + // "--inspect-brk", + // "${workspaceRoot}/packages/openai-adapters/node_modules/jest/bin/jest.js", + // "--runInBand", + // "--config", + // "${workspaceRoot}/packages/openai-adapters/jest.config.mjs", + // "${relativeFile}" + // ], + // "cwd": "${workspaceRoot}/packages/openai-adapters", + // "console": "integratedTerminal", + // "internalConsoleOptions": "neverOpen", + // "env": { + // "NODE_OPTIONS": "--experimental-vm-modules" + // } + // } ] } diff --git a/.vscode/settings.json b/.vscode/settings.json index 49c41d928..f56d10f61 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -14,7 +14,9 @@ } }, "search.exclude": { - "./binary": true, - "**/core/vendor/**": true + "**/binary": true, + "binary/": false, + "**/core/vendor/**": true, + "**/gui/dist": true } } diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 49dbba82e..2e595561f 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -45,8 +45,6 @@ } ] }, - // Tsc currently errors out due to testing setup issues, will be resolved in a different PR - // This will be useful for preventing debugging if there are compile errors { "label": "vscode-extension:tsc", "type": "npm", @@ -164,6 +162,13 @@ "options": { "cwd": "docs" } + }, + { + "label": "clean", + "type": "shell", + "command": "node", + "args": ["${workspaceFolder}/scripts/uninstall.js"], + "problemMatcher": [] } ] } diff --git a/CHANGELOG.md b/CHANGELOG.md index 010e9d1e3..268bbe613 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,4 +3,4 @@ Separate changelogs are kept for each extension: - [VS Code Extension](./extensions/vscode/CHANGELOG.md) -- [Intellij Extension](./extensions/intellij/CHANGELOG.md) +- [JetBrains Extension](./extensions/intellij/CHANGELOG.md) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 60d6200b5..0a998802a 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -71,6 +71,7 @@ You can run the documentation server locally using either of the following metho 1. Open your terminal and navigate to the root directory of the project. 2. Run the following command to start the documentation server: + ```bash npm run start --prefix docs ``` @@ -116,7 +117,7 @@ nvm use 2. Start debugging: 1. Switch to Run and Debug view - 2. Select `Extension (VS Code)` from drop down + 2. Select `Launch extension` from drop down 3. Hit play button 4. This will start the extension in debug mode and open a new VS Code window with it installed 1. The new VS Code window with the extension is referred to as the _Host VS Code_ @@ -151,7 +152,7 @@ Pre-requisite: You should use the Intellij IDE, which can be downloaded [here](h ##### Debugging -Continue's JetBrains extension shares much of the code with the VS Code extension by utilizing shared code in the `core` directory and packaging it in a binary in the `binary` directory. The Intellij extension (written in Kotlin) is then able to communicate over stdin/stdout in the [CoreMessenger.kt](./extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/CoreMessenger.kt) file. +Continue's JetBrains extension shares much of the code with the VS Code extension by utilizing shared code in the `core` directory and packaging it in a binary in the `binary` directory. The JetBrains extension (written in Kotlin) is then able to communicate over stdin/stdout in the [CoreMessenger.kt](./extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/CoreMessenger.kt) file. For the sake of rapid development, it is also possible to configure this communication to happen over local TCP sockets: @@ -162,6 +163,10 @@ For the sake of rapid development, it is also possible to configure this communi If you make changes to Kotlin code, they can often be hot-reloaded with "Run -> Debugging Actions -> Reload Changed Classes". +### Our Git Workflow + +We keep two permanent branches: `main` and `dev`. All contributions should be made as pull requests to the `dev` branch. When we are ready to create a "pre-release" version, we create a tag on the `dev` branch, which automatically triggers the workflow in [preview.yaml](./.github/workflows/preview.yaml), which builds and releases a version of the VS Code extension. When a release has been sufficiently tested, we will merge its tag into the `main` branch. Creating a tag on the `main` branch will then trigger a similar workflow in [main.yaml](./.github/workflows/main.yaml), which will build and release a main release of the VS Code extension. Any hotfixes can be made by creating a feature branch from the tag for the release in question. + ### Formatting Continue uses [Prettier](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode) to format JavaScript/TypeScript. Please install the Prettier extension in VS Code and enable "Format on Save" in your settings. diff --git a/binary/README.md b/binary/README.md index beff54b4b..741cc425f 100644 --- a/binary/README.md +++ b/binary/README.md @@ -30,3 +30,15 @@ The build process is otherwise defined entirely in `build.js`. ## Debugging To debug the binary with IntelliJ, set `useTcp` to `true` in `CoreMessenger.kt`, and then in VS Code run the "Core Binary" debug script. Instead of starting a subprocess for the binary and communicating over stdin/stdout, the IntelliJ extension will connect over TCP to the server started from the VS Code window. You can place breakpoints anywhere in the `core` or `binary` folders. + +## Building + +```bash +npm run build +``` + +## Testing + +```bash +npm run test +``` diff --git a/binary/build.js b/binary/build.js index 506fcb18e..016afe9bd 100644 --- a/binary/build.js +++ b/binary/build.js @@ -162,6 +162,7 @@ async function installNodeModuleInTempDirAndCopyToCurrent(packageName, toCopy) { "../core/vendor/tree-sitter.wasm", "../core/llm/llamaTokenizerWorkerPool.mjs", "../core/llm/llamaTokenizer.mjs", + "../core/llm/tiktokenWorkerPool.mjs", ]; for (const f of filesToCopy) { fs.copyFileSync( @@ -184,7 +185,14 @@ async function installNodeModuleInTempDirAndCopyToCurrent(packageName, toCopy) { entryPoints: ["src/index.ts"], bundle: true, outfile: esbuildOutputFile, - external: ["esbuild", "./xhr-sync-worker.js", "vscode", "./index.node"], + external: [ + "esbuild", + "./xhr-sync-worker.js", + "llamaTokenizerWorkerPool.mjs", + "tiktokenWorkerPool.mjs", + "vscode", + "./index.node", + ], format: "cjs", platform: "node", sourcemap: true, @@ -204,6 +212,11 @@ async function installNodeModuleInTempDirAndCopyToCurrent(packageName, toCopy) { "../core/node_modules/jsdom/lib/jsdom/living/xhr/xhr-sync-worker.js", "out/xhr-sync-worker.js", ); + fs.cpSync("../core/llm/tiktokenWorkerPool.mjs", "out/tiktokenWorkerPool.mjs"); + fs.cpSync( + "../core/llm/llamaTokenizerWorkerPool.mjs", + "out/llamaTokenizerWorkerPool.mjs", + ); if (esbuildOnly) { return; @@ -225,9 +238,20 @@ async function installNodeModuleInTempDirAndCopyToCurrent(packageName, toCopy) { }.tar.gz`; execCmdSync(`curl -L -o ${targetDir}/build.tar.gz ${downloadUrl}`); execCmdSync(`cd ${targetDir} && tar -xvzf build.tar.gz`); - fs.copyFileSync( - `${targetDir}/build/Release/node_sqlite3.node`, - `${targetDir}/node_sqlite3.node`, + + // Informs 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`, + JSON.stringify( + { + name: "binary", + version: "1.0.0", + author: "Continue Dev, Inc", + license: "Apache-2.0", + }, + undefined, + 2, + ), ); // Copy to build directory for testing @@ -235,7 +259,7 @@ async function installNodeModuleInTempDirAndCopyToCurrent(packageName, toCopy) { const [platform, arch] = target.split("-"); if (platform === currentPlatform && arch === currentArch) { fs.copyFileSync( - `${targetDir}/node_sqlite3.node`, + `${targetDir}/build/Release/node_sqlite3.node`, `build/node_sqlite3.node`, ); } @@ -245,10 +269,6 @@ async function installNodeModuleInTempDirAndCopyToCurrent(packageName, toCopy) { } fs.unlinkSync(`${targetDir}/build.tar.gz`); - fs.rmSync(`${targetDir}/build`, { - recursive: true, - force: true, - }); // Download and unzip prebuilt esbuild binary for the target console.log(`[info] Downloading esbuild for ${target}...`); @@ -287,9 +307,18 @@ async function installNodeModuleInTempDirAndCopyToCurrent(packageName, toCopy) { `${targetDir}/continue-binary${exe}`, `${targetDir}/esbuild${exe}`, `${targetDir}/index.node`, // @lancedb - `${targetDir}/node_sqlite3.node`, + "package.json", // Informs of where to look for node_sqlite3.node https://www.npmjs.com/package/bindings#:~:text=The%20searching%20for,file%20is%20found + `${targetDir}/build/Release/node_sqlite3.node`, ); } + + // Note that this doesn't verify they actually made it into the binary, just that they were in the expected folder before it was built + pathsToVerify.push("out/index.js"); + pathsToVerify.push("out/llamaTokenizerWorkerPool.mjs"); + pathsToVerify.push("out/tiktokenWorkerPool.mjs"); + pathsToVerify.push("out/xhr-sync-worker.js"); + pathsToVerify.push("out/tree-sitter.wasm"); + validateFilesPresent(pathsToVerify); console.log("[info] Done!"); diff --git a/binary/package-lock.json b/binary/package-lock.json index bafc0c421..dfcd3371a 100644 --- a/binary/package-lock.json +++ b/binary/package-lock.json @@ -44,32 +44,32 @@ "version": "1.0.13", "license": "Apache-2.0", "dependencies": { - "@aws-sdk/client-bedrock-runtime": "^3.574.0", - "@aws-sdk/credential-providers": "^3.596.0", + "@aws-sdk/client-bedrock-runtime": "^3.620.1", + "@aws-sdk/client-sagemaker-runtime": "^3.621.0", + "@aws-sdk/credential-providers": "^3.620.1", "@continuedev/config-types": "^1.0.10", "@continuedev/llm-info": "^1.0.1", + "@crawlee/playwright": "^3.11.1", "@mozilla/readability": "^0.5.0", "@octokit/rest": "^20.0.2", - "@types/jsdom": "^21.1.6", - "@types/mozilla-readability": "^0.2.1", - "@types/node-fetch": "^2.6.11", "@typescript-eslint/eslint-plugin": "^7.8.0", "@typescript-eslint/parser": "^7.8.0", "@xenova/transformers": "2.14.0", "adf-to-md": "^1.1.0", "async-mutex": "^0.5.0", "axios": "^1.6.7", - "cheerio": "^1.0.0-rc.12", "commander": "^12.0.0", "comment-json": "^4.2.3", "dbinfoz": "^0.1.4", "dotenv": "^16.4.5", + "extract-zip": "^2.0.1", "fastest-levenshtein": "^1.0.16", "follow-redirects": "^1.15.5", "handlebars": "^4.7.8", "http-proxy-agent": "^7.0.1", "https-proxy-agent": "^7.0.3", "ignore": "^5.3.1", + "jinja-js": "0.1.8", "js-tiktoken": "^1.0.8", "jsdom": "^24.0.0", "launchdarkly-node-client-sdk": "^3.2.0", @@ -80,8 +80,11 @@ "ollama": "^0.4.6", "onnxruntime-node": "1.14.0", "openai": "^4.20.1", + "p-limit": "^6.1.0", "pg": "^8.11.3", + "playwright": "^1.46.1", "posthog-node": "^3.6.3", + "quick-lru": "^7.0.0", "replicate": "^0.26.0", "request": "^2.88.2", "socket.io-client": "^4.7.3", @@ -91,8 +94,9 @@ "tree-sitter-wasms": "^0.1.11", "uuid": "^9.0.1", "vectordb": "^0.4.20", - "web-tree-sitter": "^0.22.0", + "web-tree-sitter": "^0.21.0", "win-ca": "^3.5.1", + "workerpool": "^9.1.3", "yaml": "^2.4.2", "zod": "^3.23.8" }, @@ -103,12 +107,20 @@ "@types/follow-redirects": "^1.14.4", "@types/jest": "^29.5.12", "@types/jquery": "^3.5.29", + "@types/jsdom": "^21.1.6", + "@types/mozilla-readability": "^0.2.1", "@types/mustache": "^4.2.5", + "@types/node-fetch": "^2.6.11", + "@types/pg": "^8.11.6", + "@types/request": "^2.48.12", "@types/uuid": "^9.0.7", + "@types/win-ca": "^3.5.4", + "cross-env": "^7.0.3", "esbuild": "0.17.19", "eslint": "^8", "eslint-plugin-import": "^2.29.1", "jest": "^29.7.0", + "jest-environment-jsdom": "^29.7.0", "myers-diff": "^2.1.0", "onnxruntime-common": "1.14.0", "onnxruntime-web": "1.14.0", diff --git a/binary/package.json b/binary/package.json index 774993a9f..cb14c50f7 100644 --- a/binary/package.json +++ b/binary/package.json @@ -1,6 +1,7 @@ { "name": "binary", "version": "1.0.0", + "author": "Continue Dev, Inc", "description": "", "main": "out/index.js", "bin": "out/index.js", @@ -26,7 +27,6 @@ "build:dev": "tsc", "esbuild": "node build.js --esbuild-only" }, - "author": "", "license": "Apache-2.0", "devDependencies": { "@biomejs/biome": "1.6.4", diff --git a/binary/pkgJson/darwin-arm64/package.json b/binary/pkgJson/darwin-arm64/package.json index cc41ae801..ce6f2cace 100644 --- a/binary/pkgJson/darwin-arm64/package.json +++ b/binary/pkgJson/darwin-arm64/package.json @@ -10,7 +10,10 @@ "assets": [ "../../../core/node_modules/sqlite3/**/*", "../../out/tree-sitter.wasm", - "../../out/tree-sitter-wasms/*" + "../../out/tree-sitter-wasms/*", + "../../out/llamaTokenizer.mjs", + "../../out/llamaTokenizerWorkerPool.mjs", + "../../out/tiktokenWorkerPool.mjs" ], "targets": [ "node18-macos-arm64" diff --git a/binary/pkgJson/darwin-x64/package.json b/binary/pkgJson/darwin-x64/package.json index 8ccb256e1..178ef6471 100644 --- a/binary/pkgJson/darwin-x64/package.json +++ b/binary/pkgJson/darwin-x64/package.json @@ -10,7 +10,10 @@ "assets": [ "../../../core/node_modules/sqlite3/**/*", "../../out/tree-sitter.wasm", - "../../out/tree-sitter-wasms/*" + "../../out/tree-sitter-wasms/*", + "../../out/llamaTokenizer.mjs", + "../../out/llamaTokenizerWorkerPool.mjs", + "../../out/tiktokenWorkerPool.mjs" ], "targets": [ "node18-macos-x64" diff --git a/binary/pkgJson/linux-arm64/package.json b/binary/pkgJson/linux-arm64/package.json index 9fe88da50..4a3b2a42f 100644 --- a/binary/pkgJson/linux-arm64/package.json +++ b/binary/pkgJson/linux-arm64/package.json @@ -10,7 +10,10 @@ "assets": [ "../../../core/node_modules/sqlite3/**/*", "../../out/tree-sitter.wasm", - "../../out/tree-sitter-wasms/*" + "../../out/tree-sitter-wasms/*", + "../../out/llamaTokenizer.mjs", + "../../out/llamaTokenizerWorkerPool.mjs", + "../../out/tiktokenWorkerPool.mjs" ], "targets": [ "node18-linux-arm64" diff --git a/binary/pkgJson/linux-x64/package.json b/binary/pkgJson/linux-x64/package.json index 1c875baa0..f62ecede7 100644 --- a/binary/pkgJson/linux-x64/package.json +++ b/binary/pkgJson/linux-x64/package.json @@ -10,7 +10,10 @@ "assets": [ "../../../core/node_modules/sqlite3/**/*", "../../out/tree-sitter.wasm", - "../../out/tree-sitter-wasms/*" + "../../out/tree-sitter-wasms/*", + "../../out/llamaTokenizer.mjs", + "../../out/llamaTokenizerWorkerPool.mjs", + "../../out/tiktokenWorkerPool.mjs" ], "targets": [ "node18-linux-x64" diff --git a/binary/pkgJson/win32-arm64/package.json b/binary/pkgJson/win32-arm64/package.json index 3eeb12234..478cf7eb9 100644 --- a/binary/pkgJson/win32-arm64/package.json +++ b/binary/pkgJson/win32-arm64/package.json @@ -13,7 +13,10 @@ "../../out/tree-sitter-wasms/*", "../../node_modules/win-ca/lib/crypt32-ia32.node", "../../node_modules/win-ca/lib/crypt32-x64.node", - "../../node_modules/win-ca/lib/roots.exe" + "../../node_modules/win-ca/lib/roots.exe", + "../../out/llamaTokenizer.mjs", + "../../out/llamaTokenizerWorkerPool.mjs", + "../../out/tiktokenWorkerPool.mjs" ], "targets": [ "node18-win-arm64" diff --git a/binary/pkgJson/win32-x64/package.json b/binary/pkgJson/win32-x64/package.json index 2e495524b..c466fc942 100644 --- a/binary/pkgJson/win32-x64/package.json +++ b/binary/pkgJson/win32-x64/package.json @@ -13,7 +13,10 @@ "../../out/tree-sitter-wasms/*", "../../node_modules/win-ca/lib/crypt32-ia32.node", "../../node_modules/win-ca/lib/crypt32-x64.node", - "../../node_modules/win-ca/lib/roots.exe" + "../../node_modules/win-ca/lib/roots.exe", + "../../out/llamaTokenizer.mjs", + "../../out/llamaTokenizerWorkerPool.mjs", + "../../out/tiktokenWorkerPool.mjs" ], "targets": [ "node18-win-x64" diff --git a/binary/src/IpcMessenger.ts b/binary/src/IpcMessenger.ts index 66acb1448..341372d8e 100644 --- a/binary/src/IpcMessenger.ts +++ b/binary/src/IpcMessenger.ts @@ -38,7 +38,7 @@ class IPCMessengerBase< } this.send(msg.messageType, { done: true }, msg.messageId); } else { - this.send(msg.messageType, response || {}, msg.messageId); + this.send(msg.messageType, response, msg.messageId); } } catch (e: any) { console.warn(`Error running handler for "${msg.messageType}": `, e); diff --git a/binary/src/logging.ts b/binary/src/logging.ts index cba34855c..b6dbfba2c 100644 --- a/binary/src/logging.ts +++ b/binary/src/logging.ts @@ -11,5 +11,6 @@ export function setupCoreLogging() { console.log = logger; console.error = logger; console.warn = logger; + console.debug = logger; console.log("[info] Starting Continue core..."); } diff --git a/binary/tsconfig.json b/binary/tsconfig.json index 351115f59..215a5aee7 100644 --- a/binary/tsconfig.json +++ b/binary/tsconfig.json @@ -1,9 +1,9 @@ { "compilerOptions": { "module": "commonjs", - "target": "ES2020", + "target": "ES2022", "outDir": "out", - "lib": ["ES2020", "dom", "es6", "es5", "dom.iterable", "scripthost"], + "lib": ["ES2022", "dom", "es6", "es5", "dom.iterable", "scripthost"], "sourceMap": true, "rootDirs": ["src", "../core"], "allowJs": true, diff --git a/biome.json b/biome.json deleted file mode 100644 index dff43ae13..000000000 --- a/biome.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "$schema": "https://biomejs.dev/schemas/1.6.4/schema.json", - "organizeImports": { - "enabled": true - }, - "linter": { - "enabled": true, - "rules": { - "recommended": true, - "suspicious": { - "noExplicitAny": "off", - "noConfusingVoidType": "off" - }, - "style": { - "noUselessElse": "off", - "noNonNullAssertion": "off" - }, - "complexity": { - "noForEach": "off" - } - } - }, - "formatter": { - "indentStyle": "space" - } -} diff --git a/core/.eslintrc.json b/core/.eslintrc.json index ed9d52781..04097f4db 100644 --- a/core/.eslintrc.json +++ b/core/.eslintrc.json @@ -3,18 +3,19 @@ "parser": "@typescript-eslint/parser", "parserOptions": { "ecmaVersion": 6, - "sourceType": "module" + "sourceType": "module", + "project": "./tsconfig.json" }, "plugins": ["@typescript-eslint", "import"], "rules": { "quotes": ["warn", "double", {}], - "import/extensions": ["error", "ignorePackages"], - "@typescript-eslint/naming-convention": "warn", + "@typescript-eslint/naming-convention": "off", "@typescript-eslint/semi": "warn", "curly": "warn", "eqeqeq": "warn", "no-throw-literal": "warn", - "semi": "off" + "semi": "off", + "@typescript-eslint/no-floating-promises": "warn" }, "ignorePatterns": ["out", "dist", "**/*.d.ts"] } diff --git a/core/.gitignore b/core/.gitignore index 646c15e7c..7d8f1fa53 100644 --- a/core/.gitignore +++ b/core/.gitignore @@ -3,4 +3,6 @@ target **/.DS_Store npm-debug.log* .env -.continue-test \ No newline at end of file +.continue-test +testDir +coverage \ No newline at end of file diff --git a/core/autocomplete/NearbyDefinitionsService.ts b/core/autocomplete/NearbyDefinitionsService.ts index 79cd0af0a..53178cba7 100644 --- a/core/autocomplete/NearbyDefinitionsService.ts +++ b/core/autocomplete/NearbyDefinitionsService.ts @@ -1,6 +1,6 @@ -import { IDE, Location } from ".."; -import { LANGUAGES } from "./languages"; -import { getSymbolsForSnippet } from "./ranking"; +import { IDE, Location } from "../index.js"; +import { LANGUAGES } from "./languages.js"; +import { getSymbolsForSnippet } from "./ranking.js"; interface FileInfo { filepath: string; diff --git a/core/autocomplete/README.md b/core/autocomplete/README.md index 4e25c9fef..2c68be1bf 100644 --- a/core/autocomplete/README.md +++ b/core/autocomplete/README.md @@ -131,7 +131,7 @@ Follow these steps to ensure that everything is set up correctly: 3. Run `ollama run starcoder:3b` to verify that the model is downloaded. 4. Make sure that any other completion providers are disabled (e.g. Copilot), as they may interfere. 5. Make sure that you aren't also using another Ollama model for chat. This will cause Ollama to constantly load and unload the models from memory, resulting in slow responses (or none at all) for both. -6. Check the output of the logs to find any potential errors (cmd/ctrl+shift+p -> "Toggle Developer Tools" -> "Console" tab in VS Code, ~/.continue/core.log in JetBrains). +6. Check the output of the logs to find any potential errors (cmd/ctrl+shift+p -> "Toggle Developer Tools" -> "Console" tab in VS Code, ~/.continue/logs/core.log in JetBrains). 7. If you are still having issues, please let us know in our [Discord](https://discord.gg/vapESyrFmJ) and we'll help as soon as possible. ### Completions are slow diff --git a/core/autocomplete/brackets.ts b/core/autocomplete/brackets.ts index 63afdfd10..3734df2be 100644 --- a/core/autocomplete/brackets.ts +++ b/core/autocomplete/brackets.ts @@ -84,9 +84,9 @@ export class BracketMatchingService { // Add corresponding open brackets from suffix to stack // because we overwrite them and the diff is displayed, and this allows something to be edited after that for (let i = 0; i < suffix.length; i++) { - if (suffix[i] === " ") continue; + if (suffix[i] === " ") {continue;} const openBracket = BracketMatchingService.BRACKETS_REVERSE[suffix[i]]; - if (!openBracket) break; + if (!openBracket) {break;} stack.unshift(openBracket); } diff --git a/core/test/streamTransforms/stopAtStopTokens.test.ts b/core/autocomplete/charStream.test.ts similarity index 98% rename from core/test/streamTransforms/stopAtStopTokens.test.ts rename to core/autocomplete/charStream.test.ts index de9d29d98..7ab8923fc 100644 --- a/core/test/streamTransforms/stopAtStopTokens.test.ts +++ b/core/autocomplete/charStream.test.ts @@ -1,4 +1,4 @@ -import { stopAtStopTokens } from "../../autocomplete/charStream"; +import { stopAtStopTokens } from "./charStream"; describe("stopAtStopTokens", () => { async function* createMockStream(chunks: string[]): AsyncGenerator { diff --git a/core/autocomplete/charStream.ts b/core/autocomplete/charStream.ts index 0ce49e418..79fc33a0d 100644 --- a/core/autocomplete/charStream.ts +++ b/core/autocomplete/charStream.ts @@ -1,12 +1,24 @@ +/** + * Asynchronous generator that yields characters from the input stream until it encounters + * an end-of-line character followed by a non-whitespace character. + * + * @param {AsyncGenerator} stream - The input stream of characters. + * @param {string[]} endOfLine - An array of characters considered as end-of-line markers. + * @param {() => void} fullStop - A function to be called when the generator stops. + * @yields {string} Characters from the input stream. + * @returns {AsyncGenerator} An async generator that yields characters. + */ export async function* onlyWhitespaceAfterEndOfLine( stream: AsyncGenerator, endOfLine: string[], fullStop: () => void, ): AsyncGenerator { let pending = ""; + for await (let chunk of stream) { chunk = pending + chunk; pending = ""; + for (let i = 0; i < chunk.length - 1; i++) { if ( endOfLine.includes(chunk[i]) && @@ -17,6 +29,7 @@ export async function* onlyWhitespaceAfterEndOfLine( return; } } + if (endOfLine.includes(chunk[chunk.length - 1])) { pending = chunk[chunk.length - 1]; yield chunk.slice(0, chunk.length - 1); @@ -27,6 +40,11 @@ export async function* onlyWhitespaceAfterEndOfLine( yield pending; } +/** + * Yields characters from the stream, stopping if the first character is a newline. + * @param {AsyncGenerator} stream - The input character stream. + * @yields {string} Characters from the stream. + */ export async function* noFirstCharNewline(stream: AsyncGenerator) { let first = true; for await (const char of stream) { @@ -40,6 +58,20 @@ export async function* noFirstCharNewline(stream: AsyncGenerator) { } } +/** + * Asynchronously yields characters from the input stream, stopping if a stop token is encountered. + * + * @param {AsyncGenerator} stream - The input stream of characters. + * @param {string[]} stopTokens - Array of tokens that signal when to stop yielding. + * @yields {string} Characters from the input stream. + * @returns {AsyncGenerator} An async generator that yields characters until a stop condition is met. + * @description + * 1. If no stop tokens are provided, yields all characters from the stream. + * 2. Otherwise, buffers incoming chunks and checks for stop tokens. + * 3. Yields characters one by one if no stop token is found at the start of the buffer. + * 4. Stops yielding and returns if a stop token is encountered. + * 5. After the stream ends, yields any remaining buffered characters. + */ export async function* stopAtStopTokens( stream: AsyncGenerator, stopTokens: string[], diff --git a/core/autocomplete/completionProvider.ts b/core/autocomplete/completionProvider.ts index f4f92ea41..39d2d1e73 100644 --- a/core/autocomplete/completionProvider.ts +++ b/core/autocomplete/completionProvider.ts @@ -37,7 +37,7 @@ import { import { isOnlyPunctuationAndWhitespace } from "./filter.js"; import { AutocompleteLanguageInfo } from "./languages.js"; import { - avoidPathLine, + avoidPathLineAndEmptyComments, noTopLevelKeywordsMidline, skipPrefixes, stopAtLines, @@ -52,6 +52,7 @@ import { getTemplateForModel } from "./templates.js"; import { GeneratorReuseManager } from "./util.js"; // @prettier-ignore import Handlebars from "handlebars"; +import { getConfigJsonPath } from "../util/paths.js"; export interface AutocompleteInput { completionId: string; @@ -249,6 +250,11 @@ export class CompletionProvider { ...config.tabAutocompleteOptions, }; + // Check whether we're in the continue config.json file + if (input.filepath === getConfigJsonPath()) { + return undefined; + } + // Check whether autocomplete is disabled for this file if (options.disableInFiles) { // Relative path needed for `ignore` @@ -266,7 +272,8 @@ export class CompletionProvider { filepath = getBasename(filepath); } - const pattern = ignore().add(options.disableInFiles); + // @ts-ignore + const pattern = ignore.default().add(options.disableInFiles); if (pattern.ignores(filepath)) { return undefined; } @@ -451,12 +458,12 @@ export class CompletionProvider { if ( !shownGptClaudeWarning && nonAutocompleteModels.some((model) => llm.model.includes(model)) && - !llm.model.includes("deepseek") && - !llm.model.includes("codestral") + !llm.model.toLowerCase().includes("deepseek") && + !llm.model.toLowerCase().includes("codestral") ) { shownGptClaudeWarning = true; throw new Error( - `Warning: ${llm.model} is not trained for tab-autocomplete, and will result in low-quality suggestions. See the docs to learn more about why: https://docs.continue.dev/walkthroughs/tab-autocomplete#i-want-better-completions-should-i-use-gpt-4`, + `Warning: ${llm.model} is not trained for tab-autocomplete, and will result in low-quality suggestions. See the docs to learn more about why: https://docs.continue.dev/features/tab-autocomplete#i-want-better-completions-should-i-use-gpt-4`, ); } @@ -471,9 +478,9 @@ export class CompletionProvider { const lines = fullPrefix.split("\n"); fullPrefix = `${lines.slice(0, -1).join("\n")}\n${ lang.singleLineComment - } ${input.injectDetails.split("\n").join(`\n${lang.singleLineComment} `)}\n${ - lines[lines.length - 1] - }`; + } ${input.injectDetails + .split("\n") + .join(`\n${lang.singleLineComment} `)}\n${lines[lines.length - 1]}`; } const fullSuffix = getRangeInString(fileContents, { @@ -574,7 +581,10 @@ export class CompletionProvider { prefix = `${formattedSnippets}\n\n${prefix}`; } else if (prefix.trim().length === 0 && suffix.trim().length === 0) { // If it's an empty file, include the file name as a comment - prefix = `${lang.singleLineComment} ${getLastNPathParts(filepath, 2)}\n${prefix}`; + prefix = `${lang.singleLineComment} ${getLastNPathParts( + filepath, + 2, + )}\n${prefix}`; } prompt = compiledTemplate({ @@ -586,7 +596,14 @@ export class CompletionProvider { }); } else { // Let the template function format snippets - prompt = template(prefix, suffix, filepath, reponame, snippets); + prompt = template( + prefix, + suffix, + filepath, + reponame, + lang.name, + snippets, + ); } // Completion @@ -675,7 +692,10 @@ export class CompletionProvider { let lineGenerator = streamLines(charGenerator); lineGenerator = stopAtLines(lineGenerator, fullStop); lineGenerator = stopAtRepeatingLines(lineGenerator, fullStop); - lineGenerator = avoidPathLine(lineGenerator, lang.singleLineComment); + lineGenerator = avoidPathLineAndEmptyComments( + lineGenerator, + lang.singleLineComment, + ); lineGenerator = skipPrefixes(lineGenerator); lineGenerator = noTopLevelKeywordsMidline( lineGenerator, diff --git a/core/autocomplete/languages.ts b/core/autocomplete/languages.ts index a558dee00..f5b4cffb0 100644 --- a/core/autocomplete/languages.ts +++ b/core/autocomplete/languages.ts @@ -1,4 +1,4 @@ -import type { LineFilter } from "./lineStream"; +import type { LineFilter } from "./lineStream.js"; export interface AutocompleteLanguageInfo { name: string; @@ -26,7 +26,7 @@ export const Python = { name: "Python", // """"#" is for .ipynb files, where we add '"""' surrounding markdown blocks. // This stops the model from trying to complete the start of a new markdown block - topLevelKeywords: ["def", "class", '"""#'], + topLevelKeywords: ["def", "class", "\"\"\"#"], singleLineComment: "#", endOfLine: [], }; diff --git a/core/autocomplete/lineStream.test.ts b/core/autocomplete/lineStream.test.ts new file mode 100644 index 000000000..df8cd1263 --- /dev/null +++ b/core/autocomplete/lineStream.test.ts @@ -0,0 +1,421 @@ +import { jest } from "@jest/globals"; +import * as lineStream from "./lineStream"; + +describe("lineStream", () => { + let mockFullStop: jest.Mock; + + async function getLineGenerator(lines: any) { + return (async function* () { + for (const line of lines) { + yield line; + } + })(); + } + + async function getFilteredLines(results: any) { + const output = []; + + for await (const line of results) { + output.push(line); + } + + return output; + } + + beforeEach(() => { + mockFullStop = jest.fn(); + }); + + describe("noTopLevelKeywordsMidline", () => { + it.todo("Need some sample inputs to properly test this"); + }); + + describe("avoidPathLine", () => { + it("should filter out path lines and empty comments", async () => { + const linesGenerator = await getLineGenerator([ + "// Path: src/index.ts", + "const x = 5;", + "//", + "console.log(x);", + ]); + + const result = lineStream.avoidPathLineAndEmptyComments( + linesGenerator, + "//", + ); + const filteredLines = await getFilteredLines(result); + + expect(filteredLines).toEqual(["const x = 5;", "console.log(x);"]); + }); + }); + + describe("streamWithNewLines", () => { + it("should add newlines between lines", async () => { + const linesGenerator = await getLineGenerator([ + "line1", + "line2", + "line3", + ]); + + const result = lineStream.streamWithNewLines(linesGenerator); + const filteredLines = await getFilteredLines(result); + + expect(filteredLines).toEqual(["line1", "\n", "line2", "\n", "line3"]); + }); + }); + + describe("lineIsRepeated", () => { + it("should return true for similar lines", () => { + expect(lineStream.lineIsRepeated("const x = 5;", "const x = 6;")).toBe( + true, + ); + }); + + it("should return false for different lines", () => { + expect(lineStream.lineIsRepeated("const x = 5;", "let y = 10;")).toBe( + false, + ); + }); + + it("should return false for short lines", () => { + expect(lineStream.lineIsRepeated("x=5", "x=6")).toBe(false); + }); + }); + + describe("stopAtSimilarLine", () => { + it("should stop at the exact same line", async () => { + const lineToTest = "const x = 6;"; + const linesGenerator = await getLineGenerator([ + "console.log();", + "const y = () => {};", + lineToTest, + ]); + + const result = lineStream.stopAtSimilarLine( + linesGenerator, + lineToTest, + mockFullStop, + ); + const filteredLines = await getFilteredLines(result); + + expect(filteredLines).toEqual(["console.log();", "const y = () => {};"]); + expect(mockFullStop).toHaveBeenCalledTimes(1); + }); + + it("should stop at a similar line", async () => { + const lineToTest = "const x = 6;"; + const linesGenerator = await getLineGenerator([ + "console.log();", + "const y = () => {};", + lineToTest, + ]); + + const result = lineStream.stopAtSimilarLine( + linesGenerator, + "a" + lineToTest, + mockFullStop, + ); + const filteredLines = await getFilteredLines(result); + + expect(filteredLines).toEqual(["console.log();", "const y = () => {};"]); + expect(mockFullStop).toHaveBeenCalledTimes(1); + }); + + it("should continue on bracket ending lines", async () => { + const linesGenerator = await getLineGenerator([ + " if (x > 0) {", + " console.log(x);", + " }", + ]); + + const result = lineStream.stopAtSimilarLine( + linesGenerator, + "}", + mockFullStop, + ); + const filteredLines = await getFilteredLines(result); + + expect(filteredLines).toEqual([ + " if (x > 0) {", + " console.log(x);", + " }", + ]); + expect(mockFullStop).toHaveBeenCalledTimes(0); + }); + }); + + describe("stopAtLines", () => { + it("should stop at specified lines", async () => { + const linesGenerator = await getLineGenerator([ + "const x = 5;", + "let y = 10;", + lineStream.LINES_TO_STOP_AT[0], + "const z = 15;", + ]); + + const result = lineStream.stopAtLines(linesGenerator, mockFullStop); + const filteredLines = await getFilteredLines(result); + + expect(filteredLines).toEqual(["const x = 5;", "let y = 10;"]); + expect(mockFullStop).toHaveBeenCalledTimes(1); + }); + }); + + describe("skipPrefixes", () => { + it("should skip specified prefixes", async () => { + const linesGenerator = await getLineGenerator([ + `${lineStream.PREFIXES_TO_SKIP[0]}const x = 5;`, + "let y = 10;", + ]); + + const result = lineStream.skipPrefixes(linesGenerator); + const filteredLines = await getFilteredLines(result); + + expect(filteredLines).toEqual(["const x = 5;", "let y = 10;"]); + }); + }); + + describe("skipLines", () => { + it("should skip specified lines", async () => { + const linesGenerator = await getLineGenerator([ + `${lineStream.LINES_TO_SKIP[0]}const x = 5;`, + "let y = 10;", + ]); + + const result = lineStream.skipLines(linesGenerator); + const filteredLines = await getFilteredLines(result); + + expect(filteredLines).toEqual(["let y = 10;"]); + }); + }); + + describe("filterCodeBlockLines", () => { + it("should remove lines before the first valid line", async () => { + const linesGenerator = await getLineGenerator(["```ts", "const x = 5;"]); + + const result = lineStream.filterCodeBlockLines(linesGenerator); + const filteredLines = await getFilteredLines(result); + + expect(filteredLines).toEqual(["const x = 5;"]); + }); + + it.todo("Need some sample inputs to properly test this"); + }); + + describe("filterEnglishLinesAtStart", () => { + it("should skip initial empty line", async () => { + const linesGenerator = await getLineGenerator([ + "", + "const x = 5;", + "let y = 10;", + ]); + + const result = lineStream.filterEnglishLinesAtStart(linesGenerator); + const filteredLines = await getFilteredLines(result); + + expect(filteredLines).toEqual(["const x = 5;", "let y = 10;"]); + }); + + it("should filter out English first line", async () => { + const linesGenerator = await getLineGenerator([ + lineStream.ENGLISH_START_PHRASES[0], + "let y = 10;", + ]); + + const result = lineStream.filterEnglishLinesAtStart(linesGenerator); + const filteredLines = await getFilteredLines(result); + + expect(filteredLines).toEqual(["let y = 10;"]); + }); + + it("should not filter out non-English first line", async () => { + const linesGenerator = await getLineGenerator([ + "const x = 5;", + "let y = 10;", + ]); + + const result = lineStream.filterEnglishLinesAtStart(linesGenerator); + const filteredLines = await getFilteredLines(result); + + expect(filteredLines).toEqual(["const x = 5;", "let y = 10;"]); + }); + + it("should filter out empty newline after first line english word", async () => { + const linesGenerator = await getLineGenerator([ + lineStream.ENGLISH_START_PHRASES[0], + "", + "const x = 5;", + ]); + + const result = lineStream.filterEnglishLinesAtStart(linesGenerator); + const filteredLines = await getFilteredLines(result); + + expect(filteredLines).toEqual(["const x = 5;"]); + }); + + it("should filter out sentences ending in a semi-colon that are not code keywords", async () => { + const linesGenerator = await getLineGenerator([ + "a" + lineStream.CODE_KEYWORDS_ENDING_IN_SEMICOLON[0] + ":", + "const x = 5;", + ]); + + const result = lineStream.filterEnglishLinesAtStart(linesGenerator); + const filteredLines = await getFilteredLines(result); + + expect(filteredLines).toEqual(["const x = 5;"]); + }); + + it("should not filter out sentences ending in a semi-colon that are code keywords", async () => { + const keyword = lineStream.CODE_KEYWORDS_ENDING_IN_SEMICOLON[0] + ":"; + + const linesGenerator = await getLineGenerator([keyword, "const x = 5;"]); + + const result = lineStream.filterEnglishLinesAtStart(linesGenerator); + const filteredLines = await getFilteredLines(result); + + expect(filteredLines).toEqual([keyword, "const x = 5;"]); + }); + }); + + describe("filterEnglishLinesAtEnd", () => { + it("should stop at English explanation after code block", async () => { + const linesGenerator = await getLineGenerator([ + "const x = 5;", + "```", + lineStream.ENGLISH_POST_PHRASES[0], + ]); + + const result = lineStream.filterEnglishLinesAtEnd(linesGenerator); + const filteredLines = await getFilteredLines(result); + + expect(filteredLines).toEqual(["const x = 5;", "```"]); + }); + }); + + describe("fixCodeLlamaFirstLineIndentation", () => { + it("should fix indentation of the first line", async () => { + const linesGenerator = await getLineGenerator([ + " const x = 5;", + "let y = 10;", + ]); + + const result = + lineStream.fixCodeLlamaFirstLineIndentation(linesGenerator); + const filteredLines = await getFilteredLines(result); + + expect(filteredLines).toEqual(["const x = 5;", "let y = 10;"]); + }); + }); + + describe("filterLeadingAndTrailingNewLineInsertion", () => { + it("should ignore 'useless' new first lines", async () => { + const linesGenerator = await getLineGenerator([ + { type: "new", line: lineStream.USELESS_LINES[0] }, + { type: "new", line: "const x = 5;" }, + ]); + + const result = + lineStream.filterLeadingAndTrailingNewLineInsertion(linesGenerator); + const filteredLines = await getFilteredLines(result); + + expect(filteredLines).toEqual([{ type: "new", line: "const x = 5;" }]); + }); + + it("should handle preserve newlines chars in old lines", async () => { + const linesGenerator = await getLineGenerator([ + { type: "new", line: "const x = 5;" }, + { type: "old", line: "let y = 10;" }, + { type: "old", line: "" }, + { type: "new", line: "const z = 15;" }, + ]); + + const result = + lineStream.filterLeadingAndTrailingNewLineInsertion(linesGenerator); + const filteredLines = await getFilteredLines(result); + + expect(filteredLines).toEqual([ + { type: "new", line: "const x = 5;" }, + { type: "old", line: "let y = 10;" }, + { type: "old", line: "" }, + { type: "new", line: "const z = 15;" }, + ]); + }); + + it("should filter leading and trailing new line insertions", async () => { + const linesGenerator = await getLineGenerator([ + { type: "new", line: "" }, + { type: "new", line: "const x = 5;" }, + { type: "new", line: "let y = 10;" }, + { type: "new", line: "" }, + ]); + + const result = + lineStream.filterLeadingAndTrailingNewLineInsertion(linesGenerator); + const filteredLines = await getFilteredLines(result); + + expect(filteredLines).toEqual([ + { type: "new", line: "const x = 5;" }, + { type: "new", line: "let y = 10;" }, + ]); + }); + + it("should buffer newline chars and then render them if we encounter another non-empty line", async () => { + const linesGenerator = await getLineGenerator([ + { type: "new", line: "const x = 5;" }, + { type: "new", line: "" }, + { type: "new", line: "let y = 10;" }, + ]); + + const result = + lineStream.filterLeadingAndTrailingNewLineInsertion(linesGenerator); + const filteredLines = await getFilteredLines(result); + + expect(filteredLines).toEqual([ + { type: "new", line: "const x = 5;" }, + { type: "new", line: "" }, + { type: "new", line: "let y = 10;" }, + ]); + }); + }); + + describe("stopAtRepeatingLines", () => { + it("should handle non-repeating lines correctly", async () => { + const linesGenerator = await getLineGenerator([ + "const x = 5;", + "let y = 10;", + "const z = 15;", + ]); + + const result = lineStream.stopAtRepeatingLines( + linesGenerator, + mockFullStop, + ); + const filteredLines = await getFilteredLines(result); + + expect(filteredLines).toEqual([ + "const x = 5;", + "let y = 10;", + "const z = 15;", + ]); + }); + + it("should stop at repeating lines", async () => { + const linesGenerator = await getLineGenerator([ + "const x = 5;", + "let y = 10;", + "let y = 10;", + "let y = 10;", + "const z = 15;", + ]); + + const result = lineStream.stopAtRepeatingLines( + linesGenerator, + mockFullStop, + ); + const filteredLines = await getFilteredLines(result); + + expect(filteredLines).toEqual(["const x = 5;", "let y = 10;"]); + expect(mockFullStop).toHaveBeenCalledTimes(1); + }); + }); +}); diff --git a/core/autocomplete/lineStream.ts b/core/autocomplete/lineStream.ts index 674f0d46e..e7d3493bd 100644 --- a/core/autocomplete/lineStream.ts +++ b/core/autocomplete/lineStream.ts @@ -1,12 +1,107 @@ import { distance } from "fastest-levenshtein"; -import { LineStream } from "../diff/util.js"; -import { DiffLine } from "../index.js"; +import { LineStream } from "../diff/util"; +import { DiffLine } from "../"; export type LineFilter = (args: { lines: LineStream; fullStop: () => void; }) => LineStream; +function isBracketEnding(line: string): boolean { + return line + .trim() + .split("") + .some((char) => BRACKET_ENDING_CHARS.includes(char)); +} + +function commonPrefixLength(a: string, b: string): number { + let i = 0; + while (i < a.length && i < b.length && a[i] === b[i]) { + i++; + } + return i; +} + +function isEnglishFirstLine(line: string) { + line = line.trim().toLowerCase(); + + if ( + line.endsWith(":") && + !CODE_KEYWORDS_ENDING_IN_SEMICOLON.some((keyword) => + line.startsWith(keyword), + ) + ) { + return true; + } + + return ENGLISH_START_PHRASES.some((phrase) => line.startsWith(phrase)); +} + +function isEnglishPostExplanation(line: string): boolean { + const lower = line.toLowerCase(); + return ENGLISH_POST_PHRASES.some((phrase) => lower.startsWith(phrase)); +} + +function shouldRemoveLineBeforeStart(line: string): boolean { + return ( + line.trimStart().startsWith("```") || + LINES_TO_REMOVE_BEFORE_START.some((l) => line.trim() === l) + ); +} + +function shouldChangeLineAndStop(line: string): string | undefined { + if (line.trimStart() === "```") { + return line; + } + + if (line.includes(CODE_START_BLOCK)) { + return line.split(CODE_START_BLOCK)[0].trimEnd(); + } + + return undefined; +} + +function isUselessLine(line: string): boolean { + const trimmed = line.trim().toLowerCase(); + const hasUselessLine = USELESS_LINES.some( + (uselessLine) => trimmed === uselessLine, + ); + + return hasUselessLine || trimmed.startsWith("// end"); +} + +export const USELESS_LINES = ["", "```"]; +export const CODE_KEYWORDS_ENDING_IN_SEMICOLON = ["def"]; +export const CODE_START_BLOCK = "[/CODE]"; +export const BRACKET_ENDING_CHARS = [")", "]", "}", ";"]; +export const PREFIXES_TO_SKIP = [""]; +export const LINES_TO_STOP_AT = ["# End of file.", ""]; +export const LINES_TO_REMOVE_BEFORE_START = [ + "", + "[CODE]", + "", +]; + +export const ENGLISH_START_PHRASES = [ + "here is", + "here's", + "sure, here", + "sure thing", + "sure!", + "to fill", + "certainly", + "of course", + "the code should", +]; + +export const ENGLISH_POST_PHRASES = [ + "explanation:", + "here is", + "here's how", + "the above", +]; + export async function* noTopLevelKeywordsMidline( lines: LineStream, topLevelKeywords: string[], @@ -15,6 +110,7 @@ export async function* noTopLevelKeywordsMidline( for await (const line of lines) { for (const keyword of topLevelKeywords) { const indexOf = line.indexOf(`${keyword} `); + // TODO: What is this second clause for? if (indexOf >= 0 && line.slice(indexOf - 1, indexOf).trim() !== "") { yield line.slice(0, indexOf); fullStop(); @@ -25,7 +121,14 @@ export async function* noTopLevelKeywordsMidline( } } -export async function* avoidPathLine( +/** + * Filters out unwanted lines from a LineStream, specifically those starting with '// Path: ' or empty comments. + * + * @param {LineStream} stream - The input stream of lines to filter. + * @param {string} comment - The comment syntax to filter (e.g., '//' for JavaScript-style comments). + * @yields {string} The filtered lines, excluding unwanted path lines and empty comments. + */ +export async function* avoidPathLineAndEmptyComments( stream: LineStream, comment: string, ): LineStream { @@ -40,6 +143,12 @@ export async function* avoidPathLine( } } +/** + * Transforms a LineStream by adding newline characters between lines. + * + * @param {LineStream} stream - The input stream of lines. + * @yields {string} The lines from the input stream with newline characters added between them. + */ export async function* streamWithNewLines(stream: LineStream): LineStream { let firstLine = true; for await (const nextLine of stream) { @@ -51,22 +160,19 @@ export async function* streamWithNewLines(stream: LineStream): LineStream { } } -const bracketEnding = [")", "]", "}", ";"]; -function isBracketEnding(line: string): boolean { - return line - .trim() - .split("") - .some((char) => bracketEnding.includes(char)); -} - -function commonPrefixLength(a: string, b: string): number { - let i = 0; - while (i < a.length && i < b.length && a[i] === b[i]) { - i++; - } - return i; -} - +/** + * Determines if two lines of text are considered repeated or very similar. + * + * @param {string} a - The first line of text to compare. + * @param {string} b - The second line of text to compare. + * @returns {boolean} True if the lines are considered repeated, false otherwise. + * + * @description + * This function checks if two lines are repeated or very similar based on two criteria: + * 1. They have a common prefix longer than 12 characters. + * 2. The Levenshtein distance between them is less than 10% of the length of the second line. + * Lines shorter than 5 characters are never considered repeated. + */ export function lineIsRepeated(a: string, b: string): boolean { if (a.length <= 4 || b.length <= 4) { return false; @@ -80,6 +186,21 @@ export function lineIsRepeated(a: string, b: string): boolean { ); } +/** + * Filters a LineStream, stopping when a line similar to the provided one is encountered. + * + * @param {LineStream} stream - The input stream of lines to filter. + * @param {string} line - The line to compare against for similarity. + * @param {() => void} fullStop - Function to call when stopping the stream. + * @yields {string} Filtered lines until a similar line is encountered. + * + * @description + * This generator function processes the input stream, yielding lines until it encounters: + * 1. An exact match to the provided line. + * 2. A line that is considered repeated or very similar to the provided line. + * 3. For lines ending with brackets, it allows exact matches of trimmed content. + * When any of these conditions are met, it calls the fullStop function and stops yielding. + */ export async function* stopAtSimilarLine( stream: LineStream, line: string, @@ -87,6 +208,7 @@ export async function* stopAtSimilarLine( ): AsyncGenerator { const trimmedLine = line.trim(); const lineIsBracketEnding = isBracketEnding(trimmedLine); + for await (const nextLine of stream) { if (nextLine === line) { fullStop(); @@ -102,12 +224,17 @@ export async function* stopAtSimilarLine( fullStop(); break; } + yield nextLine; } } -const LINES_TO_STOP_AT = ["# End of file.", " void} fullStop - Function to call when stopping. + * @yields {string} Filtered lines until a stop phrase is encountered. + */ export async function* stopAtLines( stream: LineStream, fullStop: () => void, @@ -121,7 +248,11 @@ export async function* stopAtLines( } } -const PREFIXES_TO_SKIP = [""]; +/** + * Filters a LineStream, skipping specified prefixes on the first line. + * @param {LineStream} lines - The input stream of lines. + * @yields {string} Filtered lines with prefixes removed from the first line if applicable. + */ export async function* skipPrefixes(lines: LineStream): LineStream { let isFirstLine = true; for await (const line of lines) { @@ -137,8 +268,11 @@ export async function* skipPrefixes(lines: LineStream): LineStream { } } -const LINES_TO_SKIP = [""]; - +/** + * Filters out lines starting with specified prefixes from a LineStream. + * @param {LineStream} stream - The input stream of lines. + * @yields {string} Filtered lines that don't start with any of the LINES_TO_SKIP prefixes. + */ export async function* skipLines(stream: LineStream): LineStream { for await (const line of stream) { if (!LINES_TO_SKIP.some((skipAt) => line.startsWith(skipAt))) { @@ -147,34 +281,21 @@ export async function* skipLines(stream: LineStream): LineStream { } } -const LINES_TO_REMOVE_BEFORE_START = [ - "", - "[CODE]", - "", -]; - -function shouldRemoveLineBeforeStart(line: string): boolean { - return ( - line.trimStart().startsWith("```") || - LINES_TO_REMOVE_BEFORE_START.some((l) => line.trim() === l) - ); -} - -function shouldChangeLineAndStop(line: string): string | undefined { - if (line.trimStart() === "```") { - return line; - } - - if (line.includes("[/CODE]")) { - return line.split("[/CODE]")[0].trimEnd(); - } - - return undefined; -} - +/** + * Filters and processes lines from a code block, removing unnecessary markers and handling edge cases. + * + * @param {LineStream} rawLines - The input stream of lines to filter. + * @yields {string} Filtered and processed lines from the code block. + * + * @description + * This generator function performs the following tasks: + * 1. Removes initial lines that should be removed before the actual code starts. + * 2. Filters out ending code block markers (```) unless they are the last line. + * 3. Handles special cases where lines should be changed and the stream should stop. + * 4. Yields processed lines that are part of the actual code block content. + */ export async function* filterCodeBlockLines(rawLines: LineStream): LineStream { let seenValidLine = false; - let waitingToSeeIfLineIsLast = undefined; for await (const line of rawLines) { @@ -206,28 +327,19 @@ export async function* filterCodeBlockLines(rawLines: LineStream): LineStream { } } -function isEnglishFirstLine(line: string) { - line = line.trim().toLowerCase(); - if (line.endsWith(":") && !line.trimStart().startsWith("def")) { - return true; - } - if ( - line.startsWith("here is") || - line.startsWith("here's") || - line.startsWith("sure, here") || - line.startsWith("sure thing") || - line.startsWith("sure!") || - line.startsWith("to fill") || - line.startsWith("certainly") || - line.startsWith("of course") || - line.startsWith("the code should") - ) { - return true; - } - - return false; -} - +/** + * Filters out English explanations at the start of a code block. + * + * @param {LineStream} lines - The input stream of lines. + * @yields {string} Filtered lines with English explanations removed from the start. + * + * @description + * This generator function performs the following tasks: + * 1. Skips initial blank lines. + * 2. Removes the first line if it's identified as an English explanation. + * 3. Removes a subsequent blank line if the first line was an English explanation. + * 4. Yields all remaining lines. + */ export async function* filterEnglishLinesAtStart(lines: LineStream) { let i = 0; let wasEnglishFirstLine = false; @@ -235,6 +347,7 @@ export async function* filterEnglishLinesAtStart(lines: LineStream) { if (i === 0 && line.trim() === "") { continue; } + if (i === 0) { if (isEnglishFirstLine(line)) { wasEnglishFirstLine = true; @@ -250,18 +363,14 @@ export async function* filterEnglishLinesAtStart(lines: LineStream) { } } -function isEnglishPostExplanation(line: string): boolean { - const lower = line.toLowerCase(); - return ( - lower.startsWith("explanation:") || - lower.startsWith("here is") || - lower.startsWith("here's how") || - lower.startsWith("the above") - ); -} - +/** + * Filters out English explanations at the end of a code block. + * @param {LineStream} lines - The input stream of lines. + * @yields {string} Lines up to the end of the code block or start of English explanation. + */ export async function* filterEnglishLinesAtEnd(lines: LineStream) { let finishedCodeBlock = false; + for await (const line of lines) { if (line.trim() === "```") { finishedCodeBlock = true; @@ -273,8 +382,14 @@ export async function* filterEnglishLinesAtEnd(lines: LineStream) { } } +/** + * Removes leading indentation from the first line of a CodeLlama output. + * @param {LineStream} lines - The input stream of lines. + * @yields {string} Lines with the first line's indentation fixed if necessary. + */ export async function* fixCodeLlamaFirstLineIndentation(lines: LineStream) { let isFirstLine = true; + for await (const line of lines) { if (isFirstLine && line.startsWith(" ")) { yield line.slice(2); @@ -285,23 +400,36 @@ export async function* fixCodeLlamaFirstLineIndentation(lines: LineStream) { } } -function isUselessLine(line: string): boolean { - const trimmed = line.trim().toLowerCase(); - return trimmed === "" || trimmed === "```" || trimmed.startsWith("// end"); -} - +/** + * Filters leading and trailing blank line insertions from a stream of diff lines. + * + * @param {AsyncGenerator} diffLines - An async generator that yields DiffLine objects. + * @yields {DiffLine} Filtered DiffLine objects, with leading and trailing blank line insertions removed. + * + * @description + * This generator function processes a stream of diff lines, removing leading and trailing + * blank line insertions. It performs the following tasks: + * 1. Skips the first blank line insertion if it occurs at the beginning. + * 2. Buffers subsequent blank line insertions. + * 3. Yields buffered blank lines when a non-blank insertion is encountered. + * 4. Clears the buffer when an old line is encountered. + * 5. Yields all non-blank insertions and old lines. + */ export async function* filterLeadingAndTrailingNewLineInsertion( diffLines: AsyncGenerator, ): AsyncGenerator { let isFirst = true; let buffer: DiffLine[] = []; + for await (const diffLine of diffLines) { const isBlankLineInsertion = diffLine.type === "new" && isUselessLine(diffLine.line); + if (isFirst && isBlankLineInsertion) { isFirst = false; continue; } + isFirst = false; if (isBlankLineInsertion) { @@ -319,31 +447,38 @@ export async function* filterLeadingAndTrailingNewLineInsertion( } } +/** + * Filters a LineStream, stopping when a line repeats more than a specified number of times. + * + * @param {LineStream} lines - The input stream of lines to filter. + * @param {() => void} fullStop - Function to call when stopping the stream. + * @yields {string} Filtered lines until excessive repetition is detected. + * + * @description + * This function yields lines from the input stream until a line is repeated + * for a maximum of 3 consecutive times. When this limit is reached, it calls + * the fullStop function and stops yielding. Only the first of the repeating + * lines is yieled. + */ export async function* stopAtRepeatingLines( lines: LineStream, fullStop: () => void, ): LineStream { - const repeatedLines: string[] = []; + let previousLine: string | undefined; + let repeatCount = 0; + const MAX_REPEATS = 3; + for await (const line of lines) { - if (repeatedLines.length === 0) { - repeatedLines.push(line); - } else if (repeatedLines.length < 3) { - if (repeatedLines[repeatedLines.length - 1] === line) { - repeatedLines.push(line); - } else { - while (repeatedLines.length > 0) { - yield repeatedLines.shift()!; - } - yield line; + if (line === previousLine) { + repeatCount++; + if (repeatCount === MAX_REPEATS) { + fullStop(); + return; } } else { - yield repeatedLines[0]; - fullStop(); - return; + yield line; + repeatCount = 1; } - } - - while (repeatedLines.length > 0) { - yield repeatedLines.shift()!; + previousLine = line; } } diff --git a/core/autocomplete/postprocessing.ts b/core/autocomplete/postprocessing.ts index 958c1cdff..bc1961e69 100644 --- a/core/autocomplete/postprocessing.ts +++ b/core/autocomplete/postprocessing.ts @@ -1,6 +1,6 @@ -import type { ILLM } from ".."; -import { longestCommonSubsequence } from "../util/lcs"; -import { lineIsRepeated } from "./lineStream"; +import type { ILLM } from "../index.js"; +import { longestCommonSubsequence } from "../util/lcs.js"; +import { lineIsRepeated } from "./lineStream.js"; function rewritesLineAbove(completion: string, prefix: string): boolean { const lineAbove = prefix diff --git a/core/autocomplete/retrieval.ts b/core/autocomplete/retrieval.ts index 635f52012..422b377bd 100644 --- a/core/autocomplete/retrieval.ts +++ b/core/autocomplete/retrieval.ts @@ -1,5 +1,5 @@ import { BranchAndDir, Chunk } from "../index.js"; -import { FullTextSearchCodebaseIndex } from "../indexing/FullTextSearch.js"; +import { FullTextSearchCodebaseIndex } from "../indexing/FullTextSearchCodebaseIndex.js"; export async function fullTextRetrieve( prefix: string, diff --git a/core/autocomplete/templates.ts b/core/autocomplete/templates.ts index 11444bce2..030e0a306 100644 --- a/core/autocomplete/templates.ts +++ b/core/autocomplete/templates.ts @@ -19,6 +19,7 @@ interface AutocompleteTemplate { suffix: string, filepath: string, reponame: string, + language: string, snippets: AutocompleteSnippet[], ) => string); completionOptions?: Partial; @@ -32,8 +33,8 @@ const stableCodeFimTemplate: AutocompleteTemplate = { "", "", "", - "<|endoftext|>", "", + "<|endoftext|>", "", "", ], @@ -69,7 +70,9 @@ const codestralMultifileFimTemplate: AutocompleteTemplate = { .map((snippet, i) => `+++++ ${relativePaths[i]}\n${snippet.contents}`) .join("\n\n"); return [ - `${otherFiles}\n\n+++++ ${relativePaths[relativePaths.length - 1]}\n${prefix}`, + `${otherFiles}\n\n+++++ ${ + relativePaths[relativePaths.length - 1] + }\n${prefix}`, suffix, ]; }, @@ -78,6 +81,7 @@ const codestralMultifileFimTemplate: AutocompleteTemplate = { suffix: string, filepath: string, reponame: string, + language: string, snippets: AutocompleteSnippet[], ): string => { return `[SUFFIX]${suffix}[PREFIX]${prefix}`; @@ -109,6 +113,7 @@ const starcoder2FimTemplate: AutocompleteTemplate = { suffix: string, filename: string, reponame: string, + language: string, snippets: AutocompleteSnippet[], ): string => { const otherFiles = @@ -129,8 +134,8 @@ const starcoder2FimTemplate: AutocompleteTemplate = { "", "", "", - "<|endoftext|>", "", + "<|endoftext|>", ], }, }; @@ -162,14 +167,17 @@ const codegeexFimTemplate: AutocompleteTemplate = { suffix: string, filepath: string, reponame: string, + language: string, snippets: AutocompleteSnippet[], ): string => { const relativePaths = shortestRelativePaths([ ...snippets.map((snippet) => snippet.filepath), filepath, ]); - const baseTemplate = `###PATH:${relativePaths[relativePaths.length - 1]}\n###LANGUAGE:\n###MODE:BLOCK\n<|code_suffix|>${suffix}<|code_prefix|>${prefix}<|code_middle|>`; - if (snippets.length == 0) { + const baseTemplate = `###PATH:${ + relativePaths[relativePaths.length - 1] + }\n###LANGUAGE:${language}\n###MODE:BLOCK\n<|code_suffix|>${suffix}<|code_prefix|>${prefix}<|code_middle|>`; + if (snippets.length === 0) { return `<|user|>\n${baseTemplate}<|assistant|>\n`; } const references = `###REFERENCE:\n${snippets @@ -205,6 +213,7 @@ const holeFillerTemplate: AutocompleteTemplate = { suffix: string, filename: string, reponame: string, + language: string, snippets: AutocompleteSnippet[], ) => { // From https://github.com/VictorTaelin/AI-scripts diff --git a/core/biome.json b/core/biome.json deleted file mode 100644 index 6308ce822..000000000 --- a/core/biome.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "$schema": "https://biomejs.dev/schemas/1.6.4/schema.json", - "organizeImports": { - "enabled": true - }, - "linter": { - "enabled": true, - "rules": { - "recommended": true - } - }, - "formatter": { - "indentStyle": "space" - } -} diff --git a/core/commands/index.ts b/core/commands/index.ts index 2b1a67bbd..fd075c6ff 100644 --- a/core/commands/index.ts +++ b/core/commands/index.ts @@ -1,11 +1,7 @@ -import { - CustomCommand, - SlashCommand, - SlashCommandDescription, -} from "../index.js"; -import { stripImages } from "../llm/images.js"; -import { renderTemplatedString } from "../llm/llms/index.js"; -import SlashCommands from "./slash/index.js"; +import { CustomCommand, SlashCommand, SlashCommandDescription } from "../"; +import { stripImages } from "../llm/images"; +import { renderTemplatedString } from "../promptFiles/renderTemplatedString"; +import SlashCommands from "./slash"; export function slashFromCustomCommand( customCommand: CustomCommand, diff --git a/core/commands/slash/comment.ts b/core/commands/slash/comment.ts index 929763bf3..e3b601c04 100644 --- a/core/commands/slash/comment.ts +++ b/core/commands/slash/comment.ts @@ -1,5 +1,5 @@ -import { SlashCommand } from "../../index.js"; -import EditSlashCommand from "./edit.js"; +import { SlashCommand } from "../../"; +import EditSlashCommand from "./edit"; const CommentSlashCommand: SlashCommand = { name: "comment", diff --git a/core/commands/slash/edit.ts b/core/commands/slash/edit.ts index a0fbfdd26..a3c3ed91c 100644 --- a/core/commands/slash/edit.ts +++ b/core/commands/slash/edit.ts @@ -5,18 +5,18 @@ import { fixCodeLlamaFirstLineIndentation, stopAtLines, streamWithNewLines, -} from "../../autocomplete/lineStream.js"; -import { streamLines } from "../../diff/util.js"; -import { ContextItemWithId, ILLM, SlashCommand } from "../../index.js"; -import { stripImages } from "../../llm/images.js"; +} from "../../autocomplete/lineStream"; +import { streamLines } from "../../diff/util"; +import { ContextItemWithId, ILLM, SlashCommand } from "../../"; +import { stripImages } from "../../llm/images"; import { dedentAndGetCommonWhitespace, getMarkdownLanguageTagForFile, -} from "../../util/index.js"; +} from "../../util/"; import { contextItemToRangeInFileWithContents, type RangeInFileWithContents, -} from "../util.js"; +} from "../util"; const PROMPT = `Take the file prefix and suffix into account, but only rewrite the code_to_edit as specified in the user_request. The code you write in modified_code_to_edit will replace the code between the code_to_edit tags. Do NOT preface your answer or write anything other than code. The tag should be written to indicate the end of the modified code section. Do not ever use nested tags. @@ -62,13 +62,6 @@ export async function getPromptParts( ) { const maxTokens = Math.floor(model.contextLength / 2); - const TOKENS_TO_BE_CONSIDERED_LARGE_RANGE = tokenLimit ?? 1200; - // if (model.countTokens(rif.contents) > TOKENS_TO_BE_CONSIDERED_LARGE_RANGE) { - // throw new Error( - // "\n\n**It looks like you've selected a large range to edit, which may take a while to complete. If you'd like to cancel, click the 'X' button above. If you highlight a more specific range, Continue will only edit within it.**" - // ); - // } - const BUFFER_FOR_FUNCTIONS = 400; let totalTokens = model.countTokens(fullFileContents + PROMPT + input) + diff --git a/core/commands/slash/index.ts b/core/commands/slash/index.ts index e0d507a7a..0a6fc327d 100644 --- a/core/commands/slash/index.ts +++ b/core/commands/slash/index.ts @@ -1,12 +1,13 @@ -import GenerateTerminalCommand from "./cmd.js"; -import CommentSlashCommand from "./comment.js"; -import CommitMessageCommand from "./commit.js"; -import DraftIssueCommand from "./draftIssue.js"; -import EditSlashCommand from "./edit.js"; -import HttpSlashCommand from "./http.js"; -import ReviewMessageCommand from "./review.js"; -import ShareSlashCommand from "./share.js"; -import StackOverflowSlashCommand from "./stackOverflow.js"; +import GenerateTerminalCommand from "./cmd"; +import CommentSlashCommand from "./comment"; +import CommitMessageCommand from "./commit"; +import DraftIssueCommand from "./draftIssue"; +import EditSlashCommand from "./edit"; +import HttpSlashCommand from "./http"; +import ReviewMessageCommand from "./review"; +import ShareSlashCommand from "./share"; +import StackOverflowSlashCommand from "./stackOverflow"; +import OnboardSlashCommand from "./onboard"; export default [ DraftIssueCommand, @@ -18,4 +19,5 @@ export default [ HttpSlashCommand, CommitMessageCommand, ReviewMessageCommand, + OnboardSlashCommand, ]; diff --git a/core/commands/slash/onboard.ts b/core/commands/slash/onboard.ts new file mode 100644 index 000000000..a7738a041 --- /dev/null +++ b/core/commands/slash/onboard.ts @@ -0,0 +1,155 @@ +import { IDE, SlashCommand } from "../.."; +import * as fs from "fs/promises"; +import * as path from "path"; +import { stripImages } from "../../llm/images"; +import ignore from "ignore"; +import { + defaultIgnoreDir, + defaultIgnoreFile, + gitIgArrayFromFile, +} from "../../indexing/ignore"; + +const LANGUAGE_DEP_MGMT_FILENAMES = [ + "package.json", // JavaScript (Node.js) + "requirements.txt", // Python + "Gemfile", // Ruby + "pom.xml", // Java (Maven) + "build.gradle", // Java (Gradle) + "composer.json", // PHP + "Cargo.toml", // Rust + "go.mod", // Go + "packages.config", // C# (.NET) + "*.csproj", // C# (.NET Core) + "pubspec.yaml", // Dart + "Project.toml", // Julia + "mix.exs", // Elixir + "rebar.config", // Erlang + "shard.yml", // Crystal + "Package.swift", // Swift + "dependencies.gradle", // Kotlin (when using Gradle) + "Podfile", // Objective-C/Swift (CocoaPods) + "*.cabal", // Haskell + "dub.json", // D +]; + +const MAX_EXPLORE_DEPTH = 2; + +const OnboardSlashCommand: SlashCommand = { + name: "onboard", + description: "Familiarize yourself with the codebase", + run: async function* ({ llm, ide }) { + const [workspaceDir] = await ide.getWorkspaceDirs(); + + const context = await gatherProjectContext(workspaceDir, ide); + const prompt = createOnboardingPrompt(context); + + for await (const chunk of llm.streamChat([ + { role: "user", content: prompt }, + ])) { + yield stripImages(chunk.content); + } + }, +}; + +async function getEntriesFilteredByIgnore(dir: string, ide: IDE) { + const entries = await fs.readdir(dir, { withFileTypes: true }); + + let ig = ignore().add(defaultIgnoreDir).add(defaultIgnoreFile); + + const gitIgnorePath = path.join(dir, ".gitignore"); + + const hasIgnoreFile = await fs + .access(gitIgnorePath) + .then(() => true) + .catch(() => false); + + if (hasIgnoreFile) { + const gitIgnore = await ide.readFile(gitIgnorePath); + const igPatterns = gitIgArrayFromFile(gitIgnore); + + ig = ig.add(igPatterns); + } + + const filteredEntries = entries.filter((entry) => !ig.ignores(entry.name)); + + return filteredEntries; +} + +async function gatherProjectContext( + workspaceDir: string, + ide: IDE, +): Promise { + let context = ""; + + async function exploreDirectory(dir: string, currentDepth: number = 0) { + if (currentDepth > MAX_EXPLORE_DEPTH) { + return; + } + + const entries = await getEntriesFilteredByIgnore(dir, ide); + + for (const entry of entries) { + const fullPath = path.join(dir, entry.name); + const relativePath = path.relative(workspaceDir, fullPath); + + if (entry.isDirectory()) { + context += `\nFolder: ${relativePath}\n`; + await exploreDirectory(fullPath, currentDepth + 1); + } else { + if (entry.name.toLowerCase() === "readme.md") { + const content = await fs.readFile(fullPath, "utf-8"); + context += `README for ${relativePath}:\n${content}\n\n`; + } else if (LANGUAGE_DEP_MGMT_FILENAMES.includes(entry.name)) { + const content = await fs.readFile(fullPath, "utf-8"); + context += `${entry.name} for ${relativePath}:\n${content}\n\n`; + } + } + } + } + + await exploreDirectory(workspaceDir); + + return context; +} + +function createOnboardingPrompt(context: string): string { + return ` + As a helpful AI assistant, your task is to onboard a new developer to this project. + Use the following context about the project structure, READMEs, and dependency files to create a comprehensive overview: + + ${context} + + Please provide an overview of the project with the following guidelines: + - Determine the most important folders in the project, at most 10 + - Go through each important folder step-by-step: + - Explain what each folder does in isolation by summarzing the README or package.json file, if available + - Mention the most popular or common packages used in that folder and their roles. + - After covering individual folders, zoom out to explain at most 5 high-level insights about the project's architecture: + - How different parts of the codebase fit together. + - The overall project architecture or design patterns evident from the folder structure and dependencies. + - Provide at most 5 additional insights on the project's architecture that weren't covered in the folder-by-folder breakdown. + + Your response should be structured, clear, and focused on giving the new developer both a detailed understanding of individual components and a high-level overview of the project as a whole. + + Here is an example of a valid response: + + ## Important folders + + ### /folder1 + - Description: Contains the main application logic. + - Key packages: Express.js for routing, Mongoose for database operations. + + #### /folder1/folder2 + + ## Project Architecture + - The frontend is built using React and Redux for state management. + - The backend is a Node.js application using Express.js for routing and Mongoose for database operations. + - The application follows a Model-View-Controller (MVC) architecture. + + ## Additional Insights + - The project is using a monorepo structure. + - The project uses TypeScript for type checking. + `; +} + +export default OnboardSlashCommand; diff --git a/core/config/ConfigHandler.test.ts b/core/config/ConfigHandler.test.ts new file mode 100644 index 000000000..ef4e1814d --- /dev/null +++ b/core/config/ConfigHandler.test.ts @@ -0,0 +1,42 @@ +import fs from "node:fs"; +import path from "node:path"; +import { defaultConfig } from "./default"; +import { getConfigTsPath } from "../util/paths"; +import { testConfigHandler } from "../test/util/fixtures"; +import { TEST_DIR } from "../test/util/testDir"; + +describe.skip("Test the ConfigHandler and E2E config loading", () => { + test("should show only local profile", () => { + const profiles = testConfigHandler.listProfiles(); + expect(profiles.length).toBe(1); + expect(profiles[0].id).toBe("local"); + + const currentProfile = testConfigHandler.currentProfile; + expect(currentProfile.profileId).toBe("local"); + }); + + test("should load the default config successfully", async () => { + const config = await testConfigHandler.loadConfig(); + expect(config.models.length).toBe(defaultConfig.models.length); + }); + + test.skip("should add a system message from config.ts", async () => { + const configTs = `export function modifyConfig(config: Config): Config { + config.systemMessage = "SYSTEM"; + return config; +}`; + fs.writeFileSync(getConfigTsPath(), configTs); + await new Promise((resolve) => setTimeout(resolve, 1000)); + const config = await testConfigHandler.reloadConfig(); + expect(config.systemMessage).toBe("SYSTEM"); + }); + + test.skip("should acknowledge override from .continuerc.json", async () => { + fs.writeFileSync( + path.join(TEST_DIR, ".continuerc.json"), + JSON.stringify({ systemMessage: "SYSTEM2" }), + ); + const config = await testConfigHandler.reloadConfig(); + expect(config.systemMessage).toBe("SYSTEM2"); + }); +}); diff --git a/core/config/ConfigHandler.ts b/core/config/ConfigHandler.ts index 2180ce0a1..57f728a05 100644 --- a/core/config/ConfigHandler.ts +++ b/core/config/ConfigHandler.ts @@ -51,12 +51,12 @@ class ProfileLifecycleManager { } // Clear saved config and reload - reloadConfig(): Promise { + async reloadConfig(): Promise { this.savedConfig = undefined; this.savedBrowserConfig = undefined; this.pendingConfigPromise = undefined; - return this.profileLoader.doLoadConfig(); + return await this.profileLoader.doLoadConfig(); } async loadConfig( @@ -105,6 +105,37 @@ export class ConfigHandler { private profiles: ProfileLifecycleManager[]; private selectedProfileId: string; + constructor( + private readonly ide: IDE, + private ideSettingsPromise: Promise, + private readonly writeLog: (text: string) => Promise, + private controlPlaneClient: ControlPlaneClient, + ) { + this.ide = ide; + this.ideSettingsPromise = ideSettingsPromise; + this.writeLog = writeLog; + + // Set local profile as default + const localProfileLoader = new LocalProfileLoader( + ide, + ideSettingsPromise, + controlPlaneClient, + writeLog, + ); + this.profiles = [new ProfileLifecycleManager(localProfileLoader)]; + this.selectedProfileId = localProfileLoader.profileId; + + // Always load local profile immediately in case control plane doesn't load + try { + this.loadConfig(); + } catch (e) { + console.error("Failed to load config: ", e); + } + + // Load control plane profiles + this.fetchControlPlaneProfiles(); + } + // This will be the local profile private get fallbackProfile() { return this.profiles[0]; @@ -163,37 +194,6 @@ export class ConfigHandler { }); } - constructor( - private readonly ide: IDE, - private ideSettingsPromise: Promise, - private readonly writeLog: (text: string) => Promise, - private controlPlaneClient: ControlPlaneClient, - ) { - this.ide = ide; - this.ideSettingsPromise = ideSettingsPromise; - this.writeLog = writeLog; - - // Set local profile as default - const localProfileLoader = new LocalProfileLoader( - ide, - ideSettingsPromise, - controlPlaneClient, - writeLog, - ); - this.profiles = [new ProfileLifecycleManager(localProfileLoader)]; - this.selectedProfileId = localProfileLoader.profileId; - - // Always load local profile immediately in case control plane doesn't load - try { - this.loadConfig(); - } catch (e) { - console.error("Failed to load config: ", e); - } - - // Load control plane profiles - this.fetchControlPlaneProfiles(); - } - async setSelectedProfile(profileId: string) { this.selectedProfileId = profileId; const newConfig = await this.loadConfig(); @@ -225,7 +225,9 @@ export class ConfigHandler { this.controlPlaneClient = new ControlPlaneClient( Promise.resolve(sessionInfo), ); - this.fetchControlPlaneProfiles(); + this.fetchControlPlaneProfiles().catch((e) => { + console.error("Failed to fetch control plane profiles: ", e); + }); } private profilesListeners: ((profiles: ProfileDescription[]) => void)[] = []; @@ -258,6 +260,7 @@ export class ConfigHandler { const newConfig = await this.currentProfile.reloadConfig(); this.inactiveProfiles.forEach((profile) => profile.clearConfig()); this.notifyConfigListeners(newConfig); + return newConfig; } getSerializedConfig(): Promise { diff --git a/core/config/load.ts b/core/config/load.ts index faf65dfc9..2bb836d73 100644 --- a/core/config/load.ts +++ b/core/config/load.ts @@ -36,6 +36,7 @@ import CustomLLMClass from "../llm/llms/CustomLLM.js"; import FreeTrial from "../llm/llms/FreeTrial.js"; import { llmFromDescription } from "../llm/llms/index.js"; +import { execSync } from "child_process"; import CodebaseContextProvider from "../context/providers/CodebaseContextProvider.js"; import ContinueProxyContextProvider from "../context/providers/ContinueProxyContextProvider.js"; import { fetchwithRequestOptions } from "../util/fetchWithOptions.js"; @@ -62,8 +63,6 @@ import { slashCommandFromPromptFile, } from "./promptFile.js"; -const { execSync } = require("child_process"); - function resolveSerializedConfig(filepath: string): SerializedContinueConfig { let content = fs.readFileSync(filepath, "utf8"); const config = JSONC.parse(content) as unknown as SerializedContinueConfig; @@ -356,9 +355,11 @@ async function intermediateToFinalConfig( // These context providers are always included, regardless of what, if anything, // the user has configured in config.json + + const codebaseContextParams = ((config.contextProviders || []).filter(isContextProviderWithParams).find(cp => cp.name === "codebase") as ContextProviderWithParams | undefined)?.params || {}; const DEFAULT_CONTEXT_PROVIDERS = [ new FileContextProvider({}), - new CodebaseContextProvider({}), + new CodebaseContextProvider(codebaseContextParams), ]; const DEFAULT_CONTEXT_PROVIDERS_TITLES = DEFAULT_CONTEXT_PROVIDERS.map( @@ -465,6 +466,7 @@ function finalToBrowserConfig( systemMessage: m.systemMessage, requestOptions: m.requestOptions, promptTemplates: m.promptTemplates as any, + capabilities: m.capabilities, })), systemMessage: final.systemMessage, completionOptions: final.completionOptions, @@ -534,7 +536,7 @@ async function buildConfigTs() { ); } else { // Dynamic import esbuild so potentially disastrous errors can be caught - const esbuild = require("esbuild"); + const esbuild = await import("esbuild"); await esbuild.build({ entryPoints: [getConfigTsPath()], @@ -586,8 +588,10 @@ async function loadFullConfigNode( try { // Try config.ts first const configJsPath = getConfigJsPath(); - const module = await require(configJsPath); - delete require.cache[require.resolve(configJsPath)]; + const module = await import(configJsPath); + if (typeof require !== "undefined") { + delete require.cache[require.resolve(configJsPath)]; + } if (!module.modifyConfig) { throw new Error("config.ts does not export a modifyConfig function."); } @@ -603,8 +607,10 @@ async function loadFullConfigNode( const configJsPathForRemote = getConfigJsPathForRemote( ideSettings.remoteConfigServerUrl, ); - const module = await require(configJsPathForRemote); - delete require.cache[require.resolve(configJsPathForRemote)]; + const module = await import(configJsPathForRemote); + if (typeof require !== "undefined") { + delete require.cache[require.resolve(configJsPathForRemote)]; + } if (!module.modifyConfig) { throw new Error("config.ts does not export a modifyConfig function."); } diff --git a/core/config/profile/ControlPlaneProfileLoader.ts b/core/config/profile/ControlPlaneProfileLoader.ts index 0602088bd..12fe16ec0 100644 --- a/core/config/profile/ControlPlaneProfileLoader.ts +++ b/core/config/profile/ControlPlaneProfileLoader.ts @@ -1,13 +1,13 @@ import { ConfigJson } from "@continuedev/config-types"; +import { ControlPlaneClient } from "../../control-plane/client.js"; import { ContinueConfig, IDE, IdeSettings, SerializedContinueConfig, -} from "../.."; -import { ControlPlaneClient } from "../../control-plane/client"; -import { IProfileLoader } from "./IProfileLoader"; -import doLoadConfig from "./doLoadConfig"; +} from "../../index.js"; +import { IProfileLoader } from "./IProfileLoader.js"; +import doLoadConfig from "./doLoadConfig.js"; export default class ControlPlaneProfileLoader implements IProfileLoader { private static RELOAD_INTERVAL = 1000 * 60 * 15; // every 15 minutes @@ -50,6 +50,7 @@ export default class ControlPlaneProfileLoader implements IProfileLoader { this.controlPlaneClient, this.writeLog, serializedConfig, + this.workspaceId, ); } diff --git a/core/config/profile/IProfileLoader.ts b/core/config/profile/IProfileLoader.ts index ffd6e94fb..b803e3f68 100644 --- a/core/config/profile/IProfileLoader.ts +++ b/core/config/profile/IProfileLoader.ts @@ -1,6 +1,6 @@ // ProfileHandlers manage the loading of a config, allowing us to abstract over different ways of getting to a ContinueConfig -import { ContinueConfig } from "../.."; +import { ContinueConfig } from "../../index.js"; // After we have the ContinueConfig, the ConfigHandler takes care of everything else (loading models, lifecycle, etc.) export interface IProfileLoader { diff --git a/core/config/profile/LocalProfileLoader.ts b/core/config/profile/LocalProfileLoader.ts index a79406d49..69cfeb9a5 100644 --- a/core/config/profile/LocalProfileLoader.ts +++ b/core/config/profile/LocalProfileLoader.ts @@ -1,7 +1,7 @@ -import { ContinueConfig, IDE, IdeSettings } from "../.."; -import { ControlPlaneClient } from "../../control-plane/client"; -import doLoadConfig from "./doLoadConfig"; -import { IProfileLoader } from "./IProfileLoader"; +import { ControlPlaneClient } from "../../control-plane/client.js"; +import { ContinueConfig, IDE, IdeSettings } from "../../index.js"; +import doLoadConfig from "./doLoadConfig.js"; +import { IProfileLoader } from "./IProfileLoader.js"; export default class LocalProfileLoader implements IProfileLoader { static ID = "local"; diff --git a/core/config/profile/doLoadConfig.ts b/core/config/profile/doLoadConfig.ts index 35f7bdf25..a813846da 100644 --- a/core/config/profile/doLoadConfig.ts +++ b/core/config/profile/doLoadConfig.ts @@ -1,14 +1,17 @@ +import { ContinueProxyReranker } from "../../context/rerankers/ContinueProxyReranker.js"; +import { ControlPlaneClient } from "../../control-plane/client.js"; +import { TeamAnalytics } from "../../control-plane/TeamAnalytics.js"; import { ContinueRcJson, IDE, IdeSettings, SerializedContinueConfig, -} from "../.."; -import { ControlPlaneClient } from "../../control-plane/client"; -import { TeamAnalytics } from "../../control-plane/TeamAnalytics"; -import ContinueProxy from "../../llm/llms/stubs/ContinueProxy"; -import { Telemetry } from "../../util/posthog"; -import { loadFullConfigNode } from "../load"; +} from "../../index.js"; +import ContinueProxyEmbeddingsProvider from "../../indexing/embeddings/ContinueProxyEmbeddingsProvider.js"; +import ContinueProxy from "../../llm/llms/stubs/ContinueProxy.js"; +import { Telemetry } from "../../util/posthog.js"; +import { TTS } from "../../util/tts.js"; +import { loadFullConfigNode } from "../load.js"; export default async function doLoadConfig( ide: IDE, @@ -16,6 +19,7 @@ export default async function doLoadConfig( controlPlaneClient: ControlPlaneClient, writeLog: (message: string) => Promise, overrideConfigJson: SerializedContinueConfig | undefined, + workspaceId?: string, ) { let workspaceConfigs: ContinueRcJson[] = []; try { @@ -46,14 +50,18 @@ export default async function doLoadConfig( await Telemetry.setup( newConfig.allowAnonymousTelemetry ?? true, await ide.getUniqueId(), - ideInfo.extensionVersion, + ideInfo, ); + // TODO: pass config to pre-load non-system TTS models + await TTS.setup(); + if (newConfig.analytics) { await TeamAnalytics.setup( newConfig.analytics as any, // TODO: Need to get rid of index.d.ts once and for all uniqueId, ideInfo.extensionVersion, + workspaceId, ); } @@ -65,5 +73,16 @@ export default async function doLoadConfig( }, ); + if (newConfig.embeddingsProvider?.providerName === "continue-proxy") { + ( + newConfig.embeddingsProvider as ContinueProxyEmbeddingsProvider + ).workOsAccessToken = workOsAccessToken; + } + + if (newConfig.reranker?.name === "continue-proxy") { + (newConfig.reranker as ContinueProxyReranker).workOsAccessToken = + workOsAccessToken; + } + return newConfig; } diff --git a/core/config/promptFile.ts b/core/config/promptFile.ts index 2bb307bdf..f1bfc898d 100644 --- a/core/config/promptFile.ts +++ b/core/config/promptFile.ts @@ -4,8 +4,8 @@ import * as YAML from "yaml"; import type { IDE, SlashCommand } from ".."; import { walkDir } from "../indexing/walkDir"; import { stripImages } from "../llm/images"; -import { renderTemplatedString } from "../llm/llms/index.js"; -import { getBasename } from "../util/index.js"; +import { renderTemplatedString } from "../promptFiles/renderTemplatedString"; +import { getBasename } from "../util/index"; export const DEFAULT_PROMPTS_FOLDER = ".prompts"; @@ -15,6 +15,7 @@ export async function getPromptFiles( ): Promise<{ path: string; content: string }[]> { try { const exists = await ide.fileExists(dir); + if (!exists) { return []; } @@ -34,7 +35,7 @@ export async function getPromptFiles( const DEFAULT_PROMPT_FILE = `# This is an example ".prompt" file # It is used to define and reuse prompts within Continue # Continue will automatically create a slash command for each prompt in the .prompts folder -# To learn more, see the full .prompt file reference: https://docs.continue.dev/walkthroughs/prompt-files +# To learn more, see the full .prompt file reference: https://docs.continue.dev/features/prompt-files temperature: 0.0 --- {{{ diff }}} @@ -89,6 +90,32 @@ export function slashCommandFromPromptFile( path: string, content: string, ): SlashCommand { + const { name, description, systemMessage, prompt } = parsePromptFile( + path, + content, + ); + + return { + name, + description, + run: async function* (context) { + const userInput = extractUserInput(context.input, name); + const renderedPrompt = await renderPrompt(prompt, context, userInput); + const messages = updateChatHistory( + context.history, + name, + renderedPrompt, + systemMessage, + ); + + for await (const chunk of context.llm.streamChat(messages)) { + yield stripImages(chunk.content); + } + }, + }; +} + +function parsePromptFile(path: string, content: string) { let [preambleRaw, prompt] = content.split("\n---\n"); if (prompt === undefined) { prompt = preambleRaw; @@ -105,114 +132,122 @@ export function slashCommandFromPromptFile( prompt = prompt.split("")[1].trim(); } - return { - name, - description, - run: async function* ({ - input, - llm, - history, - ide, - config, - fetch, - selectedCode, - addContextItem, - }) { - // Remove slash command prefix from input - let userInput = input; - if (userInput.startsWith(`/${name}`)) { - userInput = userInput - .slice(name.length + 1, userInput.length) - .trimStart(); - } + return { name, description, systemMessage, prompt }; +} - // Render prompt template - const helpers: [string, Handlebars.HelperDelegate][] | undefined = - config.contextProviders?.map((provider) => { - return [ - provider.description.title, - async (context: any) => { - const items = await provider.getContextItems(context, { - embeddingsProvider: config.embeddingsProvider, - fetch, - fullInput: userInput, - ide, - llm, - reranker: config.reranker, - selectedCode, - }); - items.forEach((item) => - addContextItem({ - ...item, - id: { - itemId: item.description, - providerTitle: provider.description.title, - }, - }), - ); - return items.map((item) => item.content).join("\n\n"); - }, - ]; - }); +function extractUserInput(input: string, commandName: string): string { + if (input.startsWith(`/${commandName}`)) { + return input.slice(commandName.length + 1).trimStart(); + } + return input; +} - // A few context providers that don't need to be in config.json to work in .prompt files - const diff = await ide.getDiff(); - const currentFilePath = await ide.getCurrentFile(); - const promptUserInput = await renderTemplatedString( - prompt, - ide.readFile.bind(ide), - { - input: userInput, - diff, - currentFile: currentFilePath - ? await ide.readFile(currentFilePath) - : undefined, - }, - helpers, +async function renderPrompt(prompt: string, context: any, userInput: string) { + const helpers = getContextProviderHelpers(context); + + // A few context providers that don't need to be in config.json to work in .prompt files + const diff = await context.ide.getDiff(); + const currentFilePath = await context.ide.getCurrentFile(); + const currentFile = currentFilePath + ? await context.ide.readFile(currentFilePath) + : undefined; + + return renderTemplatedString( + prompt, + context.ide.readFile.bind(context.ide), + { diff, currentFile, input: userInput }, + helpers, + ); +} + +function getContextProviderHelpers( + context: any, +): Array<[string, Handlebars.HelperDelegate]> | undefined { + return context.config.contextProviders?.map((provider: any) => [ + provider.description.title, + async (helperContext: any) => { + const items = await provider.getContextItems(helperContext, { + config: context.config, + embeddingsProvider: context.config.embeddingsProvider, + fetch: context.fetch, + fullInput: context.input, + ide: context.ide, + llm: context.llm, + reranker: context.config.reranker, + selectedCode: context.selectedCode, + }); + + items.forEach((item: any) => + context.addContextItem(createContextItem(item, provider)), ); - const messages = [...history]; - // Find the last chat message with this slash command and replace it with the user input - for (let i = messages.length - 1; i >= 0; i--) { - const { role, content } = messages[i]; - if (role !== "user") { - continue; - } + return items.map((item: any) => item.content).join("\n\n"); + }, + ]); +} - if ( - Array.isArray(content) && - content.some((part) => part.text?.startsWith(`/${name}`)) - ) { - messages[i] = { - ...messages[i], - content: content.map((part) => { - return part.text?.startsWith(`/${name}`) - ? { ...part, text: promptUserInput } - : part; - }), - }; - break; - } else if ( - typeof content === "string" && - content.startsWith(`/${name}`) - ) { - messages[i] = { ...messages[i], content: promptUserInput }; - break; - } - } - - // System message - if (systemMessage) { - if (messages[0]?.role === "system") { - messages[0].content = systemMessage; - } else { - messages.unshift({ role: "system", content: systemMessage }); - } - } - - for await (const chunk of llm.streamChat(messages)) { - yield stripImages(chunk.content); - } +function createContextItem(item: any, provider: any) { + return { + ...item, + id: { + itemId: item.description, + providerTitle: provider.description.title, }, }; } + +function updateChatHistory( + history: any[], + commandName: string, + renderedPrompt: string, + systemMessage?: string, +) { + 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.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 (systemMessage) { + messages[0]?.role === "system" + ? (messages[0].content = systemMessage) + : messages.unshift({ role: "system", content: systemMessage }); + } + + 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/config/types.ts b/core/config/types.ts index d950c15f7..97083bcd5 100644 --- a/core/config/types.ts +++ b/core/config/types.ts @@ -1,28 +1,5 @@ const Types = ` declare global { - declare global { - interface Window { - ide?: "vscode"; - windowId: string; - serverUrl: string; - vscMachineId: string; - vscMediaUrl: string; - fullColorTheme?: { - rules?: { - token?: string; - foreground?: string; - }[]; - }; - colorThemeName?: string; - workspacePaths?: string[]; - postIntellijMessage?: ( - messageType: string, - data: any, - messageIde: string, - ) => void; - } - } - export interface ChunkWithoutID { content: string; startLine: number; @@ -507,6 +484,7 @@ declare global { | "gemini" | "mistral" | "bedrock" + | "sagemaker" | "deepinfra" | "flowise" | "groq" diff --git a/core/context/providers/DatabaseContextProvider.ts b/core/context/providers/DatabaseContextProvider.ts index 272fc9c34..81a0a2710 100644 --- a/core/context/providers/DatabaseContextProvider.ts +++ b/core/context/providers/DatabaseContextProvider.ts @@ -6,6 +6,7 @@ import { LoadSubmenuItemsArgs, } from "../../index.js"; import { BaseContextProvider } from "../index.js"; +import getDatabaseAdapter from "dbinfoz"; class DatabaseContextProvider extends BaseContextProvider { static description: ContextProviderDescription = { @@ -30,10 +31,9 @@ class DatabaseContextProvider extends BaseContextProvider { const [connectionName, table] = query.split("."); - const getDatabaseAdapter = await require("dbinfoz"); - for (const connection of connections) { if (connection.name === connectionName) { + // @ts-ignore (incorrect typings on module's declaration file) const adapter = getDatabaseAdapter( connection.connection_type, connection.connection, @@ -87,9 +87,8 @@ class DatabaseContextProvider extends BaseContextProvider { return contextItems; } - const getDatabaseAdapter = await require("dbinfoz"); - for (const connection of connections) { + // @ts-ignore (incorrect typings on module's declaration file) const adapter = getDatabaseAdapter( connection.connection_type, connection.connection, diff --git a/core/context/providers/DocsContextProvider.ts b/core/context/providers/DocsContextProvider.ts index c2c6af7f0..972c12190 100644 --- a/core/context/providers/DocsContextProvider.ts +++ b/core/context/providers/DocsContextProvider.ts @@ -1,21 +1,19 @@ +import { BaseContextProvider } from "../"; import { Chunk, ContextItem, ContextProviderDescription, ContextProviderExtras, ContextSubmenuItem, - EmbeddingsProvider, LoadSubmenuItemsArgs, - Reranker, -} from "../../index.js"; -import { DocsService } from "../../indexing/docs/DocsService.js"; -import preIndexedDocs from "../../indexing/docs/preIndexedDocs.js"; -import { Telemetry } from "../../util/posthog.js"; -import { BaseContextProvider } from "../index.js"; +} from "../.."; +import DocsService from "../../indexing/docs/DocsService"; +import preIndexedDocs from "../../indexing/docs/preIndexedDocs"; +import { Telemetry } from "../../util/posthog"; class DocsContextProvider extends BaseContextProvider { - static DEFAULT_N_RETRIEVE = 30; - static DEFAULT_N_FINAL = 15; + static nRetrieve = 30; + static nFinal = 15; static description: ContextProviderDescription = { title: "docs", displayTitle: "Docs", @@ -23,11 +21,8 @@ class DocsContextProvider extends BaseContextProvider { type: "submenu", }; - private docsService: DocsService; - constructor(options: any) { super(options); - this.docsService = DocsService.getInstance(); } private async _rerankChunks( @@ -46,14 +41,14 @@ class DocsContextProvider extends BaseContextProvider { chunksCopy = chunksCopy.splice( 0, - this.options?.nFinal ?? DocsContextProvider.DEFAULT_N_FINAL, + this.options?.nFinal ?? DocsContextProvider.nFinal, ); } catch (e) { console.warn(`Failed to rerank docs results: ${e}`); chunksCopy = chunksCopy.splice( 0, - this.options?.nFinal ?? DocsContextProvider.DEFAULT_N_FINAL, + this.options?.nFinal ?? DocsContextProvider.nFinal, ); } @@ -84,14 +79,15 @@ class DocsContextProvider extends BaseContextProvider { query: string, extras: ContextProviderExtras, ): Promise { - const ideInfo = await extras.ide.getIdeInfo(); - const isJetBrains = ideInfo.ideType === "jetbrains"; + const docsService = DocsService.getSingleton(); + + if (!docsService) { + console.error(`${DocsService.name} has not been initialized`); + return []; + } const isJetBrainsAndPreIndexedDocsProvider = - this.docsService.isJetBrainsAndPreIndexedDocsProvider( - ideInfo, - extras.embeddingsProvider.id, - ); + await docsService.isJetBrainsAndPreIndexedDocsProvider(); if (isJetBrainsAndPreIndexedDocsProvider) { extras.ide.errorPopup( @@ -106,29 +102,25 @@ class DocsContextProvider extends BaseContextProvider { const preIndexedDoc = preIndexedDocs[query]; - let embeddingsProvider: EmbeddingsProvider; - - if (!!preIndexedDoc && !isJetBrains) { - // Pre-indexed docs should be filtered out in `loadSubmenuItems`, - // for JetBrains users, but we sanity check that here + if (!!preIndexedDoc) { Telemetry.capture("docs_pre_indexed_doc_used", { doc: preIndexedDoc["title"], }); - - embeddingsProvider = DocsService.preIndexedDocsEmbeddingsProvider; - } else { - embeddingsProvider = extras.embeddingsProvider; } + const embeddingsProvider = + await docsService.getEmbeddingsProvider(!!preIndexedDoc); + const [vector] = await embeddingsProvider.embed([extras.fullInput]); - let chunks = await this.docsService.retrieve( + let chunks = await docsService.retrieveChunks( query, vector, - this.options?.nRetrieve ?? DocsContextProvider.DEFAULT_N_RETRIEVE, - embeddingsProvider.id, + this.options?.nRetrieve ?? DocsContextProvider.nRetrieve, ); + const favicon = await docsService.getFavicon(query); + if (extras.reranker) { chunks = await this._rerankChunks( chunks, @@ -140,6 +132,7 @@ class DocsContextProvider extends BaseContextProvider { return [ ...chunks .map((chunk) => ({ + icon: favicon, name: chunk.filepath.includes("/tree/main") // For display of GitHub files ? chunk.filepath .split("/") @@ -168,17 +161,19 @@ class DocsContextProvider extends BaseContextProvider { async loadSubmenuItems( args: LoadSubmenuItemsArgs, ): Promise { - const ideInfo = await args.ide.getIdeInfo(); - const isJetBrains = ideInfo.ideType === "jetbrains"; - const configSites = [ - ...new Set([...(this.options?.sites || []), ...(args.config.docs || [])]), - ]; + const docsService = DocsService.getSingleton(); + + if (!docsService) { + console.error(`${DocsService.name} has not been initialized`); + return []; + } + + const docs = (await docsService.list()) ?? []; + const canUsePreindexedDocs = await docsService.canUsePreindexedDocs(); + const submenuItemsMap = new Map(); - if (!isJetBrains) { - // Currently, we generate and host embeddings for pre-indexed docs using transformers.js. - // However, we don't ship transformers.js with the JetBrains extension. - // So, we only include pre-indexed docs in the submenu for non-JetBrains IDEs. + if (canUsePreindexedDocs) { for (const { startUrl, title } of Object.values(preIndexedDocs)) { submenuItemsMap.set(startUrl, { title, @@ -191,25 +186,18 @@ class DocsContextProvider extends BaseContextProvider { } } - for (const { title, baseUrl } of await this.docsService.list()) { - submenuItemsMap.set(baseUrl, { - title, - id: baseUrl, - description: new URL(baseUrl).hostname, - }); - } - - for (const { startUrl, title } of configSites) { + for (const { startUrl, title, favicon } of docs) { submenuItemsMap.set(startUrl, { title, id: startUrl, description: new URL(startUrl).hostname, + icon: favicon, }); } const submenuItems = Array.from(submenuItemsMap.values()); - if (!isJetBrains) { + if (canUsePreindexedDocs) { return this._sortByPreIndexedDocs(submenuItems); } diff --git a/core/context/providers/JiraIssuesContextProvider/JiraClient.ts b/core/context/providers/JiraIssuesContextProvider/JiraClient.ts index c04defdaa..27f6df803 100644 --- a/core/context/providers/JiraIssuesContextProvider/JiraClient.ts +++ b/core/context/providers/JiraIssuesContextProvider/JiraClient.ts @@ -1,6 +1,6 @@ import { RequestOptions } from "../../../index.js"; -const { convert: adf2md } = require("adf-to-md"); - +// @ts-ignore +import adf2md from "adf-to-md"; interface JiraClientOptions { domain: string; username: string; diff --git a/core/context/providers/PostgresContextProvider.ts b/core/context/providers/PostgresContextProvider.ts index ff8ba289f..55c00ae3c 100644 --- a/core/context/providers/PostgresContextProvider.ts +++ b/core/context/providers/PostgresContextProvider.ts @@ -20,7 +20,9 @@ class PostgresContextProvider extends BaseContextProvider { static DEFAULT_SAMPLE_ROWS = 3; private async getPool() { - const pg = await require("pg"); + // @ts-ignore + const pg = await import("pg"); + return new pg.Pool({ host: this.options.host, port: this.options.port, @@ -35,7 +37,7 @@ class PostgresContextProvider extends BaseContextProvider { let tablesInfoQuery = ` SELECT table_schema, table_name FROM information_schema.tables`; - if (schema != null) { + if (schema !== null) { tablesInfoQuery += ` WHERE table_schema = '${schema}'`; } const { rows: tablesInfo } = await pool.query(tablesInfoQuery); diff --git a/core/context/providers/index.ts b/core/context/providers/index.ts index 462fe0db4..c388fb6dc 100644 --- a/core/context/providers/index.ts +++ b/core/context/providers/index.ts @@ -1,7 +1,6 @@ import { ContextProviderName } from "../../index.js"; import { BaseContextProvider } from "../index.js"; import CodeContextProvider from "./CodeContextProvider.js"; -import CodebaseContextProvider from "./CodebaseContextProvider.js"; import ContinueProxyContextProvider from "./ContinueProxyContextProvider.js"; import CurrentFileContextProvider from "./CurrentFileContextProvider.js"; import DatabaseContextProvider from "./DatabaseContextProvider.js"; diff --git a/core/context/rerankers/ContinueProxyReranker.ts b/core/context/rerankers/ContinueProxyReranker.ts new file mode 100644 index 000000000..abeff24dc --- /dev/null +++ b/core/context/rerankers/ContinueProxyReranker.ts @@ -0,0 +1,46 @@ +import fetch from "node-fetch"; +import { CONTROL_PLANE_URL } from "../../control-plane/client.js"; +import { Chunk, Reranker } from "../../index.js"; + +export class ContinueProxyReranker implements Reranker { + name = "continue-proxy"; + + private _workOsAccessToken: string | undefined = undefined; + + get workOsAccessToken(): string | undefined { + return this._workOsAccessToken; + } + + set workOsAccessToken(value: string | undefined) { + if (this._workOsAccessToken !== value) { + this._workOsAccessToken = value; + this.params.apiKey = value!; + } + } + + constructor( + private readonly params: { + apiKey: string; + model?: string; + }, + ) {} + + async rerank(query: string, chunks: Chunk[]): Promise { + const url = new URL("/model-proxy/v1/rerank", CONTROL_PLANE_URL); + const resp = await fetch(url, { + method: "POST", + headers: { + "Content-Type": "application/json", + Authorization: `Bearer ${this.params.apiKey}`, + }, + body: JSON.stringify({ + query, + documents: chunks.map((chunk) => chunk.content), + model: this.params.model, + }), + }); + const data: any = await resp.json(); + const results = data.data.sort((a: any, b: any) => a.index - b.index); + return results.map((result: any) => result.relevance_score); + } +} diff --git a/core/context/rerankers/index.ts b/core/context/rerankers/index.ts index af3f91556..c60c0825a 100644 --- a/core/context/rerankers/index.ts +++ b/core/context/rerankers/index.ts @@ -1,14 +1,16 @@ import { RerankerName } from "../../index.js"; import { CohereReranker } from "./cohere.js"; +import { ContinueProxyReranker } from "./ContinueProxyReranker.js"; import { FreeTrialReranker } from "./freeTrial.js"; import { LLMReranker } from "./llm.js"; +import { HuggingFaceTEIReranker } from "./tei.js"; import { VoyageReranker } from "./voyage.js"; -import {HuggingFaceTEIReranker} from "./tei.js" export const AllRerankers: { [key in RerankerName]: any } = { cohere: CohereReranker, llm: LLMReranker, voyage: VoyageReranker, "free-trial": FreeTrialReranker, - "huggingface-tei": HuggingFaceTEIReranker + "huggingface-tei": HuggingFaceTEIReranker, + "continue-proxy": ContinueProxyReranker, }; diff --git a/core/context/rerankers/tei.ts b/core/context/rerankers/tei.ts index 667181ae3..61f38b98b 100644 --- a/core/context/rerankers/tei.ts +++ b/core/context/rerankers/tei.ts @@ -26,7 +26,7 @@ export class HuggingFaceTEIReranker implements Reranker { const resp = await fetch(new URL("rerank", apiBase), { method: "POST", - headers: { 'Content-Type': 'application/json' }, + headers: { "Content-Type": "application/json" }, body: JSON.stringify({ query: query, return_text: false, diff --git a/core/context/rerankers/voyage.ts b/core/context/rerankers/voyage.ts index e2a969350..626c53229 100644 --- a/core/context/rerankers/voyage.ts +++ b/core/context/rerankers/voyage.ts @@ -12,6 +12,9 @@ export class VoyageReranker implements Reranker { ) {} async rerank(query: string, chunks: Chunk[]): Promise { + if (!query || chunks.length === 0) { + return []; + } const resp = await fetch("https://api.voyageai.com/v1/rerank", { method: "POST", headers: { diff --git a/core/context/retrieval/fullTextSearch.ts b/core/context/retrieval/fullTextSearch.ts index 3e22db302..9c52bd6b6 100644 --- a/core/context/retrieval/fullTextSearch.ts +++ b/core/context/retrieval/fullTextSearch.ts @@ -1,5 +1,5 @@ import { BranchAndDir, Chunk } from "../../index.js"; -import { FullTextSearchCodebaseIndex } from "../../indexing/FullTextSearch.js"; +import { FullTextSearchCodebaseIndex } from "../../indexing/FullTextSearchCodebaseIndex.js"; export async function retrieveFts( query: string, diff --git a/core/context/retrieval/pipelines/BaseRetrievalPipeline.ts b/core/context/retrieval/pipelines/BaseRetrievalPipeline.ts index 6c1f9f578..923669c74 100644 --- a/core/context/retrieval/pipelines/BaseRetrievalPipeline.ts +++ b/core/context/retrieval/pipelines/BaseRetrievalPipeline.ts @@ -7,7 +7,6 @@ import { } from "../../../index.js"; import { chunkDocument } from "../../../indexing/chunk/chunk.js"; import { LanceDbIndex } from "../../../indexing/LanceDbIndex.js"; -import { MAX_CHUNK_SIZE } from "../../../llm/constants.js"; import { retrieveFts } from "../fullTextSearch.js"; import { recentlyEditedFilesCache } from "../recentlyEditedFilesCache.js"; @@ -20,6 +19,7 @@ export interface RetrievalPipelineOptions { nRetrieve: number; nFinal: number; tags: BranchAndDir[]; + pathSep: string; filterDirectory?: string; } @@ -30,8 +30,10 @@ export interface IRetrievalPipeline { export default class BaseRetrievalPipeline implements IRetrievalPipeline { private lanceDbIndex: LanceDbIndex; constructor(protected readonly options: RetrievalPipelineOptions) { - this.lanceDbIndex = new LanceDbIndex(options.embeddingsProvider, (path) => - options.ide.readFile(path), + this.lanceDbIndex = new LanceDbIndex( + options.embeddingsProvider, + (path) => options.ide.readFile(path), + options.pathSep, ); } @@ -60,7 +62,7 @@ export default class BaseRetrievalPipeline implements IRetrievalPipeline { const fileChunks = chunkDocument({ filepath, contents, - maxChunkSize: MAX_CHUNK_SIZE, + maxChunkSize: this.options.embeddingsProvider.maxChunkSize, digest: filepath, }); diff --git a/core/context/retrieval/retrieval.ts b/core/context/retrieval/retrieval.ts index 9d07ae5cc..d1e7342fa 100644 --- a/core/context/retrieval/retrieval.ts +++ b/core/context/retrieval/retrieval.ts @@ -70,6 +70,7 @@ export async function retrieveContextItemsFromEmbeddings( nFinal, nRetrieve, tags, + pathSep: await extras.ide.pathSep(), embeddingsProvider: extras.embeddingsProvider, reranker: extras.reranker, filterDirectory, diff --git a/core/context/retrieval/util.ts b/core/context/retrieval/util.ts index e783a2ca0..5343d8dbd 100644 --- a/core/context/retrieval/util.ts +++ b/core/context/retrieval/util.ts @@ -1,5 +1,5 @@ -import { Chunk } from "../.."; -import { deduplicateArray } from "../../util"; +import { Chunk } from "../../index.js"; +import { deduplicateArray } from "../../util/index.js"; export function deduplicateChunks(chunks: Chunk[]): Chunk[] { return deduplicateArray(chunks, (a, b) => { diff --git a/core/continueServer/stubs/headers.ts b/core/continueServer/stubs/headers.ts index b5f951d29..ca1e0df9d 100644 --- a/core/continueServer/stubs/headers.ts +++ b/core/continueServer/stubs/headers.ts @@ -1,12 +1,12 @@ -import { constants, getTimestamp } from "../../deploy/constants"; -import { Telemetry } from "../../util/posthog"; +import { constants, getTimestamp } from "../../deploy/constants.js"; +import { Telemetry } from "../../util/posthog.js"; export async function getHeaders() { return { key: constants.c, timestamp: getTimestamp(), v: "1", - extensionVersion: Telemetry.extensionVersion ?? "0.0.0", + extensionVersion: Telemetry.ideInfo?.extensionVersion ?? "0.0.0", os: Telemetry.os ?? "Unknown", uniqueId: Telemetry.uniqueId ?? "None", }; diff --git a/core/control-plane/TeamAnalytics.ts b/core/control-plane/TeamAnalytics.ts index 2e19ed2ec..7cf299d69 100644 --- a/core/control-plane/TeamAnalytics.ts +++ b/core/control-plane/TeamAnalytics.ts @@ -1,9 +1,9 @@ import { Analytics } from "@continuedev/config-types"; import os from "node:os"; -import ContinueProxyAnalyticsProvider from "./analytics/ContinueProxyAnalyticsProvider"; -import { IAnalyticsProvider } from "./analytics/IAnalyticsProvider"; -import LogStashAnalyticsProvider from "./analytics/LogStashAnalyticsProvider"; -import PostHogAnalyticsProvider from "./analytics/PostHogAnalyticsProvider"; +import ContinueProxyAnalyticsProvider from "./analytics/ContinueProxyAnalyticsProvider.js"; +import { IAnalyticsProvider } from "./analytics/IAnalyticsProvider.js"; +import LogStashAnalyticsProvider from "./analytics/LogStashAnalyticsProvider.js"; +import PostHogAnalyticsProvider from "./analytics/PostHogAnalyticsProvider.js"; function createAnalyticsProvider( config: Analytics, @@ -39,6 +39,7 @@ export class TeamAnalytics { config: Analytics, uniqueId: string, extensionVersion: string, + workspaceId?: string, ) { TeamAnalytics.uniqueId = uniqueId; TeamAnalytics.os = os.platform(); @@ -49,7 +50,7 @@ export class TeamAnalytics { TeamAnalytics.provider = undefined; } else { TeamAnalytics.provider = createAnalyticsProvider(config); - await TeamAnalytics.provider?.setup(config, uniqueId); + await TeamAnalytics.provider?.setup(config, uniqueId, workspaceId); } } } diff --git a/core/control-plane/analytics/ContinueProxyAnalyticsProvider.ts b/core/control-plane/analytics/ContinueProxyAnalyticsProvider.ts index b586c525d..e3e3bc605 100644 --- a/core/control-plane/analytics/ContinueProxyAnalyticsProvider.ts +++ b/core/control-plane/analytics/ContinueProxyAnalyticsProvider.ts @@ -1,19 +1,19 @@ import { Analytics } from "@continuedev/config-types"; import fetch from "node-fetch"; -import { CONTROL_PLANE_URL } from "../client"; -import { IAnalyticsProvider } from "./IAnalyticsProvider"; +import { CONTROL_PLANE_URL } from "../client.js"; +import { IAnalyticsProvider } from "./IAnalyticsProvider.js"; export default class ContinueProxyAnalyticsProvider implements IAnalyticsProvider { uniqueId?: string; - addOnId?: string; + workspaceId?: string; async capture( event: string, properties: { [key: string]: any }, ): Promise { - fetch(new URL(`/proxy/analytics/${this.addOnId}`, CONTROL_PLANE_URL), { + fetch(new URL(`/proxy/analytics/${this.workspaceId}`, CONTROL_PLANE_URL), { method: "POST", body: JSON.stringify({ event, @@ -23,9 +23,13 @@ export default class ContinueProxyAnalyticsProvider }); } - async setup(config: Analytics, uniqueId: string): Promise { + async setup( + config: Analytics, + uniqueId: string, + workspaceId?: string, + ): Promise { this.uniqueId = uniqueId; - this.addOnId = config.url?.split("/").slice(-1)[0]; + this.workspaceId = workspaceId; } async shutdown(): Promise {} diff --git a/core/control-plane/analytics/IAnalyticsProvider.ts b/core/control-plane/analytics/IAnalyticsProvider.ts index 8a04ba1ce..1bb2a727c 100644 --- a/core/control-plane/analytics/IAnalyticsProvider.ts +++ b/core/control-plane/analytics/IAnalyticsProvider.ts @@ -6,6 +6,10 @@ export interface AnalyticsMetadata { export interface IAnalyticsProvider { capture(event: string, properties: { [key: string]: any }): Promise; - setup(config: Analytics, uniqueId: string): Promise; + setup( + config: Analytics, + uniqueId: string, + workspaceId?: string, + ): Promise; shutdown(): Promise; } diff --git a/core/control-plane/analytics/LogStashAnalyticsProvider.ts b/core/control-plane/analytics/LogStashAnalyticsProvider.ts index 1fe5aec47..ccf445474 100644 --- a/core/control-plane/analytics/LogStashAnalyticsProvider.ts +++ b/core/control-plane/analytics/LogStashAnalyticsProvider.ts @@ -1,6 +1,6 @@ import { Analytics } from "@continuedev/config-types"; import net from "node:net"; -import { IAnalyticsProvider } from "./IAnalyticsProvider"; +import { IAnalyticsProvider } from "./IAnalyticsProvider.js"; export default class LogStashAnalyticsProvider implements IAnalyticsProvider { private host?: string; @@ -28,9 +28,14 @@ export default class LogStashAnalyticsProvider implements IAnalyticsProvider { }); } - async setup(config: Analytics, uniqueId: string): Promise { + async setup( + config: Analytics, + uniqueId: string, + workspaceId?: string, + ): Promise { if (!config.url) { - throw new Error("Missing url in analytics config"); + console.warn("LogStashAnalyticsProvider is missing a URL"); + return; } const url = new URL(config.url); this.host = url.hostname; diff --git a/core/control-plane/analytics/PostHogAnalyticsProvider.ts b/core/control-plane/analytics/PostHogAnalyticsProvider.ts index f32a0737b..ecb4e071a 100644 --- a/core/control-plane/analytics/PostHogAnalyticsProvider.ts +++ b/core/control-plane/analytics/PostHogAnalyticsProvider.ts @@ -1,5 +1,5 @@ import { Analytics } from "@continuedev/config-types"; -import { IAnalyticsProvider } from "./IAnalyticsProvider"; +import { IAnalyticsProvider } from "./IAnalyticsProvider.js"; export default class PostHogAnalyticsProvider implements IAnalyticsProvider { client?: any; @@ -16,7 +16,11 @@ export default class PostHogAnalyticsProvider implements IAnalyticsProvider { }); } - async setup(config: Analytics, uniqueId: string): Promise { + async setup( + config: Analytics, + uniqueId: string, + workspaceId?: string, + ): Promise { if (!config || !config.clientKey || !config.url) { this.client = undefined; } else { diff --git a/core/control-plane/client.ts b/core/control-plane/client.ts index 616f9edbf..bee6061b2 100644 --- a/core/control-plane/client.ts +++ b/core/control-plane/client.ts @@ -1,6 +1,6 @@ import { ConfigJson } from "@continuedev/config-types"; import fetch, { RequestInit, Response } from "node-fetch"; -import { ModelDescription } from ".."; +import { ModelDescription } from "../index.js"; export interface ControlPlaneSessionInfo { accessToken: string; @@ -18,9 +18,10 @@ export interface ControlPlaneWorkspace { export interface ControlPlaneModelDescription extends ModelDescription {} -// export const CONTROL_PLANE_URL = "http://localhost:3001"; export const CONTROL_PLANE_URL = - "https://control-plane-api-service-i3dqylpbqa-uc.a.run.app"; + process.env.CONTROL_PLANE_ENV === "local" + ? "http://localhost:3001" + : "https://control-plane-api-service-i3dqylpbqa-uc.a.run.app"; export class ControlPlaneClient { private static URL = CONTROL_PLANE_URL; @@ -73,7 +74,7 @@ export class ControlPlaneClient { } try { - const resp = await this.request(`/workspaces`, { + const resp = await this.request("/workspaces", { method: "GET", }); return (await resp.json()) as any; diff --git a/core/control-plane/schema.ts b/core/control-plane/schema.ts index 5557eff13..756798937 100644 --- a/core/control-plane/schema.ts +++ b/core/control-plane/schema.ts @@ -13,6 +13,7 @@ const modelDescriptionSchema = z.object({ "gemini", "mistral", "bedrock", + "sagemaker", "cloudflare", "azure", ]), diff --git a/core/core.ts b/core/core.ts index 780653ce5..1bb3f9c81 100644 --- a/core/core.ts +++ b/core/core.ts @@ -1,38 +1,34 @@ import { v4 as uuidv4 } from "uuid"; -import type { - ContextItemId, - EmbeddingsProvider, - IDE, - IndexingProgressUpdate, - SiteIndexingConfig, -} from "."; -import { CompletionProvider } from "./autocomplete/completionProvider.js"; -import { ConfigHandler } from "./config/ConfigHandler.js"; +import type { ContextItemId, IDE, IndexingProgressUpdate } from "."; +import { CompletionProvider } from "./autocomplete/completionProvider"; +import { ConfigHandler } from "./config/ConfigHandler"; import { setupApiKeysMode, setupFreeTrialMode, setupLocalAfterFreeTrial, setupLocalMode, -} from "./config/onboarding.js"; -import { createNewPromptFile } from "./config/promptFile.js"; -import { addModel, addOpenAIKey, deleteModel } from "./config/util.js"; -import { recentlyEditedFilesCache } from "./context/retrieval/recentlyEditedFilesCache.js"; -import { ContinueServerClient } from "./continueServer/stubs/client.js"; -import { getAuthUrlForTokenPage } from "./control-plane/auth/index.js"; +} from "./config/onboarding"; +import { createNewPromptFile } from "./config/promptFile"; +import { addModel, addOpenAIKey, deleteModel } from "./config/util"; +import { recentlyEditedFilesCache } from "./context/retrieval/recentlyEditedFilesCache"; +import { ContinueServerClient } from "./continueServer/stubs/client"; +import { getAuthUrlForTokenPage } from "./control-plane/auth/index"; import { ControlPlaneClient } from "./control-plane/client"; -import { CodebaseIndexer, PauseToken } from "./indexing/CodebaseIndexer.js"; -import { DocsService } from "./indexing/docs/DocsService.js"; -import Ollama from "./llm/llms/Ollama.js"; +import { CodebaseIndexer, PauseToken } from "./indexing/CodebaseIndexer"; +import DocsCrawler from "./indexing/docs/DocsCrawler"; +import DocsService from "./indexing/docs/DocsService"; +import Ollama from "./llm/llms/Ollama"; import type { FromCoreProtocol, ToCoreProtocol } from "./protocol"; -import { GlobalContext } from "./util/GlobalContext.js"; -import { logDevData } from "./util/devdata.js"; -import { DevDataSqliteDb } from "./util/devdataSqlite.js"; -import { fetchwithRequestOptions } from "./util/fetchWithOptions.js"; -import historyManager from "./util/history.js"; +import { GlobalContext } from "./util/GlobalContext"; +import { logDevData } from "./util/devdata"; +import { DevDataSqliteDb } from "./util/devdataSqlite"; +import { fetchwithRequestOptions } from "./util/fetchWithOptions"; +import historyManager from "./util/history"; import type { IMessenger, Message } from "./util/messenger"; -import { editConfigJson } from "./util/paths.js"; -import { Telemetry } from "./util/posthog.js"; -import { streamDiffLines } from "./util/verticalEdit.js"; +import { editConfigJson } from "./util/paths"; +import { Telemetry } from "./util/posthog"; +import { TTS } from "./util/tts"; +import { streamDiffLines } from "./util/verticalEdit"; export class Core { // implements IMessenger @@ -42,8 +38,9 @@ export class Core { continueServerClientPromise: Promise; indexingState: IndexingProgressUpdate; controlPlaneClient: ControlPlaneClient; + private docsService: DocsService; private globalContext = new GlobalContext(); - private docsService = DocsService.getInstance(); + private readonly indexingPauseToken = new PauseToken( this.globalContext.get("indexingPaused") === true, ); @@ -98,20 +95,16 @@ export class Core { this.controlPlaneClient, ); + this.docsService = DocsService.createSingleton( + this.configHandler, + this.ide, + this.messenger, + ); + this.configHandler.onConfigUpdate( (() => this.messenger.send("configUpdate", undefined)).bind(this), ); - this.configHandler.onConfigUpdate(async ({ embeddingsProvider }) => { - if ( - await this.shouldReindexDocsOnNewEmbeddingsProvider( - embeddingsProvider.id, - ) - ) { - await this.reindexDocsOnNewEmbeddingsProvider(embeddingsProvider); - } - }); - this.configHandler.onDidChangeAvailableProfiles((profiles) => this.messenger.send("didChangeAvailableProfiles", { profiles }), ); @@ -176,10 +169,20 @@ export class Core { (..._) => Promise.resolve([]), ); + try { + DocsCrawler.verifyOrInstallChromium(); + } catch (err) { + console.debug(`Failed to install Chromium: ${err}`); + } + const on = this.messenger.on.bind(this.messenger); this.messenger.onError((err) => { console.error(err); + Telemetry.capture("core_messenger_error", { + message: err.message, + stack: err.stack, + }); this.messenger.request("errorPopup", { message: err.message }); }); @@ -209,12 +212,15 @@ export class Core { on("history/list", (msg) => { return historyManager.list(msg.data); }); + on("history/delete", (msg) => { historyManager.delete(msg.data.id); }); + on("history/load", (msg) => { return historyManager.load(msg.data.id); }); + on("history/save", (msg) => { historyManager.save(msg.data); }); @@ -230,14 +236,17 @@ export class Core { addModel(model); this.configHandler.reloadConfig(); }); + on("config/addOpenAiKey", (msg) => { addOpenAIKey(msg.data); this.configHandler.reloadConfig(); }); + on("config/deleteModel", (msg) => { deleteModel(msg.data.title); this.configHandler.reloadConfig(); }); + on("config/newPromptFile", async (msg) => { createNewPromptFile( this.ide, @@ -245,10 +254,12 @@ export class Core { ); this.configHandler.reloadConfig(); }); + on("config/reload", (msg) => { this.configHandler.reloadConfig(); return this.configHandler.getSerializedConfig(); }); + on("config/ideSettingsUpdate", (msg) => { this.configHandler.updateIdeSettings(msg.data); }); @@ -258,43 +269,36 @@ export class Core { // Context providers on("context/addDocs", async (msg) => { - await this.getEmbeddingsProviderAndIndexDoc(msg.data); + let hasFailed = false; - this.ide.infoPopup(`Successfully indexed ${msg.data.title}`); - this.messenger.send("refreshSubmenuItems", undefined); + for await (const result of this.docsService.indexAndAdd(msg.data)) { + if (result.status === "failed") { + hasFailed = true; + break; + } + } + + if (hasFailed) { + this.ide.infoPopup(`Failed to index ${msg.data.startUrl}`); + } else { + this.ide.infoPopup(`Successfully indexed ${msg.data.startUrl}`); + this.messenger.send("refreshSubmenuItems", undefined); + } }); + on("context/removeDocs", async (msg) => { - const baseUrl = msg.data.baseUrl; - await this.docsService.delete(baseUrl); + await this.docsService.delete(msg.data.startUrl); this.messenger.send("refreshSubmenuItems", undefined); }); + on("context/indexDocs", async (msg) => { - const config = await this.config(); - const provider: any = config.contextProviders?.find( - (provider) => provider.description.title === "docs", - ); - - if (!provider) { - this.ide.infoPopup("No docs in configuration"); - return; - } - - const siteIndexingOptions: SiteIndexingConfig[] = ((mProvider) => [ - ...new Set([ - ...(mProvider?.options?.sites || []), - ...(config.docs || []), - ]), - ])({ ...provider }); - - for (const site of siteIndexingOptions) { - await this.getEmbeddingsProviderAndIndexDoc(site, msg.data.reIndex); - } - - this.ide.infoPopup("Docs indexing completed"); + await this.docsService.indexAllDocs(msg.data.reIndex); + this.messenger.send("refreshSubmenuItems", undefined); }); + on("context/loadSubmenuItems", async (msg) => { const config = await this.config(); - const items = config.contextProviders + const items = await config.contextProviders ?.find((provider) => provider.description.title === msg.data.title) ?.loadSubmenuItems({ config, @@ -304,6 +308,7 @@ export class Core { }); return items || []; }); + on("context/getContextItems", async (msg) => { const { name, query, fullInput, selectedCode } = msg.data; const config = await this.config(); @@ -320,7 +325,9 @@ export class Core { providerTitle: provider.description.title, itemId: uuidv4(), }; + const items = await provider.getContextItems(query, { + config, llm, embeddingsProvider: config.embeddingsProvider, fullInput, @@ -361,6 +368,13 @@ export class Core { abortedMessageIds: Set, msg: Message, ) { + const config = await configHandler.loadConfig(); + + // Stop TTS on new StreamChat + if (config.experimental?.readResponseTTS) { + TTS.kill(); + } + const model = await configHandler.llmFromTitle(msg.data.title); const gen = model.streamChat( msg.data.messages, @@ -371,6 +385,7 @@ export class Core { if (abortedMessageIds.has(msg.messageId)) { abortedMessageIds.delete(msg.messageId); next = await gen.return({ + modelTitle: model.title ?? model.model, completion: "", prompt: "", completionOptions: { @@ -384,6 +399,10 @@ export class Core { next = await gen.next(); } + if (config.experimental?.readResponseTTS && "completion" in next.value) { + TTS.read(next.value?.completion); + } + return { done: true, content: next.value }; } @@ -407,6 +426,7 @@ export class Core { if (abortedMessageIds.has(msg.messageId)) { abortedMessageIds.delete(msg.messageId); next = await gen.return({ + modelTitle: model.title ?? model.model, completion: "", prompt: "", completionOptions: { @@ -457,6 +477,13 @@ export class Core { } }); + // Provide messenger to TTS so it can set GUI active / inactive state + TTS.messenger = this.messenger; + + on("tts/kill", async () => { + TTS.kill(); + }); + async function* runNodeJsSlashCommand( configHandler: ConfigHandler, abortedMessageIds: Set, @@ -638,8 +665,13 @@ export class Core { const rows = await DevDataSqliteDb.getTokensPerModel(); return rows; }); - on("index/forceReIndex", async (msg) => { - const dirs = msg.data ? [msg.data] : await this.ide.getWorkspaceDirs(); + on("index/forceReIndex", async ({ data }) => { + if (data?.shouldClearIndexes) { + const codebaseIndexer = await this.codebaseIndexerPromise; + await codebaseIndexer.clearIndexes(); + } + + const dirs = data?.dir ? [data.dir] : await this.ide.getWorkspaceDirs(); await this.refreshCodebaseIndex(dirs); }); on("index/setPaused", (msg) => { @@ -656,6 +688,7 @@ export class Core { on("didChangeSelectedProfile", (msg) => { this.configHandler.setSelectedProfile(msg.data.id); + this.configHandler.reloadConfig(); }); on("didChangeControlPlaneSessionInfo", async (msg) => { this.configHandler.updateControlPlaneSessionInfo(msg.data.sessionInfo); @@ -683,104 +716,19 @@ export class Core { )) { this.messenger.request("indexProgress", update); this.indexingState = update; + + if (update.status === "failed") { + Telemetry.capture( + "indexing_error", + { + error: update.desc, + stack: update.debugInfo, + }, + false, + ); + } } this.messenger.send("refreshSubmenuItems", undefined); } - - private async shouldReindexDocsOnNewEmbeddingsProvider( - curEmbeddingsProviderId: EmbeddingsProvider["id"], - ): Promise { - const ideInfo = await this.ide.getIdeInfo(); - const isJetBrainsAndPreIndexedDocsProvider = - this.docsService.isJetBrainsAndPreIndexedDocsProvider( - ideInfo, - curEmbeddingsProviderId, - ); - - if (isJetBrainsAndPreIndexedDocsProvider) { - try { - this.ide.errorPopup( - "The 'transformers.js' embeddings provider currently cannot be used to index " + - "documentation in JetBrains. To enable documentation indexing, you can use " + - "any of the other providers described in the docs: " + - "https://docs.continue.dev/walkthroughs/codebase-embeddings#embeddings-providers", - ); - } catch (error) { - console.error("Failed to show error popup:", error); - } - this.globalContext.update( - "curEmbeddingsProviderId", - curEmbeddingsProviderId, - ); - - return false; - } - - const lastEmbeddingsProviderId = this.globalContext.get( - "curEmbeddingsProviderId", - ); - - if (!lastEmbeddingsProviderId) { - // If it's the first time we're setting the `curEmbeddingsProviderId` - // global state, we don't need to reindex docs - this.globalContext.update( - "curEmbeddingsProviderId", - curEmbeddingsProviderId, - ); - - return false; - } - - return lastEmbeddingsProviderId !== curEmbeddingsProviderId; - } - - private async getEmbeddingsProviderAndIndexDoc( - site: SiteIndexingConfig, - reIndex: boolean = false, - ): Promise { - const config = await this.config(); - const { embeddingsProvider } = config; - - for await (const update of this.docsService.indexAndAdd( - site, - embeddingsProvider, - reIndex, - )) { - // Temporary disabled posting progress updates to the UI due to - // possible collision with code indexing progress updates. - // this.messenger.request("indexProgress", update); - // this.indexingState = update; - } - } - - private async reindexDocsOnNewEmbeddingsProvider( - embeddingsProvider: EmbeddingsProvider, - ) { - const docs = await this.docsService.list(); - - if (docs.length === 0) { - return; - } - - this.ide.infoPopup("Reindexing docs with new embeddings provider"); - - for (const { title, baseUrl } of docs) { - await this.docsService.delete(baseUrl); - - const generator = this.docsService.indexAndAdd( - { title, startUrl: baseUrl, rootUrl: baseUrl }, - embeddingsProvider, - ); - - while (!(await generator.next()).done) {} - } - - // Important that this only is invoked after we have successfully - // cleared and reindex the docs so that the table cannot end up in an - // invalid state. - this.globalContext.update("curEmbeddingsProviderId", embeddingsProvider.id); - - this.ide.infoPopup("Completed reindexing of all docs"); - } } diff --git a/core/test/streamDiff.test.ts b/core/diff/streamDiff.test.ts similarity index 100% rename from core/test/streamDiff.test.ts rename to core/diff/streamDiff.test.ts diff --git a/core/index.d.ts b/core/index.d.ts index d8cfe8dba..ab06f27fd 100644 --- a/core/index.d.ts +++ b/core/index.d.ts @@ -37,7 +37,9 @@ export interface Chunk extends ChunkWithoutID { export interface IndexingProgressUpdate { progress: number; desc: string; + shouldClearIndexes?: boolean; status: "loading" | "indexing" | "done" | "failed" | "paused" | "disabled"; + debugInfo?: string; } export type PromptTemplate = @@ -56,6 +58,7 @@ export interface ILLM extends LLMOptions { title?: string; systemMessage?: string; contextLength: number; + maxStopWords?: number; completionOptions: CompletionOptions; requestOptions?: RequestOptions; promptTemplates?: Record; @@ -127,6 +130,7 @@ export interface ContextProviderDescription { export type FetchFunction = (url: string | URL, init?: any) => Promise; export interface ContextProviderExtras { + config: ContinueConfig; fullInput: string; embeddingsProvider: EmbeddingsProvider; reranker: Reranker | undefined; @@ -161,21 +165,21 @@ export interface ContextSubmenuItem { id: string; title: string; description: string; - iconUrl?: string; + icon?: string; metadata?: any; } export interface SiteIndexingConfig { - startUrl: string; - rootUrl: string; title: string; + startUrl: string; + rootUrl?: string; maxDepth?: number; faviconUrl?: string; } export interface SiteIndexingConfig { startUrl: string; - rootUrl: string; + rootUrl?: string; title: string; maxDepth?: number; } @@ -269,6 +273,7 @@ export interface ContextItem { description: string; editing?: boolean; editable?: boolean; + icon?: string; } export interface ContextItemWithId { @@ -278,6 +283,7 @@ export interface ContextItemWithId { id: ContextItemId; editing?: boolean; editable?: boolean; + icon?: string; } export interface InputModifiers { @@ -286,6 +292,7 @@ export interface InputModifiers { } export interface PromptLog { + modelTitle: string; completionOptions: CompletionOptions; prompt: string; completion: string; @@ -315,6 +322,7 @@ export interface LLMOptions { uniqueId?: string; systemMessage?: string; contextLength?: number; + maxStopWords?: number; completionOptions?: CompletionOptions; requestOptions?: RequestOptions; template?: TemplateType; @@ -336,9 +344,25 @@ export interface LLMOptions { apiVersion?: string; apiType?: string; - // GCP Options + // AWS options + profile?: string; + modelArn?: string; + + // AWS and GCP Options region?: string; + + // GCP Options projectId?: string; + capabilities?: ModelCapability; + + // IBM watsonx options + watsonxUrl?: string; + watsonxCreds?: string; + watsonxProjectId?: string; + watsonxStopToken?: string; + watsonxApiVersion?: string; + + cacheSystemMessage?: boolean; } type RequireAtLeastOne = Pick< T, @@ -572,6 +596,7 @@ type ModelProvider = | "ollama" | "huggingface-tgi" | "huggingface-inference-api" + | "kindo" | "llama.cpp" | "replicate" | "text-gen-webui" @@ -580,6 +605,8 @@ type ModelProvider = | "gemini" | "mistral" | "bedrock" + | "bedrockimport" + | "sagemaker" | "deepinfra" | "flowise" | "groq" @@ -590,7 +617,9 @@ type ModelProvider = | "deepseek" | "azure" | "openai-aiohttp" - | "msty"; + | "msty" + | "watsonx" + | "openrouter"; export type ModelName = | "AUTODETECT" @@ -718,6 +747,10 @@ interface BaseCompletionOptions { stream?: boolean; } +export interface ModelCapability { + uploadImage?: boolean; +} + export interface ModelDescription { title: string; provider: ModelProvider; @@ -725,11 +758,13 @@ export interface ModelDescription { apiKey?: string; apiBase?: string; contextLength?: number; + maxStopWords?: number; template?: TemplateType; completionOptions?: BaseCompletionOptions; systemMessage?: string; requestOptions?: RequestOptions; promptTemplates?: { [key: string]: string }; + capabilities?: ModelCapability; } export type EmbeddingsProviderName = @@ -739,7 +774,9 @@ export type EmbeddingsProviderName = | "openai" | "cohere" | "free-trial" - | "gemini"; + | "gemini" + | "continue-proxy" + | "deepinfra"; export interface EmbedOptions { apiBase?: string; @@ -758,6 +795,7 @@ export interface EmbeddingsProviderDescription extends EmbedOptions { export interface EmbeddingsProvider { id: string; + providerName: EmbeddingsProviderName; maxChunkSize: number; embed(chunks: string[]): Promise; } @@ -767,7 +805,8 @@ export type RerankerName = | "voyage" | "llm" | "free-trial" - | "huggingface-tei"; + | "huggingface-tei" + | "continue-proxy"; export interface RerankerDescription { name: RerankerName; @@ -846,10 +885,14 @@ interface QuickActionConfig { sendToChat: boolean; } +export type DefaultContextProvider = ContextProviderWithParams & { + query?: string; +}; + interface ExperimentalConfig { contextMenuPrompts?: ContextMenuConfig; modelRoles?: ModelRoles; - defaultContext?: "activeFile"[]; + defaultContext?: DefaultContextProvider[]; promptPath?: string; /** @@ -857,6 +900,11 @@ interface ExperimentalConfig { * function and class declarations. */ quickActions?: QuickActionConfig[]; + + /** + * Automatically read LLM chat responses aloud using system TTS models + */ + readResponseTTS?: boolean; } interface AnalyticsConfig { @@ -886,6 +934,7 @@ export interface SerializedContinueConfig { reranker?: RerankerDescription; experimental?: ExperimentalConfig; analytics?: AnalyticsConfig; + docs?: SiteIndexingConfig[]; } export type ConfigMergeType = "merge" | "overwrite"; diff --git a/core/indexing/CodeSnippetsIndex.test.ts b/core/indexing/CodeSnippetsIndex.test.ts new file mode 100644 index 000000000..a80ffe7bd --- /dev/null +++ b/core/indexing/CodeSnippetsIndex.test.ts @@ -0,0 +1,83 @@ +import { jest } from "@jest/globals"; +import { testIde } from "../test/util/fixtures"; +import { + insertMockChunks, + updateIndexAndAwaitGenerator, + mockPathAndCacheKey, +} from "../test/util/indexing"; +import { CodeSnippetsCodebaseIndex } from "./CodeSnippetsIndex"; +import { DatabaseConnection, SqliteDb } from "./refreshIndex"; +import { IndexResultType } from "./types"; + +describe("CodeSnippetsCodebaseIndex", () => { + let index: CodeSnippetsCodebaseIndex; + let db: DatabaseConnection; + + async function getAllSnippets() { + return await db.all("SELECT * FROM code_snippets"); + } + + async function getAllSnippetTags() { + return await db.all("SELECT * FROM code_snippets_tags"); + } + + beforeAll(async () => { + db = await SqliteDb.get(); + index = new CodeSnippetsCodebaseIndex(testIde); + }); + + it("should update the index and maintain expected database state", async () => { + const mockMarkComplete = jest + .fn() + .mockImplementation(() => Promise.resolve()) as any; + + const mockSnippet = { + title: "", + content: "", + startLine: 0, + endLine: 1, + }; + + // We mock this fn since currently in testing the directory structure to access the tree-sitter + // binaries does not match what is in the release environment. + jest + .spyOn(CodeSnippetsCodebaseIndex.prototype, "getSnippetsInFile") + .mockResolvedValue([mockSnippet]); + + await insertMockChunks(); + + // Compute test + await updateIndexAndAwaitGenerator(index, "compute", mockMarkComplete); + expect((await getAllSnippetTags()).length).toBe(1); + expect((await getAllSnippets()).length).toBe(1); + expect(mockMarkComplete).toHaveBeenCalledWith( + [mockPathAndCacheKey], + IndexResultType.Compute, + ); + + // RemoveTag test + await updateIndexAndAwaitGenerator(index, "removeTag", mockMarkComplete); + expect((await getAllSnippetTags()).length).toBe(0); + expect(mockMarkComplete).toHaveBeenCalledWith( + [mockPathAndCacheKey], + IndexResultType.RemoveTag, + ); + + // AddTag test + await updateIndexAndAwaitGenerator(index, "addTag", mockMarkComplete); + expect((await getAllSnippetTags()).length).toBe(1); + expect(mockMarkComplete).toHaveBeenCalledWith( + [mockPathAndCacheKey], + IndexResultType.AddTag, + ); + + // Delete test + await updateIndexAndAwaitGenerator(index, "del", mockMarkComplete); + expect((await getAllSnippetTags()).length).toBe(0); + expect((await getAllSnippets()).length).toBe(0); + expect(mockMarkComplete).toHaveBeenCalledWith( + [mockPathAndCacheKey], + IndexResultType.Delete, + ); + }); +}); diff --git a/core/indexing/CodeSnippetsIndex.ts b/core/indexing/CodeSnippetsIndex.ts index a5ec68f8b..6f3102729 100644 --- a/core/indexing/CodeSnippetsIndex.ts +++ b/core/indexing/CodeSnippetsIndex.ts @@ -7,6 +7,7 @@ import type { IndexingProgressUpdate, } from "../index.js"; import { getBasename, getLastNPathParts } from "../util/index.js"; +import { migrate } from "../util/paths.js"; import { TSQueryType, getParserForFile, @@ -43,6 +44,55 @@ export class CodeSnippetsCodebaseIndex implements CodebaseIndex { snippetId INTEGER NOT NULL, FOREIGN KEY (snippetId) REFERENCES code_snippets (id) )`); + + migrate("delete_duplicate_code_snippets", async () => { + // Delete duplicate entries in code_snippets + await db.exec(` + DELETE FROM code_snippets + WHERE id NOT IN ( + SELECT MIN(id) + FROM code_snippets + GROUP BY path, cacheKey, content, title, startLine, endLine + ) + `); + + // Add unique constraint if it doesn't exist + await db.exec(` + CREATE UNIQUE INDEX IF NOT EXISTS idx_code_snippets_unique + ON code_snippets (path, cacheKey, content, title, startLine, endLine) + `); + + // Delete code_snippets associated with duplicate code_snippets_tags entries + await db.exec(` + DELETE FROM code_snippets + WHERE id IN ( + SELECT snippetId + FROM code_snippets_tags + WHERE (snippetId, tag) IN ( + SELECT snippetId, tag + FROM code_snippets_tags + GROUP BY snippetId, tag + HAVING COUNT(*) > 1 + ) + ) + `); + + // Delete duplicate entries + await db.exec(` + DELETE FROM code_snippets_tags + WHERE id NOT IN ( + SELECT MIN(id) + FROM code_snippets_tags + GROUP BY snippetId, tag + ) + `); + + // Add unique constraint if it doesn't exist + await db.exec(` + CREATE UNIQUE INDEX IF NOT EXISTS idx_snippetId_tag + ON code_snippets_tags (snippetId, tag) + `); + }); } async getSnippetsInFile( @@ -50,26 +100,30 @@ export class CodeSnippetsCodebaseIndex implements CodebaseIndex { contents: string, ): Promise<(ChunkWithoutID & { title: string })[]> { const parser = await getParserForFile(filepath); + if (!parser) { return []; } + const ast = parser.parse(contents); const query = await getQueryForFile(filepath, TSQueryType.CodeSnippets); const matches = query?.matches(ast.rootNode); - return ( - matches?.flatMap((match) => { - const node = match.captures[0].node; - const title = match.captures[1].node.text; - const results = { - title, - content: node.text, - startLine: node.startPosition.row, - endLine: node.endPosition.row, - }; - return results; - }) ?? [] - ); + if (!matches) { + return []; + } + + return matches.flatMap((match) => { + const node = match.captures[0].node; + const title = match.captures[1].node.text; + const results = { + title, + content: node.text, + startLine: node.startPosition.row, + endLine: node.endPosition.row, + }; + return results; + }); } async *update( @@ -82,6 +136,7 @@ export class CodeSnippetsCodebaseIndex implements CodebaseIndex { await CodeSnippetsCodebaseIndex._createTables(db); const tagString = tagToString(tag); + // Compute for (let i = 0; i < results.compute.length; i++) { const compute = results.compute[i]; @@ -93,12 +148,13 @@ export class CodeSnippetsCodebaseIndex implements CodebaseIndex { ); } catch (e) { // If can't parse, assume malformatted code + console.error(`Error parsing ${compute.path}:`, e); } // Add snippets to sqlite for (const snippet of snippets) { const { lastID } = await db.run( - "INSERT INTO code_snippets (path, cacheKey, content, title, startLine, endLine) VALUES (?, ?, ?, ?, ?, ?)", + "REPLACE INTO code_snippets (path, cacheKey, content, title, startLine, endLine) VALUES (?, ?, ?, ?, ?, ?)", [ compute.path, compute.cacheKey, @@ -110,7 +166,7 @@ export class CodeSnippetsCodebaseIndex implements CodebaseIndex { ); await db.run( - "INSERT INTO code_snippets_tags (snippetId, tag) VALUES (?, ?)", + "REPLACE INTO code_snippets_tags (snippetId, tag) VALUES (?, ?)", [lastID, tagString], ); } @@ -123,47 +179,93 @@ export class CodeSnippetsCodebaseIndex implements CodebaseIndex { markComplete([compute], IndexResultType.Compute); } + // Delete for (let i = 0; i < results.del.length; i++) { const del = results.del[i]; - const deleted = await db.run( - "DELETE FROM code_snippets WHERE path = ? AND cacheKey = ?", + + const snippets = await db.all( + "SELECT id FROM code_snippets WHERE path = ? AND cacheKey = ?", [del.path, del.cacheKey], ); - await db.run("DELETE FROM code_snippets_tags WHERE snippetId = ?", [ - deleted.lastID, - ]); + + if (snippets) { + const snippetIds = snippets.map((row) => row.id).join(","); + + await db.run(`DELETE FROM code_snippets WHERE id IN (${snippetIds})`); + + await db.run( + `DELETE FROM code_snippets_tags WHERE snippetId IN (${snippetIds})`, + ); + } + markComplete([del], IndexResultType.Delete); } + // Add tag for (let i = 0; i < results.addTag.length; i++) { - const snippetsWithPath = await db.all( - "SELECT * FROM code_snippets WHERE cacheKey = ?", - [results.addTag[i].cacheKey], - ); + const addTag = results.addTag[i]; + let snippets: (ChunkWithoutID & { title: string })[] = []; + try { + snippets = await this.getSnippetsInFile( + addTag.path, + await this.ide.readFile(addTag.path), + ); + } catch (e) { + // If can't parse, assume malformatted code + console.error(`Error parsing ${addTag.path}:`, e); + } - for (const snippet of snippetsWithPath) { + for (const snippet of snippets) { + const { lastID } = await db.run( + "REPLACE INTO code_snippets (path, cacheKey, content, title, startLine, endLine) VALUES (?, ?, ?, ?, ?, ?)", + [ + addTag.path, + addTag.cacheKey, + snippet.content, + snippet.title, + snippet.startLine, + snippet.endLine, + ], + ); await db.run( - "INSERT INTO code_snippets_tags (snippetId, tag) VALUES (?, ?)", - [snippet.id, tagString], + "REPLACE INTO code_snippets_tags (snippetId, tag) VALUES (?, ?)", + [lastID, tagString], ); } markComplete([results.addTag[i]], IndexResultType.AddTag); } + // Remove tag for (let i = 0; i < results.removeTag.length; i++) { - const item = results.removeTag[i]; - await db.run( - ` - DELETE FROM code_snippets_tags - WHERE tag = ? - AND snippetId IN ( - SELECT id FROM code_snippets - WHERE cacheKey = ? AND path = ? - ) - `, - [tagString, item.cacheKey, item.path], + const removeTag = results.removeTag[i]; + + let snippets = await db.get( + `SELECT id FROM code_snippets + WHERE cacheKey = ? AND path = ?`, + [removeTag.cacheKey, removeTag.path], ); + if (!Array.isArray(snippets)) { + snippets = [snippets]; + } + + if (snippets) { + if (!Array.isArray(snippets)) { + snippets = [snippets]; + } + + const snippetIds = snippets.map((row: any) => row.id).join(","); + + await db.run( + ` + DELETE FROM code_snippets_tags + WHERE tag = ? + AND snippetId IN (${snippetIds}) + `, + [tagString], + ); + } + markComplete([results.removeTag[i]], IndexResultType.RemoveTag); } } diff --git a/core/indexing/CodebaseIndexer.test.ts b/core/indexing/CodebaseIndexer.test.ts new file mode 100644 index 000000000..f05acfc16 --- /dev/null +++ b/core/indexing/CodebaseIndexer.test.ts @@ -0,0 +1,212 @@ +import { jest } from "@jest/globals"; +import { execSync } from "node:child_process"; +import fs from "node:fs"; +import path from "node:path"; +import { ContinueServerClient } from "../continueServer/stubs/client.js"; +import { testConfigHandler, testIde } from "../test/util/fixtures.js"; +import { + addToTestDir, + setUpTestDir, + tearDownTestDir, + TEST_DIR, +} from "../test/util/testDir.js"; +import { getIndexSqlitePath } from "../util/paths.js"; +import { CodebaseIndexer, PauseToken } from "./CodebaseIndexer.js"; +import { getComputeDeleteAddRemove } from "./refreshIndex.js"; +import { TestCodebaseIndex } from "./TestCodebaseIndex.js"; +import { CodebaseIndex } from "./types.js"; +import { walkDir } from "./walkDir.js"; + +jest.useFakeTimers(); + +const TEST_TS = `\ +function main() { + console.log("Hello, world!"); +} + +class Foo { + constructor(public bar: string) {} +} +`; + +const TEST_PY = `\ +def main(): + print("Hello, world!") + +class Foo: + def __init__(self, bar: str): + self.bar = bar +`; + +const TEST_RS = `\ +fn main() { + println!("Hello, world!"); +} + +struct Foo { + bar: String, +} +`; + +// A subclass of CodebaseIndexer that adds a new CodebaseIndex +class TestCodebaseIndexer extends CodebaseIndexer { + protected async getIndexesToBuild(): Promise { + return [new TestCodebaseIndex()]; + } +} + +// These are more like integration tests, whereas we should separately test +// the individual CodebaseIndex classes +describe("CodebaseIndexer", () => { + const pauseToken = new PauseToken(false); + const continueServerClient = new ContinueServerClient(undefined, undefined); + const codebaseIndexer = new TestCodebaseIndexer( + testConfigHandler, + testIde, + pauseToken, + continueServerClient, + ); + const testIndex = new TestCodebaseIndex(); + + beforeAll(async () => { + tearDownTestDir(); + setUpTestDir(); + + execSync('git config --global user.email "test@example.com"'); + execSync('git config --global user.name "Test"'); + }); + + afterAll(async () => { + tearDownTestDir(); + }); + + async function refreshIndex() { + const abortController = new AbortController(); + const abortSignal = abortController.signal; + + const updates = []; + for await (const update of codebaseIndexer.refresh( + [TEST_DIR], + abortSignal, + )) { + updates.push(update); + } + return updates; + } + + async function getAllIndexedFiles() { + const files = await testIndex.getIndexedFilesForTags( + await testIde.getTags(testIndex.artifactId), + ); + return files; + } + + async function getIndexPlan() { + const workspaceFiles = await walkDir(TEST_DIR, testIde); + const [tag] = await testIde.getTags(testIndex.artifactId); + const stats = await testIde.getLastModified(workspaceFiles); + + const [results, lastUpdated, markComplete] = + await getComputeDeleteAddRemove( + tag, + { ...stats }, + (filepath) => testIde.readFile(filepath), + undefined, + ); + return results; + } + + async function expectPlan( + compute: number, + addTag: number, + removeTag: number, + del: number, + ) { + const plan = await getIndexPlan(); + console.log("PLAN: ", plan); + expect(plan.compute).toHaveLength(compute); + expect(plan.addTag).toHaveLength(addTag); + expect(plan.removeTag).toHaveLength(removeTag); + expect(plan.del).toHaveLength(del); + return plan; + } + + test("should index test folder without problem", async () => { + addToTestDir([ + ["test.ts", TEST_TS], + ["py/main.py", TEST_PY], + ]); + + await expectPlan(2, 0, 0, 0); + + const updates = await refreshIndex(); + expect(updates.length).toBeGreaterThan(0); + }); + + test("should have created index folder with all necessary files", async () => { + expect(fs.existsSync(getIndexSqlitePath())).toBe(true); + }); + + test("should have indexed all of the files", async () => { + const indexed = await getAllIndexedFiles(); + expect(indexed.length).toBe(2); + expect(indexed.some((file) => file.endsWith("test.ts"))).toBe(true); + expect(indexed.some((file) => file.endsWith("main.py"))).toBe(true); + }); + + test("should successfully re-index after adding a file", async () => { + addToTestDir([["main.rs", TEST_RS]]); + + await expectPlan(1, 0, 0, 0); + + const updates = await refreshIndex(); + expect(updates.length).toBeGreaterThan(0); + + // Check that the new file was indexed + const files = await getAllIndexedFiles(); + expect(files.length).toBe(3); + expect(files.some((file) => file.endsWith("main.rs"))).toBe(true); + }); + + test("should successfully re-index after deleting a file", async () => { + fs.rmSync(path.join(TEST_DIR, "main.rs")); + + await expectPlan(0, 0, 0, 1); + + const updates = await refreshIndex(); + expect(updates.length).toBeGreaterThan(0); + + // Check that the deleted file was removed from the index + const files = await getAllIndexedFiles(); + expect(files.length).toBe(2); + expect(files.every((file) => !file.endsWith("main.rs"))).toBe(true); + }); + + test("shouldn't index any files when nothing changed", async () => { + await expectPlan(0, 0, 0, 0); + const updates = await refreshIndex(); + expect(updates.length).toBeGreaterThan(0); + }); + + test("should create git repo for testing", async () => { + execSync( + `cd ${TEST_DIR} && git init && git checkout -b main && git add -A && git commit -m "First commit"`, + ); + }); + + test.skip("should only re-index the changed files when changing branches", async () => { + execSync(`cd ${TEST_DIR} && git checkout -b test2`); + // Rewriting the file + addToTestDir([["test.ts", "// This is different"]]); + + // Should re-compute test.ts, but just re-tag the .py file + await expectPlan(1, 1, 0, 0); + + execSync(`cd ${TEST_DIR} && git add -A && git commit -m "Change .ts file"`); + }); + + test.skip("shouldn't re-index anything when changing back to original branch", async () => { + execSync(`cd ${TEST_DIR} && git checkout main`); + await expectPlan(0, 0, 0, 0); + }); +}); diff --git a/core/indexing/CodebaseIndexer.ts b/core/indexing/CodebaseIndexer.ts index 939487aad..bc53539f4 100644 --- a/core/indexing/CodebaseIndexer.ts +++ b/core/indexing/CodebaseIndexer.ts @@ -1,13 +1,20 @@ +import * as fs from "fs/promises"; import { ConfigHandler } from "../config/ConfigHandler.js"; import { IContinueServerClient } from "../continueServer/interface.js"; -import { IDE, IndexTag, IndexingProgressUpdate } from "../index.js"; -import { CodeSnippetsCodebaseIndex } from "./CodeSnippetsIndex.js"; -import { FullTextSearchCodebaseIndex } from "./FullTextSearch.js"; -import { LanceDbIndex } from "./LanceDbIndex.js"; +import { IDE, IndexingProgressUpdate, IndexTag } from "../index.js"; +import { extractMinimalStackTraceInfo } from "../util/extractMinimalStackTraceInfo.js"; +import { getIndexSqlitePath, getLanceDbPath } from "../util/paths.js"; import { ChunkCodebaseIndex } from "./chunk/ChunkCodebaseIndex.js"; +import { CodeSnippetsCodebaseIndex } from "./CodeSnippetsIndex.js"; +import { FullTextSearchCodebaseIndex } from "./FullTextSearchCodebaseIndex.js"; +import { LanceDbIndex } from "./LanceDbIndex.js"; import { getComputeDeleteAddRemove } from "./refreshIndex.js"; -import { CodebaseIndex, IndexResultType } from "./types.js"; -import { walkDir } from "./walkDir.js"; +import { + CodebaseIndex, + IndexResultType, + RefreshIndexResults, +} from "./types.js"; +import { walkDirAsync } from "./walkDir.js"; export class PauseToken { constructor(private _paused: boolean) {} @@ -22,25 +29,63 @@ export class PauseToken { } export class CodebaseIndexer { + /** + * We batch for two reasons: + * - 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; + + // Note that we exclude certain Sqlite errors that we do not want to clear the indexes on, + // e.g. a `SQLITE_BUSY` error. + errorsRegexesToClearIndexesOn = [ + /Invalid argument error: Values length (d+) is less than the length ((d+)) multiplied by the value size (d+)/, + /SQLITE_CONSTRAINT/, + /SQLITE_ERROR/, + /SQLITE_CORRUPT/, + /SQLITE_IOERR/, + /SQLITE_FULL/, + ]; + constructor( private readonly configHandler: ConfigHandler, - private readonly ide: IDE, + protected readonly ide: IDE, private readonly pauseToken: PauseToken, private readonly continueServerClient: IContinueServerClient, ) {} - private async getIndexesToBuild(): Promise { + async clearIndexes() { + const sqliteFilepath = getIndexSqlitePath(); + const lanceDbFolder = getLanceDbPath(); + + try { + await fs.unlink(sqliteFilepath); + } catch (error) { + console.error(`Error deleting ${sqliteFilepath} folder: ${error}`); + } + + try { + await fs.rm(lanceDbFolder, { recursive: true, force: true }); + } catch (error) { + console.error(`Error deleting ${lanceDbFolder}: ${error}`); + } + } + + protected async getIndexesToBuild(): Promise { const config = await this.configHandler.loadConfig(); + const pathSep = await this.ide.pathSep(); const indexes = [ new ChunkCodebaseIndex( this.ide.readFile.bind(this.ide), + pathSep, this.continueServerClient, config.embeddingsProvider.maxChunkSize, ), // Chunking must come first new LanceDbIndex( config.embeddingsProvider, this.ide.readFile.bind(this.ide), + pathSep, this.continueServerClient, ), new FullTextSearchCodebaseIndex(), @@ -50,6 +95,53 @@ export class CodebaseIndexer { return indexes; } + public async refreshFile(file: string): Promise { + if (this.pauseToken.paused) { + // NOTE: by returning here, there is a chance that while paused a file is modified and + // then after unpausing the file is not reindexed + return; + } + const workspaceDir = await this.getWorkspaceDir(file); + if (!workspaceDir) { + return; + } + const branch = await this.ide.getBranch(workspaceDir); + const repoName = await this.ide.getRepoName(workspaceDir); + const indexesToBuild = await this.getIndexesToBuild(); + const stats = await this.ide.getLastModified([file]); + for (const index of indexesToBuild) { + const tag = { + directory: workspaceDir, + branch, + artifactId: index.artifactId, + }; + const [results, lastUpdated, markComplete] = + await getComputeDeleteAddRemove( + tag, + { ...stats }, + (filepath) => this.ide.readFile(filepath), + repoName, + ); + // since this is only a single file update / save we do not want to actualy remove anything, we just want to recompute for our single file + results.removeTag = []; + results.addTag = []; + results.del = []; + + // Don't update if nothing to update. Some of the indices might do unnecessary setup work + if (results.compute.length === 0) { + continue; + } + + for await (const _ of index.update( + tag, + results, + markComplete, + repoName, + )) { + } + } + } + async *refresh( workspaceDirs: string[], abortSignal: AbortSignal, @@ -81,12 +173,7 @@ export class CodebaseIndexer { }; } - const indexesToBuild = await this.getIndexesToBuild(); let completedDirs = 0; - const totalRelativeExpectedTime = indexesToBuild.reduce( - (sum, index) => sum + index.relativeExpectedTime, - 0, - ); // Wait until Git Extension has loaded to report progress // so we don't appear stuck at 0% while waiting @@ -97,113 +184,244 @@ export class CodebaseIndexer { desc: "Starting indexing...", status: "loading", }; + const beginTime = Date.now(); for (const directory of workspaceDirs) { - const files = await walkDir(directory, this.ide); - const stats = await this.ide.getLastModified(files); + const dirBasename = await this.basename(directory); + yield { + progress, + desc: `Discovering files in ${dirBasename}...`, + status: "indexing", + }; + const workspaceFiles = []; + for await (const p of walkDirAsync(directory, this.ide)) { + workspaceFiles.push(p); + if (abortSignal.aborted) { + yield { + progress: 1, + desc: "Indexing cancelled", + status: "disabled", + }; + return; + } + if (this.pauseToken.paused) { + yield* this.yieldUpdateAndPause(); + } + } + const branch = await this.ide.getBranch(directory); const repoName = await this.ide.getRepoName(directory); - let completedRelativeExpectedTime = 0; + let nextLogThreshold = 0; - for (const codebaseIndex of indexesToBuild) { - // TODO: IndexTag type should use repoName rather than directory - const tag: IndexTag = { + try { + for await (const updateDesc of this.indexFiles( directory, + workspaceFiles, branch, - artifactId: codebaseIndex.artifactId, - }; - const [results, lastUpdated, markComplete] = await getComputeDeleteAddRemove( + repoName, + )) { + // Handle pausing in this loop because it's the only one really taking time + if (abortSignal.aborted) { + yield { + progress: 1, + desc: "Indexing cancelled", + status: "disabled", + }; + return; + } + if (this.pauseToken.paused) { + yield* this.yieldUpdateAndPause(); + } + yield updateDesc; + if (updateDesc.progress >= nextLogThreshold) { + // log progress every 2.5% + nextLogThreshold += 0.025; + this.logProgress( + beginTime, + Math.floor(workspaceFiles.length * updateDesc.progress), + updateDesc.progress, + ); + } + } + } catch (err) { + yield this.handleErrorAndGetProgressUpdate(err); + return; + } + } + yield { + progress: 100, + desc: "Indexing Complete", + status: "done", + }; + } + + private handleErrorAndGetProgressUpdate( + err: unknown, + ): IndexingProgressUpdate { + console.log("error when indexing: ", err); + if (err instanceof Error) { + return this.errorToProgressUpdate(err); + } + return { + progress: 0, + desc: `Indexing failed: ${err}`, + status: "failed", + debugInfo: extractMinimalStackTraceInfo((err as any)?.stack), + }; + } + + private errorToProgressUpdate(err: Error): IndexingProgressUpdate { + let errMsg: string = `${err}`; + let shouldClearIndexes = false; + + // Check if any of the error regexes match + for (const regexStr of this.errorsRegexesToClearIndexesOn) { + const regex = new RegExp(regexStr); + const match = err.message.match(regex); + + if (match !== null) { + shouldClearIndexes = true; + break; + } + } + + return { + progress: 0, + desc: errMsg, + status: "failed", + shouldClearIndexes, + debugInfo: extractMinimalStackTraceInfo(err.stack), + }; + } + + private logProgress( + beginTime: number, + completedFileCount: number, + progress: number, + ) { + const timeTaken = Date.now() - beginTime; + const seconds = Math.round(timeTaken / 1000); + const progressPercentage = (progress * 100).toFixed(1); + const filesPerSec = (completedFileCount / seconds).toFixed(2); + console.debug( + `Indexing: ${progressPercentage}% complete, elapsed time: ${seconds}s, ${filesPerSec} file/sec`, + ); + } + + private async *yieldUpdateAndPause(): AsyncGenerator { + yield { + progress: 0, + desc: "Indexing Paused", + status: "paused", + }; + while (this.pauseToken.paused) { + await new Promise((resolve) => setTimeout(resolve, 100)); + } + } + + /* + * Enables the indexing operation to be completed in batches, this is important in large + * repositories where indexing can quickly use up all the memory available + */ + private *batchRefreshIndexResults( + results: RefreshIndexResults, + ): Generator { + let curPos = 0; + while ( + curPos < results.compute.length || + curPos < results.del.length || + curPos < results.addTag.length || + curPos < results.removeTag.length + ) { + yield { + compute: results.compute.slice(curPos, curPos + this.filesPerBatch), + del: results.del.slice(curPos, curPos + this.filesPerBatch), + addTag: results.addTag.slice(curPos, curPos + this.filesPerBatch), + removeTag: results.removeTag.slice(curPos, curPos + this.filesPerBatch), + }; + curPos += this.filesPerBatch; + } + } + + private async *indexFiles( + workspaceDir: string, + workspaceFiles: string[], + branch: string, + repoName: string | undefined, + ): AsyncGenerator { + const stats = await this.ide.getLastModified(workspaceFiles); + const indexesToBuild = await this.getIndexesToBuild(); + let completedIndexCount = 0; + let progress = 0; + for (const codebaseIndex of indexesToBuild) { + const tag: IndexTag = { + directory: workspaceDir, + branch, + artifactId: codebaseIndex.artifactId, + }; + yield { + progress: progress, + desc: `Planning changes for ${codebaseIndex.artifactId} index...`, + status: "indexing", + }; + const [results, lastUpdated, markComplete] = + await getComputeDeleteAddRemove( tag, { ...stats }, (filepath) => this.ide.readFile(filepath), repoName, ); + const totalOps = + results.compute.length + + results.del.length + + results.addTag.length + + results.removeTag.length; + let completedOps = 0; - try { - for await (let { - progress: indexProgress, - desc, - } of codebaseIndex.update(tag, results, markComplete, repoName)) { - // Handle pausing in this loop because it's the only one really taking time - if (abortSignal.aborted) { - yield { - progress: 1, - desc: "Indexing cancelled", - status: "disabled", - }; - return; - } - - if (this.pauseToken.paused) { - yield { - progress, - desc: "Paused", - status: "paused", - }; - while (this.pauseToken.paused) { - await new Promise((resolve) => setTimeout(resolve, 100)); - } - } - - progress = - (completedDirs + - (completedRelativeExpectedTime + - Math.min(1.0, indexProgress) * - codebaseIndex.relativeExpectedTime) / - totalRelativeExpectedTime) / - workspaceDirs.length; + // Don't update if nothing to update. Some of the indices might do unnecessary setup work + if (totalOps > 0) { + for (const subResult of this.batchRefreshIndexResults(results)) { + for await (const { desc } of codebaseIndex.update( + tag, + subResult, + markComplete, + repoName, + )) { yield { - progress, + progress: progress, desc, status: "indexing", }; } - - lastUpdated.forEach((lastUpdated, path) => { - markComplete([lastUpdated], IndexResultType.UpdateLastUpdated); - }); - - completedRelativeExpectedTime += codebaseIndex.relativeExpectedTime; - yield { - progress: - (completedDirs + - completedRelativeExpectedTime / totalRelativeExpectedTime) / - workspaceDirs.length, - desc: "Completed indexing " + codebaseIndex.artifactId, - status: "indexing", - }; - } catch (e: any) { - let errMsg = `${e}`; - - const errorRegex = - /Invalid argument error: Values length (\d+) is less than the length \((\d+)\) multiplied by the value size \(\d+\)/; - const match = e.message.match(errorRegex); - - if (match) { - const [_, valuesLength, expectedLength] = match; - errMsg = `Generated embedding had length ${valuesLength} but was expected to be ${expectedLength}. This may be solved by deleting ~/.continue/index and refreshing the window to re-index.`; - } - - yield { - progress: 0, - desc: errMsg, - status: "failed", - }; - - console.warn( - `Error updating the ${codebaseIndex.artifactId} index: ${e}`, - ); - return; + completedOps += + subResult.compute.length + + subResult.del.length + + subResult.addTag.length + + subResult.removeTag.length; + progress = + (completedIndexCount + completedOps / totalOps) * + (1 / indexesToBuild.length); } } - completedDirs++; - progress = completedDirs / workspaceDirs.length; - yield { - progress, - desc: "Indexing Complete", - status: "done", - }; + await markComplete(lastUpdated, IndexResultType.UpdateLastUpdated); + completedIndexCount += 1; } } + + private async getWorkspaceDir(filepath: string): Promise { + const workspaceDirs = await this.ide.getWorkspaceDirs(); + for (const workspaceDir of workspaceDirs) { + if (filepath.startsWith(workspaceDir)) { + return workspaceDir; + } + } + return undefined; + } + + private async basename(filepath: string): Promise { + const pathSep = await this.ide.pathSep(); + const path = filepath.split(pathSep); + return path[path.length - 1]; + } } diff --git a/core/indexing/FullTextSearchCodebaseIndex.test.ts b/core/indexing/FullTextSearchCodebaseIndex.test.ts new file mode 100644 index 000000000..af59d0b3c --- /dev/null +++ b/core/indexing/FullTextSearchCodebaseIndex.test.ts @@ -0,0 +1,67 @@ +import { jest } from "@jest/globals"; +import { + insertMockChunks, + mockPathAndCacheKey, + updateIndexAndAwaitGenerator, +} from "../test/util/indexing"; +import { FullTextSearchCodebaseIndex } from "./FullTextSearchCodebaseIndex"; +import { DatabaseConnection, SqliteDb } from "./refreshIndex"; +import { IndexResultType } from "./types"; + +describe("FullTextSearchCodebaseIndex", () => { + let index: FullTextSearchCodebaseIndex; + let db: DatabaseConnection; + + async function getFts() { + return await db.all("SELECT * FROM fts"); + } + + async function getFtsMetadata() { + return await db.all("SELECT * FROM fts_metadata"); + } + + beforeEach(async () => { + db = await SqliteDb.get(); + index = new FullTextSearchCodebaseIndex(); + }); + + it.skip("should update the index and maintain expected database state", async () => { + const mockMarkComplete = jest + .fn() + .mockImplementation(() => Promise.resolve()) as any; + + await insertMockChunks(); + + // Compute test + await updateIndexAndAwaitGenerator(index, "compute", mockMarkComplete); + expect((await getFts()).length).toBe(1); + expect((await getFtsMetadata()).length).toBe(1); + expect(mockMarkComplete).toHaveBeenCalledWith( + [mockPathAndCacheKey], + IndexResultType.Compute, + ); + + // RemoveTag test - currently, we don't do anything other than mark complete + await updateIndexAndAwaitGenerator(index, "removeTag", mockMarkComplete); + expect(mockMarkComplete).toHaveBeenCalledWith( + [mockPathAndCacheKey], + IndexResultType.RemoveTag, + ); + + // AddTag test - currently, we don't do anything other than mark complete + await updateIndexAndAwaitGenerator(index, "addTag", mockMarkComplete); + expect(mockMarkComplete).toHaveBeenCalledWith( + [mockPathAndCacheKey], + IndexResultType.AddTag, + ); + + // Delete test + await updateIndexAndAwaitGenerator(index, "del", mockMarkComplete); + expect((await getFts()).length).toBe(0); + expect((await getFtsMetadata()).length).toBe(0); + expect(mockMarkComplete).toHaveBeenCalledWith( + [mockPathAndCacheKey], + IndexResultType.Delete, + ); + }); +}); diff --git a/core/indexing/FullTextSearch.ts b/core/indexing/FullTextSearchCodebaseIndex.ts similarity index 87% rename from core/indexing/FullTextSearch.ts rename to core/indexing/FullTextSearchCodebaseIndex.ts index c640eae20..7a571bc13 100644 --- a/core/indexing/FullTextSearch.ts +++ b/core/indexing/FullTextSearchCodebaseIndex.ts @@ -1,23 +1,19 @@ -import { - BranchAndDir, - Chunk, - IndexTag, - IndexingProgressUpdate, -} from "../index.js"; -import { getBasename } from "../util/index.js"; -import { RETRIEVAL_PARAMS } from "../util/parameters.js"; -import { ChunkCodebaseIndex } from "./chunk/ChunkCodebaseIndex.js"; -import { DatabaseConnection, SqliteDb, tagToString } from "./refreshIndex.js"; +import { BranchAndDir, Chunk, IndexTag, IndexingProgressUpdate } from "../"; +import { getBasename } from "../util/index"; +import { RETRIEVAL_PARAMS } from "../util/parameters"; +import { ChunkCodebaseIndex } from "./chunk/ChunkCodebaseIndex"; +import { DatabaseConnection, SqliteDb, tagToString } from "./refreshIndex"; import { IndexResultType, MarkCompleteCallback, RefreshIndexResults, type CodebaseIndex, -} from "./types.js"; +} from "./types"; export class FullTextSearchCodebaseIndex implements CodebaseIndex { relativeExpectedTime: number = 0.2; - artifactId = "sqliteFts"; + static artifactId = "sqliteFts"; + artifactId: string = ChunkCodebaseIndex.artifactId; private async _createTables(db: DatabaseConnection) { await db.exec(`CREATE VIRTUAL TABLE IF NOT EXISTS fts USING fts5( @@ -90,11 +86,12 @@ export class FullTextSearchCodebaseIndex implements CodebaseIndex { // Delete for (const item of results.del) { - const { lastID } = await db.run( - "DELETE FROM fts_metadata WHERE path = ? AND cacheKey = ?", - [item.path, item.cacheKey], - ); - await db.run("DELETE FROM fts WHERE rowid = ?", [lastID]); + await db.run("DELETE FROM fts_metadata WHERE path = ? AND cacheKey = ?", [ + item.path, + item.cacheKey, + ]); + + await db.run("DELETE FROM fts WHERE path = ?", [item.path]); markComplete([item], IndexResultType.Delete); } diff --git a/core/indexing/LanceDbIndex.test.ts b/core/indexing/LanceDbIndex.test.ts new file mode 100644 index 000000000..0c636df6a --- /dev/null +++ b/core/indexing/LanceDbIndex.test.ts @@ -0,0 +1,115 @@ +import { jest } from "@jest/globals"; +import lance from "vectordb"; +import { testConfigHandler, testIde } from "../test/util/fixtures"; +import { + mockPathAndCacheKey, + mockTag, + testContinueServerClient, + updateIndexAndAwaitGenerator, +} from "../test/util/indexing"; +import { getLanceDbPath } from "../util/paths"; +import { LanceDbIndex } from "./LanceDbIndex"; +import { DatabaseConnection, SqliteDb } from "./refreshIndex"; +import { IndexResultType } from "./types"; + +jest.useFakeTimers(); + +describe("ChunkCodebaseIndex", () => { + let index: LanceDbIndex; + let sqliteDb: DatabaseConnection; + let lanceDb: lance.Connection; + + async function getAllSqliteLanceDbCache() { + return await sqliteDb.all("SELECT * FROM lance_db_cache"); + } + + beforeAll(async () => { + const pathSep = await testIde.pathSep(); + const mockConfig = await testConfigHandler.loadConfig(); + + index = new LanceDbIndex( + mockConfig.embeddingsProvider, + testIde.readFile.bind(testIde), + pathSep, + testContinueServerClient, + ); + + sqliteDb = await SqliteDb.get(); + lanceDb = await lance.connect(getLanceDbPath()); + }); + + /** + * Some notes on quirks of this test: + * - Currently, it appears that there is a race condition in LanceDB that + * requires us to re-open the table connection each time we want to read + * from it. Attempting to follow these docs did not resolve the issue: + * https://lancedb.github.io/lancedb/guides/tables/#consistency + * + * - We cannot open either the 'dev' or 'main' tag tables ubtil after we + * can assume they've been created through `updateIndexAndAwaitGenerator` + */ + it.skip("should update the index and maintain expected database state", async () => { + const mainTag = mockTag; + const mainTagTableName = index.tableNameForTag(mainTag); + + const devTag = { ...mockTag, branch: "dev" }; + const devTagTableName = index.tableNameForTag(devTag); + + const mockMarkComplete = jest + .fn() + .mockImplementation(() => Promise.resolve()) as any; + + // Compute test - inserts into both LanceDB and Sqlite + await updateIndexAndAwaitGenerator( + index, + "compute", + mockMarkComplete, + mainTag, + ); + let mainTagTable = await lanceDb.openTable(mainTagTableName); + expect(await mainTagTable.countRows()).toBe(1); + expect((await getAllSqliteLanceDbCache()).length).toBe(1); + expect(mockMarkComplete).toHaveBeenCalledWith( + [mockPathAndCacheKey], + IndexResultType.Compute, + ); + + // AddTag test - only inserts into Lance DB + await updateIndexAndAwaitGenerator( + index, + "addTag", + mockMarkComplete, + devTag, + ); + let devTagTable = await lanceDb.openTable(devTagTableName); + expect(await devTagTable.countRows()).toBe(1); + expect(mockMarkComplete).toHaveBeenCalledWith( + [mockPathAndCacheKey], + IndexResultType.AddTag, + ); + + // RemoveTag - only removes from Lance DB + await updateIndexAndAwaitGenerator( + index, + "removeTag", + mockMarkComplete, + devTag, + ); + devTagTable = await lanceDb.openTable(devTagTableName); + expect(await devTagTable.countRows()).toBe(0); + expect(mockMarkComplete).toHaveBeenCalledWith( + [mockPathAndCacheKey], + IndexResultType.RemoveTag, + ); + + // Delete test - removes from LanceDB and Sqlite + await updateIndexAndAwaitGenerator(index, "del", mockMarkComplete, mainTag); + mainTagTable = await lanceDb.openTable(mainTagTableName); + expect(await mainTagTable.countRows()).toBe(0); + expect((await getAllSqliteLanceDbCache()).length).toBe(0); + expect(mockMarkComplete).toHaveBeenCalledWith( + [mockPathAndCacheKey], + IndexResultType.Delete, + ); + }); +}); diff --git a/core/indexing/LanceDbIndex.ts b/core/indexing/LanceDbIndex.ts index 4b98040d9..420f33eb8 100644 --- a/core/indexing/LanceDbIndex.ts +++ b/core/indexing/LanceDbIndex.ts @@ -1,6 +1,7 @@ // NOTE: vectordb requirement must be listed in extensions/vscode to avoid error +import { RunResult } from "sqlite3"; import { v4 as uuidv4 } from "uuid"; -import { Table } from "vectordb"; +import lance, { Table } from "vectordb"; import { IContinueServerClient } from "../continueServer/interface.js"; import { BranchAndDir, @@ -11,11 +12,13 @@ import { } from "../index.js"; import { getBasename } from "../util/index.js"; import { getLanceDbPath, migrate } from "../util/paths.js"; -import { chunkDocument } from "./chunk/chunk.js"; +import { Telemetry } from "../util/posthog.js"; +import { chunkDocument, shouldChunk } from "./chunk/chunk.js"; import { DatabaseConnection, SqliteDb, tagToString } from "./refreshIndex.js"; import { CodebaseIndex, IndexResultType, + MarkCompleteCallback, PathAndCacheKey, RefreshIndexResults, } from "./types.js"; @@ -29,6 +32,10 @@ interface LanceDbRow { [key: string]: any; } +type ItemWithChunks = { item: PathAndCacheKey; chunks: Chunk[] }; + +type ChunkMap = Map; + export class LanceDbIndex implements CodebaseIndex { relativeExpectedTime: number = 13; get artifactId(): string { @@ -38,10 +45,11 @@ export class LanceDbIndex implements CodebaseIndex { constructor( private readonly embeddingsProvider: EmbeddingsProvider, private readonly readFile: (filepath: string) => Promise, + private readonly pathSep: string, private readonly continueServerClient?: IContinueServerClient, ) {} - private tableNameForTag(tag: IndexTag) { + tableNameForTag(tag: IndexTag) { return tagToString(tag).replace(/[^\w-_.]/g, ""); } @@ -62,9 +70,17 @@ export class LanceDbIndex implements CodebaseIndex { "lancedb_sqlite_artifact_id_column", async () => { try { - await db.exec( - "ALTER TABLE lance_db_cache ADD COLUMN artifact_id TEXT NOT NULL DEFAULT 'UNDEFINED'", + const pragma = await db.all("PRAGMA table_info(lance_db_cache)"); + + const hasArtifactIdCol = pragma.some( + (pragma) => pragma.name === "artifact_id", ); + + if (!hasArtifactIdCol) { + await db.exec( + "ALTER TABLE lance_db_cache ADD COLUMN artifact_id TEXT NOT NULL DEFAULT 'UNDEFINED'", + ); + } } finally { resolve(undefined); } @@ -74,141 +90,153 @@ export class LanceDbIndex implements CodebaseIndex { ); } - private async *computeChunks( - items: PathAndCacheKey[], - ): AsyncGenerator< - | [ - number, - LanceDbRow, - { startLine: number; endLine: number; contents: string }, - string, - ] - | PathAndCacheKey - > { - const contents = await Promise.all( - items.map(({ path }) => this.readFile(path)), + private async computeRows(items: PathAndCacheKey[]): Promise { + const chunkMap = await this.collectChunks(items); + const allChunks = Array.from(chunkMap.values()).flatMap( + ({ chunks }) => chunks, ); + const embeddings = await this.getEmbeddings(allChunks); - for (let i = 0; i < items.length; i++) { - // Break into chunks - const content = contents[i]; - const chunks: Chunk[] = []; + // Remove undefined embeddings and their corresponding chunks + for (let i = embeddings.length - 1; i >= 0; i--) { + if (embeddings[i] === undefined) { + const chunk = allChunks[i]; + const chunks = chunkMap.get(chunk.filepath)?.chunks; - let hasEmptyChunks = false; - - for await (const chunk of chunkDocument({ - filepath: items[i].path, - contents: content, - maxChunkSize: this.embeddingsProvider.maxChunkSize, - digest: items[i].cacheKey, - })) { - if (chunk.content.length == 0) { - hasEmptyChunks = true; - break; + if (chunks) { + const index = chunks.findIndex((c) => c === chunk); + if (index !== -1) { + chunks.splice(index, 1); + } } - chunks.push(chunk); - } - if (hasEmptyChunks) { - // File did not chunk properly, let's skip it. - continue; + embeddings.splice(i, 1); } - - if (chunks.length > 20) { - // Too many chunks to index, probably a larger file than we want to include - continue; - } - - let embeddings: number[][]; - try { - // Calculate embeddings - embeddings = await this.embeddingsProvider.embed( - chunks.map((c) => c.content), - ); - } catch (e) { - // Rather than fail the entire indexing process, we'll just skip this file - // so that it may be picked up on the next indexing attempt - console.warn( - `Failed to generate embedding for ${chunks[0]?.filepath} with provider: ${this.embeddingsProvider.id}: ${e}`, - ); - continue; - } - - if (embeddings.some((emb) => emb === undefined)) { - throw new Error( - `Failed to generate embedding for ${chunks[0]?.filepath} with provider: ${this.embeddingsProvider.id}`, - ); - } - - // Create row format - for (let j = 0; j < chunks.length; j++) { - const progress = (i + j / chunks.length) / items.length; - const row = { - vector: embeddings[j], - path: items[i].path, - cachekey: items[i].cacheKey, - uuid: uuidv4(), - }; - const chunk = chunks[j]; - yield [ - progress, - row, - { - contents: chunk.content, - startLine: chunk.startLine, - endLine: chunk.endLine, - }, - `Indexing ${getBasename(chunks[j].filepath)}`, - ]; - } - - yield items[i]; } + + return this.createLanceDbRows(chunkMap, embeddings); + } + + private async collectChunks(items: PathAndCacheKey[]): Promise { + const chunkMap: ChunkMap = new Map(); + + for (const item of items) { + try { + const content = await this.readFile(item.path); + + if (!shouldChunk(this.pathSep, item.path, content)) { + continue; + } + + const chunks = await this.getChunks(item, content); + chunkMap.set(item.path, { item, chunks }); + } catch (err) { + console.log(`LanceDBIndex, skipping ${item.path}: ${err}`); + } + } + + return chunkMap; + } + + private async getChunks( + item: PathAndCacheKey, + content: string, + ): Promise { + const chunks: Chunk[] = []; + + const chunkParams = { + filepath: item.path, + contents: content, + maxChunkSize: this.embeddingsProvider.maxChunkSize, + digest: item.cacheKey, + }; + + for await (const chunk of chunkDocument(chunkParams)) { + if (chunk.content.length === 0) { + throw new Error("did not chunk properly"); + } + + chunks.push(chunk); + } + + return chunks; + } + + private async getEmbeddings(chunks: Chunk[]): Promise { + try { + return await this.embeddingsProvider.embed(chunks.map((c) => c.content)); + } catch (err) { + throw new Error( + `Failed to generate embeddings for ${chunks.length} chunks with provider: ${this.embeddingsProvider.id}: ${err}`, + { cause: err }, + ); + } + } + + private createLanceDbRows( + chunkMap: ChunkMap, + embeddings: number[][], + ): LanceDbRow[] { + const results: LanceDbRow[] = []; + let embeddingIndex = 0; + + for (const [path, { item, chunks }] of chunkMap) { + for (const chunk of chunks) { + results.push({ + path, + cachekey: item.cacheKey, + uuid: uuidv4(), + vector: embeddings[embeddingIndex], + startLine: chunk.startLine, + endLine: chunk.endLine, + contents: chunk.content, + }); + embeddingIndex++; + } + } + + return results; } async *update( tag: IndexTag, results: RefreshIndexResults, - markComplete: ( - items: PathAndCacheKey[], - resultType: IndexResultType, - ) => void, + markComplete: MarkCompleteCallback, repoName: string | undefined, ): AsyncGenerator { - const lancedb = await import("vectordb"); - const tableName = this.tableNameForTag(tag); - const db = await lancedb.connect(getLanceDbPath()); + const sqliteDb = await SqliteDb.get(); + await this.createSqliteCacheTable(sqliteDb); - const sqlite = await SqliteDb.get(); - await this.createSqliteCacheTable(sqlite); + const lanceTableName = this.tableNameForTag(tag); + const lanceDb = await lance.connect(getLanceDbPath()); + const existingLanceTables = await lanceDb.tableNames(); + + let lanceTable: Table | undefined = undefined; + let needToCreateLanceTable = !existingLanceTables.includes(lanceTableName); // Compute - let table: Table | undefined = undefined; - const existingTables = await db.tableNames(); - let needToCreateTable = !existingTables.includes(tableName); - const addComputedLanceDbRows = async ( - pathAndCacheKey: PathAndCacheKey, + pathAndCacheKeys: PathAndCacheKey[], computedRows: LanceDbRow[], ) => { // Create table if needed, add computed rows - if (table) { + if (lanceTable) { if (computedRows.length > 0) { - await table.add(computedRows); + await lanceTable.add(computedRows); } - } else if (existingTables.includes(tableName)) { - table = await db.openTable(tableName); - needToCreateTable = false; + } else if (existingLanceTables.includes(lanceTableName)) { + lanceTable = await lanceDb.openTable(lanceTableName); + needToCreateLanceTable = false; if (computedRows.length > 0) { - await table.add(computedRows); + await lanceTable.add(computedRows); } } else if (computedRows.length > 0) { - table = await db.createTable(tableName, computedRows); - needToCreateTable = false; + lanceTable = await lanceDb.createTable(lanceTableName, computedRows); + needToCreateLanceTable = false; } // Mark item complete - markComplete([pathAndCacheKey], IndexResultType.Compute); + await markComplete(pathAndCacheKeys, IndexResultType.Compute); }; // Check remote cache @@ -244,7 +272,7 @@ export class LanceDbIndex implements CodebaseIndex { }; rows.push(row); - await sqlite.run( + await sqliteDb.run( "INSERT INTO lance_db_cache (uuid, cacheKey, path, artifact_id, vector, startLine, endLine, contents) VALUES (?, ?, ?, ?, ?, ?, ?, ?)", row.uuid, row.cachekey, @@ -257,7 +285,7 @@ export class LanceDbIndex implements CodebaseIndex { ); } - await addComputedLanceDbRows({ cacheKey, path }, rows); + await addComputedLanceDbRows([{ cacheKey, path }], rows); } // Remove items that don't need to be recomputed @@ -269,43 +297,22 @@ export class LanceDbIndex implements CodebaseIndex { } } - const progressReservedForTagging = 0.1; + yield { + progress: 0, + desc: `Computing embeddings for ${ + results.compute.length + } ${this.formatListPlurality("file", results.compute.length)}`, + status: "indexing", + }; + + const dbRows = await this.computeRows(results.compute); + await this.insertRows(sqliteDb, dbRows); + await addComputedLanceDbRows(results.compute, dbRows); let accumulatedProgress = 0; - let computedRows: LanceDbRow[] = []; - for await (const update of this.computeChunks(results.compute)) { - if (Array.isArray(update)) { - const [progress, row, data, desc] = update; - computedRows.push(row); - - // Add the computed row to the cache - await sqlite.run( - "INSERT INTO lance_db_cache (uuid, cacheKey, path, artifact_id, vector, startLine, endLine, contents) VALUES (?, ?, ?, ?, ?, ?, ?, ?)", - row.uuid, - row.cachekey, - row.path, - this.artifactId, - JSON.stringify(row.vector), - data.startLine, - data.endLine, - data.contents, - ); - - accumulatedProgress = progress * (1 - progressReservedForTagging); - yield { - progress: accumulatedProgress, - desc, - status: "indexing", - }; - } else { - await addComputedLanceDbRows(update, computedRows); - computedRows = []; - } - } - // Add tag - retrieve the computed info from lance sqlite cache for (const { path, cacheKey } of results.addTag) { - const stmt = await sqlite.prepare( + const stmt = await sqliteDb.prepare( "SELECT * FROM lance_db_cache WHERE cacheKey = ? AND path = ? AND artifact_id = ?", cacheKey, path, @@ -313,29 +320,32 @@ export class LanceDbIndex implements CodebaseIndex { ); const cachedItems = await stmt.all(); - const lanceRows: LanceDbRow[] = cachedItems.map((item) => { - return { + const lanceRows: LanceDbRow[] = cachedItems.map( + ({ uuid, vector, startLine, endLine, contents }) => ({ path, + uuid, + startLine, + endLine, + contents, cachekey: cacheKey, - uuid: item.uuid, - vector: JSON.parse(item.vector), - }; - }); + vector: JSON.parse(vector), + }), + ); if (lanceRows.length > 0) { - if (needToCreateTable) { - table = await db.createTable(tableName, lanceRows); - needToCreateTable = false; - } else if (!table) { - table = await db.openTable(tableName); - needToCreateTable = false; - await table.add(lanceRows); + if (needToCreateLanceTable) { + lanceTable = await lanceDb.createTable(lanceTableName, lanceRows); + needToCreateLanceTable = false; + } else if (!lanceTable) { + lanceTable = await lanceDb.openTable(lanceTableName); + needToCreateLanceTable = false; + await lanceTable.add(lanceRows); } else { - await table?.add(lanceRows); + await lanceTable?.add(lanceRows); } } - markComplete([{ path, cacheKey }], IndexResultType.AddTag); + await markComplete([{ path, cacheKey }], IndexResultType.AddTag); accumulatedProgress += 1 / results.addTag.length / 3; yield { progress: accumulatedProgress, @@ -345,11 +355,18 @@ export class LanceDbIndex implements CodebaseIndex { } // Delete or remove tag - remove from lance table) - if (!needToCreateTable) { + if (!needToCreateLanceTable) { const toDel = [...results.removeTag, ...results.del]; + + if (!lanceTable) { + lanceTable = await lanceDb.openTable(lanceTableName); + } + for (const { path, cacheKey } of toDel) { // This is where the aforementioned lowercase conversion problem shows - await table?.delete(`cachekey = '${cacheKey}' AND path = '${path}'`); + await lanceTable.delete( + `cachekey = '${cacheKey}' AND path = '${path}'`, + ); accumulatedProgress += 1 / toDel.length / 3; yield { @@ -359,11 +376,12 @@ export class LanceDbIndex implements CodebaseIndex { }; } } - markComplete(results.removeTag, IndexResultType.RemoveTag); + + await markComplete(results.removeTag, IndexResultType.RemoveTag); // Delete - also remove from sqlite cache for (const { path, cacheKey } of results.del) { - await sqlite.run( + await sqliteDb.run( "DELETE FROM lance_db_cache WHERE cacheKey = ? AND path = ? AND artifact_id = ?", cacheKey, path, @@ -377,7 +395,8 @@ export class LanceDbIndex implements CodebaseIndex { }; } - markComplete(results.del, IndexResultType.Delete); + await markComplete(results.del, IndexResultType.Delete); + yield { progress: 1, desc: "Completed Calculating Embeddings", @@ -399,8 +418,16 @@ export class LanceDbIndex implements CodebaseIndex { return []; } - const table = await db.openTable(tableName); - let query = table.search(vector); + if (!db.search) { + // Unclear why this is happening + console.debug( + "Error retrieving from vectordb: db.search isn't a function", + ); + Telemetry.capture("db_search_not_a_function", {}, false); + return []; + } + + let query = db.search(vector); if (directory) { // seems like lancedb is only post-filtering, so have to return a bunch of results and slice after query = query.where(`path LIKE '${directory}%'`).limit(300); @@ -417,12 +444,8 @@ export class LanceDbIndex implements CodebaseIndex { tags: BranchAndDir[], filterDirectory: string | undefined, ): Promise { - const lancedb = await import("vectordb"); - if (!lancedb.connect) { - throw new Error("LanceDB failed to load a native module"); - } const [vector] = await this.embeddingsProvider.embed([query]); - const db = await lancedb.connect(getLanceDbPath()); + const db = await lance.connect(getLanceDbPath()); let allResults = []; for (const tag of tags) { @@ -458,4 +481,62 @@ export class LanceDbIndex implements CodebaseIndex { }; }); } + + private async insertRows( + db: DatabaseConnection, + rows: LanceDbRow[], + ): Promise { + return new Promise((resolve, reject) => { + db.db.serialize(() => { + db.db.exec("BEGIN", (err: Error | null) => { + if (err) { + reject(new Error("error creating transaction", { cause: err })); + } + }); + + const sql = + "INSERT INTO lance_db_cache (uuid, cacheKey, path, artifact_id, vector, startLine, endLine, contents) VALUES (?, ?, ?, ?, ?, ?, ?, ?)"; + rows.map((r) => { + db.db.run( + sql, + [ + r.uuid, + r.cachekey, + r.path, + this.artifactId, + JSON.stringify(r.vector), + r.startLine, + r.endLine, + r.contents, + ], + (result: RunResult, err: Error) => { + if (err) { + reject( + new Error("error inserting into lance_db_cache table", { + cause: err, + }), + ); + } + }, + ); + }); + db.db.exec("COMMIT", (err: Error | null) => { + if (err) { + reject( + new Error( + "error while committing insert into lance_db_rows transaction", + { cause: err }, + ), + ); + } else { + resolve(); + } + }); + }); + }); + } + + private formatListPlurality(word: string, length: number): string { + return length <= 1 ? word : `${word}s`; + } } diff --git a/core/indexing/README.md b/core/indexing/README.md index 401f281f7..2a7375f00 100644 --- a/core/indexing/README.md +++ b/core/indexing/README.md @@ -18,13 +18,13 @@ The indexing process does the following: ## Existing `CodebaseIndex`es -All indexes must be returned by `getIndexesToBuild` in [`indexCodebase.ts`](./indexCodebase.ts) if they are to be used. +All indexes must be returned by `getIndexesToBuild` in [`CodebaseIndexer.ts`](./CodebaseIndexer.ts) if they are to be used. `CodeSnippetsCodebaseIndex`: uses tree-sitter queries to get a list of functions, classes, and other top-level code objects in each file `FullTextSearchCodebaseIndex`: creates a full-text search index using SQLite FTS5 `ChunkCodebaseIndex`: chunks files recursively by code structure, for use in other embeddings providers like `LanceDbCodebaseIndex` -`LanceDbCodebaseIndex`: calculates embeddings for each chunk and adds them to the LanceDB vector database, with metadata going into SQLite +`LanceDbCodebaseIndex`: calculates embeddings for each chunk and adds them to the LanceDB vector database, with metadata going into SQLite. Note that for each branch, a unique table is created in LanceDB. -## Known problems: +## Known problems - `FullTextSearchCodebaseIndex` doesn't differentiate between tags (branch, repo), so results may come from any branch/repo. LanceDB does this by creating separate tables for each tag (see `tableNameForTag`). The chunk index does this with a second table diff --git a/core/indexing/TestCodebaseIndex.ts b/core/indexing/TestCodebaseIndex.ts new file mode 100644 index 000000000..7031fd992 --- /dev/null +++ b/core/indexing/TestCodebaseIndex.ts @@ -0,0 +1,69 @@ +import type { IndexTag, IndexingProgressUpdate } from "../index.js"; +import { DatabaseConnection, SqliteDb } from "./refreshIndex.js"; +import { + IndexResultType, + MarkCompleteCallback, + RefreshIndexResults, + type CodebaseIndex, +} from "./types.js"; + +/** + * This is a CodebaseIndex used for testing which files get indexed. + * It maintains a SQLite database of all file/tag pairs + */ +export class TestCodebaseIndex implements CodebaseIndex { + relativeExpectedTime: number = 0.1; + artifactId = "__test__"; + + private static async _createTables(db: DatabaseConnection) { + await db.exec(`CREATE TABLE IF NOT EXISTS test_index ( + id INTEGER PRIMARY KEY, + path TEXT NOT NULL, + branch TEXT NOT NULL, + directory TEXT NOT NULL + )`); + } + + async *update( + tag: IndexTag, + results: RefreshIndexResults, + markComplete: MarkCompleteCallback, + repoName: string | undefined, + ): AsyncGenerator { + const db = await SqliteDb.get(); + await TestCodebaseIndex._createTables(db); + + for (const item of [...results.compute, ...results.addTag]) { + await db.run( + "INSERT INTO test_index (path, branch, directory) VALUES (?, ?, ?)", + [item.path, tag.branch, tag.directory], + ); + } + + for (const item of [...results.del, ...results.removeTag]) { + await db.run( + "DELETE FROM test_index WHERE path = ? AND branch = ? AND directory = ?", + [item.path, tag.branch, tag.directory], + ); + } + + markComplete(results.compute, IndexResultType.Compute); + markComplete(results.addTag, IndexResultType.AddTag); + markComplete(results.del, IndexResultType.Delete); + markComplete(results.removeTag, IndexResultType.RemoveTag); + } + + async getIndexedFilesForTags(tags: IndexTag[]): Promise { + const db = await SqliteDb.get(); + await TestCodebaseIndex._createTables(db); + + const rows = await db.all( + `SELECT path FROM test_index WHERE (branch, directory) IN (VALUES ${tags + .map(() => "(?, ?)") + .join(", ")})`, + tags.flatMap((tag) => [tag.branch, tag.directory]), + ); + + return rows.map((row: any) => row.path); + } +} diff --git a/core/indexing/chunk/ChunkCodebaseIndex.test.ts b/core/indexing/chunk/ChunkCodebaseIndex.test.ts new file mode 100644 index 000000000..7453e8a78 --- /dev/null +++ b/core/indexing/chunk/ChunkCodebaseIndex.test.ts @@ -0,0 +1,83 @@ +import { jest } from "@jest/globals"; +import { testIde } from "../../test/util/fixtures"; +import { + mockFileContents, + mockFilename, + mockPathAndCacheKey, + testContinueServerClient, + updateIndexAndAwaitGenerator, +} from "../../test/util/indexing"; +import { addToTestDir } from "../../test/util/testDir"; +import { DatabaseConnection, SqliteDb } from "../refreshIndex"; +import { IndexResultType } from "../types"; +import { ChunkCodebaseIndex } from "./ChunkCodebaseIndex"; + +jest.useFakeTimers(); + +describe("ChunkCodebaseIndex", () => { + let index: ChunkCodebaseIndex; + let db: DatabaseConnection; + + async function getAllChunks() { + return await db.all("SELECT * FROM chunks"); + } + + async function getAllChunkTags() { + return await db.all("SELECT * FROM chunk_tags"); + } + + beforeAll(async () => { + const pathSep = await testIde.pathSep(); + + index = new ChunkCodebaseIndex( + testIde.readFile.bind(testIde), + pathSep, + testContinueServerClient, + 1000, + ); + + addToTestDir([[mockFilename, mockFileContents]]); + + db = await SqliteDb.get(); + }); + + it.skip("should update the index and maintain expected database state, following the same processing order of results as the update method", async () => { + const mockMarkComplete = jest + .fn() + .mockImplementation(() => Promise.resolve()) as any; + + // Compute test + await updateIndexAndAwaitGenerator(index, "compute", mockMarkComplete); + expect((await getAllChunks()).length).toBe(1); + expect((await getAllChunkTags()).length).toBe(1); + expect(mockMarkComplete).toHaveBeenCalledWith( + [mockPathAndCacheKey], + IndexResultType.Compute, + ); + + // RemoveTag test + await updateIndexAndAwaitGenerator(index, "removeTag", mockMarkComplete); + expect((await getAllChunkTags()).length).toBe(0); + expect(mockMarkComplete).toHaveBeenCalledWith( + [mockPathAndCacheKey], + IndexResultType.RemoveTag, + ); + + // AddTag test + await updateIndexAndAwaitGenerator(index, "addTag", mockMarkComplete); + expect((await getAllChunkTags()).length).toBe(1); + expect(mockMarkComplete).toHaveBeenCalledWith( + [mockPathAndCacheKey], + IndexResultType.AddTag, + ); + + // Delete test + await updateIndexAndAwaitGenerator(index, "del", mockMarkComplete); + expect((await getAllChunks()).length).toBe(0); + expect((await getAllChunkTags()).length).toBe(0); + expect(mockMarkComplete).toHaveBeenCalledWith( + [mockPathAndCacheKey], + IndexResultType.Delete, + ); + }); +}); diff --git a/core/indexing/chunk/ChunkCodebaseIndex.ts b/core/indexing/chunk/ChunkCodebaseIndex.ts index d80bb1c4f..cdf91f359 100644 --- a/core/indexing/chunk/ChunkCodebaseIndex.ts +++ b/core/indexing/chunk/ChunkCodebaseIndex.ts @@ -1,3 +1,5 @@ +import * as path from "path"; +import { RunResult } from "sqlite3"; import { IContinueServerClient } from "../../continueServer/interface.js"; import { Chunk, IndexTag, IndexingProgressUpdate } from "../../index.js"; import { getBasename } from "../../util/index.js"; @@ -5,10 +7,11 @@ import { DatabaseConnection, SqliteDb, tagToString } from "../refreshIndex.js"; import { IndexResultType, MarkCompleteCallback, + PathAndCacheKey, RefreshIndexResults, type CodebaseIndex, } from "../types.js"; -import { chunkDocument } from "./chunk.js"; +import { chunkDocument, shouldChunk } from "./chunk.js"; export class ChunkCodebaseIndex implements CodebaseIndex { relativeExpectedTime: number = 1; @@ -17,13 +20,130 @@ export class ChunkCodebaseIndex implements CodebaseIndex { constructor( private readonly readFile: (filepath: string) => Promise, + private readonly pathSep: string, private readonly continueServerClient: IContinueServerClient, private readonly maxChunkSize: number, ) { this.readFile = readFile; } - private async _createTables(db: DatabaseConnection) { + async *update( + tag: IndexTag, + results: RefreshIndexResults, + markComplete: MarkCompleteCallback, + repoName: string | undefined, + ): AsyncGenerator { + const db = await SqliteDb.get(); + await this.createTables(db); + const tagString = tagToString(tag); + + // Check the remote cache + if (this.continueServerClient.connected) { + try { + const keys = results.compute.map(({ cacheKey }) => cacheKey); + const resp = await this.continueServerClient.getFromIndexCache( + keys, + "chunks", + repoName, + ); + + for (const [cacheKey, chunks] of Object.entries(resp.files)) { + await this.insertChunks(db, tagString, chunks); + } + results.compute = results.compute.filter( + (item) => !resp.files[item.cacheKey], + ); + } catch (e) { + console.error("Failed to fetch from remote cache: ", e); + } + } + + let accumulatedProgress = 0; + + if (results.compute.length > 0) { + const filepath = results.compute[0].path; + const folderName = path.basename(path.dirname(filepath)); + + yield { + desc: `Chunking files in ${folderName}`, + status: "indexing", + progress: accumulatedProgress, + }; + const chunks = await this.computeChunks(results.compute); + await this.insertChunks(db, tagString, chunks); + await markComplete(results.compute, IndexResultType.Compute); + } + + // Add tag + for (const item of results.addTag) { + await db.run( + ` + INSERT INTO chunk_tags (chunkId, tag) + SELECT id, ? FROM chunks + WHERE cacheKey = ? AND path = ? + `, + [tagString, item.cacheKey, item.path], + ); + await markComplete([item], IndexResultType.AddTag); + accumulatedProgress += 1 / results.addTag.length / 4; + yield { + progress: accumulatedProgress, + desc: `Adding ${getBasename(item.path)}`, + status: "indexing", + }; + } + + // Remove tag + for (const item of results.removeTag) { + await db.run( + ` + DELETE FROM chunk_tags + WHERE tag = ? + AND chunkId IN ( + SELECT id FROM chunks + WHERE cacheKey = ? AND path = ? + ) + `, + [tagString, item.cacheKey, item.path], + ); + await markComplete([item], IndexResultType.RemoveTag); + accumulatedProgress += 1 / results.removeTag.length / 4; + yield { + progress: accumulatedProgress, + desc: `Removing ${getBasename(item.path)}`, + status: "indexing", + }; + } + + // Delete + for (const item of results.del) { + const chunkToDelete = await db.get( + "SELECT id FROM chunks WHERE cacheKey = ?", + [item.cacheKey], + ); + + if (chunkToDelete) { + await db.run("DELETE FROM chunks WHERE id = ?", [chunkToDelete.id]); + + // Delete from chunk_tags + await db.run("DELETE FROM chunk_tags WHERE chunkId = ?", [ + chunkToDelete.id, + ]); + } else { + console.debug("Chunk to delete wasn't found in the table: ", item.path); + } + + await markComplete([item], IndexResultType.Delete); + accumulatedProgress += 1 / results.del.length / 4; + yield { + progress: accumulatedProgress, + desc: `Removing ${getBasename(item.path)}`, + status: "indexing", + }; + } + } + + private async createTables(db: DatabaseConnection) { await db.exec(`CREATE TABLE IF NOT EXISTS chunks ( id INTEGER PRIMARY KEY AUTOINCREMENT, cacheKey TEXT NOT NULL, @@ -42,158 +162,87 @@ export class ChunkCodebaseIndex implements CodebaseIndex { )`); } - async *update( - tag: IndexTag, - results: RefreshIndexResults, - markComplete: MarkCompleteCallback, - repoName: string | undefined, - ): AsyncGenerator { - const db = await SqliteDb.get(); - await this._createTables(db); - const tagString = tagToString(tag); - - async function handleChunk(chunk: Chunk) { - const { lastID } = await db.run( - "INSERT INTO chunks (cacheKey, path, idx, startLine, endLine, content) VALUES (?, ?, ?, ?, ?, ?)", - [ - chunk.digest, - chunk.filepath, - chunk.index, - chunk.startLine, - chunk.endLine, - chunk.content, - ], - ); - - await db.run("INSERT INTO chunk_tags (chunkId, tag) VALUES (?, ?)", [ - lastID, - tagString, - ]); + private async packToChunks(pack: PathAndCacheKey): Promise { + const contents = await this.readFile(pack.path); + if (!shouldChunk(this.pathSep, pack.path, contents)) { + return []; } + const chunks: Chunk[] = []; + const chunkParams = { + filepath: pack.path, + contents, + maxChunkSize: this.maxChunkSize, + digest: pack.cacheKey, + }; + for await (const c of chunkDocument(chunkParams)) { + chunks.push(c); + } + return chunks; + } - // Check the remote cache - if (this.continueServerClient.connected) { - try { - const keys = results.compute.map(({ cacheKey }) => cacheKey); - const resp = await this.continueServerClient.getFromIndexCache( - keys, - "chunks", - repoName, - ); + private async computeChunks(paths: PathAndCacheKey[]): Promise { + const chunkLists = await Promise.all( + paths.map((p) => this.packToChunks(p)), + ); + return chunkLists.flat(); + } - for (const [cacheKey, chunks] of Object.entries(resp.files)) { - for (const chunk of chunks) { - await handleChunk(chunk); + private async insertChunks( + db: DatabaseConnection, + tagString: string, + chunks: Chunk[], + ) { + await new Promise((resolve, reject) => { + db.db.serialize(() => { + db.db.exec("BEGIN", (err: Error | null) => { + if (err) { + reject(new Error("error creating transaction", { cause: err })); } - } - results.compute = results.compute.filter( - (item) => !resp.files[item.cacheKey], - ); - } catch (e) { - console.error("Failed to fetch from remote cache: ", e); - } - } - - const progressReservedForTagging = 0.3; - let accumulatedProgress = 0; - - // Compute chunks for new files - const contents = await Promise.all( - results.compute.map(({ path }) => this.readFile(path)), - ); - for (let i = 0; i < results.compute.length; i++) { - const item = results.compute[i]; - - // Insert chunks - if (contents.length) { - for await (const chunk of chunkDocument({ - filepath: item.path, - contents: contents[i], - maxChunkSize: this.maxChunkSize, - digest: item.cacheKey, - })) { - await handleChunk(chunk); - } - } - - accumulatedProgress = - (i / results.compute.length) * (1 - progressReservedForTagging); - yield { - progress: accumulatedProgress, - desc: `Chunking ${getBasename(item.path)}`, - status: "indexing", - }; - markComplete([item], IndexResultType.Compute); - } - - // Add tag - const addContents = await Promise.all( - results.addTag.map(({ path }) => this.readFile(path)), - ); - for (let i = 0; i < results.addTag.length; i++) { - const item = results.addTag[i]; - - // Insert chunks - if (contents.length) { - for await (const chunk of chunkDocument({ - filepath: item.path, - contents: contents[i], - maxChunkSize: this.maxChunkSize, - digest: item.cacheKey, - })) { - handleChunk(chunk); - } - } - - markComplete([item], IndexResultType.AddTag); - accumulatedProgress += 1 / results.addTag.length / 4; - yield { - progress: accumulatedProgress, - desc: `Chunking ${getBasename(item.path)}`, - status: "indexing", - }; - } - - // Remove tag - for (const item of results.removeTag) { - await db.run( - ` - DELETE FROM chunk_tags - WHERE tag = ? - AND chunkId IN ( - SELECT id FROM chunks - WHERE cacheKey = ? AND path = ? - ) - `, - [tagString, item.cacheKey, item.path], - ); - markComplete([item], IndexResultType.RemoveTag); - accumulatedProgress += 1 / results.removeTag.length / 4; - yield { - progress: accumulatedProgress, - desc: `Removing ${getBasename(item.path)}`, - status: "indexing", - }; - } - - // Delete - for (const item of results.del) { - const deleted = await db.run("DELETE FROM chunks WHERE cacheKey = ?", [ - item.cacheKey, - ]); - - // Delete from chunk_tags - await db.run("DELETE FROM chunk_tags WHERE chunkId = ?", [ - deleted.lastID, - ]); - - markComplete([item], IndexResultType.Delete); - accumulatedProgress += 1 / results.del.length / 4; - yield { - progress: accumulatedProgress, - desc: `Removing ${getBasename(item.path)}`, - status: "indexing", - }; - } + }); + const chunksSQL = + "INSERT INTO chunks (cacheKey, path, idx, startLine, endLine, content) VALUES (?, ?, ?, ?, ?, ?)"; + chunks.map((c) => { + db.db.run( + chunksSQL, + [c.digest, c.filepath, c.index, c.startLine, c.endLine, c.content], + (result: RunResult, err: Error) => { + if (err) { + reject( + new Error("error inserting into chunks table", { + cause: err, + }), + ); + } + }, + ); + const chunkTagsSQL = + "INSERT INTO chunk_tags (chunkId, tag) VALUES (last_insert_rowid(), ?)"; + db.db.run( + chunkTagsSQL, + [tagString], + (result: RunResult, err: Error) => { + if (err) { + reject( + new Error("error inserting into chunk_tags table", { + cause: err, + }), + ); + } + }, + ); + }); + db.db.exec("COMMIT", (err: Error | null) => { + if (err) { + reject( + new Error("error while committing insert chunks transaction", { + cause: err, + }), + ); + } else { + resolve(); + } + }); + }); + }); } } diff --git a/core/indexing/chunk/chunk.test.ts b/core/indexing/chunk/chunk.test.ts new file mode 100644 index 000000000..a9559ca27 --- /dev/null +++ b/core/indexing/chunk/chunk.test.ts @@ -0,0 +1,32 @@ +import path from "path"; +import { shouldChunk } from "./chunk"; + +describe("shouldChunk", () => { + test("should chunk a typescript file", () => { + const filePath = path.join("directory", "file.ts"); + const fileContent = generateString(10000); + expect(shouldChunk(path.sep, filePath, fileContent)).toBe(true); + }); + + test("should not chunk a large typescript file", () => { + const filePath = path.join("directory", "file.ts"); + const fileContent = generateString(1500000); + expect(shouldChunk(path.sep, filePath, fileContent)).toBe(false); + }); + + test("should not chunk an empty file", () => { + const filePath = path.join("directory", "file.ts"); + const fileContent = generateString(0); + expect(shouldChunk(path.sep, filePath, fileContent)).toBe(false); + }); + + test("should not chunk a file without extension", () => { + const filePath = path.join("directory", "with.dot", "filename"); + const fileContent = generateString(10000); + expect(shouldChunk(path.sep, filePath, fileContent)).toBe(false); + }); +}); + +function generateString(length: number) { + return "a".repeat(length); +} diff --git a/core/indexing/chunk/chunk.ts b/core/indexing/chunk/chunk.ts index 2bdf446a8..97665ab03 100644 --- a/core/indexing/chunk/chunk.ts +++ b/core/indexing/chunk/chunk.ts @@ -1,4 +1,4 @@ -import { Chunk, ChunkWithoutID } from "../../index.js"; +import { Chunk, ChunkWithoutID, IDE } from "../../index.js"; import { countTokens, countTokensAsync } from "../../llm/countTokens.js"; import { supportedLanguages } from "../../util/treeSitter.js"; import { basicChunker } from "./basic.js"; @@ -50,22 +50,24 @@ export async function* chunkDocument({ contents, maxChunkSize, )) { - chunkPromises.push(new Promise(async (resolve) => { - if (await countTokensAsync(chunkWithoutId.content) > maxChunkSize) { - console.warn( - `Chunk with more than ${maxChunkSize} tokens constructed: `, + chunkPromises.push( + new Promise(async (resolve) => { + if ((await countTokensAsync(chunkWithoutId.content)) > maxChunkSize) { + console.debug( + `Chunk with more than ${maxChunkSize} tokens constructed: `, + filepath, + countTokens(chunkWithoutId.content), + ); + return resolve(undefined); + } + resolve({ + ...chunkWithoutId, + digest, + index, filepath, - countTokens(chunkWithoutId.content), - ); - return resolve(undefined); - } - resolve({ - ...chunkWithoutId, - digest, - index, - filepath, - }); - })); + }); + }), + ); index++; } for await (const chunk of chunkPromises) { @@ -75,3 +77,16 @@ export async function* chunkDocument({ yield chunk; } } + +export function shouldChunk(pathSep: string, filepath: string, contents: string): boolean { + if (contents.length > 1000000) { + // if a file has more than 1m characters then skip it + return false; + } + if (contents.length === 0) { + return false; + } + const basename = filepath.split(pathSep).pop(); + // files without extensions are often binary files, skip it if so + return basename?.includes(".") ?? false; +} \ No newline at end of file diff --git a/core/test/indexing/chunk/code.test.ts b/core/indexing/chunk/code.test.ts similarity index 86% rename from core/test/indexing/chunk/code.test.ts rename to core/indexing/chunk/code.test.ts index a708b230b..c852ecafd 100644 --- a/core/test/indexing/chunk/code.test.ts +++ b/core/indexing/chunk/code.test.ts @@ -1,5 +1,5 @@ -import { ChunkWithoutID } from "../../.."; -import { codeChunker } from "../../../indexing/chunk/code"; +import { ChunkWithoutID } from "../.."; +import { codeChunker } from "./code"; async function genToArr(generator: AsyncGenerator): Promise { const result: T[] = []; @@ -29,7 +29,7 @@ describe.skip("codeChunker", () => { test("should capture small class and function from large python file", async () => { const extraLine = "# This is a comment"; const myClass = "class MyClass:\n def __init__(self):\n pass"; - const myFunction = 'def my_function():\n return "Hello, World!"'; + const myFunction = "def my_function():\n return \"Hello, World!\""; const file = Array(100).fill(extraLine).join("\n") + @@ -66,7 +66,7 @@ describe.skip("codeChunker", () => { chunks[0].startsWith("class MyClass:\n def method1():\n ..."), ).toBe(true); // The extra spaces seem to be a bug with tree-sitter-python - expect(chunks).toContain('def method1():\n return "Hello, 1!"'); - expect(chunks).toContain('def method20():\n return "Hello, 20!"'); + expect(chunks).toContain("def method1():\n return \"Hello, 1!\""); + expect(chunks).toContain("def method20():\n return \"Hello, 20!\""); }); }); diff --git a/core/indexing/chunk/code.ts b/core/indexing/chunk/code.ts index 724f43641..7e3fff2b3 100644 --- a/core/indexing/chunk/code.ts +++ b/core/indexing/chunk/code.ts @@ -1,6 +1,6 @@ import { SyntaxNode } from "web-tree-sitter"; import { ChunkWithoutID } from "../../index.js"; -import { countTokens, countTokensAsync } from "../../llm/countTokens.js"; +import { countTokensAsync } from "../../llm/countTokens.js"; import { getParserForFile } from "../../util/treeSitter.js"; function collapsedReplacement(node: SyntaxNode): string { @@ -163,6 +163,9 @@ const collapsedNodeConstructors: { function_definition: constructFunctionDefinitionChunk, function_declaration: constructFunctionDefinitionChunk, function_item: constructFunctionDefinitionChunk, + // Methods + method_declaration: constructFunctionDefinitionChunk, + // Properties }; async function maybeYieldChunk( @@ -199,14 +202,20 @@ async function* getSmartCollapsedChunks( // If a collapsed form is defined, use that if (node.type in collapsedNodeConstructors) { yield { - content: await collapsedNodeConstructors[node.type](node, code, maxChunkSize), + content: await collapsedNodeConstructors[node.type]( + node, + code, + maxChunkSize, + ), startLine: node.startPosition.row, endLine: node.endPosition.row, }; } // Recurse (because even if collapsed version was shown, want to show the children in full somewhere) - const generators = node.children.map((child) => getSmartCollapsedChunks(child, code, maxChunkSize, false)); + const generators = node.children.map((child) => + getSmartCollapsedChunks(child, code, maxChunkSize, false), + ); for (const generator of generators) { yield* generator; } @@ -223,7 +232,7 @@ export async function* codeChunker( const parser = await getParserForFile(filepath); if (parser === undefined) { - console.warn(`Failed to load parser for file ${filepath}: `); + console.debug(`Failed to load parser for file ${filepath}: `); return; } diff --git a/core/indexing/docs/DocsCrawler.test.ts b/core/indexing/docs/DocsCrawler.test.ts new file mode 100644 index 000000000..b3c4b2593 --- /dev/null +++ b/core/indexing/docs/DocsCrawler.test.ts @@ -0,0 +1,130 @@ +import DocsCrawler, { type PageData } from "./DocsCrawler"; +import preIndexedDocs from "./preIndexedDocs"; + +// Temporary workaround until we have better caching of Chromium +// download between test runs +const TIMEOUT = 1_000_000; + +// Skipped until we have a better way to cache Chromium installs +// between tests and in CI +describe.skip("crawl", () => { + describe("GitHub repositories", () => { + const repoUrl = + "https://github.com/Patrick-Erichsen/test-github-repo-for-crawling"; + + let crawlResults: PageData[]; + + beforeAll(async () => { + const docsCrawler = new DocsCrawler(new URL(repoUrl)); + + crawlResults = []; + + for await (const page of docsCrawler.crawl()) { + crawlResults.push(page); + } + }, TIMEOUT); + + test("finds expected markdown files", async () => { + expect(crawlResults.some((page) => page.path.endsWith("README.md"))).toBe( + true, + ); + + expect( + crawlResults.some((page) => page.path.endsWith("docs-depth-1.md")), + ).toBe(true); + }); + + test("html includes the correct content", async () => { + const doc = crawlResults.find((page) => + page.path.endsWith("docs-depth-1.md"), + ); + + expect(doc?.content.includes("Test body")).toBe(true); + expect(doc?.content.includes("Test H2 Header")).toBe(true); + }); + + test("ignores non-markdown files, e.g. `test.js` at the root", async () => { + expect(crawlResults.some((page) => page.path.endsWith("test.js"))).toBe( + false, + ); + }); + }); + + describe.only("Non-Github repository sites", () => { + it( + "succeeds in crawling a list of common sites", + async () => { + const TEST_SITES = [ + "https://docs.nestjs.com/", + "https://docs.nestjs.com/", + "https://go.dev/doc/", + "https://clickhouse.com/docs", + "https://www.tensorflow.org/api_docs", + "https://www.rust-lang.org/learn", + "https://docs.anthropic.com/en/docs", + ]; + + const NUM_PAGES_TO_CRAWL = 10; + + for (const site of TEST_SITES) { + const crawlResults: PageData[] = []; + const docsCrawler = new DocsCrawler( + new URL(site), + NUM_PAGES_TO_CRAWL, + ); + + for await (const page of docsCrawler.crawl()) { + crawlResults.push(page); + } + + // `toBeGreaterThanOrEqual` because Crawlee doesn't guarantee + // an exact number of pages to crawl since it runs in parallel + expect(crawlResults.length).toBeGreaterThanOrEqual( + NUM_PAGES_TO_CRAWL, + ); + } + }, + TIMEOUT, + ); + }); + + describe("Pre-indexed Docs", () => { + const results: { [url: string]: boolean } = {}; + let totalTests = 0; + let passedTests = 0; + + Object.keys(preIndexedDocs).forEach((url) => { + test( + `Crawl test for ${url}`, + async () => { + totalTests++; + let pageFound = false; + + try { + const docsCrawler = new DocsCrawler(new URL(url), 1); + + for await (const page of docsCrawler.crawl()) { + if (page.url === url) { + pageFound = true; + break; + } + } + } catch (error) { + console.error(`Error crawling ${url}:`, error); + } + + results[url] = pageFound; + if (pageFound) { + passedTests++; + console.log(`✅ ${url}`); + } else { + console.log(`❌ ${url}`); + } + + expect(pageFound).toBe(true); + }, + TIMEOUT, + ); + }); + }); +}); diff --git a/core/indexing/docs/DocsCrawler.ts b/core/indexing/docs/DocsCrawler.ts new file mode 100644 index 000000000..afd3ea440 --- /dev/null +++ b/core/indexing/docs/DocsCrawler.ts @@ -0,0 +1,248 @@ +import { Octokit } from "@octokit/rest"; +import * as fs from "fs"; +import { URL } from "node:url"; +import { Page } from "puppeteer"; +import { getChromiumPath, getContinueUtilsPath } from "../../util/paths"; +// @ts-ignore +// @prettier-ignore +import PCR from "puppeteer-chromium-resolver"; + +export type PageData = { + url: string; + path: string; + content: string; +}; + +export default class DocsCrawler { + LINK_GROUP_SIZE = 2; // Controls parallelization of crawler + GITHUB_HOST = "github.com"; + static MAX_REQUESTS_PER_CRAWL = 1000; + markdownRegex = new RegExp(/\.(md|mdx)$/); + octokit = new Octokit({ + auth: undefined, + }); + + static PCR_CONFIG = { + downloadPath: getContinueUtilsPath(), + }; + + constructor( + private readonly startUrl: URL, + private readonly maxRequestsPerCrawl: number = DocsCrawler.MAX_REQUESTS_PER_CRAWL, + ) {} + + static verifyOrInstallChromium() { + if (!fs.existsSync(getChromiumPath())) { + PCR(DocsCrawler.PCR_CONFIG); + } + } + + async *crawl(): AsyncGenerator { + if (this.startUrl.host === this.GITHUB_HOST) { + yield* this.crawlGithubRepo(); + } else { + yield* this.crawlSite(); + } + } + + private async getGithubRepoDefaultBranch( + owner: string, + repo: string, + ): Promise { + const repoInfo = await this.octokit.repos.get({ + owner, + repo, + }); + + return repoInfo.data.default_branch; + } + + private async getGitHubRepoPaths( + owner: string, + repo: string, + branch: string, + ) { + const tree = await this.octokit.request( + "GET /repos/{owner}/{repo}/git/trees/{tree_sha}", + { + owner, + repo, + tree_sha: branch, + headers: { + "X-GitHub-Api-Version": "2022-11-28", + }, + recursive: "true", + }, + ); + + const paths = tree.data.tree + .filter( + (file: any) => + file.type === "blob" && this.markdownRegex.test(file.path ?? ""), + ) + .map((file: any) => file.path); + + return paths; + } + + private async getGithubRepoFileContent( + path: string, + owner: string, + repo: string, + ) { + try { + const response = await this.octokit.repos.getContent({ + owner, + repo, + path, + headers: { + Accept: "application/vnd.github.raw+json", + }, + }); + + return response.data as unknown as string; + } catch (error) { + console.debug("Error fetching file contents:", error); + return null; + } + } + + private async *crawlGithubRepo() { + console.debug(`Crawling GitHub repo: ${this.startUrl.toString()}`); + + const urlStr = this.startUrl.toString(); + const [_, owner, repo] = this.startUrl.pathname.split("/"); + const branch = await this.getGithubRepoDefaultBranch(owner, repo); + const paths = await this.getGitHubRepoPaths(owner, repo, branch); + + for await (const path of paths) { + const content = await this.getGithubRepoFileContent(path, owner, repo); + + yield { + path, + url: urlStr, + content: content ?? "", + }; + } + } + + private stripHashFromUrl(urlStr: string) { + try { + let url = new URL(urlStr); + url.hash = ""; + return url; + } catch (err) { + return null; + } + } + + private isValidHostAndPath(newUrl: URL, curUrl: URL) { + return ( + newUrl.pathname.startsWith(curUrl.pathname) && newUrl.host === curUrl.host + ); + } + + private async getLinksFromPage(page: Page, curUrl: URL) { + const links = await page.$$eval("a", (links) => links.map((a) => a.href)); + + // This additional step is due to issues getting the URL module to work + // in an $$eval command + const cleanedLinks = links + .map(this.stripHashFromUrl) + .filter( + (newUrl) => + newUrl !== null && + this.isValidHostAndPath(newUrl, curUrl) && + newUrl !== curUrl, + ) + .map((newUrl) => (newUrl as URL).href); + + const dedupedLinks = Array.from(new Set(cleanedLinks)); + + return dedupedLinks; + } + + private async getLinkGroupsFromPage(page: Page, curUrl: URL) { + const links = await this.getLinksFromPage(page, curUrl); + + const groups = links.reduce((acc, link, i) => { + const groupIndex = Math.floor(i / this.LINK_GROUP_SIZE); + + if (!acc[groupIndex]) { + acc.push([]); + } + + acc[groupIndex].push(link); + + return acc; + }, [] as string[][]); + + return groups; + } + + private async *crawlSitePages( + page: Page, + curUrl: URL, + visitedLinks: Set = new Set(), + curRequestCount: number = 0, + ): AsyncGenerator { + if (curRequestCount >= this.maxRequestsPerCrawl) { + console.warn("Max requests per crawl reached. Stopping crawler."); + return; + } + + if (visitedLinks.has(curUrl.toString())) { + return; + } + + console.debug(`Crawling page: ${curUrl.toString()}`); + + await page.goto(curUrl.toString()); + + const htmlContent = await page.content(); + const linkGroups = await this.getLinkGroupsFromPage(page, curUrl); + const requestCount = curRequestCount + 1; + + visitedLinks.add(curUrl.toString()); + + yield { + path: curUrl.pathname, + url: curUrl.toString(), + content: htmlContent, + }; + + for (const linkGroup of linkGroups) { + for (const link of linkGroup) { + yield* this.crawlSitePages( + page, + new URL(link), + visitedLinks, + requestCount, + ); + } + } + } + + private async *crawlSite(): AsyncGenerator { + console.debug(`Crawling site repo: ${this.startUrl}`); + + const stats = await PCR(DocsCrawler.PCR_CONFIG); + + const browser = await stats.puppeteer.launch({ + args: [ + "--user-agent=Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.150 Safari/537.36", + ], + executablePath: stats.executablePath, + }); + + const page = await browser.newPage(); + + try { + yield* this.crawlSitePages(page, this.startUrl); + } catch (e) { + console.debug("Error getting links: ", e); + } finally { + await browser.close(); + } + } +} diff --git a/core/indexing/docs/DocsService.test.ts b/core/indexing/docs/DocsService.test.ts new file mode 100644 index 000000000..f1fb6295b --- /dev/null +++ b/core/indexing/docs/DocsService.test.ts @@ -0,0 +1,168 @@ +/** + * @jest-environment jsdom + */ +import { ConfigHandler } from "../../config/ConfigHandler.js"; +import { ControlPlaneClient } from "../../control-plane/client.js"; +import { SiteIndexingConfig } from "../../index.js"; +import DocsService from "./DocsService.js"; +import preIndexedDocs from "./preIndexedDocs.js"; +import FreeTrialEmbeddingsProvider from "../embeddings/FreeTrialEmbeddingsProvider.js"; +import FileSystemIde from "../../util/filesystem.js"; +import { editConfigJson } from "../../util/paths.js"; + +describe.skip("DocsService Integration Tests", () => { + let ide: FileSystemIde; + let configHandler: ConfigHandler; + let docsService: DocsService; + + const mockSiteConfig: SiteIndexingConfig = { + startUrl: "https://amplified.dev/", + title: "Test repo", + faviconUrl: "https://github.com/favicon.ico", + }; + + /** + * We need to reload config explicitly to handle the scenario where the + * config file update listeners are not called before we attempt to + * use the new config + */ + async function getReloadedConfig() { + await configHandler.reloadConfig(); + const latestConfig = await configHandler.loadConfig(); + + return latestConfig; + } + + beforeEach(async () => { + ide = new FileSystemIde(process.cwd()); + + configHandler = new ConfigHandler( + ide, + Promise.resolve({ + remoteConfigSyncPeriod: 60, + userToken: "", + enableControlServerBeta: false, + pauseCodebaseIndexOnStart: false, + ideSettings: {} as any, + enableDebugLogs: false, + remoteConfigServerUrl: "", + }), + async () => {}, + new ControlPlaneClient( + Promise.resolve({ + accessToken: "", + account: { + id: "", + label: "", + }, + }), + ), + ); + + docsService = DocsService.createSingleton(configHandler, ide); + + await docsService.isInitialized; + }); + + test("Indexing, retrieval, and deletion of a new documentation site", async () => { + const generator = docsService.indexAndAdd(mockSiteConfig); + while (!(await generator.next()).done) {} + + let latestConfig = await getReloadedConfig(); + + // Sqlite check + expect(await docsService.has(mockSiteConfig.startUrl)).toBe(true); + + // config.json check + expect(latestConfig.docs).toContainEqual(mockSiteConfig); + + // Lance DB check + const embeddingsProvider = await docsService.getEmbeddingsProvider(); + const [mockVector] = await embeddingsProvider.embed(["test"]); + let retrievedChunks = await docsService.retrieveChunks( + mockSiteConfig.startUrl, + mockVector, + 5, + ); + + expect(retrievedChunks.length).toBeGreaterThan(0); + + await docsService.delete(mockSiteConfig.startUrl); + + // Sqlite check + expect(await docsService.has(mockSiteConfig.startUrl)).toBe(false); + + // config.json check + latestConfig = await getReloadedConfig(); + expect(latestConfig.docs).not.toContainEqual( + expect.objectContaining(mockSiteConfig), + ); + + // LanceDB check + retrievedChunks = await docsService.retrieveChunks( + mockSiteConfig.startUrl, + mockVector, + 5, + ); + expect(retrievedChunks.length).toBe(0); + }); + + test("Reindexes when changing embeddings provider", async () => { + const originalEmbeddingsProvider = + await docsService.getEmbeddingsProvider(); + + // Change embeddings provider + editConfigJson((config) => ({ + ...config, + embeddingsProvider: { + provider: FreeTrialEmbeddingsProvider.providerName, + }, + })); + + await getReloadedConfig(); + + const newEmbeddingsProvider = await docsService.getEmbeddingsProvider(); + + // Verify reindexing + const [originalVector] = await originalEmbeddingsProvider.embed(["test"]); + const [newMockVector] = await newEmbeddingsProvider.embed(["test"]); + + expect(originalVector).not.toEqual(newMockVector); + }); + + test("Handles pulling down and adding pre-indexed docs", async () => { + const preIndexedDoc = Object.values(preIndexedDocs)[0]; + const generator = docsService.indexAndAdd(preIndexedDoc); + while (!(await generator.next()).done) {} + }); + + test("Config synchronization with SQLite", async () => { + const generator = docsService.indexAndAdd(mockSiteConfig); + while (!(await generator.next()).done) {} + + await getReloadedConfig(); + + expect(await docsService.has(mockSiteConfig.startUrl)).toBe(true); + + editConfigJson((config) => { + const { docs, ...restConfig } = config; + return restConfig; + }); + + await getReloadedConfig(); + + const startTime = Date.now(); + const maxWaitTimeMs = 10_000; + + while (docsService.isSyncing) { + if (Date.now() - startTime > maxWaitTimeMs) { + throw new Error( + `Timeout: docsService.isSyncing did not complete within within ${maxWaitTimeMs}ms`, + ); + } + await new Promise((resolve) => setTimeout(resolve, 100)); + } + + expect(await docsService.has(mockSiteConfig.startUrl)).toBe(false); + }); +}); diff --git a/core/indexing/docs/DocsService.ts b/core/indexing/docs/DocsService.ts index 8d2854b9e..9b5c593e8 100644 --- a/core/indexing/docs/DocsService.ts +++ b/core/indexing/docs/DocsService.ts @@ -1,23 +1,41 @@ import { open, type Database } from "sqlite"; import sqlite3 from "sqlite3"; +import lancedb, { Connection } from "vectordb"; +import { ConfigHandler } from "../../config/ConfigHandler"; +import DocsContextProvider from "../../context/providers/DocsContextProvider"; import { Chunk, + ContinueConfig, EmbeddingsProvider, - IdeInfo, + IDE, IndexingProgressUpdate, SiteIndexingConfig, -} from "../../index.js"; -import { getDocsSqlitePath, getLanceDbPath } from "../../util/paths.js"; -import { Article, chunkArticle, pageToArticle } from "./article.js"; -import { crawlPage } from "./crawl.js"; -import { downloadFromS3, SiteIndexingResults } from "./preIndexed.js"; -import preIndexedDocs from "./preIndexedDocs.js"; -import TransformersJsEmbeddingsProvider from "../embeddings/TransformersJsEmbeddingsProvider.js"; +} from "../.."; +import { FromCoreProtocol, ToCoreProtocol } from "../../protocol"; +import { GlobalContext } from "../../util/GlobalContext"; +import { IMessenger } from "../../util/messenger"; +import { + editConfigJson, + getDocsSqlitePath, + getLanceDbPath, +} from "../../util/paths"; +import { Telemetry } from "../../util/posthog"; +import TransformersJsEmbeddingsProvider from "../embeddings/TransformersJsEmbeddingsProvider"; +import { Article, chunkArticle, pageToArticle } from "./article"; +import DocsCrawler from "./DocsCrawler"; +import { runLanceMigrations, runSqliteMigrations } from "./migrations"; +import { + downloadFromS3, + getS3Filename, + S3Buckets, + SiteIndexingResults, +} from "./preIndexed"; +import preIndexedDocs from "./preIndexedDocs"; // Purposefully lowercase because lancedb converts -interface LanceDbDocsRow { +export interface LanceDbDocsRow { title: string; - baseurl: string; + starturl: string; // Chunk content: string; path: string; @@ -27,200 +45,142 @@ interface LanceDbDocsRow { [key: string]: any; } -export class DocsService { - private static instance: DocsService; - private static DOCS_TABLE_NAME = "docs"; - public static preIndexedDocsEmbeddingsProvider = - new TransformersJsEmbeddingsProvider(); - private _sqliteTable: Database | undefined; - private docsIndexingQueue: Set = new Set(); +export interface SqliteDocsRow { + title: string; + startUrl: string; + favicon: string; +} - public static getInstance(): DocsService { - if (!DocsService.instance) { - DocsService.instance = new DocsService(); - } +export type AddParams = { + siteIndexingConfig: SiteIndexingConfig; + chunks: Chunk[]; + embeddings: number[][]; + favicon?: string; +}; + +export default class DocsService { + static lanceTableName = "docs"; + static sqlitebTableName = "docs"; + static preIndexedDocsEmbeddingsProvider = + new TransformersJsEmbeddingsProvider(); + + private static instance?: DocsService; + public isInitialized: Promise; + public isSyncing: boolean = false; + + private docsIndexingQueue = new Set(); + private globalContext = new GlobalContext(); + private lanceTableNamesSet = new Set(); + + private config!: ContinueConfig; + private sqliteDb?: Database; + + // If we are instantiating a new DocsService from `getContextItems()`, + // we have access to the direct config object. + // When instantiating the DocsService from core, we have access + // to a ConfigHandler instance. + constructor( + configOrHandler: ConfigHandler, + private readonly ide: IDE, + private readonly messenger?: IMessenger, + ) { + this.isInitialized = this.init(configOrHandler); + } + + static getSingleton() { return DocsService.instance; } - private async getSqliteTable() { - if (!this._sqliteTable) { - this._sqliteTable = await open({ - filename: getDocsSqlitePath(), - driver: sqlite3.Database, - }); - - this._sqliteTable.exec(`CREATE TABLE IF NOT EXISTS docs ( - id INTEGER PRIMARY KEY AUTOINCREMENT, - title STRING NOT NULL, - baseUrl STRING NOT NULL UNIQUE - )`); - } - - return this._sqliteTable; - } - - private async getLanceDb() { - const lancedb = await import("vectordb"); - const lance = await lancedb.connect(getLanceDbPath()); - return lance; - } - - async retrieve( - baseUrl: string, - vector: number[], - nRetrieve: number, - embeddingsProviderId: string, - nested = false, - ): Promise { - const lance = await this.getLanceDb(); - const tableNames = await lance.tableNames(); - const preIndexedDoc = preIndexedDocs[baseUrl]; - const isPreIndexedDoc = !!preIndexedDoc; - let shouldDownloadPreIndexedDoc = - !tableNames.includes(DocsService.DOCS_TABLE_NAME) && isPreIndexedDoc; - - const downloadAndRetrievePreIndexedDoc = async ( - preIndexedDoc: SiteIndexingConfig, - ) => { - await this.downloadAndAddPreIndexedDocs( - embeddingsProviderId, - preIndexedDoc.title, - ); - - return await this.retrieve( - baseUrl, - vector, - nRetrieve, - embeddingsProviderId, - true, - ); - }; - - if (shouldDownloadPreIndexedDoc) { - return await downloadAndRetrievePreIndexedDoc(preIndexedDoc!); - } - - const table = await lance.openTable(DocsService.DOCS_TABLE_NAME); - - let docs: LanceDbDocsRow[] = await table - .search(vector) - .limit(nRetrieve) - .where(`baseurl = '${baseUrl}'`) - .execute(); - - docs = docs.filter((doc) => doc.baseurl === baseUrl); - - shouldDownloadPreIndexedDoc = - (!docs || docs.length === 0) && !nested && isPreIndexedDoc; - - if (shouldDownloadPreIndexedDoc) { - return await downloadAndRetrievePreIndexedDoc(preIndexedDoc!); - } - - return docs.map((doc) => ({ - digest: doc.path, - filepath: doc.path, - startLine: doc.startline, - endLine: doc.endline, - index: 0, - content: doc.content, - otherMetadata: { - title: doc.title, - }, - })); - } - - private async add( - title: string, - baseUrl: URL, - chunks: Chunk[], - embeddings: number[][], + static createSingleton( + configOrHandler: ConfigHandler, + ide: IDE, + messenger?: IMessenger, ) { - const data: LanceDbDocsRow[] = chunks.map((chunk, i) => ({ - title: chunk.otherMetadata?.title || title, - baseurl: baseUrl.toString(), - content: chunk.content, - path: chunk.filepath, - startline: chunk.startLine, - endline: chunk.endLine, - vector: embeddings[i], - })); - - const lance = await this.getLanceDb(); - const tableNames = await lance.tableNames(); - if (!tableNames.includes(DocsService.DOCS_TABLE_NAME)) { - await lance.createTable(DocsService.DOCS_TABLE_NAME, data); - } else { - const table = await lance.openTable(DocsService.DOCS_TABLE_NAME); - await table.add(data); - } - - // Only after add it to SQLite - const db = await this.getSqliteTable(); - await db.run( - "INSERT INTO docs (title, baseUrl) VALUES (?, ?)", - title, - baseUrl.toString(), - ); + const docsService = new DocsService(configOrHandler, ide, messenger); + DocsService.instance = docsService; + return docsService; } - async list(): Promise<{ title: string; baseUrl: string }[]> { - const db = await this.getSqliteTable(); - const docs = db.all("SELECT title, baseUrl FROM docs"); + async isJetBrainsAndPreIndexedDocsProvider(): Promise { + const isJetBrains = await this.isJetBrains(); + + const isPreIndexedDocsProvider = + this.config.embeddingsProvider.id === + DocsService.preIndexedDocsEmbeddingsProvider.id; + + return isJetBrains && isPreIndexedDocsProvider; + } + + /* + * Currently, we generate and host embeddings for pre-indexed docs using transformers. + * However, we don't ship transformers with the JetBrains extension. + * So, we only include pre-indexed docs in the submenu for non-JetBrains IDEs. + */ + async canUsePreindexedDocs() { + const isJetBrains = await this.isJetBrains(); + return !isJetBrains; + } + + async delete(startUrl: string) { + await this.deleteFromLance(startUrl); + await this.deleteFromSqlite(startUrl); + this.deleteFromConfig(startUrl); + + if (this.messenger) { + this.messenger.send("refreshSubmenuItems", undefined); + } + } + + async has(startUrl: string): Promise> { + const db = await this.getOrCreateSqliteDb(); + const title = await db.get( + `SELECT title FROM ${DocsService.sqlitebTableName} WHERE startUrl = ?`, + startUrl, + ); + + return !!title; + } + + async indexAllDocs(reIndex: boolean = false) { + if (!this.hasDocsContextProvider()) { + this.ide.infoPopup( + "No 'docs' provider configured under 'contextProviders' in config.json", + ); + return; + } + + const docs = await this.list(); + + for (const doc of docs) { + const generator = this.indexAndAdd(doc, reIndex); + while (!(await generator.next()).done) {} + } + + this.ide.infoPopup("Docs indexing completed"); + } + + async list() { + const db = await this.getOrCreateSqliteDb(); + const docs = await db.all( + `SELECT title, startUrl, favicon FROM ${DocsService.sqlitebTableName}`, + ); + return docs; } - async delete(baseUrl: string) { - const db = await this.getSqliteTable(); - await db.run("DELETE FROM docs WHERE baseUrl = ?", baseUrl); - const lance = await this.getLanceDb(); - const tableNames = await lance.tableNames(); - if (tableNames.includes(DocsService.DOCS_TABLE_NAME)) { - const table = await lance.openTable(DocsService.DOCS_TABLE_NAME); - await table.delete(`baseurl = '${baseUrl}'`); - } - } - - async has(baseUrl: string) { - const db = await this.getSqliteTable(); - const doc = await db.get( - "SELECT title FROM docs WHERE baseUrl =?", - baseUrl, - ); - return !!doc; - } - - private async downloadAndAddPreIndexedDocs( - embeddingsProviderId: string, - title: string, - ) { - const data = await downloadFromS3( - "continue-indexed-docs", - `${embeddingsProviderId}/${title}`, - "us-west-1", - ); - const results = JSON.parse(data) as SiteIndexingResults; - await this.add( - results.title, - new URL(results.url), - results.chunks, - results.chunks.map((c) => c.embedding), - ); - } - async *indexAndAdd( siteIndexingConfig: SiteIndexingConfig, - embeddingsProvider: EmbeddingsProvider, reIndex: boolean = false, ): AsyncGenerator { - const startUrl = new URL(siteIndexingConfig.startUrl.toString()); + const { startUrl } = siteIndexingConfig; + const embeddingsProvider = await this.getEmbeddingsProvider(); - if (this.docsIndexingQueue.has(startUrl.toString())) { + if (this.docsIndexingQueue.has(startUrl)) { console.log("Already in queue"); return; } - if (!reIndex && (await this.has(startUrl.toString()))) { + if (!reIndex && (await this.has(startUrl))) { yield { progress: 1, desc: "Already indexed", @@ -230,7 +190,7 @@ export class DocsService { } // Mark the site as currently being indexed - this.docsIndexingQueue.add(startUrl.toString()); + this.docsIndexingQueue.add(startUrl); yield { progress: 0, @@ -242,13 +202,18 @@ export class DocsService { let processedPages = 0; let maxKnownPages = 1; + const docsCrawler = new DocsCrawler(new URL(startUrl)); + // Crawl pages and retrieve info as articles - for await (const page of crawlPage(startUrl, siteIndexingConfig.maxDepth)) { + for await (const page of docsCrawler.crawl()) { processedPages++; + const article = pageToArticle(page); + if (!article) { continue; } + articles.push(article); // Use a heuristic approach for progress calculation @@ -281,14 +246,19 @@ export class DocsService { }; try { - const subpathEmbeddings = await embeddingsProvider.embed( - chunkArticle(article, embeddingsProvider.maxChunkSize).map( - (chunk) => { - chunks.push(chunk); + const chunkedArticle = chunkArticle( + article, + embeddingsProvider.maxChunkSize, + ); - return chunk.content; - }, - ), + const chunkedArticleContents = chunkedArticle.map( + (chunk) => chunk.content, + ); + + chunks.push(...chunkedArticle); + + const subpathEmbeddings = await embeddingsProvider.embed( + chunkedArticleContents, ); embeddings.push(...subpathEmbeddings); @@ -297,38 +267,532 @@ export class DocsService { } } + if (embeddings.length === 0) { + console.error( + `No embeddings were created for site: ${siteIndexingConfig.startUrl}\n Num chunks: ${chunks.length}`, + ); + + yield { + progress: 1, + desc: `No embeddings were created for site: ${siteIndexingConfig.startUrl}`, + status: "failed", + }; + + this.docsIndexingQueue.delete(startUrl); + + return; + } + // Add docs to databases - console.log("Adding ", embeddings.length, " embeddings to db"); + console.log(`Adding ${embeddings.length} embeddings to db`); + yield { progress: 0.5, desc: `Adding ${embeddings.length} embeddings to db`, status: "indexing", }; - // Clear old index if re-indexing. - if (reIndex) { + // Delete indexed docs if re-indexing + if (reIndex && (await this.has(startUrl.toString()))) { console.log("Deleting old embeddings"); - await this.delete(startUrl.toString()); + await this.delete(startUrl); } - await this.add(siteIndexingConfig.title, startUrl, chunks, embeddings); - this.docsIndexingQueue.delete(startUrl.toString()); + const favicon = await this.fetchFavicon(siteIndexingConfig); + + await this.add({ + siteIndexingConfig, + chunks, + embeddings, + favicon, + }); + + this.docsIndexingQueue.delete(startUrl); yield { progress: 1, desc: "Done", status: "done", }; + + console.log(`Successfully indexed: ${siteIndexingConfig.startUrl}`); + + if (this.messenger) { + this.messenger.send("refreshSubmenuItems", undefined); + } } - public isJetBrainsAndPreIndexedDocsProvider( - ideInfo: IdeInfo, - embeddingsProviderId: EmbeddingsProvider["id"], - ): boolean { - const isJetBrains = ideInfo.ideType === "jetbrains"; - const isPreIndexedDocsProvider = - embeddingsProviderId === DocsService.preIndexedDocsEmbeddingsProvider.id; + async retrieveChunks( + startUrl: string, + vector: number[], + nRetrieve: number, + isRetry: boolean = false, + ): Promise { + const table = await this.getOrCreateLanceTable({ + initializationVector: vector, + isPreIndexedDoc: !!preIndexedDocs[startUrl], + }); - return isJetBrains && isPreIndexedDocsProvider; + const docs: LanceDbDocsRow[] = await table + .search(vector) + .limit(nRetrieve) + .where(`starturl = '${startUrl}'`) + .execute(); + + const hasIndexedDoc = await this.hasIndexedDoc(startUrl); + + if (!hasIndexedDoc && docs.length === 0) { + const preIndexedDoc = preIndexedDocs[startUrl]; + + if (isRetry || !preIndexedDoc) { + return []; + } + + await this.fetchAndAddPreIndexedDocEmbeddings(preIndexedDoc.title); + return await this.retrieveChunks(startUrl, vector, nRetrieve, true); + } + + return docs.map((doc) => ({ + digest: doc.path, + filepath: doc.path, + startLine: doc.startline, + endLine: doc.endline, + index: 0, + content: doc.content, + otherMetadata: { + title: doc.title, + }, + })); + } + + async getEmbeddingsProvider(isPreIndexedDoc: boolean = false) { + const canUsePreindexedDocs = await this.canUsePreindexedDocs(); + + if (isPreIndexedDoc && canUsePreindexedDocs) { + return DocsService.preIndexedDocsEmbeddingsProvider; + } + + return this.config.embeddingsProvider; + } + + async getFavicon(startUrl: string) { + const db = await this.getOrCreateSqliteDb(); + const { favicon } = await db.get( + `SELECT favicon FROM ${DocsService.sqlitebTableName} WHERE startUrl = ?`, + startUrl, + ); + + return favicon; + } + + /** + * A ConfigHandler is passed to the DocsService in `core` when + * we don't yet have access to the config object. This handler + * is used to set up a single instance of the DocsService that + * subscribes to config updates, e.g. to trigger re-indexing + * on a new embeddings provider. + */ + private async init(configHandler: ConfigHandler) { + if (configHandler instanceof ConfigHandler) { + this.config = await configHandler.loadConfig(); + } else { + this.config = configHandler; + } + + const embeddingsProvider = await this.getEmbeddingsProvider(); + + this.globalContext.update("curEmbeddingsProviderId", embeddingsProvider.id); + + configHandler.onConfigUpdate(async (newConfig) => { + const oldConfig = this.config; + + // Need to update class property for config at the beginning of this callback + // to ensure downstream methods have access to the latest config. + this.config = newConfig; + + if (oldConfig.docs !== newConfig.docs) { + await this.syncConfigAndSqlite(); + } + + const shouldReindex = await this.shouldReindexDocsOnNewEmbeddingsProvider( + newConfig.embeddingsProvider.id, + ); + + if (shouldReindex) { + await this.reindexDocsOnNewEmbeddingsProvider( + newConfig.embeddingsProvider, + ); + } + }); + } + + private async syncConfigAndSqlite() { + this.isSyncing = true; + + const sqliteDocs = await this.list(); + const sqliteDocStartUrls = sqliteDocs.map((doc) => doc.startUrl) || []; + + const configDocs = this.config.docs || []; + const configDocStartUrls = + this.config.docs?.map((doc) => doc.startUrl) || []; + + const newDocs = configDocs.filter( + (doc) => !sqliteDocStartUrls.includes(doc.startUrl), + ); + const deletedDocs = sqliteDocs.filter( + (doc) => + !configDocStartUrls.includes(doc.startUrl) && + !preIndexedDocs[doc.startUrl], + ); + + for (const doc of newDocs) { + console.log(`Indexing new doc: ${doc.startUrl}`); + Telemetry.capture("add_docs_config", { url: doc.startUrl }); + + const generator = this.indexAndAdd(doc); + while (!(await generator.next()).done) {} + } + + for (const doc of deletedDocs) { + console.log(`Deleting doc: ${doc.startUrl}`); + await this.delete(doc.startUrl); + } + + this.isSyncing = false; + } + + private hasDocsContextProvider() { + return !!this.config.contextProviders?.some( + (provider) => + provider.description.title === DocsContextProvider.description.title, + ); + } + + private async getOrCreateSqliteDb() { + if (!this.sqliteDb) { + const db = await open({ + filename: getDocsSqlitePath(), + driver: sqlite3.Database, + }); + + await runSqliteMigrations(db); + + await db.exec(`CREATE TABLE IF NOT EXISTS ${DocsService.sqlitebTableName} ( + id INTEGER PRIMARY KEY AUTOINCREMENT, + title STRING NOT NULL, + startUrl STRING NOT NULL UNIQUE, + favicon STRING + )`); + + this.sqliteDb = db; + } + + return this.sqliteDb; + } + + private async createLanceDocsTable( + connection: Connection, + initializationVector: number[], + tableName: string, + ) { + const mockRowTitle = "mockRowTitle"; + const mockRow: LanceDbDocsRow[] = [ + { + title: mockRowTitle, + vector: initializationVector, + starturl: "", + content: "", + path: "", + startline: 0, + endline: 0, + }, + ]; + + const table = await connection.createTable(tableName, mockRow); + + await runLanceMigrations(table); + + await table.delete(`title = '${mockRowTitle}'`); + } + + private removeInvalidLanceTableNameChars(tableName: string) { + return tableName.replace(/:/g, ""); + } + + private async getLanceTableNameFromEmbeddingsProvider( + isPreIndexedDoc: boolean, + ) { + const embeddingsProvider = await this.getEmbeddingsProvider( + isPreIndexedDoc, + ); + const embeddingsProviderId = this.removeInvalidLanceTableNameChars( + embeddingsProvider.id, + ); + const tableName = `${DocsService.lanceTableName}${embeddingsProviderId}`; + + return tableName; + } + + private async getOrCreateLanceTable({ + initializationVector, + isPreIndexedDoc, + }: { + initializationVector: number[]; + isPreIndexedDoc?: boolean; + }) { + const conn = await lancedb.connect(getLanceDbPath()); + const tableNames = await conn.tableNames(); + const tableNameFromEmbeddingsProvider = + await this.getLanceTableNameFromEmbeddingsProvider(!!isPreIndexedDoc); + + if (!tableNames.includes(tableNameFromEmbeddingsProvider)) { + if (initializationVector) { + await this.createLanceDocsTable( + conn, + initializationVector, + tableNameFromEmbeddingsProvider, + ); + } else { + console.trace( + "No existing Lance DB docs table was found and no initialization " + + "vector was passed to create one", + ); + } + } + + const table = await conn.openTable(tableNameFromEmbeddingsProvider); + + this.lanceTableNamesSet.add(tableNameFromEmbeddingsProvider); + + return table; + } + + private async isJetBrains() { + const ideInfo = await this.ide.getIdeInfo(); + return ideInfo.ideType === "jetbrains"; + } + + private async hasIndexedDoc(startUrl: string) { + const db = await this.getOrCreateSqliteDb(); + const docs = await db.all( + `SELECT startUrl FROM ${DocsService.sqlitebTableName} WHERE startUrl = ?`, + startUrl, + ); + + return docs.length > 0; + } + + private async addToLance({ + chunks, + siteIndexingConfig, + embeddings, + }: AddParams) { + const sampleVector = embeddings[0]; + const isPreIndexedDoc = !!preIndexedDocs[siteIndexingConfig.startUrl]; + const table = await this.getOrCreateLanceTable({ + isPreIndexedDoc, + initializationVector: sampleVector, + }); + + const rows: LanceDbDocsRow[] = chunks.map((chunk, i) => ({ + vector: embeddings[i], + starturl: siteIndexingConfig.startUrl, + title: chunk.otherMetadata?.title || siteIndexingConfig.title, + content: chunk.content, + path: chunk.filepath, + startline: chunk.startLine, + endline: chunk.endLine, + })); + + await table.add(rows); + } + + private async addToSqlite({ + siteIndexingConfig: { title, startUrl }, + favicon, + }: AddParams) { + const db = await this.getOrCreateSqliteDb(); + await db.run( + `INSERT INTO ${DocsService.sqlitebTableName} (title, startUrl, favicon) VALUES (?, ?, ?)`, + title, + startUrl, + favicon, + ); + } + + private addToConfig({ siteIndexingConfig }: AddParams) { + // Handles the case where a user has manually added the doc to config.json + // so it already exists in the file + const doesDocExist = this.config.docs?.some( + (doc) => doc.startUrl === siteIndexingConfig.startUrl, + ); + + if (!doesDocExist) { + editConfigJson((config) => ({ + ...config, + docs: [...(config.docs ?? []), siteIndexingConfig], + })); + } + } + + private async add(params: AddParams) { + await this.addToLance(params); + await this.addToSqlite(params); + + const isPreIndexedDoc = + !!preIndexedDocs[params.siteIndexingConfig.startUrl]; + + if (!isPreIndexedDoc) { + this.addToConfig(params); + } + } + + private async deleteFromLance(startUrl: string) { + for (const tableName of this.lanceTableNamesSet) { + const conn = await lancedb.connect(getLanceDbPath()); + const table = await conn.openTable(tableName); + await table.delete(`starturl = '${startUrl}'`); + } + } + + private async deleteFromSqlite(startUrl: string) { + const db = await this.getOrCreateSqliteDb(); + await db.run( + `DELETE FROM ${DocsService.sqlitebTableName} WHERE startUrl = ?`, + startUrl, + ); + } + + deleteFromConfig(startUrl: string) { + editConfigJson((config) => ({ + ...config, + docs: config.docs?.filter((doc) => doc.startUrl !== startUrl) || [], + })); + } + + private async fetchAndAddPreIndexedDocEmbeddings(title: string) { + const embeddingsProvider = await this.getEmbeddingsProvider(true); + + const data = await downloadFromS3( + S3Buckets.continueIndexedDocs, + getS3Filename(embeddingsProvider.id, title), + ); + + const siteEmbeddings = JSON.parse(data) as SiteIndexingResults; + const startUrl = new URL(siteEmbeddings.url).toString(); + const favicon = await this.fetchFavicon(preIndexedDocs[startUrl]); + + await this.add({ + favicon, + siteIndexingConfig: { + startUrl, + title: siteEmbeddings.title, + }, + chunks: siteEmbeddings.chunks, + embeddings: siteEmbeddings.chunks.map((c) => c.embedding), + }); + } + + private async fetchFavicon(siteIndexingConfig: SiteIndexingConfig) { + const faviconUrl = + siteIndexingConfig.faviconUrl ?? + new URL("/favicon.ico", siteIndexingConfig.startUrl); + + try { + const response = await fetch(faviconUrl); + const arrayBuffer = await response.arrayBuffer(); + const base64 = btoa( + new Uint8Array(arrayBuffer).reduce( + (data, byte) => data + String.fromCharCode(byte), + "", + ), + ); + const mimeType = response.headers.get("content-type") || "image/x-icon"; + + return `data:${mimeType};base64,${base64}`; + } catch { + console.error(`Failed to fetch favicon: ${faviconUrl}`); + } + + return undefined; + } + + private async shouldReindexDocsOnNewEmbeddingsProvider( + curEmbeddingsProviderId: EmbeddingsProvider["id"], + ): Promise { + const isJetBrainsAndPreIndexedDocsProvider = + await this.isJetBrainsAndPreIndexedDocsProvider(); + + if (isJetBrainsAndPreIndexedDocsProvider) { + // A bit noisy for teams users whom have no choice if their admin is the one who didn't setup an embeddingsProvider + // this.ide.errorPopup( + // "The 'transformers.js' embeddings provider currently cannot be used to index " + + // "documentation in JetBrains. To enable documentation indexing, you can use " + + // "any of the other providers described in the docs: " + + // "https://docs.continue.dev/walkthroughs/codebase-embeddings#embeddings-providers", + // ); + + this.globalContext.update( + "curEmbeddingsProviderId", + curEmbeddingsProviderId, + ); + + return false; + } + + const lastEmbeddingsProviderId = this.globalContext.get( + "curEmbeddingsProviderId", + ); + + if (!lastEmbeddingsProviderId) { + // If it's the first time we're setting the `curEmbeddingsProviderId` + // global state, we don't need to reindex docs + this.globalContext.update( + "curEmbeddingsProviderId", + curEmbeddingsProviderId, + ); + + return false; + } + + return lastEmbeddingsProviderId !== curEmbeddingsProviderId; + } + + /** + * Currently this deletes re-crawls + re-indexes all docs. + * A more optimal solution in the future will be to create + * a per-embeddings-provider table for docs. + */ + private async reindexDocsOnNewEmbeddingsProvider( + embeddingsProvider: EmbeddingsProvider, + ) { + // We use config as our source of truth here since it contains additional information + // needed for re-crawling such as `faviconUrl` and `maxDepth`. + const { docs } = this.config; + + if (!docs || docs.length === 0) { + return; + } + + console.log( + `Reindexing docs with new embeddings provider: ${embeddingsProvider.id}`, + ); + + for (const doc of docs) { + await this.delete(doc.startUrl); + + const generator = this.indexAndAdd(doc); + + while (!(await generator.next()).done) {} + } + + // Important that this only is invoked after we have successfully + // cleared and reindex the docs so that the table cannot end up in an + // invalid state. + this.globalContext.update("curEmbeddingsProviderId", embeddingsProvider.id); + + console.log("Completed reindexing of all docs"); } } + +export const docsServiceSingleton = DocsService.getSingleton(); diff --git a/core/indexing/docs/article.ts b/core/indexing/docs/article.ts index d1f6a94a7..c86bdb838 100644 --- a/core/indexing/docs/article.ts +++ b/core/indexing/docs/article.ts @@ -1,8 +1,8 @@ import { Readability } from "@mozilla/readability"; import { JSDOM } from "jsdom"; -import { Chunk } from "../../index.js"; -import { cleanFragment, cleanHeader } from "../chunk/markdown.js"; -import { PageData } from "./crawl.js"; +import { Chunk } from "../../"; +import { cleanFragment, cleanHeader } from "../chunk/markdown"; +import { type PageData } from "./DocsCrawler"; export type ArticleComponent = { title: string; @@ -118,7 +118,6 @@ function extractTitlesAndBodies(html: string): ArticleComponent[] { return result; } - export function stringToArticle( url: string, html: string, @@ -149,7 +148,7 @@ export function stringToArticle( export function pageToArticle(page: PageData): Article | undefined { try { - return stringToArticle(page.url, page.html, page.path); + return stringToArticle(page.url, page.content, page.path); } catch (err) { console.error("Error converting URL to article components", err); return undefined; diff --git a/core/indexing/docs/crawl.ts b/core/indexing/docs/crawl.ts deleted file mode 100644 index 838a92241..000000000 --- a/core/indexing/docs/crawl.ts +++ /dev/null @@ -1,212 +0,0 @@ -import { Octokit } from "@octokit/rest"; -import cheerio from "cheerio"; -import fetch from "node-fetch"; -import { URL } from "node:url"; - -const IGNORE_PATHS_ENDING_IN = [ - "favicon.ico", - "robots.txt", - ".rst.txt", - "genindex", - "py-modindex", - "search.html", - "search", - "genindex.html", - "changelog", - "changelog.html", -]; - -const markdownRegex = new RegExp(/\.(md|mdx)$/); - -async function getDefaultBranch(owner: string, repo: string): Promise { - const octokit = new Octokit({ auth: undefined }); - - const repoInfo = await octokit.repos.get({ - owner, - repo, - }); - - return repoInfo.data.default_branch; -} - -async function crawlGithubRepo(baseUrl: URL) { - const octokit = new Octokit({ - auth: undefined, - }); - - const [_, owner, repo] = baseUrl.pathname.split("/"); - - const branch = await getDefaultBranch(owner, repo); - console.log("Github repo detected. Crawling", branch, "branch"); - - const tree = await octokit.request( - "GET /repos/{owner}/{repo}/git/trees/{tree_sha}", - { - owner, - repo, - tree_sha: branch, - headers: { - "X-GitHub-Api-Version": "2022-11-28", - }, - recursive: "true", - }, - ); - - const paths = tree.data.tree - .filter( - (file: any) => - file.type === "blob" && markdownRegex.test(file.path ?? ""), - ) - .map((file: any) => baseUrl.pathname + "/tree/main/" + file.path); - - return paths; -} - -async function getLinksFromUrl(url: string, path: string) { - const baseUrl = new URL(url); - const location = new URL(path, url); - let response; - - try { - response = await fetch(location.toString()); - } catch (error: unknown) { - if (error instanceof Error && error.message.includes("maximum redirect")) { - console.error("Maximum redirect reached for: ", location.toString()); - return { - html: "", - links: [], - }; - } - console.error(error); - return { - html: "", - links: [], - }; - } - - const html = await response.text(); - let links: string[] = []; - - if (url.includes("github.com")) { - return { - html, - links, - }; - } - - const $ = cheerio.load(html); - - $("a").each((_, element) => { - const href = $(element).attr("href"); - if (!href) { - return; - } - - const parsedUrl = new URL(href, url); - if ( - parsedUrl.hostname === baseUrl.hostname - // parsedUrl.pathname.startsWith(baseUrl.pathname) - ) { - links.push(parsedUrl.pathname); - } - }); - - links = [...new Set(links)].filter((link) => { - return ( - !link.includes("#") && - !IGNORE_PATHS_ENDING_IN.some((ending) => link.endsWith(ending)) - ); - }); - - return { - html, - links, - }; -} - -function splitUrl(url: URL) { - const baseUrl = `${url.protocol}//${url.hostname}${ - url.port ? ":" + url.port : "" - }`; - const basePath = url.pathname; - return { - baseUrl, - basePath, - }; -} - -export type PageData = { - url: string; - path: string; - html: string; -}; - -export async function* crawlPage( - url: URL, - maxDepth: number = 3, -): AsyncGenerator { - console.log( - `Starting crawl from: ${url.toString()} - Max Depth: ${maxDepth}`, - ); - - const { baseUrl, basePath } = splitUrl(url); - let paths: { path: string; depth: number }[] = [{ path: basePath, depth: 0 }]; - - if (url.hostname === "github.com") { - const githubLinks = await crawlGithubRepo(url); - const githubLinkObjects = githubLinks.map((link) => ({ - path: link, - depth: 0, - })); - paths = [...paths, ...githubLinkObjects]; - } - - let index = 0; - while (index < paths.length) { - const batch = paths.slice(index, index + 50); - - try { - const promises = batch.map(({ path, depth }) => - getLinksFromUrl(baseUrl, path).then((links) => ({ - links, - path, - depth, - })), - ); // Adjust for depth tracking - - const results = await Promise.all(promises); - for (const { - links: { html, links: linksArray }, - path, - depth, - } of results) { - if (html !== "" && depth <= maxDepth) { - // Check depth - yield { - url: url.toString(), - path, - html, - }; - } - - // Ensure we only add links if within depth limit - if (depth < maxDepth) { - for (let link of linksArray) { - if (!paths.some((p) => p.path === link)) { - paths.push({ path: link, depth: depth + 1 }); // Increment depth for new paths - } - } - } - } - } catch (e) { - if (e instanceof TypeError) { - console.warn("Error while crawling page: ", e); // Likely an invalid url, continue with process - } else { - console.error("Error while crawling page: ", e); - } - } - - index += batch.length; // Proceed to next batch - } - console.log("Crawl completed"); -} diff --git a/core/indexing/docs/migrations.ts b/core/indexing/docs/migrations.ts new file mode 100644 index 000000000..f617098af --- /dev/null +++ b/core/indexing/docs/migrations.ts @@ -0,0 +1,70 @@ +import { Table } from "vectordb"; +import { editConfigJson, migrate } from "../../util/paths.js"; +import { type Database } from "sqlite"; +import DocsService, { SqliteDocsRow } from "./DocsService.js"; + +export async function runLanceMigrations(table: Table) { + await new Promise((resolve) => + migrate( + "rename_baseurl_column_for_lance_docs", + async () => { + try { + const schema = await table.schema; + + if (schema.fields.some((field: any) => field.name === "baseurl")) { + await table.alterColumns([{ path: "baseurl", rename: "starturl" }]); + } + } finally { + resolve(undefined); + } + }, + () => resolve(undefined), + ), + ); +} + +export async function runSqliteMigrations(db: Database) { + await new Promise((resolve) => { + migrate( + "sqlite_modify_docs_columns_and_copy_to_config", + async () => { + try { + const pragma = await db.all( + `PRAGMA table_info(${DocsService.sqlitebTableName})`, + ); + + const hasFaviconCol = pragma.some( + (pragma) => pragma.name === "favicon", + ); + const hasBaseUrlCol = pragma.some( + (pragma) => pragma.name === "baseUrl", + ); + + if (!hasFaviconCol) { + await db.exec( + `ALTER TABLE ${DocsService.sqlitebTableName} ADD COLUMN favicon BLOB`, + ); + } + + if (hasBaseUrlCol) { + await db.exec( + `ALTER TABLE ${DocsService.sqlitebTableName} RENAME COLUMN baseUrl TO startUrl`, + ); + } + + const sqliteDocs = await db.all< + Array> + >(`SELECT title, startUrl FROM ${DocsService.sqlitebTableName}`); + + editConfigJson((config) => ({ + ...config, + docs: [...(config.docs || []), ...sqliteDocs], + })); + } finally { + resolve(undefined); + } + }, + () => resolve(undefined), + ); + }); +} diff --git a/core/indexing/docs/preIndexed.ts b/core/indexing/docs/preIndexed.ts index 6f48e7d3b..705693e36 100644 --- a/core/indexing/docs/preIndexed.ts +++ b/core/indexing/docs/preIndexed.ts @@ -1,17 +1,28 @@ -import { Chunk } from "../../index.js"; +import { Chunk } from "../../"; +import request from "request"; -const request = require("request"); +export function getS3Filename( + embeddingsProviderId: string, + title: string, +): string { + return `${embeddingsProviderId}/${title}`; +} + +export enum S3Buckets { + continueIndexedDocs = "continue-indexed-docs", +} + +const AWS_REGION = "us-west-1"; export async function downloadFromS3( bucket: string, fileName: string, - region: string, ): Promise { return new Promise((resolve, reject) => { let data = ""; const download = request({ - url: `https://${bucket}.s3.${region}.amazonaws.com/${fileName}`, + url: `https://${bucket}.s3.${AWS_REGION}.amazonaws.com/${fileName}`, }); download.on("response", (response: any) => { if (response.statusCode !== 200) { diff --git a/core/indexing/docs/preIndexedDocs.ts b/core/indexing/docs/preIndexedDocs.ts index 1cb34ba6f..9da86ef85 100644 --- a/core/indexing/docs/preIndexedDocs.ts +++ b/core/indexing/docs/preIndexedDocs.ts @@ -1,5 +1,4 @@ -/* eslint-disable @typescript-eslint/naming-convention */ -import { SiteIndexingConfig } from "../../index.js"; +import { SiteIndexingConfig } from "../../"; const preIndexedDocs: Record< SiteIndexingConfig["startUrl"], diff --git a/core/indexing/embeddings/BaseEmbeddingsProvider.ts b/core/indexing/embeddings/BaseEmbeddingsProvider.ts index 3a26f311d..d23d61af1 100644 --- a/core/indexing/embeddings/BaseEmbeddingsProvider.ts +++ b/core/indexing/embeddings/BaseEmbeddingsProvider.ts @@ -1,10 +1,11 @@ import { EmbedOptions, EmbeddingsProvider, + EmbeddingsProviderName, FetchFunction, } from "../../index.js"; -import { MAX_CHUNK_SIZE } from "../../llm/constants.js"; +import { DEFAULT_MAX_CHUNK_SIZE } from "../../llm/constants.js"; export interface IBaseEmbeddingsProvider extends EmbeddingsProvider { options: EmbedOptions; @@ -17,6 +18,11 @@ abstract class BaseEmbeddingsProvider implements IBaseEmbeddingsProvider { static maxBatchSize: IBaseEmbeddingsProvider["maxBatchSize"]; static defaultOptions: IBaseEmbeddingsProvider["defaultOptions"]; + static providerName: EmbeddingsProviderName; + get providerName(): EmbeddingsProviderName { + return (this.constructor as typeof BaseEmbeddingsProvider).providerName; + } + options: IBaseEmbeddingsProvider["options"]; fetch: IBaseEmbeddingsProvider["fetch"]; id: IBaseEmbeddingsProvider["id"]; @@ -32,17 +38,19 @@ abstract class BaseEmbeddingsProvider implements IBaseEmbeddingsProvider { }; this.fetch = fetch; // Include the `max_chunk_size` if it is not the default, since we need to create other indices for different chunk_sizes - if (this.maxChunkSize !== MAX_CHUNK_SIZE) { + if (this.maxChunkSize !== DEFAULT_MAX_CHUNK_SIZE) { this.id = `${this.constructor.name}::${this.options.model}::${this.maxChunkSize}`; } else { this.id = `${this.constructor.name}::${this.options.model}`; } } + defaultOptions?: EmbedOptions | undefined; + maxBatchSize?: number | undefined; abstract embed(chunks: string[]): Promise; get maxChunkSize(): number { - return this.options.maxChunkSize ?? MAX_CHUNK_SIZE; + return this.options.maxChunkSize ?? DEFAULT_MAX_CHUNK_SIZE; } static getBatchedChunks(chunks: string[]): string[][] { diff --git a/core/indexing/embeddings/CohereEmbeddingsProvider.ts b/core/indexing/embeddings/CohereEmbeddingsProvider.ts index 59dcf23a4..f1e760bb3 100644 --- a/core/indexing/embeddings/CohereEmbeddingsProvider.ts +++ b/core/indexing/embeddings/CohereEmbeddingsProvider.ts @@ -1,11 +1,13 @@ import { Response } from "node-fetch"; -import { EmbedOptions } from "../../index.js"; +import { EmbeddingsProviderName, EmbedOptions } from "../../index.js"; import { withExponentialBackoff } from "../../util/withExponentialBackoff.js"; import BaseEmbeddingsProvider from "./BaseEmbeddingsProvider.js"; class CohereEmbeddingsProvider extends BaseEmbeddingsProvider { static maxBatchSize = 96; + static providerName: EmbeddingsProviderName = "cohere"; + static defaultOptions: Partial | undefined = { apiBase: "https://api.cohere.ai/v1/", model: "embed-english-v3.0", diff --git a/core/indexing/embeddings/ContinueProxyEmbeddingsProvider.ts b/core/indexing/embeddings/ContinueProxyEmbeddingsProvider.ts new file mode 100644 index 000000000..c02685af7 --- /dev/null +++ b/core/indexing/embeddings/ContinueProxyEmbeddingsProvider.ts @@ -0,0 +1,25 @@ +import { CONTROL_PLANE_URL } from "../../control-plane/client.js"; +import { EmbeddingsProviderName, EmbedOptions } from "../../index.js"; +import OpenAIEmbeddingsProvider from "./OpenAIEmbeddingsProvider.js"; + +class ContinueProxyEmbeddingsProvider extends OpenAIEmbeddingsProvider { + static providerName: EmbeddingsProviderName = "continue-proxy"; + static defaultOptions: Partial | undefined = { + apiBase: new URL("/model-proxy/v1", CONTROL_PLANE_URL).toString(), + }; + + private _workOsAccessToken: string | undefined = undefined; + + get workOsAccessToken(): string | undefined { + return this._workOsAccessToken; + } + + set workOsAccessToken(value: string | undefined) { + if (this._workOsAccessToken !== value) { + this._workOsAccessToken = value; + this.options.apiKey = value; + } + } +} + +export default ContinueProxyEmbeddingsProvider; diff --git a/core/indexing/embeddings/DeepInfraEmbeddingsProvider.ts b/core/indexing/embeddings/DeepInfraEmbeddingsProvider.ts index 32c482267..11444ab68 100644 --- a/core/indexing/embeddings/DeepInfraEmbeddingsProvider.ts +++ b/core/indexing/embeddings/DeepInfraEmbeddingsProvider.ts @@ -1,8 +1,9 @@ -import { EmbedOptions } from "../../index.js"; +import { EmbeddingsProviderName, EmbedOptions } from "../../index.js"; import { withExponentialBackoff } from "../../util/withExponentialBackoff.js"; import BaseEmbeddingsProvider from "./BaseEmbeddingsProvider.js"; class DeepInfraEmbeddingsProvider extends BaseEmbeddingsProvider { + static providerName: EmbeddingsProviderName = "deepinfra"; static defaultOptions: Partial | undefined = { model: "sentence-transformers/all-MiniLM-L6-v2", }; diff --git a/core/indexing/embeddings/FreeTrialEmbeddingsProvider.ts b/core/indexing/embeddings/FreeTrialEmbeddingsProvider.ts index 6d356cef9..70cd3d8c7 100644 --- a/core/indexing/embeddings/FreeTrialEmbeddingsProvider.ts +++ b/core/indexing/embeddings/FreeTrialEmbeddingsProvider.ts @@ -1,11 +1,16 @@ import { Response } from "node-fetch"; import { getHeaders } from "../../continueServer/stubs/headers.js"; import { constants } from "../../deploy/constants.js"; -import { EmbedOptions, FetchFunction } from "../../index.js"; +import { + EmbeddingsProviderName, + EmbedOptions, + FetchFunction, +} from "../../index.js"; import { withExponentialBackoff } from "../../util/withExponentialBackoff.js"; import BaseEmbeddingsProvider from "./BaseEmbeddingsProvider.js"; class FreeTrialEmbeddingsProvider extends BaseEmbeddingsProvider { + static providerName: EmbeddingsProviderName = "free-trial"; static maxBatchSize = 128; static defaultOptions: Partial | undefined = { diff --git a/core/indexing/embeddings/GeminiEmbeddingsProvider.ts b/core/indexing/embeddings/GeminiEmbeddingsProvider.ts index 3de46d5e7..d3c22f3f0 100644 --- a/core/indexing/embeddings/GeminiEmbeddingsProvider.ts +++ b/core/indexing/embeddings/GeminiEmbeddingsProvider.ts @@ -1,17 +1,13 @@ import { Response } from "node-fetch"; +import { EmbeddingsProviderName } from "../../index.js"; import { withExponentialBackoff } from "../../util/withExponentialBackoff.js"; -import BaseEmbeddingsProvider, { - IBaseEmbeddingsProvider, -} from "./BaseEmbeddingsProvider.js"; -import { - EmbedContentRequest, - EmbedContentResponse, -} from "@google/generative-ai"; +import BaseEmbeddingsProvider from "./BaseEmbeddingsProvider.js"; /** * [View the Gemini Text Embedding docs.](https://ai.google.dev/gemini-api/docs/models/gemini#text-embedding-and-embedding) */ class GeminiEmbeddingsProvider extends BaseEmbeddingsProvider { + static providerName: EmbeddingsProviderName = "gemini"; static maxBatchSize = 2048; static defaultOptions = { @@ -20,30 +16,28 @@ class GeminiEmbeddingsProvider extends BaseEmbeddingsProvider { }; get urlPath(): string { - return `${this.options.model}:embedContent`; + return `${this.options.model}:batchEmbedContents`; } async getSingleBatchEmbedding(batch: string[]) { - const body: EmbedContentRequest = { + // Batch embed endpoint: https://ai.google.dev/api/embeddings?authuser=1#EmbedContentRequest + const requests = batch.map((text) => ({ + model: this.options.model, content: { - /** - * Listed as optional in the [docs](https://ai.google.dev/api/rest/v1/Content) - * but is required in the interface. - */ role: "user", - parts: batch.map((part) => ({ text: part })), + parts: [{ text }], }, - }; + })); const fetchWithBackoff = () => withExponentialBackoff(() => this.fetch(new URL(this.urlPath, this.options.apiBase), { method: "POST", - body: JSON.stringify(body), + body: JSON.stringify({ + requests, + }), headers: { - // eslint-disable-next-line @typescript-eslint/naming-convention "x-goog-api-key": this.options.apiKey, - // eslint-disable-next-line @typescript-eslint/naming-convention "Content-Type": "application/json", }, }), @@ -55,17 +49,18 @@ class GeminiEmbeddingsProvider extends BaseEmbeddingsProvider { throw new Error(await resp.text()); } - const data = (await resp.json()) as EmbedContentResponse; + const data = (await resp.json()) as any; - return data.embedding.values; + return data.embeddings.map((embedding: any) => embedding.values); } async embed(chunks: string[]) { const batches = GeminiEmbeddingsProvider.getBatchedChunks(chunks); - return await Promise.all( + const results = await Promise.all( batches.map((batch) => this.getSingleBatchEmbedding(batch)), ); + return results.flat(); } } diff --git a/core/indexing/embeddings/HuggingFaceTEIEmbeddingsProvider.ts b/core/indexing/embeddings/HuggingFaceTEIEmbeddingsProvider.ts index 3efaa74dd..9ee6a5054 100644 --- a/core/indexing/embeddings/HuggingFaceTEIEmbeddingsProvider.ts +++ b/core/indexing/embeddings/HuggingFaceTEIEmbeddingsProvider.ts @@ -1,10 +1,15 @@ -import fetch, { Response } from "node-fetch"; -import { EmbedOptions, FetchFunction } from "../.."; -import { withExponentialBackoff } from "../../util/withExponentialBackoff"; -import BaseEmbeddingsProvider from "./BaseEmbeddingsProvider"; +import { Response } from "node-fetch"; +import { + EmbeddingsProviderName, + EmbedOptions, + FetchFunction, +} from "../../index.js"; +import { withExponentialBackoff } from "../../util/withExponentialBackoff.js"; +import BaseEmbeddingsProvider from "./BaseEmbeddingsProvider.js"; class HuggingFaceTEIEmbeddingsProvider extends BaseEmbeddingsProvider { - private maxBatchSize = 32; + static providerName: EmbeddingsProviderName = "huggingface-tei"; + maxBatchSize = 32; static defaultOptions: Partial | undefined = { apiBase: "http://localhost:8080", @@ -17,7 +22,7 @@ class HuggingFaceTEIEmbeddingsProvider extends BaseEmbeddingsProvider { if (!this.options.apiBase?.endsWith("/")) { this.options.apiBase += "/"; } - this.doInfoRequest().then(response => { + this.doInfoRequest().then((response) => { this.options.model = response.model_id; this.maxBatchSize = response.max_client_batch_size; }); @@ -26,7 +31,9 @@ class HuggingFaceTEIEmbeddingsProvider extends BaseEmbeddingsProvider { async embed(chunks: string[]) { const promises = []; for (let i = 0; i < chunks.length; i += this.maxBatchSize) { - promises.push(this.doEmbedRequest(chunks.slice(i, i + this.maxBatchSize))); + promises.push( + this.doEmbedRequest(chunks.slice(i, i + this.maxBatchSize)), + ); } const results = await Promise.all(promises); return results.flat(); @@ -37,11 +44,11 @@ class HuggingFaceTEIEmbeddingsProvider extends BaseEmbeddingsProvider { this.fetch(new URL("embed", this.options.apiBase), { method: "POST", body: JSON.stringify({ - inputs: batch + inputs: batch, }), headers: { "Content-Type": "application/json", - } + }, }), ); if (!resp.ok) { @@ -75,9 +82,9 @@ class TEIEmbedError extends Error { } type TEIEmbedErrorResponse = { - error: string - error_type: string -} + error: string; + error_type: string; +}; type TEIInfoResponse = { model_id: string; @@ -86,7 +93,7 @@ type TEIInfoResponse = { model_type: { embedding: { pooling: string; - } + }; }; max_concurrent_requests: number; max_input_length: number; diff --git a/core/indexing/embeddings/OllamaEmbeddingsProvider.ts b/core/indexing/embeddings/OllamaEmbeddingsProvider.ts index dae388582..58fa5f265 100644 --- a/core/indexing/embeddings/OllamaEmbeddingsProvider.ts +++ b/core/indexing/embeddings/OllamaEmbeddingsProvider.ts @@ -1,4 +1,8 @@ -import { EmbedOptions, FetchFunction } from "../../index.js"; +import { + EmbeddingsProviderName, + EmbedOptions, + FetchFunction, +} from "../../index.js"; import { withExponentialBackoff } from "../../util/withExponentialBackoff.js"; import BaseEmbeddingsProvider, { IBaseEmbeddingsProvider, @@ -22,6 +26,9 @@ async function embedOne( model: options.model, prompt: chunk, }), + headers: { + "Content-Type": "application/json", + }, }); if (!resp.ok) { @@ -41,6 +48,7 @@ async function embedOne( } class OllamaEmbeddingsProvider extends BaseEmbeddingsProvider { + static providerName: EmbeddingsProviderName = "ollama"; static defaultOptions: IBaseEmbeddingsProvider["defaultOptions"] = { apiBase: "http://localhost:11434/", model: "nomic-embed-text", diff --git a/core/indexing/embeddings/OpenAIEmbeddingsProvider.ts b/core/indexing/embeddings/OpenAIEmbeddingsProvider.ts index 01a85ee5e..fc6af4547 100644 --- a/core/indexing/embeddings/OpenAIEmbeddingsProvider.ts +++ b/core/indexing/embeddings/OpenAIEmbeddingsProvider.ts @@ -1,9 +1,10 @@ import { Response } from "node-fetch"; -import { EmbedOptions } from "../../index.js"; +import { EmbeddingsProviderName, EmbedOptions } from "../../index.js"; import { withExponentialBackoff } from "../../util/withExponentialBackoff.js"; import BaseEmbeddingsProvider from "./BaseEmbeddingsProvider.js"; class OpenAIEmbeddingsProvider extends BaseEmbeddingsProvider { + static providerName: EmbeddingsProviderName = "openai"; // https://platform.openai.com/docs/api-reference/embeddings/create is 2048 // but Voyage is 128 static maxBatchSize = 128; diff --git a/core/indexing/embeddings/TransformersJsEmbeddingsProvider.ts b/core/indexing/embeddings/TransformersJsEmbeddingsProvider.ts index c58acb8f7..4dcf41141 100644 --- a/core/indexing/embeddings/TransformersJsEmbeddingsProvider.ts +++ b/core/indexing/embeddings/TransformersJsEmbeddingsProvider.ts @@ -1,4 +1,5 @@ import path from "path"; +import { EmbeddingsProviderName } from "../../index.js"; // @ts-ignore // prettier-ignore import { type PipelineType } from "../../vendor/modules/@xenova/transformers/src/transformers.js"; @@ -37,8 +38,10 @@ class EmbeddingsPipeline { } export class TransformersJsEmbeddingsProvider extends BaseEmbeddingsProvider { + static providerName: EmbeddingsProviderName = "transformers.js"; static maxGroupSize: number = 4; static model: string = "all-MiniLM-L6-v2"; + static mockVector: number[] = Array.from({ length: 384 }).fill(2) as number[]; constructor() { super({ model: TransformersJsEmbeddingsProvider.model }, () => @@ -47,6 +50,11 @@ export class TransformersJsEmbeddingsProvider extends BaseEmbeddingsProvider { } async embed(chunks: string[]) { + // Workaround to ignore testing issues in Jest + if (process.env.NODE_ENV === "test") { + return chunks.map(() => TransformersJsEmbeddingsProvider.mockVector); + } + const extractor = await EmbeddingsPipeline.getInstance(); if (!extractor) { diff --git a/core/indexing/embeddings/index.ts b/core/indexing/embeddings/index.ts index f3979dd98..acf3d81e8 100644 --- a/core/indexing/embeddings/index.ts +++ b/core/indexing/embeddings/index.ts @@ -1,12 +1,14 @@ import { EmbeddingsProviderName } from "../../index.js"; import BaseEmbeddingsProvider from "./BaseEmbeddingsProvider.js"; import CohereEmbeddingsProvider from "./CohereEmbeddingsProvider.js"; +import ContinueProxyEmbeddingsProvider from "./ContinueProxyEmbeddingsProvider.js"; +import DeepInfraEmbeddingsProvider from "./DeepInfraEmbeddingsProvider.js"; import FreeTrialEmbeddingsProvider from "./FreeTrialEmbeddingsProvider.js"; +import GeminiEmbeddingsProvider from "./GeminiEmbeddingsProvider.js"; import HuggingFaceTEIEmbeddingsProvider from "./HuggingFaceTEIEmbeddingsProvider.js"; import OllamaEmbeddingsProvider from "./OllamaEmbeddingsProvider.js"; import OpenAIEmbeddingsProvider from "./OpenAIEmbeddingsProvider.js"; import TransformersJsEmbeddingsProvider from "./TransformersJsEmbeddingsProvider.js"; -import GeminiEmbeddingsProvider from "./GeminiEmbeddingsProvider.js"; type EmbeddingsProviderConstructor = new ( ...args: any[] @@ -17,13 +19,12 @@ export const allEmbeddingsProviders: Record< EmbeddingsProviderConstructor > = { ollama: OllamaEmbeddingsProvider, - // eslint-disable-next-line @typescript-eslint/naming-convention "transformers.js": TransformersJsEmbeddingsProvider, openai: OpenAIEmbeddingsProvider, cohere: CohereEmbeddingsProvider, - // eslint-disable-next-line @typescript-eslint/naming-convention "free-trial": FreeTrialEmbeddingsProvider, - // eslint-disable-next-line @typescript-eslint/naming-convention "huggingface-tei": HuggingFaceTEIEmbeddingsProvider, gemini: GeminiEmbeddingsProvider, + "continue-proxy": ContinueProxyEmbeddingsProvider, + deepinfra: DeepInfraEmbeddingsProvider, }; diff --git a/core/indexing/ignore.ts b/core/indexing/ignore.ts index 35fd84aa1..16526e7fb 100644 --- a/core/indexing/ignore.ts +++ b/core/indexing/ignore.ts @@ -59,42 +59,53 @@ export const DEFAULT_IGNORE_FILETYPES = [ "*.gcda", "*.gcno", "go.sum", - ".env", - ".gitignore", - ".gitkeep", - ".continueignore", + "*.env", + "*.gitignore", + "*.gitkeep", + "*.continueignore", "config.json", - ".csv", + "*.csv", + "*.uasset", + "*.pdb", // "*.prompt", // can be incredibly confusing for the LLM to have another set of instructions injected into the prompt ]; + export const defaultIgnoreFile = ignore().add(DEFAULT_IGNORE_FILETYPES); export const DEFAULT_IGNORE_DIRS = [ - ".git", - ".svn", - ".vscode", - ".idea", - ".vs", - "venv", - ".venv", - "env", - ".env", - "node_modules", - "dist", - "build", - "target", - "out", - "bin", - ".pytest_cache", - ".vscode-test", - ".continue", - "__pycache__", - "site-packages", - ".gradle", - ".cache", - "gems", - "vendor", + ".git/", + ".svn/", + ".vscode/", + ".idea/", + ".vs/", + "venv/", + ".venv/", + "env/", + ".env/", + "node_modules/", + "dist/", + "build/", + "target/", + "out/", + "bin/", + ".pytest_cache/", + ".vscode-test/", + ".continue/", + "__pycache__/", + "site-packages/", + ".gradle/", + ".cache/", + "gems/", + "vendor/", ]; + export const defaultIgnoreDir = ignore().add(DEFAULT_IGNORE_DIRS); export const DEFAULT_IGNORE = DEFAULT_IGNORE_FILETYPES.join("\n") + "\n" + DEFAULT_IGNORE_DIRS.join("\n"); + +export function gitIgArrayFromFile(file: string) { + return file + .split(/\r?\n/) // Split on new line + .map((l) => l.trim()) // Remove whitespace + .filter((l) => !/^#|^$/.test(l)); // Remove empty lines +} diff --git a/core/indexing/refreshIndex.ts b/core/indexing/refreshIndex.ts index db69c8725..6800a9e8a 100644 --- a/core/indexing/refreshIndex.ts +++ b/core/indexing/refreshIndex.ts @@ -1,5 +1,6 @@ import crypto from "node:crypto"; import * as fs from "node:fs"; +import plimit from "p-limit"; import { open, type Database } from "sqlite"; import sqlite3 from "sqlite3"; import { IndexTag, IndexingProgressUpdate } from "../index.js"; @@ -23,6 +24,8 @@ export class SqliteDb { static db: DatabaseConnection | null = null; private static async createTables(db: DatabaseConnection) { + await db.exec("PRAGMA journal_mode=WAL;"); + await db.exec( `CREATE TABLE IF NOT EXISTS tag_catalog ( id INTEGER PRIMARY KEY AUTOINCREMENT, @@ -110,18 +113,13 @@ async function getSavedItemsForTag( return rows; } -interface PathAndOptionalCacheKey { - path: string; - cacheKey?: string; -} - enum AddRemoveResultType { Add = "add", Remove = "remove", UpdateNewVersion = "updateNewVersion", UpdateOldVersion = "updateOldVersion", UpdateLastUpdated = "updateLastUpdated", - Compute = "compute" + Compute = "compute", } async function getAddRemoveForTag( @@ -141,7 +139,6 @@ async function getAddRemoveForTag( const saved = await getSavedItemsForTag(tag); - const add: PathAndCacheKey[] = []; const updateNewVersion: PathAndCacheKey[] = []; const updateOldVersion: PathAndCacheKey[] = []; const remove: PathAndCacheKey[] = []; @@ -176,15 +173,16 @@ async function getAddRemoveForTag( } } - // Any leftover in current files need to be added - add.push( - ...(await Promise.all( - Object.keys(files).map(async (path) => { - const fileContents = await readFile(path); - return { path, cacheKey: calculateHash(fileContents) }; - }), - )), - ); + // limit to only 10 concurrent file reads to avoid issues such as + // "too many file handles". A large number here does not improve + // throughput due to the nature of disk or network i/o -- huge + // amounts of readers generally does not improve performance + const limit = plimit(10); + const promises = Object.keys(files).map(async (path) => { + const fileContents = await limit(() => readFile(path)); + return { path, cacheKey: calculateHash(fileContents) }; + }); + const add: PathAndCacheKey[] = await Promise.all(promises); // Create the markComplete callback function const db = await SqliteDb.get(); @@ -228,7 +226,7 @@ async function getAddRemoveForTag( break; case AddRemoveResultType.Add: await db.run( - "INSERT INTO tag_catalog (path, cacheKey, lastUpdated, dir, branch, artifactId) VALUES (?, ?, ?, ?, ?, ?)", + "REPLACE INTO tag_catalog (path, cacheKey, lastUpdated, dir, branch, artifactId) VALUES (?, ?, ?, ?, ?, ?)", path, cacheKey, newLastUpdatedTimestamp, @@ -393,7 +391,7 @@ export async function getComputeDeleteAddRemove( lastUpdated, async (items, resultType) => { // Update tag catalog - markComplete(items, resultType); + await markComplete(items, resultType); // Update the global cache const results: any = { @@ -406,7 +404,7 @@ export async function getComputeDeleteAddRemove( for await (const _ of globalCacheIndex.update( tag, results, - () => {}, + async () => {}, repoName, )) { } @@ -433,7 +431,7 @@ export class GlobalCacheCodeBaseIndex implements CodebaseIndex { _: MarkCompleteCallback, repoName: string | undefined, ): AsyncGenerator { - const add = results.addTag; + const add = [...results.compute, ...results.addTag]; const remove = [...results.del, ...results.removeTag]; await Promise.all([ ...remove.map(({ cacheKey }) => { @@ -451,7 +449,7 @@ export class GlobalCacheCodeBaseIndex implements CodebaseIndex { tag: IndexTag, ): Promise { await this.db.run( - "INSERT INTO global_cache (cacheKey, dir, branch, artifactId) VALUES (?, ?, ?, ?)", + "REPLACE INTO global_cache (cacheKey, dir, branch, artifactId) VALUES (?, ?, ?, ?)", cacheKey, tag.directory, tag.branch, diff --git a/core/indexing/types.ts b/core/indexing/types.ts index f952ea8df..3e3e287b6 100644 --- a/core/indexing/types.ts +++ b/core/indexing/types.ts @@ -5,13 +5,13 @@ export enum IndexResultType { Delete = "del", AddTag = "addTag", RemoveTag = "removeTag", - UpdateLastUpdated = "updateLastUpdated" + UpdateLastUpdated = "updateLastUpdated", } export type MarkCompleteCallback = ( items: PathAndCacheKey[], resultType: IndexResultType, -) => void; +) => Promise; export interface CodebaseIndex { artifactId: string; diff --git a/core/test/walkDir.test.ts b/core/indexing/walkDir.test.ts similarity index 94% rename from core/test/walkDir.test.ts rename to core/indexing/walkDir.test.ts index 87f643f4e..7fa5ed00c 100644 --- a/core/test/walkDir.test.ts +++ b/core/indexing/walkDir.test.ts @@ -1,12 +1,12 @@ import path from "path"; -import { walkDir, WalkerOptions } from "../indexing/walkDir.js"; -import FileSystemIde from "../util/filesystem.js"; +import { walkDir, WalkerOptions } from "../indexing/walkDir"; +import FileSystemIde from "../util/filesystem"; import { - addToTestDir, + TEST_DIR, setUpTestDir, tearDownTestDir, - TEST_DIR, -} from "./testUtils/testDir.js"; + addToTestDir, +} from "../test/util/testDir"; const ide = new FileSystemIde(TEST_DIR); @@ -191,6 +191,22 @@ describe("walkDir", () => { await expectPaths(["a.txt"], ["ignored_dir/b.txt", "ignored_dir/c/d.py"]); }); + test("gitignore in sub directory should only apply to subdirectory", async () => { + const files = [ + [".gitignore", "abc"], + "a.txt", + "abc", + "xyz/", + ["xyz/.gitignore", "xyz"], + "xyz/b.txt", + "xyz/c/", + "xyz/c/d.py", + "xyz/xyz", + ]; + addToTestDir(files); + await expectPaths(["a.txt", "xyz/b.txt", "xyz/c/d.py"], ["abc", "xyz/xyz"]); + }); + test("should handle complex patterns in .gitignore", async () => { const files = [ [".gitignore", "*.what\n!important.what\ntemp/\n/root_only.txt"], diff --git a/core/indexing/walkDir.ts b/core/indexing/walkDir.ts index 1c320f181..eeeb064d0 100644 --- a/core/indexing/walkDir.ts +++ b/core/indexing/walkDir.ts @@ -1,4 +1,4 @@ -import { Minimatch } from "minimatch"; +import ignore, { Ignore } from "ignore"; import path from "node:path"; import { FileType, IDE } from "../index.d.js"; import { @@ -6,6 +6,7 @@ import { DEFAULT_IGNORE_FILETYPES, defaultIgnoreDir, defaultIgnoreFile, + gitIgArrayFromFile, } from "./ignore.js"; export interface WalkerOptions { @@ -28,39 +29,13 @@ type WalkableEntry = { // helper struct used for the DFS walk type WalkContext = { walkableEntry: WalkableEntry; - ignoreFiles: IgnoreFile[]; + ignoreContexts: IgnoreContext[]; }; -class IgnoreFile { - private _rules: Minimatch[]; - - constructor( - public path: string, - public content: string, - ) { - this.path = path; - this.content = content; - this._rules = this.contentToRules(content); - } - - public get rules() { - return this._rules; - } - - private contentToRules(content: string): Minimatch[] { - const options = { - matchBase: true, - dot: true, - flipNegate: true, - nocase: true, - }; - return content - .split(/\r?\n/) - .map((l) => l.trim()) - .filter((l) => !/^#|^$/.test(l)) - .map((l) => new Minimatch(l, options)); - } -} +type IgnoreContext = { + ignore: Ignore; + dirname: string; +}; class DFSWalker { private readonly path: string; @@ -77,40 +52,53 @@ class DFSWalker { // walk is a depth-first search implementation public async *walk(): AsyncGenerator { - const root: WalkContext = { + const fixupFunc = await this.newPathFixupFunc( + this.options.returnRelativePaths ? "" : this.path, + this.ide, + ); + const root = this.newRootWalkContext(); + const stack = [root]; + for (let cur = stack.pop(); cur; cur = stack.pop()) { + const walkableEntries = await this.listDirForWalking(cur.walkableEntry); + const ignoreContexts = await this.getIgnoreToApplyInDir( + cur, + walkableEntries, + ); + for (const w of walkableEntries) { + if (!this.shouldInclude(w, ignoreContexts)) { + continue; + } + if (this.entryIsDirectory(w.entry)) { + stack.push({ + walkableEntry: w, + ignoreContexts: ignoreContexts, + }); + if (this.options.onlyDirs) { + // when onlyDirs is enabled the walker will only return directory names + yield fixupFunc(w.relPath); + } + } else { + yield fixupFunc(w.relPath); + } + } + } + } + + private newRootWalkContext(): WalkContext { + return { walkableEntry: { relPath: "", absPath: this.path, type: 2 as FileType.Directory, entry: ["", 2 as FileType.Directory], }, - ignoreFiles: [], + ignoreContexts: [ + { + ignore: ignore().add(defaultIgnoreDir).add(defaultIgnoreFile), + dirname: "", + }, + ], }; - const stack = [root]; - for (let cur = stack.pop(); cur; cur = stack.pop()) { - const walkableEntries = await this.listDirForWalking(cur.walkableEntry); - const ignoreFiles = await this.getIgnoreFilesToApplyInDir( - cur.ignoreFiles, - walkableEntries, - ); - for (const w of walkableEntries) { - if (!this.shouldInclude(w, ignoreFiles)) { - continue; - } - if (this.entryIsDirectory(w.entry)) { - stack.push({ - walkableEntry: w, - ignoreFiles: ignoreFiles, - }); - if (this.options.onlyDirs) { - // when onlyDirs is enabled the walker will only return directory names - yield w.relPath; - } - } else { - yield w.relPath; - } - } - } } private async listDirForWalking( @@ -127,24 +115,29 @@ class DFSWalker { }); } - private async getIgnoreFilesToApplyInDir( - parentIgnoreFiles: IgnoreFile[], - walkableEntries: WalkableEntry[], - ): Promise { - const ignoreFilesInDir = await this.loadIgnoreFiles(walkableEntries); + private async getIgnoreToApplyInDir( + curDir: WalkContext, + entriesInDir: WalkableEntry[], + ): Promise { + const ignoreFilesInDir = await this.loadIgnoreFiles(entriesInDir); if (ignoreFilesInDir.length === 0) { - return parentIgnoreFiles; + return curDir.ignoreContexts; } - return Array.prototype.concat(parentIgnoreFiles, ignoreFilesInDir); + const patterns = ignoreFilesInDir.map((c) => gitIgArrayFromFile(c)).flat(); + const newIgnoreContext = { + ignore: ignore().add(patterns), + dirname: curDir.walkableEntry.relPath, + }; + return [ + ...curDir.ignoreContexts, + newIgnoreContext + ]; } - private async loadIgnoreFiles( - entries: WalkableEntry[], - ): Promise { + private async loadIgnoreFiles(entries: WalkableEntry[]): Promise { const ignoreEntries = entries.filter((w) => this.isIgnoreFile(w.entry)); const promises = ignoreEntries.map(async (w) => { - const content = await this.ide.readFile(w.absPath); - return new IgnoreFile(w.relPath, content); + return await this.ide.readFile(w.absPath); }); return Promise.all(promises); } @@ -154,10 +147,7 @@ class DFSWalker { return this.ignoreFileNames.has(p); } - private shouldInclude( - walkableEntry: WalkableEntry, - ignoreFiles: IgnoreFile[], - ) { + private shouldInclude(walkableEntry: WalkableEntry, ignoreContexts: IgnoreContext[]) { if (this.entryIsSymlink(walkableEntry.entry)) { // If called from the root, a symlink either links to a real file in this repository, // and therefore will be walked OR it linksto something outside of the repository and @@ -166,32 +156,23 @@ class DFSWalker { } let relPath = walkableEntry.relPath; if (this.entryIsDirectory(walkableEntry.entry)) { - if (defaultIgnoreDir.ignores(walkableEntry.relPath)) { - return false; - } relPath = `${relPath}/`; } else { if (this.options.onlyDirs) { return false; } - if (defaultIgnoreFile.ignores(walkableEntry.relPath)) { + } + for (const ig of ignoreContexts) { + // remove the directory name and path seperator from the match path, unless this an ignore file + // in the root directory + const prefixLength = ig.dirname.length === 0 ? 0 : ig.dirname.length + 1; + // The ignore library expects a path relative to the ignore file location + const matchPath = relPath.substring(prefixLength); + if (ig.ignore.ignores(matchPath)) { return false; } - relPath = `/${relPath}`; } - let included = true; - for (const ignoreFile of ignoreFiles) { - for (const r of ignoreFile.rules) { - if (r.negate === included) { - // no need to test when the file is already NOT to be included unless this is a negate rule and vice versa - continue; - } - if (r.match(relPath)) { - included = r.negate; - } - } - } - return included; + return true; } private entryIsDirectory(entry: Entry) { @@ -201,6 +182,27 @@ class DFSWalker { private entryIsSymlink(entry: Entry) { return entry[1] === (64 as FileType.SymbolicLink); } + + // returns a function which will optionally prefix a root path and fixup the paths for the appropriate OS filesystem (i.e. windows) + // the reason to construct this function once is to avoid the need to call ide.pathSep() multiple times + private async newPathFixupFunc( + rootPath: string, + ide: IDE, + ): Promise<(relPath: string) => string> { + const pathSep = await ide.pathSep(); + const prefix = rootPath === "" ? "" : rootPath + pathSep; + if (pathSep === "/") { + if (rootPath === "") { + // return a no-op function in this case to avoid unnecessary string concatentation + return (relPath: string) => relPath; + } + return (relPath: string) => prefix + relPath; + } + // this serves to 'fix-up' the path on Windows + return (relPath: string) => { + return prefix + relPath.split("/").join(pathSep); + }; + } } const defaultOptions: WalkerOptions = { @@ -213,18 +215,18 @@ export async function walkDir( ide: IDE, _options?: WalkerOptions, ): Promise { - let entries: string[] = []; - const options = { ...defaultOptions, ..._options }; - const dfsWalker = new DFSWalker(path, ide, options); - let relativePaths: string[] = []; - for await (const e of dfsWalker.walk()) { - relativePaths.push(e); + let paths: string[] = []; + for await (const p of walkDirAsync(path, ide, _options)) { + paths.push(p); } - const pathSep = await ide.pathSep(); - const prefix = options.returnRelativePaths ? "" : path + pathSep; - - if (pathSep === "/") { - return relativePaths.map((p) => prefix + p); - } - return relativePaths.map((p) => prefix + p.split("/").join(pathSep)); + return paths; +} + +export async function* walkDirAsync( + path: string, + ide: IDE, + _options?: WalkerOptions, +): AsyncGenerator { + const options = { ...defaultOptions, ..._options }; + yield* new DFSWalker(path, ide, options).walk(); } diff --git a/core/jest.config.js b/core/jest.config.js index 1ec7c44f8..2567c5891 100644 --- a/core/jest.config.js +++ b/core/jest.config.js @@ -1,15 +1,13 @@ import path from "path"; import { fileURLToPath } from "url"; -process.env.NODE_OPTIONS = "--experimental-vm-modules"; - export default { transform: { - "\\.[jt]sx?$": ["ts-jest", { useESM: true }], + "^.+\\.(ts|js)$": ["ts-jest", { useESM: true, useIsolatedModules: true }], }, - moduleNameMapper: { - "(.+)\\.js": "$1", + "^(\\.{1,2}/.*)\\.js$": "$1", + "^uuid$": "uuid", // https://stackoverflow.com/a/73626360 }, extensionsToTreatAsEsm: [".ts"], preset: "ts-jest/presets/default-esm", @@ -20,4 +18,5 @@ export default { __filename: path.resolve(fileURLToPath(import.meta.url)), }, globalSetup: "/jest.global-setup.ts", + setupFilesAfterEnv: ["/jest.setup-after-env.ts"], }; diff --git a/core/jest.global-setup.ts b/core/jest.global-setup.ts index 1c4fe12e8..ee9cddde4 100644 --- a/core/jest.global-setup.ts +++ b/core/jest.global-setup.ts @@ -1,4 +1,3 @@ -// jest.global-setup.js import path from "path"; export default async function () { diff --git a/core/jest.setup-after-env.ts b/core/jest.setup-after-env.ts new file mode 100644 index 000000000..a4c024332 --- /dev/null +++ b/core/jest.setup-after-env.ts @@ -0,0 +1,31 @@ +// https://github.com/mswjs/msw/issues/1576#issuecomment-1482643055 +import { jest } from "@jest/globals"; +import fetch, { Request, Response } from "node-fetch"; +import { TextDecoder, TextEncoder } from "util"; + +if (process.env.DEBUG === "jest") { + jest.setTimeout(5 * 60 * 1000); +} + +const globalThis = global as any; + +globalThis.fetch = fetch; +globalThis.Request = Request; +globalThis.Response = Response; +globalThis.TextEncoder = TextEncoder; +globalThis.TextDecoder = TextDecoder; + +// Trying to delete this when for some reason SQLite is still in use causes tests to fail +// globalThis.beforeAll(() => { +// // We can ignore TS warnings here since we set this explicitly in `./jest.global-setup.ts` +// if (fs.existsSync(process.env.CONTINUE_GLOBAL_DIR!)) { +// fs.rmSync(process.env.CONTINUE_GLOBAL_DIR!, { recursive: true }); +// } +// }); + +// globalThis.afterAll(() => { +// // We can ignore TS warnings here since we set this explicitly in `./jest.global-setup.ts` +// if (fs.existsSync(process.env.CONTINUE_GLOBAL_DIR!)) { +// fs.rmSync(process.env.CONTINUE_GLOBAL_DIR!, { recursive: true }); +// } +// }); diff --git a/core/llm/asyncEncoder.test.ts b/core/llm/asyncEncoder.test.ts new file mode 100644 index 000000000..9ed5eb80a --- /dev/null +++ b/core/llm/asyncEncoder.test.ts @@ -0,0 +1,45 @@ +import { LlamaAsyncEncoder, GPTAsyncEncoder } from "./asyncEncoder"; + +describe("llama encoder", () => { + var tokenizer: LlamaAsyncEncoder; + + beforeAll(() => { + tokenizer = new LlamaAsyncEncoder(); + }); + + afterAll(() => { + tokenizer.close(); + }); + + test("hello world", async () => { + const input = "the quick brown fox jumped over the lazy dog"; + const output = await tokenizer.encode(input); + expect(output).toEqual([ + 1, 278, 4996, 17354, 1701, 29916, 12500, 287, 975, 278, 17366, 11203, + ]); + const decoded = await tokenizer.decode(output); + expect(decoded).toBe(input); + }); +}); + +describe("tiktoken encoder", () => { + var tokenizer: GPTAsyncEncoder; + + beforeAll(() => { + tokenizer = new GPTAsyncEncoder(); + }); + + afterAll(() => { + tokenizer.close(); + }); + + test("hello world", async () => { + const input = "the quick brown fox jumped over the lazy dog"; + const output = await tokenizer.encode(input); + expect(output).toEqual([ + 1820, 4062, 14198, 39935, 27096, 927, 279, 16053, 5679, + ]); + const decoded = await tokenizer.decode(output); + expect(decoded).toBe(input); + }); +}); diff --git a/core/llm/asyncEncoder.ts b/core/llm/asyncEncoder.ts index 722664ead..5fd39eed6 100644 --- a/core/llm/asyncEncoder.ts +++ b/core/llm/asyncEncoder.ts @@ -1,26 +1,27 @@ -import llamaTokenizer from "./llamaTokenizer.js"; -import { Tiktoken, encodingForModel as _encodingForModel } from "js-tiktoken"; +import path from "path"; import workerpool from "workerpool"; -import * as path from "path"; export interface AsyncEncoder { encode(text: string): Promise; - decode(tokens: number[]): string; + decode(tokens: number[]): Promise; + close(): Promise; } export class LlamaAsyncEncoder implements AsyncEncoder { private workerPool: workerpool.Pool; constructor() { - this.workerPool = workerpool.pool(path.join(__dirname, "/llamaTokenizerWorkerPool.mjs")); + this.workerPool = workerpool.pool( + workerCodeFilePath("llamaTokenizerWorkerPool.mjs"), + ); } async encode(text: string): Promise { return this.workerPool.exec("encode", [text]); } - decode(tokens: number[]): string { - return llamaTokenizer.decode(tokens); + async decode(tokens: number[]): Promise { + return this.workerPool.exec("decode", [tokens]); } // TODO: this should be called somewhere before exit or potentially with a shutdown hook @@ -31,17 +32,32 @@ export class LlamaAsyncEncoder implements AsyncEncoder { // this class does not yet do anything asynchronous export class GPTAsyncEncoder implements AsyncEncoder { - private tiktokenEncoding: Tiktoken; + private workerPool: workerpool.Pool; constructor() { - this.tiktokenEncoding = _encodingForModel("gpt-4"); + this.workerPool = workerpool.pool( + workerCodeFilePath("tiktokenWorkerPool.mjs"), + ); } async encode(text: string): Promise { - return this.tiktokenEncoding.encode(text, "all", []); + return this.workerPool.exec("encode", [text]); } - decode(tokens: number[]): string { - return this.tiktokenEncoding.decode(tokens); + async decode(tokens: number[]): Promise { + return this.workerPool.exec("decode", [tokens]); } -} \ No newline at end of file + + // TODO: this should be called somewhere before exit or potentially with a shutdown hook + public async close(): Promise { + await this.workerPool.terminate(); + } +} + +function workerCodeFilePath(workerFileName: string): string { + if (process.env.NODE_ENV === "test") { + // `cross-env` seems to make it so __dirname is the root of the project and not the directory containing this file + return path.join(__dirname, "llm", workerFileName); + } + return path.join(__dirname, workerFileName); +} diff --git a/core/llm/autodetect.ts b/core/llm/autodetect.ts index 32ef68a3a..1696bd674 100644 --- a/core/llm/autodetect.ts +++ b/core/llm/autodetect.ts @@ -1,4 +1,4 @@ -import { ModelProvider, TemplateType } from "../index.js"; +import { ModelCapability, ModelProvider, TemplateType } from "../index.js"; import { anthropicTemplateMessages, chatmlTemplateMessages, @@ -42,6 +42,7 @@ const PROVIDER_HANDLES_TEMPLATING: ModelProvider[] = [ "msty", "anthropic", "bedrock", + "sagemaker", "continue-proxy", "mistral", ]; @@ -54,6 +55,7 @@ const PROVIDER_SUPPORTS_IMAGES: ModelProvider[] = [ "msty", "anthropic", "bedrock", + "sagemaker", "continue-proxy", ]; @@ -76,7 +78,9 @@ function modelSupportsImages( provider: ModelProvider, model: string, title: string | undefined, + capabilities: ModelCapability | undefined ): boolean { + if (capabilities?.uploadImage !== undefined) {return capabilities.uploadImage;} if (!PROVIDER_SUPPORTS_IMAGES.includes(provider)) { return false; } @@ -95,6 +99,7 @@ function modelSupportsImages( const PARALLEL_PROVIDERS: ModelProvider[] = [ "anthropic", "bedrock", + "sagemaker", "deepinfra", "gemini", "huggingface-inference-api", diff --git a/core/llm/constants.ts b/core/llm/constants.ts index a31dbbe3d..cc1866d4b 100644 --- a/core/llm/constants.ts +++ b/core/llm/constants.ts @@ -29,14 +29,14 @@ const CONTEXT_LENGTH_FOR_MODEL: { [name: string]: number } = { const TOKEN_BUFFER_FOR_SAFETY = 350; const PROXY_URL = "http://localhost:65433"; -const MAX_CHUNK_SIZE = 500; // 512 - buffer for safety (in case of differing tokenizers) +const DEFAULT_MAX_CHUNK_SIZE = 500; // 512 - buffer for safety (in case of differing tokenizers) export { CONTEXT_LENGTH_FOR_MODEL, DEFAULT_ARGS, DEFAULT_CONTEXT_LENGTH, + DEFAULT_MAX_CHUNK_SIZE, DEFAULT_MAX_TOKENS, - MAX_CHUNK_SIZE, PROXY_URL, TOKEN_BUFFER_FOR_SAFETY, }; diff --git a/core/llm/countTokens.ts b/core/llm/countTokens.ts index acc923d33..06cd4a3bb 100644 --- a/core/llm/countTokens.ts +++ b/core/llm/countTokens.ts @@ -1,10 +1,14 @@ import { Tiktoken, encodingForModel as _encodingForModel } from "js-tiktoken"; import { ChatMessage, MessageContent, MessagePart } from "../index.js"; +import { + AsyncEncoder, + GPTAsyncEncoder, + LlamaAsyncEncoder, +} from "./asyncEncoder.js"; import { autodetectTemplateType } from "./autodetect.js"; import { TOKEN_BUFFER_FOR_SAFETY } from "./constants.js"; -import llamaTokenizer from "./llamaTokenizer.js"; -import { AsyncEncoder, GPTAsyncEncoder, LlamaAsyncEncoder } from "./asyncEncoder.js"; import { stripImages } from "./images.js"; +import llamaTokenizer from "./llamaTokenizer.js"; interface Encoding { encode: Tiktoken["encode"]; decode: Tiktoken["decode"]; @@ -20,12 +24,32 @@ class LlamaEncoding implements Encoding { } } +class NonWorkerAsyncEncoder implements AsyncEncoder { + constructor(private readonly encoding: Encoding) {} + + async close(): Promise {} + + async encode(text: string): Promise { + return this.encoding.encode(text); + } + + async decode(tokens: number[]): Promise { + return this.encoding.decode(tokens); + } +} + let gptEncoding: Encoding | null = null; const gptAsyncEncoder = new GPTAsyncEncoder(); const llamaEncoding = new LlamaEncoding(); const llamaAsyncEncoder = new LlamaAsyncEncoder(); function asyncEncoderForModel(modelName: string): AsyncEncoder { + // Temporary due to issues packaging the worker files + if (process.env.IS_BINARY) { + const encoding = encodingForModel(modelName); + return new NonWorkerAsyncEncoder(encoding); + } + const modelType = autodetectTemplateType(modelName); if (!modelType || modelType === "none") { return gptAsyncEncoder; @@ -61,7 +85,7 @@ async function countTokensAsync( ): Promise { const encoding = asyncEncoderForModel(modelName); if (Array.isArray(content)) { - const promises = content.map(async part => { + const promises = content.map(async (part) => { if (part.type === "imageUrl") { return countImageTokens(part); } diff --git a/core/test/baseLLM.test.ts b/core/llm/index.test.ts similarity index 97% rename from core/test/baseLLM.test.ts rename to core/llm/index.test.ts index 9a6f4fc3d..926b61209 100644 --- a/core/test/baseLLM.test.ts +++ b/core/llm/index.test.ts @@ -1,5 +1,5 @@ -import { ChatMessage, LLMOptions, ModelProvider } from "../index"; -import { BaseLLM } from "../llm/index.js"; +import { ChatMessage, LLMOptions, ModelProvider } from ".."; +import { BaseLLM } from "."; class DummyLLM extends BaseLLM { static providerName: ModelProvider = "openai"; diff --git a/core/llm/index.ts b/core/llm/index.ts index 950c514fb..946ac9c47 100644 --- a/core/llm/index.ts +++ b/core/llm/index.ts @@ -7,6 +7,7 @@ import { ILLM, LLMFullCompletionOptions, LLMOptions, + ModelCapability, ModelName, ModelProvider, PromptLog, @@ -37,8 +38,8 @@ import { countTokens, pruneRawPromptFromTop, } from "./countTokens.js"; -import CompletionOptionsForModels from "./templates/options.js"; import { stripImages } from "./images.js"; +import CompletionOptionsForModels from "./templates/options.js"; export abstract class BaseLLM implements ILLM { static providerName: ModelProvider; @@ -53,7 +54,12 @@ export abstract class BaseLLM implements ILLM { } supportsImages(): boolean { - return modelSupportsImages(this.providerName, this.model, this.title); + return modelSupportsImages( + this.providerName, + this.model, + this.title, + this.capabilities, + ); } supportsCompletions(): boolean { @@ -85,6 +91,7 @@ export abstract class BaseLLM implements ILLM { title?: string; systemMessage?: string; contextLength: number; + maxStopWords?: number | undefined; completionOptions: CompletionOptions; requestOptions?: RequestOptions; template?: TemplateType; @@ -94,6 +101,7 @@ export abstract class BaseLLM implements ILLM { llmRequestHook?: (model: string, prompt: string) => any; apiKey?: string; apiBase?: string; + capabilities?: ModelCapability; engine?: string; apiVersion?: string; @@ -103,6 +111,15 @@ export abstract class BaseLLM implements ILLM { accountId?: string; aiGatewaySlug?: string; + // For IBM watsonx only. + watsonxUrl?: string; + watsonxCreds?: string; + watsonxProjectId?: string; + watsonxStopToken?: string; + watsonxApiVersion?: string; + + cacheSystemMessage?: boolean; + private _llmOptions: LLMOptions; constructor(_options: LLMOptions) { @@ -126,6 +143,7 @@ export abstract class BaseLLM implements ILLM { this.systemMessage = options.systemMessage; this.contextLength = options.contextLength ?? llmInfo?.contextLength ?? DEFAULT_CONTEXT_LENGTH; + this.maxStopWords = options.maxStopWords ?? this.maxStopWords; this.completionOptions = { ...options.completionOptions, model: options.model || "gpt-4", @@ -154,10 +172,21 @@ export abstract class BaseLLM implements ILLM { this.apiKey = options.apiKey; this.aiGatewaySlug = options.aiGatewaySlug; this.apiBase = options.apiBase; + + // for watsonx only + this.watsonxUrl = options.watsonxUrl; + this.watsonxCreds = options.watsonxCreds; + this.watsonxProjectId = options.watsonxProjectId; + this.watsonxStopToken = options.watsonxStopToken; + this.watsonxApiVersion = options.watsonxApiVersion; + + this.cacheSystemMessage = options.cacheSystemMessage; + if (this.apiBase && !this.apiBase.endsWith("/")) { this.apiBase = `${this.apiBase}/`; } this.accountId = options.accountId; + this.capabilities = options.capabilities; this.engine = options.engine; this.apiVersion = options.apiVersion; @@ -445,7 +474,12 @@ ${prompt}`; await this.writeLog(`Completion:\n\n${completion}\n\n`); } - return { prompt, completion, completionOptions }; + return { + modelTitle: this.title ?? completionOptions.model, + prompt, + completion, + completionOptions, + }; } async complete(_prompt: string, options: LLMFullCompletionOptions = {}) { @@ -542,6 +576,7 @@ ${prompt}`; } return { + modelTitle: this.title ?? completionOptions.model, prompt, completion, completionOptions, diff --git a/core/llm/llamaTokenizerWorkerPool.mjs b/core/llm/llamaTokenizerWorkerPool.mjs index 2131f4a1a..1ef82c872 100644 --- a/core/llm/llamaTokenizerWorkerPool.mjs +++ b/core/llm/llamaTokenizerWorkerPool.mjs @@ -5,6 +5,11 @@ function encode(segment) { return llamaTokenizer.encode(segment); } +function decode(tokens) { + return llamaTokenizer.decode(tokens); +} + workerpool.worker({ + decode, encode, }); \ No newline at end of file diff --git a/core/llm/llms/Anthropic.ts b/core/llm/llms/Anthropic.ts index 918c9338a..320dd9798 100644 --- a/core/llm/llms/Anthropic.ts +++ b/core/llm/llms/Anthropic.ts @@ -75,6 +75,9 @@ class Anthropic extends BaseLLM { messages: ChatMessage[], options: CompletionOptions, ): AsyncGenerator { + const shouldCacheSystemMessage = + !!this.systemMessage && !!this.cacheSystemMessage; + const response = await this.fetch(new URL("messages", this.apiBase), { method: "POST", headers: { @@ -82,11 +85,22 @@ class Anthropic extends BaseLLM { Accept: "application/json", "anthropic-version": "2023-06-01", "x-api-key": this.apiKey as string, + ...(shouldCacheSystemMessage + ? { "anthropic-beta": "prompt-caching-2024-07-31" } + : {}), }, body: JSON.stringify({ ...this._convertArgs(options), messages: this._convertMessages(messages), - system: this.systemMessage, + system: shouldCacheSystemMessage + ? [ + { + type: "text", + text: this.systemMessage, + cache_control: { type: "ephemeral" }, + }, + ] + : this.systemMessage, }), }); diff --git a/core/llm/llms/Bedrock.ts b/core/llm/llms/Bedrock.ts index 060deb198..415ec0f10 100644 --- a/core/llm/llms/Bedrock.ts +++ b/core/llm/llms/Bedrock.ts @@ -1,6 +1,6 @@ import { BedrockRuntimeClient, - InvokeModelWithResponseStreamCommand, + ConverseStreamCommand, } from "@aws-sdk/client-bedrock-runtime"; import { fromIni } from "@aws-sdk/credential-providers"; import { @@ -14,19 +14,24 @@ import { stripImages } from "../images.js"; import { BaseLLM } from "../index.js"; class Bedrock extends BaseLLM { - private static PROFILE_NAME: string = "bedrock"; static providerName: ModelProvider = "bedrock"; static defaultOptions: Partial = { region: "us-east-1", - model: "claude-3-sonnet-20240229", - contextLength: 200_000, + model: "anthropic.claude-3-sonnet-20240229-v1:0", + contextLength: 200_000 }; + profile?: string | undefined; constructor(options: LLMOptions) { super(options); if (!options.apiBase) { this.apiBase = `https://bedrock-runtime.${options.region}.amazonaws.com`; } + if (options.profile) { + this.profile = options.profile; + } else { + this.profile = "bedrock"; + } } protected async *_streamComplete( @@ -52,164 +57,87 @@ class Bedrock extends BaseLLM { sessionToken: credentials.sessionToken || "", }, }); - const toolkit = this._getToolkit(options.model); - const command = toolkit.generateCommand(messages, options); + + const input = this._generateConverseInput(messages, options); + const command = new ConverseStreamCommand(input); const response = await client.send(command); - if (response.body) { - for await (const value of response.body) { - const text = toolkit.unwrapResponseChunk(value); - if (text) { - yield { role: "assistant", content: text }; + + if (response.stream) { + for await (const chunk of response.stream) { + if (chunk.contentBlockDelta?.delta?.text) { + yield { + role: "assistant", + content: chunk.contentBlockDelta.delta.text, + }; } } } } + private _generateConverseInput( + messages: ChatMessage[], + options: CompletionOptions, + ): any { + const convertedMessages = this._convertMessages(messages); + + return { + modelId: options.model, + messages: convertedMessages, + system: this.systemMessage ? [{ text: this.systemMessage }] : undefined, + inferenceConfig: { + maxTokens: options.maxTokens, + temperature: options.temperature, + topP: options.topP, + stopSequences: options.stop?.filter((stop) => stop.trim() !== ""), + }, + }; + } + + private _convertMessages(messages: ChatMessage[]): any[] { + return messages + .filter((message) => message.role !== "system") + .map((message) => ({ + role: message.role, + content: this._convertMessageContent(message.content), + })); + } + + private _convertMessageContent(messageContent: MessageContent): any[] { + if (typeof messageContent === "string") { + return [{ text: messageContent }]; + } + return messageContent + .map((part) => { + if (part.type === "text") { + return { text: part.text }; + } + if (part.type === "imageUrl" && part.imageUrl) { + return { + image: { + format: "jpeg", + source: { + bytes: Buffer.from(part.imageUrl.url.split(",")[1], "base64"), + }, + }, + }; + } + return null; + }) + .filter(Boolean); + } + private async _getCredentials() { try { return await fromIni({ - profile: Bedrock.PROFILE_NAME, + profile: this.profile, })(); } catch (e) { console.warn( - `AWS profile with name ${Bedrock.PROFILE_NAME} not found in ~/.aws/credentials, using default profile`, + `AWS profile with name ${this.profile} not found in ~/.aws/credentials, using default profile`, ); return await fromIni()(); } } - - private _getToolkit(model: string): BedrockModelToolkit { - if (model.includes("claude-3")) { - return new AnthropicClaude3Toolkit(this); - } else if (model.includes("llama")) { - return new Llama3Toolkit(this); - } else { - throw new Error( - `Model ${model} is currently not supported in Continue for Bedrock`, - ); - } - } -} - -interface BedrockModelToolkit { - generateCommand( - messages: ChatMessage[], - options: CompletionOptions, - ): InvokeModelWithResponseStreamCommand; - unwrapResponseChunk(rawValue: any): string; -} - -class AnthropicClaude3Toolkit implements BedrockModelToolkit { - constructor(private bedrock: Bedrock) {} - generateCommand( - messages: ChatMessage[], - options: CompletionOptions, - ): InvokeModelWithResponseStreamCommand { - const payload = { - anthropic_version: "bedrock-2023-05-31", - max_tokens: options.maxTokens, - system: this.bedrock.systemMessage, - messages: this._convertMessages(messages), - temperature: options.temperature, - top_p: options.topP, - top_k: options.topK, - // each stop sequence must contain non-whitespace - stop_sequences: options.stop?.filter((stop) => stop.trim() !== ""), - }; - return new InvokeModelWithResponseStreamCommand({ - body: new TextEncoder().encode(JSON.stringify(payload)), - contentType: "application/json", - modelId: options.model, - }); - } - - private _convertMessages(msgs: ChatMessage[]): any[] { - return msgs - .filter((m) => m.role !== "system") - .map((message) => this._convertMessage(message)); - } - - private _convertMessage(message: ChatMessage): any { - return { - role: message.role, - content: this._convertMessageContent(message.content), - }; - } - - private _convertMessageContent(messageContent: MessageContent): any { - if (typeof messageContent === "string") { - return messageContent; - } - return messageContent.map((part) => { - if (part.type === "text") { - return part; - } - return { - type: "image", - source: { - type: "base64", - media_type: "image/jpeg", - data: part.imageUrl?.url.split(",")[1], - }, - }; - }); - } - unwrapResponseChunk(rawValue: any): string { - const binaryChunk = rawValue.chunk?.bytes; - const textChunk = new TextDecoder().decode(binaryChunk); - const chunk = JSON.parse(textChunk).delta?.text; - return chunk; - } -} - -class Llama3Toolkit implements BedrockModelToolkit { - constructor(private bedrock: Bedrock) {} - generateCommand( - messages: ChatMessage[], - options: CompletionOptions, - ): InvokeModelWithResponseStreamCommand { - let prompt = "<|begin_of_text|>"; - if (this.bedrock.systemMessage) { - prompt += `<|start_header_id|>system<|end_header_id|>${this.bedrock.systemMessage}<|eot_id|>`; - } - for (const message of messages) { - let content = ""; - if (typeof message.content === "string") { - content = message.content; - } else { - for (const part of message.content) { - if (part.type === "text") { - content += part.text || ""; - } else { - console.warn("Skipping non-text message part", part); - } - } - } - if (content) { - prompt += `<|start_header_id|>${message.role}<|end_header_id|>${content}<|eot_id|>`; - } - } - prompt += "<|start_header_id|>assistant<|end_header_id|>"; - - const payload = { - prompt, - max_gen_len: options.maxTokens, - temperature: options.temperature, - top_p: options.topP, - }; - - return new InvokeModelWithResponseStreamCommand({ - body: new TextEncoder().encode(JSON.stringify(payload)), - contentType: "application/json", - modelId: options.model, - }); - } - unwrapResponseChunk(rawValue: any): string { - const binaryChunk = rawValue.chunk?.bytes; - const textChunk = new TextDecoder().decode(binaryChunk); - const chunk = JSON.parse(textChunk).generation; - return chunk; - } } export default Bedrock; diff --git a/core/llm/llms/BedrockImport.ts b/core/llm/llms/BedrockImport.ts new file mode 100644 index 000000000..f53d4b15e --- /dev/null +++ b/core/llm/llms/BedrockImport.ts @@ -0,0 +1,96 @@ +import { + BedrockRuntimeClient, + InvokeModelWithResponseStreamCommand, +} from "@aws-sdk/client-bedrock-runtime"; +import { fromIni } from "@aws-sdk/credential-providers"; +import { + CompletionOptions, + LLMOptions, + ModelProvider, +} from "../../index.js"; +import { BaseLLM } from "../index.js"; + +class BedrockImport extends BaseLLM { + static providerName: ModelProvider = "bedrockimport"; + static defaultOptions: Partial = { + region: "us-east-1" + }; + // the BedRock imported custom model ARN + modelArn?: string | undefined; + profile?: string | undefined; + + constructor(options: LLMOptions) { + super(options); + if (!options.apiBase) { + this.apiBase = `https://bedrock-runtime.${options.region}.amazonaws.com`; + } + if (options.modelArn) { + this.modelArn = options.modelArn; + } + if (options.profile) { + this.profile = options.profile; + } else { + this.profile = "bedrock"; + } + } + + protected async *_streamComplete( + prompt: string, + options: CompletionOptions, + ): AsyncGenerator { + const credentials = await this._getCredentials(); + const client = new BedrockRuntimeClient({ + region: this.region, + credentials: { + accessKeyId: credentials.accessKeyId, + secretAccessKey: credentials.secretAccessKey, + sessionToken: credentials.sessionToken || "", + }, + }); + + const input = this._generateInvokeModelCommandInput(prompt, options); + const command = new InvokeModelWithResponseStreamCommand(input); + const response = await client.send(command); + + if (response.body) { + for await (const item of response.body) { + const chunk = JSON.parse(new TextDecoder().decode(item.chunk?.bytes)); + if (chunk.outputs[0].text) { + yield chunk.outputs[0].text; + } + } + } + } + + private _generateInvokeModelCommandInput( + prompt: string, + options: CompletionOptions, + ): any { + const payload = { + prompt: prompt + }; + + return { + body: JSON.stringify(payload), + modelId: this.modelArn, + accept: "application/json", + contentType: "application/json" + }; + } + + private async _getCredentials() { + try { + return await + fromIni({ + profile: this.profile + })(); + } catch (e) { + console.warn( + `AWS profile with name ${this.profile} not found in ~/.aws/credentials, using default profile`, + ); + return await fromIni()(); + } + } +} + +export default BedrockImport; diff --git a/core/llm/llms/Deepseek.ts b/core/llm/llms/Deepseek.ts index 48dc9e61b..105a2e20c 100644 --- a/core/llm/llms/Deepseek.ts +++ b/core/llm/llms/Deepseek.ts @@ -1,4 +1,5 @@ -import { LLMOptions, ModelProvider } from "../../index.js"; +import { CompletionOptions, LLMOptions, ModelProvider } from "../../index.js"; +import { streamSse } from "../stream.js"; import { osModelsEditPrompt } from "../templates/edit.js"; import OpenAI from "./OpenAI.js"; @@ -12,7 +13,42 @@ class Deepseek extends OpenAI { }, useLegacyCompletionsEndpoint: false, }; - protected maxStopWords: number | undefined = 16; + maxStopWords: number | undefined = 16; + + supportsFim(): boolean { + return true; + } + + async *_streamFim( + prefix: string, + suffix: string, + options: CompletionOptions, + ): AsyncGenerator { + const endpoint = new URL("beta/completions", this.apiBase); + const resp = await this.fetch(endpoint, { + method: "POST", + body: JSON.stringify({ + model: options.model, + prompt: prefix, + suffix, + max_tokens: options.maxTokens, + temperature: options.temperature, + top_p: options.topP, + frequency_penalty: options.frequencyPenalty, + presence_penalty: options.presencePenalty, + stop: options.stop, + stream: true, + }), + headers: { + "Content-Type": "application/json", + Accept: "application/json", + Authorization: `Bearer ${this.apiKey}`, + }, + }); + for await (const chunk of streamSse(resp)) { + yield chunk.choices[0].text; + } + } } export default Deepseek; diff --git a/core/llm/llms/FreeTrial.ts b/core/llm/llms/FreeTrial.ts index e4c1674e6..10632b90f 100644 --- a/core/llm/llms/FreeTrial.ts +++ b/core/llm/llms/FreeTrial.ts @@ -2,7 +2,6 @@ import { TRIAL_FIM_MODEL } from "../../config/onboarding.js"; import { getHeaders } from "../../continueServer/stubs/headers.js"; import { constants } from "../../deploy/constants.js"; import { ChatMessage, CompletionOptions, ModelProvider } from "../../index.js"; -import { Telemetry } from "../../util/posthog.js"; import { BaseLLM } from "../index.js"; import { streamResponse } from "../stream.js"; @@ -29,18 +28,19 @@ class FreeTrial extends BaseLLM { } private async _countTokens(prompt: string, model: string, isPrompt: boolean) { - if (!Telemetry.client) { - throw new Error( - 'In order to use the free trial, telemetry must be enabled so that we can monitor abuse. To enable telemetry, set "allowAnonymousTelemetry": true in config.json and make sure the box is checked in IDE settings. If you use your own model (local or API key), telemetry will never be required.', - ); - } - const event = isPrompt - ? "free_trial_prompt_tokens" - : "free_trial_completion_tokens"; - Telemetry.capture(event, { - tokens: this.countTokens(prompt), - model, - }); + // Removed to reduce PostHog bill + // if (!Telemetry.client) { + // throw new Error( + // "In order to use the free trial, telemetry must be enabled so that we can monitor abuse. To enable telemetry, set \"allowAnonymousTelemetry\": true in config.json and make sure the box is checked in IDE settings. If you use your own model (local or API key), telemetry will never be required.", + // ); + // } + // const event = isPrompt + // ? "free_trial_prompt_tokens" + // : "free_trial_completion_tokens"; + // Telemetry.capture(event, { + // tokens: this.countTokens(prompt), + // model, + // }); } private _convertArgs(options: CompletionOptions): any { diff --git a/core/llm/llms/Gemini.ts b/core/llm/llms/Gemini.ts index 9a33f06a4..0b55fd656 100644 --- a/core/llm/llms/Gemini.ts +++ b/core/llm/llms/Gemini.ts @@ -202,7 +202,7 @@ class Gemini extends BaseLLM { } } else { // Handle the case where the expected data structure is not found - console.warn('Unexpected response format:', data); + console.warn("Unexpected response format:", data); } } if (foundIncomplete) { diff --git a/core/llm/llms/Groq.ts b/core/llm/llms/Groq.ts index 27c51e1e3..7115bcc32 100644 --- a/core/llm/llms/Groq.ts +++ b/core/llm/llms/Groq.ts @@ -6,7 +6,7 @@ class Groq extends OpenAI { static defaultOptions: Partial = { apiBase: "https://api.groq.com/openai/v1/", }; - protected maxStopWords: number | undefined = 4; + maxStopWords: number | undefined = 4; private static modelConversion: { [key: string]: string } = { "llama2-70b": "llama2-70b-4096", diff --git a/core/llm/llms/Kindo.ts b/core/llm/llms/Kindo.ts new file mode 100644 index 000000000..855e386de --- /dev/null +++ b/core/llm/llms/Kindo.ts @@ -0,0 +1,16 @@ +import { LLMOptions, ModelProvider } from "../.."; +import OpenAI from "./OpenAI"; + +class Kindo extends OpenAI { + static providerName: ModelProvider = "kindo"; + static defaultOptions: Partial = { + apiBase: "https://llm.kindo.ai/v1", + requestOptions: { + headers: { + "kindo-token-transaction-type": "CONTINUE" + } + } + }; +} + +export default Kindo; \ No newline at end of file diff --git a/core/llm/llms/Mistral.ts b/core/llm/llms/Mistral.ts index 95208bb8c..992e650c7 100644 --- a/core/llm/llms/Mistral.ts +++ b/core/llm/llms/Mistral.ts @@ -20,6 +20,10 @@ class Mistral extends OpenAI { ) { this.apiBase = options.apiBase ?? "https://codestral.mistral.ai/v1/"; } + + if (!this.apiBase?.endsWith("/")) { + this.apiBase += "/"; + } } private static modelConversion: { [key: string]: string } = { diff --git a/core/llm/llms/Msty.ts b/core/llm/llms/Msty.ts index 2f126ad13..bb1b69b1b 100644 --- a/core/llm/llms/Msty.ts +++ b/core/llm/llms/Msty.ts @@ -1,5 +1,5 @@ -import Ollama from "./Ollama"; -import {LLMOptions, ModelProvider} from "../../index"; +import { LLMOptions, ModelProvider } from "../../index.js"; +import Ollama from "./Ollama.js"; class Msty extends Ollama { static providerName: ModelProvider = "msty"; diff --git a/core/llm/llms/Ollama.ts b/core/llm/llms/Ollama.ts index fe2eb6d6a..f830b7f0f 100644 --- a/core/llm/llms/Ollama.ts +++ b/core/llm/llms/Ollama.ts @@ -50,7 +50,8 @@ class Ollama extends BaseLLM { let value = parts[2]; switch (key) { case "num_ctx": - this.contextLength = Number.parseInt(value); + this.contextLength = + options.contextLength ?? Number.parseInt(value); break; case "stop": if (!this.completionOptions.stop) { @@ -60,7 +61,7 @@ class Ollama extends BaseLLM { this.completionOptions.stop.push(JSON.parse(value)); } catch (e) { console.warn( - 'Error parsing stop parameter value "{value}: ${e}', + "Error parsing stop parameter value \"{value}: ${e}", ); } break; @@ -106,6 +107,10 @@ class Ollama extends BaseLLM { "starcoder-3b": "starcoder:3b", "starcoder2-3b": "starcoder2:3b", "stable-code-3b": "stable-code:3b", + "granite-code-3b": "granite-code:3b", + "granite-code-8b": "granite-code:8b", + "granite-code-20b": "granite-code:20b", + "granite-code-34b": "granite-code:34b", }[this.model] ?? this.model ); } diff --git a/core/llm/llms/OpenAI.ts b/core/llm/llms/OpenAI.ts index 366f6bd60..4a7477102 100644 --- a/core/llm/llms/OpenAI.ts +++ b/core/llm/llms/OpenAI.ts @@ -42,7 +42,7 @@ const CHAT_ONLY_MODELS = [ class OpenAI extends BaseLLM { public useLegacyCompletionsEndpoint: boolean | undefined = undefined; - protected maxStopWords: number | undefined = undefined; + maxStopWords: number | undefined = undefined; constructor(options: LLMOptions) { super(options); @@ -139,7 +139,7 @@ class OpenAI extends BaseLLM { return completion; } - private _getEndpoint( + protected _getEndpoint( endpoint: "chat/completions" | "completions" | "models", ) { if (this.apiType === "azure") { diff --git a/core/llm/llms/OpenRouter.ts b/core/llm/llms/OpenRouter.ts new file mode 100644 index 000000000..d01a19ec5 --- /dev/null +++ b/core/llm/llms/OpenRouter.ts @@ -0,0 +1,17 @@ +import { LLMOptions, ModelProvider } from "../../index.js"; +import { osModelsEditPrompt } from "../templates/edit.js"; +import OpenAI from "./OpenAI.js"; + +class OpenRouter extends OpenAI { + static providerName: ModelProvider = "openrouter"; + static defaultOptions: Partial = { + apiBase: "https://openrouter.ai/api/v1/", + model: "gpt-4o-mini", + promptTemplates: { + edit: osModelsEditPrompt, + }, + useLegacyCompletionsEndpoint: false, + }; +} + +export default OpenRouter; diff --git a/core/llm/llms/SageMaker.ts b/core/llm/llms/SageMaker.ts new file mode 100644 index 000000000..a59de352c --- /dev/null +++ b/core/llm/llms/SageMaker.ts @@ -0,0 +1,205 @@ +import { + InvokeEndpointWithResponseStreamCommand, + SageMakerRuntimeClient +} from "@aws-sdk/client-sagemaker-runtime"; +import { fromIni } from "@aws-sdk/credential-providers"; + +// @ts-ignore +import jinja from "jinja-js"; + +import { + ChatMessage, + CompletionOptions, + LLMOptions, + ModelProvider +} from "../../index.js"; +import { BaseLLM } from "../index.js"; + +class SageMaker extends BaseLLM { + private static PROFILE_NAME: string = "sagemaker"; + static providerName: ModelProvider = "sagemaker"; + static defaultOptions: Partial = { + region: "us-west-2", + contextLength: 200_000, + }; + + constructor(options: LLMOptions) { + super(options); + if (!options.apiBase) { + this.apiBase = `https://runtime.sagemaker.${options.region}.amazonaws.com`; + } + } + + protected async *_streamComplete( + prompt: string, + options: CompletionOptions, + ): AsyncGenerator { + const credentials = await this._getCredentials(); + const client = new SageMakerRuntimeClient({ + region: this.region, + credentials: { + accessKeyId: credentials.accessKeyId, + secretAccessKey: credentials.secretAccessKey, + sessionToken: credentials.sessionToken || "", + }, + }); + const toolkit = new CompletionAPIToolkit(this); + const command = toolkit.generateCommand([], prompt, options); + const response = await client.send(command); + if (response.Body) { + let buffer = ""; + for await (const rawValue of response.Body) { + const binaryChunk = rawValue.PayloadPart?.Bytes; + let value = new TextDecoder().decode(binaryChunk); + buffer += value; + let position; + while ((position = buffer.indexOf("\n")) >= 0) { + const line = buffer.slice(0, position); + const data = JSON.parse(line.replace(/^data:/, "")); + if ("choices" in data) { + yield data.choices[0].delta.content; + } + else if ("token" in data) { + yield data.token.text; + } + buffer = buffer.slice(position + 1); + } + } + } + } + + protected async *_streamChat( + messages: ChatMessage[], + options: CompletionOptions, + ): AsyncGenerator { + const credentials = await this._getCredentials(); + const client = new SageMakerRuntimeClient({ + region: this.region, + credentials: { + accessKeyId: credentials.accessKeyId, + secretAccessKey: credentials.secretAccessKey, + sessionToken: credentials.sessionToken || "", + }, + }); + const toolkit = new MessageAPIToolkit(this); + + const command = toolkit.generateCommand(messages, "", options); + const response = await client.send(command); + if (response.Body) { + let buffer = ""; + for await (const rawValue of response.Body) { + const binaryChunk = rawValue.PayloadPart?.Bytes; + let value = new TextDecoder().decode(binaryChunk); + buffer += value; + let position; + while ((position = buffer.indexOf("\n")) >= 0) { + const line = buffer.slice(0, position); + const data = JSON.parse(line.replace(/^data:/, "")); + if ("choices" in data) { + yield { role: "assistant", content: data.choices[0].delta.content }; + } + else if ("token" in data) { + yield { role: "assistant", content: data.token.text }; + } + buffer = buffer.slice(position + 1); + } + } + } + } + + private async _getCredentials() { + try { + return await fromIni({ + profile: SageMaker.PROFILE_NAME, + })(); + } catch (e) { + console.warn( + `AWS profile with name ${SageMaker.PROFILE_NAME} not found in ~/.aws/credentials, using default profile`, + ); + return await fromIni()(); + } + } + +} + +interface SageMakerModelToolkit { + generateCommand( + messages: ChatMessage[], + prompt: string, + options: CompletionOptions, + ): InvokeEndpointWithResponseStreamCommand; +} + +class MessageAPIToolkit implements SageMakerModelToolkit { + constructor(private sagemaker: SageMaker) { } + generateCommand( + messages: ChatMessage[], + prompt: string, + options: CompletionOptions, + ): InvokeEndpointWithResponseStreamCommand { + + if ("chat_template" in this.sagemaker.completionOptions) { + // for some model you can apply chat_template to the model + let prompt = jinja.compile(this.sagemaker.completionOptions.chat_template).render( + { messages: messages, add_generation_prompt: true }, + { autoEscape: false } + ); + const payload = { + inputs: prompt, + parameters: this.sagemaker.completionOptions, + stream: true, + }; + + return new InvokeEndpointWithResponseStreamCommand({ + EndpointName: options.model, + Body: new TextEncoder().encode(JSON.stringify(payload)), + ContentType: "application/json", + CustomAttributes: "accept_eula=false", + }); + } + else { + const payload = { + messages: messages, + max_tokens: options.maxTokens, + temperature: options.temperature, + top_p: options.topP, + top_k: options.topK, + stop: options.stop, + frequencyPenalty: options.frequencyPenalty, + presencePenalty: options.presencePenalty, + stream: true, + }; + + return new InvokeEndpointWithResponseStreamCommand({ + EndpointName: options.model, + Body: new TextEncoder().encode(JSON.stringify(payload)), + ContentType: "application/json", + CustomAttributes: "accept_eula=false", + }); + } + + } +} +class CompletionAPIToolkit implements SageMakerModelToolkit { + constructor(private sagemaker: SageMaker) { } + generateCommand( + messages: ChatMessage[], + prompt: string, + options: CompletionOptions, + ): InvokeEndpointWithResponseStreamCommand { + const payload = { + inputs: prompt, + parameters: this.sagemaker.completionOptions, + stream: true, + }; + + return new InvokeEndpointWithResponseStreamCommand({ + EndpointName: options.model, + Body: new TextEncoder().encode(JSON.stringify(payload)), + ContentType: "application/json", + CustomAttributes: "accept_eula=false", + }); + } +} + +export default SageMaker; diff --git a/core/llm/llms/Vllm.ts b/core/llm/llms/Vllm.ts new file mode 100644 index 000000000..d0ad32816 --- /dev/null +++ b/core/llm/llms/Vllm.ts @@ -0,0 +1,30 @@ +import { LLMOptions, ModelProvider } from "../../index.js"; +import OpenAI from "./OpenAI.js"; + +class Vllm extends OpenAI { + constructor(options: LLMOptions) { + super(options); + this._setupCompletionOptions(); + } + + private _setupCompletionOptions() { + this.fetch(this._getEndpoint("models"), { + method: "GET", + headers: this._getHeaders(), + }).then(async (response) => { + if (response.status !== 200) { + console.warn( + "Error calling vLLM /models endpoint: ", + await response.text(), + ); + return; + } + const json = await response.json(); + const data = json.data; + this.model = data.id; + this.contextLength = Number.parseInt(data.max_model_len); + }); + } +} + +export default Vllm; diff --git a/core/llm/llms/WatsonX.ts b/core/llm/llms/WatsonX.ts new file mode 100644 index 000000000..68dfef47c --- /dev/null +++ b/core/llm/llms/WatsonX.ts @@ -0,0 +1,253 @@ +import { + ChatMessage, + CompletionOptions, + LLMOptions, + ModelProvider, +} from "../../index.js"; +import { stripImages } from "../images.js"; +import { BaseLLM } from "../index.js"; +import { streamResponse } from "../stream.js"; +const watsonxConfig = { + accessToken: { + expiration: 0, + token: "", + }, +}; +class WatsonX extends BaseLLM { + maxStopWords: number | undefined = undefined; + + constructor(options: LLMOptions) { + super(options); + } + async getBearerToken(): Promise<{ token: string; expiration: number }> { + + if ( + this.watsonxUrl?.includes("cloud.ibm.com") + ) { + // watsonx SaaS + const wxToken = await ( + await fetch( + `https://iam.cloud.ibm.com/identity/token?apikey=${this.watsonxCreds}&grant_type=urn:ibm:params:oauth:grant-type:apikey`, + { + method: "POST", + headers: { + "Content-Type": "application/x-www-form-urlencoded", + Accept: "application/json", + }, + }, + ) + ).json(); + return { + token: wxToken["access_token"], + expiration: wxToken["expiration"], + }; + } else { + // watsonx Software + if ( + !this.watsonxCreds?.includes(":") + ) { + // Using ZenApiKey auth + return { + token: this.watsonxCreds ?? "", + expiration: -1, + }; + } else { + // Using username/password auth + const userPass = this.watsonxCreds?.split(":"); + const wxToken = await ( + await fetch(`${this.watsonxUrl}/icp4d-api/v1/authorize`, { + method: "POST", + headers: { + "Content-Type": "application/json", + Accept: "application/json", + }, + body: JSON.stringify({ + username: userPass[0], + password: userPass[1], + }), + }) + ).json(); + const wxTokenExpiry = await ( + await fetch(`${this.watsonxUrl}/usermgmt/v1/user/tokenExpiry`, { + method: "GET", + headers: { + Accept: "application/json", + Authorization: `Bearer ${wxToken["token"]}`, + }, + }) + ).json(); + return { + token: wxToken["token"], + expiration: wxTokenExpiry["exp"], + }; + } + } + } + + static providerName: ModelProvider = "watsonx"; + + protected _convertMessage(message: ChatMessage) { + if (typeof message.content === "string") { + return message; + } + + const parts = message.content.map((part) => { + const msg: any = { + type: part.type, + text: part.text, + }; + if (part.type === "imageUrl") { + msg.image_url = { ...part.imageUrl, detail: "low" }; + msg.type = "image_url"; + } + return msg; + }); + return { + ...message, + content: parts, + }; + } + + protected _convertModelName(model: string): string { + return model; + } + + protected _convertArgs(options: any, messages: ChatMessage[]) { + const finalOptions = { + messages: messages.map(this._convertMessage), + model: this._convertModelName(options.model), + max_tokens: options.maxTokens, + temperature: options.temperature, + top_p: options.topP, + frequency_penalty: options.frequencyPenalty, + presence_penalty: options.presencePenalty, + }; + return finalOptions; + } + + protected _getHeaders() { + return { + "Content-Type": "application/json", + Authorization: `${ + watsonxConfig.accessToken.expiration === -1 ? "ZenApiKey" : "Bearer" + } ${watsonxConfig.accessToken.token}`, + }; + } + + protected async _complete( + prompt: string, + options: CompletionOptions, + ): Promise { + let completion = ""; + for await (const chunk of this._streamChat( + [{ role: "user", content: prompt }], + options, + )) { + completion += chunk.content; + } + + return completion; + } + + protected async *_streamComplete( + prompt: string, + options: CompletionOptions, + ): AsyncGenerator { + for await (const chunk of this._streamChat( + [{ role: "user", content: prompt }], + options, + )) { + yield stripImages(chunk.content); + } + } + + protected async *_streamChat( + messages: ChatMessage[], + options: CompletionOptions, + ): AsyncGenerator { + var now = new Date().getTime() / 1000; + if ( + watsonxConfig.accessToken === undefined || + now > watsonxConfig.accessToken.expiration || + watsonxConfig.accessToken.token === undefined + ) { + watsonxConfig.accessToken = await this.getBearerToken(); + } else { + console.log( + `Reusing token (expires in ${ + (watsonxConfig.accessToken.expiration - now) / 60 + } mins)`, + ); + } + if (watsonxConfig.accessToken.token === undefined) { + throw new Error("Something went wrong. Check your credentials, please."); + } + + const stopToken = + this.watsonxStopToken ?? + (options.model?.includes("granite") ? "<|im_end|>" : undefined); + var response = await this.fetch( + `${this.watsonxUrl}/ml/v1/text/generation_stream?version=${this.watsonxApiVersion}`, + { + method: "POST", + headers: { + "Content-Type": "application/json", + Authorization: `${ + watsonxConfig.accessToken.expiration === -1 ? "ZenApiKey" : "Bearer" + } ${watsonxConfig.accessToken.token}`, + }, + body: JSON.stringify({ + input: messages[messages.length - 1].content, + parameters: { + decoding_method: "greedy", + max_new_tokens: options.maxTokens ?? 1024, + min_new_tokens: 1, + stop_sequences: stopToken ? [stopToken] : [], + include_stop_sequence: false, + repetition_penalty: 1, + }, + model_id: options.model, + project_id: this.watsonxProjectId + }), + }, + ); + + if (!response.ok || response.body === null) { + throw new Error( + "Something went wrong. No response received, check your connection", + ); + } else { + for await (const value of streamResponse(response)) { + + const lines = value.split("\n"); + let generatedChunk = ""; + let generatedTextIndex = undefined; + lines.forEach((el: string) => { + // console.log(`${el}`); + if (el.startsWith("id:")) { + generatedTextIndex = parseInt(el.replace(/^id:\s+/, "")); + if (isNaN(generatedTextIndex)) { + console.error(`Unable to parse stream chunk ID: ${el}`); + } + } else if (el.startsWith("data:")) { + const dataStr = el.replace(/^data:\s+/, ""); + try { + const data = JSON.parse(dataStr); + data.results.forEach((result: any) => { + generatedChunk += result.generated_text || ""; + }); + } catch (e) { + console.error(`Error parsing JSON string: ${dataStr}`, e); + } + } + }); + yield { + role: "assistant", + content: generatedChunk, + }; + } + } + } +} + +export default WatsonX; diff --git a/core/llm/llms/index.ts b/core/llm/llms/index.ts index 20f77c850..84c23c9bb 100644 --- a/core/llm/llms/index.ts +++ b/core/llm/llms/index.ts @@ -1,104 +1,43 @@ -import Handlebars from "handlebars"; -import { v4 as uuidv4 } from "uuid"; import { BaseCompletionOptions, IdeSettings, ILLM, LLMOptions, ModelDescription, -} from "../../index.js"; -import { DEFAULT_MAX_TOKENS } from "../constants.js"; -import { BaseLLM } from "../index.js"; -import Anthropic from "./Anthropic.js"; -import Bedrock from "./Bedrock.js"; -import Cloudflare from "./Cloudflare.js"; -import Cohere from "./Cohere.js"; -import DeepInfra from "./DeepInfra.js"; -import Deepseek from "./Deepseek.js"; -import Fireworks from "./Fireworks.js"; -import Flowise from "./Flowise.js"; -import FreeTrial from "./FreeTrial.js"; -import Gemini from "./Gemini.js"; -import Groq from "./Groq.js"; -import HuggingFaceInferenceAPI from "./HuggingFaceInferenceAPI.js"; -import HuggingFaceTGI from "./HuggingFaceTGI.js"; -import LMStudio from "./LMStudio.js"; -import LlamaCpp from "./LlamaCpp.js"; -import Llamafile from "./Llamafile.js"; -import Mistral from "./Mistral.js"; -import Msty from "./Msty.js"; -import Azure from "./Azure.js"; -import Ollama from "./Ollama.js"; -import OpenAI from "./OpenAI.js"; -import Replicate from "./Replicate.js"; -import TextGenWebUI from "./TextGenWebUI.js"; -import Together from "./Together.js"; -import ContinueProxy from "./stubs/ContinueProxy.js"; - -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; -} - -const getHandlebarsVars = ( - value: string, -): [string, { [key: string]: string }] => { - const ast = Handlebars.parse(value); - - const keysToFilepath: { [key: string]: string } = {}; - let keyIndex = 1; - for (const i in ast.body) { - if (ast.body[i].type === "MustacheStatement") { - const letter = convertToLetter(keyIndex); - keysToFilepath[letter] = (ast.body[i] as any).path.original; - value = value.replace( - new RegExp(`{{\\s*${(ast.body[i] as any).path.original}\\s*}}`), - `{{${letter}}}`, - ); - keyIndex++; - } - } - return [value, keysToFilepath]; -}; - -export async function renderTemplatedString( - template: string, - readFile: (filepath: string) => Promise, - inputData: any, - helpers?: [string, Handlebars.HelperDelegate][], -): Promise { - const promises: { [key: string]: Promise } = {}; - if (helpers) { - for (const [name, helper] of helpers) { - Handlebars.registerHelper(name, (...args) => { - const id = uuidv4(); - promises[id] = helper(...args); - return `__${id}__`; - }); - } - } - - const [newTemplate, vars] = getHandlebarsVars(template); - const data: any = { ...inputData }; - for (const key in vars) { - const fileContents = await readFile(vars[key]); - data[key] = fileContents || (inputData[vars[key]] ?? vars[key]); - } - const templateFn = Handlebars.compile(newTemplate); - let final = templateFn(data); - - await Promise.all(Object.values(promises)); - for (const id in promises) { - final = final.replace(`__${id}__`, await promises[id]); - } - - return final; -} +} from "../.."; +import { renderTemplatedString } from "../../promptFiles/renderTemplatedString"; +import { DEFAULT_MAX_TOKENS } from "../constants"; +import { BaseLLM } from "../index"; +import Anthropic from "./Anthropic"; +import Azure from "./Azure"; +import Bedrock from "./Bedrock"; +import BedrockImport from "./BedrockImport"; +import Cloudflare from "./Cloudflare"; +import Cohere from "./Cohere"; +import DeepInfra from "./DeepInfra"; +import Deepseek from "./Deepseek"; +import Fireworks from "./Fireworks"; +import Flowise from "./Flowise"; +import FreeTrial from "./FreeTrial"; +import Gemini from "./Gemini"; +import Groq from "./Groq"; +import HuggingFaceInferenceAPI from "./HuggingFaceInferenceAPI"; +import HuggingFaceTGI from "./HuggingFaceTGI"; +import Kindo from "./Kindo"; +import LMStudio from "./LMStudio"; +import LlamaCpp from "./LlamaCpp"; +import Llamafile from "./Llamafile"; +import Mistral from "./Mistral"; +import Msty from "./Msty"; +import Ollama from "./Ollama"; +import OpenAI from "./OpenAI"; +import OpenRouter from "./OpenRouter"; +import Replicate from "./Replicate"; +import SageMaker from "./SageMaker"; +import TextGenWebUI from "./TextGenWebUI"; +import Together from "./Together"; +import WatsonX from "./WatsonX"; +import ContinueProxy from "./stubs/ContinueProxy"; const LLMs = [ Anthropic, @@ -112,11 +51,14 @@ const LLMs = [ Together, HuggingFaceTGI, HuggingFaceInferenceAPI, + Kindo, LlamaCpp, OpenAI, LMStudio, Mistral, Bedrock, + BedrockImport, + SageMaker, DeepInfra, Flowise, Groq, @@ -126,6 +68,8 @@ const LLMs = [ Deepseek, Msty, Azure, + WatsonX, + OpenRouter, ]; export async function llmFromDescription( diff --git a/core/llm/llms/stubs/ContinueProxy.ts b/core/llm/llms/stubs/ContinueProxy.ts index 3049abc3b..63712c993 100644 --- a/core/llm/llms/stubs/ContinueProxy.ts +++ b/core/llm/llms/stubs/ContinueProxy.ts @@ -1,5 +1,5 @@ -import type { LLMOptions, ModelProvider } from "../../.."; -import { CONTROL_PLANE_URL } from "../../../control-plane/client"; +import { CONTROL_PLANE_URL } from "../../../control-plane/client.js"; +import type { LLMOptions, ModelProvider } from "../../../index.js"; import OpenAI from "../OpenAI.js"; class ContinueProxy extends OpenAI { diff --git a/core/llm/templates/edit.ts b/core/llm/templates/edit.ts index fd288a48e..9be515993 100644 --- a/core/llm/templates/edit.ts +++ b/core/llm/templates/edit.ts @@ -25,9 +25,11 @@ const gptEditPrompt: PromptTemplate = (_, otherData) => { ${otherData.prefix}[BLANK]${otherData.codeToEdit}${otherData.suffix} \`\`\` -Given the user's request: "${otherData.userInput}" +Above is the file of code that the user is currently editing in. Their cursor is located at the "[BLANK]". They have requested that you fill in the "[BLANK]" with code that satisfies the following request: -Here is the code that should fill in the [BLANK]:`; +"${otherData.userInput}" + +Please generate this code. Your output will be only the code that should replace the "[BLANK]", without repeating any of the prefix or suffix, without any natural language explanation, and without messing up indentation. Here is the code that will replace the "[BLANK]":`; } const paragraphs = [ diff --git a/core/llm/tiktokenWorkerPool.mjs b/core/llm/tiktokenWorkerPool.mjs new file mode 100644 index 000000000..9e0462f33 --- /dev/null +++ b/core/llm/tiktokenWorkerPool.mjs @@ -0,0 +1,17 @@ +import workerpool from "workerpool"; +import { encodingForModel as _encodingForModel } from "js-tiktoken"; + +const tiktokenEncoding = _encodingForModel("gpt-4"); + +function encode(text) { + return tiktokenEncoding.encode(text, "all", []); +} + +function decode(tokens) { + return tiktokenEncoding.decode(tokens); +} + +workerpool.worker({ + decode, + encode, +}); \ No newline at end of file diff --git a/core/package-lock.json b/core/package-lock.json index 2778a31d1..6c03c4862 100644 --- a/core/package-lock.json +++ b/core/package-lock.json @@ -9,22 +9,19 @@ "version": "1.0.13", "license": "Apache-2.0", "dependencies": { - "@aws-sdk/client-bedrock-runtime": "^3.574.0", - "@aws-sdk/credential-providers": "^3.596.0", + "@aws-sdk/client-bedrock-runtime": "^3.620.1", + "@aws-sdk/client-sagemaker-runtime": "^3.621.0", + "@aws-sdk/credential-providers": "^3.620.1", "@continuedev/config-types": "^1.0.10", "@continuedev/llm-info": "^1.0.1", "@mozilla/readability": "^0.5.0", "@octokit/rest": "^20.0.2", - "@types/jsdom": "^21.1.6", - "@types/mozilla-readability": "^0.2.1", - "@types/node-fetch": "^2.6.11", "@typescript-eslint/eslint-plugin": "^7.8.0", "@typescript-eslint/parser": "^7.8.0", "@xenova/transformers": "2.14.0", "adf-to-md": "^1.1.0", "async-mutex": "^0.5.0", "axios": "^1.6.7", - "cheerio": "^1.0.0-rc.12", "commander": "^12.0.0", "comment-json": "^4.2.3", "dbinfoz": "^0.1.4", @@ -35,6 +32,7 @@ "http-proxy-agent": "^7.0.1", "https-proxy-agent": "^7.0.3", "ignore": "^5.3.1", + "jinja-js": "0.1.8", "js-tiktoken": "^1.0.8", "jsdom": "^24.0.0", "launchdarkly-node-client-sdk": "^3.2.0", @@ -45,8 +43,11 @@ "ollama": "^0.4.6", "onnxruntime-node": "1.14.0", "openai": "^4.20.1", + "p-limit": "^6.1.0", "pg": "^8.11.3", "posthog-node": "^3.6.3", + "puppeteer": "^22.4.0", + "puppeteer-chromium-resolver": "^23.0.0", "quick-lru": "^7.0.0", "replicate": "^0.26.0", "request": "^2.88.2", @@ -70,12 +71,20 @@ "@types/follow-redirects": "^1.14.4", "@types/jest": "^29.5.12", "@types/jquery": "^3.5.29", + "@types/jsdom": "^21.1.6", + "@types/mozilla-readability": "^0.2.1", "@types/mustache": "^4.2.5", + "@types/node-fetch": "^2.6.11", + "@types/pg": "^8.11.6", + "@types/request": "^2.48.12", "@types/uuid": "^9.0.7", + "@types/win-ca": "^3.5.4", + "cross-env": "^7.0.3", "esbuild": "0.17.19", "eslint": "^8", "eslint-plugin-import": "^2.29.1", "jest": "^29.7.0", + "jest-environment-jsdom": "^29.7.0", "myers-diff": "^2.1.0", "onnxruntime-common": "1.14.0", "onnxruntime-web": "1.14.0", @@ -139,144 +148,181 @@ } }, "node_modules/@aws-crypto/crc32": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/@aws-crypto/crc32/-/crc32-3.0.0.tgz", - "integrity": "sha512-IzSgsrxUcsrejQbPVilIKy16kAT52EwB6zSaI+M3xxIhKh5+aldEyvI+z6erM7TCLB2BJsFrtHjp6/4/sr+3dA==", + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/@aws-crypto/crc32/-/crc32-5.2.0.tgz", + "integrity": "sha512-nLbCWqQNgUiwwtFsen1AdzAtvuLRsQS8rYgMuxCrdKf9kOssamGLuPwyTY9wyYblNr9+1XM8v6zoDTPPSIeANg==", "dependencies": { - "@aws-crypto/util": "^3.0.0", + "@aws-crypto/util": "^5.2.0", "@aws-sdk/types": "^3.222.0", - "tslib": "^1.11.1" + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=16.0.0" } }, - "node_modules/@aws-crypto/crc32/node_modules/tslib": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", - "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==" - }, - "node_modules/@aws-crypto/ie11-detection": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/@aws-crypto/ie11-detection/-/ie11-detection-3.0.0.tgz", - "integrity": "sha512-341lBBkiY1DfDNKai/wXM3aujNBkXR7tq1URPQDL9wi3AUbI80NR74uF1TXHMm7po1AcnFk8iu2S2IeU/+/A+Q==", - "dependencies": { - "tslib": "^1.11.1" - } - }, - "node_modules/@aws-crypto/ie11-detection/node_modules/tslib": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", - "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==" - }, "node_modules/@aws-crypto/sha256-browser": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/@aws-crypto/sha256-browser/-/sha256-browser-3.0.0.tgz", - "integrity": "sha512-8VLmW2B+gjFbU5uMeqtQM6Nj0/F1bro80xQXCW6CQBWgosFWXTx77aeOF5CAIAmbOK64SdMBJdNr6J41yP5mvQ==", + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/@aws-crypto/sha256-browser/-/sha256-browser-5.2.0.tgz", + "integrity": "sha512-AXfN/lGotSQwu6HNcEsIASo7kWXZ5HYWvfOmSNKDsEqC4OashTp8alTmaz+F7TC2L083SFv5RdB+qU3Vs1kZqw==", "dependencies": { - "@aws-crypto/ie11-detection": "^3.0.0", - "@aws-crypto/sha256-js": "^3.0.0", - "@aws-crypto/supports-web-crypto": "^3.0.0", - "@aws-crypto/util": "^3.0.0", + "@aws-crypto/sha256-js": "^5.2.0", + "@aws-crypto/supports-web-crypto": "^5.2.0", + "@aws-crypto/util": "^5.2.0", "@aws-sdk/types": "^3.222.0", "@aws-sdk/util-locate-window": "^3.0.0", - "@aws-sdk/util-utf8-browser": "^3.0.0", - "tslib": "^1.11.1" + "@smithy/util-utf8": "^2.0.0", + "tslib": "^2.6.2" } }, - "node_modules/@aws-crypto/sha256-browser/node_modules/tslib": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", - "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==" + "node_modules/@aws-crypto/sha256-browser/node_modules/@smithy/is-array-buffer": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/@smithy/is-array-buffer/-/is-array-buffer-2.2.0.tgz", + "integrity": "sha512-GGP3O9QFD24uGeAXYUjwSTXARoqpZykHadOmA8G5vfJPK0/DC67qa//0qvqrJzL1xc8WQWX7/yc7fwudjPHPhA==", + "dependencies": { + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@aws-crypto/sha256-browser/node_modules/@smithy/util-buffer-from": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/@smithy/util-buffer-from/-/util-buffer-from-2.2.0.tgz", + "integrity": "sha512-IJdWBbTcMQ6DA0gdNhh/BwrLkDR+ADW5Kr1aZmd4k3DIF6ezMV4R2NIAmT08wQJ3yUK82thHWmC/TnK/wpMMIA==", + "dependencies": { + "@smithy/is-array-buffer": "^2.2.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@aws-crypto/sha256-browser/node_modules/@smithy/util-utf8": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/@smithy/util-utf8/-/util-utf8-2.3.0.tgz", + "integrity": "sha512-R8Rdn8Hy72KKcebgLiv8jQcQkXoLMOGGv5uI1/k0l+snqkOzQ1R0ChUBCxWMlBsFMekWjq0wRudIweFs7sKT5A==", + "dependencies": { + "@smithy/util-buffer-from": "^2.2.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=14.0.0" + } }, "node_modules/@aws-crypto/sha256-js": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/@aws-crypto/sha256-js/-/sha256-js-3.0.0.tgz", - "integrity": "sha512-PnNN7os0+yd1XvXAy23CFOmTbMaDxgxXtTKHybrJ39Y8kGzBATgBFibWJKH6BhytLI/Zyszs87xCOBNyBig6vQ==", + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/@aws-crypto/sha256-js/-/sha256-js-5.2.0.tgz", + "integrity": "sha512-FFQQyu7edu4ufvIZ+OadFpHHOt+eSTBaYaki44c+akjg7qZg9oOQeLlk77F6tSYqjDAFClrHJk9tMf0HdVyOvA==", "dependencies": { - "@aws-crypto/util": "^3.0.0", + "@aws-crypto/util": "^5.2.0", "@aws-sdk/types": "^3.222.0", - "tslib": "^1.11.1" + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=16.0.0" } }, - "node_modules/@aws-crypto/sha256-js/node_modules/tslib": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", - "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==" - }, "node_modules/@aws-crypto/supports-web-crypto": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/@aws-crypto/supports-web-crypto/-/supports-web-crypto-3.0.0.tgz", - "integrity": "sha512-06hBdMwUAb2WFTuGG73LSC0wfPu93xWwo5vL2et9eymgmu3Id5vFAHBbajVWiGhPO37qcsdCap/FqXvJGJWPIg==", + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/@aws-crypto/supports-web-crypto/-/supports-web-crypto-5.2.0.tgz", + "integrity": "sha512-iAvUotm021kM33eCdNfwIN//F77/IADDSs58i+MDaOqFrVjZo9bAal0NK7HurRuWLLpF1iLX7gbWrjHjeo+YFg==", "dependencies": { - "tslib": "^1.11.1" + "tslib": "^2.6.2" } }, - "node_modules/@aws-crypto/supports-web-crypto/node_modules/tslib": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", - "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==" - }, "node_modules/@aws-crypto/util": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/@aws-crypto/util/-/util-3.0.0.tgz", - "integrity": "sha512-2OJlpeJpCR48CC8r+uKVChzs9Iungj9wkZrl8Z041DWEWvyIHILYKCPNzJghKsivj+S3mLo6BVc7mBNzdxA46w==", + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/@aws-crypto/util/-/util-5.2.0.tgz", + "integrity": "sha512-4RkU9EsI6ZpBve5fseQlGNUWKMa1RLPQ1dnjnQoe07ldfIzcsGb5hC5W0Dm7u423KWzawlrpbjXBrXCEv9zazQ==", "dependencies": { "@aws-sdk/types": "^3.222.0", - "@aws-sdk/util-utf8-browser": "^3.0.0", - "tslib": "^1.11.1" + "@smithy/util-utf8": "^2.0.0", + "tslib": "^2.6.2" } }, - "node_modules/@aws-crypto/util/node_modules/tslib": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", - "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==" + "node_modules/@aws-crypto/util/node_modules/@smithy/is-array-buffer": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/@smithy/is-array-buffer/-/is-array-buffer-2.2.0.tgz", + "integrity": "sha512-GGP3O9QFD24uGeAXYUjwSTXARoqpZykHadOmA8G5vfJPK0/DC67qa//0qvqrJzL1xc8WQWX7/yc7fwudjPHPhA==", + "dependencies": { + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@aws-crypto/util/node_modules/@smithy/util-buffer-from": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/@smithy/util-buffer-from/-/util-buffer-from-2.2.0.tgz", + "integrity": "sha512-IJdWBbTcMQ6DA0gdNhh/BwrLkDR+ADW5Kr1aZmd4k3DIF6ezMV4R2NIAmT08wQJ3yUK82thHWmC/TnK/wpMMIA==", + "dependencies": { + "@smithy/is-array-buffer": "^2.2.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@aws-crypto/util/node_modules/@smithy/util-utf8": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/@smithy/util-utf8/-/util-utf8-2.3.0.tgz", + "integrity": "sha512-R8Rdn8Hy72KKcebgLiv8jQcQkXoLMOGGv5uI1/k0l+snqkOzQ1R0ChUBCxWMlBsFMekWjq0wRudIweFs7sKT5A==", + "dependencies": { + "@smithy/util-buffer-from": "^2.2.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=14.0.0" + } }, "node_modules/@aws-sdk/client-bedrock-runtime": { - "version": "3.577.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/client-bedrock-runtime/-/client-bedrock-runtime-3.577.0.tgz", - "integrity": "sha512-etKXJqf+//3Sche5/vPFxF5pV59MZ06I/2SEpOr60mxgZG3hYbpznB9LTw9c4eHrBAPvvQbJewIusM40BP2FZQ==", + "version": "3.620.1", + "resolved": "https://registry.npmjs.org/@aws-sdk/client-bedrock-runtime/-/client-bedrock-runtime-3.620.1.tgz", + "integrity": "sha512-aUGMj8RdxPigtRLR+/hccyP3Wk5MbzZM1OHpQz1yVfiE0Ba0ghMVkot/2cGlpuJWTaCCSoCQneDpZsnbI922Mw==", "dependencies": { - "@aws-crypto/sha256-browser": "3.0.0", - "@aws-crypto/sha256-js": "3.0.0", - "@aws-sdk/client-sso-oidc": "3.577.0", - "@aws-sdk/client-sts": "3.577.0", - "@aws-sdk/core": "3.576.0", - "@aws-sdk/credential-provider-node": "3.577.0", - "@aws-sdk/middleware-host-header": "3.577.0", - "@aws-sdk/middleware-logger": "3.577.0", - "@aws-sdk/middleware-recursion-detection": "3.577.0", - "@aws-sdk/middleware-user-agent": "3.577.0", - "@aws-sdk/region-config-resolver": "3.577.0", - "@aws-sdk/types": "3.577.0", - "@aws-sdk/util-endpoints": "3.577.0", - "@aws-sdk/util-user-agent-browser": "3.577.0", - "@aws-sdk/util-user-agent-node": "3.577.0", - "@smithy/config-resolver": "^3.0.0", - "@smithy/core": "^2.0.0", - "@smithy/eventstream-serde-browser": "^3.0.0", - "@smithy/eventstream-serde-config-resolver": "^3.0.0", - "@smithy/eventstream-serde-node": "^3.0.0", - "@smithy/fetch-http-handler": "^3.0.0", - "@smithy/hash-node": "^3.0.0", - "@smithy/invalid-dependency": "^3.0.0", - "@smithy/middleware-content-length": "^3.0.0", - "@smithy/middleware-endpoint": "^3.0.0", - "@smithy/middleware-retry": "^3.0.0", - "@smithy/middleware-serde": "^3.0.0", - "@smithy/middleware-stack": "^3.0.0", - "@smithy/node-config-provider": "^3.0.0", - "@smithy/node-http-handler": "^3.0.0", - "@smithy/protocol-http": "^4.0.0", - "@smithy/smithy-client": "^3.0.0", - "@smithy/types": "^3.0.0", - "@smithy/url-parser": "^3.0.0", + "@aws-crypto/sha256-browser": "5.2.0", + "@aws-crypto/sha256-js": "5.2.0", + "@aws-sdk/client-sso-oidc": "3.620.1", + "@aws-sdk/client-sts": "3.620.1", + "@aws-sdk/core": "3.620.1", + "@aws-sdk/credential-provider-node": "3.620.1", + "@aws-sdk/middleware-host-header": "3.620.0", + "@aws-sdk/middleware-logger": "3.609.0", + "@aws-sdk/middleware-recursion-detection": "3.620.0", + "@aws-sdk/middleware-user-agent": "3.620.0", + "@aws-sdk/region-config-resolver": "3.614.0", + "@aws-sdk/types": "3.609.0", + "@aws-sdk/util-endpoints": "3.614.0", + "@aws-sdk/util-user-agent-browser": "3.609.0", + "@aws-sdk/util-user-agent-node": "3.614.0", + "@smithy/config-resolver": "^3.0.5", + "@smithy/core": "^2.3.0", + "@smithy/eventstream-serde-browser": "^3.0.5", + "@smithy/eventstream-serde-config-resolver": "^3.0.3", + "@smithy/eventstream-serde-node": "^3.0.4", + "@smithy/fetch-http-handler": "^3.2.3", + "@smithy/hash-node": "^3.0.3", + "@smithy/invalid-dependency": "^3.0.3", + "@smithy/middleware-content-length": "^3.0.5", + "@smithy/middleware-endpoint": "^3.1.0", + "@smithy/middleware-retry": "^3.0.12", + "@smithy/middleware-serde": "^3.0.3", + "@smithy/middleware-stack": "^3.0.3", + "@smithy/node-config-provider": "^3.1.4", + "@smithy/node-http-handler": "^3.1.4", + "@smithy/protocol-http": "^4.1.0", + "@smithy/smithy-client": "^3.1.10", + "@smithy/types": "^3.3.0", + "@smithy/url-parser": "^3.0.3", "@smithy/util-base64": "^3.0.0", "@smithy/util-body-length-browser": "^3.0.0", "@smithy/util-body-length-node": "^3.0.0", - "@smithy/util-defaults-mode-browser": "^3.0.0", - "@smithy/util-defaults-mode-node": "^3.0.0", - "@smithy/util-endpoints": "^2.0.0", - "@smithy/util-middleware": "^3.0.0", - "@smithy/util-retry": "^3.0.0", - "@smithy/util-stream": "^3.0.0", + "@smithy/util-defaults-mode-browser": "^3.0.12", + "@smithy/util-defaults-mode-node": "^3.0.12", + "@smithy/util-endpoints": "^2.0.5", + "@smithy/util-middleware": "^3.0.3", + "@smithy/util-retry": "^3.0.3", + "@smithy/util-stream": "^3.1.2", "@smithy/util-utf8": "^3.0.0", "tslib": "^2.6.2" }, @@ -285,49 +331,49 @@ } }, "node_modules/@aws-sdk/client-cognito-identity": { - "version": "3.598.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/client-cognito-identity/-/client-cognito-identity-3.598.0.tgz", - "integrity": "sha512-N/1lnkhkzk1Il8WEZBWR713/7sDEqBtl/1AS6dfgw6Zh7NWUYSwBkZx6xdN8KogDu4CFExRHhilNOgI1JMug3w==", + "version": "3.620.1", + "resolved": "https://registry.npmjs.org/@aws-sdk/client-cognito-identity/-/client-cognito-identity-3.620.1.tgz", + "integrity": "sha512-AzFjmJz6FC3XvFUIFBe8v0mRT6+5l0Uv4WQz9n+b9v4jBF9QqbcFpTDTZLu0mO+tCxFVCRfMs22ekxzwhmRdnA==", "dependencies": { "@aws-crypto/sha256-browser": "5.2.0", "@aws-crypto/sha256-js": "5.2.0", - "@aws-sdk/client-sso-oidc": "3.598.0", - "@aws-sdk/client-sts": "3.598.0", - "@aws-sdk/core": "3.598.0", - "@aws-sdk/credential-provider-node": "3.598.0", - "@aws-sdk/middleware-host-header": "3.598.0", - "@aws-sdk/middleware-logger": "3.598.0", - "@aws-sdk/middleware-recursion-detection": "3.598.0", - "@aws-sdk/middleware-user-agent": "3.598.0", - "@aws-sdk/region-config-resolver": "3.598.0", - "@aws-sdk/types": "3.598.0", - "@aws-sdk/util-endpoints": "3.598.0", - "@aws-sdk/util-user-agent-browser": "3.598.0", - "@aws-sdk/util-user-agent-node": "3.598.0", - "@smithy/config-resolver": "^3.0.2", - "@smithy/core": "^2.2.1", - "@smithy/fetch-http-handler": "^3.0.2", - "@smithy/hash-node": "^3.0.1", - "@smithy/invalid-dependency": "^3.0.1", - "@smithy/middleware-content-length": "^3.0.1", - "@smithy/middleware-endpoint": "^3.0.2", - "@smithy/middleware-retry": "^3.0.4", - "@smithy/middleware-serde": "^3.0.1", - "@smithy/middleware-stack": "^3.0.1", - "@smithy/node-config-provider": "^3.1.1", - "@smithy/node-http-handler": "^3.0.1", - "@smithy/protocol-http": "^4.0.1", - "@smithy/smithy-client": "^3.1.2", - "@smithy/types": "^3.1.0", - "@smithy/url-parser": "^3.0.1", + "@aws-sdk/client-sso-oidc": "3.620.1", + "@aws-sdk/client-sts": "3.620.1", + "@aws-sdk/core": "3.620.1", + "@aws-sdk/credential-provider-node": "3.620.1", + "@aws-sdk/middleware-host-header": "3.620.0", + "@aws-sdk/middleware-logger": "3.609.0", + "@aws-sdk/middleware-recursion-detection": "3.620.0", + "@aws-sdk/middleware-user-agent": "3.620.0", + "@aws-sdk/region-config-resolver": "3.614.0", + "@aws-sdk/types": "3.609.0", + "@aws-sdk/util-endpoints": "3.614.0", + "@aws-sdk/util-user-agent-browser": "3.609.0", + "@aws-sdk/util-user-agent-node": "3.614.0", + "@smithy/config-resolver": "^3.0.5", + "@smithy/core": "^2.3.0", + "@smithy/fetch-http-handler": "^3.2.3", + "@smithy/hash-node": "^3.0.3", + "@smithy/invalid-dependency": "^3.0.3", + "@smithy/middleware-content-length": "^3.0.5", + "@smithy/middleware-endpoint": "^3.1.0", + "@smithy/middleware-retry": "^3.0.12", + "@smithy/middleware-serde": "^3.0.3", + "@smithy/middleware-stack": "^3.0.3", + "@smithy/node-config-provider": "^3.1.4", + "@smithy/node-http-handler": "^3.1.4", + "@smithy/protocol-http": "^4.1.0", + "@smithy/smithy-client": "^3.1.10", + "@smithy/types": "^3.3.0", + "@smithy/url-parser": "^3.0.3", "@smithy/util-base64": "^3.0.0", "@smithy/util-body-length-browser": "^3.0.0", "@smithy/util-body-length-node": "^3.0.0", - "@smithy/util-defaults-mode-browser": "^3.0.4", - "@smithy/util-defaults-mode-node": "^3.0.4", - "@smithy/util-endpoints": "^2.0.2", - "@smithy/util-middleware": "^3.0.1", - "@smithy/util-retry": "^3.0.1", + "@smithy/util-defaults-mode-browser": "^3.0.12", + "@smithy/util-defaults-mode-node": "^3.0.12", + "@smithy/util-endpoints": "^2.0.5", + "@smithy/util-middleware": "^3.0.3", + "@smithy/util-retry": "^3.0.3", "@smithy/util-utf8": "^3.0.0", "tslib": "^2.6.2" }, @@ -335,116 +381,54 @@ "node": ">=16.0.0" } }, - "node_modules/@aws-sdk/client-cognito-identity/node_modules/@aws-crypto/sha256-browser": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/@aws-crypto/sha256-browser/-/sha256-browser-5.2.0.tgz", - "integrity": "sha512-AXfN/lGotSQwu6HNcEsIASo7kWXZ5HYWvfOmSNKDsEqC4OashTp8alTmaz+F7TC2L083SFv5RdB+qU3Vs1kZqw==", - "dependencies": { - "@aws-crypto/sha256-js": "^5.2.0", - "@aws-crypto/supports-web-crypto": "^5.2.0", - "@aws-crypto/util": "^5.2.0", - "@aws-sdk/types": "^3.222.0", - "@aws-sdk/util-locate-window": "^3.0.0", - "@smithy/util-utf8": "^2.0.0", - "tslib": "^2.6.2" - } - }, - "node_modules/@aws-sdk/client-cognito-identity/node_modules/@aws-crypto/sha256-browser/node_modules/@smithy/util-utf8": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/@smithy/util-utf8/-/util-utf8-2.3.0.tgz", - "integrity": "sha512-R8Rdn8Hy72KKcebgLiv8jQcQkXoLMOGGv5uI1/k0l+snqkOzQ1R0ChUBCxWMlBsFMekWjq0wRudIweFs7sKT5A==", - "dependencies": { - "@smithy/util-buffer-from": "^2.2.0", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=14.0.0" - } - }, - "node_modules/@aws-sdk/client-cognito-identity/node_modules/@aws-crypto/sha256-js": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/@aws-crypto/sha256-js/-/sha256-js-5.2.0.tgz", - "integrity": "sha512-FFQQyu7edu4ufvIZ+OadFpHHOt+eSTBaYaki44c+akjg7qZg9oOQeLlk77F6tSYqjDAFClrHJk9tMf0HdVyOvA==", - "dependencies": { - "@aws-crypto/util": "^5.2.0", - "@aws-sdk/types": "^3.222.0", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=16.0.0" - } - }, - "node_modules/@aws-sdk/client-cognito-identity/node_modules/@aws-crypto/supports-web-crypto": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/@aws-crypto/supports-web-crypto/-/supports-web-crypto-5.2.0.tgz", - "integrity": "sha512-iAvUotm021kM33eCdNfwIN//F77/IADDSs58i+MDaOqFrVjZo9bAal0NK7HurRuWLLpF1iLX7gbWrjHjeo+YFg==", - "dependencies": { - "tslib": "^2.6.2" - } - }, - "node_modules/@aws-sdk/client-cognito-identity/node_modules/@aws-crypto/util": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/@aws-crypto/util/-/util-5.2.0.tgz", - "integrity": "sha512-4RkU9EsI6ZpBve5fseQlGNUWKMa1RLPQ1dnjnQoe07ldfIzcsGb5hC5W0Dm7u423KWzawlrpbjXBrXCEv9zazQ==", - "dependencies": { - "@aws-sdk/types": "^3.222.0", - "@smithy/util-utf8": "^2.0.0", - "tslib": "^2.6.2" - } - }, - "node_modules/@aws-sdk/client-cognito-identity/node_modules/@aws-crypto/util/node_modules/@smithy/util-utf8": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/@smithy/util-utf8/-/util-utf8-2.3.0.tgz", - "integrity": "sha512-R8Rdn8Hy72KKcebgLiv8jQcQkXoLMOGGv5uI1/k0l+snqkOzQ1R0ChUBCxWMlBsFMekWjq0wRudIweFs7sKT5A==", - "dependencies": { - "@smithy/util-buffer-from": "^2.2.0", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=14.0.0" - } - }, - "node_modules/@aws-sdk/client-cognito-identity/node_modules/@aws-sdk/client-sso": { - "version": "3.598.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/client-sso/-/client-sso-3.598.0.tgz", - "integrity": "sha512-nOI5lqPYa+YZlrrzwAJywJSw3MKVjvu6Ge2fCqQUNYMfxFB0NAaDFnl0EPjXi+sEbtCuz/uWE77poHbqiZ+7Iw==", + "node_modules/@aws-sdk/client-sagemaker-runtime": { + "version": "3.624.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/client-sagemaker-runtime/-/client-sagemaker-runtime-3.624.0.tgz", + "integrity": "sha512-Af97WcvcB4uDV9A+ADmIXd/UCJn3qQ1lKdaWEbYAHN3FeuvjAZwjqjCiQsXfM5Yq9vg9SRmURSY1gW+HPTgHYg==", "dependencies": { "@aws-crypto/sha256-browser": "5.2.0", "@aws-crypto/sha256-js": "5.2.0", - "@aws-sdk/core": "3.598.0", - "@aws-sdk/middleware-host-header": "3.598.0", - "@aws-sdk/middleware-logger": "3.598.0", - "@aws-sdk/middleware-recursion-detection": "3.598.0", - "@aws-sdk/middleware-user-agent": "3.598.0", - "@aws-sdk/region-config-resolver": "3.598.0", - "@aws-sdk/types": "3.598.0", - "@aws-sdk/util-endpoints": "3.598.0", - "@aws-sdk/util-user-agent-browser": "3.598.0", - "@aws-sdk/util-user-agent-node": "3.598.0", - "@smithy/config-resolver": "^3.0.2", - "@smithy/core": "^2.2.1", - "@smithy/fetch-http-handler": "^3.0.2", - "@smithy/hash-node": "^3.0.1", - "@smithy/invalid-dependency": "^3.0.1", - "@smithy/middleware-content-length": "^3.0.1", - "@smithy/middleware-endpoint": "^3.0.2", - "@smithy/middleware-retry": "^3.0.4", - "@smithy/middleware-serde": "^3.0.1", - "@smithy/middleware-stack": "^3.0.1", - "@smithy/node-config-provider": "^3.1.1", - "@smithy/node-http-handler": "^3.0.1", - "@smithy/protocol-http": "^4.0.1", - "@smithy/smithy-client": "^3.1.2", - "@smithy/types": "^3.1.0", - "@smithy/url-parser": "^3.0.1", + "@aws-sdk/client-sso-oidc": "3.624.0", + "@aws-sdk/client-sts": "3.624.0", + "@aws-sdk/core": "3.624.0", + "@aws-sdk/credential-provider-node": "3.624.0", + "@aws-sdk/middleware-host-header": "3.620.0", + "@aws-sdk/middleware-logger": "3.609.0", + "@aws-sdk/middleware-recursion-detection": "3.620.0", + "@aws-sdk/middleware-user-agent": "3.620.0", + "@aws-sdk/region-config-resolver": "3.614.0", + "@aws-sdk/types": "3.609.0", + "@aws-sdk/util-endpoints": "3.614.0", + "@aws-sdk/util-user-agent-browser": "3.609.0", + "@aws-sdk/util-user-agent-node": "3.614.0", + "@smithy/config-resolver": "^3.0.5", + "@smithy/core": "^2.3.2", + "@smithy/eventstream-serde-browser": "^3.0.5", + "@smithy/eventstream-serde-config-resolver": "^3.0.3", + "@smithy/eventstream-serde-node": "^3.0.4", + "@smithy/fetch-http-handler": "^3.2.4", + "@smithy/hash-node": "^3.0.3", + "@smithy/invalid-dependency": "^3.0.3", + "@smithy/middleware-content-length": "^3.0.5", + "@smithy/middleware-endpoint": "^3.1.0", + "@smithy/middleware-retry": "^3.0.14", + "@smithy/middleware-serde": "^3.0.3", + "@smithy/middleware-stack": "^3.0.3", + "@smithy/node-config-provider": "^3.1.4", + "@smithy/node-http-handler": "^3.1.4", + "@smithy/protocol-http": "^4.1.0", + "@smithy/smithy-client": "^3.1.12", + "@smithy/types": "^3.3.0", + "@smithy/url-parser": "^3.0.3", "@smithy/util-base64": "^3.0.0", "@smithy/util-body-length-browser": "^3.0.0", "@smithy/util-body-length-node": "^3.0.0", - "@smithy/util-defaults-mode-browser": "^3.0.4", - "@smithy/util-defaults-mode-node": "^3.0.4", - "@smithy/util-endpoints": "^2.0.2", - "@smithy/util-middleware": "^3.0.1", - "@smithy/util-retry": "^3.0.1", + "@smithy/util-defaults-mode-browser": "^3.0.14", + "@smithy/util-defaults-mode-node": "^3.0.14", + "@smithy/util-endpoints": "^2.0.5", + "@smithy/util-middleware": "^3.0.3", + "@smithy/util-retry": "^3.0.3", + "@smithy/util-stream": "^3.1.3", "@smithy/util-utf8": "^3.0.0", "tslib": "^2.6.2" }, @@ -452,49 +436,47 @@ "node": ">=16.0.0" } }, - "node_modules/@aws-sdk/client-cognito-identity/node_modules/@aws-sdk/client-sso-oidc": { - "version": "3.598.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/client-sso-oidc/-/client-sso-oidc-3.598.0.tgz", - "integrity": "sha512-jfdH1pAO9Tt8Nkta/JJLoUnwl7jaRdxToQTJfUtE+o3+0JP5sA4LfC2rBkJSWcU5BdAA+kyOs5Lv776DlN04Vg==", + "node_modules/@aws-sdk/client-sagemaker-runtime/node_modules/@aws-sdk/client-sso": { + "version": "3.624.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/client-sso/-/client-sso-3.624.0.tgz", + "integrity": "sha512-EX6EF+rJzMPC5dcdsu40xSi2To7GSvdGQNIpe97pD9WvZwM9tRNQnNM4T6HA4gjV1L6Jwk8rBlG/CnveXtLEMw==", "dependencies": { "@aws-crypto/sha256-browser": "5.2.0", "@aws-crypto/sha256-js": "5.2.0", - "@aws-sdk/client-sts": "3.598.0", - "@aws-sdk/core": "3.598.0", - "@aws-sdk/credential-provider-node": "3.598.0", - "@aws-sdk/middleware-host-header": "3.598.0", - "@aws-sdk/middleware-logger": "3.598.0", - "@aws-sdk/middleware-recursion-detection": "3.598.0", - "@aws-sdk/middleware-user-agent": "3.598.0", - "@aws-sdk/region-config-resolver": "3.598.0", - "@aws-sdk/types": "3.598.0", - "@aws-sdk/util-endpoints": "3.598.0", - "@aws-sdk/util-user-agent-browser": "3.598.0", - "@aws-sdk/util-user-agent-node": "3.598.0", - "@smithy/config-resolver": "^3.0.2", - "@smithy/core": "^2.2.1", - "@smithy/fetch-http-handler": "^3.0.2", - "@smithy/hash-node": "^3.0.1", - "@smithy/invalid-dependency": "^3.0.1", - "@smithy/middleware-content-length": "^3.0.1", - "@smithy/middleware-endpoint": "^3.0.2", - "@smithy/middleware-retry": "^3.0.4", - "@smithy/middleware-serde": "^3.0.1", - "@smithy/middleware-stack": "^3.0.1", - "@smithy/node-config-provider": "^3.1.1", - "@smithy/node-http-handler": "^3.0.1", - "@smithy/protocol-http": "^4.0.1", - "@smithy/smithy-client": "^3.1.2", - "@smithy/types": "^3.1.0", - "@smithy/url-parser": "^3.0.1", + "@aws-sdk/core": "3.624.0", + "@aws-sdk/middleware-host-header": "3.620.0", + "@aws-sdk/middleware-logger": "3.609.0", + "@aws-sdk/middleware-recursion-detection": "3.620.0", + "@aws-sdk/middleware-user-agent": "3.620.0", + "@aws-sdk/region-config-resolver": "3.614.0", + "@aws-sdk/types": "3.609.0", + "@aws-sdk/util-endpoints": "3.614.0", + "@aws-sdk/util-user-agent-browser": "3.609.0", + "@aws-sdk/util-user-agent-node": "3.614.0", + "@smithy/config-resolver": "^3.0.5", + "@smithy/core": "^2.3.2", + "@smithy/fetch-http-handler": "^3.2.4", + "@smithy/hash-node": "^3.0.3", + "@smithy/invalid-dependency": "^3.0.3", + "@smithy/middleware-content-length": "^3.0.5", + "@smithy/middleware-endpoint": "^3.1.0", + "@smithy/middleware-retry": "^3.0.14", + "@smithy/middleware-serde": "^3.0.3", + "@smithy/middleware-stack": "^3.0.3", + "@smithy/node-config-provider": "^3.1.4", + "@smithy/node-http-handler": "^3.1.4", + "@smithy/protocol-http": "^4.1.0", + "@smithy/smithy-client": "^3.1.12", + "@smithy/types": "^3.3.0", + "@smithy/url-parser": "^3.0.3", "@smithy/util-base64": "^3.0.0", "@smithy/util-body-length-browser": "^3.0.0", "@smithy/util-body-length-node": "^3.0.0", - "@smithy/util-defaults-mode-browser": "^3.0.4", - "@smithy/util-defaults-mode-node": "^3.0.4", - "@smithy/util-endpoints": "^2.0.2", - "@smithy/util-middleware": "^3.0.1", - "@smithy/util-retry": "^3.0.1", + "@smithy/util-defaults-mode-browser": "^3.0.14", + "@smithy/util-defaults-mode-node": "^3.0.14", + "@smithy/util-endpoints": "^2.0.5", + "@smithy/util-middleware": "^3.0.3", + "@smithy/util-retry": "^3.0.3", "@smithy/util-utf8": "^3.0.0", "tslib": "^2.6.2" }, @@ -502,49 +484,101 @@ "node": ">=16.0.0" } }, - "node_modules/@aws-sdk/client-cognito-identity/node_modules/@aws-sdk/client-sts": { - "version": "3.598.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/client-sts/-/client-sts-3.598.0.tgz", - "integrity": "sha512-bXhz/cHL0iB9UH9IFtMaJJf4F8mV+HzncETCRFzZ9SyUMt5rP9j8A7VZknqGYSx/6mI8SsB1XJQkWSbhn6FiSQ==", + "node_modules/@aws-sdk/client-sagemaker-runtime/node_modules/@aws-sdk/client-sso-oidc": { + "version": "3.624.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/client-sso-oidc/-/client-sso-oidc-3.624.0.tgz", + "integrity": "sha512-Ki2uKYJKKtfHxxZsiMTOvJoVRP6b2pZ1u3rcUb2m/nVgBPUfLdl8ZkGpqE29I+t5/QaS/sEdbn6cgMUZwl+3Dg==", "dependencies": { "@aws-crypto/sha256-browser": "5.2.0", "@aws-crypto/sha256-js": "5.2.0", - "@aws-sdk/client-sso-oidc": "3.598.0", - "@aws-sdk/core": "3.598.0", - "@aws-sdk/credential-provider-node": "3.598.0", - "@aws-sdk/middleware-host-header": "3.598.0", - "@aws-sdk/middleware-logger": "3.598.0", - "@aws-sdk/middleware-recursion-detection": "3.598.0", - "@aws-sdk/middleware-user-agent": "3.598.0", - "@aws-sdk/region-config-resolver": "3.598.0", - "@aws-sdk/types": "3.598.0", - "@aws-sdk/util-endpoints": "3.598.0", - "@aws-sdk/util-user-agent-browser": "3.598.0", - "@aws-sdk/util-user-agent-node": "3.598.0", - "@smithy/config-resolver": "^3.0.2", - "@smithy/core": "^2.2.1", - "@smithy/fetch-http-handler": "^3.0.2", - "@smithy/hash-node": "^3.0.1", - "@smithy/invalid-dependency": "^3.0.1", - "@smithy/middleware-content-length": "^3.0.1", - "@smithy/middleware-endpoint": "^3.0.2", - "@smithy/middleware-retry": "^3.0.4", - "@smithy/middleware-serde": "^3.0.1", - "@smithy/middleware-stack": "^3.0.1", - "@smithy/node-config-provider": "^3.1.1", - "@smithy/node-http-handler": "^3.0.1", - "@smithy/protocol-http": "^4.0.1", - "@smithy/smithy-client": "^3.1.2", - "@smithy/types": "^3.1.0", - "@smithy/url-parser": "^3.0.1", + "@aws-sdk/core": "3.624.0", + "@aws-sdk/credential-provider-node": "3.624.0", + "@aws-sdk/middleware-host-header": "3.620.0", + "@aws-sdk/middleware-logger": "3.609.0", + "@aws-sdk/middleware-recursion-detection": "3.620.0", + "@aws-sdk/middleware-user-agent": "3.620.0", + "@aws-sdk/region-config-resolver": "3.614.0", + "@aws-sdk/types": "3.609.0", + "@aws-sdk/util-endpoints": "3.614.0", + "@aws-sdk/util-user-agent-browser": "3.609.0", + "@aws-sdk/util-user-agent-node": "3.614.0", + "@smithy/config-resolver": "^3.0.5", + "@smithy/core": "^2.3.2", + "@smithy/fetch-http-handler": "^3.2.4", + "@smithy/hash-node": "^3.0.3", + "@smithy/invalid-dependency": "^3.0.3", + "@smithy/middleware-content-length": "^3.0.5", + "@smithy/middleware-endpoint": "^3.1.0", + "@smithy/middleware-retry": "^3.0.14", + "@smithy/middleware-serde": "^3.0.3", + "@smithy/middleware-stack": "^3.0.3", + "@smithy/node-config-provider": "^3.1.4", + "@smithy/node-http-handler": "^3.1.4", + "@smithy/protocol-http": "^4.1.0", + "@smithy/smithy-client": "^3.1.12", + "@smithy/types": "^3.3.0", + "@smithy/url-parser": "^3.0.3", "@smithy/util-base64": "^3.0.0", "@smithy/util-body-length-browser": "^3.0.0", "@smithy/util-body-length-node": "^3.0.0", - "@smithy/util-defaults-mode-browser": "^3.0.4", - "@smithy/util-defaults-mode-node": "^3.0.4", - "@smithy/util-endpoints": "^2.0.2", - "@smithy/util-middleware": "^3.0.1", - "@smithy/util-retry": "^3.0.1", + "@smithy/util-defaults-mode-browser": "^3.0.14", + "@smithy/util-defaults-mode-node": "^3.0.14", + "@smithy/util-endpoints": "^2.0.5", + "@smithy/util-middleware": "^3.0.3", + "@smithy/util-retry": "^3.0.3", + "@smithy/util-utf8": "^3.0.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=16.0.0" + }, + "peerDependencies": { + "@aws-sdk/client-sts": "^3.624.0" + } + }, + "node_modules/@aws-sdk/client-sagemaker-runtime/node_modules/@aws-sdk/client-sts": { + "version": "3.624.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/client-sts/-/client-sts-3.624.0.tgz", + "integrity": "sha512-k36fLZCb2nfoV/DKK3jbRgO/Yf7/R80pgYfMiotkGjnZwDmRvNN08z4l06L9C+CieazzkgRxNUzyppsYcYsQaw==", + "dependencies": { + "@aws-crypto/sha256-browser": "5.2.0", + "@aws-crypto/sha256-js": "5.2.0", + "@aws-sdk/client-sso-oidc": "3.624.0", + "@aws-sdk/core": "3.624.0", + "@aws-sdk/credential-provider-node": "3.624.0", + "@aws-sdk/middleware-host-header": "3.620.0", + "@aws-sdk/middleware-logger": "3.609.0", + "@aws-sdk/middleware-recursion-detection": "3.620.0", + "@aws-sdk/middleware-user-agent": "3.620.0", + "@aws-sdk/region-config-resolver": "3.614.0", + "@aws-sdk/types": "3.609.0", + "@aws-sdk/util-endpoints": "3.614.0", + "@aws-sdk/util-user-agent-browser": "3.609.0", + "@aws-sdk/util-user-agent-node": "3.614.0", + "@smithy/config-resolver": "^3.0.5", + "@smithy/core": "^2.3.2", + "@smithy/fetch-http-handler": "^3.2.4", + "@smithy/hash-node": "^3.0.3", + "@smithy/invalid-dependency": "^3.0.3", + "@smithy/middleware-content-length": "^3.0.5", + "@smithy/middleware-endpoint": "^3.1.0", + "@smithy/middleware-retry": "^3.0.14", + "@smithy/middleware-serde": "^3.0.3", + "@smithy/middleware-stack": "^3.0.3", + "@smithy/node-config-provider": "^3.1.4", + "@smithy/node-http-handler": "^3.1.4", + "@smithy/protocol-http": "^4.1.0", + "@smithy/smithy-client": "^3.1.12", + "@smithy/types": "^3.3.0", + "@smithy/url-parser": "^3.0.3", + "@smithy/util-base64": "^3.0.0", + "@smithy/util-body-length-browser": "^3.0.0", + "@smithy/util-body-length-node": "^3.0.0", + "@smithy/util-defaults-mode-browser": "^3.0.14", + "@smithy/util-defaults-mode-node": "^3.0.14", + "@smithy/util-endpoints": "^2.0.5", + "@smithy/util-middleware": "^3.0.3", + "@smithy/util-retry": "^3.0.3", "@smithy/util-utf8": "^3.0.0", "tslib": "^2.6.2" }, @@ -552,364 +586,186 @@ "node": ">=16.0.0" } }, - "node_modules/@aws-sdk/client-cognito-identity/node_modules/@aws-sdk/core": { - "version": "3.598.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/core/-/core-3.598.0.tgz", - "integrity": "sha512-HaSjt7puO5Cc7cOlrXFCW0rtA0BM9lvzjl56x0A20Pt+0wxXGeTOZZOkXQIepbrFkV2e/HYukuT9e99vXDm59g==", + "node_modules/@aws-sdk/client-sagemaker-runtime/node_modules/@aws-sdk/core": { + "version": "3.624.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/core/-/core-3.624.0.tgz", + "integrity": "sha512-WyFmPbhRIvtWi7hBp8uSFy+iPpj8ccNV/eX86hwF4irMjfc/FtsGVIAeBXxXM/vGCjkdfEzOnl+tJ2XACD4OXg==", "dependencies": { - "@smithy/core": "^2.2.1", - "@smithy/protocol-http": "^4.0.1", - "@smithy/signature-v4": "^3.1.0", - "@smithy/smithy-client": "^3.1.2", - "@smithy/types": "^3.1.0", - "fast-xml-parser": "4.2.5", + "@smithy/core": "^2.3.2", + "@smithy/node-config-provider": "^3.1.4", + "@smithy/protocol-http": "^4.1.0", + "@smithy/signature-v4": "^4.1.0", + "@smithy/smithy-client": "^3.1.12", + "@smithy/types": "^3.3.0", + "@smithy/util-middleware": "^3.0.3", + "fast-xml-parser": "4.4.1", "tslib": "^2.6.2" }, "engines": { "node": ">=16.0.0" } }, - "node_modules/@aws-sdk/client-cognito-identity/node_modules/@aws-sdk/credential-provider-env": { - "version": "3.598.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-env/-/credential-provider-env-3.598.0.tgz", - "integrity": "sha512-vi1khgn7yXzLCcgSIzQrrtd2ilUM0dWodxj3PQ6BLfP0O+q1imO3hG1nq7DVyJtq7rFHs6+9N8G4mYvTkxby2w==", + "node_modules/@aws-sdk/client-sagemaker-runtime/node_modules/@aws-sdk/credential-provider-http": { + "version": "3.622.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-http/-/credential-provider-http-3.622.0.tgz", + "integrity": "sha512-VUHbr24Oll1RK3WR8XLUugLpgK9ZuxEm/NVeVqyFts1Ck9gsKpRg1x4eH7L7tW3SJ4TDEQNMbD7/7J+eoL2svg==", "dependencies": { - "@aws-sdk/types": "3.598.0", - "@smithy/property-provider": "^3.1.1", - "@smithy/types": "^3.1.0", + "@aws-sdk/types": "3.609.0", + "@smithy/fetch-http-handler": "^3.2.4", + "@smithy/node-http-handler": "^3.1.4", + "@smithy/property-provider": "^3.1.3", + "@smithy/protocol-http": "^4.1.0", + "@smithy/smithy-client": "^3.1.12", + "@smithy/types": "^3.3.0", + "@smithy/util-stream": "^3.1.3", "tslib": "^2.6.2" }, "engines": { "node": ">=16.0.0" } }, - "node_modules/@aws-sdk/client-cognito-identity/node_modules/@aws-sdk/credential-provider-http": { - "version": "3.598.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-http/-/credential-provider-http-3.598.0.tgz", - "integrity": "sha512-N7cIafi4HVlQvEgvZSo1G4T9qb/JMLGMdBsDCT5XkeJrF0aptQWzTFH0jIdZcLrMYvzPcuEyO3yCBe6cy/ba0g==", + "node_modules/@aws-sdk/client-sagemaker-runtime/node_modules/@aws-sdk/credential-provider-ini": { + "version": "3.624.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-ini/-/credential-provider-ini-3.624.0.tgz", + "integrity": "sha512-mMoNIy7MO2WTBbdqMyLpbt6SZpthE6e0GkRYpsd0yozPt0RZopcBhEh+HG1U9Y1PVODo+jcMk353vAi61CfnhQ==", "dependencies": { - "@aws-sdk/types": "3.598.0", - "@smithy/fetch-http-handler": "^3.0.2", - "@smithy/node-http-handler": "^3.0.1", - "@smithy/property-provider": "^3.1.1", - "@smithy/protocol-http": "^4.0.1", - "@smithy/smithy-client": "^3.1.2", - "@smithy/types": "^3.1.0", - "@smithy/util-stream": "^3.0.2", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=16.0.0" - } - }, - "node_modules/@aws-sdk/client-cognito-identity/node_modules/@aws-sdk/credential-provider-ini": { - "version": "3.598.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-ini/-/credential-provider-ini-3.598.0.tgz", - "integrity": "sha512-/ppcIVUbRwDIwJDoYfp90X3+AuJo2mvE52Y1t2VSrvUovYn6N4v95/vXj6LS8CNDhz2jvEJYmu+0cTMHdhI6eA==", - "dependencies": { - "@aws-sdk/credential-provider-env": "3.598.0", - "@aws-sdk/credential-provider-http": "3.598.0", - "@aws-sdk/credential-provider-process": "3.598.0", - "@aws-sdk/credential-provider-sso": "3.598.0", - "@aws-sdk/credential-provider-web-identity": "3.598.0", - "@aws-sdk/types": "3.598.0", - "@smithy/credential-provider-imds": "^3.1.1", - "@smithy/property-provider": "^3.1.1", - "@smithy/shared-ini-file-loader": "^3.1.1", - "@smithy/types": "^3.1.0", + "@aws-sdk/credential-provider-env": "3.620.1", + "@aws-sdk/credential-provider-http": "3.622.0", + "@aws-sdk/credential-provider-process": "3.620.1", + "@aws-sdk/credential-provider-sso": "3.624.0", + "@aws-sdk/credential-provider-web-identity": "3.621.0", + "@aws-sdk/types": "3.609.0", + "@smithy/credential-provider-imds": "^3.2.0", + "@smithy/property-provider": "^3.1.3", + "@smithy/shared-ini-file-loader": "^3.1.4", + "@smithy/types": "^3.3.0", "tslib": "^2.6.2" }, "engines": { "node": ">=16.0.0" }, "peerDependencies": { - "@aws-sdk/client-sts": "^3.598.0" + "@aws-sdk/client-sts": "^3.624.0" } }, - "node_modules/@aws-sdk/client-cognito-identity/node_modules/@aws-sdk/credential-provider-node": { - "version": "3.598.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-node/-/credential-provider-node-3.598.0.tgz", - "integrity": "sha512-sXTlqL5I/awlF9Dg2MQ17SfrEaABVnsj2mf4jF5qQrIRhfbvQOIYdEqdy8Rn1AWlJMz/N450SGzc0XJ5owxxqw==", + "node_modules/@aws-sdk/client-sagemaker-runtime/node_modules/@aws-sdk/credential-provider-node": { + "version": "3.624.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-node/-/credential-provider-node-3.624.0.tgz", + "integrity": "sha512-vYyGK7oNpd81BdbH5IlmQ6zfaQqU+rPwsKTDDBeLRjshtrGXOEpfoahVpG9PX0ibu32IOWp4ZyXBNyVrnvcMOw==", "dependencies": { - "@aws-sdk/credential-provider-env": "3.598.0", - "@aws-sdk/credential-provider-http": "3.598.0", - "@aws-sdk/credential-provider-ini": "3.598.0", - "@aws-sdk/credential-provider-process": "3.598.0", - "@aws-sdk/credential-provider-sso": "3.598.0", - "@aws-sdk/credential-provider-web-identity": "3.598.0", - "@aws-sdk/types": "3.598.0", - "@smithy/credential-provider-imds": "^3.1.1", - "@smithy/property-provider": "^3.1.1", - "@smithy/shared-ini-file-loader": "^3.1.1", - "@smithy/types": "^3.1.0", + "@aws-sdk/credential-provider-env": "3.620.1", + "@aws-sdk/credential-provider-http": "3.622.0", + "@aws-sdk/credential-provider-ini": "3.624.0", + "@aws-sdk/credential-provider-process": "3.620.1", + "@aws-sdk/credential-provider-sso": "3.624.0", + "@aws-sdk/credential-provider-web-identity": "3.621.0", + "@aws-sdk/types": "3.609.0", + "@smithy/credential-provider-imds": "^3.2.0", + "@smithy/property-provider": "^3.1.3", + "@smithy/shared-ini-file-loader": "^3.1.4", + "@smithy/types": "^3.3.0", "tslib": "^2.6.2" }, "engines": { "node": ">=16.0.0" } }, - "node_modules/@aws-sdk/client-cognito-identity/node_modules/@aws-sdk/credential-provider-process": { - "version": "3.598.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-process/-/credential-provider-process-3.598.0.tgz", - "integrity": "sha512-rM707XbLW8huMk722AgjVyxu2tMZee++fNA8TJVNgs1Ma02Wx6bBrfIvlyK0rCcIRb0WdQYP6fe3Xhiu4e8IBA==", + "node_modules/@aws-sdk/client-sagemaker-runtime/node_modules/@aws-sdk/credential-provider-sso": { + "version": "3.624.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-sso/-/credential-provider-sso-3.624.0.tgz", + "integrity": "sha512-A02bayIjU9APEPKr3HudrFHEx0WfghoSPsPopckDkW7VBqO4wizzcxr75Q9A3vNX+cwg0wCN6UitTNe6pVlRaQ==", "dependencies": { - "@aws-sdk/types": "3.598.0", - "@smithy/property-provider": "^3.1.1", - "@smithy/shared-ini-file-loader": "^3.1.1", - "@smithy/types": "^3.1.0", + "@aws-sdk/client-sso": "3.624.0", + "@aws-sdk/token-providers": "3.614.0", + "@aws-sdk/types": "3.609.0", + "@smithy/property-provider": "^3.1.3", + "@smithy/shared-ini-file-loader": "^3.1.4", + "@smithy/types": "^3.3.0", "tslib": "^2.6.2" }, "engines": { "node": ">=16.0.0" } }, - "node_modules/@aws-sdk/client-cognito-identity/node_modules/@aws-sdk/credential-provider-sso": { - "version": "3.598.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-sso/-/credential-provider-sso-3.598.0.tgz", - "integrity": "sha512-5InwUmrAuqQdOOgxTccRayMMkSmekdLk6s+az9tmikq0QFAHUCtofI+/fllMXSR9iL6JbGYi1940+EUmS4pHJA==", + "node_modules/@aws-sdk/client-sagemaker-runtime/node_modules/@aws-sdk/credential-provider-web-identity": { + "version": "3.621.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-web-identity/-/credential-provider-web-identity-3.621.0.tgz", + "integrity": "sha512-w7ASSyfNvcx7+bYGep3VBgC3K6vEdLmlpjT7nSIHxxQf+WSdvy+HynwJosrpZax0sK5q0D1Jpn/5q+r5lwwW6w==", "dependencies": { - "@aws-sdk/client-sso": "3.598.0", - "@aws-sdk/token-providers": "3.598.0", - "@aws-sdk/types": "3.598.0", - "@smithy/property-provider": "^3.1.1", - "@smithy/shared-ini-file-loader": "^3.1.1", - "@smithy/types": "^3.1.0", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=16.0.0" - } - }, - "node_modules/@aws-sdk/client-cognito-identity/node_modules/@aws-sdk/credential-provider-web-identity": { - "version": "3.598.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-web-identity/-/credential-provider-web-identity-3.598.0.tgz", - "integrity": "sha512-GV5GdiMbz5Tz9JO4NJtRoFXjW0GPEujA0j+5J/B723rTN+REHthJu48HdBKouHGhdzkDWkkh1bu52V02Wprw8w==", - "dependencies": { - "@aws-sdk/types": "3.598.0", - "@smithy/property-provider": "^3.1.1", - "@smithy/types": "^3.1.0", + "@aws-sdk/types": "3.609.0", + "@smithy/property-provider": "^3.1.3", + "@smithy/types": "^3.3.0", "tslib": "^2.6.2" }, "engines": { "node": ">=16.0.0" }, "peerDependencies": { - "@aws-sdk/client-sts": "^3.598.0" + "@aws-sdk/client-sts": "^3.621.0" } }, - "node_modules/@aws-sdk/client-cognito-identity/node_modules/@aws-sdk/middleware-host-header": { - "version": "3.598.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/middleware-host-header/-/middleware-host-header-3.598.0.tgz", - "integrity": "sha512-WiaG059YBQwQraNejLIi0gMNkX7dfPZ8hDIhvMr5aVPRbaHH8AYF3iNSsXYCHvA2Cfa1O9haYXsuMF9flXnCmA==", - "dependencies": { - "@aws-sdk/types": "3.598.0", - "@smithy/protocol-http": "^4.0.1", - "@smithy/types": "^3.1.0", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=16.0.0" - } - }, - "node_modules/@aws-sdk/client-cognito-identity/node_modules/@aws-sdk/middleware-logger": { - "version": "3.598.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/middleware-logger/-/middleware-logger-3.598.0.tgz", - "integrity": "sha512-bxBjf/VYiu3zfu8SYM2S9dQQc3tz5uBAOcPz/Bt8DyyK3GgOpjhschH/2XuUErsoUO1gDJqZSdGOmuHGZQn00Q==", - "dependencies": { - "@aws-sdk/types": "3.598.0", - "@smithy/types": "^3.1.0", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=16.0.0" - } - }, - "node_modules/@aws-sdk/client-cognito-identity/node_modules/@aws-sdk/middleware-recursion-detection": { - "version": "3.598.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/middleware-recursion-detection/-/middleware-recursion-detection-3.598.0.tgz", - "integrity": "sha512-vjT9BeFY9FeN0f8hm2l6F53tI0N5bUq6RcDkQXKNabXBnQxKptJRad6oP2X5y3FoVfBLOuDkQgiC2940GIPxtQ==", - "dependencies": { - "@aws-sdk/types": "3.598.0", - "@smithy/protocol-http": "^4.0.1", - "@smithy/types": "^3.1.0", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=16.0.0" - } - }, - "node_modules/@aws-sdk/client-cognito-identity/node_modules/@aws-sdk/middleware-user-agent": { - "version": "3.598.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/middleware-user-agent/-/middleware-user-agent-3.598.0.tgz", - "integrity": "sha512-4tjESlHG5B5MdjUaLK7tQs/miUtHbb6deauQx8ryqSBYOhfHVgb1ZnzvQR0bTrhpqUg0WlybSkDaZAICf9xctg==", - "dependencies": { - "@aws-sdk/types": "3.598.0", - "@aws-sdk/util-endpoints": "3.598.0", - "@smithy/protocol-http": "^4.0.1", - "@smithy/types": "^3.1.0", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=16.0.0" - } - }, - "node_modules/@aws-sdk/client-cognito-identity/node_modules/@aws-sdk/region-config-resolver": { - "version": "3.598.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/region-config-resolver/-/region-config-resolver-3.598.0.tgz", - "integrity": "sha512-oYXhmTokSav4ytmWleCr3rs/1nyvZW/S0tdi6X7u+dLNL5Jee+uMxWGzgOrWK6wrQOzucLVjS4E/wA11Kv2GTw==", - "dependencies": { - "@aws-sdk/types": "3.598.0", - "@smithy/node-config-provider": "^3.1.1", - "@smithy/types": "^3.1.0", - "@smithy/util-config-provider": "^3.0.0", - "@smithy/util-middleware": "^3.0.1", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=16.0.0" - } - }, - "node_modules/@aws-sdk/client-cognito-identity/node_modules/@aws-sdk/token-providers": { - "version": "3.598.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/token-providers/-/token-providers-3.598.0.tgz", - "integrity": "sha512-TKY1EVdHVBnZqpyxyTHdpZpa1tUpb6nxVeRNn1zWG8QB5MvH4ALLd/jR+gtmWDNQbIG4cVuBOZFVL8hIYicKTA==", - "dependencies": { - "@aws-sdk/types": "3.598.0", - "@smithy/property-provider": "^3.1.1", - "@smithy/shared-ini-file-loader": "^3.1.1", - "@smithy/types": "^3.1.0", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=16.0.0" - }, - "peerDependencies": { - "@aws-sdk/client-sso-oidc": "^3.598.0" - } - }, - "node_modules/@aws-sdk/client-cognito-identity/node_modules/@aws-sdk/types": { - "version": "3.598.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/types/-/types-3.598.0.tgz", - "integrity": "sha512-742uRl6z7u0LFmZwDrFP6r1wlZcgVPw+/TilluDJmCAR8BgRw3IR+743kUXKBGd8QZDRW2n6v/PYsi/AWCDDMQ==", - "dependencies": { - "@smithy/types": "^3.1.0", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=16.0.0" - } - }, - "node_modules/@aws-sdk/client-cognito-identity/node_modules/@aws-sdk/util-endpoints": { - "version": "3.598.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/util-endpoints/-/util-endpoints-3.598.0.tgz", - "integrity": "sha512-Qo9UoiVVZxcOEdiOMZg3xb1mzkTxrhd4qSlg5QQrfWPJVx/QOg+Iy0NtGxPtHtVZNHZxohYwDwV/tfsnDSE2gQ==", - "dependencies": { - "@aws-sdk/types": "3.598.0", - "@smithy/types": "^3.1.0", - "@smithy/util-endpoints": "^2.0.2", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=16.0.0" - } - }, - "node_modules/@aws-sdk/client-cognito-identity/node_modules/@aws-sdk/util-user-agent-browser": { - "version": "3.598.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/util-user-agent-browser/-/util-user-agent-browser-3.598.0.tgz", - "integrity": "sha512-36Sxo6F+ykElaL1mWzWjlg+1epMpSe8obwhCN1yGE7Js9ywy5U6k6l+A3q3YM9YRbm740sNxncbwLklMvuhTKw==", - "dependencies": { - "@aws-sdk/types": "3.598.0", - "@smithy/types": "^3.1.0", - "bowser": "^2.11.0", - "tslib": "^2.6.2" - } - }, - "node_modules/@aws-sdk/client-cognito-identity/node_modules/@aws-sdk/util-user-agent-node": { - "version": "3.598.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/util-user-agent-node/-/util-user-agent-node-3.598.0.tgz", - "integrity": "sha512-oyWGcOlfTdzkC6SVplyr0AGh54IMrDxbhg5RxJ5P+V4BKfcDoDcZV9xenUk9NsOi9MuUjxMumb9UJGkDhM1m0A==", - "dependencies": { - "@aws-sdk/types": "3.598.0", - "@smithy/node-config-provider": "^3.1.1", - "@smithy/types": "^3.1.0", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=16.0.0" - }, - "peerDependencies": { - "aws-crt": ">=1.0.0" - }, - "peerDependenciesMeta": { - "aws-crt": { - "optional": true + "node_modules/@aws-sdk/client-sagemaker-runtime/node_modules/fast-xml-parser": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/fast-xml-parser/-/fast-xml-parser-4.4.1.tgz", + "integrity": "sha512-xkjOecfnKGkSsOwtZ5Pz7Us/T6mrbPQrq0nh+aCO5V9nk5NLWmasAHumTKjiPJPWANe+kAZ84Jc8ooJkzZ88Sw==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/NaturalIntelligence" + }, + { + "type": "paypal", + "url": "https://paypal.me/naturalintelligence" } - } - }, - "node_modules/@aws-sdk/client-cognito-identity/node_modules/@smithy/is-array-buffer": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/@smithy/is-array-buffer/-/is-array-buffer-2.2.0.tgz", - "integrity": "sha512-GGP3O9QFD24uGeAXYUjwSTXARoqpZykHadOmA8G5vfJPK0/DC67qa//0qvqrJzL1xc8WQWX7/yc7fwudjPHPhA==", + ], "dependencies": { - "tslib": "^2.6.2" + "strnum": "^1.0.5" }, - "engines": { - "node": ">=14.0.0" - } - }, - "node_modules/@aws-sdk/client-cognito-identity/node_modules/@smithy/util-buffer-from": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/@smithy/util-buffer-from/-/util-buffer-from-2.2.0.tgz", - "integrity": "sha512-IJdWBbTcMQ6DA0gdNhh/BwrLkDR+ADW5Kr1aZmd4k3DIF6ezMV4R2NIAmT08wQJ3yUK82thHWmC/TnK/wpMMIA==", - "dependencies": { - "@smithy/is-array-buffer": "^2.2.0", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=14.0.0" + "bin": { + "fxparser": "src/cli/cli.js" } }, "node_modules/@aws-sdk/client-sso": { - "version": "3.577.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/client-sso/-/client-sso-3.577.0.tgz", - "integrity": "sha512-BwujdXrydlk6UEyPmewm5GqG4nkQ6OVyRhS/SyZP/6UKSFv2/sf391Cmz0hN0itUTH1rR4XeLln8XCOtarkrzg==", + "version": "3.620.1", + "resolved": "https://registry.npmjs.org/@aws-sdk/client-sso/-/client-sso-3.620.1.tgz", + "integrity": "sha512-4Ox0BSs+atrAhLvjNHN2uiYvSTdpMv//IS4l4XRoQG0cJKIPLs3OU3PL5H0X1NfZehz9/8FTWl5Lv81uw4j1eA==", "dependencies": { - "@aws-crypto/sha256-browser": "3.0.0", - "@aws-crypto/sha256-js": "3.0.0", - "@aws-sdk/core": "3.576.0", - "@aws-sdk/middleware-host-header": "3.577.0", - "@aws-sdk/middleware-logger": "3.577.0", - "@aws-sdk/middleware-recursion-detection": "3.577.0", - "@aws-sdk/middleware-user-agent": "3.577.0", - "@aws-sdk/region-config-resolver": "3.577.0", - "@aws-sdk/types": "3.577.0", - "@aws-sdk/util-endpoints": "3.577.0", - "@aws-sdk/util-user-agent-browser": "3.577.0", - "@aws-sdk/util-user-agent-node": "3.577.0", - "@smithy/config-resolver": "^3.0.0", - "@smithy/core": "^2.0.0", - "@smithy/fetch-http-handler": "^3.0.0", - "@smithy/hash-node": "^3.0.0", - "@smithy/invalid-dependency": "^3.0.0", - "@smithy/middleware-content-length": "^3.0.0", - "@smithy/middleware-endpoint": "^3.0.0", - "@smithy/middleware-retry": "^3.0.0", - "@smithy/middleware-serde": "^3.0.0", - "@smithy/middleware-stack": "^3.0.0", - "@smithy/node-config-provider": "^3.0.0", - "@smithy/node-http-handler": "^3.0.0", - "@smithy/protocol-http": "^4.0.0", - "@smithy/smithy-client": "^3.0.0", - "@smithy/types": "^3.0.0", - "@smithy/url-parser": "^3.0.0", + "@aws-crypto/sha256-browser": "5.2.0", + "@aws-crypto/sha256-js": "5.2.0", + "@aws-sdk/core": "3.620.1", + "@aws-sdk/middleware-host-header": "3.620.0", + "@aws-sdk/middleware-logger": "3.609.0", + "@aws-sdk/middleware-recursion-detection": "3.620.0", + "@aws-sdk/middleware-user-agent": "3.620.0", + "@aws-sdk/region-config-resolver": "3.614.0", + "@aws-sdk/types": "3.609.0", + "@aws-sdk/util-endpoints": "3.614.0", + "@aws-sdk/util-user-agent-browser": "3.609.0", + "@aws-sdk/util-user-agent-node": "3.614.0", + "@smithy/config-resolver": "^3.0.5", + "@smithy/core": "^2.3.0", + "@smithy/fetch-http-handler": "^3.2.3", + "@smithy/hash-node": "^3.0.3", + "@smithy/invalid-dependency": "^3.0.3", + "@smithy/middleware-content-length": "^3.0.5", + "@smithy/middleware-endpoint": "^3.1.0", + "@smithy/middleware-retry": "^3.0.12", + "@smithy/middleware-serde": "^3.0.3", + "@smithy/middleware-stack": "^3.0.3", + "@smithy/node-config-provider": "^3.1.4", + "@smithy/node-http-handler": "^3.1.4", + "@smithy/protocol-http": "^4.1.0", + "@smithy/smithy-client": "^3.1.10", + "@smithy/types": "^3.3.0", + "@smithy/url-parser": "^3.0.3", "@smithy/util-base64": "^3.0.0", "@smithy/util-body-length-browser": "^3.0.0", "@smithy/util-body-length-node": "^3.0.0", - "@smithy/util-defaults-mode-browser": "^3.0.0", - "@smithy/util-defaults-mode-node": "^3.0.0", - "@smithy/util-endpoints": "^2.0.0", - "@smithy/util-middleware": "^3.0.0", - "@smithy/util-retry": "^3.0.0", + "@smithy/util-defaults-mode-browser": "^3.0.12", + "@smithy/util-defaults-mode-node": "^3.0.12", + "@smithy/util-endpoints": "^2.0.5", + "@smithy/util-middleware": "^3.0.3", + "@smithy/util-retry": "^3.0.3", "@smithy/util-utf8": "^3.0.0", "tslib": "^2.6.2" }, @@ -918,98 +774,100 @@ } }, "node_modules/@aws-sdk/client-sso-oidc": { - "version": "3.577.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/client-sso-oidc/-/client-sso-oidc-3.577.0.tgz", - "integrity": "sha512-njmKSPDWueWWYVFpFcZ2P3fI6/pdQVDa0FgCyYZhOnJLgEHZIcBBg1AsnkVWacBuLopp9XVt2m+7hO6ugY1/1g==", + "version": "3.620.1", + "resolved": "https://registry.npmjs.org/@aws-sdk/client-sso-oidc/-/client-sso-oidc-3.620.1.tgz", + "integrity": "sha512-gm69ttbkr7Kbg/Zzr3SczyLWkLgmK3bEZtkvbM/40ZW5ItYhDzJE48Ovs2lyA64h2YsOftDqqwcbJirAAdTgSg==", "dependencies": { - "@aws-crypto/sha256-browser": "3.0.0", - "@aws-crypto/sha256-js": "3.0.0", - "@aws-sdk/client-sts": "3.577.0", - "@aws-sdk/core": "3.576.0", - "@aws-sdk/credential-provider-node": "3.577.0", - "@aws-sdk/middleware-host-header": "3.577.0", - "@aws-sdk/middleware-logger": "3.577.0", - "@aws-sdk/middleware-recursion-detection": "3.577.0", - "@aws-sdk/middleware-user-agent": "3.577.0", - "@aws-sdk/region-config-resolver": "3.577.0", - "@aws-sdk/types": "3.577.0", - "@aws-sdk/util-endpoints": "3.577.0", - "@aws-sdk/util-user-agent-browser": "3.577.0", - "@aws-sdk/util-user-agent-node": "3.577.0", - "@smithy/config-resolver": "^3.0.0", - "@smithy/core": "^2.0.0", - "@smithy/fetch-http-handler": "^3.0.0", - "@smithy/hash-node": "^3.0.0", - "@smithy/invalid-dependency": "^3.0.0", - "@smithy/middleware-content-length": "^3.0.0", - "@smithy/middleware-endpoint": "^3.0.0", - "@smithy/middleware-retry": "^3.0.0", - "@smithy/middleware-serde": "^3.0.0", - "@smithy/middleware-stack": "^3.0.0", - "@smithy/node-config-provider": "^3.0.0", - "@smithy/node-http-handler": "^3.0.0", - "@smithy/protocol-http": "^4.0.0", - "@smithy/smithy-client": "^3.0.0", - "@smithy/types": "^3.0.0", - "@smithy/url-parser": "^3.0.0", + "@aws-crypto/sha256-browser": "5.2.0", + "@aws-crypto/sha256-js": "5.2.0", + "@aws-sdk/core": "3.620.1", + "@aws-sdk/credential-provider-node": "3.620.1", + "@aws-sdk/middleware-host-header": "3.620.0", + "@aws-sdk/middleware-logger": "3.609.0", + "@aws-sdk/middleware-recursion-detection": "3.620.0", + "@aws-sdk/middleware-user-agent": "3.620.0", + "@aws-sdk/region-config-resolver": "3.614.0", + "@aws-sdk/types": "3.609.0", + "@aws-sdk/util-endpoints": "3.614.0", + "@aws-sdk/util-user-agent-browser": "3.609.0", + "@aws-sdk/util-user-agent-node": "3.614.0", + "@smithy/config-resolver": "^3.0.5", + "@smithy/core": "^2.3.0", + "@smithy/fetch-http-handler": "^3.2.3", + "@smithy/hash-node": "^3.0.3", + "@smithy/invalid-dependency": "^3.0.3", + "@smithy/middleware-content-length": "^3.0.5", + "@smithy/middleware-endpoint": "^3.1.0", + "@smithy/middleware-retry": "^3.0.12", + "@smithy/middleware-serde": "^3.0.3", + "@smithy/middleware-stack": "^3.0.3", + "@smithy/node-config-provider": "^3.1.4", + "@smithy/node-http-handler": "^3.1.4", + "@smithy/protocol-http": "^4.1.0", + "@smithy/smithy-client": "^3.1.10", + "@smithy/types": "^3.3.0", + "@smithy/url-parser": "^3.0.3", "@smithy/util-base64": "^3.0.0", "@smithy/util-body-length-browser": "^3.0.0", "@smithy/util-body-length-node": "^3.0.0", - "@smithy/util-defaults-mode-browser": "^3.0.0", - "@smithy/util-defaults-mode-node": "^3.0.0", - "@smithy/util-endpoints": "^2.0.0", - "@smithy/util-middleware": "^3.0.0", - "@smithy/util-retry": "^3.0.0", + "@smithy/util-defaults-mode-browser": "^3.0.12", + "@smithy/util-defaults-mode-node": "^3.0.12", + "@smithy/util-endpoints": "^2.0.5", + "@smithy/util-middleware": "^3.0.3", + "@smithy/util-retry": "^3.0.3", "@smithy/util-utf8": "^3.0.0", "tslib": "^2.6.2" }, "engines": { "node": ">=16.0.0" + }, + "peerDependencies": { + "@aws-sdk/client-sts": "^3.620.1" } }, "node_modules/@aws-sdk/client-sts": { - "version": "3.577.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/client-sts/-/client-sts-3.577.0.tgz", - "integrity": "sha512-509Kklimva1XVlhGbpTpeX3kOP6ORpm44twJxDHpa9TURbmoaxj7veWlnLCbDorxDTrbsDghvYZshvcLsojVpg==", + "version": "3.620.1", + "resolved": "https://registry.npmjs.org/@aws-sdk/client-sts/-/client-sts-3.620.1.tgz", + "integrity": "sha512-d+ECGFDg0IsDdmfKU2O0VeMYKZcmbfBaA9HkZnZ39wu1BlXGI73xJe8cfmzbobvu+Ly+bAfHdLCpgIY+pD4D7g==", "dependencies": { - "@aws-crypto/sha256-browser": "3.0.0", - "@aws-crypto/sha256-js": "3.0.0", - "@aws-sdk/client-sso-oidc": "3.577.0", - "@aws-sdk/core": "3.576.0", - "@aws-sdk/credential-provider-node": "3.577.0", - "@aws-sdk/middleware-host-header": "3.577.0", - "@aws-sdk/middleware-logger": "3.577.0", - "@aws-sdk/middleware-recursion-detection": "3.577.0", - "@aws-sdk/middleware-user-agent": "3.577.0", - "@aws-sdk/region-config-resolver": "3.577.0", - "@aws-sdk/types": "3.577.0", - "@aws-sdk/util-endpoints": "3.577.0", - "@aws-sdk/util-user-agent-browser": "3.577.0", - "@aws-sdk/util-user-agent-node": "3.577.0", - "@smithy/config-resolver": "^3.0.0", - "@smithy/core": "^2.0.0", - "@smithy/fetch-http-handler": "^3.0.0", - "@smithy/hash-node": "^3.0.0", - "@smithy/invalid-dependency": "^3.0.0", - "@smithy/middleware-content-length": "^3.0.0", - "@smithy/middleware-endpoint": "^3.0.0", - "@smithy/middleware-retry": "^3.0.0", - "@smithy/middleware-serde": "^3.0.0", - "@smithy/middleware-stack": "^3.0.0", - "@smithy/node-config-provider": "^3.0.0", - "@smithy/node-http-handler": "^3.0.0", - "@smithy/protocol-http": "^4.0.0", - "@smithy/smithy-client": "^3.0.0", - "@smithy/types": "^3.0.0", - "@smithy/url-parser": "^3.0.0", + "@aws-crypto/sha256-browser": "5.2.0", + "@aws-crypto/sha256-js": "5.2.0", + "@aws-sdk/client-sso-oidc": "3.620.1", + "@aws-sdk/core": "3.620.1", + "@aws-sdk/credential-provider-node": "3.620.1", + "@aws-sdk/middleware-host-header": "3.620.0", + "@aws-sdk/middleware-logger": "3.609.0", + "@aws-sdk/middleware-recursion-detection": "3.620.0", + "@aws-sdk/middleware-user-agent": "3.620.0", + "@aws-sdk/region-config-resolver": "3.614.0", + "@aws-sdk/types": "3.609.0", + "@aws-sdk/util-endpoints": "3.614.0", + "@aws-sdk/util-user-agent-browser": "3.609.0", + "@aws-sdk/util-user-agent-node": "3.614.0", + "@smithy/config-resolver": "^3.0.5", + "@smithy/core": "^2.3.0", + "@smithy/fetch-http-handler": "^3.2.3", + "@smithy/hash-node": "^3.0.3", + "@smithy/invalid-dependency": "^3.0.3", + "@smithy/middleware-content-length": "^3.0.5", + "@smithy/middleware-endpoint": "^3.1.0", + "@smithy/middleware-retry": "^3.0.12", + "@smithy/middleware-serde": "^3.0.3", + "@smithy/middleware-stack": "^3.0.3", + "@smithy/node-config-provider": "^3.1.4", + "@smithy/node-http-handler": "^3.1.4", + "@smithy/protocol-http": "^4.1.0", + "@smithy/smithy-client": "^3.1.10", + "@smithy/types": "^3.3.0", + "@smithy/url-parser": "^3.0.3", "@smithy/util-base64": "^3.0.0", "@smithy/util-body-length-browser": "^3.0.0", "@smithy/util-body-length-node": "^3.0.0", - "@smithy/util-defaults-mode-browser": "^3.0.0", - "@smithy/util-defaults-mode-node": "^3.0.0", - "@smithy/util-endpoints": "^2.0.0", - "@smithy/util-middleware": "^3.0.0", - "@smithy/util-retry": "^3.0.0", + "@smithy/util-defaults-mode-browser": "^3.0.12", + "@smithy/util-defaults-mode-node": "^3.0.12", + "@smithy/util-endpoints": "^2.0.5", + "@smithy/util-middleware": "^3.0.3", + "@smithy/util-retry": "^3.0.3", "@smithy/util-utf8": "^3.0.0", "tslib": "^2.6.2" }, @@ -1018,15 +876,17 @@ } }, "node_modules/@aws-sdk/core": { - "version": "3.576.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/core/-/core-3.576.0.tgz", - "integrity": "sha512-KDvDlbeipSTIf+ffKtTg1m419TK7s9mZSWC8bvuZ9qx6/sjQFOXIKOVqyuli6DnfxGbvRcwoRuY99OcCH1N/0w==", + "version": "3.620.1", + "resolved": "https://registry.npmjs.org/@aws-sdk/core/-/core-3.620.1.tgz", + "integrity": "sha512-6Ejce93dDlDnovl6oYtxj3I/SJMOQoFdmmtM4+4W/cgMWH+l00T5aszVxDLjjPfu3Ryt7dNhrXaYeK2Ue1ZBmg==", "dependencies": { - "@smithy/core": "^2.0.0", - "@smithy/protocol-http": "^4.0.0", - "@smithy/signature-v4": "^3.0.0", - "@smithy/smithy-client": "^3.0.0", - "@smithy/types": "^3.0.0", + "@smithy/core": "^2.3.0", + "@smithy/node-config-provider": "^3.1.4", + "@smithy/protocol-http": "^4.1.0", + "@smithy/signature-v4": "^4.1.0", + "@smithy/smithy-client": "^3.1.10", + "@smithy/types": "^3.3.0", + "@smithy/util-middleware": "^3.0.3", "fast-xml-parser": "4.2.5", "tslib": "^2.6.2" }, @@ -1035,26 +895,14 @@ } }, "node_modules/@aws-sdk/credential-provider-cognito-identity": { - "version": "3.598.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-cognito-identity/-/credential-provider-cognito-identity-3.598.0.tgz", - "integrity": "sha512-u6oocRReswkA2mFlOwtCetgmEr9B+Yhle3K13x37rb1lQgq1wUuWUvHU7U9v26hUZIhfUpigV/Mgr/RQZB6+Yw==", + "version": "3.620.1", + "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-cognito-identity/-/credential-provider-cognito-identity-3.620.1.tgz", + "integrity": "sha512-Xj3KhllIQXnmONLOMvUInV6MsvxUut62jeKiD2k0fJNnGvJ2c2+h2/U6eMlhyneoVeVMvEKBw1L60X9vUb/aAw==", "dependencies": { - "@aws-sdk/client-cognito-identity": "3.598.0", - "@aws-sdk/types": "3.598.0", - "@smithy/property-provider": "^3.1.1", - "@smithy/types": "^3.1.0", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=16.0.0" - } - }, - "node_modules/@aws-sdk/credential-provider-cognito-identity/node_modules/@aws-sdk/types": { - "version": "3.598.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/types/-/types-3.598.0.tgz", - "integrity": "sha512-742uRl6z7u0LFmZwDrFP6r1wlZcgVPw+/TilluDJmCAR8BgRw3IR+743kUXKBGd8QZDRW2n6v/PYsi/AWCDDMQ==", - "dependencies": { - "@smithy/types": "^3.1.0", + "@aws-sdk/client-cognito-identity": "3.620.1", + "@aws-sdk/types": "3.609.0", + "@smithy/property-provider": "^3.1.3", + "@smithy/types": "^3.3.0", "tslib": "^2.6.2" }, "engines": { @@ -1062,13 +910,13 @@ } }, "node_modules/@aws-sdk/credential-provider-env": { - "version": "3.577.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-env/-/credential-provider-env-3.577.0.tgz", - "integrity": "sha512-Jxu255j0gToMGEiqufP8ZtKI8HW90lOLjwJ3LrdlD/NLsAY0tOQf1fWc53u28hWmmNGMxmCrL2p66IOgMDhDUw==", + "version": "3.620.1", + "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-env/-/credential-provider-env-3.620.1.tgz", + "integrity": "sha512-ExuILJ2qLW5ZO+rgkNRj0xiAipKT16Rk77buvPP8csR7kkCflT/gXTyzRe/uzIiETTxM7tr8xuO9MP/DQXqkfg==", "dependencies": { - "@aws-sdk/types": "3.577.0", - "@smithy/property-provider": "^3.0.0", - "@smithy/types": "^3.0.0", + "@aws-sdk/types": "3.609.0", + "@smithy/property-provider": "^3.1.3", + "@smithy/types": "^3.3.0", "tslib": "^2.6.2" }, "engines": { @@ -1076,18 +924,18 @@ } }, "node_modules/@aws-sdk/credential-provider-http": { - "version": "3.577.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-http/-/credential-provider-http-3.577.0.tgz", - "integrity": "sha512-n++yhCp67b9+ZRGEdY1jhamB5E/O+QsIDOPSuRmdaSGMCOd82oUEKPgIVEU1bkqxDsBxgiEWuvtfhK6sNiDS0A==", + "version": "3.620.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-http/-/credential-provider-http-3.620.0.tgz", + "integrity": "sha512-BI2BdrSKDmB/2ouB/NJR0PT0x/+5fmoF6XOE78hFBb4F5w/yynGgcJY936dF+oREfpME6ehjB2b0okGg78Scpw==", "dependencies": { - "@aws-sdk/types": "3.577.0", - "@smithy/fetch-http-handler": "^3.0.0", - "@smithy/node-http-handler": "^3.0.0", - "@smithy/property-provider": "^3.0.0", - "@smithy/protocol-http": "^4.0.0", - "@smithy/smithy-client": "^3.0.0", - "@smithy/types": "^3.0.0", - "@smithy/util-stream": "^3.0.0", + "@aws-sdk/types": "3.609.0", + "@smithy/fetch-http-handler": "^3.2.3", + "@smithy/node-http-handler": "^3.1.4", + "@smithy/property-provider": "^3.1.3", + "@smithy/protocol-http": "^4.1.0", + "@smithy/smithy-client": "^3.1.10", + "@smithy/types": "^3.3.0", + "@smithy/util-stream": "^3.1.2", "tslib": "^2.6.2" }, "engines": { @@ -1095,44 +943,45 @@ } }, "node_modules/@aws-sdk/credential-provider-ini": { - "version": "3.577.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-ini/-/credential-provider-ini-3.577.0.tgz", - "integrity": "sha512-q7lHPtv6BjRvChUE3m0tIaEZKxPTaZ1B3lKxGYsFl3VLAu5N8yGCUKwuA1izf4ucT+LyKscVGqK6VDZx1ev3nw==", + "version": "3.620.1", + "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-ini/-/credential-provider-ini-3.620.1.tgz", + "integrity": "sha512-m9jwigMPRlRRhoPxCQZMOwQUd6imEJbksF6tSMYNae76DIvrCi4z2Jhp6RJ9Mij8cnewUZCAmvu2FlK9+n9M7A==", "dependencies": { - "@aws-sdk/credential-provider-env": "3.577.0", - "@aws-sdk/credential-provider-process": "3.577.0", - "@aws-sdk/credential-provider-sso": "3.577.0", - "@aws-sdk/credential-provider-web-identity": "3.577.0", - "@aws-sdk/types": "3.577.0", - "@smithy/credential-provider-imds": "^3.0.0", - "@smithy/property-provider": "^3.0.0", - "@smithy/shared-ini-file-loader": "^3.0.0", - "@smithy/types": "^3.0.0", + "@aws-sdk/credential-provider-env": "3.620.1", + "@aws-sdk/credential-provider-http": "3.620.0", + "@aws-sdk/credential-provider-process": "3.620.1", + "@aws-sdk/credential-provider-sso": "3.620.1", + "@aws-sdk/credential-provider-web-identity": "3.609.0", + "@aws-sdk/types": "3.609.0", + "@smithy/credential-provider-imds": "^3.2.0", + "@smithy/property-provider": "^3.1.3", + "@smithy/shared-ini-file-loader": "^3.1.4", + "@smithy/types": "^3.3.0", "tslib": "^2.6.2" }, "engines": { "node": ">=16.0.0" }, "peerDependencies": { - "@aws-sdk/client-sts": "^3.577.0" + "@aws-sdk/client-sts": "^3.620.1" } }, "node_modules/@aws-sdk/credential-provider-node": { - "version": "3.577.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-node/-/credential-provider-node-3.577.0.tgz", - "integrity": "sha512-epZ1HOMsrXBNczc0HQpv0VMjqAEpc09DUA7Rg3gUJfn8umhML7A7bXnUyqPA+S54q397UYg1leQKdSn23OiwQQ==", + "version": "3.620.1", + "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-node/-/credential-provider-node-3.620.1.tgz", + "integrity": "sha512-KaprIJW2azM+oTIHi7S1ayJ3oQqoFwpMBWFpZM1nvSzaPucrZIUmX2m4uVrMM4LfXsfUsgMkrme2rBI1fGAjCg==", "dependencies": { - "@aws-sdk/credential-provider-env": "3.577.0", - "@aws-sdk/credential-provider-http": "3.577.0", - "@aws-sdk/credential-provider-ini": "3.577.0", - "@aws-sdk/credential-provider-process": "3.577.0", - "@aws-sdk/credential-provider-sso": "3.577.0", - "@aws-sdk/credential-provider-web-identity": "3.577.0", - "@aws-sdk/types": "3.577.0", - "@smithy/credential-provider-imds": "^3.0.0", - "@smithy/property-provider": "^3.0.0", - "@smithy/shared-ini-file-loader": "^3.0.0", - "@smithy/types": "^3.0.0", + "@aws-sdk/credential-provider-env": "3.620.1", + "@aws-sdk/credential-provider-http": "3.620.0", + "@aws-sdk/credential-provider-ini": "3.620.1", + "@aws-sdk/credential-provider-process": "3.620.1", + "@aws-sdk/credential-provider-sso": "3.620.1", + "@aws-sdk/credential-provider-web-identity": "3.609.0", + "@aws-sdk/types": "3.609.0", + "@smithy/credential-provider-imds": "^3.2.0", + "@smithy/property-provider": "^3.1.3", + "@smithy/shared-ini-file-loader": "^3.1.4", + "@smithy/types": "^3.3.0", "tslib": "^2.6.2" }, "engines": { @@ -1140,14 +989,14 @@ } }, "node_modules/@aws-sdk/credential-provider-process": { - "version": "3.577.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-process/-/credential-provider-process-3.577.0.tgz", - "integrity": "sha512-Gin6BWtOiXxIgITrJ3Nwc+Y2P1uVT6huYR4EcbA/DJUPWyO0n9y5UFLewPvVbLkRn15JeEqErBLUrHclkiOKtw==", + "version": "3.620.1", + "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-process/-/credential-provider-process-3.620.1.tgz", + "integrity": "sha512-hWqFMidqLAkaV9G460+1at6qa9vySbjQKKc04p59OT7lZ5cO5VH5S4aI05e+m4j364MBROjjk2ugNvfNf/8ILg==", "dependencies": { - "@aws-sdk/types": "3.577.0", - "@smithy/property-provider": "^3.0.0", - "@smithy/shared-ini-file-loader": "^3.0.0", - "@smithy/types": "^3.0.0", + "@aws-sdk/types": "3.609.0", + "@smithy/property-provider": "^3.1.3", + "@smithy/shared-ini-file-loader": "^3.1.4", + "@smithy/types": "^3.3.0", "tslib": "^2.6.2" }, "engines": { @@ -1155,16 +1004,16 @@ } }, "node_modules/@aws-sdk/credential-provider-sso": { - "version": "3.577.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-sso/-/credential-provider-sso-3.577.0.tgz", - "integrity": "sha512-iVm5SQvS7EgZTJsRaqUOmDQpBQPPPat42SCbWFvFQOLrl8qewq8OP94hFS5w2mP62zngeYzqhJnDel79HXbxew==", + "version": "3.620.1", + "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-sso/-/credential-provider-sso-3.620.1.tgz", + "integrity": "sha512-cFU8e6ctdkWR8BRCnHFzs37N+ilbHf1OT2EeMjt1ZDE9FgTD5L5BTgVWDxnPmyQnEoBs1p4PyNPHkpHY5EmswQ==", "dependencies": { - "@aws-sdk/client-sso": "3.577.0", - "@aws-sdk/token-providers": "3.577.0", - "@aws-sdk/types": "3.577.0", - "@smithy/property-provider": "^3.0.0", - "@smithy/shared-ini-file-loader": "^3.0.0", - "@smithy/types": "^3.0.0", + "@aws-sdk/client-sso": "3.620.1", + "@aws-sdk/token-providers": "3.614.0", + "@aws-sdk/types": "3.609.0", + "@smithy/property-provider": "^3.1.3", + "@smithy/shared-ini-file-loader": "^3.1.4", + "@smithy/types": "^3.3.0", "tslib": "^2.6.2" }, "engines": { @@ -1172,590 +1021,56 @@ } }, "node_modules/@aws-sdk/credential-provider-web-identity": { - "version": "3.577.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-web-identity/-/credential-provider-web-identity-3.577.0.tgz", - "integrity": "sha512-ZGHGNRaCtJJmszb9UTnC7izNCtRUttdPlLdMkh41KPS32vfdrBDHs1JrpbZijItRj1xKuOXsiYSXLAaHGcLh8Q==", + "version": "3.609.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-web-identity/-/credential-provider-web-identity-3.609.0.tgz", + "integrity": "sha512-U+PG8NhlYYF45zbr1km3ROtBMYqyyj/oK8NRp++UHHeuavgrP+4wJ4wQnlEaKvJBjevfo3+dlIBcaeQ7NYejWg==", "dependencies": { - "@aws-sdk/types": "3.577.0", - "@smithy/property-provider": "^3.0.0", - "@smithy/types": "^3.0.0", + "@aws-sdk/types": "3.609.0", + "@smithy/property-provider": "^3.1.3", + "@smithy/types": "^3.3.0", "tslib": "^2.6.2" }, "engines": { "node": ">=16.0.0" }, "peerDependencies": { - "@aws-sdk/client-sts": "^3.577.0" + "@aws-sdk/client-sts": "^3.609.0" } }, "node_modules/@aws-sdk/credential-providers": { - "version": "3.598.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/credential-providers/-/credential-providers-3.598.0.tgz", - "integrity": "sha512-IFZwH3F2rA2WbpYFUxOeu/M3/9p4+oRbKVLDZlaaDtwwuZ9VHEbnkUm20zOgSXeVExa3qgYhJvg7H5JrqxP97A==", + "version": "3.620.1", + "resolved": "https://registry.npmjs.org/@aws-sdk/credential-providers/-/credential-providers-3.620.1.tgz", + "integrity": "sha512-jclJi7bNtwYBrlzMwuTLqbYIKqLb00JSRJG7oQHXuQYbVAKkU2iRhnLpitLBfXklyEIDv/LmW+MKvq8uOhYNkQ==", "dependencies": { - "@aws-sdk/client-cognito-identity": "3.598.0", - "@aws-sdk/client-sso": "3.598.0", - "@aws-sdk/client-sts": "3.598.0", - "@aws-sdk/credential-provider-cognito-identity": "3.598.0", - "@aws-sdk/credential-provider-env": "3.598.0", - "@aws-sdk/credential-provider-http": "3.598.0", - "@aws-sdk/credential-provider-ini": "3.598.0", - "@aws-sdk/credential-provider-node": "3.598.0", - "@aws-sdk/credential-provider-process": "3.598.0", - "@aws-sdk/credential-provider-sso": "3.598.0", - "@aws-sdk/credential-provider-web-identity": "3.598.0", - "@aws-sdk/types": "3.598.0", - "@smithy/credential-provider-imds": "^3.1.1", - "@smithy/property-provider": "^3.1.1", - "@smithy/types": "^3.1.0", + "@aws-sdk/client-cognito-identity": "3.620.1", + "@aws-sdk/client-sso": "3.620.1", + "@aws-sdk/client-sts": "3.620.1", + "@aws-sdk/credential-provider-cognito-identity": "3.620.1", + "@aws-sdk/credential-provider-env": "3.620.1", + "@aws-sdk/credential-provider-http": "3.620.0", + "@aws-sdk/credential-provider-ini": "3.620.1", + "@aws-sdk/credential-provider-node": "3.620.1", + "@aws-sdk/credential-provider-process": "3.620.1", + "@aws-sdk/credential-provider-sso": "3.620.1", + "@aws-sdk/credential-provider-web-identity": "3.609.0", + "@aws-sdk/types": "3.609.0", + "@smithy/credential-provider-imds": "^3.2.0", + "@smithy/property-provider": "^3.1.3", + "@smithy/types": "^3.3.0", "tslib": "^2.6.2" }, "engines": { "node": ">=16.0.0" } }, - "node_modules/@aws-sdk/credential-providers/node_modules/@aws-crypto/sha256-browser": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/@aws-crypto/sha256-browser/-/sha256-browser-5.2.0.tgz", - "integrity": "sha512-AXfN/lGotSQwu6HNcEsIASo7kWXZ5HYWvfOmSNKDsEqC4OashTp8alTmaz+F7TC2L083SFv5RdB+qU3Vs1kZqw==", - "dependencies": { - "@aws-crypto/sha256-js": "^5.2.0", - "@aws-crypto/supports-web-crypto": "^5.2.0", - "@aws-crypto/util": "^5.2.0", - "@aws-sdk/types": "^3.222.0", - "@aws-sdk/util-locate-window": "^3.0.0", - "@smithy/util-utf8": "^2.0.0", - "tslib": "^2.6.2" - } - }, - "node_modules/@aws-sdk/credential-providers/node_modules/@aws-crypto/sha256-browser/node_modules/@smithy/util-utf8": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/@smithy/util-utf8/-/util-utf8-2.3.0.tgz", - "integrity": "sha512-R8Rdn8Hy72KKcebgLiv8jQcQkXoLMOGGv5uI1/k0l+snqkOzQ1R0ChUBCxWMlBsFMekWjq0wRudIweFs7sKT5A==", - "dependencies": { - "@smithy/util-buffer-from": "^2.2.0", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=14.0.0" - } - }, - "node_modules/@aws-sdk/credential-providers/node_modules/@aws-crypto/sha256-js": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/@aws-crypto/sha256-js/-/sha256-js-5.2.0.tgz", - "integrity": "sha512-FFQQyu7edu4ufvIZ+OadFpHHOt+eSTBaYaki44c+akjg7qZg9oOQeLlk77F6tSYqjDAFClrHJk9tMf0HdVyOvA==", - "dependencies": { - "@aws-crypto/util": "^5.2.0", - "@aws-sdk/types": "^3.222.0", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=16.0.0" - } - }, - "node_modules/@aws-sdk/credential-providers/node_modules/@aws-crypto/supports-web-crypto": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/@aws-crypto/supports-web-crypto/-/supports-web-crypto-5.2.0.tgz", - "integrity": "sha512-iAvUotm021kM33eCdNfwIN//F77/IADDSs58i+MDaOqFrVjZo9bAal0NK7HurRuWLLpF1iLX7gbWrjHjeo+YFg==", - "dependencies": { - "tslib": "^2.6.2" - } - }, - "node_modules/@aws-sdk/credential-providers/node_modules/@aws-crypto/util": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/@aws-crypto/util/-/util-5.2.0.tgz", - "integrity": "sha512-4RkU9EsI6ZpBve5fseQlGNUWKMa1RLPQ1dnjnQoe07ldfIzcsGb5hC5W0Dm7u423KWzawlrpbjXBrXCEv9zazQ==", - "dependencies": { - "@aws-sdk/types": "^3.222.0", - "@smithy/util-utf8": "^2.0.0", - "tslib": "^2.6.2" - } - }, - "node_modules/@aws-sdk/credential-providers/node_modules/@aws-crypto/util/node_modules/@smithy/util-utf8": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/@smithy/util-utf8/-/util-utf8-2.3.0.tgz", - "integrity": "sha512-R8Rdn8Hy72KKcebgLiv8jQcQkXoLMOGGv5uI1/k0l+snqkOzQ1R0ChUBCxWMlBsFMekWjq0wRudIweFs7sKT5A==", - "dependencies": { - "@smithy/util-buffer-from": "^2.2.0", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=14.0.0" - } - }, - "node_modules/@aws-sdk/credential-providers/node_modules/@aws-sdk/client-sso": { - "version": "3.598.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/client-sso/-/client-sso-3.598.0.tgz", - "integrity": "sha512-nOI5lqPYa+YZlrrzwAJywJSw3MKVjvu6Ge2fCqQUNYMfxFB0NAaDFnl0EPjXi+sEbtCuz/uWE77poHbqiZ+7Iw==", - "dependencies": { - "@aws-crypto/sha256-browser": "5.2.0", - "@aws-crypto/sha256-js": "5.2.0", - "@aws-sdk/core": "3.598.0", - "@aws-sdk/middleware-host-header": "3.598.0", - "@aws-sdk/middleware-logger": "3.598.0", - "@aws-sdk/middleware-recursion-detection": "3.598.0", - "@aws-sdk/middleware-user-agent": "3.598.0", - "@aws-sdk/region-config-resolver": "3.598.0", - "@aws-sdk/types": "3.598.0", - "@aws-sdk/util-endpoints": "3.598.0", - "@aws-sdk/util-user-agent-browser": "3.598.0", - "@aws-sdk/util-user-agent-node": "3.598.0", - "@smithy/config-resolver": "^3.0.2", - "@smithy/core": "^2.2.1", - "@smithy/fetch-http-handler": "^3.0.2", - "@smithy/hash-node": "^3.0.1", - "@smithy/invalid-dependency": "^3.0.1", - "@smithy/middleware-content-length": "^3.0.1", - "@smithy/middleware-endpoint": "^3.0.2", - "@smithy/middleware-retry": "^3.0.4", - "@smithy/middleware-serde": "^3.0.1", - "@smithy/middleware-stack": "^3.0.1", - "@smithy/node-config-provider": "^3.1.1", - "@smithy/node-http-handler": "^3.0.1", - "@smithy/protocol-http": "^4.0.1", - "@smithy/smithy-client": "^3.1.2", - "@smithy/types": "^3.1.0", - "@smithy/url-parser": "^3.0.1", - "@smithy/util-base64": "^3.0.0", - "@smithy/util-body-length-browser": "^3.0.0", - "@smithy/util-body-length-node": "^3.0.0", - "@smithy/util-defaults-mode-browser": "^3.0.4", - "@smithy/util-defaults-mode-node": "^3.0.4", - "@smithy/util-endpoints": "^2.0.2", - "@smithy/util-middleware": "^3.0.1", - "@smithy/util-retry": "^3.0.1", - "@smithy/util-utf8": "^3.0.0", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=16.0.0" - } - }, - "node_modules/@aws-sdk/credential-providers/node_modules/@aws-sdk/client-sso-oidc": { - "version": "3.598.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/client-sso-oidc/-/client-sso-oidc-3.598.0.tgz", - "integrity": "sha512-jfdH1pAO9Tt8Nkta/JJLoUnwl7jaRdxToQTJfUtE+o3+0JP5sA4LfC2rBkJSWcU5BdAA+kyOs5Lv776DlN04Vg==", - "dependencies": { - "@aws-crypto/sha256-browser": "5.2.0", - "@aws-crypto/sha256-js": "5.2.0", - "@aws-sdk/client-sts": "3.598.0", - "@aws-sdk/core": "3.598.0", - "@aws-sdk/credential-provider-node": "3.598.0", - "@aws-sdk/middleware-host-header": "3.598.0", - "@aws-sdk/middleware-logger": "3.598.0", - "@aws-sdk/middleware-recursion-detection": "3.598.0", - "@aws-sdk/middleware-user-agent": "3.598.0", - "@aws-sdk/region-config-resolver": "3.598.0", - "@aws-sdk/types": "3.598.0", - "@aws-sdk/util-endpoints": "3.598.0", - "@aws-sdk/util-user-agent-browser": "3.598.0", - "@aws-sdk/util-user-agent-node": "3.598.0", - "@smithy/config-resolver": "^3.0.2", - "@smithy/core": "^2.2.1", - "@smithy/fetch-http-handler": "^3.0.2", - "@smithy/hash-node": "^3.0.1", - "@smithy/invalid-dependency": "^3.0.1", - "@smithy/middleware-content-length": "^3.0.1", - "@smithy/middleware-endpoint": "^3.0.2", - "@smithy/middleware-retry": "^3.0.4", - "@smithy/middleware-serde": "^3.0.1", - "@smithy/middleware-stack": "^3.0.1", - "@smithy/node-config-provider": "^3.1.1", - "@smithy/node-http-handler": "^3.0.1", - "@smithy/protocol-http": "^4.0.1", - "@smithy/smithy-client": "^3.1.2", - "@smithy/types": "^3.1.0", - "@smithy/url-parser": "^3.0.1", - "@smithy/util-base64": "^3.0.0", - "@smithy/util-body-length-browser": "^3.0.0", - "@smithy/util-body-length-node": "^3.0.0", - "@smithy/util-defaults-mode-browser": "^3.0.4", - "@smithy/util-defaults-mode-node": "^3.0.4", - "@smithy/util-endpoints": "^2.0.2", - "@smithy/util-middleware": "^3.0.1", - "@smithy/util-retry": "^3.0.1", - "@smithy/util-utf8": "^3.0.0", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=16.0.0" - } - }, - "node_modules/@aws-sdk/credential-providers/node_modules/@aws-sdk/client-sts": { - "version": "3.598.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/client-sts/-/client-sts-3.598.0.tgz", - "integrity": "sha512-bXhz/cHL0iB9UH9IFtMaJJf4F8mV+HzncETCRFzZ9SyUMt5rP9j8A7VZknqGYSx/6mI8SsB1XJQkWSbhn6FiSQ==", - "dependencies": { - "@aws-crypto/sha256-browser": "5.2.0", - "@aws-crypto/sha256-js": "5.2.0", - "@aws-sdk/client-sso-oidc": "3.598.0", - "@aws-sdk/core": "3.598.0", - "@aws-sdk/credential-provider-node": "3.598.0", - "@aws-sdk/middleware-host-header": "3.598.0", - "@aws-sdk/middleware-logger": "3.598.0", - "@aws-sdk/middleware-recursion-detection": "3.598.0", - "@aws-sdk/middleware-user-agent": "3.598.0", - "@aws-sdk/region-config-resolver": "3.598.0", - "@aws-sdk/types": "3.598.0", - "@aws-sdk/util-endpoints": "3.598.0", - "@aws-sdk/util-user-agent-browser": "3.598.0", - "@aws-sdk/util-user-agent-node": "3.598.0", - "@smithy/config-resolver": "^3.0.2", - "@smithy/core": "^2.2.1", - "@smithy/fetch-http-handler": "^3.0.2", - "@smithy/hash-node": "^3.0.1", - "@smithy/invalid-dependency": "^3.0.1", - "@smithy/middleware-content-length": "^3.0.1", - "@smithy/middleware-endpoint": "^3.0.2", - "@smithy/middleware-retry": "^3.0.4", - "@smithy/middleware-serde": "^3.0.1", - "@smithy/middleware-stack": "^3.0.1", - "@smithy/node-config-provider": "^3.1.1", - "@smithy/node-http-handler": "^3.0.1", - "@smithy/protocol-http": "^4.0.1", - "@smithy/smithy-client": "^3.1.2", - "@smithy/types": "^3.1.0", - "@smithy/url-parser": "^3.0.1", - "@smithy/util-base64": "^3.0.0", - "@smithy/util-body-length-browser": "^3.0.0", - "@smithy/util-body-length-node": "^3.0.0", - "@smithy/util-defaults-mode-browser": "^3.0.4", - "@smithy/util-defaults-mode-node": "^3.0.4", - "@smithy/util-endpoints": "^2.0.2", - "@smithy/util-middleware": "^3.0.1", - "@smithy/util-retry": "^3.0.1", - "@smithy/util-utf8": "^3.0.0", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=16.0.0" - } - }, - "node_modules/@aws-sdk/credential-providers/node_modules/@aws-sdk/core": { - "version": "3.598.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/core/-/core-3.598.0.tgz", - "integrity": "sha512-HaSjt7puO5Cc7cOlrXFCW0rtA0BM9lvzjl56x0A20Pt+0wxXGeTOZZOkXQIepbrFkV2e/HYukuT9e99vXDm59g==", - "dependencies": { - "@smithy/core": "^2.2.1", - "@smithy/protocol-http": "^4.0.1", - "@smithy/signature-v4": "^3.1.0", - "@smithy/smithy-client": "^3.1.2", - "@smithy/types": "^3.1.0", - "fast-xml-parser": "4.2.5", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=16.0.0" - } - }, - "node_modules/@aws-sdk/credential-providers/node_modules/@aws-sdk/credential-provider-env": { - "version": "3.598.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-env/-/credential-provider-env-3.598.0.tgz", - "integrity": "sha512-vi1khgn7yXzLCcgSIzQrrtd2ilUM0dWodxj3PQ6BLfP0O+q1imO3hG1nq7DVyJtq7rFHs6+9N8G4mYvTkxby2w==", - "dependencies": { - "@aws-sdk/types": "3.598.0", - "@smithy/property-provider": "^3.1.1", - "@smithy/types": "^3.1.0", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=16.0.0" - } - }, - "node_modules/@aws-sdk/credential-providers/node_modules/@aws-sdk/credential-provider-http": { - "version": "3.598.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-http/-/credential-provider-http-3.598.0.tgz", - "integrity": "sha512-N7cIafi4HVlQvEgvZSo1G4T9qb/JMLGMdBsDCT5XkeJrF0aptQWzTFH0jIdZcLrMYvzPcuEyO3yCBe6cy/ba0g==", - "dependencies": { - "@aws-sdk/types": "3.598.0", - "@smithy/fetch-http-handler": "^3.0.2", - "@smithy/node-http-handler": "^3.0.1", - "@smithy/property-provider": "^3.1.1", - "@smithy/protocol-http": "^4.0.1", - "@smithy/smithy-client": "^3.1.2", - "@smithy/types": "^3.1.0", - "@smithy/util-stream": "^3.0.2", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=16.0.0" - } - }, - "node_modules/@aws-sdk/credential-providers/node_modules/@aws-sdk/credential-provider-ini": { - "version": "3.598.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-ini/-/credential-provider-ini-3.598.0.tgz", - "integrity": "sha512-/ppcIVUbRwDIwJDoYfp90X3+AuJo2mvE52Y1t2VSrvUovYn6N4v95/vXj6LS8CNDhz2jvEJYmu+0cTMHdhI6eA==", - "dependencies": { - "@aws-sdk/credential-provider-env": "3.598.0", - "@aws-sdk/credential-provider-http": "3.598.0", - "@aws-sdk/credential-provider-process": "3.598.0", - "@aws-sdk/credential-provider-sso": "3.598.0", - "@aws-sdk/credential-provider-web-identity": "3.598.0", - "@aws-sdk/types": "3.598.0", - "@smithy/credential-provider-imds": "^3.1.1", - "@smithy/property-provider": "^3.1.1", - "@smithy/shared-ini-file-loader": "^3.1.1", - "@smithy/types": "^3.1.0", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=16.0.0" - }, - "peerDependencies": { - "@aws-sdk/client-sts": "^3.598.0" - } - }, - "node_modules/@aws-sdk/credential-providers/node_modules/@aws-sdk/credential-provider-node": { - "version": "3.598.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-node/-/credential-provider-node-3.598.0.tgz", - "integrity": "sha512-sXTlqL5I/awlF9Dg2MQ17SfrEaABVnsj2mf4jF5qQrIRhfbvQOIYdEqdy8Rn1AWlJMz/N450SGzc0XJ5owxxqw==", - "dependencies": { - "@aws-sdk/credential-provider-env": "3.598.0", - "@aws-sdk/credential-provider-http": "3.598.0", - "@aws-sdk/credential-provider-ini": "3.598.0", - "@aws-sdk/credential-provider-process": "3.598.0", - "@aws-sdk/credential-provider-sso": "3.598.0", - "@aws-sdk/credential-provider-web-identity": "3.598.0", - "@aws-sdk/types": "3.598.0", - "@smithy/credential-provider-imds": "^3.1.1", - "@smithy/property-provider": "^3.1.1", - "@smithy/shared-ini-file-loader": "^3.1.1", - "@smithy/types": "^3.1.0", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=16.0.0" - } - }, - "node_modules/@aws-sdk/credential-providers/node_modules/@aws-sdk/credential-provider-process": { - "version": "3.598.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-process/-/credential-provider-process-3.598.0.tgz", - "integrity": "sha512-rM707XbLW8huMk722AgjVyxu2tMZee++fNA8TJVNgs1Ma02Wx6bBrfIvlyK0rCcIRb0WdQYP6fe3Xhiu4e8IBA==", - "dependencies": { - "@aws-sdk/types": "3.598.0", - "@smithy/property-provider": "^3.1.1", - "@smithy/shared-ini-file-loader": "^3.1.1", - "@smithy/types": "^3.1.0", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=16.0.0" - } - }, - "node_modules/@aws-sdk/credential-providers/node_modules/@aws-sdk/credential-provider-sso": { - "version": "3.598.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-sso/-/credential-provider-sso-3.598.0.tgz", - "integrity": "sha512-5InwUmrAuqQdOOgxTccRayMMkSmekdLk6s+az9tmikq0QFAHUCtofI+/fllMXSR9iL6JbGYi1940+EUmS4pHJA==", - "dependencies": { - "@aws-sdk/client-sso": "3.598.0", - "@aws-sdk/token-providers": "3.598.0", - "@aws-sdk/types": "3.598.0", - "@smithy/property-provider": "^3.1.1", - "@smithy/shared-ini-file-loader": "^3.1.1", - "@smithy/types": "^3.1.0", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=16.0.0" - } - }, - "node_modules/@aws-sdk/credential-providers/node_modules/@aws-sdk/credential-provider-web-identity": { - "version": "3.598.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-web-identity/-/credential-provider-web-identity-3.598.0.tgz", - "integrity": "sha512-GV5GdiMbz5Tz9JO4NJtRoFXjW0GPEujA0j+5J/B723rTN+REHthJu48HdBKouHGhdzkDWkkh1bu52V02Wprw8w==", - "dependencies": { - "@aws-sdk/types": "3.598.0", - "@smithy/property-provider": "^3.1.1", - "@smithy/types": "^3.1.0", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=16.0.0" - }, - "peerDependencies": { - "@aws-sdk/client-sts": "^3.598.0" - } - }, - "node_modules/@aws-sdk/credential-providers/node_modules/@aws-sdk/middleware-host-header": { - "version": "3.598.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/middleware-host-header/-/middleware-host-header-3.598.0.tgz", - "integrity": "sha512-WiaG059YBQwQraNejLIi0gMNkX7dfPZ8hDIhvMr5aVPRbaHH8AYF3iNSsXYCHvA2Cfa1O9haYXsuMF9flXnCmA==", - "dependencies": { - "@aws-sdk/types": "3.598.0", - "@smithy/protocol-http": "^4.0.1", - "@smithy/types": "^3.1.0", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=16.0.0" - } - }, - "node_modules/@aws-sdk/credential-providers/node_modules/@aws-sdk/middleware-logger": { - "version": "3.598.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/middleware-logger/-/middleware-logger-3.598.0.tgz", - "integrity": "sha512-bxBjf/VYiu3zfu8SYM2S9dQQc3tz5uBAOcPz/Bt8DyyK3GgOpjhschH/2XuUErsoUO1gDJqZSdGOmuHGZQn00Q==", - "dependencies": { - "@aws-sdk/types": "3.598.0", - "@smithy/types": "^3.1.0", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=16.0.0" - } - }, - "node_modules/@aws-sdk/credential-providers/node_modules/@aws-sdk/middleware-recursion-detection": { - "version": "3.598.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/middleware-recursion-detection/-/middleware-recursion-detection-3.598.0.tgz", - "integrity": "sha512-vjT9BeFY9FeN0f8hm2l6F53tI0N5bUq6RcDkQXKNabXBnQxKptJRad6oP2X5y3FoVfBLOuDkQgiC2940GIPxtQ==", - "dependencies": { - "@aws-sdk/types": "3.598.0", - "@smithy/protocol-http": "^4.0.1", - "@smithy/types": "^3.1.0", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=16.0.0" - } - }, - "node_modules/@aws-sdk/credential-providers/node_modules/@aws-sdk/middleware-user-agent": { - "version": "3.598.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/middleware-user-agent/-/middleware-user-agent-3.598.0.tgz", - "integrity": "sha512-4tjESlHG5B5MdjUaLK7tQs/miUtHbb6deauQx8ryqSBYOhfHVgb1ZnzvQR0bTrhpqUg0WlybSkDaZAICf9xctg==", - "dependencies": { - "@aws-sdk/types": "3.598.0", - "@aws-sdk/util-endpoints": "3.598.0", - "@smithy/protocol-http": "^4.0.1", - "@smithy/types": "^3.1.0", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=16.0.0" - } - }, - "node_modules/@aws-sdk/credential-providers/node_modules/@aws-sdk/region-config-resolver": { - "version": "3.598.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/region-config-resolver/-/region-config-resolver-3.598.0.tgz", - "integrity": "sha512-oYXhmTokSav4ytmWleCr3rs/1nyvZW/S0tdi6X7u+dLNL5Jee+uMxWGzgOrWK6wrQOzucLVjS4E/wA11Kv2GTw==", - "dependencies": { - "@aws-sdk/types": "3.598.0", - "@smithy/node-config-provider": "^3.1.1", - "@smithy/types": "^3.1.0", - "@smithy/util-config-provider": "^3.0.0", - "@smithy/util-middleware": "^3.0.1", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=16.0.0" - } - }, - "node_modules/@aws-sdk/credential-providers/node_modules/@aws-sdk/token-providers": { - "version": "3.598.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/token-providers/-/token-providers-3.598.0.tgz", - "integrity": "sha512-TKY1EVdHVBnZqpyxyTHdpZpa1tUpb6nxVeRNn1zWG8QB5MvH4ALLd/jR+gtmWDNQbIG4cVuBOZFVL8hIYicKTA==", - "dependencies": { - "@aws-sdk/types": "3.598.0", - "@smithy/property-provider": "^3.1.1", - "@smithy/shared-ini-file-loader": "^3.1.1", - "@smithy/types": "^3.1.0", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=16.0.0" - }, - "peerDependencies": { - "@aws-sdk/client-sso-oidc": "^3.598.0" - } - }, - "node_modules/@aws-sdk/credential-providers/node_modules/@aws-sdk/types": { - "version": "3.598.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/types/-/types-3.598.0.tgz", - "integrity": "sha512-742uRl6z7u0LFmZwDrFP6r1wlZcgVPw+/TilluDJmCAR8BgRw3IR+743kUXKBGd8QZDRW2n6v/PYsi/AWCDDMQ==", - "dependencies": { - "@smithy/types": "^3.1.0", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=16.0.0" - } - }, - "node_modules/@aws-sdk/credential-providers/node_modules/@aws-sdk/util-endpoints": { - "version": "3.598.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/util-endpoints/-/util-endpoints-3.598.0.tgz", - "integrity": "sha512-Qo9UoiVVZxcOEdiOMZg3xb1mzkTxrhd4qSlg5QQrfWPJVx/QOg+Iy0NtGxPtHtVZNHZxohYwDwV/tfsnDSE2gQ==", - "dependencies": { - "@aws-sdk/types": "3.598.0", - "@smithy/types": "^3.1.0", - "@smithy/util-endpoints": "^2.0.2", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=16.0.0" - } - }, - "node_modules/@aws-sdk/credential-providers/node_modules/@aws-sdk/util-user-agent-browser": { - "version": "3.598.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/util-user-agent-browser/-/util-user-agent-browser-3.598.0.tgz", - "integrity": "sha512-36Sxo6F+ykElaL1mWzWjlg+1epMpSe8obwhCN1yGE7Js9ywy5U6k6l+A3q3YM9YRbm740sNxncbwLklMvuhTKw==", - "dependencies": { - "@aws-sdk/types": "3.598.0", - "@smithy/types": "^3.1.0", - "bowser": "^2.11.0", - "tslib": "^2.6.2" - } - }, - "node_modules/@aws-sdk/credential-providers/node_modules/@aws-sdk/util-user-agent-node": { - "version": "3.598.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/util-user-agent-node/-/util-user-agent-node-3.598.0.tgz", - "integrity": "sha512-oyWGcOlfTdzkC6SVplyr0AGh54IMrDxbhg5RxJ5P+V4BKfcDoDcZV9xenUk9NsOi9MuUjxMumb9UJGkDhM1m0A==", - "dependencies": { - "@aws-sdk/types": "3.598.0", - "@smithy/node-config-provider": "^3.1.1", - "@smithy/types": "^3.1.0", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=16.0.0" - }, - "peerDependencies": { - "aws-crt": ">=1.0.0" - }, - "peerDependenciesMeta": { - "aws-crt": { - "optional": true - } - } - }, - "node_modules/@aws-sdk/credential-providers/node_modules/@smithy/is-array-buffer": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/@smithy/is-array-buffer/-/is-array-buffer-2.2.0.tgz", - "integrity": "sha512-GGP3O9QFD24uGeAXYUjwSTXARoqpZykHadOmA8G5vfJPK0/DC67qa//0qvqrJzL1xc8WQWX7/yc7fwudjPHPhA==", - "dependencies": { - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=14.0.0" - } - }, - "node_modules/@aws-sdk/credential-providers/node_modules/@smithy/util-buffer-from": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/@smithy/util-buffer-from/-/util-buffer-from-2.2.0.tgz", - "integrity": "sha512-IJdWBbTcMQ6DA0gdNhh/BwrLkDR+ADW5Kr1aZmd4k3DIF6ezMV4R2NIAmT08wQJ3yUK82thHWmC/TnK/wpMMIA==", - "dependencies": { - "@smithy/is-array-buffer": "^2.2.0", - "tslib": "^2.6.2" - }, - "engines": { - "node": ">=14.0.0" - } - }, "node_modules/@aws-sdk/middleware-host-header": { - "version": "3.577.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/middleware-host-header/-/middleware-host-header-3.577.0.tgz", - "integrity": "sha512-9ca5MJz455CODIVXs0/sWmJm7t3QO4EUa1zf8pE8grLpzf0J94bz/skDWm37Pli13T3WaAQBHCTiH2gUVfCsWg==", + "version": "3.620.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/middleware-host-header/-/middleware-host-header-3.620.0.tgz", + "integrity": "sha512-VMtPEZwqYrII/oUkffYsNWY9PZ9xpNJpMgmyU0rlDQ25O1c0Hk3fJmZRe6pEkAJ0omD7kLrqGl1DUjQVxpd/Rg==", "dependencies": { - "@aws-sdk/types": "3.577.0", - "@smithy/protocol-http": "^4.0.0", - "@smithy/types": "^3.0.0", + "@aws-sdk/types": "3.609.0", + "@smithy/protocol-http": "^4.1.0", + "@smithy/types": "^3.3.0", "tslib": "^2.6.2" }, "engines": { @@ -1763,12 +1078,12 @@ } }, "node_modules/@aws-sdk/middleware-logger": { - "version": "3.577.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/middleware-logger/-/middleware-logger-3.577.0.tgz", - "integrity": "sha512-aPFGpGjTZcJYk+24bg7jT4XdIp42mFXSuPt49lw5KygefLyJM/sB0bKKqPYYivW0rcuZ9brQ58eZUNthrzYAvg==", + "version": "3.609.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/middleware-logger/-/middleware-logger-3.609.0.tgz", + "integrity": "sha512-S62U2dy4jMDhDFDK5gZ4VxFdWzCtLzwbYyFZx2uvPYTECkepLUfzLic2BHg2Qvtu4QjX+oGE3P/7fwaGIsGNuQ==", "dependencies": { - "@aws-sdk/types": "3.577.0", - "@smithy/types": "^3.0.0", + "@aws-sdk/types": "3.609.0", + "@smithy/types": "^3.3.0", "tslib": "^2.6.2" }, "engines": { @@ -1776,13 +1091,13 @@ } }, "node_modules/@aws-sdk/middleware-recursion-detection": { - "version": "3.577.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/middleware-recursion-detection/-/middleware-recursion-detection-3.577.0.tgz", - "integrity": "sha512-pn3ZVEd2iobKJlR3H+bDilHjgRnNrQ6HMmK9ZzZw89Ckn3Dcbv48xOv4RJvu0aU8SDLl/SNCxppKjeLDTPGBNA==", + "version": "3.620.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/middleware-recursion-detection/-/middleware-recursion-detection-3.620.0.tgz", + "integrity": "sha512-nh91S7aGK3e/o1ck64sA/CyoFw+gAYj2BDOnoNa6ouyCrVJED96ZXWbhye/fz9SgmNUZR2g7GdVpiLpMKZoI5w==", "dependencies": { - "@aws-sdk/types": "3.577.0", - "@smithy/protocol-http": "^4.0.0", - "@smithy/types": "^3.0.0", + "@aws-sdk/types": "3.609.0", + "@smithy/protocol-http": "^4.1.0", + "@smithy/types": "^3.3.0", "tslib": "^2.6.2" }, "engines": { @@ -1790,14 +1105,14 @@ } }, "node_modules/@aws-sdk/middleware-user-agent": { - "version": "3.577.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/middleware-user-agent/-/middleware-user-agent-3.577.0.tgz", - "integrity": "sha512-P55HAXgwmiHHpFx5JEPvOnAbfhN7v6sWv9PBQs+z2tC7QiBcPS0cdJR6PfV7J1n4VPK52/OnrK3l9VxdQ7Ms0g==", + "version": "3.620.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/middleware-user-agent/-/middleware-user-agent-3.620.0.tgz", + "integrity": "sha512-bvS6etn+KsuL32ubY5D3xNof1qkenpbJXf/ugGXbg0n98DvDFQ/F+SMLxHgbnER5dsKYchNnhmtI6/FC3HFu/A==", "dependencies": { - "@aws-sdk/types": "3.577.0", - "@aws-sdk/util-endpoints": "3.577.0", - "@smithy/protocol-http": "^4.0.0", - "@smithy/types": "^3.0.0", + "@aws-sdk/types": "3.609.0", + "@aws-sdk/util-endpoints": "3.614.0", + "@smithy/protocol-http": "^4.1.0", + "@smithy/types": "^3.3.0", "tslib": "^2.6.2" }, "engines": { @@ -1805,15 +1120,15 @@ } }, "node_modules/@aws-sdk/region-config-resolver": { - "version": "3.577.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/region-config-resolver/-/region-config-resolver-3.577.0.tgz", - "integrity": "sha512-4ChCFACNwzqx/xjg3zgFcW8Ali6R9C95cFECKWT/7CUM1D0MGvkclSH2cLarmHCmJgU6onKkJroFtWp0kHhgyg==", + "version": "3.614.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/region-config-resolver/-/region-config-resolver-3.614.0.tgz", + "integrity": "sha512-vDCeMXvic/LU0KFIUjpC3RiSTIkkvESsEfbVHiHH0YINfl8HnEqR5rj+L8+phsCeVg2+LmYwYxd5NRz4PHxt5g==", "dependencies": { - "@aws-sdk/types": "3.577.0", - "@smithy/node-config-provider": "^3.0.0", - "@smithy/types": "^3.0.0", + "@aws-sdk/types": "3.609.0", + "@smithy/node-config-provider": "^3.1.4", + "@smithy/types": "^3.3.0", "@smithy/util-config-provider": "^3.0.0", - "@smithy/util-middleware": "^3.0.0", + "@smithy/util-middleware": "^3.0.3", "tslib": "^2.6.2" }, "engines": { @@ -1821,29 +1136,29 @@ } }, "node_modules/@aws-sdk/token-providers": { - "version": "3.577.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/token-providers/-/token-providers-3.577.0.tgz", - "integrity": "sha512-0CkIZpcC3DNQJQ1hDjm2bdSy/Xjs7Ny5YvSsacasGOkNfk+FdkiQy6N67bZX3Zbc9KIx+Nz4bu3iDeNSNplnnQ==", + "version": "3.614.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/token-providers/-/token-providers-3.614.0.tgz", + "integrity": "sha512-okItqyY6L9IHdxqs+Z116y5/nda7rHxLvROxtAJdLavWTYDydxrZstImNgGWTeVdmc0xX2gJCI77UYUTQWnhRw==", "dependencies": { - "@aws-sdk/types": "3.577.0", - "@smithy/property-provider": "^3.0.0", - "@smithy/shared-ini-file-loader": "^3.0.0", - "@smithy/types": "^3.0.0", + "@aws-sdk/types": "3.609.0", + "@smithy/property-provider": "^3.1.3", + "@smithy/shared-ini-file-loader": "^3.1.4", + "@smithy/types": "^3.3.0", "tslib": "^2.6.2" }, "engines": { "node": ">=16.0.0" }, "peerDependencies": { - "@aws-sdk/client-sso-oidc": "^3.577.0" + "@aws-sdk/client-sso-oidc": "^3.614.0" } }, "node_modules/@aws-sdk/types": { - "version": "3.577.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/types/-/types-3.577.0.tgz", - "integrity": "sha512-FT2JZES3wBKN/alfmhlo+3ZOq/XJ0C7QOZcDNrpKjB0kqYoKjhVKZ/Hx6ArR0czkKfHzBBEs6y40ebIHx2nSmA==", + "version": "3.609.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/types/-/types-3.609.0.tgz", + "integrity": "sha512-+Tqnh9w0h2LcrUsdXyT1F8mNhXz+tVYBtP19LpeEGntmvHwa2XzvLUCWpoIAIVsHp5+HdB2X9Sn0KAtmbFXc2Q==", "dependencies": { - "@smithy/types": "^3.0.0", + "@smithy/types": "^3.3.0", "tslib": "^2.6.2" }, "engines": { @@ -1851,13 +1166,13 @@ } }, "node_modules/@aws-sdk/util-endpoints": { - "version": "3.577.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/util-endpoints/-/util-endpoints-3.577.0.tgz", - "integrity": "sha512-FjuUz1Kdy4Zly2q/c58tpdqHd6z7iOdU/caYzoc8jwgAHBDBbIJNQLCU9hXJnPV2M8pWxQDyIZsoVwtmvErPzw==", + "version": "3.614.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/util-endpoints/-/util-endpoints-3.614.0.tgz", + "integrity": "sha512-wK2cdrXHH4oz4IomV/yrGkftU9A+ITB6nFL+rxxyO78is2ifHJpFdV4aqk4LSkXYPi6CXWNru/Dqc7yiKXgJPw==", "dependencies": { - "@aws-sdk/types": "3.577.0", - "@smithy/types": "^3.0.0", - "@smithy/util-endpoints": "^2.0.0", + "@aws-sdk/types": "3.609.0", + "@smithy/types": "^3.3.0", + "@smithy/util-endpoints": "^2.0.5", "tslib": "^2.6.2" }, "engines": { @@ -1876,24 +1191,24 @@ } }, "node_modules/@aws-sdk/util-user-agent-browser": { - "version": "3.577.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/util-user-agent-browser/-/util-user-agent-browser-3.577.0.tgz", - "integrity": "sha512-zEAzHgR6HWpZOH7xFgeJLc6/CzMcx4nxeQolZxVZoB5pPaJd3CjyRhZN0xXeZB0XIRCWmb4yJBgyiugXLNMkLA==", + "version": "3.609.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/util-user-agent-browser/-/util-user-agent-browser-3.609.0.tgz", + "integrity": "sha512-fojPU+mNahzQ0YHYBsx0ZIhmMA96H+ZIZ665ObU9tl+SGdbLneVZVikGve+NmHTQwHzwkFsZYYnVKAkreJLAtA==", "dependencies": { - "@aws-sdk/types": "3.577.0", - "@smithy/types": "^3.0.0", + "@aws-sdk/types": "3.609.0", + "@smithy/types": "^3.3.0", "bowser": "^2.11.0", "tslib": "^2.6.2" } }, "node_modules/@aws-sdk/util-user-agent-node": { - "version": "3.577.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/util-user-agent-node/-/util-user-agent-node-3.577.0.tgz", - "integrity": "sha512-XqvtFjbSMtycZTWVwDe8DRWovuoMbA54nhUoZwVU6rW9OSD6NZWGR512BUGHFaWzW0Wg8++Dj10FrKTG2XtqfA==", + "version": "3.614.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/util-user-agent-node/-/util-user-agent-node-3.614.0.tgz", + "integrity": "sha512-15ElZT88peoHnq5TEoEtZwoXTXRxNrk60TZNdpl/TUBJ5oNJ9Dqb5Z4ryb8ofN6nm9aFf59GVAerFDz8iUoHBA==", "dependencies": { - "@aws-sdk/types": "3.577.0", - "@smithy/node-config-provider": "^3.0.0", - "@smithy/types": "^3.0.0", + "@aws-sdk/types": "3.609.0", + "@smithy/node-config-provider": "^3.1.4", + "@smithy/types": "^3.3.0", "tslib": "^2.6.2" }, "engines": { @@ -1908,19 +1223,10 @@ } } }, - "node_modules/@aws-sdk/util-utf8-browser": { - "version": "3.259.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/util-utf8-browser/-/util-utf8-browser-3.259.0.tgz", - "integrity": "sha512-UvFa/vR+e19XookZF8RzFZBrw2EUkQWxiBW0yYQAhvk3C+QVGl0H3ouca8LDBlBfQKXwmW3huo/59H8rwb1wJw==", - "dependencies": { - "tslib": "^2.3.1" - } - }, "node_modules/@babel/code-frame": { "version": "7.24.7", "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.24.7.tgz", "integrity": "sha512-BcYH1CVJBO9tvyIZ2jVeXgSIMvGZ2FDRvDdOIVQyuklNKSsx+eppDEBq/g47Ayw+RqNFE+URvOShmf+f/qwAlA==", - "dev": true, "dependencies": { "@babel/highlight": "^7.24.7", "picocolors": "^1.0.0" @@ -2304,7 +1610,6 @@ "version": "7.24.7", "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.24.7.tgz", "integrity": "sha512-rR+PBcQ1SMQDDyF6X0wxtG8QyLCgUB0eRAGguqRLfkCA87l7yAP7ehq8SNj96OOGTO8OBV70KhuFYcIkHXOg0w==", - "dev": true, "engines": { "node": ">=6.9.0" } @@ -2351,7 +1656,6 @@ "version": "7.24.7", "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.24.7.tgz", "integrity": "sha512-EStJpq4OuY8xYfhGVXngigBJRWxftKX9ksiGDnmlY3o7B/V7KIAc9X4oiK87uPJSc/vs5L869bem5fhZa8caZw==", - "dev": true, "dependencies": { "@babel/helper-validator-identifier": "^7.24.7", "chalk": "^2.4.2", @@ -2366,7 +1670,6 @@ "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" }, @@ -2378,7 +1681,6 @@ "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", @@ -2392,7 +1694,6 @@ "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" } @@ -2400,14 +1701,12 @@ "node_modules/@babel/highlight/node_modules/color-name": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", - "dev": true + "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==" }, "node_modules/@babel/highlight/node_modules/escape-string-regexp": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", - "dev": true, "engines": { "node": ">=0.8.0" } @@ -2416,7 +1715,6 @@ "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" } @@ -2425,7 +1723,6 @@ "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" }, @@ -4435,6 +3732,18 @@ "@jridgewell/sourcemap-codec": "^1.4.14" } }, + "node_modules/@lancedb/vectordb-darwin-arm64": { + "version": "0.4.20", + "resolved": "https://registry.npmjs.org/@lancedb/vectordb-darwin-arm64/-/vectordb-darwin-arm64-0.4.20.tgz", + "integrity": "sha512-ffP2K4sA5mQTgePyARw1y8dPN996FmpvyAYoWO+TSItaXlhcXvc+KVa5udNMCZMDYeEnEv2Xpj6k4PwW3oBz+A==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "darwin" + ] + }, "node_modules/@lancedb/vectordb-darwin-x64": { "version": "0.4.20", "resolved": "https://registry.npmjs.org/@lancedb/vectordb-darwin-x64/-/vectordb-darwin-x64-0.4.20.tgz", @@ -4447,6 +3756,42 @@ "darwin" ] }, + "node_modules/@lancedb/vectordb-linux-arm64-gnu": { + "version": "0.4.20", + "resolved": "https://registry.npmjs.org/@lancedb/vectordb-linux-arm64-gnu/-/vectordb-linux-arm64-gnu-0.4.20.tgz", + "integrity": "sha512-FpNOjOsz3nJVm6EBGyNgbOW2aFhsWZ/igeY45Z8hbZaaK2YBwrg/DASoNlUzgv6IR8cUaGJ2irNVJfsKR2cG6g==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@lancedb/vectordb-linux-x64-gnu": { + "version": "0.4.20", + "resolved": "https://registry.npmjs.org/@lancedb/vectordb-linux-x64-gnu/-/vectordb-linux-x64-gnu-0.4.20.tgz", + "integrity": "sha512-pOqWjrRZQSrLTlQPkjidRii7NZDw8Xu9pN6ouVu2JAK8n81FXaPtFCyAI+Y3v9GpnYDN0rvD4eQ36aHAVPsa2g==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@lancedb/vectordb-win32-x64-msvc": { + "version": "0.4.20", + "resolved": "https://registry.npmjs.org/@lancedb/vectordb-win32-x64-msvc/-/vectordb-win32-x64-msvc-0.4.20.tgz", + "integrity": "sha512-5J5SsYSJ7jRCmU/sgwVHdrGz43B/7R2T9OEoFTKyVAtqTZdu75rkytXyn9SyEayXVhlUOaw76N0ASm0hAoDS/A==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "win32" + ] + }, "node_modules/@mozilla/readability": { "version": "0.5.0", "resolved": "https://registry.npmjs.org/@mozilla/readability/-/readability-0.5.0.tgz", @@ -4713,6 +4058,27 @@ "resolved": "https://registry.npmjs.org/@protobufjs/utf8/-/utf8-1.1.0.tgz", "integrity": "sha512-Vvn3zZrhQZkkBE8LSuW3em98c0FwgO4nxzv6OdSxPKJIEKY2bGbHn+mhGIPerzI4twdxaP8/0+06HBpwf345Lw==" }, + "node_modules/@puppeteer/browsers": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/@puppeteer/browsers/-/browsers-2.3.0.tgz", + "integrity": "sha512-ioXoq9gPxkss4MYhD+SFaU9p1IHFUX0ILAWFPyjGaBdjLsYAlZw6j1iLA0N/m12uVHLFDfSYNF7EQccjinIMDA==", + "dependencies": { + "debug": "^4.3.5", + "extract-zip": "^2.0.1", + "progress": "^2.0.3", + "proxy-agent": "^6.4.0", + "semver": "^7.6.3", + "tar-fs": "^3.0.6", + "unbzip2-stream": "^1.4.3", + "yargs": "^17.7.2" + }, + "bin": { + "browsers": "lib/cjs/main-cli.js" + }, + "engines": { + "node": ">=18" + } + }, "node_modules/@sinclair/typebox": { "version": "0.27.8", "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.27.8.tgz", @@ -4738,11 +4104,11 @@ } }, "node_modules/@smithy/abort-controller": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/@smithy/abort-controller/-/abort-controller-3.0.1.tgz", - "integrity": "sha512-Jb7jg4E+C+uvrUQi+h9kbILY6ts6fglKZzseMCHlH9ayq+1f5QdpYf8MV/xppuiN6DAMJAmwGz53GwP3213dmA==", + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/@smithy/abort-controller/-/abort-controller-3.1.1.tgz", + "integrity": "sha512-MBJBiidoe+0cTFhyxT8g+9g7CeVccLM0IOKKUMCNQ1CNMJ/eIfoo0RTfVrXOONEI1UCN1W+zkiHSbzUNE9dZtQ==", "dependencies": { - "@smithy/types": "^3.1.0", + "@smithy/types": "^3.3.0", "tslib": "^2.6.2" }, "engines": { @@ -4750,14 +4116,14 @@ } }, "node_modules/@smithy/config-resolver": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/@smithy/config-resolver/-/config-resolver-3.0.2.tgz", - "integrity": "sha512-wUyG6ezpp2sWAvfqmSYTROwFUmJqKV78GLf55WODrosBcT0BAMd9bOLO4HRhynWBgAobPml2cF9ZOdgCe00r+g==", + "version": "3.0.5", + "resolved": "https://registry.npmjs.org/@smithy/config-resolver/-/config-resolver-3.0.5.tgz", + "integrity": "sha512-SkW5LxfkSI1bUC74OtfBbdz+grQXYiPYolyu8VfpLIjEoN/sHVBlLeGXMQ1vX4ejkgfv6sxVbQJ32yF2cl1veA==", "dependencies": { - "@smithy/node-config-provider": "^3.1.1", - "@smithy/types": "^3.1.0", + "@smithy/node-config-provider": "^3.1.4", + "@smithy/types": "^3.3.0", "@smithy/util-config-provider": "^3.0.0", - "@smithy/util-middleware": "^3.0.1", + "@smithy/util-middleware": "^3.0.3", "tslib": "^2.6.2" }, "engines": { @@ -4765,17 +4131,17 @@ } }, "node_modules/@smithy/core": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/@smithy/core/-/core-2.2.1.tgz", - "integrity": "sha512-R8Pzrr2v2oGUoj4CTZtKPr87lVtBsz7IUBGhSwS1kc6Cj0yPwNdYbkzhFsxhoDE9+BPl09VN/6rFsW9GJzWnBA==", + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/@smithy/core/-/core-2.3.2.tgz", + "integrity": "sha512-in5wwt6chDBcUv1Lw1+QzZxN9fBffi+qOixfb65yK4sDuKG7zAUO9HAFqmVzsZM3N+3tTyvZjtnDXePpvp007Q==", "dependencies": { - "@smithy/middleware-endpoint": "^3.0.2", - "@smithy/middleware-retry": "^3.0.4", - "@smithy/middleware-serde": "^3.0.1", - "@smithy/protocol-http": "^4.0.1", - "@smithy/smithy-client": "^3.1.2", - "@smithy/types": "^3.1.0", - "@smithy/util-middleware": "^3.0.1", + "@smithy/middleware-endpoint": "^3.1.0", + "@smithy/middleware-retry": "^3.0.14", + "@smithy/middleware-serde": "^3.0.3", + "@smithy/protocol-http": "^4.1.0", + "@smithy/smithy-client": "^3.1.12", + "@smithy/types": "^3.3.0", + "@smithy/util-middleware": "^3.0.3", "tslib": "^2.6.2" }, "engines": { @@ -4783,14 +4149,14 @@ } }, "node_modules/@smithy/credential-provider-imds": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/@smithy/credential-provider-imds/-/credential-provider-imds-3.1.1.tgz", - "integrity": "sha512-htndP0LwHdE3R3Nam9ZyVWhwPYOmD4xCL79kqvNxy8u/bv0huuy574CSiRY4cvEICgimv8jlVfLeZ7zZqbnB2g==", + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/@smithy/credential-provider-imds/-/credential-provider-imds-3.2.0.tgz", + "integrity": "sha512-0SCIzgd8LYZ9EJxUjLXBmEKSZR/P/w6l7Rz/pab9culE/RWuqelAKGJvn5qUOl8BgX8Yj5HWM50A5hiB/RzsgA==", "dependencies": { - "@smithy/node-config-provider": "^3.1.1", - "@smithy/property-provider": "^3.1.1", - "@smithy/types": "^3.1.0", - "@smithy/url-parser": "^3.0.1", + "@smithy/node-config-provider": "^3.1.4", + "@smithy/property-provider": "^3.1.3", + "@smithy/types": "^3.3.0", + "@smithy/url-parser": "^3.0.3", "tslib": "^2.6.2" }, "engines": { @@ -4798,23 +4164,23 @@ } }, "node_modules/@smithy/eventstream-codec": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/@smithy/eventstream-codec/-/eventstream-codec-3.0.0.tgz", - "integrity": "sha512-PUtyEA0Oik50SaEFCZ0WPVtF9tz/teze2fDptW6WRXl+RrEenH8UbEjudOz8iakiMl3lE3lCVqYf2Y+znL8QFQ==", + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/@smithy/eventstream-codec/-/eventstream-codec-3.1.2.tgz", + "integrity": "sha512-0mBcu49JWt4MXhrhRAlxASNy0IjDRFU+aWNDRal9OtUJvJNiwDuyKMUONSOjLjSCeGwZaE0wOErdqULer8r7yw==", "dependencies": { - "@aws-crypto/crc32": "3.0.0", - "@smithy/types": "^3.0.0", + "@aws-crypto/crc32": "5.2.0", + "@smithy/types": "^3.3.0", "@smithy/util-hex-encoding": "^3.0.0", "tslib": "^2.6.2" } }, "node_modules/@smithy/eventstream-serde-browser": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/@smithy/eventstream-serde-browser/-/eventstream-serde-browser-3.0.0.tgz", - "integrity": "sha512-NB7AFiPN4NxP/YCAnrvYR18z2/ZsiHiF7VtG30gshO9GbFrIb1rC8ep4NGpJSWrz6P64uhPXeo4M0UsCLnZKqw==", + "version": "3.0.5", + "resolved": "https://registry.npmjs.org/@smithy/eventstream-serde-browser/-/eventstream-serde-browser-3.0.5.tgz", + "integrity": "sha512-dEyiUYL/ekDfk+2Ra4GxV+xNnFoCmk1nuIXg+fMChFTrM2uI/1r9AdiTYzPqgb72yIv/NtAj6C3dG//1wwgakQ==", "dependencies": { - "@smithy/eventstream-serde-universal": "^3.0.0", - "@smithy/types": "^3.0.0", + "@smithy/eventstream-serde-universal": "^3.0.4", + "@smithy/types": "^3.3.0", "tslib": "^2.6.2" }, "engines": { @@ -4822,11 +4188,11 @@ } }, "node_modules/@smithy/eventstream-serde-config-resolver": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/@smithy/eventstream-serde-config-resolver/-/eventstream-serde-config-resolver-3.0.0.tgz", - "integrity": "sha512-RUQG3vQ3LX7peqqHAbmayhgrF5aTilPnazinaSGF1P0+tgM3vvIRWPHmlLIz2qFqB9LqFIxditxc8O2Z6psrRw==", + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/@smithy/eventstream-serde-config-resolver/-/eventstream-serde-config-resolver-3.0.3.tgz", + "integrity": "sha512-NVTYjOuYpGfrN/VbRQgn31x73KDLfCXCsFdad8DiIc3IcdxL+dYA9zEQPyOP7Fy2QL8CPy2WE4WCUD+ZsLNfaQ==", "dependencies": { - "@smithy/types": "^3.0.0", + "@smithy/types": "^3.3.0", "tslib": "^2.6.2" }, "engines": { @@ -4834,12 +4200,12 @@ } }, "node_modules/@smithy/eventstream-serde-node": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/@smithy/eventstream-serde-node/-/eventstream-serde-node-3.0.0.tgz", - "integrity": "sha512-baRPdMBDMBExZXIUAoPGm/hntixjt/VFpU6+VmCyiYJYzRHRxoaI1MN+5XE+hIS8AJ2GCHLMFEIOLzq9xx1EgQ==", + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/@smithy/eventstream-serde-node/-/eventstream-serde-node-3.0.4.tgz", + "integrity": "sha512-mjlG0OzGAYuUpdUpflfb9zyLrBGgmQmrobNT8b42ZTsGv/J03+t24uhhtVEKG/b2jFtPIHF74Bq+VUtbzEKOKg==", "dependencies": { - "@smithy/eventstream-serde-universal": "^3.0.0", - "@smithy/types": "^3.0.0", + "@smithy/eventstream-serde-universal": "^3.0.4", + "@smithy/types": "^3.3.0", "tslib": "^2.6.2" }, "engines": { @@ -4847,12 +4213,12 @@ } }, "node_modules/@smithy/eventstream-serde-universal": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/@smithy/eventstream-serde-universal/-/eventstream-serde-universal-3.0.0.tgz", - "integrity": "sha512-HNFfShmotWGeAoW4ujP8meV9BZavcpmerDbPIjkJbxKbN8RsUcpRQ/2OyIxWNxXNH2GWCAxuSB7ynmIGJlQ3Dw==", + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/@smithy/eventstream-serde-universal/-/eventstream-serde-universal-3.0.4.tgz", + "integrity": "sha512-Od9dv8zh3PgOD7Vj4T3HSuox16n0VG8jJIM2gvKASL6aCtcS8CfHZDWe1Ik3ZXW6xBouU+45Q5wgoliWDZiJ0A==", "dependencies": { - "@smithy/eventstream-codec": "^3.0.0", - "@smithy/types": "^3.0.0", + "@smithy/eventstream-codec": "^3.1.2", + "@smithy/types": "^3.3.0", "tslib": "^2.6.2" }, "engines": { @@ -4860,23 +4226,23 @@ } }, "node_modules/@smithy/fetch-http-handler": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/@smithy/fetch-http-handler/-/fetch-http-handler-3.0.2.tgz", - "integrity": "sha512-0nW6tLK0b7EqSsfKvnOmZCgJqnodBAnvqcrlC5dotKfklLedPTRGsQamSVbVDWyuU/QGg+YbZDJUQ0CUufJXZQ==", + "version": "3.2.4", + "resolved": "https://registry.npmjs.org/@smithy/fetch-http-handler/-/fetch-http-handler-3.2.4.tgz", + "integrity": "sha512-kBprh5Gs5h7ug4nBWZi1FZthdqSM+T7zMmsZxx0IBvWUn7dK3diz2SHn7Bs4dQGFDk8plDv375gzenDoNwrXjg==", "dependencies": { - "@smithy/protocol-http": "^4.0.1", - "@smithy/querystring-builder": "^3.0.1", - "@smithy/types": "^3.1.0", + "@smithy/protocol-http": "^4.1.0", + "@smithy/querystring-builder": "^3.0.3", + "@smithy/types": "^3.3.0", "@smithy/util-base64": "^3.0.0", "tslib": "^2.6.2" } }, "node_modules/@smithy/hash-node": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/@smithy/hash-node/-/hash-node-3.0.1.tgz", - "integrity": "sha512-w2ncjgk2EYO2+WhAsSQA8owzoOSY7IL1qVytlwpnL1pFGWTjIoIh5nROkEKXY51unB63bMGZqDiVoXaFbyKDlg==", + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/@smithy/hash-node/-/hash-node-3.0.3.tgz", + "integrity": "sha512-2ctBXpPMG+B3BtWSGNnKELJ7SH9e4TNefJS0cd2eSkOOROeBnnVBnAy9LtJ8tY4vUEoe55N4CNPxzbWvR39iBw==", "dependencies": { - "@smithy/types": "^3.1.0", + "@smithy/types": "^3.3.0", "@smithy/util-buffer-from": "^3.0.0", "@smithy/util-utf8": "^3.0.0", "tslib": "^2.6.2" @@ -4886,11 +4252,11 @@ } }, "node_modules/@smithy/invalid-dependency": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/@smithy/invalid-dependency/-/invalid-dependency-3.0.1.tgz", - "integrity": "sha512-RSNF/32BKygXKKMyS7koyuAq1rcdW5p5c4EFa77QenBFze9As+JiRnV9OWBh2cB/ejGZalEZjvIrMLHwJl7aGA==", + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/@smithy/invalid-dependency/-/invalid-dependency-3.0.3.tgz", + "integrity": "sha512-ID1eL/zpDULmHJbflb864k72/SNOZCADRc9i7Exq3RUNJw6raWUSlFEQ+3PX3EYs++bTxZB2dE9mEHTQLv61tw==", "dependencies": { - "@smithy/types": "^3.1.0", + "@smithy/types": "^3.3.0", "tslib": "^2.6.2" } }, @@ -4906,12 +4272,12 @@ } }, "node_modules/@smithy/middleware-content-length": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/@smithy/middleware-content-length/-/middleware-content-length-3.0.1.tgz", - "integrity": "sha512-6QdK/VbrCfXD5/QolE2W/ok6VqxD+SM28Ds8iSlEHXZwv4buLsvWyvoEEy0322K/g5uFgPzBmZjGqesTmPL+yQ==", + "version": "3.0.5", + "resolved": "https://registry.npmjs.org/@smithy/middleware-content-length/-/middleware-content-length-3.0.5.tgz", + "integrity": "sha512-ILEzC2eyxx6ncej3zZSwMpB5RJ0zuqH7eMptxC4KN3f+v9bqT8ohssKbhNR78k/2tWW+KS5Spw+tbPF4Ejyqvw==", "dependencies": { - "@smithy/protocol-http": "^4.0.1", - "@smithy/types": "^3.1.0", + "@smithy/protocol-http": "^4.1.0", + "@smithy/types": "^3.3.0", "tslib": "^2.6.2" }, "engines": { @@ -4919,16 +4285,16 @@ } }, "node_modules/@smithy/middleware-endpoint": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/@smithy/middleware-endpoint/-/middleware-endpoint-3.0.2.tgz", - "integrity": "sha512-gWEaGYB3Bei17Oiy/F2IlUPpBazNXImytoOdJ1xbrUOaJKAOiUhx8/4FOnYLLJHdAwa9PlvJ2ULda2f/Dnwi9w==", + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/@smithy/middleware-endpoint/-/middleware-endpoint-3.1.0.tgz", + "integrity": "sha512-5y5aiKCEwg9TDPB4yFE7H6tYvGFf1OJHNczeY10/EFF8Ir8jZbNntQJxMWNfeQjC1mxPsaQ6mR9cvQbf+0YeMw==", "dependencies": { - "@smithy/middleware-serde": "^3.0.1", - "@smithy/node-config-provider": "^3.1.1", - "@smithy/shared-ini-file-loader": "^3.1.1", - "@smithy/types": "^3.1.0", - "@smithy/url-parser": "^3.0.1", - "@smithy/util-middleware": "^3.0.1", + "@smithy/middleware-serde": "^3.0.3", + "@smithy/node-config-provider": "^3.1.4", + "@smithy/shared-ini-file-loader": "^3.1.4", + "@smithy/types": "^3.3.0", + "@smithy/url-parser": "^3.0.3", + "@smithy/util-middleware": "^3.0.3", "tslib": "^2.6.2" }, "engines": { @@ -4936,17 +4302,17 @@ } }, "node_modules/@smithy/middleware-retry": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/@smithy/middleware-retry/-/middleware-retry-3.0.4.tgz", - "integrity": "sha512-Tu+FggbLNF5G9L6Wi8o32Mg4bhlBInWlhhaFKyytGRnkfxGopxFVXJQn7sjZdFYJyTz6RZZa06tnlvavUgtoVg==", + "version": "3.0.14", + "resolved": "https://registry.npmjs.org/@smithy/middleware-retry/-/middleware-retry-3.0.14.tgz", + "integrity": "sha512-7ZaWZJOjUxa5hgmuMspyt8v/zVsh0GXYuF7OvCmdcbVa/xbnKQoYC+uYKunAqRGTkxjOyuOCw9rmFUFOqqC0eQ==", "dependencies": { - "@smithy/node-config-provider": "^3.1.1", - "@smithy/protocol-http": "^4.0.1", - "@smithy/service-error-classification": "^3.0.1", - "@smithy/smithy-client": "^3.1.2", - "@smithy/types": "^3.1.0", - "@smithy/util-middleware": "^3.0.1", - "@smithy/util-retry": "^3.0.1", + "@smithy/node-config-provider": "^3.1.4", + "@smithy/protocol-http": "^4.1.0", + "@smithy/service-error-classification": "^3.0.3", + "@smithy/smithy-client": "^3.1.12", + "@smithy/types": "^3.3.0", + "@smithy/util-middleware": "^3.0.3", + "@smithy/util-retry": "^3.0.3", "tslib": "^2.6.2", "uuid": "^9.0.1" }, @@ -4955,11 +4321,11 @@ } }, "node_modules/@smithy/middleware-serde": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/@smithy/middleware-serde/-/middleware-serde-3.0.1.tgz", - "integrity": "sha512-ak6H/ZRN05r5+SR0/IUc5zOSyh2qp3HReg1KkrnaSLXmncy9lwOjNqybX4L4x55/e5mtVDn1uf/gQ6bw5neJPw==", + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/@smithy/middleware-serde/-/middleware-serde-3.0.3.tgz", + "integrity": "sha512-puUbyJQBcg9eSErFXjKNiGILJGtiqmuuNKEYNYfUD57fUl4i9+mfmThtQhvFXU0hCVG0iEJhvQUipUf+/SsFdA==", "dependencies": { - "@smithy/types": "^3.1.0", + "@smithy/types": "^3.3.0", "tslib": "^2.6.2" }, "engines": { @@ -4967,11 +4333,11 @@ } }, "node_modules/@smithy/middleware-stack": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/@smithy/middleware-stack/-/middleware-stack-3.0.1.tgz", - "integrity": "sha512-fS5uT//y1SlBdkzIvgmWQ9FufwMXrHSSbuR25ygMy1CRDIZkcBMoF4oTMYNfR9kBlVBcVzlv7joFdNrFuQirPA==", + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/@smithy/middleware-stack/-/middleware-stack-3.0.3.tgz", + "integrity": "sha512-r4klY9nFudB0r9UdSMaGSyjyQK5adUyPnQN/ZM6M75phTxOdnc/AhpvGD1fQUvgmqjQEBGCwpnPbDm8pH5PapA==", "dependencies": { - "@smithy/types": "^3.1.0", + "@smithy/types": "^3.3.0", "tslib": "^2.6.2" }, "engines": { @@ -4979,13 +4345,13 @@ } }, "node_modules/@smithy/node-config-provider": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/@smithy/node-config-provider/-/node-config-provider-3.1.1.tgz", - "integrity": "sha512-z5G7+ysL4yUtMghUd2zrLkecu0mTfnYlt5dR76g/HsFqf7evFazwiZP1ag2EJenGxNBDwDM5g8nm11NPogiUVA==", + "version": "3.1.4", + "resolved": "https://registry.npmjs.org/@smithy/node-config-provider/-/node-config-provider-3.1.4.tgz", + "integrity": "sha512-YvnElQy8HR4vDcAjoy7Xkx9YT8xZP4cBXcbJSgm/kxmiQu08DwUwj8rkGnyoJTpfl/3xYHH+d8zE+eHqoDCSdQ==", "dependencies": { - "@smithy/property-provider": "^3.1.1", - "@smithy/shared-ini-file-loader": "^3.1.1", - "@smithy/types": "^3.1.0", + "@smithy/property-provider": "^3.1.3", + "@smithy/shared-ini-file-loader": "^3.1.4", + "@smithy/types": "^3.3.0", "tslib": "^2.6.2" }, "engines": { @@ -4993,14 +4359,14 @@ } }, "node_modules/@smithy/node-http-handler": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/@smithy/node-http-handler/-/node-http-handler-3.0.1.tgz", - "integrity": "sha512-hlBI6MuREA4o1wBMEt+QNhUzoDtFFvwR6ecufimlx9D79jPybE/r8kNorphXOi91PgSO9S2fxRjcKCLk7Jw8zA==", + "version": "3.1.4", + "resolved": "https://registry.npmjs.org/@smithy/node-http-handler/-/node-http-handler-3.1.4.tgz", + "integrity": "sha512-+UmxgixgOr/yLsUxcEKGH0fMNVteJFGkmRltYFHnBMlogyFdpzn2CwqWmxOrfJELhV34v0WSlaqG1UtE1uXlJg==", "dependencies": { - "@smithy/abort-controller": "^3.0.1", - "@smithy/protocol-http": "^4.0.1", - "@smithy/querystring-builder": "^3.0.1", - "@smithy/types": "^3.1.0", + "@smithy/abort-controller": "^3.1.1", + "@smithy/protocol-http": "^4.1.0", + "@smithy/querystring-builder": "^3.0.3", + "@smithy/types": "^3.3.0", "tslib": "^2.6.2" }, "engines": { @@ -5008,11 +4374,11 @@ } }, "node_modules/@smithy/property-provider": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/@smithy/property-provider/-/property-provider-3.1.1.tgz", - "integrity": "sha512-YknOMZcQkB5on+MU0DvbToCmT2YPtTETMXW0D3+/Iln7ezT+Zm1GMHhCW1dOH/X/+LkkQD9aXEoCX/B10s4Xdw==", + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/@smithy/property-provider/-/property-provider-3.1.3.tgz", + "integrity": "sha512-zahyOVR9Q4PEoguJ/NrFP4O7SMAfYO1HLhB18M+q+Z4KFd4V2obiMnlVoUFzFLSPeVt1POyNWneHHrZaTMoc/g==", "dependencies": { - "@smithy/types": "^3.1.0", + "@smithy/types": "^3.3.0", "tslib": "^2.6.2" }, "engines": { @@ -5020,11 +4386,11 @@ } }, "node_modules/@smithy/protocol-http": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/@smithy/protocol-http/-/protocol-http-4.0.1.tgz", - "integrity": "sha512-eBhm9zwcFPEazc654c0BEWtxYAzrw+OhoSf5pkwKzfftWKXRoqEhwOE2Pvn30v0iAdo7Mfsfb6pi1NnZlGCMpg==", + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/@smithy/protocol-http/-/protocol-http-4.1.0.tgz", + "integrity": "sha512-dPVoHYQ2wcHooGXg3LQisa1hH0e4y0pAddPMeeUPipI1tEOqL6A4N0/G7abeq+K8wrwSgjk4C0wnD1XZpJm5aA==", "dependencies": { - "@smithy/types": "^3.1.0", + "@smithy/types": "^3.3.0", "tslib": "^2.6.2" }, "engines": { @@ -5032,11 +4398,11 @@ } }, "node_modules/@smithy/querystring-builder": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/@smithy/querystring-builder/-/querystring-builder-3.0.1.tgz", - "integrity": "sha512-vKitpnG/2KOMVlx3x1S3FkBH075EROG3wcrcDaNerQNh8yuqnSL23btCD2UyX4i4lpPzNW6VFdxbn2Z25b/g5Q==", + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/@smithy/querystring-builder/-/querystring-builder-3.0.3.tgz", + "integrity": "sha512-vyWckeUeesFKzCDaRwWLUA1Xym9McaA6XpFfAK5qI9DKJ4M33ooQGqvM4J+LalH4u/Dq9nFiC8U6Qn1qi0+9zw==", "dependencies": { - "@smithy/types": "^3.1.0", + "@smithy/types": "^3.3.0", "@smithy/util-uri-escape": "^3.0.0", "tslib": "^2.6.2" }, @@ -5045,11 +4411,11 @@ } }, "node_modules/@smithy/querystring-parser": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/@smithy/querystring-parser/-/querystring-parser-3.0.1.tgz", - "integrity": "sha512-Qt8DMC05lVS8NcQx94lfVbZSX+2Ym7032b/JR8AlboAa/D669kPzqb35dkjkvAG6+NWmUchef3ENtrD6F+5n8Q==", + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/@smithy/querystring-parser/-/querystring-parser-3.0.3.tgz", + "integrity": "sha512-zahM1lQv2YjmznnfQsWbYojFe55l0SLG/988brlLv1i8z3dubloLF+75ATRsqPBboUXsW6I9CPGE5rQgLfY0vQ==", "dependencies": { - "@smithy/types": "^3.1.0", + "@smithy/types": "^3.3.0", "tslib": "^2.6.2" }, "engines": { @@ -5057,22 +4423,22 @@ } }, "node_modules/@smithy/service-error-classification": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/@smithy/service-error-classification/-/service-error-classification-3.0.1.tgz", - "integrity": "sha512-ubFUvIePjDCyIzZ+pLETqNC6KXJ/fc6g+/baqel7Zf6kJI/kZKgjwkCI7zbUhoUuOZ/4eA/87YasVu40b/B4bA==", + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/@smithy/service-error-classification/-/service-error-classification-3.0.3.tgz", + "integrity": "sha512-Jn39sSl8cim/VlkLsUhRFq/dKDnRUFlfRkvhOJaUbLBXUsLRLNf9WaxDv/z9BjuQ3A6k/qE8af1lsqcwm7+DaQ==", "dependencies": { - "@smithy/types": "^3.1.0" + "@smithy/types": "^3.3.0" }, "engines": { "node": ">=16.0.0" } }, "node_modules/@smithy/shared-ini-file-loader": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/@smithy/shared-ini-file-loader/-/shared-ini-file-loader-3.1.1.tgz", - "integrity": "sha512-nD6tXIX2126/P9e3wqRY1bm9dTtPZwRDyjVOd18G28o+1UOG+kOVgUwujE795HslSuPlEgqzsH5sgNP1hDjj9g==", + "version": "3.1.4", + "resolved": "https://registry.npmjs.org/@smithy/shared-ini-file-loader/-/shared-ini-file-loader-3.1.4.tgz", + "integrity": "sha512-qMxS4hBGB8FY2GQqshcRUy1K6k8aBWP5vwm8qKkCT3A9K2dawUwOIJfqh9Yste/Bl0J2lzosVyrXDj68kLcHXQ==", "dependencies": { - "@smithy/types": "^3.1.0", + "@smithy/types": "^3.3.0", "tslib": "^2.6.2" }, "engines": { @@ -5080,14 +4446,15 @@ } }, "node_modules/@smithy/signature-v4": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/@smithy/signature-v4/-/signature-v4-3.1.0.tgz", - "integrity": "sha512-m0/6LW3IQ3/JBcdhqjpkpABPTPhcejqeAn0U877zxBdNLiWAnG2WmCe5MfkUyVuvpFTPQnQwCo/0ZBR4uF5kxg==", + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/@smithy/signature-v4/-/signature-v4-4.1.0.tgz", + "integrity": "sha512-aRryp2XNZeRcOtuJoxjydO6QTaVhxx/vjaR+gx7ZjaFgrgPRyZ3HCTbfwqYj6ZWEBHkCSUfcaymKPURaByukag==", "dependencies": { "@smithy/is-array-buffer": "^3.0.0", - "@smithy/types": "^3.1.0", + "@smithy/protocol-http": "^4.1.0", + "@smithy/types": "^3.3.0", "@smithy/util-hex-encoding": "^3.0.0", - "@smithy/util-middleware": "^3.0.1", + "@smithy/util-middleware": "^3.0.3", "@smithy/util-uri-escape": "^3.0.0", "@smithy/util-utf8": "^3.0.0", "tslib": "^2.6.2" @@ -5097,15 +4464,15 @@ } }, "node_modules/@smithy/smithy-client": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/@smithy/smithy-client/-/smithy-client-3.1.2.tgz", - "integrity": "sha512-f3eQpczBOFUtdT/ptw2WpUKu1qH1K7xrssrSiHYtd9TuLXkvFqb88l9mz9FHeUVNSUxSnkW1anJnw6rLwUKzQQ==", + "version": "3.1.12", + "resolved": "https://registry.npmjs.org/@smithy/smithy-client/-/smithy-client-3.1.12.tgz", + "integrity": "sha512-wtm8JtsycthkHy1YA4zjIh2thJgIQ9vGkoR639DBx5lLlLNU0v4GARpQZkr2WjXue74nZ7MiTSWfVrLkyD8RkA==", "dependencies": { - "@smithy/middleware-endpoint": "^3.0.2", - "@smithy/middleware-stack": "^3.0.1", - "@smithy/protocol-http": "^4.0.1", - "@smithy/types": "^3.1.0", - "@smithy/util-stream": "^3.0.2", + "@smithy/middleware-endpoint": "^3.1.0", + "@smithy/middleware-stack": "^3.0.3", + "@smithy/protocol-http": "^4.1.0", + "@smithy/types": "^3.3.0", + "@smithy/util-stream": "^3.1.3", "tslib": "^2.6.2" }, "engines": { @@ -5113,9 +4480,9 @@ } }, "node_modules/@smithy/types": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/@smithy/types/-/types-3.1.0.tgz", - "integrity": "sha512-qi4SeCVOUPjhSSZrxxB/mB8DrmuSFUcJnD9KXjuP+7C3LV/KFV4kpuUSH3OHDZgQB9TEH/1sO/Fq/5HyaK9MPw==", + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/@smithy/types/-/types-3.3.0.tgz", + "integrity": "sha512-IxvBBCTFDHbVoK7zIxqA1ZOdc4QfM5HM7rGleCuHi7L1wnKv5Pn69xXJQ9hgxH60ZVygH9/JG0jRgtUncE3QUA==", "dependencies": { "tslib": "^2.6.2" }, @@ -5124,12 +4491,12 @@ } }, "node_modules/@smithy/url-parser": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/@smithy/url-parser/-/url-parser-3.0.1.tgz", - "integrity": "sha512-G140IlNFlzYWVCedC4E2d6NycM1dCUbe5CnsGW1hmGt4hYKiGOw0v7lVru9WAn5T2w09QEjl4fOESWjGmCvVmg==", + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/@smithy/url-parser/-/url-parser-3.0.3.tgz", + "integrity": "sha512-pw3VtZtX2rg+s6HMs6/+u9+hu6oY6U7IohGhVNnjbgKy86wcIsSZwgHrFR+t67Uyxvp4Xz3p3kGXXIpTNisq8A==", "dependencies": { - "@smithy/querystring-parser": "^3.0.1", - "@smithy/types": "^3.1.0", + "@smithy/querystring-parser": "^3.0.3", + "@smithy/types": "^3.3.0", "tslib": "^2.6.2" } }, @@ -5189,13 +4556,13 @@ } }, "node_modules/@smithy/util-defaults-mode-browser": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/@smithy/util-defaults-mode-browser/-/util-defaults-mode-browser-3.0.4.tgz", - "integrity": "sha512-sXtin3Mue3A3xo4+XkozpgPptgmRwvNPOqTvb3ANGTCzzoQgAPBNjpE+aXCINaeSMXwHmv7E2oEn2vWdID+SAQ==", + "version": "3.0.14", + "resolved": "https://registry.npmjs.org/@smithy/util-defaults-mode-browser/-/util-defaults-mode-browser-3.0.14.tgz", + "integrity": "sha512-0iwTgKKmAIf+vFLV8fji21Jb2px11ktKVxbX6LIDPAUJyWQqGqBVfwba7xwa1f2FZUoolYQgLvxQEpJycXuQ5w==", "dependencies": { - "@smithy/property-provider": "^3.1.1", - "@smithy/smithy-client": "^3.1.2", - "@smithy/types": "^3.1.0", + "@smithy/property-provider": "^3.1.3", + "@smithy/smithy-client": "^3.1.12", + "@smithy/types": "^3.3.0", "bowser": "^2.11.0", "tslib": "^2.6.2" }, @@ -5204,16 +4571,16 @@ } }, "node_modules/@smithy/util-defaults-mode-node": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/@smithy/util-defaults-mode-node/-/util-defaults-mode-node-3.0.4.tgz", - "integrity": "sha512-CUF6TyxLh3CgBRVYgZNOPDfzHQjeQr0vyALR6/DkQkOm7rNfGEzW1BRFi88C73pndmfvoiIT7ochuT76OPz9Dw==", + "version": "3.0.14", + "resolved": "https://registry.npmjs.org/@smithy/util-defaults-mode-node/-/util-defaults-mode-node-3.0.14.tgz", + "integrity": "sha512-e9uQarJKfXApkTMMruIdxHprhcXivH1flYCe8JRDTzkkLx8dA3V5J8GZlST9yfDiRWkJpZJlUXGN9Rc9Ade3OQ==", "dependencies": { - "@smithy/config-resolver": "^3.0.2", - "@smithy/credential-provider-imds": "^3.1.1", - "@smithy/node-config-provider": "^3.1.1", - "@smithy/property-provider": "^3.1.1", - "@smithy/smithy-client": "^3.1.2", - "@smithy/types": "^3.1.0", + "@smithy/config-resolver": "^3.0.5", + "@smithy/credential-provider-imds": "^3.2.0", + "@smithy/node-config-provider": "^3.1.4", + "@smithy/property-provider": "^3.1.3", + "@smithy/smithy-client": "^3.1.12", + "@smithy/types": "^3.3.0", "tslib": "^2.6.2" }, "engines": { @@ -5221,12 +4588,12 @@ } }, "node_modules/@smithy/util-endpoints": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/@smithy/util-endpoints/-/util-endpoints-2.0.2.tgz", - "integrity": "sha512-4zFOcBFQvifd2LSD4a1dKvfIWWwh4sWNtS3oZ7mpob/qPPmJseqKB148iT+hWCDsG//TmI+8vjYPgZdvnkYlTg==", + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@smithy/util-endpoints/-/util-endpoints-2.0.5.tgz", + "integrity": "sha512-ReQP0BWihIE68OAblC/WQmDD40Gx+QY1Ez8mTdFMXpmjfxSyz2fVQu3A4zXRfQU9sZXtewk3GmhfOHswvX+eNg==", "dependencies": { - "@smithy/node-config-provider": "^3.1.1", - "@smithy/types": "^3.1.0", + "@smithy/node-config-provider": "^3.1.4", + "@smithy/types": "^3.3.0", "tslib": "^2.6.2" }, "engines": { @@ -5245,11 +4612,11 @@ } }, "node_modules/@smithy/util-middleware": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/@smithy/util-middleware/-/util-middleware-3.0.1.tgz", - "integrity": "sha512-WRODCQtUsO7vIvfrdxS8RFPeLKcewYtaCglZsBsedIKSUGIIvMlZT5oh+pCe72I+1L+OjnZuqRNpN2LKhWA4KQ==", + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/@smithy/util-middleware/-/util-middleware-3.0.3.tgz", + "integrity": "sha512-l+StyYYK/eO3DlVPbU+4Bi06Jjal+PFLSMmlWM1BEwyLxZ3aKkf1ROnoIakfaA7mC6uw3ny7JBkau4Yc+5zfWw==", "dependencies": { - "@smithy/types": "^3.1.0", + "@smithy/types": "^3.3.0", "tslib": "^2.6.2" }, "engines": { @@ -5257,12 +4624,12 @@ } }, "node_modules/@smithy/util-retry": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/@smithy/util-retry/-/util-retry-3.0.1.tgz", - "integrity": "sha512-5lRtYm+8fNFEUTdqZXg5M4ppVp40rMIJfR1TpbHAhKQgPIDpWT+iYMaqgnwEbtpi9U1smyUOPv5Sg+M1neOBgw==", + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/@smithy/util-retry/-/util-retry-3.0.3.tgz", + "integrity": "sha512-AFw+hjpbtVApzpNDhbjNG5NA3kyoMs7vx0gsgmlJF4s+yz1Zlepde7J58zpIRIsdjc+emhpAITxA88qLkPF26w==", "dependencies": { - "@smithy/service-error-classification": "^3.0.1", - "@smithy/types": "^3.1.0", + "@smithy/service-error-classification": "^3.0.3", + "@smithy/types": "^3.3.0", "tslib": "^2.6.2" }, "engines": { @@ -5270,13 +4637,13 @@ } }, "node_modules/@smithy/util-stream": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/@smithy/util-stream/-/util-stream-3.0.2.tgz", - "integrity": "sha512-n5Obp5AnlI6qHo8sbupwrcpBe6vFp4qkl0SRNuExKPNrH3ABAMG2ZszRTIUIv2b4AsFrCO+qiy4uH1Q3z1dxTA==", + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/@smithy/util-stream/-/util-stream-3.1.3.tgz", + "integrity": "sha512-FIv/bRhIlAxC0U7xM1BCnF2aDRPq0UaelqBHkM2lsCp26mcBbgI0tCVTv+jGdsQLUmAMybua/bjDsSu8RQHbmw==", "dependencies": { - "@smithy/fetch-http-handler": "^3.0.2", - "@smithy/node-http-handler": "^3.0.1", - "@smithy/types": "^3.1.0", + "@smithy/fetch-http-handler": "^3.2.4", + "@smithy/node-http-handler": "^3.1.4", + "@smithy/types": "^3.3.0", "@smithy/util-base64": "^3.0.0", "@smithy/util-buffer-from": "^3.0.0", "@smithy/util-hex-encoding": "^3.0.0", @@ -5324,6 +4691,11 @@ "node": ">= 6" } }, + "node_modules/@tootallnate/quickjs-emscripten": { + "version": "0.23.0", + "resolved": "https://registry.npmjs.org/@tootallnate/quickjs-emscripten/-/quickjs-emscripten-0.23.0.tgz", + "integrity": "sha512-C5Mc6rdnsaJDjO3UpGW/CQTHtCKaYlScZTly4JIu97Jxo/odCiH0ITnDXSJPTOrEKk/ycSZ0AOgTmkDtkOsvIA==" + }, "node_modules/@types/babel__core": { "version": "7.20.5", "resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.20.5.tgz", @@ -5365,6 +4737,12 @@ "@babel/types": "^7.20.7" } }, + "node_modules/@types/caseless": { + "version": "0.12.5", + "resolved": "https://registry.npmjs.org/@types/caseless/-/caseless-0.12.5.tgz", + "integrity": "sha512-hWtVTC2q7hc7xZ/RLbxapMvDMgUnDvKvMOpKal4DrMyfGBUfB1oKaZlIRr6mJL+If3bAP6sV/QneGzF6tJjZDg==", + "dev": true + }, "node_modules/@types/command-line-args": { "version": "5.2.0", "resolved": "https://registry.npmjs.org/@types/command-line-args/-/command-line-args-5.2.0.tgz", @@ -5442,6 +4820,7 @@ "version": "21.1.6", "resolved": "https://registry.npmjs.org/@types/jsdom/-/jsdom-21.1.6.tgz", "integrity": "sha512-/7kkMsC+/kMs7gAYmmBR9P0vGTnOoLhQhyhQJSlXGI5bzTHp6xdo0TtKWQAsz6pmSAeVqKSbqeyP6hytqr9FDw==", + "dev": true, "dependencies": { "@types/node": "*", "@types/tough-cookie": "*", @@ -5461,7 +4840,8 @@ "node_modules/@types/mozilla-readability": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/@types/mozilla-readability/-/mozilla-readability-0.2.1.tgz", - "integrity": "sha512-RjLpe3MIpj53L+q50DTNlhv6KjHjgajFQwAF4KuxVZTa2+6Cs2UNAxS5awxABfZEHRYjGKeRDB21Zrtnsi911w==" + "integrity": "sha512-RjLpe3MIpj53L+q50DTNlhv6KjHjgajFQwAF4KuxVZTa2+6Cs2UNAxS5awxABfZEHRYjGKeRDB21Zrtnsi911w==", + "dev": true }, "node_modules/@types/mustache": { "version": "4.2.5", @@ -5483,12 +4863,115 @@ "form-data": "^4.0.0" } }, + "node_modules/@types/node-forge": { + "version": "1.3.11", + "resolved": "https://registry.npmjs.org/@types/node-forge/-/node-forge-1.3.11.tgz", + "integrity": "sha512-FQx220y22OKNTqaByeBGqHWYz4cl94tpcxeFdvBo3wjG6XPBuZ0BNgNZRV5J5TFmmcsJ4IzsLkmGRiQbnYsBEQ==", + "dev": true, + "dependencies": { + "@types/node": "*" + } + }, "node_modules/@types/pad-left": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/@types/pad-left/-/pad-left-2.1.1.tgz", "integrity": "sha512-Xd22WCRBydkGSApl5Bw0PhAOHKSVjNL3E3AwzKaps96IMraPqy5BvZIsBVK6JLwdybUzjHnuWVwpDd0JjTfHXA==", "peer": true }, + "node_modules/@types/pg": { + "version": "8.11.6", + "resolved": "https://registry.npmjs.org/@types/pg/-/pg-8.11.6.tgz", + "integrity": "sha512-/2WmmBXHLsfRqzfHW7BNZ8SbYzE8OSk7i3WjFYvfgRHj7S1xj+16Je5fUKv3lVdVzk/zn9TXOqf+avFCFIE0yQ==", + "dev": true, + "dependencies": { + "@types/node": "*", + "pg-protocol": "*", + "pg-types": "^4.0.1" + } + }, + "node_modules/@types/pg/node_modules/pg-types": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/pg-types/-/pg-types-4.0.2.tgz", + "integrity": "sha512-cRL3JpS3lKMGsKaWndugWQoLOCoP+Cic8oseVcbr0qhPzYD5DWXK+RZ9LY9wxRf7RQia4SCwQlXk0q6FCPrVng==", + "dev": true, + "dependencies": { + "pg-int8": "1.0.1", + "pg-numeric": "1.0.2", + "postgres-array": "~3.0.1", + "postgres-bytea": "~3.0.0", + "postgres-date": "~2.1.0", + "postgres-interval": "^3.0.0", + "postgres-range": "^1.1.1" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/@types/pg/node_modules/postgres-array": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/postgres-array/-/postgres-array-3.0.2.tgz", + "integrity": "sha512-6faShkdFugNQCLwucjPcY5ARoW1SlbnrZjmGl0IrrqewpvxvhSLHimCVzqeuULCbG0fQv7Dtk1yDbG3xv7Veog==", + "dev": true, + "engines": { + "node": ">=12" + } + }, + "node_modules/@types/pg/node_modules/postgres-bytea": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/postgres-bytea/-/postgres-bytea-3.0.0.tgz", + "integrity": "sha512-CNd4jim9RFPkObHSjVHlVrxoVQXz7quwNFpz7RY1okNNme49+sVyiTvTRobiLV548Hx/hb1BG+iE7h9493WzFw==", + "dev": true, + "dependencies": { + "obuf": "~1.1.2" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/@types/pg/node_modules/postgres-date": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/postgres-date/-/postgres-date-2.1.0.tgz", + "integrity": "sha512-K7Juri8gtgXVcDfZttFKVmhglp7epKb1K4pgrkLxehjqkrgPhfG6OO8LHLkfaqkbpjNRnra018XwAr1yQFWGcA==", + "dev": true, + "engines": { + "node": ">=12" + } + }, + "node_modules/@types/pg/node_modules/postgres-interval": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/postgres-interval/-/postgres-interval-3.0.0.tgz", + "integrity": "sha512-BSNDnbyZCXSxgA+1f5UU2GmwhoI0aU5yMxRGO8CdFEcY2BQF9xm/7MqKnYoM1nJDk8nONNWDk9WeSmePFhQdlw==", + "dev": true, + "engines": { + "node": ">=12" + } + }, + "node_modules/@types/request": { + "version": "2.48.12", + "resolved": "https://registry.npmjs.org/@types/request/-/request-2.48.12.tgz", + "integrity": "sha512-G3sY+NpsA9jnwm0ixhAFQSJ3Q9JkpLZpJbI3GMv0mIAT0y3mRabYeINzal5WOChIiaTEGQYlHOKgkaM9EisWHw==", + "dev": true, + "dependencies": { + "@types/caseless": "*", + "@types/node": "*", + "@types/tough-cookie": "*", + "form-data": "^2.5.0" + } + }, + "node_modules/@types/request/node_modules/form-data": { + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.5.1.tgz", + "integrity": "sha512-m21N3WOmEEURgk6B9GLOE4RuWOFf28Lhh9qGYeNlGq4VDXUlJy2th2slBNU8Gp8EzloYZOibZJ7t5ecIrFSjVA==", + "dev": true, + "dependencies": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.6", + "mime-types": "^2.1.12" + }, + "engines": { + "node": ">= 0.12" + } + }, "node_modules/@types/sizzle": { "version": "2.3.8", "resolved": "https://registry.npmjs.org/@types/sizzle/-/sizzle-2.3.8.tgz", @@ -5504,7 +4987,8 @@ "node_modules/@types/tough-cookie": { "version": "4.0.5", "resolved": "https://registry.npmjs.org/@types/tough-cookie/-/tough-cookie-4.0.5.tgz", - "integrity": "sha512-/Ad8+nIOV7Rl++6f1BdKxFSMgmoqEoYbHRpPcx3JEfv8VRsQe9Z4mCXeJBzxs7mbHY/XOZZuXlRNfhpVPbs6ZA==" + "integrity": "sha512-/Ad8+nIOV7Rl++6f1BdKxFSMgmoqEoYbHRpPcx3JEfv8VRsQe9Z4mCXeJBzxs7mbHY/XOZZuXlRNfhpVPbs6ZA==", + "dev": true }, "node_modules/@types/uuid": { "version": "9.0.8", @@ -5512,6 +4996,16 @@ "integrity": "sha512-jg+97EGIcY9AGHJJRaaPVgetKDsrTgbRjQ5Msgjh/DQKEFl0DtyRr/VCOyD1T2R1MNeWPK/u7JoGhlDZnKBAfA==", "dev": true }, + "node_modules/@types/win-ca": { + "version": "3.5.4", + "resolved": "https://registry.npmjs.org/@types/win-ca/-/win-ca-3.5.4.tgz", + "integrity": "sha512-WDlA6ZvTg1g9ygKcDCQb4GjEtk0RcZyx09btQea9NZqfKPl+WtyOlEwNfYMhK2E5sRCo6hMtct1EX3l04yAC1A==", + "dev": true, + "dependencies": { + "@types/node": "*", + "@types/node-forge": "*" + } + }, "node_modules/@types/yargs": { "version": "17.0.32", "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-17.0.32.tgz", @@ -5527,6 +5021,15 @@ "integrity": "sha512-I4q9QU9MQv4oEOz4tAHJtNz1cwuLxn2F3xcc2iV5WdqLPpUnj30aUuxt1mAxYTG+oe8CZMV/+6rU4S4gRDzqtQ==", "dev": true }, + "node_modules/@types/yauzl": { + "version": "2.10.3", + "resolved": "https://registry.npmjs.org/@types/yauzl/-/yauzl-2.10.3.tgz", + "integrity": "sha512-oJoftv0LSuaDZE3Le4DbKX+KS9G36NzOeSap90UIK0yMA/NhKJhqlSGtNDORNRaIbQfzjXDrQa0ytJ6mNRGz/Q==", + "optional": true, + "dependencies": { + "@types/node": "*" + } + }, "node_modules/@typescript-eslint/eslint-plugin": { "version": "7.10.0", "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-7.10.0.tgz", @@ -5727,6 +5230,13 @@ "resolved": "https://registry.npmjs.org/@yomguithereal/helpers/-/helpers-1.1.1.tgz", "integrity": "sha512-UYvAq/XCA7xoh1juWDYsq3W0WywOB+pz8cgVnE1b45ZfdMhBvHDrgmSFG3jXeZSr2tMTYLGHFHON+ekG05Jebg==" }, + "node_modules/abab": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/abab/-/abab-2.0.6.tgz", + "integrity": "sha512-j2afSsaIENvHZN2B8GOpF566vZ5WVk5opAiMTvWgaQT8DkbOqsTfvNAvHoRGU2zzP8cPoqys+xHTRDWW8L+/BA==", + "deprecated": "Use your platform's native atob() and btoa() methods instead", + "dev": true + }, "node_modules/abbrev": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz", @@ -5755,6 +5265,16 @@ "node": ">=0.4.0" } }, + "node_modules/acorn-globals": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/acorn-globals/-/acorn-globals-7.0.1.tgz", + "integrity": "sha512-umOSDSDrfHbTNPuNpC2NSnnA3LUrqpevPb4T9jRx4MagXNS0rs+gwiTcAvqCRmsD6utzsrzNt+ebm00SNWiC3Q==", + "dev": true, + "dependencies": { + "acorn": "^8.1.0", + "acorn-walk": "^8.0.2" + } + }, "node_modules/acorn-jsx": { "version": "5.3.2", "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz", @@ -5763,6 +5283,18 @@ "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" } }, + "node_modules/acorn-walk": { + "version": "8.3.3", + "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.3.3.tgz", + "integrity": "sha512-MxXdReSRhGO7VlFe1bRG/oI7/mdLV9B9JJT0N8vZOhF7gFRR5l3M8W9G8JxmKV+JC5mGqJ0QvqfSOLsCPa4nUw==", + "dev": true, + "dependencies": { + "acorn": "^8.11.0" + }, + "engines": { + "node": ">=0.4.0" + } + }, "node_modules/adf-to-md": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/adf-to-md/-/adf-to-md-1.1.0.tgz", @@ -5907,8 +5439,7 @@ "node_modules/aproba": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/aproba/-/aproba-2.0.0.tgz", - "integrity": "sha512-lYe4Gx7QT+MKGbDsA+Z+he/Wtef0BiwDOlK/XkBrdfsh9J/jPPXbX0tE9x9cl27Tmu5gg3QUbUrQYa/y+KOHPQ==", - "optional": true + "integrity": "sha512-lYe4Gx7QT+MKGbDsA+Z+he/Wtef0BiwDOlK/XkBrdfsh9J/jPPXbX0tE9x9cl27Tmu5gg3QUbUrQYa/y+KOHPQ==" }, "node_modules/are-we-there-yet": { "version": "3.0.1", @@ -6089,6 +5620,17 @@ "node": ">=0.8" } }, + "node_modules/ast-types": { + "version": "0.13.4", + "resolved": "https://registry.npmjs.org/ast-types/-/ast-types-0.13.4.tgz", + "integrity": "sha512-x1FCFnFifvYDDzTaLII71vG5uvDwgtmDTEVWAxrgeiR8VjMONcCXJx7E+USjDtHlwFmt9MysbqgF9b9Vjr6w+w==", + "dependencies": { + "tslib": "^2.0.1" + }, + "engines": { + "node": ">=4" + } + }, "node_modules/async-mutex": { "version": "0.5.0", "resolved": "https://registry.npmjs.org/async-mutex/-/async-mutex-0.5.0.tgz", @@ -6373,6 +5915,14 @@ } ] }, + "node_modules/basic-ftp": { + "version": "5.0.5", + "resolved": "https://registry.npmjs.org/basic-ftp/-/basic-ftp-5.0.5.tgz", + "integrity": "sha512-4Bcg1P8xhUuqcii/S0Z9wiHIrQVPMermM1any+MX5GeGD7faD3/msQUDGLol9wOcz4/jbg/WJnGqoJF6LiBdtg==", + "engines": { + "node": ">=10.0.0" + } + }, "node_modules/bcrypt-pbkdf": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz", @@ -6546,6 +6096,14 @@ "ieee754": "^1.2.1" } }, + "node_modules/buffer-crc32": { + "version": "0.2.13", + "resolved": "https://registry.npmjs.org/buffer-crc32/-/buffer-crc32-0.2.13.tgz", + "integrity": "sha512-VO9Ht/+p3SN7SKWqcrgEzjGbRSJYTx+Q1pTQC0wrWqHx0vpJraQ6GtHx8tvcg1rlK1byhU5gccxgOgj7B0TDkQ==", + "engines": { + "node": "*" + } + }, "node_modules/buffer-from": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz", @@ -6698,42 +6256,6 @@ "node": ">=10" } }, - "node_modules/cheerio": { - "version": "1.0.0-rc.12", - "resolved": "https://registry.npmjs.org/cheerio/-/cheerio-1.0.0-rc.12.tgz", - "integrity": "sha512-VqR8m68vM46BNnuZ5NtnGBKIE/DfN0cRIzg9n40EIq9NOv90ayxLBXA8fXC5gquFRGJSTRqBq25Jt2ECLR431Q==", - "dependencies": { - "cheerio-select": "^2.1.0", - "dom-serializer": "^2.0.0", - "domhandler": "^5.0.3", - "domutils": "^3.0.1", - "htmlparser2": "^8.0.1", - "parse5": "^7.0.0", - "parse5-htmlparser2-tree-adapter": "^7.0.0" - }, - "engines": { - "node": ">= 6" - }, - "funding": { - "url": "https://github.com/cheeriojs/cheerio?sponsor=1" - } - }, - "node_modules/cheerio-select": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/cheerio-select/-/cheerio-select-2.1.0.tgz", - "integrity": "sha512-9v9kG0LvzrlcungtnJtpGNxY+fzECQKhK4EGJX2vByejiMX84MFNQw4UxPJl3bFbTMw+Dfs37XaIkCwTZfLh4g==", - "dependencies": { - "boolbase": "^1.0.0", - "css-select": "^5.1.0", - "css-what": "^6.1.0", - "domelementtype": "^2.3.0", - "domhandler": "^5.0.3", - "domutils": "^3.0.1" - }, - "funding": { - "url": "https://github.com/sponsors/fb55" - } - }, "node_modules/chownr": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/chownr/-/chownr-2.0.0.tgz", @@ -6742,6 +6264,19 @@ "node": ">=10" } }, + "node_modules/chromium-bidi": { + "version": "0.6.3", + "resolved": "https://registry.npmjs.org/chromium-bidi/-/chromium-bidi-0.6.3.tgz", + "integrity": "sha512-qXlsCmpCZJAnoTYI83Iu6EdYQpMYdVkCfq08KDh2pmlVqK5t5IA9mGs4/LwCwp4fqisSOMXZxP3HIh8w8aRn0A==", + "dependencies": { + "mitt": "3.0.1", + "urlpattern-polyfill": "10.0.0", + "zod": "3.23.8" + }, + "peerDependencies": { + "devtools-protocol": "*" + } + }, "node_modules/ci-info": { "version": "3.9.0", "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-3.9.0.tgz", @@ -6776,7 +6311,6 @@ "version": "8.0.1", "resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz", "integrity": "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==", - "dev": true, "dependencies": { "string-width": "^4.2.0", "strip-ansi": "^6.0.1", @@ -6843,7 +6377,6 @@ "version": "1.1.3", "resolved": "https://registry.npmjs.org/color-support/-/color-support-1.1.3.tgz", "integrity": "sha512-qiBjkpbMLO/HL68y+lh4q0/O1MZFj2RX6X/KmMa3+gJD3z+WwI1ZzDHysvqHGS3mP6mznPckpXmw1nI9cJjyRg==", - "optional": true, "bin": { "color-support": "bin.js" } @@ -6948,8 +6481,7 @@ "node_modules/console-control-strings": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/console-control-strings/-/console-control-strings-1.1.0.tgz", - "integrity": "sha512-ty/fTekppD2fIwRvnZAVdeOiGd1c7YXEixbgJTNzqcxJWKQnjJ/V1bNEEE6hygpM3WjwHFUVK6HTjWSzV4a8sQ==", - "optional": true + "integrity": "sha512-ty/fTekppD2fIwRvnZAVdeOiGd1c7YXEixbgJTNzqcxJWKQnjJ/V1bNEEE6hygpM3WjwHFUVK6HTjWSzV4a8sQ==" }, "node_modules/convert-source-map": { "version": "2.0.0", @@ -6975,6 +6507,31 @@ "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", "integrity": "sha512-3lqz5YjWTYnW6dlDa5TLaTCcShfar1e40rmcJVwCBJC6mWlFuj0eCHIElmG1g5kyuJ/GD+8Wn4FFCcz4gJPfaQ==" }, + "node_modules/cosmiconfig": { + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-9.0.0.tgz", + "integrity": "sha512-itvL5h8RETACmOTFc4UfIyB2RfEHi71Ax6E/PivVxq9NseKbOWpeyHEOIbmAw1rs8Ak0VursQNww7lf7YtUwzg==", + "dependencies": { + "env-paths": "^2.2.1", + "import-fresh": "^3.3.0", + "js-yaml": "^4.1.0", + "parse-json": "^5.2.0" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/d-fischer" + }, + "peerDependencies": { + "typescript": ">=4.9.5" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, "node_modules/create-jest": { "version": "29.7.0", "resolved": "https://registry.npmjs.org/create-jest/-/create-jest-29.7.0.tgz", @@ -6996,6 +6553,24 @@ "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, + "node_modules/cross-env": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/cross-env/-/cross-env-7.0.3.tgz", + "integrity": "sha512-+/HKd6EgcQCJGh2PSjZuUitQBQynKor4wrFbRg4DtAgS1aWO+gU52xpH7M9ScGgXSYmAVS9bIJ8EzuaGw0oNAw==", + "dev": true, + "dependencies": { + "cross-spawn": "^7.0.1" + }, + "bin": { + "cross-env": "src/bin/cross-env.js", + "cross-env-shell": "src/bin/cross-env-shell.js" + }, + "engines": { + "node": ">=10.14", + "npm": ">=6", + "yarn": ">=1" + } + }, "node_modules/cross-spawn": { "version": "7.0.3", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", @@ -7035,6 +6610,12 @@ "url": "https://github.com/sponsors/fb55" } }, + "node_modules/cssom": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/cssom/-/cssom-0.5.0.tgz", + "integrity": "sha512-iKuQcq+NdHqlAcwUY0o/HL69XQrUaQdMjmStJ8JFmUaiiQErlhrmuigkg/CU4E2J0IyUKUrMAgl36TvN67MqTw==", + "dev": true + }, "node_modules/cssstyle": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/cssstyle/-/cssstyle-4.0.1.tgz", @@ -7136,9 +6717,9 @@ } }, "node_modules/debug": { - "version": "4.3.4", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", - "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "version": "4.3.6", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.6.tgz", + "integrity": "sha512-O/09Bd4Z1fBrU4VzkhFqVgpPzaGbw6Sm9FEkBT1A/YBXQFGuuSxa1dN2nxgxS34JmKXqYx8CZAwEVoJFImUXIg==", "dependencies": { "ms": "2.1.2" }, @@ -7238,6 +6819,19 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/degenerator": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/degenerator/-/degenerator-5.0.1.tgz", + "integrity": "sha512-TllpMR/t0M5sqCXfj85i4XaAzxmS5tVA16dqvdkMwGmzI+dXLXnw3J+3Vdv7VKw+ThlTMboK6i9rnZ6Nntj5CQ==", + "dependencies": { + "ast-types": "^0.13.4", + "escodegen": "^2.1.0", + "esprima": "^4.0.1" + }, + "engines": { + "node": ">= 14" + } + }, "node_modules/delayed-stream": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", @@ -7282,6 +6876,11 @@ "node": ">=8" } }, + "node_modules/devtools-protocol": { + "version": "0.0.1312386", + "resolved": "https://registry.npmjs.org/devtools-protocol/-/devtools-protocol-0.0.1312386.tgz", + "integrity": "sha512-DPnhUXvmvKT2dFA/j7B+riVLUt9Q6RKJlcppojL5CoRywJJKLDYnRlw0gTFKfgDPHP5E04UoB71SxoJlVZy8FA==" + }, "node_modules/diff-sequences": { "version": "29.6.3", "resolved": "https://registry.npmjs.org/diff-sequences/-/diff-sequences-29.6.3.tgz", @@ -7337,6 +6936,19 @@ } ] }, + "node_modules/domexception": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/domexception/-/domexception-4.0.0.tgz", + "integrity": "sha512-A2is4PLG+eeSfoTMA95/s4pvAoSo2mKtiM5jlHkAVewmiO8ISFTFKZjH7UAM1Atli/OT/7JHOrJRJiMKUZKYBw==", + "deprecated": "Use your platform's native DOMException instead", + "dev": true, + "dependencies": { + "webidl-conversions": "^7.0.0" + }, + "engines": { + "node": ">=12" + } + }, "node_modules/domhandler": { "version": "5.0.3", "resolved": "https://registry.npmjs.org/domhandler/-/domhandler-5.0.3.tgz", @@ -7389,6 +7001,11 @@ "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", "integrity": "sha512-UVU9dibq2JcFWxQPA6KCqj5O42VOmAY3zQUfEKxU0KpTGXwNoCjkX1e13eHNvw/xPynt6pU0rZ1htjWTNTSXsg==" }, + "node_modules/eight-colors": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/eight-colors/-/eight-colors-1.3.0.tgz", + "integrity": "sha512-hVoK898cR71ADj7L1LZWaECLaSkzzPtqGXIaKv4K6Pzb72QgjLVsQaNI+ELDQQshzFvgp5xTPkaYkPGqw3YR+g==" + }, "node_modules/electron-to-chromium": { "version": "1.4.776", "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.776.tgz", @@ -7410,8 +7027,7 @@ "node_modules/emoji-regex": { "version": "8.0.0", "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", - "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", - "devOptional": true + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==" }, "node_modules/encoding": { "version": "0.1.13", @@ -7485,7 +7101,6 @@ "version": "2.2.1", "resolved": "https://registry.npmjs.org/env-paths/-/env-paths-2.2.1.tgz", "integrity": "sha512-+h1lkLKhZMTYjog1VEpJNG7NZJWcuc2DDk/qsqSTRRCOXiLjeQ1d1/udrUGhqMxUgAlwKNZ0cf2uqan5GLuS2A==", - "optional": true, "engines": { "node": ">=6" } @@ -7500,7 +7115,6 @@ "version": "1.3.2", "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", "integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==", - "dev": true, "dependencies": { "is-arrayish": "^0.2.1" } @@ -7672,7 +7286,6 @@ "version": "3.1.2", "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.2.tgz", "integrity": "sha512-ErCHMCae19vR8vQGe50xIsVomy19rg6gFu3+r3jkEO46suLMWBksvVyoGgQV+jOfl84ZSOSlmv6Gxa89PmTGmA==", - "dev": true, "engines": { "node": ">=6" } @@ -7688,6 +7301,26 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/escodegen": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/escodegen/-/escodegen-2.1.0.tgz", + "integrity": "sha512-2NlIDTwUWJN0mRPQOdtQBzbUHvdGY2P1VXSyU83Q3xKxM7WHX2Ql8dKq782Q9TgQUNOLEzEYu9bzLNj1q88I5w==", + "dependencies": { + "esprima": "^4.0.1", + "estraverse": "^5.2.0", + "esutils": "^2.0.2" + }, + "bin": { + "escodegen": "bin/escodegen.js", + "esgenerate": "bin/esgenerate.js" + }, + "engines": { + "node": ">=6.0" + }, + "optionalDependencies": { + "source-map": "~0.6.1" + } + }, "node_modules/eslint": { "version": "8.57.0", "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.57.0.tgz", @@ -8088,6 +7721,39 @@ "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==" }, + "node_modules/extract-zip": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extract-zip/-/extract-zip-2.0.1.tgz", + "integrity": "sha512-GDhU9ntwuKyGXdZBUgTIe+vXnWj0fppUEtMDL0+idd5Sta8TGpHssn/eusA9mrPr9qNDym6SxAYZjNvCn/9RBg==", + "dependencies": { + "debug": "^4.1.1", + "get-stream": "^5.1.0", + "yauzl": "^2.10.0" + }, + "bin": { + "extract-zip": "cli.js" + }, + "engines": { + "node": ">= 10.17.0" + }, + "optionalDependencies": { + "@types/yauzl": "^2.9.1" + } + }, + "node_modules/extract-zip/node_modules/get-stream": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.2.0.tgz", + "integrity": "sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA==", + "dependencies": { + "pump": "^3.0.0" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/extsprintf": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", @@ -8188,6 +7854,14 @@ "bser": "2.1.1" } }, + "node_modules/fd-slicer": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/fd-slicer/-/fd-slicer-1.1.0.tgz", + "integrity": "sha512-cE1qsB/VwyQozZ+q1dGxR8LBYNZeofhEdUNGSMbQD3Gw2lAzX9Zb3uIU6Ebc/Fmyjo9AWWfnn0AUCHqtevs/8g==", + "dependencies": { + "pend": "~1.2.0" + } + }, "node_modules/fetch-blob": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/fetch-blob/-/fetch-blob-3.2.0.tgz", @@ -8377,6 +8051,27 @@ "resolved": "https://registry.npmjs.org/fs-constants/-/fs-constants-1.0.0.tgz", "integrity": "sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow==" }, + "node_modules/fs-extra": { + "version": "11.2.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-11.2.0.tgz", + "integrity": "sha512-PmDi3uwK5nFuXh7XDTlVnS17xJS7vW36is2+w3xcv8SVxiB4NyATf4ctkVY5bkSjX0Y4nbvZCq1/EjtEyr9ktw==", + "dependencies": { + "graceful-fs": "^4.2.0", + "jsonfile": "^6.0.1", + "universalify": "^2.0.0" + }, + "engines": { + "node": ">=14.14" + } + }, + "node_modules/fs-extra/node_modules/universalify": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.1.tgz", + "integrity": "sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw==", + "engines": { + "node": ">= 10.0.0" + } + }, "node_modules/fs-minipass": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-2.1.0.tgz", @@ -8481,7 +8176,6 @@ "version": "2.0.5", "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", - "dev": true, "engines": { "node": "6.* || 8.* || >= 10.*" } @@ -8541,6 +8235,28 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/get-uri": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/get-uri/-/get-uri-6.0.3.tgz", + "integrity": "sha512-BzUrJBS9EcUb4cFol8r4W3v1cPsSyajLSthNkz5BxbpDcHN5tIrM10E2eNvfnvBn3DaT3DUgx0OpsBKkaOpanw==", + "dependencies": { + "basic-ftp": "^5.0.2", + "data-uri-to-buffer": "^6.0.2", + "debug": "^4.3.4", + "fs-extra": "^11.2.0" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/get-uri/node_modules/data-uri-to-buffer": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/data-uri-to-buffer/-/data-uri-to-buffer-6.0.2.tgz", + "integrity": "sha512-7hvf7/GW8e86rW0ptuwS3OcBGDjIi6SZva7hCyWC0yYry2cOPmLIjXAUHI6DK2HsnwJd9ifmt57i8eV2n4YNpw==", + "engines": { + "node": ">= 14" + } + }, "node_modules/getpass": { "version": "0.1.7", "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", @@ -8858,8 +8574,7 @@ "node_modules/has-unicode": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/has-unicode/-/has-unicode-2.0.1.tgz", - "integrity": "sha512-8Rf9Y83NBReMnx0gFzA8JImQACstCYWUplepDa9xprwwtmgEZUF0h/i5xSA625zB/I37EtrswSST6OXxwaaIJQ==", - "optional": true + "integrity": "sha512-8Rf9Y83NBReMnx0gFzA8JImQACstCYWUplepDa9xprwwtmgEZUF0h/i5xSA625zB/I37EtrswSST6OXxwaaIJQ==" }, "node_modules/hasown": { "version": "2.0.2", @@ -8897,24 +8612,6 @@ "integrity": "sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==", "dev": true }, - "node_modules/htmlparser2": { - "version": "8.0.2", - "resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-8.0.2.tgz", - "integrity": "sha512-GYdjWKDkbRLkZ5geuHs5NY1puJ+PXwP7+fHPRz06Eirsb9ugf6d8kkXav6ADhcODhFFPMIXyxkxSuMf3D6NCFA==", - "funding": [ - "https://github.com/fb55/htmlparser2?sponsor=1", - { - "type": "github", - "url": "https://github.com/sponsors/fb55" - } - ], - "dependencies": { - "domelementtype": "^2.3.0", - "domhandler": "^5.0.3", - "domutils": "^3.0.1", - "entities": "^4.4.0" - } - }, "node_modules/http-cache-semantics": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-4.1.1.tgz", @@ -8948,9 +8645,9 @@ } }, "node_modules/https-proxy-agent": { - "version": "7.0.4", - "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-7.0.4.tgz", - "integrity": "sha512-wlwpilI7YdjSkWaQ/7omYBMTliDcmCN8OLihO6I9B86g06lMyAoqgoDpV0XqoaPOKj+0DIdAvnsWfyAAhmimcg==", + "version": "7.0.5", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-7.0.5.tgz", + "integrity": "sha512-1e4Wqeblerz+tMKPIq2EMGiiWW1dIjZOksyHWSUm1rmuvw/how9hBHZ38lAGj5ID4Ik6EdkOw7NmWPy6LAwalw==", "dependencies": { "agent-base": "^7.0.2", "debug": "4" @@ -9107,7 +8804,6 @@ "version": "9.0.5", "resolved": "https://registry.npmjs.org/ip-address/-/ip-address-9.0.5.tgz", "integrity": "sha512-zHtQzGojZXTwZTHQqra+ETKd4Sn3vgi7uBmlPoXVWZqYvuKmtI0l/VZTjqGmJY9x88GGOaZ9+G9ES8hC4T4X8g==", - "optional": true, "dependencies": { "jsbn": "1.1.0", "sprintf-js": "^1.1.3" @@ -9134,8 +8830,7 @@ "node_modules/is-arrayish": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", - "integrity": "sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg==", - "dev": true + "integrity": "sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg==" }, "node_modules/is-bigint": { "version": "1.0.4", @@ -9230,7 +8925,6 @@ "version": "3.0.0", "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", - "devOptional": true, "engines": { "node": ">=8" } @@ -9532,6 +9226,33 @@ "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, + "node_modules/jest-changed-files/node_modules/p-limit": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", + "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", + "dev": true, + "dependencies": { + "yocto-queue": "^0.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/jest-changed-files/node_modules/yocto-queue": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", + "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/jest-circus": { "version": "29.7.0", "resolved": "https://registry.npmjs.org/jest-circus/-/jest-circus-29.7.0.tgz", @@ -9563,6 +9284,33 @@ "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, + "node_modules/jest-circus/node_modules/p-limit": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", + "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", + "dev": true, + "dependencies": { + "yocto-queue": "^0.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/jest-circus/node_modules/yocto-queue": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", + "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/jest-cli": { "version": "29.7.0", "resolved": "https://registry.npmjs.org/jest-cli/-/jest-cli-29.7.0.tgz", @@ -9684,6 +9432,248 @@ "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, + "node_modules/jest-environment-jsdom": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-environment-jsdom/-/jest-environment-jsdom-29.7.0.tgz", + "integrity": "sha512-k9iQbsf9OyOfdzWH8HDmrRT0gSIcX+FLNW7IQq94tFX0gynPwqDTW0Ho6iMVNjGz/nb+l/vW3dWM2bbLLpkbXA==", + "dev": true, + "dependencies": { + "@jest/environment": "^29.7.0", + "@jest/fake-timers": "^29.7.0", + "@jest/types": "^29.6.3", + "@types/jsdom": "^20.0.0", + "@types/node": "*", + "jest-mock": "^29.7.0", + "jest-util": "^29.7.0", + "jsdom": "^20.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + }, + "peerDependencies": { + "canvas": "^2.5.0" + }, + "peerDependenciesMeta": { + "canvas": { + "optional": true + } + } + }, + "node_modules/jest-environment-jsdom/node_modules/@tootallnate/once": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@tootallnate/once/-/once-2.0.0.tgz", + "integrity": "sha512-XCuKFP5PS55gnMVu3dty8KPatLqUoy/ZYzDzAGCQ8JNFCkLXzmI7vNHCR+XpbZaMWQK/vQubr7PkYq8g470J/A==", + "dev": true, + "engines": { + "node": ">= 10" + } + }, + "node_modules/jest-environment-jsdom/node_modules/@types/jsdom": { + "version": "20.0.1", + "resolved": "https://registry.npmjs.org/@types/jsdom/-/jsdom-20.0.1.tgz", + "integrity": "sha512-d0r18sZPmMQr1eG35u12FZfhIXNrnsPU/g5wvRKCUf/tOGilKKwYMYGqh33BNR6ba+2gkHw1EUiHoN3mn7E5IQ==", + "dev": true, + "dependencies": { + "@types/node": "*", + "@types/tough-cookie": "*", + "parse5": "^7.0.0" + } + }, + "node_modules/jest-environment-jsdom/node_modules/agent-base": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz", + "integrity": "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==", + "dev": true, + "dependencies": { + "debug": "4" + }, + "engines": { + "node": ">= 6.0.0" + } + }, + "node_modules/jest-environment-jsdom/node_modules/cssstyle": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/cssstyle/-/cssstyle-2.3.0.tgz", + "integrity": "sha512-AZL67abkUzIuvcHqk7c09cezpGNcxUxU4Ioi/05xHk4DQeTkWmGYftIE6ctU6AEt+Gn4n1lDStOtj7FKycP71A==", + "dev": true, + "dependencies": { + "cssom": "~0.3.6" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/jest-environment-jsdom/node_modules/cssstyle/node_modules/cssom": { + "version": "0.3.8", + "resolved": "https://registry.npmjs.org/cssom/-/cssom-0.3.8.tgz", + "integrity": "sha512-b0tGHbfegbhPJpxpiBPU2sCkigAqtM9O121le6bbOlgyV+NyGyCmVfJ6QW9eRjz8CpNfWEOYBIMIGRYkLwsIYg==", + "dev": true + }, + "node_modules/jest-environment-jsdom/node_modules/data-urls": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/data-urls/-/data-urls-3.0.2.tgz", + "integrity": "sha512-Jy/tj3ldjZJo63sVAvg6LHt2mHvl4V6AgRAmNDtLdm7faqtsx+aJG42rsyCo9JCoRVKwPFzKlIPx3DIibwSIaQ==", + "dev": true, + "dependencies": { + "abab": "^2.0.6", + "whatwg-mimetype": "^3.0.0", + "whatwg-url": "^11.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/jest-environment-jsdom/node_modules/html-encoding-sniffer": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/html-encoding-sniffer/-/html-encoding-sniffer-3.0.0.tgz", + "integrity": "sha512-oWv4T4yJ52iKrufjnyZPkrN0CH3QnrUqdB6In1g5Fe1mia8GmF36gnfNySxoZtxD5+NmYw1EElVXiBk93UeskA==", + "dev": true, + "dependencies": { + "whatwg-encoding": "^2.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/jest-environment-jsdom/node_modules/http-proxy-agent": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-5.0.0.tgz", + "integrity": "sha512-n2hY8YdoRE1i7r6M0w9DIw5GgZN0G25P8zLCRQ8rjXtTU3vsNFBI/vWK/UIeE6g5MUUz6avwAPXmL6Fy9D/90w==", + "dev": true, + "dependencies": { + "@tootallnate/once": "2", + "agent-base": "6", + "debug": "4" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/jest-environment-jsdom/node_modules/https-proxy-agent": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz", + "integrity": "sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA==", + "dev": true, + "dependencies": { + "agent-base": "6", + "debug": "4" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/jest-environment-jsdom/node_modules/jsdom": { + "version": "20.0.3", + "resolved": "https://registry.npmjs.org/jsdom/-/jsdom-20.0.3.tgz", + "integrity": "sha512-SYhBvTh89tTfCD/CRdSOm13mOBa42iTaTyfyEWBdKcGdPxPtLFBXuHR8XHb33YNYaP+lLbmSvBTsnoesCNJEsQ==", + "dev": true, + "dependencies": { + "abab": "^2.0.6", + "acorn": "^8.8.1", + "acorn-globals": "^7.0.0", + "cssom": "^0.5.0", + "cssstyle": "^2.3.0", + "data-urls": "^3.0.2", + "decimal.js": "^10.4.2", + "domexception": "^4.0.0", + "escodegen": "^2.0.0", + "form-data": "^4.0.0", + "html-encoding-sniffer": "^3.0.0", + "http-proxy-agent": "^5.0.0", + "https-proxy-agent": "^5.0.1", + "is-potential-custom-element-name": "^1.0.1", + "nwsapi": "^2.2.2", + "parse5": "^7.1.1", + "saxes": "^6.0.0", + "symbol-tree": "^3.2.4", + "tough-cookie": "^4.1.2", + "w3c-xmlserializer": "^4.0.0", + "webidl-conversions": "^7.0.0", + "whatwg-encoding": "^2.0.0", + "whatwg-mimetype": "^3.0.0", + "whatwg-url": "^11.0.0", + "ws": "^8.11.0", + "xml-name-validator": "^4.0.0" + }, + "engines": { + "node": ">=14" + }, + "peerDependencies": { + "canvas": "^2.5.0" + }, + "peerDependenciesMeta": { + "canvas": { + "optional": true + } + } + }, + "node_modules/jest-environment-jsdom/node_modules/tr46": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-3.0.0.tgz", + "integrity": "sha512-l7FvfAHlcmulp8kr+flpQZmVwtu7nfRV7NZujtN0OqES8EL4O4e0qqzL0DC5gAvx/ZC/9lk6rhcUwYvkBnBnYA==", + "dev": true, + "dependencies": { + "punycode": "^2.1.1" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/jest-environment-jsdom/node_modules/w3c-xmlserializer": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/w3c-xmlserializer/-/w3c-xmlserializer-4.0.0.tgz", + "integrity": "sha512-d+BFHzbiCx6zGfz0HyQ6Rg69w9k19nviJspaj4yNscGjrHu94sVP+aRm75yEbCh+r2/yR+7q6hux9LVtbuTGBw==", + "dev": true, + "dependencies": { + "xml-name-validator": "^4.0.0" + }, + "engines": { + "node": ">=14" + } + }, + "node_modules/jest-environment-jsdom/node_modules/whatwg-encoding": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/whatwg-encoding/-/whatwg-encoding-2.0.0.tgz", + "integrity": "sha512-p41ogyeMUrw3jWclHWTQg1k05DSVXPLcVxRTYsXUk+ZooOCZLcoYgPZ/HL/D/N+uQPOtcp1me1WhBEaX02mhWg==", + "dev": true, + "dependencies": { + "iconv-lite": "0.6.3" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/jest-environment-jsdom/node_modules/whatwg-mimetype": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/whatwg-mimetype/-/whatwg-mimetype-3.0.0.tgz", + "integrity": "sha512-nt+N2dzIutVRxARx1nghPKGv1xHikU7HKdfafKkLNLindmPU/ch3U31NOCGGA/dmPcmb1VlofO0vnKAcsm0o/Q==", + "dev": true, + "engines": { + "node": ">=12" + } + }, + "node_modules/jest-environment-jsdom/node_modules/whatwg-url": { + "version": "11.0.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-11.0.0.tgz", + "integrity": "sha512-RKT8HExMpoYx4igMiVMY83lN6UeITKJlBQ+vR/8ZJ8OCdSiN3RwCq+9gH0+Xzj0+5IrM6i4j/6LuvzbZIQgEcQ==", + "dev": true, + "dependencies": { + "tr46": "^3.0.0", + "webidl-conversions": "^7.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/jest-environment-jsdom/node_modules/xml-name-validator": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/xml-name-validator/-/xml-name-validator-4.0.0.tgz", + "integrity": "sha512-ICP2e+jsHvAj2E2lIHxa5tjXRlKDJo4IdvPvCXbXQGdzSfmSpNVyIKMvoZHjDY9DP0zV17iI85o90vRFXNccRw==", + "dev": true, + "engines": { + "node": ">=12" + } + }, "node_modules/jest-environment-node": { "version": "29.7.0", "resolved": "https://registry.npmjs.org/jest-environment-node/-/jest-environment-node-29.7.0.tgz", @@ -9888,6 +9878,33 @@ "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, + "node_modules/jest-runner/node_modules/p-limit": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", + "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", + "dev": true, + "dependencies": { + "yocto-queue": "^0.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/jest-runner/node_modules/yocto-queue": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", + "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/jest-runtime": { "version": "29.7.0", "resolved": "https://registry.npmjs.org/jest-runtime/-/jest-runtime-29.7.0.tgz", @@ -10047,6 +10064,14 @@ "url": "https://github.com/chalk/supports-color?sponsor=1" } }, + "node_modules/jinja-js": { + "version": "0.1.8", + "resolved": "https://registry.npmjs.org/jinja-js/-/jinja-js-0.1.8.tgz", + "integrity": "sha512-1wJNbeZxknEckfqt5VU4oVvphC2qASn9yfAw5BNF0JhRZM5LNPcnQKC6nAiEx8nJh0NhxkjCWjQDOut/zQqUOw==", + "bin": { + "jinjajs": "cli.js" + } + }, "node_modules/js-tiktoken": { "version": "1.0.12", "resolved": "https://registry.npmjs.org/js-tiktoken/-/js-tiktoken-1.0.12.tgz", @@ -10058,8 +10083,7 @@ "node_modules/js-tokens": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", - "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", - "dev": true + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==" }, "node_modules/js-yaml": { "version": "4.1.0", @@ -10075,34 +10099,33 @@ "node_modules/jsbn": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-1.1.0.tgz", - "integrity": "sha512-4bYVV3aAMtDTTu4+xsDYa6sy9GyJ69/amsu9sYF2zqjiEoZA5xJi3BrfX3uY+/IekIu7MwdObdbDWpoZdBv3/A==", - "optional": true + "integrity": "sha512-4bYVV3aAMtDTTu4+xsDYa6sy9GyJ69/amsu9sYF2zqjiEoZA5xJi3BrfX3uY+/IekIu7MwdObdbDWpoZdBv3/A==" }, "node_modules/jsdom": { - "version": "24.0.0", - "resolved": "https://registry.npmjs.org/jsdom/-/jsdom-24.0.0.tgz", - "integrity": "sha512-UDS2NayCvmXSXVP6mpTj+73JnNQadZlr9N68189xib2tx5Mls7swlTNao26IoHv46BZJFvXygyRtyXd1feAk1A==", + "version": "24.1.1", + "resolved": "https://registry.npmjs.org/jsdom/-/jsdom-24.1.1.tgz", + "integrity": "sha512-5O1wWV99Jhq4DV7rCLIoZ/UIhyQeDR7wHVyZAHAshbrvZsLs+Xzz7gtwnlJTJDjleiTKh54F4dXrX70vJQTyJQ==", "dependencies": { "cssstyle": "^4.0.1", "data-urls": "^5.0.0", "decimal.js": "^10.4.3", "form-data": "^4.0.0", "html-encoding-sniffer": "^4.0.0", - "http-proxy-agent": "^7.0.0", - "https-proxy-agent": "^7.0.2", + "http-proxy-agent": "^7.0.2", + "https-proxy-agent": "^7.0.5", "is-potential-custom-element-name": "^1.0.1", - "nwsapi": "^2.2.7", + "nwsapi": "^2.2.12", "parse5": "^7.1.2", - "rrweb-cssom": "^0.6.0", + "rrweb-cssom": "^0.7.1", "saxes": "^6.0.0", "symbol-tree": "^3.2.4", - "tough-cookie": "^4.1.3", + "tough-cookie": "^4.1.4", "w3c-xmlserializer": "^5.0.0", "webidl-conversions": "^7.0.0", "whatwg-encoding": "^3.1.1", "whatwg-mimetype": "^4.0.0", "whatwg-url": "^14.0.0", - "ws": "^8.16.0", + "ws": "^8.18.0", "xml-name-validator": "^5.0.0" }, "engines": { @@ -10117,6 +10140,11 @@ } } }, + "node_modules/jsdom/node_modules/rrweb-cssom": { + "version": "0.7.1", + "resolved": "https://registry.npmjs.org/rrweb-cssom/-/rrweb-cssom-0.7.1.tgz", + "integrity": "sha512-TrEMa7JGdVm0UThDJSx7ddw5nVm3UJS9o9CCIZ72B1vSyEZoziDqBYP3XIoi/12lKrJR8rE3jeFHMok2F/Mnsg==" + }, "node_modules/jsesc": { "version": "2.5.2", "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-2.5.2.tgz", @@ -10146,8 +10174,7 @@ "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 + "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==" }, "node_modules/json-schema": { "version": "0.4.0", @@ -10181,6 +10208,25 @@ "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==", + "dependencies": { + "universalify": "^2.0.0" + }, + "optionalDependencies": { + "graceful-fs": "^4.1.6" + } + }, + "node_modules/jsonfile/node_modules/universalify": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.1.tgz", + "integrity": "sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw==", + "engines": { + "node": ">= 10.0.0" + } + }, "node_modules/jsprim": { "version": "1.4.2", "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.2.tgz", @@ -10280,8 +10326,7 @@ "node_modules/lines-and-columns": { "version": "1.2.4", "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz", - "integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==", - "dev": true + "integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==" }, "node_modules/llm-code-highlighter": { "version": "0.0.14", @@ -10696,6 +10741,11 @@ "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" }, + "node_modules/mitt": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/mitt/-/mitt-3.0.1.tgz", + "integrity": "sha512-vKivATfr97l2/QBCYAkXYDbrIWPM2IIKEl7YPhjCvKlG3kE2gm+uBo6nEXK3M5/Ffh/FLpKExzOQ3JJoJGFKBw==" + }, "node_modules/mkdirp": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz", @@ -10803,6 +10853,14 @@ "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.2.tgz", "integrity": "sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==" }, + "node_modules/netmask": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/netmask/-/netmask-2.0.2.tgz", + "integrity": "sha512-dBpDMdxv9Irdq66304OLfEmQ9tbNRFnFTuZiLo+bD+r332bBmMJ8GBLXklIXXgxd3+v9+KUnZaUR5PJMa75Gsg==", + "engines": { + "node": ">= 0.4.0" + } + }, "node_modules/node-abi": { "version": "3.62.0", "resolved": "https://registry.npmjs.org/node-abi/-/node-abi-3.62.0.tgz", @@ -11003,9 +11061,9 @@ } }, "node_modules/nwsapi": { - "version": "2.2.10", - "resolved": "https://registry.npmjs.org/nwsapi/-/nwsapi-2.2.10.tgz", - "integrity": "sha512-QK0sRs7MKv0tKe1+5uZIQk/C8XGza4DAnztJG8iD+TpJIORARrCxczA738awHrZoHeTjSSoHqao2teO0dC/gFQ==" + "version": "2.2.12", + "resolved": "https://registry.npmjs.org/nwsapi/-/nwsapi-2.2.12.tgz", + "integrity": "sha512-qXDmcVlZV4XRtKFzddidpfVP4oMSGhga+xdMc25mv8kaLUHtgzCDhUxkrN8exkGdTlLNaXj7CV3GtON7zuGZ+w==" }, "node_modules/oauth-sign": { "version": "0.9.0", @@ -11112,6 +11170,12 @@ "resolved": "https://registry.npmjs.org/obliterator/-/obliterator-2.0.4.tgz", "integrity": "sha512-lgHwxlxV1qIg1Eap7LgIeoBWIMFibOjbrYPIPJZcI1mmGAI2m3lNYpK12Y+GBdPQ0U1hRwSord7GIaawz962qQ==" }, + "node_modules/obuf": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/obuf/-/obuf-1.1.2.tgz", + "integrity": "sha512-PX1wu0AmAdPqOL1mWhqmlOd8kOIZQwGZw6rh7uby9fTc5lhaOWFLX3I6R1hrF9k3zUY40e6igsLGkDXK92LJNg==", + "dev": true + }, "node_modules/ollama": { "version": "0.4.9", "resolved": "https://registry.npmjs.org/ollama/-/ollama-0.4.9.tgz", @@ -11273,6 +11337,34 @@ } }, "node_modules/p-limit": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-6.1.0.tgz", + "integrity": "sha512-H0jc0q1vOzlEk0TqAKXKZxdl7kX3OFUzCnNVUnq5Pc3DGo0kpeaMuPqxQn235HibwBEb0/pm9dgKTjXy66fBkg==", + "dependencies": { + "yocto-queue": "^1.1.1" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-locate": { + "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==", + "dependencies": { + "p-limit": "^3.0.2" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-locate/node_modules/p-limit": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", @@ -11286,13 +11378,10 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/p-locate": { - "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==", - "dependencies": { - "p-limit": "^3.0.2" - }, + "node_modules/p-locate/node_modules/yocto-queue": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", + "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", "engines": { "node": ">=10" }, @@ -11324,6 +11413,49 @@ "node": ">=6" } }, + "node_modules/pac-proxy-agent": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/pac-proxy-agent/-/pac-proxy-agent-7.0.2.tgz", + "integrity": "sha512-BFi3vZnO9X5Qt6NRz7ZOaPja3ic0PhlsmCRYLOpN11+mWBCR6XJDqW5RF3j8jm4WGGQZtBA+bTfxYzeKW73eHg==", + "dependencies": { + "@tootallnate/quickjs-emscripten": "^0.23.0", + "agent-base": "^7.0.2", + "debug": "^4.3.4", + "get-uri": "^6.0.1", + "http-proxy-agent": "^7.0.0", + "https-proxy-agent": "^7.0.5", + "pac-resolver": "^7.0.1", + "socks-proxy-agent": "^8.0.4" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/pac-proxy-agent/node_modules/socks-proxy-agent": { + "version": "8.0.4", + "resolved": "https://registry.npmjs.org/socks-proxy-agent/-/socks-proxy-agent-8.0.4.tgz", + "integrity": "sha512-GNAq/eg8Udq2x0eNiFkr9gRg5bA7PXEWagQdeRX4cPSG+X/8V38v637gim9bjFptMk1QWsCTr0ttrJEiXbNnRw==", + "dependencies": { + "agent-base": "^7.1.1", + "debug": "^4.3.4", + "socks": "^2.8.3" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/pac-resolver": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/pac-resolver/-/pac-resolver-7.0.1.tgz", + "integrity": "sha512-5NPgf87AT2STgwa2ntRMr45jTKrYBGkVU36yT0ig/n/GMAa3oPqhZfIQ2kMEimReg0+t9kZViDVZ83qfVUlckg==", + "dependencies": { + "degenerator": "^5.0.0", + "netmask": "^2.0.2" + }, + "engines": { + "node": ">= 14" + } + }, "node_modules/pad-left": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/pad-left/-/pad-left-2.1.0.tgz", @@ -11351,7 +11483,6 @@ "version": "5.2.0", "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-5.2.0.tgz", "integrity": "sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg==", - "dev": true, "dependencies": { "@babel/code-frame": "^7.0.0", "error-ex": "^1.3.1", @@ -11376,18 +11507,6 @@ "url": "https://github.com/inikulin/parse5?sponsor=1" } }, - "node_modules/parse5-htmlparser2-tree-adapter": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/parse5-htmlparser2-tree-adapter/-/parse5-htmlparser2-tree-adapter-7.0.0.tgz", - "integrity": "sha512-B77tOZrqqfUfnVcOrUvfdLbz4pu4RopLD/4vmu3HUPswwTA8OH0EMW9BlWR2B0RCoiZRAHEUu7IxeP1Pd1UU+g==", - "dependencies": { - "domhandler": "^5.0.2", - "parse5": "^7.0.0" - }, - "funding": { - "url": "https://github.com/inikulin/parse5?sponsor=1" - } - }, "node_modules/path-exists": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", @@ -11425,6 +11544,11 @@ "node": ">=8" } }, + "node_modules/pend": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/pend/-/pend-1.2.0.tgz", + "integrity": "sha512-F3asv42UuXchdzt+xXqfW1OGlVBe+mxa2mqI0pg5yAHZPvFmY3Y6drSf/GQ1A86WgWEN9Kzh/WrgKa6iGcHXLg==" + }, "node_modules/performance-now": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", @@ -11475,6 +11599,15 @@ "node": ">=4.0.0" } }, + "node_modules/pg-numeric": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/pg-numeric/-/pg-numeric-1.0.2.tgz", + "integrity": "sha512-BM/Thnrw5jm2kKLE5uJkXqqExRUY/toLHda65XgFTBTFYZyopbKjBe29Ii3RbkvlsMoFwD+tHeGaCjjv0gHlyw==", + "dev": true, + "engines": { + "node": ">=4" + } + }, "node_modules/pg-pool": { "version": "3.6.2", "resolved": "https://registry.npmjs.org/pg-pool/-/pg-pool-3.6.2.tgz", @@ -11514,8 +11647,7 @@ "node_modules/picocolors": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.1.tgz", - "integrity": "sha512-anP1Z8qwhkbmu7MFP5iTt+wQKXgwzf7zTyGlcdzabySa9vd0Xt392U0rVmz9poOaBj0uHJKyyo9/upk0HrEQew==", - "dev": true + "integrity": "sha512-anP1Z8qwhkbmu7MFP5iTt+wQKXgwzf7zTyGlcdzabySa9vd0Xt392U0rVmz9poOaBj0uHJKyyo9/upk0HrEQew==" }, "node_modules/picomatch": { "version": "2.3.1", @@ -11658,6 +11790,12 @@ "node": ">=0.10.0" } }, + "node_modules/postgres-range": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/postgres-range/-/postgres-range-1.1.4.tgz", + "integrity": "sha512-i/hbxIE9803Alj/6ytL7UHQxRvZkI9O4Sy+J3HGc4F4oo/2eQAjTSNJ0bfxyse3bH0nuVesCk+3IRLaMtG3H6w==", + "dev": true + }, "node_modules/posthog-node": { "version": "3.6.3", "resolved": "https://registry.npmjs.org/posthog-node/-/posthog-node-3.6.3.tgz", @@ -11782,6 +11920,14 @@ "node": ">= 0.6.0" } }, + "node_modules/progress": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz", + "integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==", + "engines": { + "node": ">=0.4.0" + } + }, "node_modules/promise-inflight": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/promise-inflight/-/promise-inflight-1.0.1.tgz", @@ -11844,6 +11990,45 @@ "resolved": "https://registry.npmjs.org/long/-/long-4.0.0.tgz", "integrity": "sha512-XsP+KhQif4bjX1kbuSiySJFNAehNxgLb6hPRGJ9QsUr8ajHkuXGdrHmFUTUUXhDwVX2R5bY4JNZEwbUiMhV+MA==" }, + "node_modules/proxy-agent": { + "version": "6.4.0", + "resolved": "https://registry.npmjs.org/proxy-agent/-/proxy-agent-6.4.0.tgz", + "integrity": "sha512-u0piLU+nCOHMgGjRbimiXmA9kM/L9EHh3zL81xCdp7m+Y2pHIsnmbdDoEDoAz5geaonNR6q6+yOPQs6n4T6sBQ==", + "dependencies": { + "agent-base": "^7.0.2", + "debug": "^4.3.4", + "http-proxy-agent": "^7.0.1", + "https-proxy-agent": "^7.0.3", + "lru-cache": "^7.14.1", + "pac-proxy-agent": "^7.0.1", + "proxy-from-env": "^1.1.0", + "socks-proxy-agent": "^8.0.2" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/proxy-agent/node_modules/lru-cache": { + "version": "7.18.3", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-7.18.3.tgz", + "integrity": "sha512-jumlc0BIUrS3qJGgIkWZsyfAM7NCWiBcCDhnd+3NNM5KbBmLTgHVfWBcg6W+rLUsIpzpERPsvwUP7CckAQSOoA==", + "engines": { + "node": ">=12" + } + }, + "node_modules/proxy-agent/node_modules/socks-proxy-agent": { + "version": "8.0.4", + "resolved": "https://registry.npmjs.org/socks-proxy-agent/-/socks-proxy-agent-8.0.4.tgz", + "integrity": "sha512-GNAq/eg8Udq2x0eNiFkr9gRg5bA7PXEWagQdeRX4cPSG+X/8V38v637gim9bjFptMk1QWsCTr0ttrJEiXbNnRw==", + "dependencies": { + "agent-base": "^7.1.1", + "debug": "^4.3.4", + "socks": "^2.8.3" + }, + "engines": { + "node": ">= 14" + } + }, "node_modules/proxy-from-env": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", @@ -11871,6 +12056,131 @@ "node": ">=6" } }, + "node_modules/puppeteer": { + "version": "22.15.0", + "resolved": "https://registry.npmjs.org/puppeteer/-/puppeteer-22.15.0.tgz", + "integrity": "sha512-XjCY1SiSEi1T7iSYuxS82ft85kwDJUS7wj1Z0eGVXKdtr5g4xnVcbjwxhq5xBnpK/E7x1VZZoJDxpjAOasHT4Q==", + "hasInstallScript": true, + "dependencies": { + "@puppeteer/browsers": "2.3.0", + "cosmiconfig": "^9.0.0", + "devtools-protocol": "0.0.1312386", + "puppeteer-core": "22.15.0" + }, + "bin": { + "puppeteer": "lib/esm/puppeteer/node/cli.js" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/puppeteer-chromium-resolver": { + "version": "23.0.0", + "resolved": "https://registry.npmjs.org/puppeteer-chromium-resolver/-/puppeteer-chromium-resolver-23.0.0.tgz", + "integrity": "sha512-PbSXK4ERPwp+eYm+SVY5vMWCxsdeJcddwz4avXvDx7kE9DLE+L86Xg027sypw2oan5yi6557brzVsbajcMmy2g==", + "hasInstallScript": true, + "dependencies": { + "@puppeteer/browsers": "^2.3.1", + "eight-colors": "^1.3.0", + "gauge": "^5.0.2", + "puppeteer-core": "^23.1.0" + } + }, + "node_modules/puppeteer-chromium-resolver/node_modules/@puppeteer/browsers": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/@puppeteer/browsers/-/browsers-2.3.1.tgz", + "integrity": "sha512-uK7o3hHkK+naEobMSJ+2ySYyXtQkBxIH8Gn4MK9ciePjNV+Pf+PgY/W7iPzn2MTjl3stcYB5AlcTmPYw7AXDwA==", + "dependencies": { + "debug": "^4.3.6", + "extract-zip": "^2.0.1", + "progress": "^2.0.3", + "proxy-agent": "^6.4.0", + "semver": "^7.6.3", + "tar-fs": "^3.0.6", + "unbzip2-stream": "^1.4.3", + "yargs": "^17.7.2" + }, + "bin": { + "browsers": "lib/cjs/main-cli.js" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/puppeteer-chromium-resolver/node_modules/chromium-bidi": { + "version": "0.6.4", + "resolved": "https://registry.npmjs.org/chromium-bidi/-/chromium-bidi-0.6.4.tgz", + "integrity": "sha512-8zoq6ogmhQQkAKZVKO2ObFTl4uOkqoX1PlKQX3hZQ5E9cbUotcAb7h4pTNVAGGv8Z36PF3CtdOriEp/Rz82JqQ==", + "dependencies": { + "mitt": "3.0.1", + "urlpattern-polyfill": "10.0.0", + "zod": "3.23.8" + }, + "peerDependencies": { + "devtools-protocol": "*" + } + }, + "node_modules/puppeteer-chromium-resolver/node_modules/gauge": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/gauge/-/gauge-5.0.2.tgz", + "integrity": "sha512-pMaFftXPtiGIHCJHdcUUx9Rby/rFT/Kkt3fIIGCs+9PMDIljSyRiqraTlxNtBReJRDfUefpa263RQ3vnp5G/LQ==", + "deprecated": "This package is no longer supported.", + "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/puppeteer-chromium-resolver/node_modules/puppeteer-core": { + "version": "23.1.1", + "resolved": "https://registry.npmjs.org/puppeteer-core/-/puppeteer-core-23.1.1.tgz", + "integrity": "sha512-OeTqNiYGF9qZtwZU4Yc88DDqFJs4TJ4rnK81jkillh6MwDeQodyisM9xe5lBmPhwiDy92s5J5DQtQLjCKHFQ3g==", + "dependencies": { + "@puppeteer/browsers": "2.3.1", + "chromium-bidi": "0.6.4", + "debug": "^4.3.6", + "devtools-protocol": "0.0.1312386", + "typed-query-selector": "^2.12.0", + "ws": "^8.18.0" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/puppeteer-chromium-resolver/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==", + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/puppeteer-core": { + "version": "22.15.0", + "resolved": "https://registry.npmjs.org/puppeteer-core/-/puppeteer-core-22.15.0.tgz", + "integrity": "sha512-cHArnywCiAAVXa3t4GGL2vttNxh7GqXtIYGym99egkNJ3oG//wL9LkvO4WE8W1TJe95t1F1ocu9X4xWaGsOKOA==", + "dependencies": { + "@puppeteer/browsers": "2.3.0", + "chromium-bidi": "0.6.3", + "debug": "^4.3.6", + "devtools-protocol": "0.0.1312386", + "ws": "^8.18.0" + }, + "engines": { + "node": ">=18" + } + }, "node_modules/pure-rand": { "version": "6.1.0", "resolved": "https://registry.npmjs.org/pure-rand/-/pure-rand-6.1.0.tgz", @@ -12158,7 +12468,6 @@ "version": "2.1.1", "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==", - "dev": true, "engines": { "node": ">=0.10.0" } @@ -12355,9 +12664,9 @@ } }, "node_modules/semver": { - "version": "7.6.2", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.2.tgz", - "integrity": "sha512-FNAIBWCx9qcRhoHcgcJ0gvU7SN1lYU2ZXuSfl04bSC5OpvDHFyJCjdNHomPXxjQlCBU67YW64PzY7/VIEH7F2w==", + "version": "7.6.3", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.3.tgz", + "integrity": "sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A==", "bin": { "semver": "bin/semver.js" }, @@ -12552,7 +12861,6 @@ "version": "4.2.0", "resolved": "https://registry.npmjs.org/smart-buffer/-/smart-buffer-4.2.0.tgz", "integrity": "sha512-94hK0Hh8rPqQl2xXc3HsaBoOXKV20MToPkcXvwbISWLEs+64sBq5kFgn2kJDHb1Pry9yrP0dxrCI9RRci7RXKg==", - "optional": true, "engines": { "node": ">= 6.0.0", "npm": ">= 3.0.0" @@ -12588,7 +12896,6 @@ "version": "2.8.3", "resolved": "https://registry.npmjs.org/socks/-/socks-2.8.3.tgz", "integrity": "sha512-l5x7VUUWbjVFbafGLxPWkYsHIhEvmF85tbIeFZWc8ZPtoMyybuEhL7Jye/ooC4/d48FgOjSJXgsF/AJPYCW8Zw==", - "optional": true, "dependencies": { "ip-address": "^9.0.5", "smart-buffer": "^4.2.0" @@ -12664,8 +12971,7 @@ "node_modules/sprintf-js": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.1.3.tgz", - "integrity": "sha512-Oo+0REFV59/rz3gfJNKQiBlwfHaSESl1pcGyABQsnnIfWOFt6JNj5gCog2U6MLZ//IGYD+nA8nI+mTShREReaA==", - "optional": true + "integrity": "sha512-Oo+0REFV59/rz3gfJNKQiBlwfHaSESl1pcGyABQsnnIfWOFt6JNj5gCog2U6MLZ//IGYD+nA8nI+mTShREReaA==" }, "node_modules/sqlite": { "version": "5.1.1", @@ -12819,7 +13125,6 @@ "version": "4.2.3", "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", - "devOptional": true, "dependencies": { "emoji-regex": "^8.0.0", "is-fullwidth-code-point": "^3.0.0", @@ -13358,6 +13663,11 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/typed-query-selector": { + "version": "2.12.0", + "resolved": "https://registry.npmjs.org/typed-query-selector/-/typed-query-selector-2.12.0.tgz", + "integrity": "sha512-SbklCd1F0EiZOyPiW192rrHZzZ5sBijB6xM+cpmrwDqObvdtunOHHIk9fCGsoK5JVIYXoyEp4iEdE3upFH3PAg==" + }, "node_modules/typescript": { "version": "5.4.5", "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.4.5.tgz", @@ -13406,6 +13716,38 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/unbzip2-stream": { + "version": "1.4.3", + "resolved": "https://registry.npmjs.org/unbzip2-stream/-/unbzip2-stream-1.4.3.tgz", + "integrity": "sha512-mlExGW4w71ebDJviH16lQLtZS32VKqsSfk80GCfUlwT/4/hNRFsoscrF/c++9xinkMzECL1uL9DDwXqFWkruPg==", + "dependencies": { + "buffer": "^5.2.1", + "through": "^2.3.8" + } + }, + "node_modules/unbzip2-stream/node_modules/buffer": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz", + "integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==", + "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.1.13" + } + }, "node_modules/undici": { "version": "6.18.2", "resolved": "https://registry.npmjs.org/undici/-/undici-6.18.2.tgz", @@ -13537,6 +13879,11 @@ "requires-port": "^1.0.0" } }, + "node_modules/urlpattern-polyfill": { + "version": "10.0.0", + "resolved": "https://registry.npmjs.org/urlpattern-polyfill/-/urlpattern-polyfill-10.0.0.tgz", + "integrity": "sha512-H/A06tKD7sS1O1X2SshBVeA5FLycRpjqiBeqGKmBwBDBy28EnRjORxTNe269KSSr5un5qyWi1iL61wLxpd+ZOg==" + }, "node_modules/util-deprecate": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", @@ -13738,7 +14085,6 @@ "version": "1.1.5", "resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.5.tgz", "integrity": "sha512-eDMORYaPNZ4sQIuuYPDHdQvf4gyCF9rEEV/yPxGfwPkRodwEgiMUUXTx/dex+Me0wxx53S+NgUHaP7y3MGlDmg==", - "optional": true, "dependencies": { "string-width": "^1.0.2 || 2 || 3 || 4" } @@ -13797,7 +14143,6 @@ "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", @@ -13829,9 +14174,9 @@ } }, "node_modules/ws": { - "version": "8.17.0", - "resolved": "https://registry.npmjs.org/ws/-/ws-8.17.0.tgz", - "integrity": "sha512-uJq6108EgZMAl20KagGkzCKfMEjxmKvZHG7Tlq0Z6nOky7YF7aq4mOx6xK8TJ/i1LeK4Qus7INktacctDgY8Ow==", + "version": "8.18.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.18.0.tgz", + "integrity": "sha512-8VbfWfHLbbwu3+N6OKsOMpBdT4kXPDDB9cJk2bJ6mh9ucxdlnNvH1e+roYkKmN9Nxw2yjz7VzeO9oOz2zJ04Pw==", "engines": { "node": ">=10.0.0" }, @@ -13881,7 +14226,6 @@ "version": "5.0.8", "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", - "dev": true, "engines": { "node": ">=10" } @@ -13907,7 +14251,6 @@ "version": "17.7.2", "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz", "integrity": "sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==", - "dev": true, "dependencies": { "cliui": "^8.0.1", "escalade": "^3.1.1", @@ -13925,17 +14268,25 @@ "version": "21.1.1", "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz", "integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==", - "dev": true, "engines": { "node": ">=12" } }, + "node_modules/yauzl": { + "version": "2.10.0", + "resolved": "https://registry.npmjs.org/yauzl/-/yauzl-2.10.0.tgz", + "integrity": "sha512-p4a9I6X6nu6IhoGmBqAcbJy1mlC4j27vEPZX9F4L4/vZT3Lyq1VkFHw/V/PUcB9Buo+DG3iHkT0x3Qya58zc3g==", + "dependencies": { + "buffer-crc32": "~0.2.3", + "fd-slicer": "~1.1.0" + } + }, "node_modules/yocto-queue": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", - "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-1.1.1.tgz", + "integrity": "sha512-b4JR1PFR10y1mKjhHY9LaGo6tmrgjit7hxVIeAmyMw3jegXR4dhYqLaQF5zMXZxY7tLpMyJeLjr1C4rLmkVe8g==", "engines": { - "node": ">=10" + "node": ">=12.20" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" diff --git a/core/package.json b/core/package.json index 43cc7d5ab..4b20b5b2c 100644 --- a/core/package.json +++ b/core/package.json @@ -1,15 +1,15 @@ { "name": "@continuedev/core", "version": "1.0.13", - "description": "The Continue Core contains functionality that can be shared across web, VS Code, or Node.js server. It is written in TypeScript and contains much of the functionality that was previously inside of the legacy Continue Python Server.", + "description": "The Continue Core contains functionality that can be shared across web, VS Code, or Node.js", "scripts": { - "test": "jest", + "test": "cross-env NODE_OPTIONS=--experimental-vm-modules jest --runInBand", "build:npm": "tsc -p ./tsconfig.npm.json", "lint": "eslint . --ext ts", "lint:fix": "eslint . --ext ts --fix" }, "type": "module", - "author": "Nate Sesti and Ty Dunn", + "author": "Continue Dev, Inc", "license": "Apache-2.0", "devDependencies": { "@babel/preset-env": "^7.24.7", @@ -18,34 +18,39 @@ "@types/follow-redirects": "^1.14.4", "@types/jest": "^29.5.12", "@types/jquery": "^3.5.29", + "@types/jsdom": "^21.1.6", + "@types/mozilla-readability": "^0.2.1", "@types/mustache": "^4.2.5", + "@types/node-fetch": "^2.6.11", + "@types/pg": "^8.11.6", + "@types/request": "^2.48.12", "@types/uuid": "^9.0.7", + "@types/win-ca": "^3.5.4", + "cross-env": "^7.0.3", "esbuild": "0.17.19", "eslint": "^8", "eslint-plugin-import": "^2.29.1", "jest": "^29.7.0", + "jest-environment-jsdom": "^29.7.0", "myers-diff": "^2.1.0", "onnxruntime-common": "1.14.0", "onnxruntime-web": "1.14.0", "ts-jest": "^29.1.1" }, "dependencies": { - "@aws-sdk/client-bedrock-runtime": "^3.574.0", - "@aws-sdk/credential-providers": "^3.596.0", + "@aws-sdk/client-bedrock-runtime": "^3.620.1", + "@aws-sdk/client-sagemaker-runtime": "^3.621.0", + "@aws-sdk/credential-providers": "^3.620.1", "@continuedev/config-types": "^1.0.10", "@continuedev/llm-info": "^1.0.1", "@mozilla/readability": "^0.5.0", "@octokit/rest": "^20.0.2", - "@types/jsdom": "^21.1.6", - "@types/mozilla-readability": "^0.2.1", - "@types/node-fetch": "^2.6.11", "@typescript-eslint/eslint-plugin": "^7.8.0", "@typescript-eslint/parser": "^7.8.0", "@xenova/transformers": "2.14.0", "adf-to-md": "^1.1.0", "async-mutex": "^0.5.0", "axios": "^1.6.7", - "cheerio": "^1.0.0-rc.12", "commander": "^12.0.0", "comment-json": "^4.2.3", "dbinfoz": "^0.1.4", @@ -56,6 +61,7 @@ "http-proxy-agent": "^7.0.1", "https-proxy-agent": "^7.0.3", "ignore": "^5.3.1", + "jinja-js": "0.1.8", "js-tiktoken": "^1.0.8", "jsdom": "^24.0.0", "launchdarkly-node-client-sdk": "^3.2.0", @@ -66,8 +72,11 @@ "ollama": "^0.4.6", "onnxruntime-node": "1.14.0", "openai": "^4.20.1", + "p-limit": "^6.1.0", "pg": "^8.11.3", "posthog-node": "^3.6.3", + "puppeteer": "^22.4.0", + "puppeteer-chromium-resolver": "^23.0.0", "quick-lru": "^7.0.0", "replicate": "^0.26.0", "request": "^2.88.2", @@ -84,9 +93,6 @@ "yaml": "^2.4.2", "zod": "^3.23.8" }, - "puppeteer": { - "chromium_revision": "119.0.6045.105" - }, "engine-strict": true, "engines": { "node": ">=20.11.0" diff --git a/core/promptFiles/createNewPromptFile.ts b/core/promptFiles/createNewPromptFile.ts new file mode 100644 index 000000000..d686e0d72 --- /dev/null +++ b/core/promptFiles/createNewPromptFile.ts @@ -0,0 +1,57 @@ +import path from "path"; +import { IDE } from ".."; +import { DEFAULT_PROMPTS_FOLDER } from "./"; + +const DEFAULT_PROMPT_FILE = `# This is an example ".prompt" file +# It is used to define and reuse prompts within Continue +# Continue will automatically create a slash command for each prompt in the .prompts folder +# To learn more, see the full .prompt file reference: https://docs.continue.dev/features/prompt-files +temperature: 0.0 +--- +{{{ diff }}} + +Give me feedback on the above changes. For each file, you should output a markdown section including the following: +- If you found any problems, an h3 like "❌ " +- If you didn't find any problems, an h3 like "✅ " +- If you found any problems, add below a bullet point description of what you found, including a minimal code snippet explaining how to fix it +- If you didn't find any problems, you don't need to add anything else + +Here is an example. The example is surrounded in backticks, but your response should not be: + +\`\`\` +### ✅ + +### ❌ + + +\`\`\` + +You should look primarily for the following types of issues, and only mention other problems if they are highly pressing. + +- console.logs that have been left after debugging +- repeated code +- algorithmic errors that could fail under edge cases +- something that could be refactored + +Make sure to review ALL files that were changed, do not skip any. +`; + +export async function createNewPromptFile( + ide: IDE, + promptPath: string | undefined, +): Promise { + const workspaceDirs = await ide.getWorkspaceDirs(); + if (workspaceDirs.length === 0) { + throw new Error( + "No workspace directories found. Make sure you've opened a folder in your IDE.", + ); + } + const promptFilePath = path.join( + workspaceDirs[0], + promptPath ?? DEFAULT_PROMPTS_FOLDER, + "new-prompt-file.prompt", + ); + + await ide.writeFile(promptFilePath, DEFAULT_PROMPT_FILE); + await ide.openFile(promptFilePath); +} diff --git a/core/promptFiles/getContextProviderHelpers.ts b/core/promptFiles/getContextProviderHelpers.ts new file mode 100644 index 000000000..263724efa --- /dev/null +++ b/core/promptFiles/getContextProviderHelpers.ts @@ -0,0 +1,37 @@ +import Handlebars from "handlebars"; + +export function getContextProviderHelpers( + context: any, +): Array<[string, Handlebars.HelperDelegate]> | undefined { + return context.config.contextProviders?.map((provider: any) => [ + provider.description.title, + async (helperContext: any) => { + const items = await provider.getContextItems(helperContext, { + config: context.config, + embeddingsProvider: context.config.embeddingsProvider, + fetch: context.fetch, + fullInput: context.input, + ide: context.ide, + llm: context.llm, + reranker: context.config.reranker, + selectedCode: context.selectedCode, + }); + + items.forEach((item: any) => + context.addContextItem(createContextItem(item, provider)), + ); + + return items.map((item: any) => item.content).join("\n\n"); + }, + ]); +} + +function createContextItem(item: any, provider: any) { + return { + ...item, + id: { + itemId: item.description, + providerTitle: provider.description.title, + }, + }; +} diff --git a/core/promptFiles/getPromptFiles.ts b/core/promptFiles/getPromptFiles.ts new file mode 100644 index 000000000..2ab9dc893 --- /dev/null +++ b/core/promptFiles/getPromptFiles.ts @@ -0,0 +1,25 @@ +import { IDE } from ".."; +import { walkDir } from "../indexing/walkDir"; + +export async function getPromptFiles( + ide: IDE, + dir: string, +): Promise<{ path: string; content: string }[]> { + try { + const exists = await ide.fileExists(dir); + + if (!exists) { + return []; + } + + const paths = await walkDir(dir, ide, { ignoreFiles: [] }); + const results = paths.map(async (path) => { + const content = await ide.readFile(path); // make a try catch + return { path, content }; + }); + return Promise.all(results); + } catch (e) { + console.error(e); + return []; + } +} diff --git a/core/promptFiles/handlebarUtils.ts b/core/promptFiles/handlebarUtils.ts new file mode 100644 index 000000000..ada9fa6b7 --- /dev/null +++ b/core/promptFiles/handlebarUtils.ts @@ -0,0 +1,114 @@ +import Handlebars from "handlebars"; +import { v4 as uuidv4 } from "uuid"; + +export 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. + */ +export 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: any, + 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: any): 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/index.ts b/core/promptFiles/index.ts new file mode 100644 index 000000000..c3afdec76 --- /dev/null +++ b/core/promptFiles/index.ts @@ -0,0 +1,8 @@ +import { IDE } from ".."; +import { getPromptFiles } from "./getPromptFiles"; +import { createNewPromptFile } from "./createNewPromptFile"; +import { slashCommandFromPromptFile } from "./slashCommandFromPromptFile"; + +export const DEFAULT_PROMPTS_FOLDER = ".prompts"; + +export { getPromptFiles, createNewPromptFile, slashCommandFromPromptFile }; diff --git a/core/promptFiles/renderTemplatedString.ts b/core/promptFiles/renderTemplatedString.ts new file mode 100644 index 000000000..d31cce0b9 --- /dev/null +++ b/core/promptFiles/renderTemplatedString.ts @@ -0,0 +1,30 @@ +import { + compileAndRenderTemplate, + prepareTemplateAndData, + registerHelpers, + resolveHelperPromises, +} from "./handlebarUtils"; + +export async function renderTemplatedString( + template: string, + readFile: (filepath: string) => Promise, + inputData: any, + availableHelpers?: Array<[string, Handlebars.HelperDelegate]>, +): Promise { + const helperPromises = availableHelpers + ? registerHelpers(availableHelpers) + : {}; + + const ctxProviderNames = availableHelpers?.map((h) => h[0]) ?? []; + + const [newTemplate, data] = await prepareTemplateAndData( + template, + readFile, + inputData, + ctxProviderNames, + ); + + let renderedString = compileAndRenderTemplate(newTemplate, data); + + return resolveHelperPromises(renderedString, helperPromises); +} diff --git a/core/promptFiles/slashCommandFromPromptFile.ts b/core/promptFiles/slashCommandFromPromptFile.ts new file mode 100644 index 000000000..e81f13615 --- /dev/null +++ b/core/promptFiles/slashCommandFromPromptFile.ts @@ -0,0 +1,93 @@ +import { SlashCommand } from ".."; +import { stripImages } from "../llm/images"; +import { getContextProviderHelpers } from "./getContextProviderHelpers"; +import { renderTemplatedString } from "./renderTemplatedString"; +import { updateChatHistory } from "./updateChatHistory"; +import * as YAML from "yaml"; +import { getBasename } from "../util/index"; + +export function extractName(preamble: { name?: string }, path: string): string { + return preamble.name ?? getBasename(path).split(".prompt")[0]; +} + +export function parsePromptFile(path: string, content: string) { + let [preambleRaw, prompt] = content.split("\n---\n"); + if (prompt === undefined) { + prompt = preambleRaw; + preambleRaw = ""; + } + + const preamble = YAML.parse(preambleRaw) ?? {}; + const name = extractName(preamble, path); + const description = preamble.description ?? name; + + let systemMessage: string | undefined = undefined; + if (prompt.includes("")) { + systemMessage = prompt.split("")[1].split("")[0].trim(); + prompt = prompt.split("")[1].trim(); + } + + return { name, description, systemMessage, prompt }; +} + +export function extractUserInput(input: string, commandName: string): string { + if (input.startsWith(`/${commandName}`)) { + return input.slice(commandName.length + 1).trimStart(); + } + return input; +} + +export async function getDefaultVariables(context: any, userInput: string) { + const currentFilePath = await context.ide.getCurrentFile(); + const currentFile = currentFilePath + ? await context.ide.readFile(currentFilePath) + : undefined; + + return { currentFile, input: userInput }; +} + +export async function renderPrompt( + prompt: string, + context: any, + userInput: string, +) { + const helpers = getContextProviderHelpers(context); + + const inputData = await getDefaultVariables(context, userInput); + + return renderTemplatedString( + prompt, + context.ide.readFile.bind(context.ide), + inputData, + helpers, + ); +} + +export function slashCommandFromPromptFile( + path: string, + content: string, +): SlashCommand { + const { name, description, systemMessage, prompt } = parsePromptFile( + path, + content, + ); + + return { + name, + description, + run: async function* (context) { + const userInput = extractUserInput(context.input, name); + const renderedPrompt = await renderPrompt(prompt, context, userInput); + const messages = updateChatHistory( + context.history, + name, + renderedPrompt, + systemMessage, + ); + + for await (const chunk of context.llm.streamChat(messages)) { + yield stripImages(chunk.content); + } + }, + }; +} diff --git a/core/promptFiles/updateChatHistory.ts b/core/promptFiles/updateChatHistory.ts new file mode 100644 index 000000000..8ebc6f038 --- /dev/null +++ b/core/promptFiles/updateChatHistory.ts @@ -0,0 +1,55 @@ +export function updateChatHistory( + history: any[], + commandName: string, + renderedPrompt: string, + systemMessage?: string, +) { + 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.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 (systemMessage) { + messages[0]?.role === "system" + ? (messages[0].content = systemMessage) + : messages.unshift({ role: "system", content: systemMessage }); + } + + 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/protocol/core.ts b/core/protocol/core.ts index aa43bdd09..9cd4d4ec8 100644 --- a/core/protocol/core.ts +++ b/core/protocol/core.ts @@ -1,4 +1,5 @@ -/* eslint-disable @typescript-eslint/naming-convention */ +import type { AutocompleteInput } from "../autocomplete/completionProvider"; +import { ProfileDescription } from "../config/ConfigHandler"; import type { BrowserSerializedContinueConfig, ChatMessage, @@ -14,9 +15,7 @@ import type { SerializedContinueConfig, SessionInfo, SiteIndexingConfig, -} from ".."; -import type { AutocompleteInput } from "../autocomplete/completionProvider"; -import { ProfileDescription } from "../config/ConfigHandler"; +} from "../"; export type ProtocolGeneratorType = AsyncGenerator<{ done?: boolean; @@ -68,7 +67,7 @@ export type ToCoreFromIdeOrWebviewProtocol = { "context/loadSubmenuItems": [{ title: string }, ContextSubmenuItem[]]; "autocomplete/complete": [AutocompleteInput, string[]]; "context/addDocs": [SiteIndexingConfig, void]; - "context/removeDocs": [{ baseUrl: string }, void]; + "context/removeDocs": [Pick, void]; "context/indexDocs": [{ reIndex: boolean }, void]; "autocomplete/cancel": [undefined, void]; "autocomplete/accept": [{ completionId: string }, void]; @@ -129,8 +128,12 @@ export type ToCoreFromIdeOrWebviewProtocol = { undefined, { model: string; promptTokens: number; generatedTokens: number }[], ]; + "tts/kill": [undefined, void]; "index/setPaused": [boolean, void]; - "index/forceReIndex": [undefined | string, void]; + "index/forceReIndex": [ + undefined | { dir?: string; shouldClearIndexes?: boolean }, + void, + ]; "index/indexingProgressBarInitialized": [undefined, void]; completeOnboarding: [ { diff --git a/core/protocol/ide.ts b/core/protocol/ide.ts index 13988a0d1..bb5f59810 100644 --- a/core/protocol/ide.ts +++ b/core/protocol/ide.ts @@ -1,3 +1,4 @@ +import { ControlPlaneSessionInfo } from "../control-plane/client.js"; import type { ContinueRcJson, DiffLine, @@ -10,8 +11,7 @@ import type { Range, RangeInFile, Thread, -} from ".."; -import { ControlPlaneSessionInfo } from "../control-plane/client"; +} from "../index.js"; export type ToIdeFromWebviewOrCoreProtocol = { // Methods from IDE type diff --git a/core/protocol/ideWebview.ts b/core/protocol/ideWebview.ts index c7b2cc7ce..5e1e74589 100644 --- a/core/protocol/ideWebview.ts +++ b/core/protocol/ideWebview.ts @@ -1,5 +1,5 @@ -import type { ContextSubmenuItem } from ".."; -import type { RangeInFileWithContents } from "../commands/util"; +import type { RangeInFileWithContents } from "../commands/util.js"; +import type { ContextSubmenuItem } from "../index.js"; import { ToIdeFromWebviewOrCoreProtocol } from "./ide.js"; import { ToWebviewFromIdeOrCoreProtocol } from "./webview.js"; @@ -31,6 +31,7 @@ export type ToIdeFromWebviewProtocol = ToIdeFromWebviewOrCoreProtocol & { export type ToWebviewFromIdeProtocol = ToWebviewFromIdeOrCoreProtocol & { setInactive: [undefined, void]; + setTTSActive: [boolean, void]; submitMessage: [{ message: any }, void]; // any -> JSONContent from TipTap updateSubmenuItems: [ { provider: string; submenuItems: ContextSubmenuItem[] }, diff --git a/core/protocol/passThrough.ts b/core/protocol/passThrough.ts index 5fe14573a..1e2499ca7 100644 --- a/core/protocol/passThrough.ts +++ b/core/protocol/passThrough.ts @@ -30,6 +30,7 @@ export const WEBVIEW_TO_CORE_PASS_THROUGH: (keyof ToCoreFromWebviewProtocol)[] = "autocomplete/cancel", "autocomplete/accept", "command/run", + "tts/kill", "llm/complete", "llm/streamComplete", "llm/streamChat", @@ -57,4 +58,5 @@ export const CORE_TO_WEBVIEW_PASS_THROUGH: (keyof ToWebviewFromCoreProtocol)[] = "refreshSubmenuItems", "isContinueInputFocused", "didChangeAvailableProfiles", + "setTTSActive", ]; diff --git a/core/protocol/util.ts b/core/protocol/util.ts new file mode 100644 index 000000000..c9fe3af1b --- /dev/null +++ b/core/protocol/util.ts @@ -0,0 +1,17 @@ +import { FromWebviewProtocol } from "."; + +interface ErrorWebviewMessengerResult { + done: boolean; + status: "error"; + error: string; +} + +interface SuccessWebviewMessengerResult { + done: boolean; + status: "success"; + content: FromWebviewProtocol[T][1]; +} + +export type WebviewMessengerResult = + | ErrorWebviewMessengerResult + | SuccessWebviewMessengerResult; diff --git a/core/protocol/webview.ts b/core/protocol/webview.ts index 3cdf68c73..d3b127fdc 100644 --- a/core/protocol/webview.ts +++ b/core/protocol/webview.ts @@ -1,4 +1,4 @@ -import type { ContextItemWithId, IndexingProgressUpdate } from ".."; +import type { ContextItemWithId, IndexingProgressUpdate } from "../index.js"; export type ToWebviewFromIdeOrCoreProtocol = { configUpdate: [undefined, void]; @@ -13,4 +13,5 @@ export type ToWebviewFromIdeOrCoreProtocol = { }, void, ]; + setTTSActive: [boolean, void]; }; diff --git a/core/test/context/providers/index.test.ts b/core/test/context/providers/index.test.ts new file mode 100644 index 000000000..ae16ccb87 --- /dev/null +++ b/core/test/context/providers/index.test.ts @@ -0,0 +1,64 @@ +import fetch from "node-fetch"; +import { + ContextProviderExtras, + ContextProviderWithParams, + IContextProvider, +} from "../../.."; +import { ConfigHandler } from "../../../config/ConfigHandler"; +import { contextProviderClassFromName } from "../../../context/providers"; +import { ControlPlaneClient } from "../../../control-plane/client"; +import FileSystemIde from "../../../util/filesystem"; +import { TEST_DIR } from "../../util/testDir"; + +const CONTEXT_PROVIDERS_TO_TEST: ContextProviderWithParams[] = [ + { name: "diff", params: {} }, + { name: "currentFile", params: {} }, + { name: "locals", params: {} }, + { name: "open", params: {} }, + { name: "os", params: {} }, + { name: "problems", params: {} }, + { name: "terminal", params: {} }, + { name: "tree", params: {} }, +]; + +async function getContextProviderExtras( + fullInput: string, +): Promise { + const ide = new FileSystemIde(TEST_DIR); + const ideSettingsPromise = ide.getIdeSettings(); + const configHandler = new ConfigHandler( + ide, + ideSettingsPromise, + async (text) => {}, + new ControlPlaneClient(Promise.resolve(undefined)), + ); + const config = await configHandler.loadConfig(); + + return { + fullInput, + ide, + config, + embeddingsProvider: config.embeddingsProvider, + fetch: fetch, + llm: config.models[0], + reranker: config.reranker, + selectedCode: [], + }; +} + +describe.skip("Should successfully run all context providers", () => { + const extrasPromise = getContextProviderExtras("Test"); + + CONTEXT_PROVIDERS_TO_TEST.forEach((provider) => { + test(`should successfully run ${provider.name} context provider`, async () => { + const cls = contextProviderClassFromName(provider.name) as any; + const instance: IContextProvider = new cls(provider.params); + + expect(instance.description.title).toBe(provider.name); + + const items = await instance.getContextItems("test", await extrasPromise); + + expect(Array.isArray(items)).toBe(true); + }); + }); +}); diff --git a/core/test/context/retrieval/RetrievalPipeline.test.ts b/core/test/context/retrieval/RetrievalPipeline.test.ts deleted file mode 100644 index 03e1a5c3b..000000000 --- a/core/test/context/retrieval/RetrievalPipeline.test.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { IRetrievalPipeline } from "../../../context/retrieval/pipelines/BaseRetrievalPipeline"; - -function testRetrievalPipeline(pipeline: IRetrievalPipeline) { - test("should successfully run"); -} - - -describe.skip("RetrievalPipeline", () => { - test.todo("should successfully run"); -}); - -// describe("Retrieval Pipelines", () => { -// const ide = new FileSystemIde(); -// const options: RetrievalPipelineOptions; - -// test("NoRerankerRetrievalPipeline", () => { -// const pipeline = new NoRerankerRetrievalPipeline(options); -// testRetrievalPipeline(pipeline); -// }); - -// test("NoRerankerRetrievalPipeline", () => { -// const pipeline = new NoRerankerRetrievalPipeline(options); -// testRetrievalPipeline(pipeline); -// }); -// }); diff --git a/core/test/indexing/CodebaseIndexer.skip.ts b/core/test/indexing/CodebaseIndexer.skip.ts deleted file mode 100644 index 404ef96fd..000000000 --- a/core/test/indexing/CodebaseIndexer.skip.ts +++ /dev/null @@ -1,175 +0,0 @@ -import fs from "node:fs"; -import path from "node:path"; -import { ConfigHandler } from "../../config/ConfigHandler"; -import { ContinueServerClient } from "../../continueServer/stubs/client"; -import { CodebaseIndexer, PauseToken } from "../../indexing/CodebaseIndexer"; -import { LanceDbIndex } from "../../indexing/LanceDbIndex"; -import TransformersJsEmbeddingsProvider from "../../indexing/embeddings/TransformersJsEmbeddingsProvider"; -import FileSystemIde from "../../util/filesystem"; -import { - getIndexFolderPath, - getIndexSqlitePath, - getLanceDbPath, -} from "../../util/paths"; -import { - addToTestDir, - setUpTestDir, - tearDownTestDir, - TEST_DIR, -} from "../testUtils/testDir"; - -const TEST_TS = `\ -function main() { - console.log("Hello, world!"); -} - -class Foo { - constructor(public bar: string) {} -} -`; - -const TEST_PY = `\ -def main(): - print("Hello, world!") - -class Foo: - def __init__(self, bar: str): - self.bar = bar -`; - -const TEST_RS = `\ -fn main() { - println!("Hello, world!"); -} - -struct Foo { - bar: String, -} -`; - -// These are more like integration tests, whereas we should separately test -// the individual CodebaseIndex classes -describe.skip("CodebaseIndexer", () => { - const ide = new FileSystemIde(TEST_DIR); - const ideSettingsPromise = ide.getIdeSettings(); - const configHandler = new ConfigHandler( - ide, - ideSettingsPromise, - async (text) => {}, - undefined as any, // TODO - ); - const pauseToken = new PauseToken(false); - const continueServerClient = new ContinueServerClient(undefined, undefined); - const codebaseIndexer = new CodebaseIndexer( - configHandler, - ide, - pauseToken, - continueServerClient, - ); - const lancedbIndex = new LanceDbIndex( - new TransformersJsEmbeddingsProvider(), - ide.readFile.bind(ide), - continueServerClient, - ); - - beforeAll(async () => { - setUpTestDir(); - }); - - afterAll(async () => { - tearDownTestDir(); - }); - - test("should index test folder without problem", async () => { - addToTestDir([ - ["test.ts", TEST_TS], - ["py/main.py", TEST_PY], - ]); - const abortController = new AbortController(); - const abortSignal = abortController.signal; - - const updates = []; - for await (const update of codebaseIndexer.refresh( - [TEST_DIR], - abortSignal, - )) { - updates.push(update); - } - - expect(updates.length).toBeGreaterThan(0); - }); - - test("should have created index folder with all necessary files", async () => { - expect(fs.existsSync(getIndexFolderPath())).toBe(true); - expect(fs.existsSync(getIndexSqlitePath())).toBe(true); - expect(fs.existsSync(getLanceDbPath())).toBe(true); - }); - - test("should be able to query lancedb index", async () => { - const chunks = await lancedbIndex.retrieve( - "What is the main function doing?", - 10, - await ide.getTags(lancedbIndex.artifactId), - undefined, - ); - - expect(chunks.length).toBe(2); - // Check that the main function from both files is returned - expect(chunks.some((chunk) => chunk.filepath.endsWith("test.ts"))).toBe( - true, - ); - expect(chunks.some((chunk) => chunk.filepath.endsWith("main.py"))).toBe( - true, - ); - }); - - test("should successfully re-index after adding a file", async () => { - addToTestDir([["main.rs", TEST_RS]]); - const abortController = new AbortController(); - const abortSignal = abortController.signal; - const updates = []; - for await (const update of codebaseIndexer.refresh( - [TEST_DIR], - abortSignal, - )) { - updates.push(update); - } - expect(updates.length).toBeGreaterThan(0); - // Check that the new file was indexed - const chunks = await lancedbIndex.retrieve( - "What is the main function doing?", - 3, - await ide.getTags(lancedbIndex.artifactId), - undefined, - ); - expect(chunks.length).toBe(3); - expect(chunks.some((chunk) => chunk.filepath.endsWith("main.rs"))).toBe( - true, - ); - }); - - test("should successfully re-index after deleting a file", async () => { - fs.rmSync(path.join(TEST_DIR, "main.rs")); - const abortController = new AbortController(); - const abortSignal = abortController.signal; - const updates = []; - for await (const update of codebaseIndexer.refresh( - [TEST_DIR], - abortSignal, - )) { - updates.push(update); - } - expect(updates.length).toBeGreaterThan(0); - // Check that the deleted file was removed from the index - const chunks = await lancedbIndex.retrieve( - "What is the main function doing?", - 10, - await ide.getTags(lancedbIndex.artifactId), - undefined, - ); - expect(chunks.length).toBe(2); - expect(chunks.every((chunk) => !chunk.filepath.endsWith("main.rs"))).toBe( - true, - ); - }); -}); diff --git a/core/test/llm.test.ts b/core/test/llm.test.ts index e3f427731..7b9b861b8 100644 --- a/core/test/llm.test.ts +++ b/core/test/llm.test.ts @@ -1,8 +1,8 @@ import * as dotenv from "dotenv"; -import { CompletionOptions } from "../index.js"; -import { BaseLLM } from "../llm/index.js"; -import OpenAI from "../llm/llms/OpenAI.js"; +import { CompletionOptions } from "../"; +import { BaseLLM } from "../llm/"; +import OpenAI from "../llm/llms/OpenAI"; // jest.setTimeout(100_000); diff --git a/core/test/testUtils/testDir.ts b/core/test/testUtils/testDir.ts deleted file mode 100644 index 33a636d08..000000000 --- a/core/test/testUtils/testDir.ts +++ /dev/null @@ -1,27 +0,0 @@ -import fs from "fs"; -import path from "path"; - -export const TEST_DIR = path.join(__dirname, "testDir"); - -export function setUpTestDir() { - if (fs.existsSync(TEST_DIR)) { - fs.rmSync(TEST_DIR, { recursive: true }); - } - fs.mkdirSync(TEST_DIR); -} - -export function tearDownTestDir() { - fs.rmSync(TEST_DIR, { recursive: true }); -} - -export function addToTestDir(paths: (string | string[])[]) { - for (const p of paths) { - if (Array.isArray(p)) { - fs.writeFileSync(path.join(TEST_DIR, p[0]), p[1]); - } else if (p.endsWith("/")) { - fs.mkdirSync(path.join(TEST_DIR, p), { recursive: true }); - } else { - fs.writeFileSync(path.join(TEST_DIR, p), ""); - } - } -} diff --git a/core/test/util/dedentAndGetCommonWhitespace.test.ts b/core/test/util/dedentAndGetCommonWhitespace.test.ts deleted file mode 100644 index 5f3c6a4be..000000000 --- a/core/test/util/dedentAndGetCommonWhitespace.test.ts +++ /dev/null @@ -1,76 +0,0 @@ -// File generated by Continue -import { dedentAndGetCommonWhitespace } from "../../util"; - -describe("dedentAndGetCommonWhitespace", () => { - let originalString: string; - - beforeEach(() => { - // Setup any global variables or states if needed - originalString = " line1\n line2\n line3"; - }); - - afterEach(() => { - // Tear down any changes to global variables or states if needed - originalString = ""; - }); - - test("should dedent and return common whitespace for a simple case", () => { - const input = " line1\n line2\n line3"; - const output = dedentAndGetCommonWhitespace(input); - expect(output).toEqual(["line1\nline2\nline3", " "]); - }); - - test("should handle empty string", () => { - const input = ""; - const output = dedentAndGetCommonWhitespace(input); - expect(output).toEqual(["", ""]); - }); - - test("should handle string with only whitespace", () => { - const input = " "; - const output = dedentAndGetCommonWhitespace(input); - expect(output).toEqual(["", ""]); - }); - - test("should handle string with mixed whitespace and content", () => { - const input = " line1\n line2\n line3"; - const output = dedentAndGetCommonWhitespace(input); - expect(output).toEqual([" line1\nline2\n line3", " "]); - }); - - test("should handle string with no common leading whitespace", () => { - const input = "line1\n line2\n line3"; - const output = dedentAndGetCommonWhitespace(input); - expect(output).toEqual([input, ""]); - }); - - test("should handle string with empty lines", () => { - const input = " line1\n\n line3"; - const output = dedentAndGetCommonWhitespace(input); - expect(output).toEqual(["line1\n\nline3", " "]); - }); - - test("should handle string with only empty lines", () => { - const input = "\n\n"; - const output = dedentAndGetCommonWhitespace(input); - expect(output).toEqual(["\n\n", ""]); - }); - - test("should handle string with tabs as whitespace", () => { - const input = "\tline1\n\tline2\n\tline3"; - const output = dedentAndGetCommonWhitespace(input); - expect(output).toEqual(["line1\nline2\nline3", "\t"]); - }); - - test("should handle string with mixed tabs and spaces", () => { - const input = "\t line1\n\t line2\n\t line3"; - const output = dedentAndGetCommonWhitespace(input); - expect(output).toEqual(["line1\nline2\nline3", "\t "]); - }); - - test("should handle string with different leading whitespace lengths", () => { - const input = " line1\n line2\n line3"; - const output = dedentAndGetCommonWhitespace(input); - expect(output).toEqual([" line1\nline2\n line3", " "]); - }); -}); diff --git a/core/test/util/deduplicateArray.test.ts b/core/test/util/deduplicateArray.test.ts deleted file mode 100644 index f26b2c782..000000000 --- a/core/test/util/deduplicateArray.test.ts +++ /dev/null @@ -1,82 +0,0 @@ -import { deduplicateArray } from "../../util"; - -describe("deduplicateArray", () => { - it("should return an empty array when given an empty array", () => { - const result = deduplicateArray([], (a, b) => a === b); - expect(result).toEqual([]); - }); - - it("should return the same array when there are no duplicates", () => { - const input = [1, 2, 3, 4, 5]; - const result = deduplicateArray(input, (a, b) => a === b); - expect(result).toEqual(input); - }); - - it("should remove duplicates based on the equality function", () => { - const input = [1, 2, 2, 3, 4, 4, 5]; - const result = deduplicateArray(input, (a, b) => a === b); - expect(result).toEqual([1, 2, 3, 4, 5]); - }); - - it("should work with objects using custom equality function", () => { - const input = [ - { id: 1, name: "Alice" }, - { id: 2, name: "Bob" }, - { id: 1, name: "Alice" }, - { id: 3, name: "Charlie" }, - ]; - const result = deduplicateArray(input, (a, b) => a.id === b.id); - expect(result).toEqual([ - { id: 1, name: "Alice" }, - { id: 2, name: "Bob" }, - { id: 3, name: "Charlie" }, - ]); - }); - - it("should preserve the order of items", () => { - const input = [3, 1, 4, 1, 5, 9, 2, 6, 5, 3, 5]; - const result = deduplicateArray(input, (a, b) => a === b); - expect(result).toEqual([3, 1, 4, 5, 9, 2, 6]); - }); - - it("should work with strings", () => { - const input = ["apple", "banana", "apple", "cherry", "banana", "date"]; - const result = deduplicateArray(input, (a, b) => a === b); - expect(result).toEqual(["apple", "banana", "cherry", "date"]); - }); - - it("should handle arrays with all duplicate elements", () => { - const input = [1, 1, 1, 1, 1]; - const result = deduplicateArray(input, (a, b) => a === b); - expect(result).toEqual([1]); - }); - - it("should work with custom equality function for complex objects", () => { - const input = [ - { x: 1, y: 2 }, - { x: 2, y: 1 }, - { x: 1, y: 2 }, - { x: 3, y: 4 }, - ]; - const result = deduplicateArray( - input, - (a, b) => a.x === b.x && a.y === b.y, - ); - expect(result).toEqual([ - { x: 1, y: 2 }, - { x: 2, y: 1 }, - { x: 3, y: 4 }, - ]); - }); - - it("should handle large arrays efficiently", () => { - const input = Array(10000) - .fill(0) - .map((_, i) => i % 100); - const start = performance.now(); - const result = deduplicateArray(input, (a, b) => a === b); - const end = performance.now(); - expect(result).toHaveLength(100); - expect(end - start).toBeLessThan(1000); // Ensure it completes in less than 1 second - }); -}); diff --git a/core/test/util/fixtures.ts b/core/test/util/fixtures.ts new file mode 100644 index 000000000..89c1c0b3b --- /dev/null +++ b/core/test/util/fixtures.ts @@ -0,0 +1,19 @@ +import { ConfigHandler } from "../../config/ConfigHandler"; +import { ControlPlaneClient } from "../../control-plane/client"; +import FileSystemIde from "../../util/filesystem"; +import { TEST_DIR } from "./testDir"; + +export const testIde = new FileSystemIde(TEST_DIR); + +export const ideSettingsPromise = testIde.getIdeSettings(); + +export const testControlPlaneClient = new ControlPlaneClient( + Promise.resolve(undefined), +); + +export const testConfigHandler = new ConfigHandler( + testIde, + ideSettingsPromise, + async (text) => {}, + testControlPlaneClient, +); diff --git a/core/test/util/getLastNPathParts.test.ts b/core/test/util/getLastNPathParts.test.ts deleted file mode 100644 index ba72b4520..000000000 --- a/core/test/util/getLastNPathParts.test.ts +++ /dev/null @@ -1,51 +0,0 @@ -// File generated by Continue -import { getLastNPathParts } from "../../util"; - -describe("getLastNPathParts", () => { - const SEP_REGEX = /[\\/]+/; - - beforeAll(() => { - // Setup code if needed - }); - - afterAll(() => { - // Teardown code if needed - }); - - test("returns the last N parts of a filepath with forward slashes", () => { - const filepath = "home/user/documents/project/file.txt"; - expect(getLastNPathParts(filepath, 2)).toBe("project/file.txt"); - }); - - test("returns the last N parts of a filepath with backward slashes", () => { - const filepath = "C:\\home\\user\\documents\\project\\file.txt"; - expect(getLastNPathParts(filepath, 3)).toBe("documents/project/file.txt"); - }); - - test("returns the last part if N is 1", () => { - const filepath = "/home/user/documents/project/file.txt"; - expect(getLastNPathParts(filepath, 1)).toBe("file.txt"); - }); - - test("returns the entire path if N is greater than the number of parts", () => { - const filepath = "home/user/documents/project/file.txt"; - expect(getLastNPathParts(filepath, 10)).toBe( - "home/user/documents/project/file.txt", - ); - }); - - test("returns an empty string if N is 0", () => { - const filepath = "home/user/documents/project/file.txt"; - expect(getLastNPathParts(filepath, 0)).toBe(""); - }); - - test("handles paths with mixed forward and backward slashes", () => { - const filepath = "home\\user/documents\\project/file.txt"; - expect(getLastNPathParts(filepath, 3)).toBe("documents/project/file.txt"); - }); - - test("handles edge case with empty filepath", () => { - const filepath = ""; - expect(getLastNPathParts(filepath, 2)).toBe(""); - }); -}); diff --git a/core/test/util/history.test.ts b/core/test/util/history.test.ts new file mode 100644 index 000000000..d3dedac7f --- /dev/null +++ b/core/test/util/history.test.ts @@ -0,0 +1,131 @@ +import { PersistedSessionInfo } from "../.."; +import historyManager from "../../util/history"; +import { getSessionFilePath } from "../../util/paths"; +import { v4 as uuidv4 } from "uuid"; + +const sessionId = uuidv4(); +const testSession: PersistedSessionInfo = { + history: [], + title: `${sessionId} title`, + workspaceDirectory: "workspaceDir", + sessionId: sessionId, +}; + +describe("No sessions have been created", () => { + const testSessionId = "invalid"; + const testSessionPath = getSessionFilePath(testSessionId); + + test("Listing all sessions returns empty list", () => { + const sessions = historyManager.list({}); + expect(sessions).toEqual([]); + }); + + test("Deleting session throws error", () => { + expect(() => { + historyManager.delete(testSessionId); + }).toThrow(`Session file ${testSessionPath} does not exist`); + }); + + test("Loading session returns default session", () => { + const session = historyManager.load(testSessionId); + expect(session).toEqual({ + history: [], + title: "Failed to load session", + workspaceDirectory: "", + sessionId: testSessionId, + }); + }); +}); + +describe("Full session lifecycle", () => { + test("Creating and listing a session", () => { + // save and list + historyManager.save(testSession); + const sessions = historyManager.list({}); + const sessionExists = sessions.some((session) => session?.sessionId === testSession.sessionId); + expect(sessionExists).toBe(true); + }); + + test("Loading session by ID returns correct object", () => { + const retrievedSession = historyManager.load(testSession.sessionId); + expect(retrievedSession).toEqual(testSession); + }); + + test("Saving session with new title updates session", () => { + const modifiedSession = { ...testSession }; + modifiedSession.title = `Edited: ${testSession.title}`; + historyManager.save(modifiedSession); + const session = historyManager.load(testSession.sessionId); + + expect(session.title).toBe(modifiedSession.title); + }); + + test("Deleting session", () => { + historyManager.delete(testSession.sessionId); + const sessions = historyManager.list({}); + const sessionWasDeleted = sessions.every( + (session) => session?.sessionId !== testSession.sessionId, + ); + expect(sessionWasDeleted).toEqual(true); + }); +}); + +describe("Many sessions created", () => { + test("Create 100 sessions and list all", () => { + for (let i = 0; i < 100; i++) { + historyManager.save({ + history: [], + title: `${i}`, + workspaceDirectory: "workspaceDir", + sessionId: `${i}`, + }); + } + const sessions = historyManager.list({}); + expect(sessions.length).toBe(100); + }); + + test("List 10 sessions, offest by 10", () => { + const limit = 10; + const offset = 10; + + const sessions = historyManager.list({ offset: offset, limit: limit }); + const sessionIds = Array.from({ length: limit }, (_, i) => (i + offset).toString()); + const isSessionIdInList = (sessionId: string) => + sessions.some((session) => session.sessionId === sessionId); + expect(sessionIds.every(isSessionIdInList)).toBe(true); + }); + + test("List 25 sessions, with no offset", () => { + const limit = 25; + + const sessions = historyManager.list({ limit: limit }); + const sessionIds = Array.from({ length: limit }, (_, i) => i.toString()); + + const isSessionIdInList = (sessionId: string) => + sessions.some((session) => session.sessionId === sessionId); + expect(sessionIds.every(isSessionIdInList)).toBe(true); + }); + + test("List sessions offset by 75", () => { + const offset = 75; + + const sessions = historyManager.list({ offset: offset }); + const sessionIds = Array.from({ length: sessions.length - offset }, (_, i) => + (i + offset).toString(), + ); + + const isSessionIdInList = (sessionId: string) => + sessions.some((session) => session.sessionId === sessionId); + expect(sessionIds.every(isSessionIdInList)).toBe(true); + }); + + test("Delete all sessions", () => { + let sessions = historyManager.list({}); + + for (let session of sessions) { + historyManager.delete(session.sessionId); + } + sessions = historyManager.list({}); + expect(sessions.length).toBe(0); + }); +}); diff --git a/core/test/util/indexing.ts b/core/test/util/indexing.ts new file mode 100644 index 000000000..650cc5b56 --- /dev/null +++ b/core/test/util/indexing.ts @@ -0,0 +1,88 @@ +import { ChunkCodebaseIndex } from "../../indexing/chunk/ChunkCodebaseIndex"; +import { IContinueServerClient } from "../../continueServer/interface"; +import { testIde } from "./fixtures"; +import { addToTestDir, TEST_DIR } from "./testDir"; +import { IndexTag } from "../.."; +import { + CodebaseIndex, + PathAndCacheKey, + RefreshIndexResults, +} from "../../indexing/types"; +import { jest } from "@jest/globals"; +import { tagToString } from "../../indexing/refreshIndex"; + +export const mockFilename = "test.py"; +export const mockPathAndCacheKey = { + path: `${TEST_DIR}/${mockFilename}`, + cacheKey: "abc123", +}; + +export const mockFileContents = `\ +def main(): + print("Hello, world!") + +class Foo: + def __init__(self, bar: str): + self.bar = bar +`; + +export const mockTag: IndexTag = { + branch: "main", + directory: "/", + artifactId: "artifactId", +}; + +export const mockTagString = tagToString(mockTag); + +export const testContinueServerClient = { + connected: false, + getFromIndexCache: jest.fn(), +} as unknown as IContinueServerClient; + +const mockContinueServerClient = { + connected: false, + getFromIndexCache: jest.fn(), +} as unknown as IContinueServerClient; + +const mockResults: RefreshIndexResults = { + compute: [], + addTag: [], + removeTag: [], + del: [], +}; + +const mockMarkComplete = jest + .fn() + .mockImplementation(() => Promise.resolve()) as any; + +export async function insertMockChunks() { + const pathSep = await testIde.pathSep(); + + const index = new ChunkCodebaseIndex( + testIde.readFile.bind(testIde), + pathSep, + mockContinueServerClient, + 1000, + ); + + addToTestDir([[mockFilename, mockFileContents]]); + + await updateIndexAndAwaitGenerator(index, "compute", mockMarkComplete); + await updateIndexAndAwaitGenerator(index, "addTag", mockMarkComplete); +} + +export async function updateIndexAndAwaitGenerator( + index: CodebaseIndex, + resultType: keyof RefreshIndexResults, + markComplete: any, + tag: IndexTag = mockTag, +) { + const computeGenerator = index.update( + tag, + { ...mockResults, [resultType]: [mockPathAndCacheKey] }, + markComplete, + "test-repo", + ); + + while (!(await computeGenerator.next()).done) {} +} diff --git a/core/test/util/lcs.test.ts b/core/test/util/lcs.test.ts deleted file mode 100644 index da10cdf90..000000000 --- a/core/test/util/lcs.test.ts +++ /dev/null @@ -1,40 +0,0 @@ -// This file is generated by Continue -import { longestCommonSubsequence } from "../../util/lcs"; - -describe("longestCommonSubsequence", () => { - beforeAll(() => { - // Setup if needed - }); - - afterAll(() => { - // Teardown if needed - }); - - test("should return the longest common subsequence for non-empty strings", () => { - expect(longestCommonSubsequence("abcde", "ace")).toBe("ace"); - expect(longestCommonSubsequence("abc", "abc")).toBe("abc"); - expect(longestCommonSubsequence("abc", "def")).toBe(""); - }); - - test("should handle cases where one or both strings are empty", () => { - expect(longestCommonSubsequence("", "abc")).toBe(""); - expect(longestCommonSubsequence("abc", "")).toBe(""); - expect(longestCommonSubsequence("", "")).toBe(""); - }); - - test("should handle cases with no common subsequence", () => { - expect(longestCommonSubsequence("abc", "def")).toBe(""); - expect(longestCommonSubsequence("xyz", "abc")).toBe(""); - }); - - test("should handle cases with special characters", () => { - expect(longestCommonSubsequence("a!@#b$c", "!@#$")).toBe("!@#$"); - expect(longestCommonSubsequence("a!@#b$c", "xyz")).toBe(""); - }); - - test("should handle long strings efficiently", () => { - const str1 = "a".repeat(1000) + "b".repeat(1000); - const str2 = "a".repeat(1000) + "c".repeat(1000); - expect(longestCommonSubsequence(str1, str2)).toBe("a".repeat(1000)); - }); -}); diff --git a/core/test/util/ranges/getRangeInString.test.ts b/core/test/util/ranges/getRangeInString.test.ts deleted file mode 100644 index e0a4df67a..000000000 --- a/core/test/util/ranges/getRangeInString.test.ts +++ /dev/null @@ -1,105 +0,0 @@ -// This file is generated by Continue - -import { getRangeInString } from "../../../util/ranges"; - -describe.skip("getRangeInString", () => { - let content: string; - - beforeEach(() => { - content = `Line 1 -Line 2 -Line 3 -Line 4 -Line 5`; - }); - - afterEach(() => { - content = ""; - }); - - test("should return substring within the same line", () => { - const range = { - start: { line: 1, character: 0 }, - end: { line: 1, character: 4 }, - }; - expect(getRangeInString(content, range)).toBe("Line"); - }); - - test("should return substring spanning multiple lines", () => { - const range = { - start: { line: 1, character: 2 }, - end: { line: 3, character: 3 }, - }; - const expected = `ne 2 -Line 3 -Line 4`; - expect(getRangeInString(content, range)).toBe(expected); - }); - - test("should handle range that starts and ends at the same character", () => { - const range = { - start: { line: 2, character: 0 }, - end: { line: 2, character: 0 }, - }; - expect(getRangeInString(content, range)).toBe("L"); - }); - - test("should handle range that spans entire content", () => { - const range = { - start: { line: 0, character: 0 }, - end: { line: 4, character: 5 }, - }; - expect(getRangeInString(content, range)).toBe(content); - }); - - test("should handle range that spans to the end of the last line", () => { - const range = { - start: { line: 3, character: 2 }, - end: { line: 4, character: 5 }, - }; - const expected = `ne 4 -Line 5`; - expect(getRangeInString(content, range)).toBe(expected); - }); - - test("should handle empty content", () => { - content = ""; - const range = { - start: { line: 0, character: 0 }, - end: { line: 0, character: 0 }, - }; - expect(getRangeInString(content, range)).toBe(""); - }); - - test("should handle invalid range (start line > end line)", () => { - const range = { - start: { line: 3, character: 0 }, - end: { line: 2, character: 0 }, - }; - expect(getRangeInString(content, range)).toBe(""); - }); - - test("should handle invalid range (start character > end character on same line)", () => { - const range = { - start: { line: 1, character: 5 }, - end: { line: 1, character: 2 }, - }; - expect(getRangeInString(content, range)).toBe(""); - }); - - test("should handle range that starts and ends at the same line but different characters", () => { - const range = { - start: { line: 1, character: 2 }, - end: { line: 1, character: 6 }, - }; - expect(getRangeInString(content, range)).toBe("ne 2"); - }); - - test("should handle range that starts and ends at the same line and same characters", () => { - const range = { - start: { line: 1, character: 2 }, - end: { line: 1, character: 2 }, - }; - expect(getRangeInString(content, range)).toBe("n"); - }); -}); diff --git a/core/test/util/ranges/intersection.test.ts b/core/test/util/ranges/intersection.test.ts deleted file mode 100644 index 397dbc1a8..000000000 --- a/core/test/util/ranges/intersection.test.ts +++ /dev/null @@ -1,123 +0,0 @@ -// This file is generated by Continue - -import { intersection } from "../../../util/ranges"; - -interface Position { - line: number; - character: number; -} - -interface Range { - start: Position; - end: Position; -} - -describe("intersection", () => { - let rangeA: Range; - let rangeB: Range; - - beforeEach(() => { - rangeA = { - start: { line: 1, character: 0 }, - end: { line: 3, character: 5 }, - }; - - rangeB = { - start: { line: 2, character: 2 }, - end: { line: 4, character: 0 }, - }; - }); - - test("returns correct intersection for overlapping ranges", () => { - const result = intersection(rangeA, rangeB); - expect(result).toEqual({ - start: { line: 2, character: 2 }, - end: { line: 3, character: 5 }, - }); - }); - - test("returns null for non-overlapping ranges", () => { - rangeA = { - start: { line: 1, character: 0 }, - end: { line: 2, character: 0 }, - }; - - rangeB = { - start: { line: 3, character: 0 }, - end: { line: 4, character: 0 }, - }; - - const result = intersection(rangeA, rangeB); - expect(result).toBeNull(); - }); - - // TODO - test.skip("returns correct intersection for single line overlap", () => { - rangeA = { - start: { line: 1, character: 0 }, - end: { line: 1, character: 5 }, - }; - - rangeB = { - start: { line: 1, character: 3 }, - end: { line: 2, character: 0 }, - }; - - const result = intersection(rangeA, rangeB); - expect(result).toEqual({ - start: { line: 1, character: 3 }, - end: { line: 1, character: 5 }, - }); - }); - - test("returns null for single line non-overlapping ranges", () => { - rangeA = { - start: { line: 1, character: 0 }, - end: { line: 1, character: 2 }, - }; - - rangeB = { - start: { line: 1, character: 3 }, - end: { line: 1, character: 5 }, - }; - - const result = intersection(rangeA, rangeB); - expect(result).toBeNull(); - }); - - test("returns correct intersection when one range is fully within another", () => { - rangeA = { - start: { line: 1, character: 0 }, - end: { line: 4, character: 5 }, - }; - - rangeB = { - start: { line: 2, character: 2 }, - end: { line: 3, character: 3 }, - }; - - const result = intersection(rangeA, rangeB); - expect(result).toEqual({ - start: { line: 2, character: 2 }, - end: { line: 3, character: 3 }, - }); - }); - - test("returns correct intersection when ranges touch at the edge", () => { - rangeA = { - start: { line: 1, character: 0 }, - end: { line: 2, character: 0 }, - }; - - rangeB = { - start: { line: 2, character: 0 }, - end: { line: 3, character: 0 }, - }; - - const result = intersection(rangeA, rangeB); - expect(result).toEqual({ - start: { line: 2, character: 0 }, - end: { line: 2, character: 0 }, - }); - }); -}); diff --git a/core/test/util/ranges/maxMinPosition.test.ts b/core/test/util/ranges/maxMinPosition.test.ts deleted file mode 100644 index 0468df1cd..000000000 --- a/core/test/util/ranges/maxMinPosition.test.ts +++ /dev/null @@ -1,70 +0,0 @@ -import { maxPosition, minPosition } from "../../../util/ranges"; - -// This file is generated by Continue -interface Position { - line: number; - character: number; -} - -describe("Position comparison functions", () => { - let pos1: Position; - let pos2: Position; - let pos3: Position; - let pos4: Position; - - beforeAll(() => { - // Setup: Initializing positions - pos1 = { line: 1, character: 5 }; - pos2 = { line: 2, character: 3 }; - pos3 = { line: 1, character: 7 }; - pos4 = { line: 2, character: 3 }; // Same as pos2 to test equality - }); - - describe("maxPosition", () => { - it("should return the position with the greater line number", () => { - expect(maxPosition(pos1, pos2)).toEqual(pos2); - }); - - it("should return the position with the greater character number when lines are equal", () => { - expect(maxPosition(pos1, pos3)).toEqual(pos3); - }); - - it("should return the first position when both positions are equal", () => { - expect(maxPosition(pos2, pos4)).toEqual(pos2); - }); - - it("should handle positions with negative line numbers", () => { - const posNegative = { line: -1, character: 0 }; - expect(maxPosition(posNegative, pos1)).toEqual(pos1); - }); - - it("should handle positions with negative character numbers", () => { - const posNegativeChar = { line: 1, character: -1 }; - expect(maxPosition(posNegativeChar, pos1)).toEqual(pos1); - }); - }); - - describe("minPosition", () => { - it("should return the position with the lesser line number", () => { - expect(minPosition(pos1, pos2)).toEqual(pos1); - }); - - it("should return the position with the lesser character number when lines are equal", () => { - expect(minPosition(pos1, pos3)).toEqual(pos1); - }); - - it("should return the first position when both positions are equal", () => { - expect(minPosition(pos2, pos4)).toEqual(pos2); - }); - - it("should handle positions with negative line numbers", () => { - const posNegative = { line: -1, character: 0 }; - expect(minPosition(posNegative, pos1)).toEqual(posNegative); - }); - - it("should handle positions with negative character numbers", () => { - const posNegativeChar = { line: 1, character: -1 }; - expect(minPosition(posNegativeChar, pos1)).toEqual(posNegativeChar); - }); - }); -}); diff --git a/core/test/util/ranges/union.test.ts b/core/test/util/ranges/union.test.ts deleted file mode 100644 index 9d06a97b4..000000000 --- a/core/test/util/ranges/union.test.ts +++ /dev/null @@ -1,92 +0,0 @@ -import { union } from "../../../util/ranges"; - -// This file is generated by Continue -interface Position { - line: number; - character: number; -} - -interface Range { - start: Position; - end: Position; -} - -describe("union", () => { - let rangeA: Range; - let rangeB: Range; - - beforeEach(() => { - rangeA = { - start: { line: 1, character: 0 }, - end: { line: 3, character: 5 }, - }; - - rangeB = { - start: { line: 2, character: 3 }, - end: { line: 4, character: 2 }, - }; - }); - - test("should return the union of two overlapping ranges", () => { - const result = union(rangeA, rangeB); - expect(result).toEqual({ - start: { line: 1, character: 0 }, - end: { line: 4, character: 2 }, - }); - }); - - test("should return the union when ranges are identical", () => { - const result = union(rangeA, rangeA); - expect(result).toEqual(rangeA); - }); - - test("should return the union when ranges do not overlap but are adjacent", () => { - rangeB = { - start: { line: 3, character: 5 }, - end: { line: 4, character: 2 }, - }; - const result = union(rangeA, rangeB); - expect(result).toEqual({ - start: { line: 1, character: 0 }, - end: { line: 4, character: 2 }, - }); - }); - - test("should return the union when one range is completely within the other", () => { - rangeB = { - start: { line: 2, character: 1 }, - end: { line: 2, character: 4 }, - }; - const result = union(rangeA, rangeB); - expect(result).toEqual(rangeA); - }); - - test("should return the union when ranges do not overlap and are not adjacent", () => { - rangeB = { - start: { line: 4, character: 3 }, - end: { line: 5, character: 1 }, - }; - const result = union(rangeA, rangeB); - expect(result).toEqual({ - start: { line: 1, character: 0 }, - end: { line: 5, character: 1 }, - }); - }); - - // TODO - test.skip("should handle edge case where start and end lines are the same", () => { - rangeA = { - start: { line: 1, character: 0 }, - end: { line: 1, character: 5 }, - }; - rangeB = { - start: { line: 1, character: 3 }, - end: { line: 1, character: 7 }, - }; - const result = union(rangeA, rangeB); - expect(result).toEqual({ - start: { line: 1, character: 0 }, - end: { line: 1, character: 7 }, - }); - }); -}); diff --git a/core/test/util/testDir.ts b/core/test/util/testDir.ts new file mode 100644 index 000000000..d6bc462dc --- /dev/null +++ b/core/test/util/testDir.ts @@ -0,0 +1,34 @@ +import fs from "fs"; +import path from "path"; +import os from "os"; + +// Want this outside of the git repository so we can change branches in tests +export const TEST_DIR = path.join(os.tmpdir(), "testDir"); + +export function setUpTestDir() { + if (fs.existsSync(TEST_DIR)) { + fs.rmSync(TEST_DIR, { recursive: true }); + } + fs.mkdirSync(TEST_DIR); +} + +export function tearDownTestDir() { + if (fs.existsSync(TEST_DIR)) { + fs.rmSync(TEST_DIR, { recursive: true }); + } +} + +export function addToTestDir(paths: (string | string[])[]) { + for (const p of paths) { + const filepath = path.join(TEST_DIR, Array.isArray(p) ? p[0] : p); + fs.mkdirSync(path.dirname(filepath), { recursive: true }); + + if (Array.isArray(p)) { + fs.writeFileSync(filepath, p[1]); + } else if (p.endsWith("/")) { + fs.mkdirSync(filepath, { recursive: true }); + } else { + fs.writeFileSync(filepath, ""); + } + } +} diff --git a/core/tsconfig.json b/core/tsconfig.json index d59b9a3d9..69966e2de 100644 --- a/core/tsconfig.json +++ b/core/tsconfig.json @@ -10,7 +10,7 @@ "strict": true, "forceConsistentCasingInFileNames": true, "module": "ESNext", - "moduleResolution": "Node", + "moduleResolution": "Bundler", "resolveJsonModule": true, "isolatedModules": true, "noEmit": true, diff --git a/core/util/ca.ts b/core/util/ca.ts index 9767c556b..3890226c0 100644 --- a/core/util/ca.ts +++ b/core/util/ca.ts @@ -1,4 +1,5 @@ import { globalAgent } from "https"; +// @ts-ignore import { systemCertsAsync } from "system-ca"; export async function setupCa() { @@ -6,11 +7,13 @@ export async function setupCa() { switch (process.platform) { case "darwin": // https://www.npmjs.com/package/mac-ca#usage - require("mac-ca").addToGlobalAgent(); + const macCa = await import("mac-ca"); + macCa.addToGlobalAgent(); break; case "win32": // https://www.npmjs.com/package/win-ca#caveats - require("win-ca").inject("+"); + const winCa = await import("win-ca"); + winCa.inject("+"); break; default: // https://www.npmjs.com/package/system-ca diff --git a/core/util/devdataSqlite.ts b/core/util/devdataSqlite.ts index 9724e9f21..4f86cb1a1 100644 --- a/core/util/devdataSqlite.ts +++ b/core/util/devdataSqlite.ts @@ -21,14 +21,14 @@ export class DevDataSqliteDb { // Add tokens_prompt column if it doesn't exist const columnCheckResult = await db.all( - `PRAGMA table_info(tokens_generated);`, + "PRAGMA table_info(tokens_generated);", ); const columnExists = columnCheckResult.some( (col: any) => col.name === "tokens_prompt", ); if (!columnExists) { await db.exec( - `ALTER TABLE tokens_generated ADD COLUMN tokens_prompt INTEGER NOT NULL DEFAULT 0;`, + "ALTER TABLE tokens_generated ADD COLUMN tokens_prompt INTEGER NOT NULL DEFAULT 0;", ); } } @@ -41,7 +41,7 @@ export class DevDataSqliteDb { ) { const db = await DevDataSqliteDb.get(); await db?.run( - `INSERT INTO tokens_generated (model, provider, tokens_prompt, tokens_generated) VALUES (?, ?, ?, ?)`, + "INSERT INTO tokens_generated (model, provider, tokens_prompt, tokens_generated) VALUES (?, ?, ?, ?)", [model, provider, promptTokens, generatedTokens], ); } diff --git a/core/util/extractMinimalStackTraceInfo.ts b/core/util/extractMinimalStackTraceInfo.ts new file mode 100644 index 000000000..51fcde91a --- /dev/null +++ b/core/util/extractMinimalStackTraceInfo.ts @@ -0,0 +1,16 @@ +/** + * It's helpful to know what functions errors occur in, but absolute + * file paths are sensitive information, so we want to remove them. + * @param stack The stack trace to extract minimal information from. + * @returns A string containing the minimal stack trace information. + */ +export function extractMinimalStackTraceInfo(stack: unknown): string { + if (typeof stack !== "string") {return "";} + const lines = stack.split("\n"); + const minimalLines = lines.filter((line) => { + return line.trimStart().startsWith("at ") && !line.includes("node_modules"); + }); + return minimalLines + .map((line) => line.trimStart().replace("at ", "").split(" (").slice(0, 1)) + .join(", "); +} diff --git a/core/util/filesystem.ts b/core/util/filesystem.ts index 978fa0829..06209a474 100644 --- a/core/util/filesystem.ts +++ b/core/util/filesystem.ts @@ -45,12 +45,17 @@ class FileSystemIde implements IDE { async getGitHubAuthToken(): Promise { return undefined; } - getLastModified(files: string[]): Promise<{ [path: string]: number }> { - return new Promise((resolve) => { - resolve({ - [files[0]]: 1234567890, - }); - }); + async getLastModified(files: string[]): Promise<{ [path: string]: number }> { + const result: { [path: string]: number } = {}; + for (const file of files) { + try { + const stats = fs.statSync(file); + result[file] = stats.mtimeMs; + } catch (error) { + console.error(`Error getting last modified time for ${file}:`, error); + } + } + return result; } getGitRootPath(dir: string): Promise { return Promise.resolve(dir); @@ -78,8 +83,13 @@ class FileSystemIde implements IDE { return Promise.resolve(undefined); } - getTags(artifactId: string): Promise { - return Promise.resolve([]); + async getTags(artifactId: string): Promise { + const directory =(await this.getWorkspaceDirs())[0]; + return [{ + artifactId, + branch: await this.getBranch(directory), + directory + }]; } getIdeInfo(): Promise { diff --git a/core/util/index.test.ts b/core/util/index.test.ts new file mode 100644 index 000000000..0d618069c --- /dev/null +++ b/core/util/index.test.ts @@ -0,0 +1,200 @@ +// File generated by Continue +import { + dedentAndGetCommonWhitespace, + deduplicateArray, + getLastNPathParts, +} from "./"; + +describe("getLastNPathParts", () => { + test("returns the last N parts of a filepath with forward slashes", () => { + const filepath = "home/user/documents/project/file.txt"; + expect(getLastNPathParts(filepath, 2)).toBe("project/file.txt"); + }); + + test("returns the last N parts of a filepath with backward slashes", () => { + const filepath = "C:\\home\\user\\documents\\project\\file.txt"; + expect(getLastNPathParts(filepath, 3)).toBe("documents/project/file.txt"); + }); + + test("returns the last part if N is 1", () => { + const filepath = "/home/user/documents/project/file.txt"; + expect(getLastNPathParts(filepath, 1)).toBe("file.txt"); + }); + + test("returns the entire path if N is greater than the number of parts", () => { + const filepath = "home/user/documents/project/file.txt"; + expect(getLastNPathParts(filepath, 10)).toBe( + "home/user/documents/project/file.txt", + ); + }); + + test("returns an empty string if N is 0", () => { + const filepath = "home/user/documents/project/file.txt"; + expect(getLastNPathParts(filepath, 0)).toBe(""); + }); + + test("handles paths with mixed forward and backward slashes", () => { + const filepath = "home\\user/documents\\project/file.txt"; + expect(getLastNPathParts(filepath, 3)).toBe("documents/project/file.txt"); + }); + + test("handles edge case with empty filepath", () => { + const filepath = ""; + expect(getLastNPathParts(filepath, 2)).toBe(""); + }); +}); + +describe("deduplicateArray", () => { + it("should return an empty array when given an empty array", () => { + const result = deduplicateArray([], (a, b) => a === b); + expect(result).toEqual([]); + }); + + it("should return the same array when there are no duplicates", () => { + const input = [1, 2, 3, 4, 5]; + const result = deduplicateArray(input, (a, b) => a === b); + expect(result).toEqual(input); + }); + + it("should remove duplicates based on the equality function", () => { + const input = [1, 2, 2, 3, 4, 4, 5]; + const result = deduplicateArray(input, (a, b) => a === b); + expect(result).toEqual([1, 2, 3, 4, 5]); + }); + + it("should work with objects using custom equality function", () => { + const input = [ + { id: 1, name: "Alice" }, + { id: 2, name: "Bob" }, + { id: 1, name: "Alice" }, + { id: 3, name: "Charlie" }, + ]; + const result = deduplicateArray(input, (a, b) => a.id === b.id); + expect(result).toEqual([ + { id: 1, name: "Alice" }, + { id: 2, name: "Bob" }, + { id: 3, name: "Charlie" }, + ]); + }); + + it("should preserve the order of items", () => { + const input = [3, 1, 4, 1, 5, 9, 2, 6, 5, 3, 5]; + const result = deduplicateArray(input, (a, b) => a === b); + expect(result).toEqual([3, 1, 4, 5, 9, 2, 6]); + }); + + it("should work with strings", () => { + const input = ["apple", "banana", "apple", "cherry", "banana", "date"]; + const result = deduplicateArray(input, (a, b) => a === b); + expect(result).toEqual(["apple", "banana", "cherry", "date"]); + }); + + it("should handle arrays with all duplicate elements", () => { + const input = [1, 1, 1, 1, 1]; + const result = deduplicateArray(input, (a, b) => a === b); + expect(result).toEqual([1]); + }); + + it("should work with custom equality function for complex objects", () => { + const input = [ + { x: 1, y: 2 }, + { x: 2, y: 1 }, + { x: 1, y: 2 }, + { x: 3, y: 4 }, + ]; + const result = deduplicateArray( + input, + (a, b) => a.x === b.x && a.y === b.y, + ); + expect(result).toEqual([ + { x: 1, y: 2 }, + { x: 2, y: 1 }, + { x: 3, y: 4 }, + ]); + }); + + it("should handle large arrays efficiently", () => { + const input = Array(10000) + .fill(0) + .map((_, i) => i % 100); + const start = performance.now(); + const result = deduplicateArray(input, (a, b) => a === b); + const end = performance.now(); + expect(result).toHaveLength(100); + expect(end - start).toBeLessThan(1000); // Ensure it completes in less than 1 second + }); +}); + +describe("dedentAndGetCommonWhitespace", () => { + let originalString: string; + + beforeEach(() => { + // Setup any global variables or states if needed + originalString = " line1\n line2\n line3"; + }); + + afterEach(() => { + // Tear down any changes to global variables or states if needed + originalString = ""; + }); + + test("should dedent and return common whitespace for a simple case", () => { + const input = " line1\n line2\n line3"; + const output = dedentAndGetCommonWhitespace(input); + expect(output).toEqual(["line1\nline2\nline3", " "]); + }); + + test("should handle empty string", () => { + const input = ""; + const output = dedentAndGetCommonWhitespace(input); + expect(output).toEqual(["", ""]); + }); + + test("should handle string with only whitespace", () => { + const input = " "; + const output = dedentAndGetCommonWhitespace(input); + expect(output).toEqual(["", ""]); + }); + + test("should handle string with mixed whitespace and content", () => { + const input = " line1\n line2\n line3"; + const output = dedentAndGetCommonWhitespace(input); + expect(output).toEqual([" line1\nline2\n line3", " "]); + }); + + test("should handle string with no common leading whitespace", () => { + const input = "line1\n line2\n line3"; + const output = dedentAndGetCommonWhitespace(input); + expect(output).toEqual([input, ""]); + }); + + test("should handle string with empty lines", () => { + const input = " line1\n\n line3"; + const output = dedentAndGetCommonWhitespace(input); + expect(output).toEqual(["line1\n\nline3", " "]); + }); + + test("should handle string with only empty lines", () => { + const input = "\n\n"; + const output = dedentAndGetCommonWhitespace(input); + expect(output).toEqual(["\n\n", ""]); + }); + + test("should handle string with tabs as whitespace", () => { + const input = "\tline1\n\tline2\n\tline3"; + const output = dedentAndGetCommonWhitespace(input); + expect(output).toEqual(["line1\nline2\nline3", "\t"]); + }); + + test("should handle string with mixed tabs and spaces", () => { + const input = "\t line1\n\t line2\n\t line3"; + const output = dedentAndGetCommonWhitespace(input); + expect(output).toEqual(["line1\nline2\nline3", "\t "]); + }); + + test("should handle string with different leading whitespace lengths", () => { + const input = " line1\n line2\n line3"; + const output = dedentAndGetCommonWhitespace(input); + expect(output).toEqual([" line1\nline2\n line3", " "]); + }); +}); diff --git a/core/util/index.ts b/core/util/index.ts index 0c7a06317..a628948c7 100644 --- a/core/util/index.ts +++ b/core/util/index.ts @@ -2,19 +2,19 @@ export function removeQuotesAndEscapes(output: string): string { output = output.trim(); // Replace smart quotes - output = output.replace("“", '"'); - output = output.replace("”", '"'); + output = output.replace("“", "\""); + output = output.replace("”", "\""); output = output.replace("‘", "'"); output = output.replace("’", "'"); // Remove escapes - output = output.replace('\\"', '"'); + output = output.replace("\\\"", "\""); output = output.replace("\\'", "'"); output = output.replace("\\n", "\n"); output = output.replace("\\t", "\t"); output = output.replace("\\\\", "\\"); while ( - (output.startsWith('"') && output.endsWith('"')) || + (output.startsWith("\"") && output.endsWith("\"")) || (output.startsWith("'") && output.endsWith("'")) ) { output = output.slice(1, -1); @@ -120,7 +120,7 @@ export function getUniqueFilePath( } export function shortestRelativePaths(paths: string[]): string[] { - if (paths.length === 0) return []; + if (paths.length === 0) {return [];} const partsLengths = paths.map((x) => x.split(SEP_REGEX).length); const currentRelativePaths = paths.map(getBasename); @@ -135,7 +135,7 @@ export function shortestRelativePaths(paths: string[]): string[] { const firstDuplicatedPath = currentRelativePaths.find( (x, i) => isDuplicated[i], ); - if (!firstDuplicatedPath) break; + if (!firstDuplicatedPath) {break;} currentRelativePaths.forEach((x, i) => { if (x === firstDuplicatedPath) { diff --git a/core/util/lcs.test.ts b/core/util/lcs.test.ts new file mode 100644 index 000000000..2f8e1f92f --- /dev/null +++ b/core/util/lcs.test.ts @@ -0,0 +1,31 @@ +import { longestCommonSubsequence as lcs } from "./lcs"; + +describe("longestCommonSubsequence", () => { + test("should return the longest common subsequence for non-empty strings", () => { + expect(lcs("abcde", "ace")).toBe("ace"); + expect(lcs("abc", "abc")).toBe("abc"); + expect(lcs("abc", "def")).toBe(""); + }); + + test("should handle cases where one or both strings are empty", () => { + expect(lcs("", "abc")).toBe(""); + expect(lcs("abc", "")).toBe(""); + expect(lcs("", "")).toBe(""); + }); + + test("should handle cases with no common subsequence", () => { + expect(lcs("abc", "def")).toBe(""); + expect(lcs("xyz", "abc")).toBe(""); + }); + + test("should handle cases with special characters", () => { + expect(lcs("a!@#b$c", "!@#$")).toBe("!@#$"); + expect(lcs("a!@#b$c", "xyz")).toBe(""); + }); + + test("should handle long strings efficiently", () => { + const str1 = "a".repeat(1000) + "b".repeat(1000); + const str2 = "a".repeat(1000) + "c".repeat(1000); + expect(lcs(str1, str2)).toBe("a".repeat(1000)); + }); +}); diff --git a/core/test/util/merge.test.ts b/core/util/merge.test.ts similarity index 96% rename from core/test/util/merge.test.ts rename to core/util/merge.test.ts index a39a5bc30..237f362c4 100644 --- a/core/test/util/merge.test.ts +++ b/core/util/merge.test.ts @@ -1,5 +1,6 @@ // File generated by Continue -import { mergeJson } from "../../util/merge"; + +import mergeJson from "./merge"; describe("mergeJson", () => { it("should merge two simple JSON objects", () => { @@ -9,7 +10,7 @@ describe("mergeJson", () => { expect(result).toEqual({ a: 1, b: 3, c: 4 }); }); - it('should overwrite values when mergeBehavior is "overwrite"', () => { + it("should overwrite values when mergeBehavior is \"overwrite\"", () => { const first = { a: 1, b: 2 }; const second = { b: 3, c: 4 }; const result = mergeJson(first, second, "overwrite"); diff --git a/core/util/messageIde.ts b/core/util/messageIde.ts index 11bd9b3b2..396df29c7 100644 --- a/core/util/messageIde.ts +++ b/core/util/messageIde.ts @@ -55,7 +55,7 @@ export class MessageIde implements IDE { } infoPopup(message: string): Promise { - return this.request("errorPopup", { message }); + return this.request("infoPopup", { message }); } errorPopup(message: string): Promise { diff --git a/core/util/messenger.ts b/core/util/messenger.ts index 1d2bde255..2b0593ef3 100644 --- a/core/util/messenger.ts +++ b/core/util/messenger.ts @@ -1,5 +1,5 @@ import { v4 as uuidv4 } from "uuid"; -import type { IProtocol } from "../protocol"; +import type { IProtocol } from "../protocol/index.js"; export interface Message { messageType: string; @@ -75,7 +75,7 @@ export class InProcessMessenger< messageId?: string, ): ToProtocol[T][1] { const listener = this.myTypeListeners.get(messageType); - if (!listener) return; + if (!listener) {return;} const msg: Message = { messageType: messageType as string, diff --git a/core/util/paths.ts b/core/util/paths.ts index cec9b0a95..5bc7fc26b 100644 --- a/core/util/paths.ts +++ b/core/util/paths.ts @@ -8,9 +8,22 @@ import Types from "../config/types.js"; import { IdeType, SerializedContinueConfig } from "../index.js"; dotenv.config(); + const CONTINUE_GLOBAL_DIR = process.env.CONTINUE_GLOBAL_DIR ?? path.join(os.homedir(), ".continue"); +export function getChromiumPath(): string { + return path.join(getContinueUtilsPath(), ".chromium-browser-snapshots"); +} + +export function getContinueUtilsPath(): string { + const utilsPath = path.join(getContinueGlobalPath(), ".utils"); + if (!fs.existsSync(utilsPath)) { + fs.mkdirSync(utilsPath); + } + return utilsPath; +} + export function getContinueGlobalPath(): string { // This is ~/.continue on mac/linux const continuePath = CONTINUE_GLOBAL_DIR; @@ -200,13 +213,19 @@ export async function migrate( callback: () => void | Promise, onAlreadyComplete?: () => void, ) { + if (process.env.NODE_ENV === "test") { + return await Promise.resolve(callback()); + } + const migrationsPath = getMigrationsFolderPath(); const migrationPath = path.join(migrationsPath, id); if (!fs.existsSync(migrationPath)) { try { - await Promise.resolve(callback()); + console.log(`Running migration: ${id}`); + fs.writeFileSync(migrationPath, ""); + await Promise.resolve(callback()); } catch (e) { console.warn(`Migration ${id} failed`, e); } diff --git a/core/util/posthog.ts b/core/util/posthog.ts index c164a0349..be62977fc 100644 --- a/core/util/posthog.ts +++ b/core/util/posthog.ts @@ -1,12 +1,13 @@ import os from "node:os"; -import { TeamAnalytics } from "../control-plane/TeamAnalytics"; +import { TeamAnalytics } from "../control-plane/TeamAnalytics.js"; +import { IdeInfo } from "../index.js"; export class Telemetry { // Set to undefined whenever telemetry is disabled static client: any = undefined; static uniqueId = "NOT_UNIQUE"; static os: string | undefined = undefined; - static extensionVersion: string | undefined = undefined; + static ideInfo: IdeInfo | undefined = undefined; static async capture( event: string, @@ -19,7 +20,9 @@ export class Telemetry { properties: { ...properties, os: Telemetry.os, - extensionVersion: Telemetry.extensionVersion, + extensionVersion: Telemetry.ideInfo?.extensionVersion, + ideName: Telemetry.ideInfo?.name, + ideType: Telemetry.ideInfo?.ideType, }, }); @@ -32,14 +35,10 @@ export class Telemetry { Telemetry.client?.shutdown(); } - static async setup( - allow: boolean, - uniqueId: string, - extensionVersion: string, - ) { + static async setup(allow: boolean, uniqueId: string, ideInfo: IdeInfo) { Telemetry.uniqueId = uniqueId; Telemetry.os = os.platform(); - Telemetry.extensionVersion = extensionVersion; + Telemetry.ideInfo = ideInfo; if (!allow) { Telemetry.client = undefined; diff --git a/core/util/ranges.test.ts b/core/util/ranges.test.ts new file mode 100644 index 000000000..d9d12c07a --- /dev/null +++ b/core/util/ranges.test.ts @@ -0,0 +1,374 @@ +// This file is generated by Continue + +import { + intersection, + getRangeInString, + maxPosition, + minPosition, + union, +} from "./ranges"; + +interface Position { + line: number; + character: number; +} + +interface Range { + start: Position; + end: Position; +} + +describe("union", () => { + let rangeA: Range; + let rangeB: Range; + + beforeEach(() => { + rangeA = { + start: { line: 1, character: 0 }, + end: { line: 3, character: 5 }, + }; + + rangeB = { + start: { line: 2, character: 3 }, + end: { line: 4, character: 2 }, + }; + }); + + test("should return the union of two overlapping ranges", () => { + const result = union(rangeA, rangeB); + expect(result).toEqual({ + start: { line: 1, character: 0 }, + end: { line: 4, character: 2 }, + }); + }); + + test("should return the union when ranges are identical", () => { + const result = union(rangeA, rangeA); + expect(result).toEqual(rangeA); + }); + + test("should return the union when ranges do not overlap but are adjacent", () => { + rangeB = { + start: { line: 3, character: 5 }, + end: { line: 4, character: 2 }, + }; + const result = union(rangeA, rangeB); + expect(result).toEqual({ + start: { line: 1, character: 0 }, + end: { line: 4, character: 2 }, + }); + }); + + test("should return the union when one range is completely within the other", () => { + rangeB = { + start: { line: 2, character: 1 }, + end: { line: 2, character: 4 }, + }; + const result = union(rangeA, rangeB); + expect(result).toEqual(rangeA); + }); + + test("should return the union when ranges do not overlap and are not adjacent", () => { + rangeB = { + start: { line: 4, character: 3 }, + end: { line: 5, character: 1 }, + }; + const result = union(rangeA, rangeB); + expect(result).toEqual({ + start: { line: 1, character: 0 }, + end: { line: 5, character: 1 }, + }); + }); + + // TODO + test.skip("should handle edge case where start and end lines are the same", () => { + rangeA = { + start: { line: 1, character: 0 }, + end: { line: 1, character: 5 }, + }; + rangeB = { + start: { line: 1, character: 3 }, + end: { line: 1, character: 7 }, + }; + const result = union(rangeA, rangeB); + expect(result).toEqual({ + start: { line: 1, character: 0 }, + end: { line: 1, character: 7 }, + }); + }); +}); + +describe("Position comparison functions", () => { + let pos1: Position; + let pos2: Position; + let pos3: Position; + let pos4: Position; + + beforeAll(() => { + // Setup: Initializing positions + pos1 = { line: 1, character: 5 }; + pos2 = { line: 2, character: 3 }; + pos3 = { line: 1, character: 7 }; + pos4 = { line: 2, character: 3 }; // Same as pos2 to test equality + }); + + describe("maxPosition", () => { + it("should return the position with the greater line number", () => { + expect(maxPosition(pos1, pos2)).toEqual(pos2); + }); + + it("should return the position with the greater character number when lines are equal", () => { + expect(maxPosition(pos1, pos3)).toEqual(pos3); + }); + + it("should return the first position when both positions are equal", () => { + expect(maxPosition(pos2, pos4)).toEqual(pos2); + }); + + it("should handle positions with negative line numbers", () => { + const posNegative = { line: -1, character: 0 }; + expect(maxPosition(posNegative, pos1)).toEqual(pos1); + }); + + it("should handle positions with negative character numbers", () => { + const posNegativeChar = { line: 1, character: -1 }; + expect(maxPosition(posNegativeChar, pos1)).toEqual(pos1); + }); + }); + + describe("minPosition", () => { + it("should return the position with the lesser line number", () => { + expect(minPosition(pos1, pos2)).toEqual(pos1); + }); + + it("should return the position with the lesser character number when lines are equal", () => { + expect(minPosition(pos1, pos3)).toEqual(pos1); + }); + + it("should return the first position when both positions are equal", () => { + expect(minPosition(pos2, pos4)).toEqual(pos2); + }); + + it("should handle positions with negative line numbers", () => { + const posNegative = { line: -1, character: 0 }; + expect(minPosition(posNegative, pos1)).toEqual(posNegative); + }); + + it("should handle positions with negative character numbers", () => { + const posNegativeChar = { line: 1, character: -1 }; + expect(minPosition(posNegativeChar, pos1)).toEqual(posNegativeChar); + }); + }); +}); + +describe.skip("getRangeInString", () => { + let content: string; + + beforeEach(() => { + content = `Line 1 +Line 2 +Line 3 +Line 4 +Line 5`; + }); + + afterEach(() => { + content = ""; + }); + + test("should return substring within the same line", () => { + const range = { + start: { line: 1, character: 0 }, + end: { line: 1, character: 4 }, + }; + expect(getRangeInString(content, range)).toBe("Line"); + }); + + test("should return substring spanning multiple lines", () => { + const range = { + start: { line: 1, character: 2 }, + end: { line: 3, character: 3 }, + }; + const expected = `ne 2 +Line 3 +Line 4`; + expect(getRangeInString(content, range)).toBe(expected); + }); + + test("should handle range that starts and ends at the same character", () => { + const range = { + start: { line: 2, character: 0 }, + end: { line: 2, character: 0 }, + }; + expect(getRangeInString(content, range)).toBe("L"); + }); + + test("should handle range that spans entire content", () => { + const range = { + start: { line: 0, character: 0 }, + end: { line: 4, character: 5 }, + }; + expect(getRangeInString(content, range)).toBe(content); + }); + + test("should handle range that spans to the end of the last line", () => { + const range = { + start: { line: 3, character: 2 }, + end: { line: 4, character: 5 }, + }; + const expected = `ne 4 +Line 5`; + expect(getRangeInString(content, range)).toBe(expected); + }); + + test("should handle empty content", () => { + content = ""; + const range = { + start: { line: 0, character: 0 }, + end: { line: 0, character: 0 }, + }; + expect(getRangeInString(content, range)).toBe(""); + }); + + test("should handle invalid range (start line > end line)", () => { + const range = { + start: { line: 3, character: 0 }, + end: { line: 2, character: 0 }, + }; + expect(getRangeInString(content, range)).toBe(""); + }); + + test("should handle invalid range (start character > end character on same line)", () => { + const range = { + start: { line: 1, character: 5 }, + end: { line: 1, character: 2 }, + }; + expect(getRangeInString(content, range)).toBe(""); + }); + + test("should handle range that starts and ends at the same line but different characters", () => { + const range = { + start: { line: 1, character: 2 }, + end: { line: 1, character: 6 }, + }; + expect(getRangeInString(content, range)).toBe("ne 2"); + }); + + test("should handle range that starts and ends at the same line and same characters", () => { + const range = { + start: { line: 1, character: 2 }, + end: { line: 1, character: 2 }, + }; + expect(getRangeInString(content, range)).toBe("n"); + }); +}); + +describe("intersection", () => { + let rangeA: Range; + let rangeB: Range; + + beforeEach(() => { + rangeA = { + start: { line: 1, character: 0 }, + end: { line: 3, character: 5 }, + }; + + rangeB = { + start: { line: 2, character: 2 }, + end: { line: 4, character: 0 }, + }; + }); + + test("returns correct intersection for overlapping ranges", () => { + const result = intersection(rangeA, rangeB); + expect(result).toEqual({ + start: { line: 2, character: 2 }, + end: { line: 3, character: 5 }, + }); + }); + + test("returns null for non-overlapping ranges", () => { + rangeA = { + start: { line: 1, character: 0 }, + end: { line: 2, character: 0 }, + }; + + rangeB = { + start: { line: 3, character: 0 }, + end: { line: 4, character: 0 }, + }; + + const result = intersection(rangeA, rangeB); + expect(result).toBeNull(); + }); + + // TODO + test.skip("returns correct intersection for single line overlap", () => { + rangeA = { + start: { line: 1, character: 0 }, + end: { line: 1, character: 5 }, + }; + + rangeB = { + start: { line: 1, character: 3 }, + end: { line: 2, character: 0 }, + }; + + const result = intersection(rangeA, rangeB); + expect(result).toEqual({ + start: { line: 1, character: 3 }, + end: { line: 1, character: 5 }, + }); + }); + + test("returns null for single line non-overlapping ranges", () => { + rangeA = { + start: { line: 1, character: 0 }, + end: { line: 1, character: 2 }, + }; + + rangeB = { + start: { line: 1, character: 3 }, + end: { line: 1, character: 5 }, + }; + + const result = intersection(rangeA, rangeB); + expect(result).toBeNull(); + }); + + test("returns correct intersection when one range is fully within another", () => { + rangeA = { + start: { line: 1, character: 0 }, + end: { line: 4, character: 5 }, + }; + + rangeB = { + start: { line: 2, character: 2 }, + end: { line: 3, character: 3 }, + }; + + const result = intersection(rangeA, rangeB); + expect(result).toEqual({ + start: { line: 2, character: 2 }, + end: { line: 3, character: 3 }, + }); + }); + + test("returns correct intersection when ranges touch at the edge", () => { + rangeA = { + start: { line: 1, character: 0 }, + end: { line: 2, character: 0 }, + }; + + rangeB = { + start: { line: 2, character: 0 }, + end: { line: 3, character: 0 }, + }; + + const result = intersection(rangeA, rangeB); + expect(result).toEqual({ + start: { line: 2, character: 0 }, + end: { line: 2, character: 0 }, + }); + }); +}); diff --git a/core/util/reverseMessageIde.ts b/core/util/reverseMessageIde.ts index 08a1ffe09..a65f1f1f2 100644 --- a/core/util/reverseMessageIde.ts +++ b/core/util/reverseMessageIde.ts @@ -1,6 +1,6 @@ -import { IDE } from ".."; -import { ToIdeFromWebviewOrCoreProtocol } from "../protocol/ide"; -import { Message } from "./messenger"; +import { IDE } from "../index.js"; +import { ToIdeFromWebviewOrCoreProtocol } from "../protocol/ide.js"; +import { Message } from "./messenger.js"; export class ReverseMessageIde { private on( @@ -124,6 +124,11 @@ export class ReverseMessageIde { return this.ide.listFolders(); }); + this.on("getControlPlaneSessionInfo", async (msg) => { + // Not supported in testing + return undefined; + }); + this.on("getContinueDir", () => { return this.ide.getContinueDir(); }); diff --git a/core/util/treeSitter.ts b/core/util/treeSitter.ts index 428c90d94..f4ab86c60 100644 --- a/core/util/treeSitter.ts +++ b/core/util/treeSitter.ts @@ -84,11 +84,15 @@ export async function getParserForFile(filepath: string) { const parser = new Parser(); const language = await getLanguageForFile(filepath); + if (!language) { + return undefined; + } + parser.setLanguage(language); return parser; } catch (e) { - console.error("Unable to load language for file", filepath, e); + console.debug("Unable to load language for file", filepath, e); return undefined; } } @@ -116,7 +120,7 @@ export async function getLanguageForFile( } return language; } catch (e) { - console.error("Unable to load language for file", filepath, e); + console.debug("Unable to load language for file", filepath, e); return undefined; } } diff --git a/core/util/tts.ts b/core/util/tts.ts new file mode 100644 index 000000000..248c38518 --- /dev/null +++ b/core/util/tts.ts @@ -0,0 +1,117 @@ +import os from "node:os"; +import { exec, ChildProcess } from "child_process"; +import type { IMessenger } from "./messenger"; +import type { FromCoreProtocol, ToCoreProtocol } from "../protocol"; + +// The amount of time before a process is declared +// a zombie after executing .kill() +const ttsKillTimeout: number = 5000; + +/** + * Removes code blocks from a message. + * + * Return modified message text. + */ +function removeCodeBlocks(msgText: string): string { + const codeBlockRegex = /```[\s\S]*?```/g; + + // Remove code blocks from the message text + const textWithoutCodeBlocks = msgText.replace(codeBlockRegex, ""); + + return textWithoutCodeBlocks.trim(); +} + +/** + * Cleans a message text to safely be used in 'exec' context on host. + * + * Return modified message text. + */ +function sanitizeMessageForTTS(message: string): string { + message = removeCodeBlocks(message); + + // Remove or replace problematic characters + message = message + .replace(/"/g, "") + .replace(/`/g, "") + .replace(/\$/g, "") + .replace(/\\/g, "") + .replace(/[&|;()<>]/g, ""); + + message = message.trim().replace(/\s+/g, " "); + + return message; +} + +export class TTS { + static os: string | undefined = undefined; + static handle: ChildProcess | undefined = undefined; + static messenger: IMessenger; + + static async read(message: string) { + message = sanitizeMessageForTTS(message); + + try { + // Kill any active TTS processes + await TTS.kill(); + } catch (e) { + console.warn("Error killing TTS process: ", e); + return; + } + + switch (TTS.os) { + case "darwin": + TTS.handle = exec(`say "${message}"`); + break; + case "win32": + // Replace single quotes on windows + TTS.handle = exec( + `powershell -Command "Add-Type -AssemblyName System.Speech; (New-Object System.Speech.Synthesis.SpeechSynthesizer).Speak('${message.replace( + /'/g, + "''", + )}')"`, + ); + break; + case "linux": + TTS.handle = exec(`espeak "${message}"`); + break; + default: + console.log( + "Text-to-speech is not supported on this operating system.", + ); + return; + } + + TTS.messenger.request("setTTSActive", true); + + TTS.handle?.once("exit", () => { + TTS.messenger.request("setTTSActive", false); + }); + } + + static async kill(): Promise { + return new Promise((resolve, reject) => { + // Only kill a TTS process if it's still running + if (TTS.handle && TTS.handle.exitCode === null) { + // Use a timeout in case of zombie processes + let killTimeout: NodeJS.Timeout = setTimeout(() => { + reject(`Unable to kill TTS process: ${TTS.handle?.pid}`); + }, ttsKillTimeout); + + // Resolve our promise once the program has exited + TTS.handle.once("exit", () => { + clearTimeout(killTimeout); + TTS.handle = undefined; + resolve(); + }); + + TTS.handle.kill(); + } else { + resolve(); + } + }); + } + + static async setup() { + TTS.os = os.platform(); + } +} diff --git a/docs/docs/changelog.mdx b/docs/docs/changelog.mdx index 8c3d76af2..3b703ce52 100644 --- a/docs/docs/changelog.mdx +++ b/docs/docs/changelog.mdx @@ -1,6 +1,6 @@ --- title: 📝 Changelog -description: Changelogs for the latest releases of the VSCode and IntelliJ extensions +description: Changelogs for the latest releases of the VSCode and JetBrains extensions keywords: [changelog] hide_table_of_contents: true --- @@ -8,7 +8,7 @@ hide_table_of_contents: true import VSCodeChangelog from "../../extensions/vscode/CHANGELOG.md"; import IntelliJChangelog from "../../extensions/intellij/CHANGELOG.md"; -Below are the changelogs for the latest releases of the VSCode and IntelliJ extensions. +Below are the changelogs for the latest releases of the VSCode and JetBrains extensions. Prior to 2024-07-02, the changelogs do not reflect all updates. import TOCInline from "@theme/TOCInline"; diff --git a/docs/docs/customization/context-providers.md b/docs/docs/customization/context-providers.md index 82d6aa133..610e272a9 100644 --- a/docs/docs/customization/context-providers.md +++ b/docs/docs/customization/context-providers.md @@ -50,35 +50,13 @@ Type '@terminal' to reference the contents of your IDE's terminal. ### Documentation -Type `@docs` to index and retrieve snippets from any documentation site. You can add any site by selecting "Add Docs" in the dropdown, then entering the root URL of the documentation site and a title to remember it by. After the site has been indexed, you can type `@docs`, select your documentation from the dropdown, and Continue will use similarity search to automatically find important sections when answering your question. +Type `@docs` to index and retrieve snippets from any documentation site. ```json { "name": "docs" } ``` -Continue also pre-indexes a number of common sites, listed [here](https://github.com/continuedev/continue/blob/main/core/indexing/docs/preIndexedDocs.ts). The embeddings for these sites are hosted by us, but downloaded for local use after the first time. All other indexing occurs entirely locally. - -#### Adding a Documentation Site via Configuration - -To add a documentation site via configuration, update the `config.json` file as follows: - -```json -{ - "name": "docs", - "params": { - "sites": [ - { - "title": "ExampleDocs", - "startUrl": "https://exampledocs.com/docs", - "rootUrl": "https://exampledocs.com", - "maxDepth": 3 // Default - } - ] - } -} -``` - -The docs are indexed when you modify the configuration file, unless indexing is disabled. If you want to manually trigger the indexing, you can use the command `Continue: Docs Index`. For force indexing, you can use the command `Continue: Docs Force Re-Index`. Note that these commands will work even if automatic indexing is disabled. +To learn more, visit [Talk To Your Docs](../features/talk-to-your-docs.md). ### Open Files @@ -90,7 +68,7 @@ Type '@open' to reference the contents of all of your open files. Set `onlyPinne ### Codebase Retrieval -Type '@codebase' to automatically retrieve the most relevant snippets from your codebase. Read more about indexing and retrieval [here](../walkthroughs/codebase-embeddings.md). +Type '@codebase' to automatically retrieve the most relevant snippets from your codebase. Read more about indexing and retrieval [here](../features/codebase-embeddings.md). ```json { "name": "codebase" } diff --git a/docs/docs/customization/slash-commands.md b/docs/docs/customization/slash-commands.md index da46f106c..85985c55e 100644 --- a/docs/docs/customization/slash-commands.md +++ b/docs/docs/customization/slash-commands.md @@ -44,11 +44,11 @@ Type "/share" to generate a shareable markdown transcript of your current chat h { "name": "share", "description": "Export the current chat session to markdown", - "params": { "ouputDir": "~/.continue/session-transcripts" } + "params": { "outputDir": "~/.continue/session-transcripts" } } ``` -Use the `ouputDir` parameter to specify where you want to the markdown file to be saved. +Use the `outputDir` parameter to specify where you want to the markdown file to be saved. ### `/cmd` @@ -107,6 +107,17 @@ The StackOverflow slash command will automatically pull results from StackOverfl } ``` +### `/onboard` + +The Onboard slash command helps to familiarize yourself with a new project by analyzing the project structure, READMEs, and dependency files. It identifies key folders, explains their purpose, and highlights popular packages used. Additionally, it offers insights into the project's architecture. + +```json +{ + "name": "onboard", + "description": "Familiarize yourself with the codebase" +} +``` + ## Custom Slash Commands There are two ways to add custom slash commands: diff --git a/docs/docs/development-data.md b/docs/docs/development-data.md index 6432197b3..3f230d0ed 100644 --- a/docs/docs/development-data.md +++ b/docs/docs/development-data.md @@ -1,11 +1,55 @@ --- -title: 🧑‍💻 Development data +title: Development Data description: Collecting data on how you build software -keywords: [development data, dev data, LLM-aided development] +keywords: [development data, dev data, LLM-aided development, software development, coding feedback] --- -# 🧑‍💻 Development Data +# Development Data -When you use Continue, you automatically collect data on how you build software. By default, this development data is saved to `.continue/dev_data` on your local machine. When combined with the code that you ultimately commit, it can be used to improve the LLM that you or your team use (if you allow). +## Why You Need Development Data -You can read more about how development data is generated as a byproduct of LLM-aided development and why we believe that you should start collecting it now: [It’s time to collect data on how you build software](https://blog.continue.dev/its-time-to-collect-data-on-how-you-build-software) +Development data is essential for any organization aiming to optimize its software development process. It provides crucial insights into how software is built by capturing the detailed workflow, context behind decisions, and natural language reasoning used during coding. Collecting and utilizing this data helps in: + +- **Improving LLMs**: Enhancing the performance and relevance of Large Language Models (LLMs) that assist in coding, making them more accurate and helpful. +- **Understanding Developer Challenges**: Identifying what frustrates developers and how they overcome challenges. +- **Demonstrating ROI**: Calculating the return on investment (ROI) of using LLMs within your organization. +- **Continual Improvement**: Establishing a continuous feedback loop to keep LLMs updated with the latest information, code, and preferred styles. + +## Understanding Development Data + +### Data Components + +- **Step-by-Step Process**: Detailed record of each step taken while completing a task. +- **Context Capture**: Information used to make decisions, such as code snippets, documentation, and logs. +- **Natural Language Reasoning**: Explanations and decisions made in natural language during coding. + +### Data Storage + +By default, the development data collected by Continue is stored locally on your machine in the directory `~/.continue/dev_data`. + +The data remains within your control on your local machine. If you choose to share your data with Continue for improving LLMs or other services, you must give explicit consent. If you are interested in working with us, please email us at [data@continue.dev](mailto:data@continue.dev). + +## Utilizing Development Data + +When combined with the code you commit, the development data can significantly improve the performance and relevance of LLMs. This results in more accurate suggestions and assistance during coding. Continue helps establish a continuous feedback loop to ensure LLMs always have fresh information, code, and preferred styles. + +Continue plays a critical role in leveraging development data for enhancing LLMs: + +- **Automatic Data Collection**: Continue automatically collects development data, including the step-by-step process, context, and natural language reasoning. + +- **Improvement of LLMs**: The collected data is used to create a continuous feedback loop, ensuring the LLMs are constantly updated with fresh and relevant information, thus improving their performance and accuracy. + +- **Development Data Engine**: Continue aids organizations in setting up development data engines. These engines offer visibility into how developers interact with LLMs, help calculate the ROI, identify frustrations, and enhance the models to overcome challenges. + +- **Open-Source Coding Autopilot**: Continue is building an open-source coding autopilot that enables the automatic collection and utilization of development data, providing flexibility, customization, and better privacy and security. + +- **Customized Improvement**: Continue allows teams to track and improve the metrics that matter most to their specific definitions of "great" software. + +- **Addressing Budget and Data Staleness**: Continue supports organizations in justifying their LLM budgets and managing data staleness by helping them extract, load, and transform their data effectively. + +## Privacy, Security, and Additional Resources + +Understanding the privacy and security implications of development data collection is crucial. Ensure that sensitive information is safeguarded and that data collection aligns with your organization's privacy policies. For more detailed insights and guidelines, refer to the following: + +- [Privacy Policy](https://continue.dev/privacy) +- [It’s time to collect data on how you build software](https://blog.continue.dev/its-time-to-collect-data-on-how-you-build-software) (Article) diff --git a/docs/docs/walkthroughs/codebase-embeddings.md b/docs/docs/features/codebase-embeddings.md similarity index 100% rename from docs/docs/walkthroughs/codebase-embeddings.md rename to docs/docs/features/codebase-embeddings.md diff --git a/docs/docs/features/prompt-files.md b/docs/docs/features/prompt-files.md new file mode 100644 index 000000000..4fb8abfce --- /dev/null +++ b/docs/docs/features/prompt-files.md @@ -0,0 +1,87 @@ +# Prompt files (experimental) + +Prompt files provide a convenient way to standardize common patterns and share a collection of LLM prompts with your team. They make it easy to build and use these prompts. + +## Quick start + +:::tip[Prompt library] +To assist you in getting started, [we've curated a small library of `.prompt` files](https://github.com/continuedev/prompt-file-examples). We encourage community contributions to this repository, so please consider opening up a pull request with your own prompts! +::: + +Below is a quick example of setting up a prompt file to write unit tests using Jest. + +1. Create a folder called `.prompts/` at the top level of your workspace. +2. Add a file called `test.prompt` to this folder. The name of this file will be the name of the slash command you will use to generate your prompt. +3. Write the following contents to `test.prompt` and save. + +``` +temperature: 0.5 +maxTokens: 4096 +--- + +You are an expert programmer + + +{{{ input }}} + +Write unit tests for the above selected code, following each of these instructions: +- Use `jest` +- Properly set up and tear down +- Include important edge cases +- The tests should be complete and sophisticated +- Give the tests just as chat output, don't edit any file +- Don't explain how to set up `jest` +``` + +Now to use this prompt, you can highlight code and use `cmd/ctrl+L` to select it in the Continue sidebar. + +Then, type "/" to see the list of slash commands and choose the one called "test". Press enter and the LLM will respond given the instructions from your prompt file. + +## Format + +The format is inspired by [HumanLoops's .prompt file](https://docs.humanloop.com/docs/prompt-file-format), with additional templating to use context providers and built-in variables using [Handlebars syntax](https://handlebarsjs.com/guide/). + +:::info +The current state of this format is experimental and subject to change +::: + +### Preamble + +The "preamble" is everything above the `---` separator, and lets you specify model parameters. It uses YAML syntax and currently supports the following parameters: + +- `name` +- `temperature` +- `topP` +- `topK` +- `minP` +- `presencePenalty` +- `frequencyPenalty` +- `mirostat` +- `stop` +- `maxTokens` +- `description` + +If you don't need any of these parameters, you can leave out the preamble and do not need to include the `---` separator. + +### System message + +To add a system message, start the body with `` tags like in the example above and place your system message inside. + +### Built-in variables + +The following built-in variables are currently available: + +- `{{{ input }}}` - The full text from the input box in the sidebar that is sent along with the slash command +- `{{{ currentFile }}}` - The currently open file in your IDE +- `{{{ ./path/to/file.js }}}` - Any file can be directly referenced + +### Context providers + +Any [context provider](../customization/context-providers.md) that you have added to your config can be referenced using the name of the context provider. Context providers that receive an input are also supported. + +- `{{{ terminal }}}` - The contents of the terminal +- `{{{ url "https://github.com/continuedev/continue" }}}` - The contents of a URL + +## Feedback + +If you have ideas about how to improve the `.prompt` file format, please reach out on [Discord](https://discord.gg/NWtdYexhMs). diff --git a/docs/docs/walkthroughs/quick-actions.md b/docs/docs/features/quick-actions.md similarity index 98% rename from docs/docs/walkthroughs/quick-actions.md rename to docs/docs/features/quick-actions.md index 7c6ce8887..a59f8e960 100644 --- a/docs/docs/walkthroughs/quick-actions.md +++ b/docs/docs/features/quick-actions.md @@ -5,8 +5,6 @@ keywords: [experimental, automate, configuration] toc_max_heading_level: 5 --- -## Quick Actions (experimental, VS Code only) - Quick Actions streamline your development workflow by providing a tool to quickly select an entire class or function to perform a quick edit on. Configure custom actions to execute complex operations with a single click. ![Quick actions example](/img/quick-actions-demo.gif) diff --git a/docs/docs/walkthroughs/tab-autocomplete.md b/docs/docs/features/tab-autocomplete.md similarity index 99% rename from docs/docs/walkthroughs/tab-autocomplete.md rename to docs/docs/features/tab-autocomplete.md index 1aef6cb6b..008358776 100644 --- a/docs/docs/walkthroughs/tab-autocomplete.md +++ b/docs/docs/features/tab-autocomplete.md @@ -136,7 +136,7 @@ Follow these steps to ensure that everything is set up correctly: 2. Make sure you have downloaded Ollama. 3. Run `ollama run starcoder2:3b` to verify that the model is downloaded. 4. Make sure that any other completion providers are disabled (e.g. Copilot), as they may interfere. -5. Check the output of the logs to find any potential errors (cmd/ctrl+shift+p -> "Toggle Developer Tools" -> "Console" tab in VS Code, ~/.continue/core.log in JetBrains). +5. Check the output of the logs to find any potential errors (cmd/ctrl+shift+p -> "Toggle Developer Tools" -> "Console" tab in VS Code, ~/.continue/logs/core.log in JetBrains). 6. Check VS Code settings to make sure that `"editor.inlineSuggest.enabled"` is set to `true` (use cmd/ctrl+, then search for this and check the box) 7. If you are still having issues, please let us know in our [Discord](https://discord.gg/vapESyrFmJ) and we'll help as soon as possible. diff --git a/docs/docs/features/talk-to-your-docs.md b/docs/docs/features/talk-to-your-docs.md new file mode 100644 index 000000000..d1088b4ea --- /dev/null +++ b/docs/docs/features/talk-to-your-docs.md @@ -0,0 +1,84 @@ +--- +title: Talk To Your Docs +description: Learn how to access and search your project's documentation directly within Continue +keywords: [documentation, indexing, context provider, embeddings] +toc_max_heading_level: 5 +--- + +The [`@docs` context provider](http://localhost:3000/customization/context-providers#documentation) allows you to interact with your documentation directly within Continue. This feature enables you to index any static site or GitHub markdown pages, making it easier to access and utilize your documentation while coding. + +## Enabling the `@docs` context provider + +To enable the `@docs` context provider, you need to add it to the list of context providers in your `config.json` file. + +```json +{ + "contextProviders": [ + { "name": "docs" } + ... + ] +} +``` + +## How It Works + +The `@docs` context provider works by crawling specified documentation sites, generating embeddings, and storing them locally for you. This process allows for quick and efficient access to your documentation content. + +1. We crawl the specified documentation site +2. Generate embeddings for the content +3. Store the embeddings locally on your machine +4. Provide access to the indexed content through the `@docs` context provider + +## Pre-indexed Documentation Sites + +We offer a selection of pre-indexed documentation sites for popular frameworks and libraries. You can view the list of [available pre-indexed sites and request additions here](https://github.com/continuedev/continue/blob/main/core/indexing/docs/preIndexedDocs.ts). + +## Indexing Your Own Documentation + +### Through the `@docs` Context Provider + +To add a single documentation site, we recommend going through the `@docs` context provider. + +1. Type `@docs` in the chat panel, hit enter +2. Type "add" and select the "Add Docs" option +3. Enter the required information into the dialog + +Indexing will begin upon submission. + +### Through `config.json` + +To add multiple documentation sites, we recommend adding them in bulk to your `config.json` file. Indexing will kick off upon file save. + +The configuration schema is as follows: + +```json +"docs": [ + { + "title": "Continue", + "startUrl": "https://docs.continue.dev/intro", + "rootUrl": "https://docs.continue.dev", + "faviconUrl": "https://docs.continue.dev/favicon.ico", + "maxDepth": 3 + } +] +``` + +- `title`: The name of the documentation site, used for identification in the UI. +- `startUrl`: The URL where the indexing process should begin. +- `rootUrl`: The base URL of the documentation site, used to determine which pages to index. +- `faviconUrl`: The URL of the site's favicon, used for visual identification in the UI. +- `maxDepth`: The maximum number of levels deep the indexer should crawl from the start URL. + +## FAQ + +### Why did my documentation site fail to index? + +Our current crawler is designed to work with static websites and may encounter issues with dynamic or JavaScript-heavy sites. If your documentation site failed to index, it's possible that it contains non-static elements that our crawler couldn't process. + +If you're experiencing issues with indexing a documentation site, please let us know. We're continuously improving our indexing capabilities and would appreciate your feedback to help us enhance the feature. + +Report Indexing Issues on Discord + +### How often is the indexed content updated? + +Currently we do not automatically re-index your docs. If you would like to force a re-index, you can use the following command: `Continue: Docs Force Re-Index`. diff --git a/docs/docs/how-to-use-continue.md b/docs/docs/how-to-use-continue.md index eb6a51fb0..8cbd23216 100644 --- a/docs/docs/how-to-use-continue.md +++ b/docs/docs/how-to-use-continue.md @@ -1,67 +1,85 @@ --- -title: 🧑‍🎓 How to use Continue -description: Using LLMs as you code with Continue +title: How to Use Continue +description: Utilizing LLMs (Large Language Models) as you code with Continue keywords: [how to, edit, refactor, boilerplate, context] --- -# 🧑‍🎓 How to use Continue +Continue is an advanced tool designed to help you integrate the power of Large Language Models (LLMs) seamlessly into your coding environment, providing assistance with understanding code, generating boilerplate, refactoring, and much more. Below are detailed instructions on how you can make the most out of Continue across different integrated development environments (IDEs) like VS Code and JetBrains. -## Easily understand code sections +## Easily Understand Code Sections + +If you ever find yourself puzzled by a piece of code, Continue can help break it down for you. This feature gives you a clear and concise explanation which can significantly speed up the debugging and understanding process. + +- **VS Code**: Press `cmd+L` (MacOS) or `ctrl+L` (Windows) to get insights into the current code section you are working on. +- **JetBrains**: Utilize the same feature with `cmd+J` (MacOS) or `ctrl+J` (Windows). ![understand](/img/understand.gif) -- VS Code: `cmd+L` (MacOS) / `ctrl+L` (Windows) -- JetBrains: `cmd+J` (MacOS) / `ctrl+J` (Windows) +## Tab to Autocomplete Code Suggestions -## Tab to autocomplete code suggestions +Autocomplete can save you time by predicting and inserting code snippets. Continue enhances this feature by using AI to offer smarter autocomplete suggestions tailored to your context. + +- **VS Code**: Simply press `tab` (MacOS) or `tab` (Windows) to autocomplete code suggestions. +- **JetBrains**: Similar functionality is available with the `tab` key on both MacOS and Windows. ![autocomplete](/img/autocomplete.gif) -- VS Code: `tab` (MacOS) / `tab` (Windows) -- JetBrains: `tab` (MacOS) / `tab` (Windows) +## Refactor Functions Where You are Coding -## Refactor functions where you are coding +Refactoring is a crucial part of maintaining and improving your code. With Continue, you can refactor functions right where you are coding, ensuring seamless transitions and minimal interruptions. + +- **VS Code**: Press `cmd+I` (MacOS) or `ctrl+I` (Windows) to refactor in place. +- **JetBrains**: Trigger the same action using `cmd+I` (MacOS) or `ctrl+I` (Windows). ![inline](/img/inline.gif) -- VS Code: `cmd+I` (MacOS) / `ctrl+I` (Windows) -- JetBrains: `cmd+I` (MacOS) / `ctrl+I` (Windows) +## Ask Questions About Your Codebase -## Ask questions about your codebase +Continue allows you to ask questions about your entire codebase, which can be extremely useful for getting quick answers and making informed decisions. + +- **VS Code**: Type `@codebase` followed by your query (works on both MacOS and Windows). +- **JetBrains**: This feature will be available soon. ![codebase](/img/codebase.gif) -- VS Code: `@codebase` (MacOS) / `@codebase` (Windows) -- JetBrains: Support coming soon +## Quickly Use Documentation as Context -## Quickly use documentation as context +Documentation can often be complex and time-consuming to scroll through. Continue can fetch the relevant sections for you, allowing you to use documentation as context efficiently. + +- **VS Code**: Use the `@docs` command (available on both MacOS and Windows). +- **JetBrains**: The same functionality is available using `@docs` on both MacOS and Windows. ![docs](/img/docs.gif) -- VS Code: `@docs` (MacOS) / `@docs` (Windows) -- JetBrains: `@docs` (MacOS) / `@docs` (Windows) +## Kick Off Actions with Slash Commands -## Kick off actions with slash commands +Slash commands in Continue enable you to perform various actions quickly and efficiently without having to leave your coding environment. + +- **VS Code**: Start commands with a `/` (works on both MacOS and Windows) like `/edit`. +- **JetBrains**: Support the use of slash commands by typing `/edit` on MacOS or Windows. ![slash](/img/slash.gif) -- VS Code: `/edit` (MacOS) / `/edit` (Windows) -- JetBrains: `/edit` (MacOS) / `/edit` (Windows) +Learn more about slash commands [here](./customization/slash-commands.md). -Learn more about slash commands [here](./customization/slash-commands.md) +## Add Classes, Files, and More to Context -## Add classes, files, and more to context +Context switching can disrupt your workflow. Continue allows you to add classes, files, and more to your current context, allowing you to see everything you need in one place. + +- **VS Code**: Use the `@files` command (available on both MacOS and Windows) for this purpose. +- **JetBrains**: This feature can also be utilized using `@files` on MacOS and Windows. ![classes](/img/classes.gif) -- VS Code: `@files` (MacOS) / `@files` (Windows) -- JetBrains: `@files` (MacOS) / `@files` (Windows) - Learn more about context providers [here](./customization/context-providers.md). -## Understand terminal errors immediately +## Understand Terminal Errors Immediately + +One of the most frustrating parts of coding is deciphering terminal errors. Continue can help you understand these errors instantly, reducing downtime and confusion. + +- **VS Code**: Press `cmd+shift+R` (MacOS) or `ctrl+shift+R` (Windows) for instant error explanations. +- **JetBrains**: This feature will be supported soon. ![error](/img/error.gif) -- VS Code: `cmd+shift+R` (MacOS) / `ctrl+shift+R` (Windows) -- JetBrains: Support coming soon \ No newline at end of file +By following these extended and detailed instructions, you can significantly improve your coding efficiency and debug processes using Continue. Happy coding! diff --git a/docs/docs/install/jetbrains.md b/docs/docs/install/jetbrains.md new file mode 100644 index 000000000..3ff9ac1fc --- /dev/null +++ b/docs/docs/install/jetbrains.md @@ -0,0 +1,110 @@ +--- +title: Installing Continue in JetBrains IDEs +description: Instructions for installing the Continue extension in JetBrains IDEs +keywords: [install, setup, jetbrains, plugin, continue, intellij, pycharm, webstorm] +--- + +## Prerequisites + +Ensure you have a compatible [JetBrains IDE](https://www.jetbrains.com/products/) installed. Continue is compatible with: + +- IntelliJ IDEA (Ultimate, Community) +- Android Studio +- AppCode +- Aqua +- CLion +- DataGrip +- DataSpell +- GoLand +- PhpStorm +- PyCharm (Professional, Community) +- Rider +- RubyMine +- RustRover +- WebStorm +- Writerside + +## Installation Options + +There are three ways to install the Continue extension in JetBrains IDEs: + +1. Install from JetBrains Marketplace within the IDE +2. Manual Installation from JetBrains Marketplace website +3. Manual Installation using ZIP from GitHub Releases + +Choose the method that best suits your preference and setup. Each option is detailed below. + +### Option 1: Install from JetBrains Marketplace within the IDE + +1. Open your JetBrains IDE. +2. Open the Settings/Preferences dialog (Ctrl+Alt+S on Windows/Linux, ⌘, on macOS). +3. Navigate to "Plugins" in the left sidebar. +4. Click on the "Marketplace" tab. +5. Search for "Continue" in the search bar. +6. Click the "Install" button next to the Continue plugin. +7. Restart your IDE when prompted to complete the installation. + +### Option 2: Manual Installation from JetBrains Marketplace website + +1. Visit the [Continue plugin page on the JetBrains Marketplace](https://plugins.jetbrains.com/plugin/22707-continue). +2. Click the "Get" button on the page. +3. Select your IDE from the list and click "Download". +4. Open your JetBrains IDE. +5. Open the Settings/Preferences dialog (Ctrl+Alt+S on Windows/Linux, ⌘, on macOS). +6. Navigate to "Plugins" in the left sidebar. +7. Click the gear icon and select "Install Plugin from Disk...". +8. Navigate to the downloaded plugin file and select it. +9. Restart your IDE when prompted to complete the installation. + +### Option 3: Manual Installation using ZIP from GitHub Releases + +1. Visit the [Continue GitHub releases page](https://github.com/continuedev/continue/releases). +2. Find the latest release and download the JetBrains ZIP file (e.g., `continue-jetbrains-[version].zip`). +3. Open your JetBrains IDE. +4. Open the Settings/Preferences dialog (Ctrl+Alt+S on Windows/Linux, ⌘, on macOS). +5. Navigate to "Plugins" in the left sidebar. +6. Click the gear icon and select "Install Plugin from Disk...". +7. Navigate to the downloaded ZIP file and select it. +8. Restart your IDE when prompted to complete the installation. + +## Post-Installation Setup + +1. After installation and IDE restart, you'll see the Continue icon in the right toolbar. +2. Click it to open the Continue tool window. + +![jetbrains-quickstart](/img/jetbrains-quickstart.png) + +## Getting Started with Continue + +Now that you've successfully installed Continue, you're ready to enhance your coding experience. Here's a quick summary of what you can do: + +1. **Open the Continue tool window**: Click the Continue icon in the right toolbar to access the extension's features. +2. **Start a conversation**: Use the chat interface to ask questions, get code suggestions, or request explanations. +3. **Explore features**: Familiarize yourself with Continue's features to streamline your workflow. +4. **Customize settings**: Adjust the plugin's settings to suit your preferences and coding style. + +For more detailed information on using Continue, check out our [user guide](../how-to-use-continue.md). + +## Pre-release Version (Optional) + +The Continue plugin for JetBrains IDEs offers a pre-release version through their Early Access Program (EAP) channel. To access the latest EAP version: + +1. Open your JetBrains IDE. +2. Open the Settings/Preferences dialog (Ctrl+Alt+S on Windows/Linux, ⌘, on macOS). +3. Navigate to "Plugins" in the left sidebar. +4. Click the gear icon at the top of the Plugins page. +5. Select "Manage Plugin Repositories...". +6. In the dialog that opens, add the URL to the list: `https://plugins.jetbrains.com/plugins/eap/list` +7. Click "OK" to save the changes. + +After adding the EAP channel, you'll be able to download the latest pre-release version of Continue from the marketplace. To install or update to the EAP version: + +1. Go back to the Plugins page in Settings/Preferences. +2. Search for "Continue" in the marketplace. +3. You should see the EAP version available. Click "Install" or "Update" to get the latest pre-release version. + +Remember that EAP versions may contain experimental features and could be less stable than the regular releases. + +## Troubleshooting + +If you encounter any issues, please refer to our [troubleshooting guide](../troubleshooting.md) or ask for help in [our Discord community](https://discord.gg/NWtdYexhMs). diff --git a/docs/docs/install/vscode.md b/docs/docs/install/vscode.md new file mode 100644 index 000000000..10114d9f1 --- /dev/null +++ b/docs/docs/install/vscode.md @@ -0,0 +1,77 @@ +--- +title: Installing Continue in VS Code +description: Instructions for installing the Continue extension in Visual Studio Code +keywords: [install, setup, vscode, extension, continue, vsix] +--- + +## Prerequisites + +Ensure you have Visual Studio Code installed. If not, download and install it from the [Visual Studio Code download page](https://code.visualstudio.com/download). + +## Installation Options + +There are three ways to install the Continue extension in Visual Studio Code: + +1. Install from VS Code Marketplace (Web) +2. Install from VS Code Extensions Marketplace +3. Manual Installation using VSIX + +Choose the method that best suits your preference and setup. Each option is detailed below. + +### Option 1: Install from VS Code Marketplace (Web) + +1. Visit the [Continue extension page on the Visual Studio Marketplace](https://marketplace.visualstudio.com/items?itemName=Continue.continue). +2. Click the `Install` button on the page. +3. This will open VS Code (if it's not already open) and take you to the extension page within VS Code. +4. Click `Install` in VS Code to complete the installation. + +### Option 2: Install from VS Code Extensions Marketplace + +1. Open Visual Studio Code. +2. Navigate to the Extensions view (Ctrl+Shift+X or Cmd+Shift+X). +3. Search for "Continue" in the marketplace. +4. Click `Install` next to the Continue extension. + +### Option 3: Manual Installation using VSIX + +1. Download the latest VSIX package from the [Continue GitHub repository](https://github.com/continuedev/continue/releases). +2. In VS Code, go to Extensions view. +3. Click on the "..." menu at the top of the Extensions sidebar. +4. Select `Install from VSIX...`. +5. Navigate to the downloaded VSIX file and select it. + +## Post-Installation Setup + +1. After installation, you'll see the Continue logo in the left sidebar. +2. Click it to open the Continue extension. +3. We recommend moving Continue to VS Code's right sidebar: + +![move-to-right-sidebar](/img/move-to-right-sidebar.png) + +This keeps the file explorer accessible while using Continue. + +## Getting Started with Continue + +Now that you've successfully installed Continue, you're ready to enhance your coding experience. Here's a quick summary of what you can do: + +1. **Open the Continue sidebar**: Click the Continue logo in the sidebar to access the extension's features. +2. **Start a conversation**: Use the chat interface to ask questions, get code suggestions, or request explanations. +3. **Explore commands**: Familiarize yourself with Continue's commands to streamline your workflow. +4. **Customize settings**: Adjust the extension's settings to suit your preferences and coding style. + +For more detailed information on using Continue, check out our [user guide](../how-to-use-continue.md). + +## Pre-release Version (Optional) + +The VS Code Continue extension is currently in beta. A pre-release version is available with the latest fixes and features. To install the pre-release version: + +1. Open Visual Studio Code. +2. Navigate to the Extensions view (Ctrl+Shift+X or Cmd+Shift+X). +3. Search for "Continue" in the installed extensions. +4. Select `Switch to Pre-release Version` from the menu. + +![Pre-Release](../../static/img/prerelease.png) + +## Troubleshooting + +If you encounter any issues, please refer to our [troubleshooting guide](.././troubleshooting.md) or ask for help in [our Discord community](https://discord.gg/NWtdYexhMs). diff --git a/docs/docs/intro.md b/docs/docs/intro.md index e21f85be8..4fed466be 100644 --- a/docs/docs/intro.md +++ b/docs/docs/intro.md @@ -1,24 +1,36 @@ --- -title: 💻 Introduction -description: Continue is the open-source autopilot for software development -keywords: [introduction, intro, continue, autopilot, chatgpt] +title: Introduction +description: The open-source AI code assistant for developers +keywords: [continue, AI, code assistant, autocomplete, chat, VS Code, JetBrains] --- -# 💻 Introduction +![Continue Logo](/img/intro.png) -![continue-cover-logo](/img/intro.png) +## The Open-Source AI Code Assistant -**Continue is the leading open-source AI code assistant. You can connect any models and any context to build custom autocomplete and chat experiences inside [VS Code](https://marketplace.visualstudio.com/items?itemName=Continue.continue) and [JetBrains](https://plugins.jetbrains.com/plugin/22707-continue-extension)** +Continue is the leading open-source AI code assistant, designed to enhance your development workflow. It seamlessly integrates with popular IDEs like [VS Code](https://marketplace.visualstudio.com/items?itemName=Continue.continue) and [JetBrains](https://plugins.jetbrains.com/plugin/22707-continue-extension), providing custom autocomplete and chat experiences. -Some examples of what you can achieve are: +### Key Features -- [Easily understand code sections](how-to-use-continue.md#easily-understand-code-sections) -- [Tab to autocomplete code suggestions](how-to-use-continue.md#tab-to-autocomplete-code-suggestions) -- [Refactor functions where you are coding](how-to-use-continue.md#refactor-functions-where-you-are-coding) -- [Ask questions about your codebase](how-to-use-continue.md#ask-questions-about-your-codebase) -- [Quickly use documentation as context](how-to-use-continue.md#quickly-use-documentation-as-context) -- [Kick off actions with slash commands](how-to-use-continue.md#kick-off-actions-with-slash-commands) -- [Add classes, files, and more to context](how-to-use-continue.md#add-classes-files-and-more-to-context) -- [Understand terminal errors immediately](how-to-use-continue.md#understand-terminal-errors-immediately) +- **Flexible Model Integration**: Use any AI model, whether open-source or commercial, local or remote. +- **Versatile Applications**: Ideal for chat, autocomplete, and embeddings. +- **Highly Customizable**: Configure to fit your existing workflows. -Continue enables you to use the right model for the job, whether it's open-source or commercial, running local or remote, and used for chat, autocomplete, or embeddings. And we provide numerous points of configuration, so that you can customize the extension to fit into your existing workflows. +### What You Can Do with Continue + +1. [Understand code sections easily](how-to-use-continue.md#easily-understand-code-sections) +2. [Autocomplete code with tab](how-to-use-continue.md#tab-to-autocomplete-code-suggestions) +3. [Refactor functions in-place](how-to-use-continue.md#refactor-functions-where-you-are-coding) +4. [Query your codebase](how-to-use-continue.md#ask-questions-about-your-codebase) +5. [Leverage documentation as context](how-to-use-continue.md#quickly-use-documentation-as-context) +6. [Use slash commands for quick actions](how-to-use-continue.md#kick-off-actions-with-slash-commands) +7. [Add various elements to context](how-to-use-continue.md#add-classes-files-and-more-to-context) +8. [Instantly understand terminal errors](how-to-use-continue.md#understand-terminal-errors-immediately) + +Explore these features to supercharge your development process with Continue! + +## See Continue in Action + +
+ +
diff --git a/docs/docs/reference/Model Providers/anthropicllm.md b/docs/docs/reference/Model Providers/anthropicllm.md index 309f29ab2..a29bf34a9 100644 --- a/docs/docs/reference/Model Providers/anthropicllm.md +++ b/docs/docs/reference/Model Providers/anthropicllm.md @@ -16,3 +16,24 @@ To setup Anthropic, obtain an API key from [here](https://www.anthropic.com/api) ``` [View the source](https://github.com/continuedev/continue/blob/main/core/llm/llms/Anthropic.ts) + +## Prompt caching + +Anthropic supports [prompt caching with Claude](https://docs.anthropic.com/en/docs/build-with-claude/prompt-caching). + +Currently, we only allow caching of the system message. To enable this feature, update your your model configuration with `"cacheSystemMessage": true`: + +```json +{ + "models": [ + { + // Enable prompt caching + "cacheSystemMessage": true, + "title": "Anthropic", + "provider": "anthropic", + "model": "claude-3-5-sonnet-20240620", + "apiKey": "YOUR_API_KEY" + } + ] +} +``` diff --git a/docs/docs/reference/Model Providers/assets/Watsonx1.gif b/docs/docs/reference/Model Providers/assets/Watsonx1.gif new file mode 100644 index 000000000..e37443ad6 Binary files /dev/null and b/docs/docs/reference/Model Providers/assets/Watsonx1.gif differ diff --git a/docs/docs/reference/Model Providers/azure.md b/docs/docs/reference/Model Providers/azure.md index c6c7219f0..7ae359910 100644 --- a/docs/docs/reference/Model Providers/azure.md +++ b/docs/docs/reference/Model Providers/azure.md @@ -20,7 +20,16 @@ You can configure Azure OpenAI service through the UI, or you can configure it m "apiBase": "", "engine": "", "apiVersion": "", - "apiType": "azure", + "apiType": "openai", "apiKey": "" }] ``` + +To find out the information from _Azure AI Studio_, select the model that you would like to connect. Under the _Endpoint_ section and capture the Target URI. +For example, Target URI of https://just-an-example.openai.azure.com/openai/deployments/gpt-4o/chat/completions?api-version=2023-13-15-preview +Maps to: + +- model = gpt-4o +- engine = gpt-4o +- apiVersion = 2023-13-15-preview +- apiBase = just-an-example.openai.azure.com diff --git a/docs/docs/reference/Model Providers/bedrock.md b/docs/docs/reference/Model Providers/bedrock.md index daac562af..d720de66f 100644 --- a/docs/docs/reference/Model Providers/bedrock.md +++ b/docs/docs/reference/Model Providers/bedrock.md @@ -1,4 +1,4 @@ -# AWS Bedrock +# AWS Bedrock To setup Bedrock, add the following to your `config.json` file: @@ -9,18 +9,19 @@ To setup Bedrock, add the following to your `config.json` file: "title": "Bedrock: Claude 3 Sonnet", "provider": "bedrock", "model": "anthropic.claude-3-sonnet-20240229-v1:0", - "region": "us-east-1" + "region": "us-east-1", + "profile": "bedrock", } ] } ``` -Authentication will be through temporary or long-term credentials in -~/.aws/credentials under a profile called "bedrock". +Authentication will be through temporary or long-term credentials in +~/.aws/credentials under a configured profile (e.g. "bedrock"). ```title="~/.aws/credentials [bedrock] aws_access_key_id = abcdefg aws_secret_access_key = hijklmno -aws_session_token = pqrstuvwxyz # Optional: means short term creds. +aws_session_token = pqrstuvwxyz # Optional: means short term creds. ``` diff --git a/docs/docs/reference/Model Providers/bedrockimport.md b/docs/docs/reference/Model Providers/bedrockimport.md new file mode 100644 index 000000000..6a8c50d68 --- /dev/null +++ b/docs/docs/reference/Model Providers/bedrockimport.md @@ -0,0 +1,28 @@ +# AWS Bedrock Custom Imported Models + +To setup Bedrock using custom imported models, add the following to your `config.json` file: + +```json title="~/.continue/config.json" +{ + "models": [ + { + "title": "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" + } + ] +} +``` + +Authentication will be through temporary or long-term credentials in +~/.aws/credentials under a configured profile (e.g. "bedrock"). + +```title="~/.aws/credentials +[bedrock] +aws_access_key_id = abcdefg +aws_secret_access_key = hijklmno +aws_session_token = pqrstuvwxyz # Optional: means short term creds. +``` diff --git a/docs/docs/reference/Model Providers/kindo.md b/docs/docs/reference/Model Providers/kindo.md new file mode 100644 index 000000000..442e30b10 --- /dev/null +++ b/docs/docs/reference/Model Providers/kindo.md @@ -0,0 +1,42 @@ +# Kindo +Kindo offers centralized control over your organization's AI operations, ensuring data protection and compliance with internal policies while supporting various commercial and open-source models. To get started, sign up [here](https://app.kindo.ai/), create your API key on the [API keys page](https://app.kindo.ai/settings/api), and choose a model from the list of supported models in the [plugins tab](https://app.kindo.ai/plugins). + +## Config Example + +```json title="~/.continue/config.json" +{ + "models": [ + { + "title": "Claude 3.5 Sonnet", + "provider": "kindo", + "model": "claude-3-5-sonnet-20240620", + "apiKey": "" + } + ] +} +``` + +## Tab Autocomplete Config Example + +```json title="~/.continue/config.json" +{ + "tabAutocompleteModel": [ + { + "title": "WhiteRabbitNeo", + "provider": "kindo", + "model": "/models/WhiteRabbitNeo-33B-DeepSeekCoder", + "apiKey": "" + }, + { + "title": "DeepSeek", + "provider": "kindo", + "model": "deepseek-ai/deepseek-coder-33b-instruct", + "apiKey": "" + } + ] +} +``` + +## Security + +To update your organization's model access, adjust the controls in [security settings](https://app.kindo.ai/security-settings). \ No newline at end of file diff --git a/docs/docs/reference/Model Providers/llamafile.md b/docs/docs/reference/Model Providers/llamafile.md index 04d12aeff..cc969f8d8 100644 --- a/docs/docs/reference/Model Providers/llamafile.md +++ b/docs/docs/reference/Model Providers/llamafile.md @@ -14,6 +14,4 @@ A [llamafile](https://github.com/Mozilla-Ocho/llamafile#readme) is a self-contai } ``` -Optionally, you can set the `llamafile_command` property, which will be run to start the llamafile if it isn't already running on port 8080. Be sure to use an absolute path to the llamafile binary. For example: `/Users/yourusername/mistral-7b-instruct-v0.1-Q4_K_M-server.llamafile`. - [View the source](https://github.com/continuedev/continue/blob/main/core/llm/llms/Llamafile.ts) diff --git a/docs/docs/reference/Model Providers/openai.md b/docs/docs/reference/Model Providers/openai.md index 10c86206d..f19cd392c 100644 --- a/docs/docs/reference/Model Providers/openai.md +++ b/docs/docs/reference/Model Providers/openai.md @@ -12,13 +12,14 @@ OpenAI compatible servers - [LocalAI](https://localai.io/basics/getting_started/) - [llama-cpp-python](https://github.com/abetlen/llama-cpp-python#web-server) - [TensorRT-LLM](https://github.com/NVIDIA/trt-llm-as-openai-windows?tab=readme-ov-file#examples) +- [vLLM](https://docs.vllm.ai/en/latest/serving/openai_compatible_server.html) [^1] OpenAI compatible APIs - [Anyscale Endpoints](https://github.com/continuedev/deploy-os-code-llm#others) - [Anyscale Private Endpoints](https://github.com/continuedev/deploy-os-code-llm#anyscale-private-endpoints) -If you are [using an OpenAI compatible server / API](../../setup/select-provider#local), you can change the `apiBase` like this: +If you are [using an OpenAI compatible server / API](../../setup/model-providers.md#local), you can change the `apiBase` like this: ```json title="~/.continue/config.json" { @@ -40,4 +41,6 @@ To force usage of `chat/completions` instead of `completions` endpoint you can s "useLegacyCompletionsEndpoint": false ``` +[^1]: Use the [Vllm Model Provider](./vllm.md) instead. + [View the source](https://github.com/continuedev/continue/blob/main/core/llm/llms/OpenAI.ts) diff --git a/docs/docs/reference/Model Providers/openrouter.md b/docs/docs/reference/Model Providers/openrouter.md index 5f2558399..eabc291bb 100644 --- a/docs/docs/reference/Model Providers/openrouter.md +++ b/docs/docs/reference/Model Providers/openrouter.md @@ -2,14 +2,14 @@ OpenRouter is a unified interface for commercial and open-source models, giving you access to the best models at the best prices. You can sign up [here](https://openrouter.ai/signup), create your API key on the [keys page](https://openrouter.ai/keys), and then choose a model from the [list of supported models](https://openrouter.ai/models). -Change `~/.continue/config.json` to look like the following. Since OpenRouter is fully API compatible with OpenAI, it is recommended to stick with `"provider": "openai"`, even if they aren't necessarily the upstream provider. +Change `~/.continue/config.json` to look like the following. ```json title="~/.continue/config.json" { "models": [ { "title": "OpenRouter LLaMA 70 8B", - "provider": "openai", + "provider": "openrouter", "model": "meta-llama/llama-3-70b-instruct", "apiBase": "https://openrouter.ai/api/v1", "apiKey": "..." diff --git a/docs/docs/reference/Model Providers/sagemaker.md b/docs/docs/reference/Model Providers/sagemaker.md new file mode 100644 index 000000000..189818548 --- /dev/null +++ b/docs/docs/reference/Model Providers/sagemaker.md @@ -0,0 +1,30 @@ +# AWS SageMaker + +SageMaker provider support SageMaker endpoint deployed with [LMI](https://docs.djl.ai/docs/serving/serving/docs/lmi/index.html) + +To setup SageMaker, add the following to your `config.json` file: + +```json title="~/.continue/config.json" +{ + "models": [ + { + "title": "deepseek-6.7b-instruct", + "provider": "sagemaker", + "model": "lmi-model-deepseek-coder-xxxxxxx", + "region": "us-west-2" + }, + ] +} +``` + +The value in model should be the SageMaker endpoint name you deployed. + +Authentication will be through temporary or long-term credentials in +~/.aws/credentials under a profile called "sagemaker". + +```title="~/.aws/credentials +[sagemaker] +aws_access_key_id = abcdefg +aws_secret_access_key = hijklmno +aws_session_token = pqrstuvwxyz # Optional: means short term creds. +``` diff --git a/docs/docs/reference/Model Providers/textgenwebui.md b/docs/docs/reference/Model Providers/textgenwebui.md index f52e44219..1aee87049 100644 --- a/docs/docs/reference/Model Providers/textgenwebui.md +++ b/docs/docs/reference/Model Providers/textgenwebui.md @@ -7,7 +7,7 @@ TextGenWebUI is a comprehensive, open-source language model UI and local server. "models": [ { "title": "Text Generation WebUI", - "provider": "openai", + "provider": "text-gen-webui", "apiBase": "http://localhost:5000", "model": "MODEL_NAME" } diff --git a/docs/docs/reference/Model Providers/vllm.md b/docs/docs/reference/Model Providers/vllm.md new file mode 100644 index 000000000..71a5f3cba --- /dev/null +++ b/docs/docs/reference/Model Providers/vllm.md @@ -0,0 +1,22 @@ +# vLLM + +Run the OpenAI-compatible server by vLLM using `vllm serve`. See their [server documentation](https://docs.vllm.ai/en/latest/serving/openai_compatible_server.html) and the [engine arguments documentation](https://docs.vllm.ai/en/latest/models/engine_args.html). + +```shell +vllm serve NousResearch/Meta-Llama-3-8B-Instruct --max-model-len 1024 +``` + +The continue implementation uses [OpenAI](./openai.md) under the hood and automatically selects the available model. You only need to set the `apiBase` like this: + +```json title="~/.continue/config.json" +{ + "models": [ + { + "title": "My vLLM OpenAI-compatible server", + "apiBase": "http://localhost:8000/v1" + } + ] +} +``` + +[View the source](https://github.com/continuedev/continue/blob/main/core/llm/llms/Vllm.ts) diff --git a/docs/docs/reference/Model Providers/watsonx.md b/docs/docs/reference/Model Providers/watsonx.md new file mode 100644 index 000000000..9e2a345d4 --- /dev/null +++ b/docs/docs/reference/Model Providers/watsonx.md @@ -0,0 +1,38 @@ +# IBM watsonx + +watsonx, developed by IBM, offers a variety of pre-trained AI foundation models that can be used for natural language processing (NLP), computer vision, and speech recognition tasks. + +## Setup + +Accessing watsonx models can be done either through watsonx SaaS on IBM Cloud or using a dedicated watsonx.ai Software instance. + +### watsonx.ai SaaS - IBM Cloud + +To get started with watsonx SaaS, visit the [registration page](https://dataplatform.cloud.ibm.com/registration/stepone?context=wx). If you do not have an existing IBM Cloud account, you can sign up for a free trial. + +To authenticate to watsonx.ai SaaS with Continue, you will need to create a project and [setup an API key](https://www.ibm.com/docs/en/mas-cd/continuous-delivery?topic=cli-creating-your-cloud-api-key). Then, in continue: +- Set **watsonx URL** to your watsonx SaaS endpoint, e.g. `https://us-south.ml.cloud.ibm.com` for US South region. +- Set **watsonx Project ID** to your watsonx project ID. +- Set **watsonx API Key** to your watsonx API Key. + +### watsonx.ai Software + +To authenticate to your watsonx.ai Software instance with Continue, you can use either `username/password` or `ZenApiKey` method: +1. *Option 1* (Recommended): using `ZenApiKey` authentication: + - Set **watsonx URL** to your watsonx software endpoint, e.g. `https://cpd-watsonx.apps.example.com`. + - Set **watsonx Project ID** to your watsonx project ID. + - Set **watsonx API Key** to your watsonx Zen API Key. To generate it: + 1. Log in to the CPD web client. + 2. From the toolbar, click your avatar. + 3. Click **Profile and settings**. + 4. Click **API key** > **Generate new key**. + 5. Click **Generate**. + 6. Click **Copy** and save your key somewhere safe. You cannot recover this key if you lose it. + 7. Generate your ZenApiKey by running the following command in your preferred terminal: `echo ":" | base64`, replacing `` with your CPD username and `` with the API Key you just created. +2. *Option 2*: using `username/password` authentication: + - Set **watsonx URL** to your watsonx software endpoint, e.g. `https://cpd-watsonx.apps.example.com`. + - Set **watsonx Project ID** to your watsonx project ID. + - Set **watsonx API Key** to your watsonx Username and Password using `username:password` as format. + +## Usage +![usage-gif](../Model%20Providers/assets/watsonx1.gif) diff --git a/docs/docs/setup/configuration.md b/docs/docs/setup/configuration.md index 26965d87a..c5ff52f69 100644 --- a/docs/docs/setup/configuration.md +++ b/docs/docs/setup/configuration.md @@ -130,14 +130,14 @@ In `config.json`, you'll find the `models` property, a list of the models that y ```json "models": [ { - "title": "GPT-4", + "title": "GPT-4o", "provider": "free-trial", - "model": "gpt-4" + "model": "gpt-4o" }, { - "title": "GPT-3.5-Turbo", + "title": "GPT-4o Mini", "provider": "free-trial", - "model": "gpt-3.5-turbo" + "model": "gpt-4o-mini" } ] ``` @@ -322,3 +322,26 @@ export function modifyConfig(config: Config): Config { return config; } ``` + +## Customizing the LLM capability + +Sometimes when you use certain third-party interface providers, such as [one api](https://github.com/songquanpeng/one-api), [openRouter](https://openrouter.ai/), etc., they offer openai-compatible interfaces, but the model names are highly different. + +Continue cannot determine the capabilities of the model, whether it supports uploading images or files, etc. You can clearly inform Continue about the capabilities of the model. + +```typescript title="~/.continue/config.json" +{ + "models": [ + { + "title": "kimi", + "provider": "openai", + "model": "moonshot-kimi", + "contextLength": 8192, + "apiBase": "https://any-your-thrid-part-OpenAI-compatible-api-provider/v1", + "capabilities": { + "uploadImage": true + } + } + ] +} +``` diff --git a/docs/docs/setup/model-providers.md b/docs/docs/setup/model-providers.md index 8bce892ed..3175da802 100644 --- a/docs/docs/setup/model-providers.md +++ b/docs/docs/setup/model-providers.md @@ -18,6 +18,7 @@ keywords: Ollama, HuggingFace, AWS Bedrock, + AWS SageMaker, ] --- @@ -45,6 +46,8 @@ You can run a model on your local computer using: - [TensorRT-LLM](https://github.com/NVIDIA/trt-llm-as-openai-windows?tab=readme-ov-file#examples) (OpenAI compatible server) - [IPEX-LLM](../reference/Model%20Providers/ipex_llm.md) (Local LLM on Intel GPU) - [Msty](../reference/Model%20Providers/msty.md) +- [IBM watsonx](../reference/Model%20Providers/watsonx.md) +- [Nvidia NIMS](../reference/Model%20Providers/openai.md) (OpenAI compatible server) ### Remote @@ -60,6 +63,7 @@ You can deploy a model in your [AWS](https://github.com/continuedev/deploy-os-co You can access both open-source and commercial LLMs via: - [OpenRouter](../reference/Model%20Providers/openrouter.md) +- [Kindo](../reference/Model%20Providers/kindo.md) ### Open-source models @@ -73,6 +77,7 @@ You can run open-source LLMs with cloud services like: - [Deepinfra](../reference/Model%20Providers/deepinfra.md) - [Groq](../reference/Model%20Providers/openai.md) (OpenAI compatible API) - [AWS Bedrock](../reference/Model%20Providers/bedrock.md) +- [Nvidia NIMS](../reference/Model%20Providers/openai.md) (OpenAI compatible server) ### Commercial models @@ -83,7 +88,7 @@ You can use commercial LLMs via APIs using: - [Azure OpenAI Service](../reference/Model%20Providers/openai.md) - [Google Gemini API](../reference/Model%20Providers/geminiapi.md) - [Mistral API](../reference/Model%20Providers/mistral.md) -- [Voyage AI API](../walkthroughs/codebase-embeddings.md#openai) +- [Voyage AI API](../features/codebase-embeddings.md#openai) - [Cohere API](../reference/Model%20Providers/cohere.md) **In addition to selecting providers, you will need to figure out [what models to use](./select-model.md).** diff --git a/docs/docs/setup/overview.md b/docs/docs/setup/overview.md index d8c1bc8dc..23bae96cd 100644 --- a/docs/docs/setup/overview.md +++ b/docs/docs/setup/overview.md @@ -1,13 +1,54 @@ +--- +title: Overview +description: Get started with Continue and tailor it to your needs +keywords: [setup, customization, models, configuration, LLMs] +--- + # Overview -Continue gives you choice over what [Large Language Models (LLMs)](https://www.youtube.com/watch?v=zjkBMFhNj_g) you use. You can use it with commercial models like Claude 3 Opus via the Anthropic API, open-source models like Llama 3 running on your laptop with Ollama, and everything in between. +Continue is a flexible AI coding assistant that allows you to choose and customize your Large Language Models (LLMs). This guide will help you get started and make Continue work best for you. -When you first install Continue, you can try it out for free using a proxy server that securely makes calls with our API keys. Once you're ready to use your own API keys or different models / providers, you can add them to the `config.json`. +## Quick Start -You will need to decide which models and providers you use for [chat](select-model.md#chat), [autocomplete](select-model.md#autocomplete), and [embeddings](select-model.md#embeddings). +1. When you first install Continue, you can use it immediately with our free proxy server. +2. As you get familiar with Continue, you can set up your own API keys and customize your experience. -Learn more: +## Choosing Your Models -- [Configuration](configuration.md) -- [Model Providers](model-providers.md) -- [Select models](select-model.md) +Continue works with a variety of LLMs: + +- Commercial models (e.g., Claude 3 Opus via Anthropic API) +- Open-source models (e.g., Llama 3 running locally with Ollama) +- And many options in between + +You'll need to select models for three main functions: + +- [Chat](select-model.md#chat) +- [Autocomplete](select-model.md#autocomplete) +- [Embeddings](select-model.md#embeddings) + +## Customization Options + +Continue offers deep customization through `config.json` and `config.ts` files. These are located in: + +- MacOS: `~/.continue/` +- Windows: `%userprofile%\.continue` + +You can customize: + +1. [Basic Configuration](configuration.md) +2. [Model Providers](model-providers.md) +3. [Model Selection](select-model.md) +4. [Context Providers](../customization/context-providers.md) +5. [Slash Commands](../customization/slash-commands.md) +6. [Advanced Options](../reference/config.mdx) + +## Sharing Your Configuration + +To share your Continue setup with a team: + +1. Create a `.continuerc.json` file in your project's root directory. +2. Use the same JSON Schema as `config.json`. +3. This file will automatically apply on top of the local `config.json`. + +Get started with Continue today and shape it to fit your coding workflow perfectly! diff --git a/docs/docs/setup/select-model.md b/docs/docs/setup/select-model.md index 7f46fe6a8..f78e29339 100644 --- a/docs/docs/setup/select-model.md +++ b/docs/docs/setup/select-model.md @@ -21,10 +21,10 @@ _We currently recommend the following open-source models:_ - Unlimited GPU: `llama3-70b` - Limited GPU: `llama3-8B` -#### DeepSeek Coder from DeepSeek +#### DeepSeek Coder v2 from DeepSeek -- Unlimited GPU: `deepseek-coder-33b` -- Limited GPU: `deepseek-coder-6.7b` +- Unlimited GPU: `deepseek-coder-v2:236b` +- Limited GPU: `deepseek-coder-v2:16b` _You can also use other open-source chat models by adding them to your `config.json`._ @@ -38,7 +38,7 @@ _You can also use other open-source chat models by adding them to your `config.j #### GPT-4o from OpenAI - Unlimited budget: `gpt-4o` -- Limited budget: `gpt-3.5-turbo-0125` +- Limited budget: `gpt-4o-mini` #### Gemini Pro from Google @@ -49,7 +49,7 @@ _You can also use other commercial chat models by adding them to your `config.js ## Autocomplete -You likely want to use a model that is 1-15B parameters for autocomplete. +You likely want to use a model that is 1-15B parameters for autocomplete. You can read more about it [here](../features/tab-autocomplete.md#tab-autocomplete-beta) ### Commercial LLMs @@ -61,10 +61,10 @@ Our current recommendation for autocomplete, if you are able to choose any model _We currently recommend the following open-source models:_ -#### DeepSeek Coder from DeepSeek +#### DeepSeek Coder v2 from DeepSeek -- Unlimited GPU: `deepseek-coder-6.7b` -- Limited GPU: `deepseek-coder-1.3b` +- Unlimited GPU: `deepseek-coder-v2:16b` +- Limited GPU: `deepseek-coder:6.7b` or `deepseek-coder:1.3b` #### StarCoder 2 from Hugging Face @@ -75,7 +75,7 @@ _You can also use other autocomplete models by adding them to your `config.json` ## Embeddings -We recommend the following embeddings models, which are used for codebase retrieval as described [here](../walkthroughs/codebase-embeddings.md#embeddings-providers) +We recommend the following embeddings models, which are used for codebase retrieval as described [here](../features/codebase-embeddings.md#embeddings-providers) ### Open-source models diff --git a/docs/docs/telemetry.md b/docs/docs/telemetry.md index 886f129c8..144e8cd59 100644 --- a/docs/docs/telemetry.md +++ b/docs/docs/telemetry.md @@ -1,40 +1,53 @@ --- -title: 🦔 Telemetry -description: Continue collects anonymous usage information +title: Telemetry +description: Learn how Continue collects anonymous usage information and how you can opt out. keywords: [telemetry, anonymous, usage info, opt out] --- -# 🦔 Telemetry +# Telemetry ## Overview -Continue collects and reports **anonymous** usage information. +Continue collects and reports **anonymous** usage information to help us improve our product. This data enables us to understand user interactions and optimize the user experience effectively. You can opt out of telemetry collection at any time if you prefer not to share your usage information. -This data is essential to understanding how we should improve the product. You can opt out of it at any time. +We utilize [Posthog](https://posthog.com/), an open-source platform for product analytics, to gather and store this data. For transparency, you can review the implementation code [here](https://github.com/continuedev/continue/blob/main/gui/src/hooks/CustomPostHogProvider.tsx) or read our [official privacy policy](https://continue.dev/privacy). -We use [Posthog](https://posthog.com/), an open source platform for product analytics, to collect and store the data. You can review the code [here](https://github.com/continuedev/continue/blob/main/gui/src/hooks/CustomPostHogProvider.tsx), or review our official policy [here](https://continue.dev/privacy). +## Tracking Policy -## Tracking policy +All data collected by Continue is anonymized and stripped of personally identifiable information (PII) before being sent to PostHog. We are committed to maintaining the privacy and security of your data. -All data is anonymous and cleaned of PII before being sent to PostHog. +## What We Track -## What we track +The following usage information is collected and reported: -- Whether you accept or reject suggestions (never including the code or the prompt) -- The name of the model and command used -- The number of tokens generated -- The name of your OS and IDE -- Pageviews +- **Suggestion Interactions:** Whether you accept or reject suggestions (excluding the actual code or prompts involved). +- **Model and Command Information:** The name of the model and command used. +- **Token Metrics:** The number of tokens generated. +- **System Information:** The name of your operating system (OS) and integrated development environment (IDE). +- **Pageviews:** General pageview statistics. -## How to opt out +## How to Opt Out -The `~/.continue` directory contains a `config.json` file that looks like this: +You can disable anonymous telemetry by modifying the `config.json` file located in the `~/.continue` directory. This file typically includes the following entry: ```json title="~/.continue/config.json" { "allowAnonymousTelemetry": true, - ... } ``` -You can turn off anonymous telemetry by changing the value of `allowAnonymousTelemetry` to `false`. Alternatively, you can uncheck the "Continue: Telemetry Enabled" box in VS Code settings. +To opt out, change the value of `allowAnonymousTelemetry` to `false`. Alternatively, you can disable telemetry through your VS Code settings by unchecking the "Continue: Telemetry Enabled" box. + +### Steps to Disable Telemetry via Configuration File + +1. Open the `~/.continue/config.json` file in your text editor. +2. Locate the `"allowAnonymousTelemetry"` setting. +3. Change the value from `true` to `false`. +4. Save the file. + +### Steps to Disable Telemetry via VS Code Settings + +1. Open VS Code. +2. Navigate to `File` > `Preferences` > `Settings` (or use the keyboard shortcut `Ctrl+,` on Windows/Linux or `Cmd+,` on macOS). +3. In the search bar, type "Continue: Telemetry Enabled". +4. Uncheck the "Continue: Telemetry Enabled" checkbox. diff --git a/docs/docs/troubleshooting.md b/docs/docs/troubleshooting.md index f330345a7..44742c0de 100644 --- a/docs/docs/troubleshooting.md +++ b/docs/docs/troubleshooting.md @@ -1,12 +1,16 @@ --- -title: ❓ Troubleshooting +title: Troubleshooting description: Troubleshooting while waiting for help during beta / alpha testing keywords: [reload, delete, manually, logs, server, console] --- -# ❓ Troubleshooting +The Continue VS Code extension is currently in beta, and the JetBrains extension is in Alpha. If you are having trouble, please follow the steps below. -The Continue VS Code extension is currently in beta, and the Intellij extension is in Alpha. If you are having trouble, please follow the steps below. +1. [Check the logs](#check-the-logs) +2. [Try the latest pre-release](#download-the-latest-pre-release) +3. [Download an older version](#download-an-older-version) +4. [Resolve keyboard shortcut issues](#keyboard-shortcuts-not-resolving) +5. [Check FAQs for common issues](#faqs) ## Check the logs @@ -32,7 +36,7 @@ If you're getting a response from the LLM that doesn't seem to make sense, you c ### JetBrains -Open `~/.continue/core.log`. The most recent logs are found at the bottom of the file. +Open `~/.continue/logs/core.log`. The most recent logs are found at the bottom of the file. ## Download the latest pre-release @@ -49,7 +53,7 @@ On JetBrains, the "pre-release" happens through their Early Access Program (EAP) 1. Open JetBrains settings (cmd/ctrl+,) and go to "Plugins" 2. Click the gear icon at the top 3. Select "Manage Plugin Repositories..." -4. Add "https://plugins.jetbrains.com/plugins/eap/list" to the list +4. Add "[https://plugins.jetbrains.com/plugins/eap/list>](https://plugins.jetbrains.com/plugins/eap/list>)" to the list 5. You'll now always be able to download the latest EAP version from the marketplace ## Download an Older Version @@ -108,6 +112,12 @@ By default the Continue window is on the left side of VS Code, but it can be dra If you have entered a valid API key and model, but are still getting a 404 error from OpenAI, this may be because you need to add credits to your billing account. You can do so from the [billing console](https://platform.openai.com/settings/organization/billing/overview). If you just want to check that this is in fact the cause of the error, you can try adding $1 to your account and checking whether the error persists. +### Indexing issues + +If you are having persistent errors with indexing, our recommendation is to rebuild your index from scratch. Note that for large codebases this may take some time. + +This can be accomplished using the following command: `Continue: Rebuild codebase index`. + ## Still having trouble? -Create a GitHub issue [here](https://github.com/continuedev/continue/issues/new?assignees=&labels=bug&projects=&template=bug-report-%F0%9F%90%9B.md&title=), leaving the details of your problem, and we'll be able to more quickly help you out. +You can also join our Discord community [here](https://discord.gg/vapESyrFmJ) for additional support and discussions. Alternatively, you can create a GitHub issue [here](https://github.com/continuedev/continue/issues/new?assignees=&labels=bug&projects=&template=bug-report-%F0%9F%90%9B.md&title=), providing details of your problem, and we'll be able to help you out more quickly. diff --git a/docs/docs/walkthroughs/codellama.md b/docs/docs/walkthroughs/codellama.md deleted file mode 100644 index c6c583c79..000000000 --- a/docs/docs/walkthroughs/codellama.md +++ /dev/null @@ -1,103 +0,0 @@ ---- -title: Using Code Llama with Continue -description: How to use Code Llama with Continue -keywords: [code llama, meta, togetherai, ollama, replciate, fastchat, msty] ---- - -# Using Code Llama with Continue - -With Continue, you can use Code Llama as a drop-in replacement for GPT-4, either by running locally with Ollama, Msty, or GGML or through Replicate. - -If you haven't already installed Continue, you can do that [here](https://marketplace.visualstudio.com/items?itemName=Continue.continue). For more general information on customizing Continue, read [our customization docs](../customization/overview.md). - -## TogetherAI - -1. Create an account [here](https://api.together.xyz/signup) -2. Copy your API key that appears on the welcome screen -3. Update your Continue config file like this: - -```json title="~/.continue/config.json" -{ - "models": [ - { - "title": "Code Llama", - "provider": "together", - "model": "togethercomputer/CodeLlama-13b-Instruct", - "apiKey": "" - } - ] -} -``` - -## Ollama - -1. Download Ollama [here](https://ollama.ai/) (it should walk you through the rest of these steps) -2. Open a terminal and run `ollama run codellama` -3. Change your Continue config file like this: - -```json title="~/.continue/config.json" -{ - "models": [ - { - "title": "Code Llama", - "provider": "ollama", - "model": "codellama-7b" - } - ] -} -``` - -## Replicate - -1. Get your Replicate API key [here](https://replicate.ai/) -2. Change your Continue config file like this: - -```json title="~/.continue/config.json" -{ - "models": [ - { - "title": "Code Llama", - "provider": "replicate", - "model": "codellama-7b", - "apiKey": "" - } - ] -} -``` - -## FastChat API - -1. Setup the FastChat API (https://github.com/lm-sys/FastChat) to use one of the Codellama models on Hugging Face (e.g: codellama/CodeLlama-7b-Instruct-hf). -2. Start the OpenAI compatible API (ref: https://github.com/lm-sys/FastChat/blob/main/docs/openai_api.md). -3. Change your Continue config file like this: - -```json title="~/.continue/config.json" -{ - "models": [ - { - "title": "Code Llama", - "provider": "openai", - "model": "codellama-7b", - "apiBase": "http://localhost:8000/v1/" - } - ] -} -``` - -## Msty - -1. Download Msty [here](https://msty.app/) for your platform (Windows, Mac, or Linux) -2. Open the app and click "Setup Local AI". Optionally, download any model you want with just a click of a button from the Text Module page. -3. Change your Continue config file like this: - -```json title="~/.continue/config.json" -{ - "models": [ - { - "title": "Code Llama", - "provider": "msty", - "model": "codellama:7b" - } - ] -} -``` diff --git a/docs/docs/walkthroughs/llama3.1.md b/docs/docs/walkthroughs/llama3.1.md new file mode 100644 index 000000000..b7f919a9d --- /dev/null +++ b/docs/docs/walkthroughs/llama3.1.md @@ -0,0 +1,94 @@ +--- +title: Using Llama 3.1 with Continue +description: How to use Llama 3.1 with Continue +keywords: [llama, meta, togetherai, ollama, replicate] +--- + +# Using Llama 3.1 with Continue + +Continue makes it easy to code with the latest open-source models, including the entire Llama 3.1 family of models. + +If you haven't already installed Continue, you can do that [here for VS Code](https://marketplace.visualstudio.com/items?itemName=Continue.continue) or [here for JetBrains](https://plugins.jetbrains.com/plugin/22707-continue). For more general information on customizing Continue, read [our customization docs](../customization/overview.md). + +Below we share some of the easiest ways to get up and running, depending on your use-case. + +## Ollama + +Ollama is the fastest way to get up and running with local language models. We recommend trying Llama 3.1 8b, which is impressive for its size and will perform well on most hardware. + +1. Download Ollama [here](https://ollama.ai/) (it should walk you through the rest of these steps) +2. Open a terminal and run `ollama run llama3.1-8b` +3. Change your Continue config file like this: + +```json title="~/.continue/config.json" +{ + "models": [ + { + "title": "Llama 3.1 8b", + "provider": "ollama", + "model": "llama3.1-8b" + } + ] +} +``` + +## Groq + +Groq provides the fastest available inference for open-source language models, including the entire Llama 3.1 family. + +1. Obtain an API key [here](https://console.groq.com/keys) +2. Update your Continue config file like this: + +```json title="~/.continue/config.json" +{ + "models": [ + { + "title": "Llama 3.1 405b", + "provider": "groq", + "model": "llama3.1-405b", + "apiKey": "" + } + ] +} +``` + +## Together AI + +Together AI provides fast and reliable inference of open-source models. You'll be able to run the 405b model with good speed. + +1. Create an account [here](https://api.together.xyz/signup) +2. Copy your API key that appears on the welcome screen +3. Update your Continue config file like this: + +```json title="~/.continue/config.json" +{ + "models": [ + { + "title": "Llama 3.1 405b", + "provider": "together", + "model": "llama3.1-405b", + "apiKey": "" + } + ] +} +``` + +## Replicate + +Replicate makes it easy to host and run open-source AI with an API. + +1. Get your Replicate API key [here](https://replicate.ai/) +2. Change your Continue config file like this: + +```json title="~/.continue/config.json" +{ + "models": [ + { + "title": "Llama 3.1 405b", + "provider": "replicate", + "model": "llama3.1-405b", + "apiKey": "" + } + ] +} +``` diff --git a/docs/docs/walkthroughs/prompt-files.md b/docs/docs/walkthroughs/prompt-files.md deleted file mode 100644 index bb5c0f68f..000000000 --- a/docs/docs/walkthroughs/prompt-files.md +++ /dev/null @@ -1,77 +0,0 @@ -# Prompt files (experimental) - -Prompt (`.prompt`) files are an easy way to build and share LLM prompts with others. The format is inspired by [HumanLoops's .prompt file](https://docs.humanloop.com/docs/prompt-file-format), and adds templating so that you can easily refer to files, your current git diff, and eventually much more. - -## How to create a prompt file - -Below is a quick example of setting up a prompt file to write unit tests using Jest. - -1. Create a folder called `.prompts/` at the top level of your workspace. -2. Add a file called `test.prompt` to this folder. The name of this file will be the name of the slash command you will use to generate your prompt. -3. Write the following contents to `test.prompt` and save. - -``` -temperature: 0.5 -maxTokens: 4096 ---- - -You are an expert programmer - - -{{{ input }}} - -Write unit tests for the above selected code, following each of these instructions: -- Use `jest` -- Properly set up and tear down -- Include important edge cases -- The tests should be complete and sophisticated -- Give the tests just as chat output, don't edit any file -- Don't explain how to set up `jest` -``` - -Now to use this prompt, you can highlight code and use cmd/ctrl+L to select it in the Continue sidebar. Then, type "/" to see the list of slash commands and choose the one called "test". Press enter and the LLM will respond given the instructions from your prompt file. - -## Syntax - -> The current state of this format is experimental and subject to change - -### Preamble - -The "preamble" is everything above the `---` separator, and lets you specify model parameters. It uses YAML syntax and currently supports the following parameters: - -- `temperature` -- `topP` -- `topK` -- `minP` -- `presencePenalty` -- `frequencyPenalty` -- `mirostat` -- `stop` -- `maxTokens` -- `name` -- `description` - -If you don't need any of these parameters, you can leave out the preamble and do not need to include the `---` separator. - -### Body - -The "body" is everything below the `---` separator, and contains your prompt. - -At its most basic, the body can be just text. - -To add a system message, start the body with `` tags like in the example above and place your system message inside. - -The body also supports templating with [Handlebars syntax](https://handlebarsjs.com/guide/). The following variables are currently available: - -- `input`: The full text from the input box in the sidebar that is sent along with the slash command -- `currentFile`: The currently open file in your IDE - -#### Context providers - -The body of a .prompt file also supports any [context provider](../customization/context-providers.md) that you have added to your config by referencing the name of the context provider. - -For example, if you wanted to include the contents of the terminal in your prompt, then you would use `{{{terminal}}}` in your prompt file. If you wanted to use the "url" context provider to include the contents of https://github.com/continuedev/continue, you would use `{{{url "https://github.com/continuedev/continue"}}}`, where the second part is the argument to the context provider, separated by a space. - -## Feedback - -If you have ideas about how to improve the `.prompt` file format, please reach out on [Discord](https://discord.gg/NWtdYexhMs). diff --git a/docs/docusaurus.config.js b/docs/docusaurus.config.js index fc3dfaffa..006981beb 100644 --- a/docs/docusaurus.config.js +++ b/docs/docusaurus.config.js @@ -82,6 +82,12 @@ const config = { position: "left", label: "Docs", }, + { + type: "docSidebar", + sidebarId: "referenceSidebar", + position: "left", + label: "Reference", + }, { to: "https://github.com/continuedev/continue", label: "GitHub", @@ -189,6 +195,22 @@ const config = { from: "/setup/select-provider", to: "/setup/model-providers", }, + { + from: "/walkthroughs/codebase-embeddings", + to: "/features/codebase-embeddings", + }, + { + from: "/walkthroughs/tab-autocomplete", + to: "/features/tab-autocomplete", + }, + { + from: "/walkthroughs/prompt-files", + to: "/features/prompt-files", + }, + { + from: "/walkthroughs/quick-actions", + to: "/features/quick-actions", + }, ], }, ], diff --git a/docs/package-lock.json b/docs/package-lock.json index 68e4cd8fa..7387674fb 100644 --- a/docs/package-lock.json +++ b/docs/package-lock.json @@ -19,7 +19,8 @@ "react-dom": "^18.2.0" }, "devDependencies": { - "@docusaurus/module-type-aliases": "^3.2.1" + "@docusaurus/module-type-aliases": "^3.2.1", + "nodemon": "^3.1.4" }, "engines": { "node": ">=20.11.0" @@ -7534,6 +7535,12 @@ "node": ">= 4" } }, + "node_modules/ignore-by-default": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/ignore-by-default/-/ignore-by-default-1.0.1.tgz", + "integrity": "sha512-Ius2VYcGNk7T90CppJqcIkS5ooHUZyIQK+ClZfMfMNFEF9VSE73Fq+906u/CWu92x4gzZMWOwfFYckPObzdEbA==", + "dev": true + }, "node_modules/image-size": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/image-size/-/image-size-1.1.1.tgz", @@ -10569,6 +10576,55 @@ "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.14.tgz", "integrity": "sha512-y10wOWt8yZpqXmOgRo77WaHEmhYQYGNA6y421PKsKYWEK8aW+cqAphborZDhqfyKrbZEN92CN1X2KbafY2s7Yw==" }, + "node_modules/nodemon": { + "version": "3.1.4", + "resolved": "https://registry.npmjs.org/nodemon/-/nodemon-3.1.4.tgz", + "integrity": "sha512-wjPBbFhtpJwmIeY2yP7QF+UKzPfltVGtfce1g/bB15/8vCGZj8uxD62b/b9M9/WVgme0NZudpownKN+c0plXlQ==", + "dev": true, + "dependencies": { + "chokidar": "^3.5.2", + "debug": "^4", + "ignore-by-default": "^1.0.1", + "minimatch": "^3.1.2", + "pstree.remy": "^1.1.8", + "semver": "^7.5.3", + "simple-update-notifier": "^2.0.0", + "supports-color": "^5.5.0", + "touch": "^3.1.0", + "undefsafe": "^2.0.5" + }, + "bin": { + "nodemon": "bin/nodemon.js" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/nodemon" + } + }, + "node_modules/nodemon/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/nodemon/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/normalize-path": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", @@ -11739,6 +11795,12 @@ "node": ">= 0.10" } }, + "node_modules/pstree.remy": { + "version": "1.1.8", + "resolved": "https://registry.npmjs.org/pstree.remy/-/pstree.remy-1.1.8.tgz", + "integrity": "sha512-77DZwxQmxKnu3aR542U+X8FypNzbfJ+C5XQDk3uWjWxn6151aIMGthWYRXTqT1E5oJvg+ljaa2OJi+VfvCOQ8w==", + "dev": true + }, "node_modules/punycode": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz", @@ -13057,6 +13119,18 @@ "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==" }, + "node_modules/simple-update-notifier": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/simple-update-notifier/-/simple-update-notifier-2.0.0.tgz", + "integrity": "sha512-a2B9Y0KlNXl9u/vsW6sTIu9vGEpfKu2wRV6l1H3XEas/0gUIzGzBoP/IouTcUQbm9JWZLH3COxyn03TYlFax6w==", + "dev": true, + "dependencies": { + "semver": "^7.5.3" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/sirv": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/sirv/-/sirv-2.0.4.tgz", @@ -13628,6 +13702,15 @@ "node": ">=6" } }, + "node_modules/touch": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/touch/-/touch-3.1.1.tgz", + "integrity": "sha512-r0eojU4bI8MnHr8c5bNo7lJDdI2qXlWWJk6a9EAFG7vbhTjElYhBVS3/miuE0uOuoLdb8Mc/rVfsmm6eo5o9GA==", + "dev": true, + "bin": { + "nodetouch": "bin/nodetouch.js" + } + }, "node_modules/trim-lines": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/trim-lines/-/trim-lines-3.0.1.tgz", @@ -13714,6 +13797,12 @@ "node": ">=14.17" } }, + "node_modules/undefsafe": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/undefsafe/-/undefsafe-2.0.5.tgz", + "integrity": "sha512-WxONCrssBM8TSPRqN5EmsjVrsv4A8X12J4ArBiiayv3DyyG3ZlIg6yysuuSYdZsVz3TKcTg2fd//Ujd4CHV1iA==", + "dev": true + }, "node_modules/undici-types": { "version": "5.26.5", "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", diff --git a/docs/package.json b/docs/package.json index a3ae7a2d3..3e212827e 100644 --- a/docs/package.json +++ b/docs/package.json @@ -1,10 +1,11 @@ { "name": "continue-docs", "version": "0.0.0", + "author": "Continue Dev, Inc", "private": true, "scripts": { "docusaurus": "docusaurus", - "start": "docusaurus start", + "start": "nodemon --watch sidebars.js --watch docusaurus.config.js --exec 'docusaurus start'", "build": "docusaurus build", "build:netlify": "docusaurus build --out-dir build/docs", "swizzle": "docusaurus swizzle", @@ -26,7 +27,8 @@ "react-dom": "^18.2.0" }, "devDependencies": { - "@docusaurus/module-type-aliases": "^3.2.1" + "@docusaurus/module-type-aliases": "^3.2.1", + "nodemon": "^3.1.4" }, "browserslist": { "production": [ @@ -44,4 +46,4 @@ "engines": { "node": ">=20.11.0" } -} +} \ No newline at end of file diff --git a/docs/sidebars.js b/docs/sidebars.js index cdd4f87d5..b569b31d8 100644 --- a/docs/sidebars.js +++ b/docs/sidebars.js @@ -14,9 +14,39 @@ /** @type {import('@docusaurus/plugin-content-docs').SidebarsConfig} */ const sidebars = { docsSidebar: [ - "intro", - "quickstart", - "how-to-use-continue", + { + type: "category", + label: "🚀 Install", + collapsible: true, + collapsed: true, + items: [ + { + type: "doc", + id: "intro", + label: "Introduction", + }, + { + type: "doc", + id: "install/vscode", + label: "VS Code", + }, + { + type: "doc", + id: "install/jetbrains", + label: "JetBrains", + }, + { + type: "doc", + id: "how-to-use-continue", + label: "How to use Continue", + }, + { + type: "doc", + id: "troubleshooting", + label: "Troubleshooting", + }, + ], + }, { type: "category", label: "🌉 Setup", @@ -31,13 +61,25 @@ const sidebars = { }, { type: "category", - label: "🎨 Customization", + label: "⭐ Features", collapsible: true, collapsed: true, items: [ - "customization/overview", + "features/codebase-embeddings", + "features/talk-to-your-docs", + "features/tab-autocomplete", "customization/context-providers", "customization/slash-commands", + { + type: "doc", + id: "features/prompt-files", + label: "Prompt Files (experimental)", + }, + { + type: "doc", + id: "features/quick-actions", + label: "Quick Actions (experimental)", + }, ], }, { @@ -45,31 +87,40 @@ const sidebars = { label: "🚶 Walkthroughs", collapsible: true, collapsed: true, - items: [ - "walkthroughs/set-up-codestral", - "walkthroughs/codebase-embeddings", - "walkthroughs/tab-autocomplete", - "walkthroughs/prompt-files", - "walkthroughs/quick-actions", - ], + items: ["walkthroughs/set-up-codestral", "walkthroughs/llama3.1"], }, - "development-data", - "telemetry", - "troubleshooting", { type: "category", - label: "📖 Reference", + label: "🧑‍💻 Privacy", collapsible: true, collapsed: true, items: [ + "development-data", + "telemetry", { - type: "autogenerated", - dirName: "reference", + type: "link", + label: "Privacy Policy", + href: "https://www.continue.dev/privacy", }, ], }, "changelog", ], + referenceSidebar: [ + "reference/config", + { + type: "category", + label: "LLM Providers", + collapsible: true, + collapsed: true, + items: [ + { + type: "autogenerated", + dirName: "reference/Model Providers", + }, + ], + }, + ], }; module.exports = sidebars; diff --git a/docs/static/schemas/config.json b/docs/static/schemas/config.json index f57459207..daa0e5f01 100644 --- a/docs/static/schemas/config.json +++ b/docs/static/schemas/config.json @@ -171,6 +171,8 @@ "anthropic", "cohere", "bedrock", + "bedrockimport", + "sagemaker", "together", "ollama", "huggingface-tgi", @@ -187,7 +189,9 @@ "cloudflare", "deepseek", "azure", - "msty" + "msty", + "watsonx", + "openrouter" ], "markdownEnumDescriptions": [ "### OpenAI\nUse gpt-4, gpt-3.5-turbo, or any other OpenAI model. See [here](https://openai.com/product#made-for-developers) to obtain an API key.\n\n> [Reference](https://docs.continue.dev/reference/Model%20Providers/openai)", @@ -195,6 +199,8 @@ "### Anthropic\nTo get started with Anthropic models, you first need to sign up for the open beta [here](https://claude.ai/login) to obtain an API key.\n> [Reference](https://docs.continue.dev/reference/Model%20Providers/anthropicllm)", "### Cohere\nTo use Cohere, visit the [Cohere dashboard](https://dashboard.cohere.com/api-keys) to create an API key.\n\n> [Reference](https://docs.continue.dev/reference/Model%20Providers/cohere)", "### Bedrock\nTo get started with Bedrock you need to sign up on AWS [here](https://aws.amazon.com/bedrock/claude/)", + "### Bedrock Imported Models\nTo get started with Bedrock you need to sign up on AWS [here](https://aws.amazon.com/bedrock/claude/)", + "### Sagemaker\nSagemaker is AWS' machine learning platform.", "### Together\nTogether is a hosted service that provides extremely fast streaming of open-source language models. To get started with Together:\n1. Obtain an API key from [here](https://together.ai)\n2. Paste below\n3. Select a model preset\n> [Reference](https://docs.continue.dev/reference/Model%20Providers/togetherllm)", "### Ollama\nTo get started with Ollama, follow these steps:\n1. Download from [ollama.ai](https://ollama.ai/) and open the application\n2. Open a terminal and run `ollama run `. Example model names are `codellama:7b-instruct` or `llama2:7b-text`. You can find the full list [here](https://ollama.ai/library).\n3. Make sure that the model name used in step 2 is the same as the one in config.json (e.g. `model=\"codellama:7b-instruct\"`)\n4. Once the model has finished downloading, you can start asking questions through Continue.\n> [Reference](https://docs.continue.dev/reference/Model%20Providers/ollama)", "### Huggingface TGI\n\n> [Reference](https://docs.continue.dev/reference/Model%20Providers/huggingfacetgi)", @@ -211,7 +217,9 @@ "### Cloudflare Workers AI\n\n[Reference](https://developers.cloudflare.com/workers-ai/)", "### Deepseek\n Deepseek's API provides the best pricing for their state-of-the-art Deepseek Coder models. To get started, obtain an API key from [their console](https://platform.deepseek.com/api_keys)", "### Azure OpenAI\n Azure OpenAI lets you securely run OpenAI's models on Azure. To get started, follow the steps [here](https://docs.continue.dev/reference/Model%20Providers/azure)", - "### Msty\nMsty is the simplest way to get started with online or local LLMs on all desktop platforms - Windows, Mac, and Linux. No fussing around, one-click and you are up and running. To get started, follow these steps:\n1. Download from [Msty.app](https://msty.app/), open the application, and click 'Setup Local AI'.\n2. Go to the Local AI Module page and download a model of your choice.\n3. Once the model has finished downloading, you can start asking questions through Continue.\n> [Reference](https://continue.dev/docs/reference/Model%20Providers/Msty)" + "### Msty\nMsty is the simplest way to get started with online or local LLMs on all desktop platforms - Windows, Mac, and Linux. No fussing around, one-click and you are up and running. To get started, follow these steps:\n1. Download from [Msty.app](https://msty.app/), open the application, and click 'Setup Local AI'.\n2. Go to the Local AI Module page and download a model of your choice.\n3. Once the model has finished downloading, you can start asking questions through Continue.\n> [Reference](https://continue.dev/docs/reference/Model%20Providers/Msty)", + "### IBM watsonx\nwatsonx, developed by IBM, offers a variety of pre-trained AI foundation models that can be used for natural language processing (NLP), computer vision, and speech recognition tasks.", + "### OpenRouter\nOpenRouter offers a single API to access almost any language model. To get started, obtain an API key from [their console](https://openrouter.ai/settings/keys)." ], "type": "string" }, @@ -236,6 +244,11 @@ "default": 2048, "type": "integer" }, + "maxStopWords": { + "title": "Max Stop Words", + "description": "The maximum number of stop words that the API will accept. You can set this if you are receiving an error about the number of stop words, but otherwise should leave it undefined.", + "type": "integer" + }, "template": { "title": "Template", "description": "The chat template used to format messages. This is auto-detected for most models, but can be overridden here. Choose none if you are using vLLM or another server that automatically handles prompting.", @@ -321,6 +334,16 @@ "title": "Engine", "description": "Azure OpenAI engine", "type": "string" + }, + "capabilities": { + "type": "object", + "description": "We will attempt to automatically detect the capabilities of the model based on its title and provider, but this may not always be accurate. You can override the model's capabilities here.", + "properties": { + "uploadImage": { + "type": "boolean", + "description": "Indicates whether the model can upload images." + } + } } }, "required": ["title", "provider", "model"], @@ -644,6 +667,9 @@ }, "then": { "properties": { + "cacheSystemMessage": { + "type": "boolean" + }, "model": { "anyOf": [ { @@ -710,6 +736,23 @@ } } }, + { + "if": { + "properties": { + "provider": { + "enum": ["sagemaker"] + } + }, + "required": ["provider"] + }, + "then": { + "properties": { + "model": { + "markdownDescription": "SageMaker endpoint name" + } + } + } + }, { "if": { "properties": { @@ -721,6 +764,9 @@ }, "then": { "properties": { + "cacheSystemMessage": { + "type": "boolean" + }, "model": { "enum": [ "chat-bison-001", @@ -939,6 +985,9 @@ }, "then": { "properties": { + "cacheSystemMessage": { + "type": "boolean" + }, "model": { "enum": ["deepseek-chat", "deepseek-coder"] } @@ -1175,6 +1224,45 @@ } } } + }, + { + "if": { + "properties": { + "provider": { + "enum": ["watsonx"] + } + }, + "required": ["provider"] + }, + "then": { + "properties": { + "watsonxUrl": { + "type": "string" + }, + "watsonxApiKey": { + "type": "string" + }, + "watsonxApiVersion": { + "type": "string" + }, + "watsonxProjectId": { + "type": "string" + }, + "watsonxStopToken": { + "type": "string" + }, + "model": { + "enum": [ + "ibm/granite-13b-chat-v2", + "ibm/granite-20b-code-instruct", + "mistralai/mistral-large", + "meta-llama/llama-3-8b-instruct", + "meta-llama/llama-3-70b-instruct" + ] + } + }, + "required": ["watsonxUrl", "watsonxProjectId"] + } } ] }, @@ -1417,46 +1505,6 @@ } }, "allOf": [ - { - "if": { - "properties": { - "name": { - "enum": ["docs"] - } - } - }, - "then": { - "properties": { - "params": { - "properties": { - "sites": { - "type": "array", - "items": { - "type": "object", - "properties": { - "title": { - "type": "string" - }, - "startUrl": { - "type": "string" - }, - "rootUrl": { - "type": "string" - }, - "maxDepth": { - "type": "integer" - } - }, - "required": ["title", "startUrl"] - } - } - }, - "required": ["sites"] - } - }, - "required": ["params"] - } - }, { "if": { "properties": { @@ -1849,6 +1897,10 @@ "maxDepth": { "type": "integer", "description": "The maximum depth to crawl the documentation site" + }, + "favicon": { + "type": "string", + "description": "The URL path to a favicon for the site - by default, it will be `/favicon.ico` path from the Start URL" } }, "required": ["title", "startUrl"] @@ -1946,18 +1998,6 @@ "description": "An optional token to identify the user.", "type": "string" }, - "dataServerUrl": { - "title": "Data Server Url", - "description": "The URL of the server where development data is sent. No data is sent unless a valid user token is provided.", - "default": "https://us-west1-autodebug.cloudfunctions.net", - "type": "string" - }, - "disableSummaries": { - "title": "Disable Summaries", - "markdownDescription": "If set to `true`, Continue will not generate summaries for each Step. This can be useful if you want to save on compute.", - "default": false, - "type": "boolean" - }, "disableIndexing": { "title": "Disable Indexing", "markdownDescription": "If set to `true`, Continue will not index the codebase. This is mainly used for debugging purposes.", @@ -1972,7 +2012,7 @@ }, "embeddingsProvider": { "title": "Embeddings Provider", - "markdownDescription": "The method that will be used to generate codebase embeddings. The default is transformers.js, which will run locally in the browser. Learn about the other options [here](https://docs.continue.dev/walkthroughs/codebase-embeddings#embeddings-providers).", + "markdownDescription": "The method that will be used to generate codebase embeddings. The default is transformers.js, which will run locally in the browser. Learn about the other options [here](https://docs.continue.dev/features/codebase-embeddings#embeddings-providers).", "type": "object", "properties": { "provider": { @@ -2210,7 +2250,7 @@ "tabAutocompleteOptions": { "title": "TabAutocompleteOptions", "type": "object", - "markdownDescription": "These options let you customize your tab-autocomplete experience. Read about all options in [the docs](https://docs.continue.dev/walkthroughs/tab-autocomplete#configuration-options).", + "markdownDescription": "These options let you customize your tab-autocomplete experience. Read about all options in [the docs](https://docs.continue.dev/features/tab-autocomplete#configuration-options).", "properties": { "disable": { "type": "boolean", @@ -2289,6 +2329,56 @@ } } }, + "analytics": { + "type": "object", + "properties": { + "provider": { + "type": "string", + "enum": ["posthog", "logstash"], + "description": "The 3rd party analytics provider to use.", + "default": "posthog", + "markdownEnumDescriptions": [ + "### Posthog\nTo use Posthog, set up an account, obtain your client key, and enter it in the client key field.", + "### Logstash\nContinue's Logstash integration uses the TCP input at the specified URL" + ] + }, + "url": { + "type": "string", + "description": "The URL to which analytics will be sent" + }, + "clientKey": { + "type": "string", + "description": "The client key to use for analytics" + } + }, + "required": ["provider"], + "allOf": [ + { + "if": { + "properties": { + "provider": { + "enum": ["posthog"] + } + } + }, + "then": { + "required": ["clientKey"] + } + }, + { + "if": { + "properties": { + "provider": { + "enum": ["logstash"] + } + } + }, + "then": { + "required": ["url"] + } + } + ] + }, "experimental": { "type": "object", "title": "Experimental", @@ -2297,7 +2387,19 @@ "defaultContext": { "type": "array", "items": { - "enum": ["activeFile"] + "allOf": [ + { + "$ref": "#/definitions/ContextProviderWithParams" + }, + { + "properties": { + "query": { + "type": "string", + "description": "Required for certain context providers, like 'url' in order to specify the input, or which of the dropdown items to select." + } + } + } + ] } }, "modelRoles": { @@ -2308,6 +2410,11 @@ } } }, + "readResponseTTS": { + "type": "boolean", + "default": true, + "description": "Automatically read LLM chat responses aloud using system TTS models" + }, "promptPath": { "type": "string" }, diff --git a/extensions/intellij/CHANGELOG.md b/extensions/intellij/CHANGELOG.md index 416858751..45fe2339a 100644 --- a/extensions/intellij/CHANGELOG.md +++ b/extensions/intellij/CHANGELOG.md @@ -5,6 +5,22 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html), and is generated by [Changie](https://github.com/miniscruff/changie). +## 0.0.54 - 2024-07-13 +### Added +* Partial autocomplete acceptance +* Autocomplete status bar spinner +### Fixed +* Fixed duplicate completion bug and others + +## 0.0.53 - 2024-07-10 +### Added +* Support for .prompt files +* New onboarding experience +### Fixed +* Indexing fixes from VS Code versions merged into IntelliJ +* Improved codebase indexing reliability and testing +* Fixes for autocomplete text positioning and timing + ## 0.0.42 - 2024-04-12 ### Added * Inline cmd/ctrl+I in JetBrains diff --git a/extensions/intellij/README.md b/extensions/intellij/README.md index 9e5a95432..3ea53bf93 100644 --- a/extensions/intellij/README.md +++ b/extensions/intellij/README.md @@ -1,7 +1,5 @@ -![readme](media/readme.png) -

Continue

@@ -14,26 +12,18 @@ ## Easily understand code sections -![understand](docs/static/img/understand.gif) - `cmd+J` (MacOS) / `ctrl+J` (Windows) ## Tab to autocomplete code suggestions -![autocomplete](docs/static/img/autocomplete.gif) - `tab` (MacOS) / `tab` (Windows) ## Refactor functions where you are coding -![inline](docs/static/img/inline.gif) - `cmd+I` (MacOS) / `ctrl+I` (Windows) ## Quickly use documentation as context -![docs](docs/static/img/docs.gif) - `@docs` (MacOS) / `@docs` (Windows)
@@ -46,6 +36,6 @@ Learn more about the models and providers [here](https://continue.dev/docs/setup ## License -[Apache 2.0 © 2023 Continue Dev, Inc.](./LICENSE) +[Apache 2.0 © 2023-2024 Continue Dev, Inc.](./LICENSE) diff --git a/extensions/intellij/build.gradle.kts b/extensions/intellij/build.gradle.kts index e3eba0461..37586546a 100644 --- a/extensions/intellij/build.gradle.kts +++ b/extensions/intellij/build.gradle.kts @@ -37,6 +37,7 @@ dependencies { implementation("io.ktor:ktor-server-cors:2.3.7"){ exclude(group = "org.slf4j", module = "slf4j-api") } + implementation("com.posthog.java:posthog:1.+") } @@ -142,6 +143,9 @@ tasks { // The pluginVersion is based on the SemVer (https://semver.org) and supports pre-release labels, like 2.1.7-alpha.3 // Specify pre-release label to publish the plugin in a custom Release Channel automatically. Read more: // https://plugins.jetbrains.com/docs/intellij/deployment.html#specifying-a-release-channel - channels = properties("pluginVersion").map { listOf(it.split('-').getOrElse(1) { "default" }.split('.').first()) } + channels.set(listOf(environment("RELEASE_CHANNEL").getOrElse("eap"))) + + // We always hide the stable releases until a few days of EAP have proven them stable +// hidden = environment("RELEASE_CHANNEL").map { it == "stable" }.getOrElse(false) } } diff --git a/extensions/intellij/gradle.properties b/extensions/intellij/gradle.properties index d131d7c37..f1ef747c8 100644 --- a/extensions/intellij/gradle.properties +++ b/extensions/intellij/gradle.properties @@ -4,7 +4,7 @@ pluginGroup = com.github.continuedev.continueintellijextension pluginName = continue-intellij-extension pluginRepositoryUrl = https://github.com/continuedev/continue # SemVer format -> https://semver.org -pluginVersion = 0.0.56 +pluginVersion = 0.0.64 # Supported build number ranges and IntelliJ Platform versions -> https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html pluginSinceBuild = 223 diff --git a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/actions/ContinuePluginActions.kt b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/actions/ContinuePluginActions.kt index db7df5b54..791172388 100644 --- a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/actions/ContinuePluginActions.kt +++ b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/actions/ContinuePluginActions.kt @@ -2,13 +2,13 @@ package com.github.continuedev.continueintellijextension.actions import com.github.continuedev.continueintellijextension.editor.DiffStreamService import com.github.continuedev.continueintellijextension.services.ContinuePluginService -import com.google.gson.Gson import com.intellij.openapi.actionSystem.AnAction import com.intellij.openapi.actionSystem.AnActionEvent import com.intellij.openapi.actionSystem.PlatformDataKeys import com.intellij.openapi.components.ServiceManager import com.intellij.openapi.components.service import com.intellij.openapi.fileEditor.FileEditorManager +import com.intellij.openapi.project.Project import com.intellij.openapi.ui.DialogWrapper import com.intellij.openapi.ui.Messages import com.intellij.openapi.wm.ToolWindowManager @@ -19,8 +19,10 @@ import javax.swing.event.DocumentListener import com.intellij.ui.components.JBScrollPane import java.awt.BorderLayout -fun pluginServiceFromActionEvent(e: AnActionEvent): ContinuePluginService? { - val project = e.project ?: return null +fun getPluginService(project: Project?): ContinuePluginService? { + if (project == null) { + return null + } return ServiceManager.getService( project, ContinuePluginService::class.java @@ -34,7 +36,7 @@ class AcceptDiffAction : AnAction() { } private fun acceptHorizontalDiff(e: AnActionEvent) { - val continuePluginService = pluginServiceFromActionEvent(e) ?: return + val continuePluginService = getPluginService(e.project) ?: return continuePluginService.ideProtocolClient?.diffManager?.acceptDiff(null) } @@ -53,7 +55,7 @@ class RejectDiffAction : AnAction() { } private fun rejectHorizontalDiff(e: AnActionEvent) { - val continuePluginService = pluginServiceFromActionEvent(e) ?: return + val continuePluginService = getPluginService(e.project) ?: return continuePluginService.ideProtocolClient?.diffManager?.rejectDiff(null) } @@ -131,7 +133,7 @@ class RejectDiffAction : AnAction() { class QuickTextEntryAction : AnAction() { override fun actionPerformed(e: AnActionEvent) { - val continuePluginService = pluginServiceFromActionEvent(e) ?: return + val continuePluginService = getPluginService(e.project) ?: return continuePluginService.ideProtocolClient?.sendHighlightedCode() // Create and show the dialog @@ -140,7 +142,7 @@ class QuickTextEntryAction : AnAction() { // Show the text entered by the user if (text != null) { - val service = pluginServiceFromActionEvent(e) + val service = getPluginService(e.project) service?.ideProtocolClient?.sendMainUserInput(text) val project = e.project @@ -172,27 +174,29 @@ class ViewLogsAction : AnAction() { } } +fun focusContinueInput(project: Project?) { + if (project != null) { + val toolWindowManager = ToolWindowManager.getInstance(project) + val toolWindow = toolWindowManager.getToolWindow("Continue") + if (toolWindow != null) { + if (!toolWindow.isVisible) { + toolWindow.activate(null) + } + } + } + + val continuePluginService = getPluginService(project) ?: return + continuePluginService.continuePluginWindow?.content?.components?.get(0)?.requestFocus() + continuePluginService.sendToWebview("focusContinueInputWithoutClear", null) + + continuePluginService.ideProtocolClient?.sendHighlightedCode() +} class FocusContinueInputWithoutClearAction : AnAction() { override fun actionPerformed(e: AnActionEvent) { val project = e.project - if (project != null) { - val toolWindowManager = ToolWindowManager.getInstance(project) - val toolWindow = toolWindowManager.getToolWindow("Continue") - - if (toolWindow != null) { - if (!toolWindow.isVisible) { - toolWindow.activate(null) - } - } - } - - val continuePluginService = pluginServiceFromActionEvent(e) ?: return - continuePluginService.continuePluginWindow?.content?.components?.get(0)?.requestFocus() - continuePluginService.sendToWebview("focusContinueInputWithoutClear", null) - - continuePluginService.ideProtocolClient?.sendHighlightedCode() + focusContinueInput(project) } } @@ -210,7 +214,7 @@ class FocusContinueInputAction : AnAction() { } } - val continuePluginService = pluginServiceFromActionEvent(e) ?: return + val continuePluginService = getPluginService(e.project) ?: return continuePluginService.continuePluginWindow?.content?.components?.get(0)?.requestFocus() continuePluginService.sendToWebview("focusContinueInput", null) @@ -233,7 +237,7 @@ class NewContinueSessionAction : AnAction() { } } - val continuePluginService = pluginServiceFromActionEvent(e) ?: return + val continuePluginService = getPluginService(e.project) ?: return continuePluginService.continuePluginWindow?.content?.components?.get(0)?.requestFocus() continuePluginService.sendToWebview("focusContinueInputWithNewSession", null) @@ -248,7 +252,7 @@ class ViewHistoryAction : AnAction() { val toolWindow = toolWindowManager.getToolWindow("Continue") } - val continuePluginService = pluginServiceFromActionEvent(e) ?: return + val continuePluginService = getPluginService(e.project) ?: return continuePluginService.sendToWebview("viewHistory", null) } 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 444a4d397..bf207db21 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 @@ -9,6 +9,7 @@ import com.github.continuedev.continueintellijextension.listeners.ContinuePlugin import com.github.continuedev.continueintellijextension.services.ContinueExtensionSettings import com.github.continuedev.continueintellijextension.services.ContinuePluginService import com.github.continuedev.continueintellijextension.services.SettingsListener +import com.github.continuedev.continueintellijextension.services.TelemetryService import com.intellij.openapi.Disposable import com.intellij.openapi.actionSystem.KeyboardShortcut import com.intellij.openapi.application.ApplicationManager @@ -177,52 +178,8 @@ class ContinuePluginStartupActivity : StartupActivity, Disposable, DumbAware { ) } - GlobalScope.async(Dispatchers.IO) { - val myPluginId = "com.github.continuedev.continueintellijextension" - val pluginDescriptor = PluginManager.getPlugin(PluginId.getId(myPluginId)) - - if (pluginDescriptor == null) { - throw Exception("Plugin not found") - } - val pluginPath = pluginDescriptor.pluginPath - val osName = System.getProperty("os.name").toLowerCase() - val os = when { - osName.contains("mac") || osName.contains("darwin") -> "darwin" - osName.contains("win") -> "win32" - osName.contains("nix") || osName.contains("nux") || osName.contains("aix") -> "linux" - else -> "linux" - } - val osArch = System.getProperty("os.arch").toLowerCase() - val arch = when { - osArch.contains("aarch64") || (osArch.contains("arm") && osArch.contains("64")) -> "arm64" - osArch.contains("amd64") || osArch.contains("x86_64") -> "x64" - else -> "x64" - } - val target = "$os-$arch" - - println("Identified OS: $os, Arch: $arch") - - val corePath = Paths.get(pluginPath.toString(), "core").toString() - val targetPath = Paths.get(corePath, target).toString() - val continueCorePath = Paths.get(targetPath, "continue-binary" + (if (os == "win32") ".exe" else "")).toString() - - // Copy targetPath / node_sqlite3.node to core / node_sqlite3.node - val nodeSqlite3Path = Paths.get(targetPath, "node_sqlite3.node") - - // Create the build/Release path first - File(Paths.get(corePath, "build", "Release").toString()).mkdirs() - - val coreNodeSqlite3Path = Paths.get(corePath, "build", "Release", "node_sqlite3.node") - if (!File(coreNodeSqlite3Path.toString()).exists()) { - Files.copy(nodeSqlite3Path, coreNodeSqlite3Path) - } - - // esbuild needs permissions - val esbuildPath = Paths.get(targetPath, "esbuild"+ (if (os == "win32") ".exe" else "")).toString() - - val coreMessenger = CoreMessenger(project, esbuildPath, continueCorePath, ideProtocolClient) - continuePluginService.coreMessenger = coreMessenger - } + val coreMessengerManager = CoreMessengerManager(project, ideProtocolClient) + continuePluginService.coreMessengerManager = coreMessengerManager } } diff --git a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/CoreMessenger.kt b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/CoreMessenger.kt index ded887c76..b95a2c7b9 100644 --- a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/CoreMessenger.kt +++ b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/CoreMessenger.kt @@ -1,15 +1,12 @@ package com.github.continuedev.continueintellijextension.`continue` + import com.github.continuedev.continueintellijextension.services.ContinueExtensionSettings import com.github.continuedev.continueintellijextension.services.ContinuePluginService -import java.io.BufferedReader -import java.io.InputStreamReader -import java.io.OutputStreamWriter - -import java.io.* - +import com.github.continuedev.continueintellijextension.services.TelemetryService import com.google.gson.Gson import com.intellij.openapi.components.service import com.intellij.openapi.project.Project +import java.io.* import java.net.Socket import java.nio.charset.StandardCharsets import java.nio.file.Files @@ -183,6 +180,11 @@ class CoreMessenger(private val project: Project, esbuildPath: String, continueC Files.setPosixFilePermissions(Paths.get(path), perms) } + private val exitCallbacks: MutableList<() -> Unit> = mutableListOf() + fun onDidExit(callback: () -> Unit) { + exitCallbacks.add(callback) + } + init { if (useTcp) { try { @@ -238,9 +240,30 @@ class CoreMessenger(private val project: Project, esbuildPath: String, continueC reader = BufferedReader(InputStreamReader(inputStream, StandardCharsets.UTF_8)) process!!.onExit().thenRun { - val err = process?.errorStream?.bufferedReader()?.readText()?.trim() + exitCallbacks.forEach { it() } + var err = process?.errorStream?.bufferedReader()?.readText()?.trim() + if (err != null) { + // There are often "⚡️Done in Xms" messages, and we want everything after the last one + val delimiter = "⚡ Done in" + val doneIndex = err.lastIndexOf(delimiter) + if (doneIndex != -1) { + err = err.substring(doneIndex + delimiter.length) + } + } + println("Core process exited with output: $err") ideProtocolClient.showMessage("Core process exited with output: $err") + + // Log the cause of the failure + val telemetryService = service() + telemetryService.capture("jetbrains_core_exit", mapOf( + "error" to err + )) + + // Clean up all resources + writer?.close() + reader?.close() + process?.destroy() } Thread { diff --git a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/CoreMessengerManager.kt b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/CoreMessengerManager.kt new file mode 100644 index 000000000..f7bd42844 --- /dev/null +++ b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/CoreMessengerManager.kt @@ -0,0 +1,80 @@ +package com.github.continuedev.continueintellijextension.`continue` + +import com.github.continuedev.continueintellijextension.services.ContinuePluginService +import com.github.continuedev.continueintellijextension.services.TelemetryService +import com.intellij.ide.plugins.PluginManager +import com.intellij.openapi.components.ServiceManager +import com.intellij.openapi.components.service +import com.intellij.openapi.extensions.PluginId +import com.intellij.openapi.project.Project +import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.GlobalScope +import kotlinx.coroutines.async +import java.nio.file.Paths + +class CoreMessengerManager(private val project: Project, private val ideProtocolClient: IdeProtocolClient) { + + var coreMessenger: CoreMessenger? = null + var lastBackoffInterval = 0.5 + + init { + GlobalScope.async(Dispatchers.IO) { + val continuePluginService = ServiceManager.getService( + project, + ContinuePluginService::class.java + ) + + val myPluginId = "com.github.continuedev.continueintellijextension" + val pluginDescriptor = PluginManager.getPlugin(PluginId.getId(myPluginId)) ?: throw Exception("Plugin not found") + + val pluginPath = pluginDescriptor.pluginPath + val osName = System.getProperty("os.name").toLowerCase() + val os = when { + osName.contains("mac") || osName.contains("darwin") -> "darwin" + osName.contains("win") -> "win32" + osName.contains("nix") || osName.contains("nux") || osName.contains("aix") -> "linux" + else -> "linux" + } + val osArch = System.getProperty("os.arch").toLowerCase() + val arch = when { + osArch.contains("aarch64") || (osArch.contains("arm") && osArch.contains("64")) -> "arm64" + osArch.contains("amd64") || osArch.contains("x86_64") -> "x64" + else -> "x64" + } + val target = "$os-$arch" + + println("Identified OS: $os, Arch: $arch") + + val corePath = Paths.get(pluginPath.toString(), "core").toString() + val targetPath = Paths.get(corePath, target).toString() + val continueCorePath = Paths.get(targetPath, "continue-binary" + (if (os == "win32") ".exe" else "")).toString() + + // esbuild needs permissions + val esbuildPath = Paths.get(targetPath, "esbuild"+ (if (os == "win32") ".exe" else "")).toString() + + setupCoreMessenger(esbuildPath, continueCorePath) + } + } + + private fun setupCoreMessenger(esbuildPath: String, continueCorePath: String): Unit { + coreMessenger = CoreMessenger(project, esbuildPath, continueCorePath, ideProtocolClient) + + coreMessenger?.request("config/getSerializedProfileInfo", null, null) { resp -> + val data = resp as? Map + val profileInfo = data?.get("config") as? Map + val allowAnonymousTelemetry = profileInfo?.get("allowAnonymousTelemetry") as? Boolean + val telemetryService = service() + if (allowAnonymousTelemetry == true || allowAnonymousTelemetry == null) { + telemetryService.setup(getMachineUniqueID()) + } + } + + // On exit, use exponential backoff to create another CoreMessenger + coreMessenger?.onDidExit { + lastBackoffInterval *= 2 + println("CoreMessenger exited, retrying in $lastBackoffInterval seconds") + Thread.sleep((lastBackoffInterval * 1000).toLong()) + setupCoreMessenger(esbuildPath, continueCorePath) + } + } +} \ No newline at end of file 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 e8aa27b6c..e13819000 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 @@ -31,6 +31,7 @@ import com.intellij.openapi.extensions.PluginId import com.intellij.openapi.fileEditor.FileDocumentManager import com.intellij.openapi.fileEditor.FileEditorManager import com.intellij.openapi.fileEditor.TextEditor +import com.intellij.openapi.fileEditor.impl.FileEditorManagerImpl import com.intellij.openapi.progress.DumbProgressIndicator import com.intellij.openapi.progress.ProgressIndicator import com.intellij.openapi.project.DumbAware @@ -44,6 +45,8 @@ import com.intellij.openapi.wm.WindowManager import com.intellij.psi.PsiDocumentManager import com.intellij.testFramework.LightVirtualFile import com.intellij.ui.awt.RelativePoint +import com.intellij.ui.content.ContentManagerUtil +import com.intellij.util.concurrency.annotations.RequiresEdt import kotlinx.coroutines.* import java.awt.Toolkit import java.awt.datatransfer.StringSelection @@ -605,8 +608,10 @@ class IdeProtocolClient ( respond(currentFile) } "getPinnedFiles" -> { - val openFiles = visibleFiles() - respond(openFiles) + ApplicationManager.getApplication().invokeLater { + val pinnedFiles = pinnedFiles() + respond(pinnedFiles) + } } "insertAtCursor" -> { val msg = data as Map; @@ -717,30 +722,6 @@ class IdeProtocolClient ( return getMachineUniqueID() } - fun onTextSelected( - selectedText: String, - filepath: String, - startLine: Int, - startCharacter: Int, - endLine: Int, - endCharacter: Int - ) = coroutineScope.launch { -// val jsonMessage = textSelectionStrategy.handleTextSelection( -// selectedText, -// filepath, -// startLine, -// startCharacter, -// endLine, -// endCharacter -// ) -// sendMessage("highlightedCodePush", jsonMessage) -// dispatchEventToWebview( -// "highlightedCode", -// jsonMessage, -// continuePluginService.continuePluginWindow.webView -// ) - } - fun readFile(filepath: String): String { try { val content = ApplicationManager.getApplication().runReadAction { @@ -964,6 +945,14 @@ class IdeProtocolClient ( return fileEditorManager.openFiles.toList().map { it.path } } + @RequiresEdt + private fun pinnedFiles(): List { + val fileEditorManager = FileEditorManager.getInstance(project) as? FileEditorManagerImpl ?: return listOf() + val openFiles = fileEditorManager.openFiles.map { it.path }.toList() + val pinnedFiles = fileEditorManager.windows.flatMap { window -> window.files.filter { window.isFilePinned(it) } }.map { it.path }.toSet() + return openFiles.intersect(pinnedFiles).toList() + } + private fun currentFile(): String? { val fileEditorManager = FileEditorManager.getInstance(project) val editor = fileEditorManager.selectedTextEditor diff --git a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/editor/InlineEditAction.kt b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/editor/InlineEditAction.kt index e974cf8fd..42205bb0b 100644 --- a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/editor/InlineEditAction.kt +++ b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/editor/InlineEditAction.kt @@ -4,13 +4,13 @@ import com.github.continuedev.continueintellijextension.`continue`.GetTheme import com.github.continuedev.continueintellijextension.services.ContinueExtensionSettings import com.github.continuedev.continueintellijextension.services.ContinuePluginService import com.github.continuedev.continueintellijextension.utils.getAltKeyLabel -import com.google.gson.Gson import com.intellij.openapi.Disposable import com.intellij.openapi.actionSystem.ActionUpdateThread import com.intellij.openapi.actionSystem.AnAction import com.intellij.openapi.actionSystem.AnActionEvent import com.intellij.openapi.actionSystem.PlatformDataKeys import com.intellij.openapi.components.service +import com.intellij.openapi.editor.Editor import com.intellij.openapi.editor.colors.EditorColorsManager import com.intellij.openapi.editor.colors.EditorFontType import com.intellij.openapi.editor.impl.EditorImpl @@ -32,8 +32,6 @@ import javax.swing.* import javax.swing.border.EmptyBorder import javax.swing.event.DocumentEvent import javax.swing.event.DocumentListener -import javax.swing.plaf.ComboBoxUI -import javax.swing.plaf.basic.BasicArrowButton import javax.swing.plaf.basic.BasicComboBoxUI import kotlin.math.max @@ -41,6 +39,193 @@ import kotlin.math.max const val SHADOW_SIZE = 7 const val MAIN_FONT_SIZE = 13 +fun makeTextArea(): JTextArea { + val textArea = CustomTextArea( 2, 40).apply { + lineWrap = true + wrapStyleWord = true + isOpaque = false + background = GetTheme().getSecondaryDark() + maximumSize = Dimension(400, Short.MAX_VALUE.toInt()) + margin = JBUI.insets(8) + font = UIUtil.getFontWithFallback("Arial", Font.PLAIN, MAIN_FONT_SIZE) + } + textArea.putClientProperty(UIUtil.HIDE_EDITOR_FROM_DATA_CONTEXT_PROPERTY, true) + + return textArea +} + +fun makePanel(project: Project, customPanelRef: Ref, textArea: JTextArea, inlayRef: Ref, comboBoxRef: Ref>, leftInset: Int, modelTitles: List, onEnter: () -> Unit, onCancel: () -> Unit, onAccept: () -> Unit, onReject: () -> Unit): JPanel { + val topPanel = ShadowPanel(MigLayout("wrap 1, insets 4 $leftInset 2 2, gap 0!")).apply { + val globalScheme = EditorColorsManager.getInstance().globalScheme + val defaultBackground = globalScheme.defaultBackground +// background = defaultBackground + background = JBColor(0x20888888.toInt(), 0x20888888.toInt()) + isOpaque = false + } + + val panel = CustomPanel(MigLayout("wrap 1, insets 0, gap 0!, fillx"), project, modelTitles, comboBoxRef, onEnter, onCancel, onAccept, onReject).apply { + val globalScheme = EditorColorsManager.getInstance().globalScheme + val defaultBackground = globalScheme.defaultBackground + background = defaultBackground + add(textArea, "grow, gap 0!, height 100%") + + putClientProperty(UIUtil.HIDE_EDITOR_FROM_DATA_CONTEXT_PROPERTY, true) + preferredSize = textArea.preferredSize + isOpaque = false + setup() + + val shadow = DropShadowBorder() + shadow.shadowColor = JBColor(0xb0b0b0, 0x505050) + shadow.isShowRightShadow = true + shadow.isShowBottomShadow = true + shadow.shadowSize = SHADOW_SIZE + border = shadow + } + customPanelRef.set(panel) + + textArea.addComponentListener(object : ComponentAdapter() { + override fun componentResized(e: ComponentEvent?) { + panel.revalidate() + panel.repaint() + } + }) + + topPanel.add(panel, "grow, gap 0!") + + return topPanel +} + +fun openInlineEdit(project: Project?, editor: Editor) { + if (project == null) return + + val manager = EditorComponentInlaysManager.from(editor) + + // Get list of model titles + val continuePluginService = project.service() + val modelTitles = mutableListOf() + continuePluginService.coreMessenger?.request("config/getSerializedProfileInfo", null, null) { response -> + val config = response as Map + val models = (config["config"] as Map)["models"] as List> + modelTitles.addAll(models.map { it["title"] as String }) + } + val maxWaitTime = 200 + val startTime = System.currentTimeMillis() + while (modelTitles.isEmpty() && System.currentTimeMillis() - startTime < maxWaitTime) { + Thread.sleep(20) + } + + // Get highlighted range + val selectionModel = editor.selectionModel + val startLineNumber = editor.document.getLineNumber(selectionModel.selectionStart) + val endLineNumber = editor.document.getLineNumber(selectionModel.selectionEnd) + val start = editor.document.getLineStartOffset(startLineNumber) + val end = editor.document.getLineEndOffset(endLineNumber) + val prefix = editor.document.getText(TextRange(0, start)) + val highlighted = editor.document.getText(TextRange(start, end)) + val suffix = editor.document.getText(TextRange(end, editor.document.textLength)) + + val startLineNum = editor.document.getLineNumber(start) + val endLineNum = editor.document.getLineNumber(end) + val lineNumber = max(0, startLineNum - 1) + + // Un-highlight the selected text + selectionModel.removeSelection() + + // Get indentation width in pixels + val indentationLineNum = lineNumber + 1 + val lineStart = editor.document.getLineStartOffset(indentationLineNum) + val lineEnd = editor.document.getLineEndOffset(indentationLineNum) + val text = editor.document.getText(TextRange(lineStart, lineEnd)) + val indentation = text.takeWhile { it == ' ' }.length + val charWidth = editor.contentComponent.getFontMetrics(editor.colorsScheme.getFont(EditorFontType.PLAIN)).charWidth(' ') + val leftInset = indentation * charWidth * 2 / 3 + + val inlayRef = Ref() + val customPanelRef = Ref() + + // Create text area, attach key listener + val textArea = makeTextArea() + + // Create diff stream handler + val diffStreamHandler = DiffStreamHandler(project, editor, textArea, startLineNum, endLineNum, { + inlayRef.get().dispose() + }, { + customPanelRef.get().finish() + }) + val diffStreamService = project.service() + diffStreamService.register(diffStreamHandler, editor) + + diffStreamHandler.setup() + + val comboBoxRef = Ref>() + + fun onEnter() { + customPanelRef.get().enter() + diffStreamHandler.run(textArea.text, prefix, highlighted, suffix, comboBoxRef.get().selectedItem as String) + } + + val panel = makePanel(project, customPanelRef, textArea, inlayRef, comboBoxRef, leftInset, modelTitles, {onEnter()}, { + diffStreamService.reject(editor) + selectionModel.setSelection(start, end) + }, { + diffStreamService.accept(editor) + inlayRef.get().dispose() + }, { + diffStreamService.reject(editor) + inlayRef.get().dispose() + }) + val inlay = manager.insertAfter(lineNumber, panel) + panel.revalidate() + inlayRef.set(inlay) + val viewport = (editor as? EditorImpl)?.scrollPane?.viewport + viewport?.dispatchEvent(ComponentEvent(viewport, ComponentEvent.COMPONENT_RESIZED)) + + // Add key listener to text area + textArea.addKeyListener(object : KeyAdapter() { + override fun keyPressed(e: KeyEvent) { + if (e.keyCode == KeyEvent.VK_ESCAPE) { + diffStreamService.reject(editor) + + // Re-highlight the selected text + selectionModel.setSelection(start, end) + } else if (e.keyCode == KeyEvent.VK_ENTER) { + if (e.modifiersEx == KeyEvent.SHIFT_DOWN_MASK) { + textArea.document.insertString(textArea.caretPosition, "\n", null) + } else if (e.modifiersEx == 0) { + onEnter() + e.consume() + } + } + } + }) + + // Listen for changes to textarea line count + textArea.document.addDocumentListener(object : DocumentListener { + private var lastNumLines: Int = 0 + private fun updateSize() { + val numLines = textArea.text.lines().size + if (numLines != lastNumLines) { + lastNumLines = numLines + viewport?.dispatchEvent(ComponentEvent(viewport, ComponentEvent.COMPONENT_RESIZED)) + } + } + override fun insertUpdate(e: DocumentEvent?) { + updateSize() + } + + override fun removeUpdate(e: DocumentEvent?) { + updateSize() + } + + override fun changedUpdate(e: DocumentEvent?) { + updateSize() + } + }) + + + textArea.requestFocus() +} + /** * Adapted from https://github.com/cursive-ide/component-inlay-example/blob/master/src/main/kotlin/inlays/InlineEditAction.kt */ @@ -55,192 +240,9 @@ class InlineEditAction : AnAction(), DumbAware { } override fun actionPerformed(e: AnActionEvent) { - if (e.project == null) return - val editor = e.getData(PlatformDataKeys.EDITOR) ?: return val project = e.getData(PlatformDataKeys.PROJECT) ?: return - val manager = EditorComponentInlaysManager.from(editor) - - // Get list of model titles - val continuePluginService = project.service() - val modelTitles = mutableListOf() - continuePluginService.coreMessenger?.request("config/getSerializedProfileInfo", null, null) { response -> - val config = response as Map - val models = (config["config"] as Map)["models"] as List> - modelTitles.addAll(models.map { it["title"] as String }) - } - val maxWaitTime = 200 - val startTime = System.currentTimeMillis() - while (modelTitles.isEmpty() && System.currentTimeMillis() - startTime < maxWaitTime) { - Thread.sleep(20) - } - - // Get highlighted range - val selectionModel = editor.selectionModel - val startLineNumber = editor.document.getLineNumber(selectionModel.selectionStart) - val endLineNumber = editor.document.getLineNumber(selectionModel.selectionEnd) - val start = editor.document.getLineStartOffset(startLineNumber) - val end = editor.document.getLineEndOffset(endLineNumber) - val prefix = editor.document.getText(TextRange(0, start)) - val highlighted = editor.document.getText(TextRange(start, end)) - val suffix = editor.document.getText(TextRange(end, editor.document.textLength)) - - val startLineNum = editor.document.getLineNumber(start) - val endLineNum = editor.document.getLineNumber(end) - val lineNumber = max(0, startLineNum - 1) - - // Un-highlight the selected text - selectionModel.removeSelection() - - // Get indentation width in pixels - val indentationLineNum = lineNumber + 1 - val lineStart = editor.document.getLineStartOffset(indentationLineNum) - val lineEnd = editor.document.getLineEndOffset(indentationLineNum) - val text = editor.document.getText(TextRange(lineStart, lineEnd)) - val indentation = text.takeWhile { it == ' ' }.length - val charWidth = editor.contentComponent.getFontMetrics(editor.colorsScheme.getFont(EditorFontType.PLAIN)).charWidth(' ') - val leftInset = indentation * charWidth * 2 / 3 - - val inlayRef = Ref() - val customPanelRef = Ref() - - // Create text area, attach key listener - val textArea = makeTextArea() - - // Create diff stream handler - val diffStreamHandler = DiffStreamHandler(project, editor, textArea, startLineNum, endLineNum, { - inlayRef.get().dispose() - }, { - customPanelRef.get().finish() - }) - val diffStreamService = project.service() - diffStreamService.register(diffStreamHandler, editor) - - diffStreamHandler.setup() - - val comboBoxRef = Ref>() - - fun onEnter() { - customPanelRef.get().enter() - diffStreamHandler.run(textArea.text, prefix, highlighted, suffix, comboBoxRef.get().selectedItem as String) - } - - val panel = makePanel(project, customPanelRef, textArea, inlayRef, comboBoxRef, leftInset, modelTitles, {onEnter()}, { - diffStreamService.reject(editor) - selectionModel.setSelection(start, end) - }, { - diffStreamService.accept(editor) - inlayRef.get().dispose() - }, { - diffStreamService.reject(editor) - inlayRef.get().dispose() - }) - val inlay = manager.insertAfter(lineNumber, panel) - panel.revalidate() - inlayRef.set(inlay) - val viewport = (editor as? EditorImpl)?.scrollPane?.viewport - viewport?.dispatchEvent(ComponentEvent(viewport, ComponentEvent.COMPONENT_RESIZED)) - - // Add key listener to text area - textArea.addKeyListener(object : KeyAdapter() { - override fun keyPressed(e: KeyEvent) { - if (e.keyCode == KeyEvent.VK_ESCAPE) { - diffStreamService.reject(editor) - - // Re-highlight the selected text - selectionModel.setSelection(start, end) - } else if (e.keyCode == KeyEvent.VK_ENTER) { - if (e.modifiersEx == KeyEvent.SHIFT_DOWN_MASK) { - textArea.document.insertString(textArea.caretPosition, "\n", null) - } else if (e.modifiersEx == 0) { - onEnter() - e.consume() - } - } - } - }) - - // Listen for changes to textarea line count - textArea.document.addDocumentListener(object : DocumentListener { - private var lastNumLines: Int = 0 - private fun updateSize() { - val numLines = textArea.text.lines().size - if (numLines != lastNumLines) { - lastNumLines = numLines - viewport?.dispatchEvent(ComponentEvent(viewport, ComponentEvent.COMPONENT_RESIZED)) - } - } - override fun insertUpdate(e: DocumentEvent?) { - updateSize() - } - - override fun removeUpdate(e: DocumentEvent?) { - updateSize() - } - - override fun changedUpdate(e: DocumentEvent?) { - updateSize() - } - }) - - - textArea.requestFocus() - } - - fun makeTextArea(): JTextArea { - val textArea = CustomTextArea( 2, 40).apply { - lineWrap = true - wrapStyleWord = true - isOpaque = false - background = GetTheme().getSecondaryDark() - maximumSize = Dimension(400, Short.MAX_VALUE.toInt()) - margin = JBUI.insets(8) - font = Font("Arial", Font.PLAIN, MAIN_FONT_SIZE) - } - textArea.putClientProperty(UIUtil.HIDE_EDITOR_FROM_DATA_CONTEXT_PROPERTY, true) - - return textArea - } - - fun makePanel(project: Project, customPanelRef: Ref, textArea: JTextArea, inlayRef: Ref, comboBoxRef: Ref>, leftInset: Int, modelTitles: List, onEnter: () -> Unit, onCancel: () -> Unit, onAccept: () -> Unit, onReject: () -> Unit): JPanel { - val topPanel = ShadowPanel(MigLayout("wrap 1, insets 4 $leftInset 2 2, gap 0!")).apply { - val globalScheme = EditorColorsManager.getInstance().globalScheme - val defaultBackground = globalScheme.defaultBackground -// background = defaultBackground - background = JBColor(0x20888888.toInt(), 0x20888888.toInt()) - isOpaque = false - } - - val panel = CustomPanel(MigLayout("wrap 1, insets 0, gap 0!, fillx"), project, modelTitles, comboBoxRef, onEnter, onCancel, onAccept, onReject).apply { - val globalScheme = EditorColorsManager.getInstance().globalScheme - val defaultBackground = globalScheme.defaultBackground - background = defaultBackground - add(textArea, "grow, gap 0!, height 100%") - - putClientProperty(UIUtil.HIDE_EDITOR_FROM_DATA_CONTEXT_PROPERTY, true) - preferredSize = textArea.preferredSize - isOpaque = false - setup() - - val shadow = DropShadowBorder() - shadow.shadowColor = JBColor(0xb0b0b0, 0x505050) - shadow.isShowRightShadow = true - shadow.isShowBottomShadow = true - shadow.shadowSize = SHADOW_SIZE - border = shadow - } - customPanelRef.set(panel) - - textArea.addComponentListener(object : ComponentAdapter() { - override fun componentResized(e: ComponentEvent?) { - panel.revalidate() - panel.repaint() - } - }) - - topPanel.add(panel, "grow, gap 0!") - - return topPanel + openInlineEdit(project, editor) } } @@ -260,7 +262,7 @@ class CustomPanel(layout: MigLayout, project: Project, modelTitles: List isEditable = true background = defaultBackground foreground = Color(128, 128, 128, 200) - font = Font("Arial", Font.PLAIN, 11) + font = UIUtil.getFontWithFallback("Arial", Font.PLAIN, 11) border = EmptyBorder(2, 4, 2, 4) isOpaque = false isEditable = false @@ -315,7 +317,7 @@ class CustomPanel(layout: MigLayout, project: Project, modelTitles: List isEditable = true background = defaultBackground foreground = Color(128, 128, 128, 200) - font = Font("Arial", Font.PLAIN, 11) + font = UIUtil.getFontWithFallback("Arial", Font.PLAIN, 11) border = EmptyBorder(2, 4, 2, 4) isOpaque = false isEditable = false @@ -352,7 +354,7 @@ class CustomPanel(layout: MigLayout, project: Project, modelTitles: List private val subPanelC: JPanel = JPanel(MigLayout("insets 0, fillx")).apply { val leftLabel = JLabel("Enter follow-up instructions").apply { foreground = Color(128, 128, 128, 200) - font = Font("Arial", Font.PLAIN, 11) + font = UIUtil.getFontWithFallback("Arial", Font.PLAIN, 11) } val leftButton = CustomButton("${getAltKeyLabel()}⇧N") { onReject() }.apply { @@ -445,7 +447,7 @@ class CustomButton(text: String, onClick: () -> Unit) : JLabel(text, CENTER) { }) // verticalAlignment = CENTER - font = Font("Arial", Font.PLAIN, 11) + font = UIUtil.getFontWithFallback("Arial", Font.PLAIN, 11) border = EmptyBorder(2, 4, 2, 4) } override fun paintComponent(g: Graphics) { @@ -477,7 +479,7 @@ class CustomTextArea(rows: Int, columns: Int) : JXTextArea("") { // Draw placeholder if (text.isEmpty()) { g.color = Color(128, 128, 128, 255) - g.font = Font("Arial", Font.PLAIN, MAIN_FONT_SIZE) + g.font = UIUtil.getFontWithFallback("Arial", Font.PLAIN, MAIN_FONT_SIZE) g.drawString("Enter instructions to edit highlighted code", 8, 20) } diff --git a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/editor/ToolTipComponent.kt b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/editor/ToolTipComponent.kt new file mode 100644 index 000000000..7d5ba7c08 --- /dev/null +++ b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/editor/ToolTipComponent.kt @@ -0,0 +1,121 @@ +import com.github.continuedev.continueintellijextension.actions.focusContinueInput +import com.github.continuedev.continueintellijextension.editor.openInlineEdit +import com.intellij.openapi.editor.Editor +import com.intellij.openapi.editor.LogicalPosition +import com.intellij.openapi.editor.colors.EditorColorsManager +import com.intellij.ui.components.JBPanel +import java.awt.* +import java.awt.event.ActionEvent +import java.util.* +import javax.swing.JButton +import java.awt.geom.RoundRectangle2D + +class StyledButton(text: String, foregroundColor: Color) : JButton(text) { + init { + cursor = Cursor(Cursor.HAND_CURSOR) + isOpaque = false + isContentAreaFilled = false + isFocusPainted = false + border = null // Remove the border + foreground = foregroundColor + } + + override fun paintComponent(g: Graphics) { + val g2 = g.create() as Graphics2D + g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON) + + val arc = 24f // Corner radius + val padding = 0f + val x = padding + val y = padding + val w = (width - 2 * padding) + val h = (height - 2 * padding) + + // Draw flat background +// g2.color = if (model.isPressed) Color(70, 70, 70) else Color(100, 100, 100) +// g2.fill(RoundRectangle2D.Float(x, y, w, h, arc, arc)) + + // Draw border +// g2.color = Color(120, 120, 120) +// g2.draw(RoundRectangle2D.Float(x, y, w - 1, h - 1, arc, arc)) + + g2.dispose() + + super.paintComponent(g) + } +} + +class ToolTipComponent(editor: Editor, x: Int, y: Int) : + JBPanel() { + private var addToChatButton: StyledButton + private var editButton: StyledButton + private var backgroundColor: Color + private var foregroundColor: Color + + init { + layout = null // Remove the FlowLayout + + val globalScheme = EditorColorsManager.getInstance().globalScheme + backgroundColor = globalScheme.defaultBackground + foregroundColor = Color( + globalScheme.defaultForeground.red, + globalScheme.defaultForeground.green, + globalScheme.defaultForeground.blue, + 200 + ) + + val cmdCtrlChar = if (System.getProperty("os.name").lowercase(Locale.getDefault()).contains("mac")) "⌘" else "Ctrl" + addToChatButton = StyledButton("${cmdCtrlChar}J Chat", foregroundColor) + editButton = StyledButton("${cmdCtrlChar}I Edit", foregroundColor) + + addToChatButton.addActionListener { e: ActionEvent? -> + focusContinueInput(editor.project) + editor.contentComponent.remove(this) + } + editButton.addActionListener { e: ActionEvent? -> + openInlineEdit(editor.project, editor) + editor.contentComponent.remove(this) + } + + // Set bounds for buttons to remove spacing + addToChatButton.setBounds(0, 0, addToChatButton.preferredSize.width, addToChatButton.preferredSize.height) + editButton.setBounds(addToChatButton.preferredSize.width, 0, editButton.preferredSize.width, editButton.preferredSize.height) + + add(addToChatButton) + add(editButton) + + val totalWidth = addToChatButton.preferredSize.width + editButton.preferredSize.width + val totalHeight = addToChatButton.preferredSize.height + setBounds(x, y, totalWidth, totalHeight) + + // Make the background transparent + isOpaque = false + background = Color(0, 0, 0, 0) + } + + override fun paintComponent(g: Graphics) { + val arc = 12f + + val g2 = g.create() as Graphics2D + g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON) + + // Draw rounded rectangle background + g2.color = backgroundColor + g2.fill(RoundRectangle2D.Float(0f, 0f, width.toFloat(), height.toFloat(), arc, arc)) + + // Draw rounded rectangle border + g2.color = Color(120, 120, 120) + val strokeWidth = 1.0f + g2.stroke = BasicStroke(1.0f) + g2.draw(RoundRectangle2D.Float(0f, 0f, width.toFloat() - strokeWidth, height.toFloat() - strokeWidth, arc, arc)) + + // Draw border between buttons + g2.color = Color(120, 120, 120) + g2.stroke = BasicStroke(1.0f) + val middleX = addToChatButton.width.toFloat() + g2.drawLine(middleX.toInt(), 0, middleX.toInt(), height) + + g2.dispose() + super.paintComponent(g) + } +} diff --git a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/listeners/ContinuePluginSelectionListener.kt b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/listeners/ContinuePluginSelectionListener.kt index e2164b090..42839b25b 100644 --- a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/listeners/ContinuePluginSelectionListener.kt +++ b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/listeners/ContinuePluginSelectionListener.kt @@ -1,8 +1,12 @@ package com.github.continuedev.continueintellijextension.listeners +import ToolTipComponent import com.github.continuedev.continueintellijextension.`continue`.IdeProtocolClient +import com.github.continuedev.continueintellijextension.services.ContinueExtensionSettings import com.github.continuedev.continueintellijextension.utils.Debouncer import com.intellij.openapi.application.ApplicationManager +import com.intellij.openapi.components.service +import com.intellij.openapi.editor.LogicalPosition import com.intellij.openapi.editor.SelectionModel import com.intellij.openapi.editor.event.SelectionEvent import com.intellij.openapi.editor.event.SelectionListener @@ -10,6 +14,8 @@ import com.intellij.openapi.fileEditor.FileDocumentManager import com.intellij.openapi.project.DumbAware import com.intellij.openapi.vfs.VirtualFile import kotlinx.coroutines.CoroutineScope +import kotlin.math.max +import kotlin.math.min class ContinuePluginSelectionListener( private val ideProtocolClient: IdeProtocolClient, @@ -20,11 +26,31 @@ class ContinuePluginSelectionListener( debouncer.debounce { handleSelection(e) } } + private var toolTipComponent: ToolTipComponent? = null + private fun handleSelection(e: SelectionEvent) { ApplicationManager.getApplication().runReadAction { val editor = e.editor val model: SelectionModel = editor.selectionModel - val selectedText = model.selectedText ?: return@runReadAction + val selectedText = model.selectedText + + // If selected text is empty, remove the tooltip + if (selectedText.isNullOrEmpty()) { + ApplicationManager.getApplication().invokeLater { + toolTipComponent?.let { editor.contentComponent.remove(it) } + toolTipComponent = null + editor.contentComponent.revalidate() + editor.contentComponent.repaint() + } + return@runReadAction + } + + // Allow user to disable editor tooltip + // Note that we still check for empty selected text before this + val extensionSettingsService = service() + if (extensionSettingsService.continueState.displayEditorTooltip == false) { + return@runReadAction + } val document = editor.document val startOffset = model.selectionStart @@ -39,14 +65,34 @@ class ContinuePluginSelectionListener( FileDocumentManager.getInstance().getFile(document) val filepath = virtualFile?.path ?: "Unknown path" - ideProtocolClient.onTextSelected( - selectedText, - filepath, - startLine, - startCharacter, - endLine, - endCharacter - ) + ApplicationManager.getApplication().invokeLater { + toolTipComponent?.let { editor.contentComponent.remove(it) } + + editor.contentComponent.layout = null + + val line = startLine - 2 + if (line > 0) { + // Get the text on line number "line" +// val text = document.getText(document.getLineStartOffset(line), document.getLineEndOffset(line)) + + val pos = LogicalPosition(line, selectedText.split("\n")[0].length + 1) + val y: Int = editor.logicalPositionToXY(pos).y + editor.lineHeight + var x: Int = editor.logicalPositionToXY(pos).x + + // Check if x is out of bounds + val maxEditorWidth = editor.contentComponent.width + val maxToolTipWidth = 600 + x = max(0, min(x, maxEditorWidth - maxToolTipWidth)) + + toolTipComponent = ToolTipComponent(editor, x, y) + editor.contentComponent.add(toolTipComponent) + } else { + toolTipComponent = null + } + + editor.contentComponent.revalidate() + editor.contentComponent.repaint() + } } } } 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 6ff8277a5..81bbbb6af 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 @@ -16,6 +16,7 @@ class ContinueSettingsComponent: DumbAware { val userToken: JTextField = JTextField() val enableTabAutocomplete: JCheckBox = JCheckBox("Enable Tab Autocomplete") val enableContinueTeamsBeta: JCheckBox = JCheckBox("Enable Continue for Teams Beta (requires restart)") + val displayEditorTooltip: JCheckBox = JCheckBox("Display Editor Tooltip") init { val constraints = GridBagConstraints() @@ -42,6 +43,8 @@ class ContinueSettingsComponent: DumbAware { constraints.gridy++ panel.add(enableContinueTeamsBeta, constraints) constraints.gridy++ + panel.add(displayEditorTooltip, constraints) + constraints.gridy++ // Add a "filler" component that takes up all remaining vertical space constraints.weighty = 1.0 @@ -65,6 +68,7 @@ open class ContinueExtensionSettings : PersistentStateComponent? = null var windowId: String = UUID.randomUUID().toString() diff --git a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/services/TelemetryService.kt b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/services/TelemetryService.kt new file mode 100644 index 000000000..5b7f00678 --- /dev/null +++ b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/services/TelemetryService.kt @@ -0,0 +1,28 @@ +package com.github.continuedev.continueintellijextension.services + +import com.intellij.openapi.components.Service +import com.posthog.java.PostHog +import com.posthog.java.PostHog.Builder + +@Service +class TelemetryService { + private val POSTHOG_API_KEY = "phc_JS6XFROuNbhJtVCEdTSYk6gl5ArRrTNMpCcguAXlSPs" + private var posthog: PostHog? = null; + private var distinctId: String? = null; + + fun setup(distinctId: String) { + this.posthog = Builder(POSTHOG_API_KEY).host("https://app.posthog.com").build() + this.distinctId = distinctId + } + + fun capture(eventName: String, properties: Map) { + if (this.posthog == null || this.distinctId == null) { + return; + } + this.posthog?.capture(this.distinctId, eventName, properties) + } + + fun shutdown() { + this.posthog?.shutdown() + } +} \ No newline at end of file diff --git a/extensions/intellij/src/main/resources/config_schema.json b/extensions/intellij/src/main/resources/config_schema.json index f57459207..daa0e5f01 100644 --- a/extensions/intellij/src/main/resources/config_schema.json +++ b/extensions/intellij/src/main/resources/config_schema.json @@ -171,6 +171,8 @@ "anthropic", "cohere", "bedrock", + "bedrockimport", + "sagemaker", "together", "ollama", "huggingface-tgi", @@ -187,7 +189,9 @@ "cloudflare", "deepseek", "azure", - "msty" + "msty", + "watsonx", + "openrouter" ], "markdownEnumDescriptions": [ "### OpenAI\nUse gpt-4, gpt-3.5-turbo, or any other OpenAI model. See [here](https://openai.com/product#made-for-developers) to obtain an API key.\n\n> [Reference](https://docs.continue.dev/reference/Model%20Providers/openai)", @@ -195,6 +199,8 @@ "### Anthropic\nTo get started with Anthropic models, you first need to sign up for the open beta [here](https://claude.ai/login) to obtain an API key.\n> [Reference](https://docs.continue.dev/reference/Model%20Providers/anthropicllm)", "### Cohere\nTo use Cohere, visit the [Cohere dashboard](https://dashboard.cohere.com/api-keys) to create an API key.\n\n> [Reference](https://docs.continue.dev/reference/Model%20Providers/cohere)", "### Bedrock\nTo get started with Bedrock you need to sign up on AWS [here](https://aws.amazon.com/bedrock/claude/)", + "### Bedrock Imported Models\nTo get started with Bedrock you need to sign up on AWS [here](https://aws.amazon.com/bedrock/claude/)", + "### Sagemaker\nSagemaker is AWS' machine learning platform.", "### Together\nTogether is a hosted service that provides extremely fast streaming of open-source language models. To get started with Together:\n1. Obtain an API key from [here](https://together.ai)\n2. Paste below\n3. Select a model preset\n> [Reference](https://docs.continue.dev/reference/Model%20Providers/togetherllm)", "### Ollama\nTo get started with Ollama, follow these steps:\n1. Download from [ollama.ai](https://ollama.ai/) and open the application\n2. Open a terminal and run `ollama run `. Example model names are `codellama:7b-instruct` or `llama2:7b-text`. You can find the full list [here](https://ollama.ai/library).\n3. Make sure that the model name used in step 2 is the same as the one in config.json (e.g. `model=\"codellama:7b-instruct\"`)\n4. Once the model has finished downloading, you can start asking questions through Continue.\n> [Reference](https://docs.continue.dev/reference/Model%20Providers/ollama)", "### Huggingface TGI\n\n> [Reference](https://docs.continue.dev/reference/Model%20Providers/huggingfacetgi)", @@ -211,7 +217,9 @@ "### Cloudflare Workers AI\n\n[Reference](https://developers.cloudflare.com/workers-ai/)", "### Deepseek\n Deepseek's API provides the best pricing for their state-of-the-art Deepseek Coder models. To get started, obtain an API key from [their console](https://platform.deepseek.com/api_keys)", "### Azure OpenAI\n Azure OpenAI lets you securely run OpenAI's models on Azure. To get started, follow the steps [here](https://docs.continue.dev/reference/Model%20Providers/azure)", - "### Msty\nMsty is the simplest way to get started with online or local LLMs on all desktop platforms - Windows, Mac, and Linux. No fussing around, one-click and you are up and running. To get started, follow these steps:\n1. Download from [Msty.app](https://msty.app/), open the application, and click 'Setup Local AI'.\n2. Go to the Local AI Module page and download a model of your choice.\n3. Once the model has finished downloading, you can start asking questions through Continue.\n> [Reference](https://continue.dev/docs/reference/Model%20Providers/Msty)" + "### Msty\nMsty is the simplest way to get started with online or local LLMs on all desktop platforms - Windows, Mac, and Linux. No fussing around, one-click and you are up and running. To get started, follow these steps:\n1. Download from [Msty.app](https://msty.app/), open the application, and click 'Setup Local AI'.\n2. Go to the Local AI Module page and download a model of your choice.\n3. Once the model has finished downloading, you can start asking questions through Continue.\n> [Reference](https://continue.dev/docs/reference/Model%20Providers/Msty)", + "### IBM watsonx\nwatsonx, developed by IBM, offers a variety of pre-trained AI foundation models that can be used for natural language processing (NLP), computer vision, and speech recognition tasks.", + "### OpenRouter\nOpenRouter offers a single API to access almost any language model. To get started, obtain an API key from [their console](https://openrouter.ai/settings/keys)." ], "type": "string" }, @@ -236,6 +244,11 @@ "default": 2048, "type": "integer" }, + "maxStopWords": { + "title": "Max Stop Words", + "description": "The maximum number of stop words that the API will accept. You can set this if you are receiving an error about the number of stop words, but otherwise should leave it undefined.", + "type": "integer" + }, "template": { "title": "Template", "description": "The chat template used to format messages. This is auto-detected for most models, but can be overridden here. Choose none if you are using vLLM or another server that automatically handles prompting.", @@ -321,6 +334,16 @@ "title": "Engine", "description": "Azure OpenAI engine", "type": "string" + }, + "capabilities": { + "type": "object", + "description": "We will attempt to automatically detect the capabilities of the model based on its title and provider, but this may not always be accurate. You can override the model's capabilities here.", + "properties": { + "uploadImage": { + "type": "boolean", + "description": "Indicates whether the model can upload images." + } + } } }, "required": ["title", "provider", "model"], @@ -644,6 +667,9 @@ }, "then": { "properties": { + "cacheSystemMessage": { + "type": "boolean" + }, "model": { "anyOf": [ { @@ -710,6 +736,23 @@ } } }, + { + "if": { + "properties": { + "provider": { + "enum": ["sagemaker"] + } + }, + "required": ["provider"] + }, + "then": { + "properties": { + "model": { + "markdownDescription": "SageMaker endpoint name" + } + } + } + }, { "if": { "properties": { @@ -721,6 +764,9 @@ }, "then": { "properties": { + "cacheSystemMessage": { + "type": "boolean" + }, "model": { "enum": [ "chat-bison-001", @@ -939,6 +985,9 @@ }, "then": { "properties": { + "cacheSystemMessage": { + "type": "boolean" + }, "model": { "enum": ["deepseek-chat", "deepseek-coder"] } @@ -1175,6 +1224,45 @@ } } } + }, + { + "if": { + "properties": { + "provider": { + "enum": ["watsonx"] + } + }, + "required": ["provider"] + }, + "then": { + "properties": { + "watsonxUrl": { + "type": "string" + }, + "watsonxApiKey": { + "type": "string" + }, + "watsonxApiVersion": { + "type": "string" + }, + "watsonxProjectId": { + "type": "string" + }, + "watsonxStopToken": { + "type": "string" + }, + "model": { + "enum": [ + "ibm/granite-13b-chat-v2", + "ibm/granite-20b-code-instruct", + "mistralai/mistral-large", + "meta-llama/llama-3-8b-instruct", + "meta-llama/llama-3-70b-instruct" + ] + } + }, + "required": ["watsonxUrl", "watsonxProjectId"] + } } ] }, @@ -1417,46 +1505,6 @@ } }, "allOf": [ - { - "if": { - "properties": { - "name": { - "enum": ["docs"] - } - } - }, - "then": { - "properties": { - "params": { - "properties": { - "sites": { - "type": "array", - "items": { - "type": "object", - "properties": { - "title": { - "type": "string" - }, - "startUrl": { - "type": "string" - }, - "rootUrl": { - "type": "string" - }, - "maxDepth": { - "type": "integer" - } - }, - "required": ["title", "startUrl"] - } - } - }, - "required": ["sites"] - } - }, - "required": ["params"] - } - }, { "if": { "properties": { @@ -1849,6 +1897,10 @@ "maxDepth": { "type": "integer", "description": "The maximum depth to crawl the documentation site" + }, + "favicon": { + "type": "string", + "description": "The URL path to a favicon for the site - by default, it will be `/favicon.ico` path from the Start URL" } }, "required": ["title", "startUrl"] @@ -1946,18 +1998,6 @@ "description": "An optional token to identify the user.", "type": "string" }, - "dataServerUrl": { - "title": "Data Server Url", - "description": "The URL of the server where development data is sent. No data is sent unless a valid user token is provided.", - "default": "https://us-west1-autodebug.cloudfunctions.net", - "type": "string" - }, - "disableSummaries": { - "title": "Disable Summaries", - "markdownDescription": "If set to `true`, Continue will not generate summaries for each Step. This can be useful if you want to save on compute.", - "default": false, - "type": "boolean" - }, "disableIndexing": { "title": "Disable Indexing", "markdownDescription": "If set to `true`, Continue will not index the codebase. This is mainly used for debugging purposes.", @@ -1972,7 +2012,7 @@ }, "embeddingsProvider": { "title": "Embeddings Provider", - "markdownDescription": "The method that will be used to generate codebase embeddings. The default is transformers.js, which will run locally in the browser. Learn about the other options [here](https://docs.continue.dev/walkthroughs/codebase-embeddings#embeddings-providers).", + "markdownDescription": "The method that will be used to generate codebase embeddings. The default is transformers.js, which will run locally in the browser. Learn about the other options [here](https://docs.continue.dev/features/codebase-embeddings#embeddings-providers).", "type": "object", "properties": { "provider": { @@ -2210,7 +2250,7 @@ "tabAutocompleteOptions": { "title": "TabAutocompleteOptions", "type": "object", - "markdownDescription": "These options let you customize your tab-autocomplete experience. Read about all options in [the docs](https://docs.continue.dev/walkthroughs/tab-autocomplete#configuration-options).", + "markdownDescription": "These options let you customize your tab-autocomplete experience. Read about all options in [the docs](https://docs.continue.dev/features/tab-autocomplete#configuration-options).", "properties": { "disable": { "type": "boolean", @@ -2289,6 +2329,56 @@ } } }, + "analytics": { + "type": "object", + "properties": { + "provider": { + "type": "string", + "enum": ["posthog", "logstash"], + "description": "The 3rd party analytics provider to use.", + "default": "posthog", + "markdownEnumDescriptions": [ + "### Posthog\nTo use Posthog, set up an account, obtain your client key, and enter it in the client key field.", + "### Logstash\nContinue's Logstash integration uses the TCP input at the specified URL" + ] + }, + "url": { + "type": "string", + "description": "The URL to which analytics will be sent" + }, + "clientKey": { + "type": "string", + "description": "The client key to use for analytics" + } + }, + "required": ["provider"], + "allOf": [ + { + "if": { + "properties": { + "provider": { + "enum": ["posthog"] + } + } + }, + "then": { + "required": ["clientKey"] + } + }, + { + "if": { + "properties": { + "provider": { + "enum": ["logstash"] + } + } + }, + "then": { + "required": ["url"] + } + } + ] + }, "experimental": { "type": "object", "title": "Experimental", @@ -2297,7 +2387,19 @@ "defaultContext": { "type": "array", "items": { - "enum": ["activeFile"] + "allOf": [ + { + "$ref": "#/definitions/ContextProviderWithParams" + }, + { + "properties": { + "query": { + "type": "string", + "description": "Required for certain context providers, like 'url' in order to specify the input, or which of the dropdown items to select." + } + } + } + ] } }, "modelRoles": { @@ -2308,6 +2410,11 @@ } } }, + "readResponseTTS": { + "type": "boolean", + "default": true, + "description": "Automatically read LLM chat responses aloud using system TTS models" + }, "promptPath": { "type": "string" }, diff --git a/extensions/vscode/CHANGELOG.md b/extensions/vscode/CHANGELOG.md index 92d3d2d6f..a20a75b56 100644 --- a/extensions/vscode/CHANGELOG.md +++ b/extensions/vscode/CHANGELOG.md @@ -5,25 +5,56 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html), and is generated by [Changie](https://github.com/miniscruff/changie). -Pre-release Changes +## 0.8.47 - 2024-08-27 +### Added +* Use headless browser for crawling to get better results +* TTS support in the chat window +### Changed +* Improved support for WatsonX models +### Fixed +* Fixed several small indexing bugs + +## 0.8.46 - 2024-08-11 +### Added +* new /onboard slash command +### Fixed +* Fixed problem loading config.ts +* Fixed bug causing duplicate indexing work + +## 0.8.45 - 2024-08-05 ### Added * Support for Llama 3.1 and gpt-4o-mini +* Support for WatsonX+Granite models ### Changed * Significant improvements to indexing performance * Improved @codebase quality by more accurately searching over file names and paths - -## 0.8.40 - 2024-07-02 -### Added -* Support for Gemini 1.5 Pro -* Link to code in the sidebar when using codebase retrieval -* Smoother onboarding experience -* .prompt files, a way of saving and sharing slash commands -* Support for Claude 3.5 Sonnet, Deepseek Coder v2, and other new models -* Support for comments in config.json -* Specify multiple autocomplete models and switch between them -* Improved bracket matching strategy reduces noisy completions +* Improved @codebase accuracy +* Further improvements to indexing performance ### Fixed -* Numerous reliability upgrades to codebase indexing +* Improved docs indexing and management +* Fixed Gemini embeddings provider + +## 0.8.43 - 2024-07-08 +### Added +* Improved indexing reliability and testing +* Quick Actions: use CodeLens to quickly take common actions like adding docstrings + +## 0.8.42 - 2024-07-02 + +### Added + +- Support for Gemini 1.5 Pro +- Link to code in the sidebar when using codebase retrieval +- Smoother onboarding experience +- .prompt files, a way of saving and sharing slash commands +- Support for Claude 3.5 Sonnet, Deepseek Coder v2, and other new models +- Support for comments in config.json +- Specify multiple autocomplete models and switch between them +- Improved bracket matching strategy reduces noisy completions + +### Fixed + +- Numerous reliability upgrades to codebase indexing ## 0.8.24 - 2024-04-12 ### Added diff --git a/extensions/vscode/README.md b/extensions/vscode/README.md index 9d0b669d8..885fbf960 100644 --- a/extensions/vscode/README.md +++ b/extensions/vscode/README.md @@ -50,4 +50,4 @@ Learn more about the models and providers [here](https://continue.dev/docs/setup ## License -[Apache 2.0 © 2023 Continue Dev, Inc.](./LICENSE) +[Apache 2.0 © 2023-2024 Continue Dev, Inc.](./LICENSE) diff --git a/extensions/vscode/config_schema.json b/extensions/vscode/config_schema.json index f57459207..daa0e5f01 100644 --- a/extensions/vscode/config_schema.json +++ b/extensions/vscode/config_schema.json @@ -171,6 +171,8 @@ "anthropic", "cohere", "bedrock", + "bedrockimport", + "sagemaker", "together", "ollama", "huggingface-tgi", @@ -187,7 +189,9 @@ "cloudflare", "deepseek", "azure", - "msty" + "msty", + "watsonx", + "openrouter" ], "markdownEnumDescriptions": [ "### OpenAI\nUse gpt-4, gpt-3.5-turbo, or any other OpenAI model. See [here](https://openai.com/product#made-for-developers) to obtain an API key.\n\n> [Reference](https://docs.continue.dev/reference/Model%20Providers/openai)", @@ -195,6 +199,8 @@ "### Anthropic\nTo get started with Anthropic models, you first need to sign up for the open beta [here](https://claude.ai/login) to obtain an API key.\n> [Reference](https://docs.continue.dev/reference/Model%20Providers/anthropicllm)", "### Cohere\nTo use Cohere, visit the [Cohere dashboard](https://dashboard.cohere.com/api-keys) to create an API key.\n\n> [Reference](https://docs.continue.dev/reference/Model%20Providers/cohere)", "### Bedrock\nTo get started with Bedrock you need to sign up on AWS [here](https://aws.amazon.com/bedrock/claude/)", + "### Bedrock Imported Models\nTo get started with Bedrock you need to sign up on AWS [here](https://aws.amazon.com/bedrock/claude/)", + "### Sagemaker\nSagemaker is AWS' machine learning platform.", "### Together\nTogether is a hosted service that provides extremely fast streaming of open-source language models. To get started with Together:\n1. Obtain an API key from [here](https://together.ai)\n2. Paste below\n3. Select a model preset\n> [Reference](https://docs.continue.dev/reference/Model%20Providers/togetherllm)", "### Ollama\nTo get started with Ollama, follow these steps:\n1. Download from [ollama.ai](https://ollama.ai/) and open the application\n2. Open a terminal and run `ollama run `. Example model names are `codellama:7b-instruct` or `llama2:7b-text`. You can find the full list [here](https://ollama.ai/library).\n3. Make sure that the model name used in step 2 is the same as the one in config.json (e.g. `model=\"codellama:7b-instruct\"`)\n4. Once the model has finished downloading, you can start asking questions through Continue.\n> [Reference](https://docs.continue.dev/reference/Model%20Providers/ollama)", "### Huggingface TGI\n\n> [Reference](https://docs.continue.dev/reference/Model%20Providers/huggingfacetgi)", @@ -211,7 +217,9 @@ "### Cloudflare Workers AI\n\n[Reference](https://developers.cloudflare.com/workers-ai/)", "### Deepseek\n Deepseek's API provides the best pricing for their state-of-the-art Deepseek Coder models. To get started, obtain an API key from [their console](https://platform.deepseek.com/api_keys)", "### Azure OpenAI\n Azure OpenAI lets you securely run OpenAI's models on Azure. To get started, follow the steps [here](https://docs.continue.dev/reference/Model%20Providers/azure)", - "### Msty\nMsty is the simplest way to get started with online or local LLMs on all desktop platforms - Windows, Mac, and Linux. No fussing around, one-click and you are up and running. To get started, follow these steps:\n1. Download from [Msty.app](https://msty.app/), open the application, and click 'Setup Local AI'.\n2. Go to the Local AI Module page and download a model of your choice.\n3. Once the model has finished downloading, you can start asking questions through Continue.\n> [Reference](https://continue.dev/docs/reference/Model%20Providers/Msty)" + "### Msty\nMsty is the simplest way to get started with online or local LLMs on all desktop platforms - Windows, Mac, and Linux. No fussing around, one-click and you are up and running. To get started, follow these steps:\n1. Download from [Msty.app](https://msty.app/), open the application, and click 'Setup Local AI'.\n2. Go to the Local AI Module page and download a model of your choice.\n3. Once the model has finished downloading, you can start asking questions through Continue.\n> [Reference](https://continue.dev/docs/reference/Model%20Providers/Msty)", + "### IBM watsonx\nwatsonx, developed by IBM, offers a variety of pre-trained AI foundation models that can be used for natural language processing (NLP), computer vision, and speech recognition tasks.", + "### OpenRouter\nOpenRouter offers a single API to access almost any language model. To get started, obtain an API key from [their console](https://openrouter.ai/settings/keys)." ], "type": "string" }, @@ -236,6 +244,11 @@ "default": 2048, "type": "integer" }, + "maxStopWords": { + "title": "Max Stop Words", + "description": "The maximum number of stop words that the API will accept. You can set this if you are receiving an error about the number of stop words, but otherwise should leave it undefined.", + "type": "integer" + }, "template": { "title": "Template", "description": "The chat template used to format messages. This is auto-detected for most models, but can be overridden here. Choose none if you are using vLLM or another server that automatically handles prompting.", @@ -321,6 +334,16 @@ "title": "Engine", "description": "Azure OpenAI engine", "type": "string" + }, + "capabilities": { + "type": "object", + "description": "We will attempt to automatically detect the capabilities of the model based on its title and provider, but this may not always be accurate. You can override the model's capabilities here.", + "properties": { + "uploadImage": { + "type": "boolean", + "description": "Indicates whether the model can upload images." + } + } } }, "required": ["title", "provider", "model"], @@ -644,6 +667,9 @@ }, "then": { "properties": { + "cacheSystemMessage": { + "type": "boolean" + }, "model": { "anyOf": [ { @@ -710,6 +736,23 @@ } } }, + { + "if": { + "properties": { + "provider": { + "enum": ["sagemaker"] + } + }, + "required": ["provider"] + }, + "then": { + "properties": { + "model": { + "markdownDescription": "SageMaker endpoint name" + } + } + } + }, { "if": { "properties": { @@ -721,6 +764,9 @@ }, "then": { "properties": { + "cacheSystemMessage": { + "type": "boolean" + }, "model": { "enum": [ "chat-bison-001", @@ -939,6 +985,9 @@ }, "then": { "properties": { + "cacheSystemMessage": { + "type": "boolean" + }, "model": { "enum": ["deepseek-chat", "deepseek-coder"] } @@ -1175,6 +1224,45 @@ } } } + }, + { + "if": { + "properties": { + "provider": { + "enum": ["watsonx"] + } + }, + "required": ["provider"] + }, + "then": { + "properties": { + "watsonxUrl": { + "type": "string" + }, + "watsonxApiKey": { + "type": "string" + }, + "watsonxApiVersion": { + "type": "string" + }, + "watsonxProjectId": { + "type": "string" + }, + "watsonxStopToken": { + "type": "string" + }, + "model": { + "enum": [ + "ibm/granite-13b-chat-v2", + "ibm/granite-20b-code-instruct", + "mistralai/mistral-large", + "meta-llama/llama-3-8b-instruct", + "meta-llama/llama-3-70b-instruct" + ] + } + }, + "required": ["watsonxUrl", "watsonxProjectId"] + } } ] }, @@ -1417,46 +1505,6 @@ } }, "allOf": [ - { - "if": { - "properties": { - "name": { - "enum": ["docs"] - } - } - }, - "then": { - "properties": { - "params": { - "properties": { - "sites": { - "type": "array", - "items": { - "type": "object", - "properties": { - "title": { - "type": "string" - }, - "startUrl": { - "type": "string" - }, - "rootUrl": { - "type": "string" - }, - "maxDepth": { - "type": "integer" - } - }, - "required": ["title", "startUrl"] - } - } - }, - "required": ["sites"] - } - }, - "required": ["params"] - } - }, { "if": { "properties": { @@ -1849,6 +1897,10 @@ "maxDepth": { "type": "integer", "description": "The maximum depth to crawl the documentation site" + }, + "favicon": { + "type": "string", + "description": "The URL path to a favicon for the site - by default, it will be `/favicon.ico` path from the Start URL" } }, "required": ["title", "startUrl"] @@ -1946,18 +1998,6 @@ "description": "An optional token to identify the user.", "type": "string" }, - "dataServerUrl": { - "title": "Data Server Url", - "description": "The URL of the server where development data is sent. No data is sent unless a valid user token is provided.", - "default": "https://us-west1-autodebug.cloudfunctions.net", - "type": "string" - }, - "disableSummaries": { - "title": "Disable Summaries", - "markdownDescription": "If set to `true`, Continue will not generate summaries for each Step. This can be useful if you want to save on compute.", - "default": false, - "type": "boolean" - }, "disableIndexing": { "title": "Disable Indexing", "markdownDescription": "If set to `true`, Continue will not index the codebase. This is mainly used for debugging purposes.", @@ -1972,7 +2012,7 @@ }, "embeddingsProvider": { "title": "Embeddings Provider", - "markdownDescription": "The method that will be used to generate codebase embeddings. The default is transformers.js, which will run locally in the browser. Learn about the other options [here](https://docs.continue.dev/walkthroughs/codebase-embeddings#embeddings-providers).", + "markdownDescription": "The method that will be used to generate codebase embeddings. The default is transformers.js, which will run locally in the browser. Learn about the other options [here](https://docs.continue.dev/features/codebase-embeddings#embeddings-providers).", "type": "object", "properties": { "provider": { @@ -2210,7 +2250,7 @@ "tabAutocompleteOptions": { "title": "TabAutocompleteOptions", "type": "object", - "markdownDescription": "These options let you customize your tab-autocomplete experience. Read about all options in [the docs](https://docs.continue.dev/walkthroughs/tab-autocomplete#configuration-options).", + "markdownDescription": "These options let you customize your tab-autocomplete experience. Read about all options in [the docs](https://docs.continue.dev/features/tab-autocomplete#configuration-options).", "properties": { "disable": { "type": "boolean", @@ -2289,6 +2329,56 @@ } } }, + "analytics": { + "type": "object", + "properties": { + "provider": { + "type": "string", + "enum": ["posthog", "logstash"], + "description": "The 3rd party analytics provider to use.", + "default": "posthog", + "markdownEnumDescriptions": [ + "### Posthog\nTo use Posthog, set up an account, obtain your client key, and enter it in the client key field.", + "### Logstash\nContinue's Logstash integration uses the TCP input at the specified URL" + ] + }, + "url": { + "type": "string", + "description": "The URL to which analytics will be sent" + }, + "clientKey": { + "type": "string", + "description": "The client key to use for analytics" + } + }, + "required": ["provider"], + "allOf": [ + { + "if": { + "properties": { + "provider": { + "enum": ["posthog"] + } + } + }, + "then": { + "required": ["clientKey"] + } + }, + { + "if": { + "properties": { + "provider": { + "enum": ["logstash"] + } + } + }, + "then": { + "required": ["url"] + } + } + ] + }, "experimental": { "type": "object", "title": "Experimental", @@ -2297,7 +2387,19 @@ "defaultContext": { "type": "array", "items": { - "enum": ["activeFile"] + "allOf": [ + { + "$ref": "#/definitions/ContextProviderWithParams" + }, + { + "properties": { + "query": { + "type": "string", + "description": "Required for certain context providers, like 'url' in order to specify the input, or which of the dropdown items to select." + } + } + } + ] } }, "modelRoles": { @@ -2308,6 +2410,11 @@ } } }, + "readResponseTTS": { + "type": "boolean", + "default": true, + "description": "Automatically read LLM chat responses aloud using system TTS models" + }, "promptPath": { "type": "string" }, diff --git a/extensions/vscode/continue_rc_schema.json b/extensions/vscode/continue_rc_schema.json index fb412d207..1a197c512 100644 --- a/extensions/vscode/continue_rc_schema.json +++ b/extensions/vscode/continue_rc_schema.json @@ -174,6 +174,8 @@ "anthropic", "cohere", "bedrock", + "bedrockimport", + "sagemaker", "together", "ollama", "huggingface-tgi", @@ -190,7 +192,9 @@ "cloudflare", "deepseek", "azure", - "msty" + "msty", + "watsonx", + "openrouter" ], "markdownEnumDescriptions": [ "### OpenAI\nUse gpt-4, gpt-3.5-turbo, or any other OpenAI model. See [here](https://openai.com/product#made-for-developers) to obtain an API key.\n\n> [Reference](https://docs.continue.dev/reference/Model%20Providers/openai)", @@ -198,6 +202,8 @@ "### Anthropic\nTo get started with Anthropic models, you first need to sign up for the open beta [here](https://claude.ai/login) to obtain an API key.\n> [Reference](https://docs.continue.dev/reference/Model%20Providers/anthropicllm)", "### Cohere\nTo use Cohere, visit the [Cohere dashboard](https://dashboard.cohere.com/api-keys) to create an API key.\n\n> [Reference](https://docs.continue.dev/reference/Model%20Providers/cohere)", "### Bedrock\nTo get started with Bedrock you need to sign up on AWS [here](https://aws.amazon.com/bedrock/claude/)", + "### Bedrock Imported Models\nTo get started with Bedrock you need to sign up on AWS [here](https://aws.amazon.com/bedrock/claude/)", + "### Sagemaker\nSagemaker is AWS' machine learning platform.", "### Together\nTogether is a hosted service that provides extremely fast streaming of open-source language models. To get started with Together:\n1. Obtain an API key from [here](https://together.ai)\n2. Paste below\n3. Select a model preset\n> [Reference](https://docs.continue.dev/reference/Model%20Providers/togetherllm)", "### Ollama\nTo get started with Ollama, follow these steps:\n1. Download from [ollama.ai](https://ollama.ai/) and open the application\n2. Open a terminal and run `ollama run `. Example model names are `codellama:7b-instruct` or `llama2:7b-text`. You can find the full list [here](https://ollama.ai/library).\n3. Make sure that the model name used in step 2 is the same as the one in config.json (e.g. `model=\"codellama:7b-instruct\"`)\n4. Once the model has finished downloading, you can start asking questions through Continue.\n> [Reference](https://docs.continue.dev/reference/Model%20Providers/ollama)", "### Huggingface TGI\n\n> [Reference](https://docs.continue.dev/reference/Model%20Providers/huggingfacetgi)", @@ -214,7 +220,9 @@ "### Cloudflare Workers AI\n\n[Reference](https://developers.cloudflare.com/workers-ai/)", "### Deepseek\n Deepseek's API provides the best pricing for their state-of-the-art Deepseek Coder models. To get started, obtain an API key from [their console](https://platform.deepseek.com/api_keys)", "### Azure OpenAI\n Azure OpenAI lets you securely run OpenAI's models on Azure. To get started, follow the steps [here](https://docs.continue.dev/reference/Model%20Providers/azure)", - "### Msty\nMsty is the simplest way to get started with online or local LLMs on all desktop platforms - Windows, Mac, and Linux. No fussing around, one-click and you are up and running. To get started, follow these steps:\n1. Download from [Msty.app](https://msty.app/), open the application, and click 'Setup Local AI'.\n2. Go to the Local AI Module page and download a model of your choice.\n3. Once the model has finished downloading, you can start asking questions through Continue.\n> [Reference](https://continue.dev/docs/reference/Model%20Providers/Msty)" + "### Msty\nMsty is the simplest way to get started with online or local LLMs on all desktop platforms - Windows, Mac, and Linux. No fussing around, one-click and you are up and running. To get started, follow these steps:\n1. Download from [Msty.app](https://msty.app/), open the application, and click 'Setup Local AI'.\n2. Go to the Local AI Module page and download a model of your choice.\n3. Once the model has finished downloading, you can start asking questions through Continue.\n> [Reference](https://continue.dev/docs/reference/Model%20Providers/Msty)", + "### IBM watsonx\nwatsonx, developed by IBM, offers a variety of pre-trained AI foundation models that can be used for natural language processing (NLP), computer vision, and speech recognition tasks.", + "### OpenRouter\nOpenRouter offers a single API to access almost any language model. To get started, obtain an API key from [their console](https://openrouter.ai/settings/keys)." ], "type": "string" }, @@ -239,6 +247,11 @@ "default": 2048, "type": "integer" }, + "maxStopWords": { + "title": "Max Stop Words", + "description": "The maximum number of stop words that the API will accept. You can set this if you are receiving an error about the number of stop words, but otherwise should leave it undefined.", + "type": "integer" + }, "template": { "title": "Template", "description": "The chat template used to format messages. This is auto-detected for most models, but can be overridden here. Choose none if you are using vLLM or another server that automatically handles prompting.", @@ -327,6 +340,16 @@ "title": "Engine", "description": "Azure OpenAI engine", "type": "string" + }, + "capabilities": { + "type": "object", + "description": "We will attempt to automatically detect the capabilities of the model based on its title and provider, but this may not always be accurate. You can override the model's capabilities here.", + "properties": { + "uploadImage": { + "type": "boolean", + "description": "Indicates whether the model can upload images." + } + } } }, "required": [ @@ -695,6 +718,9 @@ }, "then": { "properties": { + "cacheSystemMessage": { + "type": "boolean" + }, "model": { "anyOf": [ { @@ -772,6 +798,27 @@ } } }, + { + "if": { + "properties": { + "provider": { + "enum": [ + "sagemaker" + ] + } + }, + "required": [ + "provider" + ] + }, + "then": { + "properties": { + "model": { + "markdownDescription": "SageMaker endpoint name" + } + } + } + }, { "if": { "properties": { @@ -787,6 +834,9 @@ }, "then": { "properties": { + "cacheSystemMessage": { + "type": "boolean" + }, "model": { "enum": [ "chat-bison-001", @@ -1027,6 +1077,9 @@ }, "then": { "properties": { + "cacheSystemMessage": { + "type": "boolean" + }, "model": { "enum": [ "deepseek-chat", @@ -1302,6 +1355,52 @@ } } } + }, + { + "if": { + "properties": { + "provider": { + "enum": [ + "watsonx" + ] + } + }, + "required": [ + "provider" + ] + }, + "then": { + "properties": { + "watsonxUrl": { + "type": "string" + }, + "watsonxApiKey": { + "type": "string" + }, + "watsonxApiVersion": { + "type": "string" + }, + "watsonxProjectId": { + "type": "string" + }, + "watsonxStopToken": { + "type": "string" + }, + "model": { + "enum": [ + "ibm/granite-13b-chat-v2", + "ibm/granite-20b-code-instruct", + "mistralai/mistral-large", + "meta-llama/llama-3-8b-instruct", + "meta-llama/llama-3-70b-instruct" + ] + } + }, + "required": [ + "watsonxUrl", + "watsonxProjectId" + ] + } } ] }, @@ -1563,55 +1662,6 @@ } }, "allOf": [ - { - "if": { - "properties": { - "name": { - "enum": [ - "docs" - ] - } - } - }, - "then": { - "properties": { - "params": { - "properties": { - "sites": { - "type": "array", - "items": { - "type": "object", - "properties": { - "title": { - "type": "string" - }, - "startUrl": { - "type": "string" - }, - "rootUrl": { - "type": "string" - }, - "maxDepth": { - "type": "integer" - } - }, - "required": [ - "title", - "startUrl" - ] - } - } - }, - "required": [ - "sites" - ] - } - }, - "required": [ - "params" - ] - } - }, { "if": { "properties": { @@ -2071,6 +2121,10 @@ "maxDepth": { "type": "integer", "description": "The maximum depth to crawl the documentation site" + }, + "favicon": { + "type": "string", + "description": "The URL path to a favicon for the site - by default, it will be `/favicon.ico` path from the Start URL" } }, "required": [ @@ -2171,18 +2225,6 @@ "description": "An optional token to identify the user.", "type": "string" }, - "dataServerUrl": { - "title": "Data Server Url", - "description": "The URL of the server where development data is sent. No data is sent unless a valid user token is provided.", - "default": "https://us-west1-autodebug.cloudfunctions.net", - "type": "string" - }, - "disableSummaries": { - "title": "Disable Summaries", - "markdownDescription": "If set to `true`, Continue will not generate summaries for each Step. This can be useful if you want to save on compute.", - "default": false, - "type": "boolean" - }, "disableIndexing": { "title": "Disable Indexing", "markdownDescription": "If set to `true`, Continue will not index the codebase. This is mainly used for debugging purposes.", @@ -2197,7 +2239,7 @@ }, "embeddingsProvider": { "title": "Embeddings Provider", - "markdownDescription": "The method that will be used to generate codebase embeddings. The default is transformers.js, which will run locally in the browser. Learn about the other options [here](https://docs.continue.dev/walkthroughs/codebase-embeddings#embeddings-providers).", + "markdownDescription": "The method that will be used to generate codebase embeddings. The default is transformers.js, which will run locally in the browser. Learn about the other options [here](https://docs.continue.dev/features/codebase-embeddings#embeddings-providers).", "type": "object", "properties": { "provider": { @@ -2483,7 +2525,7 @@ "tabAutocompleteOptions": { "title": "TabAutocompleteOptions", "type": "object", - "markdownDescription": "These options let you customize your tab-autocomplete experience. Read about all options in [the docs](https://docs.continue.dev/walkthroughs/tab-autocomplete#configuration-options).", + "markdownDescription": "These options let you customize your tab-autocomplete experience. Read about all options in [the docs](https://docs.continue.dev/features/tab-autocomplete#configuration-options).", "properties": { "disable": { "type": "boolean", @@ -2569,6 +2611,69 @@ } } }, + "analytics": { + "type": "object", + "properties": { + "provider": { + "type": "string", + "enum": [ + "posthog", + "logstash" + ], + "description": "The 3rd party analytics provider to use.", + "default": "posthog", + "markdownEnumDescriptions": [ + "### Posthog\nTo use Posthog, set up an account, obtain your client key, and enter it in the client key field.", + "### Logstash\nContinue's Logstash integration uses the TCP input at the specified URL" + ] + }, + "url": { + "type": "string", + "description": "The URL to which analytics will be sent" + }, + "clientKey": { + "type": "string", + "description": "The client key to use for analytics" + } + }, + "required": [ + "provider" + ], + "allOf": [ + { + "if": { + "properties": { + "provider": { + "enum": [ + "posthog" + ] + } + } + }, + "then": { + "required": [ + "clientKey" + ] + } + }, + { + "if": { + "properties": { + "provider": { + "enum": [ + "logstash" + ] + } + } + }, + "then": { + "required": [ + "url" + ] + } + } + ] + }, "experimental": { "type": "object", "title": "Experimental", @@ -2577,8 +2682,18 @@ "defaultContext": { "type": "array", "items": { - "enum": [ - "activeFile" + "allOf": [ + { + "$ref": "#/definitions/ContextProviderWithParams" + }, + { + "properties": { + "query": { + "type": "string", + "description": "Required for certain context providers, like 'url' in order to specify the input, or which of the dropdown items to select." + } + } + } ] } }, @@ -2590,6 +2705,11 @@ } } }, + "readResponseTTS": { + "type": "boolean", + "default": true, + "description": "Automatically read LLM chat responses aloud using system TTS models" + }, "promptPath": { "type": "string" }, diff --git a/extensions/vscode/package-lock.json b/extensions/vscode/package-lock.json index f637a56a9..745ca0b7f 100644 --- a/extensions/vscode/package-lock.json +++ b/extensions/vscode/package-lock.json @@ -1,12 +1,12 @@ { "name": "continue", - "version": "0.9.189", + "version": "0.8.47", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "continue", - "version": "0.9.189", + "version": "0.8.47", "license": "Apache-2.0", "dependencies": { "@electron/rebuild": "^3.2.10", @@ -18,7 +18,7 @@ "axios": "^1.2.5", "core": "file:../../core", "cors": "^2.8.5", - "dbinfoz": "^0.1.4", + "dbinfoz": "^0.11.0", "downshift": "^7.6.0", "esbuild": "^0.17.19", "express": "^4.18.2", @@ -95,22 +95,19 @@ "version": "1.0.13", "license": "Apache-2.0", "dependencies": { - "@aws-sdk/client-bedrock-runtime": "^3.574.0", - "@aws-sdk/credential-providers": "^3.596.0", + "@aws-sdk/client-bedrock-runtime": "^3.620.1", + "@aws-sdk/client-sagemaker-runtime": "^3.621.0", + "@aws-sdk/credential-providers": "^3.620.1", "@continuedev/config-types": "^1.0.10", "@continuedev/llm-info": "^1.0.1", "@mozilla/readability": "^0.5.0", "@octokit/rest": "^20.0.2", - "@types/jsdom": "^21.1.6", - "@types/mozilla-readability": "^0.2.1", - "@types/node-fetch": "^2.6.11", "@typescript-eslint/eslint-plugin": "^7.8.0", "@typescript-eslint/parser": "^7.8.0", "@xenova/transformers": "2.14.0", "adf-to-md": "^1.1.0", "async-mutex": "^0.5.0", "axios": "^1.6.7", - "cheerio": "^1.0.0-rc.12", "commander": "^12.0.0", "comment-json": "^4.2.3", "dbinfoz": "^0.1.4", @@ -121,6 +118,7 @@ "http-proxy-agent": "^7.0.1", "https-proxy-agent": "^7.0.3", "ignore": "^5.3.1", + "jinja-js": "0.1.8", "js-tiktoken": "^1.0.8", "jsdom": "^24.0.0", "launchdarkly-node-client-sdk": "^3.2.0", @@ -131,8 +129,11 @@ "ollama": "^0.4.6", "onnxruntime-node": "1.14.0", "openai": "^4.20.1", + "p-limit": "^6.1.0", "pg": "^8.11.3", "posthog-node": "^3.6.3", + "puppeteer": "^22.4.0", + "puppeteer-chromium-resolver": "^23.0.0", "quick-lru": "^7.0.0", "replicate": "^0.26.0", "request": "^2.88.2", @@ -156,12 +157,20 @@ "@types/follow-redirects": "^1.14.4", "@types/jest": "^29.5.12", "@types/jquery": "^3.5.29", + "@types/jsdom": "^21.1.6", + "@types/mozilla-readability": "^0.2.1", "@types/mustache": "^4.2.5", + "@types/node-fetch": "^2.6.11", + "@types/pg": "^8.11.6", + "@types/request": "^2.48.12", "@types/uuid": "^9.0.7", + "@types/win-ca": "^3.5.4", + "cross-env": "^7.0.3", "esbuild": "0.17.19", "eslint": "^8", "eslint-plugin-import": "^2.29.1", "jest": "^29.7.0", + "jest-environment-jsdom": "^29.7.0", "myers-diff": "^2.1.0", "onnxruntime-common": "1.14.0", "onnxruntime-web": "1.14.0", @@ -3913,9 +3922,9 @@ } }, "node_modules/dbinfoz": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/dbinfoz/-/dbinfoz-0.1.4.tgz", - "integrity": "sha512-MB56+xS571ip7qoXqxdnOUtXebbWaqoZN+S++W51SQYJRSjQFGEIPucNmxgeQlBGJ1vM4mQNV47wzV6fcrezZg==", + "version": "0.11.0", + "resolved": "https://registry.npmjs.org/dbinfoz/-/dbinfoz-0.11.0.tgz", + "integrity": "sha512-l7REBd9pwTBI6PWSk/dx+zCpSE2tiJdSKfApeoOajnSgyMJgkwGfhpPO2mV76MLQeKPaSm0mMKxmoqd38SaHmw==", "dependencies": { "mysql2": "^3.9.1", "pg": "^8.11.3", diff --git a/extensions/vscode/package.json b/extensions/vscode/package.json index 6a7663e56..65e204a81 100644 --- a/extensions/vscode/package.json +++ b/extensions/vscode/package.json @@ -1,7 +1,8 @@ { "name": "continue", "icon": "media/icon.png", - "version": "0.9.189", + "author": "Continue Dev, Inc", + "version": "0.8.47", "repository": { "type": "git", "url": "https://github.com/continuedev/continue" @@ -74,6 +75,11 @@ "default": true, "markdownDescription": "Continue collects anonymous usage data, cleaned of PII, to help us improve the product for our users. Read more at [continue.dev › Telemetry](https://docs.continue.dev/telemetry)." }, + "continue.enableContinueForTeams": { + "type": "boolean", + "default": false, + "markdownDescription": "_(Requires window reload)_ Enable Continue for teams beta features. To sign in, click the person icon in the bottom right of the sidebar." + }, "continue.showInlineTip": { "type": "boolean", "default": true, @@ -81,13 +87,13 @@ }, "continue.enableQuickActions": { "type": "boolean", - "default": true, - "markdownDescription": "Enable the experimental Quick Actions feature. Read our walkthrough to learn about configuration and how to share feedback: [continue.dev › Walkthrough: Quick Actions (experimental)](https://docs.continue.dev/walkthroughs/quick-actions)" + "default": false, + "markdownDescription": "Enable the experimental Quick Actions feature. Read our walkthrough to learn about configuration and how to share feedback: [continue.dev › Walkthrough: Quick Actions (experimental)](https://docs.continue.dev/features/quick-actions)" }, "continue.enableTabAutocomplete": { "type": "boolean", "default": true, - "markdownDescription": "Enable Continue's tab autocomplete feature. Read our walkthrough to learn about configuration and how to share feedback: [continue.dev › Walkthrough: Tab Autocomplete (beta)](https://docs.continue.dev/walkthroughs/tab-autocomplete)" + "markdownDescription": "Enable Continue's tab autocomplete feature. Read our walkthrough to learn about configuration and how to share feedback: [continue.dev › Walkthrough: Tab Autocomplete (beta)](https://docs.continue.dev/features/tab-autocomplete)" }, "continue.pauseTabAutocompleteOnBattery": { "type": "boolean", @@ -168,7 +174,7 @@ { "command": "continue.debugTerminal", "category": "Continue", - "title": "Continue: Debug Terminal", + "title": "Debug Terminal", "group": "Continue" }, { @@ -193,7 +199,7 @@ { "command": "continue.selectFilesAsContext", "category": "Continue", - "title": "Continue: Select Files as Context", + "title": "Select Files as Context", "group": "Continue" }, { @@ -246,6 +252,12 @@ "title": "Codebase Force Re-Index", "group": "Continue" }, + { + "command": "continue.rebuildCodebaseIndex", + "category": "Continue", + "title": "Rebuild codebase index", + "group": "Continue" + }, { "command": "continue.docsIndex", "category": "Continue", @@ -270,11 +282,6 @@ "mac": "cmd+shift+l", "key": "ctrl+shift+l" }, - { - "command": "continue.toggleAuxiliaryBar", - "mac": "alt+cmd+l", - "key": "alt+ctrl+l" - }, { "command": "continue.acceptDiff", "mac": "shift+cmd+enter", @@ -295,13 +302,13 @@ "command": "continue.quickEditHistoryUp", "mac": "up", "key": "up", - "when": "continue.quickEditHistoryFocused" + "when": "false && continue.quickEditHistoryFocused" }, { "command": "continue.quickEditHistoryDown", "mac": "down", "key": "down", - "when": "continue.quickEditHistoryFocused" + "when": "false && continue.quickEditHistoryFocused" }, { "command": "continue.acceptVerticalDiffBlock", @@ -573,7 +580,7 @@ "axios": "^1.2.5", "core": "file:../../core", "cors": "^2.8.5", - "dbinfoz": "^0.1.4", + "dbinfoz": "^0.11.0", "downshift": "^7.6.0", "esbuild": "^0.17.19", "express": "^4.18.2", diff --git a/extensions/vscode/scripts/esbuild.js b/extensions/vscode/scripts/esbuild.js index 9aa62fa7a..f3d2c09db 100644 --- a/extensions/vscode/scripts/esbuild.js +++ b/extensions/vscode/scripts/esbuild.js @@ -19,6 +19,7 @@ const esbuildConfig = { // https://github.com/evanw/esbuild/issues/1492#issuecomment-893144483 inject: ["./scripts/importMetaUrl.js"], define: { "import.meta.url": "importMetaUrl" }, + supported: { "dynamic-import": false }, }; (async () => { diff --git a/extensions/vscode/scripts/package.js b/extensions/vscode/scripts/package.js index af2e76193..17594333e 100644 --- a/extensions/vscode/scripts/package.js +++ b/extensions/vscode/scripts/package.js @@ -15,14 +15,18 @@ if (!fs.existsSync("build")) { const isPreRelease = args.includes("--pre-release"); let command = isPreRelease -? "npx vsce package --out ./build patch --pre-release --no-dependencies" // --yarn" -: "npx vsce package --out ./build patch --no-dependencies"; // --yarn"; + ? "npx vsce package --out ./build patch --pre-release --no-dependencies" // --yarn" + : "npx vsce package --out ./build patch --no-dependencies"; // --yarn"; -if (target) command += ` --target ${target}`; +if (target) { + command += ` --target ${target}`; +} exec(command, (error) => { - if (error) throw error; + if (error) { + throw error; + } console.log( - "vsce package completed - extension created at extensions/vscode/build/continue-patch.vsix", + "vsce package completed - extension created at extensions/vscode/build/continue-{version}.vsix", ); }); diff --git a/extensions/vscode/scripts/prepackage-cross-platform.js b/extensions/vscode/scripts/prepackage-cross-platform.js index 59089dd62..018ea70c2 100644 --- a/extensions/vscode/scripts/prepackage-cross-platform.js +++ b/extensions/vscode/scripts/prepackage-cross-platform.js @@ -24,6 +24,7 @@ const { copySqliteBinary, installNodeModuleInTempDirAndCopyToCurrent, downloadSqliteBinary, + copyTokenizers, } = require("./utils"); // Clear folders that will be packaged to ensure clean slate @@ -104,6 +105,9 @@ async function package(target, os, arch, exe) { // *** onnxruntime-node *** await copyOnnxRuntimeFromNodeModules(target); + // copy llama tokenizers to out + copyTokenizers(); + // *** Install @lancedb binary *** const lancePackageToInstall = { "darwin-arm64": "@lancedb/vectordb-darwin-arm64", diff --git a/extensions/vscode/scripts/prepackage.js b/extensions/vscode/scripts/prepackage.js index 95aaf0010..f002e3c50 100644 --- a/extensions/vscode/scripts/prepackage.js +++ b/extensions/vscode/scripts/prepackage.js @@ -94,7 +94,7 @@ const exe = os === "win32" ? ".exe" : ""; execCmdSync("npm run build"); } - // Copy over the dist folder to the Intellij extension // + // Copy over the dist folder to the JetBrains extension // const intellijExtensionWebviewPath = path.join( "..", "extensions", @@ -114,7 +114,7 @@ const exe = os === "win32" ? ".exe" : ""; ncp("dist", intellijExtensionWebviewPath, (error) => { if (error) { console.warn( - "[error] Error copying React app build to Intellij extension: ", + "[error] Error copying React app build to JetBrains extension: ", error, ); reject(error); @@ -136,7 +136,7 @@ const exe = os === "win32" ? ".exe" : ""; path.join(intellijExtensionWebviewPath, "onigasm.wasm"), ); - console.log("[info] Copied gui build to Intellij extension"); + console.log("[info] Copied gui build to JetBrains extension"); // Then copy over the dist folder to the VSCode extension // const vscodeGuiPath = path.join("../extensions/vscode/gui"); @@ -245,9 +245,14 @@ const exe = os === "win32" ? ".exe" : ""; "../../../core/vendor/tree-sitter.wasm", "../../../core/llm/llamaTokenizerWorkerPool.mjs", "../../../core/llm/llamaTokenizer.mjs", + "../../../core/llm/tiktokenWorkerPool.mjs", ]; + for (const f of filesToCopy) { - fs.copyFileSync(path.join(__dirname, f), path.join(__dirname, "..", "out", path.basename(f))); + fs.copyFileSync( + path.join(__dirname, f), + path.join(__dirname, "..", "out", path.basename(f)), + ); console.log(`[info] Copied ${path.basename(f)}`); } @@ -456,6 +461,7 @@ const exe = os === "win32" ? ".exe" : ""; "@vscode/ripgrep", "workerpool", ]; + fs.mkdirSync("out/node_modules", { recursive: true }); await Promise.all( @@ -503,8 +509,8 @@ const exe = os === "win32" ? ".exe" : ""; os === "darwin" ? "libonnxruntime.1.14.0.dylib" : os === "linux" - ? "libonnxruntime.so.1.14.0" - : "onnxruntime.dll" + ? "libonnxruntime.so.1.14.0" + : "onnxruntime.dll" }`, "builtin-themes/dark_modern.json", @@ -543,8 +549,8 @@ const exe = os === "win32" ? ".exe" : ""; target === "win32-arm64" ? "esbuild.exe" : target === "win32-x64" - ? "win32-x64/esbuild.exe" - : `${target}/bin/esbuild` + ? "win32-x64/esbuild.exe" + : `${target}/bin/esbuild` }`, `out/node_modules/@lancedb/vectordb-${ os === "win32" diff --git a/extensions/vscode/scripts/utils.js b/extensions/vscode/scripts/utils.js index b0d7def7d..93c1928ce 100644 --- a/extensions/vscode/scripts/utils.js +++ b/extensions/vscode/scripts/utils.js @@ -39,6 +39,20 @@ function copyConfigSchema() { fs.writeFileSync("continue_rc_schema.json", JSON.stringify(schema, null, 2)); } +function copyTokenizers() { + fs.copyFileSync( + path.join(__dirname, "../../../core/llm/llamaTokenizerWorkerPool.mjs"), + path.join(__dirname, "../out/llamaTokenizerWorkerPool.mjs"), + ); + console.log("[info] Copied llamaTokenizerWorkerPool"); + + fs.copyFileSync( + path.join(__dirname, "../../../core/llm/llamaTokenizer.mjs"), + path.join(__dirname, "../out/llamaTokenizer.mjs"), + ); + console.log("[info] Copied llamaTokenizer"); +} + function installNodeModules() { // Make sure we are in the right directory if (!process.cwd().endsWith("vscode")) { @@ -64,7 +78,7 @@ async function buildGui(isGhAction) { execCmdSync("npm run build"); } - // Copy over the dist folder to the Intellij extension // + // Copy over the dist folder to the JetBrains extension // const intellijExtensionWebviewPath = path.join( "..", "extensions", @@ -84,7 +98,7 @@ async function buildGui(isGhAction) { ncp("dist", intellijExtensionWebviewPath, (error) => { if (error) { console.warn( - "[error] Error copying React app build to Intellij extension: ", + "[error] Error copying React app build to JetBrains extension: ", error, ); reject(error); @@ -106,7 +120,7 @@ async function buildGui(isGhAction) { path.join(intellijExtensionWebviewPath, "onigasm.wasm"), ); - console.log("[info] Copied gui build to Intellij extension"); + console.log("[info] Copied gui build to JetBrains extension"); // Then copy over the dist folder to the VSCode extension // const vscodeGuiPath = path.join("../extensions/vscode/gui"); @@ -242,6 +256,7 @@ async function copyNodeModules() { "@esbuild", "@lancedb", "@vscode/ripgrep", + "workerpool", ]; fs.mkdirSync("out/node_modules", { recursive: true }); @@ -313,15 +328,13 @@ async function downloadEsbuildBinary(target) { "win32-x64": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.17.19.tgz", }[target]; - execCmdSync( - `curl -L -o out/tmp/esbuild.tgz ${downloadUrl}`, - ); + execCmdSync(`curl -L -o out/tmp/esbuild.tgz ${downloadUrl}`); execCmdSync("cd out/tmp && tar -xvzf esbuild.tgz"); // Copy the installed package back to the current directory let tmpPath = "out/tmp/package/bin"; let outPath = `out/node_modules/@esbuild/${target}/bin`; if (target.startsWith("win")) { - tmpPath = 'out/tmp/package'; + tmpPath = "out/tmp/package"; outPath = `out/node_modules/@esbuild/${target}`; } @@ -332,10 +345,7 @@ async function downloadEsbuildBinary(target) { { dereference: true }, (error) => { if (error) { - console.error( - `[error] Error copying esbuild package`, - error, - ); + console.error(`[error] Error copying esbuild package`, error); reject(error); } else { resolve(); @@ -343,7 +353,7 @@ async function downloadEsbuildBinary(target) { }, ); }); - rimrafSync("out/tmp") + rimrafSync("out/tmp"); } async function downloadSqliteBinary(target) { @@ -393,7 +403,8 @@ async function copySqliteBinary() { async function downloadRipgrepBinary(target) { console.log("[info] Downloading pre-built ripgrep binary"); rimrafSync("node_modules/@vscode/ripgrep/bin"); - fs.mkdirSync("node_modules/@vscode/ripgrep/bin", { recursive: true });4 + fs.mkdirSync("node_modules/@vscode/ripgrep/bin", { recursive: true }); + 4; const downloadUrl = { "darwin-arm64": "https://github.com/microsoft/ripgrep-prebuilt/releases/download/v13.0.0-10/ripgrep-v13.0.0-10-aarch64-apple-darwin.tar.gz", @@ -409,8 +420,7 @@ async function downloadRipgrepBinary(target) { "https://github.com/microsoft/ripgrep-prebuilt/releases/download/v13.0.0-10/ripgrep-v13.0.0-10-x86_64-pc-windows-msvc.zip", }[target]; - - if(target.startsWith("win")) { + if (target.startsWith("win")) { execCmdSync( `curl -L -o node_modules/@vscode/ripgrep/bin/build.zip ${downloadUrl}`, ); @@ -420,7 +430,9 @@ async function downloadRipgrepBinary(target) { execCmdSync( `curl -L -o node_modules/@vscode/ripgrep/bin/build.tar.gz ${downloadUrl}`, ); - execCmdSync("cd node_modules/@vscode/ripgrep/bin && tar -xvzf build.tar.gz"); + execCmdSync( + "cd node_modules/@vscode/ripgrep/bin && tar -xvzf build.tar.gz", + ); fs.unlinkSync("node_modules/@vscode/ripgrep/bin/build.tar.gz"); } } @@ -497,4 +509,5 @@ module.exports = { installNodeModuleInTempDirAndCopyToCurrent, downloadSqliteBinary, downloadRipgrepBinary, + copyTokenizers, }; diff --git a/extensions/vscode/src/autocomplete/completionProvider.ts b/extensions/vscode/src/autocomplete/completionProvider.ts index 8e44af08e..95f5406f2 100644 --- a/extensions/vscode/src/autocomplete/completionProvider.ts +++ b/extensions/vscode/src/autocomplete/completionProvider.ts @@ -35,7 +35,7 @@ export class ContinueCompletionProvider if (val === "Documentation") { vscode.env.openExternal( vscode.Uri.parse( - "https://docs.continue.dev/walkthroughs/tab-autocomplete", + "https://docs.continue.dev/features/tab-autocomplete", ), ); } else if (val === "Download Ollama") { diff --git a/extensions/vscode/src/commands.ts b/extensions/vscode/src/commands.ts index 578c8e69c..4226b1328 100644 --- a/extensions/vscode/src/commands.ts +++ b/extensions/vscode/src/commands.ts @@ -91,7 +91,6 @@ async function addHighlightedCodeToContext( if (selection.isEmpty) { return; } - // adjust starting position to include indentation const start = new vscode.Position(selection.start.line, 0); const range = new vscode.Range(start, selection.end); @@ -285,12 +284,12 @@ const commandsMap: ( streamInlineEdit("docstring", prompt, false, range); }, - "continue.toggleAuxiliaryBar": () => { - vscode.commands.executeCommand("workbench.action.toggleAuxiliaryBar"); - }, "continue.codebaseForceReIndex": async () => { core.invoke("index/forceReIndex", undefined); }, + "continue.rebuildCodebaseIndex": async () => { + core.invoke("index/forceReIndex", { shouldClearIndexes: true }); + }, "continue.docsIndex": async () => { core.invoke("context/indexDocs", { reIndex: false }); }, @@ -321,8 +320,6 @@ const commandsMap: ( // Handle closing the GUI only if we are focused on the input if (fullScreenTab) { fullScreenPanel?.dispose(); - } else { - vscode.commands.executeCommand("workbench.action.closeAuxiliaryBar"); } } else { // Handle opening the GUI otherwise @@ -481,11 +478,6 @@ const commandsMap: ( //Full screen not open - open it captureCommandTelemetry("openFullScreen"); - // Close the sidebar.webviews - // vscode.commands.executeCommand("workbench.action.closeSidebar"); - vscode.commands.executeCommand("workbench.action.closeAuxiliaryBar"); - // vscode.commands.executeCommand("workbench.action.toggleZenMode"); - //create the full screen panel let panel = vscode.window.createWebviewPanel( "continue.continueGUIView", @@ -602,8 +594,8 @@ const commandsMap: ( currentStatus === StatusBarStatus.Paused ? StatusBarStatus.Enabled : currentStatus === StatusBarStatus.Disabled - ? StatusBarStatus.Paused - : StatusBarStatus.Disabled; + ? StatusBarStatus.Paused + : StatusBarStatus.Disabled; } else { // Toggle between Disabled and Enabled targetStatus = diff --git a/extensions/vscode/src/extension/VsCodeExtension.ts b/extensions/vscode/src/extension/VsCodeExtension.ts index efaff9e0f..563c0d068 100644 --- a/extensions/vscode/src/extension/VsCodeExtension.ts +++ b/extensions/vscode/src/extension/VsCodeExtension.ts @@ -252,11 +252,13 @@ export class VsCodeExtension { filepath.endsWith(".continueignore") || filepath.endsWith(".gitignore") ) { - // Update embeddings! (TODO) + // Reindex the workspaces + this.core.invoke("index/forceReIndex", undefined); + } else { + // Reindex the file + const indexer = await this.core.codebaseIndexerPromise; + indexer.refreshFile(filepath); } - - // Reindex the workspaces - this.core.invoke("index/forceReIndex", undefined); }); // When GitHub sign-in status changes, reload config @@ -291,7 +293,7 @@ export class VsCodeExtension { currentBranch !== this.PREVIOUS_BRANCH_FOR_WORKSPACE_DIR[dir] ) { // Trigger refresh of index only in this directory - this.core.invoke("index/forceReIndex", dir); + this.core.invoke("index/forceReIndex", { dir }); } } diff --git a/extensions/vscode/src/extension/VsCodeMessenger.ts b/extensions/vscode/src/extension/VsCodeMessenger.ts index e5866da6a..a51bd8233 100644 --- a/extensions/vscode/src/extension/VsCodeMessenger.ts +++ b/extensions/vscode/src/extension/VsCodeMessenger.ts @@ -292,6 +292,9 @@ export class VsCodeMessenger { } }); }); + this.onWebviewOrCore("infoPopup", (msg) => { + vscode.window.showInformationMessage(msg.data.message); + }); this.onWebviewOrCore("getGitHubAuthToken", (msg) => ide.getGitHubAuthToken(), ); diff --git a/extensions/vscode/src/ideProtocol.ts b/extensions/vscode/src/ideProtocol.ts index 968a85f4c..df3a909f1 100644 --- a/extensions/vscode/src/ideProtocol.ts +++ b/extensions/vscode/src/ideProtocol.ts @@ -20,7 +20,6 @@ import { editConfigJson, getConfigJsonPath, getContinueGlobalPath, - internalBetaPathExists, } from "core/util/paths"; import * as vscode from "vscode"; import { executeGotoProvider } from "./autocomplete/lsp"; @@ -523,7 +522,10 @@ class VsCodeIde implements IDE { 60, ), userToken: settings.get("userToken", ""), - enableControlServerBeta: internalBetaPathExists(), + enableControlServerBeta: settings.get( + "enableContinueForTeams", + false, + ), pauseCodebaseIndexOnStart: settings.get( "pauseCodebaseIndexOnStart", false, diff --git a/extensions/vscode/src/lang-server/codeLens/providers/QuickActionsCodeLensProvider.ts b/extensions/vscode/src/lang-server/codeLens/providers/QuickActionsCodeLensProvider.ts index 56ce22d4e..8f0c8adfe 100644 --- a/extensions/vscode/src/lang-server/codeLens/providers/QuickActionsCodeLensProvider.ts +++ b/extensions/vscode/src/lang-server/codeLens/providers/QuickActionsCodeLensProvider.ts @@ -1,12 +1,12 @@ import { ContinueConfig, QuickActionConfig } from "core"; +import { Telemetry } from "core/util/posthog"; import * as vscode from "vscode"; +import { QuickEditShowParams } from "../../../quickEdit/QuickEditQuickPick"; import { CONTINUE_WORKSPACE_KEY, getContinueWorkspaceConfig, } from "../../../util/workspaceConfig"; import { isTutorialFile } from "./TutorialCodeLensProvider"; -import { Telemetry } from "core/util/posthog"; -import { QuickEditShowParams } from "../../../quickEdit/QuickEditQuickPick"; export const ENABLE_QUICK_ACTIONS_KEY = "enableQuickActions"; @@ -48,13 +48,14 @@ export class QuickActionsCodeLensProvider implements vscode.CodeLensProvider { /** * Defines which code elements are eligible for Quick Actions. * - * Right now, we only allow functions, methods and classes - * to keep things simple. + * Right now, we only allow functions, methods, constructors + * and classes to keep things simple. */ - static quickActionSymbolKinds = [ + quickActionSymbolKinds = [ vscode.SymbolKind.Function, vscode.SymbolKind.Method, vscode.SymbolKind.Class, + vscode.SymbolKind.Constructor, ]; customQuickActionsConfig?: QuickActionConfig[]; @@ -94,6 +95,34 @@ export class QuickActionsCodeLensProvider implements vscode.CodeLensProvider { return [quickEdit]; } + /** + * Get all top-level symbols and their immediate children. + * We do not recurse through all children to avoid noise. + */ + async getTopLevelAndChildrenSymbols(uri: vscode.Uri) { + const topLevelSymbols = await vscode.commands.executeCommand< + Array | undefined + >("vscode.executeDocumentSymbolProvider", uri); + + if (!topLevelSymbols) { + return []; + } + + const childrenSymbols = topLevelSymbols.flatMap( + (symbol) => symbol.children, + ); + + const symbols = [...topLevelSymbols, ...childrenSymbols]; + + const filteredSmybols = symbols?.filter( + (symbol) => + this.quickActionSymbolKinds.includes(symbol.kind) && + !symbol.range.isSingleLine, + ); + + return filteredSmybols; + } + async provideCodeLenses( document: vscode.TextDocument, ): Promise { @@ -109,19 +138,9 @@ export class QuickActionsCodeLensProvider implements vscode.CodeLensProvider { return []; } - const symbols = await vscode.commands.executeCommand< - Array | undefined - >("vscode.executeDocumentSymbolProvider", document.uri); + const symbols = await this.getTopLevelAndChildrenSymbols(document.uri); - if (!symbols) { - return []; - } - - const filteredSmybols = symbols?.filter((def) => - QuickActionsCodeLensProvider.quickActionSymbolKinds.includes(def.kind), - ); - - return filteredSmybols.flatMap(({ range }) => { + return symbols.flatMap(({ range }) => { const commands: vscode.Command[] = !!this.customQuickActionsConfig ? this.getCustomCommands(range, this.customQuickActionsConfig) : this.getDefaultCommand(range); diff --git a/extensions/vscode/src/quickEdit/ContextProvidersQuickPick.ts b/extensions/vscode/src/quickEdit/ContextProvidersQuickPick.ts index cf986c897..02521c2ae 100644 --- a/extensions/vscode/src/quickEdit/ContextProvidersQuickPick.ts +++ b/extensions/vscode/src/quickEdit/ContextProvidersQuickPick.ts @@ -1,6 +1,6 @@ import { ContinueConfig, IDE } from "core"; -import { QuickPickItem, window } from "vscode"; import { fetchwithRequestOptions } from "core/util/fetchWithOptions"; +import { QuickPickItem, window } from "vscode"; export async function getContextProviderItems({ contextProviders, @@ -39,6 +39,7 @@ export async function getContextProvidersString( } return provider.getContextItems("", { + config, ide, embeddingsProvider: config.embeddingsProvider, reranker: config.reranker, @@ -73,12 +74,12 @@ export async function getContextProviderQuickPickVal( const val = await new Promise((resolve) => { quickPick.onDidAccept(async () => { const selectedItems = Array.from(quickPick.selectedItems); - const context = await getContextProvidersString( - selectedItems, - config, - ide, - ); - resolve(context); + getContextProvidersString(selectedItems, config, ide) + .then(resolve) + .catch((e) => { + console.warn(`Fail to get context providers: ${e}`); + resolve(""); + }); }); }); diff --git a/extensions/vscode/src/quickEdit/QuickEditQuickPick.ts b/extensions/vscode/src/quickEdit/QuickEditQuickPick.ts index 4be583ccd..58f6696c7 100644 --- a/extensions/vscode/src/quickEdit/QuickEditQuickPick.ts +++ b/extensions/vscode/src/quickEdit/QuickEditQuickPick.ts @@ -1,5 +1,5 @@ /* eslint-disable @typescript-eslint/naming-convention */ -import { IDE } from "core"; +import { ContinueConfig, IDE } from "core"; import { walkDir } from "core/indexing/walkDir"; import { Telemetry } from "core/util/posthog"; import * as vscode from "vscode"; @@ -94,6 +94,104 @@ export class QuickEdit { this.initializeFileSearchState(); } + /** + * Shows the Quick Edit Quick Pick, allowing the user to select an initial item or enter a prompt. + * Displays a quick pick for "History" or "ContextProviders" to set the prompt or context provider string. + * Displays a quick pick for "Model" to set the current model title. + * Appends the entered prompt to the history and streams the edit with input and context. + */ + async show(args?: QuickEditShowParams) { + // Clean up state from previous quick picks, e.g. if a user pressed `esc` + this.clear(); + + const editor = vscode.window.activeTextEditor; + + // We only allow users to interact with a quick edit if there is an open editor + if (!editor) { + return; + } + + // Set state that is unique to each quick pick instance + this.setActiveEditorAndPrevInput(editor); + + if (!this.editorWhenOpened) { + return; + } + + const config = await this.configHandler.loadConfig(); + + if (!!args?.initialPrompt) { + this.initialPrompt = args.initialPrompt; + } + + if (!!args?.range) { + this.range = args.range; + } + + const selectedLabelOrInputVal = await this._getInitialQuickPickVal(); + + if (!selectedLabelOrInputVal) { + return; + } + + Telemetry.capture("quickEditSelection", { + selection: selectedLabelOrInputVal, + }); + + let prompt: string | undefined = undefined; + + switch (selectedLabelOrInputVal) { + case QuickEditInitialItemLabels.History: + const historyVal = await getHistoryQuickPickVal(this.context); + prompt = historyVal ?? ""; + break; + + case QuickEditInitialItemLabels.ContextProviders: + const contextProviderVal = await getContextProviderQuickPickVal( + config, + this.ide, + ); + this.contextProviderStr = contextProviderVal ?? ""; + + // Recurse back to let the user write their prompt + this.show(args); + + break; + + case QuickEditInitialItemLabels.Model: + const curModelTitle = await this.getCurModelTitle(); + + if (!curModelTitle) { + break; + } + + const selectedModelTitle = await getModelQuickPickVal( + curModelTitle, + config, + ); + + if (selectedModelTitle) { + this._curModelTitle = selectedModelTitle; + } + + // Recurse back to let the user write their prompt + this.show(args); + + break; + + default: + // If it wasn't a label we can assume it was user input + if (selectedLabelOrInputVal) { + prompt = selectedLabelOrInputVal; + appendToHistory(selectedLabelOrInputVal, this.context); + } + } + + if (prompt) { + await this._streamEditWithInputAndContext(prompt); + } + } + private async initializeFileSearchState() { const workspaceDirs = await this.ide.getWorkspaceDirs(); @@ -123,22 +221,31 @@ export class QuickEdit { /** * Gets the model title the user has chosen, or their default model */ - private async _getCurModelTitle() { + private async getCurModelTitle() { const config = await this.configHandler.loadConfig(); if (this._curModelTitle) { return this._curModelTitle; } - let defaultModelTitle = - config.experimental?.modelRoles?.inlineEdit ?? - (await this.webviewProtocol.request("getDefaultModelTitle", undefined)); + const inlineEditModel = config.experimental?.modelRoles?.inlineEdit; - if (!defaultModelTitle) { - defaultModelTitle = config.models[0]?.title!; + if (inlineEditModel) { + return inlineEditModel; } - return defaultModelTitle; + let defaultModelTitle: string | undefined = + await this.webviewProtocol.request( + "getDefaultModelTitle", + undefined, + false, + ); + + if (!defaultModelTitle) { + defaultModelTitle = config.models[0].title; + } + + return defaultModelTitle || inlineEditModel; } /** @@ -148,7 +255,7 @@ export class QuickEdit { * @example * // "Edit myFile.ts", "Edit myFile.ts:5-10", "Edit myFile.ts:15" */ - _getQuickPickTitle = () => { + private getQuickPickTitle = () => { const { uri } = this.editorWhenOpened.document; const fileName = vscode.workspace.asRelativePath(uri, true); @@ -167,7 +274,7 @@ export class QuickEdit { }; private async _streamEditWithInputAndContext(prompt: string) { - const modelTitle = await this._getCurModelTitle(); + const modelTitle = await this.getCurModelTitle(); // Extracts all file references from the prompt string, // which are denoted by an '@' symbol followed by @@ -202,7 +309,13 @@ export class QuickEdit { } async _getInitialQuickPickVal(): Promise { - const modelTitle = await this._getCurModelTitle(); + const modelTitle = await this.getCurModelTitle(); + + if (!modelTitle) { + this.ide.infoPopup("Please configure a model to use Quick Edit"); + return undefined; + } + const { uri } = this.editorWhenOpened.document; const initialItems: vscode.QuickPickItem[] = [ @@ -247,7 +360,7 @@ export class QuickEdit { quickPick.items = initialItems; quickPick.placeholder = "Enter a prompt to edit your code (@ to search files, ⏎ to submit)"; - quickPick.title = this._getQuickPickTitle(); + quickPick.title = this.getQuickPickTitle(); quickPick.ignoreFocusOut = true; quickPick.value = this.initialPrompt ?? ""; @@ -361,94 +474,4 @@ export class QuickEdit { this.initialPrompt = undefined; this.range = undefined; } - - /** - * Shows the Quick Edit Quick Pick, allowing the user to select an initial item or enter a prompt. - * Displays a quick pick for "History" or "ContextProviders" to set the prompt or context provider string. - * Displays a quick pick for "Model" to set the current model title. - * Appends the entered prompt to the history and streams the edit with input and context. - */ - async show(args?: QuickEditShowParams) { - // Clean up state from previous quick picks, e.g. if a user pressed `esc` - this.clear(); - - const editor = vscode.window.activeTextEditor; - - // We only allow users to interact with a quick edit if there is an open editor - if (!editor) { - return; - } - - // Set state that is unique to each quick pick instance - this.setActiveEditorAndPrevInput(editor); - - if (!this.editorWhenOpened) { - return; - } - - const config = await this.configHandler.loadConfig(); - - if (!!args?.initialPrompt) { - this.initialPrompt = args.initialPrompt; - } - - if (!!args?.range) { - this.range = args.range; - } - - const selectedLabelOrInputVal = await this._getInitialQuickPickVal(); - - Telemetry.capture("quickEditSelection", { - selection: selectedLabelOrInputVal, - }); - - let prompt: string | undefined = undefined; - - switch (selectedLabelOrInputVal) { - case QuickEditInitialItemLabels.History: - const historyVal = await getHistoryQuickPickVal(this.context); - prompt = historyVal ?? ""; - break; - - case QuickEditInitialItemLabels.ContextProviders: - const contextProviderVal = await getContextProviderQuickPickVal( - config, - this.ide, - ); - this.contextProviderStr = contextProviderVal ?? ""; - - // Recurse back to let the user write their prompt - this.show(args); - - break; - - case QuickEditInitialItemLabels.Model: - const curModelTitle = await this._getCurModelTitle(); - - const selectedModelTitle = await getModelQuickPickVal( - curModelTitle, - config, - ); - - if (selectedModelTitle) { - this._curModelTitle = selectedModelTitle; - } - - // Recurse back to let the user write their prompt - this.show(args); - - break; - - default: - // If it wasn't a label we can assume it was user input - if (selectedLabelOrInputVal) { - prompt = selectedLabelOrInputVal; - appendToHistory(selectedLabelOrInputVal, this.context); - } - } - - if (prompt) { - await this._streamEditWithInputAndContext(prompt); - } - } } diff --git a/extensions/vscode/src/stubs/WorkOsAuthProvider.ts b/extensions/vscode/src/stubs/WorkOsAuthProvider.ts index 378d9ff0b..7b6385962 100644 --- a/extensions/vscode/src/stubs/WorkOsAuthProvider.ts +++ b/extensions/vscode/src/stubs/WorkOsAuthProvider.ts @@ -18,8 +18,10 @@ import { PromiseAdapter, promiseFromEvent } from "./promiseUtils"; export const AUTH_TYPE = "continue"; const AUTH_NAME = "Continue"; -const CLIENT_ID = "client_01J0FW6XN8N2XJAECF7NE0Y65J"; // Production -// const CLIENT_ID = "client_01J0FW6XCPMJMQ3CG51RB4HBZQ"; // Staging +const CLIENT_ID = + process.env.CONTROL_PLANE_ENV === "local" + ? "client_01J0FW6XCPMJMQ3CG51RB4HBZQ" + : "client_01J0FW6XN8N2XJAECF7NE0Y65J"; const SESSIONS_SECRET_KEY = `${AUTH_TYPE}.sessions`; class UriEventHandler extends EventEmitter implements UriHandler { @@ -140,7 +142,7 @@ export class WorkOsAuthProvider implements AuthenticationProvider, Disposable { if (this._sessions[0].expiresIn) { setTimeout( () => this._refreshSessions(), - (this._sessions[0].expiresIn * 1000 * 2) / 3, + (this._sessions[0].expiresIn * 2) / 3, ); } } @@ -158,7 +160,8 @@ export class WorkOsAuthProvider implements AuthenticationProvider, Disposable { }), }); if (!response.ok) { - throw new Error("Network failure"); + const text = await response.text(); + throw new Error("Error refreshing token: " + text); } const data = (await response.json()) as any; return { diff --git a/extensions/vscode/src/util/ideUtils.ts b/extensions/vscode/src/util/ideUtils.ts index 51f614ff2..15f79ddfd 100644 --- a/extensions/vscode/src/util/ideUtils.ts +++ b/extensions/vscode/src/util/ideUtils.ts @@ -135,22 +135,6 @@ export class VsCodeIdeUtils { ); } - showMultiFileEdit(edits: FileEdit[]) { - vscode.commands.executeCommand("workbench.action.closeAuxiliaryBar"); - const panel = vscode.window.createWebviewPanel( - "continue.continueGUIView", - "Continue", - vscode.ViewColumn.One, - ); - // panel.webview.html = this.sidebar.getSidebarContent( - // extensionContext, - // panel, - // this.ide, - // "/monaco", - // edits - // ); - } - openFile(filepath: string, range?: vscode.Range) { // vscode has a builtin open/get open files return openEditorAndRevealRange(filepath, range, vscode.ViewColumn.One); @@ -380,7 +364,9 @@ export class VsCodeIdeUtils { const lastLine = lines.pop()?.trim(); if (lastLine) { let i = lines.length - 1; - while (i >= 0 && !lines[i].trim().startsWith(lastLine)) i--; + while (i >= 0 && !lines[i].trim().startsWith(lastLine)) { + i--; + } terminalContents = lines.slice(Math.max(i, 0)).join("\n"); } @@ -400,7 +386,9 @@ export class VsCodeIdeUtils { async getAvailableThreads(): Promise { const session = vscode.debug.activeDebugSession; - if (!session) return []; + if (!session) { + return []; + } const threadsResponse = await this._getThreads(session); return threadsResponse.threads; @@ -449,7 +437,9 @@ export class VsCodeIdeUtils { stackDepth = 3, ): Promise { const session = vscode.debug.activeDebugSession; - if (!session) return []; + if (!session) { + return []; + } const sourcesPromises = await session .customRequest("stackTrace", { @@ -476,7 +466,9 @@ export class VsCodeIdeUtils { } private async retrieveSource(sourceContainer: any): Promise { - if (!sourceContainer.source) return ""; + if (!sourceContainer.source) { + return ""; + } const sourceRef = sourceContainer.source.sourceReference; if (sourceRef && sourceRef > 0) { @@ -498,7 +490,7 @@ export class VsCodeIdeUtils { sourceContainer.endColumn, ), ); - } else if (sourceContainer.line) + } else if (sourceContainer.line) { // fall back to 5 line of context return await this.readRangeInFile( sourceContainer.source.path, @@ -509,7 +501,9 @@ export class VsCodeIdeUtils { 0, ), ); - else return "unavailable"; + } else { + return "unavailable"; + } } private async _getRepo( @@ -557,7 +551,9 @@ export class VsCodeIdeUtils { let i = 0; while (!repo?.state?.HEAD?.name) { - if (this._repoWasNone) return undefined; + if (this._repoWasNone) { + return undefined; + } await new Promise((resolve) => setTimeout(resolve, 1000)); i++; diff --git a/extensions/vscode/src/util/loadAutocompleteModel.ts b/extensions/vscode/src/util/loadAutocompleteModel.ts index c21837f6c..4437c11d1 100644 --- a/extensions/vscode/src/util/loadAutocompleteModel.ts +++ b/extensions/vscode/src/util/loadAutocompleteModel.ts @@ -42,7 +42,7 @@ export class TabAutocompleteModel { if (value === "Documentation") { vscode.env.openExternal( vscode.Uri.parse( - "https://docs.continue.dev/walkthroughs/tab-autocomplete", + "https://docs.continue.dev/features/tab-autocomplete", ), ); } else if (value === "Copy Command") { @@ -65,7 +65,7 @@ export class TabAutocompleteModel { if (value === "Documentation") { vscode.env.openExternal( vscode.Uri.parse( - "https://docs.continue.dev/walkthroughs/tab-autocomplete", + "https://docs.continue.dev/features/tab-autocomplete", ), ); } else if (value === "Download Ollama") { diff --git a/extensions/vscode/src/webviewProtocol.ts b/extensions/vscode/src/webviewProtocol.ts index 3496691c5..7edd488f6 100644 --- a/extensions/vscode/src/webviewProtocol.ts +++ b/extensions/vscode/src/webviewProtocol.ts @@ -1,5 +1,8 @@ import { FromWebviewProtocol, ToWebviewProtocol } from "core/protocol"; +import { WebviewMessengerResult } from "core/protocol/util"; +import { extractMinimalStackTraceInfo } from "core/util/extractMinimalStackTraceInfo"; import { Message } from "core/util/messenger"; +import { Telemetry } from "core/util/posthog"; import fs from "node:fs"; import path from "path"; import { v4 as uuidv4 } from "uuid"; @@ -71,7 +74,7 @@ export class VsCodeWebviewProtocol throw new Error(`Invalid webview protocol msg: ${JSON.stringify(msg)}`); } - const respond = (message: any) => + const respond = (message: WebviewMessengerResult) => this.send(msg.messageType, message, msg.messageId); const handlers = this.listeners.get(msg.messageType) || []; @@ -87,12 +90,16 @@ export class VsCodeWebviewProtocol respond(next.value); next = await response.next(); } - respond({ done: true, content: next.value?.content }); + respond({ + done: true, + content: next.value?.content, + status: "success", + }); } else { - respond(response || {}); + respond({ done: true, content: response || {}, status: "success" }); } } catch (e: any) { - respond({ done: true, error: e }); + respond({ done: true, error: e, status: "error" }); console.error( `Error handling webview message: ${JSON.stringify( @@ -153,6 +160,15 @@ export class VsCodeWebviewProtocol } }); } else { + Telemetry.capture( + "webview_protocol_error", + { + messageType: msg.messageType, + errorMsg: message.split("\n\n")[0], + stack: extractMinimalStackTraceInfo(e.stack), + }, + false, + ); vscode.window .showErrorMessage( message.split("\n\n")[0], @@ -194,29 +210,37 @@ export class VsCodeWebviewProtocol public request( messageType: T, data: ToWebviewProtocol[T][0], + retry: boolean = true, ): Promise { const messageId = uuidv4(); return new Promise(async (resolve) => { - let i = 0; - while (!this.webview) { - if (i >= 10) { - resolve(undefined); - return; - } else { - await new Promise((res) => setTimeout(res, i >= 5 ? 1000 : 500)); - i++; + if (retry) { + let i = 0; + while (!this.webview) { + if (i >= 10) { + resolve(undefined); + return; + } else { + await new Promise((res) => setTimeout(res, i >= 5 ? 1000 : 500)); + i++; + } } } this.send(messageType, data, messageId); - const disposable = this.webview.onDidReceiveMessage( - (msg: Message) => { - if (msg.messageId === messageId) { - resolve(msg.data); - disposable?.dispose(); - } - }, - ); + + if (this.webview) { + const disposable = this.webview.onDidReceiveMessage( + (msg: Message) => { + if (msg.messageId === messageId) { + resolve(msg.data); + disposable?.dispose(); + } + }, + ); + } else if (!retry) { + resolve(undefined); + } }); } } diff --git a/extensions/vscode/tsconfig.json b/extensions/vscode/tsconfig.json index b160ec053..d2f8575e0 100644 --- a/extensions/vscode/tsconfig.json +++ b/extensions/vscode/tsconfig.json @@ -1,21 +1,17 @@ { "compilerOptions": { "module": "commonjs", - "target": "ES2020", + "target": "ES2022", + "lib": ["ES2022", "dom", "es6", "es5", "dom.iterable", "scripthost"], "outDir": "out/tsc/src", - "lib": ["ES2021", "dom", "es6", "es5", "dom.iterable", "scripthost"], "sourceMap": true, "rootDir": "../../", - "strict": true /* enable all strict type-checking options */, - /* Additional Checks */ - // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ - // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ - // "noUnusedParameters": true, /* Report errors on unused parameters. */ - "esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */, - "resolveJsonModule": true /* Enable importing .json files */, + "strict": true, + "esModuleInterop": true, + "resolveJsonModule": true, "types": ["mocha"] // This solves conflict between jest and mocha: https://github.com/cypress-io/cypress/issues/7435#issuecomment-631695007 }, "include": ["src/**/*", "../../core/**/*.ts", "../../core/**/*.d.ts"], // core/test uses @types/jest, which conflicts with @types/mocha - "exclude": ["../../core/dist/**/*", "../../core/test/**/*"] + "exclude": ["../../core/dist/**/*", "../../core/**/*.test.ts"] } diff --git a/gui/package-lock.json b/gui/package-lock.json index 71c9c267c..774db75f8 100644 --- a/gui/package-lock.json +++ b/gui/package-lock.json @@ -29,7 +29,7 @@ "dompurify": "^3.0.6", "downshift": "^7.6.0", "lodash": "^4.17.21", - "minisearch": "^6.3.0", + "minisearch": "^7.0.2", "onigasm": "^2.2.5", "posthog-js": "^1.130.1", "prismjs": "^1.29.0", @@ -88,22 +88,19 @@ "version": "1.0.13", "license": "Apache-2.0", "dependencies": { - "@aws-sdk/client-bedrock-runtime": "^3.574.0", - "@aws-sdk/credential-providers": "^3.596.0", + "@aws-sdk/client-bedrock-runtime": "^3.620.1", + "@aws-sdk/client-sagemaker-runtime": "^3.621.0", + "@aws-sdk/credential-providers": "^3.620.1", "@continuedev/config-types": "^1.0.10", "@continuedev/llm-info": "^1.0.1", "@mozilla/readability": "^0.5.0", "@octokit/rest": "^20.0.2", - "@types/jsdom": "^21.1.6", - "@types/mozilla-readability": "^0.2.1", - "@types/node-fetch": "^2.6.11", "@typescript-eslint/eslint-plugin": "^7.8.0", "@typescript-eslint/parser": "^7.8.0", "@xenova/transformers": "2.14.0", "adf-to-md": "^1.1.0", "async-mutex": "^0.5.0", "axios": "^1.6.7", - "cheerio": "^1.0.0-rc.12", "commander": "^12.0.0", "comment-json": "^4.2.3", "dbinfoz": "^0.1.4", @@ -114,6 +111,7 @@ "http-proxy-agent": "^7.0.1", "https-proxy-agent": "^7.0.3", "ignore": "^5.3.1", + "jinja-js": "0.1.8", "js-tiktoken": "^1.0.8", "jsdom": "^24.0.0", "launchdarkly-node-client-sdk": "^3.2.0", @@ -124,8 +122,11 @@ "ollama": "^0.4.6", "onnxruntime-node": "1.14.0", "openai": "^4.20.1", + "p-limit": "^6.1.0", "pg": "^8.11.3", "posthog-node": "^3.6.3", + "puppeteer": "^22.4.0", + "puppeteer-chromium-resolver": "^23.0.0", "quick-lru": "^7.0.0", "replicate": "^0.26.0", "request": "^2.88.2", @@ -149,12 +150,20 @@ "@types/follow-redirects": "^1.14.4", "@types/jest": "^29.5.12", "@types/jquery": "^3.5.29", + "@types/jsdom": "^21.1.6", + "@types/mozilla-readability": "^0.2.1", "@types/mustache": "^4.2.5", + "@types/node-fetch": "^2.6.11", + "@types/pg": "^8.11.6", + "@types/request": "^2.48.12", "@types/uuid": "^9.0.7", + "@types/win-ca": "^3.5.4", + "cross-env": "^7.0.3", "esbuild": "0.17.19", "eslint": "^8", "eslint-plugin-import": "^2.29.1", "jest": "^29.7.0", + "jest-environment-jsdom": "^29.7.0", "myers-diff": "^2.1.0", "onnxruntime-common": "1.14.0", "onnxruntime-web": "1.14.0", @@ -5150,6 +5159,7 @@ }, "../core/node_modules/@types/jsdom": { "version": "21.1.6", + "dev": true, "license": "MIT", "dependencies": { "@types/node": "*", @@ -5167,6 +5177,7 @@ }, "../core/node_modules/@types/mozilla-readability": { "version": "0.2.1", + "dev": true, "license": "MIT" }, "../core/node_modules/@types/mustache": { @@ -5203,6 +5214,7 @@ }, "../core/node_modules/@types/tough-cookie": { "version": "4.0.5", + "dev": true, "license": "MIT" }, "../core/node_modules/@types/uuid": { @@ -6301,40 +6313,6 @@ "node": ">=10" } }, - "../core/node_modules/cheerio": { - "version": "1.0.0-rc.12", - "license": "MIT", - "dependencies": { - "cheerio-select": "^2.1.0", - "dom-serializer": "^2.0.0", - "domhandler": "^5.0.3", - "domutils": "^3.0.1", - "htmlparser2": "^8.0.1", - "parse5": "^7.0.0", - "parse5-htmlparser2-tree-adapter": "^7.0.0" - }, - "engines": { - "node": ">= 6" - }, - "funding": { - "url": "https://github.com/cheeriojs/cheerio?sponsor=1" - } - }, - "../core/node_modules/cheerio-select": { - "version": "2.1.0", - "license": "BSD-2-Clause", - "dependencies": { - "boolbase": "^1.0.0", - "css-select": "^5.1.0", - "css-what": "^6.1.0", - "domelementtype": "^2.3.0", - "domhandler": "^5.0.3", - "domutils": "^3.0.1" - }, - "funding": { - "url": "https://github.com/sponsors/fb55" - } - }, "../core/node_modules/chownr": { "version": "2.0.0", "license": "ISC", @@ -8301,23 +8279,6 @@ "dev": true, "license": "MIT" }, - "../core/node_modules/htmlparser2": { - "version": "8.0.2", - "funding": [ - "https://github.com/fb55/htmlparser2?sponsor=1", - { - "type": "github", - "url": "https://github.com/sponsors/fb55" - } - ], - "license": "MIT", - "dependencies": { - "domelementtype": "^2.3.0", - "domhandler": "^5.0.3", - "domutils": "^3.0.1", - "entities": "^4.4.0" - } - }, "../core/node_modules/http-cache-semantics": { "version": "4.1.1", "license": "BSD-2-Clause", @@ -10563,17 +10524,6 @@ "url": "https://github.com/inikulin/parse5?sponsor=1" } }, - "../core/node_modules/parse5-htmlparser2-tree-adapter": { - "version": "7.0.0", - "license": "MIT", - "dependencies": { - "domhandler": "^5.0.2", - "parse5": "^7.0.0" - }, - "funding": { - "url": "https://github.com/inikulin/parse5?sponsor=1" - } - }, "../core/node_modules/path-exists": { "version": "4.0.0", "license": "MIT", @@ -17244,8 +17194,9 @@ } }, "node_modules/minisearch": { - "version": "6.3.0", - "license": "MIT" + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/minisearch/-/minisearch-7.0.2.tgz", + "integrity": "sha512-Pf0sFXaCgRpOBDr4G8wTbVAEH9o9rvJzCMwj0TMe3L/NfUuG188xabfx6Vm3vD/Dv5L500n7JeiMB9Mq3sWMfQ==" }, "node_modules/monaco-editor": { "version": "0.49.0", diff --git a/gui/package.json b/gui/package.json index d96793531..2b6bff3d1 100644 --- a/gui/package.json +++ b/gui/package.json @@ -2,6 +2,7 @@ "name": "gui", "private": true, "type": "module", + "author": "Continue Dev, Inc", "license": "Apache-2.0", "scripts": { "dev": "vite", @@ -31,7 +32,7 @@ "dompurify": "^3.0.6", "downshift": "^7.6.0", "lodash": "^4.17.21", - "minisearch": "^6.3.0", + "minisearch": "^7.0.2", "onigasm": "^2.2.5", "posthog-js": "^1.130.1", "prismjs": "^1.29.0", diff --git a/gui/public/logos/WatsonX.png b/gui/public/logos/WatsonX.png new file mode 100644 index 000000000..ba4807267 Binary files /dev/null and b/gui/public/logos/WatsonX.png differ diff --git a/gui/public/logos/ibm.png b/gui/public/logos/ibm.png new file mode 100644 index 000000000..be88ec2ed Binary files /dev/null and b/gui/public/logos/ibm.png differ diff --git a/gui/src/components/FileIcon.tsx b/gui/src/components/FileIcon.tsx index 8ea591827..ab1dd5257 100644 --- a/gui/src/components/FileIcon.tsx +++ b/gui/src/components/FileIcon.tsx @@ -1,7 +1,15 @@ import DOMPurify from "dompurify"; import { themeIcons } from "seti-file-icons"; -const FileIcon = ({ filename, height, width }) => { +const FileIcon = ({ + filename, + height, + width, +}: { + filename: string; + height: string; + width: string; +}) => { const filenameParts = filename.includes(" (") ? filename.split(" ") : [filename, ""]; diff --git a/gui/src/components/HeaderButtonWithText.tsx b/gui/src/components/HeaderButtonWithText.tsx index 9c5647a91..9af9a4236 100644 --- a/gui/src/components/HeaderButtonWithText.tsx +++ b/gui/src/components/HeaderButtonWithText.tsx @@ -1,6 +1,7 @@ import React, { useState } from "react"; import ReactDOM from "react-dom"; import { HeaderButton, StyledTooltip } from "."; +import { type PlacesType } from "react-tooltip"; import { v4 as uuidv4 } from "uuid"; @@ -17,6 +18,7 @@ interface HeaderButtonWithTextProps { style?: React.CSSProperties; backgroundColor?: string; hoverBackgroundColor?: string; + tooltipPlacement?: PlacesType; } const HeaderButtonWithText = React.forwardRef< @@ -27,13 +29,14 @@ const HeaderButtonWithText = React.forwardRef< const id = uuidv4(); const tooltipPortalDiv = document.getElementById("tooltip-portal-div"); + const tooltipId = `header_button_${id}`; return ( <> { @@ -56,7 +59,10 @@ const HeaderButtonWithText = React.forwardRef< {props.text && tooltipPortalDiv && ReactDOM.createPortal( - + {props.text} , tooltipPortalDiv, diff --git a/gui/src/components/Layout.tsx b/gui/src/components/Layout.tsx index 2ce44d6c1..dd9256753 100644 --- a/gui/src/components/Layout.tsx +++ b/gui/src/components/Layout.tsx @@ -12,7 +12,7 @@ import { } from "."; import { IdeMessengerContext } from "../context/IdeMessenger"; import { useWebviewListener } from "../hooks/useWebviewListener"; -import { shouldBeginOnboarding } from "../pages/onboarding/utils"; +import { isNewUserOnboarding } from "../pages/onboarding/utils"; import { defaultModelSelector } from "../redux/selectors/modelSelectors"; import { setBottomMessage, @@ -30,7 +30,6 @@ import ProgressBar from "./loaders/ProgressBar"; import PostHogPageView from "./PosthogPageView"; import ProfileSwitcher from "./ProfileSwitcher"; -// #region Styled Components const FOOTER_HEIGHT = "1.8em"; const LayoutTopDiv = styled(CustomScrollbarDiv)` @@ -105,8 +104,6 @@ const ProfileDropdownPortalDiv = styled.div` font-size: ${getFontSize() - 2}; `; -// #endregion - const HIDE_FOOTER_ON_PAGES = [ "/onboarding", "/localOnboarding", @@ -127,7 +124,6 @@ const Layout = () => { ); const defaultModel = useSelector(defaultModelSelector); - // #region Selectors const bottomMessage = useSelector( (state: RootState) => state.uiState.bottomMessage, @@ -138,8 +134,6 @@ const Layout = () => { const timeline = useSelector((state: RootState) => state.state.history); - // #endregion - useEffect(() => { const handleKeyDown = (event: any) => { if (isMetaEquivalentKeyPressed(event) && event.code === "KeyC") { @@ -231,7 +225,7 @@ const Layout = () => { useEffect(() => { if ( - shouldBeginOnboarding() && + isNewUserOnboarding() && (location.pathname === "/" || location.pathname === "/index.html") ) { navigate("/onboarding"); @@ -285,6 +279,7 @@ const Layout = () => { { if (location.pathname === "/help") { diff --git a/gui/src/components/ProfileSwitcher.tsx b/gui/src/components/ProfileSwitcher.tsx index 140178883..4ffa1f085 100644 --- a/gui/src/components/ProfileSwitcher.tsx +++ b/gui/src/components/ProfileSwitcher.tsx @@ -7,7 +7,7 @@ import { import { ProfileDescription } from "core/config/ConfigHandler"; import { Fragment, useContext, useEffect, useState } from "react"; import ReactDOM from "react-dom"; -import { useSelector } from "react-redux"; +import { useDispatch, useSelector } from "react-redux"; import styled from "styled-components"; import { defaultBorderRadius, @@ -21,6 +21,7 @@ import { import { IdeMessengerContext } from "../context/IdeMessenger"; import { useAuth } from "../hooks/useAuth"; import { useWebviewListener } from "../hooks/useWebviewListener"; +import { setLastControlServerBetaEnabledStatus } from "../redux/slices/miscSlice"; import { RootState } from "../redux/store"; import { getFontSize } from "../util"; import HeaderButtonWithText from "./HeaderButtonWithText"; @@ -127,6 +128,11 @@ function ProfileSwitcher(props: {}) { const { session, logout, login } = useAuth(); const [profiles, setProfiles] = useState([]); + const dispatch = useDispatch(); + const lastControlServerBetaEnabledStatus = useSelector( + (state: RootState) => state.misc.lastControlServerBetaEnabledStatus, + ); + const selectedProfileId = useSelector( (store: RootState) => store.state.selectedProfileId, ); @@ -135,13 +141,25 @@ function ProfileSwitcher(props: {}) { useState(false); useEffect(() => { - ideMessenger.ide.getIdeSettings().then((settings) => { - setControlServerBetaEnabled(settings.enableControlServerBeta); + ideMessenger.ide.getIdeSettings().then(({ enableControlServerBeta }) => { + const shouldShowPopup = + !lastControlServerBetaEnabledStatus && enableControlServerBeta; + + if (shouldShowPopup) { + ideMessenger.ide.infoPopup("Continue for Teams enabled"); + } + + setControlServerBetaEnabled(enableControlServerBeta); + dispatch(setLastControlServerBetaEnabledStatus(enableControlServerBeta)); }); }, []); useEffect(() => { - ideMessenger.request("config/listProfiles", undefined).then(setProfiles); + ideMessenger + .request("config/listProfiles", undefined) + .then( + (result) => result.status === "success" && setProfiles(result.content), + ); }, []); useWebviewListener( @@ -160,65 +178,65 @@ function ProfileSwitcher(props: {}) { return ( <> - {controlServerBetaEnabled && - profiles.some((profile) => profile.id !== "local") && ( - { - ideMessenger.request("didChangeSelectedProfile", { id }); - }} - > -
- -
{selectedProfile()?.title}
-
-
-
- {topDiv && - ReactDOM.createPortal( - - - {profiles.map((option, idx) => ( - 1} - /> - ))} -
- {profiles.length === 0 ? ( - No workspaces found - ) : ( - "Select workspace" - )} -
-
-
, - topDiv, - )} -
-
- )} + {controlServerBetaEnabled && session?.account?.id && ( + { + ideMessenger.request("didChangeSelectedProfile", { id }); + }} + > +
+ +
{selectedProfile()?.title}
+
+
+
+ {topDiv && + ReactDOM.createPortal( + + + {profiles.map((option, idx) => ( + 1} + /> + ))} +
+ {profiles.length === 0 ? ( + No workspaces found + ) : ( + "Select workspace" + )} +
+
+
, + topDiv, + )} +
+
+ )} {/* Settings button (either opens config.json or /settings page in control plane) */} { if (selectedProfileId === "local") { ideMessenger.post("openConfigJson", undefined); @@ -237,6 +255,7 @@ function ProfileSwitcher(props: {}) { {/* Only show login if beta explicitly enabled */} {controlServerBetaEnabled && ( (null); - const [docsUrl, setDocsUrl] = useState(""); - const [docsTitle, setDocsTitle] = useState(""); - const [urlValid, setUrlValid] = useState(false); - const [maxDepth, setMaxDepth] = useState(""); + const [title, setTitle] = useState(""); + const [startUrl, setStartUrl] = useState(""); + const [faviconUrl, setFaviconUrl] = useState(""); + const [isOpen, setIsOpen] = useState(false); const ideMessenger = useContext(IdeMessengerContext); - const { addItem } = useContext(SubmenuContextProvidersContext); - const isFormValid = docsUrl && docsTitle && urlValid; + const isFormValid = startUrl && title; useLayoutEffect(() => { setTimeout(() => { @@ -33,38 +30,30 @@ function AddDocsDialog() { }, 100); }, [ref]); - function onSubmit(e) { + function onSubmit(e: any) { e.preventDefault(); const siteIndexingConfig: SiteIndexingConfig = { - startUrl: docsUrl, - rootUrl: docsUrl, - title: docsTitle, - maxDepth: typeof maxDepth === "string" ? DEFAULT_MAX_DEPTH : maxDepth, - faviconUrl: new URL("/favicon.ico", docsUrl).toString(), + startUrl, + title, + faviconUrl, }; ideMessenger.post("context/addDocs", siteIndexingConfig); - setDocsTitle(""); - setDocsUrl(""); - setMaxDepth(""); + setTitle(""); + setStartUrl(""); + setFaviconUrl(""); dispatch(setShowDialog(false)); - addItem("docs", { - id: docsUrl, - title: docsTitle, - description: new URL(docsUrl).hostname, - }); - - posthog.capture("add_docs", { url: docsUrl }); + posthog.capture("add_docs_gui", { url: startUrl }); } return (
-

Add Docs

+

Add a documentation site

Continue pre-indexes many common documentation sites, but if there's @@ -78,49 +67,75 @@ function AddDocsDialog() {

- - +
setIsOpen((prev) => !prev)} + > + {isOpen ? ( + + ) : ( + + )} + Advanced +
+ + {isOpen && ( +
+ +
+ )} +
); diff --git a/gui/src/components/index.tsx b/gui/src/components/index.tsx index fad5f7849..eac6bf022 100644 --- a/gui/src/components/index.tsx +++ b/gui/src/components/index.tsx @@ -39,8 +39,8 @@ export const VSC_THEME_COLOR_VARS = [ ]; export const defaultBorderRadius = "5px"; -export const lightGray = "#646464"; -export const greenButtonColor = "#1bbe84"; +export const lightGray = "#999998"; +export const greenButtonColor = "#189e72"; export const vscInputBackground = `var(${VSC_INPUT_BACKGROUND_VAR}, rgb(45 45 45))`; export const vscQuickInputBackground = `var(${VSC_QUICK_INPUT_BACKGROUND_VAR}, ${VSC_INPUT_BACKGROUND_VAR}, rgb(45 45 45))`; @@ -58,6 +58,8 @@ export const vscBadgeBackground = `var(${VSC_BADGE_BACKGROUND_VAR}, #1bbe84)`; export const vscBadgeForeground = `var(${VSC_BADGE_FOREGROUND_VAR}, #fff)`; export const vscSidebarBorder = `var(${VSC_SIDEBAR_BORDER_VAR}, transparent)`; +// cececd + if (typeof document !== "undefined") { for (const colorVar of VSC_THEME_COLOR_VARS) { if (isJetBrains()) { @@ -189,8 +191,13 @@ const TooltipStyles = { overflow: "hidden", }; -export function StyledTooltip(props) { - return ; +export function StyledTooltip(props: any) { + const combinedStyles = { + ...TooltipStyles, + ...props.style, // Merge any additional styles passed via props + }; + + return ; } export const TextArea = styled.textarea` @@ -245,6 +252,12 @@ export const Hr = styled.hr` border: 0.5px solid ${lightGray}; `; +export const HelperText = styled.p` + margin-top: 2.5px; + font-size: ${getFontSize() - 2}px; + color: ${lightGray}; +`; + export const Input = styled.input` width: 100%; padding: 8px 12px; diff --git a/gui/src/components/loaders/BlinkingDot.tsx b/gui/src/components/loaders/BlinkingDot.tsx new file mode 100644 index 000000000..db8feb5a5 --- /dev/null +++ b/gui/src/components/loaders/BlinkingDot.tsx @@ -0,0 +1,34 @@ +import styled, { css, keyframes } from "styled-components"; + +const DEFAULT_DIAMETER = 6; + +const blink = keyframes` + 0%, 100% { + transform: scale(1); + opacity: 1; + } + 50% { + opacity: 0.25; + } +`; + +const blinkAnimation = css` + animation: ${blink} 3s infinite; +`; + +const BlinkingDot = styled.div<{ + color: string; + diameter?: number; + shouldBlink?: boolean; +}>` + background-color: ${(props) => props.color}; + box-shadow: 0px 0px 2px 1px ${(props) => props.color}; + width: ${(props) => props.diameter ?? DEFAULT_DIAMETER}px; + height: ${(props) => props.diameter ?? DEFAULT_DIAMETER}px; + border-radius: 50%; + border: 1px solid rgba(255, 255, 255, 0.75); + margin: 0 2px; + ${(props) => (props.shouldBlink ?? false) && blinkAnimation}; +`; + +export default BlinkingDot; diff --git a/gui/src/components/loaders/IndexingProgressBar.tsx b/gui/src/components/loaders/IndexingProgressBar.tsx index 74daf3606..7446f8df9 100644 --- a/gui/src/components/loaders/IndexingProgressBar.tsx +++ b/gui/src/components/loaders/IndexingProgressBar.tsx @@ -1,14 +1,20 @@ import { IndexingProgressUpdate } from "core"; +import TransformersJsEmbeddingsProvider from "core/indexing/embeddings/TransformersJsEmbeddingsProvider"; import { useContext, useEffect, useState } from "react"; import ReactDOM from "react-dom"; -import { useSelector } from "react-redux"; +import { useSelector, useDispatch } from "react-redux"; import styled from "styled-components"; import { StyledTooltip, lightGray, vscForeground } from ".."; import { IdeMessengerContext } from "../../context/IdeMessenger"; import { RootState } from "../../redux/store"; import { getFontSize, isJetBrains } from "../../util"; import StatusDot from "./StatusDot"; -import TransformersJsEmbeddingsProvider from "core/indexing/embeddings/TransformersJsEmbeddingsProvider"; +import ConfirmationDialog from "../dialogs/ConfirmationDialog"; +import { + setDialogMessage, + setShowDialog, +} from "../../redux/slices/uiStateSlice"; +import { usePostHog } from "posthog-js/react"; const STATUS_COLORS = { DISABLED: lightGray, // light gray @@ -69,16 +75,36 @@ interface ProgressBarProps { const IndexingProgressBar = ({ indexingState: indexingStateProp, }: ProgressBarProps) => { + const dispatch = useDispatch(); + const ideMessenger = useContext(IdeMessengerContext); + const posthog = usePostHog(); + + const [paused, setPaused] = useState(undefined); + const [hovered, setHovered] = useState(false); + + const embeddingsProvider = useSelector( + (state: RootState) => state.state.config.embeddingsProvider, + ); + // If sidebar is opened before extension initiates, define a default indexingState const defaultIndexingState: IndexingProgressUpdate = { status: "loading", progress: 0, desc: "", }; + const indexingState = indexingStateProp || defaultIndexingState; + const fillPercentage = Math.min( + 100, + Math.max(0, indexingState.progress * 100), + ); + + const tooltipPortalDiv = document.getElementById("tooltip-portal-div"); + // If sidebar is opened after extension initializes, retrieve saved states. let initialized = false; + useEffect(() => { if (!initialized) { // Triggers retrieval for possible non-default states set prior to IndexingProgressBar initialization @@ -87,58 +113,80 @@ const IndexingProgressBar = ({ } }, []); - const fillPercentage = Math.min( - 100, - Math.max(0, indexingState.progress * 100), - ); - - const ideMessenger = useContext(IdeMessengerContext); - - const embeddingsProvider = useSelector( - (state: RootState) => state.state.config.embeddingsProvider, - ); - - const tooltipPortalDiv = document.getElementById("tooltip-portal-div"); - - const [paused, setPaused] = useState(undefined); - const [hovered, setHovered] = useState(false); - useEffect(() => { if (paused === undefined) return; ideMessenger.post("index/setPaused", paused); }, [paused]); + function onClick() { + switch (indexingState.status) { + case "failed": + // For now, we don't show in JetBrains since the reindex command + // is not yet implemented + if (indexingState.shouldClearIndexes && !isJetBrains()) { + dispatch(setShowDialog(true)); + dispatch( + setDialogMessage( + { + posthog.capture("rebuild_index_clicked"); + ideMessenger.post("index/forceReIndex", { + shouldClearIndexes: true, + }); + }} + />, + ), + ); + } else { + ideMessenger.post("index/forceReIndex", undefined); + } + + break; + case "indexing": + case "paused": + if (indexingState.progress < 1 && indexingState.progress >= 0) { + setPaused((prev) => !prev); + } else { + ideMessenger.post("index/forceReIndex", undefined); + } + + break; + default: + ideMessenger.post("index/forceReIndex", undefined); + break; + } + } + function getIndexingErrMsg(msg: string): string { if ( isJetBrains() && embeddingsProvider === TransformersJsEmbeddingsProvider.model ) { - return "The 'transformers.js' embeddingsProvider is currently unsupported in JetBrains. To enable codebase indexing, you can use any of the other providers described in the docs: https://docs.continue.dev/walkthroughs/codebase-embeddings#embeddings-providers"; + return ( + "The 'transformers.js' embeddingsProvider is currently unsupported in JetBrains. " + + "To enable codebase indexing, you can use any of the other providers described " + + "in the docs: https://docs.continue.dev/walkthroughs/codebase-embeddings#embeddings-providers" + ); } + return msg; } return ( -
{ - if ( - indexingState.status !== "failed" && - indexingState.progress < 1 && - indexingState.progress >= 0 - ) { - setPaused((prev) => !prev); - } else { - ideMessenger.post("index/forceReIndex", undefined); - } - }} - className="cursor-pointer" - > +
{indexingState.status === "failed" ? (
- Indexing error! Click to retry - {getIndexingErrMsg(indexingState.desc)} + Indexing error - click to retry
{tooltipPortalDiv && ReactDOM.createPortal( @@ -151,7 +199,7 @@ const IndexingProgressBar = ({ ) : indexingState.status === "loading" ? ( - Continue is initializing + Initializing ) : indexingState.status === "done" ? ( diff --git a/gui/src/components/mainInput/CodeBlockExtension.tsx b/gui/src/components/mainInput/CodeBlockExtension.tsx index 13617a14c..4f9c670af 100644 --- a/gui/src/components/mainInput/CodeBlockExtension.tsx +++ b/gui/src/components/mainInput/CodeBlockExtension.tsx @@ -13,12 +13,12 @@ const CodeBlockComponent = ({ selected, editor, updateAttributes, -}) => { +}: any) => { const dispatch = useDispatch(); const item: ContextItemWithId = node.attrs.item; const contextItems = useSelector( - (state: RootState) => state.state.contextItems + (state: RootState) => state.state.contextItems, ); return ( @@ -27,8 +27,8 @@ const CodeBlockComponent = ({ item.id === contextItems[0]?.id ? "#d0d" : selected - ? vscBadgeBackground - : undefined + ? vscBadgeBackground + : undefined } item={item} onDelete={() => { diff --git a/gui/src/components/mainInput/ContextItemsPeek.tsx b/gui/src/components/mainInput/ContextItemsPeek.tsx index 57069685a..9d37725c4 100644 --- a/gui/src/components/mainInput/ContextItemsPeek.tsx +++ b/gui/src/components/mainInput/ContextItemsPeek.tsx @@ -12,6 +12,7 @@ import { import { IdeMessengerContext } from "../../context/IdeMessenger"; import { getFontSize } from "../../util"; import FileIcon from "../FileIcon"; +import SafeImg from "../SafeImg"; const ContextItemDiv = styled.div` cursor: pointer; @@ -31,6 +32,16 @@ const ContextItemDiv = styled.div` } `; +export const ContextItems = styled.span` + margin-left: 5px; + font-size: ${getFontSize() - 1}px; + color: ${lightGray}; + + &:hover { + text-decoration: underline; + } +`; + interface ContextItemsPeekProps { contextItems?: ContextItemWithId[]; } @@ -40,10 +51,16 @@ const ContextItemsPeek = (props: ContextItemsPeekProps) => { const [open, setOpen] = React.useState(false); - if (!props.contextItems || props.contextItems.length === 0) { + const ctxItems = props.contextItems; + + if (!ctxItems || ctxItems.length === 0) { return null; } + const contextItemsText = `${ctxItems.length} context ${ + ctxItems.length > 1 ? "items" : "item" + }`; + function openContextItem(contextItem: ContextItemWithId) { if (contextItem.description.startsWith("http")) { window.open(contextItem.description, "_blank"); @@ -98,7 +115,7 @@ const ContextItemsPeek = (props: ContextItemsPeekProps) => { style={{ color: lightGray }} > )} - Context Used + {contextItemsText}
{open && (
{ paddingTop: "2px", }} > - {props.contextItems?.map((contextItem, idx) => { + {ctxItems?.map((contextItem, idx) => { if (contextItem.description.startsWith("http")) { return ( { openContextItem(contextItem); }} > - + {!!contextItem.icon ? ( + + ) : ( + + )} {contextItem.name} @@ -144,11 +171,21 @@ const ContextItemsPeek = (props: ContextItemsPeekProps) => { openContextItem(contextItem); }} > - + {!!contextItem.icon ? ( + + ) : ( + + )} {contextItem.name} ); diff --git a/gui/src/components/mainInput/ContinueInputBox.tsx b/gui/src/components/mainInput/ContinueInputBox.tsx index 391f37a4c..574a945d0 100644 --- a/gui/src/components/mainInput/ContinueInputBox.tsx +++ b/gui/src/components/mainInput/ContinueInputBox.tsx @@ -54,7 +54,6 @@ interface ContinueInputBoxProps { isLastUserInput: boolean; isMainInput?: boolean; onEnter: (editorState: JSONContent, modifiers: InputModifiers) => void; - editorState?: JSONContent; contextItems?: ContextItemWithId[]; hidden?: boolean; @@ -111,8 +110,8 @@ function ContinueInputBox(props: ContinueInputBoxProps) { diff --git a/gui/src/components/mainInput/InputToolbar.tsx b/gui/src/components/mainInput/InputToolbar.tsx index 0bd113e6b..510daa368 100644 --- a/gui/src/components/mainInput/InputToolbar.tsx +++ b/gui/src/components/mainInput/InputToolbar.tsx @@ -1,4 +1,7 @@ -import { PhotoIcon as OutlinePhotoIcon } from "@heroicons/react/24/outline"; +import { + PhotoIcon as OutlinePhotoIcon, + PlusIcon, +} from "@heroicons/react/24/outline"; import { PhotoIcon as SolidPhotoIcon } from "@heroicons/react/24/solid"; import { InputModifiers } from "core"; import { modelSupportsImages } from "core/llm/autodetect"; @@ -24,22 +27,33 @@ import { import ModelSelect from "../modelSelection/ModelSelect"; const StyledDiv = styled.div<{ isHidden: boolean }>` + padding: 4px 0; display: flex; justify-content: space-between; - flex-wrap: wrap-reverse; - flex-direction: row-reverse; gap: 1px; background-color: ${vscInputBackground}; align-items: center; z-index: 50; - font-size: ${getFontSize() - 4}px; - cursor: ${props => props.isHidden ? 'default' : 'text'}; - opacity: ${props => props.isHidden ? 0 : 1}; - pointer-events: ${props => props.isHidden ? 'none' : 'auto'}; + font-size: ${getFontSize() - 2}px; + cursor: ${(props) => (props.isHidden ? "default" : "text")}; + opacity: ${(props) => (props.isHidden ? 0 : 1)}; + pointer-events: ${(props) => (props.isHidden ? "none" : "auto")}; & > * { flex: 0 0 auto; } + + /* Add a media query to hide the right-hand set of components */ + @media (max-width: 400px) { + & > span:last-child { + display: none; + } + } +`; + +const StyledSpan = styled.span` + font-size: ${() => `${getFontSize() - 2}px`}; + color: ${lightGray}; `; const EnterButton = styled.div<{ offFocus: boolean }>` @@ -87,75 +101,25 @@ function InputToolbar(props: InputToolbarProps) { onClick={props.onClick} id="input-toolbar" > - - {props.showNoContext ? ( - - {getAltKeyLabel()} ⏎{" "} - {useActiveFile ? "No context" : "Use active file"} - - ) : ( - { - props.onEnter({ - useCodebase: true, - noContext: !useActiveFile, - }); - }} - className={"hover:underline cursor-pointer float-right"} - > - {getMetaKeyLabel()} ⏎ Use codebase - - )} - { - props.onEnter({ - useCodebase: isMetaEquivalentKeyPressed(e), - noContext: useActiveFile ? e.altKey : !e.altKey, - }); - }} - > - ⏎ Enter - - - + - { props.onAddContextItem(); }} className="hover:underline cursor-pointer" > - + Add Context - + Add Context + + + {props.showNoContext ? ( + + {getAltKeyLabel()} ⏎{" "} + {useActiveFile ? "No context" : "Use active file"} + + ) : ( + { + props.onEnter({ + useCodebase: true, + noContext: !useActiveFile, + }); + }} + className={"hover:underline cursor-pointer float-right"} + > + {getMetaKeyLabel()} ⏎ Use codebase + + )} + { + props.onEnter({ + useCodebase: isMetaEquivalentKeyPressed(e), + noContext: useActiveFile ? e.altKey : !e.altKey, + }); + }} + > + ⏎ Enter + + ); diff --git a/gui/src/components/mainInput/MentionList.tsx b/gui/src/components/mainInput/MentionList.tsx index 8a43b86c9..7ad231a39 100644 --- a/gui/src/components/mainInput/MentionList.tsx +++ b/gui/src/components/mainInput/MentionList.tsx @@ -2,12 +2,9 @@ import { ArrowRightIcon, ArrowUpOnSquareIcon, AtSymbolIcon, - BeakerIcon, BookOpenIcon, CodeBracketIcon, - Cog6ToothIcon, CommandLineIcon, - CubeIcon, ExclamationCircleIcon, ExclamationTriangleIcon, FolderIcon, @@ -15,10 +12,11 @@ import { GlobeAltIcon, HashtagIcon, MagnifyingGlassIcon, - PaintBrushIcon, + PencilIcon, PlusIcon, SparklesIcon, TrashIcon, + BoltIcon, } from "@heroicons/react/24/outline"; import { Editor } from "@tiptap/react"; import { @@ -62,16 +60,11 @@ const ICONS_FOR_DROPDOWN: { [key: string]: any } = { docs: BookOpenIcon, issue: ExclamationCircleIcon, trash: TrashIcon, - "/edit": PaintBrushIcon, + "/edit": PencilIcon, "/clear": TrashIcon, - "/test": BeakerIcon, - "/config": Cog6ToothIcon, "/comment": HashtagIcon, "/share": ArrowUpOnSquareIcon, "/cmd": CommandLineIcon, - "/codebase": SparklesIcon, - "/so": GlobeAltIcon, - "/issue": ExclamationCircleIcon, }; function DropdownIcon(props: { className?: string; item: ComboBoxItem }) { @@ -81,50 +74,46 @@ function DropdownIcon(props: { className?: string; item: ComboBoxItem }) { ); } - const provider = - props.item.type === "contextProvider" - ? props.item.id - : props.item.type === "slashCommand" - ? props.item.id - : props.item.type; + const provider = (() => { + switch (props.item.type) { + case "contextProvider": + case "slashCommand": + return props.item.id; + default: + return props.item.type; + } + })(); - const iconClass = `${props.className} flex-shrink-0`; + const IconComponent = + ICONS_FOR_DROPDOWN[provider] ?? + (props.item.type === "contextProvider" ? AtSymbolIcon : BoltIcon); - let fallbackIcon; - const Icon = ICONS_FOR_DROPDOWN[provider]; - if (!Icon) { - fallbackIcon = - props.item.type === "contextProvider" ? ( - - ) : ( - - ); - } else { - fallbackIcon = ; + const fallbackIcon = ( + + ); + + if (!props.item.icon) { + return fallbackIcon; } - if (false && props.item.iconUrl) { - try { - return ( - - ); - } catch (e) {} - } - - return fallbackIcon; + return ( + + ); } const ItemsDiv = styled.div` border-radius: ${defaultBorderRadius}; - box-shadow: - 0 0 0 1px rgba(0, 0, 0, 0.05), - 0px 10px 20px rgba(0, 0, 0, 0.1); + box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.05), 0px 10px 20px rgba(0, 0, 0, 0.1); font-size: 0.9rem; overflow-x: hidden; overflow-y: auto; @@ -216,6 +205,7 @@ const MentionList = forwardRef((props: MentionListProps, ref) => { description: "Add a new documentation source", }); } + setAllItems(items); }, [subMenuTitle, props.items, props.editor]); diff --git a/gui/src/components/mainInput/TipTapEditor.tsx b/gui/src/components/mainInput/TipTapEditor.tsx index ca86e157d..654121fd9 100644 --- a/gui/src/components/mainInput/TipTapEditor.tsx +++ b/gui/src/components/mainInput/TipTapEditor.tsx @@ -4,6 +4,7 @@ import Image from "@tiptap/extension-image"; import Paragraph from "@tiptap/extension-paragraph"; import Placeholder from "@tiptap/extension-placeholder"; import Text from "@tiptap/extension-text"; +import { Plugin } from "@tiptap/pm/state"; import { Editor, EditorContent, JSONContent, useEditor } from "@tiptap/react"; import { ContextItemWithId, @@ -13,6 +14,8 @@ import { } from "core"; import { modelSupportsImages } from "core/llm/autodetect"; import { getBasename, getRelativePath } from "core/util"; +import { debounce } from "lodash"; +import { usePostHog } from "posthog-js/react"; import { useContext, useEffect, useRef, useState } from "react"; import { useDispatch, useSelector } from "react-redux"; import styled from "styled-components"; @@ -54,12 +57,11 @@ import { getSlashCommandDropdownOptions, } from "./getSuggestion"; import { ComboBoxItem } from "./types"; -import { usePostHog } from "posthog-js/react"; const InputBoxDiv = styled.div` resize: none; - padding: 8px; + padding: 8px 12px; padding-bottom: 4px; font-family: inherit; border-radius: ${defaultBorderRadius}; @@ -138,7 +140,6 @@ interface TipTapEditorProps { availableSlashCommands: ComboBoxItem[]; isMainInput: boolean; onEnter: (editorState: JSONContent, modifiers: InputModifiers) => void; - editorState?: JSONContent; } @@ -156,6 +157,7 @@ function TipTapEditor(props: TipTapEditorProps) { const { saveSession } = useHistory(dispatch); const posthog = usePostHog(); + const [isEditorFocused, setIsEditorFocused] = useState(false); const inSubmenuRef = useRef(undefined); const inDropdownRef = useRef(false); @@ -195,6 +197,7 @@ function TipTapEditor(props: TipTapEditorProps) { ); const defaultModel = useSelector(defaultModelSelector); + const defaultModelRef = useUpdatingRef(defaultModel); const getSubmenuContextItemsRef = useUpdatingRef(getSubmenuContextItems); const availableContextProvidersRef = useUpdatingRef( @@ -260,7 +263,41 @@ function TipTapEditor(props: TipTapEditorProps) { extensions: [ Document, History, - Image, + Image.extend({ + addProseMirrorPlugins() { + const plugin = new Plugin({ + props: { + handleDOMEvents: { + paste(view, event) { + const model = defaultModelRef.current; + const items = event.clipboardData.items; + for (const item of items) { + const file = item.getAsFile(); + file && + modelSupportsImages( + model.provider, + model.model, + model.title, + model.capabilities, + ) && + handleImageFile(file).then((resp) => { + if (!resp) return; + const [img, dataUrl] = resp; + const { schema } = view.state; + const node = schema.nodes.image.create({ + src: dataUrl, + }); + const tr = view.state.tr.insert(0, node); + view.dispatch(tr); + }); + } + }, + }, + }, + }); + return [plugin]; + }, + }), Placeholder.configure({ placeholder: () => historyLengthRef.current === 0 @@ -397,6 +434,8 @@ function TipTapEditor(props: TipTapEditorProps) { }, }, content: props.editorState || mainEditorContent || "", + onFocus: () => setIsEditorFocused(true), + onBlur: () => setIsEditorFocused(false), onUpdate: ({ editor, transaction }) => { // If /edit is typed and no context items are selected, select the first @@ -435,6 +474,31 @@ function TipTapEditor(props: TipTapEditorProps) { }, }); + const [shouldHideToolbar, setShouldHideToolbar] = useState(false); + const debouncedShouldHideToolbar = debounce((value) => { + setShouldHideToolbar(value); + }, 200); + + useEffect(() => { + if (editor) { + const handleFocus = () => { + debouncedShouldHideToolbar(false); + }; + + const handleBlur = () => { + debouncedShouldHideToolbar(true); + }; + + editor.on("focus", handleFocus); + editor.on("blur", handleBlur); + + return () => { + editor.off("focus", handleFocus); + editor.off("blur", handleBlur); + }; + } + }, [editor]); + const editorFocusedRef = useUpdatingRef(editor?.isFocused, [editor]); useEffect(() => { @@ -768,6 +832,7 @@ function TipTapEditor(props: TipTapEditorProps) { defaultModel.provider, defaultModel.model, defaultModel.title, + defaultModel.capabilities, ) ) { return; @@ -792,7 +857,7 @@ function TipTapEditor(props: TipTapEditorProps) { />
- {codeBlockRef.current?.scrollHeight > MAX_PREVIEW_HEIGHT && ( + {(codeBlockRef.current?.scrollHeight ?? 0) > MAX_PREVIEW_HEIGHT && ( childToText(child)).join(""); } -function PreWithToolbar(props: { - children: any; - language: string | undefined; -}) { +function PreWithToolbar(props: { children: any; language: string | null }) { const uiConfig = useUIConfig(); const toolbarBottom = uiConfig?.codeBlockToolbarPosition == "bottom"; diff --git a/gui/src/components/markdown/StyledCode.tsx b/gui/src/components/markdown/StyledCode.tsx deleted file mode 100644 index c5ed01014..000000000 --- a/gui/src/components/markdown/StyledCode.tsx +++ /dev/null @@ -1,19 +0,0 @@ -import { Prism as SyntaxHighlighter } from "react-syntax-highlighter"; -import { vscDarkPlus as highlightStyle } from "react-syntax-highlighter/dist/esm/styles/prism"; - -interface StyledCodeProps { - children: string; - language?: string; -} - -const StyledCode = (props: StyledCodeProps) => ( - - {props.children} - -); - -export default StyledCode; diff --git a/gui/src/components/markdown/StyledMarkdownPreview.tsx b/gui/src/components/markdown/StyledMarkdownPreview.tsx index 7ae3c9a61..311d8c84a 100644 --- a/gui/src/components/markdown/StyledMarkdownPreview.tsx +++ b/gui/src/components/markdown/StyledMarkdownPreview.tsx @@ -1,7 +1,6 @@ -import React, { memo, useEffect, useState } from "react"; -import { useSelector } from "react-redux"; +import { memo, useEffect } from "react"; import { useRemark } from "react-remark"; -import rehypeHighlight from "rehype-highlight"; +import rehypeHighlight, { Options } from "rehype-highlight"; import rehypeKatex from "rehype-katex"; import remarkMath from "remark-math"; import styled from "styled-components"; @@ -12,11 +11,11 @@ import { vscEditorBackground, vscForeground, } from ".."; -import { RootState } from "../../redux/store"; import { getFontSize } from "../../util"; import LinkableCode from "./LinkableCode"; import PreWithToolbar from "./PreWithToolbar"; import { SyntaxHighlightedPre } from "./SyntaxHighlightedPre"; +import { common } from "lowlight"; import "./katex.css"; import "./markdown.css"; @@ -59,19 +58,9 @@ const StyledMarkdown = styled.div<{ } background-color: ${vscBackground}; - font-family: - var(--vscode-font-family), - system-ui, - -apple-system, - BlinkMacSystemFont, - "Segoe UI", - Roboto, - Oxygen, - Ubuntu, - Cantarell, - "Open Sans", - "Helvetica Neue", - sans-serif; + font-family: var(--vscode-font-family), system-ui, -apple-system, + BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, + "Open Sans", "Helvetica Neue", sans-serif; font-size: ${(props) => props.fontSize || getFontSize()}px; padding-left: 8px; padding-right: 8px; @@ -92,41 +81,19 @@ interface StyledMarkdownPreviewProps { scrollLocked?: boolean; } -const FadeInWords: React.FC = (props: any) => { - const { children, ...otherProps } = props; +const HLJS_LANGUAGE_CLASSNAME_PREFIX = "language-"; - const active = useSelector((store: RootState) => store.state.active); +const getLanuageFromClassName = (className: any): string | null => { + if (!className || typeof className !== "string") { + return null; + } - const [textWhenActiveStarted, setTextWhenActiveStarted] = useState( - props.children, - ); + const language = className + .split(" ") + .find((word) => word.startsWith(HLJS_LANGUAGE_CLASSNAME_PREFIX)) + ?.split("-")[1]; - useEffect(() => { - if (active) { - setTextWhenActiveStarted(children); - } - }, [active]); - - // Split the text into words - const words = children - .map((child) => { - if (typeof child === "string") { - return child.split(" ").map((word, index) => ( - - {word}{" "} - - )); - } else { - return {child}; - } - }) - .flat(); - - return active && children !== textWhenActiveStarted ? ( -

{words}

- ) : ( -

{children}

- ); + return language; }; const StyledMarkdownPreview = memo(function StyledMarkdownPreview( @@ -147,7 +114,18 @@ const StyledMarkdownPreview = memo(function StyledMarkdownPreview( }; }, ], - rehypePlugins: [rehypeHighlight as any, {}, rehypeKatex as any, {}], + rehypePlugins: [ + rehypeKatex as any, + {}, + rehypeHighlight as any, + // Note: An empty obj is the default behavior, but leaving this here for scaffolding to + // add unsupported languages in the future. We will need to install the `lowlight` package + // to use the `common` language set in addition to unsupported languages. + // https://github.com/highlightjs/highlight.js/blob/main/SUPPORTED_LANGUAGES.md + { + // languages: {}, + } as Options, + ], rehypeReactOptions: { components: { a: ({ node, ...props }) => { @@ -158,12 +136,12 @@ const StyledMarkdownPreview = memo(function StyledMarkdownPreview( ); }, pre: ({ node, ...preProps }) => { - const language = preProps?.children?.[0]?.props?.className - ?.split(" ") - .find((word) => word.startsWith("language-")) - ?.split("-")[1]; + const childrenClassName = preProps?.children?.[0]?.props?.className; + return props.showCodeBorder ? ( - + ) : ( @@ -181,31 +159,6 @@ const StyledMarkdownPreview = memo(function StyledMarkdownPreview( {codeProps.children} ); }, - // pre: ({ node, ...preProps }) => { - // const codeString = - // preProps.children?.[0]?.props?.children?.[0].trim() || ""; - // const monacoEditor = ( - // - // ); - // return props.showCodeBorder ? ( - // - // - // - // ) : ( - // - // ); - // }, - // p: ({ node, ...props }) => { - // return ; - // }, }, }, }); diff --git a/gui/src/components/modelSelection/ModelSelect.tsx b/gui/src/components/modelSelection/ModelSelect.tsx index 9e68813ac..cf555c084 100644 --- a/gui/src/components/modelSelection/ModelSelect.tsx +++ b/gui/src/components/modelSelection/ModelSelect.tsx @@ -26,14 +26,15 @@ import { import ConfirmationDialog from "../dialogs/ConfirmationDialog"; const StyledListboxButton = styled(Listbox.Button)` + font-family: inherit; display: flex; align-items: center; gap: 2px; border: none; cursor: pointer; - font-size: ${() => `${getFontSize() - 3}px`}; + font-size: ${getFontSize() - 2}px; background: transparent; - color: ${() => lightGray}; + color: ${lightGray}; &:focus { outline: none; } @@ -216,10 +217,10 @@ function ModelSelect() { className="h-[18px] overflow-hidden" style={{ padding: 0 }} > -
{modelSelectTitle(defaultModel) || "Select model"}
-
+ + {modelSelectTitle(defaultModel) || "Select model"}{" "}
+ {options.map((option, idx) => ( diff --git a/gui/src/components/modelSelection/quickSetup/GitHubSignInButton.tsx b/gui/src/components/modelSelection/quickSetup/GitHubSignInButton.tsx index be0b60c2b..db79a7a9b 100644 --- a/gui/src/components/modelSelection/quickSetup/GitHubSignInButton.tsx +++ b/gui/src/components/modelSelection/quickSetup/GitHubSignInButton.tsx @@ -62,12 +62,14 @@ function GitHubSignInButton(props: GitHubSignInButtonProps) {
{ - const token = await ideMessenger.request( + const result = await ideMessenger.request( "getGitHubAuthToken", undefined, ); - setLocalStorage("signedInToGh", true); - props.onComplete(token); + if (result.status === "success") { + setLocalStorage("signedInToGh", true); + props.onComplete(result.content); + } }} className="grid grid-flow-col items-center gap-2" > diff --git a/gui/src/components/modelSelection/quickSetup/QuickModelSetup.tsx b/gui/src/components/modelSelection/quickSetup/QuickModelSetup.tsx index 76960fd9a..4c12f0a8f 100644 --- a/gui/src/components/modelSelection/quickSetup/QuickModelSetup.tsx +++ b/gui/src/components/modelSelection/quickSetup/QuickModelSetup.tsx @@ -3,13 +3,16 @@ import { FormProvider, useForm } from "react-hook-form"; import { useDispatch } from "react-redux"; import { Button, Input, SecondaryButton } from "../.."; import { IdeMessengerContext } from "../../../context/IdeMessenger"; -import { providers } from "../../../pages/AddNewModel/configs/providers"; +import { + ProviderInfo, + providers, +} from "../../../pages/AddNewModel/configs/providers"; import { setDefaultModel } from "../../../redux/slices/stateSlice"; -import QuickSetupListBox from "./QuickSetupListBox"; import { FREE_TRIAL_LIMIT_REQUESTS, hasPassedFTL, } from "../../../util/freeTrial"; +import QuickSetupListBox from "./QuickSetupListBox"; interface QuickModelSetupProps { onDone: () => void; @@ -17,7 +20,9 @@ interface QuickModelSetupProps { } function QuickModelSetup(props: QuickModelSetupProps) { - const [selectedProvider, setSelectedProvider] = useState(providers["openai"]); + const [selectedProvider, setSelectedProvider] = useState( + providers["openai"]!, + ); const [selectedModel, setSelectedModel] = useState( selectedProvider.packages[0], ); @@ -91,7 +96,9 @@ function QuickModelSetup(props: QuickModelSetupProps) { if (selectedModel.params.model.startsWith("codestral")) { apiKeyUrl = "https://console.mistral.ai/codestral"; } - ideMessenger.post("openUrl", apiKeyUrl); + if (apiKeyUrl) { + ideMessenger.post("openUrl", apiKeyUrl); + } }} > Get API Key @@ -110,7 +117,8 @@ function QuickModelSetup(props: QuickModelSetupProps) { { - ideMessenger.post("openUrl", selectedProvider.downloadUrl); + selectedProvider.downloadUrl && + ideMessenger.post("openUrl", selectedProvider.downloadUrl); }} > Download {selectedProvider.title} diff --git a/gui/src/components/modelSelection/quickSetup/QuickSetupListBox.tsx b/gui/src/components/modelSelection/quickSetup/QuickSetupListBox.tsx index 1d7c081cc..9a187fd2a 100644 --- a/gui/src/components/modelSelection/quickSetup/QuickSetupListBox.tsx +++ b/gui/src/components/modelSelection/quickSetup/QuickSetupListBox.tsx @@ -57,7 +57,7 @@ function QuickSetupListBox({ + className={({ active }: { active: boolean }) => `relative cursor-default select-none py-2 pl-10 pr-4 ${ active ? "bg-amber-100 text-amber-900" : "text-gray-900" }` diff --git a/gui/src/context/IdeMessenger.ts b/gui/src/context/IdeMessenger.ts index e67217c25..0b5329c61 100644 --- a/gui/src/context/IdeMessenger.ts +++ b/gui/src/context/IdeMessenger.ts @@ -1,5 +1,6 @@ import { ChatMessage, IDE, LLMFullCompletionOptions, PromptLog } from "core"; import type { FromWebviewProtocol, ToWebviewProtocol } from "core/protocol"; +import { WebviewMessengerResult } from "core/protocol/util"; import { MessageIde } from "core/util/messageIde"; import { Message } from "core/util/messenger"; import { createContext } from "react"; @@ -30,7 +31,7 @@ export interface IIdeMessenger { request( messageType: T, data: FromWebviewProtocol[T][0], - ): Promise; + ): Promise>; streamRequest( messageType: T, @@ -52,7 +53,16 @@ export class IdeMessenger implements IIdeMessenger { ide: IDE; constructor() { - this.ide = new MessageIde(this.request.bind(this), () => {}); + this.ide = new MessageIde( + async (messageType, data) => { + const result = await this.request(messageType, data); + if (result.status === "error") { + throw new Error(result.error); + } + return result.content; + }, + () => {}, + ); } private _postToIde(messageType: string, data: any, messageId?: string) { @@ -121,7 +131,7 @@ export class IdeMessenger implements IIdeMessenger { request( messageType: T, data: FromWebviewProtocol[T][0], - ): Promise { + ): Promise> { const messageId = uuidv4(); return new Promise((resolve) => { @@ -214,6 +224,7 @@ export class IdeMessenger implements IIdeMessenger { } return { + modelTitle: next.value.content?.modelTitle, prompt: next.value.content?.prompt, completion: next.value.content?.completion, completionOptions: next.value.content?.completionOptions, diff --git a/gui/src/editorInset/EditorInset.tsx b/gui/src/editorInset/EditorInset.tsx index d1be4f65e..f22e6a5f7 100644 --- a/gui/src/editorInset/EditorInset.tsx +++ b/gui/src/editorInset/EditorInset.tsx @@ -25,7 +25,7 @@ function EditorInset() { useSetup(dispatch); - const elementRef = useRef(null); + const elementRef = useRef(null); const ideMessenger = useContext(IdeMessengerContext); @@ -46,7 +46,7 @@ function EditorInset() { return ( { diff --git a/gui/src/hooks/CustomPostHogProvider.tsx b/gui/src/hooks/CustomPostHogProvider.tsx index 1d93889df..592288bb8 100644 --- a/gui/src/hooks/CustomPostHogProvider.tsx +++ b/gui/src/hooks/CustomPostHogProvider.tsx @@ -16,7 +16,9 @@ const CustomPostHogProvider = ({ children }: PropsWithChildren) => { posthog.init("phc_JS6XFROuNbhJtVCEdTSYk6gl5ArRrTNMpCcguAXlSPs", { api_host: "https://app.posthog.com", disable_session_recording: true, + autocapture: false, // // We need to manually track pageviews since we're a SPA + capture_pageleave: false, capture_pageview: false, }); posthog.identify(window.vscMachineId); diff --git a/gui/src/hooks/useAuth.tsx b/gui/src/hooks/useAuth.tsx index 868b22779..49961df8b 100644 --- a/gui/src/hooks/useAuth.tsx +++ b/gui/src/hooks/useAuth.tsx @@ -25,14 +25,19 @@ export function useAuth(): { useEffect(() => { ideMessenger .request("getControlPlaneSessionInfo", { silent: true }) - .then(setSession); + .then( + (result) => result.status === "success" && setSession(result.content), + ); }, []); const login = () => { - console.log("login"); ideMessenger .request("getControlPlaneSessionInfo", { silent: false }) - .then((session) => { + .then((result) => { + if (result.status === "error") { + return; + } + const session = result.content; setSession(session); // If this is the first time the user has logged in, explain how profiles work diff --git a/gui/src/hooks/useChatHandler.ts b/gui/src/hooks/useChatHandler.ts index db07f3e50..fa7e01945 100644 --- a/gui/src/hooks/useChatHandler.ts +++ b/gui/src/hooks/useChatHandler.ts @@ -1,10 +1,10 @@ import { Dispatch } from "@reduxjs/toolkit"; - import { JSONContent } from "@tiptap/react"; import { ChatHistory, ChatHistoryItem, ChatMessage, + ContextItemWithId, InputModifiers, MessageContent, PromptLog, @@ -21,6 +21,7 @@ import resolveEditorContent from "../components/mainInput/resolveInput"; import { IIdeMessenger } from "../context/IdeMessenger"; import { defaultModelSelector } from "../redux/selectors/modelSelectors"; import { + addContextItems, addPromptCompletionPair, clearLastResponse, initNewActiveMessage, @@ -35,6 +36,9 @@ function useChatHandler(dispatch: Dispatch, ideMessenger: IIdeMessenger) { const posthog = usePostHog(); const defaultModel = useSelector(defaultModelSelector); + const defaultContextProviders = useSelector( + (store: RootState) => store.state.config.experimental?.defaultContext ?? [], + ); const slashCommands = useSelector( (store: RootState) => store.state.config.slashCommands || [], @@ -56,6 +60,9 @@ function useChatHandler(dispatch: Dispatch, ideMessenger: IIdeMessenger) { const cancelToken = abortController.signal; try { + if (!defaultModel) { + throw new Error("Default model not defined"); + } const gen = ideMessenger.llmStreamChat( defaultModel.title, cancelToken, @@ -115,9 +122,15 @@ function useChatHandler(dispatch: Dispatch, ideMessenger: IIdeMessenger) { input: string, historyIndex: number, selectedCode: RangeInFile[], + contextItems: ContextItemWithId[], ) { const abortController = new AbortController(); const cancelToken = abortController.signal; + + if (!defaultModel) { + throw new Error("Default model not defined"); + } + const modelTitle = defaultModel.title; const checkActiveInterval = setInterval(() => { @@ -166,27 +179,30 @@ function useChatHandler(dispatch: Dispatch, ideMessenger: IIdeMessenger) { } // Resolve context providers and construct new history - const [contextItems, selectedCode, content] = await resolveEditorContent( - editorState, - modifiers, - ideMessenger, - ); + const [selectedContextItems, selectedCode, content] = + await resolveEditorContent( + editorState, + modifiers, + ideMessenger, + defaultContextProviders, + ); // Automatically use currently open file - if (!modifiers.noContext && (history.length === 0 || index === 0)) { - const usingFreeTrial = defaultModel.provider === "free-trial"; + if (!modifiers.noContext) { + const usingFreeTrial = defaultModel?.provider === "free-trial"; const currentFilePath = await ideMessenger.ide.getCurrentFile(); if (typeof currentFilePath === "string") { - let currentFileContents = - await ideMessenger.ide.readFile(currentFilePath); + let currentFileContents = await ideMessenger.ide.readFile( + currentFilePath, + ); if (usingFreeTrial) { currentFileContents = currentFileContents .split("\n") .slice(0, 1000) .join("\n"); } - contextItems.unshift({ + selectedContextItems.unshift({ content: `The following file is currently open. Don't reference it if it's not relevant to the user's message.\n\n\`\`\`${getRelativePath( currentFilePath, await ideMessenger.ide.getWorkspaceDirs(), @@ -200,6 +216,7 @@ function useChatHandler(dispatch: Dispatch, ideMessenger: IIdeMessenger) { }); } } + dispatch(addContextItems(contextItems)); const message: ChatMessage = { role: "user", @@ -207,7 +224,7 @@ function useChatHandler(dispatch: Dispatch, ideMessenger: IIdeMessenger) { }; const historyItem: ChatHistoryItem = { message, - contextItems, + contextItems: selectedContextItems, // : typeof index === "number" // ? history[index].contextItems // : contextItems, @@ -220,7 +237,7 @@ function useChatHandler(dispatch: Dispatch, ideMessenger: IIdeMessenger) { setMessageAtIndex({ message, index: historyIndex, - contextItems, + contextItems: selectedContextItems, }), ); @@ -242,19 +259,29 @@ function useChatHandler(dispatch: Dispatch, ideMessenger: IIdeMessenger) { await _streamNormalInput(messages); } else { const [slashCommand, commandInput] = commandAndInput; + let updatedContextItems = []; posthog.capture("step run", { step_name: slashCommand.name, params: {}, }); + + // For edit and comment slash commands, including the selected code in the context from store and for other commands, including the selected context alone + if (slashCommand.name === "edit" || slashCommand.name === "comment") { + updatedContextItems = [...contextItems]; + } else { + updatedContextItems = [...selectedContextItems]; + } + await _streamSlashCommand( messages, slashCommand, commandInput, historyIndex, selectedCode, + updatedContextItems, ); } - } catch (e) { + } catch (e: any) { console.log("Continue: error streaming response: ", e); ideMessenger.post("errorPopup", { message: `Error streaming response: ${e.message}`, diff --git a/gui/src/hooks/useHistory.tsx b/gui/src/hooks/useHistory.tsx index 615ccd7bd..8e5fe22a2 100644 --- a/gui/src/hooks/useHistory.tsx +++ b/gui/src/hooks/useHistory.tsx @@ -30,7 +30,11 @@ function useHistory(dispatch: Dispatch) { offset?: number, limit?: number, ): Promise { - return await ideMessenger.request("history/list", { offset, limit }); + const result = await ideMessenger.request("history/list", { + offset, + limit, + }); + return result.status === "success" ? result.content : []; } async function saveSession() { @@ -86,11 +90,11 @@ function useHistory(dispatch: Dispatch) { } async function getSession(id: string): Promise { - const json: PersistedSessionInfo = await ideMessenger.request( - "history/load", - { id }, - ); - return json; + const result = await ideMessenger.request("history/load", { id }); + if (result.status === "error") { + throw new Error(result.error); + } + return result.content; } async function updateSession(sessionInfo: PersistedSessionInfo) { @@ -103,22 +107,23 @@ function useHistory(dispatch: Dispatch) { async function loadSession(id: string): Promise { setLocalStorage("lastSessionId", state.sessionId); - const json: PersistedSessionInfo = await ideMessenger.request( - "history/load", - { id }, - ); + const result = await ideMessenger.request("history/load", { id }); + if (result.status === "error") { + throw new Error(result.error); + } + const json = result.content; dispatch(newSession(json)); return json; } - async function loadLastSession(): Promise { + async function loadLastSession(): Promise { const lastSessionId = getLocalStorage("lastSessionId"); if (lastSessionId) { return await loadSession(lastSessionId); } } - function getLastSessionId(): string { + function getLastSessionId(): string | undefined { return getLocalStorage("lastSessionId"); } diff --git a/gui/src/hooks/useSetup.ts b/gui/src/hooks/useSetup.ts index 28cd4019b..92fc15fda 100644 --- a/gui/src/hooks/useSetup.ts +++ b/gui/src/hooks/useSetup.ts @@ -9,14 +9,15 @@ import { setConfig, setInactive, setSelectedProfileId, + setTTSActive, } from "../redux/slices/stateSlice"; import { RootState } from "../redux/store"; +import { debounce } from "lodash"; import { isJetBrains } from "../util"; import { getLocalStorage, setLocalStorage } from "../util/localStorage"; import useChatHandler from "./useChatHandler"; import { useWebviewListener } from "./useWebviewListener"; -import { debounce } from "lodash"; function useSetup(dispatch: Dispatch) { const [configLoaded, setConfigLoaded] = useState(false); @@ -24,10 +25,14 @@ function useSetup(dispatch: Dispatch) { const ideMessenger = useContext(IdeMessengerContext); const loadConfig = async () => { - const { config, profileId } = await ideMessenger.request( + const result = await ideMessenger.request( "config/getSerializedProfileInfo", undefined, ); + if (result.status === "error") { + return; + } + const { config, profileId } = result.content; dispatch(setConfig(config)); dispatch(setSelectedProfileId(profileId)); setConfigLoaded(true); @@ -59,7 +64,11 @@ function useSetup(dispatch: Dispatch) { dispatch(setInactive()); // Tell JetBrains the webview is ready - ideMessenger.request("onLoad", undefined).then((msg) => { + ideMessenger.request("onLoad", undefined).then((result) => { + if (result.status === "error") { + return; + } + const msg = result.content; (window as any).windowId = msg.windowId; (window as any).serverUrl = msg.serverUrl; (window as any).workspacePaths = msg.workspacePaths; @@ -81,6 +90,10 @@ function useSetup(dispatch: Dispatch) { dispatch(setInactive()); }); + useWebviewListener("setTTSActive", async (status) => { + dispatch(setTTSActive(status)); + }); + useWebviewListener("setColors", async (colors) => { Object.keys(colors).forEach((key) => { document.body.style.setProperty(key, colors[key]); diff --git a/gui/src/hooks/useSubmenuContextProviders.tsx b/gui/src/hooks/useSubmenuContextProviders.tsx index 262b45eee..1c79fe0c6 100644 --- a/gui/src/hooks/useSubmenuContextProviders.tsx +++ b/gui/src/hooks/useSubmenuContextProviders.tsx @@ -197,33 +197,56 @@ function useSubmenuContextProviders() { return; } setLoaded(true); - contextProviderDescriptions.forEach(async (description) => { - const minisearch = new MiniSearch({ - fields: ["title", "description"], - storeFields: ["id", "title", "description"], - }); - const items = await ideMessenger.request("context/loadSubmenuItems", { - title: description.title, - }); - minisearch.addAll(items); - setMinisearches((prev) => ({ ...prev, [description.title]: minisearch })); - if (description.title === "file") { - const openFiles = await getOpenFileItems(); - setFallbackResults((prev) => ({ + const loadSubmenuItems = async () => { + for (const description of contextProviderDescriptions) { + const minisearch = new MiniSearch({ + fields: ["title", "description"], + storeFields: ["id", "title", "description"], + }); + const result = await ideMessenger.request("context/loadSubmenuItems", { + title: description.title, + }); + + if (result.status === "error") { + continue; + } + const items = result.content; + + try { + minisearch.addAll(items); + } catch (itemError) { + console.error( + "Error adding item to minisearch:", + itemError.message, + itemError.stack, + ); + } + + setMinisearches((prev) => ({ ...prev, - file: [ - ...openFiles, - ...items.slice(0, MAX_LENGTH - openFiles.length), - ], - })); - } else { - setFallbackResults((prev) => ({ - ...prev, - [description.title]: items.slice(0, MAX_LENGTH), + [description.title]: minisearch, })); + + if (description.title === "file") { + const openFiles = await getOpenFileItems(); + setFallbackResults((prev) => ({ + ...prev, + file: [ + ...openFiles, + ...items.slice(0, MAX_LENGTH - openFiles.length), + ], + })); + } else { + setFallbackResults((prev) => ({ + ...prev, + [description.title]: items.slice(0, MAX_LENGTH), + })); + } } - }); + }; + + loadSubmenuItems(); }, [contextProviderDescriptions, loaded]); useWebviewListener("configUpdate", async () => { diff --git a/gui/src/pages/AddNewModel/AddNewModel.tsx b/gui/src/pages/AddNewModel/AddNewModel.tsx index ddf947fc2..ed06ccdce 100644 --- a/gui/src/pages/AddNewModel/AddNewModel.tsx +++ b/gui/src/pages/AddNewModel/AddNewModel.tsx @@ -49,6 +49,7 @@ const modelsByProvider: Record = { models.mistralLarge, ], Cohere: [models.commandR, models.commandRPlus], + DeepSeek: [models.deepseekCoderApi, models.deepseekChatApi], Gemini: [models.geminiPro, models.gemini15Pro, models.gemini15Flash], "Open Source": [models.llama3Chat, models.mistralOs, models.deepseek], }; diff --git a/gui/src/pages/AddNewModel/ConfigureProvider.tsx b/gui/src/pages/AddNewModel/ConfigureProvider.tsx index 28a60f9ab..ae3837c27 100644 --- a/gui/src/pages/AddNewModel/ConfigureProvider.tsx +++ b/gui/src/pages/AddNewModel/ConfigureProvider.tsx @@ -140,7 +140,7 @@ function ConfigureProvider() { type={d.inputType} id={d.key} className="border-2 border-gray-200 rounded-md p-2 m-2" - placeholder={d.label} + placeholder={d.placeholder ?? d.label} defaultValue={d.defaultValue} min={d.min} max={d.max} @@ -170,7 +170,7 @@ function ConfigureProvider() { type={d.inputType} id={d.key} className="border-2 border-gray-200 rounded-md p-2 m-2" - placeholder={d.label} + placeholder={d.placeholder ?? d.label} defaultValue={d.defaultValue} min={d.min} max={d.max} diff --git a/gui/src/pages/AddNewModel/configs/models.ts b/gui/src/pages/AddNewModel/configs/models.ts index e3ed6f286..4763f77ff 100644 --- a/gui/src/pages/AddNewModel/configs/models.ts +++ b/gui/src/pages/AddNewModel/configs/models.ts @@ -9,7 +9,6 @@ export interface PackageDimension { description: string; options: { [key: string]: { [key: string]: any } }; } - export interface ModelPackage { title: string; icon?: string; @@ -72,7 +71,7 @@ export const models: { [key: string]: ModelPackage } = { isOpenSource: true, }, deepseek: { - title: "DeepSeek-Coder", + title: "DeepSeek Coder", description: "A model pre-trained on 2 trillion tokens including 80+ programming languages and a repo-level corpus.", params: { @@ -104,6 +103,31 @@ export const models: { [key: string]: ModelPackage } = { providerOptions: ["ollama", "lmstudio", "llama.cpp"], isOpenSource: true, }, + deepseekChatApi: { + title: "DeepSeek Chat", + description: "DeepSeek's best model for general chat use cases.", + params: { + title: "DeepSeek Chat", + model: "deepseek-chat", + contextLength: 128_000, + }, + icon: "deepseek.png", + providerOptions: ["deepseek"], + isOpenSource: false, + }, + deepseekCoderApi: { + title: "DeepSeek Coder", + description: + "A model pre-trained on 2 trillion tokens including 80+ programming languages and a repo-level corpus.", + params: { + title: "DeepSeek Coder", + model: "deepseek-coder", + contextLength: 128_000, + }, + icon: "deepseek.png", + providerOptions: ["deepseek"], + isOpenSource: false, + }, mistralOs: { title: "Mistral", description: @@ -337,6 +361,44 @@ export const models: { [key: string]: ModelPackage } = { ], isOpenSource: true, }, + graniteCodeOpenSource: { + title: "Granite Code", + description: + "The Granite model series is a family of IBM-trained, dense decoder-only models, which are particularly well-suited for generative tasks.", + params: { + model: "granite-code", + contextLength: 20_000, + title: "Granite Code", + systemMessage: `You are Granite Chat, an AI language model developed by IBM. You are a cautious assistant. You carefully follow instructions. You are helpful and harmless and you follow ethical guidelines and promote positive behavior. You always respond to greetings (for example, hi, hello, g'day, morning, afternoon, evening, night, what's up, nice to meet you, sup, etc) with "Hello! I am Granite Chat, created by IBM. How can I help you today?". Please do not say anything else and do not start a conversation.`, + }, + providerOptions: ["ollama", "lmstudio", "llama.cpp", "replicate"], + icon: "ibm.png", + isOpenSource: true, + dimensions: [ + { + name: "Parameter Count", + description: "The number of parameters in the model", + options: { + "3b": { + model: "granite-code-3b", + title: "Granite Code 3B", + }, + "8b": { + model: "granite-code-8b", + title: "Granite Code 8B", + }, + "20b": { + model: "granite-code-20b", + title: "Granite Code 20B", + }, + "34b": { + model: "granite-code-34b", + title: "Granite Code 34B", + }, + }, + }, + ], + }, wizardCoder: { title: "WizardCoder", description: @@ -659,6 +721,74 @@ export const models: { [key: string]: ModelPackage } = { icon: "anthropic.png", isOpenSource: false, }, + graniteChat: { + title: "watsonx - Granite Chat", + description: + "The Granite model series is a family of IBM-trained, dense decoder-only models, which are particularly well-suited for generative tasks.", + params: { + model: "ibm/granite-13b-chat-v2", + contextLength: 20_000, + title: "Granite Chat", + }, + providerOptions: ["watsonx"], + icon: "", + isOpenSource: false, + }, + graniteCode: { + title: "watsonx - Granite Code 20b", + description: + "The Granite model series is a family of IBM-trained, dense decoder-only models, which are particularly well-suited for generative tasks.", + params: { + model: "ibm/granite-20b-code-instruct", + contextLength: 20_000, + title: "watsonx - Granite Code 20b" + }, + providerOptions: ["watsonx"], + icon: "watsonx.png", + isOpenSource: false, + }, + MistralLarge: { + title: "watsonx - Mistral Large", + description: + "Mistral Large, the most advanced Large Language Model (LLM) developed by Mistral Al, is an exceptionally powerful model.", + params: { + model: "mistralai/mistral-large", + contextLength: 20_000, + title: "watsonx - Mistral Large", + }, + providerOptions: ["watsonx"], + icon: "mistral.png", + isOpenSource: false, + }, + MetaLlama3: { + title: "watsonx - Llama 3.1", + description: + "Llama 3 is an auto-regressive language model that uses an optimized transformer architecture.", + params: { + title: "watsonx - Llama 3.1 8b", + model: "meta-llama/llama-3-1-8b-instruct", + contextLength: 20_000, + }, + icon: "meta.png", + dimensions: [ + { + name: "Parameter Count", + description: "The number of parameters in the model", + options: { + "8b": { + model: "meta-llama/llama-3-1-8b-instruct", + title: "watsonx - Llama 3.1 8b", + }, + "70b": { + model: "meta-llama/llama-3-1-70b-instruct", + title: "watsonx - Llama 3.1 70b", + }, + }, + }, + ], + providerOptions: ["watsonx"], + isOpenSource: false, + }, AUTODETECT: { title: "Autodetect", description: diff --git a/gui/src/pages/AddNewModel/configs/providers.ts b/gui/src/pages/AddNewModel/configs/providers.ts index 630b5de78..e36bd35b4 100644 --- a/gui/src/pages/AddNewModel/configs/providers.ts +++ b/gui/src/pages/AddNewModel/configs/providers.ts @@ -274,10 +274,30 @@ Select the \`GPT-4o\` model below to complete your provider configuration, but n title: "Groq", }, }, - , ], apiKeyUrl: "https://console.groq.com/keys", }, + deepseek: { + title: "DeepSeek", + provider: "deepseek", + icon: "deepseek.png", + description: + "DeepSeek provides cheap inference of its DeepSeek Coder v2 and other impressive open-source models.", + longDescription: + "To get started with DeepSeek, obtain an API key from their website [here](https://platform.deepseek.com/api_keys).", + tags: [ModelProviderTags.RequiresApiKey, ModelProviderTags.OpenSource], + collectInputFor: [ + { + inputType: "text", + key: "apiKey", + label: "API Key", + placeholder: "Enter your DeepSeek API key", + required: true, + }, + ], + packages: [models.deepseekCoderApi, models.deepseekChatApi], + apiKeyUrl: "https://platform.deepseek.com/api_keys", + }, together: { title: "TogetherAI", provider: "together", @@ -455,6 +475,76 @@ After it's up and running, you can start using Continue.`, ...openSourceModels, ], }, + watsonx: { + title: "IBM watsonx", + provider: "watsonx", + refPage: "watsonX", + description: + "Explore foundation models from IBM and other third-parties depending on your use case.", + longDescription: `**watsonx**, developed by IBM, offers a variety of pre-trained AI foundation models that can be used for natural language processing (NLP), computer vision, and speech recognition tasks. + +To get started, [register](https://dataplatform.cloud.ibm.com/registration/stepone?context=wx) on watsonx SaaS, create your first project and setup an [API key](https://www.ibm.com/docs/en/mas-cd/continuous-delivery?topic=cli-creating-your-cloud-api-key).`, + collectInputFor: [ + { + inputType: "text", + key: "watsonxUrl", + label: "watsonx URL", + placeholder: "e.g. http://us-south.dataplatform.cloud.ibm.com", + required: true + }, + { + inputType: "text", + key: "watsonxProjectId", + label: "watsonx Project ID", + placeholder: "Enter your project ID", + required: true + }, + { + inputType: "text", + key: "watsonxCreds", + label: "watsonx API key", + placeholder: "Enter your API key (SaaS) or ZenApiKey (Software)", + required: true + }, + { + inputType: "text", + key: "watsonxApiVersion", + label: "watsonx API version", + placeholder: "Enter the API Version", + defaultValue: "2023-05-29" + }, + // { + // inputType: "text", + // key: "title", + // label: "Model name", + // placeholder: "Granite 13B Chat v2", + // isWatsonxAttribute: true, + // }, + // { + // inputType: "text", + // key: "model", + // label: "Model Id", + // placeholder: "ibm/granite-13b-chat-v2", + // isWatsonxAttribute: true, + // }, + { + inputType: "text", + key: "watsonxStopToken", + label: "Stop Token", + placeholder: "<|im_end|>", + }, + + ...completionParamsInputsConfigs, + ], + icon: "watsonx.png", + tags: [ModelProviderTags.RequiresApiKey], + packages: [ + models.graniteCode, + models.graniteChat, + models.MistralLarge, + models.MetaLlama3, + ], + }, "free-trial": { title: "Continue limited free trial", provider: "free-trial", diff --git a/gui/src/pages/gui.tsx b/gui/src/pages/gui.tsx index e255ad060..d38e57dd9 100644 --- a/gui/src/pages/gui.tsx +++ b/gui/src/pages/gui.tsx @@ -87,6 +87,7 @@ const StopButton = styled.div` `; const StepsDiv = styled.div` + padding-bottom: 8px; position: relative; background-color: transparent; @@ -106,11 +107,11 @@ const StepsDiv = styled.div` // } .thread-message { - margin: 16px 8px 0 8px; - } - .thread-message:not(:first-child) { - border-top: 1px solid ${lightGray}22; + margin: 12px 4px 0 4px; } + // .thread-message:not(:first-child) { + // border-top: 1px solid ${lightGray}22; + // } `; const NewSessionButton = styled.div` @@ -133,39 +134,7 @@ const NewSessionButton = styled.div` cursor: pointer; `; -const ThreadHead = styled.div` - display: flex; - align-items: center; - gap: 6px; - margin: 18px 6px 0 6px; -`; - -const THREAD_AVATAR_SIZE = 15; - -const ThreadAvatar = styled.div` - width: 24px; - height: 24px; - border-radius: 50%; - background-color: rgba(248, 248, 248, 0.75); - color: #000; - display: flex; - align-items: center; - justify-content: center; - border: 1px solid rgba(136, 136, 136, 0.3); -`; - -const ThreadUserTitle = styled.div` - text-transform: capitalize; - font-weight: 500; - margin-bottom: 2px; -`; - -const ThreadUserName = styled.div` - font-size: ${getFontSize() - 3}px; - color: ${lightGray}; -`; - -function fallbackRender({ error, resetErrorBoundary }) { +function fallbackRender({ error, resetErrorBoundary }: any) { // Call resetErrorBoundary() to reset the error boundary and retry the render. return ( @@ -194,6 +163,7 @@ function GUI() { const defaultModel = useSelector(defaultModelSelector); + const ttsActive = useSelector((state: RootState) => state.state.ttsActive); const active = useSelector((state: RootState) => state.state.active); const [stepsOpen, setStepsOpen] = useState<(boolean | undefined)[]>([]); @@ -206,7 +176,7 @@ function GUI() { const state = useSelector((state: RootState) => state.state); const [showTutorialCard, setShowTutorialCard] = useState( - getLocalStorage("showTutorialCard"), + getLocalStorage("showTutorialCard") ?? true, ); const onCloseTutorialCard = () => { @@ -482,10 +452,7 @@ function GUI() { onDelete={() => { dispatch(deleteMessage(index)); }} - subtext={ - item.promptLogs?.[0]?.completionOptions?.model ?? - "" - } + modelTitle={item.promptLogs?.[0]?.modelTitle ?? ""} />
@@ -510,26 +477,32 @@ function GUI() {
) : state.history.length > 0 ? ( - { - saveSession(); - }} - className="mr-auto" - > - New Session ({getMetaKeyLabel()} {isJetBrains() ? "J" : "L"}) - +
+ { + saveSession(); + }} + className="mr-auto" + > + New Session ({getMetaKeyLabel()} {isJetBrains() ? "J" : "L"}) + {" "} +
) : ( <> {getLastSessionId() ? ( - { - loadLastSession(); - }} - className="mr-auto flex items-center gap-1" - > - - Last Session - +
+ { + loadLastSession().catch((e) => + console.error(`Failed to load last session: ${e}`), + ); + }} + className="mr-auto flex items-center gap-2" + > + + Last Session + +
) : null} {!!showTutorialCard && ( @@ -547,9 +520,19 @@ function GUI() { trackVisibility={active} /> + {ttsActive && ( + { + ideMessenger.post("tts/kill", undefined); + }} + > + ■ Stop TTS + + )} {active && ( { dispatch(setInactive()); if ( diff --git a/gui/src/pages/help.tsx b/gui/src/pages/help.tsx index cf2093269..e054f1afb 100644 --- a/gui/src/pages/help.tsx +++ b/gui/src/pages/help.tsx @@ -102,18 +102,6 @@ function HelpPage() { className="no-underline" > - - - Create a GitHub issue @@ -132,15 +120,6 @@ function HelpPage() { className="no-underline" > - - - Continue Discord diff --git a/gui/src/pages/history.tsx b/gui/src/pages/history.tsx index 377455ec9..47744fd7f 100644 --- a/gui/src/pages/history.tsx +++ b/gui/src/pages/history.tsx @@ -23,13 +23,20 @@ import useHistory from "../hooks/useHistory"; import { useNavigationListener } from "../hooks/useNavigationListener"; import { getFontSize } from "../util"; +const SearchBarContainer = styled.div` + display: flex; + max-width: 500px; + padding: 0 8px 0 8px; + margin: 0 auto; + align-items: center; + justify-content: center; +`; + const SearchBar = styled.input` padding: 4px 8px; border-radius: ${defaultBorderRadius}; border: 0.5px solid #888; outline: none; - width: 90vw; - max-width: 500px; margin: 8px auto; display: block; background-color: ${vscInputBackground}; @@ -60,14 +67,15 @@ const parseDate = (date: string): Date => { }; const SectionHeader = styled.tr` + display: flex; + user-select: none; padding: 4px; - padding-left: 16px; - padding-right: 16px; background-color: ${vscInputBackground}; width: 100%; font-weight: bold; text-align: center; align-items: center; + justify-content: center; margin: 0; position: sticky; height: 1.5em; @@ -150,16 +158,19 @@ function TableRow({
- {date.toLocaleString("en-US", { - year: "2-digit", - month: "2-digit", - day: "2-digit", - hour: "numeric", - minute: "2-digit", - hour12: true, - })} - {" | "} {lastPartOfPath(session.workspaceDirectory || "")} + {!hovered && ( + + {date.toLocaleString("en-US", { + year: "2-digit", + month: "2-digit", + day: "2-digit", + hour: "numeric", + minute: "2-digit", + hour12: true, + })} + + )}
@@ -214,7 +225,8 @@ function History() { ); }; - const [filteringByWorkspace, setFilteringByWorkspace] = useState(false); + const searchInputRef = React.useRef(null); + const stickyHistoryHeaderRef = React.useRef(null); const [headerHeight, setHeaderHeight] = useState(0); @@ -247,8 +259,12 @@ function History() { }, []); useEffect(() => { + // When searchTerm is empty only show sessions from the current workspace + let filteringByWorkspace = searchTerm === ""; + + // When the searchTerm is wildcard (asterisk) then show ALL sessions, otherwise use minisearch to search for user input const sessionIds = minisearch - .search(searchTerm, { + .search(searchTerm === "*" ? "" : searchTerm, { fuzzy: 0.1, }) .map((result) => result.id); @@ -267,7 +283,11 @@ function History() { }) // Filter by search term .filter((session) => { - return searchTerm === "" || sessionIds.includes(session.sessionId); + return ( + searchTerm === "*" || + filteringByWorkspace || + sessionIds.includes(session.sessionId) + ); }) .sort( (a, b) => @@ -275,7 +295,7 @@ function History() { parseDate(a.dateCreated).getTime(), ), ); - }, [filteringByWorkspace, sessions, searchTerm, minisearch]); + }, [sessions, searchTerm, minisearch]); useEffect(() => { setHeaderHeight(stickyHistoryHeaderRef.current?.clientHeight || 100); @@ -319,11 +339,34 @@ function History() {
- setSearchTerm(e.target.value)} - /> + + setSearchTerm(e.target.value)} + /> + { + if (searchInputRef.current.value === "") { + searchInputRef.current.value = "*"; + setSearchTerm("*"); + } else { + searchInputRef.current.value = ""; + setSearchTerm(""); + } + }} + > + {searchTerm === "" ? "Show All" : "Clear"} + + {filteredAndSortedSessions.length === 0 && (
diff --git a/gui/src/pages/onboarding/ApiKeysOnboarding.tsx b/gui/src/pages/onboarding/ApiKeysOnboarding.tsx index 2b070960c..95f733ccf 100644 --- a/gui/src/pages/onboarding/ApiKeysOnboarding.tsx +++ b/gui/src/pages/onboarding/ApiKeysOnboarding.tsx @@ -6,7 +6,7 @@ import Toggle from "../../components/modelSelection/Toggle"; import { IdeMessengerContext } from "../../context/IdeMessenger"; import { getLocalStorage } from "../../util/localStorage"; import DefaultModelConfigForm from "./DefaultModelConfigForm"; -import { useOnboarding } from "./utils"; +import { useCompleteOnboarding } from "./utils"; function ApiKeysOnboarding() { const ideMessenger = useContext(IdeMessengerContext); @@ -14,7 +14,7 @@ function ApiKeysOnboarding() { const [isBestToggle, setIsBestToggle] = useState(true); - const { completeOnboarding } = useOnboarding(); + const { completeOnboarding } = useCompleteOnboarding(); return (
diff --git a/gui/src/pages/onboarding/DefaultModelConfigForm.tsx b/gui/src/pages/onboarding/DefaultModelConfigForm.tsx index 90e0d56d6..9c3940bec 100644 --- a/gui/src/pages/onboarding/DefaultModelConfigForm.tsx +++ b/gui/src/pages/onboarding/DefaultModelConfigForm.tsx @@ -7,7 +7,7 @@ import { setDefaultModel } from "../../redux/slices/stateSlice"; import { models } from "../AddNewModel/configs/models"; import { providers } from "../AddNewModel/configs/providers"; import { StyledButton } from "./components"; -import { useOnboarding } from "./utils"; +import { useCompleteOnboarding } from "./utils"; const HelperText = styled.p` font-size: 0.8rem; @@ -23,7 +23,7 @@ function DefaultModelConfigForm() { const [mistralApiKey, setMistralApiKey] = useState(""); const [anthropicApiKey, setAnthropicApiKey] = useState(""); - const { completeOnboarding } = useOnboarding(); + const { completeOnboarding } = useCompleteOnboarding(); const isFormComplete = !!mistralApiKey && !!anthropicApiKey; diff --git a/gui/src/pages/onboarding/LocalOnboarding.tsx b/gui/src/pages/onboarding/LocalOnboarding.tsx index ea0b03143..04611c553 100644 --- a/gui/src/pages/onboarding/LocalOnboarding.tsx +++ b/gui/src/pages/onboarding/LocalOnboarding.tsx @@ -6,7 +6,7 @@ import { IdeMessengerContext } from "../../context/IdeMessenger"; import { CheckMarkHeader } from "./CheckMarkHeader"; import { StyledButton } from "./components"; import { CopyToTerminalButton } from "./CopyToTerminalButton"; -import { useOnboarding } from "./utils"; +import { useCompleteOnboarding } from "./utils"; type OllamaConnectionStatuses = | "waiting_to_download" @@ -35,7 +35,7 @@ function LocalOnboarding() { const [hasLoadedChatModel, setHasLoadedChatModel] = useState(false); - const { completeOnboarding } = useOnboarding(); + const { completeOnboarding } = useCompleteOnboarding(); const isOllamaConnected = ollamaConnectionStatus === "verified"; diff --git a/gui/src/pages/onboarding/Onboarding.tsx b/gui/src/pages/onboarding/Onboarding.tsx index 827fec0f0..a1de9a528 100644 --- a/gui/src/pages/onboarding/Onboarding.tsx +++ b/gui/src/pages/onboarding/Onboarding.tsx @@ -5,7 +5,7 @@ import { GiftIcon, } from "@heroicons/react/24/outline"; import { ToCoreFromIdeOrWebviewProtocol } from "core/protocol/core"; -import { useContext, useState } from "react"; +import { useContext, useEffect, useState } from "react"; import { useDispatch } from "react-redux"; import { useNavigate } from "react-router-dom"; import { lightGray } from "../../components"; @@ -19,7 +19,9 @@ import { import { isJetBrains } from "../../util"; import { FREE_TRIAL_LIMIT_REQUESTS, hasPassedFTL } from "../../util/freeTrial"; import { Div, StyledButton } from "./components"; -import { useOnboarding } from "./utils"; +import { isNewUserOnboarding, useCompleteOnboarding } from "./utils"; +import { setLocalStorage } from "../../util/localStorage"; +import { usePostHog } from "posthog-js/react"; type OnboardingMode = ToCoreFromIdeOrWebviewProtocol["completeOnboarding"][0]["mode"]; @@ -27,6 +29,7 @@ type OnboardingMode = function Onboarding() { const navigate = useNavigate(); const dispatch = useDispatch(); + const posthog = usePostHog(); const ideMessenger = useContext(IdeMessengerContext); const [hasSignedIntoGh, setHasSignedIntoGh] = useState(false); @@ -34,7 +37,7 @@ function Onboarding() { OnboardingMode | undefined >(undefined); - const { completeOnboarding } = useOnboarding(); + const { completeOnboarding } = useCompleteOnboarding(); function onSubmit() { ideMessenger.post("completeOnboarding", { @@ -68,8 +71,15 @@ function Onboarding() { } } + useEffect(() => { + if (isNewUserOnboarding()) { + posthog.capture("Onboarding Step", { status: "Started" }); + setLocalStorage("onboardingStatus", "Started"); + } + }, []); + return ( -
+

Welcome to Continue

diff --git a/gui/src/pages/onboarding/apiKeyAutocompleteOnboarding.tsx b/gui/src/pages/onboarding/apiKeyAutocompleteOnboarding.tsx index 1f6c38e2a..45f667182 100644 --- a/gui/src/pages/onboarding/apiKeyAutocompleteOnboarding.tsx +++ b/gui/src/pages/onboarding/apiKeyAutocompleteOnboarding.tsx @@ -13,7 +13,7 @@ import { StyledListboxOptions, } from "../../components/modelSelection/quickSetup/StyledListbox"; import { IdeMessengerContext } from "../../context/IdeMessenger"; -import { useOnboarding } from "./utils"; +import { useCompleteOnboarding } from "./utils"; interface AutocompleteOption { provider: ModelProvider; @@ -80,7 +80,7 @@ function AutocompleteModelDropdown({ + className={({ active }: { active: boolean }) => `relative cursor-default select-none py-2 pl-10 pr-4 ${ active ? "bg-amber-100 text-amber-900" : "text-gray-900" }` @@ -124,7 +124,7 @@ function ApiKeyAutocompleteOnboarding() { const [apiKeyValue, setApiKeyValue] = useState(""); - const { completeOnboarding } = useOnboarding(); + const { completeOnboarding } = useCompleteOnboarding(); return (

diff --git a/gui/src/pages/onboarding/utils.ts b/gui/src/pages/onboarding/utils.ts index 0c978a41e..48c15a28b 100644 --- a/gui/src/pages/onboarding/utils.ts +++ b/gui/src/pages/onboarding/utils.ts @@ -1,5 +1,4 @@ import { usePostHog } from "posthog-js/react"; -import { useEffect } from "react"; import { useNavigate } from "react-router-dom"; import { getLocalStorage, setLocalStorage } from "../../util/localStorage"; @@ -9,15 +8,16 @@ export type OnboardingStatus = "Started" | "Completed"; // If there is no value in local storage for "onboardingStatus", // it implies that the user has not begun or completed onboarding. -export function shouldBeginOnboarding() { +export function isNewUserOnboarding() { // We used to use "onboardingComplete", but switched to "onboardingStatus" const onboardingCompleteLegacyValue = localStorage.getItem("onboardingComplete"); + if (onboardingCompleteLegacyValue === "true") { setLocalStorage("onboardingStatus", "Completed"); localStorage.removeItem("onboardingComplete"); - return false; } + const onboardingStatus = getLocalStorage("onboardingStatus"); return onboardingStatus === undefined; @@ -26,11 +26,11 @@ export function shouldBeginOnboarding() { /** * Telemetry, status tracking, and routing logic for new user onboarding. */ -export function useOnboarding() { +export function useCompleteOnboarding() { const posthog = usePostHog(); const navigate = useNavigate(); - const completeOnboarding = () => { + function completeOnboarding() { const onboardingStatus = getLocalStorage("onboardingStatus"); if (onboardingStatus === "Started") { @@ -40,14 +40,7 @@ export function useOnboarding() { } navigate("/"); - }; - - useEffect(() => { - if (shouldBeginOnboarding()) { - setLocalStorage("onboardingStatus", "Started"); - posthog.capture("Onboarding Step", { status: "Started" }); - } - }, []); + } return { completeOnboarding, diff --git a/gui/src/pages/stats.tsx b/gui/src/pages/stats.tsx index c07adc864..c9a2d6464 100644 --- a/gui/src/pages/stats.tsx +++ b/gui/src/pages/stats.tsx @@ -46,16 +46,16 @@ function Stats() { >([]); useEffect(() => { - ideMessenger.request("stats/getTokensPerDay", undefined).then((days) => { - setDays(days); + ideMessenger.request("stats/getTokensPerDay", undefined).then((result) => { + result.status === "success" && setDays(result.content); }); }, []); useEffect(() => { ideMessenger .request("stats/getTokensPerModel", undefined) - .then((models) => { - setModels(models); + .then((result) => { + result.status === "success" && setModels(result.content); }); }, []); diff --git a/gui/src/redux/selectors/index.ts b/gui/src/redux/selectors/index.ts index 6a56499bb..88f5c99bc 100644 --- a/gui/src/redux/selectors/index.ts +++ b/gui/src/redux/selectors/index.ts @@ -20,11 +20,11 @@ export const selectSlashCommands = createSelector( export const selectContextProviderDescriptions = createSelector( [(store: RootState) => store.state.config.contextProviders], (providers) => { - return providers.filter((desc) => desc.type === "submenu") || []; + return providers?.filter((desc) => desc.type === "submenu") || []; }, ); export const selectUseActiveFile = createSelector( [(store: RootState) => store.state.config.experimental?.defaultContext], - (defaultContext) => defaultContext?.includes("activeFile"), + (defaultContext) => defaultContext?.includes("activeFile" as any), ); diff --git a/gui/src/redux/slices/miscSlice.ts b/gui/src/redux/slices/miscSlice.ts index e07340590..a01b02374 100644 --- a/gui/src/redux/slices/miscSlice.ts +++ b/gui/src/redux/slices/miscSlice.ts @@ -5,6 +5,7 @@ export const miscSlice = createSlice({ initialState: { takenAction: false, serverStatusMessage: "Continue Server Starting", + lastControlServerBetaEnabledStatus: false, }, reducers: { setTakenActionTrue: (state) => { @@ -13,8 +14,18 @@ export const miscSlice = createSlice({ setServerStatusMessage: (state, action: PayloadAction) => { state.serverStatusMessage = action.payload; }, + setLastControlServerBetaEnabledStatus: ( + state, + action: PayloadAction, + ) => { + state.lastControlServerBetaEnabledStatus = action.payload; + }, }, }); -export const { setTakenActionTrue, setServerStatusMessage } = miscSlice.actions; +export const { + setTakenActionTrue, + setServerStatusMessage, + setLastControlServerBetaEnabledStatus, +} = miscSlice.actions; export default miscSlice.reducer; diff --git a/gui/src/redux/slices/stateSlice.ts b/gui/src/redux/slices/stateSlice.ts index 69b0450c8..7534d9b85 100644 --- a/gui/src/redux/slices/stateSlice.ts +++ b/gui/src/redux/slices/stateSlice.ts @@ -98,6 +98,7 @@ fn bubble_sort(values: &mut[T]) { type State = { history: ChatHistory; contextItems: ContextItemWithId[]; + ttsActive: boolean; active: boolean; config: BrowserSerializedContinueConfig; title: string; @@ -110,6 +111,7 @@ type State = { const initialState: State = { history: [], contextItems: [], + ttsActive: false, active: false, config: { slashCommands: [ @@ -168,6 +170,9 @@ export const stateSlice = createSlice({ ? lastHistory.promptLogs.concat(payload) : payload; }, + setTTSActive: (state, { payload }: PayloadAction) => { + state.ttsActive = payload; + }, setActive: (state) => { state.active = true; }, @@ -510,6 +515,7 @@ export const { setDefaultModel, setConfig, addPromptCompletionPair, + setTTSActive, setActive, setEditingContextItemAtIndex, initNewActiveMessage, diff --git a/gui/src/redux/slices/uiStateSlice.ts b/gui/src/redux/slices/uiStateSlice.ts index f75a83125..0d6671162 100644 --- a/gui/src/redux/slices/uiStateSlice.ts +++ b/gui/src/redux/slices/uiStateSlice.ts @@ -4,7 +4,7 @@ type UiState = { bottomMessageCloseTimeout: NodeJS.Timeout | undefined; displayBottomMessageOnBottom: boolean; showDialog: boolean; - dialogMessage: string | JSX.Element; + dialogMessage: string | JSX.Element | undefined; dialogEntryOn: boolean; }; @@ -21,13 +21,13 @@ export const uiStateSlice = createSlice({ reducers: { setBottomMessage: ( state, - action: PayloadAction + action: PayloadAction, ) => { state.bottomMessage = action.payload; }, setBottomMessageCloseTimeout: ( state, - action: PayloadAction + action: PayloadAction, ) => { if (state.bottomMessageCloseTimeout) { clearTimeout(state.bottomMessageCloseTimeout); @@ -36,13 +36,13 @@ export const uiStateSlice = createSlice({ }, setDialogMessage: ( state, - action: PayloadAction + action: PayloadAction, ) => { state.dialogMessage = action.payload; }, setDialogEntryOn: ( state, - action: PayloadAction + action: PayloadAction, ) => { state.dialogEntryOn = action.payload; }, @@ -51,7 +51,7 @@ export const uiStateSlice = createSlice({ }, setDisplayBottomMessageOnBottom: ( state, - action: PayloadAction + action: PayloadAction, ) => { state.displayBottomMessageOnBottom = action.payload; }, diff --git a/gui/src/redux/store.ts b/gui/src/redux/store.ts index 16ac22ad9..86f6bf21e 100644 --- a/gui/src/redux/store.ts +++ b/gui/src/redux/store.ts @@ -25,7 +25,7 @@ const rootReducer = combineReducers({ export type RootState = ReturnType; -const windowIDTransform = (windowID) => +const windowIDTransform = (windowID: string) => createTransform( // transform state on its way to being serialized and persisted. (inboundState, key) => { @@ -34,7 +34,7 @@ const windowIDTransform = (windowID) => // transform state being rehydrated (outboundState, key) => { return outboundState[windowID] || {}; - } + }, ); const saveSubsetFilters = [ diff --git a/gui/src/util/freeTrial.ts b/gui/src/util/freeTrial.ts index 60d789cd4..83e9ea510 100644 --- a/gui/src/util/freeTrial.ts +++ b/gui/src/util/freeTrial.ts @@ -6,6 +6,6 @@ export const FREE_TRIAL_LIMIT_REQUESTS = 50; * * @returns {boolean} true if the user has passed the free trial limit, false otherwise. */ -export function hasPassedFTL() { - return getLocalStorage("ftc") > FREE_TRIAL_LIMIT_REQUESTS; +export function hasPassedFTL(): boolean { + return (getLocalStorage("ftc") ?? 0) > FREE_TRIAL_LIMIT_REQUESTS; } diff --git a/extensions/vscode/manual-testing-sandbox/example.ipynb b/manual-testing-sandbox/example.ipynb similarity index 100% rename from extensions/vscode/manual-testing-sandbox/example.ipynb rename to manual-testing-sandbox/example.ipynb diff --git a/extensions/vscode/manual-testing-sandbox/nested-folder/helloNested.py b/manual-testing-sandbox/nested-folder/helloNested.py similarity index 100% rename from extensions/vscode/manual-testing-sandbox/nested-folder/helloNested.py rename to manual-testing-sandbox/nested-folder/helloNested.py diff --git a/extensions/vscode/manual-testing-sandbox/readme.md b/manual-testing-sandbox/readme.md similarity index 100% rename from extensions/vscode/manual-testing-sandbox/readme.md rename to manual-testing-sandbox/readme.md diff --git a/extensions/vscode/manual-testing-sandbox/test.css b/manual-testing-sandbox/test.css similarity index 100% rename from extensions/vscode/manual-testing-sandbox/test.css rename to manual-testing-sandbox/test.css diff --git a/manual-testing-sandbox/test.csv b/manual-testing-sandbox/test.csv new file mode 100644 index 000000000..49ae6b845 --- /dev/null +++ b/manual-testing-sandbox/test.csv @@ -0,0 +1,26 @@ +Date,Temperature,Damage Incident +04/12/1981,66,0 +11/12/1981,70,1 +3/22/82,69,0 +6/27/82,80,NA +01/11/1982,68,0 +04/04/1983,67,0 +6/18/83,72,0 +8/30/83,73,0 +11/28/83,70,0 +02/03/1984,57,1 +04/06/1984,63,1 +8/30/84,70,1 +10/05/1984,78,0 +11/08/1984,67,0 +1/24/85,53,1 +04/12/1985,67,0 +4/29/85,75,0 +6/17/85,70,0 +7/29/85,81,0 +8/27/85,76,0 +10/03/1985,79,0 +10/30/85,75,1 +11/26/85,76,0 +01/12/1986,58,1 +1/28/86,31,Challenger Accident diff --git a/extensions/vscode/manual-testing-sandbox/test.js b/manual-testing-sandbox/test.js similarity index 100% rename from extensions/vscode/manual-testing-sandbox/test.js rename to manual-testing-sandbox/test.js diff --git a/extensions/vscode/manual-testing-sandbox/test.rs b/manual-testing-sandbox/test.rs similarity index 100% rename from extensions/vscode/manual-testing-sandbox/test.rs rename to manual-testing-sandbox/test.rs diff --git a/packages/config-types/package.json b/packages/config-types/package.json index 544f807f0..3c715cc2b 100644 --- a/packages/config-types/package.json +++ b/packages/config-types/package.json @@ -1,6 +1,6 @@ { "name": "@continuedev/config-types", - "version": "1.0.10", + "version": "1.0.11", "description": "", "main": "dist/index.js", "types": "dist/index.d.ts", diff --git a/packages/config-types/src/index.ts b/packages/config-types/src/index.ts index 9d58ddffa..0e20ba7cb 100644 --- a/packages/config-types/src/index.ts +++ b/packages/config-types/src/index.ts @@ -51,6 +51,7 @@ export const modelDescriptionSchema = z.object({ "gemini", "mistral", "bedrock", + "sagemaker", "cloudflare", "azure", "continue-proxy", diff --git a/packages/fetch/package-lock.json b/packages/fetch/package-lock.json index b9d1c03c5..b7f80cb7d 100644 --- a/packages/fetch/package-lock.json +++ b/packages/fetch/package-lock.json @@ -1,12 +1,12 @@ { "name": "@continuedev/fetch", - "version": "1.0.0", + "version": "1.0.2", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@continuedev/fetch", - "version": "1.0.0", + "version": "1.0.2", "license": "Apache-2.0", "dependencies": { "@continuedev/config-types": "^1.0.5", diff --git a/packages/fetch/package.json b/packages/fetch/package.json index 2fab4e43f..17223fc3f 100644 --- a/packages/fetch/package.json +++ b/packages/fetch/package.json @@ -1,6 +1,6 @@ { "name": "@continuedev/fetch", - "version": "1.0.2", + "version": "1.0.3", "description": "", "main": "dist/index.js", "types": "dist/index.d.ts", diff --git a/packages/fetch/src/index.ts b/packages/fetch/src/index.ts index c310ea53c..ca0055148 100644 --- a/packages/fetch/src/index.ts +++ b/packages/fetch/src/index.ts @@ -1,8 +1,16 @@ -export { +import { streamJSON, streamResponse, streamSse, toAsyncIterable, } from "./stream.js"; -export { fetchwithRequestOptions } from "./fetch.js"; +import { fetchwithRequestOptions } from "./fetch.js"; + +export { + fetchwithRequestOptions, + streamJSON, + streamResponse, + streamSse, + toAsyncIterable, +}; diff --git a/packages/openai-adapters/.npmignore b/packages/openai-adapters/.npmignore new file mode 100644 index 000000000..02818d352 --- /dev/null +++ b/packages/openai-adapters/.npmignore @@ -0,0 +1,2 @@ +.env +test \ No newline at end of file diff --git a/packages/openai-adapters/jest.config.mjs b/packages/openai-adapters/jest.config.mjs new file mode 100644 index 000000000..2592f3834 --- /dev/null +++ b/packages/openai-adapters/jest.config.mjs @@ -0,0 +1,20 @@ +import path from "path"; +import { fileURLToPath } from "url"; + +export default { + transform: { + "\\.[jt]sx?$": ["ts-jest", { useESM: true }], + }, + + moduleNameMapper: { + "(.+)\\.js": "$1", + }, + extensionsToTreatAsEsm: [".ts"], + preset: "ts-jest/presets/default-esm", + testTimeout: 10000, + testEnvironment: "node", + globals: { + __dirname: path.dirname(fileURLToPath(import.meta.url)), + __filename: path.resolve(fileURLToPath(import.meta.url)), + }, +}; diff --git a/packages/openai-adapters/package-lock.json b/packages/openai-adapters/package-lock.json index fdf52d285..27df8c41a 100644 --- a/packages/openai-adapters/package-lock.json +++ b/packages/openai-adapters/package-lock.json @@ -1,22 +1,39 @@ { "name": "@continuedev/openai-adapters", - "version": "1.0.3", + "version": "1.0.8", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@continuedev/openai-adapters", - "version": "1.0.3", + "version": "1.0.8", "license": "Apache-2.0", "dependencies": { "@azure/openai": "^1.0.0-beta.12", "@continuedev/config-types": "^1.0.5", - "@continuedev/fetch": "^1.0.1", + "@continuedev/fetch": "^1.0.3", "node-fetch": "^3.3.2", "openai": "^4.52.5" }, "devDependencies": { - "@types/follow-redirects": "^1.14.4" + "@types/follow-redirects": "^1.14.4", + "cross-env": "^7.0.3", + "ts-jest": "^29.2.3", + "ts-node": "^10.9.2" + } + }, + "node_modules/@ampproject/remapping": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.3.0.tgz", + "integrity": "sha512-30iZtAPgz+LTIYoeivqYo853f02jBYSd5uGnGpkFV0M3xOt9aN73erkgYAmZU43x4VfqcnLxW9Kpg3R5LC4YYw==", + "dev": true, + "peer": true, + "dependencies": { + "@jridgewell/gen-mapping": "^0.3.5", + "@jridgewell/trace-mapping": "^0.3.24" + }, + "engines": { + "node": ">=6.0.0" } }, "node_modules/@azure-rest/core-client": { @@ -139,6 +156,549 @@ "node": ">=18.0.0" } }, + "node_modules/@babel/code-frame": { + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.24.7.tgz", + "integrity": "sha512-BcYH1CVJBO9tvyIZ2jVeXgSIMvGZ2FDRvDdOIVQyuklNKSsx+eppDEBq/g47Ayw+RqNFE+URvOShmf+f/qwAlA==", + "dev": true, + "peer": true, + "dependencies": { + "@babel/highlight": "^7.24.7", + "picocolors": "^1.0.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/compat-data": { + "version": "7.25.0", + "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.25.0.tgz", + "integrity": "sha512-P4fwKI2mjEb3ZU5cnMJzvRsRKGBUcs8jvxIoRmr6ufAY9Xk2Bz7JubRTTivkw55c7WQJfTECeqYVa+HZ0FzREg==", + "dev": true, + "peer": true, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/core": { + "version": "7.24.9", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.24.9.tgz", + "integrity": "sha512-5e3FI4Q3M3Pbr21+5xJwCv6ZT6KmGkI0vw3Tozy5ODAQFTIWe37iT8Cr7Ice2Ntb+M3iSKCEWMB1MBgKrW3whg==", + "dev": true, + "peer": true, + "dependencies": { + "@ampproject/remapping": "^2.2.0", + "@babel/code-frame": "^7.24.7", + "@babel/generator": "^7.24.9", + "@babel/helper-compilation-targets": "^7.24.8", + "@babel/helper-module-transforms": "^7.24.9", + "@babel/helpers": "^7.24.8", + "@babel/parser": "^7.24.8", + "@babel/template": "^7.24.7", + "@babel/traverse": "^7.24.8", + "@babel/types": "^7.24.9", + "convert-source-map": "^2.0.0", + "debug": "^4.1.0", + "gensync": "^1.0.0-beta.2", + "json5": "^2.2.3", + "semver": "^6.3.1" + }, + "engines": { + "node": ">=6.9.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/babel" + } + }, + "node_modules/@babel/generator": { + "version": "7.25.0", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.25.0.tgz", + "integrity": "sha512-3LEEcj3PVW8pW2R1SR1M89g/qrYk/m/mB/tLqn7dn4sbBUQyTqnlod+II2U4dqiGtUmkcnAmkMDralTFZttRiw==", + "dev": true, + "peer": true, + "dependencies": { + "@babel/types": "^7.25.0", + "@jridgewell/gen-mapping": "^0.3.5", + "@jridgewell/trace-mapping": "^0.3.25", + "jsesc": "^2.5.1" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-compilation-targets": { + "version": "7.24.8", + "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.24.8.tgz", + "integrity": "sha512-oU+UoqCHdp+nWVDkpldqIQL/i/bvAv53tRqLG/s+cOXxe66zOYLU7ar/Xs3LdmBihrUMEUhwu6dMZwbNOYDwvw==", + "dev": true, + "peer": true, + "dependencies": { + "@babel/compat-data": "^7.24.8", + "@babel/helper-validator-option": "^7.24.8", + "browserslist": "^4.23.1", + "lru-cache": "^5.1.1", + "semver": "^6.3.1" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-module-imports": { + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.24.7.tgz", + "integrity": "sha512-8AyH3C+74cgCVVXow/myrynrAGv+nTVg5vKu2nZph9x7RcRwzmh0VFallJuFTZ9mx6u4eSdXZfcOzSqTUm0HCA==", + "dev": true, + "peer": true, + "dependencies": { + "@babel/traverse": "^7.24.7", + "@babel/types": "^7.24.7" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-module-transforms": { + "version": "7.25.0", + "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.25.0.tgz", + "integrity": "sha512-bIkOa2ZJYn7FHnepzr5iX9Kmz8FjIz4UKzJ9zhX3dnYuVW0xul9RuR3skBfoLu+FPTQw90EHW9rJsSZhyLQ3fQ==", + "dev": true, + "peer": true, + "dependencies": { + "@babel/helper-module-imports": "^7.24.7", + "@babel/helper-simple-access": "^7.24.7", + "@babel/helper-validator-identifier": "^7.24.7", + "@babel/traverse": "^7.25.0" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" + } + }, + "node_modules/@babel/helper-plugin-utils": { + "version": "7.24.8", + "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.24.8.tgz", + "integrity": "sha512-FFWx5142D8h2Mgr/iPVGH5G7w6jDn4jUSpZTyDnQO0Yn7Ks2Kuz6Pci8H6MPCoUJegd/UZQ3tAvfLCxQSnWWwg==", + "dev": true, + "peer": true, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-simple-access": { + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.24.7.tgz", + "integrity": "sha512-zBAIvbCMh5Ts+b86r/CjU+4XGYIs+R1j951gxI3KmmxBMhCg4oQMsv6ZXQ64XOm/cvzfU1FmoCyt6+owc5QMYg==", + "dev": true, + "peer": true, + "dependencies": { + "@babel/traverse": "^7.24.7", + "@babel/types": "^7.24.7" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-string-parser": { + "version": "7.24.8", + "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.24.8.tgz", + "integrity": "sha512-pO9KhhRcuUyGnJWwyEgnRJTSIZHiT+vMD0kPeD+so0l7mxkMT19g3pjY9GTnHySck/hDzq+dtW/4VgnMkippsQ==", + "dev": true, + "peer": true, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-validator-identifier": { + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.24.7.tgz", + "integrity": "sha512-rR+PBcQ1SMQDDyF6X0wxtG8QyLCgUB0eRAGguqRLfkCA87l7yAP7ehq8SNj96OOGTO8OBV70KhuFYcIkHXOg0w==", + "dev": true, + "peer": true, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-validator-option": { + "version": "7.24.8", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.24.8.tgz", + "integrity": "sha512-xb8t9tD1MHLungh/AIoWYN+gVHaB9kwlu8gffXGSt3FFEIT7RjS+xWbc2vUD1UTZdIpKj/ab3rdqJ7ufngyi2Q==", + "dev": true, + "peer": true, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helpers": { + "version": "7.25.0", + "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.25.0.tgz", + "integrity": "sha512-MjgLZ42aCm0oGjJj8CtSM3DB8NOOf8h2l7DCTePJs29u+v7yO/RBX9nShlKMgFnRks/Q4tBAe7Hxnov9VkGwLw==", + "dev": true, + "peer": true, + "dependencies": { + "@babel/template": "^7.25.0", + "@babel/types": "^7.25.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/highlight": { + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.24.7.tgz", + "integrity": "sha512-EStJpq4OuY8xYfhGVXngigBJRWxftKX9ksiGDnmlY3o7B/V7KIAc9X4oiK87uPJSc/vs5L869bem5fhZa8caZw==", + "dev": true, + "peer": true, + "dependencies": { + "@babel/helper-validator-identifier": "^7.24.7", + "chalk": "^2.4.2", + "js-tokens": "^4.0.0", + "picocolors": "^1.0.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/highlight/node_modules/ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "peer": true, + "dependencies": { + "color-convert": "^1.9.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/@babel/highlight/node_modules/chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "peer": true, + "dependencies": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/@babel/highlight/node_modules/color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "dev": true, + "peer": true, + "dependencies": { + "color-name": "1.1.3" + } + }, + "node_modules/@babel/highlight/node_modules/color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", + "dev": true, + "peer": true + }, + "node_modules/@babel/highlight/node_modules/escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", + "dev": true, + "peer": true, + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/@babel/highlight/node_modules/has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", + "dev": true, + "peer": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/@babel/highlight/node_modules/supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "peer": true, + "dependencies": { + "has-flag": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/@babel/parser": { + "version": "7.25.0", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.25.0.tgz", + "integrity": "sha512-CzdIU9jdP0dg7HdyB+bHvDJGagUv+qtzZt5rYCWwW6tITNqV9odjp6Qu41gkG0ca5UfdDUWrKkiAnHHdGRnOrA==", + "dev": true, + "peer": true, + "bin": { + "parser": "bin/babel-parser.js" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@babel/plugin-syntax-async-generators": { + "version": "7.8.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-async-generators/-/plugin-syntax-async-generators-7.8.4.tgz", + "integrity": "sha512-tycmZxkGfZaxhMRbXlPXuVFpdWlXpir2W4AMhSJgRKzk/eDlIXOhb2LHWoLpDF7TEHylV5zNhykX6KAgHJmTNw==", + "dev": true, + "peer": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.8.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-bigint": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-bigint/-/plugin-syntax-bigint-7.8.3.tgz", + "integrity": "sha512-wnTnFlG+YxQm3vDxpGE57Pj0srRU4sHE/mDkt1qv2YJJSeUAec2ma4WLUnUPeKjyrfntVwe/N6dCXpU+zL3Npg==", + "dev": true, + "peer": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.8.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-class-properties": { + "version": "7.12.13", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-class-properties/-/plugin-syntax-class-properties-7.12.13.tgz", + "integrity": "sha512-fm4idjKla0YahUNgFNLCB0qySdsoPiZP3iQE3rky0mBUtMZ23yDJ9SJdg6dXTSDnulOVqiF3Hgr9nbXvXTQZYA==", + "dev": true, + "peer": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.12.13" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-import-meta": { + "version": "7.10.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-import-meta/-/plugin-syntax-import-meta-7.10.4.tgz", + "integrity": "sha512-Yqfm+XDx0+Prh3VSeEQCPU81yC+JWZ2pDPFSS4ZdpfZhp4MkFMaDC1UqseovEKwSUpnIL7+vK+Clp7bfh0iD7g==", + "dev": true, + "peer": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.10.4" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-json-strings": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-json-strings/-/plugin-syntax-json-strings-7.8.3.tgz", + "integrity": "sha512-lY6kdGpWHvjoe2vk4WrAapEuBR69EMxZl+RoGRhrFGNYVK8mOPAW8VfbT/ZgrFbXlDNiiaxQnAtgVCZ6jv30EA==", + "dev": true, + "peer": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.8.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-jsx": { + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-jsx/-/plugin-syntax-jsx-7.24.7.tgz", + "integrity": "sha512-6ddciUPe/mpMnOKv/U+RSd2vvVy+Yw/JfBB0ZHYjEZt9NLHmCUylNYlsbqCCS1Bffjlb0fCwC9Vqz+sBz6PsiQ==", + "dev": true, + "peer": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.24.7" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-logical-assignment-operators": { + "version": "7.10.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-logical-assignment-operators/-/plugin-syntax-logical-assignment-operators-7.10.4.tgz", + "integrity": "sha512-d8waShlpFDinQ5MtvGU9xDAOzKH47+FFoney2baFIoMr952hKOLp1HR7VszoZvOsV/4+RRszNY7D17ba0te0ig==", + "dev": true, + "peer": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.10.4" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-nullish-coalescing-operator": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-nullish-coalescing-operator/-/plugin-syntax-nullish-coalescing-operator-7.8.3.tgz", + "integrity": "sha512-aSff4zPII1u2QD7y+F8oDsz19ew4IGEJg9SVW+bqwpwtfFleiQDMdzA/R+UlWDzfnHFCxxleFT0PMIrR36XLNQ==", + "dev": true, + "peer": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.8.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-numeric-separator": { + "version": "7.10.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-numeric-separator/-/plugin-syntax-numeric-separator-7.10.4.tgz", + "integrity": "sha512-9H6YdfkcK/uOnY/K7/aA2xpzaAgkQn37yzWUMRK7OaPOqOpGS1+n0H5hxT9AUw9EsSjPW8SVyMJwYRtWs3X3ug==", + "dev": true, + "peer": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.10.4" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-object-rest-spread": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-object-rest-spread/-/plugin-syntax-object-rest-spread-7.8.3.tgz", + "integrity": "sha512-XoqMijGZb9y3y2XskN+P1wUGiVwWZ5JmoDRwx5+3GmEplNyVM2s2Dg8ILFQm8rWM48orGy5YpI5Bl8U1y7ydlA==", + "dev": true, + "peer": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.8.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-optional-catch-binding": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-optional-catch-binding/-/plugin-syntax-optional-catch-binding-7.8.3.tgz", + "integrity": "sha512-6VPD0Pc1lpTqw0aKoeRTMiB+kWhAoT24PA+ksWSBrFtl5SIRVpZlwN3NNPQjehA2E/91FV3RjLWoVTglWcSV3Q==", + "dev": true, + "peer": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.8.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-optional-chaining": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-optional-chaining/-/plugin-syntax-optional-chaining-7.8.3.tgz", + "integrity": "sha512-KoK9ErH1MBlCPxV0VANkXW2/dw4vlbGDrFgz8bmUsBGYkFRcbRwMh6cIJubdPrkxRwuGdtCk0v/wPTKbQgBjkg==", + "dev": true, + "peer": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.8.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-top-level-await": { + "version": "7.14.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-top-level-await/-/plugin-syntax-top-level-await-7.14.5.tgz", + "integrity": "sha512-hx++upLv5U1rgYfwe1xBQUhRmU41NEvpUvrp8jkrSCdvGSnM5/qdRMtylJ6PG5OFkBaHkbTAKTnd3/YyESRHFw==", + "dev": true, + "peer": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.14.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-typescript": { + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-typescript/-/plugin-syntax-typescript-7.24.7.tgz", + "integrity": "sha512-c/+fVeJBB0FeKsFvwytYiUD+LBvhHjGSI0g446PRGdSVGZLRNArBUno2PETbAly3tpiNAQR5XaZ+JslxkotsbA==", + "dev": true, + "peer": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.24.7" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/template": { + "version": "7.25.0", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.25.0.tgz", + "integrity": "sha512-aOOgh1/5XzKvg1jvVz7AVrx2piJ2XBi227DHmbY6y+bM9H2FlN+IfecYu4Xl0cNiiVejlsCri89LUsbj8vJD9Q==", + "dev": true, + "peer": true, + "dependencies": { + "@babel/code-frame": "^7.24.7", + "@babel/parser": "^7.25.0", + "@babel/types": "^7.25.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/traverse": { + "version": "7.25.0", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.25.0.tgz", + "integrity": "sha512-ubALThHQy4GCf6mbb+5ZRNmLLCI7bJ3f8Q6LHBSRlSKSWj5a7dSUzJBLv3VuIhFrFPgjF4IzPF567YG/HSCdZA==", + "dev": true, + "peer": true, + "dependencies": { + "@babel/code-frame": "^7.24.7", + "@babel/generator": "^7.25.0", + "@babel/parser": "^7.25.0", + "@babel/template": "^7.25.0", + "@babel/types": "^7.25.0", + "debug": "^4.3.1", + "globals": "^11.1.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/types": { + "version": "7.25.0", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.25.0.tgz", + "integrity": "sha512-LcnxQSsd9aXOIgmmSpvZ/1yo46ra2ESYyqLcryaBZOghxy5qqOBjvCWP5JfkI8yl9rlxRgdLTTMCQQRcN2hdCg==", + "dev": true, + "peer": true, + "dependencies": { + "@babel/helper-string-parser": "^7.24.8", + "@babel/helper-validator-identifier": "^7.24.7", + "to-fast-properties": "^2.0.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@bcoe/v8-coverage": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz", + "integrity": "sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==", + "dev": true, + "peer": true + }, "node_modules/@continuedev/config-types": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/@continuedev/config-types/-/config-types-1.0.5.tgz", @@ -148,9 +708,9 @@ } }, "node_modules/@continuedev/fetch": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/@continuedev/fetch/-/fetch-1.0.1.tgz", - "integrity": "sha512-vUFyP48WxdeAoVJUmN0nzk5FCiGfMWiW5SZEvJoSmzJMigHEfbsW/2kRCI9hu9LFRw4drN+Wo3fktG7Lb1MabA==", + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/@continuedev/fetch/-/fetch-1.0.3.tgz", + "integrity": "sha512-cGNCUEVnDfC+3O/n1PV+oYhS5yZRLR1Q7Njg929kVbA8kRHe5a3VdKINfFzWdKprOU4wipsXSliciZHCpbJJ9g==", "dependencies": { "@continuedev/config-types": "^1.0.5", "follow-redirects": "^1.15.6", @@ -159,6 +719,491 @@ "node-fetch": "^3.3.2" } }, + "node_modules/@cspotcode/source-map-support": { + "version": "0.8.1", + "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz", + "integrity": "sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==", + "dev": true, + "dependencies": { + "@jridgewell/trace-mapping": "0.3.9" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/@cspotcode/source-map-support/node_modules/@jridgewell/trace-mapping": { + "version": "0.3.9", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz", + "integrity": "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==", + "dev": true, + "dependencies": { + "@jridgewell/resolve-uri": "^3.0.3", + "@jridgewell/sourcemap-codec": "^1.4.10" + } + }, + "node_modules/@istanbuljs/load-nyc-config": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@istanbuljs/load-nyc-config/-/load-nyc-config-1.1.0.tgz", + "integrity": "sha512-VjeHSlIzpv/NyD3N0YuHfXOPDIixcA1q2ZV98wsMqcYlPmv2n3Yb2lYP9XMElnaFVXg5A7YLTeLu6V84uQDjmQ==", + "dev": true, + "peer": true, + "dependencies": { + "camelcase": "^5.3.1", + "find-up": "^4.1.0", + "get-package-type": "^0.1.0", + "js-yaml": "^3.13.1", + "resolve-from": "^5.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/@istanbuljs/schema": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/@istanbuljs/schema/-/schema-0.1.3.tgz", + "integrity": "sha512-ZXRY4jNvVgSVQ8DL3LTcakaAtXwTVUxE81hslsyD2AtoXW/wVob10HkOJ1X/pAlcI7D+2YoZKg5do8G/w6RYgA==", + "dev": true, + "peer": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/@jest/console": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/console/-/console-29.7.0.tgz", + "integrity": "sha512-5Ni4CU7XHQi32IJ398EEP4RrB8eV09sXP2ROqD4bksHrnTree52PsxvX8tpL8LvTZ3pFzXyPbNQReSN41CAhOg==", + "dev": true, + "peer": true, + "dependencies": { + "@jest/types": "^29.6.3", + "@types/node": "*", + "chalk": "^4.0.0", + "jest-message-util": "^29.7.0", + "jest-util": "^29.7.0", + "slash": "^3.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@jest/core": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/core/-/core-29.7.0.tgz", + "integrity": "sha512-n7aeXWKMnGtDA48y8TLWJPJmLmmZ642Ceo78cYWEpiD7FzDgmNDV/GCVRorPABdXLJZ/9wzzgZAlHjXjxDHGsg==", + "dev": true, + "peer": true, + "dependencies": { + "@jest/console": "^29.7.0", + "@jest/reporters": "^29.7.0", + "@jest/test-result": "^29.7.0", + "@jest/transform": "^29.7.0", + "@jest/types": "^29.6.3", + "@types/node": "*", + "ansi-escapes": "^4.2.1", + "chalk": "^4.0.0", + "ci-info": "^3.2.0", + "exit": "^0.1.2", + "graceful-fs": "^4.2.9", + "jest-changed-files": "^29.7.0", + "jest-config": "^29.7.0", + "jest-haste-map": "^29.7.0", + "jest-message-util": "^29.7.0", + "jest-regex-util": "^29.6.3", + "jest-resolve": "^29.7.0", + "jest-resolve-dependencies": "^29.7.0", + "jest-runner": "^29.7.0", + "jest-runtime": "^29.7.0", + "jest-snapshot": "^29.7.0", + "jest-util": "^29.7.0", + "jest-validate": "^29.7.0", + "jest-watcher": "^29.7.0", + "micromatch": "^4.0.4", + "pretty-format": "^29.7.0", + "slash": "^3.0.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + }, + "peerDependencies": { + "node-notifier": "^8.0.1 || ^9.0.0 || ^10.0.0" + }, + "peerDependenciesMeta": { + "node-notifier": { + "optional": true + } + } + }, + "node_modules/@jest/environment": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/environment/-/environment-29.7.0.tgz", + "integrity": "sha512-aQIfHDq33ExsN4jP1NWGXhxgQ/wixs60gDiKO+XVMd8Mn0NWPWgc34ZQDTb2jKaUWQ7MuwoitXAsN2XVXNMpAw==", + "dev": true, + "peer": true, + "dependencies": { + "@jest/fake-timers": "^29.7.0", + "@jest/types": "^29.6.3", + "@types/node": "*", + "jest-mock": "^29.7.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@jest/expect": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/expect/-/expect-29.7.0.tgz", + "integrity": "sha512-8uMeAMycttpva3P1lBHB8VciS9V0XAr3GymPpipdyQXbBcuhkLQOSe8E/p92RyAdToS6ZD1tFkX+CkhoECE0dQ==", + "dev": true, + "peer": true, + "dependencies": { + "expect": "^29.7.0", + "jest-snapshot": "^29.7.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@jest/expect-utils": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/expect-utils/-/expect-utils-29.7.0.tgz", + "integrity": "sha512-GlsNBWiFQFCVi9QVSx7f5AgMeLxe9YCCs5PuP2O2LdjDAA8Jh9eX7lA1Jq/xdXw3Wb3hyvlFNfZIfcRetSzYcA==", + "dev": true, + "peer": true, + "dependencies": { + "jest-get-type": "^29.6.3" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@jest/fake-timers": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/fake-timers/-/fake-timers-29.7.0.tgz", + "integrity": "sha512-q4DH1Ha4TTFPdxLsqDXK1d3+ioSL7yL5oCMJZgDYm6i+6CygW5E5xVr/D1HdsGxjt1ZWSfUAs9OxSB/BNelWrQ==", + "dev": true, + "peer": true, + "dependencies": { + "@jest/types": "^29.6.3", + "@sinonjs/fake-timers": "^10.0.2", + "@types/node": "*", + "jest-message-util": "^29.7.0", + "jest-mock": "^29.7.0", + "jest-util": "^29.7.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@jest/globals": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/globals/-/globals-29.7.0.tgz", + "integrity": "sha512-mpiz3dutLbkW2MNFubUGUEVLkTGiqW6yLVTA+JbP6fI6J5iL9Y0Nlg8k95pcF8ctKwCS7WVxteBs29hhfAotzQ==", + "dev": true, + "peer": true, + "dependencies": { + "@jest/environment": "^29.7.0", + "@jest/expect": "^29.7.0", + "@jest/types": "^29.6.3", + "jest-mock": "^29.7.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@jest/reporters": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/reporters/-/reporters-29.7.0.tgz", + "integrity": "sha512-DApq0KJbJOEzAFYjHADNNxAE3KbhxQB1y5Kplb5Waqw6zVbuWatSnMjE5gs8FUgEPmNsnZA3NCWl9NG0ia04Pg==", + "dev": true, + "peer": true, + "dependencies": { + "@bcoe/v8-coverage": "^0.2.3", + "@jest/console": "^29.7.0", + "@jest/test-result": "^29.7.0", + "@jest/transform": "^29.7.0", + "@jest/types": "^29.6.3", + "@jridgewell/trace-mapping": "^0.3.18", + "@types/node": "*", + "chalk": "^4.0.0", + "collect-v8-coverage": "^1.0.0", + "exit": "^0.1.2", + "glob": "^7.1.3", + "graceful-fs": "^4.2.9", + "istanbul-lib-coverage": "^3.0.0", + "istanbul-lib-instrument": "^6.0.0", + "istanbul-lib-report": "^3.0.0", + "istanbul-lib-source-maps": "^4.0.0", + "istanbul-reports": "^3.1.3", + "jest-message-util": "^29.7.0", + "jest-util": "^29.7.0", + "jest-worker": "^29.7.0", + "slash": "^3.0.0", + "string-length": "^4.0.1", + "strip-ansi": "^6.0.0", + "v8-to-istanbul": "^9.0.1" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + }, + "peerDependencies": { + "node-notifier": "^8.0.1 || ^9.0.0 || ^10.0.0" + }, + "peerDependenciesMeta": { + "node-notifier": { + "optional": true + } + } + }, + "node_modules/@jest/schemas": { + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/@jest/schemas/-/schemas-29.6.3.tgz", + "integrity": "sha512-mo5j5X+jIZmJQveBKeS/clAueipV7KgiX1vMgCxam1RNYiqE1w62n0/tJJnHtjW8ZHcQco5gY85jA3mi0L+nSA==", + "dev": true, + "dependencies": { + "@sinclair/typebox": "^0.27.8" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@jest/source-map": { + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/@jest/source-map/-/source-map-29.6.3.tgz", + "integrity": "sha512-MHjT95QuipcPrpLM+8JMSzFx6eHp5Bm+4XeFDJlwsvVBjmKNiIAvasGK2fxz2WbGRlnvqehFbh07MMa7n3YJnw==", + "dev": true, + "peer": true, + "dependencies": { + "@jridgewell/trace-mapping": "^0.3.18", + "callsites": "^3.0.0", + "graceful-fs": "^4.2.9" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@jest/test-result": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/test-result/-/test-result-29.7.0.tgz", + "integrity": "sha512-Fdx+tv6x1zlkJPcWXmMDAG2HBnaR9XPSd5aDWQVsfrZmLVT3lU1cwyxLgRmXR9yrq4NBoEm9BMsfgFzTQAbJYA==", + "dev": true, + "peer": true, + "dependencies": { + "@jest/console": "^29.7.0", + "@jest/types": "^29.6.3", + "@types/istanbul-lib-coverage": "^2.0.0", + "collect-v8-coverage": "^1.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@jest/test-sequencer": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/test-sequencer/-/test-sequencer-29.7.0.tgz", + "integrity": "sha512-GQwJ5WZVrKnOJuiYiAF52UNUJXgTZx1NHjFSEB0qEMmSZKAkdMoIzw/Cj6x6NF4AvV23AUqDpFzQkN/eYCYTxw==", + "dev": true, + "peer": true, + "dependencies": { + "@jest/test-result": "^29.7.0", + "graceful-fs": "^4.2.9", + "jest-haste-map": "^29.7.0", + "slash": "^3.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@jest/transform": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/transform/-/transform-29.7.0.tgz", + "integrity": "sha512-ok/BTPFzFKVMwO5eOHRrvnBVHdRy9IrsrW1GpMaQ9MCnilNLXQKmAX8s1YXDFaai9xJpac2ySzV0YeRRECr2Vw==", + "dev": true, + "peer": true, + "dependencies": { + "@babel/core": "^7.11.6", + "@jest/types": "^29.6.3", + "@jridgewell/trace-mapping": "^0.3.18", + "babel-plugin-istanbul": "^6.1.1", + "chalk": "^4.0.0", + "convert-source-map": "^2.0.0", + "fast-json-stable-stringify": "^2.1.0", + "graceful-fs": "^4.2.9", + "jest-haste-map": "^29.7.0", + "jest-regex-util": "^29.6.3", + "jest-util": "^29.7.0", + "micromatch": "^4.0.4", + "pirates": "^4.0.4", + "slash": "^3.0.0", + "write-file-atomic": "^4.0.2" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@jest/types": { + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/@jest/types/-/types-29.6.3.tgz", + "integrity": "sha512-u3UPsIilWKOM3F9CXtrG8LEJmNxwoCQC/XVj4IKYXvvpx7QIi/Kg1LI5uDmDpKlac62NUtX7eLjRh+jVZcLOzw==", + "dev": true, + "dependencies": { + "@jest/schemas": "^29.6.3", + "@types/istanbul-lib-coverage": "^2.0.0", + "@types/istanbul-reports": "^3.0.0", + "@types/node": "*", + "@types/yargs": "^17.0.8", + "chalk": "^4.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@jridgewell/gen-mapping": { + "version": "0.3.5", + "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.5.tgz", + "integrity": "sha512-IzL8ZoEDIBRWEzlCcRhOaCupYyN5gdIK+Q6fbFdPDg6HqX6jpkItn7DFIpW9LQzXG6Df9sA7+OKnq0qlz/GaQg==", + "dev": true, + "peer": true, + "dependencies": { + "@jridgewell/set-array": "^1.2.1", + "@jridgewell/sourcemap-codec": "^1.4.10", + "@jridgewell/trace-mapping": "^0.3.24" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/resolve-uri": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz", + "integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==", + "dev": true, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/set-array": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.2.1.tgz", + "integrity": "sha512-R8gLRTZeyp03ymzP/6Lil/28tGeGEzhx1q2k703KGWRAI1VdvPIXdG70VJc2pAMw3NA6JKL5hhFu1sJX0Mnn/A==", + "dev": true, + "peer": true, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/sourcemap-codec": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.0.tgz", + "integrity": "sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ==", + "dev": true + }, + "node_modules/@jridgewell/trace-mapping": { + "version": "0.3.25", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.25.tgz", + "integrity": "sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ==", + "dev": true, + "peer": true, + "dependencies": { + "@jridgewell/resolve-uri": "^3.1.0", + "@jridgewell/sourcemap-codec": "^1.4.14" + } + }, + "node_modules/@sinclair/typebox": { + "version": "0.27.8", + "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.27.8.tgz", + "integrity": "sha512-+Fj43pSMwJs4KRrH/938Uf+uAELIgVBmQzg/q1YG10djyfA3TnrU8N8XzqCh/okZdszqBQTZf96idMfE5lnwTA==", + "dev": true + }, + "node_modules/@sinonjs/commons": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-3.0.1.tgz", + "integrity": "sha512-K3mCHKQ9sVh8o1C9cxkwxaOmXoAMlDxC1mYyHrjqOWEcBjYr76t96zL2zlj5dUGZ3HSw240X1qgH3Mjf1yJWpQ==", + "dev": true, + "peer": true, + "dependencies": { + "type-detect": "4.0.8" + } + }, + "node_modules/@sinonjs/fake-timers": { + "version": "10.3.0", + "resolved": "https://registry.npmjs.org/@sinonjs/fake-timers/-/fake-timers-10.3.0.tgz", + "integrity": "sha512-V4BG07kuYSUkTCSBHG8G8TNhM+F19jXFWnQtzj+we8DrkpSBCee9Z3Ms8yiGer/dlmhe35/Xdgyo3/0rQKg7YA==", + "dev": true, + "peer": true, + "dependencies": { + "@sinonjs/commons": "^3.0.0" + } + }, + "node_modules/@tsconfig/node10": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.11.tgz", + "integrity": "sha512-DcRjDCujK/kCk/cUe8Xz8ZSpm8mS3mNNpta+jGCA6USEDfktlNvm1+IuZ9eTcDbNk41BHwpHHeW+N1lKCz4zOw==", + "dev": true + }, + "node_modules/@tsconfig/node12": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.11.tgz", + "integrity": "sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==", + "dev": true + }, + "node_modules/@tsconfig/node14": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.3.tgz", + "integrity": "sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==", + "dev": true + }, + "node_modules/@tsconfig/node16": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.4.tgz", + "integrity": "sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA==", + "dev": true + }, + "node_modules/@types/babel__core": { + "version": "7.20.5", + "resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.20.5.tgz", + "integrity": "sha512-qoQprZvz5wQFJwMDqeseRXWv3rqMvhgpbXFfVyWhbx9X47POIA6i/+dXefEmZKoAgOaTdaIgNSMqMIU61yRyzA==", + "dev": true, + "peer": true, + "dependencies": { + "@babel/parser": "^7.20.7", + "@babel/types": "^7.20.7", + "@types/babel__generator": "*", + "@types/babel__template": "*", + "@types/babel__traverse": "*" + } + }, + "node_modules/@types/babel__generator": { + "version": "7.6.8", + "resolved": "https://registry.npmjs.org/@types/babel__generator/-/babel__generator-7.6.8.tgz", + "integrity": "sha512-ASsj+tpEDsEiFr1arWrlN6V3mdfjRMZt6LtK/Vp/kreFLnr5QH5+DhvD5nINYZXzwJvXeGq+05iUXcAzVrqWtw==", + "dev": true, + "peer": true, + "dependencies": { + "@babel/types": "^7.0.0" + } + }, + "node_modules/@types/babel__template": { + "version": "7.4.4", + "resolved": "https://registry.npmjs.org/@types/babel__template/-/babel__template-7.4.4.tgz", + "integrity": "sha512-h/NUaSyG5EyxBIp8YRxo4RMe2/qQgvyowRwVMzhYhBCONbW8PUsg4lkFMrhgZhUe5z3L3MiLDuvyJ/CaPa2A8A==", + "dev": true, + "peer": true, + "dependencies": { + "@babel/parser": "^7.1.0", + "@babel/types": "^7.0.0" + } + }, + "node_modules/@types/babel__traverse": { + "version": "7.20.6", + "resolved": "https://registry.npmjs.org/@types/babel__traverse/-/babel__traverse-7.20.6.tgz", + "integrity": "sha512-r1bzfrm0tomOI8g1SzvCaQHo6Lcv6zu0EA+W2kHrt8dyrHQxGzBBL4kdkzIS+jBMV+EYcMAEAqXqYaLJq5rOZg==", + "dev": true, + "peer": true, + "dependencies": { + "@babel/types": "^7.20.7" + } + }, "node_modules/@types/follow-redirects": { "version": "1.14.4", "resolved": "https://registry.npmjs.org/@types/follow-redirects/-/follow-redirects-1.14.4.tgz", @@ -168,6 +1213,40 @@ "@types/node": "*" } }, + "node_modules/@types/graceful-fs": { + "version": "4.1.9", + "resolved": "https://registry.npmjs.org/@types/graceful-fs/-/graceful-fs-4.1.9.tgz", + "integrity": "sha512-olP3sd1qOEe5dXTSaFvQG+02VdRXcdytWLAZsAq1PecU8uqQAhkrnbli7DagjtXKW/Bl7YJbUsa8MPcuc8LHEQ==", + "dev": true, + "peer": true, + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@types/istanbul-lib-coverage": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.6.tgz", + "integrity": "sha512-2QF/t/auWm0lsy8XtKVPG19v3sSOQlJe/YHZgfjb/KBBHOGSV+J2q/S671rcq9uTBrLAXmZpqJiaQbMT+zNU1w==", + "dev": true + }, + "node_modules/@types/istanbul-lib-report": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/@types/istanbul-lib-report/-/istanbul-lib-report-3.0.3.tgz", + "integrity": "sha512-NQn7AHQnk/RSLOxrBbGyJM/aVQ+pjj5HCgasFxc0K/KhoATfQ/47AyUl15I2yBUpihjmas+a+VJBOqecrFH+uA==", + "dev": true, + "dependencies": { + "@types/istanbul-lib-coverage": "*" + } + }, + "node_modules/@types/istanbul-reports": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/@types/istanbul-reports/-/istanbul-reports-3.0.4.tgz", + "integrity": "sha512-pk2B1NWalF9toCRu6gjBzR69syFjP4Od8WRAX+0mmf9lAjCRicLOWc+ZrxZHx/0XRjotgkF9t6iaMJ+aXcOdZQ==", + "dev": true, + "dependencies": { + "@types/istanbul-lib-report": "*" + } + }, "node_modules/@types/node": { "version": "18.19.39", "resolved": "https://registry.npmjs.org/@types/node/-/node-18.19.39.tgz", @@ -185,6 +1264,28 @@ "form-data": "^4.0.0" } }, + "node_modules/@types/stack-utils": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/@types/stack-utils/-/stack-utils-2.0.3.tgz", + "integrity": "sha512-9aEbYZ3TbYMznPdcdr3SmIrLXwC/AKZXQeCf9Pgao5CKb8CyHuEX5jzWPTkvregvhRJHcpRO6BFoGW9ycaOkYw==", + "dev": true, + "peer": true + }, + "node_modules/@types/yargs": { + "version": "17.0.32", + "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-17.0.32.tgz", + "integrity": "sha512-xQ67Yc/laOG5uMfX/093MRlGGCIBzZMarVa+gfNKJxWAIgykYpVGkBdbqEzGDDfCrVUj6Hiff4mTZ5BA6TmAog==", + "dev": true, + "dependencies": { + "@types/yargs-parser": "*" + } + }, + "node_modules/@types/yargs-parser": { + "version": "21.0.3", + "resolved": "https://registry.npmjs.org/@types/yargs-parser/-/yargs-parser-21.0.3.tgz", + "integrity": "sha512-I4q9QU9MQv4oEOz4tAHJtNz1cwuLxn2F3xcc2iV5WdqLPpUnj30aUuxt1mAxYTG+oe8CZMV/+6rU4S4gRDzqtQ==", + "dev": true + }, "node_modules/abort-controller": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/abort-controller/-/abort-controller-3.0.0.tgz", @@ -196,6 +1297,30 @@ "node": ">=6.5" } }, + "node_modules/acorn": { + "version": "8.12.1", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.12.1.tgz", + "integrity": "sha512-tcpGyI9zbizT9JbV6oYE477V6mTlXvvi0T0G3SNIYE2apm/G5huBa1+K89VGeovbg+jycCrfhl3ADxErOuO6Jg==", + "dev": true, + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/acorn-walk": { + "version": "8.3.3", + "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.3.3.tgz", + "integrity": "sha512-MxXdReSRhGO7VlFe1bRG/oI7/mdLV9B9JJT0N8vZOhF7gFRR5l3M8W9G8JxmKV+JC5mGqJ0QvqfSOLsCPa4nUw==", + "dev": true, + "dependencies": { + "acorn": "^8.11.0" + }, + "engines": { + "node": ">=0.4.0" + } + }, "node_modules/agent-base": { "version": "7.1.1", "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-7.1.1.tgz", @@ -218,11 +1343,432 @@ "node": ">= 8.0.0" } }, + "node_modules/ansi-escapes": { + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-4.3.2.tgz", + "integrity": "sha512-gKXj5ALrKWQLsYG9jlTRmR/xKluxHV+Z9QEwNIgCfM1/uwPMCuzVVnh5mwTd+OuBZcwSIMbqssNWRm1lE51QaQ==", + "dev": true, + "peer": true, + "dependencies": { + "type-fest": "^0.21.3" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "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, + "peer": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/anymatch": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", + "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", + "dev": true, + "peer": true, + "dependencies": { + "normalize-path": "^3.0.0", + "picomatch": "^2.0.4" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/arg": { + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", + "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==", + "dev": true + }, + "node_modules/argparse": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", + "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", + "dev": true, + "peer": true, + "dependencies": { + "sprintf-js": "~1.0.2" + } + }, + "node_modules/async": { + "version": "3.2.5", + "resolved": "https://registry.npmjs.org/async/-/async-3.2.5.tgz", + "integrity": "sha512-baNZyqaaLhyLVKm/DlvdW051MSgO6b8eVfIezl9E5PqWxFgzLm/wQntEW4zOytVburDEr0JlALEpdOFwvErLsg==", + "dev": true + }, "node_modules/asynckit": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==" }, + "node_modules/babel-jest": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/babel-jest/-/babel-jest-29.7.0.tgz", + "integrity": "sha512-BrvGY3xZSwEcCzKvKsCi2GgHqDqsYkOP4/by5xCgIwGXQxIEh+8ew3gmrE1y7XRR6LHZIj6yLYnUi/mm2KXKBg==", + "dev": true, + "peer": true, + "dependencies": { + "@jest/transform": "^29.7.0", + "@types/babel__core": "^7.1.14", + "babel-plugin-istanbul": "^6.1.1", + "babel-preset-jest": "^29.6.3", + "chalk": "^4.0.0", + "graceful-fs": "^4.2.9", + "slash": "^3.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + }, + "peerDependencies": { + "@babel/core": "^7.8.0" + } + }, + "node_modules/babel-plugin-istanbul": { + "version": "6.1.1", + "resolved": "https://registry.npmjs.org/babel-plugin-istanbul/-/babel-plugin-istanbul-6.1.1.tgz", + "integrity": "sha512-Y1IQok9821cC9onCx5otgFfRm7Lm+I+wwxOx738M/WLPZ9Q42m4IG5W0FNX8WLL2gYMZo3JkuXIH2DOpWM+qwA==", + "dev": true, + "peer": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.0.0", + "@istanbuljs/load-nyc-config": "^1.0.0", + "@istanbuljs/schema": "^0.1.2", + "istanbul-lib-instrument": "^5.0.4", + "test-exclude": "^6.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/babel-plugin-istanbul/node_modules/istanbul-lib-instrument": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/istanbul-lib-instrument/-/istanbul-lib-instrument-5.2.1.tgz", + "integrity": "sha512-pzqtp31nLv/XFOzXGuvhCb8qhjmTVo5vjVk19XE4CRlSWz0KoeJ3bw9XsA7nOp9YBf4qHjwBxkDzKcME/J29Yg==", + "dev": true, + "peer": true, + "dependencies": { + "@babel/core": "^7.12.3", + "@babel/parser": "^7.14.7", + "@istanbuljs/schema": "^0.1.2", + "istanbul-lib-coverage": "^3.2.0", + "semver": "^6.3.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/babel-plugin-jest-hoist": { + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-29.6.3.tgz", + "integrity": "sha512-ESAc/RJvGTFEzRwOTT4+lNDk/GNHMkKbNzsvT0qKRfDyyYTskxB5rnU2njIDYVxXCBHHEI1c0YwHob3WaYujOg==", + "dev": true, + "peer": true, + "dependencies": { + "@babel/template": "^7.3.3", + "@babel/types": "^7.3.3", + "@types/babel__core": "^7.1.14", + "@types/babel__traverse": "^7.0.6" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/babel-preset-current-node-syntax": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/babel-preset-current-node-syntax/-/babel-preset-current-node-syntax-1.0.1.tgz", + "integrity": "sha512-M7LQ0bxarkxQoN+vz5aJPsLBn77n8QgTFmo8WK0/44auK2xlCXrYcUxHFxgU7qW5Yzw/CjmLRK2uJzaCd7LvqQ==", + "dev": true, + "peer": true, + "dependencies": { + "@babel/plugin-syntax-async-generators": "^7.8.4", + "@babel/plugin-syntax-bigint": "^7.8.3", + "@babel/plugin-syntax-class-properties": "^7.8.3", + "@babel/plugin-syntax-import-meta": "^7.8.3", + "@babel/plugin-syntax-json-strings": "^7.8.3", + "@babel/plugin-syntax-logical-assignment-operators": "^7.8.3", + "@babel/plugin-syntax-nullish-coalescing-operator": "^7.8.3", + "@babel/plugin-syntax-numeric-separator": "^7.8.3", + "@babel/plugin-syntax-object-rest-spread": "^7.8.3", + "@babel/plugin-syntax-optional-catch-binding": "^7.8.3", + "@babel/plugin-syntax-optional-chaining": "^7.8.3", + "@babel/plugin-syntax-top-level-await": "^7.8.3" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" + } + }, + "node_modules/babel-preset-jest": { + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/babel-preset-jest/-/babel-preset-jest-29.6.3.tgz", + "integrity": "sha512-0B3bhxR6snWXJZtR/RliHTDPRgn1sNHOR0yVtq/IiQFyuOVjFS+wuio/R4gSNkyYmKmJB4wGZv2NZanmKmTnNA==", + "dev": true, + "peer": true, + "dependencies": { + "babel-plugin-jest-hoist": "^29.6.3", + "babel-preset-current-node-syntax": "^1.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" + } + }, + "node_modules/balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "dev": true + }, + "node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/braces": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz", + "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", + "dev": true, + "peer": true, + "dependencies": { + "fill-range": "^7.1.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/browserslist": { + "version": "4.23.2", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.23.2.tgz", + "integrity": "sha512-qkqSyistMYdxAcw+CzbZwlBy8AGmS/eEWs+sEV5TnLRGDOL+C5M2EnH6tlZyg0YoAxGJAFKh61En9BR941GnHA==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/browserslist" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "peer": true, + "dependencies": { + "caniuse-lite": "^1.0.30001640", + "electron-to-chromium": "^1.4.820", + "node-releases": "^2.0.14", + "update-browserslist-db": "^1.1.0" + }, + "bin": { + "browserslist": "cli.js" + }, + "engines": { + "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7" + } + }, + "node_modules/bs-logger": { + "version": "0.2.6", + "resolved": "https://registry.npmjs.org/bs-logger/-/bs-logger-0.2.6.tgz", + "integrity": "sha512-pd8DCoxmbgc7hyPKOvxtqNcjYoOsABPQdcCUjGp3d42VR2CX1ORhk2A87oqqu5R1kk+76nsxZupkmyd+MVtCog==", + "dev": true, + "dependencies": { + "fast-json-stable-stringify": "2.x" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/bser": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/bser/-/bser-2.1.1.tgz", + "integrity": "sha512-gQxTNE/GAfIIrmHLUE3oJyp5FO6HRBfhjnw4/wMmA63ZGDJnWBmgY/lyQBpnDUkGmAhbSe39tx2d/iTOAfglwQ==", + "dev": true, + "peer": true, + "dependencies": { + "node-int64": "^0.4.0" + } + }, + "node_modules/buffer-from": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz", + "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==", + "dev": true, + "peer": true + }, + "node_modules/callsites": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", + "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", + "dev": true, + "peer": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/camelcase": { + "version": "5.3.1", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", + "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==", + "dev": true, + "peer": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/caniuse-lite": { + "version": "1.0.30001643", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001643.tgz", + "integrity": "sha512-ERgWGNleEilSrHM6iUz/zJNSQTP8Mr21wDWpdgvRwcTXGAq6jMtOUPP4dqFPTdKqZ2wKTdtB+uucZ3MRpAUSmg==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/caniuse-lite" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "peer": true + }, + "node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/char-regex": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/char-regex/-/char-regex-1.0.2.tgz", + "integrity": "sha512-kWWXztvZ5SBQV+eRgKFeh8q5sLuZY2+8WUIzlxWVTg+oGwY14qylx1KbKzHd8P6ZYkAg0xyIDU9JMHhyJMZ1jw==", + "dev": true, + "peer": true, + "engines": { + "node": ">=10" + } + }, + "node_modules/ci-info": { + "version": "3.9.0", + "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-3.9.0.tgz", + "integrity": "sha512-NIxF55hv4nSqQswkAeiOi1r83xy8JldOFDTWiug55KBu9Jnblncd2U6ViHmYgHf01TPZS77NJBhBMKdWj9HQMQ==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/sibiraj-s" + } + ], + "engines": { + "node": ">=8" + } + }, + "node_modules/cjs-module-lexer": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/cjs-module-lexer/-/cjs-module-lexer-1.3.1.tgz", + "integrity": "sha512-a3KdPAANPbNE4ZUv9h6LckSl9zLsYOP4MBmhIPkRaeyybt+r4UghLvq+xw/YwUcC1gqylCkL4rdVs3Lwupjm4Q==", + "dev": true, + "peer": true + }, + "node_modules/cliui": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz", + "integrity": "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==", + "dev": true, + "peer": true, + "dependencies": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.1", + "wrap-ansi": "^7.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/co": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz", + "integrity": "sha512-QVb0dM5HvG+uaxitm8wONl7jltx8dqhfU33DcqtOZcLSVIKSDDLDi7+0LbAKiyI8hD9u42m2YxXSkMGWThaecQ==", + "dev": true, + "peer": true, + "engines": { + "iojs": ">= 1.0.0", + "node": ">= 0.12.0" + } + }, + "node_modules/collect-v8-coverage": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/collect-v8-coverage/-/collect-v8-coverage-1.0.2.tgz", + "integrity": "sha512-lHl4d5/ONEbLlJvaJNtsF/Lz+WvB07u2ycqTYbdrq7UypDXailES4valYb2eWiJFxZlVmpGekfqoxQhzyFdT4Q==", + "dev": true, + "peer": true + }, + "node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, "node_modules/combined-stream": { "version": "1.0.8", "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", @@ -234,6 +1780,79 @@ "node": ">= 0.8" } }, + "node_modules/concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", + "dev": true + }, + "node_modules/convert-source-map": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-2.0.0.tgz", + "integrity": "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==", + "dev": true, + "peer": true + }, + "node_modules/create-jest": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/create-jest/-/create-jest-29.7.0.tgz", + "integrity": "sha512-Adz2bdH0Vq3F53KEMJOoftQFutWCukm6J24wbPWRO4k1kMY7gS7ds/uoJkNuV8wDCtWWnuwGcJwpWcih+zEW1Q==", + "dev": true, + "peer": true, + "dependencies": { + "@jest/types": "^29.6.3", + "chalk": "^4.0.0", + "exit": "^0.1.2", + "graceful-fs": "^4.2.9", + "jest-config": "^29.7.0", + "jest-util": "^29.7.0", + "prompts": "^2.0.1" + }, + "bin": { + "create-jest": "bin/create-jest.js" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/create-require": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz", + "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==", + "dev": true + }, + "node_modules/cross-env": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/cross-env/-/cross-env-7.0.3.tgz", + "integrity": "sha512-+/HKd6EgcQCJGh2PSjZuUitQBQynKor4wrFbRg4DtAgS1aWO+gU52xpH7M9ScGgXSYmAVS9bIJ8EzuaGw0oNAw==", + "dev": true, + "dependencies": { + "cross-spawn": "^7.0.1" + }, + "bin": { + "cross-env": "src/bin/cross-env.js", + "cross-env-shell": "src/bin/cross-env-shell.js" + }, + "engines": { + "node": ">=10.14", + "npm": ">=6", + "yarn": ">=1" + } + }, + "node_modules/cross-spawn": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", + "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "dev": true, + "dependencies": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + }, + "engines": { + "node": ">= 8" + } + }, "node_modules/data-uri-to-buffer": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/data-uri-to-buffer/-/data-uri-to-buffer-4.0.1.tgz", @@ -263,6 +1882,31 @@ "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" }, + "node_modules/dedent": { + "version": "1.5.3", + "resolved": "https://registry.npmjs.org/dedent/-/dedent-1.5.3.tgz", + "integrity": "sha512-NHQtfOOW68WD8lgypbLA5oT+Bt0xXJhiYvoR6SmmNXZfpzOGXwdKWmcwG8N7PwVVWV3eF/68nmD9BaJSsTBhyQ==", + "dev": true, + "peer": true, + "peerDependencies": { + "babel-plugin-macros": "^3.1.0" + }, + "peerDependenciesMeta": { + "babel-plugin-macros": { + "optional": true + } + } + }, + "node_modules/deepmerge": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-4.3.1.tgz", + "integrity": "sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A==", + "dev": true, + "peer": true, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/delayed-stream": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", @@ -271,6 +1915,121 @@ "node": ">=0.4.0" } }, + "node_modules/detect-newline": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/detect-newline/-/detect-newline-3.1.0.tgz", + "integrity": "sha512-TLz+x/vEXm/Y7P7wn1EJFNLxYpUD4TgMosxY6fAVJUnJMbupHBOncxyWUG9OpTaH9EBD7uFI5LfEgmMOc54DsA==", + "dev": true, + "peer": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/diff": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", + "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", + "dev": true, + "engines": { + "node": ">=0.3.1" + } + }, + "node_modules/diff-sequences": { + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/diff-sequences/-/diff-sequences-29.6.3.tgz", + "integrity": "sha512-EjePK1srD3P08o2j4f0ExnylqRs5B9tJjcp9t1krH2qRi8CCdsYfwe9JgSLurFBWwq4uOlipzfk5fHNvwFKr8Q==", + "dev": true, + "peer": true, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/ejs": { + "version": "3.1.10", + "resolved": "https://registry.npmjs.org/ejs/-/ejs-3.1.10.tgz", + "integrity": "sha512-UeJmFfOrAQS8OJWPZ4qtgHyWExa088/MtK5UEyoJGFH67cDEXkZSviOiKRCZ4Xij0zxI3JECgYs3oKx+AizQBA==", + "dev": true, + "dependencies": { + "jake": "^10.8.5" + }, + "bin": { + "ejs": "bin/cli.js" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/electron-to-chromium": { + "version": "1.5.2", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.2.tgz", + "integrity": "sha512-kc4r3U3V3WLaaZqThjYz/Y6z8tJe+7K0bbjUVo3i+LWIypVdMx5nXCkwRe6SWbY6ILqLdc1rKcKmr3HoH7wjSQ==", + "dev": true, + "peer": true + }, + "node_modules/emittery": { + "version": "0.13.1", + "resolved": "https://registry.npmjs.org/emittery/-/emittery-0.13.1.tgz", + "integrity": "sha512-DeWwawk6r5yR9jFgnDKYt4sLS0LmHJJi3ZOnb5/JdbYwj3nW+FxQnHIjhBKz8YLC7oRNPVM9NQ47I3CVx34eqQ==", + "dev": true, + "peer": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sindresorhus/emittery?sponsor=1" + } + }, + "node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true, + "peer": true + }, + "node_modules/error-ex": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", + "integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==", + "dev": true, + "peer": true, + "dependencies": { + "is-arrayish": "^0.2.1" + } + }, + "node_modules/escalade": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.2.tgz", + "integrity": "sha512-ErCHMCae19vR8vQGe50xIsVomy19rg6gFu3+r3jkEO46suLMWBksvVyoGgQV+jOfl84ZSOSlmv6Gxa89PmTGmA==", + "dev": true, + "peer": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/escape-string-regexp": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-2.0.0.tgz", + "integrity": "sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w==", + "dev": true, + "peer": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/esprima": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", + "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", + "dev": true, + "peer": true, + "bin": { + "esparse": "bin/esparse.js", + "esvalidate": "bin/esvalidate.js" + }, + "engines": { + "node": ">=4" + } + }, "node_modules/event-target-shim": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/event-target-shim/-/event-target-shim-5.0.1.tgz", @@ -279,6 +2038,73 @@ "node": ">=6" } }, + "node_modules/execa": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/execa/-/execa-5.1.1.tgz", + "integrity": "sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg==", + "dev": true, + "peer": true, + "dependencies": { + "cross-spawn": "^7.0.3", + "get-stream": "^6.0.0", + "human-signals": "^2.1.0", + "is-stream": "^2.0.0", + "merge-stream": "^2.0.0", + "npm-run-path": "^4.0.1", + "onetime": "^5.1.2", + "signal-exit": "^3.0.3", + "strip-final-newline": "^2.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sindresorhus/execa?sponsor=1" + } + }, + "node_modules/exit": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/exit/-/exit-0.1.2.tgz", + "integrity": "sha512-Zk/eNKV2zbjpKzrsQ+n1G6poVbErQxJ0LBOJXaKZ1EViLzH+hrLu9cdXI4zw9dBQJslwBEpbQ2P1oS7nDxs6jQ==", + "dev": true, + "peer": true, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/expect": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/expect/-/expect-29.7.0.tgz", + "integrity": "sha512-2Zks0hf1VLFYI1kbh0I5jP3KHHyCHpkfyHBzsSXRFgl/Bg9mWYfMW8oD+PdMPlEwy5HNsR9JutYy6pMeOh61nw==", + "dev": true, + "peer": true, + "dependencies": { + "@jest/expect-utils": "^29.7.0", + "jest-get-type": "^29.6.3", + "jest-matcher-utils": "^29.7.0", + "jest-message-util": "^29.7.0", + "jest-util": "^29.7.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/fast-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/fb-watchman": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/fb-watchman/-/fb-watchman-2.0.2.tgz", + "integrity": "sha512-p5161BqbuCaSnB8jIbzQHOlpgsPmK5rJVDfDKO91Axs5NC1uu3HRQm6wt9cd9/+GtQQIO53JdGXXoyDpTAsgYA==", + "dev": true, + "peer": true, + "dependencies": { + "bser": "2.1.1" + } + }, "node_modules/fetch-blob": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/fetch-blob/-/fetch-blob-3.2.0.tgz", @@ -301,6 +2127,63 @@ "node": "^12.20 || >= 14.13" } }, + "node_modules/filelist": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/filelist/-/filelist-1.0.4.tgz", + "integrity": "sha512-w1cEuf3S+DrLCQL7ET6kz+gmlJdbq9J7yXCSjK/OZCPA+qEN1WyF4ZAf0YYJa4/shHJra2t/d/r8SV4Ji+x+8Q==", + "dev": true, + "dependencies": { + "minimatch": "^5.0.1" + } + }, + "node_modules/filelist/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, + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/filelist/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, + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/fill-range": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", + "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", + "dev": true, + "peer": true, + "dependencies": { + "to-regex-range": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/find-up": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", + "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", + "dev": true, + "peer": true, + "dependencies": { + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/follow-redirects": { "version": "1.15.6", "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.6.tgz", @@ -369,6 +2252,148 @@ "node": ">=12.20.0" } }, + "node_modules/fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", + "dev": true, + "peer": true + }, + "node_modules/fsevents": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "dev": true, + "hasInstallScript": true, + "optional": true, + "os": [ + "darwin" + ], + "peer": true, + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, + "node_modules/function-bind": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", + "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", + "dev": true, + "peer": true, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/gensync": { + "version": "1.0.0-beta.2", + "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz", + "integrity": "sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==", + "dev": true, + "peer": true, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/get-caller-file": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", + "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", + "dev": true, + "peer": true, + "engines": { + "node": "6.* || 8.* || >= 10.*" + } + }, + "node_modules/get-package-type": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/get-package-type/-/get-package-type-0.1.0.tgz", + "integrity": "sha512-pjzuKtY64GYfWizNAJ0fr9VqttZkNiK2iS430LtIHzjBEr6bX8Am2zm4sW4Ro5wjWW5cAlRL1qAMTcXbjNAO2Q==", + "dev": true, + "peer": true, + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/get-stream": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz", + "integrity": "sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==", + "dev": true, + "peer": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/glob": { + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "deprecated": "Glob versions prior to v9 are no longer supported", + "dev": true, + "peer": true, + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.1.1", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/globals": { + "version": "11.12.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz", + "integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==", + "dev": true, + "peer": true, + "engines": { + "node": ">=4" + } + }, + "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/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/hasown": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz", + "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==", + "dev": true, + "peer": true, + "dependencies": { + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/html-escaper": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/html-escaper/-/html-escaper-2.0.2.tgz", + "integrity": "sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==", + "dev": true, + "peer": 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", @@ -393,6 +2418,16 @@ "node": ">= 14" } }, + "node_modules/human-signals": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-2.1.0.tgz", + "integrity": "sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==", + "dev": true, + "peer": true, + "engines": { + "node": ">=10.17.0" + } + }, "node_modules/humanize-ms": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/humanize-ms/-/humanize-ms-1.2.1.tgz", @@ -401,6 +2436,999 @@ "ms": "^2.0.0" } }, + "node_modules/import-local": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/import-local/-/import-local-3.2.0.tgz", + "integrity": "sha512-2SPlun1JUPWoM6t3F0dw0FkCF/jWY8kttcY4f599GLTSjh2OCuuhdTkJQsEcZzBqbXZGKMK2OqW1oZsjtf/gQA==", + "dev": true, + "peer": true, + "dependencies": { + "pkg-dir": "^4.2.0", + "resolve-cwd": "^3.0.0" + }, + "bin": { + "import-local-fixture": "fixtures/cli.js" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/imurmurhash": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", + "integrity": "sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==", + "dev": true, + "peer": true, + "engines": { + "node": ">=0.8.19" + } + }, + "node_modules/inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", + "deprecated": "This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.", + "dev": true, + "peer": true, + "dependencies": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "dev": true, + "peer": true + }, + "node_modules/is-arrayish": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", + "integrity": "sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg==", + "dev": true, + "peer": true + }, + "node_modules/is-core-module": { + "version": "2.15.0", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.15.0.tgz", + "integrity": "sha512-Dd+Lb2/zvk9SKy1TGCt1wFJFo/MWBPMX5x7KcvLajWTGuomczdQX61PvY5yK6SVACwpoexWo81IfFyoKY2QnTA==", + "dev": true, + "peer": true, + "dependencies": { + "hasown": "^2.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "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", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true, + "peer": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/is-generator-fn": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-generator-fn/-/is-generator-fn-2.1.0.tgz", + "integrity": "sha512-cTIB4yPYL/Grw0EaSzASzg6bBy9gqCofvWN8okThAYIxKJZC+udlRAmGbM0XLeniEJSs8uEgHPGuHSe1XsOLSQ==", + "dev": true, + "peer": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "dev": true, + "peer": true, + "engines": { + "node": ">=0.12.0" + } + }, + "node_modules/is-stream": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz", + "integrity": "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==", + "dev": true, + "peer": true, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "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/istanbul-lib-coverage": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-3.2.2.tgz", + "integrity": "sha512-O8dpsF+r0WV/8MNRKfnmrtCWhuKjxrq2w+jpzBL5UZKTi2LeVWnWOmWRxFlesJONmc+wLAGvKQZEOanko0LFTg==", + "dev": true, + "peer": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/istanbul-lib-instrument": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/istanbul-lib-instrument/-/istanbul-lib-instrument-6.0.3.tgz", + "integrity": "sha512-Vtgk7L/R2JHyyGW07spoFlB8/lpjiOLTjMdms6AFMraYt3BaJauod/NGrfnVG/y4Ix1JEuMRPDPEj2ua+zz1/Q==", + "dev": true, + "peer": true, + "dependencies": { + "@babel/core": "^7.23.9", + "@babel/parser": "^7.23.9", + "@istanbuljs/schema": "^0.1.3", + "istanbul-lib-coverage": "^3.2.0", + "semver": "^7.5.4" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/istanbul-lib-instrument/node_modules/semver": { + "version": "7.6.3", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.3.tgz", + "integrity": "sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A==", + "dev": true, + "peer": true, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/istanbul-lib-report": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/istanbul-lib-report/-/istanbul-lib-report-3.0.1.tgz", + "integrity": "sha512-GCfE1mtsHGOELCU8e/Z7YWzpmybrx/+dSTfLrvY8qRmaY6zXTKWn6WQIjaAFw069icm6GVMNkgu0NzI4iPZUNw==", + "dev": true, + "peer": true, + "dependencies": { + "istanbul-lib-coverage": "^3.0.0", + "make-dir": "^4.0.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/istanbul-lib-source-maps": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/istanbul-lib-source-maps/-/istanbul-lib-source-maps-4.0.1.tgz", + "integrity": "sha512-n3s8EwkdFIJCG3BPKBYvskgXGoy88ARzvegkitk60NxRdwltLOTaH7CUiMRXvwYorl0Q712iEjcWB+fK/MrWVw==", + "dev": true, + "peer": true, + "dependencies": { + "debug": "^4.1.1", + "istanbul-lib-coverage": "^3.0.0", + "source-map": "^0.6.1" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/istanbul-reports": { + "version": "3.1.7", + "resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-3.1.7.tgz", + "integrity": "sha512-BewmUXImeuRk2YY0PVbxgKAysvhRPUQE0h5QRM++nVWyubKGV0l8qQ5op8+B2DOmwSe63Jivj0BjkPQVf8fP5g==", + "dev": true, + "peer": true, + "dependencies": { + "html-escaper": "^2.0.0", + "istanbul-lib-report": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/jake": { + "version": "10.9.2", + "resolved": "https://registry.npmjs.org/jake/-/jake-10.9.2.tgz", + "integrity": "sha512-2P4SQ0HrLQ+fw6llpLnOaGAvN2Zu6778SJMrCUwns4fOoG9ayrTiZk3VV8sCPkVZF8ab0zksVpS8FDY5pRCNBA==", + "dev": true, + "dependencies": { + "async": "^3.2.3", + "chalk": "^4.0.2", + "filelist": "^1.0.4", + "minimatch": "^3.1.2" + }, + "bin": { + "jake": "bin/cli.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/jest": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest/-/jest-29.7.0.tgz", + "integrity": "sha512-NIy3oAFp9shda19hy4HK0HRTWKtPJmGdnvywu01nOqNC2vZg+Z+fvJDxpMQA88eb2I9EcafcdjYgsDthnYTvGw==", + "dev": true, + "peer": true, + "dependencies": { + "@jest/core": "^29.7.0", + "@jest/types": "^29.6.3", + "import-local": "^3.0.2", + "jest-cli": "^29.7.0" + }, + "bin": { + "jest": "bin/jest.js" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + }, + "peerDependencies": { + "node-notifier": "^8.0.1 || ^9.0.0 || ^10.0.0" + }, + "peerDependenciesMeta": { + "node-notifier": { + "optional": true + } + } + }, + "node_modules/jest-changed-files": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-changed-files/-/jest-changed-files-29.7.0.tgz", + "integrity": "sha512-fEArFiwf1BpQ+4bXSprcDc3/x4HSzL4al2tozwVpDFpsxALjLYdyiIK4e5Vz66GQJIbXJ82+35PtysofptNX2w==", + "dev": true, + "peer": true, + "dependencies": { + "execa": "^5.0.0", + "jest-util": "^29.7.0", + "p-limit": "^3.1.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-circus": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-circus/-/jest-circus-29.7.0.tgz", + "integrity": "sha512-3E1nCMgipcTkCocFwM90XXQab9bS+GMsjdpmPrlelaxwD93Ad8iVEjX/vvHPdLPnFf+L40u+5+iutRdA1N9myw==", + "dev": true, + "peer": true, + "dependencies": { + "@jest/environment": "^29.7.0", + "@jest/expect": "^29.7.0", + "@jest/test-result": "^29.7.0", + "@jest/types": "^29.6.3", + "@types/node": "*", + "chalk": "^4.0.0", + "co": "^4.6.0", + "dedent": "^1.0.0", + "is-generator-fn": "^2.0.0", + "jest-each": "^29.7.0", + "jest-matcher-utils": "^29.7.0", + "jest-message-util": "^29.7.0", + "jest-runtime": "^29.7.0", + "jest-snapshot": "^29.7.0", + "jest-util": "^29.7.0", + "p-limit": "^3.1.0", + "pretty-format": "^29.7.0", + "pure-rand": "^6.0.0", + "slash": "^3.0.0", + "stack-utils": "^2.0.3" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-cli": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-cli/-/jest-cli-29.7.0.tgz", + "integrity": "sha512-OVVobw2IubN/GSYsxETi+gOe7Ka59EFMR/twOU3Jb2GnKKeMGJB5SGUUrEz3SFVmJASUdZUzy83sLNNQ2gZslg==", + "dev": true, + "peer": true, + "dependencies": { + "@jest/core": "^29.7.0", + "@jest/test-result": "^29.7.0", + "@jest/types": "^29.6.3", + "chalk": "^4.0.0", + "create-jest": "^29.7.0", + "exit": "^0.1.2", + "import-local": "^3.0.2", + "jest-config": "^29.7.0", + "jest-util": "^29.7.0", + "jest-validate": "^29.7.0", + "yargs": "^17.3.1" + }, + "bin": { + "jest": "bin/jest.js" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + }, + "peerDependencies": { + "node-notifier": "^8.0.1 || ^9.0.0 || ^10.0.0" + }, + "peerDependenciesMeta": { + "node-notifier": { + "optional": true + } + } + }, + "node_modules/jest-config": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-config/-/jest-config-29.7.0.tgz", + "integrity": "sha512-uXbpfeQ7R6TZBqI3/TxCU4q4ttk3u0PJeC+E0zbfSoSjq6bJ7buBPxzQPL0ifrkY4DNu4JUdk0ImlBUYi840eQ==", + "dev": true, + "peer": true, + "dependencies": { + "@babel/core": "^7.11.6", + "@jest/test-sequencer": "^29.7.0", + "@jest/types": "^29.6.3", + "babel-jest": "^29.7.0", + "chalk": "^4.0.0", + "ci-info": "^3.2.0", + "deepmerge": "^4.2.2", + "glob": "^7.1.3", + "graceful-fs": "^4.2.9", + "jest-circus": "^29.7.0", + "jest-environment-node": "^29.7.0", + "jest-get-type": "^29.6.3", + "jest-regex-util": "^29.6.3", + "jest-resolve": "^29.7.0", + "jest-runner": "^29.7.0", + "jest-util": "^29.7.0", + "jest-validate": "^29.7.0", + "micromatch": "^4.0.4", + "parse-json": "^5.2.0", + "pretty-format": "^29.7.0", + "slash": "^3.0.0", + "strip-json-comments": "^3.1.1" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + }, + "peerDependencies": { + "@types/node": "*", + "ts-node": ">=9.0.0" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + }, + "ts-node": { + "optional": true + } + } + }, + "node_modules/jest-diff": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-diff/-/jest-diff-29.7.0.tgz", + "integrity": "sha512-LMIgiIrhigmPrs03JHpxUh2yISK3vLFPkAodPeo0+BuF7wA2FoQbkEg1u8gBYBThncu7e1oEDUfIXVuTqLRUjw==", + "dev": true, + "peer": true, + "dependencies": { + "chalk": "^4.0.0", + "diff-sequences": "^29.6.3", + "jest-get-type": "^29.6.3", + "pretty-format": "^29.7.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-docblock": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-docblock/-/jest-docblock-29.7.0.tgz", + "integrity": "sha512-q617Auw3A612guyaFgsbFeYpNP5t2aoUNLwBUbc/0kD1R4t9ixDbyFTHd1nok4epoVFpr7PmeWHrhvuV3XaJ4g==", + "dev": true, + "peer": true, + "dependencies": { + "detect-newline": "^3.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-each": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-each/-/jest-each-29.7.0.tgz", + "integrity": "sha512-gns+Er14+ZrEoC5fhOfYCY1LOHHr0TI+rQUHZS8Ttw2l7gl+80eHc/gFf2Ktkw0+SIACDTeWvpFcv3B04VembQ==", + "dev": true, + "peer": true, + "dependencies": { + "@jest/types": "^29.6.3", + "chalk": "^4.0.0", + "jest-get-type": "^29.6.3", + "jest-util": "^29.7.0", + "pretty-format": "^29.7.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-environment-node": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-environment-node/-/jest-environment-node-29.7.0.tgz", + "integrity": "sha512-DOSwCRqXirTOyheM+4d5YZOrWcdu0LNZ87ewUoywbcb2XR4wKgqiG8vNeYwhjFMbEkfju7wx2GYH0P2gevGvFw==", + "dev": true, + "peer": true, + "dependencies": { + "@jest/environment": "^29.7.0", + "@jest/fake-timers": "^29.7.0", + "@jest/types": "^29.6.3", + "@types/node": "*", + "jest-mock": "^29.7.0", + "jest-util": "^29.7.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-get-type": { + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/jest-get-type/-/jest-get-type-29.6.3.tgz", + "integrity": "sha512-zrteXnqYxfQh7l5FHyL38jL39di8H8rHoecLH3JNxH3BwOrBsNeabdap5e0I23lD4HHI8W5VFBZqG4Eaq5LNcw==", + "dev": true, + "peer": true, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-haste-map": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-haste-map/-/jest-haste-map-29.7.0.tgz", + "integrity": "sha512-fP8u2pyfqx0K1rGn1R9pyE0/KTn+G7PxktWidOBTqFPLYX0b9ksaMFkhK5vrS3DVun09pckLdlx90QthlW7AmA==", + "dev": true, + "peer": true, + "dependencies": { + "@jest/types": "^29.6.3", + "@types/graceful-fs": "^4.1.3", + "@types/node": "*", + "anymatch": "^3.0.3", + "fb-watchman": "^2.0.0", + "graceful-fs": "^4.2.9", + "jest-regex-util": "^29.6.3", + "jest-util": "^29.7.0", + "jest-worker": "^29.7.0", + "micromatch": "^4.0.4", + "walker": "^1.0.8" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + }, + "optionalDependencies": { + "fsevents": "^2.3.2" + } + }, + "node_modules/jest-leak-detector": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-leak-detector/-/jest-leak-detector-29.7.0.tgz", + "integrity": "sha512-kYA8IJcSYtST2BY9I+SMC32nDpBT3J2NvWJx8+JCuCdl/CR1I4EKUJROiP8XtCcxqgTTBGJNdbB1A8XRKbTetw==", + "dev": true, + "peer": true, + "dependencies": { + "jest-get-type": "^29.6.3", + "pretty-format": "^29.7.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-matcher-utils": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-matcher-utils/-/jest-matcher-utils-29.7.0.tgz", + "integrity": "sha512-sBkD+Xi9DtcChsI3L3u0+N0opgPYnCRPtGcQYrgXmR+hmt/fYfWAL0xRXYU8eWOdfuLgBe0YCW3AFtnRLagq/g==", + "dev": true, + "peer": true, + "dependencies": { + "chalk": "^4.0.0", + "jest-diff": "^29.7.0", + "jest-get-type": "^29.6.3", + "pretty-format": "^29.7.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-message-util": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-message-util/-/jest-message-util-29.7.0.tgz", + "integrity": "sha512-GBEV4GRADeP+qtB2+6u61stea8mGcOT4mCtrYISZwfu9/ISHFJ/5zOMXYbpBE9RsS5+Gb63DW4FgmnKJ79Kf6w==", + "dev": true, + "peer": true, + "dependencies": { + "@babel/code-frame": "^7.12.13", + "@jest/types": "^29.6.3", + "@types/stack-utils": "^2.0.0", + "chalk": "^4.0.0", + "graceful-fs": "^4.2.9", + "micromatch": "^4.0.4", + "pretty-format": "^29.7.0", + "slash": "^3.0.0", + "stack-utils": "^2.0.3" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-mock": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-mock/-/jest-mock-29.7.0.tgz", + "integrity": "sha512-ITOMZn+UkYS4ZFh83xYAOzWStloNzJFO2s8DWrE4lhtGD+AorgnbkiKERe4wQVBydIGPx059g6riW5Btp6Llnw==", + "dev": true, + "peer": true, + "dependencies": { + "@jest/types": "^29.6.3", + "@types/node": "*", + "jest-util": "^29.7.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-pnp-resolver": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/jest-pnp-resolver/-/jest-pnp-resolver-1.2.3.tgz", + "integrity": "sha512-+3NpwQEnRoIBtx4fyhblQDPgJI0H1IEIkX7ShLUjPGA7TtUTvI1oiKi3SR4oBR0hQhQR80l4WAe5RrXBwWMA8w==", + "dev": true, + "peer": true, + "engines": { + "node": ">=6" + }, + "peerDependencies": { + "jest-resolve": "*" + }, + "peerDependenciesMeta": { + "jest-resolve": { + "optional": true + } + } + }, + "node_modules/jest-regex-util": { + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/jest-regex-util/-/jest-regex-util-29.6.3.tgz", + "integrity": "sha512-KJJBsRCyyLNWCNBOvZyRDnAIfUiRJ8v+hOBQYGn8gDyF3UegwiP4gwRR3/SDa42g1YbVycTidUF3rKjyLFDWbg==", + "dev": true, + "peer": true, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-resolve": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-resolve/-/jest-resolve-29.7.0.tgz", + "integrity": "sha512-IOVhZSrg+UvVAshDSDtHyFCCBUl/Q3AAJv8iZ6ZjnZ74xzvwuzLXid9IIIPgTnY62SJjfuupMKZsZQRsCvxEgA==", + "dev": true, + "peer": true, + "dependencies": { + "chalk": "^4.0.0", + "graceful-fs": "^4.2.9", + "jest-haste-map": "^29.7.0", + "jest-pnp-resolver": "^1.2.2", + "jest-util": "^29.7.0", + "jest-validate": "^29.7.0", + "resolve": "^1.20.0", + "resolve.exports": "^2.0.0", + "slash": "^3.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-resolve-dependencies": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-resolve-dependencies/-/jest-resolve-dependencies-29.7.0.tgz", + "integrity": "sha512-un0zD/6qxJ+S0et7WxeI3H5XSe9lTBBR7bOHCHXkKR6luG5mwDDlIzVQ0V5cZCuoTgEdcdwzTghYkTWfubi+nA==", + "dev": true, + "peer": true, + "dependencies": { + "jest-regex-util": "^29.6.3", + "jest-snapshot": "^29.7.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-runner": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-runner/-/jest-runner-29.7.0.tgz", + "integrity": "sha512-fsc4N6cPCAahybGBfTRcq5wFR6fpLznMg47sY5aDpsoejOcVYFb07AHuSnR0liMcPTgBsA3ZJL6kFOjPdoNipQ==", + "dev": true, + "peer": true, + "dependencies": { + "@jest/console": "^29.7.0", + "@jest/environment": "^29.7.0", + "@jest/test-result": "^29.7.0", + "@jest/transform": "^29.7.0", + "@jest/types": "^29.6.3", + "@types/node": "*", + "chalk": "^4.0.0", + "emittery": "^0.13.1", + "graceful-fs": "^4.2.9", + "jest-docblock": "^29.7.0", + "jest-environment-node": "^29.7.0", + "jest-haste-map": "^29.7.0", + "jest-leak-detector": "^29.7.0", + "jest-message-util": "^29.7.0", + "jest-resolve": "^29.7.0", + "jest-runtime": "^29.7.0", + "jest-util": "^29.7.0", + "jest-watcher": "^29.7.0", + "jest-worker": "^29.7.0", + "p-limit": "^3.1.0", + "source-map-support": "0.5.13" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-runtime": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-runtime/-/jest-runtime-29.7.0.tgz", + "integrity": "sha512-gUnLjgwdGqW7B4LvOIkbKs9WGbn+QLqRQQ9juC6HndeDiezIwhDP+mhMwHWCEcfQ5RUXa6OPnFF8BJh5xegwwQ==", + "dev": true, + "peer": true, + "dependencies": { + "@jest/environment": "^29.7.0", + "@jest/fake-timers": "^29.7.0", + "@jest/globals": "^29.7.0", + "@jest/source-map": "^29.6.3", + "@jest/test-result": "^29.7.0", + "@jest/transform": "^29.7.0", + "@jest/types": "^29.6.3", + "@types/node": "*", + "chalk": "^4.0.0", + "cjs-module-lexer": "^1.0.0", + "collect-v8-coverage": "^1.0.0", + "glob": "^7.1.3", + "graceful-fs": "^4.2.9", + "jest-haste-map": "^29.7.0", + "jest-message-util": "^29.7.0", + "jest-mock": "^29.7.0", + "jest-regex-util": "^29.6.3", + "jest-resolve": "^29.7.0", + "jest-snapshot": "^29.7.0", + "jest-util": "^29.7.0", + "slash": "^3.0.0", + "strip-bom": "^4.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-snapshot": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-snapshot/-/jest-snapshot-29.7.0.tgz", + "integrity": "sha512-Rm0BMWtxBcioHr1/OX5YCP8Uov4riHvKPknOGs804Zg9JGZgmIBkbtlxJC/7Z4msKYVbIJtfU+tKb8xlYNfdkw==", + "dev": true, + "peer": true, + "dependencies": { + "@babel/core": "^7.11.6", + "@babel/generator": "^7.7.2", + "@babel/plugin-syntax-jsx": "^7.7.2", + "@babel/plugin-syntax-typescript": "^7.7.2", + "@babel/types": "^7.3.3", + "@jest/expect-utils": "^29.7.0", + "@jest/transform": "^29.7.0", + "@jest/types": "^29.6.3", + "babel-preset-current-node-syntax": "^1.0.0", + "chalk": "^4.0.0", + "expect": "^29.7.0", + "graceful-fs": "^4.2.9", + "jest-diff": "^29.7.0", + "jest-get-type": "^29.6.3", + "jest-matcher-utils": "^29.7.0", + "jest-message-util": "^29.7.0", + "jest-util": "^29.7.0", + "natural-compare": "^1.4.0", + "pretty-format": "^29.7.0", + "semver": "^7.5.3" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-snapshot/node_modules/semver": { + "version": "7.6.3", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.3.tgz", + "integrity": "sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A==", + "dev": true, + "peer": true, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/jest-util": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-29.7.0.tgz", + "integrity": "sha512-z6EbKajIpqGKU56y5KBUgy1dt1ihhQJgWzUlZHArA/+X2ad7Cb5iF+AK1EWVL/Bo7Rz9uurpqw6SiBCefUbCGA==", + "dev": true, + "dependencies": { + "@jest/types": "^29.6.3", + "@types/node": "*", + "chalk": "^4.0.0", + "ci-info": "^3.2.0", + "graceful-fs": "^4.2.9", + "picomatch": "^2.2.3" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-validate": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-validate/-/jest-validate-29.7.0.tgz", + "integrity": "sha512-ZB7wHqaRGVw/9hST/OuFUReG7M8vKeq0/J2egIGLdvjHCmYqGARhzXmtgi+gVeZ5uXFF219aOc3Ls2yLg27tkw==", + "dev": true, + "peer": true, + "dependencies": { + "@jest/types": "^29.6.3", + "camelcase": "^6.2.0", + "chalk": "^4.0.0", + "jest-get-type": "^29.6.3", + "leven": "^3.1.0", + "pretty-format": "^29.7.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-validate/node_modules/camelcase": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz", + "integrity": "sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==", + "dev": true, + "peer": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/jest-watcher": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-watcher/-/jest-watcher-29.7.0.tgz", + "integrity": "sha512-49Fg7WXkU3Vl2h6LbLtMQ/HyB6rXSIX7SqvBLQmssRBGN9I0PNvPmAmCWSOY6SOvrjhI/F7/bGAv9RtnsPA03g==", + "dev": true, + "peer": true, + "dependencies": { + "@jest/test-result": "^29.7.0", + "@jest/types": "^29.6.3", + "@types/node": "*", + "ansi-escapes": "^4.2.1", + "chalk": "^4.0.0", + "emittery": "^0.13.1", + "jest-util": "^29.7.0", + "string-length": "^4.0.1" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-worker": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-29.7.0.tgz", + "integrity": "sha512-eIz2msL/EzL9UFTFFx7jBTkeZfku0yUAyZZZmJ93H2TYEiroIx2PQjEXcwYtYl8zXCxb+PAmA2hLIt/6ZEkPHw==", + "dev": true, + "peer": true, + "dependencies": { + "@types/node": "*", + "jest-util": "^29.7.0", + "merge-stream": "^2.0.0", + "supports-color": "^8.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-worker/node_modules/supports-color": { + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", + "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", + "dev": true, + "peer": true, + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/supports-color?sponsor=1" + } + }, + "node_modules/js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", + "dev": true, + "peer": true + }, + "node_modules/js-yaml": { + "version": "3.14.1", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz", + "integrity": "sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==", + "dev": true, + "peer": true, + "dependencies": { + "argparse": "^1.0.7", + "esprima": "^4.0.0" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, + "node_modules/jsesc": { + "version": "2.5.2", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-2.5.2.tgz", + "integrity": "sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==", + "dev": true, + "peer": true, + "bin": { + "jsesc": "bin/jsesc" + }, + "engines": { + "node": ">=4" + } + }, + "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, + "peer": true + }, + "node_modules/json5": { + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz", + "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==", + "dev": true, + "bin": { + "json5": "lib/cli.js" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/kleur": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/kleur/-/kleur-3.0.3.tgz", + "integrity": "sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w==", + "dev": true, + "peer": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/leven": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/leven/-/leven-3.1.0.tgz", + "integrity": "sha512-qsda+H8jTaUaN/x5vzW2rzc+8Rw4TAQ/4KjB46IwK5VH+IlVeeeje/EoZRpiXvIqjFgK84QffqPztGI3VBLG1A==", + "dev": true, + "peer": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/lines-and-columns": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz", + "integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==", + "dev": true, + "peer": true + }, + "node_modules/locate-path": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", + "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", + "dev": true, + "peer": true, + "dependencies": { + "p-locate": "^4.1.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/lodash.memoize": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/lodash.memoize/-/lodash.memoize-4.1.2.tgz", + "integrity": "sha512-t7j+NzmgnQzTAYXcsHYLgimltOV1MXHtlOWf6GjL9Kj8GK5FInw5JotxvbOs+IvV1/Dzo04/fCGfLVs7aXb4Ag==", + "dev": true + }, + "node_modules/lru-cache": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz", + "integrity": "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==", + "dev": true, + "peer": true, + "dependencies": { + "yallist": "^3.0.2" + } + }, + "node_modules/make-dir": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-4.0.0.tgz", + "integrity": "sha512-hXdUTZYIVOt1Ex//jAQi+wTZZpUpwBj/0QsOzqegb3rGMMeJiSEu5xLHnYfBrRV4RH2+OCSOO95Is/7x1WJ4bw==", + "dev": true, + "peer": true, + "dependencies": { + "semver": "^7.5.3" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/make-dir/node_modules/semver": { + "version": "7.6.3", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.3.tgz", + "integrity": "sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A==", + "dev": true, + "peer": true, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/make-error": { + "version": "1.3.6", + "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", + "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==", + "dev": true + }, + "node_modules/makeerror": { + "version": "1.0.12", + "resolved": "https://registry.npmjs.org/makeerror/-/makeerror-1.0.12.tgz", + "integrity": "sha512-JmqCvUhmt43madlpFzG4BQzG2Z3m6tvQDNKdClZnO3VbIudJYmxsT0FNJMeiB2+JTSlTQTSbU8QdesVmwJcmLg==", + "dev": true, + "peer": true, + "dependencies": { + "tmpl": "1.0.5" + } + }, + "node_modules/merge-stream": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", + "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==", + "dev": true, + "peer": true + }, + "node_modules/micromatch": { + "version": "4.0.7", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.7.tgz", + "integrity": "sha512-LPP/3KorzCwBxfeUuZmaR6bG2kdeHSbe0P2tY3FLRU4vYrjYz5hI4QZwV0njUx3jeuKe67YukQ1LSPZBKDqO/Q==", + "dev": true, + "peer": true, + "dependencies": { + "braces": "^3.0.3", + "picomatch": "^2.3.1" + }, + "engines": { + "node": ">=8.6" + } + }, "node_modules/mime-db": { "version": "1.52.0", "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", @@ -420,11 +3448,40 @@ "node": ">= 0.6" } }, + "node_modules/mimic-fn": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", + "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", + "dev": true, + "peer": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, "node_modules/ms": { "version": "2.1.3", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" }, + "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, + "peer": true + }, "node_modules/node-domexception": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/node-domexception/-/node-domexception-1.0.0.tgz", @@ -460,6 +3517,69 @@ "url": "https://opencollective.com/node-fetch" } }, + "node_modules/node-int64": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/node-int64/-/node-int64-0.4.0.tgz", + "integrity": "sha512-O5lz91xSOeoXP6DulyHfllpq+Eg00MWitZIbtPfoSEvqIHdl5gfcY6hYzDWnj0qD5tz52PI08u9qUvSVeUBeHw==", + "dev": true, + "peer": true + }, + "node_modules/node-releases": { + "version": "2.0.18", + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.18.tgz", + "integrity": "sha512-d9VeXT4SJ7ZeOqGX6R5EM022wpL+eWPooLI+5UpWn2jCT1aosUQEhQP214x33Wkwx3JQMvIm+tIoVOdodFS40g==", + "dev": true, + "peer": true + }, + "node_modules/normalize-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", + "dev": true, + "peer": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/npm-run-path": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz", + "integrity": "sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==", + "dev": true, + "peer": true, + "dependencies": { + "path-key": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "dev": true, + "peer": true, + "dependencies": { + "wrappy": "1" + } + }, + "node_modules/onetime": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz", + "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==", + "dev": true, + "peer": true, + "dependencies": { + "mimic-fn": "^2.1.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/openai": { "version": "4.52.5", "resolved": "https://registry.npmjs.org/openai/-/openai-4.52.5.tgz", @@ -497,21 +3617,743 @@ } } }, + "node_modules/p-limit": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", + "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", + "dev": true, + "peer": true, + "dependencies": { + "yocto-queue": "^0.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-locate": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", + "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", + "dev": true, + "peer": true, + "dependencies": { + "p-limit": "^2.2.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/p-locate/node_modules/p-limit": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", + "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "dev": true, + "peer": true, + "dependencies": { + "p-try": "^2.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-try": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", + "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", + "dev": true, + "peer": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/parse-json": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-5.2.0.tgz", + "integrity": "sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg==", + "dev": true, + "peer": true, + "dependencies": { + "@babel/code-frame": "^7.0.0", + "error-ex": "^1.3.1", + "json-parse-even-better-errors": "^2.3.0", + "lines-and-columns": "^1.1.6" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "dev": true, + "peer": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", + "dev": true, + "peer": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/path-parse": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", + "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", + "dev": true, + "peer": true + }, + "node_modules/picocolors": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.1.tgz", + "integrity": "sha512-anP1Z8qwhkbmu7MFP5iTt+wQKXgwzf7zTyGlcdzabySa9vd0Xt392U0rVmz9poOaBj0uHJKyyo9/upk0HrEQew==", + "dev": true, + "peer": true + }, + "node_modules/picomatch": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "dev": true, + "engines": { + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/pirates": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/pirates/-/pirates-4.0.6.tgz", + "integrity": "sha512-saLsH7WeYYPiD25LDuLRRY/i+6HaPYr6G1OUlN39otzkSTxKnubR9RTxS3/Kk50s1g2JTgFwWQDQyplC5/SHZg==", + "dev": true, + "peer": true, + "engines": { + "node": ">= 6" + } + }, + "node_modules/pkg-dir": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-4.2.0.tgz", + "integrity": "sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==", + "dev": true, + "peer": true, + "dependencies": { + "find-up": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/pretty-format": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-29.7.0.tgz", + "integrity": "sha512-Pdlw/oPxN+aXdmM9R00JVC9WVFoCLTKJvDVLgmJ+qAffBMxsV85l/Lu7sNx4zSzPyoL2euImuEwHhOXdEgNFZQ==", + "dev": true, + "peer": true, + "dependencies": { + "@jest/schemas": "^29.6.3", + "ansi-styles": "^5.0.0", + "react-is": "^18.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/pretty-format/node_modules/ansi-styles": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-5.2.0.tgz", + "integrity": "sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==", + "dev": true, + "peer": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/prompts": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/prompts/-/prompts-2.4.2.tgz", + "integrity": "sha512-NxNv/kLguCA7p3jE8oL2aEBsrJWgAakBpgmgK6lpPWV+WuOmY6r2/zbAVnP+T8bQlA0nzHXSJSJW0Hq7ylaD2Q==", + "dev": true, + "peer": true, + "dependencies": { + "kleur": "^3.0.3", + "sisteransi": "^1.0.5" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/pure-rand": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/pure-rand/-/pure-rand-6.1.0.tgz", + "integrity": "sha512-bVWawvoZoBYpp6yIoQtQXHZjmz35RSVHnUOTefl8Vcjr8snTPY1wnpSPMWekcFwbxI6gtmT7rSYPFvz71ldiOA==", + "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://github.com/sponsors/dubzzz" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/fast-check" + } + ], + "peer": true + }, + "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, + "peer": true + }, + "node_modules/require-directory": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", + "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==", + "dev": true, + "peer": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/resolve": { + "version": "1.22.8", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.8.tgz", + "integrity": "sha512-oKWePCxqpd6FlLvGV1VU0x7bkPmmCNolxzjMf4NczoDnQcIWrAF+cPtZn5i6n+RfD2d9i0tzpKnG6Yk168yIyw==", + "dev": true, + "peer": true, + "dependencies": { + "is-core-module": "^2.13.0", + "path-parse": "^1.0.7", + "supports-preserve-symlinks-flag": "^1.0.0" + }, + "bin": { + "resolve": "bin/resolve" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/resolve-cwd": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/resolve-cwd/-/resolve-cwd-3.0.0.tgz", + "integrity": "sha512-OrZaX2Mb+rJCpH/6CpSqt9xFVpN++x01XnN2ie9g6P5/3xelLAkXWVADpdz1IHD/KFfEXyE6V0U01OQ3UO2rEg==", + "dev": true, + "peer": true, + "dependencies": { + "resolve-from": "^5.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/resolve-from": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-5.0.0.tgz", + "integrity": "sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==", + "dev": true, + "peer": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/resolve.exports": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/resolve.exports/-/resolve.exports-2.0.2.tgz", + "integrity": "sha512-X2UW6Nw3n/aMgDVy+0rSqgHlv39WZAlZrXCdnbyEiKm17DSqHX4MmQMaST3FbeWR5FTuRcUwYAziZajji0Y7mg==", + "dev": true, + "peer": true, + "engines": { + "node": ">=10" + } + }, + "node_modules/semver": { + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", + "dev": true, + "peer": true, + "bin": { + "semver": "bin/semver.js" + } + }, + "node_modules/shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dev": true, + "dependencies": { + "shebang-regex": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/signal-exit": { + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", + "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", + "dev": true, + "peer": true + }, + "node_modules/sisteransi": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/sisteransi/-/sisteransi-1.0.5.tgz", + "integrity": "sha512-bLGGlR1QxBcynn2d5YmDX4MGjlZvy2MRBDRNHLJ8VI6l6+9FUiyTFNJ0IveOSP0bcXgVDPRcfGqA0pjaqUpfVg==", + "dev": true, + "peer": true + }, + "node_modules/slash": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", + "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", + "dev": true, + "peer": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true, + "peer": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/source-map-support": { + "version": "0.5.13", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.13.tgz", + "integrity": "sha512-SHSKFHadjVA5oR4PPqhtAVdcBWwRYVd6g6cAXnIbRiIwc2EhPrTuKUBdSLvlEKyIP3GCf89fltvcZiP9MMFA1w==", + "dev": true, + "peer": true, + "dependencies": { + "buffer-from": "^1.0.0", + "source-map": "^0.6.0" + } + }, + "node_modules/sprintf-js": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", + "integrity": "sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==", + "dev": true, + "peer": true + }, + "node_modules/stack-utils": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/stack-utils/-/stack-utils-2.0.6.tgz", + "integrity": "sha512-XlkWvfIm6RmsWtNJx+uqtKLS8eqFbxUg0ZzLXqY0caEy9l7hruX8IpiDnjsLavoBgqCCR71TqWO8MaXYheJ3RQ==", + "dev": true, + "peer": true, + "dependencies": { + "escape-string-regexp": "^2.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/string-length": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/string-length/-/string-length-4.0.2.tgz", + "integrity": "sha512-+l6rNN5fYHNhZZy41RXsYptCjA2Igmq4EG7kZAYFQI1E1VTXarr6ZPXBg6eq7Y6eK4FEhY6AJlyuFIb/v/S0VQ==", + "dev": true, + "peer": true, + "dependencies": { + "char-regex": "^1.0.2", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, + "peer": true, + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "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, + "peer": true, + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-bom": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-4.0.0.tgz", + "integrity": "sha512-3xurFv5tEgii33Zi8Jtp55wEIILR9eh34FAW00PZf+JnSsTmV/ioewSgQl97JHvgjoRGwPShsWm+IdrxB35d0w==", + "dev": true, + "peer": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-final-newline": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-2.0.0.tgz", + "integrity": "sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==", + "dev": true, + "peer": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/strip-json-comments": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", + "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", + "dev": true, + "peer": true, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "dependencies": { + "has-flag": "^4.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", + "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", + "dev": true, + "peer": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/test-exclude": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/test-exclude/-/test-exclude-6.0.0.tgz", + "integrity": "sha512-cAGWPIyOHU6zlmg88jwm7VRyXnMN7iV68OGAbYDk/Mh/xC/pzVPlQtY6ngoIH/5/tciuhGfvESU8GrHrcxD56w==", + "dev": true, + "peer": true, + "dependencies": { + "@istanbuljs/schema": "^0.1.2", + "glob": "^7.1.4", + "minimatch": "^3.0.4" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/tmpl": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/tmpl/-/tmpl-1.0.5.tgz", + "integrity": "sha512-3f0uOEAQwIqGuWW2MVzYg8fV/QNnc/IpuJNG837rLuczAaLVHslWHZQj4IGiEl5Hs3kkbhwL9Ab7Hrsmuj+Smw==", + "dev": true, + "peer": true + }, + "node_modules/to-fast-properties": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz", + "integrity": "sha512-/OaKK0xYrs3DmxRYqL/yDc+FxFUVYhDlXMhRmv3z915w2HF1tnN1omB354j8VUGO/hbRzyD6Y3sA7v7GS/ceog==", + "dev": true, + "peer": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dev": true, + "peer": true, + "dependencies": { + "is-number": "^7.0.0" + }, + "engines": { + "node": ">=8.0" + } + }, "node_modules/tr46": { "version": "0.0.3", "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==" }, + "node_modules/ts-jest": { + "version": "29.2.3", + "resolved": "https://registry.npmjs.org/ts-jest/-/ts-jest-29.2.3.tgz", + "integrity": "sha512-yCcfVdiBFngVz9/keHin9EnsrQtQtEu3nRykNy9RVp+FiPFFbPJ3Sg6Qg4+TkmH0vMP5qsTKgXSsk80HRwvdgQ==", + "dev": true, + "dependencies": { + "bs-logger": "0.x", + "ejs": "^3.1.10", + "fast-json-stable-stringify": "2.x", + "jest-util": "^29.0.0", + "json5": "^2.2.3", + "lodash.memoize": "4.x", + "make-error": "1.x", + "semver": "^7.5.3", + "yargs-parser": "^21.0.1" + }, + "bin": { + "ts-jest": "cli.js" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || ^18.0.0 || >=20.0.0" + }, + "peerDependencies": { + "@babel/core": ">=7.0.0-beta.0 <8", + "@jest/transform": "^29.0.0", + "@jest/types": "^29.0.0", + "babel-jest": "^29.0.0", + "jest": "^29.0.0", + "typescript": ">=4.3 <6" + }, + "peerDependenciesMeta": { + "@babel/core": { + "optional": true + }, + "@jest/transform": { + "optional": true + }, + "@jest/types": { + "optional": true + }, + "babel-jest": { + "optional": true + }, + "esbuild": { + "optional": true + } + } + }, + "node_modules/ts-jest/node_modules/semver": { + "version": "7.6.3", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.3.tgz", + "integrity": "sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A==", + "dev": true, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/ts-node": { + "version": "10.9.2", + "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.2.tgz", + "integrity": "sha512-f0FFpIdcHgn8zcPSbf1dRevwt047YMnaiJM3u2w2RewrB+fob/zePZcrOyQoLMMO7aBIddLcQIEK5dYjkLnGrQ==", + "dev": true, + "dependencies": { + "@cspotcode/source-map-support": "^0.8.0", + "@tsconfig/node10": "^1.0.7", + "@tsconfig/node12": "^1.0.7", + "@tsconfig/node14": "^1.0.0", + "@tsconfig/node16": "^1.0.2", + "acorn": "^8.4.1", + "acorn-walk": "^8.1.1", + "arg": "^4.1.0", + "create-require": "^1.1.0", + "diff": "^4.0.1", + "make-error": "^1.1.1", + "v8-compile-cache-lib": "^3.0.1", + "yn": "3.1.1" + }, + "bin": { + "ts-node": "dist/bin.js", + "ts-node-cwd": "dist/bin-cwd.js", + "ts-node-esm": "dist/bin-esm.js", + "ts-node-script": "dist/bin-script.js", + "ts-node-transpile-only": "dist/bin-transpile.js", + "ts-script": "dist/bin-script-deprecated.js" + }, + "peerDependencies": { + "@swc/core": ">=1.2.50", + "@swc/wasm": ">=1.2.50", + "@types/node": "*", + "typescript": ">=2.7" + }, + "peerDependenciesMeta": { + "@swc/core": { + "optional": true + }, + "@swc/wasm": { + "optional": true + } + } + }, "node_modules/tslib": { "version": "2.6.3", "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.3.tgz", "integrity": "sha512-xNvxJEOUiWPGhUuUdQgAJPKOOJfGnIyKySOc09XkKsgdUV/3E2zvwZYdejjmRgPCgcym1juLH3226yA7sEFJKQ==" }, + "node_modules/type-detect": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", + "integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==", + "dev": true, + "peer": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/type-fest": { + "version": "0.21.3", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.21.3.tgz", + "integrity": "sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w==", + "dev": true, + "peer": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/typescript": { + "version": "5.5.4", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.5.4.tgz", + "integrity": "sha512-Mtq29sKDAEYP7aljRgtPOpTvOfbwRWlS6dPRzwjdE+C0R4brX/GUyhHSecbHMFLNBLcJIPt9nl9yG5TZ1weH+Q==", + "dev": true, + "peer": true, + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" + } + }, "node_modules/undici-types": { "version": "5.26.5", "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==" }, + "node_modules/update-browserslist-db": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.1.0.tgz", + "integrity": "sha512-EdRAaAyk2cUE1wOf2DkEhzxqOQvFOoRJFNS6NeyJ01Gp2beMRpBAINjM2iDXE3KCuKhwnvHIQCJm6ThL2Z+HzQ==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/browserslist" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "peer": true, + "dependencies": { + "escalade": "^3.1.2", + "picocolors": "^1.0.1" + }, + "bin": { + "update-browserslist-db": "cli.js" + }, + "peerDependencies": { + "browserslist": ">= 4.21.0" + } + }, + "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", + "integrity": "sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==", + "dev": true + }, + "node_modules/v8-to-istanbul": { + "version": "9.3.0", + "resolved": "https://registry.npmjs.org/v8-to-istanbul/-/v8-to-istanbul-9.3.0.tgz", + "integrity": "sha512-kiGUalWN+rgBJ/1OHZsBtU4rXZOfj/7rKQxULKlIzwzQSvMJUUNgPwJEEh7gU6xEVxC0ahoOBvN2YI8GH6FNgA==", + "dev": true, + "peer": true, + "dependencies": { + "@jridgewell/trace-mapping": "^0.3.12", + "@types/istanbul-lib-coverage": "^2.0.1", + "convert-source-map": "^2.0.0" + }, + "engines": { + "node": ">=10.12.0" + } + }, + "node_modules/walker": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/walker/-/walker-1.0.8.tgz", + "integrity": "sha512-ts/8E8l5b7kY0vlWLewOkDXMmPdLcVV4GmOQLyxuSswIJsweeFZtAsMF7k1Nszz+TYBQrlYRmzOnr398y1JemQ==", + "dev": true, + "peer": true, + "dependencies": { + "makeerror": "1.0.12" + } + }, "node_modules/web-streams-polyfill": { "version": "3.3.3", "resolved": "https://registry.npmjs.org/web-streams-polyfill/-/web-streams-polyfill-3.3.3.tgz", @@ -534,6 +4376,127 @@ "webidl-conversions": "^3.0.0" } }, + "node_modules/which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" + } + }, + "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, + "peer": true, + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, + "node_modules/wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", + "dev": true, + "peer": true + }, + "node_modules/write-file-atomic": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-4.0.2.tgz", + "integrity": "sha512-7KxauUdBmSdWnmpaGFg+ppNjKF8uNLry8LyzjauQDOVONfFLNKrKvQOxZ/VuTIcS/gge/YNahf5RIIQWTSarlg==", + "dev": true, + "peer": true, + "dependencies": { + "imurmurhash": "^0.1.4", + "signal-exit": "^3.0.7" + }, + "engines": { + "node": "^12.13.0 || ^14.15.0 || >=16.0.0" + } + }, + "node_modules/y18n": { + "version": "5.0.8", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", + "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", + "dev": true, + "peer": true, + "engines": { + "node": ">=10" + } + }, + "node_modules/yallist": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", + "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==", + "dev": true, + "peer": true + }, + "node_modules/yargs": { + "version": "17.7.2", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz", + "integrity": "sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==", + "dev": true, + "peer": true, + "dependencies": { + "cliui": "^8.0.1", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "require-directory": "^2.1.1", + "string-width": "^4.2.3", + "y18n": "^5.0.5", + "yargs-parser": "^21.1.1" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/yargs-parser": { + "version": "21.1.1", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz", + "integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==", + "dev": true, + "engines": { + "node": ">=12" + } + }, + "node_modules/yn": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz", + "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/yocto-queue": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", + "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", + "dev": true, + "peer": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/zod": { "version": "3.23.8", "resolved": "https://registry.npmjs.org/zod/-/zod-3.23.8.tgz", diff --git a/packages/openai-adapters/package.json b/packages/openai-adapters/package.json index ea8b61e9e..48084a364 100644 --- a/packages/openai-adapters/package.json +++ b/packages/openai-adapters/package.json @@ -1,12 +1,12 @@ { "name": "@continuedev/openai-adapters", - "version": "1.0.5", + "version": "1.0.8", "description": "", "main": "dist/index.js", "types": "dist/index.d.ts", "type": "module", "scripts": { - "test": "echo \"Error: no test specified\" && exit 1", + "test": "cross-env NODE_OPTIONS=--experimental-vm-modules jest", "build": "tsc" }, "author": "Nate Sesti and Ty Dunn", @@ -14,11 +14,14 @@ "dependencies": { "@azure/openai": "^1.0.0-beta.12", "@continuedev/config-types": "^1.0.5", - "@continuedev/fetch": "^1.0.1", + "@continuedev/fetch": "^1.0.3", "node-fetch": "^3.3.2", "openai": "^4.52.5" }, "devDependencies": { - "@types/follow-redirects": "^1.14.4" + "@types/follow-redirects": "^1.14.4", + "cross-env": "^7.0.3", + "ts-jest": "^29.2.3", + "ts-node": "^10.9.2" } } diff --git a/packages/openai-adapters/src/apis/Anthropic.ts b/packages/openai-adapters/src/apis/Anthropic.ts new file mode 100644 index 000000000..4ae4d6c2e --- /dev/null +++ b/packages/openai-adapters/src/apis/Anthropic.ts @@ -0,0 +1,184 @@ +import { streamSse } from "@continuedev/fetch"; +import fetch from "node-fetch"; +import { OpenAI } from "openai/index.mjs"; +import { + ChatCompletion, + ChatCompletionChunk, + ChatCompletionCreateParamsNonStreaming, + ChatCompletionCreateParamsStreaming, + Completion, + CompletionCreateParamsNonStreaming, + CompletionCreateParamsStreaming, +} from "openai/resources/index.mjs"; +import { ChatCompletionCreateParams } from "openai/src/resources/index.js"; +import { LlmApiConfig } from "../index.js"; +import { + BaseLlmApi, + CreateRerankResponse, + FimCreateParamsStreaming, + RerankCreateParams, +} from "./base.js"; + +export class AnthropicApi implements BaseLlmApi { + apiBase: string = "https://api.anthropic.com/v1/"; + + constructor(protected config: LlmApiConfig) { + this.apiBase = config.apiBase ?? this.apiBase; + if (!this.apiBase.endsWith("/")) { + this.apiBase += "/"; + } + } + + private _convertBody(oaiBody: ChatCompletionCreateParams) { + let stop = undefined; + if (oaiBody.stop && Array.isArray(oaiBody.stop)) { + stop = oaiBody.stop.filter((x) => x.trim() !== ""); + } else if (typeof oaiBody.stop === "string" && oaiBody.stop.trim() !== "") { + stop = [oaiBody.stop]; + } + const anthropicBody = { + messages: this._convertMessages( + oaiBody.messages.filter((msg) => msg.role !== "system"), + ), + system: oaiBody.messages.find((msg) => msg.role === "system")?.content, + top_p: oaiBody.top_p, + temperature: oaiBody.temperature, + max_tokens: oaiBody.max_tokens ?? 4096, // max_tokens is required + model: oaiBody.model, + stop_sequences: stop, + stream: oaiBody.stream, + }; + + return anthropicBody; + } + + private _convertMessages( + msgs: OpenAI.Chat.Completions.ChatCompletionMessageParam[], + ): any[] { + const messages = msgs.map((message) => { + if (!Array.isArray(message.content)) { + return message; + } + return { + ...message, + content: message.content.map((part) => { + if (part.type === "text") { + return part; + } + return { + type: "image", + source: { + type: "base64", + media_type: "image/jpeg", + data: part.image_url.url.split(",")[1], + }, + }; + }), + }; + }); + return messages; + } + + async chatCompletionNonStream( + body: ChatCompletionCreateParamsNonStreaming, + ): Promise { + const response = await fetch(new URL("messages", this.apiBase), { + method: "POST", + headers: { + "Content-Type": "application/json", + Accept: "application/json", + "anthropic-version": "2023-06-01", + "x-api-key": this.config.apiKey, + }, + body: JSON.stringify(this._convertBody(body)), + }); + + const completion = (await response.json()) as any; + return { + id: completion.id, + object: "chat.completion", + model: body.model, + created: Date.now(), + usage: { + total_tokens: + completion.usage.input_tokens + completion.usage.output_tokens, + completion_tokens: completion.usage.output_tokens, + prompt_tokens: completion.usage.input_tokens, + }, + choices: [ + { + logprobs: null, + finish_reason: "stop", + message: { + role: "assistant", + content: completion.content[0].text, + }, + index: 0, + }, + ], + }; + } + async *chatCompletionStream( + body: ChatCompletionCreateParamsStreaming, + ): AsyncGenerator { + body.messages; + const response = await fetch(new URL("messages", this.apiBase), { + method: "POST", + headers: { + "Content-Type": "application/json", + Accept: "application/json", + "anthropic-version": "2023-06-01", + "x-api-key": this.config.apiKey, + }, + body: JSON.stringify(this._convertBody(body)), + }); + + for await (const value of streamSse(response as any)) { + if (value.delta?.text) { + yield { + id: value.id, + object: "chat.completion.chunk", + model: body.model, + created: Date.now(), + choices: [ + { + index: 0, + logprobs: undefined, + finish_reason: null, + delta: { + role: "assistant", + content: value.delta.text, + }, + }, + ], + usage: undefined, + }; + } + } + } + async completionNonStream( + body: CompletionCreateParamsNonStreaming, + ): Promise { + throw new Error("Method not implemented."); + } + async *completionStream( + body: CompletionCreateParamsStreaming, + ): AsyncGenerator { + throw new Error("Method not implemented."); + } + async *fimStream( + body: FimCreateParamsStreaming, + ): AsyncGenerator { + throw new Error("Method not implemented."); + } + + async embed( + body: OpenAI.Embeddings.EmbeddingCreateParams, + ): Promise { + throw new Error("Method not implemented."); + } + + async rerank(body: RerankCreateParams): Promise { + throw new Error("Method not implemented."); + } +} diff --git a/packages/openai-adapters/src/apis/AzureOpenAI.ts b/packages/openai-adapters/src/apis/AzureOpenAI.ts index c8927878c..6d74c029f 100644 --- a/packages/openai-adapters/src/apis/AzureOpenAI.ts +++ b/packages/openai-adapters/src/apis/AzureOpenAI.ts @@ -1,6 +1,5 @@ import { AzureKeyCredential, OpenAIClient } from "@azure/openai"; -import { ModelDescription } from "@continuedev/config-types/src/index.js"; import dotenv from "dotenv"; import { Completion, @@ -12,8 +11,16 @@ import { ChatCompletionChunk, ChatCompletionCreateParamsNonStreaming, ChatCompletionCreateParamsStreaming, + CreateEmbeddingResponse, + EmbeddingCreateParams, } from "openai/resources/index.js"; -import { BaseLlmApi, FimCreateParamsStreaming } from "./base.js"; +import { LlmApiConfig } from "../index.js"; +import { + BaseLlmApi, + CreateRerankResponse, + FimCreateParamsStreaming, + RerankCreateParams, +} from "./base.js"; dotenv.config(); @@ -24,9 +31,9 @@ const MS_TOKEN = 30; export class AzureOpenAIApi implements BaseLlmApi { private client: OpenAIClient; - private config: ModelDescription; + private config: LlmApiConfig; - constructor(config: ModelDescription) { + constructor(config: LlmApiConfig) { this.config = config; let proxyOptions; const PROXY = HTTPS_PROXY ?? HTTP_PROXY; @@ -71,14 +78,14 @@ export class AzureOpenAIApi implements BaseLlmApi { body: ChatCompletionCreateParamsNonStreaming, ): Promise { const completion = await this.client.getChatCompletions( - this.config.model, + body.model, body.messages, this._bodyToOptions(body), ); return { ...completion, object: "chat.completion", - model: this.config.model, + model: body.model, created: completion.created.getTime(), usage: completion.usage ? { @@ -102,7 +109,7 @@ export class AzureOpenAIApi implements BaseLlmApi { body: ChatCompletionCreateParamsStreaming, ): AsyncGenerator { const events = await this.client.streamChatCompletions( - this.config.model, + body.model, body.messages, this._bodyToOptions(body), ); @@ -116,7 +123,7 @@ export class AzureOpenAIApi implements BaseLlmApi { eventBuffer.push({ ...event, object: "chat.completion.chunk", - model: this.config.model, + model: body.model, created: event.created.getTime(), choices: event.choices.map((choice: any) => ({ ...choice, @@ -217,4 +224,31 @@ export class AzureOpenAIApi implements BaseLlmApi { "Azure OpenAI does not support fill-in-the-middle (FIM) completions.", ); } + + async embed(body: EmbeddingCreateParams): Promise { + const input = typeof body.input === "string" ? [body.input] : body.input; + const response = await this.client.getEmbeddings(body.model, input as any, { + dimensions: body.dimensions, + model: body.model, + }); + + const output = { + data: response.data.map((item) => ({ + ...item, + object: "embedding" as const, + })), + model: body.model, + object: "list" as const, + usage: { + prompt_tokens: response.usage.promptTokens, + total_tokens: response.usage.totalTokens, + }, + }; + + return output; + } + + async rerank(body: RerankCreateParams): Promise { + throw new Error("Azure OpenAI does not support reranking."); + } } diff --git a/packages/openai-adapters/src/apis/Cohere.ts b/packages/openai-adapters/src/apis/Cohere.ts new file mode 100644 index 000000000..589fdb1c5 --- /dev/null +++ b/packages/openai-adapters/src/apis/Cohere.ts @@ -0,0 +1,212 @@ +import { streamJSON } from "@continuedev/fetch"; +import fetch from "node-fetch"; +import { OpenAI } from "openai/index.mjs"; +import { + ChatCompletion, + ChatCompletionChunk, + ChatCompletionCreateParams, + ChatCompletionCreateParamsNonStreaming, + ChatCompletionCreateParamsStreaming, + Completion, + CompletionCreateParamsNonStreaming, + CompletionCreateParamsStreaming, + CreateEmbeddingResponse, + EmbeddingCreateParams, +} from "openai/resources/index.mjs"; +import { LlmApiConfig } from "../index.js"; +import { + BaseLlmApi, + CreateRerankResponse, + FimCreateParamsStreaming, + RerankCreateParams, +} from "./base.js"; + +export class CohereApi implements BaseLlmApi { + apiBase: string = "https://api.cohere.com/v1"; + + static maxStopSequences = 5; + + constructor(protected config: LlmApiConfig) { + this.apiBase = config.apiBase ?? this.apiBase; + if (!this.apiBase.endsWith("/")) { + this.apiBase += "/"; + } + } + + private _convertMessages( + msgs: OpenAI.Chat.Completions.ChatCompletionMessageParam[], + ): any[] { + return msgs.map((m) => ({ + role: m.role === "assistant" ? "CHATBOT" : "USER", + message: m.content, + })); + } + + private _convertBody(oaiBody: ChatCompletionCreateParams) { + return { + message: oaiBody.messages.pop()?.content, + chat_history: this._convertMessages( + oaiBody.messages.filter((msg) => msg.role !== "system"), + ), + preamble: oaiBody.messages.find((msg) => msg.role === "system")?.content, + model: oaiBody.model, + stream: oaiBody.stream, + temperature: oaiBody.temperature, + max_tokens: oaiBody.max_tokens, + p: oaiBody.top_p, + stop_sequences: oaiBody.stop?.slice(0, CohereApi.maxStopSequences), + frequency_penalty: oaiBody.frequency_penalty, + presence_penalty: oaiBody.presence_penalty, + }; + } + + async chatCompletionNonStream( + body: ChatCompletionCreateParamsNonStreaming, + ): Promise { + const headers = { + "Content-Type": "application/json", + Authorization: `Bearer ${this.config.apiKey}`, + }; + + const resp = await fetch(new URL("chat", this.apiBase), { + method: "POST", + headers, + body: JSON.stringify(this._convertBody(body)), + }); + + const data = (await resp.json()) as any; + const { input_tokens, output_tokens } = data.meta.tokens; + return { + id: data.id, + object: "chat.completion", + model: body.model, + created: Date.now(), + usage: { + total_tokens: input_tokens + output_tokens, + completion_tokens: output_tokens, + prompt_tokens: input_tokens, + }, + choices: [ + { + logprobs: null, + finish_reason: "stop", + message: { + role: "assistant", + content: data.text, + }, + index: 0, + }, + ], + }; + } + + async *chatCompletionStream( + body: ChatCompletionCreateParamsStreaming, + ): AsyncGenerator { + const headers = { + "Content-Type": "application/json", + Authorization: `Bearer ${this.config.apiKey}`, + }; + + const resp = await fetch(new URL("chat", this.apiBase), { + method: "POST", + headers, + body: JSON.stringify(this._convertBody(body)), + }); + + for await (const value of streamJSON(resp as any)) { + if (value.event_type === "text-generation") { + yield { + id: value.id, + object: "chat.completion.chunk", + model: body.model, + created: Date.now(), + choices: [ + { + index: 0, + logprobs: undefined, + finish_reason: null, + delta: { + role: "assistant", + content: value.text, + }, + }, + ], + usage: undefined, + }; + } + } + } + completionNonStream( + body: CompletionCreateParamsNonStreaming, + ): Promise { + throw new Error("Method not implemented."); + } + completionStream( + body: CompletionCreateParamsStreaming, + ): AsyncGenerator { + throw new Error("Method not implemented."); + } + fimStream( + body: FimCreateParamsStreaming, + ): AsyncGenerator { + throw new Error("Method not implemented."); + } + async rerank(body: RerankCreateParams): Promise { + const endpoint = new URL("rerank", this.apiBase); + const response = await fetch(endpoint, { + method: "POST", + body: JSON.stringify(body), + headers: { + "Content-Type": "application/json", + Accept: "application/json", + "x-api-key": this.config.apiKey ?? "", + Authorization: `Bearer ${this.config.apiKey}`, + }, + }); + const data = (await response.json()) as any; + return { + object: "list", + data: data.results.map((result: any) => ({ + index: result.index, + relevance_score: result.relevance_score, + })), + model: body.model, + usage: { + total_tokens: 0, + }, + }; + } + + async embed(body: EmbeddingCreateParams): Promise { + const url = new URL("/embed", this.apiBase); + const texts = typeof body.input === "string" ? [body.input] : body.input; + const response = await fetch(url, { + method: "POST", + headers: { + "Content-Type": "application/json", + Authorization: `Bearer ${this.config.apiKey}`, + }, + body: JSON.stringify({ + texts, + model: body.model, + input_type: "search_document", + }), + }); + const data = (await response.json()) as any; + + return { + object: "list", + model: body.model, + usage: { + total_tokens: 0, + prompt_tokens: 0, + }, + data: data.embeddings.map((embedding: any, index: number) => ({ + object: "embedding", + index, + embedding, + })), + }; + } +} diff --git a/packages/openai-adapters/src/apis/DeepSeek.ts b/packages/openai-adapters/src/apis/DeepSeek.ts new file mode 100644 index 000000000..5ff6e41d5 --- /dev/null +++ b/packages/openai-adapters/src/apis/DeepSeek.ts @@ -0,0 +1,57 @@ +import { streamSse } from "@continuedev/fetch"; +import fetch from "node-fetch"; +import { ChatCompletionChunk } from "openai/resources/index.mjs"; +import { LlmApiConfig } from "../index.js"; +import { OpenAIApi } from "./OpenAI.js"; +import { FimCreateParamsStreaming } from "./base.js"; + +export class DeepSeekApi extends OpenAIApi { + constructor(config: LlmApiConfig) { + super(config); + this.apiBase = "https://api.deepseek.com/"; + } + async *fimStream( + body: FimCreateParamsStreaming, + ): AsyncGenerator { + const endpoint = new URL("beta/completions", this.apiBase); + const resp = await fetch(endpoint, { + method: "POST", + body: JSON.stringify({ + model: body.model, + prompt: body.prompt, + suffix: body.suffix, + max_tokens: body.max_tokens, + temperature: body.temperature, + top_p: body.top_p, + frequency_penalty: body.frequency_penalty, + presence_penalty: body.presence_penalty, + stop: body.stop, + stream: true, + }), + headers: { + "Content-Type": "application/json", + Accept: "application/json", + Authorization: `Bearer ${this.config.apiKey}`, + }, + }); + for await (const chunk of streamSse(resp as any)) { + yield { + choices: [ + { + delta: { + content: chunk.choices[0].text, + role: "assistant", + }, + finish_reason: chunk.finish_reason, + index: 0, + logprobs: null, + }, + ], + created: Date.now(), + id: "", + model: body.model, + object: "chat.completion.chunk", + }; + } + } +} diff --git a/packages/openai-adapters/src/apis/Gemini.ts b/packages/openai-adapters/src/apis/Gemini.ts new file mode 100644 index 000000000..d4f5e67be --- /dev/null +++ b/packages/openai-adapters/src/apis/Gemini.ts @@ -0,0 +1,270 @@ +import { streamResponse } from "@continuedev/fetch"; +import fetch from "node-fetch"; +import { OpenAI } from "openai/index.mjs"; +import { + ChatCompletion, + ChatCompletionChunk, + ChatCompletionCreateParams, + ChatCompletionCreateParamsNonStreaming, + ChatCompletionCreateParamsStreaming, + Completion, + CompletionCreateParamsNonStreaming, + CompletionCreateParamsStreaming, + CreateEmbeddingResponse, + EmbeddingCreateParams, +} from "openai/resources/index.mjs"; +import { LlmApiConfig } from "../index.js"; +import { + BaseLlmApi, + CreateRerankResponse, + FimCreateParamsStreaming, + RerankCreateParams, +} from "./base.js"; + +export class GeminiApi implements BaseLlmApi { + apiBase: string = "https://generativelanguage.googleapis.com/v1beta/"; + + static maxStopSequences = 5; + + constructor(protected config: LlmApiConfig) { + this.apiBase = config.apiBase ?? this.apiBase; + if (!this.apiBase.endsWith("/")) { + this.apiBase += "/"; + } + } + + private _convertMessages( + msgs: OpenAI.Chat.Completions.ChatCompletionMessageParam[], + ): any[] { + return msgs.map((m) => ({ + role: m.role === "assistant" ? "CHATBOT" : "USER", + message: m.content, + })); + } + + private _oaiPartToGeminiPart( + part: OpenAI.Chat.Completions.ChatCompletionContentPart, + ) { + return part.type === "text" + ? { + text: part.text, + } + : { + inlineData: { + mimeType: "image/jpeg", + data: part.image_url?.url.split(",")[1], + }, + }; + } + + private _convertBody(oaiBody: ChatCompletionCreateParams, url: string) { + const generationConfig: any = {}; + + if (oaiBody.top_p) { + generationConfig.topP = oaiBody.top_p; + } + if (oaiBody.temperature !== undefined && oaiBody.temperature !== null) { + generationConfig.temperature = oaiBody.temperature; + } + if (oaiBody.max_tokens) { + generationConfig.maxOutputTokens = oaiBody.max_tokens; + } + if (oaiBody.stop) { + const stop = Array.isArray(oaiBody.stop) ? oaiBody.stop : [oaiBody.stop]; + generationConfig.stopSequences = stop.filter((x) => x.trim() !== ""); + } + + const isV1API = url.includes("/v1/"); + const contents = oaiBody.messages + .map((msg) => { + if (msg.role === "system" && !isV1API) { + return null; // Don't include system message in contents + } + if (!msg.content) { + return null; + } + + return { + role: msg.role === "assistant" ? "model" : "user", + parts: + typeof msg.content === "string" + ? [{ text: msg.content }] + : msg.content.map(this._oaiPartToGeminiPart), + }; + }) + .filter((c) => c !== null); + + const sysMsg = oaiBody.messages.find((msg) => msg.role === "system"); + const finalBody = { + generationConfig, + contents, + // if this.systemMessage is defined, reformat it for Gemini API + ...(sysMsg && + !isV1API && { + systemInstruction: { parts: [{ text: sysMsg.content }] }, + }), + }; + return finalBody; + } + + async chatCompletionNonStream( + body: ChatCompletionCreateParamsNonStreaming, + ): Promise { + let completion = ""; + for await (const chunk of this.chatCompletionStream({ + ...body, + stream: true, + })) { + completion += chunk.choices[0].delta.content; + } + return { + id: "", + object: "chat.completion", + model: body.model, + created: Date.now(), + choices: [ + { + index: 0, + logprobs: null, + finish_reason: "stop", + message: { + role: "assistant", + content: completion, + }, + }, + ], + usage: undefined, + }; + } + + async *chatCompletionStream( + body: ChatCompletionCreateParamsStreaming, + ): AsyncGenerator { + const apiURL = new URL( + `models/${body.model}:streamGenerateContent?key=${this.config.apiKey}`, + this.apiBase, + ).toString(); + const resp = await fetch(apiURL, { + method: "POST", + body: JSON.stringify(this._convertBody(body, apiURL)), + }); + + let buffer = ""; + for await (const chunk of streamResponse(resp as any)) { + buffer += chunk; + if (buffer.startsWith("[")) { + buffer = buffer.slice(1); + } + if (buffer.endsWith("]")) { + buffer = buffer.slice(0, -1); + } + if (buffer.startsWith(",")) { + buffer = buffer.slice(1); + } + + const parts = buffer.split("\n,"); + + let foundIncomplete = false; + for (let i = 0; i < parts.length; i++) { + const part = parts[i]; + let data; + try { + data = JSON.parse(part); + } catch (e) { + foundIncomplete = true; + continue; // yo! + } + if (data.error) { + throw new Error(data.error.message); + } + // Check for existence of each level before accessing the final 'text' property + if (data?.candidates?.[0]?.content?.parts?.[0]?.text) { + yield { + id: "", + object: "chat.completion.chunk", + model: body.model, + created: Date.now(), + choices: [ + { + index: 0, + logprobs: undefined, + finish_reason: null, + delta: { + role: "assistant", + content: data.candidates[0].content.parts[0].text, + }, + }, + ], + usage: undefined, + }; + } else { + // Handle the case where the expected data structure is not found + console.warn("Unexpected response format:", data); + } + } + if (foundIncomplete) { + buffer = parts[parts.length - 1]; + } else { + buffer = ""; + } + } + } + completionNonStream( + body: CompletionCreateParamsNonStreaming, + ): Promise { + throw new Error("Method not implemented."); + } + completionStream( + body: CompletionCreateParamsStreaming, + ): AsyncGenerator { + throw new Error("Method not implemented."); + } + fimStream( + body: FimCreateParamsStreaming, + ): AsyncGenerator { + throw new Error("Method not implemented."); + } + async rerank(body: RerankCreateParams): Promise { + throw new Error("Method not implemented."); + } + + async embed(body: EmbeddingCreateParams): Promise { + const inputs = Array.isArray(body.input) ? body.input : [body.input]; + const response = await fetch( + new URL(`${body.model}:batchEmbedContents`, this.apiBase), + { + method: "POST", + body: JSON.stringify({ + requests: inputs.map((input) => ({ + model: body.model, + content: { + role: "user", + parts: [{ text: input }], + }, + })), + }), + headers: { + // eslint-disable-next-line @typescript-eslint/naming-convention + "x-goog-api-key": this.config.apiKey, + // eslint-disable-next-line @typescript-eslint/naming-convention + "Content-Type": "application/json", + }, + }, + ); + + const data = (await response.json()) as any; + return { + object: "list", + model: body.model, + usage: { + total_tokens: 0, + prompt_tokens: 0, + }, + data: data.embeddings.map((embedding: any, index: number) => ({ + object: "embedding", + index, + embedding: embedding.values, + })), + }; + } +} diff --git a/packages/openai-adapters/src/apis/Jina.ts b/packages/openai-adapters/src/apis/Jina.ts new file mode 100644 index 000000000..7d5e2a40a --- /dev/null +++ b/packages/openai-adapters/src/apis/Jina.ts @@ -0,0 +1,87 @@ +import fetch from "node-fetch"; +import { OpenAI } from "openai/index.mjs"; +import { + ChatCompletion, + ChatCompletionChunk, + ChatCompletionCreateParamsNonStreaming, + ChatCompletionCreateParamsStreaming, + Completion, + CompletionCreateParamsNonStreaming, + CompletionCreateParamsStreaming, +} from "openai/resources/index.mjs"; +import { LlmApiConfig } from "../index.js"; +import { + BaseLlmApi, + CreateRerankResponse, + FimCreateParamsStreaming, + RerankCreateParams, +} from "./base.js"; + +export class JinaApi implements BaseLlmApi { + apiBase: string = "https://api.jina.ai/v1/"; + + constructor(protected config: LlmApiConfig) { + this.apiBase = config.apiBase ?? this.apiBase; + if (!this.apiBase.endsWith("/")) { + this.apiBase += "/"; + } + } + + async chatCompletionNonStream( + body: ChatCompletionCreateParamsNonStreaming, + ): Promise { + throw new Error("Method not implemented."); + } + async *chatCompletionStream( + body: ChatCompletionCreateParamsStreaming, + ): AsyncGenerator { + throw new Error("Method not implemented."); + } + async completionNonStream( + body: CompletionCreateParamsNonStreaming, + ): Promise { + throw new Error("Method not implemented."); + } + async *completionStream( + body: CompletionCreateParamsStreaming, + ): AsyncGenerator { + throw new Error("Method not implemented."); + } + async *fimStream( + body: FimCreateParamsStreaming, + ): AsyncGenerator { + throw new Error("Method not implemented."); + } + + async embed( + body: OpenAI.Embeddings.EmbeddingCreateParams, + ): Promise { + throw new Error("Method not implemented."); + } + + async rerank(body: RerankCreateParams): Promise { + const endpoint = new URL("rerank", this.apiBase); + const response = await fetch(endpoint, { + method: "POST", + body: JSON.stringify(body), + headers: { + "Content-Type": "application/json", + Accept: "application/json", + "x-api-key": this.config.apiKey ?? "", + Authorization: `Bearer ${this.config.apiKey}`, + }, + }); + const data = (await response.json()) as any; + return { + object: "list", + data: data.results.map((result: any) => ({ + index: result.index, + relevance_score: result.relevance_score, + })), + model: body.model, + usage: { + total_tokens: 0, + }, + }; + } +} diff --git a/packages/openai-adapters/src/apis/OpenAI.ts b/packages/openai-adapters/src/apis/OpenAI.ts index 0f6ffb204..c9e3b1d98 100644 --- a/packages/openai-adapters/src/apis/OpenAI.ts +++ b/packages/openai-adapters/src/apis/OpenAI.ts @@ -1,4 +1,3 @@ -import { ModelDescription } from "@continuedev/config-types"; import { streamSse } from "@continuedev/fetch"; import fetch from "node-fetch"; import { OpenAI } from "openai/index.mjs"; @@ -11,14 +10,26 @@ import { CompletionCreateParamsNonStreaming, CompletionCreateParamsStreaming, } from "openai/resources/index.mjs"; -import { BaseLlmApi, FimCreateParamsStreaming } from "./base.js"; +import { LlmApiConfig } from "../index.js"; +import { + BaseLlmApi, + CreateRerankResponse, + FimCreateParamsStreaming, + RerankCreateParams, +} from "./base.js"; export class OpenAIApi implements BaseLlmApi { openai: OpenAI; - constructor(protected config: ModelDescription) { + apiBase: string = "https://api.openai.com/v1/"; + + constructor(protected config: LlmApiConfig) { + this.apiBase = config.apiBase ?? this.apiBase; + if (!this.apiBase.endsWith("/")) { + this.apiBase += "/"; + } this.openai = new OpenAI({ apiKey: config.apiKey, - baseURL: config.apiBase, + baseURL: this.apiBase, }); } @@ -53,7 +64,7 @@ export class OpenAIApi implements BaseLlmApi { async *fimStream( body: FimCreateParamsStreaming, ): AsyncGenerator { - const endpoint = new URL("fim/completions", this.config.apiBase); + const endpoint = new URL("fim/completions", this.apiBase); const resp = await fetch(endpoint, { method: "POST", body: JSON.stringify({ @@ -81,4 +92,27 @@ export class OpenAIApi implements BaseLlmApi { } } } + + async embed( + body: OpenAI.Embeddings.EmbeddingCreateParams, + ): Promise { + const response = await this.openai.embeddings.create(body); + return response; + } + + async rerank(body: RerankCreateParams): Promise { + const endpoint = new URL("rerank", this.apiBase); + const response = await fetch(endpoint, { + method: "POST", + body: JSON.stringify(body), + headers: { + "Content-Type": "application/json", + Accept: "application/json", + "x-api-key": this.config.apiKey ?? "", + Authorization: `Bearer ${this.config.apiKey}`, + }, + }); + const data = await response.json(); + return data as any; + } } diff --git a/packages/openai-adapters/src/apis/base.ts b/packages/openai-adapters/src/apis/base.ts index 2cb31fdfb..ee812b8e4 100644 --- a/packages/openai-adapters/src/apis/base.ts +++ b/packages/openai-adapters/src/apis/base.ts @@ -6,6 +6,8 @@ import { Completion, CompletionCreateParamsNonStreaming, CompletionCreateParamsStreaming, + CreateEmbeddingResponse, + EmbeddingCreateParams, } from "openai/resources/index.mjs"; export interface FimCreateParamsStreaming @@ -13,6 +15,27 @@ export interface FimCreateParamsStreaming suffix: string; } +export interface RerankCreateParams { + query: string; + documents: string[]; + model: string; + top_k?: number; +} + +export interface CreateRerankItem { + relevance_score: number; + index: number; +} + +export interface CreateRerankResponse { + object: "list"; + data: CreateRerankItem[]; + model: string; + usage: { + total_tokens: number; + }; +} + export interface BaseLlmApi { // Chat, no stream chatCompletionNonStream( @@ -38,4 +61,10 @@ export interface BaseLlmApi { fimStream( body: FimCreateParamsStreaming, ): AsyncGenerator; + + // Embeddings + embed(body: EmbeddingCreateParams): Promise; + + // Reranking + rerank(body: RerankCreateParams): Promise; } diff --git a/packages/openai-adapters/src/index.ts b/packages/openai-adapters/src/index.ts index 198ecfab7..8882ad42a 100644 --- a/packages/openai-adapters/src/index.ts +++ b/packages/openai-adapters/src/index.ts @@ -1,12 +1,23 @@ -import { ModelDescription } from "@continuedev/config-types/src/index.js"; import dotenv from "dotenv"; +import { AnthropicApi } from "./apis/Anthropic.js"; import { AzureOpenAIApi } from "./apis/AzureOpenAI.js"; -import { OpenAIApi } from "./apis/OpenAI.js"; import { BaseLlmApi } from "./apis/base.js"; +import { CohereApi } from "./apis/Cohere.js"; +import { DeepSeekApi } from "./apis/DeepSeek.js"; +import { GeminiApi } from "./apis/Gemini.js"; +import { JinaApi } from "./apis/Jina.js"; +import { OpenAIApi } from "./apis/OpenAI.js"; dotenv.config(); -export function constructLlmApi(config: ModelDescription): BaseLlmApi { +export interface LlmApiConfig { + provider: string; + model: string; + apiKey: string; + apiBase?: string; +} + +export function constructLlmApi(config: LlmApiConfig): BaseLlmApi { switch (config.provider) { case "openai": return new OpenAIApi(config); @@ -17,6 +28,41 @@ export function constructLlmApi(config: ModelDescription): BaseLlmApi { }); case "azure": return new AzureOpenAIApi(config); + case "voyage": + return new OpenAIApi({ + ...config, + apiBase: "https://api.voyageai.com/v1/", + }); + case "cohere": + return new CohereApi(config); + case "anthropic": + return new AnthropicApi(config); + case "gemini": + return new GeminiApi(config); + case "jina": + return new JinaApi(config); + case "deepinfra": + return new OpenAIApi({ + ...config, + apiBase: "https://api.deepinfra.com/v1/openai/", + }); + case "deepseek": + return new DeepSeekApi(config); + case "groq": + return new OpenAIApi({ + ...config, + apiBase: "https://api.groq.com/openai/v1/", + }); + case "fireworks": + return new OpenAIApi({ + ...config, + apiBase: "https://api.fireworks.ai/inference/v1", + }); + case "together": + return new OpenAIApi({ + ...config, + apiBase: "https://api.together.xyz/v1/", + }); default: throw new Error(`Unsupported LLM API format: ${config.provider}`); } diff --git a/packages/openai-adapters/test/main.test.ts b/packages/openai-adapters/test/main.test.ts new file mode 100644 index 000000000..c4615a05b --- /dev/null +++ b/packages/openai-adapters/test/main.test.ts @@ -0,0 +1,283 @@ +import * as dotenv from "dotenv"; +import { constructLlmApi, LlmApiConfig } from "../src/index.js"; + +dotenv.config(); + +function testEmbed(config: LlmApiConfig) { + test("should successfully embed", async () => { + const api = constructLlmApi(config); + + const response = await api.embed({ + model: config.model, + input: ["This is a test", "Hello world!"], + }); + expect(response.model).toBe(config.model); + expect(response.object).toBe("list"); + expect(response.data.length).toEqual(2); + response.data.forEach((val, index) => { + expect(val.index).toBe(index); + expect(val.object).toBe("embedding"); + expect(val.embedding.some((v) => typeof v !== "number")).toBe(false); + }); + }); +} + +function testRerank(config: LlmApiConfig) { + test("should successfully rerank", async () => { + const api = constructLlmApi(config); + + const response = await api.rerank({ + model: config.model, + query: "What is the capital of spain?", + documents: [ + "The capital of spain is Madrid", + "The largest breed of dog is the Great Dane", + ], + }); + expect(response.model).toBe(config.model); + expect(response.object).toBe("list"); + expect(response.data.length).toEqual(2); + response.data.forEach((val, index) => { + expect(val.index).toBe(index); + expect(typeof val.relevance_score).toBe("number"); + }); + expect(response.data[0].relevance_score).toBeGreaterThan( + response.data[1].relevance_score, + ); + }); +} + +function testFim(config: LlmApiConfig) { + test("should successfully fim", async () => { + const api = constructLlmApi(config); + + const response = api.fimStream({ + model: config.model, + prompt: "This is a ", + suffix: " .", + stream: true, + }); + + let completion = ""; + for await (const result of response) { + expect(result.choices.length).toBeGreaterThan(0); + expect(typeof result.choices[0].delta.content).toBe("string"); + + completion += result.choices[0].delta.content; + } + + expect(completion.length).toBeGreaterThan(0); + }); +} + +function testConfig(config: LlmApiConfig, chatOnly: boolean = false) { + const api = constructLlmApi(config); + + if (!chatOnly) { + test("should successfully stream complete", async () => { + const stream = api.completionStream({ + model: config.model, + prompt: "Hello! Who are you?", + stream: true, + }); + let completion = ""; + for await (const result of stream) { + completion += result.choices[0].text ?? ""; + + expect(typeof result.choices[0].text).toBe("string"); + expect(result.choices.length).toBeGreaterThan(0); + } + expect(completion.length).toBeGreaterThan(0); + }); + + test("should successfully non-stream complete", async () => { + const response = await api.completionNonStream({ + model: config.model, + prompt: "Hello! Who are you?", + stream: false, + }); + + expect(response.choices.length).toBeGreaterThan(0); + + const completion = response.choices[0].text; + expect(typeof completion).toBe("string"); + expect(completion.length).toBeGreaterThan(0); + }); + } + + test("should successfully stream chat", async () => { + const stream = api.chatCompletionStream({ + model: config.model, + messages: [{ role: "user", content: "Hello! Who are you?" }], + stream: true, + }); + let completion = ""; + for await (const result of stream) { + completion += result.choices[0].delta.content ?? ""; + + expect(result.choices.length).toBeGreaterThan(0); + } + expect(completion.length).toBeGreaterThan(0); + }); + + test("should successfully non-stream chat", async () => { + const response = await api.chatCompletionNonStream({ + model: config.model, + messages: [{ role: "user", content: "Hello! Who are you?" }], + stream: false, + }); + + expect(response.choices.length).toBeGreaterThan(0); + + const completion = response.choices[0].message.content; + expect(typeof completion).toBe("string"); + expect(completion?.length).toBeGreaterThan(0); + }); + + test("should acknowledge system message in chat", async () => { + const response = await api.chatCompletionNonStream({ + model: config.model, + messages: [ + { + role: "system", + content: + "Regardless of what is asked of you, your answer should start with 'RESPONSE: '.", + }, + { role: "user", content: "Who are you?" }, + ], + stream: false, + }); + expect(response.choices.length).toBeGreaterThan(0); + const completion = response.choices[0].message.content; + expect(typeof completion).toBe("string"); + expect(completion?.length).toBeGreaterThan(0); + expect(completion?.startsWith("RESPONSE: ")).toBe(true); + }); +} + +const COMPLETION_TESTS: ({ chatOnly?: boolean } & LlmApiConfig)[] = [ + { + provider: "openai", + model: "gpt-4o-mini", + apiKey: process.env.OPENAI_API_KEY!, + chatOnly: true, + }, + { + provider: "anthropic", + model: "claude-3-haiku-20240307", + apiKey: process.env.ANTHROPIC_API_KEY!, + chatOnly: true, + }, + { + provider: "gemini", + model: "gemini-1.5-flash-latest", + apiKey: process.env.GEMINI_API_KEY!, + chatOnly: true, + }, + { + provider: "cohere", + model: "command-r", + apiKey: process.env.COHERE_API_KEY!, + chatOnly: true, + }, + { + provider: "fireworks", + model: "accounts/fireworks/models/llama-v3p1-8b-instruct", + apiKey: process.env.FIREWORKS_API_KEY!, + chatOnly: true, + }, + { + provider: "groq", + model: "llama3-8b-8192", + apiKey: process.env.GROQ_API_KEY!, + chatOnly: true, + }, + { + provider: "deepinfra", + model: "meta-llama/Meta-Llama-3.1-8B-Instruct", + apiKey: process.env.DEEP_INFRA_API_KEY!, + chatOnly: true, + }, + { + provider: "together", + model: "meta-llama/Meta-Llama-3.1-8B-Instruct-Turbo", + apiKey: process.env.TOGETHER_API_KEY!, + chatOnly: true, + }, +]; + +const FIM_TESTS: LlmApiConfig[] = [ + { + provider: "openai", + model: "codestral-latest", + apiKey: process.env.MISTRAL_API_KEY!, + apiBase: "https://api.mistral.ai/v1", + }, + { + provider: "deepseek", + model: "deepseek-coder", + apiKey: process.env.DEEPSEEK_API_KEY!, + }, +]; + +const EMBEDDINGS_TESTS: LlmApiConfig[] = [ + { + provider: "openai", + model: "text-embedding-3-small", + apiKey: process.env.OPENAI_API_KEY!, + }, + { + provider: "openai", + model: "voyage-code-2", + apiKey: process.env.VOYAGE_API_KEY!, + apiBase: "https://api.voyageai.com/v1/", + }, + { + provider: "cohere", + model: "embed-english-v3.0", + apiKey: process.env.COHERE_API_KEY!, + }, + { + provider: "gemini", + model: "models/text-embedding-004", + apiKey: process.env.GEMINI_API_KEY!, + }, +]; + +const RERANK_TESTS: LlmApiConfig[] = [ + { + provider: "openai", + model: "rerank-lite-1", + apiKey: process.env.VOYAGE_API_KEY!, + apiBase: "https://api.voyageai.com/v1/", + }, + { + provider: "cohere", + model: "rerank-english-v3.0", + apiKey: process.env.COHERE_API_KEY!, + }, + { + provider: "jina", + model: "jina-reranker-v2-base-multilingual", + apiKey: process.env.JINA_API_KEY!, + }, +]; + +describe("should successfully call all adapters", () => { + COMPLETION_TESTS.forEach((config) => { + const { chatOnly, ...rest } = config; + testConfig(rest, chatOnly); + }); + + EMBEDDINGS_TESTS.forEach((config) => { + testEmbed(config); + }); + + RERANK_TESTS.forEach((config) => { + testRerank(config); + }); + + FIM_TESTS.forEach((config) => { + testFim(config); + }); +}); diff --git a/packages/openai-adapters/tsconfig.json b/packages/openai-adapters/tsconfig.json index f21949f4b..63587b995 100644 --- a/packages/openai-adapters/tsconfig.json +++ b/packages/openai-adapters/tsconfig.json @@ -12,9 +12,9 @@ "forceConsistentCasingInFileNames": true, "moduleResolution": "NodeNext", "resolveJsonModule": true, - "isolatedModules": true, + "isolatedModules": false, "noEmitOnError": false, - "types": ["node"], + "types": ["node", "jest"], "outDir": "dist", "declaration": true // "sourceMap": true diff --git a/scripts/install-dependencies.sh b/scripts/install-dependencies.sh index 6fe6e1fce..9f3fbe2e9 100755 --- a/scripts/install-dependencies.sh +++ b/scripts/install-dependencies.sh @@ -7,6 +7,8 @@ set -e echo "Installing Core extension dependencies..." pushd core +## This flag is set because we pull down Chromium at runtime +export PUPPETEER_SKIP_DOWNLOAD='true' npm install npm link