Merge pull request #2683 from continuedev/release/v0.9.221-vscode
Merge v0.9.221-vscode tag
This commit is contained in:
commit
2adb61834b
313 changed files with 12258 additions and 4481 deletions
7
.changes/extensions/intellij/0.0.72.md
Normal file
7
.changes/extensions/intellij/0.0.72.md
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
## 0.0.72 - 2024-10-04
|
||||
### Added
|
||||
* Listen for changes to Intellij settings without requiring window reload
|
||||
### Changed
|
||||
* Updated tutorial file
|
||||
### Fixed
|
||||
* Fix ability to load config.ts in JetBrains IDEs
|
||||
4
.changes/unreleased/Added-20241014-231551.yaml
Normal file
4
.changes/unreleased/Added-20241014-231551.yaml
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
project: extensions/vscode
|
||||
kind: Added
|
||||
body: Web context provider
|
||||
time: 2024-10-14T23:15:51.670444-07:00
|
||||
4
.changes/unreleased/Added-20241014-231622.yaml
Normal file
4
.changes/unreleased/Added-20241014-231622.yaml
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
project: extensions/vscode
|
||||
kind: Added
|
||||
body: Cerebras inference provider
|
||||
time: 2024-10-14T23:16:22.754491-07:00
|
||||
4
.changes/unreleased/Added-20241014-231639.yaml
Normal file
4
.changes/unreleased/Added-20241014-231639.yaml
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
project: extensions/vscode
|
||||
kind: Added
|
||||
body: Automatic descriptions for previous chats
|
||||
time: 2024-10-14T23:16:39.451261-07:00
|
||||
4
.changes/unreleased/Added-20241014-231657.yaml
Normal file
4
.changes/unreleased/Added-20241014-231657.yaml
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
project: extensions/vscode
|
||||
kind: Added
|
||||
body: Discord context provider
|
||||
time: 2024-10-14T23:16:57.089953-07:00
|
||||
4
.changes/unreleased/Added-20241014-231714.yaml
Normal file
4
.changes/unreleased/Added-20241014-231714.yaml
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
project: extensions/vscode
|
||||
kind: Added
|
||||
body: Improved full screen UI
|
||||
time: 2024-10-14T23:17:14.574917-07:00
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
project: extensions/intellij
|
||||
kind: Changed
|
||||
body: Updated tutorial file
|
||||
time: 2024-09-23T16:02:51.918152-07:00
|
||||
4
.changes/unreleased/Changed-20241014-231738.yaml
Normal file
4
.changes/unreleased/Changed-20241014-231738.yaml
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
project: extensions/vscode
|
||||
kind: Changed
|
||||
body: Easier way to accept/reject/re-prompt after cmd/ctrl+I
|
||||
time: 2024-10-14T23:17:38.086964-07:00
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
project: extensions/intellij
|
||||
kind: Fixed
|
||||
body: Fix ability to load config.ts in JetBrains IDEs
|
||||
time: 2024-09-29T09:54:40.284968-07:00
|
||||
5
.changes/unreleased/Fixed-20241007-183820.yaml
Normal file
5
.changes/unreleased/Fixed-20241007-183820.yaml
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
project: extensions/intellij
|
||||
kind: Fixed
|
||||
body: Off-screen rendering to solve white flash on load and lack of changing cursor
|
||||
type
|
||||
time: 2024-10-07T18:38:20.733658-07:00
|
||||
1
.github/pull_request_template.md
vendored
1
.github/pull_request_template.md
vendored
|
|
@ -14,3 +14,4 @@
|
|||
## Testing
|
||||
|
||||
[ For new or modified features, provide step-by-step testing instructions to validate the intended behavior of the change. ]
|
||||
[ For new UI features, ensure that the changes look good across viewport widths, light/dark theme, etc ]
|
||||
|
|
|
|||
2
.github/workflows/auto-assign.yaml
vendored
2
.github/workflows/auto-assign.yaml
vendored
|
|
@ -3,8 +3,6 @@ name: Issue assignment
|
|||
on:
|
||||
issues:
|
||||
types: [opened]
|
||||
pull_request:
|
||||
types: [opened]
|
||||
|
||||
jobs:
|
||||
auto-assign:
|
||||
|
|
|
|||
1
.github/workflows/jetbrains-release.yaml
vendored
1
.github/workflows/jetbrains-release.yaml
vendored
|
|
@ -320,7 +320,6 @@ jobs:
|
|||
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
|
||||
|
|
|
|||
20
.gitignore
vendored
20
.gitignore
vendored
|
|
@ -147,16 +147,6 @@ codeql
|
|||
**/**/.qodana
|
||||
**/**/build
|
||||
|
||||
**/.idea/**/*
|
||||
!**/.idea/.name
|
||||
!**/.idea/compiler.xml
|
||||
!**/.idea/gradle.xml
|
||||
!**/.idea/kotlinc.xml
|
||||
!**/.idea/misc.xml
|
||||
!**/.idea/vcs.xml
|
||||
!**/.idea/jarRepositories.xml
|
||||
core/.idea
|
||||
|
||||
continue_server.build
|
||||
continue_server.dist
|
||||
|
||||
|
|
@ -164,9 +154,15 @@ Icon
|
|||
Icon?
|
||||
|
||||
.continue
|
||||
|
||||
|
||||
.continuerc.json
|
||||
.prompts/
|
||||
.aider*
|
||||
|
||||
notes.md
|
||||
|
||||
manual-testing-sandbox/.idea/**
|
||||
extensions/intellij/.idea/**
|
||||
|
||||
**/.idea/workspace.xml
|
||||
**/.idea/usage.statistics.xml
|
||||
**/.idea/shelf/
|
||||
|
|
|
|||
63
.idea/codeStyles/Project.xml
generated
Normal file
63
.idea/codeStyles/Project.xml
generated
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
<component name="ProjectCodeStyleConfiguration">
|
||||
<code_scheme name="Project" version="173">
|
||||
<HTMLCodeStyleSettings>
|
||||
<option name="HTML_SPACE_INSIDE_EMPTY_TAG" value="true" />
|
||||
</HTMLCodeStyleSettings>
|
||||
<JSCodeStyleSettings version="0">
|
||||
<option name="FORCE_SEMICOLON_STYLE" value="true" />
|
||||
<option name="SPACE_BEFORE_FUNCTION_LEFT_PARENTH" value="false" />
|
||||
<option name="FORCE_QUOTE_STYlE" value="true" />
|
||||
<option name="ENFORCE_TRAILING_COMMA" value="WhenMultiline" />
|
||||
<option name="SPACES_WITHIN_OBJECT_LITERAL_BRACES" value="true" />
|
||||
<option name="SPACES_WITHIN_IMPORTS" value="true" />
|
||||
</JSCodeStyleSettings>
|
||||
<JetCodeStyleSettings>
|
||||
<option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" />
|
||||
</JetCodeStyleSettings>
|
||||
<TypeScriptCodeStyleSettings version="0">
|
||||
<option name="FORCE_SEMICOLON_STYLE" value="true" />
|
||||
<option name="SPACE_BEFORE_FUNCTION_LEFT_PARENTH" value="false" />
|
||||
<option name="FORCE_QUOTE_STYlE" value="true" />
|
||||
<option name="ENFORCE_TRAILING_COMMA" value="WhenMultiline" />
|
||||
<option name="SPACES_WITHIN_OBJECT_LITERAL_BRACES" value="true" />
|
||||
<option name="SPACES_WITHIN_IMPORTS" value="true" />
|
||||
</TypeScriptCodeStyleSettings>
|
||||
<VueCodeStyleSettings>
|
||||
<option name="INTERPOLATION_NEW_LINE_AFTER_START_DELIMITER" value="false" />
|
||||
<option name="INTERPOLATION_NEW_LINE_BEFORE_END_DELIMITER" value="false" />
|
||||
</VueCodeStyleSettings>
|
||||
<codeStyleSettings language="HTML">
|
||||
<option name="SOFT_MARGINS" value="80" />
|
||||
<indentOptions>
|
||||
<option name="INDENT_SIZE" value="2" />
|
||||
<option name="CONTINUATION_INDENT_SIZE" value="2" />
|
||||
<option name="TAB_SIZE" value="2" />
|
||||
</indentOptions>
|
||||
</codeStyleSettings>
|
||||
<codeStyleSettings language="JavaScript">
|
||||
<option name="SOFT_MARGINS" value="80" />
|
||||
<indentOptions>
|
||||
<option name="INDENT_SIZE" value="2" />
|
||||
<option name="CONTINUATION_INDENT_SIZE" value="2" />
|
||||
<option name="TAB_SIZE" value="2" />
|
||||
</indentOptions>
|
||||
</codeStyleSettings>
|
||||
<codeStyleSettings language="TypeScript">
|
||||
<option name="SOFT_MARGINS" value="80" />
|
||||
<indentOptions>
|
||||
<option name="INDENT_SIZE" value="2" />
|
||||
<option name="CONTINUATION_INDENT_SIZE" value="2" />
|
||||
<option name="TAB_SIZE" value="2" />
|
||||
</indentOptions>
|
||||
</codeStyleSettings>
|
||||
<codeStyleSettings language="Vue">
|
||||
<option name="SOFT_MARGINS" value="80" />
|
||||
<indentOptions>
|
||||
<option name="CONTINUATION_INDENT_SIZE" value="2" />
|
||||
</indentOptions>
|
||||
</codeStyleSettings>
|
||||
<codeStyleSettings language="kotlin">
|
||||
<option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" />
|
||||
</codeStyleSettings>
|
||||
</code_scheme>
|
||||
</component>
|
||||
5
.idea/codeStyles/codeStyleConfig.xml
generated
Normal file
5
.idea/codeStyles/codeStyleConfig.xml
generated
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
<component name="ProjectCodeStyleConfiguration">
|
||||
<state>
|
||||
<option name="USE_PER_PROJECT_SETTINGS" value="true" />
|
||||
</state>
|
||||
</component>
|
||||
6
.idea/git_toolbox_blame.xml
generated
Normal file
6
.idea/git_toolbox_blame.xml
generated
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="GitToolBoxBlameSettings">
|
||||
<option name="version" value="2" />
|
||||
</component>
|
||||
</project>
|
||||
1
.idea/gradle.xml
generated
1
.idea/gradle.xml
generated
|
|
@ -5,7 +5,6 @@
|
|||
<option name="linkedExternalProjectsSettings">
|
||||
<GradleProjectSettings>
|
||||
<option name="externalProjectPath" value="$PROJECT_DIR$/extensions/intellij" />
|
||||
<option name="gradleJvm" value="corretto-17" />
|
||||
<option name="modules">
|
||||
<set>
|
||||
<option value="$PROJECT_DIR$/extensions/intellij" />
|
||||
|
|
|
|||
10
.idea/modules.xml
generated
Normal file
10
.idea/modules.xml
generated
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/modules/com.github.continuedev.continueintellijextension.continue-intellij-extension.iml" filepath="$PROJECT_DIR$/.idea/modules/com.github.continuedev.continueintellijextension.continue-intellij-extension.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/modules/com.github.continuedev.continueintellijextension.continue-intellij-extension.main.iml" filepath="$PROJECT_DIR$/.idea/modules/com.github.continuedev.continueintellijextension.continue-intellij-extension.main.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/modules/com.github.continuedev.continueintellijextension.continue-intellij-extension.test.iml" filepath="$PROJECT_DIR$/.idea/modules/com.github.continuedev.continueintellijextension.continue-intellij-extension.test.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
||||
8
.idea/modules/com.github.continuedev.continueintellijextension.continue-intellij-extension.iml
generated
Normal file
8
.idea/modules/com.github.continuedev.continueintellijextension.continue-intellij-extension.iml
generated
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module version="4">
|
||||
<component name="AdditionalModuleElements">
|
||||
<content url="file://$MODULE_DIR$/../..">
|
||||
<sourceFolder url="file://$MODULE_DIR$/../../extensions/intellij/.gradle/8.3/dependencies-accessors/5ff144de810dd952e050983bda2040fa7aa351f8/sources" isTestSource="false" />
|
||||
</content>
|
||||
</component>
|
||||
</module>
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module version="4">
|
||||
<component name="AdditionalModuleElements">
|
||||
<content url="file://$MODULE_DIR$/../../extensions/intellij/src/main" dumb="true">
|
||||
<sourceFolder url="file://$MODULE_DIR$/../../extensions/intellij/src/main" isTestSource="false" />
|
||||
</content>
|
||||
</component>
|
||||
</module>
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module version="4">
|
||||
<component name="AdditionalModuleElements">
|
||||
<content url="file://$MODULE_DIR$/../../extensions/intellij/src/test" dumb="true">
|
||||
<sourceFolder url="file://$MODULE_DIR$/../../extensions/intellij/src/test" isTestSource="true" />
|
||||
</content>
|
||||
</component>
|
||||
</module>
|
||||
6
.idea/prettier.xml
generated
Normal file
6
.idea/prettier.xml
generated
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="PrettierConfiguration">
|
||||
<option name="myConfigurationMode" value="AUTOMATIC" />
|
||||
</component>
|
||||
</project>
|
||||
3
.idea/scopes/Continue.xml
generated
Normal file
3
.idea/scopes/Continue.xml
generated
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
<component name="DependencyValidationManager">
|
||||
<scope name="Continue" pattern="!file[com.github.continuedev.continueintellijextension.continue-intellij-extension]:gui/dist//*&&!file[com.github.continuedev.continueintellijextension.continue-intellij-extension]:extensions/vscode/gui//*&&!file[com.github.continuedev.continueintellijextension.continue-intellij-extension]:core/vendor//*" />
|
||||
</component>
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
{
|
||||
"tabWidth": 2,
|
||||
"useTabs": false,
|
||||
"trailingComma": "all"
|
||||
"trailingComma": "all",
|
||||
"plugins": ["prettier-plugin-tailwindcss"]
|
||||
}
|
||||
|
|
|
|||
5
.vscode/launch.json
vendored
5
.vscode/launch.json
vendored
|
|
@ -20,7 +20,9 @@
|
|||
"outFiles": ["${workspaceFolder}/extensions/vscode/out/extension.js"],
|
||||
"preLaunchTask": "vscode-extension:build",
|
||||
"env": {
|
||||
// "CONTROL_PLANE_ENV": "local"
|
||||
// "staging" for the preview deployment
|
||||
// "local" for entirely local development of control plane/proxy
|
||||
// "CONTROL_PLANE_ENV": "staging"
|
||||
}
|
||||
},
|
||||
{
|
||||
|
|
@ -29,7 +31,6 @@
|
|||
"name": "Core Binary",
|
||||
"skipFiles": ["<node_internals>/**"],
|
||||
"program": "${workspaceFolder}/binary/out/index.js",
|
||||
// "preLaunchTask": "binary:esbuild",
|
||||
"outFiles": ["${workspaceFolder}/binary/out/**/*.js"],
|
||||
"sourceMaps": true,
|
||||
"smartStep": true,
|
||||
|
|
|
|||
10
.vscode/settings.json
vendored
10
.vscode/settings.json
vendored
|
|
@ -14,12 +14,10 @@
|
|||
}
|
||||
},
|
||||
"search.exclude": {
|
||||
"**/binary": true,
|
||||
"binary/": false,
|
||||
"**/core/vendor/**": true,
|
||||
"**/gui/dist": true
|
||||
"**/gui/dist": true,
|
||||
"**/extensions/vscode/gui/**": true,
|
||||
"**/extensions/vscode/out/**": true
|
||||
},
|
||||
"eslint.workingDirectories": [
|
||||
"./core"
|
||||
]
|
||||
"eslint.workingDirectories": ["./core"]
|
||||
}
|
||||
|
|
|
|||
1
.vscode/tasks.json
vendored
1
.vscode/tasks.json
vendored
|
|
@ -21,6 +21,7 @@
|
|||
},
|
||||
{
|
||||
"label": "vscode-extension:esbuild",
|
||||
"dependsOn": ["vscode-extension:continue-ui:build"],
|
||||
"type": "npm",
|
||||
"script": "esbuild-watch",
|
||||
"path": "extensions/vscode",
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
- [VS Code](#vs-code)
|
||||
- [Debugging](#debugging)
|
||||
- [JetBrains](#jetbrains)
|
||||
- [Debugging](#debugging-1)
|
||||
- [Our Git Workflow](#our-git-workflow)
|
||||
- [Formatting](#formatting)
|
||||
- [Writing Slash Commands](#writing-slash-commands)
|
||||
- [Writing Context Providers](#writing-context-providers)
|
||||
|
|
@ -68,7 +68,7 @@ You can run the documentation server locally using either of the following metho
|
|||
|
||||
#### Method 1: NPM Script
|
||||
|
||||
1. Open your terminal and navigate to the `docs` subdirectory of the project. The `docusaurus.config.js` file you'll see there is a sign you're in the right place.
|
||||
1. Open your terminal and navigate to the `docs` subdirectory of the project. The `docusaurus.config.js` file you'll see there is a sign you're in the right place.
|
||||
|
||||
2. Run the following command to install the necessary dependencies for the documentation server:
|
||||
|
||||
|
|
@ -141,33 +141,7 @@ Similarly, any changes to `core` or `extensions/vscode` will be automatically in
|
|||
|
||||
#### JetBrains
|
||||
|
||||
Pre-requisite: You should use the Intellij IDE, which can be downloaded [here](https://www.jetbrains.com/idea/download). Either Ultimate or Community (free) will work. Continue is built with JDK version 17, as specified in `extensions/intellij/build.gradle.kts`. You should also ensure that you have the Gradle plugin installed.
|
||||
|
||||
1. Clone the repository
|
||||
2. Run `scripts/install-dependencies.sh` or `scripts/install-dependencies.ps1` on Windows. This will install and build all of the necessary dependencies.
|
||||
3. To test the plugin, select the "Run Plugin" Gradle configuration and click the "Run" or "Debug" button as shown in this screenshot:
|
||||

|
||||
4. To package the extension, run `./gradlew build` (or `./gradlew.bat build` on Windows) from the `extensions/intellij` directory. This will generate a .zip file in `extensions/intellij/build/distributions` with the version defined in `extensions/intellij/gradle.properties`.
|
||||
5. If you make changes, you may need to re-build before running the "Build Plugin" configuration
|
||||
|
||||
a. If you change code from the `core` or `binary` directories, make sure to run `npm run build` from the `binary` directory to create a new binary.
|
||||
|
||||
b. If you change code from the `gui` directory, make sure to run `npm run build` from the `gui` directory to create a new bundle.
|
||||
|
||||
c. Any changes to the Kotlin coded in the `extensions/intellij` directory will be automatically included when you run "Build Plugin"
|
||||
|
||||
##### 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 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:
|
||||
|
||||
1. In [CoreMessenger.kt](./extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/CoreMessenger.kt), change the `useTcp` variable to `true`.
|
||||
2. Open a VS Code window (we recommend this for a preconfigured Typescript debugging experience) with the `continue` repository. Select the "Core Binary" debug configuration and press play.
|
||||
3. Run the "Run Plugin" Gradle configuration.
|
||||
4. You can now set breakpoints in any of the TypeScript files in VS Code. If you make changes to the code, restart the "Core Binary" debug configuration and reload the _Host IntelliJ_ window.
|
||||
|
||||
If you make changes to Kotlin code, they can often be hot-reloaded with "Run -> Debugging Actions -> Reload Changed Classes".
|
||||
See the [`CONTRIBUTING.md`](./extensions/intellij/CONTRIBUTING.md) for the JetBrains extension.
|
||||
|
||||
### Our Git Workflow
|
||||
|
||||
|
|
|
|||
|
|
@ -62,4 +62,4 @@ Check out the [contribution ideas board](https://github.com/orgs/continuedev/pro
|
|||
|
||||
## License
|
||||
|
||||
[Apache 2.0 © 2023 Continue Dev, Inc.](./LICENSE)
|
||||
[Apache 2.0 © 2023-2024 Continue Dev, Inc.](./LICENSE)
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$/../.." vcs="Git" />
|
||||
<mapping directory="$PROJECT_DIR$/.." vcs="Git" />
|
||||
</component>
|
||||
</project>
|
||||
|
|
@ -270,24 +270,6 @@ async function installNodeModuleInTempDirAndCopyToCurrent(packageName, toCopy) {
|
|||
|
||||
fs.unlinkSync(`${targetDir}/build.tar.gz`);
|
||||
|
||||
// Download and unzip prebuilt esbuild binary for the target
|
||||
console.log(`[info] Downloading esbuild for ${target}...`);
|
||||
// Version is pinned to 0.19.11 in package.json to make sure that they match
|
||||
execCmdSync(
|
||||
`curl -o ${targetDir}/esbuild.tgz https://registry.npmjs.org/@esbuild/${target}/-/${target}-0.19.11.tgz`,
|
||||
);
|
||||
execCmdSync(`tar -xzvf ${targetDir}/esbuild.tgz -C ${targetDir}`);
|
||||
if (target.startsWith("win32")) {
|
||||
fs.cpSync(`${targetDir}/package/esbuild.exe`, `${targetDir}/esbuild.exe`);
|
||||
} else {
|
||||
fs.cpSync(`${targetDir}/package/bin/esbuild`, `${targetDir}/esbuild`);
|
||||
}
|
||||
fs.rmSync(`${targetDir}/esbuild.tgz`);
|
||||
fs.rmSync(`${targetDir}/package`, {
|
||||
force: true,
|
||||
recursive: true,
|
||||
});
|
||||
|
||||
// copy @lancedb to bin folders
|
||||
console.log("[info] Copying @lancedb files to bin");
|
||||
fs.copyFileSync(
|
||||
|
|
@ -295,9 +277,6 @@ async function installNodeModuleInTempDirAndCopyToCurrent(packageName, toCopy) {
|
|||
`${targetDir}/index.node`,
|
||||
);
|
||||
}
|
||||
// execCmdSync(
|
||||
// `npx pkg out/index.js --target node18-darwin-arm64 --no-bytecode --public-packages "*" --public -o bin/pkg`
|
||||
// );
|
||||
|
||||
const pathsToVerify = [];
|
||||
for (target of targets) {
|
||||
|
|
@ -305,7 +284,6 @@ async function installNodeModuleInTempDirAndCopyToCurrent(packageName, toCopy) {
|
|||
const targetDir = `bin/${target}`;
|
||||
pathsToVerify.push(
|
||||
`${targetDir}/continue-binary${exe}`,
|
||||
`${targetDir}/esbuild${exe}`,
|
||||
`${targetDir}/index.node`, // @lancedb
|
||||
"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`,
|
||||
|
|
|
|||
4
binary/package-lock.json
generated
4
binary/package-lock.json
generated
|
|
@ -65,6 +65,7 @@
|
|||
"dotenv": "^16.4.5",
|
||||
"fastest-levenshtein": "^1.0.16",
|
||||
"follow-redirects": "^1.15.5",
|
||||
"google-auth-library": "^9.14.2",
|
||||
"handlebars": "^4.7.8",
|
||||
"http-proxy-agent": "^7.0.1",
|
||||
"https-proxy-agent": "^7.0.3",
|
||||
|
|
@ -74,6 +75,7 @@
|
|||
"jsdom": "^24.0.0",
|
||||
"launchdarkly-node-client-sdk": "^3.2.0",
|
||||
"llm-code-highlighter": "^0.0.14",
|
||||
"lru-cache": "^10.2.2",
|
||||
"mac-ca": "^3.1.0",
|
||||
"node-fetch": "^3.3.2",
|
||||
"node-html-markdown": "^1.3.0",
|
||||
|
|
@ -92,6 +94,7 @@
|
|||
"sqlite": "^5.1.1",
|
||||
"sqlite3": "^5.1.7",
|
||||
"system-ca": "^1.0.3",
|
||||
"tar": "^7.4.3",
|
||||
"tree-sitter-wasms": "^0.1.11",
|
||||
"uuid": "^9.0.1",
|
||||
"vectordb": "^0.4.20",
|
||||
|
|
@ -115,6 +118,7 @@
|
|||
"@types/node-fetch": "^2.6.11",
|
||||
"@types/pg": "^8.11.6",
|
||||
"@types/request": "^2.48.12",
|
||||
"@types/tar": "^6.1.13",
|
||||
"@types/uuid": "^9.0.7",
|
||||
"@types/win-ca": "^3.5.4",
|
||||
"cross-env": "^7.0.3",
|
||||
|
|
|
|||
|
|
@ -23,7 +23,6 @@
|
|||
"scripts": {
|
||||
"test": "jest",
|
||||
"build": "node build.js",
|
||||
"build:old": "ncc build src/index.ts -o out && pkg .",
|
||||
"build:dev": "tsc",
|
||||
"esbuild": "node build.js --esbuild-only"
|
||||
},
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ import {
|
|||
constructAutocompletePrompt,
|
||||
languageForFilepath,
|
||||
} from "./constructPrompt.js";
|
||||
import { isOnlyPunctuationAndWhitespace } from "./filter.js";
|
||||
import { isOnlyWhitespace } from "./filter.js";
|
||||
import { AutocompleteLanguageInfo } from "./languages.js";
|
||||
import { postprocessCompletion } from "./postprocessing.js";
|
||||
import { AutocompleteSnippet } from "./ranking.js";
|
||||
|
|
@ -355,8 +355,12 @@ export class CompletionProvider {
|
|||
return undefined;
|
||||
}
|
||||
|
||||
// Filter out unwanted results
|
||||
if (isOnlyPunctuationAndWhitespace(outcome.completion)) {
|
||||
/**
|
||||
* This check is most likely not needed because we do trim the LLM output
|
||||
* elsewhere in the code. That said, I'm not yet confident enough to
|
||||
* remove this.
|
||||
*/
|
||||
if (isOnlyWhitespace(outcome.completion)) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ import {
|
|||
import { RecentlyEditedRange, findMatchingRange } from "./recentlyEdited.js";
|
||||
import { ImportDefinitionsService } from "./services/ImportDefinitionsService.js";
|
||||
import { RootPathContextService } from "./services/RootPathContextService.js";
|
||||
import { shouldCompleteMultiline } from "./shouldCompleteMultiline.js";
|
||||
|
||||
export function languageForFilepath(
|
||||
filepath: string,
|
||||
|
|
@ -29,79 +30,6 @@ export function languageForFilepath(
|
|||
return LANGUAGES[filepath.split(".").slice(-1)[0]] || Typescript;
|
||||
}
|
||||
|
||||
const BLOCK_TYPES = ["body", "statement_block"];
|
||||
|
||||
function shouldCompleteMultilineAst(
|
||||
treePath: AstPath,
|
||||
cursorLine: number,
|
||||
): boolean {
|
||||
// If at the base of the file, do multiline
|
||||
if (treePath.length === 1) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// If at the first line of an otherwise empty funtion body, do multiline
|
||||
for (let i = treePath.length - 1; i >= 0; i--) {
|
||||
const node = treePath[i];
|
||||
if (
|
||||
BLOCK_TYPES.includes(node.type) &&
|
||||
Math.abs(node.startPosition.row - cursorLine) <= 1
|
||||
) {
|
||||
let text = node.text;
|
||||
text = text.slice(text.indexOf("{") + 1);
|
||||
text = text.slice(0, text.lastIndexOf("}"));
|
||||
text = text.trim();
|
||||
return text.split("\n").length === 1;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function isMidlineCompletion(prefix: string, suffix: string): boolean {
|
||||
return !suffix.startsWith("\n");
|
||||
}
|
||||
|
||||
async function shouldCompleteMultiline(
|
||||
treePath: AstPath | undefined,
|
||||
fullPrefix: string,
|
||||
fullSuffix: string,
|
||||
language: AutocompleteLanguageInfo,
|
||||
): Promise<boolean> {
|
||||
// Don't complete multi-line if you are mid-line
|
||||
if (isMidlineCompletion(fullPrefix, fullSuffix)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Don't complete multi-line for single-line comments
|
||||
if (
|
||||
fullPrefix
|
||||
.split("\n")
|
||||
.slice(-1)[0]
|
||||
?.trimStart()
|
||||
.startsWith(language.singleLineComment)
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// First, if the line before ends with an opening bracket, then assume multi-line
|
||||
if (
|
||||
["{", "(", "["].includes(
|
||||
fullPrefix.split("\n").slice(-2)[0]?.trim().slice(-1)[0],
|
||||
)
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Use AST to determine whether to complete multiline
|
||||
let completeMultiline = false;
|
||||
if (treePath) {
|
||||
const cursorLine = fullPrefix.split("\n").length - 1;
|
||||
completeMultiline = shouldCompleteMultilineAst(treePath, cursorLine);
|
||||
}
|
||||
return completeMultiline;
|
||||
}
|
||||
|
||||
export async function constructAutocompletePrompt(
|
||||
filepath: string,
|
||||
cursorLine: number,
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
export function isOnlyPunctuationAndWhitespace(completion: string): boolean {
|
||||
const punctuationAndWhitespaceRegex = /^[^\w\d\}\)\]]+$/;
|
||||
return punctuationAndWhitespaceRegex.test(completion);
|
||||
export function isOnlyWhitespace(completion: string): boolean {
|
||||
const whitespaceRegex = /^[\s]+$/;
|
||||
return whitespaceRegex.test(completion);
|
||||
}
|
||||
|
|
|
|||
0
core/autocomplete/shouldCompleteMultiline.test.ts
Normal file
0
core/autocomplete/shouldCompleteMultiline.test.ts
Normal file
75
core/autocomplete/shouldCompleteMultiline.ts
Normal file
75
core/autocomplete/shouldCompleteMultiline.ts
Normal file
|
|
@ -0,0 +1,75 @@
|
|||
import { AstPath } from "./ast";
|
||||
import { AutocompleteLanguageInfo } from "./languages";
|
||||
|
||||
const BLOCK_TYPES = ["body", "statement_block"];
|
||||
|
||||
function shouldCompleteMultilineAst(
|
||||
treePath: AstPath,
|
||||
cursorLine: number,
|
||||
): boolean {
|
||||
// If at the base of the file, do multiline
|
||||
if (treePath.length === 1) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// If at the first line of an otherwise empty funtion body, do multiline
|
||||
for (let i = treePath.length - 1; i >= 0; i--) {
|
||||
const node = treePath[i];
|
||||
if (
|
||||
BLOCK_TYPES.includes(node.type) &&
|
||||
Math.abs(node.startPosition.row - cursorLine) <= 1
|
||||
) {
|
||||
let text = node.text;
|
||||
text = text.slice(text.indexOf("{") + 1);
|
||||
text = text.slice(0, text.lastIndexOf("}"));
|
||||
text = text.trim();
|
||||
return text.split("\n").length === 1;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function isMidlineCompletion(prefix: string, suffix: string): boolean {
|
||||
return !suffix.startsWith("\n");
|
||||
}
|
||||
|
||||
export async function shouldCompleteMultiline(
|
||||
treePath: AstPath | undefined,
|
||||
fullPrefix: string,
|
||||
fullSuffix: string,
|
||||
language: AutocompleteLanguageInfo,
|
||||
): Promise<boolean> {
|
||||
// Don't complete multi-line if you are mid-line
|
||||
if (isMidlineCompletion(fullPrefix, fullSuffix)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Don't complete multi-line for single-line comments
|
||||
if (
|
||||
fullPrefix
|
||||
.split("\n")
|
||||
.slice(-1)[0]
|
||||
?.trimStart()
|
||||
.startsWith(language.singleLineComment)
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// First, if the line before ends with an opening bracket, then assume multi-line
|
||||
if (
|
||||
["{", "(", "["].includes(
|
||||
fullPrefix.split("\n").slice(-2)[0]?.trim().slice(-1)[0],
|
||||
)
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Use AST to determine whether to complete multiline
|
||||
let completeMultiline = false;
|
||||
if (treePath) {
|
||||
const cursorLine = fullPrefix.split("\n").length - 1;
|
||||
completeMultiline = shouldCompleteMultilineAst(treePath, cursorLine);
|
||||
}
|
||||
return completeMultiline;
|
||||
}
|
||||
|
|
@ -4,8 +4,9 @@ import { stripImages } from "../../llm/images.js";
|
|||
const CommitMessageCommand: SlashCommand = {
|
||||
name: "commit",
|
||||
description: "Generate a commit message for current changes",
|
||||
run: async function* ({ ide, llm, input }) {
|
||||
const diff = await ide.getDiff();
|
||||
run: async function* ({ ide, llm, params }) {
|
||||
const includeUnstaged = params?.includeUnstaged ?? false;
|
||||
const diff = await ide.getDiff(includeUnstaged);
|
||||
|
||||
if (!diff || diff.trim() === "") {
|
||||
yield "No changes detected. Make sure you are in a git repository with current changes.";
|
||||
|
|
|
|||
|
|
@ -613,6 +613,7 @@ Please briefly explain the changes made to the code above. Give no more than 2-3
|
|||
yield update;
|
||||
}
|
||||
}
|
||||
yield `Edited ${contextItemToEdit.name}`;
|
||||
},
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -6,13 +6,11 @@ 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,
|
||||
ShareSlashCommand,
|
||||
StackOverflowSlashCommand,
|
||||
GenerateTerminalCommand,
|
||||
EditSlashCommand,
|
||||
CommentSlashCommand,
|
||||
|
|
|
|||
|
|
@ -1,126 +0,0 @@
|
|||
import { constants } from "../../deploy/constants.js";
|
||||
import { ChatMessageRole, FetchFunction, SlashCommand } from "../../index.js";
|
||||
import { pruneStringFromBottom } from "../../llm/countTokens.js";
|
||||
import { stripImages } from "../../llm/images.js";
|
||||
|
||||
const PROMPT = (
|
||||
input: string,
|
||||
) => `The above sources are excerpts from related StackOverflow questions. Use them to help answer the below question from our user. Provide links to the sources in markdown whenever possible:
|
||||
|
||||
${input}
|
||||
`;
|
||||
|
||||
async function getResults(q: string, fetch: FetchFunction): Promise<any> {
|
||||
const payload = JSON.stringify({
|
||||
q: `${q} site:stackoverflow.com`,
|
||||
});
|
||||
|
||||
const resp = await fetch(new URL("/search", constants.a), {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
body: payload,
|
||||
});
|
||||
return await resp.json();
|
||||
}
|
||||
|
||||
async function fetchData(
|
||||
url: string,
|
||||
fetch: FetchFunction,
|
||||
): Promise<string | undefined> {
|
||||
const response = await fetch(url, {
|
||||
headers: {
|
||||
Accept: "text/html",
|
||||
},
|
||||
});
|
||||
const htmlString = await response.text();
|
||||
|
||||
const parser = new DOMParser();
|
||||
const doc = parser.parseFromString(htmlString, "text/html");
|
||||
|
||||
const h1 = doc.querySelector("h1.fs-headline1");
|
||||
const title = h1?.textContent?.trim() ?? "No Title";
|
||||
|
||||
const bodies = doc.querySelectorAll("div.js-post-body");
|
||||
if (bodies.length < 2) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const question = bodies[0].textContent ?? "";
|
||||
const answer = bodies[1].textContent ?? "";
|
||||
|
||||
return `
|
||||
# Question: [${title}](${url})
|
||||
|
||||
${question}
|
||||
|
||||
# Best Answer
|
||||
|
||||
${answer}
|
||||
`;
|
||||
}
|
||||
|
||||
const StackOverflowSlashCommand: SlashCommand = {
|
||||
name: "so",
|
||||
description: "Search Stack Overflow",
|
||||
run: async function* ({ llm, input, addContextItem, history, fetch }) {
|
||||
const contextLength = llm.contextLength;
|
||||
|
||||
const sources: string[] = [];
|
||||
const results = await getResults(input, fetch);
|
||||
const links = results.organic.map((result: any) => result.link);
|
||||
let totalTokens = llm.countTokens(input) + 200;
|
||||
|
||||
for (const link of links) {
|
||||
const contents = await fetchData(link, fetch);
|
||||
if (!contents) {
|
||||
continue;
|
||||
}
|
||||
sources.push(contents);
|
||||
const newTokens = llm.countTokens(contents);
|
||||
totalTokens += newTokens;
|
||||
|
||||
let shouldBreak = false;
|
||||
if (totalTokens > contextLength) {
|
||||
sources[sources.length - 1] = pruneStringFromBottom(
|
||||
llm.model,
|
||||
contextLength - (totalTokens - newTokens),
|
||||
sources[sources.length - 1],
|
||||
);
|
||||
shouldBreak = true;
|
||||
}
|
||||
|
||||
if (sources.length >= 3) {
|
||||
shouldBreak = true;
|
||||
}
|
||||
|
||||
addContextItem({
|
||||
content: sources[sources.length - 1],
|
||||
description: "StackOverflow Answer",
|
||||
name: `StackOverflow ${sources.length}`,
|
||||
id: {
|
||||
providerTitle: "so",
|
||||
itemId: links[sources.length - 1],
|
||||
},
|
||||
});
|
||||
|
||||
if (shouldBreak) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for await (const chunk of llm.streamChat([
|
||||
...history,
|
||||
...sources.map((source) => ({
|
||||
role: "user" as ChatMessageRole,
|
||||
content: source,
|
||||
})),
|
||||
{ role: "user", content: PROMPT(input) },
|
||||
])) {
|
||||
yield stripImages(chunk.content);
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
export default StackOverflowSlashCommand;
|
||||
|
|
@ -28,6 +28,10 @@ describe.skip("Test the ConfigHandler and E2E config loading", () => {
|
|||
fs.writeFileSync(getConfigTsPath(), configTs);
|
||||
await new Promise((resolve) => setTimeout(resolve, 1000));
|
||||
const config = await testConfigHandler.reloadConfig();
|
||||
/**
|
||||
* @ts-ignore is applied because this test is skipped
|
||||
*/
|
||||
// @ts-ignore
|
||||
expect(config.systemMessage).toBe("SYSTEM");
|
||||
});
|
||||
|
||||
|
|
@ -37,6 +41,10 @@ describe.skip("Test the ConfigHandler and E2E config loading", () => {
|
|||
JSON.stringify({ systemMessage: "SYSTEM2" }),
|
||||
);
|
||||
const config = await testConfigHandler.reloadConfig();
|
||||
/**
|
||||
* @ts-ignore is applied because this test is skipped
|
||||
*/
|
||||
// @ts-ignore
|
||||
expect(config.systemMessage).toBe("SYSTEM2");
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -12,97 +12,24 @@ import {
|
|||
} from "../index.js";
|
||||
import Ollama from "../llm/llms/Ollama.js";
|
||||
import { GlobalContext } from "../util/GlobalContext.js";
|
||||
import { finalToBrowserConfig } from "./load.js";
|
||||
import { ConfigResult } from "./load.js";
|
||||
import {
|
||||
LOCAL_ONBOARDING_CHAT_MODEL,
|
||||
ONBOARDING_LOCAL_MODEL_TITLE,
|
||||
} from "./onboarding.js";
|
||||
import ControlPlaneProfileLoader from "./profile/ControlPlaneProfileLoader.js";
|
||||
import { IProfileLoader } from "./profile/IProfileLoader.js";
|
||||
import LocalProfileLoader from "./profile/LocalProfileLoader.js";
|
||||
|
||||
export interface ProfileDescription {
|
||||
title: string;
|
||||
id: string;
|
||||
}
|
||||
import {
|
||||
ProfileDescription,
|
||||
ProfileLifecycleManager,
|
||||
} from "./ProfileLifecycleManager.js";
|
||||
|
||||
export type { ProfileDescription };
|
||||
|
||||
type ConfigUpdateFunction = (payload: ConfigResult<ContinueConfig>) => void;
|
||||
|
||||
// Separately manages saving/reloading each profile
|
||||
class ProfileLifecycleManager {
|
||||
private savedConfig: ContinueConfig | undefined;
|
||||
private savedBrowserConfig?: BrowserSerializedContinueConfig;
|
||||
private pendingConfigPromise?: Promise<ContinueConfig>;
|
||||
|
||||
constructor(private readonly profileLoader: IProfileLoader) {}
|
||||
|
||||
get profileId() {
|
||||
return this.profileLoader.profileId;
|
||||
}
|
||||
|
||||
get profileTitle() {
|
||||
return this.profileLoader.profileTitle;
|
||||
}
|
||||
|
||||
get profileDescription(): ProfileDescription {
|
||||
return {
|
||||
title: this.profileTitle,
|
||||
id: this.profileId,
|
||||
};
|
||||
}
|
||||
|
||||
clearConfig() {
|
||||
this.savedConfig = undefined;
|
||||
this.savedBrowserConfig = undefined;
|
||||
this.pendingConfigPromise = undefined;
|
||||
}
|
||||
|
||||
// Clear saved config and reload
|
||||
async reloadConfig(): Promise<ContinueConfig> {
|
||||
this.savedConfig = undefined;
|
||||
this.savedBrowserConfig = undefined;
|
||||
this.pendingConfigPromise = undefined;
|
||||
|
||||
return await this.profileLoader.doLoadConfig();
|
||||
}
|
||||
|
||||
async loadConfig(
|
||||
additionalContextProviders: IContextProvider[],
|
||||
): Promise<ContinueConfig> {
|
||||
// If we already have a config, return it
|
||||
if (this.savedConfig) {
|
||||
return this.savedConfig;
|
||||
} else if (this.pendingConfigPromise) {
|
||||
return this.pendingConfigPromise;
|
||||
}
|
||||
|
||||
// Set pending config promise
|
||||
this.pendingConfigPromise = new Promise(async (resolve, reject) => {
|
||||
const newConfig = await this.profileLoader.doLoadConfig();
|
||||
|
||||
// Add registered context providers
|
||||
newConfig.contextProviders = (newConfig.contextProviders ?? []).concat(
|
||||
additionalContextProviders,
|
||||
);
|
||||
|
||||
this.savedConfig = newConfig;
|
||||
resolve(newConfig);
|
||||
});
|
||||
|
||||
// Wait for the config promise to resolve
|
||||
this.savedConfig = await this.pendingConfigPromise;
|
||||
this.pendingConfigPromise = undefined;
|
||||
return this.savedConfig;
|
||||
}
|
||||
|
||||
async getSerializedConfig(
|
||||
additionalContextProviders: IContextProvider[],
|
||||
): Promise<BrowserSerializedContinueConfig> {
|
||||
if (!this.savedBrowserConfig) {
|
||||
const continueConfig = await this.loadConfig(additionalContextProviders);
|
||||
this.savedBrowserConfig = finalToBrowserConfig(continueConfig);
|
||||
}
|
||||
return this.savedBrowserConfig;
|
||||
}
|
||||
}
|
||||
|
||||
export class ConfigHandler {
|
||||
private readonly globalContext = new GlobalContext();
|
||||
|
|
@ -159,50 +86,59 @@ export class ConfigHandler {
|
|||
|
||||
private async fetchControlPlaneProfiles() {
|
||||
// Get the profiles and create their lifecycle managers
|
||||
this.controlPlaneClient.listWorkspaces().then(async (workspaces) => {
|
||||
this.profiles = this.profiles.filter(
|
||||
(profile) => profile.profileId === "local",
|
||||
);
|
||||
workspaces.forEach((workspace) => {
|
||||
const profileLoader = new ControlPlaneProfileLoader(
|
||||
workspace.id,
|
||||
workspace.name,
|
||||
this.controlPlaneClient,
|
||||
this.ide,
|
||||
this.ideSettingsPromise,
|
||||
this.writeLog,
|
||||
this.reloadConfig.bind(this),
|
||||
this.controlPlaneClient
|
||||
.listWorkspaces()
|
||||
.then(async (workspaces) => {
|
||||
this.profiles = this.profiles.filter(
|
||||
(profile) => profile.profileId === "local",
|
||||
);
|
||||
this.profiles.push(new ProfileLifecycleManager(profileLoader));
|
||||
workspaces.forEach((workspace) => {
|
||||
const profileLoader = new ControlPlaneProfileLoader(
|
||||
workspace.id,
|
||||
workspace.name,
|
||||
this.controlPlaneClient,
|
||||
this.ide,
|
||||
this.ideSettingsPromise,
|
||||
this.writeLog,
|
||||
this.reloadConfig.bind(this),
|
||||
);
|
||||
this.profiles.push(new ProfileLifecycleManager(profileLoader));
|
||||
});
|
||||
|
||||
this.notifyProfileListeners(
|
||||
this.profiles.map((profile) => profile.profileDescription),
|
||||
);
|
||||
|
||||
// Check the last selected workspace, and reload if it isn't local
|
||||
const workspaceId = await this.getWorkspaceId();
|
||||
const lastSelectedWorkspaceIds =
|
||||
this.globalContext.get("lastSelectedProfileForWorkspace") ?? {};
|
||||
const selectedWorkspaceId = lastSelectedWorkspaceIds[workspaceId];
|
||||
if (selectedWorkspaceId) {
|
||||
this.selectedProfileId = selectedWorkspaceId;
|
||||
await this.loadConfig();
|
||||
} else {
|
||||
// Otherwise we stick with local profile, and record choice
|
||||
lastSelectedWorkspaceIds[workspaceId] = this.selectedProfileId;
|
||||
this.globalContext.update(
|
||||
"lastSelectedProfileForWorkspace",
|
||||
lastSelectedWorkspaceIds,
|
||||
);
|
||||
}
|
||||
})
|
||||
.catch((e) => {
|
||||
console.error(e);
|
||||
});
|
||||
|
||||
this.notifyProfileListeners(
|
||||
this.profiles.map((profile) => profile.profileDescription),
|
||||
);
|
||||
|
||||
// Check the last selected workspace, and reload if it isn't local
|
||||
const workspaceId = await this.getWorkspaceId();
|
||||
const lastSelectedWorkspaceIds =
|
||||
this.globalContext.get("lastSelectedProfileForWorkspace") ?? {};
|
||||
const selectedWorkspaceId = lastSelectedWorkspaceIds[workspaceId];
|
||||
if (selectedWorkspaceId) {
|
||||
this.selectedProfileId = selectedWorkspaceId;
|
||||
this.loadConfig();
|
||||
} else {
|
||||
// Otherwise we stick with local profile, and record choice
|
||||
lastSelectedWorkspaceIds[workspaceId] = this.selectedProfileId;
|
||||
this.globalContext.update(
|
||||
"lastSelectedProfileForWorkspace",
|
||||
lastSelectedWorkspaceIds,
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
async setSelectedProfile(profileId: string) {
|
||||
this.selectedProfileId = profileId;
|
||||
const newConfig = await this.loadConfig();
|
||||
this.notifyConfigListeners(newConfig);
|
||||
this.notifyConfigListeners({
|
||||
config: newConfig,
|
||||
errors: undefined,
|
||||
configLoadInterrupted: false,
|
||||
});
|
||||
const selectedProfiles =
|
||||
this.globalContext.get("lastSelectedProfileForWorkspace") ?? {};
|
||||
selectedProfiles[await this.getWorkspaceId()] = profileId;
|
||||
|
|
@ -248,24 +184,31 @@ export class ConfigHandler {
|
|||
}
|
||||
}
|
||||
|
||||
private notifyConfigListeners(newConfig: ContinueConfig) {
|
||||
private notifyConfigListeners(result: ConfigResult<ContinueConfig>) {
|
||||
// Notify listeners that config changed
|
||||
for (const listener of this.updateListeners) {
|
||||
listener(newConfig);
|
||||
listener(result);
|
||||
}
|
||||
}
|
||||
|
||||
private updateListeners: ((newConfig: ContinueConfig) => void)[] = [];
|
||||
onConfigUpdate(listener: (newConfig: ContinueConfig) => void) {
|
||||
private updateListeners: ConfigUpdateFunction[] = [];
|
||||
|
||||
onConfigUpdate(listener: ConfigUpdateFunction) {
|
||||
this.updateListeners.push(listener);
|
||||
}
|
||||
|
||||
async reloadConfig() {
|
||||
// TODO: this isn't right, there are two different senses in which you want to "reload"
|
||||
const newConfig = await this.currentProfile.reloadConfig();
|
||||
this.inactiveProfiles.forEach((profile) => profile.clearConfig());
|
||||
this.notifyConfigListeners(newConfig);
|
||||
return newConfig;
|
||||
|
||||
const { config, errors, configLoadInterrupted } =
|
||||
await this.currentProfile.reloadConfig();
|
||||
|
||||
if (config) {
|
||||
this.inactiveProfiles.forEach((profile) => profile.clearConfig());
|
||||
}
|
||||
|
||||
this.notifyConfigListeners({ config, errors, configLoadInterrupted });
|
||||
return { config, errors };
|
||||
}
|
||||
|
||||
getSerializedConfig(): Promise<BrowserSerializedContinueConfig> {
|
||||
|
|
|
|||
99
core/config/ProfileLifecycleManager.ts
Normal file
99
core/config/ProfileLifecycleManager.ts
Normal file
|
|
@ -0,0 +1,99 @@
|
|||
import { config } from "dotenv";
|
||||
import {
|
||||
BrowserSerializedContinueConfig,
|
||||
ContinueConfig,
|
||||
IContextProvider,
|
||||
} from "../index.js";
|
||||
|
||||
import { ConfigResult, finalToBrowserConfig } from "./load.js";
|
||||
|
||||
import { IProfileLoader } from "./profile/IProfileLoader.js";
|
||||
|
||||
export interface ProfileDescription {
|
||||
title: string;
|
||||
id: string;
|
||||
}
|
||||
|
||||
export class ProfileLifecycleManager {
|
||||
private savedConfig: ContinueConfig | undefined;
|
||||
private savedBrowserConfig?: BrowserSerializedContinueConfig;
|
||||
private pendingConfigPromise?: Promise<ContinueConfig>;
|
||||
|
||||
constructor(private readonly profileLoader: IProfileLoader) {}
|
||||
|
||||
get profileId() {
|
||||
return this.profileLoader.profileId;
|
||||
}
|
||||
|
||||
get profileTitle() {
|
||||
return this.profileLoader.profileTitle;
|
||||
}
|
||||
|
||||
get profileDescription(): ProfileDescription {
|
||||
return {
|
||||
title: this.profileTitle,
|
||||
id: this.profileId,
|
||||
};
|
||||
}
|
||||
|
||||
clearConfig() {
|
||||
this.savedConfig = undefined;
|
||||
this.savedBrowserConfig = undefined;
|
||||
this.pendingConfigPromise = undefined;
|
||||
}
|
||||
|
||||
// Clear saved config and reload
|
||||
async reloadConfig(): Promise<ConfigResult<ContinueConfig>> {
|
||||
this.savedConfig = undefined;
|
||||
this.savedBrowserConfig = undefined;
|
||||
this.pendingConfigPromise = undefined;
|
||||
|
||||
return this.profileLoader.doLoadConfig();
|
||||
}
|
||||
|
||||
async loadConfig(
|
||||
additionalContextProviders: IContextProvider[],
|
||||
): Promise<ContinueConfig> {
|
||||
// If we already have a config, return it
|
||||
if (this.savedConfig) {
|
||||
return this.savedConfig;
|
||||
} else if (this.pendingConfigPromise) {
|
||||
return this.pendingConfigPromise;
|
||||
}
|
||||
|
||||
// Set pending config promise
|
||||
this.pendingConfigPromise = new Promise(async (resolve, reject) => {
|
||||
const { config: newConfig, errors } =
|
||||
await this.profileLoader.doLoadConfig();
|
||||
|
||||
if (newConfig) {
|
||||
// Add registered context providers
|
||||
newConfig.contextProviders = (newConfig.contextProviders ?? []).concat(
|
||||
additionalContextProviders,
|
||||
);
|
||||
|
||||
this.savedConfig = newConfig;
|
||||
resolve(newConfig);
|
||||
} else if (errors) {
|
||||
reject(
|
||||
`Error in config.json: ${errors.map((item) => item.message).join(" | ")}`,
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
// Wait for the config promise to resolve
|
||||
this.savedConfig = await this.pendingConfigPromise;
|
||||
this.pendingConfigPromise = undefined;
|
||||
return this.savedConfig;
|
||||
}
|
||||
|
||||
async getSerializedConfig(
|
||||
additionalContextProviders: IContextProvider[],
|
||||
): Promise<BrowserSerializedContinueConfig> {
|
||||
if (!this.savedBrowserConfig) {
|
||||
const continueConfig = await this.loadConfig(additionalContextProviders);
|
||||
this.savedBrowserConfig = finalToBrowserConfig(continueConfig);
|
||||
}
|
||||
return this.savedBrowserConfig;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,15 +1,16 @@
|
|||
import * as JSONC from "comment-json";
|
||||
import * as fs from "fs";
|
||||
import path from "path";
|
||||
import * as tar from "tar";
|
||||
import {
|
||||
slashCommandFromDescription,
|
||||
slashFromCustomCommand,
|
||||
} from "../commands/index.js";
|
||||
import CustomContextProviderClass from "../context/providers/CustomContextProvider.js";
|
||||
import FileContextProvider from "../context/providers/FileContextProvider.js";
|
||||
import { contextProviderClassFromName } from "../context/providers/index.js";
|
||||
import { AllRerankers } from "../context/rerankers/index.js";
|
||||
import { LLMReranker } from "../context/rerankers/llm.js";
|
||||
import CustomContextProviderClass from "../context/providers/CustomContextProvider";
|
||||
import FileContextProvider from "../context/providers/FileContextProvider";
|
||||
import { contextProviderClassFromName } from "../context/providers/index";
|
||||
import { AllRerankers } from "../context/rerankers/index";
|
||||
import { LLMReranker } from "../context/rerankers/llm";
|
||||
import {
|
||||
BrowserSerializedContinueConfig,
|
||||
Config,
|
||||
|
|
@ -28,40 +29,51 @@ import {
|
|||
RerankerDescription,
|
||||
SerializedContinueConfig,
|
||||
SlashCommand,
|
||||
} from "../index.js";
|
||||
import TransformersJsEmbeddingsProvider from "../indexing/embeddings/TransformersJsEmbeddingsProvider.js";
|
||||
import { allEmbeddingsProviders } from "../indexing/embeddings/index.js";
|
||||
import { BaseLLM } from "../llm/index.js";
|
||||
import CustomLLMClass from "../llm/llms/CustomLLM.js";
|
||||
import FreeTrial from "../llm/llms/FreeTrial.js";
|
||||
import { llmFromDescription } from "../llm/llms/index.js";
|
||||
|
||||
} from "..";
|
||||
import TransformersJsEmbeddingsProvider from "../indexing/embeddings/TransformersJsEmbeddingsProvider";
|
||||
import { allEmbeddingsProviders } from "../indexing/embeddings";
|
||||
import { BaseLLM } from "../llm";
|
||||
import CustomLLMClass from "../llm/llms/CustomLLM";
|
||||
import FreeTrial from "../llm/llms/FreeTrial";
|
||||
import { llmFromDescription } from "../llm/llms";
|
||||
import os from "os";
|
||||
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";
|
||||
import { copyOf } from "../util/index.js";
|
||||
import mergeJson from "../util/merge.js";
|
||||
import CodebaseContextProvider from "../context/providers/CodebaseContextProvider";
|
||||
import ContinueProxyContextProvider from "../context/providers/ContinueProxyContextProvider";
|
||||
import { fetchwithRequestOptions } from "../util/fetchWithOptions";
|
||||
import { copyOf } from "../util";
|
||||
import mergeJson from "../util/merge";
|
||||
import {
|
||||
DEFAULT_CONFIG_TS_CONTENTS,
|
||||
getConfigJsPath,
|
||||
getConfigJsPathForRemote,
|
||||
getConfigJsonPath,
|
||||
getConfigJsonPathForRemote,
|
||||
getConfigTsPath,
|
||||
getContinueDotEnv,
|
||||
getEsbuildBinaryPath,
|
||||
readAllGlobalPromptFiles,
|
||||
} from "../util/paths.js";
|
||||
} from "../util/paths";
|
||||
import {
|
||||
defaultContextProvidersJetBrains,
|
||||
defaultContextProvidersVsCode,
|
||||
defaultSlashCommandsJetBrains,
|
||||
defaultSlashCommandsVscode,
|
||||
} from "./default.js";
|
||||
} from "./default";
|
||||
import {
|
||||
DEFAULT_PROMPTS_FOLDER,
|
||||
getPromptFiles,
|
||||
slashCommandFromPromptFile,
|
||||
} from "./promptFile.js";
|
||||
import { validateConfig, ConfigValidationError } from "./validation.js";
|
||||
|
||||
import { GlobalContext } from "../util/GlobalContext";
|
||||
|
||||
export interface ConfigResult<T> {
|
||||
config: T | undefined;
|
||||
errors: ConfigValidationError[] | undefined;
|
||||
configLoadInterrupted: boolean;
|
||||
}
|
||||
|
||||
function resolveSerializedConfig(filepath: string): SerializedContinueConfig {
|
||||
let content = fs.readFileSync(filepath, "utf8");
|
||||
|
|
@ -97,7 +109,7 @@ function loadSerializedConfig(
|
|||
ideSettings: IdeSettings,
|
||||
ideType: IdeType,
|
||||
overrideConfigJson: SerializedContinueConfig | undefined,
|
||||
): SerializedContinueConfig {
|
||||
): ConfigResult<SerializedContinueConfig> {
|
||||
const configPath = getConfigJsonPath(ideType);
|
||||
let config: SerializedContinueConfig = overrideConfigJson!;
|
||||
if (!config) {
|
||||
|
|
@ -108,6 +120,16 @@ function loadSerializedConfig(
|
|||
}
|
||||
}
|
||||
|
||||
const errors = validateConfig(config);
|
||||
|
||||
if (errors?.some((error) => error.fatal)) {
|
||||
return {
|
||||
errors,
|
||||
config: undefined,
|
||||
configLoadInterrupted: true,
|
||||
};
|
||||
}
|
||||
|
||||
if (config.allowAnonymousTelemetry === undefined) {
|
||||
config.allowAnonymousTelemetry = true;
|
||||
}
|
||||
|
|
@ -142,7 +164,7 @@ function loadSerializedConfig(
|
|||
? [...defaultSlashCommandsVscode]
|
||||
: [...defaultSlashCommandsJetBrains];
|
||||
|
||||
return config;
|
||||
return { config, errors, configLoadInterrupted: false };
|
||||
}
|
||||
|
||||
async function serializedToIntermediateConfig(
|
||||
|
|
@ -492,80 +514,184 @@ function finalToBrowserConfig(
|
|||
};
|
||||
}
|
||||
|
||||
function getTarget() {
|
||||
const os =
|
||||
{
|
||||
aix: "linux",
|
||||
darwin: "darwin",
|
||||
freebsd: "linux",
|
||||
linux: "linux",
|
||||
openbsd: "linux",
|
||||
sunos: "linux",
|
||||
win32: "win32",
|
||||
}[process.platform as string] ?? "linux";
|
||||
const arch = {
|
||||
arm: "arm64",
|
||||
arm64: "arm64",
|
||||
ia32: "x64",
|
||||
loong64: "arm64",
|
||||
mips: "arm64",
|
||||
mipsel: "arm64",
|
||||
ppc: "x64",
|
||||
ppc64: "x64",
|
||||
riscv64: "arm64",
|
||||
s390: "x64",
|
||||
s390x: "x64",
|
||||
x64: "x64",
|
||||
}[process.arch];
|
||||
|
||||
return `${os}-${arch}`;
|
||||
}
|
||||
|
||||
function escapeSpacesInPath(p: string): string {
|
||||
return p.replace(/ /g, "\\ ");
|
||||
}
|
||||
|
||||
async function buildConfigTs() {
|
||||
if (!fs.existsSync(getConfigTsPath())) {
|
||||
return undefined;
|
||||
async function handleEsbuildInstallation(ide: IDE, ideType: IdeType) {
|
||||
// JetBrains is currently the only IDE that we've reached the plugin size limit and
|
||||
// therefore need to install esbuild manually to reduce the size
|
||||
if (ideType !== "jetbrains") {
|
||||
return;
|
||||
}
|
||||
|
||||
const globalContext = new GlobalContext();
|
||||
if (globalContext.get("hasDismissedConfigTsNoticeJetBrains")) {
|
||||
return;
|
||||
}
|
||||
|
||||
const esbuildPath = getEsbuildBinaryPath();
|
||||
|
||||
if (fs.existsSync(esbuildPath)) {
|
||||
return;
|
||||
}
|
||||
|
||||
console.debug("No esbuild binary detected");
|
||||
|
||||
const shouldInstall = await promptEsbuildInstallation(ide);
|
||||
|
||||
if (shouldInstall) {
|
||||
await downloadAndInstallEsbuild(ide);
|
||||
}
|
||||
}
|
||||
|
||||
async function promptEsbuildInstallation(ide: IDE): Promise<boolean> {
|
||||
const installMsg = "Install esbuild";
|
||||
const dismissMsg = "Dismiss";
|
||||
|
||||
const res = await ide.showToast(
|
||||
"warning",
|
||||
"You're using a custom 'config.ts' file, which requires 'esbuild' to be installed. Would you like to install it now?",
|
||||
dismissMsg,
|
||||
installMsg,
|
||||
);
|
||||
|
||||
if (res === dismissMsg) {
|
||||
const globalContext = new GlobalContext();
|
||||
globalContext.update("hasDismissedConfigTsNoticeJetBrains", true);
|
||||
return false;
|
||||
}
|
||||
|
||||
return res === installMsg;
|
||||
}
|
||||
|
||||
/**
|
||||
* The download logic is adapted from here: https://esbuild.github.io/getting-started/#download-a-build
|
||||
*/
|
||||
async function downloadAndInstallEsbuild(ide: IDE) {
|
||||
const esbuildPath = getEsbuildBinaryPath();
|
||||
const tempDir = fs.mkdtempSync(path.join(os.tmpdir(), "esbuild-"));
|
||||
|
||||
try {
|
||||
const target = `${os.platform()}-${os.arch()}`;
|
||||
const version = "0.19.11";
|
||||
const url = `https://registry.npmjs.org/@esbuild/${target}/-/${target}-${version}.tgz`;
|
||||
const tgzPath = path.join(tempDir, `esbuild-${version}.tgz`);
|
||||
|
||||
console.debug(`Downloading esbuild from: ${url}`);
|
||||
execSync(`curl -fo "${tgzPath}" "${url}"`);
|
||||
|
||||
console.debug(`Extracting tgz file to: ${tempDir}`);
|
||||
await tar.x({
|
||||
file: tgzPath,
|
||||
cwd: tempDir,
|
||||
strip: 2, // Remove the top two levels of directories
|
||||
});
|
||||
|
||||
// Ensure the destination directory exists
|
||||
const destDir = path.dirname(esbuildPath);
|
||||
if (!fs.existsSync(destDir)) {
|
||||
fs.mkdirSync(destDir, { recursive: true });
|
||||
}
|
||||
|
||||
// Move the file
|
||||
const extractedBinaryPath = path.join(tempDir, "esbuild");
|
||||
fs.renameSync(extractedBinaryPath, esbuildPath);
|
||||
|
||||
// Ensure the binary is executable (not needed on Windows)
|
||||
if (os.platform() !== "win32") {
|
||||
fs.chmodSync(esbuildPath, 0o755);
|
||||
}
|
||||
|
||||
// Clean up
|
||||
fs.unlinkSync(tgzPath);
|
||||
fs.rmSync(tempDir, { recursive: true });
|
||||
|
||||
await ide.showToast(
|
||||
"info",
|
||||
`'esbuild' successfully installed to ${esbuildPath}`,
|
||||
);
|
||||
} catch (error) {
|
||||
console.error("Error downloading or saving esbuild binary:", error);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
async function tryBuildConfigTs() {
|
||||
try {
|
||||
if (process.env.IS_BINARY === "true") {
|
||||
execSync(
|
||||
`${escapeSpacesInPath(path.dirname(process.execPath))}/esbuild${
|
||||
getTarget().startsWith("win32") ? ".exe" : ""
|
||||
} ${escapeSpacesInPath(
|
||||
getConfigTsPath(),
|
||||
)} --bundle --outfile=${escapeSpacesInPath(
|
||||
getConfigJsPath(),
|
||||
)} --platform=node --format=cjs --sourcemap --external:fetch --external:fs --external:path --external:os --external:child_process`,
|
||||
);
|
||||
await buildConfigTsWithBinary();
|
||||
} else {
|
||||
// Dynamic import esbuild so potentially disastrous errors can be caught
|
||||
const esbuild = await import("esbuild");
|
||||
|
||||
await esbuild.build({
|
||||
entryPoints: [getConfigTsPath()],
|
||||
bundle: true,
|
||||
platform: "node",
|
||||
format: "cjs",
|
||||
outfile: getConfigJsPath(),
|
||||
external: ["fetch", "fs", "path", "os", "child_process"],
|
||||
sourcemap: true,
|
||||
});
|
||||
await buildConfigTsWithNodeModule();
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(
|
||||
`Build error. Please check your ~/.continue/config.ts file: ${e}`,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
async function buildConfigTsWithBinary() {
|
||||
const cmd = [
|
||||
escapeSpacesInPath(getEsbuildBinaryPath()),
|
||||
escapeSpacesInPath(getConfigTsPath()),
|
||||
"--bundle",
|
||||
`--outfile=${escapeSpacesInPath(getConfigJsPath())}`,
|
||||
"--platform=node",
|
||||
"--format=cjs",
|
||||
"--sourcemap",
|
||||
"--external:fetch",
|
||||
"--external:fs",
|
||||
"--external:path",
|
||||
"--external:os",
|
||||
"--external:child_process",
|
||||
].join(" ");
|
||||
|
||||
execSync(cmd);
|
||||
}
|
||||
|
||||
async function buildConfigTsWithNodeModule() {
|
||||
const { build } = await import("esbuild");
|
||||
|
||||
await build({
|
||||
entryPoints: [getConfigTsPath()],
|
||||
bundle: true,
|
||||
platform: "node",
|
||||
format: "cjs",
|
||||
outfile: getConfigJsPath(),
|
||||
external: ["fetch", "fs", "path", "os", "child_process"],
|
||||
sourcemap: true,
|
||||
});
|
||||
}
|
||||
|
||||
function readConfigJs(): string | undefined {
|
||||
const configJsPath = getConfigJsPath();
|
||||
|
||||
if (!fs.existsSync(configJsPath)) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
if (!fs.existsSync(getConfigJsPath())) {
|
||||
return undefined;
|
||||
return fs.readFileSync(configJsPath, "utf8");
|
||||
}
|
||||
|
||||
async function buildConfigTsandReadConfigJs(ide: IDE, ideType: IdeType) {
|
||||
const configTsPath = getConfigTsPath();
|
||||
|
||||
if (!fs.existsSync(configTsPath)) {
|
||||
return;
|
||||
}
|
||||
return fs.readFileSync(getConfigJsPath(), "utf8");
|
||||
|
||||
const currentContent = fs.readFileSync(configTsPath, "utf8");
|
||||
|
||||
// If the user hasn't modified the default config.ts, don't bother building
|
||||
if (currentContent.trim() === DEFAULT_CONFIG_TS_CONTENTS.trim()) {
|
||||
return;
|
||||
}
|
||||
|
||||
await handleEsbuildInstallation(ide, ideType);
|
||||
await tryBuildConfigTs();
|
||||
|
||||
return readConfigJs();
|
||||
}
|
||||
|
||||
async function loadFullConfigNode(
|
||||
|
|
@ -577,20 +703,28 @@ async function loadFullConfigNode(
|
|||
writeLog: (log: string) => Promise<void>,
|
||||
workOsAccessToken: string | undefined,
|
||||
overrideConfigJson: SerializedContinueConfig | undefined,
|
||||
): Promise<ContinueConfig> {
|
||||
): Promise<ConfigResult<ContinueConfig>> {
|
||||
// Serialized config
|
||||
let serialized = loadSerializedConfig(
|
||||
let {
|
||||
config: serialized,
|
||||
errors,
|
||||
configLoadInterrupted,
|
||||
} = loadSerializedConfig(
|
||||
workspaceConfigs,
|
||||
ideSettings,
|
||||
ideType,
|
||||
overrideConfigJson,
|
||||
);
|
||||
|
||||
if (!serialized || configLoadInterrupted) {
|
||||
return { errors, config: undefined, configLoadInterrupted: true };
|
||||
}
|
||||
|
||||
// Convert serialized to intermediate config
|
||||
let intermediate = await serializedToIntermediateConfig(serialized, ide);
|
||||
|
||||
// Apply config.ts to modify intermediate config
|
||||
const configJsContents = await buildConfigTs();
|
||||
const configJsContents = await buildConfigTsandReadConfigJs(ide, ideType);
|
||||
if (configJsContents) {
|
||||
try {
|
||||
// Try config.ts first
|
||||
|
|
@ -653,7 +787,7 @@ async function loadFullConfigNode(
|
|||
writeLog,
|
||||
workOsAccessToken,
|
||||
);
|
||||
return finalConfig;
|
||||
return { config: finalConfig, errors, configLoadInterrupted: false };
|
||||
}
|
||||
|
||||
export {
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ import {
|
|||
} from "../../index.js";
|
||||
import { IProfileLoader } from "./IProfileLoader.js";
|
||||
import doLoadConfig from "./doLoadConfig.js";
|
||||
import { ConfigResult } from "../load.js";
|
||||
|
||||
export default class ControlPlaneProfileLoader implements IProfileLoader {
|
||||
private static RELOAD_INTERVAL = 1000 * 60 * 15; // every 15 minutes
|
||||
|
|
@ -36,7 +37,7 @@ export default class ControlPlaneProfileLoader implements IProfileLoader {
|
|||
}, ControlPlaneProfileLoader.RELOAD_INTERVAL);
|
||||
}
|
||||
|
||||
async doLoadConfig(): Promise<ContinueConfig> {
|
||||
async doLoadConfig(): Promise<ConfigResult<ContinueConfig>> {
|
||||
const settings =
|
||||
this.workspaceSettings ??
|
||||
((await this.controlPlaneClient.getSettingsForWorkspace(
|
||||
|
|
|
|||
|
|
@ -1,11 +1,12 @@
|
|||
// ProfileHandlers manage the loading of a config, allowing us to abstract over different ways of getting to a ContinueConfig
|
||||
|
||||
import { ContinueConfig } from "../../index.js";
|
||||
import { ConfigResult } from "../load.js";
|
||||
|
||||
// After we have the ContinueConfig, the ConfigHandler takes care of everything else (loading models, lifecycle, etc.)
|
||||
export interface IProfileLoader {
|
||||
profileTitle: string;
|
||||
profileId: string;
|
||||
doLoadConfig(): Promise<ContinueConfig>;
|
||||
doLoadConfig(): Promise<ConfigResult<ContinueConfig>>;
|
||||
setIsActive(isActive: boolean): void;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
import { ControlPlaneClient } from "../../control-plane/client.js";
|
||||
import { ContinueConfig, IDE, IdeSettings } from "../../index.js";
|
||||
import { ConfigResult } from "../load.js";
|
||||
import doLoadConfig from "./doLoadConfig.js";
|
||||
import { IProfileLoader } from "./IProfileLoader.js";
|
||||
|
||||
|
|
@ -15,7 +16,7 @@ export default class LocalProfileLoader implements IProfileLoader {
|
|||
private writeLog: (message: string) => Promise<void>,
|
||||
) {}
|
||||
|
||||
async doLoadConfig(): Promise<ContinueConfig> {
|
||||
async doLoadConfig(): Promise<ConfigResult<ContinueConfig>> {
|
||||
return doLoadConfig(
|
||||
this.ide,
|
||||
this.ideSettingsPromise,
|
||||
|
|
|
|||
|
|
@ -1,22 +1,20 @@
|
|||
import { ContinueProxyReranker } from "../../context/rerankers/ContinueProxyReranker.js";
|
||||
import { ControlPlaneProxyInfo } from "../../control-plane/analytics/IAnalyticsProvider.js";
|
||||
import {
|
||||
ControlPlaneClient,
|
||||
DEFAULT_CONTROL_PLANE_PROXY_URL,
|
||||
} from "../../control-plane/client.js";
|
||||
import { TeamAnalytics } from "../../control-plane/TeamAnalytics.js";
|
||||
import {
|
||||
ContinueConfig,
|
||||
ContinueRcJson,
|
||||
IDE,
|
||||
IdeSettings,
|
||||
SerializedContinueConfig,
|
||||
} 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";
|
||||
} from "../../";
|
||||
import { ContinueProxyReranker } from "../../context/rerankers/ContinueProxyReranker.js";
|
||||
import { ControlPlaneProxyInfo } from "../../control-plane/analytics/IAnalyticsProvider.js";
|
||||
import { ControlPlaneClient } from "../../control-plane/client.js";
|
||||
import { controlPlaneEnv } from "../../control-plane/env.js";
|
||||
import { TeamAnalytics } from "../../control-plane/TeamAnalytics.js";
|
||||
import ContinueProxyEmbeddingsProvider from "../../indexing/embeddings/ContinueProxyEmbeddingsProvider";
|
||||
import ContinueProxy from "../../llm/llms/stubs/ContinueProxy";
|
||||
import { Telemetry } from "../../util/posthog";
|
||||
import { TTS } from "../../util/tts";
|
||||
import { ConfigResult, loadFullConfigNode } from "../load";
|
||||
|
||||
export default async function doLoadConfig(
|
||||
ide: IDE,
|
||||
|
|
@ -25,20 +23,18 @@ export default async function doLoadConfig(
|
|||
writeLog: (message: string) => Promise<void>,
|
||||
overrideConfigJson: SerializedContinueConfig | undefined,
|
||||
workspaceId?: string,
|
||||
) {
|
||||
let workspaceConfigs: ContinueRcJson[] = [];
|
||||
try {
|
||||
workspaceConfigs = await ide.getWorkspaceConfigs();
|
||||
} catch (e) {
|
||||
console.warn("Failed to load workspace configs");
|
||||
}
|
||||
|
||||
): Promise<ConfigResult<ContinueConfig>> {
|
||||
const workspaceConfigs = await getWorkspaceConfigs(ide);
|
||||
const ideInfo = await ide.getIdeInfo();
|
||||
const uniqueId = await ide.getUniqueId();
|
||||
const ideSettings = await ideSettingsPromise;
|
||||
const workOsAccessToken = await controlPlaneClient.getAccessToken();
|
||||
|
||||
let newConfig = await loadFullConfigNode(
|
||||
let {
|
||||
config: newConfig,
|
||||
errors,
|
||||
configLoadInterrupted,
|
||||
} = await loadFullConfigNode(
|
||||
ide,
|
||||
workspaceConfigs,
|
||||
ideSettings,
|
||||
|
|
@ -48,6 +44,11 @@ export default async function doLoadConfig(
|
|||
workOsAccessToken,
|
||||
overrideConfigJson,
|
||||
);
|
||||
|
||||
if (configLoadInterrupted || !newConfig) {
|
||||
return { errors, config: newConfig, configLoadInterrupted: true };
|
||||
}
|
||||
|
||||
newConfig.allowAnonymousTelemetry =
|
||||
newConfig.allowAnonymousTelemetry && (await ide.isTelemetryEnabled());
|
||||
|
||||
|
|
@ -62,9 +63,13 @@ export default async function doLoadConfig(
|
|||
await TTS.setup();
|
||||
|
||||
// Set up control plane proxy if configured
|
||||
let controlPlaneProxyUrl: string =
|
||||
(newConfig as any).controlPlane?.proxyUrl ??
|
||||
DEFAULT_CONTROL_PLANE_PROXY_URL;
|
||||
const controlPlane = (newConfig as any).controlPlane;
|
||||
const useOnPremProxy =
|
||||
controlPlane?.useContinueForTeamsProxy === false && controlPlane?.proxyUrl;
|
||||
let controlPlaneProxyUrl: string = useOnPremProxy
|
||||
? controlPlane?.proxyUrl
|
||||
: controlPlaneEnv.DEFAULT_CONTROL_PLANE_PROXY_URL;
|
||||
|
||||
if (!controlPlaneProxyUrl.endsWith("/")) {
|
||||
controlPlaneProxyUrl += "/";
|
||||
}
|
||||
|
|
@ -89,7 +94,7 @@ export default async function doLoadConfig(
|
|||
controlPlaneProxyInfo,
|
||||
);
|
||||
|
||||
return newConfig;
|
||||
return { config: newConfig, errors, configLoadInterrupted: false };
|
||||
}
|
||||
|
||||
// Pass ControlPlaneProxyInfo to objects that need it
|
||||
|
|
@ -117,3 +122,21 @@ async function injectControlPlaneProxyInfo(
|
|||
|
||||
return config;
|
||||
}
|
||||
|
||||
async function getWorkspaceConfigs(ide: IDE): Promise<ContinueRcJson[]> {
|
||||
const ideInfo = await ide.getIdeInfo();
|
||||
let workspaceConfigs: ContinueRcJson[] = [];
|
||||
|
||||
try {
|
||||
workspaceConfigs = await ide.getWorkspaceConfigs();
|
||||
|
||||
// Config is sent over the wire from JB so we need to parse it
|
||||
if (ideInfo.ideType === "jetbrains") {
|
||||
workspaceConfigs = (workspaceConfigs as any).map(JSON.parse);
|
||||
}
|
||||
} catch (e) {
|
||||
console.debug("Failed to load workspace configs: ", e);
|
||||
}
|
||||
|
||||
return workspaceConfigs;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -151,7 +151,7 @@ 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 diff = await context.ide.getDiff(false);
|
||||
const currentFilePath = await context.ide.getCurrentFile();
|
||||
const currentFile = currentFilePath
|
||||
? await context.ide.readFile(currentFilePath)
|
||||
|
|
|
|||
|
|
@ -434,7 +434,7 @@ declare global {
|
|||
export interface IDE {
|
||||
getIdeInfo(): Promise<IdeInfo>;
|
||||
getIdeSettings(): Promise<IdeSettings>;
|
||||
getDiff(): Promise<string>;
|
||||
getDiff(includeUnstaged: boolean): Promise<string>;
|
||||
isTelemetryEnabled(): Promise<boolean>;
|
||||
getUniqueId(): Promise<string>;
|
||||
getTerminalContents(): Promise<string>;
|
||||
|
|
@ -531,7 +531,7 @@ declare global {
|
|||
| "diff"
|
||||
| "github"
|
||||
| "terminal"
|
||||
| "locals"
|
||||
| "debugger"
|
||||
| "open"
|
||||
| "google"
|
||||
| "search"
|
||||
|
|
@ -548,7 +548,7 @@ declare global {
|
|||
| "gitlab-mr"
|
||||
| "os"
|
||||
| "currentFile"
|
||||
| "greptile;
|
||||
| "greptile";
|
||||
|
||||
type TemplateType =
|
||||
| "llama2"
|
||||
|
|
|
|||
133
core/config/validation.ts
Normal file
133
core/config/validation.ts
Normal file
|
|
@ -0,0 +1,133 @@
|
|||
import { SerializedContinueConfig } from "../";
|
||||
import { Telemetry } from "../util/posthog";
|
||||
|
||||
export interface ConfigValidationError {
|
||||
fatal: boolean;
|
||||
message: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validates a SerializedContinueConfig object to ensure all properties are correctly formed.
|
||||
* @param config The configuration object to validate.
|
||||
* @returns An array of error messages if there are any. Otherwise, the config is valid.
|
||||
*/
|
||||
export function validateConfig(config: SerializedContinueConfig) {
|
||||
const errors: ConfigValidationError[] = [];
|
||||
|
||||
// Validate models
|
||||
if (!Array.isArray(config.models) || config.models.length === 0) {
|
||||
errors.push({
|
||||
fatal: true,
|
||||
message: "The 'models' field should be a non-empty array.",
|
||||
});
|
||||
} else {
|
||||
config.models.forEach((model, index) => {
|
||||
if (typeof model.title !== "string" || model.title.trim() === "") {
|
||||
errors.push({
|
||||
fatal: true,
|
||||
message: `Model at index ${index} has an invalid or missing 'title'.`,
|
||||
});
|
||||
}
|
||||
if (typeof model.provider !== "string") {
|
||||
errors.push({
|
||||
fatal: true,
|
||||
message: `Model at index ${index} has an invalid 'provider'.`,
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Validate slashCommands
|
||||
if (config.slashCommands) {
|
||||
if (!Array.isArray(config.slashCommands)) {
|
||||
errors.push({
|
||||
fatal: true,
|
||||
message: "The 'slashCommands' field should be an array if defined.",
|
||||
});
|
||||
} else {
|
||||
config.slashCommands.forEach((command, index) => {
|
||||
if (typeof command.name !== "string" || command.name.trim() === "") {
|
||||
errors.push({
|
||||
fatal: true,
|
||||
message: `Slash command at index ${index} has an invalid or missing 'name'.`,
|
||||
});
|
||||
}
|
||||
if (typeof command.description !== "string") {
|
||||
errors.push({
|
||||
fatal: true,
|
||||
message: `Slash command at index ${index} has an invalid or missing 'description'.`,
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// Validate contextProviders
|
||||
if (config.contextProviders) {
|
||||
if (!Array.isArray(config.contextProviders)) {
|
||||
errors.push({
|
||||
fatal: true,
|
||||
message: "The 'contextProviders' field should be an array if defined.",
|
||||
});
|
||||
} else {
|
||||
config.contextProviders.forEach((provider, index) => {
|
||||
if (typeof provider.name !== "string" || provider.name.trim() === "") {
|
||||
errors.push({
|
||||
fatal: true,
|
||||
message: `Context provider at index ${index} has an invalid or missing 'name'.`,
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// Validate embeddingsProvider
|
||||
if (
|
||||
config.embeddingsProvider &&
|
||||
typeof config.embeddingsProvider !== "object"
|
||||
) {
|
||||
errors.push({
|
||||
fatal: true,
|
||||
message: "The 'embeddingsProvider' field should be an object if defined.",
|
||||
});
|
||||
}
|
||||
|
||||
// Validate reranker
|
||||
if (config.reranker && typeof config.reranker !== "object") {
|
||||
errors.push({
|
||||
fatal: true,
|
||||
message: "The 'reranker' field should be an object if defined.",
|
||||
});
|
||||
}
|
||||
|
||||
// Validate other boolean flags
|
||||
const booleanFlags: Array<
|
||||
keyof Pick<
|
||||
SerializedContinueConfig,
|
||||
"allowAnonymousTelemetry" | "disableIndexing" | "disableSessionTitles"
|
||||
>
|
||||
> = ["allowAnonymousTelemetry", "disableIndexing", "disableSessionTitles"];
|
||||
|
||||
booleanFlags.forEach((flag) => {
|
||||
if (config[flag] !== undefined && typeof config[flag] !== "boolean") {
|
||||
errors.push({
|
||||
fatal: true,
|
||||
message: `The '${flag}' field should be a boolean if defined.`,
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
if (errors.length > 0) {
|
||||
void Telemetry.capture(
|
||||
"configValidationError",
|
||||
{
|
||||
errors,
|
||||
},
|
||||
true,
|
||||
);
|
||||
|
||||
return errors;
|
||||
}
|
||||
|
||||
return undefined;
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
import { CONTROL_PLANE_URL } from "../../control-plane/client.js";
|
||||
import { controlPlaneEnv } from "../../control-plane/env.js";
|
||||
import {
|
||||
ContextItem,
|
||||
ContextProviderDescription,
|
||||
|
|
@ -36,7 +36,10 @@ class ContinueProxyContextProvider extends BaseContextProvider {
|
|||
args: LoadSubmenuItemsArgs,
|
||||
): Promise<ContextSubmenuItem[]> {
|
||||
const response = await args.fetch(
|
||||
new URL(`/proxy/context/${this.options.id}/list`, CONTROL_PLANE_URL),
|
||||
new URL(
|
||||
`/proxy/context/${this.options.id}/list`,
|
||||
controlPlaneEnv.CONTROL_PLANE_URL,
|
||||
),
|
||||
{
|
||||
method: "GET",
|
||||
headers: {
|
||||
|
|
@ -54,7 +57,10 @@ class ContinueProxyContextProvider extends BaseContextProvider {
|
|||
extras: ContextProviderExtras,
|
||||
): Promise<ContextItem[]> {
|
||||
const response = await extras.fetch(
|
||||
new URL(`/proxy/context/${this.options.id}/retrieve`, CONTROL_PLANE_URL),
|
||||
new URL(
|
||||
`/proxy/context/${this.options.id}/retrieve`,
|
||||
controlPlaneEnv.CONTROL_PLANE_URL,
|
||||
),
|
||||
{
|
||||
method: "POST",
|
||||
headers: {
|
||||
|
|
|
|||
|
|
@ -7,11 +7,11 @@ import {
|
|||
} from "../../index.js";
|
||||
import { BaseContextProvider } from "../index.js";
|
||||
|
||||
class LocalsProvider extends BaseContextProvider {
|
||||
class DebugLocalsProvider extends BaseContextProvider {
|
||||
static description: ContextProviderDescription = {
|
||||
title: "locals",
|
||||
displayTitle: "Locals",
|
||||
description: "Reference the contents of the local variables",
|
||||
title: "debugger",
|
||||
displayTitle: "Debugger",
|
||||
description: "Reference the contents of the local variables in the debugger",
|
||||
type: "submenu",
|
||||
renderInlineAs: "",
|
||||
};
|
||||
|
|
@ -42,7 +42,7 @@ class LocalsProvider extends BaseContextProvider {
|
|||
`This is a paused thread: ${thread?.name}\n` +
|
||||
`Current local variable contents: \n${localVariables}.\n` +
|
||||
`Current top level call stacks: ${callStackContents}`,
|
||||
name: "Locals",
|
||||
name: "Debugger",
|
||||
},
|
||||
];
|
||||
}
|
||||
|
|
@ -60,4 +60,4 @@ class LocalsProvider extends BaseContextProvider {
|
|||
}
|
||||
}
|
||||
|
||||
export default LocalsProvider;
|
||||
export default DebugLocalsProvider;
|
||||
|
|
@ -17,7 +17,7 @@ class DiffContextProvider extends BaseContextProvider {
|
|||
query: string,
|
||||
extras: ContextProviderExtras,
|
||||
): Promise<ContextItem[]> {
|
||||
const diff = await extras.ide.getDiff();
|
||||
const diff = await extras.ide.getDiff(false);
|
||||
return [
|
||||
{
|
||||
description: "The current git diff",
|
||||
|
|
|
|||
139
core/context/providers/DiscordContextProvider.ts
Normal file
139
core/context/providers/DiscordContextProvider.ts
Normal file
|
|
@ -0,0 +1,139 @@
|
|||
import {
|
||||
ContextItem,
|
||||
ContextProviderDescription,
|
||||
ContextProviderExtras,
|
||||
ContextSubmenuItem,
|
||||
LoadSubmenuItemsArgs,
|
||||
FetchFunction,
|
||||
} from "../../index.js";
|
||||
import { BaseContextProvider } from "../index.js";
|
||||
|
||||
//Define helper interfaces for Discord responses
|
||||
export interface DiscordChannel {
|
||||
id: string;
|
||||
name?: string;
|
||||
icon?: string;
|
||||
topic?: string;
|
||||
type?: number;
|
||||
guild_id?: string;
|
||||
}
|
||||
|
||||
interface DiscordMessage {
|
||||
id: string;
|
||||
content: string;
|
||||
author: {
|
||||
id: string;
|
||||
username: string;
|
||||
};
|
||||
timestamp: string;
|
||||
}
|
||||
|
||||
class DiscordContextProvider extends BaseContextProvider {
|
||||
static description: ContextProviderDescription = {
|
||||
title: "discord",
|
||||
displayTitle: "Discord",
|
||||
description: "Reference Discord messages from a channel",
|
||||
type: "submenu",
|
||||
};
|
||||
|
||||
private baseUrl = "https://discord.com/api/v10";
|
||||
|
||||
// Helper function to get the full fetch URL
|
||||
private getUrl(path: string): string {
|
||||
return `${this.baseUrl}${path}`;
|
||||
}
|
||||
|
||||
async fetchMessages(
|
||||
channelId: string,
|
||||
fetch: FetchFunction,
|
||||
): Promise<Array<DiscordMessage>> {
|
||||
const url = this.getUrl(`/channels/${channelId}/messages`);
|
||||
// Fetch messages from the specified channel using the provided fetch function
|
||||
const response = await fetch(url, {
|
||||
headers: {
|
||||
Authorization: `Bot ${this.options.discordKey}`,
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error(`Failed to fetch messages: ${response.statusText}`);
|
||||
}
|
||||
|
||||
return response.json();
|
||||
}
|
||||
|
||||
async fetchChannels(fetch: FetchFunction): Promise<Array<DiscordChannel>> {
|
||||
const url = this.getUrl(`/guilds/${this.options.guildId}/channels`);
|
||||
const response = await fetch(url, {
|
||||
headers: {
|
||||
Authorization: `Bot ${this.options.discordKey}`,
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error(`Failed to fetch channels: ${response.statusText}`);
|
||||
}
|
||||
|
||||
const channels = await response.json();
|
||||
// Filter channels to only include text channels (type 0)
|
||||
return channels.filter((channel: DiscordChannel) => channel.type === 0);
|
||||
}
|
||||
|
||||
async getContextItems(
|
||||
query: string,
|
||||
extras: ContextProviderExtras,
|
||||
): Promise<ContextItem[]> {
|
||||
const channels = await this.fetchChannels(extras.fetch);
|
||||
|
||||
let channelId: string;
|
||||
// Find the channel by ID or name in the query string. If not found, use the first channel
|
||||
const selectedChannel = channels.find(
|
||||
(channel) => channel.id === query || channel.name === query,
|
||||
);
|
||||
|
||||
channelId = selectedChannel ? selectedChannel.id : channels[0].id;
|
||||
|
||||
const parts = ["# Discord Channel Messages", `Channel ID: ${channelId}`];
|
||||
const messages = await this.fetchMessages(channelId, extras.fetch);
|
||||
|
||||
if (messages.length > 0) {
|
||||
parts.push("## Messages");
|
||||
// Format each message into a markdown string
|
||||
messages.forEach((message) => {
|
||||
parts.push(
|
||||
`### ${message.author?.username ?? "Unknown User"} on ${
|
||||
message.timestamp
|
||||
}\n\n${message.content}`,
|
||||
);
|
||||
});
|
||||
} else {
|
||||
parts.push("No messages found.");
|
||||
}
|
||||
|
||||
const content = parts.join("\n\n");
|
||||
|
||||
return [
|
||||
{
|
||||
name: `Messages from Channel ${channelId}`,
|
||||
content,
|
||||
description: "Latest messages from the channel",
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
async loadSubmenuItems(
|
||||
args: LoadSubmenuItemsArgs,
|
||||
): Promise<ContextSubmenuItem[]> {
|
||||
const channels = await this.fetchChannels(args.fetch);
|
||||
|
||||
return channels.map((channel) => ({
|
||||
id: channel.id,
|
||||
title: channel.name || `Channel ${channel.id}`,
|
||||
description: channel.topic ?? "",
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
export default DiscordContextProvider;
|
||||
|
|
@ -64,9 +64,7 @@ const getSubprocess = async (extras: ContextProviderExtras) => {
|
|||
const workingDir = await extras.ide.getWorkspaceDirs().then(trimFirstElement);
|
||||
|
||||
return (command: string) =>
|
||||
extras.ide
|
||||
.subprocess(`cd ${workingDir}; ${command}`)
|
||||
.then(trimFirstElement);
|
||||
extras.ide.subprocess(command, workingDir).then(trimFirstElement);
|
||||
};
|
||||
|
||||
class GitLabMergeRequestContextProvider extends BaseContextProvider {
|
||||
|
|
@ -269,7 +267,7 @@ class GitLabMergeRequestContextProvider extends BaseContextProvider {
|
|||
if (ex instanceof AxiosError) {
|
||||
if (ex.response) {
|
||||
const errorMessage = ex.response?.data
|
||||
? ex.response.data.message ?? JSON.stringify(ex.response?.data)
|
||||
? (ex.response.data.message ?? JSON.stringify(ex.response?.data))
|
||||
: `${ex.response.status}: ${ex.response.statusText}`;
|
||||
content += `GitLab Error: ${errorMessage}`;
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ class HttpContextProvider extends BaseContextProvider {
|
|||
displayTitle: "HTTP",
|
||||
description: "Retrieve a context item from a custom server",
|
||||
type: "normal",
|
||||
renderInlineAs: "",
|
||||
};
|
||||
|
||||
override get description(): ContextProviderDescription {
|
||||
|
|
@ -36,18 +37,29 @@ class HttpContextProvider extends BaseContextProvider {
|
|||
body: JSON.stringify({
|
||||
query: query || "",
|
||||
fullInput: extras.fullInput,
|
||||
options: this.options.options,
|
||||
}),
|
||||
});
|
||||
|
||||
const json = await response.json();
|
||||
|
||||
const createContextItem = (item: any) => ({
|
||||
description: item.description ?? "HTTP Context Item",
|
||||
content: item.content ?? "",
|
||||
name: item.name ?? this.options.title ?? "HTTP",
|
||||
});
|
||||
try {
|
||||
const createContextItem = (item: any) => ({
|
||||
description: item.description ?? "HTTP Context Item",
|
||||
content: item.content ?? "",
|
||||
name: item.name ?? this.options.title ?? "HTTP",
|
||||
});
|
||||
|
||||
return Array.isArray(json) ? json.map(createContextItem) : [createContextItem(json)];
|
||||
return Array.isArray(json)
|
||||
? json.map(createContextItem)
|
||||
: [createContextItem(json)];
|
||||
} catch (e) {
|
||||
console.warn(
|
||||
`Failed to parse response from custom HTTP context provider.\nError:\n${e}\nResponse from server:\n`,
|
||||
json,
|
||||
);
|
||||
return [];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ class TerminalContextProvider extends BaseContextProvider {
|
|||
static description: ContextProviderDescription = {
|
||||
title: "terminal",
|
||||
displayTitle: "Terminal",
|
||||
description: "Reference the contents of the terminal",
|
||||
description: "Reference the last terminal command",
|
||||
type: "normal",
|
||||
};
|
||||
|
||||
|
|
|
|||
44
core/context/providers/WebContextProvider.ts
Normal file
44
core/context/providers/WebContextProvider.ts
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
import { BaseContextProvider } from "..";
|
||||
import {
|
||||
ContextItem,
|
||||
ContextProviderDescription,
|
||||
ContextProviderExtras,
|
||||
} from "../..";
|
||||
import { getHeaders } from "../../continueServer/stubs/headers";
|
||||
import { TRIAL_PROXY_URL } from "../../control-plane/client";
|
||||
|
||||
export default class WebContextProvider extends BaseContextProvider {
|
||||
private static ENDPOINT = new URL("web", TRIAL_PROXY_URL);
|
||||
private static DEFAULT_N = 6;
|
||||
|
||||
static description: ContextProviderDescription = {
|
||||
title: "web",
|
||||
displayTitle: "Web",
|
||||
description: "Search the web",
|
||||
type: "normal",
|
||||
renderInlineAs: "",
|
||||
};
|
||||
|
||||
async getContextItems(
|
||||
query: string,
|
||||
extras: ContextProviderExtras,
|
||||
): Promise<ContextItem[]> {
|
||||
const resp = await extras.fetch(WebContextProvider.ENDPOINT, {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
...(await getHeaders()),
|
||||
},
|
||||
body: JSON.stringify({
|
||||
query: extras.fullInput,
|
||||
n: this.options.n ?? WebContextProvider.DEFAULT_N,
|
||||
}),
|
||||
});
|
||||
if (!resp.ok) {
|
||||
const text = await resp.text();
|
||||
throw new Error(`Failed to fetch web context: ${text}`);
|
||||
}
|
||||
const json = await resp.json();
|
||||
return json;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,28 +1,30 @@
|
|||
import { ContextItem, ContextProviderName } from "../../";
|
||||
import { BaseContextProvider } from "../";
|
||||
import { ContextProviderName } from "../../";
|
||||
import CodeContextProvider from "./CodeContextProvider";
|
||||
import ContinueProxyContextProvider from "./ContinueProxyContextProvider";
|
||||
import CurrentFileContextProvider from "./CurrentFileContextProvider";
|
||||
import DatabaseContextProvider from "./DatabaseContextProvider";
|
||||
import DiffContextProvider from "./DiffContextProvider";
|
||||
import DiscordContextProvider from "./DiscordContextProvider";
|
||||
import DocsContextProvider from "./DocsContextProvider";
|
||||
import FileTreeContextProvider from "./FileTreeContextProvider";
|
||||
import FolderContextProvider from "./FolderContextProvider";
|
||||
import GitHubIssuesContextProvider from "./GitHubIssuesContextProvider";
|
||||
import GitLabMergeRequestContextProvider from "./GitLabMergeRequestContextProvider";
|
||||
import GoogleContextProvider from "./GoogleContextProvider";
|
||||
import GreptileContextProvider from "./GreptileContextProvider";
|
||||
import HttpContextProvider from "./HttpContextProvider";
|
||||
import JiraIssuesContextProvider from "./JiraIssuesContextProvider/";
|
||||
import LocalsProvider from "./LocalsProvider";
|
||||
import DebugLocalsProvider from "./DebugLocalsProvider";
|
||||
import OSContextProvider from "./OSContextProvider";
|
||||
import OpenFilesContextProvider from "./OpenFilesContextProvider";
|
||||
import PostgresContextProvider from "./PostgresContextProvider";
|
||||
import ProblemsContextProvider from "./ProblemsContextProvider";
|
||||
import RepoMapContextProvider from "./RepoMapContextProvider";
|
||||
import SearchContextProvider from "./SearchContextProvider";
|
||||
import TerminalContextProvider from "./TerminalContextProvider";
|
||||
import URLContextProvider from "./URLContextProvider";
|
||||
import RepoMapContextProvider from "./RepoMapContextProvider";
|
||||
import GreptileContextProvider from "./GreptileContextProvider";
|
||||
import WebContextProvider from "./WebContextProvider";
|
||||
|
||||
/**
|
||||
* Note: We are currently omitting the following providers due to bugs:
|
||||
|
|
@ -37,7 +39,7 @@ export const Providers: (typeof BaseContextProvider)[] = [
|
|||
GitHubIssuesContextProvider,
|
||||
GoogleContextProvider,
|
||||
TerminalContextProvider,
|
||||
LocalsProvider,
|
||||
DebugLocalsProvider,
|
||||
OpenFilesContextProvider,
|
||||
HttpContextProvider,
|
||||
SearchContextProvider,
|
||||
|
|
@ -54,7 +56,9 @@ export const Providers: (typeof BaseContextProvider)[] = [
|
|||
URLContextProvider,
|
||||
ContinueProxyContextProvider,
|
||||
RepoMapContextProvider,
|
||||
DiscordContextProvider,
|
||||
GreptileContextProvider,
|
||||
WebContextProvider,
|
||||
];
|
||||
|
||||
export function contextProviderClassFromName(
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import fetch from "node-fetch";
|
||||
import { getHeaders } from "../../continueServer/stubs/headers.js";
|
||||
import { constants } from "../../deploy/constants.js";
|
||||
import { TRIAL_PROXY_URL } from "../../control-plane/client.js";
|
||||
import { Chunk, Reranker } from "../../index.js";
|
||||
|
||||
export class FreeTrialReranker implements Reranker {
|
||||
|
|
@ -10,7 +10,7 @@ export class FreeTrialReranker implements Reranker {
|
|||
if (chunks.length === 0) {
|
||||
return [];
|
||||
}
|
||||
const resp = await fetch(new URL("rerank", constants.a), {
|
||||
const resp = await fetch(new URL("rerank", TRIAL_PROXY_URL), {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
|
|
|
|||
|
|
@ -8,14 +8,20 @@ export class VoyageReranker implements Reranker {
|
|||
private readonly params: {
|
||||
apiKey: string;
|
||||
model?: string;
|
||||
apiBase?: string;
|
||||
},
|
||||
) {}
|
||||
|
||||
private get apiBase() {
|
||||
return this.params.apiBase ?? "https://api.voyageai.com/v1/";
|
||||
}
|
||||
|
||||
async rerank(query: string, chunks: Chunk[]): Promise<number[]> {
|
||||
if (!query || chunks.length === 0) {
|
||||
return [];
|
||||
}
|
||||
const resp = await fetch("https://api.voyageai.com/v1/rerank", {
|
||||
const url = new URL("rerank", this.apiBase);
|
||||
const resp = await fetch(url, {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
|
|
@ -24,11 +30,20 @@ export class VoyageReranker implements Reranker {
|
|||
body: JSON.stringify({
|
||||
query,
|
||||
documents: chunks.map((chunk) => chunk.content),
|
||||
model: this.params.model ?? "rerank-lite-1",
|
||||
model: this.params.model ?? "rerank-2",
|
||||
}),
|
||||
});
|
||||
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);
|
||||
|
||||
if (resp.status !== 200) {
|
||||
throw new Error(
|
||||
`VoyageReranker API error ${resp.status}: ${await resp.text()}`,
|
||||
);
|
||||
}
|
||||
|
||||
const data = (await resp.json()) as {
|
||||
data: Array<{ index: number; relevance_score: number }>;
|
||||
};
|
||||
const results = data.data.sort((a, b) => a.index - b.index);
|
||||
return results.map((result) => result.relevance_score);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,6 +48,9 @@ export default class RerankerRetrievalPipeline extends BaseRetrievalPipeline {
|
|||
throw new Error("No reranker provided");
|
||||
}
|
||||
|
||||
// remove empty chunks -- some APIs fail on that
|
||||
chunks = chunks.filter((chunk) => chunk.content);
|
||||
|
||||
let scores: number[] = await this.options.config.reranker.rerank(
|
||||
input,
|
||||
chunks,
|
||||
|
|
@ -62,8 +65,11 @@ export default class RerankerRetrievalPipeline extends BaseRetrievalPipeline {
|
|||
// (score) => score >= RETRIEVAL_PARAMS.rerankThreshold,
|
||||
// );
|
||||
|
||||
const chunkIndexMap = new Map<Chunk, number>();
|
||||
chunks.forEach((chunk, idx) => chunkIndexMap.set(chunk, idx));
|
||||
|
||||
results.sort(
|
||||
(a, b) => scores[results.indexOf(a)] - scores[results.indexOf(b)],
|
||||
(a, b) => scores[chunkIndexMap.get(a)!] - scores[chunkIndexMap.get(b)!],
|
||||
);
|
||||
results = results.slice(-this.options.nFinal);
|
||||
return results;
|
||||
|
|
|
|||
|
|
@ -1,12 +1,13 @@
|
|||
import path from "path";
|
||||
import { BranchAndDir, ContextItem, ContextProviderExtras } from "../../";
|
||||
import TransformersJsEmbeddingsProvider from "../../indexing/embeddings/TransformersJsEmbeddingsProvider";
|
||||
import { resolveRelativePathInWorkspace } from "../../util/ideUtils";
|
||||
import { getRelativePath } from "../../util/";
|
||||
import { INSTRUCTIONS_BASE_ITEM } from "../providers/utils";
|
||||
import { RetrievalPipelineOptions } from "./pipelines/BaseRetrievalPipeline";
|
||||
import NoRerankerRetrievalPipeline from "./pipelines/NoRerankerRetrievalPipeline";
|
||||
import RerankerRetrievalPipeline from "./pipelines/RerankerRetrievalPipeline";
|
||||
import path from "path";
|
||||
|
||||
const DEFAULT_N_FINAL = 25;
|
||||
|
||||
export async function retrieveContextItemsFromEmbeddings(
|
||||
extras: ContextProviderExtras,
|
||||
|
|
@ -43,7 +44,8 @@ export async function retrieveContextItemsFromEmbeddings(
|
|||
const contextLength = extras.llm.contextLength;
|
||||
const tokensPerSnippet = 512;
|
||||
const nFinal =
|
||||
options?.nFinal ?? Math.min(50, contextLength / tokensPerSnippet / 2);
|
||||
options?.nFinal ??
|
||||
Math.min(DEFAULT_N_FINAL, contextLength / tokensPerSnippet / 2);
|
||||
const useReranking = !!extras.reranker;
|
||||
const nRetrieve = useReranking ? options?.nRetrieve || 2 * nFinal : nFinal;
|
||||
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ export class TeamAnalytics {
|
|||
static extensionVersion: string | undefined = undefined;
|
||||
|
||||
static async capture(event: string, properties: { [key: string]: any }) {
|
||||
TeamAnalytics.provider?.capture(event, {
|
||||
void TeamAnalytics.provider?.capture(event, {
|
||||
...properties,
|
||||
os: TeamAnalytics.os,
|
||||
extensionVersion: TeamAnalytics.extensionVersion,
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ export default class ContinueProxyAnalyticsProvider
|
|||
`proxy/analytics/${this.controlPlaneProxyInfo?.workspaceId}/capture`,
|
||||
this.controlPlaneProxyInfo?.controlPlaneProxyUrl,
|
||||
).toString();
|
||||
fetch(url, {
|
||||
void fetch(url, {
|
||||
method: "POST",
|
||||
body: JSON.stringify({
|
||||
event,
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
import { ConfigJson } from "@continuedev/config-types";
|
||||
import fetch, { RequestInit, Response } from "node-fetch";
|
||||
import { ModelDescription } from "../index.js";
|
||||
import { controlPlaneEnv } from "./env.js";
|
||||
|
||||
export interface ControlPlaneSessionInfo {
|
||||
accessToken: string;
|
||||
|
|
@ -18,19 +19,11 @@ export interface ControlPlaneWorkspace {
|
|||
|
||||
export interface ControlPlaneModelDescription extends ModelDescription {}
|
||||
|
||||
export const DEFAULT_CONTROL_PLANE_PROXY_URL =
|
||||
process.env.CONTROL_PLANE_ENV === "local"
|
||||
? "http://localhost:3001/"
|
||||
: "https://control-plane-api-service-i3dqylpbqa-uc.a.run.app/";
|
||||
// : "https://control-plane-proxy.continue.dev/";
|
||||
|
||||
export const CONTROL_PLANE_URL =
|
||||
process.env.CONTROL_PLANE_ENV === "local"
|
||||
? "http://localhost:3001/"
|
||||
: "https://control-plane-api-service-i3dqylpbqa-uc.a.run.app/";
|
||||
export const TRIAL_PROXY_URL =
|
||||
"https://proxy-server-blue-l6vsfbzhba-uw.a.run.app";
|
||||
|
||||
export class ControlPlaneClient {
|
||||
private static URL = CONTROL_PLANE_URL;
|
||||
private static URL = controlPlaneEnv.CONTROL_PLANE_URL;
|
||||
private static ACCESS_TOKEN_VALID_FOR_MS = 1000 * 60 * 5; // 5 minutes
|
||||
|
||||
private lastAccessTokenRefresh = 0;
|
||||
|
|
|
|||
50
core/control-plane/env.ts
Normal file
50
core/control-plane/env.ts
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
interface ControlPlaneEnv {
|
||||
DEFAULT_CONTROL_PLANE_PROXY_URL: string;
|
||||
CONTROL_PLANE_URL: string;
|
||||
AUTH_TYPE: string;
|
||||
WORKOS_CLIENT_ID: string;
|
||||
APP_URL: string;
|
||||
}
|
||||
|
||||
export const EXTENSION_NAME = "continue";
|
||||
|
||||
const WORKOS_CLIENT_ID_PRODUCTION = "client_01J0FW6XN8N2XJAECF7NE0Y65J";
|
||||
const WORKOS_CLIENT_ID_STAGING = "client_01J0FW6XCPMJMQ3CG51RB4HBZQ";
|
||||
|
||||
const WORKOS_ENV_ID_PRODUCTION = "continue";
|
||||
const WORKOS_ENV_ID_STAGING = "continue-staging";
|
||||
|
||||
const PRODUCTION_ENV: ControlPlaneEnv = {
|
||||
DEFAULT_CONTROL_PLANE_PROXY_URL:
|
||||
"https://control-plane-api-service-i3dqylpbqa-uc.a.run.app/",
|
||||
CONTROL_PLANE_URL:
|
||||
"https://control-plane-api-service-i3dqylpbqa-uc.a.run.app/",
|
||||
AUTH_TYPE: WORKOS_ENV_ID_PRODUCTION,
|
||||
WORKOS_CLIENT_ID: WORKOS_CLIENT_ID_PRODUCTION,
|
||||
APP_URL: "https://app.continue.dev",
|
||||
};
|
||||
|
||||
const STAGING_ENV: ControlPlaneEnv = {
|
||||
DEFAULT_CONTROL_PLANE_PROXY_URL:
|
||||
"https://control-plane-api-service-537175798139.us-central1.run.app/",
|
||||
CONTROL_PLANE_URL:
|
||||
"https://control-plane-api-service-537175798139.us-central1.run.app/",
|
||||
AUTH_TYPE: WORKOS_CLIENT_ID_STAGING,
|
||||
WORKOS_CLIENT_ID: WORKOS_CLIENT_ID_STAGING,
|
||||
APP_URL: "https://app-preview.continue.dev",
|
||||
};
|
||||
|
||||
const LOCAL_ENV: ControlPlaneEnv = {
|
||||
DEFAULT_CONTROL_PLANE_PROXY_URL: "http://localhost:3001/",
|
||||
CONTROL_PLANE_URL: "http://localhost:3001/",
|
||||
AUTH_TYPE: WORKOS_ENV_ID_STAGING,
|
||||
WORKOS_CLIENT_ID: WORKOS_CLIENT_ID_STAGING,
|
||||
APP_URL: "http://localhost:3000",
|
||||
};
|
||||
|
||||
export const controlPlaneEnv =
|
||||
process.env.CONTROL_PLANE_ENV === "local"
|
||||
? LOCAL_ENV
|
||||
: process.env.CONTROL_PLANE_ENV === "staging"
|
||||
? STAGING_ENV
|
||||
: PRODUCTION_ENV;
|
||||
10
core/core.ts
10
core/core.ts
|
|
@ -28,6 +28,7 @@ import type { IMessenger, Message } from "./util/messenger";
|
|||
import { editConfigJson } from "./util/paths";
|
||||
import { Telemetry } from "./util/posthog";
|
||||
import { TTS } from "./util/tts";
|
||||
import { ChatDescriber } from "./util/chatDescriber";
|
||||
|
||||
export class Core {
|
||||
// implements IMessenger<ToCoreProtocol, FromCoreProtocol>
|
||||
|
|
@ -401,7 +402,6 @@ export class Core {
|
|||
if (config.experimental?.readResponseTTS && "completion" in next.value) {
|
||||
void TTS.read(next.value?.completion);
|
||||
}
|
||||
|
||||
return { done: true, content: next.value };
|
||||
}
|
||||
|
||||
|
|
@ -476,12 +476,18 @@ export class Core {
|
|||
}
|
||||
});
|
||||
|
||||
// Provide messenger to TTS so it can set GUI active / inactive state
|
||||
// Provide messenger to utils so they can interact with GUI + state
|
||||
TTS.messenger = this.messenger;
|
||||
ChatDescriber.messenger = this.messenger;
|
||||
|
||||
on("tts/kill", async () => {
|
||||
void TTS.kill();
|
||||
});
|
||||
|
||||
on("chatDescriber/describe", async (msg) => {
|
||||
const currentModel = await this.getSelectedModel();
|
||||
return await ChatDescriber.describe(currentModel, {}, msg.data);
|
||||
});
|
||||
|
||||
async function* runNodeJsSlashCommand(
|
||||
configHandler: ConfigHandler,
|
||||
|
|
|
|||
|
|
@ -1,6 +1,4 @@
|
|||
export const constants = {
|
||||
a: "https://proxy-server-blue-l6vsfbzhba-uw.a.run.app",
|
||||
// a: "http://localhost:3000",
|
||||
b: "1710787199603",
|
||||
c: "NfZFVegMpdyT3P5UmAggr7T7Hb6PlcbB",
|
||||
};
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ import { LineStream, matchLine } from "./util.js";
|
|||
* - old + same = oldLinesCopy.length
|
||||
* ^ (above two guarantee that all lines get represented)
|
||||
* - Lines are always output in order, at least among old and new separately
|
||||
* - Old lines in a hunk are always output before the new lines
|
||||
*/
|
||||
export async function* streamDiff(
|
||||
oldLines: string[],
|
||||
|
|
|
|||
40
core/index.d.ts
vendored
40
core/index.d.ts
vendored
|
|
@ -48,9 +48,9 @@ export interface IndexingProgressUpdate {
|
|||
export type PromptTemplate =
|
||||
| string
|
||||
| ((
|
||||
history: ChatMessage[],
|
||||
otherData: Record<string, string>,
|
||||
) => string | ChatMessage[]);
|
||||
history: ChatMessage[],
|
||||
otherData: Record<string, string>,
|
||||
) => string | ChatMessage[]);
|
||||
|
||||
export interface ILLM extends LLMOptions {
|
||||
get providerName(): ModelProvider;
|
||||
|
|
@ -464,7 +464,7 @@ export interface IdeSettings {
|
|||
export interface IDE {
|
||||
getIdeInfo(): Promise<IdeInfo>;
|
||||
getIdeSettings(): Promise<IdeSettings>;
|
||||
getDiff(): Promise<string>;
|
||||
getDiff(includeUnstaged: boolean): Promise<string>;
|
||||
isTelemetryEnabled(): Promise<boolean>;
|
||||
getUniqueId(): Promise<string>;
|
||||
getTerminalContents(): Promise<string>;
|
||||
|
|
@ -500,7 +500,7 @@ export interface IDE {
|
|||
getCurrentFile(): Promise<string | undefined>;
|
||||
getPinnedFiles(): Promise<string[]>;
|
||||
getSearchResults(query: string): Promise<string>;
|
||||
subprocess(command: string): Promise<[string, string]>;
|
||||
subprocess(command: string, cwd?: string): Promise<[string, string]>;
|
||||
getProblems(filepath?: string | undefined): Promise<Problem[]>;
|
||||
getBranch(dir: string): Promise<string>;
|
||||
getTags(artifactId: string): Promise<IndexTag[]>;
|
||||
|
|
@ -563,7 +563,7 @@ type ContextProviderName =
|
|||
| "diff"
|
||||
| "github"
|
||||
| "terminal"
|
||||
| "locals"
|
||||
| "debugger"
|
||||
| "open"
|
||||
| "google"
|
||||
| "search"
|
||||
|
|
@ -612,6 +612,7 @@ type ModelProvider =
|
|||
| "openai"
|
||||
| "free-trial"
|
||||
| "anthropic"
|
||||
| "anthropic-vertexai"
|
||||
| "cohere"
|
||||
| "together"
|
||||
| "ollama"
|
||||
|
|
@ -624,7 +625,9 @@ type ModelProvider =
|
|||
| "lmstudio"
|
||||
| "llamafile"
|
||||
| "gemini"
|
||||
| "gemini-vertexai"
|
||||
| "mistral"
|
||||
| "mistral-vertexai"
|
||||
| "bedrock"
|
||||
| "bedrockimport"
|
||||
| "sagemaker"
|
||||
|
|
@ -644,7 +647,9 @@ type ModelProvider =
|
|||
| "sambanova"
|
||||
| "nvidia"
|
||||
| "vllm"
|
||||
| "mock";
|
||||
| "mock"
|
||||
| "cerebras";
|
||||
|
||||
|
||||
export type ModelName =
|
||||
| "AUTODETECT"
|
||||
|
|
@ -683,6 +688,9 @@ export type ModelName =
|
|||
// Llama 3
|
||||
| "llama3-8b"
|
||||
| "llama3-70b"
|
||||
// Llama 3.1
|
||||
| "llama3.1-8b"
|
||||
| "llama3.1-70b"
|
||||
// Other Open-source
|
||||
| "phi2"
|
||||
| "phind-codellama-34b"
|
||||
|
|
@ -801,6 +809,7 @@ export interface ModelDescription {
|
|||
}
|
||||
|
||||
export type EmbeddingsProviderName =
|
||||
| "sagemaker"
|
||||
| "bedrock"
|
||||
| "huggingface-tei"
|
||||
| "transformers.js"
|
||||
|
|
@ -813,7 +822,8 @@ export type EmbeddingsProviderName =
|
|||
| "deepinfra"
|
||||
| "nvidia"
|
||||
| "voyage"
|
||||
| "mistral";
|
||||
| "mistral"
|
||||
| "vertex";
|
||||
|
||||
export interface EmbedOptions {
|
||||
apiBase?: string;
|
||||
|
|
@ -830,6 +840,9 @@ export interface EmbedOptions {
|
|||
|
||||
// AWS and GCP Options
|
||||
region?: string;
|
||||
|
||||
// GCP Options
|
||||
projectId?: string;
|
||||
}
|
||||
|
||||
export interface EmbeddingsProviderDescription extends EmbedOptions {
|
||||
|
|
@ -952,6 +965,11 @@ interface ExperimentalConfig {
|
|||
*/
|
||||
readResponseTTS?: boolean;
|
||||
|
||||
/**
|
||||
* Prompt the user's LLM for a title given the current chat content
|
||||
*/
|
||||
getChatTitles?: boolean;
|
||||
|
||||
/**
|
||||
* If set to true, we will attempt to pull down and install an instance of Chromium
|
||||
* that is compatible with the current version of Puppeteer.
|
||||
|
|
@ -1027,9 +1045,9 @@ export interface Config {
|
|||
embeddingsProvider?: EmbeddingsProviderDescription | EmbeddingsProvider;
|
||||
/** The model that Continue will use for tab autocompletions. */
|
||||
tabAutocompleteModel?:
|
||||
| CustomLLM
|
||||
| ModelDescription
|
||||
| (CustomLLM | ModelDescription)[];
|
||||
| CustomLLM
|
||||
| ModelDescription
|
||||
| (CustomLLM | ModelDescription)[];
|
||||
/** Options for tab autocomplete */
|
||||
tabAutocompleteOptions?: Partial<TabAutocompleteOptions>;
|
||||
/** UI styles customization */
|
||||
|
|
|
|||
|
|
@ -261,7 +261,9 @@ class CheerioCrawler {
|
|||
console.error(error);
|
||||
return { html: "", links: [] };
|
||||
}
|
||||
|
||||
if (!response.ok) {
|
||||
return { html: "", links: [] };
|
||||
}
|
||||
const html = await response.text();
|
||||
let links: string[] = [];
|
||||
|
||||
|
|
@ -277,7 +279,7 @@ class CheerioCrawler {
|
|||
return;
|
||||
}
|
||||
|
||||
const parsedUrl = new URL(href, url);
|
||||
const parsedUrl = new URL(href, location);
|
||||
if (parsedUrl.hostname === baseUrl.hostname) {
|
||||
links.push(parsedUrl.pathname);
|
||||
}
|
||||
|
|
@ -289,14 +291,11 @@ class CheerioCrawler {
|
|||
!this.IGNORE_PATHS_ENDING_IN.some((ending) => link.endsWith(ending))
|
||||
);
|
||||
});
|
||||
|
||||
return { html, links };
|
||||
}
|
||||
|
||||
private splitUrl(url: URL) {
|
||||
const baseUrl = `${url.protocol}//${url.hostname}${
|
||||
url.port ? ":" + url.port : ""
|
||||
}`;
|
||||
const baseUrl = new URL('/', url).href;
|
||||
const basePath = url.pathname;
|
||||
return { baseUrl, basePath };
|
||||
}
|
||||
|
|
|
|||
|
|
@ -420,25 +420,28 @@ export default class DocsService {
|
|||
|
||||
this.globalContext.update("curEmbeddingsProviderId", embeddingsProvider.id);
|
||||
|
||||
configHandler.onConfigUpdate(async (newConfig) => {
|
||||
const oldConfig = this.config;
|
||||
configHandler.onConfigUpdate(async ({ config: newConfig }) => {
|
||||
if (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;
|
||||
// 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();
|
||||
}
|
||||
if (oldConfig.docs !== newConfig.docs) {
|
||||
await this.syncConfigAndSqlite();
|
||||
}
|
||||
|
||||
const shouldReindex = await this.shouldReindexDocsOnNewEmbeddingsProvider(
|
||||
newConfig.embeddingsProvider.id,
|
||||
);
|
||||
const shouldReindex =
|
||||
await this.shouldReindexDocsOnNewEmbeddingsProvider(
|
||||
newConfig.embeddingsProvider.id,
|
||||
);
|
||||
|
||||
if (shouldReindex) {
|
||||
await this.reindexDocsOnNewEmbeddingsProvider(
|
||||
newConfig.embeddingsProvider,
|
||||
);
|
||||
if (shouldReindex) {
|
||||
await this.reindexDocsOnNewEmbeddingsProvider(
|
||||
newConfig.embeddingsProvider,
|
||||
);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
@ -534,8 +537,12 @@ export default class DocsService {
|
|||
await table.delete(`title = '${mockRowTitle}'`);
|
||||
}
|
||||
|
||||
private removeInvalidLanceTableNameChars(tableName: string) {
|
||||
return tableName.replace(/:/g, "");
|
||||
/**
|
||||
* From Lance: Table names can only contain alphanumeric characters,
|
||||
* underscores, hyphens, and periods
|
||||
*/
|
||||
private sanitizeLanceTableName(name: string) {
|
||||
return name.replace(/[^a-zA-Z0-9_.-]/g, "_");
|
||||
}
|
||||
|
||||
private async getLanceTableNameFromEmbeddingsProvider(
|
||||
|
|
@ -544,10 +551,10 @@ export default class DocsService {
|
|||
const embeddingsProvider = await this.getEmbeddingsProvider(
|
||||
isPreIndexedDoc,
|
||||
);
|
||||
const embeddingsProviderId = this.removeInvalidLanceTableNameChars(
|
||||
embeddingsProvider.id,
|
||||
|
||||
const tableName = this.sanitizeLanceTableName(
|
||||
`${DocsService.lanceTableName}${embeddingsProvider.id}`,
|
||||
);
|
||||
const tableName = `${DocsService.lanceTableName}${embeddingsProviderId}`;
|
||||
|
||||
return tableName;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import { Response } from "node-fetch";
|
||||
import { getHeaders } from "../../continueServer/stubs/headers.js";
|
||||
import { constants } from "../../deploy/constants.js";
|
||||
import { TRIAL_PROXY_URL } from "../../control-plane/client.js";
|
||||
import {
|
||||
EmbeddingsProviderName,
|
||||
EmbedOptions,
|
||||
|
|
@ -33,7 +33,7 @@ class FreeTrialEmbeddingsProvider extends BaseEmbeddingsProvider {
|
|||
}
|
||||
const fetchWithBackoff = () =>
|
||||
withExponentialBackoff<Response>(async () =>
|
||||
this.fetch(new URL("embeddings", constants.a), {
|
||||
this.fetch(new URL("embeddings", TRIAL_PROXY_URL), {
|
||||
method: "POST",
|
||||
body: JSON.stringify({
|
||||
input: batch,
|
||||
|
|
|
|||
|
|
@ -8,12 +8,12 @@ import BaseEmbeddingsProvider, {
|
|||
IBaseEmbeddingsProvider,
|
||||
} from "./BaseEmbeddingsProvider.js";
|
||||
|
||||
async function embedOne(
|
||||
chunk: string,
|
||||
async function embedOneBatch(
|
||||
chunks: string[],
|
||||
options: EmbedOptions,
|
||||
customFetch: FetchFunction,
|
||||
) {
|
||||
const embedding = await withExponentialBackoff<number[]>(async () => {
|
||||
const embedding = await withExponentialBackoff<number[][]>(async () => {
|
||||
let apiBase = options.apiBase!;
|
||||
|
||||
if (!apiBase.endsWith("/")) {
|
||||
|
|
@ -24,7 +24,7 @@ async function embedOne(
|
|||
method: "POST",
|
||||
body: JSON.stringify({
|
||||
model: options.model,
|
||||
input: chunk,
|
||||
input: chunks,
|
||||
}),
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
|
|
@ -37,7 +37,7 @@ async function embedOne(
|
|||
}
|
||||
|
||||
const data = await resp.json();
|
||||
const embedding = data.embeddings[0];
|
||||
const embedding: number[][] = data.embeddings;
|
||||
|
||||
if (!embedding || embedding.length === 0) {
|
||||
throw new Error("Ollama generated empty embedding");
|
||||
|
|
@ -53,12 +53,15 @@ class OllamaEmbeddingsProvider extends BaseEmbeddingsProvider {
|
|||
static defaultOptions: IBaseEmbeddingsProvider["defaultOptions"] = {
|
||||
apiBase: "http://localhost:11434/",
|
||||
model: "nomic-embed-text",
|
||||
maxBatchSize: 64,
|
||||
};
|
||||
|
||||
async embed(chunks: string[]) {
|
||||
const results: any = [];
|
||||
for (const chunk of chunks) {
|
||||
results.push(await embedOne(chunk, this.options, this.fetch));
|
||||
const batchedChunks = this.getBatchedChunks(chunks);
|
||||
var results: number[][] = [];
|
||||
|
||||
for (const batch of batchedChunks) {
|
||||
results.push(...await embedOneBatch(batch, this.options, this.fetch));
|
||||
}
|
||||
return results;
|
||||
}
|
||||
|
|
|
|||
114
core/indexing/embeddings/SageMakerEmbeddingsProvider.ts
Normal file
114
core/indexing/embeddings/SageMakerEmbeddingsProvider.ts
Normal file
|
|
@ -0,0 +1,114 @@
|
|||
import {
|
||||
InvokeEndpointCommand,
|
||||
SageMakerRuntimeClient,
|
||||
} from "@aws-sdk/client-sagemaker-runtime";
|
||||
import { fromIni } from "@aws-sdk/credential-providers";
|
||||
|
||||
import {
|
||||
EmbeddingsProviderName,
|
||||
EmbedOptions,
|
||||
FetchFunction,
|
||||
} from "../../index.js";
|
||||
import BaseEmbeddingsProvider from "./BaseEmbeddingsProvider.js";
|
||||
|
||||
|
||||
class SageMakerEmbeddingsProvider extends BaseEmbeddingsProvider {
|
||||
static providerName: EmbeddingsProviderName = "sagemaker";
|
||||
|
||||
static defaultOptions: Partial<EmbedOptions> | undefined = {
|
||||
region: "us-west-2",
|
||||
maxBatchSize: 1,
|
||||
};
|
||||
profile?: string | undefined;
|
||||
|
||||
constructor(options: EmbedOptions, fetch: FetchFunction) {
|
||||
super(options, fetch);
|
||||
if (!options.apiBase) {
|
||||
options.apiBase = `https://runtime.sagemaker.${options.region}.amazonaws.com`;
|
||||
}
|
||||
|
||||
if (options.profile) {
|
||||
this.profile = options.profile;
|
||||
} else {
|
||||
this.profile = "sagemaker";
|
||||
}
|
||||
}
|
||||
|
||||
async embed(chunks: string[]) {
|
||||
const credentials = await this._getCredentials();
|
||||
const client = new SageMakerRuntimeClient({
|
||||
region: this.options.region,
|
||||
credentials: {
|
||||
accessKeyId: credentials.accessKeyId,
|
||||
secretAccessKey: credentials.secretAccessKey,
|
||||
sessionToken: credentials.sessionToken || "",
|
||||
},
|
||||
});
|
||||
|
||||
const batchedChunks = this.getBatchedChunks(chunks);
|
||||
return (
|
||||
await Promise.all(
|
||||
batchedChunks.map(async (batch) => {
|
||||
const input = this._generateInvokeModelCommandInput(
|
||||
batch,
|
||||
this.options,
|
||||
);
|
||||
const command = new InvokeEndpointCommand(input);
|
||||
const response = await client.send(command);
|
||||
|
||||
if (response.Body) {
|
||||
const responseBody = JSON.parse(
|
||||
new TextDecoder().decode(response.Body),
|
||||
);
|
||||
// If the body contains a key called "embedding" or "embeddings", return the value, otherwise return the whole body
|
||||
if (responseBody.embedding) {
|
||||
return responseBody.embedding;
|
||||
} else if (responseBody.embeddings) {
|
||||
return responseBody.embeddings;
|
||||
} else {
|
||||
return responseBody;
|
||||
}
|
||||
}
|
||||
}),
|
||||
)
|
||||
).flat();
|
||||
}
|
||||
private _generateInvokeModelCommandInput(
|
||||
prompts: string | string[],
|
||||
options: EmbedOptions,
|
||||
): any {
|
||||
const payload = {
|
||||
inputs: prompts,
|
||||
normalize: true,
|
||||
// ...(options.requestOptions?.extraBodyProperties || {}),
|
||||
};
|
||||
|
||||
if (options.requestOptions?.extraBodyProperties) {
|
||||
Object.assign(payload, options.requestOptions.extraBodyProperties);
|
||||
}
|
||||
|
||||
return {
|
||||
EndpointName: this.options.model,
|
||||
Body: JSON.stringify(payload),
|
||||
ContentType: "application/json",
|
||||
CustomAttributes: "accept_eula=false",
|
||||
};
|
||||
}
|
||||
|
||||
private async _getCredentials() {
|
||||
try {
|
||||
return await fromIni({
|
||||
profile: this.profile,
|
||||
ignoreCache: true,
|
||||
})();
|
||||
} catch (e) {
|
||||
console.warn(
|
||||
`AWS profile with name ${this.profile} not found in ~/.aws/credentials, using default profile`,
|
||||
);
|
||||
return await fromIni()();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export default SageMakerEmbeddingsProvider;
|
||||
|
||||
89
core/indexing/embeddings/VertexEmbeddingsProvider.ts
Normal file
89
core/indexing/embeddings/VertexEmbeddingsProvider.ts
Normal file
|
|
@ -0,0 +1,89 @@
|
|||
import { GoogleAuth } from "google-auth-library";
|
||||
import { Response } from "node-fetch";
|
||||
import { EmbeddingsProviderName, EmbedOptions, FetchFunction } from "../../index.js";
|
||||
import { withExponentialBackoff } from "../../util/withExponentialBackoff.js";
|
||||
import BaseEmbeddingsProvider from "./BaseEmbeddingsProvider.js";
|
||||
|
||||
/**
|
||||
* [View the Vertex Text Embedding docs.](https://cloud.google.com/vertex-ai/generative-ai/docs/embeddings/get-text-embeddings)
|
||||
*/
|
||||
class VertexEmbeddingsProvider extends BaseEmbeddingsProvider {
|
||||
static providerName: EmbeddingsProviderName = "vertex";
|
||||
declare apiBase: string;
|
||||
|
||||
|
||||
static defaultOptions: Partial<EmbedOptions> | undefined = {
|
||||
model: "text-embedding-004",
|
||||
maxBatchSize: 5,
|
||||
region: "us-central1"
|
||||
};
|
||||
|
||||
private clientPromise = new GoogleAuth({
|
||||
scopes: "https://www.googleapis.com/auth/cloud-platform",
|
||||
}).getClient();
|
||||
|
||||
private static getDefaultApiBaseFrom(options: EmbedOptions) {
|
||||
const { region, projectId } = options;
|
||||
if (!region || !projectId) {
|
||||
throw new Error(
|
||||
"region and projectId must be defined if apiBase is not provided",
|
||||
);
|
||||
}
|
||||
|
||||
return `https://${region}-aiplatform.googleapis.com/v1/projects/${projectId}/locations/${region}`;
|
||||
}
|
||||
|
||||
|
||||
|
||||
constructor(options: EmbedOptions, fetch: FetchFunction) {
|
||||
super(options, fetch);
|
||||
this.apiBase ??= VertexEmbeddingsProvider.getDefaultApiBaseFrom(options);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
get urlPath(): string {
|
||||
return `/publishers/google/models/${this.options.model}:predict`;
|
||||
}
|
||||
|
||||
async embed(chunks: string[]) {
|
||||
const client = await this.clientPromise;
|
||||
const { token } = await client.getAccessToken();
|
||||
if (!token) {
|
||||
throw new Error(
|
||||
"Could not get an access token. Set up your Google Application Default Credentials.",
|
||||
);
|
||||
}
|
||||
const batchedChunks = this.getBatchedChunks(chunks);
|
||||
|
||||
return (
|
||||
await Promise.all(
|
||||
batchedChunks.map(async (batch) => {
|
||||
const fetchWithBackoff = () =>
|
||||
withExponentialBackoff<Response>(() =>
|
||||
this.fetch(new URL(this.apiBase + this.urlPath), {
|
||||
method: "POST",
|
||||
body: JSON.stringify({
|
||||
instances: batch.map((chunk) => ({ content: chunk })),
|
||||
}),
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
Authorization: `Bearer ${token}`,
|
||||
},
|
||||
}),
|
||||
);
|
||||
const resp = await fetchWithBackoff();
|
||||
|
||||
if (!resp.ok) {
|
||||
throw new Error(await resp.text());
|
||||
}
|
||||
|
||||
const data = (await resp.json()) as any;
|
||||
return data.predictions.map((prediction: any) => prediction.embeddings.values);
|
||||
}),
|
||||
)
|
||||
).flat();
|
||||
}
|
||||
}
|
||||
export default VertexEmbeddingsProvider;
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
import { EmbeddingsProviderName } from "../../index.js";
|
||||
import BaseEmbeddingsProvider from "./BaseEmbeddingsProvider.js";
|
||||
import SageMakerEmbeddingsProvider from "./SageMakerEmbeddingsProvider.js";
|
||||
import BedrockEmbeddingsProvider from "./BedrockEmbeddingsProvider.js";
|
||||
import CohereEmbeddingsProvider from "./CohereEmbeddingsProvider.js";
|
||||
import ContinueProxyEmbeddingsProvider from "./ContinueProxyEmbeddingsProvider.js";
|
||||
|
|
@ -13,6 +14,7 @@ import OpenAIEmbeddingsProvider from "./OpenAIEmbeddingsProvider.js";
|
|||
import TransformersJsEmbeddingsProvider from "./TransformersJsEmbeddingsProvider.js";
|
||||
import NvidiaEmbeddingsProvider from "./NvidiaEmbeddingsProvider.js";
|
||||
import VoyageEmbeddingsProvider from "./VoyageEmbeddingsProvider.js";
|
||||
import VertexEmbeddingsProvider from "./VertexEmbeddingsProvider.js";
|
||||
|
||||
type EmbeddingsProviderConstructor = new (
|
||||
...args: any[]
|
||||
|
|
@ -22,6 +24,7 @@ export const allEmbeddingsProviders: Record<
|
|||
EmbeddingsProviderName,
|
||||
EmbeddingsProviderConstructor
|
||||
> = {
|
||||
sagemaker: SageMakerEmbeddingsProvider,
|
||||
bedrock: BedrockEmbeddingsProvider,
|
||||
ollama: OllamaEmbeddingsProvider,
|
||||
"transformers.js": TransformersJsEmbeddingsProvider,
|
||||
|
|
@ -35,4 +38,5 @@ export const allEmbeddingsProviders: Record<
|
|||
nvidia: NvidiaEmbeddingsProvider,
|
||||
voyage: VoyageEmbeddingsProvider,
|
||||
mistral: MistralEmbeddingsProvider,
|
||||
vertex: VertexEmbeddingsProvider
|
||||
};
|
||||
|
|
|
|||
|
|
@ -68,6 +68,9 @@ export const DEFAULT_IGNORE_FILETYPES = [
|
|||
"*.uasset",
|
||||
"*.pdb",
|
||||
"*.bin",
|
||||
"*.pag",
|
||||
"*.swp",
|
||||
"*.jsonl",
|
||||
// "*.prompt", // can be incredibly confusing for the LLM to have another set of instructions injected into the prompt
|
||||
];
|
||||
|
||||
|
|
|
|||
|
|
@ -41,10 +41,12 @@ const PROVIDER_HANDLES_TEMPLATING: ModelProvider[] = [
|
|||
"together",
|
||||
"msty",
|
||||
"anthropic",
|
||||
"anthropic-vertexai",
|
||||
"bedrock",
|
||||
"sagemaker",
|
||||
"continue-proxy",
|
||||
"mistral",
|
||||
"mistral-vertexai",
|
||||
"sambanova",
|
||||
];
|
||||
|
||||
|
|
@ -52,9 +54,11 @@ const PROVIDER_SUPPORTS_IMAGES: ModelProvider[] = [
|
|||
"openai",
|
||||
"ollama",
|
||||
"gemini",
|
||||
"gemini-vertexai",
|
||||
"free-trial",
|
||||
"msty",
|
||||
"anthropic",
|
||||
"anthropic-vertexai",
|
||||
"bedrock",
|
||||
"sagemaker",
|
||||
"continue-proxy",
|
||||
|
|
@ -103,13 +107,16 @@ function modelSupportsImages(
|
|||
}
|
||||
const PARALLEL_PROVIDERS: ModelProvider[] = [
|
||||
"anthropic",
|
||||
"anthropic-vertexai",
|
||||
"bedrock",
|
||||
"sagemaker",
|
||||
"deepinfra",
|
||||
"gemini",
|
||||
"gemini-vertexai",
|
||||
"huggingface-inference-api",
|
||||
"huggingface-tgi",
|
||||
"mistral",
|
||||
"mistral-vertexai",
|
||||
"free-trial",
|
||||
"replicate",
|
||||
"together",
|
||||
|
|
|
|||
142
core/llm/llms/AnthropicVertexAI.ts
Normal file
142
core/llm/llms/AnthropicVertexAI.ts
Normal file
|
|
@ -0,0 +1,142 @@
|
|||
import {
|
||||
ChatMessage,
|
||||
CompletionOptions,
|
||||
LLMOptions,
|
||||
ModelProvider,
|
||||
} from "../../index.js";
|
||||
import { stripImages } from "../images.js";
|
||||
import { streamSse } from "../stream.js";
|
||||
import VertexAI from "./VertexAI.js";
|
||||
|
||||
class AnthropicVertexAI extends VertexAI {
|
||||
static providerName: ModelProvider = "anthropic-vertexai";
|
||||
static defaultOptions: Partial<LLMOptions> = {
|
||||
region: "us-east5",
|
||||
model: "claude-3-5-sonnet",
|
||||
};
|
||||
|
||||
private _convertArgs(options: CompletionOptions) {
|
||||
const finalOptions = {
|
||||
anthropic_version: "vertex-2023-10-16",
|
||||
top_k: options.topK,
|
||||
top_p: options.topP,
|
||||
temperature: options.temperature,
|
||||
max_tokens: options.maxTokens ?? 2048,
|
||||
stop_sequences: options.stop?.filter((x) => x.trim() !== ""),
|
||||
stream: options.stream ?? true,
|
||||
};
|
||||
|
||||
return finalOptions;
|
||||
}
|
||||
|
||||
private _convertMessages(msgs: ChatMessage[]): any[] {
|
||||
const filteredmessages = msgs.filter((m) => m.role !== "system")
|
||||
const lastTwoUserMsgIndices = filteredmessages
|
||||
.map((msg, index) => (msg.role === "user" ? index : -1))
|
||||
.filter((index) => index !== -1).slice(-2);
|
||||
|
||||
const messages = filteredmessages.map((message, filteredMsgIdx) => {
|
||||
// Add cache_control parameter to the last two user messages
|
||||
// The second-to-last because it retrieves potentially already cached contents,
|
||||
// The last one because we want it cached for later retrieval.
|
||||
// See: https://docs.anthropic.com/en/docs/build-with-claude/prompt-caching
|
||||
const addCaching = this.cacheBehavior?.cacheConversation && lastTwoUserMsgIndices.includes(filteredMsgIdx);
|
||||
|
||||
if (typeof message.content === "string") {
|
||||
var chatMessage = {
|
||||
...message,
|
||||
content: [{
|
||||
type: "text",
|
||||
text: message.content,
|
||||
...(addCaching? { cache_control: { type: "ephemeral" } } : {})
|
||||
}]
|
||||
};
|
||||
return chatMessage;
|
||||
}
|
||||
|
||||
return {
|
||||
...message,
|
||||
content: message.content.map((part, contentIdx) => {
|
||||
if (part.type === "text") {
|
||||
const newpart = {
|
||||
...part,
|
||||
// If multiple text parts, only add cache_control to the last one
|
||||
...((addCaching && contentIdx == message.content.length - 1) ? { cache_control: { type: "ephemeral" } } : {})
|
||||
};
|
||||
return newpart;
|
||||
}
|
||||
return {
|
||||
type: "image",
|
||||
source: {
|
||||
type: "base64",
|
||||
media_type: "image/jpeg",
|
||||
data: part.imageUrl?.url.split(",")[1],
|
||||
},
|
||||
};
|
||||
}),
|
||||
};
|
||||
});
|
||||
return messages;
|
||||
}
|
||||
|
||||
protected async *_streamComplete(
|
||||
prompt: string,
|
||||
options: CompletionOptions,
|
||||
): AsyncGenerator<string> {
|
||||
const messages = [{ role: "user" as const, content: prompt }];
|
||||
for await (const update of this._streamChat(messages, options)) {
|
||||
yield stripImages(update.content);
|
||||
}
|
||||
}
|
||||
|
||||
protected async *_streamChat(
|
||||
messages: ChatMessage[],
|
||||
options: CompletionOptions,
|
||||
): AsyncGenerator<ChatMessage> {
|
||||
const shouldCacheSystemMessage = !!this.systemMessage && this.cacheBehavior?.cacheSystemMessage;
|
||||
const systemMessage: string = stripImages(
|
||||
messages.filter((m) => m.role === "system")[0]?.content,
|
||||
);
|
||||
const apiURL = new URL(
|
||||
`publishers/anthropic/models/${options.model}:streamRawPredict`,
|
||||
this.apiBase
|
||||
);
|
||||
|
||||
const response = await this.fetch(apiURL, {
|
||||
method: "POST",
|
||||
headers: {
|
||||
...(shouldCacheSystemMessage || this.cacheBehavior?.cacheConversation
|
||||
? { "anthropic-beta": "prompt-caching-2024-07-31" }
|
||||
: {}),
|
||||
},
|
||||
body: JSON.stringify({
|
||||
...this._convertArgs(options),
|
||||
messages: this._convertMessages(messages),
|
||||
system: shouldCacheSystemMessage
|
||||
? [
|
||||
{
|
||||
type: "text",
|
||||
text: this.systemMessage,
|
||||
cache_control: { type: "ephemeral" },
|
||||
},
|
||||
]
|
||||
: systemMessage,
|
||||
}),
|
||||
});
|
||||
|
||||
if (options.stream === false) {
|
||||
const data = await response.json();
|
||||
yield { role: "assistant", content: data.content[0].text };
|
||||
return;
|
||||
}
|
||||
|
||||
for await (const value of streamSse(response)) {
|
||||
if (value.type == "message_start") console.log(value);
|
||||
if (value.delta?.text) {
|
||||
yield { role: "assistant", content: value.delta.text };
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export default AnthropicVertexAI;
|
||||
20
core/llm/llms/Cerebras.ts
Normal file
20
core/llm/llms/Cerebras.ts
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
import { LLMOptions, ModelProvider } from "../../index.js";
|
||||
import OpenAI from "./OpenAI.js";
|
||||
|
||||
class Cerebras extends OpenAI {
|
||||
static providerName: ModelProvider = "cerebras";
|
||||
static defaultOptions: Partial<LLMOptions> = {
|
||||
apiBase: "https://api.cerebras.ai/v1/",
|
||||
};
|
||||
maxStopWords: number | undefined = 4;
|
||||
|
||||
private static modelConversion: { [key: string]: string } = {
|
||||
"llama3.1-8b": "llama3.1-8b",
|
||||
"llama3.1-70b": "llama3.1-70b",
|
||||
};
|
||||
protected _convertModelName(model: string): string {
|
||||
return Cerebras.modelConversion[model] ?? model;
|
||||
}
|
||||
}
|
||||
|
||||
export default Cerebras;
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
import { TRIAL_FIM_MODEL } from "../../config/onboarding.js";
|
||||
import { getHeaders } from "../../continueServer/stubs/headers.js";
|
||||
import { constants } from "../../deploy/constants.js";
|
||||
import { TRIAL_PROXY_URL } from "../../control-plane/client.js";
|
||||
import { ChatMessage, CompletionOptions, ModelProvider } from "../../index.js";
|
||||
import { BaseLLM } from "../index.js";
|
||||
import { streamResponse } from "../stream.js";
|
||||
|
|
@ -66,7 +66,7 @@ class FreeTrial extends BaseLLM {
|
|||
|
||||
await this._countTokens(prompt, args.model, true);
|
||||
|
||||
const response = await this.fetch(`${constants.a}/stream_complete`, {
|
||||
const response = await this.fetch(`${TRIAL_PROXY_URL}/stream_complete`, {
|
||||
method: "POST",
|
||||
headers: await this._getHeaders(),
|
||||
body: JSON.stringify({
|
||||
|
|
@ -113,7 +113,7 @@ class FreeTrial extends BaseLLM {
|
|||
true,
|
||||
);
|
||||
|
||||
const response = await this.fetch(`${constants.a}/stream_chat`, {
|
||||
const response = await this.fetch(`${TRIAL_PROXY_URL}/stream_chat`, {
|
||||
method: "POST",
|
||||
headers: await this._getHeaders(),
|
||||
body: JSON.stringify({
|
||||
|
|
@ -143,7 +143,7 @@ class FreeTrial extends BaseLLM {
|
|||
options: CompletionOptions,
|
||||
): AsyncGenerator<string> {
|
||||
const args = this._convertArgs(this.collectArgs(options));
|
||||
const resp = await this.fetch(`${constants.a}/stream_fim`, {
|
||||
const resp = await this.fetch(`${TRIAL_PROXY_URL}/stream_fim`, {
|
||||
method: "POST",
|
||||
headers: await this._getHeaders(),
|
||||
body: JSON.stringify({
|
||||
|
|
|
|||
|
|
@ -190,16 +190,10 @@ class Gemini extends BaseLLM {
|
|||
if (data?.candidates?.[0]?.content?.parts?.[0]?.text) {
|
||||
// Incrementally stream the content to make it smoother
|
||||
const content = data.candidates[0].content.parts[0].text;
|
||||
const words = content.split(/(\s+)/);
|
||||
const delaySeconds = Math.min(4.0 / (words.length + 1), 0.1);
|
||||
while (words.length > 0) {
|
||||
const wordsToYield = Math.min(3, words.length);
|
||||
yield {
|
||||
role: "assistant",
|
||||
content: words.splice(0, wordsToYield).join(""),
|
||||
};
|
||||
await delay(delaySeconds);
|
||||
}
|
||||
yield {
|
||||
role: "assistant",
|
||||
content,
|
||||
};
|
||||
} else {
|
||||
// Handle the case where the expected data structure is not found
|
||||
console.warn("Unexpected response format:", data);
|
||||
|
|
|
|||
232
core/llm/llms/GeminiVertexAI.ts
Normal file
232
core/llm/llms/GeminiVertexAI.ts
Normal file
|
|
@ -0,0 +1,232 @@
|
|||
import {
|
||||
ChatMessage,
|
||||
CompletionOptions,
|
||||
LLMOptions,
|
||||
MessagePart,
|
||||
ModelProvider,
|
||||
} from "../../index.js";
|
||||
import { stripImages } from "../images.js";
|
||||
import { streamResponse } from "../stream.js";
|
||||
import VertexAI from "./VertexAI.js";
|
||||
|
||||
class GeminiVertexAI extends VertexAI {
|
||||
static providerName: ModelProvider = "gemini-vertexai";
|
||||
|
||||
static defaultOptions: Partial<LLMOptions> = {
|
||||
model: "gemini-pro",
|
||||
region: "us-central1",
|
||||
};
|
||||
|
||||
// Function to convert completion options to Gemini format
|
||||
private _convertArgs(options: CompletionOptions) {
|
||||
const finalOptions: any = {}; // Initialize an empty object
|
||||
|
||||
// Map known options
|
||||
if (options.topK) {
|
||||
finalOptions.topK = options.topK;
|
||||
}
|
||||
if (options.topP) {
|
||||
finalOptions.topP = options.topP;
|
||||
}
|
||||
if (options.temperature !== undefined && options.temperature !== null) {
|
||||
finalOptions.temperature = options.temperature;
|
||||
}
|
||||
if (options.maxTokens) {
|
||||
finalOptions.maxOutputTokens = options.maxTokens;
|
||||
}
|
||||
if (options.stop) {
|
||||
finalOptions.stopSequences = options.stop.filter((x) => x.trim() !== "");
|
||||
}
|
||||
|
||||
return { generationConfig: finalOptions }; // Wrap options under 'generationConfig'
|
||||
}
|
||||
|
||||
protected async *_streamComplete(
|
||||
prompt: string,
|
||||
options: CompletionOptions,
|
||||
): AsyncGenerator<string> {
|
||||
for await (const message of this._streamChat(
|
||||
[{ content: prompt, role: "user" }],
|
||||
options,
|
||||
)) {
|
||||
yield stripImages(message.content);
|
||||
}
|
||||
}
|
||||
|
||||
private removeSystemMessage(messages: ChatMessage[]) {
|
||||
const msgs = [...messages];
|
||||
|
||||
if (msgs[0]?.role === "system") {
|
||||
const sysMsg = msgs.shift()?.content;
|
||||
// @ts-ignore
|
||||
if (msgs[0]?.role === "user") {
|
||||
msgs[0].content = `System message - follow these instructions in every response: ${sysMsg}\n\n---\n\n${msgs[0].content}`;
|
||||
}
|
||||
}
|
||||
|
||||
return msgs;
|
||||
}
|
||||
|
||||
protected async *_streamChat(
|
||||
messages: ChatMessage[],
|
||||
options: CompletionOptions,
|
||||
): AsyncGenerator<ChatMessage> {
|
||||
const isV1API = this.apiBase.includes("/v1/");
|
||||
|
||||
// Conditionally apply removeSystemMessage
|
||||
const convertedMsgs = isV1API
|
||||
? this.removeSystemMessage(messages)
|
||||
: messages;
|
||||
|
||||
if (options.model.includes("gemini")) {
|
||||
yield* this.streamChatGemini(convertedMsgs, options);
|
||||
} else {
|
||||
yield* this.streamChatBison(convertedMsgs, options);
|
||||
}
|
||||
}
|
||||
|
||||
private _continuePartToGeminiPart(part: MessagePart) {
|
||||
return part.type === "text"
|
||||
? {
|
||||
text: part.text,
|
||||
}
|
||||
: {
|
||||
inlineData: {
|
||||
mimeType: "image/jpeg",
|
||||
data: part.imageUrl?.url.split(",")[1],
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
private async *streamChatGemini(
|
||||
messages: ChatMessage[],
|
||||
options: CompletionOptions,
|
||||
): AsyncGenerator<ChatMessage> {
|
||||
const apiURL = new URL(
|
||||
`publishers/google/models/${options.model}:streamGenerateContent`,
|
||||
this.apiBase,
|
||||
);
|
||||
// This feels hacky to repeat code from above function but was the quickest
|
||||
// way to ensure system message re-formatting isn't done if user has specified v1
|
||||
const isV1API = this.apiBase.includes("/v1/");
|
||||
|
||||
const contents = messages
|
||||
.map((msg) => {
|
||||
if (msg.role === "system" && !isV1API) {
|
||||
return null; // Don't include system message in contents
|
||||
}
|
||||
return {
|
||||
role: msg.role === "assistant" ? "model" : "user",
|
||||
parts:
|
||||
typeof msg.content === "string"
|
||||
? [{ text: msg.content }]
|
||||
: msg.content.map(this._continuePartToGeminiPart),
|
||||
};
|
||||
})
|
||||
.filter((c) => c !== null);
|
||||
|
||||
const body = {
|
||||
...this._convertArgs(options),
|
||||
contents,
|
||||
// if this.systemMessage is defined, reformat it for Gemini API
|
||||
...(this.systemMessage &&
|
||||
!isV1API && {
|
||||
systemInstruction: { parts: [{ text: this.systemMessage }] },
|
||||
}),
|
||||
};
|
||||
const response = await this.fetch(apiURL, {
|
||||
method: "POST",
|
||||
body: JSON.stringify(body),
|
||||
});
|
||||
|
||||
let buffer = "";
|
||||
for await (const chunk of streamResponse(response)) {
|
||||
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) {
|
||||
// Incrementally stream the content to make it smoother
|
||||
const content = data.candidates[0].content.parts[0].text;
|
||||
const words = content.split(/(\s+)/);
|
||||
const delaySeconds = Math.min(4.0 / (words.length + 1), 0.1);
|
||||
while (words.length > 0) {
|
||||
const wordsToYield = Math.min(3, words.length);
|
||||
yield {
|
||||
role: "assistant",
|
||||
content: words.splice(0, wordsToYield).join(""),
|
||||
};
|
||||
await delay(delaySeconds);
|
||||
}
|
||||
} 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 = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private async *streamChatBison(
|
||||
messages: ChatMessage[],
|
||||
options: CompletionOptions,
|
||||
): AsyncGenerator<ChatMessage> {
|
||||
const instances = messages.map((message) => ({ prompt: message.content }));
|
||||
|
||||
const apiURL = new URL(
|
||||
`publishers/google/models/${options.model}:predict`,
|
||||
this.apiBase,
|
||||
);
|
||||
const body = {
|
||||
instances,
|
||||
parameters: {
|
||||
temperature: options.temperature,
|
||||
maxOutputTokens: options.maxTokens,
|
||||
topP: options.topP,
|
||||
topK: options.topK,
|
||||
stopSequences: options.stop,
|
||||
presencePenalty: options.presencePenalty,
|
||||
frequencyPenalty: options.frequencyPenalty,
|
||||
},
|
||||
};
|
||||
const response = await this.fetch(apiURL, {
|
||||
method: "POST",
|
||||
body: JSON.stringify(body),
|
||||
});
|
||||
const data = await response.json();
|
||||
yield { role: "assistant", content: data.predictions[0].content };
|
||||
}
|
||||
}
|
||||
|
||||
async function delay(seconds: number) {
|
||||
return new Promise((resolve) => setTimeout(resolve, seconds * 1000));
|
||||
}
|
||||
|
||||
export default GeminiVertexAI;
|
||||
106
core/llm/llms/MistralVertexAI.ts
Normal file
106
core/llm/llms/MistralVertexAI.ts
Normal file
|
|
@ -0,0 +1,106 @@
|
|||
import {
|
||||
ChatMessage,
|
||||
CompletionOptions,
|
||||
LLMOptions,
|
||||
ModelProvider
|
||||
} from "../../index.js";
|
||||
import { stripImages } from "../images.js";
|
||||
import { streamSse } from "../stream.js";
|
||||
import { gptEditPrompt } from "../templates/edit.js";
|
||||
import VertexAI from "./VertexAI.js";
|
||||
|
||||
class MistralVertexAI extends VertexAI {
|
||||
static providerName: ModelProvider = "mistral-vertexai";
|
||||
static defaultOptions: Partial<LLMOptions> = {
|
||||
region: "us-central1",
|
||||
model: "codestral-latest",
|
||||
promptTemplates: {
|
||||
edit: gptEditPrompt,
|
||||
},
|
||||
};
|
||||
|
||||
protected async *_streamComplete(
|
||||
prompt: string,
|
||||
options: CompletionOptions,
|
||||
): AsyncGenerator<string> {
|
||||
for await (const chunk of this._streamChat(
|
||||
[{ role: "user", content: prompt }],
|
||||
options,
|
||||
)) {
|
||||
yield stripImages(chunk.content);
|
||||
}
|
||||
}
|
||||
|
||||
protected async *_streamChat(
|
||||
messages: ChatMessage[],
|
||||
options: CompletionOptions,
|
||||
): AsyncGenerator<ChatMessage> {
|
||||
const apiBase = this.apiBase!;
|
||||
const apiURL = new URL(
|
||||
`publishers/mistralai/models/${options.model}:streamRawPredict`,
|
||||
apiBase,
|
||||
);
|
||||
|
||||
const lastMessage = messages[messages.length - 1];
|
||||
if (lastMessage?.role === "assistant") {
|
||||
(lastMessage as any).prefix = true;
|
||||
}
|
||||
|
||||
const body = {
|
||||
model: options.model,
|
||||
temperature: options.temperature,
|
||||
top_p: options.topP,
|
||||
max_tokens: options.maxTokens,
|
||||
stream: options.stream ?? true,
|
||||
stop: options.stop,
|
||||
messages,
|
||||
};
|
||||
|
||||
const response = await this.fetch(apiURL, {
|
||||
method: "POST",
|
||||
body: JSON.stringify(body),
|
||||
});
|
||||
|
||||
for await (const chunk of streamSse(response)) {
|
||||
yield chunk.choices[0].delta;
|
||||
}
|
||||
}
|
||||
|
||||
protected async *_streamFim(
|
||||
prefix: string,
|
||||
suffix: string,
|
||||
options: CompletionOptions,
|
||||
): AsyncGenerator<string> {
|
||||
const apiBase = this.apiBase!;
|
||||
const apiURL = new URL(
|
||||
`publishers/mistralai/models/${options.model}:streamRawPredict`,
|
||||
apiBase,
|
||||
);
|
||||
|
||||
const body = {
|
||||
model: options.model,
|
||||
max_tokens: options.maxTokens,
|
||||
temperature: options.temperature,
|
||||
top_p: options.topP,
|
||||
stream: options.stream ?? true,
|
||||
stop: options.stop,
|
||||
prompt: prefix,
|
||||
suffix,
|
||||
};
|
||||
|
||||
const response = await this.fetch(apiURL, {
|
||||
method: "POST",
|
||||
body: JSON.stringify(body),
|
||||
});
|
||||
|
||||
for await (const chunk of streamSse(response)) {
|
||||
yield chunk.choices[0].delta.content;
|
||||
}
|
||||
}
|
||||
|
||||
supportsFim(): boolean {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
export default MistralVertexAI;
|
||||
|
|
@ -33,7 +33,7 @@ class Ollama extends BaseLLM {
|
|||
body: JSON.stringify({ name: this._getModel() }),
|
||||
})
|
||||
.then(async (response) => {
|
||||
if (response.status !== 200) {
|
||||
if (response?.status !== 200) {
|
||||
// console.warn(
|
||||
// "Error calling Ollama /api/show endpoint: ",
|
||||
// await response.text(),
|
||||
|
|
|
|||
|
|
@ -42,8 +42,6 @@ const CHAT_ONLY_MODELS = [
|
|||
class OpenAI extends BaseLLM {
|
||||
public useLegacyCompletionsEndpoint: boolean | undefined = undefined;
|
||||
|
||||
maxStopWords: number | undefined = undefined;
|
||||
|
||||
constructor(options: LLMOptions) {
|
||||
super(options);
|
||||
this.useLegacyCompletionsEndpoint = options.useLegacyCompletionsEndpoint;
|
||||
|
|
|
|||
46
core/llm/llms/VertexAI.ts
Normal file
46
core/llm/llms/VertexAI.ts
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
import { GoogleAuth } from "google-auth-library";
|
||||
import { LLMOptions } from "../../index.js";
|
||||
import { BaseLLM } from "../index.js";
|
||||
|
||||
abstract class VertexAI extends BaseLLM {
|
||||
declare apiBase: string;
|
||||
|
||||
private clientPromise = new GoogleAuth({
|
||||
scopes: "https://www.googleapis.com/auth/cloud-platform",
|
||||
}).getClient();
|
||||
|
||||
private static getDefaultApiBaseFrom(options: LLMOptions) {
|
||||
const { region, projectId } = options;
|
||||
if (!region || !projectId) {
|
||||
throw new Error(
|
||||
"region and projectId must be defined if apiBase is not provided",
|
||||
);
|
||||
}
|
||||
return `https://${region}-aiplatform.googleapis.com/v1/projects/${projectId}/locations/${region}/`;
|
||||
}
|
||||
|
||||
constructor(_options: LLMOptions) {
|
||||
super(_options);
|
||||
this.apiBase ??= VertexAI.getDefaultApiBaseFrom(_options);
|
||||
}
|
||||
|
||||
async fetch(url: RequestInfo | URL, init?: RequestInit) {
|
||||
const client = await this.clientPromise;
|
||||
const { token } = await client.getAccessToken();
|
||||
if (!token) {
|
||||
throw new Error(
|
||||
"Could not get an access token. Set up your Google Application Default Credentials.",
|
||||
);
|
||||
}
|
||||
return await super.fetch(url, {
|
||||
...init,
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
Authorization: `Bearer ${token}`,
|
||||
...init?.headers,
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export default VertexAI;
|
||||
|
|
@ -14,7 +14,6 @@ const watsonxConfig = {
|
|||
},
|
||||
};
|
||||
class WatsonX extends BaseLLM {
|
||||
maxStopWords: number | undefined = undefined;
|
||||
|
||||
constructor(options: LLMOptions) {
|
||||
super(options);
|
||||
|
|
|
|||
|
|
@ -8,9 +8,11 @@ import {
|
|||
import { renderTemplatedString } from "../../promptFiles/renderTemplatedString";
|
||||
import { BaseLLM } from "../index";
|
||||
import Anthropic from "./Anthropic";
|
||||
import AnthropicVertexAI from "./AnthropicVertexAI";
|
||||
import Azure from "./Azure";
|
||||
import Bedrock from "./Bedrock";
|
||||
import BedrockImport from "./BedrockImport";
|
||||
import Cerebras from "./Cerebras";
|
||||
import Cloudflare from "./Cloudflare";
|
||||
import Cohere from "./Cohere";
|
||||
import DeepInfra from "./DeepInfra";
|
||||
|
|
@ -19,6 +21,7 @@ import Fireworks from "./Fireworks";
|
|||
import Flowise from "./Flowise";
|
||||
import FreeTrial from "./FreeTrial";
|
||||
import Gemini from "./Gemini";
|
||||
import GeminiVertexAI from "./GeminiVertexAI";
|
||||
import Groq from "./Groq";
|
||||
import HuggingFaceInferenceAPI from "./HuggingFaceInferenceAPI";
|
||||
import HuggingFaceTGI from "./HuggingFaceTGI";
|
||||
|
|
@ -27,6 +30,7 @@ import LMStudio from "./LMStudio";
|
|||
import LlamaCpp from "./LlamaCpp";
|
||||
import Llamafile from "./Llamafile";
|
||||
import Mistral from "./Mistral";
|
||||
import MistralVertexAI from "./MistralVertexAI";
|
||||
import Mock from "./Mock";
|
||||
import Msty from "./Msty";
|
||||
import Nvidia from "./Nvidia";
|
||||
|
|
@ -44,9 +48,11 @@ import ContinueProxy from "./stubs/ContinueProxy";
|
|||
|
||||
const LLMs = [
|
||||
Anthropic,
|
||||
AnthropicVertexAI,
|
||||
Cohere,
|
||||
FreeTrial,
|
||||
Gemini,
|
||||
GeminiVertexAI,
|
||||
Llamafile,
|
||||
Ollama,
|
||||
Replicate,
|
||||
|
|
@ -59,6 +65,7 @@ const LLMs = [
|
|||
OpenAI,
|
||||
LMStudio,
|
||||
Mistral,
|
||||
MistralVertexAI,
|
||||
Bedrock,
|
||||
BedrockImport,
|
||||
SageMaker,
|
||||
|
|
@ -77,6 +84,7 @@ const LLMs = [
|
|||
Vllm,
|
||||
SambaNova,
|
||||
Mock,
|
||||
Cerebras,
|
||||
];
|
||||
|
||||
export async function llmFromDescription(
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
import { ControlPlaneProxyInfo } from "../../../control-plane/analytics/IAnalyticsProvider.js";
|
||||
import type { LLMOptions, ModelProvider } from "../../../index.js";
|
||||
import { Telemetry } from "../../../util/posthog.js";
|
||||
import OpenAI from "../OpenAI.js";
|
||||
|
||||
class ContinueProxy extends OpenAI {
|
||||
|
|
@ -11,6 +12,11 @@ class ContinueProxy extends OpenAI {
|
|||
static providerName: ModelProvider = "continue-proxy";
|
||||
static defaultOptions: Partial<LLMOptions> = {
|
||||
useLegacyCompletionsEndpoint: false,
|
||||
requestOptions: {
|
||||
headers: {
|
||||
"x-continue-unique-id": Telemetry.uniqueId,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
supportsCompletions(): boolean {
|
||||
|
|
|
|||
612
core/package-lock.json
generated
612
core/package-lock.json
generated
|
|
@ -12,7 +12,7 @@
|
|||
"@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/config-types": "^1.0.13",
|
||||
"@continuedev/llm-info": "^1.0.2",
|
||||
"@mozilla/readability": "^0.5.0",
|
||||
"@octokit/rest": "^20.0.2",
|
||||
|
|
@ -30,6 +30,7 @@
|
|||
"dotenv": "^16.4.5",
|
||||
"fastest-levenshtein": "^1.0.16",
|
||||
"follow-redirects": "^1.15.5",
|
||||
"google-auth-library": "^9.14.2",
|
||||
"handlebars": "^4.7.8",
|
||||
"http-proxy-agent": "^7.0.1",
|
||||
"https-proxy-agent": "^7.0.3",
|
||||
|
|
@ -58,6 +59,7 @@
|
|||
"sqlite": "^5.1.1",
|
||||
"sqlite3": "^5.1.7",
|
||||
"system-ca": "^1.0.3",
|
||||
"tar": "^7.4.3",
|
||||
"tree-sitter-wasms": "^0.1.11",
|
||||
"uuid": "^9.0.1",
|
||||
"vectordb": "^0.4.20",
|
||||
|
|
@ -81,6 +83,7 @@
|
|||
"@types/node-fetch": "^2.6.11",
|
||||
"@types/pg": "^8.11.6",
|
||||
"@types/request": "^2.48.12",
|
||||
"@types/tar": "^6.1.13",
|
||||
"@types/uuid": "^9.0.7",
|
||||
"@types/win-ca": "^3.5.4",
|
||||
"cross-env": "^7.0.3",
|
||||
|
|
@ -3132,9 +3135,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/@continuedev/config-types": {
|
||||
"version": "1.0.10",
|
||||
"resolved": "https://registry.npmjs.org/@continuedev/config-types/-/config-types-1.0.10.tgz",
|
||||
"integrity": "sha512-QuL4g9f889JlJtOnNTy/7MlLFx6+KBAQWWWcjQswPZmGIXK6e+i13ZufuEla6AIOH3JzBTC5Z/ipX9IYmTrcpg==",
|
||||
"version": "1.0.13",
|
||||
"resolved": "https://registry.npmjs.org/@continuedev/config-types/-/config-types-1.0.13.tgz",
|
||||
"integrity": "sha512-5Qmy2x58uhW1GYknypFT/7iwxEJSbt8gMgfQReV7d6xjbJ09ISOTki3hIfCilKrTCo0gIY6pzKEfCoQkUTEi6Q==",
|
||||
"dependencies": {
|
||||
"zod": "^3.23.8"
|
||||
}
|
||||
|
|
@ -3305,6 +3308,114 @@
|
|||
"resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-2.0.3.tgz",
|
||||
"integrity": "sha512-93zYdMES/c1D69yZiKDBj0V24vqNzB/koF26KPaagAfd3P/4gUlh3Dys5ogAK+Exi9QyzlD8x/08Zt7wIKcDcA=="
|
||||
},
|
||||
"node_modules/@isaacs/cliui": {
|
||||
"version": "8.0.2",
|
||||
"resolved": "https://registry.npmjs.org/@isaacs/cliui/-/cliui-8.0.2.tgz",
|
||||
"integrity": "sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==",
|
||||
"dependencies": {
|
||||
"string-width": "^5.1.2",
|
||||
"string-width-cjs": "npm:string-width@^4.2.0",
|
||||
"strip-ansi": "^7.0.1",
|
||||
"strip-ansi-cjs": "npm:strip-ansi@^6.0.1",
|
||||
"wrap-ansi": "^8.1.0",
|
||||
"wrap-ansi-cjs": "npm:wrap-ansi@^7.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/@isaacs/cliui/node_modules/ansi-regex": {
|
||||
"version": "6.1.0",
|
||||
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.1.0.tgz",
|
||||
"integrity": "sha512-7HSX4QQb4CspciLpVFwyRe79O3xsIZDDLER21kERQ71oaPodF8jL725AgJMFAYbooIqolJoRLuM81SpeUkpkvA==",
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/chalk/ansi-regex?sponsor=1"
|
||||
}
|
||||
},
|
||||
"node_modules/@isaacs/cliui/node_modules/ansi-styles": {
|
||||
"version": "6.2.1",
|
||||
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.1.tgz",
|
||||
"integrity": "sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==",
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/chalk/ansi-styles?sponsor=1"
|
||||
}
|
||||
},
|
||||
"node_modules/@isaacs/cliui/node_modules/emoji-regex": {
|
||||
"version": "9.2.2",
|
||||
"resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz",
|
||||
"integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg=="
|
||||
},
|
||||
"node_modules/@isaacs/cliui/node_modules/string-width": {
|
||||
"version": "5.1.2",
|
||||
"resolved": "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz",
|
||||
"integrity": "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==",
|
||||
"dependencies": {
|
||||
"eastasianwidth": "^0.2.0",
|
||||
"emoji-regex": "^9.2.2",
|
||||
"strip-ansi": "^7.0.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/@isaacs/cliui/node_modules/strip-ansi": {
|
||||
"version": "7.1.0",
|
||||
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz",
|
||||
"integrity": "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==",
|
||||
"dependencies": {
|
||||
"ansi-regex": "^6.0.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/chalk/strip-ansi?sponsor=1"
|
||||
}
|
||||
},
|
||||
"node_modules/@isaacs/cliui/node_modules/wrap-ansi": {
|
||||
"version": "8.1.0",
|
||||
"resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-8.1.0.tgz",
|
||||
"integrity": "sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==",
|
||||
"dependencies": {
|
||||
"ansi-styles": "^6.1.0",
|
||||
"string-width": "^5.0.1",
|
||||
"strip-ansi": "^7.0.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/chalk/wrap-ansi?sponsor=1"
|
||||
}
|
||||
},
|
||||
"node_modules/@isaacs/fs-minipass": {
|
||||
"version": "4.0.1",
|
||||
"resolved": "https://registry.npmjs.org/@isaacs/fs-minipass/-/fs-minipass-4.0.1.tgz",
|
||||
"integrity": "sha512-wgm9Ehl2jpeqP3zw/7mo3kRHFp5MEDhqAdwy1fTGkHAwnkGOVsgpvQhL8B5n1qlb01jV3n/bI0ZfZp5lWA1k4w==",
|
||||
"dependencies": {
|
||||
"minipass": "^7.0.4"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@isaacs/fs-minipass/node_modules/minipass": {
|
||||
"version": "7.1.2",
|
||||
"resolved": "https://registry.npmjs.org/minipass/-/minipass-7.1.2.tgz",
|
||||
"integrity": "sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw==",
|
||||
"engines": {
|
||||
"node": ">=16 || 14 >=14.17"
|
||||
}
|
||||
},
|
||||
"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",
|
||||
|
|
@ -4017,6 +4128,15 @@
|
|||
"@octokit/openapi-types": "^22.2.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@pkgjs/parseargs": {
|
||||
"version": "0.11.0",
|
||||
"resolved": "https://registry.npmjs.org/@pkgjs/parseargs/-/parseargs-0.11.0.tgz",
|
||||
"integrity": "sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==",
|
||||
"optional": true,
|
||||
"engines": {
|
||||
"node": ">=14"
|
||||
}
|
||||
},
|
||||
"node_modules/@protobufjs/aspromise": {
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmjs.org/@protobufjs/aspromise/-/aspromise-1.1.2.tgz",
|
||||
|
|
@ -5003,6 +5123,25 @@
|
|||
"integrity": "sha512-9aEbYZ3TbYMznPdcdr3SmIrLXwC/AKZXQeCf9Pgao5CKb8CyHuEX5jzWPTkvregvhRJHcpRO6BFoGW9ycaOkYw==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/@types/tar": {
|
||||
"version": "6.1.13",
|
||||
"resolved": "https://registry.npmjs.org/@types/tar/-/tar-6.1.13.tgz",
|
||||
"integrity": "sha512-IznnlmU5f4WcGTh2ltRu/Ijpmk8wiWXfF0VA4s+HPjHZgvFggk1YaIkbo5krX/zUCzWF8N/l4+W/LNxnvAJ8nw==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@types/node": "*",
|
||||
"minipass": "^4.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/tar/node_modules/minipass": {
|
||||
"version": "4.2.8",
|
||||
"resolved": "https://registry.npmjs.org/minipass/-/minipass-4.2.8.tgz",
|
||||
"integrity": "sha512-fNzuVyifolSLFL4NzpF+wEF4qrgqaaKX0haXPQEdQ7NKAN+WecoKMHV09YcuL/DHxrUsYQOK3MiuDf7Ip2OXfQ==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/tough-cookie": {
|
||||
"version": "4.0.5",
|
||||
"resolved": "https://registry.npmjs.org/@types/tough-cookie/-/tough-cookie-4.0.5.tgz",
|
||||
|
|
@ -5955,6 +6094,15 @@
|
|||
"resolved": "https://registry.npmjs.org/before-after-hook/-/before-after-hook-2.2.3.tgz",
|
||||
"integrity": "sha512-NzUnlZexiaH/46WDhANlyR2bXRopNg4F/zuSA3OpZnllCUgRaOF2znDioDWrmbNVsuZk6l9pMquQB38cfBZwkQ=="
|
||||
},
|
||||
"node_modules/bignumber.js": {
|
||||
"version": "9.1.2",
|
||||
"resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-9.1.2.tgz",
|
||||
"integrity": "sha512-2/mKyZH9K85bzOEfhXDBFZTGd1CTs+5IHpeFQo9luiBG7hghdC851Pj2WAhb6E3R6b9tZj/XKhbg4fum+Kepug==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/bindings": {
|
||||
"version": "1.5.0",
|
||||
"resolved": "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz",
|
||||
|
|
@ -6123,6 +6271,12 @@
|
|||
"node": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/buffer-equal-constant-time": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/buffer-equal-constant-time/-/buffer-equal-constant-time-1.0.1.tgz",
|
||||
"integrity": "sha512-zRpUiDwd/xk6ADqPMATG8vc9VPrkck7T07OIx0gnjmJAnHnTVXNQG3vfvWNuiZIkwu9KrKdA1iJKfsfTVxE6NA==",
|
||||
"license": "BSD-3-Clause"
|
||||
},
|
||||
"node_modules/buffer-from": {
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz",
|
||||
|
|
@ -6170,6 +6324,32 @@
|
|||
"node": ">=10"
|
||||
}
|
||||
},
|
||||
"node_modules/cacache/node_modules/tar": {
|
||||
"version": "6.2.1",
|
||||
"resolved": "https://registry.npmjs.org/tar/-/tar-6.2.1.tgz",
|
||||
"integrity": "sha512-DZ4yORTwrbTj/7MZYq2w+/ZFdI6OZ/f9SFHR+71gIVUZhOQPHzVCLpvRnPgyaMpfWxxk/4ONva3GQSyNIKRv6A==",
|
||||
"optional": true,
|
||||
"dependencies": {
|
||||
"chownr": "^2.0.0",
|
||||
"fs-minipass": "^2.0.0",
|
||||
"minipass": "^5.0.0",
|
||||
"minizlib": "^2.1.1",
|
||||
"mkdirp": "^1.0.3",
|
||||
"yallist": "^4.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
}
|
||||
},
|
||||
"node_modules/cacache/node_modules/tar/node_modules/minipass": {
|
||||
"version": "5.0.0",
|
||||
"resolved": "https://registry.npmjs.org/minipass/-/minipass-5.0.0.tgz",
|
||||
"integrity": "sha512-3FnjYuehv9k6ovOEbyOswadCDPX1piCfhV8ncmYtHOjuPwylVWsghTLo7rabjC3Rx5xD4HDx8Wm1xnMF7S5qFQ==",
|
||||
"optional": true,
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/cacache/node_modules/yallist": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz",
|
||||
|
|
@ -7054,6 +7234,11 @@
|
|||
"url": "https://dotenvx.com"
|
||||
}
|
||||
},
|
||||
"node_modules/eastasianwidth": {
|
||||
"version": "0.2.0",
|
||||
"resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz",
|
||||
"integrity": "sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA=="
|
||||
},
|
||||
"node_modules/ecc-jsbn": {
|
||||
"version": "0.1.2",
|
||||
"resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz",
|
||||
|
|
@ -7068,6 +7253,15 @@
|
|||
"resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz",
|
||||
"integrity": "sha512-UVU9dibq2JcFWxQPA6KCqj5O42VOmAY3zQUfEKxU0KpTGXwNoCjkX1e13eHNvw/xPynt6pU0rZ1htjWTNTSXsg=="
|
||||
},
|
||||
"node_modules/ecdsa-sig-formatter": {
|
||||
"version": "1.0.11",
|
||||
"resolved": "https://registry.npmjs.org/ecdsa-sig-formatter/-/ecdsa-sig-formatter-1.0.11.tgz",
|
||||
"integrity": "sha512-nagl3RYrbNv6kQkeJIpt6NJZy8twLB/2vtz6yN9Z4vRKHN4/QZJIEbqohALSgwKdnksuY3k5Addp5lg8sVoVcQ==",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"safe-buffer": "^5.0.1"
|
||||
}
|
||||
},
|
||||
"node_modules/eight-colors": {
|
||||
"version": "1.3.0",
|
||||
"resolved": "https://registry.npmjs.org/eight-colors/-/eight-colors-1.3.0.tgz",
|
||||
|
|
@ -8068,6 +8262,32 @@
|
|||
"is-callable": "^1.1.3"
|
||||
}
|
||||
},
|
||||
"node_modules/foreground-child": {
|
||||
"version": "3.3.0",
|
||||
"resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-3.3.0.tgz",
|
||||
"integrity": "sha512-Ld2g8rrAyMYFXBhEqMz8ZAHBi4J4uS1i/CxGMDnjyFWddMXLVcDp051DZfu+t7+ab7Wv6SMqpWmyFIj5UbfFvg==",
|
||||
"dependencies": {
|
||||
"cross-spawn": "^7.0.0",
|
||||
"signal-exit": "^4.0.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=14"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/isaacs"
|
||||
}
|
||||
},
|
||||
"node_modules/foreground-child/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/forever-agent": {
|
||||
"version": "0.6.1",
|
||||
"resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz",
|
||||
|
|
@ -8234,6 +8454,77 @@
|
|||
"node": "^12.13.0 || ^14.15.0 || >=16.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/gaxios": {
|
||||
"version": "6.7.1",
|
||||
"resolved": "https://registry.npmjs.org/gaxios/-/gaxios-6.7.1.tgz",
|
||||
"integrity": "sha512-LDODD4TMYx7XXdpwxAVRAIAuB0bzv0s+ywFonY46k126qzQHT9ygyoa9tncmOiQmmDrik65UYsEkv3lbfqQ3yQ==",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"extend": "^3.0.2",
|
||||
"https-proxy-agent": "^7.0.1",
|
||||
"is-stream": "^2.0.0",
|
||||
"node-fetch": "^2.6.9",
|
||||
"uuid": "^9.0.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=14"
|
||||
}
|
||||
},
|
||||
"node_modules/gaxios/node_modules/node-fetch": {
|
||||
"version": "2.7.0",
|
||||
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz",
|
||||
"integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"whatwg-url": "^5.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": "4.x || >=6.0.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"encoding": "^0.1.0"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"encoding": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/gaxios/node_modules/tr46": {
|
||||
"version": "0.0.3",
|
||||
"resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz",
|
||||
"integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/gaxios/node_modules/webidl-conversions": {
|
||||
"version": "3.0.1",
|
||||
"resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz",
|
||||
"integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==",
|
||||
"license": "BSD-2-Clause"
|
||||
},
|
||||
"node_modules/gaxios/node_modules/whatwg-url": {
|
||||
"version": "5.0.0",
|
||||
"resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz",
|
||||
"integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"tr46": "~0.0.3",
|
||||
"webidl-conversions": "^3.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/gcp-metadata": {
|
||||
"version": "6.1.0",
|
||||
"resolved": "https://registry.npmjs.org/gcp-metadata/-/gcp-metadata-6.1.0.tgz",
|
||||
"integrity": "sha512-Jh/AIwwgaxan+7ZUUmRLCjtchyDiqh4KjBJ5tW3plBZb5iL/BPcso8A5DlzeD9qlw0duCamnNdpFjxwaT0KyKg==",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"gaxios": "^6.0.0",
|
||||
"json-bigint": "^1.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=14"
|
||||
}
|
||||
},
|
||||
"node_modules/generate-function": {
|
||||
"version": "2.3.1",
|
||||
"resolved": "https://registry.npmjs.org/generate-function/-/generate-function-2.3.1.tgz",
|
||||
|
|
@ -8447,6 +8738,23 @@
|
|||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/google-auth-library": {
|
||||
"version": "9.14.2",
|
||||
"resolved": "https://registry.npmjs.org/google-auth-library/-/google-auth-library-9.14.2.tgz",
|
||||
"integrity": "sha512-R+FRIfk1GBo3RdlRYWPdwk8nmtVUOn6+BkDomAC46KoU8kzXzE1HLmOasSCbWUByMMAGkknVF0G5kQ69Vj7dlA==",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"base64-js": "^1.3.0",
|
||||
"ecdsa-sig-formatter": "^1.0.11",
|
||||
"gaxios": "^6.1.1",
|
||||
"gcp-metadata": "^6.1.0",
|
||||
"gtoken": "^7.0.0",
|
||||
"jws": "^4.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=14"
|
||||
}
|
||||
},
|
||||
"node_modules/gopd": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/gopd/-/gopd-1.0.1.tgz",
|
||||
|
|
@ -8533,6 +8841,19 @@
|
|||
"graphology-types": ">=0.23.0"
|
||||
}
|
||||
},
|
||||
"node_modules/gtoken": {
|
||||
"version": "7.1.0",
|
||||
"resolved": "https://registry.npmjs.org/gtoken/-/gtoken-7.1.0.tgz",
|
||||
"integrity": "sha512-pCcEwRi+TKpMlxAQObHDQ56KawURgyAf6jtIY046fJ5tIv3zDe/LEIubckAO8fj6JnAxLdmWkUfNyulQ2iKdEw==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"gaxios": "^6.0.0",
|
||||
"jws": "^4.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=14.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/guid-typescript": {
|
||||
"version": "1.0.9",
|
||||
"resolved": "https://registry.npmjs.org/guid-typescript/-/guid-typescript-1.0.9.tgz",
|
||||
|
|
@ -9136,7 +9457,6 @@
|
|||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz",
|
||||
"integrity": "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
},
|
||||
|
|
@ -9283,6 +9603,20 @@
|
|||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/jackspeak": {
|
||||
"version": "3.4.3",
|
||||
"resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-3.4.3.tgz",
|
||||
"integrity": "sha512-OGlZQpz2yfahA/Rd1Y8Cd9SIEsqvXkLVoSw/cgwhnhFMDbsQFeZYoJJ7bIZBS9BcamUW96asq/npPWugM+RQBw==",
|
||||
"dependencies": {
|
||||
"@isaacs/cliui": "^8.0.2"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/isaacs"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"@pkgjs/parseargs": "^0.11.0"
|
||||
}
|
||||
},
|
||||
"node_modules/jest": {
|
||||
"version": "29.7.0",
|
||||
"resolved": "https://registry.npmjs.org/jest/-/jest-29.7.0.tgz",
|
||||
|
|
@ -10254,6 +10588,15 @@
|
|||
"node": ">=4"
|
||||
}
|
||||
},
|
||||
"node_modules/json-bigint": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/json-bigint/-/json-bigint-1.0.0.tgz",
|
||||
"integrity": "sha512-SiPv/8VpZuWbvLSMtTDU8hEfrZWg/mH/nV/b4o0CYbSxu1UIQPLdwKOCIyLQX+VIPO5vrLX3i8qtqFyhdPSUSQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"bignumber.js": "^9.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/json-bignum": {
|
||||
"version": "0.0.3",
|
||||
"resolved": "https://registry.npmjs.org/json-bignum/-/json-bignum-0.0.3.tgz",
|
||||
|
|
@ -10338,6 +10681,27 @@
|
|||
"node": ">=0.6.0"
|
||||
}
|
||||
},
|
||||
"node_modules/jwa": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/jwa/-/jwa-2.0.0.tgz",
|
||||
"integrity": "sha512-jrZ2Qx916EA+fq9cEAeCROWPTfCwi1IVHqT2tapuqLEVVDKFDENFw1oL+MwrTvH6msKxsd1YTDVw6uKEcsrLEA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"buffer-equal-constant-time": "1.0.1",
|
||||
"ecdsa-sig-formatter": "1.0.11",
|
||||
"safe-buffer": "^5.0.1"
|
||||
}
|
||||
},
|
||||
"node_modules/jws": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/jws/-/jws-4.0.0.tgz",
|
||||
"integrity": "sha512-KDncfTmOZoOMTFG4mBlG0qUIOlc03fmzH+ru6RgYVZhPkyiy/92Owlt/8UEN+a4TXR1FQetfIpJE8ApdvdVxTg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"jwa": "^2.0.0",
|
||||
"safe-buffer": "^5.0.1"
|
||||
}
|
||||
},
|
||||
"node_modules/keyv": {
|
||||
"version": "4.5.4",
|
||||
"resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.4.tgz",
|
||||
|
|
@ -11040,6 +11404,38 @@
|
|||
"node": ">= 10.12.0"
|
||||
}
|
||||
},
|
||||
"node_modules/node-gyp/node_modules/minipass": {
|
||||
"version": "5.0.0",
|
||||
"resolved": "https://registry.npmjs.org/minipass/-/minipass-5.0.0.tgz",
|
||||
"integrity": "sha512-3FnjYuehv9k6ovOEbyOswadCDPX1piCfhV8ncmYtHOjuPwylVWsghTLo7rabjC3Rx5xD4HDx8Wm1xnMF7S5qFQ==",
|
||||
"optional": true,
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/node-gyp/node_modules/tar": {
|
||||
"version": "6.2.1",
|
||||
"resolved": "https://registry.npmjs.org/tar/-/tar-6.2.1.tgz",
|
||||
"integrity": "sha512-DZ4yORTwrbTj/7MZYq2w+/ZFdI6OZ/f9SFHR+71gIVUZhOQPHzVCLpvRnPgyaMpfWxxk/4ONva3GQSyNIKRv6A==",
|
||||
"optional": true,
|
||||
"dependencies": {
|
||||
"chownr": "^2.0.0",
|
||||
"fs-minipass": "^2.0.0",
|
||||
"minipass": "^5.0.0",
|
||||
"minizlib": "^2.1.1",
|
||||
"mkdirp": "^1.0.3",
|
||||
"yallist": "^4.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
}
|
||||
},
|
||||
"node_modules/node-gyp/node_modules/yallist": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz",
|
||||
"integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==",
|
||||
"optional": true
|
||||
},
|
||||
"node_modules/node-html-markdown": {
|
||||
"version": "1.3.0",
|
||||
"resolved": "https://registry.npmjs.org/node-html-markdown/-/node-html-markdown-1.3.0.tgz",
|
||||
|
|
@ -11552,6 +11948,11 @@
|
|||
"node": ">= 14"
|
||||
}
|
||||
},
|
||||
"node_modules/package-json-from-dist": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/package-json-from-dist/-/package-json-from-dist-1.0.1.tgz",
|
||||
"integrity": "sha512-UEZIS3/by4OC8vL3P2dTXRETpebLI2NiI5vIrjaD/5UtrkFX/tNbwjTSRAGC/+7CAo2pIcBaRgWmcBBHcsaCIw=="
|
||||
},
|
||||
"node_modules/pad-left": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/pad-left/-/pad-left-2.1.0.tgz",
|
||||
|
|
@ -11655,6 +12056,29 @@
|
|||
"resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz",
|
||||
"integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw=="
|
||||
},
|
||||
"node_modules/path-scurry": {
|
||||
"version": "1.11.1",
|
||||
"resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-1.11.1.tgz",
|
||||
"integrity": "sha512-Xa4Nw17FS9ApQFJ9umLiJS4orGjm7ZzwUrwamcGQuHSzDyth9boKDaycYdDcZDuqYATXw4HFXgaqWTctW/v1HA==",
|
||||
"dependencies": {
|
||||
"lru-cache": "^10.2.0",
|
||||
"minipass": "^5.0.0 || ^6.0.2 || ^7.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=16 || 14 >=14.18"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/isaacs"
|
||||
}
|
||||
},
|
||||
"node_modules/path-scurry/node_modules/minipass": {
|
||||
"version": "7.1.2",
|
||||
"resolved": "https://registry.npmjs.org/minipass/-/minipass-7.1.2.tgz",
|
||||
"integrity": "sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw==",
|
||||
"engines": {
|
||||
"node": ">=16 || 14 >=14.17"
|
||||
}
|
||||
},
|
||||
"node_modules/path-type": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz",
|
||||
|
|
@ -13120,6 +13544,14 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"node_modules/sqlite3/node_modules/minipass": {
|
||||
"version": "5.0.0",
|
||||
"resolved": "https://registry.npmjs.org/minipass/-/minipass-5.0.0.tgz",
|
||||
"integrity": "sha512-3FnjYuehv9k6ovOEbyOswadCDPX1piCfhV8ncmYtHOjuPwylVWsghTLo7rabjC3Rx5xD4HDx8Wm1xnMF7S5qFQ==",
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/sqlite3/node_modules/node-addon-api": {
|
||||
"version": "7.1.0",
|
||||
"resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-7.1.0.tgz",
|
||||
|
|
@ -13128,6 +13560,27 @@
|
|||
"node": "^16 || ^18 || >= 20"
|
||||
}
|
||||
},
|
||||
"node_modules/sqlite3/node_modules/tar": {
|
||||
"version": "6.2.1",
|
||||
"resolved": "https://registry.npmjs.org/tar/-/tar-6.2.1.tgz",
|
||||
"integrity": "sha512-DZ4yORTwrbTj/7MZYq2w+/ZFdI6OZ/f9SFHR+71gIVUZhOQPHzVCLpvRnPgyaMpfWxxk/4ONva3GQSyNIKRv6A==",
|
||||
"dependencies": {
|
||||
"chownr": "^2.0.0",
|
||||
"fs-minipass": "^2.0.0",
|
||||
"minipass": "^5.0.0",
|
||||
"minizlib": "^2.1.1",
|
||||
"mkdirp": "^1.0.3",
|
||||
"yallist": "^4.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
}
|
||||
},
|
||||
"node_modules/sqlite3/node_modules/yallist": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz",
|
||||
"integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A=="
|
||||
},
|
||||
"node_modules/sqlstring": {
|
||||
"version": "2.3.3",
|
||||
"resolved": "https://registry.npmjs.org/sqlstring/-/sqlstring-2.3.3.tgz",
|
||||
|
|
@ -13253,6 +13706,20 @@
|
|||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/string-width-cjs": {
|
||||
"name": "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==",
|
||||
"dependencies": {
|
||||
"emoji-regex": "^8.0.0",
|
||||
"is-fullwidth-code-point": "^3.0.0",
|
||||
"strip-ansi": "^6.0.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/string.prototype.trim": {
|
||||
"version": "1.2.9",
|
||||
"resolved": "https://registry.npmjs.org/string.prototype.trim/-/string.prototype.trim-1.2.9.tgz",
|
||||
|
|
@ -13310,6 +13777,18 @@
|
|||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/strip-ansi-cjs": {
|
||||
"name": "strip-ansi",
|
||||
"version": "6.0.1",
|
||||
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz",
|
||||
"integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==",
|
||||
"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",
|
||||
|
|
@ -13420,19 +13899,19 @@
|
|||
}
|
||||
},
|
||||
"node_modules/tar": {
|
||||
"version": "6.2.1",
|
||||
"resolved": "https://registry.npmjs.org/tar/-/tar-6.2.1.tgz",
|
||||
"integrity": "sha512-DZ4yORTwrbTj/7MZYq2w+/ZFdI6OZ/f9SFHR+71gIVUZhOQPHzVCLpvRnPgyaMpfWxxk/4ONva3GQSyNIKRv6A==",
|
||||
"version": "7.4.3",
|
||||
"resolved": "https://registry.npmjs.org/tar/-/tar-7.4.3.tgz",
|
||||
"integrity": "sha512-5S7Va8hKfV7W5U6g3aYxXmlPoZVAwUMy9AOKyF2fVuZa2UD3qZjg578OrLRt8PcNN1PleVaL/5/yYATNL0ICUw==",
|
||||
"dependencies": {
|
||||
"chownr": "^2.0.0",
|
||||
"fs-minipass": "^2.0.0",
|
||||
"minipass": "^5.0.0",
|
||||
"minizlib": "^2.1.1",
|
||||
"mkdirp": "^1.0.3",
|
||||
"yallist": "^4.0.0"
|
||||
"@isaacs/fs-minipass": "^4.0.0",
|
||||
"chownr": "^3.0.0",
|
||||
"minipass": "^7.1.2",
|
||||
"minizlib": "^3.0.1",
|
||||
"mkdirp": "^3.0.1",
|
||||
"yallist": "^5.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/tar-fs": {
|
||||
|
|
@ -13458,18 +13937,88 @@
|
|||
"streamx": "^2.15.0"
|
||||
}
|
||||
},
|
||||
"node_modules/tar/node_modules/minipass": {
|
||||
"version": "5.0.0",
|
||||
"resolved": "https://registry.npmjs.org/minipass/-/minipass-5.0.0.tgz",
|
||||
"integrity": "sha512-3FnjYuehv9k6ovOEbyOswadCDPX1piCfhV8ncmYtHOjuPwylVWsghTLo7rabjC3Rx5xD4HDx8Wm1xnMF7S5qFQ==",
|
||||
"node_modules/tar/node_modules/chownr": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/chownr/-/chownr-3.0.0.tgz",
|
||||
"integrity": "sha512-+IxzY9BZOQd/XuYPRmrvEVjF/nqj5kgT4kEq7VofrDoM1MxoRjEWkrCC3EtLi59TVawxTAn+orJwFQcrqEN1+g==",
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/tar/node_modules/glob": {
|
||||
"version": "10.4.5",
|
||||
"resolved": "https://registry.npmjs.org/glob/-/glob-10.4.5.tgz",
|
||||
"integrity": "sha512-7Bv8RF0k6xjo7d4A/PxYLbUCfb6c+Vpd2/mB2yRDlew7Jb5hEXiCD9ibfO7wpk8i4sevK6DFny9h7EYbM3/sHg==",
|
||||
"dependencies": {
|
||||
"foreground-child": "^3.1.0",
|
||||
"jackspeak": "^3.1.2",
|
||||
"minimatch": "^9.0.4",
|
||||
"minipass": "^7.1.2",
|
||||
"package-json-from-dist": "^1.0.0",
|
||||
"path-scurry": "^1.11.1"
|
||||
},
|
||||
"bin": {
|
||||
"glob": "dist/esm/bin.mjs"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/isaacs"
|
||||
}
|
||||
},
|
||||
"node_modules/tar/node_modules/minipass": {
|
||||
"version": "7.1.2",
|
||||
"resolved": "https://registry.npmjs.org/minipass/-/minipass-7.1.2.tgz",
|
||||
"integrity": "sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw==",
|
||||
"engines": {
|
||||
"node": ">=16 || 14 >=14.17"
|
||||
}
|
||||
},
|
||||
"node_modules/tar/node_modules/minizlib": {
|
||||
"version": "3.0.1",
|
||||
"resolved": "https://registry.npmjs.org/minizlib/-/minizlib-3.0.1.tgz",
|
||||
"integrity": "sha512-umcy022ILvb5/3Djuu8LWeqUa8D68JaBzlttKeMWen48SjabqS3iY5w/vzeMzMUNhLDifyhbOwKDSznB1vvrwg==",
|
||||
"dependencies": {
|
||||
"minipass": "^7.0.4",
|
||||
"rimraf": "^5.0.5"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 18"
|
||||
}
|
||||
},
|
||||
"node_modules/tar/node_modules/mkdirp": {
|
||||
"version": "3.0.1",
|
||||
"resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-3.0.1.tgz",
|
||||
"integrity": "sha512-+NsyUUAZDmo6YVHzL/stxSu3t9YS1iljliy3BSDrXJ/dkn1KYdmtZODGGjLcc9XLgVVpH4KshHB8XmZgMhaBXg==",
|
||||
"bin": {
|
||||
"mkdirp": "dist/cjs/src/bin.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/isaacs"
|
||||
}
|
||||
},
|
||||
"node_modules/tar/node_modules/rimraf": {
|
||||
"version": "5.0.10",
|
||||
"resolved": "https://registry.npmjs.org/rimraf/-/rimraf-5.0.10.tgz",
|
||||
"integrity": "sha512-l0OE8wL34P4nJH/H2ffoaniAokM2qSmrtXHmlpvYr5AVVX8msAyW0l8NVJFDxlSK4u3Uh/f41cQheDVdnYijwQ==",
|
||||
"dependencies": {
|
||||
"glob": "^10.3.7"
|
||||
},
|
||||
"bin": {
|
||||
"rimraf": "dist/esm/bin.mjs"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/isaacs"
|
||||
}
|
||||
},
|
||||
"node_modules/tar/node_modules/yallist": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz",
|
||||
"integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A=="
|
||||
"version": "5.0.0",
|
||||
"resolved": "https://registry.npmjs.org/yallist/-/yallist-5.0.0.tgz",
|
||||
"integrity": "sha512-YgvUTfwqyc7UXVMrB+SImsVYSmTS8X/tSrtdNZMImM+n7+QTriRXyXim0mBrTXNeqzVF0KWGgHPeiyViFFrNDw==",
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/test-exclude": {
|
||||
"version": "6.0.0",
|
||||
|
|
@ -14274,6 +14823,23 @@
|
|||
"url": "https://github.com/chalk/wrap-ansi?sponsor=1"
|
||||
}
|
||||
},
|
||||
"node_modules/wrap-ansi-cjs": {
|
||||
"name": "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==",
|
||||
"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",
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
"description": "The Continue Core contains functionality that can be shared across web, VS Code, or Node.js",
|
||||
"scripts": {
|
||||
"test": "cross-env NODE_OPTIONS=--experimental-vm-modules jest --runInBand",
|
||||
"tsc:check": "tsc -p ./ --noEmit",
|
||||
"build:npm": "tsc -p ./tsconfig.npm.json",
|
||||
"lint": "eslint . --ext ts",
|
||||
"lint:fix": "eslint . --ext ts --fix"
|
||||
|
|
@ -25,6 +26,7 @@
|
|||
"@types/node-fetch": "^2.6.11",
|
||||
"@types/pg": "^8.11.6",
|
||||
"@types/request": "^2.48.12",
|
||||
"@types/tar": "^6.1.13",
|
||||
"@types/uuid": "^9.0.7",
|
||||
"@types/win-ca": "^3.5.4",
|
||||
"cross-env": "^7.0.3",
|
||||
|
|
@ -42,7 +44,7 @@
|
|||
"@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/config-types": "^1.0.13",
|
||||
"@continuedev/llm-info": "^1.0.2",
|
||||
"@mozilla/readability": "^0.5.0",
|
||||
"@octokit/rest": "^20.0.2",
|
||||
|
|
@ -60,6 +62,7 @@
|
|||
"dotenv": "^16.4.5",
|
||||
"fastest-levenshtein": "^1.0.16",
|
||||
"follow-redirects": "^1.15.5",
|
||||
"google-auth-library": "^9.14.2",
|
||||
"handlebars": "^4.7.8",
|
||||
"http-proxy-agent": "^7.0.1",
|
||||
"https-proxy-agent": "^7.0.3",
|
||||
|
|
@ -88,6 +91,7 @@
|
|||
"sqlite": "^5.1.1",
|
||||
"sqlite3": "^5.1.7",
|
||||
"system-ca": "^1.0.3",
|
||||
"tar": "^7.4.3",
|
||||
"tree-sitter-wasms": "^0.1.11",
|
||||
"uuid": "^9.0.1",
|
||||
"vectordb": "^0.4.20",
|
||||
|
|
|
|||
|
|
@ -131,6 +131,7 @@ export type ToCoreFromIdeOrWebviewProtocol = {
|
|||
},
|
||||
ProtocolGeneratorType<DiffLine>,
|
||||
];
|
||||
"chatDescriber/describe": [string, string | undefined];
|
||||
"stats/getTokensPerDay": [
|
||||
undefined,
|
||||
{ day: string; promptTokens: number; generatedTokens: number }[],
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ export type ToIdeFromWebviewOrCoreProtocol = {
|
|||
openFile: [{ path: string }, void];
|
||||
runCommand: [{ command: string }, void];
|
||||
getSearchResults: [{ query: string }, string];
|
||||
subprocess: [{ command: string }, [string, string]];
|
||||
subprocess: [{ command: string; cwd?: string }, [string, string]];
|
||||
saveFile: [{ filepath: string }, void];
|
||||
fileExists: [{ filepath: string }, boolean];
|
||||
readFile: [{ filepath: string }, string];
|
||||
|
|
@ -52,7 +52,7 @@ export type ToIdeFromWebviewOrCoreProtocol = {
|
|||
getPinnedFiles: [undefined, string[]];
|
||||
showLines: [{ filepath: string; startLine: number; endLine: number }, void];
|
||||
readRangeInFile: [{ filepath: string; range: Range }, string];
|
||||
getDiff: [undefined, string];
|
||||
getDiff: [{ includeUnstaged: boolean }, string];
|
||||
getWorkspaceConfigs: [undefined, ContinueRcJson[]];
|
||||
getTerminalContents: [undefined, string];
|
||||
getDebugLocals: [{ threadIndex: number }, string];
|
||||
|
|
@ -97,4 +97,5 @@ export type ToWebviewOrCoreFromIdeProtocol = {
|
|||
{ sessionInfo: ControlPlaneSessionInfo | undefined },
|
||||
void,
|
||||
];
|
||||
didChangeIdeSettings: [{ settings: IdeSettings }, void];
|
||||
};
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue