diff --git a/.continueignore b/.continueignore index 1086d8297..fcbe84fa0 100644 --- a/.continueignore +++ b/.continueignore @@ -1,3 +1,4 @@ **/*.run.xml archive/**/* -extensions/vscode/models/**/* \ No newline at end of file +extensions/vscode/models/**/* +docs/docs/languages \ No newline at end of file diff --git a/.gitignore b/.gitignore index 0517e3971..f8d2c8a18 100644 --- a/.gitignore +++ b/.gitignore @@ -152,4 +152,4 @@ continue_server.build continue_server.dist Icon -Icon? +Icon? \ No newline at end of file diff --git a/.vscode/launch.json b/.vscode/launch.json index c00f3a766..e32b84fe5 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -10,9 +10,9 @@ "request": "launch", "name": "Core Binary", "skipFiles": ["/**"], - "program": "${workspaceFolder}/pkg/out/index.js", - "preLaunchTask": "pkg:esbuild", - "outFiles": ["${workspaceFolder}/pkg/out/**/*.js"], + "program": "${workspaceFolder}/binary/out/index.js", + "preLaunchTask": "binary:esbuild", + "outFiles": ["${workspaceFolder}/binary/out/**/*.js"], "sourceMaps": true, "smartStep": true, "internalConsoleOptions": "openOnSessionStart" diff --git a/.vscode/tasks.json b/.vscode/tasks.json index ac279cdba..0e335a55f 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -142,17 +142,17 @@ } } ] - }, + }, // // esbuild for the core binary { - "label": "pkg:esbuild", + "label": "binary:esbuild", "type": "shell", "command": "npm", "args": ["run", "esbuild"], "problemMatcher": [], "options": { - "cwd": "pkg" + "cwd": "binary" } } ] diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 391d81cfb..0daba6aeb 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -93,7 +93,7 @@ Pre-requisite: You should use the Intellij IDE, which can be downloaded [here](h > For changes to Typescript code, the binary/gui will currently need to be rebuilt. Changes to Kotlin code can often be hot-reloaded with "Run -> Debugging Actions -> Reload Changed Classes" -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 `pkg` directory. The Intellij extension (written in Kotlin) is then able to communicate over stdin/stdout in the [CoreMessenger.kt](./extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/CoreMessenger.kt) file. +Continue's JetBrains extension shares much of the code with the VS Code extension by utilizing shared code in the `core` directory and packaging it in a binary in the `binary` directory. The Intellij extension (written in Kotlin) is then able to communicate over stdin/stdout in the [CoreMessenger.kt](./extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/CoreMessenger.kt) file. ### Formatting diff --git a/pkg/.continueignore b/binary/.continueignore similarity index 100% rename from pkg/.continueignore rename to binary/.continueignore diff --git a/binary/.gitignore b/binary/.gitignore index c5e82d745..d748f39f1 100644 --- a/binary/.gitignore +++ b/binary/.gitignore @@ -1 +1,4 @@ -bin \ No newline at end of file +node_modules +bin +data +out diff --git a/pkg/README.md b/binary/README.md similarity index 100% rename from pkg/README.md rename to binary/README.md diff --git a/pkg/build.js b/binary/build.js similarity index 95% rename from pkg/build.js rename to binary/build.js index 414b17c42..9769fcf0f 100644 --- a/pkg/build.js +++ b/binary/build.js @@ -90,7 +90,7 @@ const targetToLanceDb = { entryPoints: ["src/index.ts"], bundle: true, outfile: esbuildOutputFile, - external: ["esbuild", ...DYNAMIC_IMPORTS], + external: ["esbuild", ...DYNAMIC_IMPORTS, "./xhr-sync-worker.js", "vscode"], format: "cjs", platform: "node", sourcemap: true, @@ -118,6 +118,7 @@ const targetToLanceDb = { console.log("[info] Building binaries with pkg..."); for (const target of targets) { const targetDir = `bin/${target}`; + fs.mkdirSync(targetDir, { recursive: true }); console.log(`[info] Building ${target}...`); execSync( `npx pkg --no-bytecode --public-packages "*" --public pkgJson/${target} --out-path ${targetDir}`, @@ -141,6 +142,7 @@ const targetToLanceDb = { // 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 execSync( `curl -o ${targetDir}/esbuild.tgz https://registry.npmjs.org/@esbuild/${target}/-/${target}-0.19.11.tgz`, ); diff --git a/pkg/importMetaUrl.js b/binary/importMetaUrl.js similarity index 100% rename from pkg/importMetaUrl.js rename to binary/importMetaUrl.js diff --git a/pkg/package-lock.json b/binary/package-lock.json similarity index 91% rename from pkg/package-lock.json rename to binary/package-lock.json index 5ccdb9584..2d1439878 100644 --- a/pkg/package-lock.json +++ b/binary/package-lock.json @@ -1,11 +1,11 @@ { - "name": "pkg", + "name": "binary", "version": "1.0.0", "lockfileVersion": 3, "requires": true, "packages": { "": { - "name": "pkg", + "name": "binary", "version": "1.0.0", "license": "Apache-2.0", "dependencies": { @@ -19,20 +19,20 @@ "vectordb": "^0.4.10" }, "bin": { - "pkg": "out/index.js" + "binary": "out/index.js" }, "devDependencies": { "@types/follow-redirects": "^1.14.4", "@types/uuid": "^9.0.8", "@vercel/ncc": "^0.38.1", - "esbuild": "^0.19.11", + "esbuild": "0.19.11", "pkg": "^5.8.1", "typescript": "^5.3.3" } }, "../core": { "name": "@continuedev/core", - "version": "1.0.4", + "version": "1.0.6", "license": "Apache-2.0", "dependencies": { "@mozilla/readability": "^0.5.0", @@ -52,6 +52,7 @@ "handlebars": "^4.7.8", "http-proxy-agent": "^7.0.1", "https-proxy-agent": "^7.0.3", + "ignore": "^5.3.1", "js-tiktoken": "^1.0.8", "jsdom": "^24.0.0", "llama-tokenizer-js": "^1.1.3", @@ -69,7 +70,7 @@ "sqlite3": "^5.1.7", "tree-sitter-wasms": "^0.1.6", "uuid": "^9.0.1", - "vectordb": "^0.4.12", + "vectordb": "0.4.12", "web-tree-sitter": "^0.21.0" }, "devDependencies": { @@ -142,9 +143,9 @@ } }, "node_modules/@babel/helper-string-parser": { - "version": "7.23.4", - "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.23.4.tgz", - "integrity": "sha512-803gmbQdqwdf4olxrX4AJyFBV/RTr3rSmOj0rKwesmzlfhYNDEs+/iOcznzpNWlJlIlTJC2QfPFcHB6DlzdVLQ==", + "version": "7.24.1", + "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.24.1.tgz", + "integrity": "sha512-2ofRCjnnA9y+wk8b9IAREroeUP02KHp431N2mhKniy2yKIDKpbrHv9eXwm8cBeWQYcJmzv5qKCu65P47eCF7CQ==", "dev": true, "engines": { "node": ">=6.9.0" @@ -186,9 +187,9 @@ } }, "node_modules/@esbuild/aix-ppc64": { - "version": "0.19.12", - "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.19.12.tgz", - "integrity": "sha512-bmoCYyWdEL3wDQIVbcyzRyeKLgk2WtWLTWz1ZIAZF/EGbNOwSA6ew3PftJ1PqMiOOGu0OyFMzG53L0zqIpPeNA==", + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.19.11.tgz", + "integrity": "sha512-FnzU0LyE3ySQk7UntJO4+qIiQgI7KoODnZg5xzXIrFJlKd2P2gwHsHY4927xj9y5PJmJSzULiUCWmv7iWnNa7g==", "cpu": [ "ppc64" ], @@ -202,9 +203,9 @@ } }, "node_modules/@esbuild/android-arm": { - "version": "0.19.12", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.19.12.tgz", - "integrity": "sha512-qg/Lj1mu3CdQlDEEiWrlC4eaPZ1KztwGJ9B6J+/6G+/4ewxJg7gqj8eVYWvao1bXrqGiW2rsBZFSX3q2lcW05w==", + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.19.11.tgz", + "integrity": "sha512-5OVapq0ClabvKvQ58Bws8+wkLCV+Rxg7tUVbo9xu034Nm536QTII4YzhaFriQ7rMrorfnFKUsArD2lqKbFY4vw==", "cpu": [ "arm" ], @@ -218,9 +219,9 @@ } }, "node_modules/@esbuild/android-arm64": { - "version": "0.19.12", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.19.12.tgz", - "integrity": "sha512-P0UVNGIienjZv3f5zq0DP3Nt2IE/3plFzuaS96vihvD0Hd6H/q4WXUGpCxD/E8YrSXfNyRPbpTq+T8ZQioSuPA==", + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.19.11.tgz", + "integrity": "sha512-aiu7K/5JnLj//KOnOfEZ0D90obUkRzDMyqd/wNAUQ34m4YUPVhRZpnqKV9uqDGxT7cToSDnIHsGooyIczu9T+Q==", "cpu": [ "arm64" ], @@ -234,9 +235,9 @@ } }, "node_modules/@esbuild/android-x64": { - "version": "0.19.12", - "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.19.12.tgz", - "integrity": "sha512-3k7ZoUW6Q6YqhdhIaq/WZ7HwBpnFBlW905Fa4s4qWJyiNOgT1dOqDiVAQFwBH7gBRZr17gLrlFCRzF6jFh7Kew==", + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.19.11.tgz", + "integrity": "sha512-eccxjlfGw43WYoY9QgB82SgGgDbibcqyDTlk3l3C0jOVHKxrjdc9CTwDUQd0vkvYg5um0OH+GpxYvp39r+IPOg==", "cpu": [ "x64" ], @@ -250,9 +251,9 @@ } }, "node_modules/@esbuild/darwin-arm64": { - "version": "0.19.12", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.19.12.tgz", - "integrity": "sha512-B6IeSgZgtEzGC42jsI+YYu9Z3HKRxp8ZT3cqhvliEHovq8HSX2YX8lNocDn79gCKJXOSaEot9MVYky7AKjCs8g==", + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.19.11.tgz", + "integrity": "sha512-ETp87DRWuSt9KdDVkqSoKoLFHYTrkyz2+65fj9nfXsaV3bMhTCjtQfw3y+um88vGRKRiF7erPrh/ZuIdLUIVxQ==", "cpu": [ "arm64" ], @@ -266,9 +267,9 @@ } }, "node_modules/@esbuild/darwin-x64": { - "version": "0.19.12", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.19.12.tgz", - "integrity": "sha512-hKoVkKzFiToTgn+41qGhsUJXFlIjxI/jSYeZf3ugemDYZldIXIxhvwN6erJGlX4t5h417iFuheZ7l+YVn05N3A==", + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.19.11.tgz", + "integrity": "sha512-fkFUiS6IUK9WYUO/+22omwetaSNl5/A8giXvQlcinLIjVkxwTLSktbF5f/kJMftM2MJp9+fXqZ5ezS7+SALp4g==", "cpu": [ "x64" ], @@ -282,9 +283,9 @@ } }, "node_modules/@esbuild/freebsd-arm64": { - "version": "0.19.12", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.19.12.tgz", - "integrity": "sha512-4aRvFIXmwAcDBw9AueDQ2YnGmz5L6obe5kmPT8Vd+/+x/JMVKCgdcRwH6APrbpNXsPz+K653Qg8HB/oXvXVukA==", + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.19.11.tgz", + "integrity": "sha512-lhoSp5K6bxKRNdXUtHoNc5HhbXVCS8V0iZmDvyWvYq9S5WSfTIHU2UGjcGt7UeS6iEYp9eeymIl5mJBn0yiuxA==", "cpu": [ "arm64" ], @@ -298,9 +299,9 @@ } }, "node_modules/@esbuild/freebsd-x64": { - "version": "0.19.12", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.19.12.tgz", - "integrity": "sha512-EYoXZ4d8xtBoVN7CEwWY2IN4ho76xjYXqSXMNccFSx2lgqOG/1TBPW0yPx1bJZk94qu3tX0fycJeeQsKovA8gg==", + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.19.11.tgz", + "integrity": "sha512-JkUqn44AffGXitVI6/AbQdoYAq0TEullFdqcMY/PCUZ36xJ9ZJRtQabzMA+Vi7r78+25ZIBosLTOKnUXBSi1Kw==", "cpu": [ "x64" ], @@ -314,9 +315,9 @@ } }, "node_modules/@esbuild/linux-arm": { - "version": "0.19.12", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.19.12.tgz", - "integrity": "sha512-J5jPms//KhSNv+LO1S1TX1UWp1ucM6N6XuL6ITdKWElCu8wXP72l9MM0zDTzzeikVyqFE6U8YAV9/tFyj0ti+w==", + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.19.11.tgz", + "integrity": "sha512-3CRkr9+vCV2XJbjwgzjPtO8T0SZUmRZla+UL1jw+XqHZPkPgZiyWvbDvl9rqAN8Zl7qJF0O/9ycMtjU67HN9/Q==", "cpu": [ "arm" ], @@ -330,9 +331,9 @@ } }, "node_modules/@esbuild/linux-arm64": { - "version": "0.19.12", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.19.12.tgz", - "integrity": "sha512-EoTjyYyLuVPfdPLsGVVVC8a0p1BFFvtpQDB/YLEhaXyf/5bczaGeN15QkR+O4S5LeJ92Tqotve7i1jn35qwvdA==", + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.19.11.tgz", + "integrity": "sha512-LneLg3ypEeveBSMuoa0kwMpCGmpu8XQUh+mL8XXwoYZ6Be2qBnVtcDI5azSvh7vioMDhoJFZzp9GWp9IWpYoUg==", "cpu": [ "arm64" ], @@ -346,9 +347,9 @@ } }, "node_modules/@esbuild/linux-ia32": { - "version": "0.19.12", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.19.12.tgz", - "integrity": "sha512-Thsa42rrP1+UIGaWz47uydHSBOgTUnwBwNq59khgIwktK6x60Hivfbux9iNR0eHCHzOLjLMLfUMLCypBkZXMHA==", + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.19.11.tgz", + "integrity": "sha512-caHy++CsD8Bgq2V5CodbJjFPEiDPq8JJmBdeyZ8GWVQMjRD0sU548nNdwPNvKjVpamYYVL40AORekgfIubwHoA==", "cpu": [ "ia32" ], @@ -362,9 +363,9 @@ } }, "node_modules/@esbuild/linux-loong64": { - "version": "0.19.12", - "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.19.12.tgz", - "integrity": "sha512-LiXdXA0s3IqRRjm6rV6XaWATScKAXjI4R4LoDlvO7+yQqFdlr1Bax62sRwkVvRIrwXxvtYEHHI4dm50jAXkuAA==", + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.19.11.tgz", + "integrity": "sha512-ppZSSLVpPrwHccvC6nQVZaSHlFsvCQyjnvirnVjbKSHuE5N24Yl8F3UwYUUR1UEPaFObGD2tSvVKbvR+uT1Nrg==", "cpu": [ "loong64" ], @@ -378,9 +379,9 @@ } }, "node_modules/@esbuild/linux-mips64el": { - "version": "0.19.12", - "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.19.12.tgz", - "integrity": "sha512-fEnAuj5VGTanfJ07ff0gOA6IPsvrVHLVb6Lyd1g2/ed67oU1eFzL0r9WL7ZzscD+/N6i3dWumGE1Un4f7Amf+w==", + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.19.11.tgz", + "integrity": "sha512-B5x9j0OgjG+v1dF2DkH34lr+7Gmv0kzX6/V0afF41FkPMMqaQ77pH7CrhWeR22aEeHKaeZVtZ6yFwlxOKPVFyg==", "cpu": [ "mips64el" ], @@ -394,9 +395,9 @@ } }, "node_modules/@esbuild/linux-ppc64": { - "version": "0.19.12", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.19.12.tgz", - "integrity": "sha512-nYJA2/QPimDQOh1rKWedNOe3Gfc8PabU7HT3iXWtNUbRzXS9+vgB0Fjaqr//XNbd82mCxHzik2qotuI89cfixg==", + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.19.11.tgz", + "integrity": "sha512-MHrZYLeCG8vXblMetWyttkdVRjQlQUb/oMgBNurVEnhj4YWOr4G5lmBfZjHYQHHN0g6yDmCAQRR8MUHldvvRDA==", "cpu": [ "ppc64" ], @@ -410,9 +411,9 @@ } }, "node_modules/@esbuild/linux-riscv64": { - "version": "0.19.12", - "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.19.12.tgz", - "integrity": "sha512-2MueBrlPQCw5dVJJpQdUYgeqIzDQgw3QtiAHUC4RBz9FXPrskyyU3VI1hw7C0BSKB9OduwSJ79FTCqtGMWqJHg==", + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.19.11.tgz", + "integrity": "sha512-f3DY++t94uVg141dozDu4CCUkYW+09rWtaWfnb3bqe4w5NqmZd6nPVBm+qbz7WaHZCoqXqHz5p6CM6qv3qnSSQ==", "cpu": [ "riscv64" ], @@ -426,9 +427,9 @@ } }, "node_modules/@esbuild/linux-s390x": { - "version": "0.19.12", - "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.19.12.tgz", - "integrity": "sha512-+Pil1Nv3Umes4m3AZKqA2anfhJiVmNCYkPchwFJNEJN5QxmTs1uzyy4TvmDrCRNT2ApwSari7ZIgrPeUx4UZDg==", + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.19.11.tgz", + "integrity": "sha512-A5xdUoyWJHMMlcSMcPGVLzYzpcY8QP1RtYzX5/bS4dvjBGVxdhuiYyFwp7z74ocV7WDc0n1harxmpq2ePOjI0Q==", "cpu": [ "s390x" ], @@ -442,9 +443,9 @@ } }, "node_modules/@esbuild/linux-x64": { - "version": "0.19.12", - "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.19.12.tgz", - "integrity": "sha512-B71g1QpxfwBvNrfyJdVDexenDIt1CiDN1TIXLbhOw0KhJzE78KIFGX6OJ9MrtC0oOqMWf+0xop4qEU8JrJTwCg==", + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.19.11.tgz", + "integrity": "sha512-grbyMlVCvJSfxFQUndw5mCtWs5LO1gUlwP4CDi4iJBbVpZcqLVT29FxgGuBJGSzyOxotFG4LoO5X+M1350zmPA==", "cpu": [ "x64" ], @@ -458,9 +459,9 @@ } }, "node_modules/@esbuild/netbsd-x64": { - "version": "0.19.12", - "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.19.12.tgz", - "integrity": "sha512-3ltjQ7n1owJgFbuC61Oj++XhtzmymoCihNFgT84UAmJnxJfm4sYCiSLTXZtE00VWYpPMYc+ZQmB6xbSdVh0JWA==", + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.19.11.tgz", + "integrity": "sha512-13jvrQZJc3P230OhU8xgwUnDeuC/9egsjTkXN49b3GcS5BKvJqZn86aGM8W9pd14Kd+u7HuFBMVtrNGhh6fHEQ==", "cpu": [ "x64" ], @@ -474,9 +475,9 @@ } }, "node_modules/@esbuild/openbsd-x64": { - "version": "0.19.12", - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.19.12.tgz", - "integrity": "sha512-RbrfTB9SWsr0kWmb9srfF+L933uMDdu9BIzdA7os2t0TXhCRjrQyCeOt6wVxr79CKD4c+p+YhCj31HBkYcXebw==", + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.19.11.tgz", + "integrity": "sha512-ysyOGZuTp6SNKPE11INDUeFVVQFrhcNDVUgSQVDzqsqX38DjhPEPATpid04LCoUr2WXhQTEZ8ct/EgJCUDpyNw==", "cpu": [ "x64" ], @@ -490,9 +491,9 @@ } }, "node_modules/@esbuild/sunos-x64": { - "version": "0.19.12", - "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.19.12.tgz", - "integrity": "sha512-HKjJwRrW8uWtCQnQOz9qcU3mUZhTUQvi56Q8DPTLLB+DawoiQdjsYq+j+D3s9I8VFtDr+F9CjgXKKC4ss89IeA==", + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.19.11.tgz", + "integrity": "sha512-Hf+Sad9nVwvtxy4DXCZQqLpgmRTQqyFyhT3bZ4F2XlJCjxGmRFF0Shwn9rzhOYRB61w9VMXUkxlBy56dk9JJiQ==", "cpu": [ "x64" ], @@ -506,9 +507,9 @@ } }, "node_modules/@esbuild/win32-arm64": { - "version": "0.19.12", - "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.19.12.tgz", - "integrity": "sha512-URgtR1dJnmGvX864pn1B2YUYNzjmXkuJOIqG2HdU62MVS4EHpU2946OZoTMnRUHklGtJdJZ33QfzdjGACXhn1A==", + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.19.11.tgz", + "integrity": "sha512-0P58Sbi0LctOMOQbpEOvOL44Ne0sqbS0XWHMvvrg6NE5jQ1xguCSSw9jQeUk2lfrXYsKDdOe6K+oZiwKPilYPQ==", "cpu": [ "arm64" ], @@ -522,9 +523,9 @@ } }, "node_modules/@esbuild/win32-ia32": { - "version": "0.19.12", - "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.19.12.tgz", - "integrity": "sha512-+ZOE6pUkMOJfmxmBZElNOx72NKpIa/HFOMGzu8fqzQJ5kgf6aTGrcJaFsNiVMH4JKpMipyK+7k0n2UXN7a8YKQ==", + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.19.11.tgz", + "integrity": "sha512-6YOrWS+sDJDmshdBIQU+Uoyh7pQKrdykdefC1avn76ss5c+RN6gut3LZA4E2cH5xUEp5/cA0+YxRaVtRAb0xBg==", "cpu": [ "ia32" ], @@ -538,9 +539,9 @@ } }, "node_modules/@esbuild/win32-x64": { - "version": "0.19.12", - "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.19.12.tgz", - "integrity": "sha512-T1QyPSDCyMXaO3pzBkF96E8xMkiRYbUEZADd29SyPGabqxMViNoii+NcK7eWJAEoU6RZyEm5lVSIjTmcdoB9HA==", + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.19.11.tgz", + "integrity": "sha512-vfkhltrjCAb603XaFhqhAF4LGDi2M4OrCRrFusyQ+iTLQ/o60QQXxc9cZC/FFpihBI9N1Grn6SMKVJ4KP7Fuiw==", "cpu": [ "x64" ], @@ -602,9 +603,9 @@ } }, "node_modules/@lancedb/vectordb-darwin-arm64": { - "version": "0.4.12", - "resolved": "https://registry.npmjs.org/@lancedb/vectordb-darwin-arm64/-/vectordb-darwin-arm64-0.4.12.tgz", - "integrity": "sha512-38/rkJRlWXkPWXuj9onzvbrhnIWcIUQjgEp5G9v5ixPosBowm7A4j8e2Q8CJMsVSNcVX2JLqwWVldiWegZFuYw==", + "version": "0.4.15", + "resolved": "https://registry.npmjs.org/@lancedb/vectordb-darwin-arm64/-/vectordb-darwin-arm64-0.4.15.tgz", + "integrity": "sha512-asNVd0ojbExbj/iRCFu/+vpnnGtAHbrn7AjrL1PFeSl1JvsvzeZBBxq+WlM4UfGKfiJhkyBvQwh609OiCP3Snw==", "cpu": [ "arm64" ], @@ -614,9 +615,9 @@ ] }, "node_modules/@lancedb/vectordb-darwin-x64": { - "version": "0.4.12", - "resolved": "https://registry.npmjs.org/@lancedb/vectordb-darwin-x64/-/vectordb-darwin-x64-0.4.12.tgz", - "integrity": "sha512-psE48dztyO450hXWdv9Rl9aayM2HQ1uF9wErfC0gKmDUh1N0NdVq2viDuFpZxnmCis/nvGwKlYiYT9OnYNCJ9g==", + "version": "0.4.15", + "resolved": "https://registry.npmjs.org/@lancedb/vectordb-darwin-x64/-/vectordb-darwin-x64-0.4.15.tgz", + "integrity": "sha512-tbMGb1P9KXdnoP6dqFnjhUUjGIVzzo2V/Ewc8iktMU1scCVQ7/rEPPvTh9jHuM1r1i+wVTNtKYijIVaHZZPJLA==", "cpu": [ "x64" ], @@ -626,9 +627,9 @@ ] }, "node_modules/@lancedb/vectordb-linux-arm64-gnu": { - "version": "0.4.12", - "resolved": "https://registry.npmjs.org/@lancedb/vectordb-linux-arm64-gnu/-/vectordb-linux-arm64-gnu-0.4.12.tgz", - "integrity": "sha512-xwkgF6MiF5aAdG9JG8v4ke652YxUJrhs9z4OrsEfrENnvsIQd2C5UyKMepVLdvij4BI/XPFRFWXdjPvP7S9rTA==", + "version": "0.4.15", + "resolved": "https://registry.npmjs.org/@lancedb/vectordb-linux-arm64-gnu/-/vectordb-linux-arm64-gnu-0.4.15.tgz", + "integrity": "sha512-5oiWvS9Y5mRc2PhaVzu9zoM1UFf77gDgX8IM95U87CZZdPAoREDvnbVhyIZa2SEZccEjLG7tShe+PJsOFWOT/w==", "cpu": [ "arm64" ], @@ -638,9 +639,9 @@ ] }, "node_modules/@lancedb/vectordb-linux-x64-gnu": { - "version": "0.4.12", - "resolved": "https://registry.npmjs.org/@lancedb/vectordb-linux-x64-gnu/-/vectordb-linux-x64-gnu-0.4.12.tgz", - "integrity": "sha512-gJqYR0aymrS+C60xc4EQPzmQ5/69XfeFv2ofBvAj7qW+c6BcnoAcfVl+7s1IrcWeGz251sm5cD5Lx4AzJd89dA==", + "version": "0.4.15", + "resolved": "https://registry.npmjs.org/@lancedb/vectordb-linux-x64-gnu/-/vectordb-linux-x64-gnu-0.4.15.tgz", + "integrity": "sha512-FjlrV2h97t5aoammRpPSBjws2cWSKYQpzALHm8Af8QjTuvo9J/MD63Fr/D6Sb9Ie2ER3pCiWD1o8UCFndCFtRg==", "cpu": [ "x64" ], @@ -650,9 +651,9 @@ ] }, "node_modules/@lancedb/vectordb-win32-x64-msvc": { - "version": "0.4.12", - "resolved": "https://registry.npmjs.org/@lancedb/vectordb-win32-x64-msvc/-/vectordb-win32-x64-msvc-0.4.12.tgz", - "integrity": "sha512-LhCzpyEeBUyO6L2fuVqeP3mW8kYDryyU9PNqcM01m88sZB1Do6AlwiM+GjPRQ0SpzD0LK9oxQqSmJrdcNGqjbw==", + "version": "0.4.15", + "resolved": "https://registry.npmjs.org/@lancedb/vectordb-win32-x64-msvc/-/vectordb-win32-x64-msvc-0.4.15.tgz", + "integrity": "sha512-o3zlY/FnY426kp2Y7xn4UbD6/Oeg5xqtezYNhhmt44lCmhSlpydx+2m9Fq1OGSDNUCWtrhMhgdHVnGTu2VTa5A==", "cpu": [ "x64" ], @@ -980,11 +981,11 @@ } }, "node_modules/axios": { - "version": "1.6.7", - "resolved": "https://registry.npmjs.org/axios/-/axios-1.6.7.tgz", - "integrity": "sha512-/hDJGff6/c7u0hDkvkGxR/oy6CbCs8ziCsC7SqmhjfozqiJGc8Z11wrv9z9lYfY4K8l+H9TpjcMDX0xOZmx+RA==", + "version": "1.6.8", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.6.8.tgz", + "integrity": "sha512-v/ZHtJDU39mDpyBoFVkETcd/uNdxrWRrg3bKpOKzXFA6Bvqopts6ALSMU3y6ijYxbw2B+wPrIv46egTzJXCLGQ==", "dependencies": { - "follow-redirects": "^1.15.4", + "follow-redirects": "^1.15.6", "form-data": "^4.0.0", "proxy-from-env": "^1.1.0" } @@ -1270,9 +1271,9 @@ "integrity": "sha512-xmHIy4F3scKVwMsQ4WnVaS8bHOx0DmVwRywosKhaILI0ywMDWPtBSku2HNxRvF7jtwDRsoEwYQSfbxj8b7RlJQ==" }, "node_modules/detect-libc": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.0.2.tgz", - "integrity": "sha512-UX6sGumvvqSaXgdKGUsgZWqcUyIXZ/vZTrlRT/iobiKhGL0zL4d3osHj3uqllWJK+i+sixDS/3COVEOFbupFyw==", + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.0.3.tgz", + "integrity": "sha512-bwy0MGW55bG41VqxxypOsdSdGqLwXPI/focwgTYCFMbdUiBAxLg9CFzG08sz2aqzknwiX7Hkl0bQENjg8iLByw==", "dev": true, "engines": { "node": ">=8" @@ -1306,9 +1307,9 @@ } }, "node_modules/esbuild": { - "version": "0.19.12", - "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.19.12.tgz", - "integrity": "sha512-aARqgq8roFBj054KvQr5f1sFu0D65G+miZRCuJyJ0G13Zwx7vRar5Zhn2tkQNzIXcBrNVsv/8stehpj+GAjgbg==", + "version": "0.19.11", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.19.11.tgz", + "integrity": "sha512-HJ96Hev2hX/6i5cDVwcqiJBBtuo9+FeIJOtZ9W1kA5M6AMJRHUZlpYZ1/SbEwtO0ioNAW8rUooVpC/WehY2SfA==", "dev": true, "hasInstallScript": true, "bin": { @@ -1318,29 +1319,29 @@ "node": ">=12" }, "optionalDependencies": { - "@esbuild/aix-ppc64": "0.19.12", - "@esbuild/android-arm": "0.19.12", - "@esbuild/android-arm64": "0.19.12", - "@esbuild/android-x64": "0.19.12", - "@esbuild/darwin-arm64": "0.19.12", - "@esbuild/darwin-x64": "0.19.12", - "@esbuild/freebsd-arm64": "0.19.12", - "@esbuild/freebsd-x64": "0.19.12", - "@esbuild/linux-arm": "0.19.12", - "@esbuild/linux-arm64": "0.19.12", - "@esbuild/linux-ia32": "0.19.12", - "@esbuild/linux-loong64": "0.19.12", - "@esbuild/linux-mips64el": "0.19.12", - "@esbuild/linux-ppc64": "0.19.12", - "@esbuild/linux-riscv64": "0.19.12", - "@esbuild/linux-s390x": "0.19.12", - "@esbuild/linux-x64": "0.19.12", - "@esbuild/netbsd-x64": "0.19.12", - "@esbuild/openbsd-x64": "0.19.12", - "@esbuild/sunos-x64": "0.19.12", - "@esbuild/win32-arm64": "0.19.12", - "@esbuild/win32-ia32": "0.19.12", - "@esbuild/win32-x64": "0.19.12" + "@esbuild/aix-ppc64": "0.19.11", + "@esbuild/android-arm": "0.19.11", + "@esbuild/android-arm64": "0.19.11", + "@esbuild/android-x64": "0.19.11", + "@esbuild/darwin-arm64": "0.19.11", + "@esbuild/darwin-x64": "0.19.11", + "@esbuild/freebsd-arm64": "0.19.11", + "@esbuild/freebsd-x64": "0.19.11", + "@esbuild/linux-arm": "0.19.11", + "@esbuild/linux-arm64": "0.19.11", + "@esbuild/linux-ia32": "0.19.11", + "@esbuild/linux-loong64": "0.19.11", + "@esbuild/linux-mips64el": "0.19.11", + "@esbuild/linux-ppc64": "0.19.11", + "@esbuild/linux-riscv64": "0.19.11", + "@esbuild/linux-s390x": "0.19.11", + "@esbuild/linux-x64": "0.19.11", + "@esbuild/netbsd-x64": "0.19.11", + "@esbuild/openbsd-x64": "0.19.11", + "@esbuild/sunos-x64": "0.19.11", + "@esbuild/win32-arm64": "0.19.11", + "@esbuild/win32-ia32": "0.19.11", + "@esbuild/win32-x64": "0.19.11" } }, "node_modules/escalade": { @@ -1881,9 +1882,9 @@ } }, "node_modules/node-abi": { - "version": "3.56.0", - "resolved": "https://registry.npmjs.org/node-abi/-/node-abi-3.56.0.tgz", - "integrity": "sha512-fZjdhDOeRcaS+rcpve7XuwHBmktS1nS1gzgghwKUQQ8nTy2FdSDr6ZT8k6YhvlJeHmmQMYiT/IH9hfco5zeW2Q==", + "version": "3.57.0", + "resolved": "https://registry.npmjs.org/node-abi/-/node-abi-3.57.0.tgz", + "integrity": "sha512-Dp+A9JWxRaKuHP35H77I4kCKesDy5HUDEmScia2FyncMTOXASMyg251F5PhFoDA5uqBrDDffiLpbqnrZmNXW+g==", "dev": true, "dependencies": { "semver": "^7.3.5" @@ -2510,9 +2511,9 @@ } }, "node_modules/typescript": { - "version": "5.4.2", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.4.2.tgz", - "integrity": "sha512-+2/g0Fds1ERlP6JsakQQDXjZdZMM+rqpamFZJEKh4kwTIn3iDkgKtby0CeNd5ATNZ4Ry1ax15TMx0W2V+miizQ==", + "version": "5.4.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.4.3.tgz", + "integrity": "sha512-KrPd3PKaCLr78MalgiwJnA25Nm8HAmdwN3mYUYZgG/wizIo9EainNVQI9/yDavtVFRN2h3k8uf3GLHuhDMgEHg==", "dev": true, "bin": { "tsc": "bin/tsc", @@ -2564,9 +2565,9 @@ } }, "node_modules/vectordb": { - "version": "0.4.12", - "resolved": "https://registry.npmjs.org/vectordb/-/vectordb-0.4.12.tgz", - "integrity": "sha512-H2mFwZ87d3BcuX4yGx5RoW06amRZQ3W5u/FRTNc86rwVINuEEa+Ivsqng1i8hURHXoTDbF/0Y9qwCshySkeznQ==", + "version": "0.4.15", + "resolved": "https://registry.npmjs.org/vectordb/-/vectordb-0.4.15.tgz", + "integrity": "sha512-iROQ92CUGHj+kDUFVCdIk1Wvqg/pGE6WHhBlOorgRXHZwiFjP2SwmcDZeW7c7lH2hXC5Sks8MAGlglPstCpELQ==", "cpu": [ "x64", "arm64" @@ -2581,11 +2582,11 @@ "axios": "^1.4.0" }, "optionalDependencies": { - "@lancedb/vectordb-darwin-arm64": "0.4.12", - "@lancedb/vectordb-darwin-x64": "0.4.12", - "@lancedb/vectordb-linux-arm64-gnu": "0.4.12", - "@lancedb/vectordb-linux-x64-gnu": "0.4.12", - "@lancedb/vectordb-win32-x64-msvc": "0.4.12" + "@lancedb/vectordb-darwin-arm64": "0.4.15", + "@lancedb/vectordb-darwin-x64": "0.4.15", + "@lancedb/vectordb-linux-arm64-gnu": "0.4.15", + "@lancedb/vectordb-linux-x64-gnu": "0.4.15", + "@lancedb/vectordb-win32-x64-msvc": "0.4.15" }, "peerDependencies": { "@apache-arrow/ts": "^14.0.2", diff --git a/pkg/package.json b/binary/package.json similarity index 96% rename from pkg/package.json rename to binary/package.json index 0429c35a7..d821cd3fe 100644 --- a/pkg/package.json +++ b/binary/package.json @@ -1,5 +1,5 @@ { - "name": "pkg", + "name": "binary", "version": "1.0.0", "description": "", "main": "out/index.js", @@ -32,7 +32,7 @@ "@types/follow-redirects": "^1.14.4", "@types/uuid": "^9.0.8", "@vercel/ncc": "^0.38.1", - "esbuild": "^0.19.11", + "esbuild": "0.19.11", "pkg": "^5.8.1", "typescript": "^5.3.3" }, diff --git a/pkg/pkgJson/darwin-arm64/package.json b/binary/pkgJson/darwin-arm64/package.json similarity index 94% rename from pkg/pkgJson/darwin-arm64/package.json rename to binary/pkgJson/darwin-arm64/package.json index 3ac12e67a..0cb1b4d32 100644 --- a/pkg/pkgJson/darwin-arm64/package.json +++ b/binary/pkgJson/darwin-arm64/package.json @@ -1,5 +1,5 @@ { - "name": "pkg", + "name": "continue-binary", "version": "1.0.0", "description": "", "bin": "../../out/index.js", diff --git a/pkg/pkgJson/darwin-x64/package.json b/binary/pkgJson/darwin-x64/package.json similarity index 94% rename from pkg/pkgJson/darwin-x64/package.json rename to binary/pkgJson/darwin-x64/package.json index d064d6c2a..65ad94d25 100644 --- a/pkg/pkgJson/darwin-x64/package.json +++ b/binary/pkgJson/darwin-x64/package.json @@ -1,5 +1,5 @@ { - "name": "pkg", + "name": "continue-binary", "version": "1.0.0", "description": "", "bin": "../../out/index.js", diff --git a/pkg/pkgJson/linux-arm64/package.json b/binary/pkgJson/linux-arm64/package.json similarity index 94% rename from pkg/pkgJson/linux-arm64/package.json rename to binary/pkgJson/linux-arm64/package.json index 37a3a5b6d..fbea8ff60 100644 --- a/pkg/pkgJson/linux-arm64/package.json +++ b/binary/pkgJson/linux-arm64/package.json @@ -1,5 +1,5 @@ { - "name": "pkg", + "name": "continue-binary", "version": "1.0.0", "description": "", "bin": "../../out/index.js", diff --git a/pkg/pkgJson/linux-x64/package.json b/binary/pkgJson/linux-x64/package.json similarity index 94% rename from pkg/pkgJson/linux-x64/package.json rename to binary/pkgJson/linux-x64/package.json index 487886d26..508a116d4 100644 --- a/pkg/pkgJson/linux-x64/package.json +++ b/binary/pkgJson/linux-x64/package.json @@ -1,5 +1,5 @@ { - "name": "pkg", + "name": "continue-binary", "version": "1.0.0", "description": "", "bin": "../../out/index.js", diff --git a/pkg/pkgJson/win32-arm64/package.json b/binary/pkgJson/win32-arm64/package.json similarity index 94% rename from pkg/pkgJson/win32-arm64/package.json rename to binary/pkgJson/win32-arm64/package.json index 4573ccbca..0dcf4fa57 100644 --- a/pkg/pkgJson/win32-arm64/package.json +++ b/binary/pkgJson/win32-arm64/package.json @@ -1,5 +1,5 @@ { - "name": "pkg", + "name": "continue-binary", "version": "1.0.0", "description": "", "bin": "../../out/index.js", diff --git a/pkg/pkgJson/win32-x64/package.json b/binary/pkgJson/win32-x64/package.json similarity index 94% rename from pkg/pkgJson/win32-x64/package.json rename to binary/pkgJson/win32-x64/package.json index c9a4b1a9b..e61e1380c 100644 --- a/pkg/pkgJson/win32-x64/package.json +++ b/binary/pkgJson/win32-x64/package.json @@ -1,5 +1,5 @@ { - "name": "pkg", + "name": "continue-binary", "version": "1.0.0", "description": "", "bin": "../../out/index.js", diff --git a/pkg/src/IpcIde.ts b/binary/src/IpcIde.ts similarity index 100% rename from pkg/src/IpcIde.ts rename to binary/src/IpcIde.ts diff --git a/pkg/src/core.ts b/binary/src/core.ts similarity index 88% rename from pkg/src/core.ts rename to binary/src/core.ts index 0ee89ff18..8cded9f25 100644 --- a/pkg/src/core.ts +++ b/binary/src/core.ts @@ -9,6 +9,7 @@ import { logDevData } from "core/util/devdata"; import historyManager from "core/util/history"; import { Message } from "core/util/messenger"; import { Telemetry } from "core/util/posthog"; +import { streamDiffLines } from "core/util/verticalEdit"; import { v4 as uuidv4 } from "uuid"; import { IpcMessenger } from "./messenger"; import { Protocol } from "./protocol"; @@ -47,6 +48,8 @@ export class Core { this.configHandler, this.ide, new PauseToken(false), + undefined, // TODO + Promise.resolve(undefined), // TODO ); const getLlm = async () => { @@ -63,6 +66,11 @@ export class Core { const on = this.messenger.on.bind(this.messenger); + this.messenger.onError((err) => { + console.error(err); + this.messenger.request("errorPopup", { message: err.message }); + }); + // New on("update/modelChange", (msg) => { this.selectedModelTitle = msg.data; @@ -151,6 +159,7 @@ export class Core { fullInput: msg.data.fullInput, ide, selectedCode: msg.data.selectedCode, + reranker: config.reranker, }); Telemetry.capture("useContextProvider", { @@ -293,6 +302,36 @@ export class Core { on("autocomplete/cancel", async (msg) => { this.completionProvider.cancel(); }); + + async function* streamDiffLinesGenerator( + configHandler: ConfigHandler, + abortedMessageIds: Set, + msg: Message, + ) { + const data = msg.data; + const llm = await configHandler.llmFromTitle(msg.data.modelTitle); + for await (const diffLine of streamDiffLines( + data.prefix, + data.highlighted, + data.suffix, + llm, + data.input, + data.language, + )) { + if (abortedMessageIds.has(msg.messageId)) { + abortedMessageIds.delete(msg.messageId); + break; + } + console.log(diffLine); + yield { content: diffLine }; + } + + return { done: true }; + } + + on("streamDiffLines", (msg) => + streamDiffLinesGenerator(this.configHandler, this.abortedMessageIds, msg), + ); } public invoke( diff --git a/pkg/src/index.ts b/binary/src/index.ts similarity index 100% rename from pkg/src/index.ts rename to binary/src/index.ts diff --git a/pkg/src/messenger.ts b/binary/src/messenger.ts similarity index 91% rename from pkg/src/messenger.ts rename to binary/src/messenger.ts index ba4d6e266..f8f02a7f9 100644 --- a/pkg/src/messenger.ts +++ b/binary/src/messenger.ts @@ -35,6 +35,12 @@ export class IpcMessenger { }); } + private _onErrorHandlers: ((error: Error) => void)[] = []; + + onError(handler: (error: Error) => void) { + this._onErrorHandlers.push(handler); + } + mock(data: any) { const d = JSON.stringify(data); this._handleData(Buffer.from(d)); @@ -63,8 +69,11 @@ export class IpcMessenger { } else { this.send(msg.messageType, response || {}, msg.messageId); } - } catch (e) { + } catch (e: any) { console.warn(`Error running handler for "${msg.messageType}": `, e); + this._onErrorHandlers.forEach((handler) => { + handler(e); + }); } }); @@ -78,7 +87,7 @@ export class IpcMessenger { private _handleData(data: Buffer) { const d = data.toString(); - const lines = d.split("\n").filter((line) => line.trim() !== ""); + const lines = d.split(/\r\n|\r|\n/).filter((line) => line.trim() !== ""); lines.forEach((line) => this._handleLine(line)); } diff --git a/pkg/tsconfig.json b/binary/tsconfig.json similarity index 100% rename from pkg/tsconfig.json rename to binary/tsconfig.json diff --git a/core/autocomplete/completionProvider.ts b/core/autocomplete/completionProvider.ts index 8e0664136..dadacf6f1 100644 --- a/core/autocomplete/completionProvider.ts +++ b/core/autocomplete/completionProvider.ts @@ -7,6 +7,7 @@ import { streamLines } from "../diff/util"; import OpenAI from "../llm/llms/OpenAI"; import { getBasename } from "../util"; import { logDevData } from "../util/devdata"; +import { DEFAULT_AUTOCOMPLETE_OPTS } from "../util/parameters"; import { Telemetry } from "../util/posthog"; import { getRangeInString } from "../util/ranges"; import AutocompleteLruCache from "./cache"; @@ -18,12 +19,12 @@ import { import { AutocompleteLanguageInfo } from "./languages"; import { avoidPathLine, + noTopLevelKeywordsMidline, stopAtLines, stopAtRepeatingLines, stopAtSimilarLine, streamWithNewLines, } from "./lineStream"; -import { DEFAULT_AUTOCOMPLETE_OPTS } from "./parameters"; import { AutocompleteSnippet } from "./ranking"; import { getTemplateForModel } from "./templates"; import { GeneratorReuseManager } from "./util"; @@ -37,7 +38,7 @@ export interface AutocompleteInput { clipboardText: string; } -export interface AutocompleteOutcome { +export interface AutocompleteOutcome extends TabAutocompleteOptions { accepted?: boolean; time: number; prompt: string; @@ -50,10 +51,21 @@ export interface AutocompleteOutcome { const autocompleteCache = AutocompleteLruCache.get(); +const DOUBLE_NEWLINE = "\n\n"; +const WINDOWS_DOUBLE_NEWLINE = "\r\n\r\n"; +const SRC_DIRECTORY = "/src/"; +// Starcoder2 tends to output artifacts starting with the letter "t" +const STARCODER2_T_ARTIFACTS = ["t.", "\nt"]; +const PYTHON_ENCODING = "#- coding: utf-8"; +const CODE_BLOCK_END = "```"; + +const multilineStops = [DOUBLE_NEWLINE, WINDOWS_DOUBLE_NEWLINE]; +const commonStops = [SRC_DIRECTORY, PYTHON_ENCODING, CODE_BLOCK_END]; + function formatExternalSnippet( filepath: string, snippet: string, - language: AutocompleteLanguageInfo + language: AutocompleteLanguageInfo, ) { const comment = language.comment; const lines = [ @@ -78,8 +90,8 @@ export async function getTabCompletion( filepath: string, contents: string, cursorIndex: number, - ide: IDE - ) => Promise + ide: IDE, + ) => Promise, ): Promise { const startTime = Date.now(); @@ -105,9 +117,12 @@ export async function getTabCompletion( // Model if (llm instanceof OpenAI) { llm.useLegacyCompletionsEndpoint = true; - } else if (llm.providerName === "free-trial") { + } else if ( + llm.providerName === "free-trial" && + llm.model !== "starcoder-7b" + ) { throw new Error( - "Free trial is not supported for tab-autocomplete. We recommend using starcoder with Ollama, LM Studio, or another provider.", + "The only free trial model supported for tab-autocomplete is starcoder-7b.", ); } if (!llm) return; @@ -129,7 +144,7 @@ export async function getTabCompletion( filepath, fullPrefix + fullSuffix, fullPrefix.length, - ide + ide, ), new Promise((resolve) => { setTimeout(() => resolve([]), 100); @@ -155,7 +170,7 @@ export async function getTabCompletion( recentlyEditedRanges, recentlyEditedFiles, llm.model, - extrasSnippets + extrasSnippets, ); // Template prompt @@ -172,7 +187,7 @@ export async function getTabCompletion( // Format snippets as comments and prepend to prefix const formattedSnippets = snippets .map((snippet) => - formatExternalSnippet(snippet.filepath, snippet.contents, lang) + formatExternalSnippet(snippet.filepath, snippet.contents, lang), ) .join("\n"); if (formattedSnippets.length > 0) { @@ -203,12 +218,13 @@ export async function getTabCompletion( cacheHit = true; completion = cachedCompletion; } else { - // Try to reuse pending requests if what the user typed matches start of completion let stop = [ ...(completionOptions?.stop || []), - "\n\n", - "/src/", - "```", + ...multilineStops, + ...commonStops, + ...(llm.model.toLowerCase().includes("starcoder2") + ? STARCODER2_T_ARTIFACTS + : []), ...lang.stopWords, ]; @@ -216,6 +232,7 @@ export async function getTabCompletion( options.multilineCompletions !== "never" && (options.multilineCompletions === "always" || completeMultiline); + // Try to reuse pending requests if what the user typed matches start of completion let generator = generatorReuseManager.getGenerator( prefix, () => @@ -224,7 +241,7 @@ export async function getTabCompletion( raw: true, stop, }), - multiline + multiline, ); // LLM @@ -233,22 +250,22 @@ export async function getTabCompletion( for await (const update of generator) { if (token.aborted) { cancelled = true; - return undefined; + return; } yield update; } }; - let chars = generatorWithCancellation(); - const gen2 = onlyWhitespaceAfterEndOfLine( - noFirstCharNewline(chars), - lang.endOfLine - ); - const lineGenerator = streamWithNewLines( - avoidPathLine( - stopAtRepeatingLines(stopAtLines(streamLines(gen2))), - lang.comment - ) - ); + let charGenerator = generatorWithCancellation(); + charGenerator = noFirstCharNewline(charGenerator); + charGenerator = onlyWhitespaceAfterEndOfLine(charGenerator, lang.endOfLine); + + let lineGenerator = streamLines(charGenerator); + lineGenerator = stopAtLines(lineGenerator); + lineGenerator = stopAtRepeatingLines(lineGenerator); + lineGenerator = avoidPathLine(lineGenerator, lang.comment); + lineGenerator = noTopLevelKeywordsMidline(lineGenerator, lang.stopWords); + lineGenerator = streamWithNewLines(lineGenerator); + const finalGenerator = stopAtSimilarLine(lineGenerator, lineBelowCursor); for await (const update of finalGenerator) { completion += update; @@ -276,6 +293,7 @@ export async function getTabCompletion( modelName: llm.model, completionOptions, cacheHit, + ...options, }; } @@ -293,11 +311,11 @@ export class CompletionProvider { filepath: string, contents: string, cursorIndex: number, - ide: IDE - ) => Promise + ide: IDE, + ) => Promise, ) { this.generatorReuseManager = new GeneratorReuseManager( - this.onError.bind(this) + this.onError.bind(this), ); } @@ -347,7 +365,7 @@ export class CompletionProvider { public async provideInlineCompletionItems( input: AutocompleteInput, - token: AbortSignal | undefined + token: AbortSignal | undefined, ): Promise { // Create abort signal if not given if (!token) { @@ -367,12 +385,17 @@ export class CompletionProvider { ...config.tabAutocompleteOptions, }; + // Allow disabling autocomplete from config.json + if (options.disable) { + return undefined; + } + if (CompletionProvider.debouncing) { CompletionProvider.debounceTimeout?.refresh(); const lastUUID = await new Promise((resolve) => setTimeout(() => { resolve(CompletionProvider.lastUUID); - }, options.debounceDelay) + }, options.debounceDelay), ); if (uuid !== lastUUID) { return undefined; @@ -392,7 +415,7 @@ export class CompletionProvider { // Set temperature (but don't overrride) if (llm.completionOptions.temperature === undefined) { - llm.completionOptions.temperature = 0.0; + llm.completionOptions.temperature = 0.01; } const outcome = await getTabCompletion( @@ -402,7 +425,7 @@ export class CompletionProvider { this.ide, this.generatorReuseManager, input, - this.getDefinitionsFromLsp + this.getDefinitionsFromLsp, ); const completion = outcome?.completion; @@ -421,12 +444,9 @@ export class CompletionProvider { const logRejectionTimeout = setTimeout(() => { // Wait 10 seconds, then assume it wasn't accepted logDevData("autocomplete", outcome); + const { prompt, completion, ...restOfOutcome } = outcome; Telemetry.capture("autocomplete", { - accepted: outcome.accepted, - modelName: outcome.modelName, - modelProvider: outcome.modelProvider, - time: outcome.time, - cacheHit: outcome.cacheHit, + ...restOfOutcome, }); this._logRejectionTimeouts.delete(input.completionId); }, 10_000); diff --git a/core/autocomplete/languages.ts b/core/autocomplete/languages.ts index 1f9e7dac2..9f3bcb649 100644 --- a/core/autocomplete/languages.ts +++ b/core/autocomplete/languages.ts @@ -6,7 +6,7 @@ export interface AutocompleteLanguageInfo { // TypeScript export const Typescript = { - stopWords: ["function", "class", "module", "export"], + stopWords: ["function", "class", "module", "export", "import"], comment: "//", endOfLine: [";"], }; diff --git a/core/autocomplete/lineStream.ts b/core/autocomplete/lineStream.ts index b24cb1458..1ee0c5e88 100644 --- a/core/autocomplete/lineStream.ts +++ b/core/autocomplete/lineStream.ts @@ -2,6 +2,22 @@ import { distance } from "fastest-levenshtein"; import { DiffLine } from ".."; import { LineStream } from "../diff/util"; +export async function* noTopLevelKeywordsMidline( + lines: LineStream, + topLevelKeywords: string[], +): LineStream { + for await (const line of lines) { + for (const keyword of topLevelKeywords) { + const indexOf = line.indexOf(keyword + " "); + if (indexOf >= 0 && line.slice(indexOf - 1, indexOf).trim() !== "") { + yield line.slice(0, indexOf); + break; + } + } + yield line; + } +} + export async function* avoidPathLine( stream: LineStream, comment: string, @@ -54,11 +70,11 @@ export async function* stopAtSimilarLine( } } -const LINES_TO_STOP_AT = ["# End of file."]; +const LINES_TO_STOP_AT = ["# End of file.", " line.trim().includes(stopAt))) { break; } yield line; @@ -69,7 +85,8 @@ function shouldRemoveLineBeforeStart(line: string): boolean { return ( line.trimStart().startsWith("```") || line.trim() === "[CODE]" || - line.trim() === "" + line.trim() === "" || + line.trim() === "" ); } @@ -142,6 +159,9 @@ export async function* filterEnglishLinesAtStart(lines: LineStream) { let i = 0; let wasEnglishFirstLine = false; for await (let line of lines) { + if (i === 0 && line.trim() === "") { + continue; + } if (i === 0) { if (isEnglishFirstLine(line)) { wasEnglishFirstLine = true; diff --git a/core/autocomplete/retrieval.ts b/core/autocomplete/retrieval.ts index 0f6349508..5c9641863 100644 --- a/core/autocomplete/retrieval.ts +++ b/core/autocomplete/retrieval.ts @@ -1,10 +1,10 @@ -import { Chunk, IndexTag } from ".."; +import { BranchAndDir, Chunk } from ".."; import { FullTextSearchCodebaseIndex } from "../indexing/FullTextSearch"; export async function fullTextRetrieve( prefix: string, suffix: string, - indexTag: IndexTag, + indexTag: BranchAndDir, ): Promise { const index = new FullTextSearchCodebaseIndex(); const searchStrings = prefix.split("\n").slice(-3); diff --git a/core/autocomplete/templates.ts b/core/autocomplete/templates.ts index 2755771aa..430bd3db2 100644 --- a/core/autocomplete/templates.ts +++ b/core/autocomplete/templates.ts @@ -24,6 +24,13 @@ const stableCodeFimTemplate: AutocompleteTemplate = { }, }; +const codegemmaFimTemplate: AutocompleteTemplate = { + template: "<|fim_prefix|>{{{prefix}}}<|fim_suffix|>{{{suffix}}}<|fim_middle|>", + completionOptions: { + stop: ["<|fim_prefix|>", "<|fim_suffix|>", "<|fim_middle|>", "<|file_separator|>", "", ""], + }, +}; + // https://arxiv.org/pdf/2402.19173.pdf section 5.1 const starcoder2FimTemplate: AutocompleteTemplate = { template: ( @@ -79,12 +86,11 @@ const deepseekFimTemplateWrongPipeChar: AutocompleteTemplate = { }; const gptAutocompleteTemplate: AutocompleteTemplate = { - template: `Your task is to complete the line at the end of this code block: -\`\`\` -{{{prefix}}} + template: `\`\`\` +{{{prefix}}}[BLANK]{{{suffix}}} \`\`\` -The last line is incomplete, and you should provide the rest of that line. If the line is already complete, just return a new line. Otherwise, DO NOT provide explanation, a code block, or extra whitespace, just the code that should be added to the last line to complete it:`, +Fill in the blank to complete the code block. Your response should include only the code to replace [BLANK], without surrounding backticks.`, completionOptions: { stop: ["\n"] }, }; @@ -105,6 +111,10 @@ export function getTemplateForModel(model: string): AutocompleteTemplate { return stableCodeFimTemplate; } + if (lowerCaseModel.includes("codegemma")) { + return codegemmaFimTemplate; + } + if (lowerCaseModel.includes("codellama")) { return codeLlamaFimTemplate; } @@ -113,7 +123,11 @@ export function getTemplateForModel(model: string): AutocompleteTemplate { return deepseekFimTemplate; } - if (lowerCaseModel.includes("gpt") || lowerCaseModel.includes("davinci-002")) { + if ( + lowerCaseModel.includes("gpt") || + lowerCaseModel.includes("davinci-002") || + lowerCaseModel.includes("claude") + ) { return gptAutocompleteTemplate; } diff --git a/core/autocomplete/util.ts b/core/autocomplete/util.ts index 5b9010cd6..99f204dd8 100644 --- a/core/autocomplete/util.ts +++ b/core/autocomplete/util.ts @@ -49,8 +49,9 @@ export class ListenableGenerator { async *tee(): AsyncGenerator { try { - for (const value of this._buffer) { - yield value; + let i = 0; + while (i < this._buffer.length) { + yield this._buffer[i++]; } while (!this._isEnded) { let resolve: (value: any) => void; @@ -58,10 +59,14 @@ export class ListenableGenerator { resolve = res; this._listeners.add(resolve!); }); - const value = await promise; + await promise; this._listeners.delete(resolve!); - yield value; + // Possible timing caused something to slip in between + // timers so we iterate over the buffer + while (i < this._buffer.length) { + yield this._buffer[i++]; + } } } finally { // this._listeners.delete(resolve!); diff --git a/core/commands/slash/edit.ts b/core/commands/slash/edit.ts index 8cb85e442..bb90086b1 100644 --- a/core/commands/slash/edit.ts +++ b/core/commands/slash/edit.ts @@ -4,11 +4,12 @@ import { filterEnglishLinesAtEnd, filterEnglishLinesAtStart, fixCodeLlamaFirstLineIndentation, + stopAtLines, streamWithNewLines, } from "../../autocomplete/lineStream"; import { streamLines } from "../../diff/util"; import { stripImages } from "../../llm/countTokens"; -import { dedentAndGetCommonWhitespace, renderPromptTemplate } from "../../util"; +import { dedentAndGetCommonWhitespace } from "../../util"; import { RangeInFileWithContents, contextItemToRangeInFileWithContents, @@ -446,7 +447,7 @@ const EditSlashCommand: SlashCommand = { const template = llm.promptTemplates?.edit; let generator: AsyncGenerator; if (template) { - let rendered = renderPromptTemplate( + let rendered = llm.renderPromptTemplate( template, // typeof template === 'string' ? template : template.prompt, messages.slice(0, messages.length - 1), @@ -479,6 +480,7 @@ const EditSlashCommand: SlashCommand = { lineStream = filterEnglishLinesAtStart(lineStream); lineStream = filterEnglishLinesAtEnd(filterCodeBlockLines(lineStream)); + lineStream = stopAtLines(lineStream); generator = streamWithNewLines( fixCodeLlamaFirstLineIndentation(lineStream), diff --git a/core/commands/slash/index.ts b/core/commands/slash/index.ts index 0c95060f5..fe51fac2e 100644 --- a/core/commands/slash/index.ts +++ b/core/commands/slash/index.ts @@ -6,6 +6,7 @@ import EditSlashCommand from "./edit"; import HttpSlashCommand from "./http"; import ShareSlashCommand from "./share"; import StackOverflowSlashCommand from "./stackOverflow"; +import ReviewMessageCommand from "./review"; export default [ DraftIssueCommand, @@ -16,4 +17,5 @@ export default [ CommentSlashCommand, HttpSlashCommand, CommitMessageCommand, + ReviewMessageCommand, ]; diff --git a/core/commands/slash/review.ts b/core/commands/slash/review.ts new file mode 100644 index 000000000..87ff75764 --- /dev/null +++ b/core/commands/slash/review.ts @@ -0,0 +1,55 @@ +import { SlashCommand } from "../.."; +import { stripImages } from "../../llm/countTokens"; +import { ChatMessage } from "../.."; + +const prompt = ` + Review the following code, focusing on Readability, Maintainability, Code Smells, Speed, and Memory Performance. Provide feedback with these guidelines: + + Tone: Friendly casual tone of a fellow engineer, ensure the feedback is clear and focused on practical improvements. + Orderly Analysis: Address the code sequentially, from top to bottom, to ensure a thorough review without skipping any parts. + Descriptive Feedback: Avoid referencing line numbers directly, as they may vary. Instead, describe the code sections or specific constructs that need attention, explaining the reasons clearly. + Provide Examples: For each issue identified, offer an example of how the code could be improved or rewritten for better clarity, performance, or maintainability. + Your response should be structured to first identify the issue, then explain why it’s a problem, and finally, offer a solution with example code.`; + + +function getLastUserHistory(history: ChatMessage[]): string { + const lastUserHistory = history + .reverse() + .find((message) => message.role === "user"); + + if (!lastUserHistory) return ""; + + if (lastUserHistory.content instanceof Array) { + return lastUserHistory.content.reduce( + (acc: string, current: { type: string; text?: string }) => { + return current.type === "text" && current.text + ? acc + current.text + : acc; + }, + "" + ); + } + + return typeof lastUserHistory.content === "string" + ? lastUserHistory.content + : ""; +} + +const ReviewMessageCommand: SlashCommand = { + name: "review", + description: "Review code and give feedback", + run: async function* ({ llm, history }) { + + let reviewText = getLastUserHistory(history).replace("\\review", ""); + + const content = `${prompt} \r\n ${reviewText}`; + + for await (const chunk of llm.streamChat([ + { role: "user", content: content }, + ])) { + yield stripImages(chunk.content); + } + }, +}; + +export default ReviewMessageCommand; diff --git a/core/config/default.ts b/core/config/default.ts index da0f9aa91..e27c674ff 100644 --- a/core/config/default.ts +++ b/core/config/default.ts @@ -2,6 +2,11 @@ import { SerializedContinueConfig } from ".."; export const defaultConfig: SerializedContinueConfig = { models: [ + { + title: "Claude 3 Sonnet (Free Trial)", + provider: "free-trial", + model: "claude-3-sonnet-20240229", + }, { title: "GPT-4 Vision (Free Trial)", provider: "free-trial", @@ -17,21 +22,11 @@ export const defaultConfig: SerializedContinueConfig = { provider: "free-trial", model: "gemini-pro", }, - { - title: "Codellama 70b (Free Trial)", - provider: "free-trial", - model: "codellama-70b", - }, { title: "Mixtral (Free Trial)", provider: "free-trial", model: "mistral-8x7b", }, - { - title: "Claude 3 Sonnet (Free Trial)", - provider: "free-trial", - model: "claude-3-sonnet-20240229", - }, ], slashCommands: [ { @@ -70,14 +65,19 @@ export const defaultConfig: SerializedContinueConfig = { { name: "codebase", params: {} }, ], tabAutocompleteModel: { - title: "Starcoder 3b", + title: "Starcoder2 3b", provider: "ollama", - model: "starcoder-3b", + model: "starcoder2:3b", }, }; export const defaultConfigJetBrains: SerializedContinueConfig = { models: [ + { + title: "Claude 3 Sonnet (Free Trial)", + provider: "free-trial", + model: "claude-3-sonnet-20240229", + }, { title: "GPT-4 Vision (Free Trial)", provider: "free-trial", @@ -93,21 +93,11 @@ export const defaultConfigJetBrains: SerializedContinueConfig = { provider: "free-trial", model: "gemini-pro", }, - { - title: "Codellama 70b (Free Trial)", - provider: "free-trial", - model: "codellama-70b", - }, { title: "Mixtral (Free Trial)", provider: "free-trial", model: "mistral-8x7b", }, - { - title: "Claude 3 Sonnet (Free Trial)", - provider: "free-trial", - model: "claude-3-sonnet-20240229", - }, ], slashCommands: [ { @@ -137,7 +127,9 @@ export const defaultConfigJetBrains: SerializedContinueConfig = { params: {}, }, ], - ui: { - codeBlockToolbarPosition: "top", - } + tabAutocompleteModel: { + title: "Starcoder2 3b", + provider: "ollama", + model: "starcoder2:3b", + }, }; diff --git a/core/config/handler.ts b/core/config/handler.ts index 221a3ae37..0b93cbe78 100644 --- a/core/config/handler.ts +++ b/core/config/handler.ts @@ -1,8 +1,3 @@ -import { http, https } from "follow-redirects"; -import * as fs from "fs"; -import { HttpProxyAgent } from "http-proxy-agent"; -import { HttpsProxyAgent } from "https-proxy-agent"; -import fetch from "node-fetch"; import { ContinueConfig, ContinueRcJson, IDE, ILLM } from ".."; import { IdeSettings } from "../protocol"; import { Telemetry } from "../util/posthog"; @@ -11,7 +6,8 @@ import { finalToBrowserConfig, loadFullConfigNode, } from "./load"; -const tls = require("tls"); +import { fetchwithRequestOptions } from "../util/fetchWithOptions"; + export class ConfigHandler { private savedConfig: ContinueConfig | undefined; private savedBrowserConfig?: BrowserSerializedContinueConfig; @@ -20,7 +16,7 @@ export class ConfigHandler { private readonly ide: IDE, private ideSettingsPromise: Promise, private readonly writeLog: (text: string) => void, - private readonly onConfigUpdate: () => void, + private readonly onConfigUpdate: () => void ) { this.ide = ide; this.ideSettingsPromise = ideSettingsPromise; @@ -80,7 +76,7 @@ export class ConfigHandler { this.ide.readFile, workspaceConfigs, remoteConfigServerUrl, - ideInfo.ideType, + ideInfo.ideType ); this.savedConfig.allowAnonymousTelemetry = this.savedConfig.allowAnonymousTelemetry && @@ -90,81 +86,19 @@ export class ConfigHandler { await Telemetry.setup( this.savedConfig.allowAnonymousTelemetry ?? true, await this.ide.getUniqueId(), + ideInfo.extensionVersion ); return this.savedConfig; } setupLlm(llm: ILLM): ILLM { - const TIMEOUT = 7200; // 7200 seconds = 2 hours - // Since we know this is happening in Node.js, we can add requestOptions through a custom agent - const ca = [...tls.rootCertificates]; - const customCerts = - typeof llm.requestOptions?.caBundlePath === "string" - ? [llm.requestOptions?.caBundlePath] - : llm.requestOptions?.caBundlePath; - if (customCerts) { - ca.push( - ...customCerts.map((customCert) => fs.readFileSync(customCert, "utf8")), - ); - } - - let timeout = (llm.requestOptions?.timeout ?? TIMEOUT) * 1000; // measured in ms - - const agentOptions = { - ca, - rejectUnauthorized: llm.requestOptions?.verifySsl, - timeout, - sessionTimeout: timeout, - keepAlive: true, - keepAliveMsecs: timeout, - }; - - const proxy = llm.requestOptions?.proxy; - llm._fetch = async (input, init) => { - // Create agent - const protocol = new URL(input).protocol === "https:" ? https : http; - const agent = proxy - ? new URL(input).protocol === "https:" - ? new HttpsProxyAgent(proxy, agentOptions) - : new HttpProxyAgent(proxy, agentOptions) - : new protocol.Agent(agentOptions); - - const headers: { [key: string]: string } = - llm!.requestOptions?.headers || {}; - for (const [key, value] of Object.entries(init?.headers || {})) { - headers[key] = value as string; - } - - // Replace localhost with 127.0.0.1 - input = new URL(input); - if (input.hostname === "localhost") { - input.hostname = "127.0.0.1"; - } - - let updatedBody: string | undefined = undefined; - try { - if ( - llm.requestOptions?.extraBodyProperties && - typeof init.body === "string" - ) { - const parsedBody = JSON.parse(init.body); - updatedBody = JSON.stringify({ - ...parsedBody, - ...llm.requestOptions.extraBodyProperties, - }); - } - } catch (e) { - console.log("Unable to parse HTTP request body: ", e); - } - - const resp = await fetch(input, { - ...init, - body: updatedBody ?? init.body, - headers, - agent, - }); + const resp = await fetchwithRequestOptions( + new URL(input), + { ...init }, + llm.requestOptions + ); if (!resp.ok) { let text = await resp.text(); @@ -181,7 +115,7 @@ export class ConfigHandler { } } throw new Error( - `HTTP ${resp.status} ${resp.statusText} from ${resp.url}\n\n${text}`, + `HTTP ${resp.status} ${resp.statusText} from ${resp.url}\n\n${text}` ); } diff --git a/core/config/load.ts b/core/config/load.ts index c52ab61cc..af207f711 100644 --- a/core/config/load.ts +++ b/core/config/load.ts @@ -12,6 +12,8 @@ import { IContextProvider, IdeType, ModelDescription, + Reranker, + RerankerDescription, SerializedContinueConfig, SlashCommand, } from ".."; @@ -22,6 +24,8 @@ import { import { contextProviderClassFromName } from "../context/providers"; import CustomContextProviderClass from "../context/providers/CustomContextProvider"; import FileContextProvider from "../context/providers/FileContextProvider"; +import { AllRerankers } from "../context/rerankers"; +import { LLMReranker } from "../context/rerankers/llm"; import { AllEmbeddingsProviders } from "../indexing/embeddings"; import TransformersJsEmbeddingsProvider from "../indexing/embeddings/TransformersJsEmbeddingsProvider"; import { BaseLLM } from "../llm"; @@ -267,6 +271,7 @@ async function intermediateToFinalConfig( } } + // Embeddings Provider if ( (config.embeddingsProvider as EmbeddingsProviderDescription | undefined) ?.provider @@ -280,12 +285,30 @@ async function intermediateToFinalConfig( config.embeddingsProvider = new TransformersJsEmbeddingsProvider(); } + // Reranker + if (config.reranker && !(config.reranker as Reranker | undefined)?.rerank) { + const { name, params } = config.reranker as RerankerDescription; + const rerankerClass = AllRerankers[name]; + + if (name === "llm") { + const llm = models.find((model) => model.title === params?.modelTitle); + if (!llm) { + console.warn(`Unknown model ${params?.modelTitle}`); + } else { + config.reranker = new LLMReranker(llm); + } + } else if (rerankerClass) { + config.reranker = new rerankerClass(params); + } + } + return { ...config, contextProviders, models, embeddingsProvider: config.embeddingsProvider as any, tabAutocompleteModel: autocompleteLlm, + reranker: config.reranker as any, }; } diff --git a/core/config/onboarding.ts b/core/config/onboarding.ts new file mode 100644 index 000000000..bc6261404 --- /dev/null +++ b/core/config/onboarding.ts @@ -0,0 +1,90 @@ +import { SerializedContinueConfig } from ".."; + +export function setupOptimizedMode( + config: SerializedContinueConfig, +): SerializedContinueConfig { + return { + ...config, + models: [ + { + title: "Claude 3 Sonnet (Free Trial)", + provider: "free-trial", + model: "claude-3-sonnet-20240229", + }, + { + title: "GPT-4 Vision (Free Trial)", + provider: "free-trial", + model: "gpt-4-vision-preview", + }, + { + title: "GPT-3.5-Turbo (Free Trial)", + provider: "free-trial", + model: "gpt-3.5-turbo", + }, + { + title: "Gemini Pro (Free Trial)", + provider: "free-trial", + model: "gemini-pro", + }, + { + title: "Mixtral (Free Trial)", + provider: "free-trial", + model: "mistral-8x7b", + }, + ], + tabAutocompleteModel: { + title: "Tab Autocomplete", + provider: "free-trial", + model: "starcoder-7b", + }, + embeddingsProvider: { + provider: "free-trial", + }, + reranker: { + name: "free-trial", + }, + }; +} + +export function setupOptimizedExistingUserMode( + config: SerializedContinueConfig, +): SerializedContinueConfig { + return { + ...config, + tabAutocompleteModel: { + title: "Tab Autocomplete", + provider: "free-trial", + model: "starcoder-7b", + }, + embeddingsProvider: { + provider: "free-trial", + }, + reranker: { + name: "free-trial", + }, + }; +} + +export function setupLocalMode( + config: SerializedContinueConfig, +): SerializedContinueConfig { + return { + ...config, + models: [ + { + title: "Ollama", + provider: "ollama", + model: "AUTODETECT", + }, + ], + tabAutocompleteModel: { + title: "Starcoder 3b", + provider: "ollama", + model: "starcoder2:3b", + }, + embeddingsProvider: { + provider: "transformers.js", + }, + reranker: undefined, + }; +} diff --git a/core/config/types.ts b/core/config/types.ts index 976dc3f89..e69a11716 100644 --- a/core/config/types.ts +++ b/core/config/types.ts @@ -408,7 +408,6 @@ declare global { | "open" | "google" | "search" - | "url" | "tree" | "http" | "codebase" @@ -486,6 +485,7 @@ declare global { | "chat-bison-001" // Gemini | "gemini-pro" + | "gemini-1.5-pro-latest" // Mistral | "mistral-tiny" | "mistral-small" diff --git a/core/context/providers/CodebaseContextProvider.ts b/core/context/providers/CodebaseContextProvider.ts index 67d695508..9a46807e8 100644 --- a/core/context/providers/CodebaseContextProvider.ts +++ b/core/context/providers/CodebaseContextProvider.ts @@ -4,7 +4,7 @@ import { ContextProviderDescription, ContextProviderExtras, } from "../.."; -import { retrieveContextItemsFromEmbeddings } from "../retrieval"; +import { retrieveContextItemsFromEmbeddings } from "../retrieval/retrieval"; class CodebaseContextProvider extends BaseContextProvider { static description: ContextProviderDescription = { diff --git a/core/context/providers/FolderContextProvider.ts b/core/context/providers/FolderContextProvider.ts index 44b7e4f6b..13b942094 100644 --- a/core/context/providers/FolderContextProvider.ts +++ b/core/context/providers/FolderContextProvider.ts @@ -20,7 +20,9 @@ class FolderContextProvider extends BaseContextProvider { query: string, extras: ContextProviderExtras, ): Promise { - const { retrieveContextItemsFromEmbeddings } = await import("../retrieval"); + const { retrieveContextItemsFromEmbeddings } = await import( + "../retrieval/retrieval" + ); return retrieveContextItemsFromEmbeddings(extras, this.options, query); } async loadSubmenuItems( diff --git a/core/context/providers/JiraIssuesContextProvider/JiraClient.ts b/core/context/providers/JiraIssuesContextProvider/JiraClient.ts index b1915d767..573c5549f 100644 --- a/core/context/providers/JiraIssuesContextProvider/JiraClient.ts +++ b/core/context/providers/JiraIssuesContextProvider/JiraClient.ts @@ -1,5 +1,5 @@ - -import type { AxiosInstance } from "axios"; +import { RequestOptions } from "../../.."; +import { fetchwithRequestOptions } from "../../../util/fetchWithOptions"; const { convert: adf2md } = require("adf-to-md"); interface JiraClientOptions { @@ -8,6 +8,7 @@ interface JiraClientOptions { password: string; issueQuery?: string; apiVersion?: string; + requestOptions?: RequestOptions; } interface JiraComment { @@ -63,95 +64,110 @@ export interface Issue { export class JiraClient { private readonly options: Required; - private _api: AxiosInstance | null = null; + private baseUrl: string; + private authHeader; constructor(options: JiraClientOptions) { this.options = { issueQuery: `assignee = currentUser() AND resolution = Unresolved order by updated DESC`, - apiVersion: '3', - ...options + apiVersion: "3", + requestOptions: {}, + ...options, }; - } - - private async getApi() { - if (!this._api) { - - const { default: Axios } = await import("axios"); - - this._api = Axios.create({ - baseURL: `https://${this.options.domain}/rest/api/${this.options.apiVersion}/`, - ...(this.options.username - ? { - auth: { - username: this.options.username, - password: this.options.password, - }, - } - : { - headers: { - Authorization: `Bearer ${this.options.password}`, - }, - }), - }); - } - - return this._api; + this.baseUrl = `https://${this.options.domain}/rest/api/${this.options.apiVersion}`; + this.authHeader = this.options.username + ? { + Authorization: + "Basic " + + btoa(this.options.username + ":" + this.options.password), + } + : { + Authorization: `Bearer ${this.options.password}`, + }; } async issue(issueId: string): Promise { - const api = await this.getApi(); const result = {} as Issue; - const issue = await api - .get(`/issue/${issueId}`, { - params: { - fields: "description,comment,summary", + const response = await fetchwithRequestOptions( + new URL( + this.baseUrl + `/issue/${issueId}?fields=description,comment,summary` + ), + { + method: "GET", + headers: { + "Content-Type": "application/json", + ...this.authHeader, }, - }) - .then((result) => result.data); - + }, + this.options.requestOptions + ); + + const issue = (await response.json()) as any; + result.key = issue.key; result.summary = issue.fields.summary; - - if (typeof issue.fields.description === 'string') { + if (typeof issue.fields.description === "string") { result.description = issue.fields.description; - } else if(issue.fields.description) { + } else if (issue.fields.description) { result.description = adf2md(issue.fields.description).result; } else { result.description = ""; } - result.comments = issue.fields.comment?.comments?.map((comment) => { - const body = typeof comment.body === 'string' ? comment.body : adf2md(comment.body).result; - - return { - body, - author: comment.author, - created: comment.created, - updated: comment.updated, - }; - }) ?? []; + result.comments = + issue.fields.comment?.comments?.map((comment: any) => { + const body = + typeof comment.body === "string" + ? comment.body + : adf2md(comment.body).result; + return { + body, + author: comment.author, + created: comment.created, + updated: comment.updated, + }; + }) ?? []; return result; } async listIssues(): Promise> { - const api = await this.getApi(); - - const results = await api.get("/search", { - params: { - jql: - this.options.issueQuery ?? - `assignee = currentUser() AND resolution = Unresolved order by updated DESC`, - fields: "summary", + const response = await fetchwithRequestOptions( + new URL( + this.baseUrl + + `/search?fields=summary&jql=${ + this.options.issueQuery ?? + `assignee = currentUser() AND resolution = Unresolved order by updated DESC` + }` + ), + { + method: "GET", + headers: { + "Content-Type": "application/json", + ...this.authHeader, + }, }, - }); + this.options.requestOptions + ); - return results.data?.issues?.map((issue) => ({ - id: issue.id, - key: issue.key, - summary: issue.fields.summary, - })) ?? []; + if (response.status != 200) { + console.warn( + "Unable to get jira tickets. Response code from API is", + response.status + ); + return Promise.resolve([]); + } + + const data = (await response.json()) as any; + + return ( + data.issues?.map((issue: any) => ({ + id: issue.id, + key: issue.key, + summary: issue.fields.summary, + })) ?? [] + ); } } diff --git a/core/context/providers/JiraIssuesContextProvider/index.ts b/core/context/providers/JiraIssuesContextProvider/index.ts index be35b22ee..4ee7a4b6a 100644 --- a/core/context/providers/JiraIssuesContextProvider/index.ts +++ b/core/context/providers/JiraIssuesContextProvider/index.ts @@ -23,6 +23,7 @@ class JiraIssuesContextProvider extends BaseContextProvider { password: this.options.token, issueQuery: this.options.issueQuery, apiVersion: this.options.apiVersion, + requestOptions: this.options.requestOptions, }); } diff --git a/core/context/providers/URLContextProvider.ts b/core/context/providers/URLContextProvider.ts deleted file mode 100644 index a26fdf7dc..000000000 --- a/core/context/providers/URLContextProvider.ts +++ /dev/null @@ -1,43 +0,0 @@ -import { BaseContextProvider } from ".."; -import { - ContextItem, - ContextProviderDescription, - ContextProviderExtras, -} from "../.."; - -class URLContextProvider extends BaseContextProvider { - static description: ContextProviderDescription = { - title: "url", - displayTitle: "URL", - description: "Attach the contents of a web page", - type: "query", - }; - - async getContextItems( - query: string, - extras: ContextProviderExtras, - ): Promise { - let url = query.trim(); - if (!url.startsWith("http")) { - url = "https://" + url; - } - - const response = await fetch(url); - const html = await response.text(); - const content = html; - const title = url - .replace("https://", "") - .replace("http://", "") - .replace("www.", ""); - - return [ - { - content, - name: title, - description: title, - }, - ]; - } -} - -export default URLContextProvider; diff --git a/core/context/providers/index.ts b/core/context/providers/index.ts index 4fd950b26..15f444648 100644 --- a/core/context/providers/index.ts +++ b/core/context/providers/index.ts @@ -8,18 +8,17 @@ 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 HttpContextProvider from "./HttpContextProvider"; import JiraIssuesContextProvider from "./JiraIssuesContextProvider"; +import LocalsProvider from "./LocalsProvider"; +import OSContextProvider from "./OSContextProvider"; import OpenFilesContextProvider from "./OpenFilesContextProvider"; import PostgresContextProvider from "./PostgresContextProvider"; import ProblemsContextProvider from "./ProblemsContextProvider"; import SearchContextProvider from "./SearchContextProvider"; -import OSContextProvider from "./OSContextProvider"; import TerminalContextProvider from "./TerminalContextProvider"; -import LocalsProvider from "./LocalsProvider"; -import URLContextProvider from "./URLContextProvider"; -import GitLabMergeRequestContextProvider from "./GitLabMergeRequestContextProvider"; const Providers: (typeof BaseContextProvider)[] = [ DiffContextProvider, @@ -28,7 +27,6 @@ const Providers: (typeof BaseContextProvider)[] = [ GoogleContextProvider, TerminalContextProvider, LocalsProvider, - URLContextProvider, OpenFilesContextProvider, HttpContextProvider, SearchContextProvider, diff --git a/core/context/rerankers/freeTrial.ts b/core/context/rerankers/freeTrial.ts new file mode 100644 index 000000000..4e6200822 --- /dev/null +++ b/core/context/rerankers/freeTrial.ts @@ -0,0 +1,30 @@ +import fetch from "node-fetch"; +import { Chunk, Reranker } from "../.."; +import { getHeaders } from "../../continueServer/stubs/headers"; +import { SERVER_URL } from "../../util/parameters"; + +export class FreeTrialReranker implements Reranker { + name = "free-trial"; + + async rerank(query: string, chunks: Chunk[]): Promise { + const resp = await fetch(new URL("rerank", SERVER_URL), { + method: "POST", + headers: { + "Content-Type": "application/json", + ...getHeaders(), + }, + body: JSON.stringify({ + query, + documents: chunks.map((chunk) => chunk.content), + }), + }); + + if (!resp.ok) { + throw new Error(await resp.text()); + } + + const data = (await resp.json()) as any; + const results = data.sort((a: any, b: any) => a.index - b.index); + return results.map((result: any) => result.relevance_score); + } +} diff --git a/core/context/rerankers/index.ts b/core/context/rerankers/index.ts new file mode 100644 index 000000000..f7aa7ee25 --- /dev/null +++ b/core/context/rerankers/index.ts @@ -0,0 +1,10 @@ +import { RerankerName } from "../.."; +import { FreeTrialReranker } from "./freeTrial"; +import { LLMReranker } from "./llm"; +import { VoyageReranker } from "./voyage"; + +export const AllRerankers: { [key in RerankerName]: any } = { + llm: LLMReranker, + voyage: VoyageReranker, + "free-trial": FreeTrialReranker, +}; diff --git a/core/context/rerankers/llm.ts b/core/context/rerankers/llm.ts new file mode 100644 index 000000000..f108d5a62 --- /dev/null +++ b/core/context/rerankers/llm.ts @@ -0,0 +1,91 @@ +import { Chunk, ILLM, Reranker } from "../.."; +import { getBasename } from "../../util"; + +const RERANK_PROMPT = ( + query: string, + documentId: string, + document: string, +) => `You are an expert software developer responsible for helping detect whether the retrieved snippet of code is relevant to the query. For a given input, you need to output a single word: "Yes" or "No" indicating the retrieved snippet is relevant to the query. + + Query: Where is the FastAPI server? + Snippet: + \`\`\`/Users/andrew/Desktop/server/main.py + from fastapi import FastAPI + app = FastAPI() + @app.get("/") + def read_root(): + return {{"Hello": "World"}} + \`\`\` + Relevant: Yes + + Query: Where in the documentation does it talk about the UI? + Snippet: + \`\`\`/Users/andrew/Projects/bubble_sort/src/lib.rs + fn bubble_sort(arr: &mut [T]) {{ + for i in 0..arr.len() {{ + for j in 1..arr.len() - i {{ + if arr[j - 1] > arr[j] {{ + arr.swap(j - 1, j); + }} + }} + }} + }} + \`\`\` + Relevant: No + + Query: ${query} + Snippet: + \`\`\`${documentId} + ${document} + \`\`\` + Relevant: + `; + +export class LLMReranker implements Reranker { + name = "llmReranker"; + + constructor(private readonly llm: ILLM) {} + + async scoreChunk(chunk: Chunk, query: string): Promise { + const completion = await this.llm.complete( + RERANK_PROMPT(query, getBasename(chunk.filepath), chunk.content), + { + maxTokens: 1, + model: + this.llm.providerName.startsWith("openai") && + this.llm.model.startsWith("gpt-4") + ? "gpt-3.5-turbo" + : this.llm.model, + }, + ); + + if (!completion) { + // TODO: Why is this happening? + return 0.0; + } + + let answer = completion + .trim() + .toLowerCase() + .replace(/"/g, "") + .replace(/'/g, ""); + + if (answer === "yes") { + return 1.0; + } else if (answer === "no") { + return 0.0; + } else { + console.warn( + `Unexpected response from single token reranker: "${answer}". Expected "yes" or "no".`, + ); + return 0.0; + } + } + + async rerank(query: string, chunks: Chunk[]): Promise { + const scores = await Promise.all( + chunks.map((chunk) => this.scoreChunk(chunk, query)), + ); + return scores; + } +} diff --git a/core/context/rerankers/voyage.ts b/core/context/rerankers/voyage.ts new file mode 100644 index 000000000..cf82eb5e2 --- /dev/null +++ b/core/context/rerankers/voyage.ts @@ -0,0 +1,30 @@ +import { Chunk, Reranker } from "../.."; + +export class VoyageReranker implements Reranker { + name = "voyage"; + + constructor( + private readonly params: { + apiKey: string; + model?: string; + }, + ) {} + + async rerank(query: string, chunks: Chunk[]): Promise { + const resp = await fetch("https://api.voyageai.com/v1/rerank", { + method: "POST", + headers: { + "Content-Type": "application/json", + Authorization: `Bearer ${this.params.apiKey}`, + }, + body: JSON.stringify({ + query, + documents: chunks.map((chunk) => chunk.content), + model: this.params.model ?? "rerank-lite-1", + }), + }); + const data = await resp.json(); + const results = data.data.sort((a: any, b: any) => a.index - b.index); + return results.map((result: any) => result.relevance_score); + } +} diff --git a/core/context/retrieval.ts b/core/context/retrieval.ts deleted file mode 100644 index 6dc1a8071..000000000 --- a/core/context/retrieval.ts +++ /dev/null @@ -1,216 +0,0 @@ -import { Chunk, ContextItem, ContextProviderExtras, ILLM, IndexTag } from ".."; -import { FullTextSearchCodebaseIndex } from "../indexing/FullTextSearch"; -import { LanceDbIndex } from "../indexing/LanceDbIndex"; - -import { llmCanGenerateInParallel } from "../llm/autodetect"; -import { getBasename } from "../util"; - -const RERANK_PROMPT = ( - query: string, - documentId: string, - document: string, -) => `You are an expert software developer responsible for helping detect whether the retrieved snippet of code is relevant to the query. For a given input, you need to output a single word: "Yes" or "No" indicating the retrieved snippet is relevant to the query. - -Query: Where is the FastAPI server? -Snippet: -\`\`\`/Users/andrew/Desktop/server/main.py -from fastapi import FastAPI -app = FastAPI() -@app.get("/") -def read_root(): - return {{"Hello": "World"}} -\`\`\` -Relevant: Yes - -Query: Where in the documentation does it talk about the UI? -Snippet: -\`\`\`/Users/andrew/Projects/bubble_sort/src/lib.rs -fn bubble_sort(arr: &mut [T]) {{ - for i in 0..arr.len() {{ - for j in 1..arr.len() - i {{ - if arr[j - 1] > arr[j] {{ - arr.swap(j - 1, j); - }} - }} - }} -}} -\`\`\` -Relevant: No - -Query: ${query} -Snippet: -\`\`\`${documentId} -${document} -\`\`\` -Relevant: -`; - -async function scoreChunk( - chunk: Chunk, - llm: ILLM, - query: string, -): Promise { - const completion = await llm.complete( - RERANK_PROMPT(query, getBasename(chunk.filepath), chunk.content), - { - maxTokens: 1, - model: - llm.providerName.startsWith("openai") && llm.model.startsWith("gpt-4") - ? "gpt-3.5-turbo" - : llm.model, - }, - ); - - if (!completion) { - // TODO: Why is this happening? - return 0.0; - } - - let answer = completion - .trim() - .toLowerCase() - .replace(/"/g, "") - .replace(/'/g, ""); - - if (answer === "yes") { - return 1.0; - } else if (answer === "no") { - return 0.0; - } else { - console.warn( - `Unexpected response from single token reranker: "${answer}". Expected "yes" or "no".`, - ); - return 0.0; - } -} - -async function rerank( - chunks: Chunk[], - llm: ILLM, - query: string, - nFinal: number, -): Promise { - const scores = await Promise.all( - chunks.map((chunk) => scoreChunk(chunk, llm, query)), - ); - const sorted = chunks - .map((chunk, i) => ({ chunk, score: scores[i] })) - .sort((a, b) => b.score - a.score); - - return sorted.map((s) => s.chunk).slice(0, nFinal); -} - -export async function retrieveContextItemsFromEmbeddings( - extras: ContextProviderExtras, - options: any | undefined, - filterDirectory: string | undefined, -): Promise { - if (!extras.embeddingsProvider) { - return []; - } - - const nFinal = options?.nFinal || 10; - const useReranking = - llmCanGenerateInParallel(extras.llm.providerName, extras.llm.model) && - (options?.useReranking === undefined ? false : options?.useReranking); - const nRetrieve = useReranking === false ? nFinal : options?.nRetrieve || 20; - - const ftsIndex = new FullTextSearchCodebaseIndex(); - const workspaceDirs = await extras.ide.getWorkspaceDirs(); - - if (workspaceDirs.length === 0) { - throw new Error("No workspace directories found"); - } - - const branches = (await Promise.race([ - Promise.all(workspaceDirs.map((dir) => extras.ide.getBranch(dir))), - new Promise((resolve) => { - setTimeout(() => { - resolve(["NONE"]); - }, 500); - }), - ])) as string[]; - const tags: (artifactId: string) => IndexTag[] = (artifactId: string) => - workspaceDirs.map((directory, i) => ({ - directory, - branch: branches[i], - artifactId, - })); - - let ftsResults: Chunk[] = []; - - try { - if (extras.fullInput.trim() !== "") { - ftsResults = await ftsIndex.retrieve( - tags(ftsIndex.artifactId), - extras.fullInput - .trim() - .split(" ") - .map((element) => `"${element}"`) - .join(" OR "), - nRetrieve / 2, - filterDirectory, - undefined, - ); - } - } catch (e) { - console.warn("Error retrieving from FTS:", e); - } - - const lanceDbIndex = new LanceDbIndex(extras.embeddingsProvider, (path) => - extras.ide.readFile(path), - ); - let vecResults = await lanceDbIndex.retrieve( - tags(lanceDbIndex.artifactId), - extras.fullInput, - nRetrieve, - filterDirectory, - ); - - // Now combine these (de-duplicate) and re-rank - let results = [...ftsResults]; - for (const vecResult of vecResults) { - if (results.length >= nRetrieve) { - break; - } - if ( - !ftsResults.find( - (r) => - r.filepath === vecResult.filepath && - r.startLine === vecResult.startLine && - r.endLine === vecResult.endLine, - ) - ) { - results.push(vecResult); - } - } - - // Re-ranking - if (useReranking) { - results = await rerank(results, extras.llm, extras.fullInput, nFinal); - } - - if (results.length === 0) { - throw new Error( - "Warning: No results found for @codebase context provider.", - ); - } - - return [ - ...results.map((r) => { - const name = `${getBasename(r.filepath)} (${r.startLine}-${r.endLine})`; - const description = `${r.filepath} (${r.startLine}-${r.endLine})`; - return { - name, - description, - content: `\`\`\`${name}\n${r.content}\n\`\`\``, - }; - }), - { - name: "Instructions", - description: "Instructions", - content: - "Use the above code to answer the following question. You should not reference any files outside of what is shown, unless they are commonly known files, like a .gitignore or package.json. Reference the filenames whenever possible. If there isn't enough information to answer the question, suggest where the user might look to learn more.", - }, - ]; -} diff --git a/core/context/retrieval/fullTextSearch.ts b/core/context/retrieval/fullTextSearch.ts new file mode 100644 index 000000000..34ec2e0a0 --- /dev/null +++ b/core/context/retrieval/fullTextSearch.ts @@ -0,0 +1,31 @@ +import { BranchAndDir, Chunk } from "../.."; +import { FullTextSearchCodebaseIndex } from "../../indexing/FullTextSearch"; +export async function retrieveFts( + query: string, + n: number, + tags: BranchAndDir[], + filterDirectory: string | undefined, +): Promise { + const ftsIndex = new FullTextSearchCodebaseIndex(); + + let ftsResults: Chunk[] = []; + try { + if (query.trim() !== "") { + ftsResults = await ftsIndex.retrieve( + tags, + query + .trim() + .split(" ") + .map((element) => `"${element}"`) + .join(" OR "), + n, + filterDirectory, + undefined, + ); + } + return ftsResults; + } catch (e) { + console.warn("Error retrieving from FTS:", e); + return []; + } +} diff --git a/core/context/retrieval/retrieval.ts b/core/context/retrieval/retrieval.ts new file mode 100644 index 000000000..63ed4a70d --- /dev/null +++ b/core/context/retrieval/retrieval.ts @@ -0,0 +1,150 @@ +import { BranchAndDir, Chunk, ContextItem, ContextProviderExtras } from "../.."; +import { LanceDbIndex } from "../../indexing/LanceDbIndex"; + +import { deduplicateArray, getBasename } from "../../util"; +import { RETRIEVAL_PARAMS } from "../../util/parameters"; +import { retrieveFts } from "./fullTextSearch"; + +function deduplicateChunks(chunks: Chunk[]): Chunk[] { + return deduplicateArray(chunks, (a, b) => { + return ( + a.filepath === b.filepath && + a.startLine === b.startLine && + a.endLine === b.endLine + ); + }); +} + +export async function retrieveContextItemsFromEmbeddings( + extras: ContextProviderExtras, + options: any | undefined, + filterDirectory: string | undefined, +): Promise { + if (!extras.embeddingsProvider) { + return []; + } + + const nFinal = options?.nFinal || RETRIEVAL_PARAMS.nFinal; + const useReranking = extras.reranker !== undefined; + const nRetrieve = + useReranking === false + ? nFinal + : options?.nRetrieve || RETRIEVAL_PARAMS.nRetrieve; + + // Get tags to retrieve for + const workspaceDirs = await extras.ide.getWorkspaceDirs(); + + if (workspaceDirs.length === 0) { + throw new Error("No workspace directories found"); + } + + const branches = (await Promise.race([ + Promise.all(workspaceDirs.map((dir) => extras.ide.getBranch(dir))), + new Promise((resolve) => { + setTimeout(() => { + resolve(["NONE"]); + }, 500); + }), + ])) as string[]; + const tags: BranchAndDir[] = workspaceDirs.map((directory, i) => ({ + directory, + branch: branches[i], + })); + + // Get all retrieval results + const retrievalResults: Chunk[] = []; + + // Source: Full-text search + let ftsResults = await retrieveFts( + extras.fullInput, + nRetrieve / 2, + tags, + filterDirectory, + ); + retrievalResults.push(...ftsResults); + + // Source: expansion with code graph + // consider doing this after reranking? Or just having a lower reranking threshold + // This is VS Code only until we use PSI for JetBrains or build our own general solution + if ((await extras.ide.getIdeInfo()).ideType === "vscode") { + const { expandSnippet } = await import( + "../../../extensions/vscode/src/util/expandSnippet" + ); + let expansionResults = ( + await Promise.all( + extras.selectedCode.map(async (rif) => { + return expandSnippet( + rif.filepath, + rif.range.start.line, + rif.range.end.line, + extras.ide, + ); + }), + ) + ).flat() as Chunk[]; + retrievalResults.push(...expansionResults); + } + + // Source: Open file exact match + // Source: Class/function name exact match + + // Source: Embeddings + const lanceDbIndex = new LanceDbIndex(extras.embeddingsProvider, (path) => + extras.ide.readFile(path), + ); + let vecResults = await lanceDbIndex.retrieve( + extras.fullInput, + nRetrieve, + tags, + filterDirectory, + ); + retrievalResults.push(...vecResults); + + // De-duplicate + let results: Chunk[] = deduplicateChunks(retrievalResults); + + // Re-rank + if (useReranking && extras.reranker) { + let scores: number[] = await extras.reranker.rerank( + extras.fullInput, + results, + ); + + // Filter out low-scoring results + results = results.filter( + (_, i) => scores[i] >= RETRIEVAL_PARAMS.rerankThreshold, + ); + scores = scores.filter( + (score) => score >= RETRIEVAL_PARAMS.rerankThreshold, + ); + + results.sort( + (a, b) => scores[results.indexOf(b)] - scores[results.indexOf(a)], + ); + results = results.slice(0, nFinal); + } + + if (results.length === 0) { + throw new Error( + "Warning: No results found for @codebase context provider.", + ); + } + + return [ + ...results.map((r) => { + const name = `${getBasename(r.filepath)} (${r.startLine}-${r.endLine})`; + const description = `${r.filepath} (${r.startLine}-${r.endLine})`; + return { + name, + description, + content: `\`\`\`${name}\n${r.content}\n\`\`\``, + }; + }), + { + name: "Instructions", + description: "Instructions", + content: + "Use the above code to answer the following question. You should not reference any files outside of what is shown, unless they are commonly known files, like a .gitignore or package.json. Reference the filenames whenever possible. If there isn't enough information to answer the question, suggest where the user might look to learn more.", + }, + ]; +} diff --git a/core/continueServer/interface.ts b/core/continueServer/interface.ts new file mode 100644 index 000000000..a306b03ae --- /dev/null +++ b/core/continueServer/interface.ts @@ -0,0 +1,28 @@ +import { Chunk } from ".."; + +export interface EmbeddingsCacheChunk { + vector: number[]; + startLine: number; + endLine: number; + contents: string; +} + +interface ArtifactReturnTypes { + chunks: Chunk[]; + embeddings: EmbeddingsCacheChunk[]; +} + +export type ArtifactType = keyof ArtifactReturnTypes; + +export interface EmbeddingsCacheResponse { + files: { [cacheKey: string]: ArtifactReturnTypes[T] }; +} + +export interface IContinueServerClient { + getConfig(): Promise<{ configJson: string; configJs: string }>; + getFromIndexCache( + keys: string[], + artifactId: T, + repoName: string | undefined, + ): Promise>; +} diff --git a/core/continueServer/stubs/client.ts b/core/continueServer/stubs/client.ts new file mode 100644 index 000000000..cfdde054c --- /dev/null +++ b/core/continueServer/stubs/client.ts @@ -0,0 +1,24 @@ +import { + ArtifactType, + EmbeddingsCacheResponse, + IContinueServerClient, +} from "../interface"; + +export class ContinueServerClient implements IContinueServerClient { + constructor( + private readonly serverUrl: string, + private readonly userToken: Promise, + ) {} + + public async getConfig(): Promise<{ configJson: string; configJs: string }> { + throw new Error("Not Implemented"); + } + + public async getFromIndexCache( + keys: string[], + artifactId: T, + repoName: string | undefined, + ): Promise> { + return { files: {} }; + } +} diff --git a/core/continueServer/stubs/headers.ts b/core/continueServer/stubs/headers.ts new file mode 100644 index 000000000..f7bd60391 --- /dev/null +++ b/core/continueServer/stubs/headers.ts @@ -0,0 +1,3 @@ +export function getHeaders() { + return {}; +} diff --git a/core/diff/streamDiff.ts b/core/diff/streamDiff.ts index a86bda9b3..f30e76e07 100644 --- a/core/diff/streamDiff.ts +++ b/core/diff/streamDiff.ts @@ -14,6 +14,8 @@ export async function* streamDiff( newLines: LineStream, ): AsyncGenerator { const mutatedOldLines = [...oldLines]; // be careful + + // If one indentation mistake is made, others are likely. So we are more permissive about matching let seenIndentationMistake = false; let newLineResult = await newLines.next(); diff --git a/core/diff/util.ts b/core/diff/util.ts index 2558a1f62..ade376291 100644 --- a/core/diff/util.ts +++ b/core/diff/util.ts @@ -8,16 +8,23 @@ function linesMatchPerfectly(lineA: string, lineB: string): boolean { return lineA === lineB && lineA !== ""; } -function linesMatch(lineA: string, lineB: string): boolean { +const END_BRACKETS = ["}", "});", "})"]; + +function linesMatch( + lineA: string, + lineB: string, + linesBetween: number = 0, +): boolean { // Require a perfect (without padding) match for these lines // Otherwise they are edit distance 1 from empty lines and other single char lines (e.g. each other) - if (["}", "*"].includes(lineA.trim())) { + if (["}", "*", "});", "})"].includes(lineA.trim())) { return lineA.trim() === lineB.trim(); } const d = distance(lineA, lineB); return ( - (d / Math.max(lineA.length, lineB.length) < 0.5 || + // Should be more unlikely for lines to fuzzy match if they are further away + (d / Math.max(lineA.length, lineB.length) < 0.5 - linesBetween * 0.05 || lineA.trim() === lineB.trim()) && lineA.trim() !== "" ); @@ -37,10 +44,16 @@ export function matchLine( return [0, true, newLine.trim()]; } + const isEndBracket = END_BRACKETS.includes(newLine.trim()); for (let i = 0; i < oldLines.length; i++) { + // Don't match end bracket lines if too far away + if (i > 4 && isEndBracket) { + return [-1, false, newLine]; + } + if (linesMatchPerfectly(newLine, oldLines[i])) { return [i, true, newLine]; - } else if (linesMatch(newLine, oldLines[i])) { + } else if (linesMatch(newLine, oldLines[i], i)) { // This is a way to fix indentation, but only for sufficiently long lines to avoid matching whitespace or short lines if ( newLine.trimStart() === oldLines[i].trimStart() && diff --git a/core/index.d.ts b/core/index.d.ts index f1c2ab35a..04aa4a326 100644 --- a/core/index.d.ts +++ b/core/index.d.ts @@ -43,6 +43,14 @@ export interface LLMReturnValue { prompt: string; completion: string; } + +export type PromptTemplate = + | string + | (( + history: ChatMessage[], + otherData: Record, + ) => string | ChatMessage[]); + export interface ILLM extends LLMOptions { get providerName(): ModelProvider; @@ -90,7 +98,18 @@ export interface ILLM extends LLMOptions { supportsImages(): boolean; + supportsCompletions(): boolean; + + supportsPrefill(): boolean; + listModels(): Promise; + + renderPromptTemplate( + template: PromptTemplate, + history: ChatMessage[], + otherData: Record, + canPutWordsInModelsMouth?: boolean, + ): string | ChatMessage[]; } export type ContextProviderType = "normal" | "query" | "submenu"; @@ -106,6 +125,7 @@ export interface ContextProviderDescription { export interface ContextProviderExtras { fullInput: string; embeddingsProvider: EmbeddingsProvider; + reranker: Reranker | undefined; llm: ILLM; ide: IDE; selectedCode: RangeInFile[]; @@ -231,9 +251,14 @@ export interface ContextItemWithId { editable?: boolean; } +export interface InputModifiers { + useCodebase: boolean; +} + export interface ChatHistoryItem { message: ChatMessage; editorState?: any; + modifiers?: InputModifiers; contextItems: ContextItemWithId[]; promptLogs?: [string, string][]; // [prompt, completion] } @@ -243,7 +268,6 @@ export type ChatHistory = ChatHistoryItem[]; // LLM export interface LLMFullCompletionOptions extends BaseCompletionOptions { - raw?: boolean; log?: boolean; model?: string; @@ -265,6 +289,8 @@ export interface LLMOptions { apiKey?: string; apiBase?: string; + useLegacyCompletionsEndpoint?: boolean; + // Azure options engine?: string; apiVersion?: string; @@ -331,11 +357,15 @@ export interface IdeInfo { name: string; version: string; remoteName: string; + extensionVersion: string; } -export interface IndexTag { - directory: string; +export interface BranchAndDir { branch: string; + directory: string; +} + +export interface IndexTag extends BranchAndDir { artifactId: string; } @@ -381,6 +411,7 @@ export interface IDE { getBranch(dir: string): Promise; getStats(directory: string): Promise<{ [path: string]: number }>; getTags(artifactId: string): Promise; + getRepoName(dir: string): Promise; } // Slash Commands @@ -430,7 +461,6 @@ type ContextProviderName = | "open" | "google" | "search" - | "url" | "tree" | "http" | "codebase" @@ -479,7 +509,8 @@ type ModelProvider = | "mistral" | "bedrock" | "deepinfra" - | "flowise"; + | "flowise" + | "groq"; export type ModelName = | "AUTODETECT" @@ -496,6 +527,7 @@ export type ModelName = | "mistral-8x7b" | "llama2-7b" | "llama2-13b" + | "llama2-70b" | "codellama-7b" | "codellama-13b" | "codellama-34b" @@ -520,6 +552,7 @@ export type ModelName = | "chat-bison-001" // Gemini | "gemini-pro" + | "gemini-1.5-pro-latest" // Mistral | "mistral-tiny" | "mistral-small" @@ -528,6 +561,7 @@ export type ModelName = | "deepseek-1b" | "starcoder-1b" | "starcoder-3b" + | "starcoder2-3b" | "stable-code-3b"; export interface RequestOptions { @@ -573,6 +607,8 @@ interface BaseCompletionOptions { maxTokens?: number; numThreads?: number; keepAlive?: number; + raw?: boolean; + stream?: boolean; } export interface ModelDescription { @@ -589,7 +625,11 @@ export interface ModelDescription { promptTemplates?: { [key: string]: string }; } -export type EmbeddingsProviderName = "transformers.js" | "ollama" | "openai"; +export type EmbeddingsProviderName = + | "transformers.js" + | "ollama" + | "openai" + | "free-trial"; export interface EmbedOptions { apiBase?: string; @@ -606,7 +646,20 @@ export interface EmbeddingsProvider { embed(chunks: string[]): Promise; } +export type RerankerName = "voyage" | "llm" | "free-trial"; + +export interface RerankerDescription { + name: RerankerName; + params?: { [key: string]: any }; +} + +export interface Reranker { + name: string; + rerank(query: string, chunks: Chunk[]): Promise; +} + export interface TabAutocompleteOptions { + disable: boolean; useCopyBuffer: boolean; useSuffix: boolean; maxPromptTokens: number; @@ -628,6 +681,17 @@ export interface ContinueUIConfig { codeBlockToolbarPosition?: "top" | "bottom"; } +interface ContextMenuConfig { + comment?: string; + docstring?: string; + fix?: string; + optimize?: string; + fixGrammar?: string; +} +interface ExperimantalConfig { + contextMenuPrompts?: ContextMenuConfig; +} + export interface SerializedContinueConfig { env?: string[]; allowAnonymousTelemetry?: boolean; @@ -644,6 +708,8 @@ export interface SerializedContinueConfig { tabAutocompleteModel?: ModelDescription; tabAutocompleteOptions?: Partial; ui?: ContinueUIConfig; + reranker?: RerankerDescription; + experimental?: ExperimantalConfig; } export type ConfigMergeType = "merge" | "overwrite"; @@ -684,6 +750,10 @@ export interface Config { tabAutocompleteOptions?: Partial; /** UI styles customization */ ui?: ContinueUIConfig; + /** Options for the reranker */ + reranker?: RerankerDescription | Reranker; + /** Experimental configuration */ + experimental?: ExperimantalConfig; } export interface ContinueConfig { @@ -700,6 +770,8 @@ export interface ContinueConfig { tabAutocompleteModel?: ILLM; tabAutocompleteOptions?: Partial; ui?: ContinueUIConfig; + reranker?: Reranker; + experimental?: ExperimantalConfig; } export interface BrowserSerializedContinueConfig { @@ -714,4 +786,6 @@ export interface BrowserSerializedContinueConfig { userToken?: string; embeddingsProvider?: string; ui?: ContinueUIConfig; + reranker?: RerankerDescription; + experimental?: ExperimantalConfig; } diff --git a/core/indexing/CodeSnippetsIndex.ts b/core/indexing/CodeSnippetsIndex.ts index f8f92443f..884411491 100644 --- a/core/indexing/CodeSnippetsIndex.ts +++ b/core/indexing/CodeSnippetsIndex.ts @@ -96,6 +96,7 @@ export class CodeSnippetsCodebaseIndex implements CodebaseIndex { tag: IndexTag, results: RefreshIndexResults, markComplete: MarkCompleteCallback, + repoName: string | undefined, ): AsyncGenerator { const db = await SqliteDb.get(); await CodeSnippetsCodebaseIndex._createTables(db); diff --git a/core/indexing/FullTextSearch.ts b/core/indexing/FullTextSearch.ts index 883b73a51..ab82fc926 100644 --- a/core/indexing/FullTextSearch.ts +++ b/core/indexing/FullTextSearch.ts @@ -1,4 +1,6 @@ -import { Chunk, IndexTag, IndexingProgressUpdate } from ".."; +import { BranchAndDir, Chunk, IndexTag, IndexingProgressUpdate } from ".."; +import { RETRIEVAL_PARAMS } from "../util/parameters"; +import { ChunkCodebaseIndex } from "./chunk/ChunkCodebaseIndex"; import { DatabaseConnection, SqliteDb, tagToString } from "./refreshIndex"; import { CodebaseIndex, @@ -31,6 +33,7 @@ export class FullTextSearchCodebaseIndex implements CodebaseIndex { tag: IndexTag, results: RefreshIndexResults, markComplete: MarkCompleteCallback, + repoName: string | undefined, ): AsyncGenerator { const db = await SqliteDb.get(); await this._createTables(db); @@ -85,14 +88,19 @@ export class FullTextSearchCodebaseIndex implements CodebaseIndex { } async retrieve( - tags: IndexTag[], + tags: BranchAndDir[], text: string, n: number, directory: string | undefined, filterPaths: string[] | undefined, + bm25Threshold: number = RETRIEVAL_PARAMS.bm25Threshold, ): Promise { const db = await SqliteDb.get(); - const tagStrings = tags.map(tagToString); + + // Notice that the "chunks" artifactId is used because of linking between tables + const tagStrings = tags.map((tag) => { + return tagToString({ ...tag, artifactId: ChunkCodebaseIndex.artifactId }); + }); const query = `SELECT fts_metadata.chunkId, fts_metadata.path, fts.content, rank FROM fts @@ -110,12 +118,14 @@ export class FullTextSearchCodebaseIndex implements CodebaseIndex { ORDER BY rank LIMIT ?`; - const results = await db.all(query, [ + let results = await db.all(query, [ ...tagStrings, ...(filterPaths || []), n, ]); + results = results.filter((result) => result.rank <= bm25Threshold); + const chunks = await db.all( `SELECT * FROM chunks WHERE id IN (${results.map(() => "?").join(",")})`, results.map((result) => result.chunkId), diff --git a/core/indexing/LanceDbIndex.ts b/core/indexing/LanceDbIndex.ts index 4029f7543..7e66693c9 100644 --- a/core/indexing/LanceDbIndex.ts +++ b/core/indexing/LanceDbIndex.ts @@ -1,11 +1,14 @@ // NOTE: vectordb requirement must be listed in extensions/vscode to avoid error import { v4 as uuidv4 } from "uuid"; +import { Table } from "vectordb"; import { + BranchAndDir, Chunk, EmbeddingsProvider, IndexTag, IndexingProgressUpdate, } from ".."; +import { ContinueServerClient } from "../continueServer/stubs/client"; import { MAX_CHUNK_SIZE } from "../llm/constants"; import { getBasename } from "../util"; import { getLanceDbPath } from "../util/paths"; @@ -34,16 +37,11 @@ export class LanceDbIndex implements CodebaseIndex { static MAX_CHUNK_SIZE = MAX_CHUNK_SIZE; - embeddingsProvider: EmbeddingsProvider; - readFile: (filepath: string) => Promise; - constructor( - embeddingsProvider: EmbeddingsProvider, - readFile: (filepath: string) => Promise, - ) { - this.embeddingsProvider = embeddingsProvider; - this.readFile = readFile; - } + private readonly embeddingsProvider: EmbeddingsProvider, + private readonly readFile: (filepath: string) => Promise, + private readonly continueServerClient?: ContinueServerClient, + ) {} private tableNameForTag(tag: IndexTag) { return tagToString(tag) @@ -136,6 +134,7 @@ export class LanceDbIndex implements CodebaseIndex { items: PathAndCacheKey[], resultType: IndexResultType, ) => void, + repoName: string | undefined, ): AsyncGenerator { const lancedb = await import("vectordb"); const tableName = this.tableNameForTag(tag); @@ -145,11 +144,92 @@ export class LanceDbIndex implements CodebaseIndex { await this.createSqliteCacheTable(sqlite); // Compute - let table = undefined; + let table: Table | undefined = undefined; let needToCreateTable = true; const existingTables = await db.tableNames(); - let computedRows: LanceDbRow[] = []; + const addComputedLanceDbRows = async ( + pathAndCacheKey: PathAndCacheKey, + computedRows: LanceDbRow[], + ) => { + // Create table if needed, add computed rows + if (table) { + if (computedRows.length > 0) { + await table.add(computedRows); + } + } else if (existingTables.includes(tableName)) { + table = await db.openTable(tableName); + needToCreateTable = false; + if (computedRows.length > 0) { + await table.add(computedRows); + } + } else if (computedRows.length > 0) { + table = await db.createTable(tableName, computedRows); + needToCreateTable = false; + } + + // Mark item complete + markComplete([pathAndCacheKey], IndexResultType.Compute); + }; + + // Check remote cache + if (this.continueServerClient !== undefined) { + try { + const keys = results.compute.map(({ cacheKey }) => cacheKey); + const resp = await this.continueServerClient.getFromIndexCache( + keys, + "embeddings", + repoName, + ); + for (const [cacheKey, chunks] of Object.entries(resp.files)) { + // Get path for cacheKey + const path = results.compute.find( + (item) => item.cacheKey === cacheKey, + )?.path; + if (!path) { + console.warn( + "Continue server sent a cacheKey that wasn't requested", + cacheKey, + ); + continue; + } + + // Build LanceDbRow objects + const rows: LanceDbRow[] = []; + for (const chunk of chunks) { + const row = { + path, + cachekey: cacheKey, + uuid: uuidv4(), + vector: chunk.vector, + }; + rows.push(row); + + await sqlite.run( + "INSERT INTO lance_db_cache (uuid, cacheKey, path, vector, startLine, endLine, contents) VALUES (?, ?, ?, ?, ?, ?, ?)", + row.uuid, + row.cachekey, + row.path, + JSON.stringify(row.vector), + chunk.startLine, + chunk.endLine, + chunk.contents, + ); + } + + await addComputedLanceDbRows({ cacheKey, path }, rows); + } + + // Remove items that don't need to be recomputed + results.compute = results.compute.filter( + (item) => !resp.files[item.cacheKey], + ); + } catch (e) { + console.log("Error checking remote cache: ", e); + } + } + + let computedRows: LanceDbRow[] = []; for await (const update of this.computeChunks(results.compute)) { if (Array.isArray(update)) { const [progress, row, data, desc] = update; @@ -169,26 +249,8 @@ export class LanceDbIndex implements CodebaseIndex { yield { progress, desc }; } else { - // Create table if needed, add computed rows - if (table) { - if (computedRows.length > 0) { - await table.add(computedRows); - } - } else if (existingTables.includes(tableName)) { - table = await db.openTable(tableName); - needToCreateTable = false; - if (computedRows.length > 0) { - await table.add(computedRows); - } - } else if (computedRows.length > 0) { - table = await db.createTable(tableName, computedRows); - needToCreateTable = false; - } - + await addComputedLanceDbRows(update, computedRows); computedRows = []; - - // Mark item complete - markComplete([update], IndexResultType.Compute); } } @@ -268,21 +330,27 @@ export class LanceDbIndex implements CodebaseIndex { } async retrieve( - tags: IndexTag[], - text: string, + query: string, n: number, - directory: string | undefined, + tags: BranchAndDir[], + filterDirectory: string | undefined, ): Promise { const lancedb = await import("vectordb"); if (!lancedb.connect) { throw new Error("LanceDB failed to load a native module"); } - const [vector] = await this.embeddingsProvider.embed([text]); + const [vector] = await this.embeddingsProvider.embed([query]); const db = await lancedb.connect(getLanceDbPath()); let allResults = []; for (const tag of tags) { - const results = await this._retrieveForTag(tag, n, directory, vector, db); + const results = await this._retrieveForTag( + { ...tag, artifactId: this.artifactId }, + n, + filterDirectory, + vector, + db, + ); allResults.push(...results); } diff --git a/core/indexing/chunk/ChunkCodebaseIndex.ts b/core/indexing/chunk/ChunkCodebaseIndex.ts index d52f57b7e..4601ef5c7 100644 --- a/core/indexing/chunk/ChunkCodebaseIndex.ts +++ b/core/indexing/chunk/ChunkCodebaseIndex.ts @@ -1,4 +1,5 @@ -import { IndexTag, IndexingProgressUpdate } from "../.."; +import { Chunk, IndexTag, IndexingProgressUpdate } from "../.."; +import { ContinueServerClient } from "../../continueServer/stubs/client"; import { MAX_CHUNK_SIZE } from "../../llm/constants"; import { getBasename } from "../../util"; import { DatabaseConnection, SqliteDb, tagToString } from "../refreshIndex"; @@ -14,8 +15,10 @@ export class ChunkCodebaseIndex implements CodebaseIndex { static artifactId: string = "chunks"; artifactId: string = ChunkCodebaseIndex.artifactId; - readFile: (filepath: string) => Promise; - constructor(readFile: (filepath: string) => Promise) { + constructor( + private readonly readFile: (filepath: string) => Promise, + private readonly continueServerClient?: ContinueServerClient, + ) { this.readFile = readFile; } @@ -42,11 +45,54 @@ export class ChunkCodebaseIndex implements CodebaseIndex { tag: IndexTag, results: RefreshIndexResults, markComplete: MarkCompleteCallback, + repoName: string | undefined, ): AsyncGenerator { const db = await SqliteDb.get(); await this._createTables(db); const tagString = tagToString(tag); + async function handleChunk(chunk: Chunk) { + const { lastID } = await db.run( + `INSERT INTO chunks (cacheKey, path, idx, startLine, endLine, content) VALUES (?, ?, ?, ?, ?, ?)`, + [ + chunk.digest, + chunk.filepath, + chunk.index, + chunk.startLine, + chunk.endLine, + chunk.content, + ], + ); + + await db.run(`INSERT INTO chunk_tags (chunkId, tag) VALUES (?, ?)`, [ + lastID, + tagString, + ]); + } + + // Check the remote cache + if (this.continueServerClient !== undefined) { + try { + const keys = results.compute.map(({ cacheKey }) => cacheKey); + const resp = await this.continueServerClient.getFromIndexCache( + keys, + "chunks", + repoName, + ); + + for (const [cacheKey, chunks] of Object.entries(resp.files)) { + for (const chunk of chunks) { + await handleChunk(chunk); + } + } + results.compute = results.compute.filter( + (item) => !resp.files[item.cacheKey], + ); + } catch (e) { + console.error("Failed to fetch from remote cache: ", e); + } + } + // Compute chunks for new files const contents = await Promise.all( results.compute.map(({ path }) => this.readFile(path)), @@ -61,22 +107,7 @@ export class ChunkCodebaseIndex implements CodebaseIndex { MAX_CHUNK_SIZE, item.cacheKey, )) { - const { lastID } = await db.run( - `INSERT INTO chunks (cacheKey, path, idx, startLine, endLine, content) VALUES (?, ?, ?, ?, ?, ?)`, - [ - chunk.digest, - chunk.filepath, - chunk.index, - chunk.startLine, - chunk.endLine, - chunk.content, - ], - ); - - await db.run(`INSERT INTO chunk_tags (chunkId, tag) VALUES (?, ?)`, [ - lastID, - tagString, - ]); + handleChunk(chunk); } yield { diff --git a/core/indexing/embeddings/FreeTrialEmbeddingsProvider.ts b/core/indexing/embeddings/FreeTrialEmbeddingsProvider.ts new file mode 100644 index 000000000..a7821ebdb --- /dev/null +++ b/core/indexing/embeddings/FreeTrialEmbeddingsProvider.ts @@ -0,0 +1,55 @@ +import fetch, { Response } from "node-fetch"; +import { EmbedOptions } from "../.."; +import { getHeaders } from "../../continueServer/stubs/headers"; +import { SERVER_URL } from "../../util/parameters"; +import { withExponentialBackoff } from "../../util/withExponentialBackoff"; +import BaseEmbeddingsProvider from "./BaseEmbeddingsProvider"; + +class FreeTrialEmbeddingsProvider extends BaseEmbeddingsProvider { + static maxBatchSize = 128; + static defaultOptions: Partial | undefined = { + model: "voyage-code-2", + }; + + get id(): string { + return FreeTrialEmbeddingsProvider.defaultOptions!.model!; + } + + async embed(chunks: string[]) { + const batchedChunks = []; + for ( + let i = 0; + i < chunks.length; + i += FreeTrialEmbeddingsProvider.maxBatchSize + ) { + batchedChunks.push( + chunks.slice(i, i + FreeTrialEmbeddingsProvider.maxBatchSize), + ); + } + return ( + await Promise.all( + batchedChunks.map(async (batch) => { + const fetchWithBackoff = () => + withExponentialBackoff(() => + fetch(new URL("embeddings", SERVER_URL), { + method: "POST", + body: JSON.stringify({ + input: batch, + model: this.options.model, + }), + headers: { + "Content-Type": "application/json", + ...getHeaders(), + }, + }), + ); + const resp = await fetchWithBackoff(); + const data = (await resp.json()) as any; + return data.embeddings; + }), + ) + ).flat(); + } +} + +export default FreeTrialEmbeddingsProvider; diff --git a/core/indexing/embeddings/OpenAIEmbeddingsProvider.ts b/core/indexing/embeddings/OpenAIEmbeddingsProvider.ts index 0719f5984..1bb2b5fdf 100644 --- a/core/indexing/embeddings/OpenAIEmbeddingsProvider.ts +++ b/core/indexing/embeddings/OpenAIEmbeddingsProvider.ts @@ -1,8 +1,13 @@ +import fetch, { Response } from "node-fetch"; import { EmbedOptions } from "../.."; import { withExponentialBackoff } from "../../util/withExponentialBackoff"; import BaseEmbeddingsProvider from "./BaseEmbeddingsProvider"; class OpenAIEmbeddingsProvider extends BaseEmbeddingsProvider { + // https://platform.openai.com/docs/api-reference/embeddings/create is 2048 + // but Voyage is 128 + static maxBatchSize = 128; + static defaultOptions: Partial | undefined = { apiBase: "https://api.openai.com/v1/", model: "text-embedding-3-small", @@ -13,27 +18,50 @@ class OpenAIEmbeddingsProvider extends BaseEmbeddingsProvider { } async embed(chunks: string[]) { - return await Promise.all( - chunks.map(async (chunk) => { - const fetchWithBackoff = () => - withExponentialBackoff(() => - fetch(new URL("embeddings", this.options.apiBase).toString(), { - method: "POST", - body: JSON.stringify({ - input: chunk, - model: this.options.model, + if (!this.options.apiBase?.endsWith("/")) { + this.options.apiBase += "/"; + } + + const batchedChunks = []; + for ( + let i = 0; + i < chunks.length; + i += OpenAIEmbeddingsProvider.maxBatchSize + ) { + batchedChunks.push( + chunks.slice(i, i + OpenAIEmbeddingsProvider.maxBatchSize), + ); + } + return ( + await Promise.all( + batchedChunks.map(async (batch) => { + const fetchWithBackoff = () => + withExponentialBackoff(() => + fetch(new URL("embeddings", this.options.apiBase), { + method: "POST", + body: JSON.stringify({ + input: batch, + model: this.options.model, + }), + headers: { + Authorization: `Bearer ${this.options.apiKey}`, + "Content-Type": "application/json", + }, }), - headers: { - Authorization: `Bearer ${this.options.apiKey}`, - "Content-Type": "application/json", - }, - }), + ); + const resp = await fetchWithBackoff(); + + if (!resp.ok) { + throw new Error(await resp.text()); + } + + const data = (await resp.json()) as any; + return data.data.map( + (result: { embedding: number[] }) => result.embedding, ); - const resp = await fetchWithBackoff(); - const data = await resp.json(); - return data.data[0].embedding; - }), - ); + }), + ) + ).flat(); } } diff --git a/core/indexing/embeddings/index.ts b/core/indexing/embeddings/index.ts index 5538001ec..7430a652d 100644 --- a/core/indexing/embeddings/index.ts +++ b/core/indexing/embeddings/index.ts @@ -1,4 +1,5 @@ import { EmbeddingsProviderName } from "../.."; +import FreeTrialEmbeddingsProvider from "./FreeTrialEmbeddingsProvider"; import OllamaEmbeddingsProvider from "./OllamaEmbeddingsProvider"; import OpenAIEmbeddingsProvider from "./OpenAIEmbeddingsProvider"; import TransformersJsEmbeddingsProvider from "./TransformersJsEmbeddingsProvider"; @@ -9,4 +10,5 @@ export const AllEmbeddingsProviders: { ollama: OllamaEmbeddingsProvider, "transformers.js": TransformersJsEmbeddingsProvider, openai: OpenAIEmbeddingsProvider, + "free-trial": FreeTrialEmbeddingsProvider, }; diff --git a/core/indexing/ignore.ts b/core/indexing/ignore.ts new file mode 100644 index 000000000..c0776b3bf --- /dev/null +++ b/core/indexing/ignore.ts @@ -0,0 +1,80 @@ +import ignore from "ignore"; + +const DEFAULT_IGNORE_FILETYPES = [ + "*.DS_Store", + "*-lock.json", + "*.lock", + "*.log", + "*.ttf", + "*.png", + "*.jpg", + "*.jpeg", + "*.gif", + "*.mp4", + "*.svg", + "*.ico", + "*.pdf", + "*.zip", + "*.gz", + "*.tar", + "*.dmg", + "*.tgz", + "*.rar", + "*.7z", + "*.exe", + "*.dll", + "*.obj", + "*.o", + "*.a", + "*.lib", + "*.so", + "*.dylib", + "*.ncb", + "*.sdf", + "*.woff", + "*.woff2", + "*.eot", + "*.cur", + "*.avi", + "*.mpg", + "*.mpeg", + "*.mov", + "*.mp3", + "*.mp4", + "*.mkv", + "*.mkv", + "*.webm", + "*.jar", + "*.onnx", + "*.parquet", + "*.pqt", + "*.wav", + "*.webp", + "*.db", + "*.sqlite", + "*.wasm", + "*.plist", +]; +export const defaultIgnoreFile = ignore().add(DEFAULT_IGNORE_FILETYPES); +export const DEFAULT_IGNORE_DIRS = [ + ".git", + ".vscode", + ".idea", + ".vs", + "venv", + ".venv", + "env", + ".env", + "node_modules", + "dist", + "build", + "target", + "out", + "bin", + ".pytest_cache", + ".vscode-test", + ".continue", + "__pycache__", + "site-packages", +]; +export const defaultIgnoreDir = ignore().add(DEFAULT_IGNORE_DIRS); diff --git a/core/indexing/indexCodebase.ts b/core/indexing/indexCodebase.ts index 645affa6a..b3b1ba688 100644 --- a/core/indexing/indexCodebase.ts +++ b/core/indexing/indexCodebase.ts @@ -1,5 +1,6 @@ import { IDE, IndexTag, IndexingProgressUpdate } from ".."; import { ConfigHandler } from "../config/handler"; +import { ContinueServerClient } from "../continueServer/stubs/client"; import { CodeSnippetsCodebaseIndex } from "./CodeSnippetsIndex"; import { FullTextSearchCodebaseIndex } from "./FullTextSearch"; import { LanceDbIndex } from "./LanceDbIndex"; @@ -20,24 +21,34 @@ export class PauseToken { } export class CodebaseIndexer { - configHandler: ConfigHandler; - ide: IDE; - pauseToken: PauseToken; - - constructor(configHandler: ConfigHandler, ide: IDE, pauseToken: PauseToken) { - this.configHandler = configHandler; - this.ide = ide; - this.pauseToken = pauseToken; + private continueServerClient?: ContinueServerClient; + constructor( + private readonly configHandler: ConfigHandler, + private readonly ide: IDE, + private readonly pauseToken: PauseToken, + private readonly continueServerUrl: string | undefined, + private readonly userToken: Promise, + ) { + if (continueServerUrl) { + this.continueServerClient = new ContinueServerClient( + continueServerUrl, + userToken, + ); + } } private async getIndexesToBuild(): Promise { const config = await this.configHandler.loadConfig(); const indexes = [ - new ChunkCodebaseIndex(this.ide.readFile.bind(this.ide)), // Chunking must come first + new ChunkCodebaseIndex( + this.ide.readFile.bind(this.ide), + this.continueServerClient, + ), // Chunking must come first new LanceDbIndex( config.embeddingsProvider, this.ide.readFile.bind(this.ide), + this.continueServerClient, ), new FullTextSearchCodebaseIndex(), new CodeSnippetsCodebaseIndex(this.ide), @@ -48,6 +59,7 @@ export class CodebaseIndexer { async *refresh( workspaceDirs: string[], + abortSignal: AbortSignal, ): AsyncGenerator { const config = await this.configHandler.loadConfig(); if (config.disableIndexing) { @@ -58,18 +70,23 @@ export class CodebaseIndexer { let completedDirs = 0; + // Wait until Git Extension has loaded to report progress + // so we don't appear stuck at 0% while waiting + await this.ide.getRepoName(workspaceDirs[0]); yield { - progress: 0.01, + progress: 0, desc: "Starting indexing...", }; for (let directory of workspaceDirs) { const stats = await this.ide.getStats(directory); const branch = await this.ide.getBranch(directory); + const repoName = await this.ide.getRepoName(directory); let completedIndexes = 0; try { for (let codebaseIndex of indexesToBuild) { + // TODO: IndexTag type should use repoName rather than directory const tag: IndexTag = { directory, branch, @@ -79,14 +96,23 @@ export class CodebaseIndexer { tag, { ...stats }, (filepath) => this.ide.readFile(filepath), + repoName, ); for await (let { progress, desc } of codebaseIndex.update( tag, results, markComplete, + repoName, )) { // Handle pausing in this loop because it's the only one really taking time + if (abortSignal.aborted) { + yield { + progress: 1, + desc: "Indexing cancelled", + }; + return; + } while (this.pauseToken.paused) { await new Promise((resolve) => setTimeout(resolve, 100)); } diff --git a/core/indexing/refreshIndex.ts b/core/indexing/refreshIndex.ts index 6f6ec1406..a52b07c64 100644 --- a/core/indexing/refreshIndex.ts +++ b/core/indexing/refreshIndex.ts @@ -259,6 +259,7 @@ export async function getComputeDeleteAddRemove( tag: IndexTag, currentFiles: LastModifiedMap, readFile: (path: string) => Promise, + repoName: string | undefined, ): Promise<[RefreshIndexResults, MarkCompleteCallback]> { const [add, remove, markComplete] = await getAddRemoveForTag( tag, @@ -316,7 +317,12 @@ export async function getComputeDeleteAddRemove( removeTag: [], }; results[resultType] = items; - for await (let _ of globalCacheIndex.update(tag, results, () => {})) { + for await (let _ of globalCacheIndex.update( + tag, + results, + () => {}, + repoName, + )) { } }, ]; @@ -338,6 +344,7 @@ export class GlobalCacheCodeBaseIndex implements CodebaseIndex { tag: IndexTag, results: RefreshIndexResults, _: MarkCompleteCallback, + repoName: string | undefined, ): AsyncGenerator { const add = [...results.compute, ...results.addTag]; const remove = [...results.del, ...results.removeTag]; diff --git a/core/indexing/types.ts b/core/indexing/types.ts index 64df4a618..6715413ad 100644 --- a/core/indexing/types.ts +++ b/core/indexing/types.ts @@ -18,6 +18,7 @@ export interface CodebaseIndex { tag: IndexTag, results: RefreshIndexResults, markComplete: MarkCompleteCallback, + repoName: string | undefined, ): AsyncGenerator; } diff --git a/core/llm/autodetect.ts b/core/llm/autodetect.ts index 4be960b99..98a6bb654 100644 --- a/core/llm/autodetect.ts +++ b/core/llm/autodetect.ts @@ -19,13 +19,13 @@ import { alpacaEditPrompt, claudeEditPrompt, codeLlama70bEditPrompt, - codellamaEditPrompt, deepseekEditPrompt, gemmaEditPrompt, gptEditPrompt, mistralEditPrompt, neuralChatEditPrompt, openchatEditPrompt, + osModelsEditPrompt, phindEditPrompt, simplifiedEditPrompt, xWinCoderEditPrompt, @@ -38,6 +38,7 @@ const PROVIDER_HANDLES_TEMPLATING: ModelProvider[] = [ "ollama", "together", "anthropic", + "bedrock", ]; const PROVIDER_SUPPORTS_IMAGES: ModelProvider[] = [ @@ -46,6 +47,7 @@ const PROVIDER_SUPPORTS_IMAGES: ModelProvider[] = [ "google-palm", "free-trial", "anthropic", + "bedrock", ]; function modelSupportsImages(provider: ModelProvider, model: string): boolean { @@ -160,7 +162,7 @@ function autodetectTemplateType(model: string): TemplateType | undefined { return "alpaca"; } - if (lower.includes("mistral")) { + if (lower.includes("mistral") || lower.includes("mixtral")) { return "llama2"; } @@ -218,6 +220,22 @@ function autodetectTemplateFunction( return null; } +const USES_OS_MODELS_EDIT_PROMPT: TemplateType[] = [ + "alpaca", + "chatml", + // "codellama-70b", Doesn't respond well to this prompt + "deepseek", + "gemma", + "llama2", + "llava", + "neural-chat", + "openchat", + "phi2", + "phind", + "xwin-coder", + "zephyr", +]; + function autodetectPromptTemplates( model: string, explicitTemplate: TemplateType | undefined = undefined, @@ -227,7 +245,11 @@ function autodetectPromptTemplates( let editTemplate = null; - if (templateType === "phind") { + if (templateType && USES_OS_MODELS_EDIT_PROMPT.includes(templateType)) { + // This is overriding basically everything else + // Will probably delete the rest later, but for now it's easy to revert + editTemplate = osModelsEditPrompt; + } else if (templateType === "phind") { editTemplate = phindEditPrompt; } else if (templateType === "phi2") { editTemplate = simplifiedEditPrompt; @@ -237,7 +259,7 @@ function autodetectPromptTemplates( if (model.includes("mistral")) { editTemplate = mistralEditPrompt; } else { - editTemplate = codellamaEditPrompt; + editTemplate = osModelsEditPrompt; } } else if (templateType === "alpaca") { editTemplate = alpacaEditPrompt; diff --git a/core/llm/index.ts b/core/llm/index.ts index a7e186ab7..e8f4ec550 100644 --- a/core/llm/index.ts +++ b/core/llm/index.ts @@ -8,6 +8,7 @@ import { LLMReturnValue, ModelName, ModelProvider, + PromptTemplate, RequestOptions, TemplateType, } from ".."; @@ -46,6 +47,23 @@ export abstract class BaseLLM implements ILLM { return modelSupportsImages(this.providerName, this.model); } + supportsCompletions(): boolean { + if (this.providerName === "openai") { + if ( + this.apiBase?.includes("api.groq.com") || + this.apiBase?.includes(":1337") + ) { + // Jan + Groq don't support completions : ( + return false; + } + } + return true; + } + + supportsPrefill(): boolean { + return ["ollama", "anthropic"].includes(this.providerName); + } + uniqueId: string; model: string; @@ -237,7 +255,6 @@ ${prompt}`; const log = options.log ?? true; const raw = options.raw ?? false; delete options.log; - delete options.raw; const completionOptions: CompletionOptions = mergeJson( this.completionOptions, @@ -443,10 +460,45 @@ ${prompt}`; }; } - private _shouldRequestDirectly() { - if (typeof window === "undefined") { - return true; + public renderPromptTemplate( + template: PromptTemplate, + history: ChatMessage[], + otherData: Record, + canPutWordsInModelsMouth: boolean = false, + ): string | ChatMessage[] { + if (typeof template === "string") { + let data: any = { + history: history, + ...otherData, + }; + if (history.length > 0 && history[0].role == "system") { + data["system_message"] = history.shift()!.content; + } + + const compiledTemplate = Handlebars.compile(template); + return compiledTemplate(data); + } else { + const rendered = template(history, { + ...otherData, + supportsCompletions: this.supportsCompletions() ? "true" : "false", + supportsPrefill: this.supportsPrefill() ? "true" : "false", + }); + if ( + typeof rendered !== "string" && + rendered[rendered.length - 1]?.role === "assistant" && + !canPutWordsInModelsMouth + ) { + // Some providers don't allow you to put words in the model's mouth + // So we have to manually compile the prompt template and use + // raw /completions, not /chat/completions + const templateMessages = autodetectTemplateFunction( + this.model, + this.providerName, + autodetectTemplateType(this.model), + ); + return templateMessages(rendered); + } + return rendered; } - return window?.ide !== "vscode"; } } diff --git a/core/llm/llms/Anthropic.ts b/core/llm/llms/Anthropic.ts index 674de84b8..974bfc7cd 100644 --- a/core/llm/llms/Anthropic.ts +++ b/core/llm/llms/Anthropic.ts @@ -31,7 +31,8 @@ class Anthropic extends BaseLLM { temperature: options.temperature, max_tokens: options.maxTokens ?? 2048, model: options.model === "claude-2" ? "claude-2.1" : options.model, - stop_sequences: options.stop, + stop_sequences: options.stop?.filter((x) => x.trim() !== ""), + stream: options.stream ?? true, }; return finalOptions; @@ -92,10 +93,15 @@ class Anthropic extends BaseLLM { ...this._convertArgs(options), messages: this._convertMessages(messages), system: this.systemMessage, - stream: true, }), }); + 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.delta?.text) { yield { role: "assistant", content: value.delta.text }; diff --git a/core/llm/llms/Bedrock.ts b/core/llm/llms/Bedrock.ts index dc17832ab..138a7f536 100644 --- a/core/llm/llms/Bedrock.ts +++ b/core/llm/llms/Bedrock.ts @@ -1,35 +1,209 @@ +import * as fs from "fs"; +import { join as joinPath } from "path"; +import { promisify } from "util"; import { BaseLLM } from ".."; -import { CompletionOptions, LLMOptions, ModelProvider } from "../.."; -import { streamSse } from "../stream"; +import { + ChatMessage, + CompletionOptions, + LLMOptions, + ModelProvider, +} from "../.."; +import { stripImages } from "../countTokens"; + +const aws4 = require("aws4"); +const readFile = promisify(fs.readFile); + +namespace BedrockCommon { + export enum Method { + Chat = "invoke", + Completion = "invoke-with-response-stream", + } + export const Service: string = "bedrock"; + export const AuthAlgo: string = "AWS4-HMAC-SHA256"; + export const HashAlgo: string = "sha256"; +} class Bedrock extends BaseLLM { static providerName: ModelProvider = "bedrock"; - static defaultOptions: Partial = {}; + static defaultOptions: Partial = { + region: "us-east-1", + model: "claude-3-sonnet-20240229", + contextLength: 200_000, + }; + + constructor(options: LLMOptions) { + super(options); + this.apiBase = `https://bedrock-runtime.${options.region}.amazonaws.com`; + } + + private _convertModelName(model: string): string { + return ( + { + "claude-3-sonnet-20240229": "anthropic.claude-3-sonnet-20240229-v1:0", + "claude-3-haiku-20240307": "anthropic.claude-3-haiku-20240307-v1:0", + "claude-2": "anthropic.claude-v2:1", + }[model] ?? model + ); + } + + private _convertArgs(options: CompletionOptions) { + const finalOptions = { + top_k: options.topK, + top_p: options.topP, + temperature: options.temperature, + max_tokens: options.maxTokens ?? 4096, + stop_sequences: options.stop, + }; + + return finalOptions; + } + + private _convertMessages(msgs: ChatMessage[]): any[] { + const messages = msgs + .filter((m) => m.role !== "system") + .map((message) => { + if (typeof message.content === "string") { + return message; + } else { + return { + ...message, + content: message.content.map((part) => { + if (part.type === "text") { + return part; + } else { + return { + type: "image", + source: { + type: "base64", + media_type: "image/jpeg", + data: part.imageUrl?.url.split(",")[1], + }, + }; + } + }), + }; + } + }); + return messages; + } + + private _parseCredentialsFile(fileContents: string) { + const profiles: { [key: string]: any } = {}; + const lines = fileContents.trim().split("\n"); + + let currentProfile: string | null = null; + + for (const line of lines) { + const trimmedLine = line.trim(); + + if (trimmedLine.startsWith("[") && trimmedLine.endsWith("]")) { + currentProfile = trimmedLine.slice(1, -1); + profiles[currentProfile] = {}; + } else if (currentProfile !== null && trimmedLine.includes("=")) { + const [key, value] = trimmedLine.split("="); + const trimmedKey = key.trim(); + const trimmedValue = value.trim(); + + if (trimmedKey === "aws_access_key_id") { + profiles[currentProfile].accessKeyId = trimmedValue; + } else if (trimmedKey === "aws_secret_access_key") { + profiles[currentProfile].secretAccessKey = trimmedValue; + } else if (trimmedKey === "aws_session_token") { + profiles[currentProfile].sessionToken = trimmedValue; + } + } + } + + return profiles; + } + + private async _fetchWithAwsAuthSigV4( + apiMethod: BedrockCommon.Method, + body: string, + model: string, + ): Promise { + const path = `/model/${model}/${apiMethod}`; + const opts = { + headers: { + accept: + apiMethod === BedrockCommon.Method.Chat + ? "application/json" + : "application/vnd.amazon.eventstream", + "content-type": "application/json", + "x-amzn-bedrock-accept": "*/*", + }, + path: path, + body: body, + service: "bedrock", + host: new URL(this.apiBase!).host, + region: this.region, + }; + + let accessKeyId: string, secretAccessKey: string, sessionToken: string; + + try { + const data = await readFile( + joinPath(process.env.HOME!, ".aws", "credentials"), + "utf8", + ); + const credentials = this._parseCredentialsFile(data); + accessKeyId = credentials.bedrock.accessKeyId; + secretAccessKey = credentials.bedrock.secretAccessKey; + sessionToken = credentials.bedrock.sessionToken || ""; + } catch (err) { + console.error("Error reading AWS credentials", err); + return new Response("403"); + } + return await this.fetch(new URL(`${this.apiBase}${path}`), { + method: "POST", + headers: aws4.sign(opts, { accessKeyId, secretAccessKey, sessionToken })[ + "headers" + ], + body: body, + }); + } protected async *_streamComplete( prompt: string, options: CompletionOptions, ): AsyncGenerator { - const response = await this.fetch( - `${this.apiBase}/model/${options.model}/invoke-with-response-stream`, - { - method: "POST", - headers: { - accept: "application/vnd.amazon.eventstream", - "content-type": "application/json", - "x-amzn-bedrock-accept": "*/*", - }, - body: JSON.stringify({ - inputText: prompt, - }), - }, - ); - - for await (const value of streamSse(response)) { - if (value.chunk) { - yield value.chunk; - } + const messages = [{ role: "user" as const, content: prompt }]; + for await (const update of this._streamChat(messages, options)) { + yield stripImages(update.content); } + // TODO: Couldn't seem to get this stream API working yet. Deferring to _streamChat. + // import { streamSse } from "../stream"; + // const response = await this._fetchWithAwsAuthSigV4(BedrockCommon.Method.Completion, JSON.stringify({ + // ...this._convertArgs(options), + // max_tokens: undefined, // Delete this key in favor of the correct one for the Completions API. + // max_tokens_to_sample: options.maxTokens, + // prompt: `\n\nHuman: ${prompt}\n\nAssistant:`, + // }) + // ); + // for await (const value of streamSse(response)) { + // if (value.completion) { + // yield value.completion + // } + // } + } + + protected async *_streamChat( + messages: ChatMessage[], + options: CompletionOptions, + ): AsyncGenerator { + const response = await this._fetchWithAwsAuthSigV4( + BedrockCommon.Method.Chat, + JSON.stringify({ + ...this._convertArgs(options), + messages: this._convertMessages(messages), + anthropic_version: "bedrock-2023-05-31", // Fixed, required parameter for Chat API. + }), + this._convertModelName(options.model), + ); + yield { + role: "assistant", + content: (await response.json()).content[0].text, + }; } } diff --git a/core/llm/llms/FreeTrial.ts b/core/llm/llms/FreeTrial.ts index d59d114b9..05cec040e 100644 --- a/core/llm/llms/FreeTrial.ts +++ b/core/llm/llms/FreeTrial.ts @@ -1,10 +1,9 @@ import { BaseLLM } from ".."; import { ChatMessage, CompletionOptions, ModelProvider } from "../.."; +import { getHeaders } from "../../continueServer/stubs/headers"; +import { SERVER_URL } from "../../util/parameters"; import { streamResponse } from "../stream"; -// const SERVER_URL = "http://localhost:3000"; -const SERVER_URL = "https://node-proxy-server-blue-l6vsfbzhba-uw.a.run.app"; - class FreeTrial extends BaseLLM { static providerName: ModelProvider = "free-trial"; @@ -12,6 +11,7 @@ class FreeTrial extends BaseLLM { return { uniqueId: this.uniqueId || "None", "Content-Type": "application/json", + ...getHeaders(), }; } @@ -22,7 +22,7 @@ class FreeTrial extends BaseLLM { presence_penalty: options.presencePenalty, max_tokens: options.maxTokens, stop: - options.model === "starcoder2-15b" + options.model === "starcoder-7b" ? options.stop : options.stop?.slice(0, 2), temperature: options.temperature, diff --git a/core/llm/llms/GooglePalm.ts b/core/llm/llms/GooglePalm.ts index 780eeac19..311019fb5 100644 --- a/core/llm/llms/GooglePalm.ts +++ b/core/llm/llms/GooglePalm.ts @@ -14,7 +14,7 @@ class GooglePalm extends BaseLLM { static defaultOptions: Partial = { model: "gemini-pro", - apiBase: "https://generativelanguage.googleapis.com/", + apiBase: "https://generativelanguage.googleapis.com/v1beta/", }; protected async *_streamComplete( @@ -83,7 +83,7 @@ class GooglePalm extends BaseLLM { options: CompletionOptions, ): AsyncGenerator { const apiURL = new URL( - `v1/models/${options.model}:streamGenerateContent?key=${this.apiKey}`, + `models/${options.model}:streamGenerateContent?key=${this.apiKey}`, this.apiBase, ); const body = { @@ -161,7 +161,7 @@ class GooglePalm extends BaseLLM { } const apiURL = new URL( - `v1beta2/models/${options.model}:generateMessage?key=${this.apiKey}`, + `models/${options.model}:generateMessage?key=${this.apiKey}`, this.apiBase, ); const body = { prompt: { messages: msgList } }; diff --git a/core/llm/llms/Groq.ts b/core/llm/llms/Groq.ts new file mode 100644 index 000000000..6c9515795 --- /dev/null +++ b/core/llm/llms/Groq.ts @@ -0,0 +1,20 @@ +import { LLMOptions, ModelProvider } from "../.."; +import OpenAI from "./OpenAI"; + +class Groq extends OpenAI { + static providerName: ModelProvider = "groq"; + static defaultOptions: Partial = { + apiBase: "https://api.groq.com/openai/v1/", + }; + + private static modelConversion: { [key: string]: string } = { + "llama2-70b": "llama2-70b-4096", + "mistral-8x7b": "mixtral-8x7b-32768", + gemma: "gemma-7b-it", + }; + protected _convertModelName(model: string): string { + return Groq.modelConversion[model] ?? model; + } +} + +export default Groq; diff --git a/core/llm/llms/LlamaCpp.ts b/core/llm/llms/LlamaCpp.ts index 9c5349619..c52f6e527 100644 --- a/core/llm/llms/LlamaCpp.ts +++ b/core/llm/llms/LlamaCpp.ts @@ -15,6 +15,7 @@ class LlamaCpp extends BaseLLM { presence_penalty: options.presencePenalty, min_p: options.minP, mirostat: options.mirostat, + stop: options.stop, }; return finalOptions; diff --git a/core/llm/llms/Ollama.ts b/core/llm/llms/Ollama.ts index b7209e94c..b7c05bbcc 100644 --- a/core/llm/llms/Ollama.ts +++ b/core/llm/llms/Ollama.ts @@ -89,6 +89,7 @@ class Ollama extends BaseLLM { "neural-chat-7b": "neural-chat:7b-v3.3", "starcoder-1b": "starcoder:1b", "starcoder-3b": "starcoder:3b", + "starcoder2-3b": "starcoder2:3b", "stable-code-3b": "stable-code:3b", }[this.model] ?? this.model ); diff --git a/core/llm/llms/OpenAI.ts b/core/llm/llms/OpenAI.ts index da31df620..9dfba7fee 100644 --- a/core/llm/llms/OpenAI.ts +++ b/core/llm/llms/OpenAI.ts @@ -39,6 +39,12 @@ const CHAT_ONLY_MODELS = [ class OpenAI extends BaseLLM { public useLegacyCompletionsEndpoint = false; + constructor(options: LLMOptions) { + super(options); + this.useLegacyCompletionsEndpoint = + options.useLegacyCompletionsEndpoint ?? false; + } + static providerName: ModelProvider = "openai"; static defaultOptions: Partial = { apiBase: "https://api.openai.com/v1/", @@ -65,10 +71,15 @@ class OpenAI extends BaseLLM { }; } + protected _convertModelName(model: string): string { + return model; + } + protected _convertArgs(options: any, messages: ChatMessage[]) { + const url = new URL(this.apiBase!); const finalOptions = { messages: messages.map(this._convertMessage), - model: options.model, + model: this._convertModelName(options.model), max_tokens: options.maxTokens, temperature: options.temperature, top_p: options.topP, @@ -76,7 +87,9 @@ class OpenAI extends BaseLLM { presence_penalty: options.presencePenalty, stop: // Jan + Azure OpenAI don't truncate and will throw an error - this.apiBase?.includes(":1337") || this.apiType === "azure" + url.port === "1337" || + url.host === "api.openai.com" || + this.apiType === "azure" ? options.stop?.slice(0, 4) : options.stop, }; @@ -164,8 +177,10 @@ class OpenAI extends BaseLLM { ): AsyncGenerator { if ( !CHAT_ONLY_MODELS.includes(options.model) && + this.supportsCompletions() && (NON_CHAT_MODELS.includes(options.model) || - this.useLegacyCompletionsEndpoint) + this.useLegacyCompletionsEndpoint || + options.raw) ) { for await (const content of this._legacystreamComplete( stripImages(messages[messages.length - 1]?.content || ""), diff --git a/core/llm/llms/index.ts b/core/llm/llms/index.ts index 9375c2d31..1c1214a9d 100644 --- a/core/llm/llms/index.ts +++ b/core/llm/llms/index.ts @@ -14,6 +14,7 @@ import Flowise from "./Flowise"; import FreeTrial from "./FreeTrial"; import Gemini from "./Gemini"; import GooglePalm from "./GooglePalm"; +import Groq from "./Groq"; import HuggingFaceInferenceAPI from "./HuggingFaceInferenceAPI"; import HuggingFaceTGI from "./HuggingFaceTGI"; import LMStudio from "./LMStudio"; @@ -94,6 +95,7 @@ const LLMs = [ DeepInfra, OpenAIFreeTrial, Flowise, + Groq, ]; export async function llmFromDescription( @@ -123,13 +125,13 @@ export async function llmFromDescription( completionOptions: { ...finalCompletionOptions, model: (desc.model || cls.defaultOptions?.model) ?? "codellama-7b", - maxTokens: ( + maxTokens: finalCompletionOptions.maxTokens ?? - cls.defaultOptions?.completionOptions?.maxTokens - ) ?? DEFAULT_MAX_TOKENS, + cls.defaultOptions?.completionOptions?.maxTokens ?? + DEFAULT_MAX_TOKENS, }, systemMessage, -}; + }; return new cls(options); } diff --git a/core/llm/templates/chat.ts b/core/llm/templates/chat.ts index 8f004abb8..cb39f8827 100644 --- a/core/llm/templates/chat.ts +++ b/core/llm/templates/chat.ts @@ -1,6 +1,46 @@ import { ChatMessage } from "../.."; import { stripImages } from "../countTokens"; +function templateFactory( + systemMessage: (msg: ChatMessage) => string, + userPrompt: string, + assistantPrompt: string, + separator: string, + prefix?: string, + emptySystemMessage?: string, +): (msgs: ChatMessage[]) => string { + return (msgs: ChatMessage[]) => { + let prompt = prefix ?? ""; + + // Skip assistant messages at the beginning + while (msgs.length > 0 && msgs[0].role === "assistant") { + msgs.shift(); + } + + if (msgs.length > 0 && msgs[0].role === "system") { + prompt += systemMessage(msgs.shift()!); + } else if (emptySystemMessage) { + prompt += emptySystemMessage; + } + + for (let i = 0; i < msgs.length; i++) { + const msg = msgs[i]; + prompt += msg.role === "user" ? userPrompt : assistantPrompt; + prompt += msg.content; + if (i < msgs.length - 1) { + prompt += separator; + } + } + + if (msgs.length > 0 && msgs[msgs.length - 1].role === "user") { + prompt += separator; + prompt += assistantPrompt; + } + + return prompt; + }; +} + /** * @description Template for LLAMA2 messages: * @@ -43,7 +83,10 @@ function llama2TemplateMessages(msgs: ChatMessage[]): string { if (msgs[i].role === "user") { prompt += `[INST] ${msgs[i].content} [/INST]`; } else { - prompt += msgs[i].content + "\n"; + prompt += msgs[i].content; + if (i < msgs.length - 1) { + prompt += "\n"; + } } } @@ -73,77 +116,41 @@ function anthropicTemplateMessages(messages: ChatMessage[]): string { return prompt; } -function llavaTemplateMessages(msgs: ChatMessage[]): string { - `A chat between a curious user and an artificial intelligence assistant. The assistant gives helpful, detailed, and polite answers to the user's questions. +`A chat between a curious user and an artificial intelligence assistant. The assistant gives helpful, detailed, and polite answers to the user's questions. USER: {prompt} ASSISTANT:`; +const llavaTemplateMessages = templateFactory( + () => "", + "USER: ", + "ASSISTANT: ", + "\n", + "A chat between a curious user and an artificial intelligence assistant. The assistant gives helpful, detailed, and polite answers to the user's questions.", +); - let prompt = - "A chat between a curious user and an artificial intelligence assistant. The assistant gives helpful, detailed, and polite answers to the user's questions."; +const zephyrTemplateMessages = templateFactory( + (msg) => `<|system|>${msg.content}\n`, + "<|user|>\n", + "<|assistant|>\n", + "\n", + undefined, + "<|system|> \n", +); - for (const msg of msgs) { - prompt += msg.role === "user" ? "USER: " : "ASSISTANT: "; - prompt += msg.content; +const chatmlTemplateMessages = templateFactory( + (msg) => `<|im_start|>${msg.role}\n${msg.content}<|im_end|>\n`, + "<|im_start|>user\n", + "<|im_start|>assistant\n", + "<|im_end|>\n", +); - prompt += "\n"; - } - - prompt += "ASSISTANT: "; - - return prompt; -} - -function zephyrTemplateMessages(msgs: ChatMessage[]): string { - let prompt = ""; - - if (msgs[0].role === "system") { - prompt += `<|system|>${msgs[0].content}\n`; - msgs.shift(); - } else { - prompt += "<|system|> \n"; - } - - for (const msg of msgs) { - prompt += msg.role === "user" ? "<|user|>\n" : "<|assistant|>\n"; - prompt += `${msg.content}\n`; - } - - prompt += "<|assistant|>\n"; - - return prompt; -} - -function chatmlTemplateMessages(messages: ChatMessage[]): string { - let prompt = ""; - - for (const msg of messages) { - prompt += `<|im_start|>${msg.role}\n${msg.content}<|im_end|>\n`; - } - - prompt += "<|im_start|>assistant\n"; - return prompt; -} - -function templateAlpacaMessages(msgs: ChatMessage[]): string { - let prompt = ""; - - if (msgs[0].role === "system") { - prompt += `${msgs[0].content}\n\n`; - msgs.shift(); - } else { - prompt += - "Below is an instruction that describes a task. Write a response that appropriately completes the request.\n\n"; - } - - for (const msg of msgs) { - prompt += msg.role === "user" ? "### Instruction:\n" : "### Response:\n"; - prompt += `${msg.content}\n\n`; - } - - prompt += "### Response:\n"; - - return prompt; -} +const templateAlpacaMessages = templateFactory( + (msg) => `${msg.content}\n\n`, + "### Instruction:\n", + "### Response:\n", + "\n\n", + undefined, + "Below is an instruction that describes a task. Write a response that appropriately completes the request.\n\n", +); function deepseekTemplateMessages(msgs: ChatMessage[]): string { let prompt = ""; @@ -163,63 +170,45 @@ function deepseekTemplateMessages(msgs: ChatMessage[]): string { } prompt += `${msg.content}`; - prompt += msg.role === "user" ? "\n" : "<|EOT|>\n"; + + if (i < msgs.length - 1) { + prompt += msg.role === "user" ? "\n" : "<|EOT|>\n"; + } } - return prompt + "### Response:\n"; + if (msgs.length > 0 && msgs[msgs.length - 1].role === "user") { + prompt += "\n"; + prompt += "### Response:\n"; + } + + return prompt; } // See https://huggingface.co/microsoft/phi-2#qa-format -function phi2TemplateMessages(msgs: ChatMessage[]): string { - const HUMAN_PROMPT = "\n\nInstruct:"; - const AI_PROMPT = "\n\nOutput:"; - let prompt = ""; +const phi2TemplateMessages = templateFactory( + (msg) => `\n\nInstruct: ${msg.content} `, + "\n\nInstruct: ", + "\n\nOutput: ", + " ", +); - for (const msg of msgs) { - prompt += `${ - msg.role === "user" || msg.role === "system" ? HUMAN_PROMPT : AI_PROMPT - } ${msg.content} `; - } - - prompt += AI_PROMPT; - return prompt; -} - -function phindTemplateMessages(msgs: ChatMessage[]): string { - let prompt = ""; - - if (msgs[0].role === "system") { - prompt += `### System Prompt\n${msgs[0].content}\n\n`; - msgs.shift(); - } - - for (const msg of msgs) { - prompt += msg.role === "user" ? "### User Message\n" : "### Assistant\n"; - prompt += `${msg.content}\n`; - } - - prompt += "### Assistant\n"; - - return prompt; -} +const phindTemplateMessages = templateFactory( + (msg) => `### System Prompt\n${msg.content}\n\n`, + "### User Message\n", + "### Assistant\n", + "\n", +); /** * OpenChat Template, used by CodeNinja * GPT4 Correct User: Hello<|end_of_turn|>GPT4 Correct Assistant: Hi<|end_of_turn|>GPT4 Correct User: How are you today?<|end_of_turn|>GPT4 Correct Assistant: */ -function openchatTemplateMessages(msgs: ChatMessage[]): string { - let prompt = ""; - - for (const msg of msgs) { - prompt += - msg.role === "user" ? "GPT4 Correct User: " : "GPT4 Correct Assistant: "; - prompt += msg.content + "<|end_of_turn|>"; - } - - prompt += "GPT4 Correct Assistant: "; - - return prompt; -} +const openchatTemplateMessages = templateFactory( + () => "", + "GPT4 Correct User: ", + "GPT4 Correct Assistant: ", + "<|end_of_turn|>", +); /** * Chat template used by https://huggingface.co/TheBloke/XwinCoder-13B-GPTQ @@ -229,47 +218,25 @@ function openchatTemplateMessages(msgs: ChatMessage[]): string { : {prompt} : */ -function xWinCoderTemplateMessages(msgs: ChatMessage[]): string { - let prompt = ": "; - if (msgs[0].role === "system") { - prompt += msgs.shift()!.content; - } else { - prompt += - "You are an AI coding assistant that helps people with programming. Write a response that appropriately completes the user's request."; - } - - for (let msg of msgs) { - prompt += "\n"; - prompt += msg.role === "user" ? "" : ""; - prompt += ": " + msg.content; - } - - prompt += ": "; - - return prompt; -} +const xWinCoderTemplateMessages = templateFactory( + (msg) => `: ${msg.content}`, + "\n: ", + "\n: ", + "", + undefined, + ": You are an AI coding assistant that helps people with programming. Write a response that appropriately completes the user's request.", +); /** * NeuralChat Template * ### System:\n{system_input}\n### User:\n{user_input}\n### Assistant:\n */ -function neuralChatTemplateMessages(msgs: ChatMessage[]): string { - let prompt = ""; - - if (msgs[0].role === "system") { - prompt += `### System:\n${msgs[0].content}\n`; - msgs.shift(); - } - - for (const msg of msgs) { - prompt += msg.role === "user" ? "### User:\n" : "### Assistant:\n"; - prompt += `${msg.content}\n`; - } - - prompt += "### Assistant:\n"; - - return prompt; -} +const neuralChatTemplateMessages = templateFactory( + (msg) => `### System:\n${msg.content}\n`, + "### User:\n", + "### Assistant:\n", + "\n", +); /** 'Source: system\n\n System prompt Source: user\n\n First user query Source: assistant\n\n Model response to first query Source: user\n\n Second user query Source: assistant\nDestination: user\n\n ' @@ -292,18 +259,12 @@ function codeLlama70bTemplateMessages(msgs: ChatMessage[]): string { What is Cramer's Rule? model */ - -function gemmaTemplateMessage(msgs: ChatMessage[]): string { - let prompt = ""; - for (const msg of msgs) { - prompt += `${ - msg.role === "assistant" ? "model" : "user" - }\n${stripImages(msg.content).trim()}\n`; - } - - prompt += "model\n"; - return prompt; -} +const gemmaTemplateMessage = templateFactory( + () => "", + "user\n", + "model\n", + "\n", +); export { anthropicTemplateMessages, diff --git a/core/llm/templates/edit.ts b/core/llm/templates/edit.ts index abe914f74..188ff0966 100644 --- a/core/llm/templates/edit.ts +++ b/core/llm/templates/edit.ts @@ -1,5 +1,4 @@ -import { ChatMessage } from "../.."; -import { PromptTemplate } from "../../util"; +import { ChatMessage, PromptTemplate } from "../.."; const simplifiedEditPrompt = `Consider the following code: \`\`\`{{{language}}} @@ -19,27 +18,115 @@ Here is the edit requested: Here is the code after editing:`; -const gptEditPrompt = `\ -\`\`\`{{{language}}} -{{{codeToEdit}}} +const gptEditPrompt: PromptTemplate = (_, otherData) => { + if (otherData?.codeToEdit?.trim().length === 0) { + return `\ +\`\`\`${otherData.language} +${otherData.prefix}[BLANK]${otherData.codeToEdit}${otherData.suffix} \`\`\` -You are an expert programmer. You will rewrite the above code to do the following: +Given the user's request: "${otherData.userInput}" -{{{userInput}}} +Here is the code that should fill in the [BLANK]:`; + } -Output only a code block with the rewritten code:`; + const paragraphs = [ + "The user has requested a section of code in a file to be rewritten.", + ]; + if (otherData.prefix?.trim().length > 0) { + paragraphs.push(`This is the prefix of the file: +\`\`\`${otherData.language} +${otherData.prefix} +\`\`\``); + } + + if (otherData.suffix?.trim().length > 0) { + paragraphs.push(`This is the suffix of the file: +\`\`\`${otherData.language} +${otherData.suffix} +\`\`\``); + } + + paragraphs.push(`This is the code to rewrite: +\`\`\`${otherData.language} +${otherData.codeToEdit} +\`\`\` + +The user's request is: "${otherData.userInput}" + +Here is the rewritten code:`); + + return paragraphs.join("\n\n"); +}; const codellamaInfillEditPrompt = "{{filePrefix}}{{fileSuffix}}"; -const codellamaEditPrompt = `\`\`\`{{{language}}} -{{{codeToEdit}}} -\`\`\` -[INST] You are an expert programmer and personal assistant. Your task is to rewrite the above code with these instructions: "{{{userInput}}}" +const START_TAG = ""; +const osModelsEditPrompt: PromptTemplate = (history, otherData) => { + // "No sufix" means either there is no suffix OR + // it's a clean break at end of function or something + // (what we're trying to avoid is just the language model trying to complete the closing brackets of a function or something) + const firstCharOfFirstLine = otherData.suffix?.split("\n")[0]?.[0]?.trim(); + const isSuffix = + otherData.suffix?.trim() !== "" && + // First character of first line is whitespace + // Otherwise we assume it's a clean break + !firstCharOfFirstLine; + const suffixTag = isSuffix ? "" : ""; + const suffixExplanation = isSuffix + ? ' When you get to "", end your response.' + : ""; -Your answer should be given inside of a code block. It should use the same kind of indentation as above. -[/INST] Sure! Here's the rewritten code you requested: -\`\`\`{{{language}}}`; + // If neither prefilling nor /v1/completions are supported, we have to use a chat prompt without putting words in the model's mouth + if ( + otherData.supportsCompletions !== "true" && + otherData.supportsPrefill !== "true" + ) { + return gptEditPrompt(history, otherData); + } + + // Use a different prompt when there's neither prefix nor suffix + if (otherData.prefix?.trim() === "" && otherData.suffix?.trim() === "") { + return [ + { + role: "user", + content: `\`\`\`${otherData.language} +${otherData.codeToEdit} +${suffixTag} +\`\`\` + +Please rewrite the entire code block above in order to satisfy the following request: "${otherData.userInput}".${suffixExplanation}`, + }, + { + role: "assistant", + content: `Sure! Here's the entire rewritten code block: +\`\`\`${otherData.language} +`, + }, + ]; + } + + return [ + { + role: "user", + content: `\`\`\`${otherData.language} +${otherData.prefix}${START_TAG} +${otherData.codeToEdit} +${suffixTag} +\`\`\` + +Please rewrite the entire code block above, editing the portion below "${START_TAG}" in order to satisfy the following request: "${otherData.userInput}".${suffixExplanation} +`, + }, + { + role: "assistant", + content: `Sure! Here's the entire code block, including the rewritten portion: +\`\`\`${otherData.language} +${otherData.prefix}${START_TAG} +`, + }, + ]; +}; const mistralEditPrompt = `[INST] You are a helpful code assistant. Your task is to rewrite the following code with these instructions: "{{{userInput}}}" \`\`\`{{{language}}} @@ -188,7 +275,6 @@ export { alpacaEditPrompt, claudeEditPrompt, codeLlama70bEditPrompt, - codellamaEditPrompt, codellamaInfillEditPrompt, deepseekEditPrompt, gemmaEditPrompt, @@ -196,6 +282,7 @@ export { mistralEditPrompt, neuralChatEditPrompt, openchatEditPrompt, + osModelsEditPrompt, phindEditPrompt, simplestEditPrompt, simplifiedEditPrompt, diff --git a/core/package-lock.json b/core/package-lock.json index 9c82cd3d2..13f36dd80 100644 --- a/core/package-lock.json +++ b/core/package-lock.json @@ -1,12 +1,12 @@ { "name": "@continuedev/core", - "version": "1.0.4", + "version": "1.0.6", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@continuedev/core", - "version": "1.0.4", + "version": "1.0.6", "license": "Apache-2.0", "dependencies": { "@mozilla/readability": "^0.5.0", @@ -26,6 +26,7 @@ "handlebars": "^4.7.8", "http-proxy-agent": "^7.0.1", "https-proxy-agent": "^7.0.3", + "ignore": "^5.3.1", "js-tiktoken": "^1.0.8", "jsdom": "^24.0.0", "llama-tokenizer-js": "^1.1.3", @@ -43,7 +44,7 @@ "sqlite3": "^5.1.7", "tree-sitter-wasms": "^0.1.6", "uuid": "^9.0.1", - "vectordb": "^0.4.12", + "vectordb": "0.4.12", "web-tree-sitter": "^0.21.0" }, "devDependencies": { @@ -5336,7 +5337,6 @@ "version": "5.3.1", "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.1.tgz", "integrity": "sha512-5Fytz/IraMjqpwfd34ke28PTVMjZjJG2MPn5t7OE4eUCUNf8BAa7b5WUS9/Qvr6mwOQS7Mk6vdsMno5he+T8Xw==", - "peer": true, "engines": { "node": ">= 4" } diff --git a/core/package.json b/core/package.json index 3cd4ea5f0..ee0ff76f9 100644 --- a/core/package.json +++ b/core/package.json @@ -1,6 +1,6 @@ { "name": "@continuedev/core", - "version": "1.0.4", + "version": "1.0.6", "description": "The Continue Core contains functionality that can be shared across web, VS Code, or Node.js server. It is written in TypeScript and contains much of the functionality that was previously inside of the legacy Continue Python Server.", "scripts": { "test": "jest ./test/diff.test.ts", @@ -37,6 +37,7 @@ "handlebars": "^4.7.8", "http-proxy-agent": "^7.0.1", "https-proxy-agent": "^7.0.3", + "ignore": "^5.3.1", "js-tiktoken": "^1.0.8", "jsdom": "^24.0.0", "llama-tokenizer-js": "^1.1.3", @@ -54,7 +55,7 @@ "sqlite3": "^5.1.7", "tree-sitter-wasms": "^0.1.6", "uuid": "^9.0.1", - "vectordb": "^0.4.12", + "vectordb": "0.4.12", "web-tree-sitter": "^0.21.0" }, "puppeteer": { diff --git a/core/protocol.ts b/core/protocol.ts index a6836b615..43d5c729c 100644 --- a/core/protocol.ts +++ b/core/protocol.ts @@ -3,6 +3,7 @@ import { ChatMessage, ContextItemWithId, ContextSubmenuItem, + DiffLine, LLMFullCompletionOptions, MessageContent, PersistedSessionInfo, @@ -97,6 +98,17 @@ export type Protocol = { }, ProtocolGeneratorType, ]; + streamDiffLines: [ + { + prefix: string; + highlighted: string; + suffix: string; + input: string; + language: string | undefined; + modelTitle: string | undefined; + }, + ProtocolGeneratorType, + ]; }; export interface IdeSettings { @@ -107,4 +119,5 @@ export interface IdeSettings { export type ReverseProtocol = IdeProtocol & { getIdeSettings: [undefined, IdeSettings]; + errorPopup: [{ message: string }, void]; }; diff --git a/core/util/fetchWithOptions.ts b/core/util/fetchWithOptions.ts new file mode 100644 index 000000000..83f146d86 --- /dev/null +++ b/core/util/fetchWithOptions.ts @@ -0,0 +1,81 @@ +import { http, https } from "follow-redirects"; +import * as fs from "fs"; +import { HttpProxyAgent } from "http-proxy-agent"; +import { HttpsProxyAgent } from "https-proxy-agent"; +import fetch, { RequestInit, Response } from "node-fetch"; +import tls from "tls"; +import { RequestOptions } from ".."; + +export function fetchwithRequestOptions( + url: URL, + init: RequestInit, + requestOptions?: RequestOptions, +): Promise { + const TIMEOUT = 7200; // 7200 seconds = 2 hours + + const ca = [...tls.rootCertificates]; + const customCerts = + typeof requestOptions?.caBundlePath === "string" + ? [requestOptions?.caBundlePath] + : requestOptions?.caBundlePath; + if (customCerts) { + ca.push( + ...customCerts.map((customCert) => fs.readFileSync(customCert, "utf8")), + ); + } + + let timeout = (requestOptions?.timeout ?? TIMEOUT) * 1000; // measured in ms + + const agentOptions = { + ca, + rejectUnauthorized: requestOptions?.verifySsl, + timeout, + sessionTimeout: timeout, + keepAlive: true, + keepAliveMsecs: timeout, + }; + + const proxy = requestOptions?.proxy; + + // Create agent + const protocol = url.protocol === "https:" ? https : http; + const agent = proxy + ? protocol === https + ? new HttpsProxyAgent(proxy, agentOptions) + : new HttpProxyAgent(proxy, agentOptions) + : new protocol.Agent(agentOptions); + + const headers: { [key: string]: string } = requestOptions?.headers || {}; + for (const [key, value] of Object.entries(init.headers || {})) { + headers[key] = value as string; + } + + // Replace localhost with 127.0.0.1 + if (url.hostname === "localhost") { + url.hostname = "127.0.0.1"; + } + + // add extra body properties if provided + let updatedBody: string | undefined = undefined; + try { + if (requestOptions?.extraBodyProperties && typeof init.body === "string") { + const parsedBody = JSON.parse(init.body); + updatedBody = JSON.stringify({ + ...parsedBody, + ...requestOptions.extraBodyProperties, + }); + } + } catch (e) { + console.log("Unable to parse HTTP request body: ", e); + } + + // fetch the request with the provided options + let resp = fetch(url, { + ...init, + body: updatedBody ?? init.body, + headers: headers, + agent: agent, + }); + + return resp; +} diff --git a/core/util/filesystem.ts b/core/util/filesystem.ts index 3753c35d9..18499451d 100644 --- a/core/util/filesystem.ts +++ b/core/util/filesystem.ts @@ -1,32 +1,51 @@ import * as fs from "fs"; -import { ContinueRcJson, IDE, IdeInfo, IndexTag, Problem, Range, Thread } from ".."; +import { + ContinueRcJson, + IDE, + IdeInfo, + IndexTag, + Problem, + Range, + Thread, +} from ".."; import { getContinueGlobalPath } from "./paths"; class FileSystemIde implements IDE { + getRepoName(dir: string): Promise { + return Promise.resolve(undefined); + } + getTags(artifactId: string): Promise { return Promise.resolve([]); } + getIdeInfo(): Promise { return Promise.resolve({ ideType: "vscode", name: "na", version: "0.1", remoteName: "na", + extensionVersion: "na", }); } + readRangeInFile(filepath: string, range: Range): Promise { return Promise.resolve(""); } + getStats(directory: string): Promise<{ [path: string]: number }> { return Promise.resolve({}); } + isTelemetryEnabled(): Promise { return Promise.resolve(false); } + getUniqueId(): Promise { return Promise.resolve("NOT_UNIQUE"); } + getWorkspaceConfigs(): Promise { return Promise.resolve([]); } @@ -34,28 +53,34 @@ class FileSystemIde implements IDE { getDiff(): Promise { return Promise.resolve(""); } + getTerminalContents(): Promise { return Promise.resolve(""); } + async getDebugLocals(threadIndex: number): Promise { return Promise.resolve(""); } + async getTopLevelCallStackSources( threadIndex: number, - stackDepth: number + stackDepth: number, ): Promise { return Promise.resolve([]); } + async getAvailableThreads(): Promise { return Promise.resolve([]); } + showLines( filepath: string, startLine: number, - endLine: number + endLine: number, ): Promise { return Promise.resolve(); } + listWorkspaceContents(): Promise { return new Promise((resolve, reject) => { fs.readdir("/tmp/continue", (err, files) => { @@ -66,6 +91,7 @@ class FileSystemIde implements IDE { }); }); } + getWorkspaceDirs(): Promise { return new Promise((resolve, reject) => { fs.mkdtemp("/tmp/continue", (err, folder) => { @@ -76,9 +102,11 @@ class FileSystemIde implements IDE { }); }); } + listFolders(): Promise { return Promise.resolve([]); } + writeFile(path: string, contents: string): Promise { return new Promise((resolve, reject) => { fs.writeFile(path, contents, (err) => { @@ -89,21 +117,27 @@ class FileSystemIde implements IDE { }); }); } + showVirtualFile(title: string, contents: string): Promise { return Promise.resolve(); } + getContinueDir(): Promise { return Promise.resolve(getContinueGlobalPath()); } + openFile(path: string): Promise { return Promise.resolve(); } + runCommand(command: string): Promise { return Promise.resolve(); } + saveFile(filepath: string): Promise { return Promise.resolve(); } + readFile(filepath: string): Promise { return new Promise((resolve, reject) => { fs.readFile(filepath, "utf8", (err, contents) => { @@ -114,10 +148,11 @@ class FileSystemIde implements IDE { }); }); } + showDiff( filepath: string, newContents: string, - stepIndex: number + stepIndex: number, ): Promise { return Promise.resolve(); } diff --git a/core/util/index.ts b/core/util/index.ts index e92634483..083547025 100644 --- a/core/util/index.ts +++ b/core/util/index.ts @@ -1,6 +1,3 @@ -import Handlebars from "handlebars"; -import { ChatMessage } from ".."; - export function removeQuotesAndEscapes(output: string): string { output = output.trim(); @@ -92,34 +89,6 @@ export function dedentAndGetCommonWhitespace(s: string): [string, string] { return [lines.map((x) => x.replace(lcp, "")).join("\n"), lcp]; } -export type PromptTemplate = - | string - | (( - history: ChatMessage[], - otherData: Record, - ) => string | ChatMessage[]); - -export function renderPromptTemplate( - template: PromptTemplate, - history: ChatMessage[], - otherData: Record, -): string | ChatMessage[] { - if (typeof template === "string") { - let data: any = { - history: history, - ...otherData, - }; - if (history.length > 0 && history[0].role == "system") { - data["system_message"] = history.shift()!.content; - } - - const compiledTemplate = Handlebars.compile(template); - return compiledTemplate(data); - } else { - return template(history, otherData); - } -} - export function getBasename(filepath: string, n: number = 1): string { return filepath.split(/[\\/]/).pop() ?? ""; } @@ -190,3 +159,18 @@ export function copyOf(obj: any): any { if (obj === null || obj === undefined) return obj; return JSON.parse(JSON.stringify(obj)); } + +export function deduplicateArray( + array: T[], + equal: (a: T, b: T) => boolean, +): T[] { + const result: T[] = []; + + for (const item of array) { + if (!result.some((existingItem) => equal(existingItem, item))) { + result.push(item); + } + } + + return result; +} diff --git a/core/util/messageIde.ts b/core/util/messageIde.ts index cfcaded5a..31f9e34d2 100644 --- a/core/util/messageIde.ts +++ b/core/util/messageIde.ts @@ -1,27 +1,44 @@ -import { ContinueRcJson, IDE, IdeInfo, IndexTag, Problem, Range, Thread } from ".."; +import { + ContinueRcJson, + IDE, + IdeInfo, + IndexTag, + Problem, + Range, + Thread, +} from ".."; export class MessageIde implements IDE { constructor( - private readonly request: (messageType: string, data: any) => Promise + private readonly request: (messageType: string, data: any) => Promise, ) {} + + getRepoName(dir: string): Promise { + return this.request("getRepoName", { dir }); + } + getDebugLocals(threadIndex: number): Promise { return this.request("getDebugLocals", { threadIndex }); } + getTopLevelCallStackSources( threadIndex: number, - stackDepth: number + stackDepth: number, ): Promise { return this.request("getTopLevelCallStackSources", { threadIndex, stackDepth, }); } + getAvailableThreads(): Promise { return this.request("getAvailableThreads", undefined); } + getTags(artifactId: string): Promise { return this.request("getTags", artifactId); } + getIdeInfo(): Promise { return this.request("getIdeInfo", undefined); } @@ -29,9 +46,11 @@ export class MessageIde implements IDE { readRangeInFile(filepath: string, range: Range): Promise { return this.request("readRangeInFile", { filepath, range }); } + getStats(directory: string): Promise<{ [path: string]: number }> { throw new Error("Method not implemented."); } + isTelemetryEnabled(): Promise { return this.request("isTelemetryEnabled", undefined); } @@ -63,7 +82,7 @@ export class MessageIde implements IDE { async showLines( filepath: string, startLine: number, - endLine: number + endLine: number, ): Promise { return await this.request("showLines", { filepath, startLine, endLine }); } @@ -108,7 +127,7 @@ export class MessageIde implements IDE { async showDiff( filepath: string, newContents: string, - stepIndex: number + stepIndex: number, ): Promise { await this.request("showDiff", { filepath, newContents, stepIndex }); } diff --git a/core/autocomplete/parameters.ts b/core/util/parameters.ts similarity index 61% rename from core/autocomplete/parameters.ts rename to core/util/parameters.ts index 4940a6710..86f3e1b34 100644 --- a/core/autocomplete/parameters.ts +++ b/core/util/parameters.ts @@ -1,7 +1,8 @@ import { TabAutocompleteOptions } from ".."; export const DEFAULT_AUTOCOMPLETE_OPTS: TabAutocompleteOptions = { - useCopyBuffer: true, + disable: false, + useCopyBuffer: false, useSuffix: true, maxPromptTokens: 500, prefixPercentage: 0.85, @@ -16,3 +17,13 @@ export const DEFAULT_AUTOCOMPLETE_OPTS: TabAutocompleteOptions = { onlyMyCode: true, useOtherFiles: false, }; + +export const RETRIEVAL_PARAMS = { + rerankThreshold: 0.3, + nFinal: 10, + nRetrieve: 20, + bm25Threshold: -2.5, +}; + +// export const SERVER_URL = "http://localhost:3000"; +export const SERVER_URL = "https://proxy-server-green-l6vsfbzhba-uw.a.run.app"; diff --git a/core/util/posthog.ts b/core/util/posthog.ts index 6373ec2ce..071654372 100644 --- a/core/util/posthog.ts +++ b/core/util/posthog.ts @@ -1,13 +1,21 @@ +import os from "os"; + export class Telemetry { // Set to undefined whenever telemetry is disabled static client: any = undefined; static uniqueId: string = "NOT_UNIQUE"; + static os: string | undefined = undefined; + static extensionVersion: string | undefined = undefined; - static async capture(event: string, properties: any) { + static async capture(event: string, properties: { [key: string]: any }) { Telemetry.client?.capture({ distinctId: Telemetry.uniqueId, event, - properties, + properties: { + ...properties, + os: Telemetry.os, + extensionVersion: Telemetry.extensionVersion, + }, }); } @@ -15,8 +23,15 @@ export class Telemetry { Telemetry.client?.shutdown(); } - static async setup(allow: boolean, uniqueId: string) { + static async setup( + allow: boolean, + uniqueId: string, + extensionVersion: string, + ) { Telemetry.uniqueId = uniqueId; + Telemetry.os = os.platform(); + Telemetry.extensionVersion = extensionVersion; + if (!allow) { Telemetry.client = undefined; } else { diff --git a/core/util/verticalEdit.ts b/core/util/verticalEdit.ts index 1cbe6936d..341b847ee 100644 --- a/core/util/verticalEdit.ts +++ b/core/util/verticalEdit.ts @@ -4,23 +4,27 @@ import { filterEnglishLinesAtEnd, filterEnglishLinesAtStart, filterLeadingAndTrailingNewLineInsertion, - fixCodeLlamaFirstLineIndentation, + stopAtLines, } from "../autocomplete/lineStream"; import { streamDiff } from "../diff/streamDiff"; import { streamLines } from "../diff/util"; import { gptEditPrompt } from "../llm/templates/edit"; -import { dedentAndGetCommonWhitespace, renderPromptTemplate } from "../util"; +import { Telemetry } from "./posthog"; function constructPrompt( - codeToEdit: string, + prefix: string, + highlighted: string, + suffix: string, llm: ILLM, userInput: string, language: string | undefined, ): string | ChatMessage[] { const template = llm.promptTemplates?.edit ?? gptEditPrompt; - return renderPromptTemplate(template, [], { + return llm.renderPromptTemplate(template, [], { userInput, - codeToEdit, + prefix, + codeToEdit: highlighted, + suffix, language: language ?? "", }); } @@ -42,37 +46,62 @@ function modelIsInept(model: string): boolean { } export async function* streamDiffLines( - oldCode: string, + prefix: string, + highlighted: string, + suffix: string, llm: ILLM, input: string, language: string | undefined, ): AsyncGenerator { + Telemetry.capture("inlineEdit", { + model: llm.model, + provider: llm.providerName, + }); + // Strip common indentation for the LLM, then add back after generation - const [withoutIndentation, commonIndentation] = - dedentAndGetCommonWhitespace(oldCode); - oldCode = withoutIndentation; - const oldLines = oldCode.split("\n"); - const prompt = constructPrompt(oldCode, llm, input, language); + let oldLines = + highlighted.length > 0 + ? highlighted.split("\n") + : // When highlighted is empty, we need to combine last line of prefix and first line of suffix to determine the line being edited + [(prefix + suffix).split("\n")[prefix.split("\n").length - 1]]; + + // But if that line is empty, we can assume we are insertion-only + if (oldLines.length === 1 && oldLines[0].trim() === "") { + oldLines = []; + } + + const prompt = constructPrompt( + prefix, + highlighted, + suffix, + llm, + input, + language, + ); const inept = modelIsInept(llm.model); const completion = typeof prompt === "string" - ? llm.streamComplete(prompt) + ? llm.streamComplete(prompt, { raw: true }) : llm.streamChat(prompt); let lines = streamLines(completion); - if (inept) { - lines = filterEnglishLinesAtStart(lines); - } + lines = filterEnglishLinesAtStart(lines); lines = filterCodeBlockLines(lines); + lines = stopAtLines(lines); if (inept) { - lines = filterEnglishLinesAtEnd(fixCodeLlamaFirstLineIndentation(lines)); + // lines = fixCodeLlamaFirstLineIndentation(lines); + lines = filterEnglishLinesAtEnd(lines); } let diffLines = streamDiff(oldLines, lines); - diffLines = addIndentation(diffLines, commonIndentation); diffLines = filterLeadingAndTrailingNewLineInsertion(diffLines); + if (highlighted.length === 0) { + const line = prefix.split("\n").slice(-1)[0]; + const indentation = line.slice(0, line.length - line.trimStart().length); + diffLines = addIndentation(diffLines, indentation); + } for await (let diffLine of diffLines) { yield diffLine; diff --git a/core/web/webviewProtocol.ts b/core/web/webviewProtocol.ts index 217bdf856..b5b5c6aaf 100644 --- a/core/web/webviewProtocol.ts +++ b/core/web/webviewProtocol.ts @@ -73,6 +73,7 @@ export type WebviewProtocol = Protocol & errorPopup: [{ message: string }, void]; "index/setPaused": [boolean, void]; + "index/forceReIndex": [undefined, void]; openUrl: [string, void]; applyToCurrentFile: [{ text: string }, void]; showTutorial: [undefined, void]; @@ -85,6 +86,20 @@ export type WebviewProtocol = Protocol & toggleFullScreen: [undefined, void]; "stats/getTokensPerDay": [undefined, { day: string; tokens: number }[]]; "stats/getTokensPerModel": [undefined, { model: string; tokens: number }[]]; + insertAtCursor: [{ text: string }, void]; + copyText: [{ text: string }, void]; + "jetbrains/editorInsetHeight": [{ height: number }, void]; + completeOnboarding: [ + { + mode: + | "local" + | "optimized" + | "custom" + | "localExistingUser" + | "optimizedExistingUser"; + }, + void, + ]; }; export type ReverseWebviewProtocol = { @@ -117,4 +132,5 @@ export type ReverseWebviewProtocol = { refreshSubmenuItems: [undefined, void]; setTheme: [{ theme: any }, void]; setColors: [{ [key: string]: string }, void]; + "jetbrains/editorInsetRefresh": [undefined, void]; }; diff --git a/core/yarn.lock b/core/yarn.lock index 795d82637..fe19c35ee 100644 --- a/core/yarn.lock +++ b/core/yarn.lock @@ -3044,7 +3044,7 @@ ieee754@^1.1.13, ieee754@^1.2.1: resolved "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz" integrity sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA== -ignore@^5.2.0: +ignore@^5.2.0, ignore@^5.3.1: version "5.3.1" resolved "https://registry.npmjs.org/ignore/-/ignore-5.3.1.tgz" integrity sha512-5Fytz/IraMjqpwfd34ke28PTVMjZjJG2MPn5t7OE4eUCUNf8BAa7b5WUS9/Qvr6mwOQS7Mk6vdsMno5he+T8Xw== @@ -5730,7 +5730,7 @@ v8-to-istanbul@^9.0.1: "@types/istanbul-lib-coverage" "^2.0.1" convert-source-map "^2.0.0" -vectordb@^0.4.12: +vectordb@0.4.12: version "0.4.12" resolved "https://registry.npmjs.org/vectordb/-/vectordb-0.4.12.tgz" integrity sha512-H2mFwZ87d3BcuX4yGx5RoW06amRZQ3W5u/FRTNc86rwVINuEEa+Ivsqng1i8hURHXoTDbF/0Y9qwCshySkeznQ== diff --git a/docs/docs/model-setup/configuration.md b/docs/docs/model-setup/configuration.md index b1a35f56a..c378c7b01 100644 --- a/docs/docs/model-setup/configuration.md +++ b/docs/docs/model-setup/configuration.md @@ -167,7 +167,7 @@ export function modifyConfig(config: Config): Config { title: "My Custom LLM", model: "mistral-7b", }, - streamComplete: async function* (prompt, options) { + streamCompletion: async function* (prompt: string, options: CompletionOptions) { // Make the API call here // Then yield each part of the completion as it is streamed @@ -178,5 +178,6 @@ export function modifyConfig(config: Config): Config { } }, }); + return config; } ``` diff --git a/docs/docs/reference/Model Providers/bedrock.md b/docs/docs/reference/Model Providers/bedrock.md new file mode 100644 index 000000000..daac562af --- /dev/null +++ b/docs/docs/reference/Model Providers/bedrock.md @@ -0,0 +1,26 @@ +# AWS Bedrock + +To setup Bedrock, add the following to your `config.json` file: + +```json title="~/.continue/config.json" +{ + "models": [ + { + "title": "Bedrock: Claude 3 Sonnet", + "provider": "bedrock", + "model": "anthropic.claude-3-sonnet-20240229-v1:0", + "region": "us-east-1" + } + ] +} +``` + +Authentication will be through temporary or long-term credentials in +~/.aws/credentials under a profile called "bedrock". + +```title="~/.aws/credentials +[bedrock] +aws_access_key_id = abcdefg +aws_secret_access_key = hijklmno +aws_session_token = pqrstuvwxyz # Optional: means short term creds. +``` diff --git a/docs/docs/walkthroughs/tab-autocomplete.md b/docs/docs/walkthroughs/tab-autocomplete.md index 523b05ba0..52a2f65c8 100644 --- a/docs/docs/walkthroughs/tab-autocomplete.md +++ b/docs/docs/walkthroughs/tab-autocomplete.md @@ -78,6 +78,7 @@ This object allows you to customize the behavior of tab-autocomplete. The availa - `multilineCompletions`: Whether to enable multiline completions ("always", "never", or "auto"). Defaults to "auto". - `useCache`: Whether to cache and reuse completions when the prompt is the same as a previous one. May be useful to disable for testing purposes. - `useOtherFiles`: Whether to include context from files outside of the current one. Turning this off should be expected to reduce the accuracy of completions, but might be good for testing. +- `disable`: Disable autocomplete (can also be done from IDE settings) ### Full example diff --git a/docs/static/schemas/config.json b/docs/static/schemas/config.json index a8c88a803..fff595834 100644 --- a/docs/static/schemas/config.json +++ b/docs/static/schemas/config.json @@ -6,6 +6,12 @@ "title": "BaseCompletionOptions", "type": "object", "properties": { + "stream": { + "title": "Stream", + "description": "Whether to stream the LLM response. Currently only respected by the 'anthropic' provider. Otherwise will always stream.", + "type": "boolean", + "default": true + }, "temperature": { "title": "Temperature", "description": "The temperature of the completion.", @@ -128,6 +134,7 @@ "openai", "free-trial", "anthropic", + "bedrock", "together", "ollama", "huggingface-tgi", @@ -139,12 +146,14 @@ "llamafile", "mistral", "deepinfra", - "flowise" + "flowise", + "groq" ], "markdownEnumDescriptions": [ "### OpenAI\nUse gpt-4, gpt-3.5-turbo, or any other OpenAI model. See [here](https://openai.com/product#made-for-developers) to obtain an API key.\n\n> [Reference](https://continue.dev/docs/reference/Model%20Providers/openai)", "### Free Trial\nNew users can try out Continue for free using a proxy server that securely makes calls to OpenAI using our API key. If you are ready to use your own API key or have used all 250 free uses, you can enter your API key in config.py where it says `apiKey=\"\"` or select another model provider.\n> [Reference](https://continue.dev/docs/reference/Model%20Providers/freetrial)", "### Anthropic\nTo get started with Anthropic models, you first need to sign up for the open beta [here](https://claude.ai/login) to obtain an API key.\n> [Reference](https://continue.dev/docs/reference/Model%20Providers/anthropicllm)", + "### Bedrock\nTo get started with Bedrock you need to sign up on AWS [here](https://aws.amazon.com/bedrock/claude/)", "### Together\nTogether is a hosted service that provides extremely fast streaming of open-source language models. To get started with Together:\n1. Obtain an API key from [here](https://together.ai)\n2. Paste below\n3. Select a model preset\n> [Reference](https://continue.dev/docs/reference/Model%20Providers/togetherllm)", "### Ollama\nTo get started with Ollama, follow these steps:\n1. Download from [ollama.ai](https://ollama.ai/) and open the application\n2. Open a terminal and run `ollama run `. Example model names are `codellama:7b-instruct` or `llama2:7b-text`. You can find the full list [here](https://ollama.ai/library).\n3. Make sure that the model name used in step 2 is the same as the one in config.py (e.g. `model=\"codellama:7b-instruct\"`)\n4. Once the model has finished downloading, you can start asking questions through Continue.\n> [Reference](https://continue.dev/docs/reference/Model%20Providers/ollama)", "### Huggingface TGI\n\n> [Reference](https://continue.dev/docs/reference/Model%20Providers/huggingfacetgi)", @@ -430,6 +439,7 @@ "claude-3-opus-20240229", "claude-3-sonnet-20240229", "claude-3-haiku-20240307", + "starcoder-7b", "AUTODETECT" ] } @@ -484,6 +494,7 @@ "stable-code-3b", "starcoder-1b", "starcoder-3b", + "starcoder2-3b", "mistral-tiny", "mistral-small", "mistral-medium", @@ -529,6 +540,34 @@ } } }, + { + "if": { + "properties": { + "provider": { + "enum": ["bedrock"] + } + }, + "required": ["provider"] + }, + "then": { + "properties": { + "model": { + "anyOf": [ + { + "enum": [ + "claude-3-sonnet-20240229", + "claude-3-haiku-20240307", + "claude-2" + ] + }, + { + "type": "string" + } + ] + } + } + } + }, { "if": { "properties": { @@ -639,7 +678,8 @@ "deepseek-1b", "stable-code-3b", "starcoder-1b", - "starcoder-3b" + "starcoder-3b", + "starcoder2-3b" ] }, { @@ -686,6 +726,7 @@ "stable-code-3b", "starcoder-1b", "starcoder-3b", + "starcoder2-3b", "AUTODETECT" ] }, @@ -715,6 +756,23 @@ } } }, + { + "if": { + "properties": { + "provider": { + "enum": ["groq"] + } + }, + "required": ["provider"] + }, + "then": { + "properties": { + "model": { + "enum": ["llama2-70b", "mistral-8x7b", "gemma"] + } + } + } + }, { "if": { "properties": { @@ -876,7 +934,8 @@ "deepseek-1b", "stable-code-3b", "starcoder-1b", - "starcoder-3b" + "starcoder-3b", + "starcoder2-3b" ] }, { @@ -932,7 +991,8 @@ "edit", "comment", "http", - "commit" + "commit", + "review" ], "type": "string", "markdownEnumDescriptions": [ @@ -943,7 +1003,8 @@ "Edit the highlighted code with given instructions", "Add comments to the highlighted code", "Write a custom slash command at your own HTTP endpoint. Set 'url' in the params object for the endpoint you have setup.", - "Generate a commit message for the current changes" + "Generate a commit message for the current changes", + "Review code and give feedback" ] }, { @@ -1314,9 +1375,26 @@ "apiVersion": { "type": "integer", "markdownDescription": "This context provider supports both Jira API version 2 and 3. It will use version 3 by default since that's what the cloud version uses, but if you have the datacenter version of Jira, you'll need to set the API Version to 2 using the `apiVersion` property." + }, + "requestOptions": { + "title": "Request Options", + "description": "Options for the HTTPS request to Jira.", + "default": { + "timeout": 7200, + "verifySsl": null, + "caBundlePath": null, + "proxy": null, + "headers": null, + "extraBodyProperties": null + }, + "allOf": [ + { + "$ref": "#/definitions/RequestOptions" + } + ] } }, - "required": ["domain", "email", "token"] + "required": ["domain", "token"] } }, "required": ["params"] @@ -1559,7 +1637,7 @@ "type": "object", "properties": { "provider": { - "enum": ["transformers.js", "ollama", "openai"] + "enum": ["transformers.js", "ollama", "openai", "free-trial"] }, "model": { "type": "string" @@ -1588,9 +1666,74 @@ } ] }, + "reranker": { + "title": "Reranker", + "markdownDescription": "The reranker is responsible for selecting the final results when retrieving snippets from your codebase.", + "type": "object", + "properties": { + "name": { + "enum": ["voyage", "llm", "free-trial"] + }, + "params": { + "type": "object" + } + }, + "required": ["name"], + "allOf": [ + { + "if": { + "properties": { + "name": { + "enum": ["llm"] + } + }, + "required": ["name"] + }, + "then": { + "properties": { + "params": { + "type": "object", + "properties": { + "modelTitle": { + "type": "string" + } + }, + "required": ["modelTitle"] + } + } + } + }, + { + "if": { + "properties": { + "name": { + "enum": ["voyage"] + } + }, + "required": ["name"] + }, + "then": { + "properties": { + "params": { + "type": "object", + "properties": { + "apiKey": { + "type": "string" + }, + "model": { + "enum": ["rerank-lite-1"] + } + }, + "required": ["apiKey"] + } + } + } + } + ] + }, "tabAutocompleteModel": { "title": "Tab Autocomplete Model", - "markdownDescription": "The model used for tab autocompletion. If undefined, Continue will default to using starcoder:3b on a local Ollama instance.\n\n*IMPORTANT*:\n\nIf you use a custom model, ensure that it is one trained for fill-in-the-middle completions. An instruct model is typically not well-suited to autocomplete and you may receive unsatisfactory completions.", + "markdownDescription": "The model used for tab autocompletion. If undefined, Continue will default to using starcoder2:3b on a local Ollama instance.\n\n*IMPORTANT*:\n\nIf you use a custom model, ensure that it is one trained for fill-in-the-middle completions. An instruct model is typically not well-suited to autocomplete and you may receive unsatisfactory completions.", "default": { "title": "Tab Autocomplete Model", "provider": "ollama", @@ -1603,6 +1746,11 @@ "type": "object", "markdownDescription": "These options let you customize your tab-autocomplete experience. Read about all options in [the docs](https://continue.dev/docs/walkthroughs/tab-autocomplete#configuration-options).", "properties": { + "disable": { + "type": "boolean", + "description": "Disable tab autocomplete. This can also be done from the IDE settings.", + "default": false + }, "useCopyBuffer": { "type": "boolean", "description": "Determines whether the copy buffer will be considered when contructing the prompt." @@ -1649,6 +1797,48 @@ } }, "required": [] + }, + "ui": { + "type": "object", + "properties": { + "codeBlockToolbarPosition": { + "enum": ["top", "bottom"], + "default": "top", + "description": "Whether to show the copy and apply code buttons at the top or bottom of code blocks in the sidebar." + } + } + }, + "experimental": { + "type": "object", + "title": "Experimental", + "description": "Experimental properties are subject to change.", + "properties": { + "contextMenuPrompts": { + "type": "object", + "properties": { + "comment": { + "type": "string", + "default": "Write comments for this code. Do not change anything about the code itself." + }, + "docstring": { + "type": "string", + "default": "Write a docstring for this code. Do not change anything about the code itself." + }, + "fix": { + "type": "string", + "default": "Fix this code" + }, + "optimize": { + "type": "string", + "default": "Optimize this code" + }, + "fixGrammar": { + "type": "string", + "default": "If there are any grammar or spelling mistakes in this writing, fix them. Do not make other large changes to the writing." + } + } + } + } } } } diff --git a/extensions/intellij/build.gradle.kts b/extensions/intellij/build.gradle.kts index 034edeef4..d801ee4b4 100644 --- a/extensions/intellij/build.gradle.kts +++ b/extensions/intellij/build.gradle.kts @@ -80,7 +80,7 @@ koverReport { tasks { prepareSandbox { - from("../../pkg/bin") { + from("../../binary/bin") { into("${intellij.pluginName.get()}/core/") } } diff --git a/extensions/intellij/gradle.properties b/extensions/intellij/gradle.properties index 65089e0f9..fc276a336 100644 --- a/extensions/intellij/gradle.properties +++ b/extensions/intellij/gradle.properties @@ -4,7 +4,7 @@ pluginGroup = com.github.continuedev.continueintellijextension pluginName = continue-intellij-extension pluginRepositoryUrl = https://github.com/continuedev/continue # SemVer format -> https://semver.org -pluginVersion = 0.0.39 +pluginVersion = 0.0.42 # Supported build number ranges and IntelliJ Platform versions -> https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html pluginSinceBuild = 223 diff --git a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/actions/ContinuePluginActions.kt b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/actions/ContinuePluginActions.kt index 3e1aaa1d5..ee325ba89 100644 --- a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/actions/ContinuePluginActions.kt +++ b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/actions/ContinuePluginActions.kt @@ -1,11 +1,15 @@ package com.github.continuedev.continueintellijextension.actions +import com.github.continuedev.continueintellijextension.editor.DiffStreamService import com.github.continuedev.continueintellijextension.services.ContinuePluginService import com.google.gson.Gson import com.intellij.openapi.actionSystem.AnAction import com.intellij.openapi.actionSystem.AnActionEvent +import com.intellij.openapi.actionSystem.PlatformDataKeys import com.intellij.openapi.components.ServiceManager - import com.intellij.openapi.ui.DialogWrapper +import com.intellij.openapi.components.service +import com.intellij.openapi.fileEditor.FileEditorManager +import com.intellij.openapi.ui.DialogWrapper import com.intellij.openapi.ui.Messages import com.intellij.openapi.wm.ToolWindowManager import java.awt.Dimension @@ -25,16 +29,40 @@ fun pluginServiceFromActionEvent(e: AnActionEvent): ContinuePluginService? { class AcceptDiffAction : AnAction() { override fun actionPerformed(e: AnActionEvent) { + acceptHorizontalDiff(e) + acceptVerticalDiff(e) + } + + private fun acceptHorizontalDiff(e: AnActionEvent) { val continuePluginService = pluginServiceFromActionEvent(e) ?: return continuePluginService.ideProtocolClient?.diffManager?.acceptDiff(null) } + + private fun acceptVerticalDiff(e: AnActionEvent) { + val project = e.project ?: return + val editor = e.getData(PlatformDataKeys.EDITOR) ?: FileEditorManager.getInstance(project).selectedTextEditor ?: return + val diffStreamService = project.service() + diffStreamService.accept(editor) + } } class RejectDiffAction : AnAction() { override fun actionPerformed(e: AnActionEvent) { + rejectHorizontalDiff(e) + rejectVerticalDiff(e) + } + + private fun rejectHorizontalDiff(e: AnActionEvent) { val continuePluginService = pluginServiceFromActionEvent(e) ?: return continuePluginService.ideProtocolClient?.diffManager?.rejectDiff(null) } + + private fun rejectVerticalDiff(e: AnActionEvent) { + val project = e.project ?: return + val editor = e.getData(PlatformDataKeys.EDITOR) ?: FileEditorManager.getInstance(project).selectedTextEditor ?: return + val diffStreamService = project.service() + diffStreamService.reject(editor) + } } diff --git a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/activities/ContinuePluginStartupActivity.kt b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/activities/ContinuePluginStartupActivity.kt index b14a3e357..23b1ac8c0 100644 --- a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/activities/ContinuePluginStartupActivity.kt +++ b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/activities/ContinuePluginStartupActivity.kt @@ -237,7 +237,7 @@ class ContinuePluginStartupActivity : StartupActivity, Disposable, DumbAware { val corePath = Paths.get(pluginPath.toString(), "core").toString() val targetPath = Paths.get(corePath, target).toString() - val continueCorePath = Paths.get(targetPath, "pkg" + (if (os == "win32") ".exe" else "")).toString() + val continueCorePath = Paths.get(targetPath, "continue-binary" + (if (os == "win32") ".exe" else "")).toString() // Copy targetPath / node_sqlite3.node to core / node_sqlite3.node val nodeSqlite3Path = Paths.get(targetPath, "node_sqlite3.node") @@ -253,7 +253,7 @@ class ContinuePluginStartupActivity : StartupActivity, Disposable, DumbAware { // esbuild needs permissions val esbuildPath = Paths.get(targetPath, "esbuild"+ (if (os == "win32") ".exe" else "")).toString() - val coreMessenger = CoreMessenger(esbuildPath, continueCorePath, ideProtocolClient); + val coreMessenger = CoreMessenger(project, esbuildPath, continueCorePath, ideProtocolClient); continuePluginService.coreMessenger = coreMessenger } } diff --git a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/autocomplete/AutocompleteService.kt b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/autocomplete/AutocompleteService.kt index 2c9a5c874..4c06ebcf0 100644 --- a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/autocomplete/AutocompleteService.kt +++ b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/autocomplete/AutocompleteService.kt @@ -4,11 +4,6 @@ import com.github.continuedev.continueintellijextension.`continue`.uuid import com.github.continuedev.continueintellijextension.services.ContinueExtensionSettings import com.github.continuedev.continueintellijextension.services.ContinuePluginService import com.google.gson.Gson -import com.intellij.codeInsight.AutoPopupController -import com.intellij.codeInsight.lookup.LookupManager -import com.intellij.codeInsight.lookup.impl.LookupImpl -import com.intellij.openapi.actionSystem.ActionManager -import com.intellij.openapi.actionSystem.AnActionEvent import com.intellij.openapi.application.ApplicationManager import com.intellij.openapi.application.WriteAction import com.intellij.openapi.application.invokeLater @@ -95,6 +90,13 @@ class AutocompleteService(private val project: Project) { } else { editor.inlayModel.addInlineElement(offset, properties, ContinueCustomElementRenderer(editor, text)) } + +// val attributes = TextAttributes().apply { +// backgroundColor = JBColor.GREEN +// } +// val key = TextAttributesKey.createTextAttributesKey("CONTINUE_AUTOCOMPLETE") +// key.let { editor.colorsScheme.setAttributes(it, attributes) } +// editor.markupModel.addLineHighlighter(key, editor.caretModel.logicalPosition.line, HighlighterLayer.LAST) } } } diff --git a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/CoreMessenger.kt b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/CoreMessenger.kt index bd9f2f676..17abff486 100644 --- a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/CoreMessenger.kt +++ b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/CoreMessenger.kt @@ -1,4 +1,5 @@ package com.github.continuedev.continueintellijextension.`continue` +import com.github.continuedev.continueintellijextension.services.ContinuePluginService import java.io.BufferedReader import java.io.InputStreamReader import java.io.OutputStreamWriter @@ -6,12 +7,15 @@ import java.io.OutputStreamWriter import java.io.* import com.google.gson.Gson +import com.intellij.openapi.components.ServiceManager +import com.intellij.openapi.components.service +import com.intellij.openapi.project.Project import java.nio.charset.StandardCharsets import java.nio.file.Files import java.nio.file.Paths import java.nio.file.attribute.PosixFilePermission -class CoreMessenger(esbuildPath: String, continueCorePath: String, ideProtocolClient: IdeProtocolClient) { +class CoreMessenger(private val project: Project, esbuildPath: String, continueCorePath: String, ideProtocolClient: IdeProtocolClient) { private val writer: OutputStreamWriter private val reader: BufferedReader private val process: Process @@ -60,6 +64,12 @@ class CoreMessenger(esbuildPath: String, continueCorePath: String, ideProtocolCl }; } + // Forward to webview + if (forwardToWebview.contains(messageType)) { + val continuePluginService = project.service() + continuePluginService.sendToWebview(messageType, data, messageType) + } + // Responses for messageId responseListeners[messageId]?.let { listener -> listener(data) @@ -79,7 +89,8 @@ class CoreMessenger(esbuildPath: String, continueCorePath: String, ideProtocolCl private val generatorTypes = listOf( "llm/streamComplete", "llm/streamChat", - "command/run" + "command/run", + "streamDiffLines" ) private val ideMessageTypes = listOf( @@ -109,6 +120,11 @@ class CoreMessenger(esbuildPath: String, continueCorePath: String, ideProtocolCl "getBranch", "getIdeInfo", "getIdeSettings", + "errorPopup" + ) + + private val forwardToWebview = listOf( + "configUpdate" ) private fun setPermissions(destination: String) { @@ -147,7 +163,7 @@ class CoreMessenger(esbuildPath: String, continueCorePath: String, ideProtocolCl val outputStream = process.outputStream val inputStream = process.inputStream - writer = OutputStreamWriter(outputStream) + writer = OutputStreamWriter(outputStream, StandardCharsets.UTF_8) reader = BufferedReader(InputStreamReader(inputStream, StandardCharsets.UTF_8)) process.onExit().thenRun { diff --git a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/Diffs.kt b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/Diffs.kt index d05a7ff96..a059a6ae4 100644 --- a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/Diffs.kt +++ b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/Diffs.kt @@ -1,6 +1,7 @@ package com.github.continuedev.continueintellijextension.`continue` import com.github.continuedev.continueintellijextension.services.ContinuePluginService +import com.github.continuedev.continueintellijextension.utils.getAltKeyLabel import com.intellij.diff.DiffContentFactory import com.intellij.diff.DiffManager import com.intellij.diff.DiffRequestPanel @@ -27,7 +28,7 @@ import javax.swing.JComponent fun getDiffDirectory(): File { val homeDirectory = System.getProperty("user.home") - val diffDirPath = Paths.get(homeDirectory).resolve(".continue").resolve("diffs").toString() + val diffDirPath = Paths.get(homeDirectory).resolve(".continue").resolve(".diffs").toString() val diffDir = File(diffDirPath) if (!diffDir.exists()) { diffDir.mkdirs() @@ -174,11 +175,10 @@ class DiffManager(private val project: Project): DumbAware { override fun createActions(): Array { val okAction = getOKAction() - val cmdCtrl = if (System.getProperty("os.name").toLowerCase().contains("mac")) "⌘" else "⌃" - okAction.putValue(Action.NAME, "Accept ($cmdCtrl ⇧ ⏎)") + okAction.putValue(Action.NAME, "Accept (${getAltKeyLabel()} ⇧ Y)") val cancelAction = getCancelAction() - cancelAction.putValue(Action.NAME, "Reject ($cmdCtrl ⇧ ⌫)") + cancelAction.putValue(Action.NAME, "Reject (${getAltKeyLabel()} ⇧ N)") return arrayOf(okAction, cancelAction) } diff --git a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/GetTheme.kt b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/GetTheme.kt index eafcc6a35..63c776e4b 100644 --- a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/GetTheme.kt +++ b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/GetTheme.kt @@ -5,11 +5,40 @@ import com.intellij.openapi.editor.colors.EditorColors import com.intellij.openapi.editor.colors.EditorColorsManager import com.intellij.openapi.editor.colors.EditorColorsScheme import com.intellij.openapi.editor.colors.TextAttributesKey +import java.awt.Color import kotlin.math.max import kotlin.math.min class GetTheme { + fun getSecondaryDark(): Color { + val globalScheme = EditorColorsManager.getInstance().globalScheme + val defaultBackground = globalScheme.defaultBackground + val grayscale = (defaultBackground.red * 0.3 + defaultBackground.green * 0.59 + defaultBackground.blue * 0.11).toInt() + + val adjustedRed: Int + val adjustedGreen: Int + val adjustedBlue: Int + + val tint: Int = 20 + if (grayscale > 128) { // if closer to white + adjustedRed = max(0, defaultBackground.red - tint) + adjustedGreen = max(0, defaultBackground.green - tint) + adjustedBlue = max(0, defaultBackground.blue - tint) + } else { // if closer to black + adjustedRed = min(255, defaultBackground.red + tint) + adjustedGreen = min(255, defaultBackground.green + tint) + adjustedBlue = min(255, defaultBackground.blue + tint) + } + + return Color(adjustedRed, adjustedGreen, adjustedBlue) + } + + fun getHighlight(): Color { + val globalScheme = EditorColorsManager.getInstance().globalScheme + return globalScheme.getColor(EditorColors.MODIFIED_TAB_ICON_COLOR) ?: globalScheme.defaultForeground + } + fun getTheme(): Map { try { val globalScheme = EditorColorsManager.getInstance().globalScheme diff --git a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/IdeProtocolClient.kt b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/IdeProtocolClient.kt index 4deed6e6b..ae1515ff9 100644 --- a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/IdeProtocolClient.kt +++ b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/IdeProtocolClient.kt @@ -6,17 +6,20 @@ import com.github.continuedev.continueintellijextension.services.ContinuePluginS import com.google.gson.Gson import com.google.gson.GsonBuilder import com.google.gson.reflect.TypeToken +import com.intellij.ide.plugins.PluginManagerCore import com.intellij.openapi.Disposable import com.intellij.openapi.application.ApplicationInfo import com.intellij.openapi.application.ApplicationManager import com.intellij.openapi.components.ServiceManager import com.intellij.openapi.editor.SelectionModel +import com.intellij.openapi.extensions.PluginId import com.intellij.openapi.fileEditor.FileDocumentManager import com.intellij.openapi.fileEditor.FileEditorManager import com.intellij.openapi.fileEditor.TextEditor import com.intellij.openapi.project.DumbAware import com.intellij.openapi.project.Project import com.intellij.openapi.ui.MessageType +import com.intellij.openapi.ui.Messages import com.intellij.openapi.ui.popup.Balloon import com.intellij.openapi.ui.popup.JBPopupFactory import com.intellij.openapi.vfs.* @@ -25,6 +28,8 @@ import com.intellij.openapi.wm.WindowManager import com.intellij.testFramework.LightVirtualFile import com.intellij.ui.awt.RelativePoint import kotlinx.coroutines.* +import java.awt.Toolkit +import java.awt.datatransfer.StringSelection import java.io.* import java.net.NetworkInterface import java.nio.charset.Charset @@ -168,11 +173,17 @@ class IdeProtocolClient ( if (sshClient != null || sshTty != null) { remoteName = "ssh" } + + val pluginId = "com.github.continuedev.continueintellijextension" + val plugin = PluginManagerCore.getPlugin(PluginId.getId(pluginId)) + val extensionVersion = plugin?.version ?: "Unknown" + respond(mapOf( "ideType" to "jetbrains", "name" to ideName, "version" to ideVersion, - "remoteName" to remoteName + "remoteName" to remoteName, + "extensionVersion" to extensionVersion )) } @@ -180,6 +191,14 @@ class IdeProtocolClient ( respond(uniqueId()) } + "copyText" -> { + val data = data as Map + val text = data["text"] as String + val clipboard = Toolkit.getDefaultToolkit().systemClipboard + val stringSelection = StringSelection(text) + clipboard.setContents(stringSelection, stringSelection) + } + "showDiff" -> { val data = data as Map diffManager.showDiff( diff --git a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/editor/ContinueEditorLinePainter.kt b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/editor/ContinueEditorLinePainter.kt new file mode 100644 index 000000000..02d03d371 --- /dev/null +++ b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/editor/ContinueEditorLinePainter.kt @@ -0,0 +1,19 @@ +package com.github.continuedev.continueintellijextension.editor + +import com.intellij.openapi.editor.EditorLinePainter +import com.intellij.openapi.editor.LineExtensionInfo +import com.intellij.openapi.editor.colors.EditorColorsManager +import com.intellij.openapi.editor.colors.TextAttributesKey +import com.intellij.openapi.editor.markup.EffectType +import com.intellij.openapi.project.Project +import com.intellij.openapi.vfs.VirtualFile +import com.intellij.ui.JBColor +import java.awt.Color +import java.awt.Font + +class ContinueEditorLinePainter : EditorLinePainter() { + override fun getLineExtensions(project: Project, file: VirtualFile, lineNumber: Int): MutableCollection? { + return null +// return mutableListOf(LineExtensionInfo("Line $lineNumber", null, EffectType.BOLD_DOTTED_LINE, JBColor.BLUE, Font.PLAIN )) + } +} \ No newline at end of file diff --git a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/editor/DiffStreamHandler.kt b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/editor/DiffStreamHandler.kt new file mode 100644 index 000000000..629b5c680 --- /dev/null +++ b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/editor/DiffStreamHandler.kt @@ -0,0 +1,236 @@ +package com.github.continuedev.continueintellijextension.editor + +import com.github.continuedev.continueintellijextension.services.ContinuePluginService +import com.google.gson.Gson +import com.intellij.openapi.application.ApplicationManager +import com.intellij.openapi.command.WriteCommandAction +import com.intellij.openapi.command.undo.UndoManager +import com.intellij.openapi.components.ServiceManager +import com.intellij.openapi.editor.Editor +import com.intellij.openapi.editor.colors.TextAttributesKey +import com.intellij.openapi.editor.markup.HighlighterLayer +import com.intellij.openapi.editor.markup.RangeHighlighter +import com.intellij.openapi.editor.markup.TextAttributes +import com.intellij.openapi.fileEditor.FileDocumentManager +import com.intellij.openapi.fileEditor.FileEditorManager +import com.intellij.openapi.fileEditor.TextEditor +import com.intellij.openapi.project.Project +import com.intellij.ui.JBColor +import java.awt.event.KeyEvent +import javax.swing.JTextArea +import kotlin.math.min + + +enum class DiffLineType { + SAME, NEW, OLD +} + +class DiffStreamHandler( + private val project: Project, + private val editor: Editor, + private val textArea: JTextArea, + private val startLine: Int, + private val endLine: Int, + private val onClose: () -> Unit, + private val onFinish: () -> Unit +) { + private val greenKey = run { + val attributes = TextAttributes().apply { + backgroundColor = JBColor(0x3000FF00.toInt(), 0x3000FF00.toInt()) + } + val key = TextAttributesKey.createTextAttributesKey("CONTINUE_DIFF_NEW_LINE") + key.let { editor.colorsScheme.setAttributes(it, attributes) } + key + } + + private val currentLineKey = run { + val attributes = TextAttributes().apply { + backgroundColor = JBColor(0x40888888.toInt(), 0x40888888.toInt()) + } + val key = TextAttributesKey.createTextAttributesKey("CONTINUE_DIFF_CURRENT_LINE") + key.let { editor.colorsScheme.setAttributes(it, attributes) } + key + } + + private val unfinishedKey = run { + val attributes = TextAttributes().apply { + backgroundColor = JBColor(0x20888888.toInt(), 0x20888888.toInt()) + } + val key = TextAttributesKey.createTextAttributesKey("CONTINUE_DIFF_UNFINISHED_LINE") + key.let { editor.colorsScheme.setAttributes(it, attributes) } + key + } + + private var currentLine = startLine + private var currentLineHighlighter: RangeHighlighter? = null + private val unfinishedHighlighters: MutableList = mutableListOf() + private var changeCount: Int = 0 + private var running: Boolean = false + + fun setup() { + // Highlight the range with unfinished color + for (i in startLine..endLine) { + val highlighter = editor.markupModel.addLineHighlighter(unfinishedKey, min( + i, editor.document.lineCount - 1 + ), HighlighterLayer.FIRST) + unfinishedHighlighters.add(highlighter) + } + } + + private fun handleDiffLine(type: DiffLineType, line: String) { + println("DiffStreamHandler: handleDiffLine: $currentLine, $type, $line") + try { + when (type) { + DiffLineType.SAME -> { + currentLine++ + } + DiffLineType.NEW -> { + // Insert new line + if (currentLine == editor.document.lineCount) { + editor.document.insertString(editor.document.textLength, "\n") + } + val offset = editor.document.getLineStartOffset(currentLine) + editor.document.insertString(offset, line + "\n") + + // Highlight the new line green + editor.markupModel.addLineHighlighter(greenKey, currentLine, HighlighterLayer.LAST) + + currentLine++ + changeCount++ + } + DiffLineType.OLD -> { + // Remove old line + val startOffset = editor.document.getLineStartOffset(currentLine) + val endOffset = editor.document.getLineEndOffset(currentLine) + 1 + editor.document.deleteString(startOffset, min(endOffset, editor.document.textLength)) + changeCount++ + } + } + + // Highlight the current line + if (currentLineHighlighter != null) { + editor.markupModel.removeHighlighter(currentLineHighlighter!!) + } + currentLineHighlighter = editor.markupModel.addLineHighlighter(currentLineKey, min(currentLine, editor.document.lineCount - 1), HighlighterLayer.LAST) + + // Remove the unfinished highlighter top line + if (type != DiffLineType.OLD) { + if (unfinishedHighlighters.isNotEmpty()) { + editor.markupModel.removeHighlighter(unfinishedHighlighters.removeAt(0)) + } + } + } catch (e: Exception) { + println("Error handling diff line: $currentLine, $type, $line, $e.message") + } + } + + private fun resetState() { + // Remove all highlighters + editor.markupModel.removeAllHighlighters() + + // Undo changes just by using builtin undo + WriteCommandAction.runWriteCommandAction(project) { + val undoManager = UndoManager.getInstance(project) + val virtualFile = FileDocumentManager.getInstance().getFile(editor.document) ?: return@runWriteCommandAction + val fileEditor = FileEditorManager.getInstance(project).getSelectedEditor(virtualFile) as TextEditor? + if (undoManager.isUndoAvailable(fileEditor)) { + for (i in 0 until changeCount) { + undoManager.undo(fileEditor) + } + } + + // Reset state variables + currentLine = startLine + changeCount = 0 + } + } + + fun accept() { + // Accept the changes + editor.markupModel.removeAllHighlighters() + onClose() + running = false + } + + fun reject() { + // Reject the changes + resetState() + onClose() + running = false + } + + fun toggleFocus() { + if (textArea.hasFocus()) { + textArea.transferFocus() + editor.contentComponent.requestFocus() + } else { + textArea.requestFocus() + } + } + + fun run(input : String, prefix : String, highlighted : String, suffix : String, modelTitle : String) { + // Undo changes + resetState() + + running = true + + // Highlight the range with unfinished color + for (i in startLine..endLine) { + val highlighter = editor.markupModel.addLineHighlighter(unfinishedKey, min( + i, editor.document.lineCount - 1 + ), HighlighterLayer.FIRST) + unfinishedHighlighters.add(highlighter) + } + + // Request diff stream from core + val continuePluginService = ServiceManager.getService( + this.project, + ContinuePluginService::class.java + ) + val virtualFile = FileDocumentManager.getInstance().getFile(editor.document) + continuePluginService.coreMessenger?.request("streamDiffLines", mapOf( + "input" to input, + "prefix" to prefix, + "highlighted" to highlighted, + "suffix" to suffix, + "language" to virtualFile?.fileType?.name, + "modelTitle" to modelTitle + ), null) { response -> + if (!running) { + return@request + } + + val parsed = Gson().fromJson(response, Map::class.java) + val done = parsed["done"] as? Boolean + if (done == true) { + onFinish() + + ApplicationManager.getApplication().invokeLater { + // Clean up highlighters + if (currentLineHighlighter != null) { + editor.markupModel.removeHighlighter(currentLineHighlighter!!) + } + unfinishedHighlighters.forEach { editor.markupModel.removeHighlighter(it) } + + // Add ", " to the text area + textArea.document.insertString(textArea.caretPosition, ", ", null) + textArea.requestFocus() + } + + return@request + } + val data = parsed["content"] as Map<*, *> + val type = data["type"] as String + val diffLineType = when (type) { + "same" -> DiffLineType.SAME + "new" -> DiffLineType.NEW + "old" -> DiffLineType.OLD + else -> throw Exception("Unknown diff line type: $type") + } + + WriteCommandAction.runWriteCommandAction(project) { + handleDiffLine(diffLineType, data["line"] as String) + } + } + } +} \ No newline at end of file diff --git a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/editor/DiffStreamService.kt b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/editor/DiffStreamService.kt new file mode 100644 index 000000000..48aba76b8 --- /dev/null +++ b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/editor/DiffStreamService.kt @@ -0,0 +1,31 @@ +package com.github.continuedev.continueintellijextension.editor + +import com.intellij.openapi.components.Service +import com.intellij.openapi.editor.Editor + +@Service(Service.Level.PROJECT) +class DiffStreamService { + private val handlers = mutableMapOf() + + fun register(handler: DiffStreamHandler, editor: Editor) { + if (handlers.containsKey(editor)) { + handlers[editor]?.reject() + } + handlers[editor] = handler + println("Registered handler for editor") + } + + fun reject(editor: Editor) { + handlers[editor]?.reject() + handlers.remove(editor) + } + + fun accept(editor: Editor) { + handlers[editor]?.accept() + handlers.remove(editor) + } + + fun getHandler(editor: Editor): DiffStreamHandler? { + return handlers[editor] + } +} \ No newline at end of file diff --git a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/editor/EditorComponentInlaysManager.kt b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/editor/EditorComponentInlaysManager.kt new file mode 100644 index 000000000..c5b089d7a --- /dev/null +++ b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/editor/EditorComponentInlaysManager.kt @@ -0,0 +1,158 @@ +package com.github.continuedev.continueintellijextension.editor + +import com.intellij.openapi.Disposable +import com.intellij.openapi.editor.Editor +import com.intellij.openapi.editor.ex.EditorEx +import com.intellij.openapi.editor.ex.util.EditorUtil +import com.intellij.openapi.editor.impl.EditorEmbeddedComponentManager +import com.intellij.openapi.editor.impl.EditorImpl +import com.intellij.openapi.editor.impl.view.FontLayoutService +import com.intellij.openapi.util.Disposer +import com.intellij.openapi.util.Key +import com.intellij.ui.components.JBScrollPane +import com.intellij.util.concurrency.annotations.RequiresEdt +import com.intellij.util.ui.JBUI +import java.awt.Dimension +import java.awt.Font +import java.awt.event.ComponentAdapter +import java.awt.event.ComponentEvent +import javax.swing.JComponent +import javax.swing.ScrollPaneConstants +import kotlin.math.ceil +import kotlin.math.max +import kotlin.math.min + +/** + * Copied from com.intellij.util.ui.codereview.diff.EditorComponentInlaysManager + * via https://github.com/cursive-ide/component-inlay-example/blob/master/src/main/kotlin/inlays/EditorComponentInlaysManager.kt + */ +class EditorComponentInlaysManager(val editor: EditorImpl) : Disposable { + + private val managedInlays = mutableMapOf() + private val editorWidthWatcher = EditorTextWidthWatcher() + + init { + editor.scrollPane.viewport.addComponentListener(editorWidthWatcher) + Disposer.register(this, Disposable { + editor.scrollPane.viewport.removeComponentListener(editorWidthWatcher) + }) + + EditorUtil.disposeWithEditor(editor, this) + } + + @RequiresEdt + fun insertAfter(lineIndex: Int, component: JComponent): Disposable? { + if (Disposer.isDisposed(this)) return null + + // Dispose all other inlays + managedInlays.values.forEach(Disposer::dispose) + + val wrappedComponent = ComponentWrapper(component) + val offset = editor.document.getLineEndOffset(lineIndex) + + return EditorEmbeddedComponentManager.getInstance() + .addComponent(editor, wrappedComponent, + EditorEmbeddedComponentManager.Properties(EditorEmbeddedComponentManager.ResizePolicy.none(), + null, + true, + false, + 0, + offset))?.also { + managedInlays[wrappedComponent] = it + Disposer.register(it, Disposable { managedInlays.remove(wrappedComponent) }) + } + } + + private inner class ComponentWrapper(private val component: JComponent) : JBScrollPane(component) { + init { + isOpaque = false + viewport.isOpaque = false + + border = JBUI.Borders.empty() + viewportBorder = JBUI.Borders.empty() + + horizontalScrollBarPolicy = ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER + verticalScrollBar.preferredSize = Dimension(0, 0) + setViewportView(component) + + component.addComponentListener(object : ComponentAdapter() { + override fun componentResized(e: ComponentEvent) = + dispatchEvent(ComponentEvent(component, ComponentEvent.COMPONENT_RESIZED)) + }) + } + + override fun getPreferredSize(): Dimension { + return Dimension(editorWidthWatcher.editorTextWidth, component.preferredSize.height) + } + } + + override fun dispose() { + managedInlays.values.forEach(Disposer::dispose) + } + + private inner class EditorTextWidthWatcher : ComponentAdapter() { + + var editorTextWidth: Int = 0 + + private val maximumEditorTextWidth: Int + private val verticalScrollbarFlipped: Boolean + + init { + val metrics = editor.getFontMetrics(Font.PLAIN) + val spaceWidth = FontLayoutService.getInstance().charWidth2D(metrics, ' '.toInt()) + // -4 to create some space + maximumEditorTextWidth = ceil(spaceWidth * (editor.settings.getRightMargin(editor.project)) - 4).toInt() + + val scrollbarFlip = editor.scrollPane.getClientProperty(JBScrollPane.Flip::class.java) + verticalScrollbarFlipped = + scrollbarFlip == JBScrollPane.Flip.HORIZONTAL || scrollbarFlip == JBScrollPane.Flip.BOTH + } + + override fun componentResized(e: ComponentEvent) = updateWidthForAllInlays() + override fun componentHidden(e: ComponentEvent) = updateWidthForAllInlays() + override fun componentShown(e: ComponentEvent) = updateWidthForAllInlays() + + private fun updateWidthForAllInlays() { + val newWidth = calcWidth() + if (editorTextWidth == newWidth) return + editorTextWidth = newWidth + + managedInlays.keys.forEach { + it.dispatchEvent(ComponentEvent(it, ComponentEvent.COMPONENT_RESIZED)) + it.invalidate() + } + } + + private fun calcWidth(): Int { + val visibleEditorTextWidth = editor.scrollPane.viewport.width - getVerticalScrollbarWidth() - getGutterTextGap() + return min(max(visibleEditorTextWidth, 0), maximumEditorTextWidth) + } + + private fun getVerticalScrollbarWidth(): Int { + val width = editor.scrollPane.verticalScrollBar.width + return if (!verticalScrollbarFlipped) width * 2 else width + } + + private fun getGutterTextGap(): Int { + return if (verticalScrollbarFlipped) { + val gutter = (editor as EditorEx).gutterComponentEx + gutter.width - gutter.whitespaceSeparatorOffset + } else 0 + } + } + + companion object { + val INLAYS_KEY: Key = Key.create("EditorComponentInlaysManager") + + fun from(editor: Editor): EditorComponentInlaysManager { + return synchronized(editor) { + val manager = editor.getUserData(INLAYS_KEY) + if (manager == null) { + val newManager = EditorComponentInlaysManager(editor as EditorImpl) + editor.putUserData(INLAYS_KEY, newManager) + newManager + } else manager + } + } + } +} \ No newline at end of file diff --git a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/editor/InlineEditAction.kt b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/editor/InlineEditAction.kt new file mode 100644 index 000000000..52077b70f --- /dev/null +++ b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/editor/InlineEditAction.kt @@ -0,0 +1,530 @@ +package com.github.continuedev.continueintellijextension.editor + +import com.github.continuedev.continueintellijextension.`continue`.GetTheme +import com.github.continuedev.continueintellijextension.services.ContinueExtensionSettings +import com.github.continuedev.continueintellijextension.services.ContinuePluginService +import com.github.continuedev.continueintellijextension.utils.getAltKeyLabel +import com.google.gson.Gson +import com.intellij.openapi.Disposable +import com.intellij.openapi.actionSystem.AnAction +import com.intellij.openapi.actionSystem.AnActionEvent +import com.intellij.openapi.actionSystem.PlatformDataKeys +import com.intellij.openapi.components.service +import com.intellij.openapi.editor.colors.EditorColorsManager +import com.intellij.openapi.editor.colors.EditorFontType +import com.intellij.openapi.editor.impl.EditorImpl +import com.intellij.openapi.project.DumbAware +import com.intellij.openapi.project.Project +import com.intellij.openapi.util.Ref +import com.intellij.openapi.util.TextRange +import com.intellij.ui.JBColor +import com.intellij.util.ui.JBUI +import com.intellij.util.ui.UIUtil +import net.miginfocom.swing.MigLayout +import org.jdesktop.swingx.JXPanel +import org.jdesktop.swingx.JXTextArea +import org.jdesktop.swingx.border.DropShadowBorder +import java.awt.* +import java.awt.event.* +import java.awt.geom.RoundRectangle2D +import javax.swing.* +import javax.swing.border.EmptyBorder +import javax.swing.event.DocumentEvent +import javax.swing.event.DocumentListener +import javax.swing.plaf.ComboBoxUI +import javax.swing.plaf.basic.BasicArrowButton +import javax.swing.plaf.basic.BasicComboBoxUI +import kotlin.math.max + + +const val SHADOW_SIZE = 7 +const val MAIN_FONT_SIZE = 13 + +/** + * Adapted from https://github.com/cursive-ide/component-inlay-example/blob/master/src/main/kotlin/inlays/InlineEditAction.kt + */ +class InlineEditAction : AnAction(), DumbAware { + override fun update(e: AnActionEvent) { + e.presentation.isEnabled = true + e.presentation.isVisible = true + } + + override fun actionPerformed(e: AnActionEvent) { + if (e.project == null) return + + val editor = e.getData(PlatformDataKeys.EDITOR) ?: return + val project = e.getData(PlatformDataKeys.PROJECT) ?: return + val manager = EditorComponentInlaysManager.from(editor) + + // Get list of model titles + val continuePluginService = project.service() + val modelTitles = mutableListOf() + continuePluginService.coreMessenger?.request("config/getBrowserSerialized", null, null) { response -> + val gson = Gson() + val config = gson.fromJson(response, Map::class.java) + val models = config["models"] as List> + modelTitles.addAll(models.map { it["title"] as String }) + } + val maxWaitTime = 200 + val startTime = System.currentTimeMillis() + while (modelTitles.isEmpty() && System.currentTimeMillis() - startTime < maxWaitTime) { + Thread.sleep(20) + } + + // Get highlighted range + val selectionModel = editor.selectionModel + val start = selectionModel.selectionStart + val end = selectionModel.selectionEnd + val prefix = editor.document.getText(TextRange(0, start)) + val highlighted = editor.document.getText(TextRange(start, end)) + val suffix = editor.document.getText(TextRange(end, editor.document.textLength)) + + val startLineNum = editor.document.getLineNumber(start) + val endLineNum = editor.document.getLineNumber(end) + val lineNumber = max(0, startLineNum - 1) + + // Un-highlight the selected text + selectionModel.removeSelection() + + // Get indentation width in pixels + val indentationLineNum = lineNumber + 1 + val lineStart = editor.document.getLineStartOffset(indentationLineNum) + val lineEnd = editor.document.getLineEndOffset(indentationLineNum) + val text = editor.document.getText(TextRange(lineStart, lineEnd)) + val indentation = text.takeWhile { it == ' ' }.length + val charWidth = editor.contentComponent.getFontMetrics(editor.colorsScheme.getFont(EditorFontType.PLAIN)).charWidth(' ') + val leftInset = indentation * charWidth * 2 / 3 + + val inlayRef = Ref() + val customPanelRef = Ref() + + // Create text area, attach key listener + val textArea = makeTextArea() + + // Create diff stream handler + val diffStreamHandler = DiffStreamHandler(project, editor, textArea, startLineNum, endLineNum, { + inlayRef.get().dispose() + }, { + customPanelRef.get().finish() + }) + val diffStreamService = project.service() + diffStreamService.register(diffStreamHandler, editor) + + diffStreamHandler.setup() + + val comboBoxRef = Ref>() + + fun onEnter() { + customPanelRef.get().enter() + diffStreamHandler.run(textArea.text, prefix, highlighted, suffix, comboBoxRef.get().selectedItem as String) + } + + val panel = makePanel(project, customPanelRef, textArea, inlayRef, comboBoxRef, leftInset, modelTitles, {onEnter()}, { + diffStreamService.reject(editor) + selectionModel.setSelection(start, end) + }, { + diffStreamService.accept(editor) + inlayRef.get().dispose() + }, { + diffStreamService.reject(editor) + inlayRef.get().dispose() + }) + val inlay = manager.insertAfter(lineNumber, panel) + panel.revalidate() + inlayRef.set(inlay) + val viewport = (editor as? EditorImpl)?.scrollPane?.viewport + viewport?.dispatchEvent(ComponentEvent(viewport, ComponentEvent.COMPONENT_RESIZED)) + + // Add key listener to text area + textArea.addKeyListener(object : KeyAdapter() { + override fun keyPressed(e: KeyEvent) { + if (e.keyCode == KeyEvent.VK_ESCAPE) { + diffStreamService.reject(editor) + + // Re-highlight the selected text + selectionModel.setSelection(start, end) + } else if (e.keyCode == KeyEvent.VK_ENTER) { + if (e.modifiersEx == KeyEvent.SHIFT_DOWN_MASK) { + textArea.document.insertString(textArea.caretPosition, "\n", null) + } else if (e.modifiersEx == 0) { + onEnter() + e.consume() + } + } + } + }) + + // Listen for changes to textarea line count + textArea.document.addDocumentListener(object : DocumentListener { + private var lastNumLines: Int = 0 + private fun updateSize() { + val numLines = textArea.text.lines().size + if (numLines != lastNumLines) { + lastNumLines = numLines + viewport?.dispatchEvent(ComponentEvent(viewport, ComponentEvent.COMPONENT_RESIZED)) + } + } + override fun insertUpdate(e: DocumentEvent?) { + updateSize() + } + + override fun removeUpdate(e: DocumentEvent?) { + updateSize() + } + + override fun changedUpdate(e: DocumentEvent?) { + updateSize() + } + }) + + + textArea.requestFocus() + } + + fun makeTextArea(): JTextArea { + val textArea = CustomTextArea( 2, 40).apply { + lineWrap = true + wrapStyleWord = true + isOpaque = false + background = GetTheme().getSecondaryDark() + maximumSize = Dimension(400, Short.MAX_VALUE.toInt()) + margin = JBUI.insets(8) + font = Font("Arial", Font.PLAIN, MAIN_FONT_SIZE) + } + textArea.putClientProperty(UIUtil.HIDE_EDITOR_FROM_DATA_CONTEXT_PROPERTY, true) + + return textArea + } + + fun makePanel(project: Project, customPanelRef: Ref, textArea: JTextArea, inlayRef: Ref, comboBoxRef: Ref>, leftInset: Int, modelTitles: List, onEnter: () -> Unit, onCancel: () -> Unit, onAccept: () -> Unit, onReject: () -> Unit): JPanel { + val topPanel = ShadowPanel(MigLayout("wrap 1, insets 4 $leftInset 2 2, gap 0!")).apply { + val globalScheme = EditorColorsManager.getInstance().globalScheme + val defaultBackground = globalScheme.defaultBackground +// background = defaultBackground + background = JBColor(0x20888888.toInt(), 0x20888888.toInt()) + isOpaque = false + } + + val panel = CustomPanel(MigLayout("wrap 1, insets 0, gap 0!, fillx"), project, modelTitles, comboBoxRef, onEnter, onCancel, onAccept, onReject).apply { + val globalScheme = EditorColorsManager.getInstance().globalScheme + val defaultBackground = globalScheme.defaultBackground + background = defaultBackground + add(textArea, "grow, gap 0!, height 100%") + + putClientProperty(UIUtil.HIDE_EDITOR_FROM_DATA_CONTEXT_PROPERTY, true) + preferredSize = textArea.preferredSize + isOpaque = false + setup() + + val shadow = DropShadowBorder() + shadow.shadowColor = JBColor(0xb0b0b0, 0x505050) + shadow.isShowRightShadow = true + shadow.isShowBottomShadow = true + shadow.shadowSize = SHADOW_SIZE + border = shadow + } + customPanelRef.set(panel) + + textArea.addComponentListener(object : ComponentAdapter() { + override fun componentResized(e: ComponentEvent?) { + panel.revalidate() + panel.repaint() + } + }) + + topPanel.add(panel, "grow, gap 0!") + + return topPanel + } +} + +class CustomPanel(layout: MigLayout, project: Project, modelTitles: List, comboBoxRef: Ref>, onEnter: () -> Unit, onCancel: () -> Unit, onAccept: () -> Unit, onReject: () -> Unit): JPanel(layout) { + private val subPanelA: JPanel = JPanel(MigLayout("insets 0, fillx")).apply { + val globalScheme = EditorColorsManager.getInstance().globalScheme + val defaultBackground = globalScheme.defaultBackground + + val leftButton = CustomButton("Esc to cancel") { onCancel() }.apply { + foreground = Color(128, 128, 128, 200) + background = defaultBackground + } + + val continueSettingsService = service() + + val dropdown = JComboBox(modelTitles.toTypedArray()).apply { + isEditable = true + background = defaultBackground + foreground = Color(128, 128, 128, 200) + font = Font("Arial", Font.PLAIN, 11) + border = EmptyBorder(2, 4, 2, 4) + isOpaque = false + isEditable = false + cursor = Cursor.getPredefinedCursor(Cursor.HAND_CURSOR) + renderer = DefaultListCellRenderer().apply { + horizontalAlignment = SwingConstants.RIGHT + } + selectedIndex = continueSettingsService.continueState.lastSelectedInlineEditModel?.let { modelTitles.indexOf(it) } ?: 0 + + addActionListener { + continueSettingsService.continueState.lastSelectedInlineEditModel = selectedItem as String + } + +// setUI(TransparentArrowButtonUI()) + } + + comboBoxRef.set(dropdown) + + val rightButton = CustomButton("Submit") { onEnter() }.apply { +// background = GetTheme().getHighlight() + background = JBColor(0xe04573e8.toInt(), 0xe04573e8.toInt()) + foreground = JBColor(0xffffffff.toInt(), 0xffffffff.toInt()) + } + + val rightPanel = JPanel(MigLayout("insets 0, fillx")).apply { + isOpaque = false + border = EmptyBorder(0, 0, 0, 0) + add(dropdown, "align right") + add(rightButton, "align right") + } + + border = EmptyBorder(4, 8, 4, 8) + + add(leftButton, "align left") + add(rightPanel, "align right") + isOpaque = false + + cursor = Cursor.getPredefinedCursor(Cursor.TEXT_CURSOR) + } + + private val subPanelB: JPanel = JPanel(MigLayout("insets 0, fillx")).apply { + // Get the global color scheme and default background color + val globalScheme = EditorColorsManager.getInstance().globalScheme + val defaultBackground = globalScheme.defaultBackground + + val leftButton = CustomButton("Esc to cancel") { onCancel() }.apply { + foreground = Color(128, 128, 128, 200) + background = defaultBackground + } + + val dropdown = JComboBox(modelTitles.toTypedArray()).apply { + isEditable = true + background = defaultBackground + foreground = Color(128, 128, 128, 200) + font = Font("Arial", Font.PLAIN, 11) + border = EmptyBorder(2, 4, 2, 4) + isOpaque = false + isEditable = false + cursor = Cursor.getPredefinedCursor(Cursor.HAND_CURSOR) + renderer = DefaultListCellRenderer().apply { + horizontalAlignment = SwingConstants.RIGHT + } + + isVisible = false + +// setUI(TransparentArrowButtonUI()) + } + + val progressBar = JProgressBar() + progressBar.isIndeterminate = true + + val rightPanel = JPanel(MigLayout("insets 0, fillx")).apply { + isOpaque = false + border = EmptyBorder(0, 0, 0, 0) + add(dropdown, "align right") + add(progressBar, "align right") + } + + + + border = EmptyBorder(4, 8, 4, 8) + add(leftButton, "align left") + add(rightPanel, "align right") + isOpaque = false + + cursor = Cursor.getPredefinedCursor(Cursor.TEXT_CURSOR) + } + + private val subPanelC: JPanel = JPanel(MigLayout("insets 0, fillx")).apply { + val leftLabel = JLabel("Enter follow-up instructions").apply { + foreground = Color(128, 128, 128, 200) + font = Font("Arial", Font.PLAIN, 11) + } + + val leftButton = CustomButton("${getAltKeyLabel()}⇧N") { onReject() }.apply { + background = Color(255, 0, 0, 64) + } + + val rightButton = CustomButton("${getAltKeyLabel()}⇧Y") { onAccept() }.apply { + background = Color(0, 255, 0, 64) + } + + val rightPanel = JPanel(MigLayout("insets 0, fillx")).apply { + isOpaque = false + add(leftButton, "align right") + add(rightButton, "align right") + border = EmptyBorder(0, 0, 0, 0) + } + + add(leftLabel, "align left") + add(rightPanel, "align right") + border = EmptyBorder(4, 8, 4, 8) + isOpaque = false + } + + fun setup() { + remove(subPanelB) + remove(subPanelC) + add(subPanelA, "grow, gap 0!") + } + + fun enter() { + remove(subPanelA) + remove(subPanelC) + add(subPanelB, "grow, gap 0!") + revalidate() + repaint() + } + + fun finish() { + remove(subPanelB) + add(subPanelC, "grow, gap 0!") + revalidate() + repaint() + } + + override fun paintComponent(g: Graphics) { + val g2 = g as Graphics2D + g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON) + + // Draw the rounded border + val borderColor = Color(128, 128, 128, 128) + val borderThickness = 1 + val borderRadius = 8 + + g2.color = borderColor + g2.stroke = BasicStroke(borderThickness.toFloat()) + g2.drawRoundRect( + borderThickness / 2, + borderThickness / 2, + width - borderThickness - SHADOW_SIZE + 1, + height - borderThickness - SHADOW_SIZE + 1, + borderRadius, + borderRadius + ) + + super.paintComponent(g) + } +} + + +class CustomButton(text: String, onClick: () -> Unit) : JLabel(text, CENTER) { + private var isHovered = false + + init { + isOpaque = false + cursor = Cursor.getPredefinedCursor(Cursor.HAND_CURSOR) + addMouseListener(object : MouseAdapter() { + override fun mouseEntered(e: MouseEvent?) { + isHovered = true + repaint() + } + + override fun mouseExited(e: MouseEvent?) { + isHovered = false + repaint() + } + + override fun mouseClicked(e: MouseEvent?) { + onClick() + } + }) + +// verticalAlignment = CENTER + font = Font("Arial", Font.PLAIN, 11) + border = EmptyBorder(2, 4, 2, 4) + } + override fun paintComponent(g: Graphics) { + val g2 = g as Graphics2D + g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON) + + val cornerRadius = 8 + val rect = Rectangle(0, 0, width, height) + val roundRect = RoundRectangle2D.Float(rect.x.toFloat(), rect.y.toFloat(), rect.width.toFloat(), rect.height.toFloat(), cornerRadius.toFloat(), cornerRadius.toFloat()) + if (isHovered) { + g2.color = background.brighter() + } else { + g2.color = background + } + g2.fill(roundRect) + g2.color = foreground + g2.drawString(text, (width / 2 - g.fontMetrics.stringWidth(text) / 2).toFloat(), + (height / 2 + g.fontMetrics.ascent / 2).toFloat()) + } +} + +class CustomTextArea(rows: Int, columns: Int) : JXTextArea("") { + init { + setRows(rows) + setColumns(columns) + } + + override fun paintComponent(g: Graphics) { + // Draw placeholder + if (text.isEmpty()) { + g.color = Color(128, 128, 128, 255) + g.font = Font("Arial", Font.PLAIN, MAIN_FONT_SIZE) + g.drawString("Enter instructions to edit highlighted code", 8, 20) + } + + super.paintComponent(g) + } +} + +class ShadowPanel(layout: LayoutManager) : JXPanel(layout) { + override fun getPreferredSize(): Dimension { + val prefSize = super.getPreferredSize() + val insets = getInsets() + prefSize.width += insets.left + insets.right + prefSize.height += insets.top + insets.bottom + return prefSize + } + + override fun paintComponent(g: Graphics) { + super.paintComponent(g) + } +} + +class TransparentArrowButtonUI : BasicComboBoxUI() { + override fun createArrowButton() = object : JButton() { + override fun paintComponent(g: Graphics) { + val g2 = g as Graphics2D + g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON) + val size = 6 + val x = (width - size) / 2 + val y = (height - size / 2) / 2 + val triangle = Polygon( + intArrayOf(x, x + size, x + size / 2), + intArrayOf(y, y, (y + size / 1.16).toInt()), + 3 + ) + g2.color = Color.GRAY + g2.fill(triangle) + } + }.apply { + border = EmptyBorder(0, 0, 0, 0) +// background = Color(0, 0, 0, 0) + isOpaque = false + } + + override fun getInsets(): Insets { + return JBUI.insets(0, 0, 0, 0) + } + + override fun installUI(c: JComponent?) { + super.installUI(c) + comboBox.border = EmptyBorder(0, 0, 0, 0) + comboBox.isOpaque = false + val globalScheme = EditorColorsManager.getInstance().globalScheme + val defaultBackground = globalScheme.defaultBackground + comboBox.background = defaultBackground + } +} \ No newline at end of file diff --git a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/editor/ToggleInlineEditAction.kt b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/editor/ToggleInlineEditAction.kt new file mode 100644 index 000000000..f14ce4dad --- /dev/null +++ b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/editor/ToggleInlineEditAction.kt @@ -0,0 +1,27 @@ +package com.github.continuedev.continueintellijextension.editor + +import com.intellij.openapi.actionSystem.ActionManager +import com.intellij.openapi.actionSystem.AnAction +import com.intellij.openapi.actionSystem.AnActionEvent +import com.intellij.openapi.actionSystem.PlatformDataKeys +import com.intellij.openapi.components.service +import com.intellij.openapi.fileEditor.FileEditorManager +import com.intellij.openapi.project.DumbAware + +class ToggleInlineEditAction : AnAction(), DumbAware { + override fun actionPerformed(e: AnActionEvent) { + val project = e.getData(PlatformDataKeys.PROJECT) ?: return + val editor = e.getData(PlatformDataKeys.EDITOR) ?: FileEditorManager.getInstance(project).selectedTextEditor ?: return + val diffService = project.service() + val handler = diffService.getHandler(editor) + if (handler == null) { + val actionId = "continue.inlineEdit" + val action = ActionManager.getInstance().getAction(actionId) + if (action != null) { + e.actionManager.tryToExecute(action, e.inputEvent, null, null, true) + } + } else { + handler.toggleFocus() + } + } +} \ No newline at end of file diff --git a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/services/ContinueExtensionSettingsService.kt b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/services/ContinueExtensionSettingsService.kt index 8042cdc24..d2da9d7d8 100644 --- a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/services/ContinueExtensionSettingsService.kt +++ b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/services/ContinueExtensionSettingsService.kt @@ -62,6 +62,7 @@ class ContinueSettingsComponent: DumbAware { open class ContinueExtensionSettings : PersistentStateComponent { class ContinueState { + var lastSelectedInlineEditModel: String? = null var shownWelcomeDialog: Boolean = false var remoteConfigServerUrl: String? = null var remoteConfigSyncPeriod: Int = 60 diff --git a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/services/ContinuePluginService.kt b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/services/ContinuePluginService.kt index 6f4989c59..550df9542 100644 --- a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/services/ContinuePluginService.kt +++ b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/services/ContinuePluginService.kt @@ -3,6 +3,7 @@ package com.github.continuedev.continueintellijextension.services import com.github.continuedev.continueintellijextension.`continue`.CoreMessenger import com.github.continuedev.continueintellijextension.`continue`.IdeProtocolClient import com.github.continuedev.continueintellijextension.`continue`.uuid +import com.github.continuedev.continueintellijextension.toolWindow.ContinueBrowser import com.github.continuedev.continueintellijextension.toolWindow.ContinuePluginToolWindowFactory import com.google.gson.Gson import com.intellij.openapi.Disposable @@ -41,25 +42,6 @@ class ContinuePluginService(project: Project) : Disposable, DumbAware { data: Any?, messageId: String = uuid() ) { - val jsonData = Gson().toJson( - mapOf( - "messageId" to messageId, - "messageType" to messageType, - "data" to data - ) - ) - val jsCode = buildJavaScript(jsonData) - - try { - continuePluginWindow?.webView?.executeJavaScriptAsync(jsCode) - } catch (error: IllegalStateException) { - println("Webview not initialized yet $error") - } + continuePluginWindow?.browser?.sendToWebview(messageType, data, messageId) } - - private fun buildJavaScript(jsonData: String): String { - return """window.postMessage($jsonData, "*");""" - } - - } \ No newline at end of file diff --git a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/toolWindow/ContinueBrowser.kt b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/toolWindow/ContinueBrowser.kt new file mode 100644 index 000000000..c7ffad486 --- /dev/null +++ b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/toolWindow/ContinueBrowser.kt @@ -0,0 +1,233 @@ +package com.github.continuedev.continueintellijextension.toolWindow + +import com.github.continuedev.continueintellijextension.activities.showTutorial +import com.github.continuedev.continueintellijextension.constants.getConfigJsonPath +import com.github.continuedev.continueintellijextension.`continue`.* +import com.github.continuedev.continueintellijextension.factories.CustomSchemeHandlerFactory +import com.github.continuedev.continueintellijextension.services.ContinuePluginService +import com.google.gson.Gson +import com.google.gson.JsonObject +import com.google.gson.JsonParser +import com.intellij.openapi.components.ServiceManager +import com.intellij.openapi.project.Project +import com.intellij.openapi.util.Disposer +import com.intellij.ui.jcef.* +import kotlinx.coroutines.GlobalScope +import kotlinx.coroutines.launch +import org.cef.CefApp +import org.cef.browser.CefBrowser +import org.cef.handler.CefLoadHandlerAdapter + +class ContinueBrowser(val project: Project, url: String, useOsr: Boolean = false) { + private val heightChangeListeners = mutableListOf<(Int) -> Unit>() + fun onHeightChange(listener: (Int) -> Unit) { + heightChangeListeners.add(listener) + } + + private val PASS_THROUGH_TO_CORE = listOf( + "abort", + "getContinueDir", + "history/list", + "history/save", + "history/delete", + "history/load", + "devdata/log", + "config/addModel", + "config/deleteModel", + "config/addOpenAIKey", + "llm/streamComplete", + "llm/streamChat", + "llm/complete", + "command/run", + "context/loadSubmenuItems", + "context/getContextItems", + "context/addDocs", + "config/getBrowserSerialized", + ) + + private fun registerAppSchemeHandler() { + CefApp.getInstance().registerSchemeHandlerFactory( + "http", + "continue", + CustomSchemeHandlerFactory() + ) + } + + val browser: JBCefBrowser + init { + val osName = System.getProperty("os.name").toLowerCase() + val os = when { + osName.contains("mac") || osName.contains("darwin") -> "darwin" + osName.contains("win") -> "win32" + osName.contains("nix") || osName.contains("nux") || osName.contains("aix") -> "linux" + else -> "linux" + } + + this.browser = JBCefBrowser.createBuilder().setOffScreenRendering(os == "linux" || useOsr).build() + browser.jbCefClient.setProperty( + JBCefClient.Properties.JS_QUERY_POOL_SIZE, + JS_QUERY_POOL_SIZE + ) + registerAppSchemeHandler() + browser.loadURL(url); + Disposer.register(project, browser) + + // Listen for events sent from browser + val myJSQueryOpenInBrowser = JBCefJSQuery.create((browser as JBCefBrowserBase?)!!) + myJSQueryOpenInBrowser.addHandler { msg: String? -> + val parser = JsonParser() + val json: JsonObject = parser.parse(msg).asJsonObject + val messageType = json.get("messageType").asString + val data = json.get("data") + val messageId = json.get("messageId")?.asString + + val continuePluginService = ServiceManager.getService( + project, + ContinuePluginService::class.java + ) + + val ide = continuePluginService.ideProtocolClient; + + val respond = fun(data: Any?) { + val jsonData = mutableMapOf( + "messageId" to messageId, + "data" to data, + "messageType" to messageType + ) + val jsonString = Gson().toJson(jsonData) + sendToWebview(messageType, data, messageId ?: uuid()) + } + + if (PASS_THROUGH_TO_CORE.contains(messageType)) { + continuePluginService.coreMessenger?.request(messageType, data, messageId, respond) + return@addHandler null + } + + when (messageType) { + "jetbrains/editorInsetHeight" -> { + val height = data.asJsonObject.get("height").asInt + heightChangeListeners.forEach { it(height) } + } + "onLoad" -> { + GlobalScope.launch { + // Set the colors to match Intellij theme + val colors = GetTheme().getTheme(); + sendToWebview("setColors", colors) + + val jsonData = mutableMapOf( + "windowId" to continuePluginService.windowId, + "workspacePaths" to continuePluginService.workspacePaths, + "vscMachineId" to getMachineUniqueID(), + "vscMediaUrl" to "http://continue", + ) + respond(jsonData) + } + + } + "showLines" -> { + val data = data.asJsonObject + ide?.highlightCode(RangeInFile( + data.get("filepath").asString, + Range(Position( + data.get("start").asInt, + 0 + ), Position( + data.get("end").asInt, + 0 + )), + + ),"#00ff0022") + } + "showTutorial" -> { + showTutorial(project) + } + "showVirtualFile" -> { + val data = data.asJsonObject + ide?.showVirtualFile(data.get("name").asString, data.get("content").asString) + } + "showFile" -> { + val data = data.asJsonObject + ide?.setFileOpen(data.get("filepath").asString) + } + "reloadWindow" -> {} + "openConfigJson" -> { + ide?.setFileOpen(getConfigJsonPath()) + } + "readRangeInFile" -> { + val data = data.asJsonObject + ide?.readRangeInFile(RangeInFile( + data.get("filepath").asString, + Range(Position( + data.get("start").asInt, + 0 + ), Position( + data.get("end").asInt + 1, + 0 + )), + )) + } + "focusEditor" -> {} + + // IDE // + else -> { + if (msg != null) { + ide?.handleMessage(msg, respond) + } + } + } + + + null + } + + // Listen for the page load event + browser.jbCefClient.addLoadHandler(object : CefLoadHandlerAdapter() { + override fun onLoadingStateChange( + browser: CefBrowser?, + isLoading: Boolean, + canGoBack: Boolean, + canGoForward: Boolean + ) { + if (!isLoading) { + // The page has finished loading + executeJavaScript(browser, myJSQueryOpenInBrowser) + } + } + }, browser.cefBrowser) + + } + fun executeJavaScript(browser: CefBrowser?, myJSQueryOpenInBrowser: JBCefJSQuery) { + // Execute JavaScript - you might want to handle potential exceptions here + val script = """window.postIntellijMessage = function(messageType, data, messageId) { + const msg = JSON.stringify({messageType, data, messageId}); + ${myJSQueryOpenInBrowser.inject("msg")} + }""".trimIndent() + + browser?.executeJavaScript(script, browser.url, 0) + } + + fun sendToWebview( + messageType: String, + data: Any?, + messageId: String = uuid() + ) { + val jsonData = Gson().toJson( + mapOf( + "messageId" to messageId, + "messageType" to messageType, + "data" to data + ) + ) + val jsCode = buildJavaScript(jsonData) + + try { + this.browser.executeJavaScriptAsync(jsCode) + } catch (error: IllegalStateException) { + println("Webview not initialized yet $error") + } + } + + private fun buildJavaScript(jsonData: String): String { + return """window.postMessage($jsonData, "*");""" + } +} \ No newline at end of file diff --git a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/toolWindow/ContinuePluginToolWindowFactory.kt b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/toolWindow/ContinuePluginToolWindowFactory.kt index 873ccb911..5f71aaed4 100644 --- a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/toolWindow/ContinuePluginToolWindowFactory.kt +++ b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/toolWindow/ContinuePluginToolWindowFactory.kt @@ -1,33 +1,16 @@ package com.github.continuedev.continueintellijextension.toolWindow -import com.github.continuedev.continueintellijextension.activities.showTutorial -import com.github.continuedev.continueintellijextension.constants.getConfigJsonPath -import com.github.continuedev.continueintellijextension.`continue`.* -import com.github.continuedev.continueintellijextension.factories.CustomSchemeHandlerFactory import com.github.continuedev.continueintellijextension.services.ContinuePluginService -import com.google.gson.Gson -import com.google.gson.JsonObject -import com.google.gson.JsonParser import com.intellij.openapi.actionSystem.ActionManager import com.intellij.openapi.actionSystem.AnAction import com.intellij.openapi.components.ServiceManager -import com.intellij.openapi.editor.colors.EditorColorsManager import com.intellij.openapi.project.DumbAware import com.intellij.openapi.project.Project -import com.intellij.openapi.util.Disposer import com.intellij.openapi.wm.ToolWindow import com.intellij.openapi.wm.ToolWindowFactory import com.intellij.ui.content.ContentFactory import com.intellij.ui.jcef.* -import kotlinx.coroutines.GlobalScope -import kotlinx.coroutines.launch -import org.cef.CefApp -import org.cef.browser.CefBrowser -import org.cef.handler.CefLoadHandlerAdapter import javax.swing.* -import kotlin.math.max -import kotlin.math.min - const val JS_QUERY_POOL_SIZE = "200" @@ -38,6 +21,13 @@ class ContinuePluginToolWindowFactory : ToolWindowFactory, DumbAware { toolWindow.contentManager.addContent(content) val titleActions = mutableListOf() createTitleActions(titleActions) + + // Add MaximizeToolWindow action + val action = ActionManager.getInstance().getAction("MaximizeToolWindow") + if (action != null) { + titleActions.add(action) + } + toolWindow.setTitleActions(titleActions) } @@ -53,200 +43,26 @@ class ContinuePluginToolWindowFactory : ToolWindowFactory, DumbAware { class ContinuePluginWindow(toolWindow: ToolWindow, project: Project) { - val PASS_THROUGH_TO_CORE = listOf( - "abort", - "getContinueDir", - "history/list", - "history/save", - "history/delete", - "history/load", - "devdata/log", - "config/addModel", - "config/deleteModel", - "config/addOpenAIKey", - "llm/streamComplete", - "llm/streamChat", - "llm/complete", - "command/run", - "context/loadSubmenuItems", - "context/getContextItems", - "context/addDocs", - "config/getBrowserSerialized", - ) - init { System.setProperty("ide.browser.jcef.jsQueryPoolSize", JS_QUERY_POOL_SIZE) System.setProperty("ide.browser.jcef.contextMenu.devTools.enabled", "true") } - val webView: JBCefBrowser by lazy { - val osName = System.getProperty("os.name").toLowerCase() - val os = when { - osName.contains("mac") || osName.contains("darwin") -> "darwin" - osName.contains("win") -> "win32" - osName.contains("nix") || osName.contains("nux") || osName.contains("aix") -> "linux" - else -> "linux" - } - - val browser = JBCefBrowser.createBuilder().setOffScreenRendering(os == "linux").build() - browser.jbCefClient.setProperty( - JBCefClient.Properties.JS_QUERY_POOL_SIZE, - JS_QUERY_POOL_SIZE - ) - registerAppSchemeHandler() - + val browser: ContinueBrowser by lazy { + val url = "http://continue/index.html"; // Use to get hot-reloading in local development - if (false) { - browser.loadURL("http://localhost:5173/jetbrains_index.html"); - } else { - browser.loadURL("http://continue/index.html") - } -// browser.loadHTML("") -// browser.loadURL("http://localhost:5173/index.html") - Disposer.register(project, browser) + // val url = "http://localhost:5173/jetbrains_index.html"; + val browser = ContinueBrowser(project, url) val continuePluginService = ServiceManager.getService( project, ContinuePluginService::class.java ) continuePluginService.continuePluginWindow = this - - // Listen for events sent from browser - val myJSQueryOpenInBrowser = JBCefJSQuery.create((browser as JBCefBrowserBase?)!!) - myJSQueryOpenInBrowser.addHandler { msg: String? -> - val parser = JsonParser() - val json: JsonObject = parser.parse(msg).asJsonObject - val messageType = json.get("messageType").asString - val data = json.get("data") - val messageId = json.get("messageId")?.asString - - val ide = continuePluginService.ideProtocolClient; - - val respond = fun(data: Any?) { - val jsonData = mutableMapOf( - "messageId" to messageId, - "data" to data, - "messageType" to messageType - ) - val jsonString = Gson().toJson(jsonData) - continuePluginService.sendToWebview(messageType, data, messageId ?: uuid()) - } - - if (PASS_THROUGH_TO_CORE.contains(messageType)) { - continuePluginService.coreMessenger?.request(messageType, data, messageId, respond) - return@addHandler null - } - - when (messageType) { - "onLoad" -> { - GlobalScope.launch { - // Set the colors to match Intellij theme - val colors = GetTheme().getTheme(); - continuePluginService.sendToWebview("setColors", colors) - - val jsonData = mutableMapOf( - "windowId" to continuePluginService.windowId, - "workspacePaths" to continuePluginService.workspacePaths, - "vscMachineId" to getMachineUniqueID(), - "vscMediaUrl" to "http://continue", - ) - respond(jsonData) - } - - } - "showLines" -> { - val data = data.asJsonObject - ide?.highlightCode(RangeInFile( - data.get("filepath").asString, - Range(Position( - data.get("start").asInt, - 0 - ), Position( - data.get("end").asInt, - 0 - )), - - ),"#00ff0022") - } - "showTutorial" -> { - showTutorial(project) - } - "showVirtualFile" -> { - val data = data.asJsonObject - ide?.showVirtualFile(data.get("name").asString, data.get("content").asString) - } - "showFile" -> { - val data = data.asJsonObject - ide?.setFileOpen(data.get("filepath").asString) - } - "reloadWindow" -> {} - "openConfigJson" -> { - ide?.setFileOpen(getConfigJsonPath()) - } - "readRangeInFile" -> { - val data = data.asJsonObject - ide?.readRangeInFile(RangeInFile( - data.get("filepath").asString, - Range(Position( - data.get("start").asInt, - 0 - ), Position( - data.get("end").asInt + 1, - 0 - )), - )) - } - "focusEditor" -> {} - - // IDE // - else -> { - if (msg != null) { - ide?.handleMessage(msg, respond) - } - } - } - - - null - } - - // Listen for the page load event - browser.jbCefClient.addLoadHandler(object : CefLoadHandlerAdapter() { - override fun onLoadingStateChange( - browser: CefBrowser?, - isLoading: Boolean, - canGoBack: Boolean, - canGoForward: Boolean - ) { - if (!isLoading) { - // The page has finished loading - executeJavaScript(browser, myJSQueryOpenInBrowser) - } - } - }, browser.cefBrowser) - browser } - fun executeJavaScript(browser: CefBrowser?, myJSQueryOpenInBrowser: JBCefJSQuery) { - // Execute JavaScript - you might want to handle potential exceptions here - val script = """window.postIntellijMessage = function(messageType, data, messageId) { - const msg = JSON.stringify({messageType, data, messageId}); - ${myJSQueryOpenInBrowser.inject("msg")} - }""".trimIndent() - - browser?.executeJavaScript(script, browser.url, 0) - } - val content: JComponent - get() = webView.component - - private fun registerAppSchemeHandler() { - CefApp.getInstance().registerSchemeHandlerFactory( - "http", - "continue", - CustomSchemeHandlerFactory() - ) - } + get() = browser.browser.component } } \ No newline at end of file diff --git a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/utils/Utils.kt b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/utils/Utils.kt new file mode 100644 index 000000000..d584b80f5 --- /dev/null +++ b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/utils/Utils.kt @@ -0,0 +1,34 @@ +package com.github.continuedev.continueintellijextension.utils + +import java.awt.Toolkit +import java.awt.event.KeyEvent + +enum class Os { + MAC, WINDOWS, LINUX +} +fun getOs(): Os { + val osName = System.getProperty("os.name").toLowerCase() + val os = when { + osName.contains("mac") || osName.contains("darwin") -> Os.MAC + osName.contains("win") -> Os.WINDOWS + osName.contains("nix") || osName.contains("nux") || osName.contains("aix") -> Os.LINUX + else -> Os.LINUX + } + return os +} + +fun getMetaKeyLabel(): String { + return when (getOs()) { + Os.MAC -> "⌘" + Os.WINDOWS -> "Ctrl" + Os.LINUX -> "Ctrl" + } +} + +fun getAltKeyLabel(): String { + return when (getOs()) { + Os.MAC -> "⌥" + Os.WINDOWS -> "Alt" + Os.LINUX -> "Alt" + } +} \ No newline at end of file diff --git a/extensions/intellij/src/main/resources/META-INF/plugin.xml b/extensions/intellij/src/main/resources/META-INF/plugin.xml index ae89f8e8b..0c02a2d70 100644 --- a/extensions/intellij/src/main/resources/META-INF/plugin.xml +++ b/extensions/intellij/src/main/resources/META-INF/plugin.xml @@ -16,6 +16,9 @@ factoryClass="com.github.continuedev.continueintellijextension.toolWindow.ContinuePluginToolWindowFactory"/> + messages.MyBundle @@ -33,21 +36,41 @@ + + + + + + + + + + + first-keystroke="alt shift Y"/> + first-keystroke="alt shift Y"/> + first-keystroke="alt shift N"/> + first-keystroke="alt shift N"/> [Reference](https://continue.dev/docs/reference/Model%20Providers/openai)", "### Free Trial\nNew users can try out Continue for free using a proxy server that securely makes calls to OpenAI using our API key. If you are ready to use your own API key or have used all 250 free uses, you can enter your API key in config.py where it says `apiKey=\"\"` or select another model provider.\n> [Reference](https://continue.dev/docs/reference/Model%20Providers/freetrial)", "### Anthropic\nTo get started with Anthropic models, you first need to sign up for the open beta [here](https://claude.ai/login) to obtain an API key.\n> [Reference](https://continue.dev/docs/reference/Model%20Providers/anthropicllm)", + "### Bedrock\nTo get started with Bedrock you need to sign up on AWS [here](https://aws.amazon.com/bedrock/claude/)", "### Together\nTogether is a hosted service that provides extremely fast streaming of open-source language models. To get started with Together:\n1. Obtain an API key from [here](https://together.ai)\n2. Paste below\n3. Select a model preset\n> [Reference](https://continue.dev/docs/reference/Model%20Providers/togetherllm)", "### Ollama\nTo get started with Ollama, follow these steps:\n1. Download from [ollama.ai](https://ollama.ai/) and open the application\n2. Open a terminal and run `ollama run `. Example model names are `codellama:7b-instruct` or `llama2:7b-text`. You can find the full list [here](https://ollama.ai/library).\n3. Make sure that the model name used in step 2 is the same as the one in config.py (e.g. `model=\"codellama:7b-instruct\"`)\n4. Once the model has finished downloading, you can start asking questions through Continue.\n> [Reference](https://continue.dev/docs/reference/Model%20Providers/ollama)", "### Huggingface TGI\n\n> [Reference](https://continue.dev/docs/reference/Model%20Providers/huggingfacetgi)", @@ -430,6 +439,7 @@ "claude-3-opus-20240229", "claude-3-sonnet-20240229", "claude-3-haiku-20240307", + "starcoder-7b", "AUTODETECT" ] } @@ -484,6 +494,7 @@ "stable-code-3b", "starcoder-1b", "starcoder-3b", + "starcoder2-3b", "mistral-tiny", "mistral-small", "mistral-medium", @@ -529,6 +540,34 @@ } } }, + { + "if": { + "properties": { + "provider": { + "enum": ["bedrock"] + } + }, + "required": ["provider"] + }, + "then": { + "properties": { + "model": { + "anyOf": [ + { + "enum": [ + "claude-3-sonnet-20240229", + "claude-3-haiku-20240307", + "claude-2" + ] + }, + { + "type": "string" + } + ] + } + } + } + }, { "if": { "properties": { @@ -639,7 +678,8 @@ "deepseek-1b", "stable-code-3b", "starcoder-1b", - "starcoder-3b" + "starcoder-3b", + "starcoder2-3b" ] }, { @@ -686,6 +726,7 @@ "stable-code-3b", "starcoder-1b", "starcoder-3b", + "starcoder2-3b", "AUTODETECT" ] }, @@ -715,6 +756,23 @@ } } }, + { + "if": { + "properties": { + "provider": { + "enum": ["groq"] + } + }, + "required": ["provider"] + }, + "then": { + "properties": { + "model": { + "enum": ["llama2-70b", "mistral-8x7b", "gemma"] + } + } + } + }, { "if": { "properties": { @@ -876,7 +934,8 @@ "deepseek-1b", "stable-code-3b", "starcoder-1b", - "starcoder-3b" + "starcoder-3b", + "starcoder2-3b" ] }, { @@ -932,7 +991,8 @@ "edit", "comment", "http", - "commit" + "commit", + "review" ], "type": "string", "markdownEnumDescriptions": [ @@ -943,7 +1003,8 @@ "Edit the highlighted code with given instructions", "Add comments to the highlighted code", "Write a custom slash command at your own HTTP endpoint. Set 'url' in the params object for the endpoint you have setup.", - "Generate a commit message for the current changes" + "Generate a commit message for the current changes", + "Review code and give feedback" ] }, { @@ -1314,9 +1375,26 @@ "apiVersion": { "type": "integer", "markdownDescription": "This context provider supports both Jira API version 2 and 3. It will use version 3 by default since that's what the cloud version uses, but if you have the datacenter version of Jira, you'll need to set the API Version to 2 using the `apiVersion` property." + }, + "requestOptions": { + "title": "Request Options", + "description": "Options for the HTTPS request to Jira.", + "default": { + "timeout": 7200, + "verifySsl": null, + "caBundlePath": null, + "proxy": null, + "headers": null, + "extraBodyProperties": null + }, + "allOf": [ + { + "$ref": "#/definitions/RequestOptions" + } + ] } }, - "required": ["domain", "email", "token"] + "required": ["domain", "token"] } }, "required": ["params"] @@ -1559,7 +1637,7 @@ "type": "object", "properties": { "provider": { - "enum": ["transformers.js", "ollama", "openai"] + "enum": ["transformers.js", "ollama", "openai", "free-trial"] }, "model": { "type": "string" @@ -1588,9 +1666,74 @@ } ] }, + "reranker": { + "title": "Reranker", + "markdownDescription": "The reranker is responsible for selecting the final results when retrieving snippets from your codebase.", + "type": "object", + "properties": { + "name": { + "enum": ["voyage", "llm", "free-trial"] + }, + "params": { + "type": "object" + } + }, + "required": ["name"], + "allOf": [ + { + "if": { + "properties": { + "name": { + "enum": ["llm"] + } + }, + "required": ["name"] + }, + "then": { + "properties": { + "params": { + "type": "object", + "properties": { + "modelTitle": { + "type": "string" + } + }, + "required": ["modelTitle"] + } + } + } + }, + { + "if": { + "properties": { + "name": { + "enum": ["voyage"] + } + }, + "required": ["name"] + }, + "then": { + "properties": { + "params": { + "type": "object", + "properties": { + "apiKey": { + "type": "string" + }, + "model": { + "enum": ["rerank-lite-1"] + } + }, + "required": ["apiKey"] + } + } + } + } + ] + }, "tabAutocompleteModel": { "title": "Tab Autocomplete Model", - "markdownDescription": "The model used for tab autocompletion. If undefined, Continue will default to using starcoder:3b on a local Ollama instance.\n\n*IMPORTANT*:\n\nIf you use a custom model, ensure that it is one trained for fill-in-the-middle completions. An instruct model is typically not well-suited to autocomplete and you may receive unsatisfactory completions.", + "markdownDescription": "The model used for tab autocompletion. If undefined, Continue will default to using starcoder2:3b on a local Ollama instance.\n\n*IMPORTANT*:\n\nIf you use a custom model, ensure that it is one trained for fill-in-the-middle completions. An instruct model is typically not well-suited to autocomplete and you may receive unsatisfactory completions.", "default": { "title": "Tab Autocomplete Model", "provider": "ollama", @@ -1603,6 +1746,11 @@ "type": "object", "markdownDescription": "These options let you customize your tab-autocomplete experience. Read about all options in [the docs](https://continue.dev/docs/walkthroughs/tab-autocomplete#configuration-options).", "properties": { + "disable": { + "type": "boolean", + "description": "Disable tab autocomplete. This can also be done from the IDE settings.", + "default": false + }, "useCopyBuffer": { "type": "boolean", "description": "Determines whether the copy buffer will be considered when contructing the prompt." @@ -1649,6 +1797,48 @@ } }, "required": [] + }, + "ui": { + "type": "object", + "properties": { + "codeBlockToolbarPosition": { + "enum": ["top", "bottom"], + "default": "top", + "description": "Whether to show the copy and apply code buttons at the top or bottom of code blocks in the sidebar." + } + } + }, + "experimental": { + "type": "object", + "title": "Experimental", + "description": "Experimental properties are subject to change.", + "properties": { + "contextMenuPrompts": { + "type": "object", + "properties": { + "comment": { + "type": "string", + "default": "Write comments for this code. Do not change anything about the code itself." + }, + "docstring": { + "type": "string", + "default": "Write a docstring for this code. Do not change anything about the code itself." + }, + "fix": { + "type": "string", + "default": "Fix this code" + }, + "optimize": { + "type": "string", + "default": "Optimize this code" + }, + "fixGrammar": { + "type": "string", + "default": "If there are any grammar or spelling mistakes in this writing, fix them. Do not make other large changes to the writing." + } + } + } + } } } } diff --git a/extensions/intellij/src/main/resources/continue_tutorial.py b/extensions/intellij/src/main/resources/continue_tutorial.py index 7c8d6b0c8..9a7194ad0 100644 --- a/extensions/intellij/src/main/resources/continue_tutorial.py +++ b/extensions/intellij/src/main/resources/continue_tutorial.py @@ -39,7 +39,7 @@ select the code and toggle the Continue input box""" # endregion -# region ————————————————————————————————— Part 2: Edit code [⌘ ⇧ J] ————————————————————————————————— +# region ————————————————————————————————— Part 2: Edit code [⌘ I] ————————————————————————————————— """Step 1: Highlight this code""" @@ -54,15 +54,15 @@ def bubble_sort(x): return x -"""Step 2: Use the keyboard shortcut [⌘ J] to +"""Step 2: Use the keyboard shortcut [⌘ I] to select the code""" -"""Step 3: Type "/edit " and press Enter""" -# e.g.) /edit optimize this function -# e.g.) /edit write comments +"""Step 3: Type instructions to edit the code and press Enter""" +# e.g.) "optimize this function" +# e.g.) "edit write comments" """Step 4: Use keyboard shortcuts to -accept [⌘ ⇧ ⏎] or reject [⌘ ⇧ ⌫] the edit""" +accept [⌥ ⇧ Y] or reject [⌥ ⇧ N] the edit""" # endregion diff --git a/extensions/vscode/config_schema.json b/extensions/vscode/config_schema.json index a8c88a803..d94309807 100644 --- a/extensions/vscode/config_schema.json +++ b/extensions/vscode/config_schema.json @@ -6,6 +6,12 @@ "title": "BaseCompletionOptions", "type": "object", "properties": { + "stream": { + "title": "Stream", + "description": "Whether to stream the LLM response. Currently only respected by the 'anthropic' provider. Otherwise will always stream.", + "type": "boolean", + "default": true + }, "temperature": { "title": "Temperature", "description": "The temperature of the completion.", @@ -128,6 +134,7 @@ "openai", "free-trial", "anthropic", + "bedrock", "together", "ollama", "huggingface-tgi", @@ -139,12 +146,14 @@ "llamafile", "mistral", "deepinfra", - "flowise" + "flowise", + "groq" ], "markdownEnumDescriptions": [ "### OpenAI\nUse gpt-4, gpt-3.5-turbo, or any other OpenAI model. See [here](https://openai.com/product#made-for-developers) to obtain an API key.\n\n> [Reference](https://continue.dev/docs/reference/Model%20Providers/openai)", "### Free Trial\nNew users can try out Continue for free using a proxy server that securely makes calls to OpenAI using our API key. If you are ready to use your own API key or have used all 250 free uses, you can enter your API key in config.py where it says `apiKey=\"\"` or select another model provider.\n> [Reference](https://continue.dev/docs/reference/Model%20Providers/freetrial)", "### Anthropic\nTo get started with Anthropic models, you first need to sign up for the open beta [here](https://claude.ai/login) to obtain an API key.\n> [Reference](https://continue.dev/docs/reference/Model%20Providers/anthropicllm)", + "### Bedrock\nTo get started with Bedrock you need to sign up on AWS [here](https://aws.amazon.com/bedrock/claude/)", "### Together\nTogether is a hosted service that provides extremely fast streaming of open-source language models. To get started with Together:\n1. Obtain an API key from [here](https://together.ai)\n2. Paste below\n3. Select a model preset\n> [Reference](https://continue.dev/docs/reference/Model%20Providers/togetherllm)", "### Ollama\nTo get started with Ollama, follow these steps:\n1. Download from [ollama.ai](https://ollama.ai/) and open the application\n2. Open a terminal and run `ollama run `. Example model names are `codellama:7b-instruct` or `llama2:7b-text`. You can find the full list [here](https://ollama.ai/library).\n3. Make sure that the model name used in step 2 is the same as the one in config.py (e.g. `model=\"codellama:7b-instruct\"`)\n4. Once the model has finished downloading, you can start asking questions through Continue.\n> [Reference](https://continue.dev/docs/reference/Model%20Providers/ollama)", "### Huggingface TGI\n\n> [Reference](https://continue.dev/docs/reference/Model%20Providers/huggingfacetgi)", @@ -430,6 +439,7 @@ "claude-3-opus-20240229", "claude-3-sonnet-20240229", "claude-3-haiku-20240307", + "starcoder-7b", "AUTODETECT" ] } @@ -484,6 +494,7 @@ "stable-code-3b", "starcoder-1b", "starcoder-3b", + "starcoder2-3b", "mistral-tiny", "mistral-small", "mistral-medium", @@ -529,6 +540,34 @@ } } }, + { + "if": { + "properties": { + "provider": { + "enum": ["bedrock"] + } + }, + "required": ["provider"] + }, + "then": { + "properties": { + "model": { + "anyOf": [ + { + "enum": [ + "claude-3-sonnet-20240229", + "claude-3-haiku-20240307", + "claude-2" + ] + }, + { + "type": "string" + } + ] + } + } + } + }, { "if": { "properties": { @@ -541,7 +580,11 @@ "then": { "properties": { "model": { - "enum": ["chat-bison-001", "gemini-pro"] + "enum": [ + "chat-bison-001", + "gemini-pro", + "gemini-1.5-pro-latest" + ] } } } @@ -639,7 +682,8 @@ "deepseek-1b", "stable-code-3b", "starcoder-1b", - "starcoder-3b" + "starcoder-3b", + "starcoder2-3b" ] }, { @@ -686,6 +730,7 @@ "stable-code-3b", "starcoder-1b", "starcoder-3b", + "starcoder2-3b", "AUTODETECT" ] }, @@ -715,6 +760,23 @@ } } }, + { + "if": { + "properties": { + "provider": { + "enum": ["groq"] + } + }, + "required": ["provider"] + }, + "then": { + "properties": { + "model": { + "enum": ["llama2-70b", "mistral-8x7b", "gemma"] + } + } + } + }, { "if": { "properties": { @@ -870,13 +932,15 @@ "claude-2.1", "chat-bison-001", "gemini-pro", + "gemini-1.5-pro-latest", "mistral-tiny", "mistral-small", "mistral-medium", "deepseek-1b", "stable-code-3b", "starcoder-1b", - "starcoder-3b" + "starcoder-3b", + "starcoder2-3b" ] }, { @@ -932,7 +996,8 @@ "edit", "comment", "http", - "commit" + "commit", + "review" ], "type": "string", "markdownEnumDescriptions": [ @@ -943,7 +1008,8 @@ "Edit the highlighted code with given instructions", "Add comments to the highlighted code", "Write a custom slash command at your own HTTP endpoint. Set 'url' in the params object for the endpoint you have setup.", - "Generate a commit message for the current changes" + "Generate a commit message for the current changes", + "Review code and give feedback" ] }, { @@ -1314,9 +1380,26 @@ "apiVersion": { "type": "integer", "markdownDescription": "This context provider supports both Jira API version 2 and 3. It will use version 3 by default since that's what the cloud version uses, but if you have the datacenter version of Jira, you'll need to set the API Version to 2 using the `apiVersion` property." + }, + "requestOptions": { + "title": "Request Options", + "description": "Options for the HTTPS request to Jira.", + "default": { + "timeout": 7200, + "verifySsl": null, + "caBundlePath": null, + "proxy": null, + "headers": null, + "extraBodyProperties": null + }, + "allOf": [ + { + "$ref": "#/definitions/RequestOptions" + } + ] } }, - "required": ["domain", "email", "token"] + "required": ["domain", "token"] } }, "required": ["params"] @@ -1559,7 +1642,7 @@ "type": "object", "properties": { "provider": { - "enum": ["transformers.js", "ollama", "openai"] + "enum": ["transformers.js", "ollama", "openai", "free-trial"] }, "model": { "type": "string" @@ -1588,9 +1671,74 @@ } ] }, + "reranker": { + "title": "Reranker", + "markdownDescription": "The reranker is responsible for selecting the final results when retrieving snippets from your codebase.", + "type": "object", + "properties": { + "name": { + "enum": ["voyage", "llm", "free-trial"] + }, + "params": { + "type": "object" + } + }, + "required": ["name"], + "allOf": [ + { + "if": { + "properties": { + "name": { + "enum": ["llm"] + } + }, + "required": ["name"] + }, + "then": { + "properties": { + "params": { + "type": "object", + "properties": { + "modelTitle": { + "type": "string" + } + }, + "required": ["modelTitle"] + } + } + } + }, + { + "if": { + "properties": { + "name": { + "enum": ["voyage"] + } + }, + "required": ["name"] + }, + "then": { + "properties": { + "params": { + "type": "object", + "properties": { + "apiKey": { + "type": "string" + }, + "model": { + "enum": ["rerank-lite-1"] + } + }, + "required": ["apiKey"] + } + } + } + } + ] + }, "tabAutocompleteModel": { "title": "Tab Autocomplete Model", - "markdownDescription": "The model used for tab autocompletion. If undefined, Continue will default to using starcoder:3b on a local Ollama instance.\n\n*IMPORTANT*:\n\nIf you use a custom model, ensure that it is one trained for fill-in-the-middle completions. An instruct model is typically not well-suited to autocomplete and you may receive unsatisfactory completions.", + "markdownDescription": "The model used for tab autocompletion. If undefined, Continue will default to using starcoder2:3b on a local Ollama instance.\n\n*IMPORTANT*:\n\nIf you use a custom model, ensure that it is one trained for fill-in-the-middle completions. An instruct model is typically not well-suited to autocomplete and you may receive unsatisfactory completions.", "default": { "title": "Tab Autocomplete Model", "provider": "ollama", @@ -1603,6 +1751,11 @@ "type": "object", "markdownDescription": "These options let you customize your tab-autocomplete experience. Read about all options in [the docs](https://continue.dev/docs/walkthroughs/tab-autocomplete#configuration-options).", "properties": { + "disable": { + "type": "boolean", + "description": "Disable tab autocomplete. This can also be done from the IDE settings.", + "default": false + }, "useCopyBuffer": { "type": "boolean", "description": "Determines whether the copy buffer will be considered when contructing the prompt." @@ -1649,6 +1802,48 @@ } }, "required": [] + }, + "ui": { + "type": "object", + "properties": { + "codeBlockToolbarPosition": { + "enum": ["top", "bottom"], + "default": "top", + "description": "Whether to show the copy and apply code buttons at the top or bottom of code blocks in the sidebar." + } + } + }, + "experimental": { + "type": "object", + "title": "Experimental", + "description": "Experimental properties are subject to change.", + "properties": { + "contextMenuPrompts": { + "type": "object", + "properties": { + "comment": { + "type": "string", + "default": "Write comments for this code. Do not change anything about the code itself." + }, + "docstring": { + "type": "string", + "default": "Write a docstring for this code. Do not change anything about the code itself." + }, + "fix": { + "type": "string", + "default": "Fix this code" + }, + "optimize": { + "type": "string", + "default": "Optimize this code" + }, + "fixGrammar": { + "type": "string", + "default": "If there are any grammar or spelling mistakes in this writing, fix them. Do not make other large changes to the writing." + } + } + } + } } } } diff --git a/extensions/vscode/continue_rc_schema.json b/extensions/vscode/continue_rc_schema.json index 67a294786..d1cbb3d42 100644 --- a/extensions/vscode/continue_rc_schema.json +++ b/extensions/vscode/continue_rc_schema.json @@ -6,6 +6,12 @@ "title": "BaseCompletionOptions", "type": "object", "properties": { + "stream": { + "title": "Stream", + "description": "Whether to stream the LLM response. Currently only respected by the 'anthropic' provider. Otherwise will always stream.", + "type": "boolean", + "default": true + }, "temperature": { "title": "Temperature", "description": "The temperature of the completion.", @@ -128,6 +134,7 @@ "openai", "free-trial", "anthropic", + "bedrock", "together", "ollama", "huggingface-tgi", @@ -139,12 +146,14 @@ "llamafile", "mistral", "deepinfra", - "flowise" + "flowise", + "groq" ], "markdownEnumDescriptions": [ "### OpenAI\nUse gpt-4, gpt-3.5-turbo, or any other OpenAI model. See [here](https://openai.com/product#made-for-developers) to obtain an API key.\n\n> [Reference](https://continue.dev/docs/reference/Model%20Providers/openai)", "### Free Trial\nNew users can try out Continue for free using a proxy server that securely makes calls to OpenAI using our API key. If you are ready to use your own API key or have used all 250 free uses, you can enter your API key in config.py where it says `apiKey=\"\"` or select another model provider.\n> [Reference](https://continue.dev/docs/reference/Model%20Providers/freetrial)", "### Anthropic\nTo get started with Anthropic models, you first need to sign up for the open beta [here](https://claude.ai/login) to obtain an API key.\n> [Reference](https://continue.dev/docs/reference/Model%20Providers/anthropicllm)", + "### Bedrock\nTo get started with Bedrock you need to sign up on AWS [here](https://aws.amazon.com/bedrock/claude/)", "### Together\nTogether is a hosted service that provides extremely fast streaming of open-source language models. To get started with Together:\n1. Obtain an API key from [here](https://together.ai)\n2. Paste below\n3. Select a model preset\n> [Reference](https://continue.dev/docs/reference/Model%20Providers/togetherllm)", "### Ollama\nTo get started with Ollama, follow these steps:\n1. Download from [ollama.ai](https://ollama.ai/) and open the application\n2. Open a terminal and run `ollama run `. Example model names are `codellama:7b-instruct` or `llama2:7b-text`. You can find the full list [here](https://ollama.ai/library).\n3. Make sure that the model name used in step 2 is the same as the one in config.py (e.g. `model=\"codellama:7b-instruct\"`)\n4. Once the model has finished downloading, you can start asking questions through Continue.\n> [Reference](https://continue.dev/docs/reference/Model%20Providers/ollama)", "### Huggingface TGI\n\n> [Reference](https://continue.dev/docs/reference/Model%20Providers/huggingfacetgi)", @@ -466,6 +475,7 @@ "claude-3-opus-20240229", "claude-3-sonnet-20240229", "claude-3-haiku-20240307", + "starcoder-7b", "AUTODETECT" ] } @@ -524,6 +534,7 @@ "stable-code-3b", "starcoder-1b", "starcoder-3b", + "starcoder2-3b", "mistral-tiny", "mistral-small", "mistral-medium", @@ -573,6 +584,38 @@ } } }, + { + "if": { + "properties": { + "provider": { + "enum": [ + "bedrock" + ] + } + }, + "required": [ + "provider" + ] + }, + "then": { + "properties": { + "model": { + "anyOf": [ + { + "enum": [ + "claude-3-sonnet-20240229", + "claude-3-haiku-20240307", + "claude-2" + ] + }, + { + "type": "string" + } + ] + } + } + } + }, { "if": { "properties": { @@ -700,7 +743,8 @@ "deepseek-1b", "stable-code-3b", "starcoder-1b", - "starcoder-3b" + "starcoder-3b", + "starcoder2-3b" ] }, { @@ -751,6 +795,7 @@ "stable-code-3b", "starcoder-1b", "starcoder-3b", + "starcoder2-3b", "AUTODETECT" ] }, @@ -788,6 +833,31 @@ } } }, + { + "if": { + "properties": { + "provider": { + "enum": [ + "groq" + ] + } + }, + "required": [ + "provider" + ] + }, + "then": { + "properties": { + "model": { + "enum": [ + "llama2-70b", + "mistral-8x7b", + "gemma" + ] + } + } + } + }, { "if": { "properties": { @@ -975,7 +1045,8 @@ "deepseek-1b", "stable-code-3b", "starcoder-1b", - "starcoder-3b" + "starcoder-3b", + "starcoder2-3b" ] }, { @@ -1033,7 +1104,8 @@ "edit", "comment", "http", - "commit" + "commit", + "review" ], "type": "string", "markdownEnumDescriptions": [ @@ -1044,7 +1116,8 @@ "Edit the highlighted code with given instructions", "Add comments to the highlighted code", "Write a custom slash command at your own HTTP endpoint. Set 'url' in the params object for the endpoint you have setup.", - "Generate a commit message for the current changes" + "Generate a commit message for the current changes", + "Review code and give feedback" ] }, { @@ -1471,11 +1544,27 @@ "apiVersion": { "type": "integer", "markdownDescription": "This context provider supports both Jira API version 2 and 3. It will use version 3 by default since that's what the cloud version uses, but if you have the datacenter version of Jira, you'll need to set the API Version to 2 using the `apiVersion` property." + }, + "requestOptions": { + "title": "Request Options", + "description": "Options for the HTTPS request to Jira.", + "default": { + "timeout": 7200, + "verifySsl": null, + "caBundlePath": null, + "proxy": null, + "headers": null, + "extraBodyProperties": null + }, + "allOf": [ + { + "$ref": "#/definitions/RequestOptions" + } + ] } }, "required": [ "domain", - "email", "token" ] } @@ -1744,7 +1833,8 @@ "enum": [ "transformers.js", "ollama", - "openai" + "openai", + "free-trial" ] }, "model": { @@ -1782,9 +1872,94 @@ } ] }, + "reranker": { + "title": "Reranker", + "markdownDescription": "The reranker is responsible for selecting the final results when retrieving snippets from your codebase.", + "type": "object", + "properties": { + "name": { + "enum": [ + "voyage", + "llm", + "free-trial" + ] + }, + "params": { + "type": "object" + } + }, + "required": [ + "name" + ], + "allOf": [ + { + "if": { + "properties": { + "name": { + "enum": [ + "llm" + ] + } + }, + "required": [ + "name" + ] + }, + "then": { + "properties": { + "params": { + "type": "object", + "properties": { + "modelTitle": { + "type": "string" + } + }, + "required": [ + "modelTitle" + ] + } + } + } + }, + { + "if": { + "properties": { + "name": { + "enum": [ + "voyage" + ] + } + }, + "required": [ + "name" + ] + }, + "then": { + "properties": { + "params": { + "type": "object", + "properties": { + "apiKey": { + "type": "string" + }, + "model": { + "enum": [ + "rerank-lite-1" + ] + } + }, + "required": [ + "apiKey" + ] + } + } + } + } + ] + }, "tabAutocompleteModel": { "title": "Tab Autocomplete Model", - "markdownDescription": "The model used for tab autocompletion. If undefined, Continue will default to using starcoder:3b on a local Ollama instance.\n\n*IMPORTANT*:\n\nIf you use a custom model, ensure that it is one trained for fill-in-the-middle completions. An instruct model is typically not well-suited to autocomplete and you may receive unsatisfactory completions.", + "markdownDescription": "The model used for tab autocompletion. If undefined, Continue will default to using starcoder2:3b on a local Ollama instance.\n\n*IMPORTANT*:\n\nIf you use a custom model, ensure that it is one trained for fill-in-the-middle completions. An instruct model is typically not well-suited to autocomplete and you may receive unsatisfactory completions.", "default": { "title": "Tab Autocomplete Model", "provider": "ollama", @@ -1797,6 +1972,11 @@ "type": "object", "markdownDescription": "These options let you customize your tab-autocomplete experience. Read about all options in [the docs](https://continue.dev/docs/walkthroughs/tab-autocomplete#configuration-options).", "properties": { + "disable": { + "type": "boolean", + "description": "Disable tab autocomplete. This can also be done from the IDE settings.", + "default": false + }, "useCopyBuffer": { "type": "boolean", "description": "Determines whether the copy buffer will be considered when contructing the prompt." @@ -1848,6 +2028,51 @@ }, "required": [] }, + "ui": { + "type": "object", + "properties": { + "codeBlockToolbarPosition": { + "enum": [ + "top", + "bottom" + ], + "default": "top", + "description": "Whether to show the copy and apply code buttons at the top or bottom of code blocks in the sidebar." + } + } + }, + "experimental": { + "type": "object", + "title": "Experimental", + "description": "Experimental properties are subject to change.", + "properties": { + "contextMenuPrompts": { + "type": "object", + "properties": { + "comment": { + "type": "string", + "default": "Write comments for this code. Do not change anything about the code itself." + }, + "docstring": { + "type": "string", + "default": "Write a docstring for this code. Do not change anything about the code itself." + }, + "fix": { + "type": "string", + "default": "Fix this code" + }, + "optimize": { + "type": "string", + "default": "Optimize this code" + }, + "fixGrammar": { + "type": "string", + "default": "If there are any grammar or spelling mistakes in this writing, fix them. Do not make other large changes to the writing." + } + } + } + } + }, "mergeBehavior": { "type": "string", "enum": [ diff --git a/extensions/vscode/esbuild.js b/extensions/vscode/esbuild.js index fed18197a..95a23bc72 100644 --- a/extensions/vscode/esbuild.js +++ b/extensions/vscode/esbuild.js @@ -6,7 +6,7 @@ const esbuildConfig = { entryPoints: ["src/extension.ts"], bundle: true, outfile: "out/extension.js", - external: ["vscode", "esbuild"], + external: ["vscode", "esbuild", "./xhr-sync-worker.js"], format: "cjs", platform: "node", sourcemap: true, diff --git a/extensions/vscode/media/welcome.md b/extensions/vscode/media/welcome.md index d407ba29f..dac249e0a 100644 --- a/extensions/vscode/media/welcome.md +++ b/extensions/vscode/media/welcome.md @@ -1,5 +1,11 @@ # 👋 Welcome to Continue +## ❗️ Before you get started + +Continue is currently in the left sidebar, but we recommend moving it to the right. This way it won't cover your file explorer. You can move it back at any time. + +![Move Continue to right sidebar](./sidebar.gif) + ## 🔑 Most important shortcuts > If you've been using Continue, these have changed. You can always customize them in VS Code settings. @@ -12,16 +18,10 @@ Cmd/Ctrl + Shift + R = Automatically debug terminal -## ❗️ Before you get started - -Continue is currently in the left sidebar, but we recommend moving it to the right. This way it won't cover your file explorer. You can move it back at any time. - -![Move Continue to right sidebar](./sidebar.gif) - ## ⚡️ Setting up tab autocomplete 1. Download [Ollama](https://ollama.ai) -2. Download starcoder:3b by running `ollama run starcoder:3b` in the terminal +2. Download starcoder2:3b by running `ollama run starcoder2:3b` in the terminal 3. That's it! You can disable autocomplete at any time by clicking the `Continue` button in the status bar (bottom right of the VS Code window) > Learn how to customize your autocomplete experience in [our walkthrough](https://continue.dev/docs/walkthroughs/tab-autocomplete) diff --git a/extensions/vscode/package-lock.json b/extensions/vscode/package-lock.json index 6ab6ac9f7..4c98f50b6 100644 --- a/extensions/vscode/package-lock.json +++ b/extensions/vscode/package-lock.json @@ -1,12 +1,12 @@ { "name": "continue", - "version": "0.9.92", + "version": "0.8.22", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "continue", - "version": "0.9.92", + "version": "0.8.22", "license": "Apache-2.0", "dependencies": { "@electron/rebuild": "^3.2.10", @@ -48,7 +48,7 @@ "tailwindcss": "^3.3.2", "undici": "^6.2.0", "uuidv4": "^6.2.13", - "vectordb": "^0.4.3", + "vectordb": "0.4.12", "vscode-languageclient": "^8.0.2", "ws": "^8.13.0", "yarn": "^1.22.21" @@ -86,7 +86,7 @@ }, "../../core": { "name": "@continuedev/core", - "version": "1.0.4", + "version": "1.0.6", "license": "Apache-2.0", "dependencies": { "@mozilla/readability": "^0.5.0", @@ -106,6 +106,7 @@ "handlebars": "^4.7.8", "http-proxy-agent": "^7.0.1", "https-proxy-agent": "^7.0.3", + "ignore": "^5.3.1", "js-tiktoken": "^1.0.8", "jsdom": "^24.0.0", "llama-tokenizer-js": "^1.1.3", @@ -123,7 +124,7 @@ "sqlite3": "^5.1.7", "tree-sitter-wasms": "^0.1.6", "uuid": "^9.0.1", - "vectordb": "^0.4.12", + "vectordb": "0.4.12", "web-tree-sitter": "^0.21.0" }, "devDependencies": { diff --git a/extensions/vscode/package.json b/extensions/vscode/package.json index d878e141f..3886791a1 100644 --- a/extensions/vscode/package.json +++ b/extensions/vscode/package.json @@ -1,7 +1,7 @@ { "name": "continue", "icon": "media/icon.png", - "version": "0.8.22", + "version": "0.9.92", "repository": { "type": "git", "url": "https://github.com/continuedev/continue" @@ -100,6 +100,18 @@ "group": "Continue", "icon": "$(stop)" }, + { + "command": "continue.acceptVerticalDiffBlock", + "category": "Continue", + "title": "Accept Vertical Diff Block", + "group": "Continue" + }, + { + "command": "continue.rejectVerticalDiffBlock", + "category": "Continue", + "title": "Reject Vertical Diff Block", + "group": "Continue" + }, { "command": "continue.quickEdit", "category": "Continue", @@ -219,7 +231,17 @@ "command": "continue.rejectDiff", "mac": "cmd+z", "key": "ctrl+z", - "when": "continue.streamingDiff" + "when": "continue.diffVisible" + }, + { + "command": "continue.acceptVerticalDiffBlock", + "mac": "alt+cmd+y", + "key": "alt+ctrl+y" + }, + { + "command": "continue.rejectVerticalDiffBlock", + "mac": "alt+cmd+n", + "key": "alt+ctrl+n" }, { "command": "continue.quickEdit", @@ -508,7 +530,7 @@ "tailwindcss": "^3.3.2", "undici": "^6.2.0", "uuidv4": "^6.2.13", - "vectordb": "^0.4.3", + "vectordb": "0.4.12", "vscode-languageclient": "^8.0.2", "ws": "^8.13.0", "yarn": "^1.22.21" diff --git a/extensions/vscode/scripts/package.js b/extensions/vscode/scripts/package.js index 208ef0019..e5b376fac 100644 --- a/extensions/vscode/scripts/package.js +++ b/extensions/vscode/scripts/package.js @@ -14,5 +14,7 @@ const command = isPreRelease exec(command, (error) => { if (error) throw error; - console.log("vsce package completed"); + console.log( + "vsce package completed - extension created at extensions/vscode/build/continue-patch.vsix", + ); }); diff --git a/extensions/vscode/scripts/prepackage.js b/extensions/vscode/scripts/prepackage.js index 3b3e06a0e..4444362c4 100644 --- a/extensions/vscode/scripts/prepackage.js +++ b/extensions/vscode/scripts/prepackage.js @@ -4,12 +4,56 @@ const ncp = require("ncp").ncp; const path = require("path"); const { rimrafSync } = require("rimraf"); +// Clear folders that will be packaged to ensure clean slate +rimrafSync(path.join(__dirname, "bin")); +rimrafSync(path.join(__dirname, "out")); + +// Get the target to package for let target = undefined; const args = process.argv; if (args[2] === "--target") { target = args[3]; } +let os; +let arch; +if (!target) { + os = { + aix: "linux", + darwin: "darwin", + freebsd: "linux", + linux: "linux", + openbsd: "linux", + sunos: "linux", + win32: "win32", + }[process.platform]; + 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]; +} + +if (os === "alpine") { + os = "linux"; +} +if (arch === "armhf") { + arch = "arm64"; +} +target = `${os}-${arch}`; +console.log("[info] Using target: ", target); + +const exe = os === "win32" ? ".exe" : ""; + (async () => { console.log("[info] Packaging extension for target ", target); @@ -47,12 +91,12 @@ if (args[2] === "--target") { } // Install node_modules // - execSync("npm install"); + execSync("npm install --no-save"); console.log("[info] npm install in extensions/vscode completed"); process.chdir("../../gui"); - execSync("npm install"); + execSync("npm install --no-save"); console.log("[info] npm install in gui completed"); if (ghAction()) { @@ -124,35 +168,6 @@ if (args[2] === "--target") { // Copy over native / wasm modules // process.chdir("../extensions/vscode"); - // If target doesn't exist, but the bin folder also doesn't, we want to download it once, to help set up the dev environment - if (!target) { - const os = { - aix: "linux", - darwin: "darwin", - freebsd: "linux", - linux: "linux", - openbsd: "linux", - sunos: "linux", - win32: "win32", - }[process.platform]; - 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]; - - target = `${os}-${arch}`; - console.log("[info] Detected target: ", target); - } fs.mkdirSync("bin", { recursive: true }); // onnxruntime-node @@ -257,7 +272,7 @@ if (args[2] === "--target") { } // GitHub Actions doesn't support ARM, so we need to download pre-saved binaries - if (ghAction() && isArm()) { + if (isArm()) { // Neither lancedb nor sqlite3 have pre-built windows arm64 binaries if (!isWin()) { // lancedb binary @@ -348,4 +363,124 @@ if (args[2] === "--target") { "node_modules/jsdom/lib/jsdom/living/xhr/xhr-sync-worker.js", "out/xhr-sync-worker.js", ); + + // Validate the all of the necessary files are present + validateFilesPresent(); })(); + +function validateFilesPresent() { + // This script verifies after pacakging that necessary files are in the correct locations + // In many cases just taking a sample file from the folder when they are all roughly the same thing + + const pathsToVerify = [ + // Queries used to create the index for @code context provider + "tree-sitter/code-snippet-queries/tree-sitter-c_sharp-tags.scm", + + // Queries used for @outline and @highlights context providers + "tag-qry/tree-sitter-c_sharp-tags.scm", + + // onnx runtime bindngs + `bin/napi-v3/${os}/${arch}/onnxruntime_binding.node`, + `bin/napi-v3/${os}/${arch}/${ + os === "darwin" + ? "libonnxruntime.1.14.0.dylib" + : os === "linux" + ? "libonnxruntime.so.1.14.0" + : "onnxruntime.dll" + }`, + "builtin-themes/dark_modern.json", + + // Code/styling for the sidebar + "gui/assets/index.js", + "gui/assets/index.css", + + // Tutorial + "media/welcome.md", + "continue_tutorial.py", + "config_schema.json", + + // Embeddings model + "models/all-MiniLM-L6-v2/config.json", + "models/all-MiniLM-L6-v2/special_tokens_map.json", + "models/all-MiniLM-L6-v2/tokenizer_config.json", + "models/all-MiniLM-L6-v2/tokenizer.json", + "models/all-MiniLM-L6-v2/vocab.txt", + "models/all-MiniLM-L6-v2/onnx/model_quantized.onnx", + + // node_modules (it's a bit confusing why this is necessary) + `node_modules/@vscode/ripgrep/bin/rg${exe}`, + + // out directory (where the extension.js lives) + // "out/extension.js", This is generated afterward by vsce + // web-tree-sitter + "out/tree-sitter.wasm", + // Worker required by jsdom + "out/xhr-sync-worker.js", + // SQLite3 Node native module + "out/build/Release/node_sqlite3.node", + + // out/node_modules (to be accessed by extension.js) + `out/node_modules/@vscode/ripgrep/bin/rg${exe}`, + `out/node_modules/@esbuild/${ + target === "win32-arm64" + ? "esbuild.exe" + : target === "win32-x64" + ? "win32-x64/esbuild.exe" + : `${target}/bin/esbuild` + }`, + `out/node_modules/@lancedb/vectordb-${ + os === "win32" + ? "win32-x64-msvc" + : `${target}${os === "linux" ? "-gnu" : ""}` + }/index.node`, + `out/node_modules/esbuild/lib/main.js`, + `out/node_modules/esbuild/bin/esbuild`, + ]; + + let missingFiles = []; + for (const path of pathsToVerify) { + if (!fs.existsSync(path)) { + const parentFolder = path.split("/").slice(0, -1).join("/"); + const grandparentFolder = path.split("/").slice(0, -2).join("/"); + const grandGrandparentFolder = path.split("/").slice(0, -3).join("/"); + + console.error(`File ${path} does not exist`); + if (!fs.existsSync(parentFolder)) { + console.error(`Parent folder ${parentFolder} does not exist`); + } else { + console.error( + "Contents of parent folder:", + fs.readdirSync(parentFolder), + ); + } + if (!fs.existsSync(grandparentFolder)) { + console.error(`Grandparent folder ${grandparentFolder} does not exist`); + if (!fs.existsSync(grandGrandparentFolder)) { + console.error( + `Grandgrandparent folder ${grandGrandparentFolder} does not exist`, + ); + } else { + console.error( + "Contents of grandgrandparent folder:", + fs.readdirSync(grandGrandparentFolder), + ); + } + } else { + console.error( + "Contents of grandparent folder:", + fs.readdirSync(grandparentFolder), + ); + } + + missingFiles.push(path); + } + } + + if (missingFiles.length > 0) { + throw new Error( + `The following files were missing:\n- ${missingFiles.join("\n- ")}`, + ); + } else { + console.log("All paths exist"); + } +} diff --git a/extensions/vscode/scripts/testPackaging.js b/extensions/vscode/scripts/testPackaging.js new file mode 100644 index 000000000..79ca692b3 --- /dev/null +++ b/extensions/vscode/scripts/testPackaging.js @@ -0,0 +1,98 @@ +// This script verifies after pacakging that necessary files are in the correct locations +// In many cases just taking a sample file from the folder when they are all roughly the same thing +const fs = require("fs"); + +let target = undefined; +const args = process.argv; +if (args[2] === "--target") { + target = args[3]; +} + +if (!target) { + const os = { + aix: "linux", + darwin: "darwin", + freebsd: "linux", + linux: "linux", + openbsd: "linux", + sunos: "linux", + win32: "win32", + }[process.platform]; + 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]; + + target = `${os}-${arch}`; + console.log("[info] Detected target: ", target); +} + +const [os, arch] = target.split("-"); +const exe = os === "win32" ? ".exe" : ""; + +const pathsToVerify = [ + // Queries used to create the index for @code context provider + "tree-sitter/code-snippet-queries/tree-sitter-c_sharp-tags.scm", + + // Queries used for @outline and @highlights context providers + "tag-qry/tree-sitter-c_sharp-tags.scm", + + // onnx runtime bindngs + `bin/napi-v3/${os}/${arch}/onnxruntime_binding.node`, + `bin/napi-v3/${os}/${arch}/libonnxruntime.1.14.0.dylib`, + "builtin-themes/dark_modern.json", + + // Code/styling for the sidebar + "gui/assets/index.js", + "gui/assets/index.css", + + // Tutorial + "media/welcome.md", + "continue_tutorial.py", + "config_schema.json", + + // Embeddings model + "models/all-MiniLM-L6-v2/config.json", + "models/all-MiniLM-L6-v2/special_tokens_map.json", + "models/all-MiniLM-L6-v2/tokenizer_config.json", + "models/all-MiniLM-L6-v2/tokenizer.json", + "models/all-MiniLM-L6-v2/vocab.txt", + "models/all-MiniLM-L6-v2/onnx/model_quantized.onnx", + + // node_modules (it's a bit confusing why this is necessary) + `node_modules/@vscode/ripgrep/bin/rg${exe}`, + + // out directory (where the extension.js lives) + "out/extension.js", + // web-tree-sitter + "out/tree-sitter.wasm", + // Worker required by jsdom + "out/xhr-sync-worker.js", + // SQLite3 Node native module + "out/build/Release/node_sqlite3.node", + + // out/node_modules (to be accessed by extension.js) + `out/node_modules/@vscode/ripgrep/bin/rg${exe}`, + `out/node_modules/@esbuild/${target}/bin/esbuild${exe}`, + `out/node_modules/@lancedb/vectordb-${target}/index.node`, + `out/node_modules/esbuild/lib/main.js`, + `out/node_modules/esbuild/bin/esbuild${exe}`, +]; + +for (const path of pathsToVerify) { + if (!fs.existsSync(path)) { + throw new Error(`File ${path} does not exist`); + } +} + +console.log("All paths exist"); diff --git a/extensions/vscode/src/activation/activate.ts b/extensions/vscode/src/activation/activate.ts index 3b999b4b9..5af72bacb 100644 --- a/extensions/vscode/src/activation/activate.ts +++ b/extensions/vscode/src/activation/activate.ts @@ -1,6 +1,5 @@ import { getTsConfigPath, migrate } from "core/util/paths"; import { Telemetry } from "core/util/posthog"; -import * as fs from "fs"; import path from "path"; import * as vscode from "vscode"; import { VsCodeExtension } from "../extension/vscodeExtension"; @@ -9,31 +8,6 @@ import { getExtensionVersion } from "../util/util"; import { getExtensionUri } from "../util/vscode"; import { setupInlineTips } from "./inlineTips"; -export async function showTutorial() { - const tutorialPath = path.join( - getExtensionUri().fsPath, - "continue_tutorial.py", - ); - // Ensure keyboard shortcuts match OS - if (process.platform !== "darwin") { - let tutorialContent = fs.readFileSync(tutorialPath, "utf8"); - tutorialContent = tutorialContent.replace("⌘", "^").replace("Cmd", "Ctrl"); - fs.writeFileSync(tutorialPath, tutorialContent); - } - - const doc = await vscode.workspace.openTextDocument( - vscode.Uri.file(tutorialPath), - ); - await vscode.window.showTextDocument(doc); -} - -async function openTutorialFirstTime(context: vscode.ExtensionContext) { - if (context.globalState.get("continue.tutorialShown") !== true) { - await showTutorial(); - context.globalState.update("continue.tutorialShown", true); - } -} - function showRefactorMigrationMessage( extensionContext: vscode.ExtensionContext, ) { @@ -72,7 +46,6 @@ export async function activateExtension(context: vscode.ExtensionContext) { // Register commands and providers registerQuickFixProvider(); - await openTutorialFirstTime(context); setupInlineTips(context); showRefactorMigrationMessage(context); diff --git a/extensions/vscode/src/autocomplete/completionProvider.ts b/extensions/vscode/src/autocomplete/completionProvider.ts index 24140cde9..5a7830d3a 100644 --- a/extensions/vscode/src/autocomplete/completionProvider.ts +++ b/extensions/vscode/src/autocomplete/completionProvider.ts @@ -62,13 +62,20 @@ export class ContinueCompletionProvider const abortController = new AbortController(); const signal = abortController.signal; token.onCancellationRequested(() => abortController.abort()); + + const config = await this.configHandler.loadConfig(); + let clipboardText = ""; + if (config.tabAutocompleteOptions?.useCopyBuffer === true) { + clipboardText = await vscode.env.clipboard.readText(); + } + const input: AutocompleteInput = { completionId: uuidv4(), filepath: document.uri.fsPath, pos: { line: position.line, character: position.character }, recentlyEditedFiles: [], recentlyEditedRanges: [], - clipboardText: await vscode.env.clipboard.readText(), + clipboardText: clipboardText }; setupStatusBar(true, true); diff --git a/extensions/vscode/src/autocomplete/lsp.ts b/extensions/vscode/src/autocomplete/lsp.ts index abe07f5c3..ca7600424 100644 --- a/extensions/vscode/src/autocomplete/lsp.ts +++ b/extensions/vscode/src/autocomplete/lsp.ts @@ -31,7 +31,7 @@ async function executeGotoProvider( })); } -async function getDefinitionsForNode( +export async function getDefinitionsForNode( uri: string, node: Parser.SyntaxNode, ): Promise { diff --git a/extensions/vscode/src/autocomplete/statusBar.ts b/extensions/vscode/src/autocomplete/statusBar.ts index 28bf2b9b7..07dcb8f16 100644 --- a/extensions/vscode/src/autocomplete/statusBar.ts +++ b/extensions/vscode/src/autocomplete/statusBar.ts @@ -6,7 +6,7 @@ const statusBarItemText = (enabled: boolean | undefined) => const statusBarItemTooltip = (enabled: boolean | undefined) => enabled ? "Tab autocomplete is enabled" : "Click to enable tab autocomplete"; -let lastStatusBar: vscode.StatusBarItem | undefined = undefined; +let statusBarItem: vscode.StatusBarItem | undefined = undefined; let statusBarFalseTimeout: NodeJS.Timeout | undefined = undefined; export function stopStatusBarLoading() { @@ -24,27 +24,25 @@ export function setupStatusBar( statusBarFalseTimeout = undefined; } - const statusBarItem = vscode.window.createStatusBarItem( - vscode.StatusBarAlignment.Right, - ); + // If statusBarItem hasn't been defined yet, create it + if (!statusBarItem) { + statusBarItem = vscode.window.createStatusBarItem( + vscode.StatusBarAlignment.Right, + ); + } + statusBarItem.text = loading ? "$(loading~spin) Continue" : statusBarItemText(enabled); statusBarItem.tooltip = statusBarItemTooltip(enabled); statusBarItem.command = "continue.toggleTabAutocompleteEnabled"; - // Swap out with old status bar - if (lastStatusBar) { - lastStatusBar.dispose(); - } statusBarItem.show(); - lastStatusBar = statusBarItem; vscode.workspace.onDidChangeConfiguration((event) => { if (event.affectsConfiguration("continue")) { const config = vscode.workspace.getConfiguration("continue"); const enabled = config.get("enableTabAutocomplete"); - statusBarItem.dispose(); setupStatusBar(enabled); } }); diff --git a/extensions/vscode/src/commands.ts b/extensions/vscode/src/commands.ts index f5a38e7eb..c026b72da 100644 --- a/extensions/vscode/src/commands.ts +++ b/extensions/vscode/src/commands.ts @@ -11,6 +11,7 @@ import { Telemetry } from "core/util/posthog"; import { ContinueGUIWebviewViewProvider } from "./debugPanel"; import { DiffManager } from "./diff/horizontal"; import { VerticalPerLineDiffManager } from "./diff/verticalPerLine/manager"; +import { getPlatform } from "./util/util"; import { VsCodeWebviewProtocol } from "./webviewProtocol"; function getFullScreenTab() { @@ -164,18 +165,56 @@ const commandsMap: ( "continue.quickEdit": async () => { const selectionEmpty = vscode.window.activeTextEditor?.selection.isEmpty; - let text = await vscode.window.showInputBox({ + const editor = vscode.window.activeTextEditor; + const existingHandler = verticalDiffManager.getHandlerForFile( + editor?.document.uri.fsPath ?? "", + ); + const previousInput = existingHandler?.input; + + let defaultModelTitle = await sidebar.webviewProtocol.request( + "getDefaultModelTitle", + undefined, + ); + const config = await configHandler.loadConfig(); + if (!defaultModelTitle) { + defaultModelTitle = config.models[0]?.title!; + } + const quickPickItems = + config.contextProviders + ?.filter((provider) => provider.description.type === "normal") + .map((provider) => { + return { + label: provider.description.displayTitle, + description: provider.description.title, + detail: provider.description.description, + }; + }) || []; + + const addContextMsg = quickPickItems.length + ? " (or press enter to add context first)" + : ""; + const textInputOptions: vscode.InputBoxOptions = { placeHolder: selectionEmpty - ? "Describe the code you want to generate (or press enter to add context first)" - : "Describe how to edit the highlighted code (or press enter to add context first)", - title: "Continue Quick Edit", - }); + ? `Type instructions to generate code${addContextMsg}` + : `Describe how to edit the highlighted code${addContextMsg}`, + title: `${getPlatform() === "mac" ? "Cmd" : "Ctrl"}+I`, + prompt: `[${defaultModelTitle}]`, + }; + if (previousInput) { + textInputOptions.value = previousInput + ", "; + textInputOptions.valueSelection = [ + textInputOptions.value.length, + textInputOptions.value.length, + ]; + } + + let text = await vscode.window.showInputBox(textInputOptions); if (text === undefined) { return; } - if (text.length > 0) { + if (text.length > 0 || quickPickItems.length === 0) { const modelName = await sidebar.webviewProtocol.request( "getDefaultModelTitle", undefined, @@ -183,22 +222,6 @@ const commandsMap: ( await verticalDiffManager.streamEdit(text, modelName); } else { // Pick context first - const quickPickItems: Promise = configHandler - .loadConfig() - .then((config) => { - return ( - config.contextProviders - ?.filter((provider) => provider.description.type === "normal") - .map((provider) => { - return { - label: provider.description.displayTitle, - description: provider.description.title, - detail: provider.description.description, - }; - }) || [] - ); - }); - const selectedProviders = await vscode.window.showQuickPick( quickPickItems, { @@ -207,12 +230,7 @@ const commandsMap: ( }, ); - let text = await vscode.window.showInputBox({ - placeHolder: selectionEmpty - ? "Describe the code you want to generate (or press enter to add context first)" - : "Describe how to edit the highlighted code (or press enter to add context first)", - title: "Continue Quick Edit", - }); + let text = await vscode.window.showInputBox(textInputOptions); if (text) { const llm = await configHandler.llmFromTitle(); const config = await configHandler.loadConfig(); @@ -229,6 +247,7 @@ const commandsMap: ( return provider.getContextItems("", { embeddingsProvider: config.embeddingsProvider, + reranker: config.reranker, ide, llm, fullInput: text || "", @@ -243,43 +262,45 @@ const commandsMap: ( "\n\n---\n\n" + text; - await verticalDiffManager.streamEdit( - text, - await sidebar.webviewProtocol.request( - "getDefaultModelTitle", - undefined, - ), - ); + await verticalDiffManager.streamEdit(text, defaultModelTitle); } } }, "continue.writeCommentsForCode": async () => { await verticalDiffManager.streamEdit( - "Write comments for this code. Do not change anything about the code itself.", + (await configHandler.loadConfig()).experimental?.contextMenuPrompts + ?.comment || + "Write comments for this code. Do not change anything about the code itself.", await sidebar.webviewProtocol.request("getDefaultModelTitle", undefined), ); }, "continue.writeDocstringForCode": async () => { await verticalDiffManager.streamEdit( - "Write a docstring for this code. Do not change anything about the code itself.", + (await configHandler.loadConfig()).experimental?.contextMenuPrompts + ?.docstring || + "Write a docstring for this code. Do not change anything about the code itself.", await sidebar.webviewProtocol.request("getDefaultModelTitle", undefined), ); }, "continue.fixCode": async () => { await verticalDiffManager.streamEdit( - "Fix this code", + (await configHandler.loadConfig()).experimental?.contextMenuPrompts + ?.fix || "Fix this code", await sidebar.webviewProtocol.request("getDefaultModelTitle", undefined), ); }, "continue.optimizeCode": async () => { await verticalDiffManager.streamEdit( - "Optimize this code", + (await configHandler.loadConfig()).experimental?.contextMenuPrompts + ?.optimize || "Optimize this code", await sidebar.webviewProtocol.request("getDefaultModelTitle", undefined), ); }, "continue.fixGrammar": async () => { await verticalDiffManager.streamEdit( - "If there are any grammar or spelling mistakes in this writing, fix them. Do not make other large changes to the writing.", + (await configHandler.loadConfig()).experimental?.contextMenuPrompts + ?.fixGrammar || + "If there are any grammar or spelling mistakes in this writing, fix them. Do not make other large changes to the writing.", await sidebar.webviewProtocol.request("getDefaultModelTitle", undefined), ); }, @@ -362,12 +383,13 @@ const commandsMap: ( // Check if the active editor is the Continue GUI View if (fullScreenTab && fullScreenTab.isActive) { - vscode.commands.executeCommand("workbench.action.closeActiveEditor"); - vscode.commands.executeCommand("continue.focusContinueInput"); + //Full screen open and focused - close it + vscode.commands.executeCommand("workbench.action.closeActiveEditor"); //this will trigger the onDidDispose listener below return; } if (fullScreenTab) { + //Full screen open, but not focused - focus it // Focus the tab const openOptions = { preserveFocus: true, @@ -383,15 +405,21 @@ const commandsMap: ( return; } + //Full screen not open - open it + // Close the sidebar.webviews // vscode.commands.executeCommand("workbench.action.closeSidebar"); vscode.commands.executeCommand("workbench.action.closeAuxiliaryBar"); // vscode.commands.executeCommand("workbench.action.toggleZenMode"); - const panel = vscode.window.createWebviewPanel( + + //create the full screen panel + let panel = vscode.window.createWebviewPanel( "continue.continueGUIView", "Continue", vscode.ViewColumn.One, ); + + //Add content to the panel panel.webview.html = sidebar.getSidebarContent( extensionContext, panel, @@ -402,6 +430,16 @@ const commandsMap: ( undefined, true, ); + + //When panel closes, reset the webview and focus + panel.onDidDispose( + () => { + sidebar.resetWebviewProtocolWebview(); + vscode.commands.executeCommand("continue.focusContinueInput"); + }, + null, + extensionContext.subscriptions, + ); }, "continue.selectFilesAsContext": ( firstUri: vscode.Uri, diff --git a/extensions/vscode/src/debugPanel.ts b/extensions/vscode/src/debugPanel.ts index c835917f0..0e3496629 100644 --- a/extensions/vscode/src/debugPanel.ts +++ b/extensions/vscode/src/debugPanel.ts @@ -33,6 +33,14 @@ export class ContinueGUIWebviewViewProvider return this._webview; } + public resetWebviewProtocolWebview(): void { + if (this._webview) { + this.webviewProtocol.webview = this._webview; + } else{ + console.warn("no webview found during reset") + } + } + sendMainUserInput(input: string) { this.webview?.postMessage({ type: "userInput", diff --git a/extensions/vscode/src/diff/horizontal.ts b/extensions/vscode/src/diff/horizontal.ts index dbf251f5a..fcb77bded 100644 --- a/extensions/vscode/src/diff/horizontal.ts +++ b/extensions/vscode/src/diff/horizontal.ts @@ -27,7 +27,7 @@ async function writeFile(uri: vscode.Uri, contents: string) { // THIS IS LOCAL export const DIFF_DIRECTORY = path - .join(os.homedir(), ".continue", "diffs") + .join(os.homedir(), ".continue", ".diffs") .replace(/^C:/, "c:"); export class DiffManager { diff --git a/extensions/vscode/src/diff/verticalPerLine/decorations.ts b/extensions/vscode/src/diff/verticalPerLine/decorations.ts index 96cc4372e..fa6e70baf 100644 --- a/extensions/vscode/src/diff/verticalPerLine/decorations.ts +++ b/extensions/vscode/src/diff/verticalPerLine/decorations.ts @@ -43,6 +43,11 @@ export class DecorationTypeRangeManager { private ranges: vscode.Range[] = []; + applyToNewEditor(newEditor: vscode.TextEditor) { + this.editor = newEditor; + this.editor.setDecorations(this.decorationType, this.ranges); + } + addLines(startIndex: number, numLines: number) { const lastRange = this.ranges[this.ranges.length - 1]; if (lastRange && lastRange.end.line === startIndex - 1) { diff --git a/extensions/vscode/src/diff/verticalPerLine/handler.ts b/extensions/vscode/src/diff/verticalPerLine/handler.ts index 302456eef..f6973e054 100644 --- a/extensions/vscode/src/diff/verticalPerLine/handler.ts +++ b/extensions/vscode/src/diff/verticalPerLine/handler.ts @@ -38,6 +38,7 @@ export class VerticalPerLineDiffHandler { filepath: string | undefined, accept: boolean, ) => void, + private readonly refreshCodeLens: () => void, input?: string, ) { this.currentLineIndex = startLine; @@ -54,6 +55,20 @@ export class VerticalPerLineDiffHandler { greenDecorationType, this.editor, ); + + vscode.window.onDidChangeActiveTextEditor((editor) => { + // When we switch away and back to this editor, need to re-draw decorations + if (editor?.document.uri.fsPath === this.filepath) { + this.editor = editor; + this.redDecorationManager.applyToNewEditor(editor); + this.greenDecorationManager.applyToNewEditor(editor); + this.updateIndexLineDecorations(); + this.refreshCodeLens(); + + // Handle any lines received while editor was closed + this.queueDiffLine(undefined); + } + }); } private get filepath() { @@ -111,6 +126,8 @@ export class VerticalPerLineDiffHandler { } this.deletionBuffer = []; this.insertedInCurrentBlock = 0; + + this.refreshCodeLens(); } private incrementCurrentLineIndex() { @@ -121,21 +138,27 @@ export class VerticalPerLineDiffHandler { private greenDecorationManager: DecorationTypeRangeManager; private async insertTextAboveLine(index: number, text: string) { - await this.editor.edit((editBuilder) => { - const lineCount = this.editor.document.lineCount; - if (index >= lineCount) { - // Append to end of file - editBuilder.insert( - new vscode.Position( - lineCount, - this.editor.document.lineAt(lineCount - 1).text.length, - ), - "\n" + text, - ); - } else { - editBuilder.insert(new vscode.Position(index, 0), text + "\n"); - } - }); + await this.editor.edit( + (editBuilder) => { + const lineCount = this.editor.document.lineCount; + if (index >= lineCount) { + // Append to end of file + editBuilder.insert( + new vscode.Position( + lineCount, + this.editor.document.lineAt(lineCount - 1).text.length, + ), + "\n" + text, + ); + } else { + editBuilder.insert(new vscode.Position(index, 0), text + "\n"); + } + }, + { + undoStopAfter: false, + undoStopBefore: false, + }, + ); } private async insertLineAboveIndex(index: number, line: string) { @@ -146,11 +169,17 @@ export class VerticalPerLineDiffHandler { private async deleteLinesAt(index: number, numLines: number = 1) { const startLine = new vscode.Position(index, 0); - await this.editor.edit((editBuilder) => { - editBuilder.delete( - new vscode.Range(startLine, startLine.translate(numLines)), - ); - }); + await this.editor.edit( + (editBuilder) => { + editBuilder.delete( + new vscode.Range(startLine, startLine.translate(numLines)), + ); + }, + { + undoStopAfter: false, + undoStopBefore: false, + }, + ); } private updateIndexLineDecorations() { @@ -195,25 +224,64 @@ export class VerticalPerLineDiffHandler { this.editorToVerticalDiffCodeLens.delete(this.filepath); - this.editor.edit((editBuilder) => { - for (const range of rangesToDelete) { - editBuilder.delete( - new vscode.Range( - range.start, - new vscode.Position(range.end.line + 1, 0), - ), - ); - } - }); + this.editor.edit( + (editBuilder) => { + for (const range of rangesToDelete) { + editBuilder.delete( + new vscode.Range( + range.start, + new vscode.Position(range.end.line + 1, 0), + ), + ); + } + }, + { + undoStopAfter: false, + undoStopBefore: false, + }, + ); this.cancelled = true; + this.refreshCodeLens(); } get isCancelled() { return this.cancelled; } - async handleDiffLine(diffLine: DiffLine) { + private _diffLinesQueue: DiffLine[] = []; + private _queueLock = false; + + async queueDiffLine(diffLine: DiffLine | undefined) { + if (diffLine) { + this._diffLinesQueue.push(diffLine); + } + + if (this._queueLock || this.editor !== vscode.window.activeTextEditor) { + return; + } + + this._queueLock = true; + + while (this._diffLinesQueue.length) { + const line = this._diffLinesQueue.shift(); + if (!line) { + break; + } + + try { + await this._handleDiffLine(line); + } catch (e) { + // If editor is switched between calling _handleDiffLine and the edit actually being executed + this._diffLinesQueue.push(line); + break; + } + } + + this._queueLock = false; + } + + private async _handleDiffLine(diffLine: DiffLine) { switch (diffLine.type) { case "same": await this.insertDeletionBuffer(); @@ -241,13 +309,15 @@ export class VerticalPerLineDiffHandler { if (this.isCancelled) { return; } - await this.handleDiffLine(diffLine); + await this.queueDiffLine(diffLine); } // Clear deletion buffer await this.insertDeletionBuffer(); this.clearIndexLineDecorations(); + this.refreshCodeLens(); + // Reject on user typing // const listener = vscode.workspace.onDidChangeTextDocument((e) => { // if (e.document.uri.fsPath === this.filepath) { @@ -303,5 +373,7 @@ export class VerticalPerLineDiffHandler { return x; }) || []; this.editorToVerticalDiffCodeLens.set(this.filepath, blocks); + + this.refreshCodeLens(); } } diff --git a/extensions/vscode/src/diff/verticalPerLine/manager.ts b/extensions/vscode/src/diff/verticalPerLine/manager.ts index 7d10ff8f1..3ce6f79c0 100644 --- a/extensions/vscode/src/diff/verticalPerLine/manager.ts +++ b/extensions/vscode/src/diff/verticalPerLine/manager.ts @@ -1,6 +1,6 @@ import { ConfigHandler } from "core/config/handler"; +import { pruneLinesFromBottom, pruneLinesFromTop } from "core/llm/countTokens"; import { getMarkdownLanguageTagForFile } from "core/util"; -import { Telemetry } from "core/util/posthog"; import { streamDiffLines } from "core/util/verticalEdit"; import * as vscode from "vscode"; import { VerticalPerLineDiffHandler } from "./handler"; @@ -12,10 +12,12 @@ export interface VerticalDiffCodeLens { } export class VerticalPerLineDiffManager { - private filepathToEditorMap: Map = + public refreshCodeLens: () => void = () => {}; + + private filepathToHandler: Map = new Map(); - editorToVerticalDiffCodeLens: Map = new Map(); + filepathToCodeLens: Map = new Map(); constructor(private readonly configHandler: ConfigHandler) {} @@ -25,9 +27,9 @@ export class VerticalPerLineDiffManager { endLine: number, input: string, ) { - if (this.filepathToEditorMap.has(filepath)) { - this.filepathToEditorMap.get(filepath)?.clear(false); - this.filepathToEditorMap.delete(filepath); + if (this.filepathToHandler.has(filepath)) { + this.filepathToHandler.get(filepath)?.clear(false); + this.filepathToHandler.delete(filepath); } const editor = vscode.window.activeTextEditor; // TODO if (editor && editor.document.uri.fsPath === filepath) { @@ -35,11 +37,12 @@ export class VerticalPerLineDiffManager { startLine, endLine, editor, - this.editorToVerticalDiffCodeLens, + this.filepathToCodeLens, this.clearForFilepath.bind(this), + this.refreshCodeLens, input, ); - this.filepathToEditorMap.set(filepath, handler); + this.filepathToHandler.set(filepath, handler); return handler; } else { return undefined; @@ -51,8 +54,8 @@ export class VerticalPerLineDiffManager { startLine: number, endLine: number, ) { - if (this.filepathToEditorMap.has(filepath)) { - return this.filepathToEditorMap.get(filepath)!; + if (this.filepathToHandler.has(filepath)) { + return this.filepathToHandler.get(filepath)!; } else { const editor = vscode.window.activeTextEditor; // TODO if (editor && editor.document.uri.fsPath === filepath) { @@ -60,10 +63,11 @@ export class VerticalPerLineDiffManager { startLine, endLine, editor, - this.editorToVerticalDiffCodeLens, + this.filepathToCodeLens, this.clearForFilepath.bind(this), + this.refreshCodeLens, ); - this.filepathToEditorMap.set(filepath, handler); + this.filepathToHandler.set(filepath, handler); return handler; } else { return undefined; @@ -72,7 +76,7 @@ export class VerticalPerLineDiffManager { } getHandlerForFile(filepath: string) { - return this.filepathToEditorMap.get(filepath); + return this.filepathToHandler.get(filepath); } clearForFilepath(filepath: string | undefined, accept: boolean) { @@ -84,11 +88,13 @@ export class VerticalPerLineDiffManager { filepath = activeEditor.document.uri.fsPath; } - const handler = this.filepathToEditorMap.get(filepath); + const handler = this.filepathToHandler.get(filepath); if (handler) { handler.clear(accept); - this.filepathToEditorMap.delete(filepath); + this.filepathToHandler.delete(filepath); } + + vscode.commands.executeCommand("setContext", "continue.diffVisible", false); } acceptRejectVerticalDiffBlock( @@ -108,7 +114,7 @@ export class VerticalPerLineDiffManager { index = 0; } - let blocks = this.editorToVerticalDiffCodeLens.get(filepath); + let blocks = this.filepathToCodeLens.get(filepath); const block = blocks?.[index]; if (!blocks || !block) { return; @@ -126,9 +132,15 @@ export class VerticalPerLineDiffManager { block.numGreen, block.numRed, ); + + if (blocks.length === 1) { + this.clearForFilepath(filepath, true); + } } async streamEdit(input: string, modelTitle: string | undefined) { + vscode.commands.executeCommand("setContext", "continue.diffVisible", true); + const editor = vscode.window.activeTextEditor; if (!editor) { return; @@ -153,14 +165,35 @@ export class VerticalPerLineDiffManager { return; } - const selectedRange = - existingHandler?.range ?? - new vscode.Range( + let selectedRange = existingHandler?.range ?? editor.selection; + + // Only if the selection is empty, use exact prefix/suffix instead of by line + if (!selectedRange.isEmpty) { + selectedRange = new vscode.Range( editor.selection.start.with(undefined, 0), editor.selection.end.with(undefined, Number.MAX_SAFE_INTEGER), ); - const rangeContent = editor.document.getText(selectedRange); + } + const llm = await this.configHandler.llmFromTitle(modelTitle); + const rangeContent = editor.document.getText(selectedRange); + const prefix = pruneLinesFromTop( + editor.document.getText( + new vscode.Range(new vscode.Position(0, 0), selectedRange.start), + ), + llm.contextLength / 4, + llm.model, + ); + const suffix = pruneLinesFromBottom( + editor.document.getText( + new vscode.Range( + selectedRange.end, + new vscode.Position(editor.document.lineCount, 0), + ), + ), + llm.contextLength / 4, + llm.model, + ); // Unselect the range editor.selection = new vscode.Selection( @@ -174,22 +207,12 @@ export class VerticalPerLineDiffManager { true, ); - if (existingHandler?.input) { - if (existingHandler.input.startsWith("Original request: ")) { - existingHandler.input = existingHandler.input.substring( - "Original request: ".length, - ); - } - input = `Original request: ${existingHandler.input}\nUpdated request: ${input}`; - } try { - Telemetry.capture("inlineEdit", { - model: llm.model, - provider: llm.providerName, - }); await diffHandler.run( streamDiffLines( + prefix, rangeContent, + suffix, llm, input, getMarkdownLanguageTagForFile(filepath), diff --git a/extensions/vscode/src/extension/vscodeExtension.ts b/extensions/vscode/src/extension/vscodeExtension.ts index 4d41632e9..5f1cc1ea8 100644 --- a/extensions/vscode/src/extension/vscodeExtension.ts +++ b/extensions/vscode/src/extension/vscodeExtension.ts @@ -13,6 +13,7 @@ import { VerticalPerLineDiffManager } from "../diff/verticalPerLine/manager"; import { VsCodeIde } from "../ideProtocol"; import { registerAllCodeLensProviders } from "../lang-server/codeLens"; import { setupRemoteConfigSync } from "../stubs/activation"; +import { getUserToken } from "../stubs/auth"; import { TabAutocompleteModel } from "../util/loadAutocompleteModel"; import { VsCodeWebviewProtocol } from "../webviewProtocol"; @@ -106,20 +107,54 @@ export class VsCodeExtension { context.globalState.update("continue.indexingPaused", msg.data); indexingPauseToken.paused = msg.data; }); + this.webviewProtocol.on("index/forceReIndex", (msg) => { + this.ide + .getWorkspaceDirs() + .then((dirs) => this.refreshCodebaseIndex(dirs)); + }); this.diffManager.webviewProtocol = this.webviewProtocol; + + const userTokenPromise: Promise = new Promise( + async (resolve) => { + if ( + remoteConfigServerUrl === null || + remoteConfigServerUrl === undefined || + remoteConfigServerUrl.trim() === "" + ) { + resolve(undefined); + return; + } + const token = await getUserToken(); + resolve(token); + }, + ); this.indexer = new CodebaseIndexer( this.configHandler, this.ide, indexingPauseToken, + ideSettings.remoteConfigServerUrl, + userTokenPromise, ); + if ( + !( + remoteConfigServerUrl === null || + remoteConfigServerUrl === undefined || + remoteConfigServerUrl.trim() === "" + ) + ) { + getUserToken().then((token) => {}); + } + // CodeLens - registerAllCodeLensProviders( + const verticalDiffCodeLens = registerAllCodeLensProviders( context, this.diffManager, - this.verticalDiffManager.editorToVerticalDiffCodeLens, + this.verticalDiffManager.filepathToCodeLens, ); + this.verticalDiffManager.refreshCodeLens = + verticalDiffCodeLens.refresh.bind(verticalDiffCodeLens); // Tab autocomplete const config = vscode.workspace.getConfiguration("continue"); @@ -223,9 +258,17 @@ export class VsCodeExtension { static continueVirtualDocumentScheme = "continue"; private PREVIOUS_BRANCH_FOR_WORKSPACE_DIR: { [dir: string]: string } = {}; + private indexingCancellationController: AbortController | undefined; private async refreshCodebaseIndex(dirs: string[]) { - for await (const update of this.indexer.refresh(dirs)) { + if (this.indexingCancellationController) { + this.indexingCancellationController.abort(); + } + this.indexingCancellationController = new AbortController(); + for await (const update of this.indexer.refresh( + dirs, + this.indexingCancellationController.signal, + )) { this.webviewProtocol.request("indexProgress", update); } } diff --git a/extensions/vscode/src/ideProtocol.ts b/extensions/vscode/src/ideProtocol.ts index 0727e3477..82d2b91a8 100644 --- a/extensions/vscode/src/ideProtocol.ts +++ b/extensions/vscode/src/ideProtocol.ts @@ -1,6 +1,14 @@ import * as child_process from "child_process"; import { exec } from "child_process"; -import { ContinueRcJson, IDE, IdeInfo, IndexTag, Problem, Range, Thread } from "core"; +import { + ContinueRcJson, + IDE, + IdeInfo, + IndexTag, + Problem, + Range, + Thread, +} from "core"; import { getContinueGlobalPath } from "core/util/paths"; import * as path from "path"; import * as vscode from "vscode"; @@ -19,6 +27,22 @@ class VsCodeIde implements IDE { constructor(private readonly diffManager: DiffManager) { this.ideUtils = new VsCodeIdeUtils(); } + + async getRepoName(dir: string): Promise { + const repo = await this.getRepo(vscode.Uri.file(dir)); + const remote = + repo?.repository.remotes.find((r: any) => r.name === "origin") ?? + repo?.repository.remotes[0]; + if (!remote) { + return undefined; + } + const ownerAndRepo = remote.fetchUrl + .replace(".git", "") + .split("/") + .slice(-2); + return ownerAndRepo.join("/"); + } + async getTags(artifactId: string): Promise { const workspaceDirs = await this.getWorkspaceDirs(); @@ -40,6 +64,9 @@ class VsCodeIde implements IDE { name: vscode.env.appName, version: vscode.version, remoteName: vscode.env.remoteName || "local", + extensionVersion: + vscode.extensions.getExtension("continue.continue")?.packageJSON + .version, }); } readRangeInFile(filepath: string, range: Range): Promise { @@ -47,8 +74,8 @@ class VsCodeIde implements IDE { filepath, new vscode.Range( new vscode.Position(range.start.line, range.start.character), - new vscode.Position(range.end.line, range.end.character) - ) + new vscode.Position(range.end.line, range.end.character), + ), ); } @@ -60,7 +87,7 @@ class VsCodeIde implements IDE { files.map(async (file) => { let stat = await vscode.workspace.fs.stat(uriFromFilePath(file)); pathToLastModified[file] = stat.mtime; - }) + }), ); return pathToLastModified; @@ -95,11 +122,11 @@ class VsCodeIde implements IDE { async getTopLevelCallStackSources( threadIndex: number, - stackDepth: number + stackDepth: number, ): Promise { return await this.ideUtils.getTopLevelCallStackSources( threadIndex, - stackDepth + stackDepth, ); } async getAvailableThreads(): Promise { @@ -113,7 +140,7 @@ class VsCodeIde implements IDE { const contents = await Promise.all( this.ideUtils .getWorkspaceDirectories() - .map((dir) => this.ideUtils.getDirectoryContents(dir, true)) + .map((dir) => this.ideUtils.getDirectoryContents(dir, true)), ); return contents.flat(); } @@ -128,7 +155,7 @@ class VsCodeIde implements IDE { for (const [filename, type] of files) { if (type === vscode.FileType.File && filename === ".continuerc.json") { const contents = await this.ideUtils.readFile( - vscode.Uri.joinPath(workspaceDir, filename).fsPath + vscode.Uri.joinPath(workspaceDir, filename).fsPath, ); configs.push(JSON.parse(contents)); } @@ -146,7 +173,7 @@ class VsCodeIde implements IDE { directory, [], false, - undefined + undefined, )) { allDirs.push(dir); } @@ -166,7 +193,7 @@ class VsCodeIde implements IDE { async writeFile(path: string, contents: string): Promise { await vscode.workspace.fs.writeFile( vscode.Uri.file(path), - Buffer.from(contents) + Buffer.from(contents), ); } @@ -181,11 +208,11 @@ class VsCodeIde implements IDE { async showLines( filepath: string, startLine: number, - endLine: number + endLine: number, ): Promise { const range = new vscode.Range( new vscode.Position(startLine, 0), - new vscode.Position(endLine, 0) + new vscode.Position(endLine, 0), ); openEditorAndRevealRange(filepath, range).then(() => { // TODO: Highlight lines @@ -219,7 +246,7 @@ class VsCodeIde implements IDE { async showDiff( filepath: string, newContents: string, - stepIndex: number + stepIndex: number, ): Promise { await this.diffManager.writeDiff(filepath, newContents, stepIndex); } @@ -245,11 +272,11 @@ class VsCodeIde implements IDE { "@vscode", "ripgrep", "bin", - "rg" + "rg", ), ["-i", "-C", "2", "--", `${query}`, "."], //no regex //["-i", "-C", "2", "-e", `${query}`, "."], //use regex - { cwd: dir } + { cwd: dir }, ); let output = ""; diff --git a/extensions/vscode/src/lang-server/codeLens.ts b/extensions/vscode/src/lang-server/codeLens.ts index d2a2686a9..3589f7ba4 100644 --- a/extensions/vscode/src/lang-server/codeLens.ts +++ b/extensions/vscode/src/lang-server/codeLens.ts @@ -4,10 +4,18 @@ import * as vscode from "vscode"; import { DIFF_DIRECTORY, DiffManager } from "../diff/horizontal"; import { VerticalDiffCodeLens } from "../diff/verticalPerLine/manager"; import { editorSuggestionsLocked, editorToSuggestions } from "../suggestions"; -import { getMetaKeyLabel } from "../util/util"; +import { getAltOrOption, getMetaKeyLabel } from "../util/util"; import { getExtensionUri } from "../util/vscode"; class VerticalPerLineCodeLensProvider implements vscode.CodeLensProvider { + private _eventEmitter: vscode.EventEmitter = + new vscode.EventEmitter(); + onDidChangeCodeLenses: vscode.Event = this._eventEmitter.event; + + public refresh(): void { + this._eventEmitter.fire(); + } + constructor( private readonly editorToVerticalDiffCodeLens: Map< string, @@ -33,22 +41,44 @@ class VerticalPerLineCodeLensProvider implements vscode.CodeLensProvider { start, start.translate(block.numGreen + block.numRed), ); + if (codeLenses.length === 0) { + codeLenses.push( + new vscode.CodeLens(range, { + title: `Accept All (${getMetaKeyLabel()}⇧↩)`, + command: "continue.acceptVerticalDiffBlock", + arguments: [filepath, i], + }), + new vscode.CodeLens(range, { + title: `Reject All (${getMetaKeyLabel()}⇧⌫)`, + command: "continue.rejectVerticalDiffBlock", + arguments: [filepath, i], + }), + ); + } codeLenses.push( new vscode.CodeLens(range, { - title: "Accept", + title: `Accept${ + codeLenses.length === 2 + ? ` (${getAltOrOption()}${getMetaKeyLabel()}Y)` + : "" + }`, command: "continue.acceptVerticalDiffBlock", arguments: [filepath, i], }), new vscode.CodeLens(range, { - title: "Reject", + title: `Reject${ + codeLenses.length === 2 + ? ` (${getAltOrOption()}${getMetaKeyLabel()}N)` + : "" + }`, command: "continue.rejectVerticalDiffBlock", arguments: [filepath, i], }), ); - if (codeLenses.length === 2) { + if (codeLenses.length === 4) { codeLenses.push( new vscode.CodeLens(range, { - title: `(${getMetaKeyLabel()}⇧↩/${getMetaKeyLabel()}⇧⌫ to accept/reject all, ${getMetaKeyLabel()}I to retry)`, + title: `${getMetaKeyLabel()}I to add instructions`, command: "", }), ); @@ -341,7 +371,8 @@ class TutorialCodeLensProvider implements vscode.CodeLensProvider { } } -let verticalPerLineCodeLensProvider: vscode.Disposable | undefined = undefined; +export let verticalPerLineCodeLensProvider: vscode.Disposable | undefined = + undefined; let diffsCodeLensDisposable: vscode.Disposable | undefined = undefined; let suggestionsCodeLensDisposable: vscode.Disposable | undefined = undefined; let configPyCodeLensDisposable: vscode.Disposable | undefined = undefined; @@ -368,9 +399,12 @@ export function registerAllCodeLensProviders( tutorialCodeLensDisposable.dispose(); } + const verticalDiffCodeLens = new VerticalPerLineCodeLensProvider( + editorToVerticalDiffCodeLens, + ); verticalPerLineCodeLensProvider = vscode.languages.registerCodeLensProvider( "*", - new VerticalPerLineCodeLensProvider(editorToVerticalDiffCodeLens), + verticalDiffCodeLens, ); suggestionsCodeLensDisposable = vscode.languages.registerCodeLensProvider( "*", @@ -393,4 +427,6 @@ export function registerAllCodeLensProviders( context.subscriptions.push(diffsCodeLensDisposable); context.subscriptions.push(configPyCodeLensDisposable); context.subscriptions.push(tutorialCodeLensDisposable); + + return verticalDiffCodeLens; } diff --git a/extensions/vscode/src/util/expandSnippet.ts b/extensions/vscode/src/util/expandSnippet.ts new file mode 100644 index 000000000..a56d193ee --- /dev/null +++ b/extensions/vscode/src/util/expandSnippet.ts @@ -0,0 +1,106 @@ +import { Chunk, IDE } from "core"; +import { DEFAULT_IGNORE_DIRS } from "core/indexing/ignore"; +import { deduplicateArray } from "core/util"; +import { getParserForFile } from "core/util/treeSitter"; +import { SyntaxNode } from "web-tree-sitter"; +import { getDefinitionsForNode } from "../autocomplete/lsp"; + +export async function expandSnippet( + filepath: string, + startLine: number, + endLine: number, + ide: IDE, +): Promise { + const parser = await getParserForFile(filepath); + if (!parser) { + return []; + } + + const fullFileContents = await ide.readFile(filepath); + const root: SyntaxNode = parser.parse(fullFileContents).rootNode; + + // Find all nodes contained in the range + let containedInRange: SyntaxNode[] = []; + let toExplore: SyntaxNode[] = [root]; + while (toExplore.length > 0) { + const node = toExplore.pop()!; + for (const child of node.namedChildren) { + if ( + child.startPosition.row >= startLine && + child.endPosition.row <= endLine + ) { + // Fully contained in range + containedInRange.push(child); + toExplore.push(child); + } else if ( + child.startPosition.row >= startLine || + child.endPosition.row <= endLine + ) { + // Overlaps, children may be contained in range + toExplore.push(child); + } + } + } + + // Find all call expressions + const callExpressions = containedInRange.filter( + (node) => node.type === "call_expression", + ); + let callExpressionDefinitions = ( + await Promise.all( + callExpressions.map(async (node) => { + return getDefinitionsForNode(filepath, node); + }), + ) + ).flat(); + + // De-duplicate the definitions + callExpressionDefinitions = deduplicateArray( + callExpressionDefinitions, + (a, b) => { + return ( + a.filepath === b.filepath && + a.range.start.line === b.range.start.line && + a.range.end.line === b.range.end.line && + a.range.start.character === b.range.start.character && + a.range.end.character === b.range.end.character + ); + }, + ); + + // Filter out definitions already in selected range + callExpressionDefinitions = callExpressionDefinitions.filter((def) => { + return !( + def.filepath === filepath && + def.range.start.line >= startLine && + def.range.end.line <= endLine + ); + }); + + // Filter out defintions not under workspace directories + const workspaceDirectories = await ide.getWorkspaceDirs(); + callExpressionDefinitions = callExpressionDefinitions.filter((def) => { + return ( + workspaceDirectories.some((dir) => def.filepath.startsWith(dir)) && + !DEFAULT_IGNORE_DIRS.some( + (dir) => + def.filepath.includes(`/${dir}/`) || + def.filepath.includes(`\\${dir}\\`), + ) + ); + }); + + const chunks = await Promise.all( + callExpressionDefinitions.map(async (def) => { + return { + filepath: def.filepath, + startLine: def.range.start.line, + endLine: def.range.end.line, + digest: "", + index: 0, + content: await ide.readRangeInFile(def.filepath, def.range), + }; + }), + ); + return chunks; +} diff --git a/extensions/vscode/src/util/ideUtils.ts b/extensions/vscode/src/util/ideUtils.ts index 0f1557d40..ddcad6597 100644 --- a/extensions/vscode/src/util/ideUtils.ts +++ b/extensions/vscode/src/util/ideUtils.ts @@ -1,4 +1,5 @@ import { FileEdit, RangeInFile, Thread } from "core"; +import { defaultIgnoreFile } from "core/indexing/ignore"; import path from "path"; import * as vscode from "vscode"; import { threadStopped } from "../debug/debug"; @@ -10,7 +11,7 @@ import { rejectSuggestionCommand, showSuggestion as showSuggestionInEditor, } from "../suggestions"; -import { defaultIgnoreFile, traverseDirectory } from "./traverseDirectory"; +import { traverseDirectory } from "./traverseDirectory"; import { getUniqueId, openEditorAndRevealRange, @@ -25,12 +26,12 @@ export class VsCodeIdeUtils { async gotoDefinition( filepath: string, - position: vscode.Position + position: vscode.Position, ): Promise { const locations: vscode.Location[] = await vscode.commands.executeCommand( "vscode.executeDefinitionProvider", uriFromFilePath(filepath), - position + position, ); return locations; } @@ -38,25 +39,25 @@ export class VsCodeIdeUtils { async documentSymbol(filepath: string): Promise { return await vscode.commands.executeCommand( "vscode.executeDocumentSymbolProvider", - uriFromFilePath(filepath) + uriFromFilePath(filepath), ); } async references( filepath: string, - position: vscode.Position + position: vscode.Position, ): Promise { return await vscode.commands.executeCommand( "vscode.executeReferenceProvider", uriFromFilePath(filepath), - position + position, ); } async foldingRanges(filepath: string): Promise { return await vscode.commands.executeCommand( "vscode.executeFoldingRangeProvider", - uriFromFilePath(filepath) + uriFromFilePath(filepath), ); } @@ -80,12 +81,12 @@ export class VsCodeIdeUtils { rangeInFile.range.start.line, rangeInFile.range.start.character, rangeInFile.range.end.line, - rangeInFile.range.end.character + rangeInFile.range.end.character, ); const editor = await openEditorAndRevealRange( rangeInFile.filepath, range, - vscode.ViewColumn.One + vscode.ViewColumn.One, ); if (editor) { const decorationType = vscode.window.createTextEditorDecorationType({ @@ -100,7 +101,7 @@ export class VsCodeIdeUtils { cursorDisposable.dispose(); editor.setDecorations(decorationType, []); } - } + }, ); setTimeout(() => { @@ -123,9 +124,9 @@ export class VsCodeIdeUtils { edit.range.start.line, edit.range.start.character, edit.range.end.line, - edit.range.end.character + edit.range.end.character, ), - edit.replacement + edit.replacement, ); } @@ -134,7 +135,7 @@ export class VsCodeIdeUtils { const panel = vscode.window.createWebviewPanel( "continue.continueGUIView", "Continue", - vscode.ViewColumn.One + vscode.ViewColumn.One, ); // panel.webview.html = this.sidebar.getSidebarContent( // extensionContext, @@ -165,8 +166,8 @@ export class VsCodeIdeUtils { vscode.Uri.parse( `${ VsCodeExtension.continueVirtualDocumentScheme - }:${encodeURIComponent(name)}?${encodeURIComponent(contents)}` - ) + }:${encodeURIComponent(name)}?${encodeURIComponent(contents)}`, + ), ) .then((doc) => { vscode.window.showTextDocument(doc, { preview: false }); @@ -248,7 +249,7 @@ export class VsCodeIdeUtils { async getDirectoryContents( directory: string, - recursive: boolean + recursive: boolean, ): Promise { if (!recursive) { return ( @@ -273,7 +274,7 @@ export class VsCodeIdeUtils { gitRoot ?? directory, [], true, - gitRoot === directory ? undefined : onlyThisDirectory + gitRoot === directory ? undefined : onlyThisDirectory, )) { allFiles.push(file); } @@ -324,10 +325,10 @@ export class VsCodeIdeUtils { async readRangeInFile( filepath: string, - range: vscode.Range + range: vscode.Range, ): Promise { const contents = new TextDecoder().decode( - await vscode.workspace.fs.readFile(vscode.Uri.file(filepath)) + await vscode.workspace.fs.readFile(vscode.Uri.file(filepath)), ); const lines = contents.split("\n"); return ( @@ -343,20 +344,20 @@ export class VsCodeIdeUtils { const tempCopyBuffer = await vscode.env.clipboard.readText(); if (commands < 0) { await vscode.commands.executeCommand( - "workbench.action.terminal.selectAll" + "workbench.action.terminal.selectAll", ); } else { for (let i = 0; i < commands; i++) { await vscode.commands.executeCommand( - "workbench.action.terminal.selectToPreviousCommand" + "workbench.action.terminal.selectToPreviousCommand", ); } } await vscode.commands.executeCommand( - "workbench.action.terminal.copySelection" + "workbench.action.terminal.copySelection", ); await vscode.commands.executeCommand( - "workbench.action.terminal.clearSelection" + "workbench.action.terminal.clearSelection", ); const terminalContents = await vscode.env.clipboard.readText(); await vscode.env.clipboard.writeText(tempCopyBuffer); @@ -371,7 +372,7 @@ export class VsCodeIdeUtils { private async _getThreads(session: vscode.DebugSession) { const threadsResponse = await session.customRequest("threads"); const threads = threadsResponse.threads.filter((thread: any) => - threadStopped.get(thread.id) + threadStopped.get(thread.id), ); threads.sort((a: any, b: any) => a.id - b.id); threadsResponse.threads = threads; @@ -392,7 +393,7 @@ export class VsCodeIdeUtils { if (!session) { vscode.window.showWarningMessage( - "No active debug session found, therefore no debug context will be provided for the llm." + "No active debug session found, therefore no debug context will be provided for the llm.", ); return ""; } @@ -405,12 +406,12 @@ export class VsCodeIdeUtils { .then((traceResponse) => session.customRequest("scopes", { frameId: traceResponse.stackFrames[0].id, - }) + }), ) .then((scopesResponse) => session.customRequest("variables", { variablesReference: scopesResponse.scopes[0].variablesReference, - }) + }), ); const variableContext = variablesResponse.variables @@ -419,7 +420,7 @@ export class VsCodeIdeUtils { (acc: any, variable: any) => `${acc}\nname: ${variable.name}, type: ${variable.type}, ` + `value: ${variable.value}`, - "" + "", ); return variableContext; @@ -427,7 +428,7 @@ export class VsCodeIdeUtils { async getTopLevelCallStackSources( threadIndex: number, - stackDepth: number = 3 + stackDepth: number = 3, ): Promise { const session = vscode.debug.activeDebugSession; if (!session) return []; @@ -448,7 +449,7 @@ export class VsCodeIdeUtils { const scope = scopeResponse.scopes[0]; return await this.retrieveSource(scope.source ? scope : stackFrame); - }) + }), ); return Promise.all(sourcesPromises); @@ -474,8 +475,8 @@ export class VsCodeIdeUtils { sourceContainer.line - 1, // The line number from scope response starts from 1 sourceContainer.column, sourceContainer.endLine - 1, - sourceContainer.endColumn - ) + sourceContainer.endColumn, + ), ); } else if (sourceContainer.line) // fall back to 5 line of context @@ -485,8 +486,8 @@ export class VsCodeIdeUtils { sourceContainer.line - 3, 0, sourceContainer.line + 2, - 0 - ) + 0, + ), ); else return "unavailable"; } @@ -502,17 +503,28 @@ export class VsCodeIdeUtils { return undefined; } - const git = extension.exports.getAPI(1); - return git.getRepository(forDirectory); + try { + const git = extension.exports.getAPI(1); + return git.getRepository(forDirectory); + } catch (e) { + this._repoWasNone = true; + console.warn("Git not found: ", e); + return undefined; + } } + private _repoWasNone: boolean = false; async getRepo(forDirectory: vscode.Uri): Promise { let repo = await this._getRepo(forDirectory); + let i = 0; while (!repo?.state?.HEAD?.name) { + if (this._repoWasNone) return undefined; + await new Promise((resolve) => setTimeout(resolve, 1000)); i++; if (i >= 20) { + this._repoWasNone = true; return undefined; } repo = await this._getRepo(forDirectory); diff --git a/extensions/vscode/src/util/loadAutocompleteModel.ts b/extensions/vscode/src/util/loadAutocompleteModel.ts index 41fd7f886..b2f698013 100644 --- a/extensions/vscode/src/util/loadAutocompleteModel.ts +++ b/extensions/vscode/src/util/loadAutocompleteModel.ts @@ -5,8 +5,8 @@ import * as vscode from "vscode"; export class TabAutocompleteModel { private _llm: ILLM | undefined; - private defaultTag: string = "starcoder:3b"; - private defaultTagName: string = "Starcoder 3b"; + private defaultTag: string = "starcoder2:3b"; + private defaultTagName: string = "Starcoder2 3b"; private shownOllamaWarning: boolean = false; private shownDeepseekWarning: boolean = false; diff --git a/extensions/vscode/src/util/traverseDirectory.ts b/extensions/vscode/src/util/traverseDirectory.ts index cd4095da4..1fc9e7dc9 100644 --- a/extensions/vscode/src/util/traverseDirectory.ts +++ b/extensions/vscode/src/util/traverseDirectory.ts @@ -1,82 +1,9 @@ +import { defaultIgnoreDir, defaultIgnoreFile } from "core/indexing/ignore"; import ignore from "ignore"; import * as path from "path"; import * as vscode from "vscode"; import { uriFromFilePath } from "./vscode"; -const DEFAULT_IGNORE_FILETYPES = [ - "*.DS_Store", - "*-lock.json", - "*.lock", - "*.log", - "*.ttf", - "*.png", - "*.jpg", - "*.jpeg", - "*.gif", - "*.mp4", - "*.svg", - "*.ico", - "*.pdf", - "*.zip", - "*.gz", - "*.tar", - "*.dmg", - "*.tgz", - "*.rar", - "*.7z", - "*.exe", - "*.dll", - "*.obj", - "*.o", - "*.a", - "*.lib", - "*.so", - "*.dylib", - "*.ncb", - "*.sdf", - "*.woff", - "*.woff2", - "*.eot", - "*.cur", - "*.avi", - "*.mpg", - "*.mpeg", - "*.mov", - "*.mp3", - "*.mp4", - "*.mkv", - "*.mkv", - "*.webm", - "*.jar", - "*.onnx", - "*.parquet", - "*.pqt", - "*.wav", - "*.webp", -]; -export const defaultIgnoreFile = ignore().add(DEFAULT_IGNORE_FILETYPES); -const DEFAULT_IGNORE_DIRS = [ - ".git", - ".vscode", - ".idea", - ".vs", - "venv", - ".venv", - "env", - ".env", - "node_modules", - "dist", - "build", - "target", - "out", - "bin", - ".pytest_cache", - ".vscode-test", - ".continue", - "__pycache__", -]; -const defaultIgnoreDir = ignore().add(DEFAULT_IGNORE_DIRS); - function isIgnoreFilepath(filepath: string): boolean { return ( filepath.endsWith(".gitignore") || filepath.endsWith(".continueignore") diff --git a/extensions/vscode/src/util/util.ts b/extensions/vscode/src/util/util.ts index 9d13b81f7..5a2f5cbf8 100644 --- a/extensions/vscode/src/util/util.ts +++ b/extensions/vscode/src/util/util.ts @@ -79,6 +79,14 @@ export function getPlatform(): Platform { } } +export function getAltOrOption() { + if (getPlatform() === "mac") { + return "⌥"; + } else { + return "⎇"; + } +} + export function getMetaKeyLabel() { const platform = getPlatform(); switch (platform) { diff --git a/extensions/vscode/src/webviewProtocol.ts b/extensions/vscode/src/webviewProtocol.ts index 3b21730ca..4ffc24116 100644 --- a/extensions/vscode/src/webviewProtocol.ts +++ b/extensions/vscode/src/webviewProtocol.ts @@ -1,5 +1,10 @@ import { ContextItemId, IDE } from "core"; import { ConfigHandler } from "core/config/handler"; +import { + setupLocalMode, + setupOptimizedExistingUserMode, + setupOptimizedMode, +} from "core/config/onboarding"; import { addModel, addOpenAIKey, deleteModel } from "core/config/util"; import { indexDocs } from "core/indexing/docs"; import TransformersJsEmbeddingsProvider from "core/indexing/embeddings/TransformersJsEmbeddingsProvider"; @@ -7,16 +12,36 @@ import { logDevData } from "core/util/devdata"; import { DevDataSqliteDb } from "core/util/devdataSqlite"; import historyManager from "core/util/history"; import { Message } from "core/util/messenger"; -import { getConfigJsonPath } from "core/util/paths"; +import { editConfigJson, getConfigJsonPath } from "core/util/paths"; import { Telemetry } from "core/util/posthog"; import { ReverseWebviewProtocol, WebviewProtocol, } from "core/web/webviewProtocol"; +import fs from "fs"; +import path from "path"; import { v4 as uuidv4 } from "uuid"; import * as vscode from "vscode"; -import { showTutorial } from "./activation/activate"; import { VerticalPerLineDiffManager } from "./diff/verticalPerLine/manager"; +import { getExtensionUri } from "./util/vscode"; + +async function showTutorial() { + const tutorialPath = path.join( + getExtensionUri().fsPath, + "continue_tutorial.py", + ); + // Ensure keyboard shortcuts match OS + if (process.platform !== "darwin") { + let tutorialContent = fs.readFileSync(tutorialPath, "utf8"); + tutorialContent = tutorialContent.replace("⌘", "^").replace("Cmd", "Ctrl"); + fs.writeFileSync(tutorialPath, tutorialContent); + } + + const doc = await vscode.workspace.openTextDocument( + vscode.Uri.file(tutorialPath), + ); + await vscode.window.showTextDocument(doc); +} export class VsCodeWebviewProtocol { listeners = new Map any)[]>(); @@ -71,10 +96,12 @@ export class VsCodeWebviewProtocol { response && typeof response[Symbol.asyncIterator] === "function" ) { - for await (const update of response) { - respond(update); + let next = await response.next(); + while (!next.done) { + respond(next.value); + next = await response.next(); } - respond({ done: true }); + respond({ done: true, content: next.value?.content }); } else { respond(response || {}); } @@ -466,6 +493,7 @@ export class VsCodeWebviewProtocol { const items = await provider.getContextItems(query, { llm, embeddingsProvider: config.embeddingsProvider, + reranker: config.reranker, fullInput, ide, selectedCode, @@ -536,6 +564,23 @@ export class VsCodeWebviewProtocol { showTutorial(); }); + this.on("completeOnboarding", (msg) => { + const mode = msg.data.mode; + Telemetry.capture("onboardingSelection", { + mode, + }); + if (mode === "custom" || mode === "localExistingUser") { + return; + } + editConfigJson( + mode === "local" + ? setupLocalMode + : mode === "optimized" + ? setupOptimizedMode + : setupOptimizedExistingUserMode, + ); + }); + this.on("openUrl", (msg) => { vscode.env.openExternal(vscode.Uri.parse(msg.data)); }); @@ -547,6 +592,19 @@ export class VsCodeWebviewProtocol { const rows = await DevDataSqliteDb.getTokensPerModel(); return rows; }); + this.on("insertAtCursor", async (msg) => { + const editor = vscode.window.activeTextEditor; + if (editor === undefined || !editor.selection) { + return; + } + + editor.edit((editBuilder) => { + editBuilder.replace( + new vscode.Range(editor.selection.start, editor.selection.end), + msg.data.text, + ); + }); + }); } public request( diff --git a/extensions/vscode/yarn.lock b/extensions/vscode/yarn.lock index 9268fc252..07f331801 100644 --- a/extensions/vscode/yarn.lock +++ b/extensions/vscode/yarn.lock @@ -692,9 +692,9 @@ integrity sha512-4JQNk+3mVzK3xh2rqd6RB4J46qUR19azEHBneZyTZM+c456qOrbbM/5xcR8huNCCcbVt7+UmizG6GuUvPvKUYg== "@lancedb/vectordb-darwin-arm64@*": - version "0.4.13" - resolved "https://registry.npmjs.org/@lancedb/vectordb-darwin-arm64/-/vectordb-darwin-arm64-0.4.13.tgz" - integrity sha512-JfroNCG8yKIU931Y+x8d0Fp8C9DHUSC5j+CjI+e5err7rTWtie4j3JbsXlWAnPFaFEOg0Xk3BWkSikCvhPGJGg== + version "0.4.16" + resolved "https://registry.npmjs.org/@lancedb/vectordb-darwin-arm64/-/vectordb-darwin-arm64-0.4.16.tgz" + integrity sha512-RtuizzrZIVDYQ4ZZIMQRHGuV0DvOV93lyvivJJBLP1zCORMHEtEduaVbFE/+H0OCo0oqPsKXEpbc0nUEXKQqRg== "@lancedb/vectordb-darwin-arm64@0.4.12": version "0.4.12" @@ -2353,7 +2353,7 @@ core-util-is@1.0.2: integrity sha512-3lqz5YjWTYnW6dlDa5TLaTCcShfar1e40rmcJVwCBJC6mWlFuj0eCHIElmG1g5kyuJ/GD+8Wn4FFCcz4gJPfaQ== "core@file:../../core": - version "1.0.4" + version "1.0.6" resolved "file:../../core" dependencies: "@mozilla/readability" "^0.5.0" @@ -2373,6 +2373,7 @@ core-util-is@1.0.2: handlebars "^4.7.8" http-proxy-agent "^7.0.1" https-proxy-agent "^7.0.3" + ignore "^5.3.1" js-tiktoken "^1.0.8" jsdom "^24.0.0" llama-tokenizer-js "^1.1.3" @@ -2390,7 +2391,7 @@ core-util-is@1.0.2: sqlite3 "^5.1.7" tree-sitter-wasms "^0.1.6" uuid "^9.0.1" - vectordb "^0.4.12" + vectordb "0.4.12" web-tree-sitter "^0.21.0" cors@^2.8.5: @@ -7764,7 +7765,7 @@ vary@^1, vary@~1.1.2: resolved "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz" integrity sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg== -vectordb@^0.4.3: +vectordb@0.4.12: version "0.4.12" resolved "https://registry.npmjs.org/vectordb/-/vectordb-0.4.12.tgz" integrity sha512-H2mFwZ87d3BcuX4yGx5RoW06amRZQ3W5u/FRTNc86rwVINuEEa+Ivsqng1i8hURHXoTDbF/0Y9qwCshySkeznQ== diff --git a/gui/editorInset/index.html b/gui/editorInset/index.html new file mode 100644 index 000000000..1e6607ff2 --- /dev/null +++ b/gui/editorInset/index.html @@ -0,0 +1,13 @@ + + + + + + + Continue + + +
+ + + diff --git a/gui/editorInset/vite.config.ts b/gui/editorInset/vite.config.ts new file mode 100644 index 000000000..fdc63bbdb --- /dev/null +++ b/gui/editorInset/vite.config.ts @@ -0,0 +1,19 @@ +import react from "@vitejs/plugin-react-swc"; +import tailwindcss from "tailwindcss"; +import { defineConfig } from "vite"; + +// https://vitejs.dev/config/ +export default defineConfig({ + plugins: [react(), tailwindcss()], + build: { + // Change the output .js filename to not include a hash + rollupOptions: { + // external: ["vscode-webview"], + output: { + entryFileNames: `assets/[name].js`, + chunkFileNames: `assets/[name].js`, + assetFileNames: `assets/[name].[ext]`, + }, + }, + }, +}); diff --git a/gui/package-lock.json b/gui/package-lock.json index 6f308aca7..317237093 100644 --- a/gui/package-lock.json +++ b/gui/package-lock.json @@ -75,7 +75,7 @@ }, "../core": { "name": "@continuedev/core", - "version": "1.0.4", + "version": "1.0.6", "license": "Apache-2.0", "dependencies": { "@mozilla/readability": "^0.5.0", @@ -95,6 +95,7 @@ "handlebars": "^4.7.8", "http-proxy-agent": "^7.0.1", "https-proxy-agent": "^7.0.3", + "ignore": "^5.3.1", "js-tiktoken": "^1.0.8", "jsdom": "^24.0.0", "llama-tokenizer-js": "^1.1.3", @@ -112,7 +113,7 @@ "sqlite3": "^5.1.7", "tree-sitter-wasms": "^0.1.6", "uuid": "^9.0.1", - "vectordb": "^0.4.12", + "vectordb": "0.4.12", "web-tree-sitter": "^0.21.0" }, "devDependencies": { @@ -143,55 +144,55 @@ } }, "node_modules/@ampproject/remapping": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.2.1.tgz", - "integrity": "sha512-lFMjJTrFL3j7L9yBxwYfCq2k6qqwHyzuUl/XBnif78PWTJYyL/dfowQHWE3sp6U6ZzqWiiIZnpTMO96zhkjwtg==", + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.3.0.tgz", + "integrity": "sha512-30iZtAPgz+LTIYoeivqYo853f02jBYSd5uGnGpkFV0M3xOt9aN73erkgYAmZU43x4VfqcnLxW9Kpg3R5LC4YYw==", "peer": true, "dependencies": { - "@jridgewell/gen-mapping": "^0.3.0", - "@jridgewell/trace-mapping": "^0.3.9" + "@jridgewell/gen-mapping": "^0.3.5", + "@jridgewell/trace-mapping": "^0.3.24" }, "engines": { "node": ">=6.0.0" } }, "node_modules/@babel/code-frame": { - "version": "7.23.5", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.23.5.tgz", - "integrity": "sha512-CgH3s1a96LipHCmSUmYFPwY7MNx8C3avkq7i4Wl3cfa662ldtUe4VM1TPXX70pfmrlWTb6jLqTYrZyT2ZTJBgA==", + "version": "7.24.2", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.24.2.tgz", + "integrity": "sha512-y5+tLQyV8pg3fsiln67BVLD1P13Eg4lh5RW9mF0zUuvLrv9uIQ4MCL+CRT+FTsBlBjcIan6PGsLcBN0m3ClUyQ==", "dependencies": { - "@babel/highlight": "^7.23.4", - "chalk": "^2.4.2" + "@babel/highlight": "^7.24.2", + "picocolors": "^1.0.0" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/compat-data": { - "version": "7.23.5", - "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.23.5.tgz", - "integrity": "sha512-uU27kfDRlhfKl+w1U6vp16IuvSLtjAxdArVXPa9BvLkrr7CYIsxH5adpHObeAGY/41+syctUWOZ140a2Rvkgjw==", + "version": "7.24.1", + "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.24.1.tgz", + "integrity": "sha512-Pc65opHDliVpRHuKfzI+gSA4zcgr65O4cl64fFJIWEEh8JoHIHh0Oez1Eo8Arz8zq/JhgKodQaxEwUPRtZylVA==", "peer": true, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/core": { - "version": "7.23.9", - "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.23.9.tgz", - "integrity": "sha512-5q0175NOjddqpvvzU+kDiSOAk4PfdO6FvwCWoQ6RO7rTzEe8vlo+4HVfcnAREhD4npMs0e9uZypjTwzZPCf/cw==", + "version": "7.24.3", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.24.3.tgz", + "integrity": "sha512-5FcvN1JHw2sHJChotgx8Ek0lyuh4kCKelgMTTqhYJJtloNvUfpAFMeNQUtdlIaktwrSV9LtCdqwk48wL2wBacQ==", "peer": true, "dependencies": { "@ampproject/remapping": "^2.2.0", - "@babel/code-frame": "^7.23.5", - "@babel/generator": "^7.23.6", + "@babel/code-frame": "^7.24.2", + "@babel/generator": "^7.24.1", "@babel/helper-compilation-targets": "^7.23.6", "@babel/helper-module-transforms": "^7.23.3", - "@babel/helpers": "^7.23.9", - "@babel/parser": "^7.23.9", - "@babel/template": "^7.23.9", - "@babel/traverse": "^7.23.9", - "@babel/types": "^7.23.9", + "@babel/helpers": "^7.24.1", + "@babel/parser": "^7.24.1", + "@babel/template": "^7.24.0", + "@babel/traverse": "^7.24.1", + "@babel/types": "^7.24.0", "convert-source-map": "^2.0.0", "debug": "^4.1.0", "gensync": "^1.0.0-beta.2", @@ -207,13 +208,13 @@ } }, "node_modules/@babel/generator": { - "version": "7.23.6", - "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.23.6.tgz", - "integrity": "sha512-qrSfCYxYQB5owCmGLbl8XRpX1ytXlpueOb0N0UmQwA073KZxejgQTzAmJezxvpwQD9uGtK2shHdi55QT+MbjIw==", + "version": "7.24.1", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.24.1.tgz", + "integrity": "sha512-DfCRfZsBcrPEHUfuBMgbJ1Ut01Y/itOs+hY2nFLgqsqXd52/iSiVq5TITtUasIUgm+IIKdY2/1I7auiQOEeC9A==", "dependencies": { - "@babel/types": "^7.23.6", - "@jridgewell/gen-mapping": "^0.3.2", - "@jridgewell/trace-mapping": "^0.3.17", + "@babel/types": "^7.24.0", + "@jridgewell/gen-mapping": "^0.3.5", + "@jridgewell/trace-mapping": "^0.3.25", "jsesc": "^2.5.1" }, "engines": { @@ -279,11 +280,11 @@ } }, "node_modules/@babel/helper-module-imports": { - "version": "7.22.15", - "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.22.15.tgz", - "integrity": "sha512-0pYVBnDKZO2fnSPCrgM/6WMc7eS20Fbok+0r88fp+YtWVLZrp4CkafFGIp+W0VKw4a22sgebPT99y+FDNMdP4w==", + "version": "7.24.3", + "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.24.3.tgz", + "integrity": "sha512-viKb0F9f2s0BCS22QSF308z/+1YWKV/76mwt61NBzS5izMzDPwdq1pTrzf+Li3npBWX9KdQbkeCt1jSAM7lZqg==", "dependencies": { - "@babel/types": "^7.22.15" + "@babel/types": "^7.24.0" }, "engines": { "node": ">=6.9.0" @@ -309,9 +310,9 @@ } }, "node_modules/@babel/helper-plugin-utils": { - "version": "7.22.5", - "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.22.5.tgz", - "integrity": "sha512-uLls06UVKgFG9QD4OeFYLEGteMIAa5kpTPcFL28yuCIIzsf6ZyKZMllKVOCZFhiZ5ptnwX4mtKdWCBE/uT4amg==", + "version": "7.24.0", + "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.24.0.tgz", + "integrity": "sha512-9cUznXMG0+FxRuJfvL82QlTqIzhVW9sL0KjMPHhAOOvpQGL8QtdxnBKILjBqxlHyliz0yCa1G903ZXI/FuHy2w==", "engines": { "node": ">=6.9.0" } @@ -340,9 +341,9 @@ } }, "node_modules/@babel/helper-string-parser": { - "version": "7.23.4", - "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.23.4.tgz", - "integrity": "sha512-803gmbQdqwdf4olxrX4AJyFBV/RTr3rSmOj0rKwesmzlfhYNDEs+/iOcznzpNWlJlIlTJC2QfPFcHB6DlzdVLQ==", + "version": "7.24.1", + "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.24.1.tgz", + "integrity": "sha512-2ofRCjnnA9y+wk8b9IAREroeUP02KHp431N2mhKniy2yKIDKpbrHv9eXwm8cBeWQYcJmzv5qKCu65P47eCF7CQ==", "engines": { "node": ">=6.9.0" } @@ -365,36 +366,37 @@ } }, "node_modules/@babel/helpers": { - "version": "7.23.9", - "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.23.9.tgz", - "integrity": "sha512-87ICKgU5t5SzOT7sBMfCOZQ2rHjRU+Pcb9BoILMYz600W6DkVRLFBPwQ18gwUVvggqXivaUakpnxWQGbpywbBQ==", + "version": "7.24.1", + "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.24.1.tgz", + "integrity": "sha512-BpU09QqEe6ZCHuIHFphEFgvNSrubve1FtyMton26ekZ85gRGi6LrTF7zArARp2YvyFxloeiRmtSCq5sjh1WqIg==", "peer": true, "dependencies": { - "@babel/template": "^7.23.9", - "@babel/traverse": "^7.23.9", - "@babel/types": "^7.23.9" + "@babel/template": "^7.24.0", + "@babel/traverse": "^7.24.1", + "@babel/types": "^7.24.0" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/highlight": { - "version": "7.23.4", - "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.23.4.tgz", - "integrity": "sha512-acGdbYSfp2WheJoJm/EBBBLh/ID8KDc64ISZ9DYtBmC8/Q204PZJLHyzeB5qMzJ5trcOkybd78M4x2KWsUq++A==", + "version": "7.24.2", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.24.2.tgz", + "integrity": "sha512-Yac1ao4flkTxTteCDZLEvdxg2fZfz1v8M4QpaGypq/WPDqg3ijHYbDfs+LG5hvzSoqaSZ9/Z9lKSP3CjZjv+pA==", "dependencies": { "@babel/helper-validator-identifier": "^7.22.20", "chalk": "^2.4.2", - "js-tokens": "^4.0.0" + "js-tokens": "^4.0.0", + "picocolors": "^1.0.0" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/parser": { - "version": "7.23.9", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.23.9.tgz", - "integrity": "sha512-9tcKgqKbs3xGJ+NtKF2ndOBBLVwPjl1SHxPQkd36r3Dlirw3xWUeGaTbqr7uGZcTaxkVNwc+03SVP7aCdWrTlA==", + "version": "7.24.1", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.24.1.tgz", + "integrity": "sha512-Zo9c7N3xdOIQrNip7Lc9wvRPzlRtovHVE4lkz8WEDr7uYh/GMQhSiIgFxGIArRHYdJE5kxtZjAf8rT0xhdLCzg==", "bin": { "parser": "bin/babel-parser.js" }, @@ -403,11 +405,11 @@ } }, "node_modules/@babel/plugin-syntax-jsx": { - "version": "7.23.3", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-jsx/-/plugin-syntax-jsx-7.23.3.tgz", - "integrity": "sha512-EB2MELswq55OHUoRZLGg/zC7QWUKfNLpE57m/S2yr1uEneIgsTgrSzXP3NXEsMkVn76OlaVVnzN+ugObuYGwhg==", + "version": "7.24.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-jsx/-/plugin-syntax-jsx-7.24.1.tgz", + "integrity": "sha512-2eCtxZXf+kbkMIsXS4poTvT4Yu5rXiRa+9xGVT56raghjmBTKMpFNc9R4IDiB4emao9eO22Ox7CxuJG7BgExqA==", "dependencies": { - "@babel/helper-plugin-utils": "^7.22.5" + "@babel/helper-plugin-utils": "^7.24.0" }, "engines": { "node": ">=6.9.0" @@ -417,9 +419,9 @@ } }, "node_modules/@babel/runtime": { - "version": "7.23.9", - "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.23.9.tgz", - "integrity": "sha512-0CX6F+BI2s9dkUqr08KFrAIZgNFj75rdBU/DjCyYLIaV/quFjkk6T+EJ2LkZHyZTbEV4L5p97mNkUsHl2wLFAw==", + "version": "7.24.1", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.24.1.tgz", + "integrity": "sha512-+BIznRzyqBf+2wCTxcKE3wDjfGeCoVE61KSHGpkzqrLi8qxqFwBeUFyId2cxkTmm55fzDGnm0+yCxaxygrLUnQ==", "dependencies": { "regenerator-runtime": "^0.14.0" }, @@ -428,31 +430,31 @@ } }, "node_modules/@babel/template": { - "version": "7.23.9", - "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.23.9.tgz", - "integrity": "sha512-+xrD2BWLpvHKNmX2QbpdpsBaWnRxahMwJjO+KZk2JOElj5nSmKezyS1B4u+QbHMTX69t4ukm6hh9lsYQ7GHCKA==", + "version": "7.24.0", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.24.0.tgz", + "integrity": "sha512-Bkf2q8lMB0AFpX0NFEqSbx1OkTHf0f+0j82mkw+ZpzBnkk7e9Ql0891vlfgi+kHwOk8tQjiQHpqh4LaSa0fKEA==", "dependencies": { "@babel/code-frame": "^7.23.5", - "@babel/parser": "^7.23.9", - "@babel/types": "^7.23.9" + "@babel/parser": "^7.24.0", + "@babel/types": "^7.24.0" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/traverse": { - "version": "7.23.9", - "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.23.9.tgz", - "integrity": "sha512-I/4UJ9vs90OkBtY6iiiTORVMyIhJ4kAVmsKo9KFc8UOxMeUfi2hvtIBsET5u9GizXE6/GFSuKCTNfgCswuEjRg==", + "version": "7.24.1", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.24.1.tgz", + "integrity": "sha512-xuU6o9m68KeqZbQuDt2TcKSxUw/mrsvavlEqQ1leZ/B+C9tk6E4sRWy97WaXgvq5E+nU3cXMxv3WKOCanVMCmQ==", "dependencies": { - "@babel/code-frame": "^7.23.5", - "@babel/generator": "^7.23.6", + "@babel/code-frame": "^7.24.1", + "@babel/generator": "^7.24.1", "@babel/helper-environment-visitor": "^7.22.20", "@babel/helper-function-name": "^7.23.0", "@babel/helper-hoist-variables": "^7.22.5", "@babel/helper-split-export-declaration": "^7.22.6", - "@babel/parser": "^7.23.9", - "@babel/types": "^7.23.9", + "@babel/parser": "^7.24.1", + "@babel/types": "^7.24.0", "debug": "^4.3.1", "globals": "^11.1.0" }, @@ -461,9 +463,9 @@ } }, "node_modules/@babel/types": { - "version": "7.23.9", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.23.9.tgz", - "integrity": "sha512-dQjSq/7HaSjRM43FFGnv5keM2HsxpmyV1PfaSVm0nzzjwwTmjOe6J4bC8e3+pTEIgHaHj+1ZlLThRJ2auc/w1Q==", + "version": "7.24.0", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.24.0.tgz", + "integrity": "sha512-+j7a5c253RfKh8iABBhywc8NSfP5LURe7Uh4qpsh6jc+aLJguvmIUBdjSdEMQv2bENrCR5MfRdjGo7vzS/ob7w==", "dependencies": { "@babel/helper-string-parser": "^7.23.4", "@babel/helper-validator-identifier": "^7.22.20", @@ -474,9 +476,9 @@ } }, "node_modules/@emotion/is-prop-valid": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/@emotion/is-prop-valid/-/is-prop-valid-1.2.1.tgz", - "integrity": "sha512-61Mf7Ufx4aDxx1xlDeOm8aFFigGHE4z+0sKCa+IHCeZKiyP9RLD0Mmx7m8b9/Cf37f7NAvQOOJAbQQGVr5uERw==", + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/@emotion/is-prop-valid/-/is-prop-valid-1.2.2.tgz", + "integrity": "sha512-uNsoYd37AFmaCdXlg6EYD1KaPOaRWRByMCYzbKUX4+hhMfrxdVSelShywL4JVaAeM/eHUOSprYBQls+/neX3pw==", "dependencies": { "@emotion/memoize": "^0.8.1" } @@ -887,9 +889,9 @@ } }, "node_modules/@heroicons/react": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/@heroicons/react/-/react-2.1.1.tgz", - "integrity": "sha512-JyyN9Lo66kirbCMuMMRPtJxtKJoIsXKS569ebHGGRKbl8s4CtUfLnyKJxteA+vIKySocO4s1SkTkGS4xtG/yEA==", + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/@heroicons/react/-/react-2.1.3.tgz", + "integrity": "sha512-fEcPfo4oN345SoqdlCDdSa4ivjaKbk0jTd+oubcgNxnNgAfzysfwWfQUr+51wigiWHQQRiZNd1Ao0M5Y3M2EGg==", "peerDependencies": { "react": ">= 16" } @@ -911,14 +913,64 @@ "node": ">=12" } }, - "node_modules/@jridgewell/gen-mapping": { - "version": "0.3.3", - "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.3.tgz", - "integrity": "sha512-HLhSWOLRi875zjjMG/r+Nv0oCW8umGb0BgEhyX3dDX3egwZtB8PqLnjz3yedt8R5StBrzcg4aBpnh8UA9D1BoQ==", + "node_modules/@isaacs/cliui/node_modules/ansi-regex": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.0.1.tgz", + "integrity": "sha512-n5M855fKb2SsfMIiFFoVrABHJC8QtHwVx+mHWP3QcEqBHYienj5dHSgjbxtC0WEZXYt4wcD6zrQElDPhFuZgfA==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-regex?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==", + "dev": true + }, + "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==", + "dev": true, "dependencies": { - "@jridgewell/set-array": "^1.0.1", + "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==", + "dev": true, + "dependencies": { + "ansi-regex": "^6.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/strip-ansi?sponsor=1" + } + }, + "node_modules/@jridgewell/gen-mapping": { + "version": "0.3.5", + "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.5.tgz", + "integrity": "sha512-IzL8ZoEDIBRWEzlCcRhOaCupYyN5gdIK+Q6fbFdPDg6HqX6jpkItn7DFIpW9LQzXG6Df9sA7+OKnq0qlz/GaQg==", + "dependencies": { + "@jridgewell/set-array": "^1.2.1", "@jridgewell/sourcemap-codec": "^1.4.10", - "@jridgewell/trace-mapping": "^0.3.9" + "@jridgewell/trace-mapping": "^0.3.24" }, "engines": { "node": ">=6.0.0" @@ -933,9 +985,9 @@ } }, "node_modules/@jridgewell/set-array": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.1.2.tgz", - "integrity": "sha512-xnkseuNADM0gt2bs+BvhO0p78Mk762YnZdsuzFV018NoG1Sj1SCQvpSqa7XUaTam5vAGasABV9qXASMKnFMwMw==", + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.2.1.tgz", + "integrity": "sha512-R8gLRTZeyp03ymzP/6Lil/28tGeGEzhx1q2k703KGWRAI1VdvPIXdG70VJc2pAMw3NA6JKL5hhFu1sJX0Mnn/A==", "engines": { "node": ">=6.0.0" } @@ -946,9 +998,9 @@ "integrity": "sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==" }, "node_modules/@jridgewell/trace-mapping": { - "version": "0.3.22", - "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.22.tgz", - "integrity": "sha512-Wf963MzWtA2sjrNt+g18IAln9lKnlRp+K2eH4jjIoF1wYeq3aMREpG09xhlhdzS0EjwU7qmUJYangWa+151vZw==", + "version": "0.3.25", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.25.tgz", + "integrity": "sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ==", "dependencies": { "@jridgewell/resolve-uri": "^3.1.0", "@jridgewell/sourcemap-codec": "^1.4.14" @@ -1092,38 +1144,10 @@ "resolved": "https://registry.npmjs.org/@remirror/core-constants/-/core-constants-2.0.2.tgz", "integrity": "sha512-dyHY+sMF0ihPus3O27ODd4+agdHMEmuRdyiZJ2CCWjPV5UFmn17ZbElvk6WOGVE4rdCJKZQCrPV2BcikOMLUGQ==" }, - "node_modules/@remirror/core-helpers": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/@remirror/core-helpers/-/core-helpers-3.0.0.tgz", - "integrity": "sha512-tusEgQJIqg4qKj6HSBUFcyRnWnziw3neh4T9wOmsPGHFC3w9kl5KSrDb9UAgE8uX6y32FnS7vJ955mWOl3n50A==", - "dependencies": { - "@remirror/core-constants": "^2.0.2", - "@remirror/types": "^1.0.1", - "@types/object.omit": "^3.0.0", - "@types/object.pick": "^1.3.2", - "@types/throttle-debounce": "^2.1.0", - "case-anything": "^2.1.13", - "dash-get": "^1.0.2", - "deepmerge": "^4.3.1", - "fast-deep-equal": "^3.1.3", - "make-error": "^1.3.6", - "object.omit": "^3.0.0", - "object.pick": "^1.3.0", - "throttle-debounce": "^3.0.1" - } - }, - "node_modules/@remirror/types": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/@remirror/types/-/types-1.0.1.tgz", - "integrity": "sha512-VlZQxwGnt1jtQ18D6JqdIF+uFZo525WEqrfp9BOc3COPpK4+AWCgdnAWL+ho6imWcoINlGjR/+3b6y5C1vBVEA==", - "dependencies": { - "type-fest": "^2.19.0" - } - }, "node_modules/@remix-run/router": { - "version": "1.15.0", - "resolved": "https://registry.npmjs.org/@remix-run/router/-/router-1.15.0.tgz", - "integrity": "sha512-HOil5aFtme37dVQTB6M34G95kPM3MMuqSmIRVCC52eKV+Y/tGSqw9P3rWhlAx6A+mz+MoX+XxsGsNJbaI5qCgQ==", + "version": "1.15.3", + "resolved": "https://registry.npmjs.org/@remix-run/router/-/router-1.15.3.tgz", + "integrity": "sha512-Oy8rmScVrVxWZVOpEF57ovlnhpZ8CCPlnIIumVcV9nFdiSIrus99+Lw78ekXyGvVDlIsFJbSfmSovJUhCWYV3w==", "engines": { "node": ">=14.0.0" } @@ -1134,9 +1158,9 @@ "integrity": "sha512-+9jVqKhRSpsc591z5vX+X5Yyw+he/HCB4iQ/RYxw35CEPaY1gnsNE43nf9n9AaYjAQrTiI/mOwKUKdUs9vf7Xg==" }, "node_modules/@swc/core": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/@swc/core/-/core-1.4.1.tgz", - "integrity": "sha512-3y+Y8js+e7BbM16iND+6Rcs3jdiL28q3iVtYsCviYSSpP2uUVKkp5sJnCY4pg8AaVvyN7CGQHO7gLEZQ5ByozQ==", + "version": "1.4.11", + "resolved": "https://registry.npmjs.org/@swc/core/-/core-1.4.11.tgz", + "integrity": "sha512-WKEakMZxkVwRdgMN4AMJ9K5nysY8g8npgQPczmjBeNK5In7QEAZAJwnyccrWwJZU0XjVeHn2uj+XbOKdDW17rg==", "dev": true, "hasInstallScript": true, "dependencies": { @@ -1151,16 +1175,16 @@ "url": "https://opencollective.com/swc" }, "optionalDependencies": { - "@swc/core-darwin-arm64": "1.4.1", - "@swc/core-darwin-x64": "1.4.1", - "@swc/core-linux-arm-gnueabihf": "1.4.1", - "@swc/core-linux-arm64-gnu": "1.4.1", - "@swc/core-linux-arm64-musl": "1.4.1", - "@swc/core-linux-x64-gnu": "1.4.1", - "@swc/core-linux-x64-musl": "1.4.1", - "@swc/core-win32-arm64-msvc": "1.4.1", - "@swc/core-win32-ia32-msvc": "1.4.1", - "@swc/core-win32-x64-msvc": "1.4.1" + "@swc/core-darwin-arm64": "1.4.11", + "@swc/core-darwin-x64": "1.4.11", + "@swc/core-linux-arm-gnueabihf": "1.4.11", + "@swc/core-linux-arm64-gnu": "1.4.11", + "@swc/core-linux-arm64-musl": "1.4.11", + "@swc/core-linux-x64-gnu": "1.4.11", + "@swc/core-linux-x64-musl": "1.4.11", + "@swc/core-win32-arm64-msvc": "1.4.11", + "@swc/core-win32-ia32-msvc": "1.4.11", + "@swc/core-win32-x64-msvc": "1.4.11" }, "peerDependencies": { "@swc/helpers": "^0.5.0" @@ -1172,9 +1196,9 @@ } }, "node_modules/@swc/core-darwin-arm64": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/@swc/core-darwin-arm64/-/core-darwin-arm64-1.4.1.tgz", - "integrity": "sha512-ePyfx0348UbR4DOAW24TedeJbafnzha8liXFGuQ4bdXtEVXhLfPngprrxKrAddCuv42F9aTxydlF6+adD3FBhA==", + "version": "1.4.11", + "resolved": "https://registry.npmjs.org/@swc/core-darwin-arm64/-/core-darwin-arm64-1.4.11.tgz", + "integrity": "sha512-C1j1Qp/IHSelVWdEnT7f0iONWxQz6FAqzjCF2iaL+0vFg4V5f2nlgrueY8vj5pNNzSGhrAlxsMxEIp4dj1MXkg==", "cpu": [ "arm64" ], @@ -1188,9 +1212,9 @@ } }, "node_modules/@swc/core-darwin-x64": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/@swc/core-darwin-x64/-/core-darwin-x64-1.4.1.tgz", - "integrity": "sha512-eLf4JSe6VkCMdDowjM8XNC5rO+BrgfbluEzAVtKR8L2HacNYukieumN7EzpYCi0uF1BYwu1ku6tLyG2r0VcGxA==", + "version": "1.4.11", + "resolved": "https://registry.npmjs.org/@swc/core-darwin-x64/-/core-darwin-x64-1.4.11.tgz", + "integrity": "sha512-0TTy3Ni8ncgaMCchSQ7FK8ZXQLlamy0FXmGWbR58c+pVZWYZltYPTmheJUvVcR0H2+gPAymRKyfC0iLszDALjg==", "cpu": [ "x64" ], @@ -1204,9 +1228,9 @@ } }, "node_modules/@swc/core-linux-arm-gnueabihf": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/@swc/core-linux-arm-gnueabihf/-/core-linux-arm-gnueabihf-1.4.1.tgz", - "integrity": "sha512-K8VtTLWMw+rkN/jDC9o/Q9SMmzdiHwYo2CfgkwVT29NsGccwmNhCQx6XoYiPKyKGIFKt4tdQnJHKUFzxUqQVtQ==", + "version": "1.4.11", + "resolved": "https://registry.npmjs.org/@swc/core-linux-arm-gnueabihf/-/core-linux-arm-gnueabihf-1.4.11.tgz", + "integrity": "sha512-XJLB71uw0rog4DjYAPxFGAuGCBQpgJDlPZZK6MTmZOvI/1t0+DelJ24IjHIxk500YYM26Yv47xPabqFPD7I2zQ==", "cpu": [ "arm" ], @@ -1220,9 +1244,9 @@ } }, "node_modules/@swc/core-linux-arm64-gnu": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/@swc/core-linux-arm64-gnu/-/core-linux-arm64-gnu-1.4.1.tgz", - "integrity": "sha512-0e8p4g0Bfkt8lkiWgcdiENH3RzkcqKtpRXIVNGOmVc0OBkvc2tpm2WTx/eoCnes2HpTT4CTtR3Zljj4knQ4Fvw==", + "version": "1.4.11", + "resolved": "https://registry.npmjs.org/@swc/core-linux-arm64-gnu/-/core-linux-arm64-gnu-1.4.11.tgz", + "integrity": "sha512-vYQwzJvm/iu052d5Iw27UFALIN5xSrGkPZXxLNMHPySVko2QMNNBv35HLatkEQHbQ3X+VKSW9J9SkdtAvAVRAQ==", "cpu": [ "arm64" ], @@ -1236,9 +1260,9 @@ } }, "node_modules/@swc/core-linux-arm64-musl": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/@swc/core-linux-arm64-musl/-/core-linux-arm64-musl-1.4.1.tgz", - "integrity": "sha512-b/vWGQo2n7lZVUnSQ7NBq3Qrj85GrAPPiRbpqaIGwOytiFSk8VULFihbEUwDe0rXgY4LDm8z8wkgADZcLnmdUA==", + "version": "1.4.11", + "resolved": "https://registry.npmjs.org/@swc/core-linux-arm64-musl/-/core-linux-arm64-musl-1.4.11.tgz", + "integrity": "sha512-eV+KduiRYUFjPsvbZuJ9aknQH9Tj0U2/G9oIZSzLx/18WsYi+upzHbgxmIIHJ2VJgfd7nN40RI/hMtxNsUzR/g==", "cpu": [ "arm64" ], @@ -1252,9 +1276,9 @@ } }, "node_modules/@swc/core-linux-x64-gnu": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/@swc/core-linux-x64-gnu/-/core-linux-x64-gnu-1.4.1.tgz", - "integrity": "sha512-AFMQlvkKEdNi1Vk2GFTxxJzbICttBsOQaXa98kFTeWTnFFIyiIj2w7Sk8XRTEJ/AjF8ia8JPKb1zddBWr9+bEQ==", + "version": "1.4.11", + "resolved": "https://registry.npmjs.org/@swc/core-linux-x64-gnu/-/core-linux-x64-gnu-1.4.11.tgz", + "integrity": "sha512-WA1iGXZ2HpqM1OR9VCQZJ8sQ1KP2or9O4bO8vWZo6HZJIeoQSo7aa9waaCLRpkZvkng1ct/TF/l6ymqSNFXIzQ==", "cpu": [ "x64" ], @@ -1268,9 +1292,9 @@ } }, "node_modules/@swc/core-linux-x64-musl": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/@swc/core-linux-x64-musl/-/core-linux-x64-musl-1.4.1.tgz", - "integrity": "sha512-QX2MxIECX1gfvUVZY+jk528/oFkS9MAl76e3ZRvG2KC/aKlCQL0KSzcTSm13mOxkDKS30EaGRDRQWNukGpMeRg==", + "version": "1.4.11", + "resolved": "https://registry.npmjs.org/@swc/core-linux-x64-musl/-/core-linux-x64-musl-1.4.11.tgz", + "integrity": "sha512-UkVJToKf0owwQYRnGvjHAeYVDfeimCEcx0VQSbJoN7Iy0ckRZi7YPlmWJU31xtKvikE2bQWCOVe0qbSDqqcWXA==", "cpu": [ "x64" ], @@ -1284,9 +1308,9 @@ } }, "node_modules/@swc/core-win32-arm64-msvc": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/@swc/core-win32-arm64-msvc/-/core-win32-arm64-msvc-1.4.1.tgz", - "integrity": "sha512-OklkJYXXI/tntD2zaY8i3iZldpyDw5q+NAP3k9OlQ7wXXf37djRsHLV0NW4+ZNHBjE9xp2RsXJ0jlOJhfgGoFA==", + "version": "1.4.11", + "resolved": "https://registry.npmjs.org/@swc/core-win32-arm64-msvc/-/core-win32-arm64-msvc-1.4.11.tgz", + "integrity": "sha512-35khwkyly7lF5NDSyvIrukBMzxPorgc5iTSDfVO/LvnmN5+fm4lTlrDr4tUfTdOhv3Emy7CsKlsNAeFRJ+Pm+w==", "cpu": [ "arm64" ], @@ -1300,9 +1324,9 @@ } }, "node_modules/@swc/core-win32-ia32-msvc": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/@swc/core-win32-ia32-msvc/-/core-win32-ia32-msvc-1.4.1.tgz", - "integrity": "sha512-MBuc3/QfKX9FnLOU7iGN+6yHRTQaPQ9WskiC8s8JFiKQ+7I2p25tay2RplR9dIEEGgVAu6L7auv96LbNTh+FaA==", + "version": "1.4.11", + "resolved": "https://registry.npmjs.org/@swc/core-win32-ia32-msvc/-/core-win32-ia32-msvc-1.4.11.tgz", + "integrity": "sha512-Wx8/6f0ufgQF2pbVPsJ2dAmFLwIOW+xBE5fxnb7VnEbGkTgP1qMDWiiAtD9rtvDSuODG3i1AEmAak/2HAc6i6A==", "cpu": [ "ia32" ], @@ -1316,9 +1340,9 @@ } }, "node_modules/@swc/core-win32-x64-msvc": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/@swc/core-win32-x64-msvc/-/core-win32-x64-msvc-1.4.1.tgz", - "integrity": "sha512-lu4h4wFBb/bOK6N2MuZwg7TrEpwYXgpQf5R7ObNSXL65BwZ9BG8XRzD+dLJmALu8l5N08rP/TrpoKRoGT4WSxw==", + "version": "1.4.11", + "resolved": "https://registry.npmjs.org/@swc/core-win32-x64-msvc/-/core-win32-x64-msvc-1.4.11.tgz", + "integrity": "sha512-0xRFW6K9UZQH2NVC/0pVB0GJXS45lY24f+6XaPBF1YnMHd8A8GoHl7ugyM5yNUTe2AKhSgk5fJV00EJt/XBtdQ==", "cpu": [ "x64" ], @@ -1338,17 +1362,20 @@ "dev": true }, "node_modules/@swc/types": { - "version": "0.1.5", - "resolved": "https://registry.npmjs.org/@swc/types/-/types-0.1.5.tgz", - "integrity": "sha512-myfUej5naTBWnqOCc/MdVOLVjXUXtIA+NpDrDBKJtLLg2shUjBu3cZmB/85RyitKc55+lUUyl7oRfLOvkr2hsw==", - "dev": true + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/@swc/types/-/types-0.1.6.tgz", + "integrity": "sha512-/JLo/l2JsT/LRd80C3HfbmVpxOAJ11FO2RCEslFrgzLltoP9j8XIbsyDcfCt2WWyX+CM96rBoNM+IToAkFOugg==", + "dev": true, + "dependencies": { + "@swc/counter": "^0.1.3" + } }, "node_modules/@tanstack/react-virtual": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/@tanstack/react-virtual/-/react-virtual-3.0.4.tgz", - "integrity": "sha512-tiqKW/e2MJVCr7/pRUXulpkyxllaOclkHNfhKTo4pmHjJIqnhMfwIjc1Q1R0Un3PI3kQywywu/791c8z9u0qeA==", + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/@tanstack/react-virtual/-/react-virtual-3.2.0.tgz", + "integrity": "sha512-OEdMByf2hEfDa6XDbGlZN8qO6bTjlNKqjM3im9JG+u3mCL8jALy0T/67oDI001raUUPh1Bdmfn4ZvPOV5knpcg==", "dependencies": { - "@tanstack/virtual-core": "3.0.0" + "@tanstack/virtual-core": "3.2.0" }, "funding": { "type": "github", @@ -1360,18 +1387,18 @@ } }, "node_modules/@tanstack/virtual-core": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/@tanstack/virtual-core/-/virtual-core-3.0.0.tgz", - "integrity": "sha512-SYXOBTjJb05rXa2vl55TTwO40A6wKu0R5i1qQwhJYNDIqaIGF7D0HsLw+pJAyi2OvntlEIVusx3xtbbgSUi6zg==", + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/@tanstack/virtual-core/-/virtual-core-3.2.0.tgz", + "integrity": "sha512-P5XgYoAw/vfW65byBbJQCw+cagdXDT/qH6wmABiLt4v4YBT2q2vqCOhihe+D1Nt325F/S/0Tkv6C5z0Lv+VBQQ==", "funding": { "type": "github", "url": "https://github.com/sponsors/tannerlinsley" } }, "node_modules/@tiptap/core": { - "version": "2.2.2", - "resolved": "https://registry.npmjs.org/@tiptap/core/-/core-2.2.2.tgz", - "integrity": "sha512-fec26LtNgYFGhKzEA9+Of+qLKIKUxDL/XZQofoPcxP71NffcmpZ+ZjAx9NjnvuYtvylUSySZiPauY6WhN3aprw==", + "version": "2.2.4", + "resolved": "https://registry.npmjs.org/@tiptap/core/-/core-2.2.4.tgz", + "integrity": "sha512-cRrI8IlLIhCE1hacBQzXIC8dsRvGq6a4lYWQK/BaHuZg21CG7szp3Vd8Ix+ra1f5v0xPOT+Hy+QFNQooRMKMCw==", "funding": { "type": "github", "url": "https://github.com/sponsors/ueberdosis" @@ -1381,9 +1408,9 @@ } }, "node_modules/@tiptap/extension-blockquote": { - "version": "2.2.2", - "resolved": "https://registry.npmjs.org/@tiptap/extension-blockquote/-/extension-blockquote-2.2.2.tgz", - "integrity": "sha512-ENCGx/yhNdUQ0epGOeTN4HFeUSfQDK2CQBy2szkQVtzG/Vhv8ExxBWTxHJcMoeSfEVmKag4B506vfRkKH24IMA==", + "version": "2.2.4", + "resolved": "https://registry.npmjs.org/@tiptap/extension-blockquote/-/extension-blockquote-2.2.4.tgz", + "integrity": "sha512-FrfPnn0VgVrUwWLwja1afX99JGLp6PE9ThVcmri+tLwUZQvTTVcCvHoCdOakav3/nge1+aV4iE3tQdyq1tWI9Q==", "funding": { "type": "github", "url": "https://github.com/sponsors/ueberdosis" @@ -1393,9 +1420,9 @@ } }, "node_modules/@tiptap/extension-bold": { - "version": "2.2.2", - "resolved": "https://registry.npmjs.org/@tiptap/extension-bold/-/extension-bold-2.2.2.tgz", - "integrity": "sha512-8/KLpPHwO+GXlWsXEION7ppLfFIaSpnw5m2QYXz/LGRK32hzpTavbdXV3rx9+Vu+7Z+0yQF9G/ro1z9dqTQHpw==", + "version": "2.2.4", + "resolved": "https://registry.npmjs.org/@tiptap/extension-bold/-/extension-bold-2.2.4.tgz", + "integrity": "sha512-v3tTLc8YESFZPOGj5ByFr8VbmQ/PTo49T1vsK50VubxIN/5r9cXlKH8kb3dZlZxCxJa3FrXNO/M8rdGBSWQvSg==", "funding": { "type": "github", "url": "https://github.com/sponsors/ueberdosis" @@ -1405,9 +1432,9 @@ } }, "node_modules/@tiptap/extension-bubble-menu": { - "version": "2.2.2", - "resolved": "https://registry.npmjs.org/@tiptap/extension-bubble-menu/-/extension-bubble-menu-2.2.2.tgz", - "integrity": "sha512-W3OvoHxgBdQSrlX8FXvIs5wA+eHXe/0jGsqQdwLXPtqZOSR4Ks9OLmxDk2+O8ci0KCLPb6/doJYg7j/8Ic4KRg==", + "version": "2.2.4", + "resolved": "https://registry.npmjs.org/@tiptap/extension-bubble-menu/-/extension-bubble-menu-2.2.4.tgz", + "integrity": "sha512-Nx1fS9jcFlhxaTDYlnayz2UulhK6CMaePc36+7PQIVI+u20RhgTCRNr25zKNemvsiM0RPZZVUjlHkxC0l5as1Q==", "dependencies": { "tippy.js": "^6.3.7" }, @@ -1421,9 +1448,9 @@ } }, "node_modules/@tiptap/extension-bullet-list": { - "version": "2.2.2", - "resolved": "https://registry.npmjs.org/@tiptap/extension-bullet-list/-/extension-bullet-list-2.2.2.tgz", - "integrity": "sha512-mZznxwymWitQRHYxEN8LX7theJdQ1/O6kUsvwDyHw42+jaCsZumTHEWGckBwkxk3BWWKbrkRGv/cC78sa3cNJw==", + "version": "2.2.4", + "resolved": "https://registry.npmjs.org/@tiptap/extension-bullet-list/-/extension-bullet-list-2.2.4.tgz", + "integrity": "sha512-z/MPmW8bhRougMuorl6MAQBXeK4rhlP+jBWlNwT+CT8h5IkXqPnDbM1sZeagp2nYfVV6Yc4RWpzimqHHtGnYTA==", "funding": { "type": "github", "url": "https://github.com/sponsors/ueberdosis" @@ -1433,9 +1460,9 @@ } }, "node_modules/@tiptap/extension-code": { - "version": "2.2.2", - "resolved": "https://registry.npmjs.org/@tiptap/extension-code/-/extension-code-2.2.2.tgz", - "integrity": "sha512-CHMHK76fGFrY3TpsyNmPB393VvRgjnvLVOfc0Qx4KKEkntDQ1v2jg90XupLf0+H0aq0KQBHlSooW0Bh+7SxbmQ==", + "version": "2.2.4", + "resolved": "https://registry.npmjs.org/@tiptap/extension-code/-/extension-code-2.2.4.tgz", + "integrity": "sha512-JB4SJ2mUU/9qXFUf+K5K9szvovnN9AIcCb0f0UlcVBuddKHSqCl3wO3QJgYt44BfQTLMNuyzr+zVqfFd6BNt/g==", "funding": { "type": "github", "url": "https://github.com/sponsors/ueberdosis" @@ -1445,9 +1472,9 @@ } }, "node_modules/@tiptap/extension-code-block": { - "version": "2.2.2", - "resolved": "https://registry.npmjs.org/@tiptap/extension-code-block/-/extension-code-block-2.2.2.tgz", - "integrity": "sha512-CKn4xqhpCfwkVdkj//A+LVf0hFrRkBbDx8u3KG+I7cegjXxvDSqb2OGhn/tXpFatLAE50GJiPIvqf+TmhIWBvA==", + "version": "2.2.4", + "resolved": "https://registry.npmjs.org/@tiptap/extension-code-block/-/extension-code-block-2.2.4.tgz", + "integrity": "sha512-h6WV9TmaBEZmvqe1ezMR83DhCPUap6P2mSR5pwVk0WVq6rvZjfgU0iF3EetBJOeDgPlz7cNe2NMDfVb1nGTM/g==", "funding": { "type": "github", "url": "https://github.com/sponsors/ueberdosis" @@ -1458,9 +1485,9 @@ } }, "node_modules/@tiptap/extension-document": { - "version": "2.2.2", - "resolved": "https://registry.npmjs.org/@tiptap/extension-document/-/extension-document-2.2.2.tgz", - "integrity": "sha512-eUhpYq8ErVAlxuTg5wslc96mniEQs+VN+tFmRrx9Q0n0nG/aDKUQFDgcSMpAMpHK7+h7tGc/rDq+ydpzZhFXlQ==", + "version": "2.2.4", + "resolved": "https://registry.npmjs.org/@tiptap/extension-document/-/extension-document-2.2.4.tgz", + "integrity": "sha512-z+05xGK0OFoXV1GL+/8bzcZuWMdMA3+EKwk5c+iziG60VZcvGTF7jBRsZidlu9Oaj0cDwWHCeeo6L9SgSh6i2A==", "funding": { "type": "github", "url": "https://github.com/sponsors/ueberdosis" @@ -1470,9 +1497,9 @@ } }, "node_modules/@tiptap/extension-dropcursor": { - "version": "2.2.2", - "resolved": "https://registry.npmjs.org/@tiptap/extension-dropcursor/-/extension-dropcursor-2.2.2.tgz", - "integrity": "sha512-HxXEf6m+W3PnT63Ib49qAmcwmapZvmyWgq9cvB5kSfl/znQT04wBgShEigkgUBLqgcM/R/RI8NS1GQl1Zpv9iQ==", + "version": "2.2.4", + "resolved": "https://registry.npmjs.org/@tiptap/extension-dropcursor/-/extension-dropcursor-2.2.4.tgz", + "integrity": "sha512-IHwkEKmqpqXyJi16h7871NrcIqeyN7I6XRE2qdqi+MhGigVWI8nWHoYbjRKa7K/1uhs5zeRYyDlq5EuZyL6mgA==", "funding": { "type": "github", "url": "https://github.com/sponsors/ueberdosis" @@ -1483,9 +1510,9 @@ } }, "node_modules/@tiptap/extension-floating-menu": { - "version": "2.2.2", - "resolved": "https://registry.npmjs.org/@tiptap/extension-floating-menu/-/extension-floating-menu-2.2.2.tgz", - "integrity": "sha512-DRz9kzcPt7S8s22EQC+KS/ghnHRV6j7Qequ+0kLjfLYPdqj2u4G5xTrFM7sWfzUqf2HdH8SS8Yo9WFMYm69D9w==", + "version": "2.2.4", + "resolved": "https://registry.npmjs.org/@tiptap/extension-floating-menu/-/extension-floating-menu-2.2.4.tgz", + "integrity": "sha512-U25l7PEzOmlAPugNRl8t8lqyhQZS6W/+3f92+FdwW9qXju3i62iX/3OGCC3Gv+vybmQ4fbZmMjvl+VDfenNi3A==", "dependencies": { "tippy.js": "^6.3.7" }, @@ -1499,9 +1526,9 @@ } }, "node_modules/@tiptap/extension-gapcursor": { - "version": "2.2.2", - "resolved": "https://registry.npmjs.org/@tiptap/extension-gapcursor/-/extension-gapcursor-2.2.2.tgz", - "integrity": "sha512-qsE8yI9nZOLHg6XdFwn4BYMhR2f/50gppHJdsHx53575y2ci6uowMI+WjdEentl6yR9ctgV1jelHLs9ShmPzwQ==", + "version": "2.2.4", + "resolved": "https://registry.npmjs.org/@tiptap/extension-gapcursor/-/extension-gapcursor-2.2.4.tgz", + "integrity": "sha512-Y6htT/RDSqkQ1UwG2Ia+rNVRvxrKPOs3RbqKHPaWr3vbFWwhHyKhMCvi/FqfI3d5pViVHOZQ7jhb5hT/a0BmNw==", "funding": { "type": "github", "url": "https://github.com/sponsors/ueberdosis" @@ -1512,9 +1539,9 @@ } }, "node_modules/@tiptap/extension-hard-break": { - "version": "2.2.2", - "resolved": "https://registry.npmjs.org/@tiptap/extension-hard-break/-/extension-hard-break-2.2.2.tgz", - "integrity": "sha512-zbG6/7xyMim2fnRESIx2FiFHjdY7BXKMe+GUgLGPnRfXrJqSZhdVguBrtYGBnBFCnuSiOZZ6rFy+k5uORGSrhA==", + "version": "2.2.4", + "resolved": "https://registry.npmjs.org/@tiptap/extension-hard-break/-/extension-hard-break-2.2.4.tgz", + "integrity": "sha512-FPvS57GcqHIeLbPKGJa3gnH30Xw+YB1PXXnAWG2MpnMtc2Vtj1l5xaYYBZB+ADdXLAlU0YMbKhFLQO4+pg1Isg==", "funding": { "type": "github", "url": "https://github.com/sponsors/ueberdosis" @@ -1524,9 +1551,9 @@ } }, "node_modules/@tiptap/extension-heading": { - "version": "2.2.2", - "resolved": "https://registry.npmjs.org/@tiptap/extension-heading/-/extension-heading-2.2.2.tgz", - "integrity": "sha512-oCd8VsLnrqJFY+lgA+5I/2EjBa4mQzB5DFLzCI460PfZnQJ2DmaNUdpY38BpHUv8E2PbBXzxxWS9h88yycW6yw==", + "version": "2.2.4", + "resolved": "https://registry.npmjs.org/@tiptap/extension-heading/-/extension-heading-2.2.4.tgz", + "integrity": "sha512-gkq7Ns2FcrOCRq7Q+VRYt5saMt2R9g4REAtWy/jEevJ5UV5vA2AiGnYDmxwAkHutoYU0sAUkjqx37wE0wpamNw==", "funding": { "type": "github", "url": "https://github.com/sponsors/ueberdosis" @@ -1536,9 +1563,9 @@ } }, "node_modules/@tiptap/extension-history": { - "version": "2.2.2", - "resolved": "https://registry.npmjs.org/@tiptap/extension-history/-/extension-history-2.2.2.tgz", - "integrity": "sha512-hcCEh7mP5H38ZY3YtbyyUOTNfKWAvITkJhVqjKbrRI3E+FOlG3pWPH3wz4srW5bHK38oUsiKwyP9FqC3C2Mixg==", + "version": "2.2.4", + "resolved": "https://registry.npmjs.org/@tiptap/extension-history/-/extension-history-2.2.4.tgz", + "integrity": "sha512-FDM32XYF5NU4mzh+fJ8w2CyUqv0l2Nl15sd6fOhQkVxSj8t57z+DUXc9ZR3zkH+1RAagYJo/2Gu3e99KpMr0tg==", "funding": { "type": "github", "url": "https://github.com/sponsors/ueberdosis" @@ -1549,9 +1576,9 @@ } }, "node_modules/@tiptap/extension-horizontal-rule": { - "version": "2.2.2", - "resolved": "https://registry.npmjs.org/@tiptap/extension-horizontal-rule/-/extension-horizontal-rule-2.2.2.tgz", - "integrity": "sha512-5hun56M9elO6slOoDH03q2of06KB1rX8MLvfiKpfAvjbhmuQJav20fz2MQ2lCunek0D8mUIySwhfMvBrTcd90A==", + "version": "2.2.4", + "resolved": "https://registry.npmjs.org/@tiptap/extension-horizontal-rule/-/extension-horizontal-rule-2.2.4.tgz", + "integrity": "sha512-iCRHjFQQHApWg3R4fkKkJQhWEOdu1Fdc4YEAukdOXPSg3fg36IwjvsMXjt9SYBtVZ+iio3rORCZGXyMvgCH9uw==", "funding": { "type": "github", "url": "https://github.com/sponsors/ueberdosis" @@ -1562,9 +1589,9 @@ } }, "node_modules/@tiptap/extension-image": { - "version": "2.2.2", - "resolved": "https://registry.npmjs.org/@tiptap/extension-image/-/extension-image-2.2.2.tgz", - "integrity": "sha512-fqZ2VB3K/c/Mi/2QTfav6CmTe33yGRkeQEivllSCCxgDD+kNYGto/P9maHSIJSG3RZWZHYfIPHmUJKfUlJRTXQ==", + "version": "2.2.4", + "resolved": "https://registry.npmjs.org/@tiptap/extension-image/-/extension-image-2.2.4.tgz", + "integrity": "sha512-xOnqZpnP/fAfmK5AKmXplVQdXBtY5AoZ9B+qllH129aLABaDRzl3e14ZRHC8ahQawOmCe6AOCCXYUBXDOlY5Jg==", "funding": { "type": "github", "url": "https://github.com/sponsors/ueberdosis" @@ -1574,9 +1601,9 @@ } }, "node_modules/@tiptap/extension-italic": { - "version": "2.2.2", - "resolved": "https://registry.npmjs.org/@tiptap/extension-italic/-/extension-italic-2.2.2.tgz", - "integrity": "sha512-l9NZK4vYqYY9Y5UskLQpdbvi0sXG4I/MuhRxPdjitK8E3SVhZxMnoNwCTkq0+I1xBjCD/jSrDMV4FqkKesrl2w==", + "version": "2.2.4", + "resolved": "https://registry.npmjs.org/@tiptap/extension-italic/-/extension-italic-2.2.4.tgz", + "integrity": "sha512-qIhGNvWnsQswSgEMRA8jQQjxfkOGNAuNWKEVQX9DPoqAUgknT41hQcAMP8L2+OdACpb2jbVMOO5Cy5Dof2L8/w==", "funding": { "type": "github", "url": "https://github.com/sponsors/ueberdosis" @@ -1586,9 +1613,9 @@ } }, "node_modules/@tiptap/extension-list-item": { - "version": "2.2.2", - "resolved": "https://registry.npmjs.org/@tiptap/extension-list-item/-/extension-list-item-2.2.2.tgz", - "integrity": "sha512-VuHlbhLePXvKTx55X0iIZ1EXARAoOf6lpbKJK8180jny2gpYxGhk7rwG1G8s6G6ZDST+kyVa04gncxz8F/z6oA==", + "version": "2.2.4", + "resolved": "https://registry.npmjs.org/@tiptap/extension-list-item/-/extension-list-item-2.2.4.tgz", + "integrity": "sha512-lPLKGKsHpM9ClUa8n7GEUn8pG6HCYU0vFruIy3l2t6jZdHkrgBnYtVGMZ13K8UDnj/hlAlccxku0D0P4mA1Vrg==", "funding": { "type": "github", "url": "https://github.com/sponsors/ueberdosis" @@ -1598,9 +1625,9 @@ } }, "node_modules/@tiptap/extension-mention": { - "version": "2.2.2", - "resolved": "https://registry.npmjs.org/@tiptap/extension-mention/-/extension-mention-2.2.2.tgz", - "integrity": "sha512-REmjd01kyoZryORdFbkdo+8E4ZHq1sPK6fePXo0+5LYEFnVGs9k2EvpENkZ94pzVZgV6V1K6s8oEQAxSy45oOQ==", + "version": "2.2.4", + "resolved": "https://registry.npmjs.org/@tiptap/extension-mention/-/extension-mention-2.2.4.tgz", + "integrity": "sha512-myUlwpbrQgWfRJwG4UHM2PbiSp+squJv6LPKfKINs5yDxIproaZ0/4TAJt3heeSXZJnboPAQxSP7eLd5pY8lBw==", "funding": { "type": "github", "url": "https://github.com/sponsors/ueberdosis" @@ -1612,9 +1639,9 @@ } }, "node_modules/@tiptap/extension-ordered-list": { - "version": "2.2.2", - "resolved": "https://registry.npmjs.org/@tiptap/extension-ordered-list/-/extension-ordered-list-2.2.2.tgz", - "integrity": "sha512-TgG+mJyQB5CfeqCD65B9CLesl2IQTjc7tAKm8ZxRzF80GrCrmWNnoXi424TWmSF6cUV/4TY0G5dTkc9kB+S2tw==", + "version": "2.2.4", + "resolved": "https://registry.npmjs.org/@tiptap/extension-ordered-list/-/extension-ordered-list-2.2.4.tgz", + "integrity": "sha512-TpFy140O9Af1JciXt+xwqYUXxcJ6YG8zi/B5UDJujp+FH5sCmlYYBBnWxiFMhVaj6yEmA2eafu1qUkic/1X5Aw==", "funding": { "type": "github", "url": "https://github.com/sponsors/ueberdosis" @@ -1624,9 +1651,9 @@ } }, "node_modules/@tiptap/extension-paragraph": { - "version": "2.2.2", - "resolved": "https://registry.npmjs.org/@tiptap/extension-paragraph/-/extension-paragraph-2.2.2.tgz", - "integrity": "sha512-USTzajni/hsQXsBF0Lbw++FyPJKCDlROyaKbZi77QQoUsU2MbJIka7k4tGc0kwyTB04aAl+E6+0iS4xIhC3rug==", + "version": "2.2.4", + "resolved": "https://registry.npmjs.org/@tiptap/extension-paragraph/-/extension-paragraph-2.2.4.tgz", + "integrity": "sha512-m1KwyvTNJxsq7StbspbcOhxO4Wk4YpElDbqOouWi+H4c8azdpI5Pn96ZqhFeE9bSyjByg6OcB/wqoJsLbeFWdQ==", "funding": { "type": "github", "url": "https://github.com/sponsors/ueberdosis" @@ -1636,9 +1663,9 @@ } }, "node_modules/@tiptap/extension-placeholder": { - "version": "2.2.2", - "resolved": "https://registry.npmjs.org/@tiptap/extension-placeholder/-/extension-placeholder-2.2.2.tgz", - "integrity": "sha512-dPN15nVu+HlONJSCiKjEl9n5/61CltTLSefhyRVQJeE7lmtMUGrsErUdOYMxGskehDQWIQW1VM0OiF63ln/3sA==", + "version": "2.2.4", + "resolved": "https://registry.npmjs.org/@tiptap/extension-placeholder/-/extension-placeholder-2.2.4.tgz", + "integrity": "sha512-UL4Fn9T33SoS7vdI3NnSxBJVeGUIgCIutgXZZ5J8CkcRoDIeS78z492z+6J+qGctHwTd0xUL5NzNJI82HfiTdg==", "funding": { "type": "github", "url": "https://github.com/sponsors/ueberdosis" @@ -1649,9 +1676,9 @@ } }, "node_modules/@tiptap/extension-strike": { - "version": "2.2.2", - "resolved": "https://registry.npmjs.org/@tiptap/extension-strike/-/extension-strike-2.2.2.tgz", - "integrity": "sha512-0wsqiZPatw9QrK3DJ1jCMukenc8DRQtEXo4/dQjtnzNDhe7ZySed6kPpGO9A4lASG7NV7GmYZ/k5iEELr+iE6Q==", + "version": "2.2.4", + "resolved": "https://registry.npmjs.org/@tiptap/extension-strike/-/extension-strike-2.2.4.tgz", + "integrity": "sha512-/a2EwQgA+PpG17V2tVRspcrIY0SN3blwcgM7lxdW4aucGkqSKnf7+91dkhQEwCZ//o8kv9mBCyRoCUcGy6S5Xg==", "funding": { "type": "github", "url": "https://github.com/sponsors/ueberdosis" @@ -1661,9 +1688,9 @@ } }, "node_modules/@tiptap/extension-text": { - "version": "2.2.2", - "resolved": "https://registry.npmjs.org/@tiptap/extension-text/-/extension-text-2.2.2.tgz", - "integrity": "sha512-Zj53Vp/9MSQj5uiaObFaD3y7grUpMy+PfHmrK5XAZSFhRx+QpGUp+oItlKod6IJEIu8rq4dChgE7i6kT9uwWlA==", + "version": "2.2.4", + "resolved": "https://registry.npmjs.org/@tiptap/extension-text/-/extension-text-2.2.4.tgz", + "integrity": "sha512-NlKHMPnRJXB+0AGtDlU0P2Pg+SdesA2lMMd7JzDUgJgL7pX2jOb8eUqSeOjFKuSzFSqYfH6C3o6mQiNhuQMv+g==", "funding": { "type": "github", "url": "https://github.com/sponsors/ueberdosis" @@ -1673,9 +1700,9 @@ } }, "node_modules/@tiptap/pm": { - "version": "2.2.2", - "resolved": "https://registry.npmjs.org/@tiptap/pm/-/pm-2.2.2.tgz", - "integrity": "sha512-TcUxqevVcqLYOcbAGlmvZfOB5LL5zZmb6jxSHyevl41SRpGZLe9Jt0e1v98jS0o9GMS7nvcTK/scYQu9e0HqTA==", + "version": "2.2.4", + "resolved": "https://registry.npmjs.org/@tiptap/pm/-/pm-2.2.4.tgz", + "integrity": "sha512-Po0klR165zgtinhVp1nwMubjyKx6gAY9kH3IzcniYLCkqhPgiqnAcCr61TBpp4hfK8YURBS4ihvCB1dyfCyY8A==", "dependencies": { "prosemirror-changeset": "^2.2.1", "prosemirror-collab": "^1.3.1", @@ -1702,12 +1729,12 @@ } }, "node_modules/@tiptap/react": { - "version": "2.2.2", - "resolved": "https://registry.npmjs.org/@tiptap/react/-/react-2.2.2.tgz", - "integrity": "sha512-9jRaY7Clrtb23itFyTGgLEo5SO0shR/kxlFN3G6Wyda6S6SduY9ERX93ffRdvzbJKcbEptcko0KqUZ/MD0eDnA==", + "version": "2.2.4", + "resolved": "https://registry.npmjs.org/@tiptap/react/-/react-2.2.4.tgz", + "integrity": "sha512-HkYmMZWcETPZn3KpzdDg/ns2TKeFh54TvtCEInA4ljYtWGLoZc/A+KaiEtMIgVs+Mo1XwrhuoNGjL9c0OK2HJw==", "dependencies": { - "@tiptap/extension-bubble-menu": "^2.2.2", - "@tiptap/extension-floating-menu": "^2.2.2" + "@tiptap/extension-bubble-menu": "^2.2.4", + "@tiptap/extension-floating-menu": "^2.2.4" }, "funding": { "type": "github", @@ -1721,29 +1748,29 @@ } }, "node_modules/@tiptap/starter-kit": { - "version": "2.2.2", - "resolved": "https://registry.npmjs.org/@tiptap/starter-kit/-/starter-kit-2.2.2.tgz", - "integrity": "sha512-J8nbrVBggGJwO7CPEwdUqG6Q8btiQJjjnYWZEs+ImM9GMUfXJ8lyaGT0My3wDvTeq537N9BjTEcQ88pMtOqbOw==", + "version": "2.2.4", + "resolved": "https://registry.npmjs.org/@tiptap/starter-kit/-/starter-kit-2.2.4.tgz", + "integrity": "sha512-Kbk7qUfIZg3+bNa3e/wBeDQt4jJB46uQgM+xy5NSY6H8NZP6gdmmap3aIrn9S/W/hGpxJl4RcXAeaT0CQji9XA==", "dependencies": { - "@tiptap/core": "^2.2.2", - "@tiptap/extension-blockquote": "^2.2.2", - "@tiptap/extension-bold": "^2.2.2", - "@tiptap/extension-bullet-list": "^2.2.2", - "@tiptap/extension-code": "^2.2.2", - "@tiptap/extension-code-block": "^2.2.2", - "@tiptap/extension-document": "^2.2.2", - "@tiptap/extension-dropcursor": "^2.2.2", - "@tiptap/extension-gapcursor": "^2.2.2", - "@tiptap/extension-hard-break": "^2.2.2", - "@tiptap/extension-heading": "^2.2.2", - "@tiptap/extension-history": "^2.2.2", - "@tiptap/extension-horizontal-rule": "^2.2.2", - "@tiptap/extension-italic": "^2.2.2", - "@tiptap/extension-list-item": "^2.2.2", - "@tiptap/extension-ordered-list": "^2.2.2", - "@tiptap/extension-paragraph": "^2.2.2", - "@tiptap/extension-strike": "^2.2.2", - "@tiptap/extension-text": "^2.2.2" + "@tiptap/core": "^2.2.4", + "@tiptap/extension-blockquote": "^2.2.4", + "@tiptap/extension-bold": "^2.2.4", + "@tiptap/extension-bullet-list": "^2.2.4", + "@tiptap/extension-code": "^2.2.4", + "@tiptap/extension-code-block": "^2.2.4", + "@tiptap/extension-document": "^2.2.4", + "@tiptap/extension-dropcursor": "^2.2.4", + "@tiptap/extension-gapcursor": "^2.2.4", + "@tiptap/extension-hard-break": "^2.2.4", + "@tiptap/extension-heading": "^2.2.4", + "@tiptap/extension-history": "^2.2.4", + "@tiptap/extension-horizontal-rule": "^2.2.4", + "@tiptap/extension-italic": "^2.2.4", + "@tiptap/extension-list-item": "^2.2.4", + "@tiptap/extension-ordered-list": "^2.2.4", + "@tiptap/extension-paragraph": "^2.2.4", + "@tiptap/extension-strike": "^2.2.4", + "@tiptap/extension-text": "^2.2.4" }, "funding": { "type": "github", @@ -1751,9 +1778,9 @@ } }, "node_modules/@tiptap/suggestion": { - "version": "2.2.2", - "resolved": "https://registry.npmjs.org/@tiptap/suggestion/-/suggestion-2.2.2.tgz", - "integrity": "sha512-3Po78jqoWwYCYP9gMqO7bV5oV63cL1Y6KS1RzTVhBUTdpRoLc2rHCDPqbL9EqKBwyHeTrp37fjUz9T54/LBNpA==", + "version": "2.2.4", + "resolved": "https://registry.npmjs.org/@tiptap/suggestion/-/suggestion-2.2.4.tgz", + "integrity": "sha512-g6HHsKM6K3asW+ZlwMYyLCRqCRaswoliZOQofY4iZt5ru5HNTSzm3YW4XSyW5RGXJIuc319yyrOFgtJ3Fyu5rQ==", "funding": { "type": "github", "url": "https://github.com/sponsors/ueberdosis" @@ -1777,9 +1804,9 @@ "integrity": "sha512-/kYRxGDLWzHOB7q+wtSUQlFrtcdUccpfy+X+9iMBpHK8QLLhx2wIPYuS5DYtR9Wa/YlZAbIovy7qVdB1Aq6Lyw==" }, "node_modules/@types/estree-jsx": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/@types/estree-jsx/-/estree-jsx-1.0.4.tgz", - "integrity": "sha512-5idy3hvI9lAMqsyilBM+N+boaCf1MgoefbDxN6KEO5aK17TOHwFAYT9sjxzeKAiIWRUBgLxmZ9mPcnzZXtTcRQ==", + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/@types/estree-jsx/-/estree-jsx-1.0.5.tgz", + "integrity": "sha512-52CcUVNFyfb1A2ALocQw/Dd1BQFNmSdkuC3BkZ6iqhdMfQz7JWOFRuJFloOzjk+6WijU56m9oKXFAXc7o3Towg==", "dependencies": { "@types/estree": "*" } @@ -1826,9 +1853,9 @@ "integrity": "sha512-nG96G3Wp6acyAgJqGasjODb+acrI7KltPiRxzHPXnP3NgI28bpQDRv53olbqGXbfcgF5aiiHmO3xpwEpS5Ld9g==" }, "node_modules/@types/node": { - "version": "20.11.17", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.17.tgz", - "integrity": "sha512-QmgQZGWu1Yw9TDyAP9ZzpFJKynYNeOvwMJmaxABfieQoVoiVOS6MN1WSpqpRcbeA5+RW82kraAVxCCJg+780Qw==", + "version": "20.12.2", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.12.2.tgz", + "integrity": "sha512-zQ0NYO87hyN6Xrclcqp7f8ZbXNbRfoGWNcMvHTPQp9UUrwI0mI7XBz+cu7/W6/VClYo2g63B0cjull/srU7LgQ==", "dev": true, "dependencies": { "undici-types": "~5.26.4" @@ -1844,35 +1871,24 @@ "form-data": "^4.0.0" } }, - "node_modules/@types/object.omit": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/@types/object.omit/-/object.omit-3.0.3.tgz", - "integrity": "sha512-xrq4bQTBGYY2cw+gV4PzoG2Lv3L0pjZ1uXStRRDQoATOYW1lCsFQHhQ+OkPhIcQoqLjAq7gYif7D14Qaa6Zbew==" - }, - "node_modules/@types/object.pick": { - "version": "1.3.4", - "resolved": "https://registry.npmjs.org/@types/object.pick/-/object.pick-1.3.4.tgz", - "integrity": "sha512-5PjwB0uP2XDp3nt5u5NJAG2DORHIRClPzWT/TTZhJ2Ekwe8M5bA9tvPdi9NO/n2uvu2/ictat8kgqvLfcIE1SA==" - }, "node_modules/@types/prop-types": { - "version": "15.7.11", - "resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.11.tgz", - "integrity": "sha512-ga8y9v9uyeiLdpKddhxYQkxNDrfvuPrlFb0N1qnZZByvcElJaXthF1UhvCh9TLWJBEHeNtdnbysW7Y6Uq8CVng==" + "version": "15.7.12", + "resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.12.tgz", + "integrity": "sha512-5zvhXYtRNRluoE/jAp4GVsSduVUzNWKkOZrCDBWYtE7biZywwdC2AcEzg+cSMLFRfVgeAFqpfNabiPjxFddV1Q==" }, "node_modules/@types/react": { - "version": "18.2.55", - "resolved": "https://registry.npmjs.org/@types/react/-/react-18.2.55.tgz", - "integrity": "sha512-Y2Tz5P4yz23brwm2d7jNon39qoAtMMmalOQv6+fEFt1mT+FcM3D841wDpoUvFXhaYenuROCy3FZYqdTjM7qVyA==", + "version": "18.2.74", + "resolved": "https://registry.npmjs.org/@types/react/-/react-18.2.74.tgz", + "integrity": "sha512-9AEqNZZyBx8OdZpxzQlaFEVCSFUM2YXJH46yPOiOpm078k6ZLOCcuAzGum/zK8YBwY+dbahVNbHrbgrAwIRlqw==", "dependencies": { "@types/prop-types": "*", - "@types/scheduler": "*", "csstype": "^3.0.2" } }, "node_modules/@types/react-dom": { - "version": "18.2.19", - "resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-18.2.19.tgz", - "integrity": "sha512-aZvQL6uUbIJpjZk4U8JZGbau9KDeAwMfmhyWorxgBkqDIEf6ROjRozcmPIicqsUwPUjbkDfHKgGee1Lq65APcA==", + "version": "18.2.23", + "resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-18.2.23.tgz", + "integrity": "sha512-ZQ71wgGOTmDYpnav2knkjr3qXdAFu0vsk8Ci5w3pGAIdj7/kKAyn+VsQDhXsmzzzepAiI9leWMmubXz690AI/A==", "devOptional": true, "dependencies": { "@types/react": "*" @@ -1908,11 +1924,6 @@ "@types/react": "*" } }, - "node_modules/@types/scheduler": { - "version": "0.16.8", - "resolved": "https://registry.npmjs.org/@types/scheduler/-/scheduler-0.16.8.tgz", - "integrity": "sha512-WZLiwShhwLRmeV6zH+GkbOFT6Z6VklCItrDioxUnv+u4Ll+8vKeFySoFyK/0ctcRpOmwAicELfmys1sDc/Rw+A==" - }, "node_modules/@types/styled-components": { "version": "5.1.34", "resolved": "https://registry.npmjs.org/@types/styled-components/-/styled-components-5.1.34.tgz", @@ -1924,11 +1935,6 @@ "csstype": "^3.0.2" } }, - "node_modules/@types/throttle-debounce": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/@types/throttle-debounce/-/throttle-debounce-2.1.0.tgz", - "integrity": "sha512-5eQEtSCoESnh2FsiLTxE121IiE60hnMqcb435fShf4bpLRjEu1Eoekht23y6zXS9Ts3l+Szu3TARnTsA0GkOkQ==" - }, "node_modules/@types/unist": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/@types/unist/-/unist-3.0.2.tgz", @@ -1977,15 +1983,11 @@ } }, "node_modules/ansi-regex": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.0.1.tgz", - "integrity": "sha512-n5M855fKb2SsfMIiFFoVrABHJC8QtHwVx+mHWP3QcEqBHYienj5dHSgjbxtC0WEZXYt4wcD6zrQElDPhFuZgfA==", - "dev": true, + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/chalk/ansi-regex?sponsor=1" + "node": ">=8" } }, "node_modules/ansi-styles": { @@ -2044,9 +2046,9 @@ "dev": true }, "node_modules/autoprefixer": { - "version": "10.4.17", - "resolved": "https://registry.npmjs.org/autoprefixer/-/autoprefixer-10.4.17.tgz", - "integrity": "sha512-/cpVNRLSfhOtcGflT13P2794gVSgmPgTR+erw5ifnMLZb0UnSlkK4tquLmkd3BhA+nLo5tX8Cu0upUsGKvKbmg==", + "version": "10.4.19", + "resolved": "https://registry.npmjs.org/autoprefixer/-/autoprefixer-10.4.19.tgz", + "integrity": "sha512-BaENR2+zBZ8xXhM4pUaKUxlVdxZ0EZhjvbopwnXmxRUfqDmwSpC2lAi/QXvx7NRdPCo1WKEcEF6mV64si1z4Ew==", "dev": true, "funding": [ { @@ -2063,8 +2065,8 @@ } ], "dependencies": { - "browserslist": "^4.22.2", - "caniuse-lite": "^1.0.30001578", + "browserslist": "^4.23.0", + "caniuse-lite": "^1.0.30001599", "fraction.js": "^4.3.7", "normalize-range": "^0.1.2", "picocolors": "^1.0.0", @@ -2120,12 +2122,15 @@ } }, "node_modules/binary-extensions": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz", - "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==", + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.3.0.tgz", + "integrity": "sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw==", "dev": true, "engines": { "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/boolbase": { @@ -2203,9 +2208,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001587", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001587.tgz", - "integrity": "sha512-HMFNotUmLXn71BQxg8cijvqxnIAofforZOwGsxyXJ0qugTdspUF4sPSJ2vhgprHCB996tIDzEq1ubumPDV8ULA==", + "version": "1.0.30001605", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001605.tgz", + "integrity": "sha512-nXwGlFWo34uliI9z3n6Qc0wZaf7zaZWA1CPZ169La5mV3I/gem7bst0vr5XQH5TJXZIMfDeZyOrZnSlVzKxxHQ==", "funding": [ { "type": "opencollective", @@ -2221,17 +2226,6 @@ } ] }, - "node_modules/case-anything": { - "version": "2.1.13", - "resolved": "https://registry.npmjs.org/case-anything/-/case-anything-2.1.13.tgz", - "integrity": "sha512-zlOQ80VrQ2Ue+ymH5OuM/DlDq64mEm+B9UTdHULv5osUMD6HalNTblf2b1u/m6QecjsnOkBpqVZ+XPwIVsy7Ng==", - "engines": { - "node": ">=12.13" - }, - "funding": { - "url": "https://github.com/sponsors/mesqueeb" - } - }, "node_modules/ccount": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/ccount/-/ccount-2.0.1.tgz", @@ -2460,11 +2454,6 @@ "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.1.3.tgz", "integrity": "sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw==" }, - "node_modules/dash-get": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/dash-get/-/dash-get-1.0.2.tgz", - "integrity": "sha512-4FbVrHDwfOASx7uQVxeiCTo7ggSdYZbqs8lH+WU6ViypPlDbe9y6IP5VVUDQBv9DcnyaiPT5XT0UWHgJ64zLeQ==" - }, "node_modules/debug": { "version": "4.3.4", "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", @@ -2493,14 +2482,6 @@ "url": "https://github.com/sponsors/wooorm" } }, - "node_modules/deepmerge": { - "version": "4.3.1", - "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-4.3.1.tgz", - "integrity": "sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A==", - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/delayed-stream": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", @@ -2555,9 +2536,9 @@ "dev": true }, "node_modules/dompurify": { - "version": "3.0.8", - "resolved": "https://registry.npmjs.org/dompurify/-/dompurify-3.0.8.tgz", - "integrity": "sha512-b7uwreMYL2eZhrSCRC4ahLTeZcPZxSmYfmcQGXGkXiZSNW1X85v+SDM5KsWcpivIiUBH47Ji7NtyUdpLeF5JZQ==" + "version": "3.0.11", + "resolved": "https://registry.npmjs.org/dompurify/-/dompurify-3.0.11.tgz", + "integrity": "sha512-Fan4uMuyB26gFV3ovPoEoQbxRRPfTu3CvImyZnhGq5fsIEO+gEFLp45ISFt+kQBWsK5ulDdT0oV28jS1UrwQLg==" }, "node_modules/downshift": { "version": "7.6.2", @@ -2586,15 +2567,14 @@ "dev": true }, "node_modules/electron-to-chromium": { - "version": "1.4.669", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.669.tgz", - "integrity": "sha512-E2SmpffFPrZhBSgf8ibqanRS2mpuk3FIRDzLDwt7WFpfgJMKDHJs0hmacyP0PS1cWsq0dVkwIIzlscNaterkPg==" + "version": "1.4.723", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.723.tgz", + "integrity": "sha512-rxFVtrMGMFROr4qqU6n95rUi9IlfIm+lIAt+hOToy/9r6CDv0XiEcQdC3VP71y1pE5CFTzKV0RvxOGYCPWWHPw==" }, "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==", - "dev": true + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==" }, "node_modules/engine.io-client": { "version": "6.5.3", @@ -2865,16 +2845,16 @@ } }, "node_modules/glob": { - "version": "10.3.10", - "resolved": "https://registry.npmjs.org/glob/-/glob-10.3.10.tgz", - "integrity": "sha512-fa46+tv1Ak0UPK1TOy/pZrIybNNt4HCv7SDzwyfiOZkvZLEbjsZkJBPtDHVshZjbecAoAGSC20MjLDG/qr679g==", + "version": "10.3.12", + "resolved": "https://registry.npmjs.org/glob/-/glob-10.3.12.tgz", + "integrity": "sha512-TCNv8vJ+xz4QiqTpfOJA7HvYv+tNIRHKfUWw/q+v2jdgN4ebz+KY9tGx5J4rHP0o84mNP+ApH66HRX8us3Khqg==", "dev": true, "dependencies": { "foreground-child": "^3.1.0", - "jackspeak": "^2.3.5", + "jackspeak": "^2.3.6", "minimatch": "^9.0.1", - "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0", - "path-scurry": "^1.10.1" + "minipass": "^7.0.4", + "path-scurry": "^1.10.2" }, "bin": { "glob": "dist/esm/bin.mjs" @@ -2920,9 +2900,9 @@ } }, "node_modules/hasown": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.1.tgz", - "integrity": "sha512-1/th4MHjnwncwXsIW6QMzlvYL9kG5e/CpVvLRZe4XPa8TOUNbCELqmvhDmnkNsAjwaG4+I8gJJL0JBvTTLO9qA==", + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz", + "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==", "dev": true, "dependencies": { "function-bind": "^1.1.2" @@ -3450,9 +3430,9 @@ } }, "node_modules/inline-style-parser": { - "version": "0.2.2", - "resolved": "https://registry.npmjs.org/inline-style-parser/-/inline-style-parser-0.2.2.tgz", - "integrity": "sha512-EcKzdTHVe8wFVOGEYXiW9WmJXPjqi1T+234YpJr98RiFYKHV3cdy1+3mkTE+KHTHxFFLH51SfaGOoUdW+v7ViQ==" + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/inline-style-parser/-/inline-style-parser-0.2.3.tgz", + "integrity": "sha512-qlD8YNDqyTKTyuITrDOffsl6Tdhv+UC4hcdAVuQsK4IMQ99nSgd1MIA/Q+jQYoh9r3hVUXhYh7urSRmXPkW04g==" }, "node_modules/is-alphabetical": { "version": "2.0.1", @@ -3531,17 +3511,6 @@ "url": "https://github.com/sponsors/wooorm" } }, - "node_modules/is-extendable": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-1.0.1.tgz", - "integrity": "sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA==", - "dependencies": { - "is-plain-object": "^2.0.4" - }, - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/is-extglob": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", @@ -3600,31 +3569,12 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/is-plain-object": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz", - "integrity": "sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og==", - "dependencies": { - "isobject": "^3.0.1" - }, - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/isexe": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", "dev": true }, - "node_modules/isobject": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", - "integrity": "sha512-WhB9zCku7EGTj/HQQRz5aUQEUeoQZH2bWcltRErOpymJ4boYE6wL9Tbr23krRPSZ+C5zqNSrSw+Cc7sZZ4b7vg==", - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/jackspeak": { "version": "2.3.6", "resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-2.3.6.tgz", @@ -3697,9 +3647,9 @@ } }, "node_modules/katex": { - "version": "0.16.9", - "resolved": "https://registry.npmjs.org/katex/-/katex-0.16.9.tgz", - "integrity": "sha512-fsSYjWS0EEOwvy81j3vRA8TEAhQhKiqO+FQaKWp0m39qwOzHVBgAUBIXWj1pB+O2W3fIpNa6Y9KSKCVbfPhyAQ==", + "version": "0.16.10", + "resolved": "https://registry.npmjs.org/katex/-/katex-0.16.10.tgz", + "integrity": "sha512-ZiqaC04tp2O5utMsl2TEZTXxa6WSC4yo0fv5ML++D3QZv/vx2Mct0mTlRx3O+uUkjfuAgOkzsCmq5MiUEsDDdA==", "funding": [ "https://opencollective.com/katex", "https://github.com/sponsors/katex" @@ -3785,22 +3735,17 @@ "yallist": "^3.0.2" } }, - "node_modules/make-error": { - "version": "1.3.6", - "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", - "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==" - }, "node_modules/markdown-it": { - "version": "14.0.0", - "resolved": "https://registry.npmjs.org/markdown-it/-/markdown-it-14.0.0.tgz", - "integrity": "sha512-seFjF0FIcPt4P9U39Bq1JYblX0KZCjDLFFQPHpL5AzHpqPEKtosxmdq/LTVZnjfH7tjt9BxStm+wXcDBNuYmzw==", + "version": "14.1.0", + "resolved": "https://registry.npmjs.org/markdown-it/-/markdown-it-14.1.0.tgz", + "integrity": "sha512-a54IwgWPaeBCAAsv13YgmALOF1elABB08FxO9i+r4VFk5Vl4pKokRPeX8u5TCgSsPi6ec1otfLjdOpVcgbpshg==", "dependencies": { "argparse": "^2.0.1", "entities": "^4.4.0", "linkify-it": "^5.0.0", "mdurl": "^2.0.0", "punycode.js": "^2.3.1", - "uc.micro": "^2.0.0" + "uc.micro": "^2.1.0" }, "bin": { "markdown-it": "bin/markdown-it.mjs" @@ -3918,9 +3863,9 @@ } }, "node_modules/mdast-util-mdx-jsx": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/mdast-util-mdx-jsx/-/mdast-util-mdx-jsx-3.1.0.tgz", - "integrity": "sha512-A8AJHlR7/wPQ3+Jre1+1rq040fX9A4Q1jG8JxmSNp/PLPHg80A6475wxTp3KzHpApFH6yWxFotHrJQA3dXP6/w==", + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/mdast-util-mdx-jsx/-/mdast-util-mdx-jsx-3.1.2.tgz", + "integrity": "sha512-eKMQDeywY2wlHc97k5eD8VC+9ASMjN8ItEZQNGwJ6E0XWKiW/Z0V5/H8pvoXUf+y+Mj0VIgeRRbujBmFn4FTyA==", "dependencies": { "@types/estree-jsx": "^1.0.0", "@types/hast": "^3.0.0", @@ -4510,9 +4455,9 @@ } }, "node_modules/minimatch": { - "version": "9.0.3", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.3.tgz", - "integrity": "sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg==", + "version": "9.0.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.4.tgz", + "integrity": "sha512-KqWh+VchfxcMNRAJjj2tnsSJdNbHsVgnkBhTNrW7AjVo6OvLtxw8zfT9oLw1JSohlFzJ8jCoTgaoXvJ+kHt6fw==", "dev": true, "dependencies": { "brace-expansion": "^2.0.1" @@ -4539,9 +4484,9 @@ "integrity": "sha512-ihFnidEeU8iXzcVHy74dhkxh/dn8Dc08ERl0xwoMMGqp4+LvRSCgicb+zGqWthVokQKvCSxITlh3P08OzdTYCQ==" }, "node_modules/monaco-editor": { - "version": "0.46.0", - "resolved": "https://registry.npmjs.org/monaco-editor/-/monaco-editor-0.46.0.tgz", - "integrity": "sha512-ADwtLIIww+9FKybWscd7OCfm9odsFYHImBRI1v9AviGce55QY8raT+9ihH8jX/E/e6QVSGM+pKj4jSUSRmALNQ==", + "version": "0.47.0", + "resolved": "https://registry.npmjs.org/monaco-editor/-/monaco-editor-0.47.0.tgz", + "integrity": "sha512-VabVvHvQ9QmMwXu4du008ZDuyLnHs9j7ThVFsiJoXSOQk18+LF89N4ADzPbFenm0W4V2bGHnFBztIRQTgBfxzw==", "peer": true }, "node_modules/ms": { @@ -4634,28 +4579,6 @@ "node": ">= 6" } }, - "node_modules/object.omit": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/object.omit/-/object.omit-3.0.0.tgz", - "integrity": "sha512-EO+BCv6LJfu+gBIF3ggLicFebFLN5zqzz/WWJlMFfkMyGth+oBkhxzDl0wx2W4GkLzuQs/FsSkXZb2IMWQqmBQ==", - "dependencies": { - "is-extendable": "^1.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/object.pick": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/object.pick/-/object.pick-1.3.0.tgz", - "integrity": "sha512-tqa/UMy/CCoYmj+H5qc07qvSL9dqcs/WZENZ1JbtWBlATP+iVOe778gE6MSijnyCnORzDuX6hU+LA4SZ09YjFQ==", - "dependencies": { - "isobject": "^3.0.1" - }, - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/onigasm": { "version": "2.2.5", "resolved": "https://registry.npmjs.org/onigasm/-/onigasm-2.2.5.tgz", @@ -4720,12 +4643,12 @@ "dev": true }, "node_modules/path-scurry": { - "version": "1.10.1", - "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-1.10.1.tgz", - "integrity": "sha512-MkhCqzzBEpPvxxQ71Md0b1Kk51W01lrYvlMzSUaIzNsODdd7mqhiimSZlr+VegAz5Z6Vzt9Xg2ttE//XBhH3EQ==", + "version": "1.10.2", + "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-1.10.2.tgz", + "integrity": "sha512-7xTavNy5RQXnsjANvVvMkEjvloOinkAjv/Z6Ildz9v2RinZ4SBKTWFOVRbaF8p0vpHnyjV/UwNDdKuUv6M5qcA==", "dev": true, "dependencies": { - "lru-cache": "^9.1.1 || ^10.0.0", + "lru-cache": "^10.2.0", "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0" }, "engines": { @@ -4779,9 +4702,9 @@ } }, "node_modules/postcss": { - "version": "8.4.35", - "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.35.tgz", - "integrity": "sha512-u5U8qYpBCpN13BsiEB0CbR1Hhh4Gc0zLFuedrHJKMctHCHAGrMdG0PRM/KErzAL3CU6/eckEtmHNB3x6e3c0vA==", + "version": "8.4.38", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.38.tgz", + "integrity": "sha512-Wglpdk03BSfXkHoQa3b/oulrotAkwrlLDRSOb9D0bN86FdRyE9lppSp33aHNPgBa0JKCoB+drFLZkQoRRYae5A==", "dev": true, "funding": [ { @@ -4800,7 +4723,7 @@ "dependencies": { "nanoid": "^3.3.7", "picocolors": "^1.0.0", - "source-map-js": "^1.0.2" + "source-map-js": "^1.2.0" }, "engines": { "node": "^10 || ^12 || >=14" @@ -4878,9 +4801,9 @@ } }, "node_modules/postcss-load-config/node_modules/lilconfig": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/lilconfig/-/lilconfig-3.1.0.tgz", - "integrity": "sha512-p3cz0JV5vw/XeouBU3Ldnp+ZkBjE+n8ydJ4mcwBrOiXXPqNlrzGBqWs9X4MWF7f+iKUBu794Y8Hh8yawiJbCjw==", + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/lilconfig/-/lilconfig-3.1.1.tgz", + "integrity": "sha512-O18pf7nyvHTckunPWCV1XUNXU1piu01y2b7ATJ0ppkUkk8ocqVWBrYjJBCwHDjD/ZWcfyrA0P4gKhzWGi5EINQ==", "dev": true, "engines": { "node": ">=14" @@ -4909,9 +4832,9 @@ } }, "node_modules/postcss-selector-parser": { - "version": "6.0.15", - "resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-6.0.15.tgz", - "integrity": "sha512-rEYkQOMUCEMhsKbK66tbEU9QVIxbhN18YiniAwA7XQYTVBqrBy+P2p5JcdqsHgKM2zWylp8d7J6eszocfds5Sw==", + "version": "6.0.16", + "resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-6.0.16.tgz", + "integrity": "sha512-A0RVJrX+IUkVZbW3ClroRWurercFhieevHB38sr2+l9eUClMqome3LmEmnhlNy+5Mr2EYN6B2Kaw9wYdd+VHiw==", "dev": true, "dependencies": { "cssesc": "^3.0.0", @@ -4927,18 +4850,18 @@ "integrity": "sha512-1NNCs6uurfkVbeXG4S8JFT9t19m45ICnif8zWLd5oPSZ50QnwMfK+H3jv408d4jw/7Bttv5axS5IiHoLaVNHeQ==" }, "node_modules/posthog-js": { - "version": "1.105.9", - "resolved": "https://registry.npmjs.org/posthog-js/-/posthog-js-1.105.9.tgz", - "integrity": "sha512-i9DnfyXDktugF5E9x0ejihQ8Xdh1kdVnVh7GdL7+PvFtULGMoN/b4pDmWBCwmH+ciubmqTCImVuNrZYy8+eTbw==", + "version": "1.116.6", + "resolved": "https://registry.npmjs.org/posthog-js/-/posthog-js-1.116.6.tgz", + "integrity": "sha512-rvt8HxzJD4c2B/xsUa4jle8ApdqljeBI2Qqjp4XJMohQf18DXRyM6b96H5/UMs8jxYuZG14Er0h/kEIWeU6Fmw==", "dependencies": { "fflate": "^0.4.8", "preact": "^10.19.3" } }, "node_modules/preact": { - "version": "10.19.4", - "resolved": "https://registry.npmjs.org/preact/-/preact-10.19.4.tgz", - "integrity": "sha512-dwaX5jAh0Ga8uENBX1hSOujmKWgx9RtL80KaKUFLc6jb4vCEAc3EeZ0rnQO/FO4VgjfPMfoLFWnNG8bHuZ9VLw==", + "version": "10.20.1", + "resolved": "https://registry.npmjs.org/preact/-/preact-10.20.1.tgz", + "integrity": "sha512-JIFjgFg9B2qnOoGiYMVBtrcFxHqn+dNXbq76bVmcaHYJFYR4lW67AOcXgAYQQTDYXDOg/kTZrKPNCdRgJ2UJmw==", "funding": { "type": "opencollective", "url": "https://opencollective.com/preact" @@ -5024,9 +4947,9 @@ } }, "node_modules/prosemirror-history": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/prosemirror-history/-/prosemirror-history-1.3.2.tgz", - "integrity": "sha512-/zm0XoU/N/+u7i5zepjmZAEnpvjDtzoPWW6VmKptcAnPadN/SStsBjMImdCEbb3seiNTpveziPTIrXQbHLtU1g==", + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/prosemirror-history/-/prosemirror-history-1.4.0.tgz", + "integrity": "sha512-UUiGzDVcqo1lovOPdi9YxxUps3oBFWAIYkXLu3Ot+JPv1qzVogRbcizxK3LhHmtaUxclohgiOVesRw5QSlMnbQ==", "dependencies": { "prosemirror-state": "^1.2.2", "prosemirror-transform": "^1.0.0", @@ -5109,9 +5032,9 @@ } }, "node_modules/prosemirror-tables": { - "version": "1.3.5", - "resolved": "https://registry.npmjs.org/prosemirror-tables/-/prosemirror-tables-1.3.5.tgz", - "integrity": "sha512-JSZ2cCNlApu/ObAhdPyotrjBe2cimniniTpz60YXzbL0kZ+47nEYk2LWbfKU2lKpBkUNquta2PjteoNi4YCluQ==", + "version": "1.3.7", + "resolved": "https://registry.npmjs.org/prosemirror-tables/-/prosemirror-tables-1.3.7.tgz", + "integrity": "sha512-oEwX1wrziuxMtwFvdDWSFHVUWrFJWt929kVVfHvtTi8yvw+5ppxjXZkMG/fuTdFo+3DXyIPSKfid+Be1npKXDA==", "dependencies": { "prosemirror-keymap": "^1.1.2", "prosemirror-model": "^1.8.1", @@ -5121,12 +5044,11 @@ } }, "node_modules/prosemirror-trailing-node": { - "version": "2.0.7", - "resolved": "https://registry.npmjs.org/prosemirror-trailing-node/-/prosemirror-trailing-node-2.0.7.tgz", - "integrity": "sha512-8zcZORYj/8WEwsGo6yVCRXFMOfBo0Ub3hCUvmoWIZYfMP26WqENU0mpEP27w7mt8buZWuGrydBewr0tOArPb1Q==", + "version": "2.0.8", + "resolved": "https://registry.npmjs.org/prosemirror-trailing-node/-/prosemirror-trailing-node-2.0.8.tgz", + "integrity": "sha512-ujRYhSuhQb1Jsarh1IHqb2KoSnRiD7wAMDGucP35DN7j5af6X7B18PfdPIrbwsPTqIAj0fyOvxbuPsWhNvylmA==", "dependencies": { "@remirror/core-constants": "^2.0.2", - "@remirror/core-helpers": "^3.0.0", "escape-string-regexp": "^4.0.0" }, "peerDependencies": { @@ -5144,9 +5066,9 @@ } }, "node_modules/prosemirror-view": { - "version": "1.32.7", - "resolved": "https://registry.npmjs.org/prosemirror-view/-/prosemirror-view-1.32.7.tgz", - "integrity": "sha512-pvxiOoD4shW41X5bYDjRQk3DSG4fMqxh36yPMt7VYgU3dWRmqFzWJM/R6zeo1KtC8nyk717ZbQND3CC9VNeptw==", + "version": "1.33.3", + "resolved": "https://registry.npmjs.org/prosemirror-view/-/prosemirror-view-1.33.3.tgz", + "integrity": "sha512-P4Ao/bc4OrU/2yLIf8dL4lJaEtjLR3QjIvQHgJYp2jUS7kYM4bSR6okbBjkqzOs/FwUon6UGjTLdKMnPL1MZqw==", "dependencies": { "prosemirror-model": "^1.16.0", "prosemirror-state": "^1.0.0", @@ -5213,9 +5135,9 @@ } }, "node_modules/react-error-boundary": { - "version": "4.0.12", - "resolved": "https://registry.npmjs.org/react-error-boundary/-/react-error-boundary-4.0.12.tgz", - "integrity": "sha512-kJdxdEYlb7CPC1A0SeUY38cHpjuu6UkvzKiAmqmOFL21VRfMhOcWxTCBgLVCO0VEMh9JhFNcVaXlV4/BTpiwOA==", + "version": "4.0.13", + "resolved": "https://registry.npmjs.org/react-error-boundary/-/react-error-boundary-4.0.13.tgz", + "integrity": "sha512-b6PwbdSv8XeOSYvjt8LpgpKrZ0yGdtZokYwkwV2wlcZbxgopHX/hgPl5VgpnoVOWd868n1hktM8Qm4b+02MiLQ==", "dependencies": { "@babel/runtime": "^7.12.5" }, @@ -5224,9 +5146,9 @@ } }, "node_modules/react-hook-form": { - "version": "7.50.1", - "resolved": "https://registry.npmjs.org/react-hook-form/-/react-hook-form-7.50.1.tgz", - "integrity": "sha512-3PCY82oE0WgeOgUtIr3nYNNtNvqtJ7BZjsbxh6TnYNbXButaD5WpjOmTjdxZfheuHKR68qfeFnEDVYoSSFPMTQ==", + "version": "7.51.2", + "resolved": "https://registry.npmjs.org/react-hook-form/-/react-hook-form-7.51.2.tgz", + "integrity": "sha512-y++lwaWjtzDt/XNnyGDQy6goHskFualmDlf+jzEZvjvz6KWDf7EboL7pUvRCzPTJd0EOPpdekYaQLEvvG6m6HA==", "engines": { "node": ">=12.22.0" }, @@ -5645,11 +5567,11 @@ } }, "node_modules/react-router": { - "version": "6.22.0", - "resolved": "https://registry.npmjs.org/react-router/-/react-router-6.22.0.tgz", - "integrity": "sha512-q2yemJeg6gw/YixRlRnVx6IRJWZD6fonnfZhN1JIOhV2iJCPeRNSH3V1ISwHf+JWcESzLC3BOLD1T07tmO5dmg==", + "version": "6.22.3", + "resolved": "https://registry.npmjs.org/react-router/-/react-router-6.22.3.tgz", + "integrity": "sha512-dr2eb3Mj5zK2YISHK++foM9w4eBnO23eKnZEDs7c880P6oKbrjz/Svg9+nxqtHQK+oMW4OtjZca0RqPglXxguQ==", "dependencies": { - "@remix-run/router": "1.15.0" + "@remix-run/router": "1.15.3" }, "engines": { "node": ">=14.0.0" @@ -5659,12 +5581,12 @@ } }, "node_modules/react-router-dom": { - "version": "6.22.0", - "resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-6.22.0.tgz", - "integrity": "sha512-z2w+M4tH5wlcLmH3BMMOMdrtrJ9T3oJJNsAlBJbwk+8Syxd5WFJ7J5dxMEW0/GEXD1BBis4uXRrNIz3mORr0ag==", + "version": "6.22.3", + "resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-6.22.3.tgz", + "integrity": "sha512-7ZILI7HjcE+p31oQvwbokjk6OA/bnFxrhJ19n82Ex9Ph8fNAq+Hm/7KchpMGlTgWhUxRHMMCut+vEtNpWpowKw==", "dependencies": { - "@remix-run/router": "1.15.0", - "react-router": "6.22.0" + "@remix-run/router": "1.15.3", + "react-router": "6.22.3" }, "engines": { "node": ">=14.0.0" @@ -5702,9 +5624,9 @@ } }, "node_modules/react-tooltip": { - "version": "5.26.2", - "resolved": "https://registry.npmjs.org/react-tooltip/-/react-tooltip-5.26.2.tgz", - "integrity": "sha512-C1qHiqWYn6l5c98kL/NKFyJSw5G11vUVJkgOPcKgn306c5iL5317LxMNn5Qg1GSSM7Qvtsd6KA5MvwfgxFF7Dg==", + "version": "5.26.3", + "resolved": "https://registry.npmjs.org/react-tooltip/-/react-tooltip-5.26.3.tgz", + "integrity": "sha512-MpYAws8CEHUd/RC4GaDCdoceph/T4KHM5vS5Dbk8FOmLMvvIht2ymP2htWdrke7K6lqPO8rz8+bnwWUIXeDlzg==", "dependencies": { "@floating-ui/dom": "^1.6.1", "classnames": "^2.3.0" @@ -6242,9 +6164,9 @@ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" }, "node_modules/socket.io-client": { - "version": "4.7.4", - "resolved": "https://registry.npmjs.org/socket.io-client/-/socket.io-client-4.7.4.tgz", - "integrity": "sha512-wh+OkeF0rAVCrABWQBaEjLfb7DVPotMbu0cgWgyR0v6eA4EoVnAwcIeIbcdTE3GT/H3kbdLl7OoH2+asoDRIIg==", + "version": "4.7.5", + "resolved": "https://registry.npmjs.org/socket.io-client/-/socket.io-client-4.7.5.tgz", + "integrity": "sha512-sJ/tqHOCe7Z50JCBCXrsY3I2k03iOiUe+tj1OmKeD2lXPiGH/RUCdTZFoqVyN7l1MnpIzPrGtLcijffmeouNlQ==", "dependencies": { "@socket.io/component-emitter": "~3.1.0", "debug": "~4.3.2", @@ -6268,9 +6190,9 @@ } }, "node_modules/source-map-js": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.0.2.tgz", - "integrity": "sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw==", + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.0.tgz", + "integrity": "sha512-itJW8lvSA0TXEphiRoawsCksnlf8SyvmFzIhltqAHluXd88pkCd+cXJVHTDwdCr0IzwptSm035IHQktUu1QUMg==", "dev": true, "engines": { "node": ">=0.10.0" @@ -6291,20 +6213,16 @@ "integrity": "sha512-HTEHMNieakEnoe33shBYcZ7NX83ACUjCu8c40iOGEZsngj9zRnkqS9j1pqQPXwobB0ZcVTk27REb7COQ0UR59w==" }, "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==", - "dev": true, + "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": { - "eastasianwidth": "^0.2.0", - "emoji-regex": "^9.2.2", - "strip-ansi": "^7.0.1" + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" }, "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "node": ">=8" } }, "node_modules/string-width-cjs": { @@ -6322,33 +6240,6 @@ "node": ">=8" } }, - "node_modules/string-width-cjs/node_modules/ansi-regex": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", - "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/string-width-cjs/node_modules/emoji-regex": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", - "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", - "dev": true - }, - "node_modules/string-width-cjs/node_modules/strip-ansi": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", - "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", - "dev": true, - "dependencies": { - "ansi-regex": "^5.0.1" - }, - "engines": { - "node": ">=8" - } - }, "node_modules/stringify-entities": { "version": "4.0.3", "resolved": "https://registry.npmjs.org/stringify-entities/-/stringify-entities-4.0.3.tgz", @@ -6363,18 +6254,14 @@ } }, "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==", - "dev": true, + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", "dependencies": { - "ansi-regex": "^6.0.1" + "ansi-regex": "^5.0.1" }, "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/chalk/strip-ansi?sponsor=1" + "node": ">=8" } }, "node_modules/strip-ansi-cjs": { @@ -6390,21 +6277,12 @@ "node": ">=8" } }, - "node_modules/strip-ansi-cjs/node_modules/ansi-regex": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", - "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", - "dev": true, - "engines": { - "node": ">=8" - } - }, "node_modules/style-to-object": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/style-to-object/-/style-to-object-1.0.5.tgz", - "integrity": "sha512-rDRwHtoDD3UMMrmZ6BzOW0naTjMsVZLIjsGleSKS/0Oz+cgCfAPRspaqJuE8rDzpKha/nEvnM0IF4seEAZUTKQ==", + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/style-to-object/-/style-to-object-1.0.6.tgz", + "integrity": "sha512-khxq+Qm3xEyZfKd/y9L3oIWQimxuc4STrQKtQn8aSDRHb8mFgpukgX1hdzfrMEW6JCjyJ8p89x+IUMVnCBI1PA==", "dependencies": { - "inline-style-parser": "0.2.2" + "inline-style-parser": "0.2.3" } }, "node_modules/styled-components": { @@ -6491,9 +6369,9 @@ } }, "node_modules/table": { - "version": "6.8.1", - "resolved": "https://registry.npmjs.org/table/-/table-6.8.1.tgz", - "integrity": "sha512-Y4X9zqrCftUhMeH2EptSSERdVKt/nEdijTOacGD/97EKjhQ/Qs8RTlEGABSJNNN8lac9kheH+af7yAkEWlgneA==", + "version": "6.8.2", + "resolved": "https://registry.npmjs.org/table/-/table-6.8.2.tgz", + "integrity": "sha512-w2sfv80nrAh2VCbqR5AK27wswXhqcck2AhfnNW76beQXskGZ1V12GwS//yYVa3d3fcvAip2OUnbDAjW2k3v9fA==", "dependencies": { "ajv": "^8.0.1", "lodash.truncate": "^4.4.2", @@ -6505,47 +6383,10 @@ "node": ">=10.0.0" } }, - "node_modules/table/node_modules/ansi-regex": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", - "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", - "engines": { - "node": ">=8" - } - }, - "node_modules/table/node_modules/emoji-regex": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", - "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==" - }, - "node_modules/table/node_modules/string-width": { - "version": "4.2.3", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", - "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", - "dependencies": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/table/node_modules/strip-ansi": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", - "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", - "dependencies": { - "ansi-regex": "^5.0.1" - }, - "engines": { - "node": ">=8" - } - }, "node_modules/tailwindcss": { - "version": "3.4.1", - "resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-3.4.1.tgz", - "integrity": "sha512-qAYmXRfk3ENzuPBakNK0SRrUDipP8NQnEY6772uDhflcQz5EhRdD7JNZxyrFHVQNCwULPBn6FNPp9brpO7ctcA==", + "version": "3.4.3", + "resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-3.4.3.tgz", + "integrity": "sha512-U7sxQk/n397Bmx4JHbJx/iSOOv5G+II3f1kpLpY2QeUv5DcPdcTsYLlusZfq1NthHS1c1cZoyFmmkex1rzke0A==", "dev": true, "dependencies": { "@alloc/quick-lru": "^5.2.0", @@ -6556,7 +6397,7 @@ "fast-glob": "^3.3.0", "glob-parent": "^6.0.2", "is-glob": "^4.0.3", - "jiti": "^1.19.1", + "jiti": "^1.21.0", "lilconfig": "^2.1.0", "micromatch": "^4.0.5", "normalize-path": "^3.0.0", @@ -6600,14 +6441,6 @@ "node": ">=0.8" } }, - "node_modules/throttle-debounce": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/throttle-debounce/-/throttle-debounce-3.0.1.tgz", - "integrity": "sha512-dTEWWNu6JmeVXY0ZYoPuH5cRIwc0MeGbJwah9KUNYSJwommQpCzTySTpEe8Gs1J23aeWEuAobe4Ag7EHVt/LOg==", - "engines": { - "node": ">=10" - } - }, "node_modules/tippy.js": { "version": "6.3.7", "resolved": "https://registry.npmjs.org/tippy.js/-/tippy.js-6.3.7.tgz", @@ -6665,17 +6498,6 @@ "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz", "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==" }, - "node_modules/type-fest": { - "version": "2.19.0", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-2.19.0.tgz", - "integrity": "sha512-RAH822pAdBgcNMAfWnCBU3CFZcfZ/i1eZjwFU/dsLKumyuuP3niueg2UAukXYF0E2AAoc82ZSSf9J0WQBinzHA==", - "engines": { - "node": ">=12.20" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/typescript": { "version": "4.9.5", "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.5.tgz", @@ -6690,9 +6512,9 @@ } }, "node_modules/uc.micro": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/uc.micro/-/uc.micro-2.0.0.tgz", - "integrity": "sha512-DffL94LsNOccVn4hyfRe5rdKa273swqeA5DJpMOeFmEn1wCDc7nAbbB0gXlgBCL7TNzeTv6G7XVWzan7iJtfig==" + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/uc.micro/-/uc.micro-2.1.0.tgz", + "integrity": "sha512-ARDJmphmdvUk6Glw7y9DQ2bFkKBHwQHLi2lsaH6PPmz/Ka9sFOBsBluozhDltWmnv9u/cF6Rt87znRTPV+yp/A==" }, "node_modules/undici-types": { "version": "5.26.5", @@ -6937,9 +6759,9 @@ } }, "node_modules/vite": { - "version": "4.5.2", - "resolved": "https://registry.npmjs.org/vite/-/vite-4.5.2.tgz", - "integrity": "sha512-tBCZBNSBbHQkaGyhGCDUGqeo2ph8Fstyp6FMSvTtsXeZSPpSMGlviAOav2hxVTqFcx8Hj/twtWKsMJXNY0xI8w==", + "version": "4.5.3", + "resolved": "https://registry.npmjs.org/vite/-/vite-4.5.3.tgz", + "integrity": "sha512-kQL23kMeX92v3ph7IauVkXkikdDRsYMGTVl5KY2E9OY4ONLvkHf04MDTbnfo6NKxZiDLWzVpP5oTa8hQD8U3dg==", "dev": true, "dependencies": { "esbuild": "^0.18.10", @@ -7063,15 +6885,6 @@ "url": "https://github.com/chalk/wrap-ansi?sponsor=1" } }, - "node_modules/wrap-ansi-cjs/node_modules/ansi-regex": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", - "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", - "dev": true, - "engines": { - "node": ">=8" - } - }, "node_modules/wrap-ansi-cjs/node_modules/ansi-styles": { "version": "4.3.0", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", @@ -7105,36 +6918,16 @@ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", "dev": true }, - "node_modules/wrap-ansi-cjs/node_modules/emoji-regex": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", - "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", - "dev": true - }, - "node_modules/wrap-ansi-cjs/node_modules/string-width": { - "version": "4.2.3", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", - "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", - "dev": true, - "dependencies": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/wrap-ansi-cjs/node_modules/strip-ansi": { + "node_modules/wrap-ansi/node_modules/ansi-regex": { "version": "6.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", - "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.0.1.tgz", + "integrity": "sha512-n5M855fKb2SsfMIiFFoVrABHJC8QtHwVx+mHWP3QcEqBHYienj5dHSgjbxtC0WEZXYt4wcD6zrQElDPhFuZgfA==", "dev": true, - "dependencies": { - "ansi-regex": "^5.0.1" - }, "engines": { - "node": ">=8" + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-regex?sponsor=1" } }, "node_modules/wrap-ansi/node_modules/ansi-styles": { @@ -7149,6 +6942,44 @@ "url": "https://github.com/chalk/ansi-styles?sponsor=1" } }, + "node_modules/wrap-ansi/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==", + "dev": true + }, + "node_modules/wrap-ansi/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==", + "dev": true, + "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/wrap-ansi/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==", + "dev": true, + "dependencies": { + "ansi-regex": "^6.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/strip-ansi?sponsor=1" + } + }, "node_modules/ws": { "version": "8.11.0", "resolved": "https://registry.npmjs.org/ws/-/ws-8.11.0.tgz", @@ -7191,10 +7022,13 @@ "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==" }, "node_modules/yaml": { - "version": "2.3.4", - "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.3.4.tgz", - "integrity": "sha512-8aAvwVUSHpfEqTQ4w/KMlf3HcRdt50E5ODIQJBw1fQ5RL34xabzxtUlzTXVqc4rkZsPbvrXKWnABCD7kWSmocA==", + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.4.1.tgz", + "integrity": "sha512-pIXzoImaqmfOrL7teGUBt/T7ZDnyeGBWyXQBvOVhLkWLN37GXv8NMLK406UY6dS51JfcQHsmcW5cJ441bHg6Lg==", "dev": true, + "bin": { + "yaml": "bin.mjs" + }, "engines": { "node": ">= 14" } diff --git a/gui/public/jetbrains_editorInset_index.html b/gui/public/jetbrains_editorInset_index.html new file mode 100644 index 000000000..1573f0bcd --- /dev/null +++ b/gui/public/jetbrains_editorInset_index.html @@ -0,0 +1,26 @@ + + + + + + + + Continue + + +
+ + + + + + + diff --git a/gui/public/logos/groq.png b/gui/public/logos/groq.png new file mode 100644 index 000000000..7cefaad26 Binary files /dev/null and b/gui/public/logos/groq.png differ diff --git a/gui/src/App.tsx b/gui/src/App.tsx index 797d51fe8..50ae708a1 100644 --- a/gui/src/App.tsx +++ b/gui/src/App.tsx @@ -4,7 +4,6 @@ import { RouterProvider, createMemoryRouter } from "react-router-dom"; import Layout from "./components/Layout"; import useSetup from "./hooks/useSetup"; import ErrorPage from "./pages/error"; -import GUI from "./pages/gui"; import { default as Help, default as HelpPage } from "./pages/help"; import History from "./pages/history"; import MigrationPage from "./pages/migration"; @@ -16,6 +15,9 @@ import SettingsPage from "./pages/settings"; import { ContextSubmenuItem } from "core"; import useSubmenuContextProviders from "./hooks/useSubmenuContextProviders"; import { useVscTheme } from "./hooks/useVscTheme"; +import GUI from "./pages/gui"; +import ExistingUserOnboarding from "./pages/onboarding/existingUserOnboarding"; +import Onboarding from "./pages/onboarding/onboarding"; import Stats from "./pages/stats"; const router = createMemoryRouter([ @@ -64,6 +66,14 @@ const router = createMemoryRouter([ path: "/monaco", element: , }, + { + path: "/onboarding", + element: , + }, + { + path: "/existingUserOnboarding", + element: , + }, { path: "/migration", element: , diff --git a/gui/src/components/HeaderButtonWithText.tsx b/gui/src/components/HeaderButtonWithText.tsx index bc97c287a..b1b4f5241 100644 --- a/gui/src/components/HeaderButtonWithText.tsx +++ b/gui/src/components/HeaderButtonWithText.tsx @@ -1,6 +1,8 @@ import React, { useState } from "react"; -import { HeaderButton, StyledTooltip } from "."; import ReactDOM from "react-dom"; +import { HeaderButton, StyledTooltip } from "."; + +import { v4 as uuidv4 } from "uuid"; interface HeaderButtonWithTextProps { text: string; @@ -20,13 +22,14 @@ const HeaderButtonWithText = React.forwardRef< HeaderButtonWithTextProps >((props: HeaderButtonWithTextProps, ref) => { const [hover, setHover] = useState(false); + const id = uuidv4(); const tooltipPortalDiv = document.getElementById("tooltip-portal-div"); return ( <> { @@ -48,10 +51,10 @@ const HeaderButtonWithText = React.forwardRef< {tooltipPortalDiv && ReactDOM.createPortal( - + {props.text} , - tooltipPortalDiv + tooltipPortalDiv, )} ); diff --git a/gui/src/components/Layout.tsx b/gui/src/components/Layout.tsx index 7e136df48..675f893e7 100644 --- a/gui/src/components/Layout.tsx +++ b/gui/src/components/Layout.tsx @@ -21,7 +21,8 @@ import { } from "../redux/slices/uiStateSlice"; import { RootState } from "../redux/store"; import { getFontSize, isMetaEquivalentKeyPressed } from "../util"; -import { postToIde } from "../util/ide"; +import { isJetBrains, postToIde } from "../util/ide"; +import { getLocalStorage } from "../util/localStorage"; import HeaderButtonWithText from "./HeaderButtonWithText"; import TextDialog from "./dialogs"; import IndexingProgressBar from "./loaders/IndexingProgressBar"; @@ -177,6 +178,21 @@ const Layout = () => { setIndexingTask(data.desc); }); + useEffect(() => { + const onboardingComplete = getLocalStorage("onboardingComplete"); + if ( + !onboardingComplete && + !location.pathname.startsWith("/onboarding") && + !location.pathname.startsWith("/existingUserOnboarding") + ) { + if (getLocalStorage("mainTextEntryCounter")) { + navigate("/existingUserOnboarding"); + } else { + navigate("/onboarding"); + } + } + }, [location]); + const [indexingProgress, setIndexingProgress] = useState(1); const [indexingTask, setIndexingTask] = useState("Indexing Codebase"); @@ -245,7 +261,7 @@ const Layout = () => { /> )} - {indexingProgress < 1 && ( + {isJetBrains() || ( { // navigate("/settings"); postToIde("openConfigJson", undefined); }} - text="Config" + text="Configure Continue" > diff --git a/gui/src/components/dialogs/KeyboardShortcuts.tsx b/gui/src/components/dialogs/KeyboardShortcuts.tsx index d4a55d030..28dac7fee 100644 --- a/gui/src/components/dialogs/KeyboardShortcuts.tsx +++ b/gui/src/components/dialogs/KeyboardShortcuts.tsx @@ -40,6 +40,7 @@ const keyToName = { "⏎": "Enter", "⌫": "Backspace", "⌥": "Option", + "⎇": "Alt", }; function KeyDiv({ text }: { text: string }) { @@ -113,9 +114,19 @@ const vscodeShortcuts: KeyboardShortcutProps[] = [ windows: "⌃ ⇧ ⌫", description: "Reject Diff", }, + { + mac: "⌥ ⌘ Y", + windows: "⎇ ⌃ Y", + description: "Accept Top Change in Diff", + }, + { + mac: "⌥ ⌘ N", + windows: "⎇ ⌃ N", + description: "Reject Top Change in Diff", + }, { mac: "⌥ ⌘ L", - windows: "⌥ ⌃ L", + windows: "⎇ ⌃ L", description: "Toggle Auxiliary Bar", }, { @@ -151,6 +162,16 @@ const jetbrainsShortcuts: KeyboardShortcutProps[] = [ windows: "⌃ ⇧ J", description: "Select Code", }, + { + mac: "⌘ I", + windows: "⌃ I", + description: "Edit highlighted code", + }, + { + mac: "⌘ ⇧ I", + windows: "⌃ ⇧ I", + description: "Toggle inline edit focus", + }, { mac: "⌘ ⇧ ⏎", windows: "⌃ ⇧ ⏎", @@ -163,12 +184,12 @@ const jetbrainsShortcuts: KeyboardShortcutProps[] = [ }, { mac: "⌥ ⇧ J", - windows: "⌥ ⇧ J", + windows: "⎇ ⇧ J", description: "Quick Input", }, { mac: "⌥ ⌘ J", - windows: "⌥ ⌃ J", + windows: "⎇ ⌃ J", description: "Toggle Sidebar", }, { diff --git a/gui/src/components/gui/StepContainer.tsx b/gui/src/components/gui/StepContainer.tsx index f8158fa9a..10b92330c 100644 --- a/gui/src/components/gui/StepContainer.tsx +++ b/gui/src/components/gui/StepContainer.tsx @@ -1,10 +1,12 @@ import { + ArrowUturnLeftIcon, + BarsArrowDownIcon, HandThumbDownIcon, HandThumbUpIcon, } from "@heroicons/react/24/outline"; import { ChatHistoryItem } from "core"; import { stripImages } from "core/llm/countTokens"; -import { useState } from "react"; +import { useEffect, useState } from "react"; import { useSelector } from "react-redux"; import styled from "styled-components"; import { @@ -17,6 +19,7 @@ import { RootState } from "../../redux/store"; import { getFontSize } from "../../util"; import { postToIde } from "../../util/ide"; import HeaderButtonWithText from "../HeaderButtonWithText"; +import { CopyButton } from "../markdown/CopyButton"; import StyledMarkdownPreview from "../markdown/StyledMarkdownPreview"; interface StepContainerProps { @@ -24,6 +27,7 @@ interface StepContainerProps { onReverse: () => void; onUserInput: (input: string) => void; onRetry: () => void; + onContinueGeneration: () => void; onDelete: () => void; open: boolean; isFirst: boolean; @@ -78,6 +82,27 @@ function StepContainer(props: StepContainerProps) { } }; + const [truncatedEarly, setTruncatedEarly] = useState(false); + + useEffect(() => { + if (!active) { + const content = stripImages(props.item.message.content).trim(); + const endingPunctuation = [".", "?", "!", "```"]; + + // If not ending in punctuation or emoji, we assume the response got truncated + if ( + !( + endingPunctuation.some((p) => content.endsWith(p)) || + /\p{Emoji}/u.test(content.slice(-2)) + ) + ) { + setTruncatedEarly(true); + } else { + setTruncatedEarly(false); + } + } + }, [props.item.message.content, active]); + return (
{ @@ -98,11 +123,43 @@ function StepContainer(props: StepContainerProps) { showCodeBorder={true} /> +
{(isHovered || typeof feedback !== "undefined") && !active && (
+ {truncatedEarly && ( + { + props.onContinueGeneration(); + }} + > + + + )} + + + { + props.onRetry(); + }} + > + + {feedback === false || ( ` + background-color: ${(props) => props.color}; + box-shadow: 0px 0px 2px 1px ${(props) => props.color}; width: ${DIAMETER}px; height: ${DIAMETER}px; border-radius: ${DIAMETER / 2}px; @@ -72,10 +72,27 @@ const IndexingProgressBar = ({ return (
setExpanded((prev) => !prev)} + onClick={() => { + if (completed < total) { + setExpanded((prev) => !prev); + } else { + postToIde("index/forceReIndex", undefined); + } + }} className="cursor-pointer" > - {expanded ? ( + {completed >= total ? ( + <> + + {tooltipPortalDiv && + ReactDOM.createPortal( + + Index up to date. Click to force re-indexing + , + tooltipPortalDiv, + )} + + ) : expanded ? ( <> {currentlyIndexing} , - tooltipPortalDiv + tooltipPortalDiv, )} ) : ( <> - + {tooltipPortalDiv && ReactDOM.createPortal( Click to unpause indexing ( {Math.trunc((completed / total) * 100)}%) , - tooltipPortalDiv + tooltipPortalDiv, )} )} diff --git a/gui/src/components/mainInput/ContinueInputBox.tsx b/gui/src/components/mainInput/ContinueInputBox.tsx index 582091ceb..391f37a4c 100644 --- a/gui/src/components/mainInput/ContinueInputBox.tsx +++ b/gui/src/components/mainInput/ContinueInputBox.tsx @@ -1,5 +1,5 @@ import { JSONContent } from "@tiptap/react"; -import { ContextItemWithId } from "core"; +import { ContextItemWithId, InputModifiers } from "core"; import { useDispatch, useSelector } from "react-redux"; import styled, { keyframes } from "styled-components"; import { defaultBorderRadius, vscBackground } from ".."; @@ -53,7 +53,7 @@ const GradientBorder = styled.div<{ interface ContinueInputBoxProps { isLastUserInput: boolean; isMainInput?: boolean; - onEnter: (editorState: JSONContent) => void; + onEnter: (editorState: JSONContent, modifiers: InputModifiers) => void; editorState?: JSONContent; contextItems?: ContextItemWithId[]; @@ -66,7 +66,7 @@ function ContinueInputBox(props: ContinueInputBoxProps) { const active = useSelector((store: RootState) => store.state.active); const availableSlashCommands = useSelector(selectSlashCommands); const availableContextProviders = useSelector( - (store: RootState) => store.state.config.contextProviders + (store: RootState) => store.state.config.contextProviders, ); useWebviewListener( @@ -78,11 +78,11 @@ function ContinueInputBox(props: ContinueInputBoxProps) { setMessageAtIndex({ message: { role: "user", content: data.prompt }, index: 0, - }) + }), ); } }, - [props.isMainInput] + [props.isMainInput], ); return ( diff --git a/gui/src/components/mainInput/InputToolbar.tsx b/gui/src/components/mainInput/InputToolbar.tsx index 214598fe9..1fc7dc928 100644 --- a/gui/src/components/mainInput/InputToolbar.tsx +++ b/gui/src/components/mainInput/InputToolbar.tsx @@ -1,5 +1,6 @@ import { PhotoIcon as OutlinePhotoIcon } from "@heroicons/react/24/outline"; import { PhotoIcon as SolidPhotoIcon } from "@heroicons/react/24/solid"; +import { InputModifiers } from "core"; import { modelSupportsImages } from "core/llm/autodetect"; import { useRef, useState } from "react"; import { useSelector } from "react-redux"; @@ -13,6 +14,7 @@ import { vscInputBackground, } from ".."; import { defaultModelSelector } from "../../redux/selectors/modelSelectors"; +import { getMetaKeyLabel, isMetaEquivalentKeyPressed } from "../../util"; const StyledDiv = styled.div<{ hidden?: boolean }>` position: absolute; @@ -55,8 +57,7 @@ const EnterButton = styled.div<{ offFocus: boolean }>` `; interface InputToolbarProps { - onEnter?: () => void; - useCodebase?: () => void; + onEnter?: (modifiers: InputModifiers) => void; usingCodebase?: boolean; onAddContextItem?: () => void; @@ -127,18 +128,22 @@ function InputToolbar(props: InputToolbarProps) { )} - {/* { + props.onEnter({ + useCodebase: true, + }); + }} className={"hover:underline cursor-pointer float-right"} > {getMetaKeyLabel()} ⏎ Use Codebase - */} + { + props.onEnter({ + useCodebase: isMetaEquivalentKeyPressed(e), + }); + }} > ⏎ Enter diff --git a/gui/src/components/mainInput/TipTapEditor.tsx b/gui/src/components/mainInput/TipTapEditor.tsx index 80c8142ff..a65bb39ee 100644 --- a/gui/src/components/mainInput/TipTapEditor.tsx +++ b/gui/src/components/mainInput/TipTapEditor.tsx @@ -8,6 +8,7 @@ import { Editor, EditorContent, JSONContent, useEditor } from "@tiptap/react"; import { ContextItemWithId, ContextProviderDescription, + InputModifiers, RangeInFile, } from "core"; import { modelSupportsImages } from "core/llm/autodetect"; @@ -122,7 +123,7 @@ interface TipTapEditorProps { availableContextProviders: ContextProviderDescription[]; availableSlashCommands: ComboBoxItem[]; isMainInput: boolean; - onEnter: (editorState: JSONContent) => void; + onEnter: (editorState: JSONContent, modifiers: InputModifiers) => void; editorState?: JSONContent; } @@ -249,12 +250,12 @@ function TipTapEditor(props: TipTapEditorProps) { return false; } - onEnterRef.current(); + onEnterRef.current({ useCodebase: false }); return true; }, "Cmd-Enter": () => { - onEnterRef.current(); + onEnterRef.current({ useCodebase: true }); return true; }, @@ -349,20 +350,23 @@ function TipTapEditor(props: TipTapEditorProps) { }, }); - const onEnterRef = useUpdatingRef(() => { - const json = editor.getJSON(); + const onEnterRef = useUpdatingRef( + (modifiers: InputModifiers) => { + const json = editor.getJSON(); - // Don't do anything if input box is empty - if (!json.content?.some((c) => c.content)) { - return; - } + // Don't do anything if input box is empty + if (!json.content?.some((c) => c.content)) { + return; + } - props.onEnter(json); + props.onEnter(json, modifiers); - if (props.isMainInput) { - editor.commands.clearContent(true); - } - }, [props.onEnter, editor, props.isMainInput]); + if (props.isMainInput) { + editor.commands.clearContent(true); + } + }, + [props.onEnter, editor, props.isMainInput], + ); // This is a mechanism for overriding the IDE keyboard shortcut when inside of the webview const [ignoreHighlightedCode, setIgnoreHighlightedCode] = useState(false); @@ -392,7 +396,7 @@ function TipTapEditor(props: TipTapEditorProps) { // Re-focus main input after done generating const active = useSelector((state: RootState) => state.state.active); useEffect(() => { - if (editor && !active && props.isMainInput) { + if (editor && !active && props.isMainInput && document.hasFocus()) { editor.commands.focus(); } }, [props.isMainInput, active, editor]); @@ -405,11 +409,15 @@ function TipTapEditor(props: TipTapEditorProps) { return; } editor?.commands.insertContent(data.input); - onEnterRef.current(); + onEnterRef.current({ useCodebase: false }); }, [editor, onEnterRef.current, props.isMainInput], ); + useWebviewListener("jetbrains/editorInsetRefresh", async () => { + editor?.chain().clearContent().focus().run(); + }); + useWebviewListener( "focusContinueInput", async (data) => { diff --git a/gui/src/components/mainInput/inputModifiers.ts b/gui/src/components/mainInput/inputModifiers.ts new file mode 100644 index 000000000..ce69cce7a --- /dev/null +++ b/gui/src/components/mainInput/inputModifiers.ts @@ -0,0 +1,5 @@ +import { InputModifiers } from "core"; + +export const defaultInputModifiers: InputModifiers = { + useCodebase: false, +}; diff --git a/gui/src/components/mainInput/resolveInput.ts b/gui/src/components/mainInput/resolveInput.ts index ac039d694..6d3c78b4a 100644 --- a/gui/src/components/mainInput/resolveInput.ts +++ b/gui/src/components/mainInput/resolveInput.ts @@ -1,6 +1,7 @@ import { JSONContent } from "@tiptap/react"; import { ContextItemWithId, + InputModifiers, MessageContent, MessagePart, RangeInFile, @@ -25,7 +26,8 @@ interface MentionAttrs { */ async function resolveEditorContent( - editorState: JSONContent + editorState: JSONContent, + modifiers: InputModifiers, ): Promise<[ContextItemWithId[], RangeInFile[], MessageContent]> { let parts: MessagePart[] = []; let contextItemAttrs: MentionAttrs[] = []; @@ -122,6 +124,20 @@ async function resolveEditorContent( } } + // cmd+enter to use codebase + if (modifiers.useCodebase) { + const codebaseItems = await ideRequest("context/getContextItems", { + name: "codebase", + query: "", + fullInput: stripImages(parts), + selectedCode, + }); + contextItems.push(...codebaseItems); + for (const codebaseItem of codebaseItems) { + contextItemsText += codebaseItem.content + "\n\n"; + } + } + if (contextItemsText !== "") { contextItemsText += "\n"; } @@ -141,7 +157,7 @@ async function resolveEditorContent( function findLastIndex( array: T[], - predicate: (value: T, index: number, obj: T[]) => boolean + predicate: (value: T, index: number, obj: T[]) => boolean, ): number { for (let i = array.length - 1; i >= 0; i--) { if (predicate(array[i], i, array)) { diff --git a/gui/src/components/markdown/CodeBlockToolbar.tsx b/gui/src/components/markdown/CodeBlockToolbar.tsx index b23c5ff61..a7a1e53e1 100644 --- a/gui/src/components/markdown/CodeBlockToolbar.tsx +++ b/gui/src/components/markdown/CodeBlockToolbar.tsx @@ -1,8 +1,13 @@ -import { CheckIcon, PlayIcon } from "@heroicons/react/24/outline"; +import { + ArrowLeftEndOnRectangleIcon, + CheckIcon, + PlayIcon, +} from "@heroicons/react/24/outline"; import { useState } from "react"; import styled from "styled-components"; -import { vscEditorBackground } from ".."; +import { defaultBorderRadius, vscEditorBackground } from ".."; import { isJetBrains, postToIde } from "../../util/ide"; +import { WebviewIde } from "../../util/webviewIde"; import HeaderButtonWithText from "../HeaderButtonWithText"; import { CopyButton } from "./CopyButton"; @@ -18,18 +23,24 @@ const TopDiv = styled.div` const SecondDiv = styled.div<{ bottom: boolean }>` position: absolute; - ${(props) => (props.bottom ? "bottom: 1.2rem;" : "top: 4px;")} - right: 4px; + ${(props) => (props.bottom ? "bottom: 3px;" : "top: -11px;")} + right: 10px; display: flex; + padding: 1px 2px; gap: 4px; + border: 0.5px solid #8888; + border-radius: ${defaultBorderRadius}; background-color: ${vscEditorBackground}; `; interface CodeBlockToolBarProps { text: string; bottom: boolean; + language: string | undefined; } +const terminalLanguages = ["bash", "sh"]; + function CodeBlockToolBar(props: CodeBlockToolBarProps) { const [copied, setCopied] = useState(false); const [applying, setApplying] = useState(false); @@ -38,24 +49,50 @@ function CodeBlockToolBar(props: CodeBlockToolBarProps) { {isJetBrains() || ( - { - if (applying) return; - postToIde("applyToCurrentFile", { text: props.text }); - setApplying(true); - setTimeout(() => setApplying(false), 2000); - }} - > - {applying ? ( - - ) : ( - - )} - + <> + { + if (terminalLanguages.includes(props.language)) { + let text = props.text; + if (text.startsWith("$ ")) { + text = text.slice(2); + } + new WebviewIde().runCommand(text); + } + + if (applying) return; + postToIde("applyToCurrentFile", { text: props.text }); + setApplying(true); + setTimeout(() => setApplying(false), 2000); + }} + > + {applying ? ( + + ) : ( + + )} + + { + postToIde("insertAtCursor", { text: props.text }); + }} + > + + + )} + diff --git a/gui/src/components/markdown/CopyButton.tsx b/gui/src/components/markdown/CopyButton.tsx index a284745d6..cb996da96 100644 --- a/gui/src/components/markdown/CopyButton.tsx +++ b/gui/src/components/markdown/CopyButton.tsx @@ -1,10 +1,11 @@ import { CheckIcon, ClipboardIcon } from "@heroicons/react/24/outline"; import { useState } from "react"; -import { vscEditorBackground } from ".."; +import { ideRequest, isJetBrains } from "../../util/ide"; import HeaderButtonWithText from "../HeaderButtonWithText"; interface CopyButtonProps { text: string | (() => string); + color?: string; } export function CopyButton(props: CopyButtonProps) { @@ -14,11 +15,15 @@ export function CopyButton(props: CopyButtonProps) { <> { - navigator.clipboard.writeText( - typeof props.text === "string" ? props.text : props.text(), - ); + const text = + typeof props.text === "string" ? props.text : props.text(); + if (isJetBrains()) { + ideRequest("copyText", { text }); + } else { + navigator.clipboard.writeText(text); + } + setCopied(true); setTimeout(() => setCopied(false), 2000); }} @@ -26,7 +31,7 @@ export function CopyButton(props: CopyButtonProps) { {copied ? ( ) : ( - + )} diff --git a/gui/src/components/markdown/PreWithToolbar.tsx b/gui/src/components/markdown/PreWithToolbar.tsx index 08be4c643..a5df415f1 100644 --- a/gui/src/components/markdown/PreWithToolbar.tsx +++ b/gui/src/components/markdown/PreWithToolbar.tsx @@ -19,9 +19,12 @@ function childrenToText(children: any) { return children.map((child: any) => childToText(child)).join(""); } -function PreWithToolbar(props: { children: any }) { - const uiConfig = useUIConfig() - const toolbarBottom = uiConfig?.codeBlockToolbarPosition == 'bottom'; +function PreWithToolbar(props: { + children: any; + language: string | undefined; +}) { + const uiConfig = useUIConfig(); + const toolbarBottom = uiConfig?.codeBlockToolbarPosition == "bottom"; const [hovering, setHovering] = useState(false); @@ -46,9 +49,21 @@ function PreWithToolbar(props: { children: any }) { onMouseEnter={() => setHovering(true)} onMouseLeave={() => setHovering(false)} > - {!toolbarBottom && hovering && } + {!toolbarBottom && hovering && ( + + )} {props.children} - {toolbarBottom && hovering && } + {toolbarBottom && hovering && ( + + )}
); } diff --git a/gui/src/components/markdown/StyledMarkdownPreview.tsx b/gui/src/components/markdown/StyledMarkdownPreview.tsx index dea1c331a..c6528084c 100644 --- a/gui/src/components/markdown/StyledMarkdownPreview.tsx +++ b/gui/src/components/markdown/StyledMarkdownPreview.tsx @@ -1,8 +1,8 @@ import React, { memo, useEffect } from "react"; import { useRemark } from "react-remark"; -// import rehypeKatex from "rehype-katex"; -// import remarkMath from "remark-math"; import rehypeHighlight from "rehype-highlight"; +import rehypeKatex from "rehype-katex"; +import remarkMath from "remark-math"; import styled from "styled-components"; import { visit } from "unist-util-visit"; import { @@ -14,6 +14,7 @@ import { import { getFontSize } from "../../util"; import PreWithToolbar from "./PreWithToolbar"; import { SyntaxHighlightedPre } from "./SyntaxHighlightedPre"; +import "./katex.css"; import "./markdown.css"; const StyledMarkdown = styled.div<{ @@ -110,12 +111,11 @@ const FadeInWords: React.FC = (props: any) => { }; const StyledMarkdownPreview = memo(function StyledMarkdownPreview( - props: StyledMarkdownPreviewProps + props: StyledMarkdownPreviewProps, ) { const [reactContent, setMarkdownSource] = useRemark({ - // remarkPlugins: [remarkMath], - // rehypePlugins: [rehypeKatex as any, {}], remarkPlugins: [ + remarkMath, () => { return (tree) => { visit(tree, "code", (node: any) => { @@ -128,7 +128,7 @@ const StyledMarkdownPreview = memo(function StyledMarkdownPreview( }; }, ], - rehypePlugins: [rehypeHighlight as any, {}], + rehypePlugins: [rehypeHighlight as any, {}, rehypeKatex as any, {}], rehypeReactOptions: { components: { a: ({ node, ...props }) => { @@ -139,8 +139,12 @@ const StyledMarkdownPreview = memo(function StyledMarkdownPreview( ); }, pre: ({ node, ...preProps }) => { + const language = preProps?.children?.[0]?.props?.className + ?.split(" ") + .find((word) => word.startsWith("language-")) + ?.split("-")[1]; return props.showCodeBorder ? ( - + ) : ( diff --git a/gui/src/components/markdown/katex.css b/gui/src/components/markdown/katex.css new file mode 100644 index 000000000..b7502b341 --- /dev/null +++ b/gui/src/components/markdown/katex.css @@ -0,0 +1,1128 @@ +@font-face { + font-family: KaTeX_AMS; + font-style: normal; + font-weight: 400; + src: + url(fonts/KaTeX_AMS-Regular.woff2) format("woff2"), + url(fonts/KaTeX_AMS-Regular.woff) format("woff"), + url(fonts/KaTeX_AMS-Regular.ttf) format("truetype"); +} +@font-face { + font-family: KaTeX_Caligraphic; + font-style: normal; + font-weight: 700; + src: + url(fonts/KaTeX_Caligraphic-Bold.woff2) format("woff2"), + url(fonts/KaTeX_Caligraphic-Bold.woff) format("woff"), + url(fonts/KaTeX_Caligraphic-Bold.ttf) format("truetype"); +} +@font-face { + font-family: KaTeX_Caligraphic; + font-style: normal; + font-weight: 400; + src: + url(fonts/KaTeX_Caligraphic-Regular.woff2) format("woff2"), + url(fonts/KaTeX_Caligraphic-Regular.woff) format("woff"), + url(fonts/KaTeX_Caligraphic-Regular.ttf) format("truetype"); +} +@font-face { + font-family: KaTeX_Fraktur; + font-style: normal; + font-weight: 700; + src: + url(fonts/KaTeX_Fraktur-Bold.woff2) format("woff2"), + url(fonts/KaTeX_Fraktur-Bold.woff) format("woff"), + url(fonts/KaTeX_Fraktur-Bold.ttf) format("truetype"); +} +@font-face { + font-family: KaTeX_Fraktur; + font-style: normal; + font-weight: 400; + src: + url(fonts/KaTeX_Fraktur-Regular.woff2) format("woff2"), + url(fonts/KaTeX_Fraktur-Regular.woff) format("woff"), + url(fonts/KaTeX_Fraktur-Regular.ttf) format("truetype"); +} +@font-face { + font-family: KaTeX_Main; + font-style: normal; + font-weight: 700; + src: + url(fonts/KaTeX_Main-Bold.woff2) format("woff2"), + url(fonts/KaTeX_Main-Bold.woff) format("woff"), + url(fonts/KaTeX_Main-Bold.ttf) format("truetype"); +} +@font-face { + font-family: KaTeX_Main; + font-style: italic; + font-weight: 700; + src: + url(fonts/KaTeX_Main-BoldItalic.woff2) format("woff2"), + url(fonts/KaTeX_Main-BoldItalic.woff) format("woff"), + url(fonts/KaTeX_Main-BoldItalic.ttf) format("truetype"); +} +@font-face { + font-family: KaTeX_Main; + font-style: italic; + font-weight: 400; + src: + url(fonts/KaTeX_Main-Italic.woff2) format("woff2"), + url(fonts/KaTeX_Main-Italic.woff) format("woff"), + url(fonts/KaTeX_Main-Italic.ttf) format("truetype"); +} +@font-face { + font-family: KaTeX_Main; + font-style: normal; + font-weight: 400; + src: + url(fonts/KaTeX_Main-Regular.woff2) format("woff2"), + url(fonts/KaTeX_Main-Regular.woff) format("woff"), + url(fonts/KaTeX_Main-Regular.ttf) format("truetype"); +} +@font-face { + font-family: KaTeX_Math; + font-style: italic; + font-weight: 700; + src: + url(fonts/KaTeX_Math-BoldItalic.woff2) format("woff2"), + url(fonts/KaTeX_Math-BoldItalic.woff) format("woff"), + url(fonts/KaTeX_Math-BoldItalic.ttf) format("truetype"); +} +@font-face { + font-family: KaTeX_Math; + font-style: italic; + font-weight: 400; + src: + url(fonts/KaTeX_Math-Italic.woff2) format("woff2"), + url(fonts/KaTeX_Math-Italic.woff) format("woff"), + url(fonts/KaTeX_Math-Italic.ttf) format("truetype"); +} +@font-face { + font-family: "KaTeX_SansSerif"; + font-style: normal; + font-weight: 700; + src: + url(fonts/KaTeX_SansSerif-Bold.woff2) format("woff2"), + url(fonts/KaTeX_SansSerif-Bold.woff) format("woff"), + url(fonts/KaTeX_SansSerif-Bold.ttf) format("truetype"); +} +@font-face { + font-family: "KaTeX_SansSerif"; + font-style: italic; + font-weight: 400; + src: + url(fonts/KaTeX_SansSerif-Italic.woff2) format("woff2"), + url(fonts/KaTeX_SansSerif-Italic.woff) format("woff"), + url(fonts/KaTeX_SansSerif-Italic.ttf) format("truetype"); +} +@font-face { + font-family: "KaTeX_SansSerif"; + font-style: normal; + font-weight: 400; + src: + url(fonts/KaTeX_SansSerif-Regular.woff2) format("woff2"), + url(fonts/KaTeX_SansSerif-Regular.woff) format("woff"), + url(fonts/KaTeX_SansSerif-Regular.ttf) format("truetype"); +} +@font-face { + font-family: KaTeX_Script; + font-style: normal; + font-weight: 400; + src: + url(fonts/KaTeX_Script-Regular.woff2) format("woff2"), + url(fonts/KaTeX_Script-Regular.woff) format("woff"), + url(fonts/KaTeX_Script-Regular.ttf) format("truetype"); +} +@font-face { + font-family: KaTeX_Size1; + font-style: normal; + font-weight: 400; + src: + url(fonts/KaTeX_Size1-Regular.woff2) format("woff2"), + url(fonts/KaTeX_Size1-Regular.woff) format("woff"), + url(fonts/KaTeX_Size1-Regular.ttf) format("truetype"); +} +@font-face { + font-family: KaTeX_Size2; + font-style: normal; + font-weight: 400; + src: + url(fonts/KaTeX_Size2-Regular.woff2) format("woff2"), + url(fonts/KaTeX_Size2-Regular.woff) format("woff"), + url(fonts/KaTeX_Size2-Regular.ttf) format("truetype"); +} +@font-face { + font-family: KaTeX_Size3; + font-style: normal; + font-weight: 400; + src: + url(fonts/KaTeX_Size3-Regular.woff2) format("woff2"), + url(fonts/KaTeX_Size3-Regular.woff) format("woff"), + url(fonts/KaTeX_Size3-Regular.ttf) format("truetype"); +} +@font-face { + font-family: KaTeX_Size4; + font-style: normal; + font-weight: 400; + src: + url(fonts/KaTeX_Size4-Regular.woff2) format("woff2"), + url(fonts/KaTeX_Size4-Regular.woff) format("woff"), + url(fonts/KaTeX_Size4-Regular.ttf) format("truetype"); +} +@font-face { + font-family: KaTeX_Typewriter; + font-style: normal; + font-weight: 400; + src: + url(fonts/KaTeX_Typewriter-Regular.woff2) format("woff2"), + url(fonts/KaTeX_Typewriter-Regular.woff) format("woff"), + url(fonts/KaTeX_Typewriter-Regular.ttf) format("truetype"); +} +.katex { + text-rendering: auto; + font: + normal 1.21em KaTeX_Main, + Times New Roman, + serif; + line-height: 1.2; + text-indent: 0; +} +.katex * { + -ms-high-contrast-adjust: none !important; + border-color: currentColor; +} +.katex .katex-version:after { + content: "0.16.8"; +} +.katex .katex-mathml { + clip: rect(1px, 1px, 1px, 1px); + border: 0; + height: 1px; + overflow: hidden; + padding: 0; + position: absolute; + width: 1px; +} +.katex .katex-html > .newline { + display: block; +} +.katex .base { + position: relative; + white-space: nowrap; + width: -webkit-min-content; + width: -moz-min-content; + width: min-content; +} +.katex .base, +.katex .strut { + display: inline-block; +} +.katex .textbf { + font-weight: 700; +} +.katex .textit { + font-style: italic; +} +.katex .textrm { + font-family: KaTeX_Main; +} +.katex .textsf { + font-family: KaTeX_SansSerif; +} +.katex .texttt { + font-family: KaTeX_Typewriter; +} +.katex .mathnormal { + font-family: KaTeX_Math; + font-style: italic; +} +.katex .mathit { + font-family: KaTeX_Main; + font-style: italic; +} +.katex .mathrm { + font-style: normal; +} +.katex .mathbf { + font-family: KaTeX_Main; + font-weight: 700; +} +.katex .boldsymbol { + font-family: KaTeX_Math; + font-style: italic; + font-weight: 700; +} +.katex .amsrm, +.katex .mathbb, +.katex .textbb { + font-family: KaTeX_AMS; +} +.katex .mathcal { + font-family: KaTeX_Caligraphic; +} +.katex .mathfrak, +.katex .textfrak { + font-family: KaTeX_Fraktur; +} +.katex .mathtt { + font-family: KaTeX_Typewriter; +} +.katex .mathscr, +.katex .textscr { + font-family: KaTeX_Script; +} +.katex .mathsf, +.katex .textsf { + font-family: KaTeX_SansSerif; +} +.katex .mathboldsf, +.katex .textboldsf { + font-family: KaTeX_SansSerif; + font-weight: 700; +} +.katex .mathitsf, +.katex .textitsf { + font-family: KaTeX_SansSerif; + font-style: italic; +} +.katex .mainrm { + font-family: KaTeX_Main; + font-style: normal; +} +.katex .vlist-t { + border-collapse: collapse; + display: inline-table; + table-layout: fixed; +} +.katex .vlist-r { + display: table-row; +} +.katex .vlist { + display: table-cell; + position: relative; + vertical-align: bottom; +} +.katex .vlist > span { + display: block; + height: 0; + position: relative; +} +.katex .vlist > span > span { + display: inline-block; +} +.katex .vlist > span > .pstrut { + overflow: hidden; + width: 0; +} +.katex .vlist-t2 { + margin-right: -2px; +} +.katex .vlist-s { + display: table-cell; + font-size: 1px; + min-width: 2px; + vertical-align: bottom; + width: 2px; +} +.katex .vbox { + align-items: baseline; + display: inline-flex; + flex-direction: column; +} +.katex .hbox { + width: 100%; +} +.katex .hbox, +.katex .thinbox { + display: inline-flex; + flex-direction: row; +} +.katex .thinbox { + max-width: 0; + width: 0; +} +.katex .msupsub { + text-align: left; +} +.katex .mfrac > span > span { + text-align: center; +} +.katex .mfrac .frac-line { + border-bottom-style: solid; + display: inline-block; + width: 100%; +} +.katex .hdashline, +.katex .hline, +.katex .mfrac .frac-line, +.katex .overline .overline-line, +.katex .rule, +.katex .underline .underline-line { + min-height: 1px; +} +.katex .mspace { + display: inline-block; +} +.katex .clap, +.katex .llap, +.katex .rlap { + position: relative; + width: 0; +} +.katex .clap > .inner, +.katex .llap > .inner, +.katex .rlap > .inner { + position: absolute; +} +.katex .clap > .fix, +.katex .llap > .fix, +.katex .rlap > .fix { + display: inline-block; +} +.katex .llap > .inner { + right: 0; +} +.katex .clap > .inner, +.katex .rlap > .inner { + left: 0; +} +.katex .clap > .inner > span { + margin-left: -50%; + margin-right: 50%; +} +.katex .rule { + border: 0 solid; + display: inline-block; + position: relative; +} +.katex .hline, +.katex .overline .overline-line, +.katex .underline .underline-line { + border-bottom-style: solid; + display: inline-block; + width: 100%; +} +.katex .hdashline { + border-bottom-style: dashed; + display: inline-block; + width: 100%; +} +.katex .sqrt > .root { + margin-left: 0.27777778em; + margin-right: -0.55555556em; +} +.katex .fontsize-ensurer.reset-size1.size1, +.katex .sizing.reset-size1.size1 { + font-size: 1em; +} +.katex .fontsize-ensurer.reset-size1.size2, +.katex .sizing.reset-size1.size2 { + font-size: 1.2em; +} +.katex .fontsize-ensurer.reset-size1.size3, +.katex .sizing.reset-size1.size3 { + font-size: 1.4em; +} +.katex .fontsize-ensurer.reset-size1.size4, +.katex .sizing.reset-size1.size4 { + font-size: 1.6em; +} +.katex .fontsize-ensurer.reset-size1.size5, +.katex .sizing.reset-size1.size5 { + font-size: 1.8em; +} +.katex .fontsize-ensurer.reset-size1.size6, +.katex .sizing.reset-size1.size6 { + font-size: 2em; +} +.katex .fontsize-ensurer.reset-size1.size7, +.katex .sizing.reset-size1.size7 { + font-size: 2.4em; +} +.katex .fontsize-ensurer.reset-size1.size8, +.katex .sizing.reset-size1.size8 { + font-size: 2.88em; +} +.katex .fontsize-ensurer.reset-size1.size9, +.katex .sizing.reset-size1.size9 { + font-size: 3.456em; +} +.katex .fontsize-ensurer.reset-size1.size10, +.katex .sizing.reset-size1.size10 { + font-size: 4.148em; +} +.katex .fontsize-ensurer.reset-size1.size11, +.katex .sizing.reset-size1.size11 { + font-size: 4.976em; +} +.katex .fontsize-ensurer.reset-size2.size1, +.katex .sizing.reset-size2.size1 { + font-size: 0.83333333em; +} +.katex .fontsize-ensurer.reset-size2.size2, +.katex .sizing.reset-size2.size2 { + font-size: 1em; +} +.katex .fontsize-ensurer.reset-size2.size3, +.katex .sizing.reset-size2.size3 { + font-size: 1.16666667em; +} +.katex .fontsize-ensurer.reset-size2.size4, +.katex .sizing.reset-size2.size4 { + font-size: 1.33333333em; +} +.katex .fontsize-ensurer.reset-size2.size5, +.katex .sizing.reset-size2.size5 { + font-size: 1.5em; +} +.katex .fontsize-ensurer.reset-size2.size6, +.katex .sizing.reset-size2.size6 { + font-size: 1.66666667em; +} +.katex .fontsize-ensurer.reset-size2.size7, +.katex .sizing.reset-size2.size7 { + font-size: 2em; +} +.katex .fontsize-ensurer.reset-size2.size8, +.katex .sizing.reset-size2.size8 { + font-size: 2.4em; +} +.katex .fontsize-ensurer.reset-size2.size9, +.katex .sizing.reset-size2.size9 { + font-size: 2.88em; +} +.katex .fontsize-ensurer.reset-size2.size10, +.katex .sizing.reset-size2.size10 { + font-size: 3.45666667em; +} +.katex .fontsize-ensurer.reset-size2.size11, +.katex .sizing.reset-size2.size11 { + font-size: 4.14666667em; +} +.katex .fontsize-ensurer.reset-size3.size1, +.katex .sizing.reset-size3.size1 { + font-size: 0.71428571em; +} +.katex .fontsize-ensurer.reset-size3.size2, +.katex .sizing.reset-size3.size2 { + font-size: 0.85714286em; +} +.katex .fontsize-ensurer.reset-size3.size3, +.katex .sizing.reset-size3.size3 { + font-size: 1em; +} +.katex .fontsize-ensurer.reset-size3.size4, +.katex .sizing.reset-size3.size4 { + font-size: 1.14285714em; +} +.katex .fontsize-ensurer.reset-size3.size5, +.katex .sizing.reset-size3.size5 { + font-size: 1.28571429em; +} +.katex .fontsize-ensurer.reset-size3.size6, +.katex .sizing.reset-size3.size6 { + font-size: 1.42857143em; +} +.katex .fontsize-ensurer.reset-size3.size7, +.katex .sizing.reset-size3.size7 { + font-size: 1.71428571em; +} +.katex .fontsize-ensurer.reset-size3.size8, +.katex .sizing.reset-size3.size8 { + font-size: 2.05714286em; +} +.katex .fontsize-ensurer.reset-size3.size9, +.katex .sizing.reset-size3.size9 { + font-size: 2.46857143em; +} +.katex .fontsize-ensurer.reset-size3.size10, +.katex .sizing.reset-size3.size10 { + font-size: 2.96285714em; +} +.katex .fontsize-ensurer.reset-size3.size11, +.katex .sizing.reset-size3.size11 { + font-size: 3.55428571em; +} +.katex .fontsize-ensurer.reset-size4.size1, +.katex .sizing.reset-size4.size1 { + font-size: 0.625em; +} +.katex .fontsize-ensurer.reset-size4.size2, +.katex .sizing.reset-size4.size2 { + font-size: 0.75em; +} +.katex .fontsize-ensurer.reset-size4.size3, +.katex .sizing.reset-size4.size3 { + font-size: 0.875em; +} +.katex .fontsize-ensurer.reset-size4.size4, +.katex .sizing.reset-size4.size4 { + font-size: 1em; +} +.katex .fontsize-ensurer.reset-size4.size5, +.katex .sizing.reset-size4.size5 { + font-size: 1.125em; +} +.katex .fontsize-ensurer.reset-size4.size6, +.katex .sizing.reset-size4.size6 { + font-size: 1.25em; +} +.katex .fontsize-ensurer.reset-size4.size7, +.katex .sizing.reset-size4.size7 { + font-size: 1.5em; +} +.katex .fontsize-ensurer.reset-size4.size8, +.katex .sizing.reset-size4.size8 { + font-size: 1.8em; +} +.katex .fontsize-ensurer.reset-size4.size9, +.katex .sizing.reset-size4.size9 { + font-size: 2.16em; +} +.katex .fontsize-ensurer.reset-size4.size10, +.katex .sizing.reset-size4.size10 { + font-size: 2.5925em; +} +.katex .fontsize-ensurer.reset-size4.size11, +.katex .sizing.reset-size4.size11 { + font-size: 3.11em; +} +.katex .fontsize-ensurer.reset-size5.size1, +.katex .sizing.reset-size5.size1 { + font-size: 0.55555556em; +} +.katex .fontsize-ensurer.reset-size5.size2, +.katex .sizing.reset-size5.size2 { + font-size: 0.66666667em; +} +.katex .fontsize-ensurer.reset-size5.size3, +.katex .sizing.reset-size5.size3 { + font-size: 0.77777778em; +} +.katex .fontsize-ensurer.reset-size5.size4, +.katex .sizing.reset-size5.size4 { + font-size: 0.88888889em; +} +.katex .fontsize-ensurer.reset-size5.size5, +.katex .sizing.reset-size5.size5 { + font-size: 1em; +} +.katex .fontsize-ensurer.reset-size5.size6, +.katex .sizing.reset-size5.size6 { + font-size: 1.11111111em; +} +.katex .fontsize-ensurer.reset-size5.size7, +.katex .sizing.reset-size5.size7 { + font-size: 1.33333333em; +} +.katex .fontsize-ensurer.reset-size5.size8, +.katex .sizing.reset-size5.size8 { + font-size: 1.6em; +} +.katex .fontsize-ensurer.reset-size5.size9, +.katex .sizing.reset-size5.size9 { + font-size: 1.92em; +} +.katex .fontsize-ensurer.reset-size5.size10, +.katex .sizing.reset-size5.size10 { + font-size: 2.30444444em; +} +.katex .fontsize-ensurer.reset-size5.size11, +.katex .sizing.reset-size5.size11 { + font-size: 2.76444444em; +} +.katex .fontsize-ensurer.reset-size6.size1, +.katex .sizing.reset-size6.size1 { + font-size: 0.5em; +} +.katex .fontsize-ensurer.reset-size6.size2, +.katex .sizing.reset-size6.size2 { + font-size: 0.6em; +} +.katex .fontsize-ensurer.reset-size6.size3, +.katex .sizing.reset-size6.size3 { + font-size: 0.7em; +} +.katex .fontsize-ensurer.reset-size6.size4, +.katex .sizing.reset-size6.size4 { + font-size: 0.8em; +} +.katex .fontsize-ensurer.reset-size6.size5, +.katex .sizing.reset-size6.size5 { + font-size: 0.9em; +} +.katex .fontsize-ensurer.reset-size6.size6, +.katex .sizing.reset-size6.size6 { + font-size: 1em; +} +.katex .fontsize-ensurer.reset-size6.size7, +.katex .sizing.reset-size6.size7 { + font-size: 1.2em; +} +.katex .fontsize-ensurer.reset-size6.size8, +.katex .sizing.reset-size6.size8 { + font-size: 1.44em; +} +.katex .fontsize-ensurer.reset-size6.size9, +.katex .sizing.reset-size6.size9 { + font-size: 1.728em; +} +.katex .fontsize-ensurer.reset-size6.size10, +.katex .sizing.reset-size6.size10 { + font-size: 2.074em; +} +.katex .fontsize-ensurer.reset-size6.size11, +.katex .sizing.reset-size6.size11 { + font-size: 2.488em; +} +.katex .fontsize-ensurer.reset-size7.size1, +.katex .sizing.reset-size7.size1 { + font-size: 0.41666667em; +} +.katex .fontsize-ensurer.reset-size7.size2, +.katex .sizing.reset-size7.size2 { + font-size: 0.5em; +} +.katex .fontsize-ensurer.reset-size7.size3, +.katex .sizing.reset-size7.size3 { + font-size: 0.58333333em; +} +.katex .fontsize-ensurer.reset-size7.size4, +.katex .sizing.reset-size7.size4 { + font-size: 0.66666667em; +} +.katex .fontsize-ensurer.reset-size7.size5, +.katex .sizing.reset-size7.size5 { + font-size: 0.75em; +} +.katex .fontsize-ensurer.reset-size7.size6, +.katex .sizing.reset-size7.size6 { + font-size: 0.83333333em; +} +.katex .fontsize-ensurer.reset-size7.size7, +.katex .sizing.reset-size7.size7 { + font-size: 1em; +} +.katex .fontsize-ensurer.reset-size7.size8, +.katex .sizing.reset-size7.size8 { + font-size: 1.2em; +} +.katex .fontsize-ensurer.reset-size7.size9, +.katex .sizing.reset-size7.size9 { + font-size: 1.44em; +} +.katex .fontsize-ensurer.reset-size7.size10, +.katex .sizing.reset-size7.size10 { + font-size: 1.72833333em; +} +.katex .fontsize-ensurer.reset-size7.size11, +.katex .sizing.reset-size7.size11 { + font-size: 2.07333333em; +} +.katex .fontsize-ensurer.reset-size8.size1, +.katex .sizing.reset-size8.size1 { + font-size: 0.34722222em; +} +.katex .fontsize-ensurer.reset-size8.size2, +.katex .sizing.reset-size8.size2 { + font-size: 0.41666667em; +} +.katex .fontsize-ensurer.reset-size8.size3, +.katex .sizing.reset-size8.size3 { + font-size: 0.48611111em; +} +.katex .fontsize-ensurer.reset-size8.size4, +.katex .sizing.reset-size8.size4 { + font-size: 0.55555556em; +} +.katex .fontsize-ensurer.reset-size8.size5, +.katex .sizing.reset-size8.size5 { + font-size: 0.625em; +} +.katex .fontsize-ensurer.reset-size8.size6, +.katex .sizing.reset-size8.size6 { + font-size: 0.69444444em; +} +.katex .fontsize-ensurer.reset-size8.size7, +.katex .sizing.reset-size8.size7 { + font-size: 0.83333333em; +} +.katex .fontsize-ensurer.reset-size8.size8, +.katex .sizing.reset-size8.size8 { + font-size: 1em; +} +.katex .fontsize-ensurer.reset-size8.size9, +.katex .sizing.reset-size8.size9 { + font-size: 1.2em; +} +.katex .fontsize-ensurer.reset-size8.size10, +.katex .sizing.reset-size8.size10 { + font-size: 1.44027778em; +} +.katex .fontsize-ensurer.reset-size8.size11, +.katex .sizing.reset-size8.size11 { + font-size: 1.72777778em; +} +.katex .fontsize-ensurer.reset-size9.size1, +.katex .sizing.reset-size9.size1 { + font-size: 0.28935185em; +} +.katex .fontsize-ensurer.reset-size9.size2, +.katex .sizing.reset-size9.size2 { + font-size: 0.34722222em; +} +.katex .fontsize-ensurer.reset-size9.size3, +.katex .sizing.reset-size9.size3 { + font-size: 0.40509259em; +} +.katex .fontsize-ensurer.reset-size9.size4, +.katex .sizing.reset-size9.size4 { + font-size: 0.46296296em; +} +.katex .fontsize-ensurer.reset-size9.size5, +.katex .sizing.reset-size9.size5 { + font-size: 0.52083333em; +} +.katex .fontsize-ensurer.reset-size9.size6, +.katex .sizing.reset-size9.size6 { + font-size: 0.5787037em; +} +.katex .fontsize-ensurer.reset-size9.size7, +.katex .sizing.reset-size9.size7 { + font-size: 0.69444444em; +} +.katex .fontsize-ensurer.reset-size9.size8, +.katex .sizing.reset-size9.size8 { + font-size: 0.83333333em; +} +.katex .fontsize-ensurer.reset-size9.size9, +.katex .sizing.reset-size9.size9 { + font-size: 1em; +} +.katex .fontsize-ensurer.reset-size9.size10, +.katex .sizing.reset-size9.size10 { + font-size: 1.20023148em; +} +.katex .fontsize-ensurer.reset-size9.size11, +.katex .sizing.reset-size9.size11 { + font-size: 1.43981481em; +} +.katex .fontsize-ensurer.reset-size10.size1, +.katex .sizing.reset-size10.size1 { + font-size: 0.24108004em; +} +.katex .fontsize-ensurer.reset-size10.size2, +.katex .sizing.reset-size10.size2 { + font-size: 0.28929605em; +} +.katex .fontsize-ensurer.reset-size10.size3, +.katex .sizing.reset-size10.size3 { + font-size: 0.33751205em; +} +.katex .fontsize-ensurer.reset-size10.size4, +.katex .sizing.reset-size10.size4 { + font-size: 0.38572806em; +} +.katex .fontsize-ensurer.reset-size10.size5, +.katex .sizing.reset-size10.size5 { + font-size: 0.43394407em; +} +.katex .fontsize-ensurer.reset-size10.size6, +.katex .sizing.reset-size10.size6 { + font-size: 0.48216008em; +} +.katex .fontsize-ensurer.reset-size10.size7, +.katex .sizing.reset-size10.size7 { + font-size: 0.57859209em; +} +.katex .fontsize-ensurer.reset-size10.size8, +.katex .sizing.reset-size10.size8 { + font-size: 0.69431051em; +} +.katex .fontsize-ensurer.reset-size10.size9, +.katex .sizing.reset-size10.size9 { + font-size: 0.83317261em; +} +.katex .fontsize-ensurer.reset-size10.size10, +.katex .sizing.reset-size10.size10 { + font-size: 1em; +} +.katex .fontsize-ensurer.reset-size10.size11, +.katex .sizing.reset-size10.size11 { + font-size: 1.19961427em; +} +.katex .fontsize-ensurer.reset-size11.size1, +.katex .sizing.reset-size11.size1 { + font-size: 0.20096463em; +} +.katex .fontsize-ensurer.reset-size11.size2, +.katex .sizing.reset-size11.size2 { + font-size: 0.24115756em; +} +.katex .fontsize-ensurer.reset-size11.size3, +.katex .sizing.reset-size11.size3 { + font-size: 0.28135048em; +} +.katex .fontsize-ensurer.reset-size11.size4, +.katex .sizing.reset-size11.size4 { + font-size: 0.32154341em; +} +.katex .fontsize-ensurer.reset-size11.size5, +.katex .sizing.reset-size11.size5 { + font-size: 0.36173633em; +} +.katex .fontsize-ensurer.reset-size11.size6, +.katex .sizing.reset-size11.size6 { + font-size: 0.40192926em; +} +.katex .fontsize-ensurer.reset-size11.size7, +.katex .sizing.reset-size11.size7 { + font-size: 0.48231511em; +} +.katex .fontsize-ensurer.reset-size11.size8, +.katex .sizing.reset-size11.size8 { + font-size: 0.57877814em; +} +.katex .fontsize-ensurer.reset-size11.size9, +.katex .sizing.reset-size11.size9 { + font-size: 0.69453376em; +} +.katex .fontsize-ensurer.reset-size11.size10, +.katex .sizing.reset-size11.size10 { + font-size: 0.83360129em; +} +.katex .fontsize-ensurer.reset-size11.size11, +.katex .sizing.reset-size11.size11 { + font-size: 1em; +} +.katex .delimsizing.size1 { + font-family: KaTeX_Size1; +} +.katex .delimsizing.size2 { + font-family: KaTeX_Size2; +} +.katex .delimsizing.size3 { + font-family: KaTeX_Size3; +} +.katex .delimsizing.size4 { + font-family: KaTeX_Size4; +} +.katex .delimsizing.mult .delim-size1 > span { + font-family: KaTeX_Size1; +} +.katex .delimsizing.mult .delim-size4 > span { + font-family: KaTeX_Size4; +} +.katex .nulldelimiter { + display: inline-block; + width: 0.12em; +} +.katex .delimcenter, +.katex .op-symbol { + position: relative; +} +.katex .op-symbol.small-op { + font-family: KaTeX_Size1; +} +.katex .op-symbol.large-op { + font-family: KaTeX_Size2; +} +.katex .accent > .vlist-t, +.katex .op-limits > .vlist-t { + text-align: center; +} +.katex .accent .accent-body { + position: relative; +} +.katex .accent .accent-body:not(.accent-full) { + width: 0; +} +.katex .overlay { + display: block; +} +.katex .mtable .vertical-separator { + display: inline-block; + min-width: 1px; +} +.katex .mtable .arraycolsep { + display: inline-block; +} +.katex .mtable .col-align-c > .vlist-t { + text-align: center; +} +.katex .mtable .col-align-l > .vlist-t { + text-align: left; +} +.katex .mtable .col-align-r > .vlist-t { + text-align: right; +} +.katex .svg-align { + text-align: left; +} +.katex svg { + fill: currentColor; + stroke: currentColor; + fill-rule: nonzero; + fill-opacity: 1; + stroke-width: 1; + stroke-linecap: butt; + stroke-linejoin: miter; + stroke-miterlimit: 4; + stroke-dasharray: none; + stroke-dashoffset: 0; + stroke-opacity: 1; + display: block; + height: inherit; + position: absolute; + width: 100%; +} +.katex svg path { + stroke: none; +} +.katex img { + border-style: none; + max-height: none; + max-width: none; + min-height: 0; + min-width: 0; +} +.katex .stretchy { + display: block; + overflow: hidden; + position: relative; + width: 100%; +} +.katex .stretchy:after, +.katex .stretchy:before { + content: ""; +} +.katex .hide-tail { + overflow: hidden; + position: relative; + width: 100%; +} +.katex .halfarrow-left { + left: 0; + overflow: hidden; + position: absolute; + width: 50.2%; +} +.katex .halfarrow-right { + overflow: hidden; + position: absolute; + right: 0; + width: 50.2%; +} +.katex .brace-left { + left: 0; + overflow: hidden; + position: absolute; + width: 25.1%; +} +.katex .brace-center { + left: 25%; + overflow: hidden; + position: absolute; + width: 50%; +} +.katex .brace-right { + overflow: hidden; + position: absolute; + right: 0; + width: 25.1%; +} +.katex .x-arrow-pad { + padding: 0 0.5em; +} +.katex .cd-arrow-pad { + padding: 0 0.55556em 0 0.27778em; +} +.katex .mover, +.katex .munder, +.katex .x-arrow { + text-align: center; +} +.katex .boxpad { + padding: 0 0.3em; +} +.katex .fbox, +.katex .fcolorbox { + border: 0.04em solid; + box-sizing: border-box; +} +.katex .cancel-pad { + padding: 0 0.2em; +} +.katex .cancel-lap { + margin-left: -0.2em; + margin-right: -0.2em; +} +.katex .sout { + border-bottom-style: solid; + border-bottom-width: 0.08em; +} +.katex .angl { + border-right: 0.049em solid; + border-top: 0.049em solid; + box-sizing: border-box; + margin-right: 0.03889em; +} +.katex .anglpad { + padding: 0 0.03889em; +} +.katex .eqn-num:before { + content: "(" counter(katexEqnNo) ")"; + counter-increment: katexEqnNo; +} +.katex .mml-eqn-num:before { + content: "(" counter(mmlEqnNo) ")"; + counter-increment: mmlEqnNo; +} +.katex .mtr-glue { + width: 50%; +} +.katex .cd-vert-arrow { + display: inline-block; + position: relative; +} +.katex .cd-label-left { + display: inline-block; + position: absolute; + right: calc(50% + 0.3em); + text-align: left; +} +.katex .cd-label-right { + display: inline-block; + left: calc(50% + 0.3em); + position: absolute; + text-align: right; +} +.katex-display { + display: block; + margin: 1em 0; + text-align: center; +} +.katex-display > .katex { + display: block; + text-align: center; + white-space: nowrap; +} +.katex-display > .katex > .katex-html { + display: block; + position: relative; +} +.katex-display > .katex > .katex-html > .tag { + position: absolute; + right: 0; +} +.katex-display.leqno > .katex > .katex-html > .tag { + left: 0; + right: auto; +} +.katex-display.fleqn > .katex { + padding-left: 2em; + text-align: left; +} +body { + counter-reset: katexEqnNo mmlEqnNo; +} diff --git a/gui/src/editorInset/EditorInset.tsx b/gui/src/editorInset/EditorInset.tsx new file mode 100644 index 000000000..75f4a4f22 --- /dev/null +++ b/gui/src/editorInset/EditorInset.tsx @@ -0,0 +1,58 @@ +import { useEffect, useRef } from "react"; +import { useDispatch, useSelector } from "react-redux"; +import styled from "styled-components"; +import { defaultBorderRadius } from "../components"; +import TipTapEditor from "../components/mainInput/TipTapEditor"; +import useSetup from "../hooks/useSetup"; +import { selectSlashCommands } from "../redux/selectors"; +import { RootState } from "../redux/store"; +import { ideRequest } from "../util/ide"; + +const EditorInsetDiv = styled.div` + max-width: 500px; + position: relative; + display: flex; + border-radius: ${defaultBorderRadius}; + // box-shadow: 0 0 8px 0 rgba(0, 0, 0, 0.4); +`; + +function EditorInset() { + const dispatch = useDispatch(); + const availableSlashCommands = useSelector(selectSlashCommands); + const availableContextProviders = useSelector( + (store: RootState) => store.state.config.contextProviders, + ); + + useSetup(dispatch); + + const elementRef = useRef(null); + + useEffect(() => { + if (!elementRef.current) return; + const resizeObserver = new ResizeObserver(() => { + if (!elementRef.current) return; + + console.log("Height: ", elementRef.current.clientHeight); + ideRequest("jetbrains/editorInsetHeight", { + height: elementRef.current.clientHeight, + }); + }); + resizeObserver.observe(elementRef.current); + return () => resizeObserver.disconnect(); + }, []); + + return ( + + { + console.log("Enter: ", e, modifiers); + }} + > + + ); +} + +export default EditorInset; diff --git a/gui/src/editorInset/main.tsx b/gui/src/editorInset/main.tsx new file mode 100644 index 000000000..d15005ee7 --- /dev/null +++ b/gui/src/editorInset/main.tsx @@ -0,0 +1,18 @@ +import React from "react"; +import ReactDOM from "react-dom/client"; +import { Provider } from "react-redux"; +import "../index.css"; +import { store } from "../redux/store"; + +import CustomPostHogProvider from "../hooks/CustomPostHogProvider"; +import EditorInset from "./EditorInset"; + +ReactDOM.createRoot(document.getElementById("root") as HTMLElement).render( + + + + + + + , +); diff --git a/gui/src/hooks/CustomPostHogProvider.tsx b/gui/src/hooks/CustomPostHogProvider.tsx index 65beff0f6..d3df5753d 100644 --- a/gui/src/hooks/CustomPostHogProvider.tsx +++ b/gui/src/hooks/CustomPostHogProvider.tsx @@ -6,7 +6,7 @@ import { RootState } from "../redux/store"; const CustomPostHogProvider = ({ children }: PropsWithChildren) => { const allowAnonymousTelemetry = useSelector( - (store: RootState) => store?.state?.config.allowAnonymousTelemetry + (store: RootState) => store?.state?.config.allowAnonymousTelemetry, ); const [client, setClient] = React.useState(undefined); diff --git a/gui/src/hooks/useChatHandler.ts b/gui/src/hooks/useChatHandler.ts index 438004cf8..39439680c 100644 --- a/gui/src/hooks/useChatHandler.ts +++ b/gui/src/hooks/useChatHandler.ts @@ -5,6 +5,7 @@ import { ChatHistory, ChatHistoryItem, ChatMessage, + InputModifiers, LLMReturnValue, MessageContent, RangeInFile, @@ -18,7 +19,7 @@ import { useSelector } from "react-redux"; import resolveEditorContent from "../components/mainInput/resolveInput"; import { defaultModelSelector } from "../redux/selectors/modelSelectors"; import { - addLogs, + addPromptCompletionPair, initNewActiveMessage, resubmitAtIndex, setInactive, @@ -65,7 +66,9 @@ function useChatHandler(dispatch: Dispatch) { let returnVal = next.value as LLMReturnValue; if (returnVal) { - dispatch(addLogs([[returnVal?.prompt, returnVal?.completion]])); + dispatch( + addPromptCompletionPair([[returnVal?.prompt, returnVal?.completion]]), + ); } } @@ -129,7 +132,11 @@ function useChatHandler(dispatch: Dispatch) { } } - async function streamResponse(editorState: JSONContent, index?: number) { + async function streamResponse( + editorState: JSONContent, + modifiers: InputModifiers, + index?: number, + ) { try { if (typeof index === "number") { dispatch(resubmitAtIndex({ index, editorState })); @@ -138,8 +145,10 @@ function useChatHandler(dispatch: Dispatch) { } // Resolve context providers and construct new history - const [contextItems, selectedCode, content] = - await resolveEditorContent(editorState); + const [contextItems, selectedCode, content] = await resolveEditorContent( + editorState, + modifiers, + ); const message: ChatMessage = { role: "user", diff --git a/gui/src/hooks/useSetup.ts b/gui/src/hooks/useSetup.ts index 419e23b91..693522e06 100644 --- a/gui/src/hooks/useSetup.ts +++ b/gui/src/hooks/useSetup.ts @@ -74,7 +74,7 @@ function useSetup(dispatch: Dispatch) { }); useWebviewListener("submitMessage", async (data) => { - streamResponse(data.message); + streamResponse(data.message, { useCodebase: false }); }); useWebviewListener("addContextItem", async (data) => { diff --git a/gui/src/hooks/useWebviewListener.ts b/gui/src/hooks/useWebviewListener.ts index ab56b1ffb..7f9d682da 100644 --- a/gui/src/hooks/useWebviewListener.ts +++ b/gui/src/hooks/useWebviewListener.ts @@ -6,9 +6,9 @@ import { respondToIde } from "../util/ide"; export function useWebviewListener( messageType: T, handler: ( - data: ReverseWebviewProtocol[T][0] + data: ReverseWebviewProtocol[T][0], ) => Promise, - dependencies?: any[] + dependencies?: any[], ) { useEffect(() => { const listener = async (event: { data: Message }) => { diff --git a/gui/src/pages/gui.tsx b/gui/src/pages/gui.tsx index 6e9dab11a..68d69603c 100644 --- a/gui/src/pages/gui.tsx +++ b/gui/src/pages/gui.tsx @@ -4,6 +4,7 @@ import { ExclamationTriangleIcon, } from "@heroicons/react/24/outline"; import { JSONContent } from "@tiptap/react"; +import { InputModifiers } from "core"; import { usePostHog } from "posthog-js/react"; import { Fragment, @@ -28,6 +29,7 @@ import FTCDialog from "../components/dialogs/FTCDialog"; import StepContainer from "../components/gui/StepContainer"; import TimelineItem from "../components/gui/TimelineItem"; import ContinueInputBox from "../components/mainInput/ContinueInputBox"; +import { defaultInputModifiers } from "../components/mainInput/inputModifiers"; import useChatHandler from "../hooks/useChatHandler"; import useHistory from "../hooks/useHistory"; import { useWebviewListener } from "../hooks/useWebviewListener"; @@ -41,6 +43,7 @@ import { import { RootState } from "../redux/store"; import { getMetaKeyLabel, isMetaEquivalentKeyPressed } from "../util"; import { isJetBrains } from "../util/ide"; +import { getLocalStorage, setLocalStorage } from "../util/localStorage"; const TopGuiDiv = styled.div` overflow-y: scroll; @@ -78,15 +81,16 @@ const StepsDiv = styled.div` position: relative; } - &::before { - content: ""; - position: absolute; - height: calc(100% - 12px); - border-left: 2px solid ${lightGray}; - left: 28px; - z-index: 0; - bottom: 12px; - } + // Gray, vertical line on the left ("thread") + // &::before { + // content: ""; + // position: absolute; + // height: calc(100% - 12px); + // border-left: 2px solid ${lightGray}; + // left: 28px; + // z-index: 0; + // bottom: 12px; + // } `; const NewSessionButton = styled.div` @@ -224,7 +228,7 @@ function GUI(props: GUIProps) { const { streamResponse } = useChatHandler(dispatch); const sendInput = useCallback( - (editorState: JSONContent) => { + (editorState: JSONContent, modifiers: InputModifiers) => { if (defaultModel?.provider === "free-trial") { const ftc = localStorage.getItem("ftc"); if (ftc) { @@ -242,16 +246,12 @@ function GUI(props: GUIProps) { } } - streamResponse(editorState); + streamResponse(editorState, modifiers); // Increment localstorage counter for popup - const counter = localStorage.getItem("mainTextEntryCounter"); - if (counter) { - let currentCount = parseInt(counter); - localStorage.setItem( - "mainTextEntryCounter", - (currentCount + 1).toString(), - ); + const currentCount = getLocalStorage("mainTextEntryCounter"); + if (currentCount) { + setLocalStorage("mainTextEntryCounter", currentCount + 1); if (currentCount === 300) { dispatch( setDialogMessage( @@ -315,7 +315,7 @@ function GUI(props: GUIProps) { dispatch(setShowDialog(true)); } } else { - localStorage.setItem("mainTextEntryCounter", "1"); + setLocalStorage("mainTextEntryCounter", 1); } }, [ @@ -368,8 +368,8 @@ function GUI(props: GUIProps) { > {item.message.role === "user" ? ( { - streamResponse(editorState, index); + onEnter={async (editorState, modifiers) => { + streamResponse(editorState, modifiers, index); }} isLastUserInput={isLastUserInput(index)} isMainInput={false} @@ -417,7 +417,23 @@ function GUI(props: GUIProps) { onUserInput={(input: string) => {}} item={item} onReverse={() => {}} - onRetry={() => {}} + onRetry={() => { + streamResponse( + state.history[index - 1].editorState, + state.history[index - 1].modifiers ?? + defaultInputModifiers, + index - 1, + ); + }} + onContinueGeneration={() => { + window.postMessage( + { + messageType: "userInput", + data: { input: "Keep going" }, + }, + "*", + ); + }} onDelete={() => {}} /> @@ -429,7 +445,9 @@ function GUI(props: GUIProps) { { + sendInput(editorContent, modifiers); + }} isLastUserInput={false} isMainInput={true} hidden={active} diff --git a/gui/src/pages/help.tsx b/gui/src/pages/help.tsx index 8e857fb83..e12f3f099 100644 --- a/gui/src/pages/help.tsx +++ b/gui/src/pages/help.tsx @@ -75,6 +75,7 @@ function HelpPage() { { postToIde("showTutorial", undefined); + // navigate("/onboarding"); }} > Open tutorial diff --git a/gui/src/pages/onboarding/components.ts b/gui/src/pages/onboarding/components.ts new file mode 100644 index 000000000..0ee5dd475 --- /dev/null +++ b/gui/src/pages/onboarding/components.ts @@ -0,0 +1,52 @@ +import styled from "styled-components"; +import { + Button, + defaultBorderRadius, + lightGray, + vscButtonBackground, + vscForeground, +} from "../../components"; + +export const StyledButton = styled(Button)` + margin-left: auto; + background-color: transparent; + color: ${vscForeground}; + border: 0.5px solid ${lightGray}; + + &:hover { + ${(props) => + !props.disabled && `box-shadow: 0 0 4px 4px ${vscButtonBackground};`} + } +`; + +export const Div = styled.div<{ + color: string; + disabled: boolean; + hovered: boolean; + selected: boolean; +}>` + border: 1px solid ${lightGray}; + border-radius: ${defaultBorderRadius}; + transition: all 0.5s; + padding-left: 16px; + padding-right: 16px; + + ${(props) => + props.disabled + ? ` + opacity: 0.5; + ` + : props.hovered || props.selected + ? ` + border: 1px solid ${props.color}; + background-color: ${props.color}22; + cursor: pointer;` + : ""} + + ${(props) => + props.selected + ? ` + box-shadow: 0 0 4px 0px ${props.color}; + ` + : ""} +`; diff --git a/gui/src/pages/onboarding/existingUserOnboarding.tsx b/gui/src/pages/onboarding/existingUserOnboarding.tsx new file mode 100644 index 000000000..d7670f794 --- /dev/null +++ b/gui/src/pages/onboarding/existingUserOnboarding.tsx @@ -0,0 +1,149 @@ +import { useState } from "react"; +import { useNavigate } from "react-router-dom"; +import styled from "styled-components"; +import { greenButtonColor } from "../../components"; +import StyledMarkdownPreview from "../../components/markdown/StyledMarkdownPreview"; +import { postToIde } from "../../util/ide"; +import { setLocalStorage } from "../../util/localStorage"; +import { Div, StyledButton } from "./components"; + +const TopDiv = styled.div` + overflow-y: scroll; + + scrollbar-width: none; /* Firefox */ + + /* Hide scrollbar for Chrome, Safari and Opera */ + &::-webkit-scrollbar { + display: none; + } + + height: 100%; +`; + +function ExistingUserOnboarding() { + const navigate = useNavigate(); + + const [hovered1, setHovered1] = useState(false); + const [hovered2, setHovered2] = useState(false); + + const [selected, setSelected] = useState(-1); + + return ( + +
+

Use Improved Models?

+

+ Continue now integrates with higher quality models for autocomplete + and codebase retrieval. +

+
{ + setSelected(0); + }} + onMouseEnter={() => setHovered1(true)} + onMouseLeave={() => setHovered1(false)} + > +

🔒 Keep existing setup

+

+ Continue using fully local autocomplete + embeddings, or whichever + options you have configured. +

+
+

+
{ + setSelected(1); + }} + onMouseEnter={() => setHovered2(true)} + onMouseLeave={() => setHovered2(false)} + > +

✨ Use optimized models

+

+ Continue's autocomplete and codebase retrieval will feel + significantly improved. API calls are made to Fireworks/Voyage, but + code is only ever stored locally. +

+
+ {selected === 1 && ( + <> + + + )} +
+
+ { + postToIde("completeOnboarding", { + mode: ["localExistingUser", "optimizedExistingUser"][ + selected + ] as any, + }); + postToIde("openConfigJson", undefined); + setLocalStorage("onboardingComplete", true); + postToIde("index/forceReIndex", undefined); + navigate("/"); + }} + > + Continue + +
+
+
+ ); +} + +export default ExistingUserOnboarding; diff --git a/gui/src/pages/onboarding/onboarding.tsx b/gui/src/pages/onboarding/onboarding.tsx new file mode 100644 index 000000000..20bbdbd46 --- /dev/null +++ b/gui/src/pages/onboarding/onboarding.tsx @@ -0,0 +1,131 @@ +import { useState } from "react"; +import { useNavigate } from "react-router-dom"; +import { greenButtonColor } from "../../components"; +import { postToIde } from "../../util/ide"; +import { setLocalStorage } from "../../util/localStorage"; +import { Div, StyledButton } from "./components"; + +function Onboarding() { + const navigate = useNavigate(); + + const [hovered1, setHovered1] = useState(false); + const [hovered2, setHovered2] = useState(false); + const [hovered3, setHovered3] = useState(false); + + const [selected, setSelected] = useState(-1); + + return ( +
+

Welcome to Continue

+

+ Let's find the setup that works best for you +

+
{ + setSelected(0); + }} + onMouseEnter={() => setHovered1(true)} + onMouseLeave={() => setHovered1(false)} + > +

🔒 Fully local

+

+ No code will leave your computer, but less powerful models are used. + Works with Ollama, LM Studio and others. +

+
+ {selected === 0 && ( +

+ Embeddings: Local sentence-transformers model +
+
+ Autocomplete: Starcoder2 3b (manual setup with Ollama, LM + Studio, etc.) +
+
+ Chat: Manual setup with Ollama, LM Studio, etc. +

+ )} +

+
{ + setSelected(1); + }} + onMouseEnter={() => setHovered2(true)} + onMouseLeave={() => setHovered2(false)} + > +

✨ Optimized

+

+ Use the best available commercial models to index code and answer + questions. Code is still only ever stored locally. +

+
+ {selected === 1 && ( +

+ Embeddings: Voyage Code 2 +
+
+ Autocomplete: Starcoder 7b via Fireworks AI (free trial) +
+
+ Chat: GPT-4, Claude 3, and others (free trial) +

+ )} +

+ {/*

+ + Read the docs + {" "} + to learn more and fully customize Continue by opening config.json. +

*/} +
setHovered3(true)} + onMouseLeave={() => setHovered3(false)} + onClick={() => { + setSelected(2); + postToIde("openConfigJson", undefined); + }} + > +

⚙️ Custom

+

+ + Read the docs + {" "} + to learn more and fully customize Continue by opening config.json. + This can always be done later. +

+
+ +
+
+ { + postToIde("showTutorial", undefined); + postToIde("completeOnboarding", { + mode: ["local", "optimized", "custom"][selected] as any, + }); + setLocalStorage("onboardingComplete", true); + postToIde("index/forceReIndex", undefined); + navigate("/"); + }} + > + Continue + +
+
+ ); +} + +export default Onboarding; diff --git a/gui/src/redux/slices/stateSlice.ts b/gui/src/redux/slices/stateSlice.ts index f151df3bc..1977bb500 100644 --- a/gui/src/redux/slices/stateSlice.ts +++ b/gui/src/redux/slices/stateSlice.ts @@ -168,7 +168,10 @@ export const stateSlice = createSlice({ state.config = config; state.defaultModelTitle = defaultModelTitle; }, - addLogs: (state, { payload }: PayloadAction<[string, string][]>) => { + addPromptCompletionPair: ( + state, + { payload }: PayloadAction<[string, string][]>, + ) => { if (!state.history.length) { return; } @@ -239,7 +242,8 @@ export const stateSlice = createSlice({ contextItems: [], }); - state.contextItems = []; + // https://github.com/continuedev/continue/pull/1021 + // state.contextItems = []; state.active = true; }, initNewActiveMessage: ( @@ -262,7 +266,8 @@ export const stateSlice = createSlice({ }, contextItems: [], }); - state.contextItems = []; + // https://github.com/continuedev/continue/pull/1021 + // state.contextItems = []; state.active = true; }, setMessageAtIndex: ( @@ -480,7 +485,7 @@ export const { setEditingAtIds, setDefaultModel, setConfig, - addLogs, + addPromptCompletionPair, setActive, setEditingContextItemAtIndex, initNewActiveMessage, diff --git a/gui/src/util/ide.ts b/gui/src/util/ide.ts index 912a3dfbf..28e7557fc 100644 --- a/gui/src/util/ide.ts +++ b/gui/src/util/ide.ts @@ -170,7 +170,10 @@ export async function* llmStreamChat( yield { role: "user", content: next.value }; next = await gen.next(); } - return { prompt: next.value?.prompt, completion: next.value?.completion }; + return { + prompt: next.value.content?.prompt, + completion: next.value.content?.completion, + }; } export function appendText(text: string) { diff --git a/gui/src/util/localStorage.ts b/gui/src/util/localStorage.ts new file mode 100644 index 000000000..faddd64f6 --- /dev/null +++ b/gui/src/util/localStorage.ts @@ -0,0 +1,21 @@ +type LocalStorageTypes = { + onboardingComplete: boolean; + mainTextEntryCounter: number; +}; + +export function getLocalStorage( + key: T, +): LocalStorageTypes[T] | undefined { + const value = localStorage.getItem(key); + if (value === null) { + return undefined; + } + return JSON.parse(value); +} + +export function setLocalStorage( + key: T, + value: LocalStorageTypes[T], +): void { + localStorage.setItem(key, JSON.stringify(value)); +} diff --git a/gui/src/util/modelData.ts b/gui/src/util/modelData.ts index 304a11cb2..b4afcc7a9 100644 --- a/gui/src/util/modelData.ts +++ b/gui/src/util/modelData.ts @@ -228,7 +228,20 @@ const mixtralTrial: ModelPackage = { contextLength: 4096, }, icon: "mistral.png", - providerOptions: ["freetrial"], + providerOptions: ["freetrial", "groq"], +}; + +const llama270bChat: ModelPackage = { + title: "Llama2 70b Chat", + description: "The latest Llama model from Meta, fine-tuned for chat", + refUrl: "", + params: { + title: "Llama2-70b", + model: "llama2-70b", + contextLength: 4096, + }, + icon: "meta.png", + providerOptions: ["groq"], }; const llama2Chat: ModelPackage = { @@ -750,6 +763,40 @@ export const PROVIDER_INFO: { [key: string]: ModelInfo } = { return p; }), }, + groq: { + title: "Groq", + provider: "groq", + icon: "groq.png", + description: + "Groq is the fastest LLM provider by a wide margin, using 'LPUs' to serve open-source models at blazing speed.", + longDescription: + "To get started with Groq, obtain an API key from their website [here](https://wow.groq.com/).", + tags: [ + ModelProviderTag["Requires API Key"], + ModelProviderTag["Open-Source"], + ], + collectInputFor: [ + { + inputType: CollectInputType.text, + key: "apiKey", + label: "API Key", + placeholder: "Enter your Groq API key", + required: true, + }, + ], + packages: [ + { ...mixtralTrial, title: "Mixtral" }, + llama270bChat, + { + ...AUTODETECT, + params: { + ...AUTODETECT.params, + title: "Groq", + }, + }, + , + ], + }, palm: { title: "Google Gemini API", provider: "google-palm", @@ -883,6 +930,15 @@ After it's up and running, you can start using Continue.`, packages: osModels, collectInputFor: [...completionParamsInputs], }, + // bedrock: { + // title: "Bedrock", + // provider: "bedrock", + // refPage: "amazon.com", + // description: + // "Bedrock is Amazon's provider of multiple diverse language models.", + // tags: [ModelProviderTag["Requires API Key"]], + // packages: [claude3Sonnet, claude3Haiku], + // }, "openai-aiohttp": { title: "Other OpenAI-compatible API", provider: "openai", diff --git a/install-dependencies.ps1 b/install-dependencies.ps1 index 708cc1d30..0da372e76 100644 --- a/install-dependencies.ps1 +++ b/install-dependencies.ps1 @@ -96,8 +96,8 @@ npm run package Pop-Location -Write-Output "`nInstalling pkg dependencies..." -ForegroundColor White -Push-Location pkg +Write-Output "`nInstalling binary dependencies..." -ForegroundColor White +Push-Location binary npm install npm run build diff --git a/install-dependencies.sh b/install-dependencies.sh index 6964bbdf9..3400e40b6 100755 --- a/install-dependencies.sh +++ b/install-dependencies.sh @@ -27,7 +27,7 @@ npm run package popd -echo "Installing pkg dependencies..." -pushd pkg +echo "Installing binary dependencies..." +pushd binary npm install npm run build \ No newline at end of file diff --git a/package/.gitignore b/package/.gitignore deleted file mode 100644 index 2124e6f6d..000000000 --- a/package/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -bin -data -out \ No newline at end of file diff --git a/package/package-lock.json b/package/package-lock.json deleted file mode 100644 index 82201e04a..000000000 --- a/package/package-lock.json +++ /dev/null @@ -1,2370 +0,0 @@ -{ - "name": "package", - "version": "1.0.0", - "lockfileVersion": 3, - "requires": true, - "packages": { - "": { - "name": "package", - "version": "1.0.0", - "license": "Apache-2.0", - "dependencies": { - "@lancedb/vectordb-darwin-arm64": "^0.4.3", - "vectordb": "^0.4.3" - }, - "bin": { - "package": "out/index.js" - }, - "devDependencies": { - "@vercel/ncc": "^0.38.1", - "esbuild": "^0.19.11", - "pkg": "^5.8.1", - "typescript": "^5.3.3" - } - }, - "node_modules/@75lb/deep-merge": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/@75lb/deep-merge/-/deep-merge-1.1.1.tgz", - "integrity": "sha512-xvgv6pkMGBA6GwdyJbNAnDmfAIR/DfWhrj9jgWh3TY7gRm3KO46x/GPjRg6wJ0nOepwqrNxFfojebh0Df4h4Tw==", - "dependencies": { - "lodash.assignwith": "^4.2.0", - "typical": "^7.1.1" - }, - "engines": { - "node": ">=12.17" - } - }, - "node_modules/@75lb/deep-merge/node_modules/typical": { - "version": "7.1.1", - "resolved": "https://registry.npmjs.org/typical/-/typical-7.1.1.tgz", - "integrity": "sha512-T+tKVNs6Wu7IWiAce5BgMd7OZfNYUndHwc5MknN+UHOudi7sGZzuHdCadllRuqJ3fPtgFtIH9+lt9qRv6lmpfA==", - "engines": { - "node": ">=12.17" - } - }, - "node_modules/@apache-arrow/ts": { - "version": "14.0.2", - "resolved": "https://registry.npmjs.org/@apache-arrow/ts/-/ts-14.0.2.tgz", - "integrity": "sha512-CtwAvLkK0CZv7xsYeCo91ml6PvlfzAmAJZkRYuz2GNBwfYufj5SVi0iuSMwIMkcU/szVwvLdzORSLa5PlF/2ug==", - "dependencies": { - "@types/command-line-args": "5.2.0", - "@types/command-line-usage": "5.0.2", - "@types/node": "20.3.0", - "@types/pad-left": "2.1.1", - "command-line-args": "5.2.1", - "command-line-usage": "7.0.1", - "flatbuffers": "23.5.26", - "json-bignum": "^0.0.3", - "pad-left": "^2.1.0", - "tslib": "^2.5.3" - } - }, - "node_modules/@babel/generator": { - "version": "7.18.2", - "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.18.2.tgz", - "integrity": "sha512-W1lG5vUwFvfMd8HVXqdfbuG7RuaSrTCCD8cl8fP8wOivdbtbIg2Db3IWUcgvfxKbbn6ZBGYRW/Zk1MIwK49mgw==", - "dev": true, - "dependencies": { - "@babel/types": "^7.18.2", - "@jridgewell/gen-mapping": "^0.3.0", - "jsesc": "^2.5.1" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-string-parser": { - "version": "7.23.4", - "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.23.4.tgz", - "integrity": "sha512-803gmbQdqwdf4olxrX4AJyFBV/RTr3rSmOj0rKwesmzlfhYNDEs+/iOcznzpNWlJlIlTJC2QfPFcHB6DlzdVLQ==", - "dev": true, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-validator-identifier": { - "version": "7.22.20", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.22.20.tgz", - "integrity": "sha512-Y4OZ+ytlatR8AI+8KZfKuL5urKp7qey08ha31L8b3BwewJAoJamTzyvxPR/5D+KkdJCGPq/+8TukHBlY10FX9A==", - "dev": true, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/parser": { - "version": "7.18.4", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.18.4.tgz", - "integrity": "sha512-FDge0dFazETFcxGw/EXzOkN8uJp0PC7Qbm+Pe9T+av2zlBpOgunFHkQPPn+eRuClU73JF+98D531UgayY89tow==", - "dev": true, - "bin": { - "parser": "bin/babel-parser.js" - }, - "engines": { - "node": ">=6.0.0" - } - }, - "node_modules/@babel/types": { - "version": "7.19.0", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.19.0.tgz", - "integrity": "sha512-YuGopBq3ke25BVSiS6fgF49Ul9gH1x70Bcr6bqRLjWCkcX8Hre1/5+z+IiWOIerRMSSEfGZVB9z9kyq7wVs9YA==", - "dev": true, - "dependencies": { - "@babel/helper-string-parser": "^7.18.10", - "@babel/helper-validator-identifier": "^7.18.6", - "to-fast-properties": "^2.0.0" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@esbuild/aix-ppc64": { - "version": "0.19.11", - "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.19.11.tgz", - "integrity": "sha512-FnzU0LyE3ySQk7UntJO4+qIiQgI7KoODnZg5xzXIrFJlKd2P2gwHsHY4927xj9y5PJmJSzULiUCWmv7iWnNa7g==", - "cpu": [ - "ppc64" - ], - "dev": true, - "optional": true, - "os": [ - "aix" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/android-arm": { - "version": "0.19.11", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.19.11.tgz", - "integrity": "sha512-5OVapq0ClabvKvQ58Bws8+wkLCV+Rxg7tUVbo9xu034Nm536QTII4YzhaFriQ7rMrorfnFKUsArD2lqKbFY4vw==", - "cpu": [ - "arm" - ], - "dev": true, - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/android-arm64": { - "version": "0.19.11", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.19.11.tgz", - "integrity": "sha512-aiu7K/5JnLj//KOnOfEZ0D90obUkRzDMyqd/wNAUQ34m4YUPVhRZpnqKV9uqDGxT7cToSDnIHsGooyIczu9T+Q==", - "cpu": [ - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/android-x64": { - "version": "0.19.11", - "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.19.11.tgz", - "integrity": "sha512-eccxjlfGw43WYoY9QgB82SgGgDbibcqyDTlk3l3C0jOVHKxrjdc9CTwDUQd0vkvYg5um0OH+GpxYvp39r+IPOg==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/darwin-arm64": { - "version": "0.19.11", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.19.11.tgz", - "integrity": "sha512-ETp87DRWuSt9KdDVkqSoKoLFHYTrkyz2+65fj9nfXsaV3bMhTCjtQfw3y+um88vGRKRiF7erPrh/ZuIdLUIVxQ==", - "cpu": [ - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/darwin-x64": { - "version": "0.19.11", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.19.11.tgz", - "integrity": "sha512-fkFUiS6IUK9WYUO/+22omwetaSNl5/A8giXvQlcinLIjVkxwTLSktbF5f/kJMftM2MJp9+fXqZ5ezS7+SALp4g==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/freebsd-arm64": { - "version": "0.19.11", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.19.11.tgz", - "integrity": "sha512-lhoSp5K6bxKRNdXUtHoNc5HhbXVCS8V0iZmDvyWvYq9S5WSfTIHU2UGjcGt7UeS6iEYp9eeymIl5mJBn0yiuxA==", - "cpu": [ - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "freebsd" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/freebsd-x64": { - "version": "0.19.11", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.19.11.tgz", - "integrity": "sha512-JkUqn44AffGXitVI6/AbQdoYAq0TEullFdqcMY/PCUZ36xJ9ZJRtQabzMA+Vi7r78+25ZIBosLTOKnUXBSi1Kw==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "freebsd" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/linux-arm": { - "version": "0.19.11", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.19.11.tgz", - "integrity": "sha512-3CRkr9+vCV2XJbjwgzjPtO8T0SZUmRZla+UL1jw+XqHZPkPgZiyWvbDvl9rqAN8Zl7qJF0O/9ycMtjU67HN9/Q==", - "cpu": [ - "arm" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/linux-arm64": { - "version": "0.19.11", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.19.11.tgz", - "integrity": "sha512-LneLg3ypEeveBSMuoa0kwMpCGmpu8XQUh+mL8XXwoYZ6Be2qBnVtcDI5azSvh7vioMDhoJFZzp9GWp9IWpYoUg==", - "cpu": [ - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/linux-ia32": { - "version": "0.19.11", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.19.11.tgz", - "integrity": "sha512-caHy++CsD8Bgq2V5CodbJjFPEiDPq8JJmBdeyZ8GWVQMjRD0sU548nNdwPNvKjVpamYYVL40AORekgfIubwHoA==", - "cpu": [ - "ia32" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/linux-loong64": { - "version": "0.19.11", - "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.19.11.tgz", - "integrity": "sha512-ppZSSLVpPrwHccvC6nQVZaSHlFsvCQyjnvirnVjbKSHuE5N24Yl8F3UwYUUR1UEPaFObGD2tSvVKbvR+uT1Nrg==", - "cpu": [ - "loong64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/linux-mips64el": { - "version": "0.19.11", - "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.19.11.tgz", - "integrity": "sha512-B5x9j0OgjG+v1dF2DkH34lr+7Gmv0kzX6/V0afF41FkPMMqaQ77pH7CrhWeR22aEeHKaeZVtZ6yFwlxOKPVFyg==", - "cpu": [ - "mips64el" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/linux-ppc64": { - "version": "0.19.11", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.19.11.tgz", - "integrity": "sha512-MHrZYLeCG8vXblMetWyttkdVRjQlQUb/oMgBNurVEnhj4YWOr4G5lmBfZjHYQHHN0g6yDmCAQRR8MUHldvvRDA==", - "cpu": [ - "ppc64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/linux-riscv64": { - "version": "0.19.11", - "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.19.11.tgz", - "integrity": "sha512-f3DY++t94uVg141dozDu4CCUkYW+09rWtaWfnb3bqe4w5NqmZd6nPVBm+qbz7WaHZCoqXqHz5p6CM6qv3qnSSQ==", - "cpu": [ - "riscv64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/linux-s390x": { - "version": "0.19.11", - "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.19.11.tgz", - "integrity": "sha512-A5xdUoyWJHMMlcSMcPGVLzYzpcY8QP1RtYzX5/bS4dvjBGVxdhuiYyFwp7z74ocV7WDc0n1harxmpq2ePOjI0Q==", - "cpu": [ - "s390x" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/linux-x64": { - "version": "0.19.11", - "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.19.11.tgz", - "integrity": "sha512-grbyMlVCvJSfxFQUndw5mCtWs5LO1gUlwP4CDi4iJBbVpZcqLVT29FxgGuBJGSzyOxotFG4LoO5X+M1350zmPA==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/netbsd-x64": { - "version": "0.19.11", - "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.19.11.tgz", - "integrity": "sha512-13jvrQZJc3P230OhU8xgwUnDeuC/9egsjTkXN49b3GcS5BKvJqZn86aGM8W9pd14Kd+u7HuFBMVtrNGhh6fHEQ==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "netbsd" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/openbsd-x64": { - "version": "0.19.11", - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.19.11.tgz", - "integrity": "sha512-ysyOGZuTp6SNKPE11INDUeFVVQFrhcNDVUgSQVDzqsqX38DjhPEPATpid04LCoUr2WXhQTEZ8ct/EgJCUDpyNw==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "openbsd" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/sunos-x64": { - "version": "0.19.11", - "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.19.11.tgz", - "integrity": "sha512-Hf+Sad9nVwvtxy4DXCZQqLpgmRTQqyFyhT3bZ4F2XlJCjxGmRFF0Shwn9rzhOYRB61w9VMXUkxlBy56dk9JJiQ==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "sunos" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/win32-arm64": { - "version": "0.19.11", - "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.19.11.tgz", - "integrity": "sha512-0P58Sbi0LctOMOQbpEOvOL44Ne0sqbS0XWHMvvrg6NE5jQ1xguCSSw9jQeUk2lfrXYsKDdOe6K+oZiwKPilYPQ==", - "cpu": [ - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/win32-ia32": { - "version": "0.19.11", - "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.19.11.tgz", - "integrity": "sha512-6YOrWS+sDJDmshdBIQU+Uoyh7pQKrdykdefC1avn76ss5c+RN6gut3LZA4E2cH5xUEp5/cA0+YxRaVtRAb0xBg==", - "cpu": [ - "ia32" - ], - "dev": true, - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/win32-x64": { - "version": "0.19.11", - "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.19.11.tgz", - "integrity": "sha512-vfkhltrjCAb603XaFhqhAF4LGDi2M4OrCRrFusyQ+iTLQ/o60QQXxc9cZC/FFpihBI9N1Grn6SMKVJ4KP7Fuiw==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@jridgewell/gen-mapping": { - "version": "0.3.3", - "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.3.tgz", - "integrity": "sha512-HLhSWOLRi875zjjMG/r+Nv0oCW8umGb0BgEhyX3dDX3egwZtB8PqLnjz3yedt8R5StBrzcg4aBpnh8UA9D1BoQ==", - "dev": true, - "dependencies": { - "@jridgewell/set-array": "^1.0.1", - "@jridgewell/sourcemap-codec": "^1.4.10", - "@jridgewell/trace-mapping": "^0.3.9" - }, - "engines": { - "node": ">=6.0.0" - } - }, - "node_modules/@jridgewell/resolve-uri": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.1.tgz", - "integrity": "sha512-dSYZh7HhCDtCKm4QakX0xFpsRDqjjtZf/kjI/v3T3Nwt5r8/qz/M19F9ySyOqU94SXBmeG9ttTul+YnR4LOxFA==", - "dev": true, - "engines": { - "node": ">=6.0.0" - } - }, - "node_modules/@jridgewell/set-array": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.1.2.tgz", - "integrity": "sha512-xnkseuNADM0gt2bs+BvhO0p78Mk762YnZdsuzFV018NoG1Sj1SCQvpSqa7XUaTam5vAGasABV9qXASMKnFMwMw==", - "dev": true, - "engines": { - "node": ">=6.0.0" - } - }, - "node_modules/@jridgewell/sourcemap-codec": { - "version": "1.4.15", - "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz", - "integrity": "sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==", - "dev": true - }, - "node_modules/@jridgewell/trace-mapping": { - "version": "0.3.21", - "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.21.tgz", - "integrity": "sha512-SRfKmRe1KvYnxjEMtxEr+J4HIeMX5YBg/qhRHpxEIGjhX1rshcHlnFUE9K0GazhVKWM7B+nARSkV8LuvJdJ5/g==", - "dev": true, - "dependencies": { - "@jridgewell/resolve-uri": "^3.1.0", - "@jridgewell/sourcemap-codec": "^1.4.14" - } - }, - "node_modules/@lancedb/vectordb-darwin-arm64": { - "version": "0.4.3", - "resolved": "https://registry.npmjs.org/@lancedb/vectordb-darwin-arm64/-/vectordb-darwin-arm64-0.4.3.tgz", - "integrity": "sha512-47CvvSaV1EdUsFEpXUJApTk+hMzAhCxVizipCFUlXCgcmzpCDL86wNgJij/X9a+j6zADhIX//Lsu0qd/an/Bpw==", - "cpu": [ - "arm64" - ], - "os": [ - "darwin" - ] - }, - "node_modules/@lancedb/vectordb-darwin-x64": { - "version": "0.4.3", - "resolved": "https://registry.npmjs.org/@lancedb/vectordb-darwin-x64/-/vectordb-darwin-x64-0.4.3.tgz", - "integrity": "sha512-UlZZv8CmJIuRJNJG+Y1VmFsGyPR8W/72Q5EwgMMsSES6zpMQ9pNdBDWhL3UGX6nMRgnbprkwYiWJ3xHhJvtqtw==", - "cpu": [ - "x64" - ], - "optional": true, - "os": [ - "darwin" - ] - }, - "node_modules/@lancedb/vectordb-linux-arm64-gnu": { - "version": "0.4.3", - "resolved": "https://registry.npmjs.org/@lancedb/vectordb-linux-arm64-gnu/-/vectordb-linux-arm64-gnu-0.4.3.tgz", - "integrity": "sha512-L6NVJr/lKEd8+904FzZNpT8BGQMs2cHNYbGJMIaVvGnMiIJgKAFKtOyGtdDjoe1xRZoEw21yjRGksGbnRO5wHQ==", - "cpu": [ - "arm64" - ], - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@lancedb/vectordb-linux-x64-gnu": { - "version": "0.4.3", - "resolved": "https://registry.npmjs.org/@lancedb/vectordb-linux-x64-gnu/-/vectordb-linux-x64-gnu-0.4.3.tgz", - "integrity": "sha512-OBx3WF3pK0xNfFJeErmuD9R2QWLa3XdeZspyTsIrQmBDeKj3HKh8y7Scpx4NH5Y09+9JNqRRKRZN7OqWTYhITg==", - "cpu": [ - "x64" - ], - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@lancedb/vectordb-win32-x64-msvc": { - "version": "0.4.3", - "resolved": "https://registry.npmjs.org/@lancedb/vectordb-win32-x64-msvc/-/vectordb-win32-x64-msvc-0.4.3.tgz", - "integrity": "sha512-n9IvR81NXZKnSN91mrgeXbEyCiGM+YLJpOgbdHoEtMP04VDnS+iSU4jGOtQBKErvWeCJQaGFQ9qzdcVchpRGyw==", - "cpu": [ - "x64" - ], - "optional": true, - "os": [ - "win32" - ] - }, - "node_modules/@neon-rs/load": { - "version": "0.0.74", - "resolved": "https://registry.npmjs.org/@neon-rs/load/-/load-0.0.74.tgz", - "integrity": "sha512-/cPZD907UNz55yrc/ud4wDgQKtU1TvkD9jeqZWG6J4IMmZkp6zgjkQcKA8UvpkZlcpPHvc8J17sGzLFbP/LUYg==" - }, - "node_modules/@nodelib/fs.scandir": { - "version": "2.1.5", - "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", - "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", - "dev": true, - "dependencies": { - "@nodelib/fs.stat": "2.0.5", - "run-parallel": "^1.1.9" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/@nodelib/fs.stat": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz", - "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==", - "dev": true, - "engines": { - "node": ">= 8" - } - }, - "node_modules/@nodelib/fs.walk": { - "version": "1.2.8", - "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz", - "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", - "dev": true, - "dependencies": { - "@nodelib/fs.scandir": "2.1.5", - "fastq": "^1.6.0" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/@types/command-line-args": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/@types/command-line-args/-/command-line-args-5.2.0.tgz", - "integrity": "sha512-UuKzKpJJ/Ief6ufIaIzr3A/0XnluX7RvFgwkV89Yzvm77wCh1kFaFmqN8XEnGcN62EuHdedQjEMb8mYxFLGPyA==" - }, - "node_modules/@types/command-line-usage": { - "version": "5.0.2", - "resolved": "https://registry.npmjs.org/@types/command-line-usage/-/command-line-usage-5.0.2.tgz", - "integrity": "sha512-n7RlEEJ+4x4TS7ZQddTmNSxP+zziEG0TNsMfiRIxcIVXt71ENJ9ojeXmGO3wPoTdn7pJcU2xc3CJYMktNT6DPg==" - }, - "node_modules/@types/node": { - "version": "20.3.0", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.3.0.tgz", - "integrity": "sha512-cumHmIAf6On83X7yP+LrsEyUOf/YlociZelmpRYaGFydoaPdxdt80MAbu6vWerQT2COCp2nPvHdsbD7tHn/YlQ==" - }, - "node_modules/@types/pad-left": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/@types/pad-left/-/pad-left-2.1.1.tgz", - "integrity": "sha512-Xd22WCRBydkGSApl5Bw0PhAOHKSVjNL3E3AwzKaps96IMraPqy5BvZIsBVK6JLwdybUzjHnuWVwpDd0JjTfHXA==" - }, - "node_modules/@vercel/ncc": { - "version": "0.38.1", - "resolved": "https://registry.npmjs.org/@vercel/ncc/-/ncc-0.38.1.tgz", - "integrity": "sha512-IBBb+iI2NLu4VQn3Vwldyi2QwaXt5+hTyh58ggAMoCGE6DJmPvwL3KPBWcJl1m9LYPChBLE980Jw+CS4Wokqxw==", - "dev": true, - "bin": { - "ncc": "dist/ncc/cli.js" - } - }, - "node_modules/agent-base": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz", - "integrity": "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==", - "dev": true, - "dependencies": { - "debug": "4" - }, - "engines": { - "node": ">= 6.0.0" - } - }, - "node_modules/ansi-regex": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", - "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/apache-arrow": { - "version": "14.0.2", - "resolved": "https://registry.npmjs.org/apache-arrow/-/apache-arrow-14.0.2.tgz", - "integrity": "sha512-EBO2xJN36/XoY81nhLcwCJgFwkboDZeyNQ+OPsG7bCoQjc2BT0aTyH/MR6SrL+LirSNz+cYqjGRlupMMlP1aEg==", - "dependencies": { - "@types/command-line-args": "5.2.0", - "@types/command-line-usage": "5.0.2", - "@types/node": "20.3.0", - "@types/pad-left": "2.1.1", - "command-line-args": "5.2.1", - "command-line-usage": "7.0.1", - "flatbuffers": "23.5.26", - "json-bignum": "^0.0.3", - "pad-left": "^2.1.0", - "tslib": "^2.5.3" - }, - "bin": { - "arrow2csv": "bin/arrow2csv.js" - } - }, - "node_modules/array-back": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/array-back/-/array-back-3.1.0.tgz", - "integrity": "sha512-TkuxA4UCOvxuDK6NZYXCalszEzj+TLszyASooky+i742l9TqsOdYCMJJupxRic61hwquNtppB3hgcuq9SVSH1Q==", - "engines": { - "node": ">=6" - } - }, - "node_modules/array-union": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz", - "integrity": "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/asynckit": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", - "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==" - }, - "node_modules/at-least-node": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/at-least-node/-/at-least-node-1.0.0.tgz", - "integrity": "sha512-+q/t7Ekv1EDY2l6Gda6LLiX14rU9TV20Wa3ofeQmwPFZbOMo9DXrLbOjFaaclkXKWidIaopwAObQDqwWtGUjqg==", - "dev": true, - "engines": { - "node": ">= 4.0.0" - } - }, - "node_modules/axios": { - "version": "1.6.5", - "resolved": "https://registry.npmjs.org/axios/-/axios-1.6.5.tgz", - "integrity": "sha512-Ii012v05KEVuUoFWmMW/UQv9aRIc3ZwkWDcM+h5Il8izZCtRVpDUfwpoFf7eOtajT3QiGR4yDUx7lPqHJULgbg==", - "dependencies": { - "follow-redirects": "^1.15.4", - "form-data": "^4.0.0", - "proxy-from-env": "^1.1.0" - } - }, - "node_modules/base64-js": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", - "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ] - }, - "node_modules/bl": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/bl/-/bl-4.1.0.tgz", - "integrity": "sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w==", - "dev": true, - "dependencies": { - "buffer": "^5.5.0", - "inherits": "^2.0.4", - "readable-stream": "^3.4.0" - } - }, - "node_modules/bl/node_modules/readable-stream": { - "version": "3.6.2", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", - "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", - "dev": true, - "dependencies": { - "inherits": "^2.0.3", - "string_decoder": "^1.1.1", - "util-deprecate": "^1.0.1" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/braces": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", - "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", - "dev": true, - "dependencies": { - "fill-range": "^7.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/buffer": { - "version": "5.7.1", - "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz", - "integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "dependencies": { - "base64-js": "^1.3.1", - "ieee754": "^1.1.13" - } - }, - "node_modules/chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" - } - }, - "node_modules/chalk-template": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/chalk-template/-/chalk-template-0.4.0.tgz", - "integrity": "sha512-/ghrgmhfY8RaSdeo43hNXxpoHAtxdbskUHjPpfqUWGttFgycUhYPGx3YZBCnUCvOa7Doivn1IZec3DEGFoMgLg==", - "dependencies": { - "chalk": "^4.1.2" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/chalk/chalk-template?sponsor=1" - } - }, - "node_modules/chownr": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.4.tgz", - "integrity": "sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg==", - "dev": true - }, - "node_modules/cliui": { - "version": "7.0.4", - "resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz", - "integrity": "sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==", - "dev": true, - "dependencies": { - "string-width": "^4.2.0", - "strip-ansi": "^6.0.0", - "wrap-ansi": "^7.0.0" - } - }, - "node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" - }, - "node_modules/combined-stream": { - "version": "1.0.8", - "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", - "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", - "dependencies": { - "delayed-stream": "~1.0.0" - }, - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/command-line-args": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/command-line-args/-/command-line-args-5.2.1.tgz", - "integrity": "sha512-H4UfQhZyakIjC74I9d34fGYDwk3XpSr17QhEd0Q3I9Xq1CETHo4Hcuo87WyWHpAF1aSLjLRf5lD9ZGX2qStUvg==", - "dependencies": { - "array-back": "^3.1.0", - "find-replace": "^3.0.0", - "lodash.camelcase": "^4.3.0", - "typical": "^4.0.0" - }, - "engines": { - "node": ">=4.0.0" - } - }, - "node_modules/command-line-usage": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/command-line-usage/-/command-line-usage-7.0.1.tgz", - "integrity": "sha512-NCyznE//MuTjwi3y84QVUGEOT+P5oto1e1Pk/jFPVdPPfsG03qpTIl3yw6etR+v73d0lXsoojRpvbru2sqePxQ==", - "dependencies": { - "array-back": "^6.2.2", - "chalk-template": "^0.4.0", - "table-layout": "^3.0.0", - "typical": "^7.1.1" - }, - "engines": { - "node": ">=12.20.0" - } - }, - "node_modules/command-line-usage/node_modules/array-back": { - "version": "6.2.2", - "resolved": "https://registry.npmjs.org/array-back/-/array-back-6.2.2.tgz", - "integrity": "sha512-gUAZ7HPyb4SJczXAMUXMGAvI976JoK3qEx9v1FTmeYuJj0IBiaKttG1ydtGKdkfqWkIkouke7nG8ufGy77+Cvw==", - "engines": { - "node": ">=12.17" - } - }, - "node_modules/command-line-usage/node_modules/typical": { - "version": "7.1.1", - "resolved": "https://registry.npmjs.org/typical/-/typical-7.1.1.tgz", - "integrity": "sha512-T+tKVNs6Wu7IWiAce5BgMd7OZfNYUndHwc5MknN+UHOudi7sGZzuHdCadllRuqJ3fPtgFtIH9+lt9qRv6lmpfA==", - "engines": { - "node": ">=12.17" - } - }, - "node_modules/core-util-is": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz", - "integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==", - "dev": true - }, - "node_modules/debug": { - "version": "4.3.4", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", - "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", - "dev": true, - "dependencies": { - "ms": "2.1.2" - }, - "engines": { - "node": ">=6.0" - }, - "peerDependenciesMeta": { - "supports-color": { - "optional": true - } - } - }, - "node_modules/decompress-response": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-6.0.0.tgz", - "integrity": "sha512-aW35yZM6Bb/4oJlZncMH2LCoZtJXTRxES17vE3hoRiowU2kWHaJKFkSBDnDR+cm9J+9QhXmREyIfv0pji9ejCQ==", - "dev": true, - "dependencies": { - "mimic-response": "^3.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/deep-extend": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz", - "integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==", - "dev": true, - "engines": { - "node": ">=4.0.0" - } - }, - "node_modules/delayed-stream": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", - "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==", - "engines": { - "node": ">=0.4.0" - } - }, - "node_modules/detect-libc": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.0.2.tgz", - "integrity": "sha512-UX6sGumvvqSaXgdKGUsgZWqcUyIXZ/vZTrlRT/iobiKhGL0zL4d3osHj3uqllWJK+i+sixDS/3COVEOFbupFyw==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/dir-glob": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz", - "integrity": "sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==", - "dev": true, - "dependencies": { - "path-type": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/emoji-regex": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", - "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", - "dev": true - }, - "node_modules/end-of-stream": { - "version": "1.4.4", - "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz", - "integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==", - "dev": true, - "dependencies": { - "once": "^1.4.0" - } - }, - "node_modules/esbuild": { - "version": "0.19.11", - "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.19.11.tgz", - "integrity": "sha512-HJ96Hev2hX/6i5cDVwcqiJBBtuo9+FeIJOtZ9W1kA5M6AMJRHUZlpYZ1/SbEwtO0ioNAW8rUooVpC/WehY2SfA==", - "dev": true, - "hasInstallScript": true, - "bin": { - "esbuild": "bin/esbuild" - }, - "engines": { - "node": ">=12" - }, - "optionalDependencies": { - "@esbuild/aix-ppc64": "0.19.11", - "@esbuild/android-arm": "0.19.11", - "@esbuild/android-arm64": "0.19.11", - "@esbuild/android-x64": "0.19.11", - "@esbuild/darwin-arm64": "0.19.11", - "@esbuild/darwin-x64": "0.19.11", - "@esbuild/freebsd-arm64": "0.19.11", - "@esbuild/freebsd-x64": "0.19.11", - "@esbuild/linux-arm": "0.19.11", - "@esbuild/linux-arm64": "0.19.11", - "@esbuild/linux-ia32": "0.19.11", - "@esbuild/linux-loong64": "0.19.11", - "@esbuild/linux-mips64el": "0.19.11", - "@esbuild/linux-ppc64": "0.19.11", - "@esbuild/linux-riscv64": "0.19.11", - "@esbuild/linux-s390x": "0.19.11", - "@esbuild/linux-x64": "0.19.11", - "@esbuild/netbsd-x64": "0.19.11", - "@esbuild/openbsd-x64": "0.19.11", - "@esbuild/sunos-x64": "0.19.11", - "@esbuild/win32-arm64": "0.19.11", - "@esbuild/win32-ia32": "0.19.11", - "@esbuild/win32-x64": "0.19.11" - } - }, - "node_modules/escalade": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", - "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==", - "dev": true, - "engines": { - "node": ">=6" - } - }, - "node_modules/expand-template": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/expand-template/-/expand-template-2.0.3.tgz", - "integrity": "sha512-XYfuKMvj4O35f/pOXLObndIRvyQ+/+6AhODh+OKWj9S9498pHHn/IMszH+gt0fBCRWMNfk1ZSp5x3AifmnI2vg==", - "dev": true, - "engines": { - "node": ">=6" - } - }, - "node_modules/fast-glob": { - "version": "3.3.2", - "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.2.tgz", - "integrity": "sha512-oX2ruAFQwf/Orj8m737Y5adxDQO0LAB7/S5MnxCdTNDd4p6BsyIVsv9JQsATbTSq8KHRpLwIHbVlUNatxd+1Ow==", - "dev": true, - "dependencies": { - "@nodelib/fs.stat": "^2.0.2", - "@nodelib/fs.walk": "^1.2.3", - "glob-parent": "^5.1.2", - "merge2": "^1.3.0", - "micromatch": "^4.0.4" - }, - "engines": { - "node": ">=8.6.0" - } - }, - "node_modules/fastq": { - "version": "1.16.0", - "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.16.0.tgz", - "integrity": "sha512-ifCoaXsDrsdkWTtiNJX5uzHDsrck5TzfKKDcuFFTIrrc/BS076qgEIfoIy1VeZqViznfKiysPYTh/QeHtnIsYA==", - "dev": true, - "dependencies": { - "reusify": "^1.0.4" - } - }, - "node_modules/fill-range": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", - "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", - "dev": true, - "dependencies": { - "to-regex-range": "^5.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/find-replace": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/find-replace/-/find-replace-3.0.0.tgz", - "integrity": "sha512-6Tb2myMioCAgv5kfvP5/PkZZ/ntTpVK39fHY7WkWBgvbeE+VHd/tZuZ4mrC+bxh4cfOZeYKVPaJIZtZXV7GNCQ==", - "dependencies": { - "array-back": "^3.0.1" - }, - "engines": { - "node": ">=4.0.0" - } - }, - "node_modules/flatbuffers": { - "version": "23.5.26", - "resolved": "https://registry.npmjs.org/flatbuffers/-/flatbuffers-23.5.26.tgz", - "integrity": "sha512-vE+SI9vrJDwi1oETtTIFldC/o9GsVKRM+s6EL0nQgxXlYV1Vc4Tk30hj4xGICftInKQKj1F3up2n8UbIVobISQ==" - }, - "node_modules/follow-redirects": { - "version": "1.15.5", - "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.5.tgz", - "integrity": "sha512-vSFWUON1B+yAw1VN4xMfxgn5fTUiaOzAJCKBwIIgT/+7CuGy9+r+5gITvP62j3RmaD5Ph65UaERdOSRGUzZtgw==", - "funding": [ - { - "type": "individual", - "url": "https://github.com/sponsors/RubenVerborgh" - } - ], - "engines": { - "node": ">=4.0" - }, - "peerDependenciesMeta": { - "debug": { - "optional": true - } - } - }, - "node_modules/form-data": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", - "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", - "dependencies": { - "asynckit": "^0.4.0", - "combined-stream": "^1.0.8", - "mime-types": "^2.1.12" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/from2": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/from2/-/from2-2.3.0.tgz", - "integrity": "sha512-OMcX/4IC/uqEPVgGeyfN22LJk6AZrMkRZHxcHBMBvHScDGgwTm2GT2Wkgtocyd3JfZffjj2kYUDXXII0Fk9W0g==", - "dev": true, - "dependencies": { - "inherits": "^2.0.1", - "readable-stream": "^2.0.0" - } - }, - "node_modules/fs-constants": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/fs-constants/-/fs-constants-1.0.0.tgz", - "integrity": "sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow==", - "dev": true - }, - "node_modules/fs-extra": { - "version": "9.1.0", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-9.1.0.tgz", - "integrity": "sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ==", - "dev": true, - "dependencies": { - "at-least-node": "^1.0.0", - "graceful-fs": "^4.2.0", - "jsonfile": "^6.0.1", - "universalify": "^2.0.0" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/function-bind": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", - "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", - "dev": true, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/get-caller-file": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", - "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", - "dev": true, - "engines": { - "node": "6.* || 8.* || >= 10.*" - } - }, - "node_modules/github-from-package": { - "version": "0.0.0", - "resolved": "https://registry.npmjs.org/github-from-package/-/github-from-package-0.0.0.tgz", - "integrity": "sha512-SyHy3T1v2NUXn29OsWdxmK6RwHD+vkj3v8en8AOBZ1wBQ/hCAQ5bAQTD02kW4W9tUp/3Qh6J8r9EvntiyCmOOw==", - "dev": true - }, - "node_modules/glob-parent": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", - "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", - "dev": true, - "dependencies": { - "is-glob": "^4.0.1" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/globby": { - "version": "11.1.0", - "resolved": "https://registry.npmjs.org/globby/-/globby-11.1.0.tgz", - "integrity": "sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g==", - "dev": true, - "dependencies": { - "array-union": "^2.1.0", - "dir-glob": "^3.0.1", - "fast-glob": "^3.2.9", - "ignore": "^5.2.0", - "merge2": "^1.4.1", - "slash": "^3.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/graceful-fs": { - "version": "4.2.11", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", - "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==", - "dev": true - }, - "node_modules/has": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/has/-/has-1.0.4.tgz", - "integrity": "sha512-qdSAmqLF6209RFj4VVItywPMbm3vWylknmB3nvNiUIs72xAimcM8nVYxYr7ncvZq5qzk9MKIZR8ijqD/1QuYjQ==", - "dev": true, - "engines": { - "node": ">= 0.4.0" - } - }, - "node_modules/has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "engines": { - "node": ">=8" - } - }, - "node_modules/hasown": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.0.tgz", - "integrity": "sha512-vUptKVTpIJhcczKBbgnS+RtcuYMB8+oNzPK2/Hp3hanz8JmpATdmmgLgSaadVREkDm+e2giHwY3ZRkyjSIDDFA==", - "dev": true, - "dependencies": { - "function-bind": "^1.1.2" - }, - "engines": { - "node": ">= 0.4" - } - }, - "node_modules/https-proxy-agent": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz", - "integrity": "sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA==", - "dev": true, - "dependencies": { - "agent-base": "6", - "debug": "4" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/ieee754": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", - "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ] - }, - "node_modules/ignore": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.0.tgz", - "integrity": "sha512-g7dmpshy+gD7mh88OC9NwSGTKoc3kyLAZQRU1mt53Aw/vnvfXnbC+F/7F7QoYVKbV+KNvJx8wArewKy1vXMtlg==", - "dev": true, - "engines": { - "node": ">= 4" - } - }, - "node_modules/inherits": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", - "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", - "dev": true - }, - "node_modules/ini": { - "version": "1.3.8", - "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.8.tgz", - "integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==", - "dev": true - }, - "node_modules/into-stream": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/into-stream/-/into-stream-6.0.0.tgz", - "integrity": "sha512-XHbaOAvP+uFKUFsOgoNPRjLkwB+I22JFPFe5OjTkQ0nwgj6+pSjb4NmB6VMxaPshLiOf+zcpOCBQuLwC1KHhZA==", - "dev": true, - "dependencies": { - "from2": "^2.3.0", - "p-is-promise": "^3.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/is-core-module": { - "version": "2.9.0", - "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.9.0.tgz", - "integrity": "sha512-+5FPy5PnwmO3lvfMb0AsoPaBG+5KHUI0wYFXOtYPnVVVspTFUuMZNfNaNVRt3FZadstu2c8x23vykRW/NBoU6A==", - "dev": true, - "dependencies": { - "has": "^1.0.3" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/is-extglob": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", - "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/is-fullwidth-code-point": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", - "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/is-glob": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", - "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", - "dev": true, - "dependencies": { - "is-extglob": "^2.1.1" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/is-number": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", - "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", - "dev": true, - "engines": { - "node": ">=0.12.0" - } - }, - "node_modules/isarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==", - "dev": true - }, - "node_modules/jsesc": { - "version": "2.5.2", - "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-2.5.2.tgz", - "integrity": "sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==", - "dev": true, - "bin": { - "jsesc": "bin/jsesc" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/json-bignum": { - "version": "0.0.3", - "resolved": "https://registry.npmjs.org/json-bignum/-/json-bignum-0.0.3.tgz", - "integrity": "sha512-2WHyXj3OfHSgNyuzDbSxI1w2jgw5gkWSWhS7Qg4bWXx1nLk3jnbwfUeS0PSba3IzpTUWdHxBieELUzXRjQB2zg==", - "engines": { - "node": ">=0.8" - } - }, - "node_modules/jsonfile": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz", - "integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==", - "dev": true, - "dependencies": { - "universalify": "^2.0.0" - }, - "optionalDependencies": { - "graceful-fs": "^4.1.6" - } - }, - "node_modules/lodash.assignwith": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/lodash.assignwith/-/lodash.assignwith-4.2.0.tgz", - "integrity": "sha512-ZznplvbvtjK2gMvnQ1BR/zqPFZmS6jbK4p+6Up4xcRYA7yMIwxHCfbTcrYxXKzzqLsQ05eJPVznEW3tuwV7k1g==" - }, - "node_modules/lodash.camelcase": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/lodash.camelcase/-/lodash.camelcase-4.3.0.tgz", - "integrity": "sha512-TwuEnCnxbc3rAvhf/LbG7tJUDzhqXyFnv3dtzLOPgCG/hODL7WFnsbwktkD7yUV0RrreP/l1PALq/YSg6VvjlA==" - }, - "node_modules/lru-cache": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", - "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", - "dev": true, - "dependencies": { - "yallist": "^4.0.0" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/merge2": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", - "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", - "dev": true, - "engines": { - "node": ">= 8" - } - }, - "node_modules/micromatch": { - "version": "4.0.5", - "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.5.tgz", - "integrity": "sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==", - "dev": true, - "dependencies": { - "braces": "^3.0.2", - "picomatch": "^2.3.1" - }, - "engines": { - "node": ">=8.6" - } - }, - "node_modules/mime-db": { - "version": "1.52.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", - "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/mime-types": { - "version": "2.1.35", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", - "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", - "dependencies": { - "mime-db": "1.52.0" - }, - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/mimic-response": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-3.1.0.tgz", - "integrity": "sha512-z0yWI+4FDrrweS8Zmt4Ej5HdJmky15+L2e6Wgn3+iK5fWzb6T3fhNFq2+MeTRb064c6Wr4N/wv0DzQTjNzHNGQ==", - "dev": true, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/minimist": { - "version": "1.2.8", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz", - "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==", - "dev": true, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/mkdirp-classic": { - "version": "0.5.3", - "resolved": "https://registry.npmjs.org/mkdirp-classic/-/mkdirp-classic-0.5.3.tgz", - "integrity": "sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A==", - "dev": true - }, - "node_modules/ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", - "dev": true - }, - "node_modules/multistream": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/multistream/-/multistream-4.1.0.tgz", - "integrity": "sha512-J1XDiAmmNpRCBfIWJv+n0ymC4ABcf/Pl+5YvC5B/D2f/2+8PtHvCNxMPKiQcZyi922Hq69J2YOpb1pTywfifyw==", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "dependencies": { - "once": "^1.4.0", - "readable-stream": "^3.6.0" - } - }, - "node_modules/multistream/node_modules/readable-stream": { - "version": "3.6.2", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", - "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", - "dev": true, - "dependencies": { - "inherits": "^2.0.3", - "string_decoder": "^1.1.1", - "util-deprecate": "^1.0.1" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/napi-build-utils": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/napi-build-utils/-/napi-build-utils-1.0.2.tgz", - "integrity": "sha512-ONmRUqK7zj7DWX0D9ADe03wbwOBZxNAfF20PlGfCWQcD3+/MakShIHrMqx9YwPTfxDdF1zLeL+RGZiR9kGMLdg==", - "dev": true - }, - "node_modules/node-abi": { - "version": "3.54.0", - "resolved": "https://registry.npmjs.org/node-abi/-/node-abi-3.54.0.tgz", - "integrity": "sha512-p7eGEiQil0YUV3ItH4/tBb781L5impVmmx2E9FRKF7d18XXzp4PGT2tdYMFY6wQqgxD0IwNZOiSJ0/K0fSi/OA==", - "dev": true, - "dependencies": { - "semver": "^7.3.5" - }, - "engines": { - "node": ">=10" - } - }, - "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==", - "dev": true, - "dependencies": { - "whatwg-url": "^5.0.0" - }, - "engines": { - "node": "4.x || >=6.0.0" - }, - "peerDependencies": { - "encoding": "^0.1.0" - }, - "peerDependenciesMeta": { - "encoding": { - "optional": true - } - } - }, - "node_modules/once": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", - "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", - "dev": true, - "dependencies": { - "wrappy": "1" - } - }, - "node_modules/p-is-promise": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/p-is-promise/-/p-is-promise-3.0.0.tgz", - "integrity": "sha512-Wo8VsW4IRQSKVXsJCn7TomUaVtyfjVDn3nUP7kE967BQk0CwFpdbZs0X0uk5sW9mkBa9eNM7hCMaG93WUAwxYQ==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/pad-left": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/pad-left/-/pad-left-2.1.0.tgz", - "integrity": "sha512-HJxs9K9AztdIQIAIa/OIazRAUW/L6B9hbQDxO4X07roW3eo9XqZc2ur9bn1StH9CnbbI9EgvejHQX7CBpCF1QA==", - "dependencies": { - "repeat-string": "^1.5.4" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/path-parse": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", - "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", - "dev": true - }, - "node_modules/path-type": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", - "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/picomatch": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", - "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", - "dev": true, - "engines": { - "node": ">=8.6" - }, - "funding": { - "url": "https://github.com/sponsors/jonschlinkert" - } - }, - "node_modules/pkg": { - "version": "5.8.1", - "resolved": "https://registry.npmjs.org/pkg/-/pkg-5.8.1.tgz", - "integrity": "sha512-CjBWtFStCfIiT4Bde9QpJy0KeH19jCfwZRJqHFDFXfhUklCx8JoFmMj3wgnEYIwGmZVNkhsStPHEOnrtrQhEXA==", - "dev": true, - "dependencies": { - "@babel/generator": "7.18.2", - "@babel/parser": "7.18.4", - "@babel/types": "7.19.0", - "chalk": "^4.1.2", - "fs-extra": "^9.1.0", - "globby": "^11.1.0", - "into-stream": "^6.0.0", - "is-core-module": "2.9.0", - "minimist": "^1.2.6", - "multistream": "^4.1.0", - "pkg-fetch": "3.4.2", - "prebuild-install": "7.1.1", - "resolve": "^1.22.0", - "stream-meter": "^1.0.4" - }, - "bin": { - "pkg": "lib-es5/bin.js" - }, - "peerDependencies": { - "node-notifier": ">=9.0.1" - }, - "peerDependenciesMeta": { - "node-notifier": { - "optional": true - } - } - }, - "node_modules/pkg-fetch": { - "version": "3.4.2", - "resolved": "https://registry.npmjs.org/pkg-fetch/-/pkg-fetch-3.4.2.tgz", - "integrity": "sha512-0+uijmzYcnhC0hStDjm/cl2VYdrmVVBpe7Q8k9YBojxmR5tG8mvR9/nooQq3QSXiQqORDVOTY3XqMEqJVIzkHA==", - "dev": true, - "dependencies": { - "chalk": "^4.1.2", - "fs-extra": "^9.1.0", - "https-proxy-agent": "^5.0.0", - "node-fetch": "^2.6.6", - "progress": "^2.0.3", - "semver": "^7.3.5", - "tar-fs": "^2.1.1", - "yargs": "^16.2.0" - }, - "bin": { - "pkg-fetch": "lib-es5/bin.js" - } - }, - "node_modules/prebuild-install": { - "version": "7.1.1", - "resolved": "https://registry.npmjs.org/prebuild-install/-/prebuild-install-7.1.1.tgz", - "integrity": "sha512-jAXscXWMcCK8GgCoHOfIr0ODh5ai8mj63L2nWrjuAgXE6tDyYGnx4/8o/rCgU+B4JSyZBKbeZqzhtwtC3ovxjw==", - "dev": true, - "dependencies": { - "detect-libc": "^2.0.0", - "expand-template": "^2.0.3", - "github-from-package": "0.0.0", - "minimist": "^1.2.3", - "mkdirp-classic": "^0.5.3", - "napi-build-utils": "^1.0.1", - "node-abi": "^3.3.0", - "pump": "^3.0.0", - "rc": "^1.2.7", - "simple-get": "^4.0.0", - "tar-fs": "^2.0.0", - "tunnel-agent": "^0.6.0" - }, - "bin": { - "prebuild-install": "bin.js" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/process-nextick-args": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", - "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==", - "dev": true - }, - "node_modules/progress": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz", - "integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==", - "dev": true, - "engines": { - "node": ">=0.4.0" - } - }, - "node_modules/proxy-from-env": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", - "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==" - }, - "node_modules/pump": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", - "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==", - "dev": true, - "dependencies": { - "end-of-stream": "^1.1.0", - "once": "^1.3.1" - } - }, - "node_modules/queue-microtask": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", - "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ] - }, - "node_modules/rc": { - "version": "1.2.8", - "resolved": "https://registry.npmjs.org/rc/-/rc-1.2.8.tgz", - "integrity": "sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw==", - "dev": true, - "dependencies": { - "deep-extend": "^0.6.0", - "ini": "~1.3.0", - "minimist": "^1.2.0", - "strip-json-comments": "~2.0.1" - }, - "bin": { - "rc": "cli.js" - } - }, - "node_modules/readable-stream": { - "version": "2.3.8", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.8.tgz", - "integrity": "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==", - "dev": true, - "dependencies": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" - } - }, - "node_modules/repeat-string": { - "version": "1.6.1", - "resolved": "https://registry.npmjs.org/repeat-string/-/repeat-string-1.6.1.tgz", - "integrity": "sha512-PV0dzCYDNfRi1jCDbJzpW7jNNDRuCOG/jI5ctQcGKt/clZD+YcPS3yIlWuTJMmESC8aevCFmWJy5wjAFgNqN6w==", - "engines": { - "node": ">=0.10" - } - }, - "node_modules/require-directory": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", - "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/resolve": { - "version": "1.22.8", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.8.tgz", - "integrity": "sha512-oKWePCxqpd6FlLvGV1VU0x7bkPmmCNolxzjMf4NczoDnQcIWrAF+cPtZn5i6n+RfD2d9i0tzpKnG6Yk168yIyw==", - "dev": true, - "dependencies": { - "is-core-module": "^2.13.0", - "path-parse": "^1.0.7", - "supports-preserve-symlinks-flag": "^1.0.0" - }, - "bin": { - "resolve": "bin/resolve" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/resolve/node_modules/is-core-module": { - "version": "2.13.1", - "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.13.1.tgz", - "integrity": "sha512-hHrIjvZsftOsvKSn2TRYl63zvxsgE0K+0mYMoH6gD4omR5IWB2KynivBQczo3+wF1cCkjzvptnI9Q0sPU66ilw==", - "dev": true, - "dependencies": { - "hasown": "^2.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/reusify": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", - "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==", - "dev": true, - "engines": { - "iojs": ">=1.0.0", - "node": ">=0.10.0" - } - }, - "node_modules/run-parallel": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", - "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "dependencies": { - "queue-microtask": "^1.2.2" - } - }, - "node_modules/safe-buffer": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", - "dev": true - }, - "node_modules/semver": { - "version": "7.5.4", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", - "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", - "dev": true, - "dependencies": { - "lru-cache": "^6.0.0" - }, - "bin": { - "semver": "bin/semver.js" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/simple-concat": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/simple-concat/-/simple-concat-1.0.1.tgz", - "integrity": "sha512-cSFtAPtRhljv69IK0hTVZQ+OfE9nePi/rtJmw5UjHeVyVroEqJXP1sFztKUy1qU+xvz3u/sfYJLa947b7nAN2Q==", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ] - }, - "node_modules/simple-get": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/simple-get/-/simple-get-4.0.1.tgz", - "integrity": "sha512-brv7p5WgH0jmQJr1ZDDfKDOSeWWg+OVypG99A/5vYGPqJ6pxiaHLy8nxtFjBA7oMa01ebA9gfh1uMCFqOuXxvA==", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "dependencies": { - "decompress-response": "^6.0.0", - "once": "^1.3.1", - "simple-concat": "^1.0.0" - } - }, - "node_modules/slash": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", - "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/stream-meter": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/stream-meter/-/stream-meter-1.0.4.tgz", - "integrity": "sha512-4sOEtrbgFotXwnEuzzsQBYEV1elAeFSO8rSGeTwabuX1RRn/kEq9JVH7I0MRBhKVRR0sJkr0M0QCH7yOLf9fhQ==", - "dev": true, - "dependencies": { - "readable-stream": "^2.1.4" - } - }, - "node_modules/stream-read-all": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/stream-read-all/-/stream-read-all-3.0.1.tgz", - "integrity": "sha512-EWZT9XOceBPlVJRrYcykW8jyRSZYbkb/0ZK36uLEmoWVO5gxBOnntNTseNzfREsqxqdfEGQrD8SXQ3QWbBmq8A==", - "engines": { - "node": ">=10" - } - }, - "node_modules/string_decoder": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", - "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", - "dev": true, - "dependencies": { - "safe-buffer": "~5.1.0" - } - }, - "node_modules/string-width": { - "version": "4.2.3", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", - "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", - "dev": true, - "dependencies": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/strip-ansi": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", - "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", - "dev": true, - "dependencies": { - "ansi-regex": "^5.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/strip-json-comments": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", - "integrity": "sha512-4gB8na07fecVVkOI6Rs4e7T6NOTki5EmL7TUduTs6bu3EdnSycntVJ4re8kgZA+wx9IueI2Y11bfbgwtzuE0KQ==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/supports-preserve-symlinks-flag": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", - "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", - "dev": true, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/table-layout": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/table-layout/-/table-layout-3.0.2.tgz", - "integrity": "sha512-rpyNZYRw+/C+dYkcQ3Pr+rLxW4CfHpXjPDnG7lYhdRoUcZTUt+KEsX+94RGp/aVp/MQU35JCITv2T/beY4m+hw==", - "dependencies": { - "@75lb/deep-merge": "^1.1.1", - "array-back": "^6.2.2", - "command-line-args": "^5.2.1", - "command-line-usage": "^7.0.0", - "stream-read-all": "^3.0.1", - "typical": "^7.1.1", - "wordwrapjs": "^5.1.0" - }, - "bin": { - "table-layout": "bin/cli.js" - }, - "engines": { - "node": ">=12.17" - } - }, - "node_modules/table-layout/node_modules/array-back": { - "version": "6.2.2", - "resolved": "https://registry.npmjs.org/array-back/-/array-back-6.2.2.tgz", - "integrity": "sha512-gUAZ7HPyb4SJczXAMUXMGAvI976JoK3qEx9v1FTmeYuJj0IBiaKttG1ydtGKdkfqWkIkouke7nG8ufGy77+Cvw==", - "engines": { - "node": ">=12.17" - } - }, - "node_modules/table-layout/node_modules/typical": { - "version": "7.1.1", - "resolved": "https://registry.npmjs.org/typical/-/typical-7.1.1.tgz", - "integrity": "sha512-T+tKVNs6Wu7IWiAce5BgMd7OZfNYUndHwc5MknN+UHOudi7sGZzuHdCadllRuqJ3fPtgFtIH9+lt9qRv6lmpfA==", - "engines": { - "node": ">=12.17" - } - }, - "node_modules/tar-fs": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/tar-fs/-/tar-fs-2.1.1.tgz", - "integrity": "sha512-V0r2Y9scmbDRLCNex/+hYzvp/zyYjvFbHPNgVTKfQvVrb6guiE/fxP+XblDNR011utopbkex2nM4dHNV6GDsng==", - "dev": true, - "dependencies": { - "chownr": "^1.1.1", - "mkdirp-classic": "^0.5.2", - "pump": "^3.0.0", - "tar-stream": "^2.1.4" - } - }, - "node_modules/tar-stream": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-2.2.0.tgz", - "integrity": "sha512-ujeqbceABgwMZxEJnk2HDY2DlnUZ+9oEcb1KzTVfYHio0UE6dG71n60d8D2I4qNvleWrrXpmjpt7vZeF1LnMZQ==", - "dev": true, - "dependencies": { - "bl": "^4.0.3", - "end-of-stream": "^1.4.1", - "fs-constants": "^1.0.0", - "inherits": "^2.0.3", - "readable-stream": "^3.1.1" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/tar-stream/node_modules/readable-stream": { - "version": "3.6.2", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", - "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", - "dev": true, - "dependencies": { - "inherits": "^2.0.3", - "string_decoder": "^1.1.1", - "util-deprecate": "^1.0.1" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/to-fast-properties": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz", - "integrity": "sha512-/OaKK0xYrs3DmxRYqL/yDc+FxFUVYhDlXMhRmv3z915w2HF1tnN1omB354j8VUGO/hbRzyD6Y3sA7v7GS/ceog==", - "dev": true, - "engines": { - "node": ">=4" - } - }, - "node_modules/to-regex-range": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", - "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", - "dev": true, - "dependencies": { - "is-number": "^7.0.0" - }, - "engines": { - "node": ">=8.0" - } - }, - "node_modules/tr46": { - "version": "0.0.3", - "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", - "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==", - "dev": true - }, - "node_modules/tslib": { - "version": "2.6.2", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz", - "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==" - }, - "node_modules/tunnel-agent": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", - "integrity": "sha512-McnNiV1l8RYeY8tBgEpuodCC1mLUdbSN+CYBL7kJsJNInOP8UjDDEwdk6Mw60vdLLrr5NHKZhMAOSrR2NZuQ+w==", - "dev": true, - "dependencies": { - "safe-buffer": "^5.0.1" - }, - "engines": { - "node": "*" - } - }, - "node_modules/typescript": { - "version": "5.3.3", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.3.3.tgz", - "integrity": "sha512-pXWcraxM0uxAS+tN0AG/BF2TyqmHO014Z070UsJ+pFvYuRSq8KH8DmWpnbXe0pEPDHXZV3FcAbJkijJ5oNEnWw==", - "dev": true, - "bin": { - "tsc": "bin/tsc", - "tsserver": "bin/tsserver" - }, - "engines": { - "node": ">=14.17" - } - }, - "node_modules/typical": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/typical/-/typical-4.0.0.tgz", - "integrity": "sha512-VAH4IvQ7BDFYglMd7BPRDfLgxZZX4O4TFcRDA6EN5X7erNJJq+McIEp8np9aVtxrCJ6qx4GTYVfOWNjcqwZgRw==", - "engines": { - "node": ">=8" - } - }, - "node_modules/universalify": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.1.tgz", - "integrity": "sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw==", - "dev": true, - "engines": { - "node": ">= 10.0.0" - } - }, - "node_modules/util-deprecate": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", - "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==", - "dev": true - }, - "node_modules/vectordb": { - "version": "0.4.3", - "resolved": "https://registry.npmjs.org/vectordb/-/vectordb-0.4.3.tgz", - "integrity": "sha512-7ToixoZgAB/hn44EE4ftcdE74SGRX+wmGejatTQodFBiYD9RQLW8LIuGo8MmT+AkYEDAuOR98jTEFUwnEU5sqA==", - "cpu": [ - "x64", - "arm64" - ], - "os": [ - "darwin", - "linux", - "win32" - ], - "dependencies": { - "@apache-arrow/ts": "^14.0.2", - "@neon-rs/load": "^0.0.74", - "apache-arrow": "^14.0.2", - "axios": "^1.4.0" - }, - "optionalDependencies": { - "@lancedb/vectordb-darwin-arm64": "0.4.3", - "@lancedb/vectordb-darwin-x64": "0.4.3", - "@lancedb/vectordb-linux-arm64-gnu": "0.4.3", - "@lancedb/vectordb-linux-x64-gnu": "0.4.3", - "@lancedb/vectordb-win32-x64-msvc": "0.4.3" - } - }, - "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==", - "dev": true - }, - "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==", - "dev": true, - "dependencies": { - "tr46": "~0.0.3", - "webidl-conversions": "^3.0.0" - } - }, - "node_modules/wordwrapjs": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/wordwrapjs/-/wordwrapjs-5.1.0.tgz", - "integrity": "sha512-JNjcULU2e4KJwUNv6CHgI46UvDGitb6dGryHajXTDiLgg1/RiGoPSDw4kZfYnwGtEXf2ZMeIewDQgFGzkCB2Sg==", - "engines": { - "node": ">=12.17" - } - }, - "node_modules/wrap-ansi": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", - "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", - "dev": true, - "dependencies": { - "ansi-styles": "^4.0.0", - "string-width": "^4.1.0", - "strip-ansi": "^6.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/wrap-ansi?sponsor=1" - } - }, - "node_modules/wrappy": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", - "dev": true - }, - "node_modules/y18n": { - "version": "5.0.8", - "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", - "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", - "dev": true, - "engines": { - "node": ">=10" - } - }, - "node_modules/yallist": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", - "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", - "dev": true - }, - "node_modules/yargs": { - "version": "16.2.0", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz", - "integrity": "sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==", - "dev": true, - "dependencies": { - "cliui": "^7.0.2", - "escalade": "^3.1.1", - "get-caller-file": "^2.0.5", - "require-directory": "^2.1.1", - "string-width": "^4.2.0", - "y18n": "^5.0.5", - "yargs-parser": "^20.2.2" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/yargs-parser": { - "version": "20.2.9", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.9.tgz", - "integrity": "sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w==", - "dev": true, - "engines": { - "node": ">=10" - } - } - } -} diff --git a/package/package.json b/package/package.json deleted file mode 100644 index 95d325d49..000000000 --- a/package/package.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "name": "package", - "version": "1.0.0", - "description": "", - "main": "out/index.js", - "bin": "out/index.js", - "pkg": { - "scripts": [ - "node_modules/axios/**/*" - ], - "assets": [ - "node_modules/@lancedb/vectordb-darwin-arm64/**/*" - ], - "targets": [ - "node18-darwin-arm64" - ], - "outputPath": "bin" - }, - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1", - "build": "ncc build src/index.ts -o out && pkg .", - "build:dev": "tsc" - }, - "author": "Nate Sesti and Ty Dunn", - "license": "Apache-2.0", - "devDependencies": { - "@vercel/ncc": "^0.38.1", - "esbuild": "^0.19.11", - "pkg": "^5.8.1", - "typescript": "^5.3.3" - }, - "dependencies": { - "@lancedb/vectordb-darwin-arm64": "^0.4.3", - "vectordb": "^0.4.3" - }, - "engine-strict": true, - "engines": { - "node": ">=20.11.0" - } -} diff --git a/package/src/index.ts b/package/src/index.ts deleted file mode 100644 index 2acb48728..000000000 --- a/package/src/index.ts +++ /dev/null @@ -1,14 +0,0 @@ -import * as lancedb from "vectordb"; - -(async () => { - console.log("Hello!"); - const uri = "data/sample-lancedb"; - const db = await lancedb.connect(uri); - const tb = await db.createTable("myTable", [ - { vector: [3.1, 4.1], item: "foo", price: 10.0 }, - { vector: [5.9, 26.5], item: "bar", price: 20.0 }, - ]); - const query = await tb.search([100, 100]).limit(2).execute(); - console.log(query); - console.log("DONE"); -})(); diff --git a/package/tsconfig.json b/package/tsconfig.json deleted file mode 100644 index b4e96c713..000000000 --- a/package/tsconfig.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "target": "ES2020", - "outDir": "out", - "lib": ["ES2020", "dom", "es6", "es5", "dom.iterable", "scripthost"], - "sourceMap": true, - "rootDir": "src", - "allowJs": true, - "strict": true /* enable all strict type-checking options */, - /* Additional Checks */ - // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ - // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ - // "noUnusedParameters": true, /* Report errors on unused parameters. */ - "esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */, - "resolveJsonModule": true /* Enable importing .json files */ - }, - "include": ["src/**/*"] -} diff --git a/pkg/.gitignore b/pkg/.gitignore deleted file mode 100644 index d748f39f1..000000000 --- a/pkg/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -node_modules -bin -data -out diff --git a/schema/json/ModelDescription.json b/schema/json/ModelDescription.json index ddaf3e1f5..53bd6c6e0 100644 --- a/schema/json/ModelDescription.json +++ b/schema/json/ModelDescription.json @@ -99,6 +99,7 @@ "free-trial", "openai-aiohttp", "anthropic", + "bedrock", "together", "ollama", "huggingface-tgi", diff --git a/schema/json/SerializedContinueConfig.json b/schema/json/SerializedContinueConfig.json index 17243beab..d3e3991f2 100644 --- a/schema/json/SerializedContinueConfig.json +++ b/schema/json/SerializedContinueConfig.json @@ -99,6 +99,7 @@ "free-trial", "openai-aiohttp", "anthropic", + "bedrock", "together", "ollama", "huggingface-tgi", diff --git a/sync/src/sync.rs b/sync/src/sync.rs index 460dcd785..d9e4791f2 100644 --- a/sync/src/sync.rs +++ b/sync/src/sync.rs @@ -45,21 +45,6 @@ fn remove_seps_from_path(dir: &Path) -> String { fn path_for_tag(tag: &Tag) -> PathBuf { let mut path = get_my_home().unwrap().unwrap(); path.push(".continue/index/tags"); -<<<<<<<< HEAD:sync/src/sync.rs - path.push(remove_seps_from_path(dir)); - if let Some(branch) = branch { - path.push(branch); - } else { - path.push("main"); - } - path -} - -// /// Stored in ~/.continue/index/.last_sync -// fn get_last_sync_time(dir: &Path, branch: Option<&str>) -> u64 { -// // TODO: Error handle here -// let path = path_for_tag(dir, branch).join(".last_sync"); -======== path.push(remove_seps_from_path(tag.dir)); path.push(tag.branch); path.push(tag.provider_id); @@ -70,7 +55,6 @@ fn path_for_tag(tag: &Tag) -> PathBuf { fn get_last_sync_time(tag: &Tag) -> u64 { // TODO: Error handle here let path = path_for_tag(tag).join(".last_sync"); ->>>>>>>> preview:sync/src/sync/mod.rs // let mut file = File::open(path).unwrap(); // let mut contents = String::new(); @@ -90,11 +74,6 @@ fn write_sync_time(tag: &Tag) { file.write_all(now.to_string().as_bytes()).unwrap(); } -<<<<<<<< HEAD:sync/src/sync.rs -// /// Use stat to find files since last sync time -// pub fn get_modified_files(dir: &Path, branch: Option<&str>) -> Vec { -// let last_sync_time = get_last_sync_time(dir, branch); -======== /// Use stat to find files since last sync time pub fn get_modified_files(tag: &Tag) -> Vec { let last_sync_time = get_last_sync_time(tag); @@ -104,7 +83,6 @@ pub fn get_modified_files(tag: &Tag) -> Vec { let path = entry.path(); let metadata = path.metadata().unwrap(); let modified = metadata.modified().unwrap(); ->>>>>>>> preview:sync/src/sync/mod.rs // build_walk(dir) // .filter_map(|entry| { @@ -226,29 +204,6 @@ impl<'a> IndexCache<'a> { } fn tag_str(&self) -> String { -<<<<<<<< HEAD:sync/src/sync.rs - format!("{}::{}", self.dir.to_str().unwrap(), self.branch) - } - - fn new(dir: &Path, branch: Option<&str>) -> Self { - Self { - dir: Box::from(dir), - branch: Box::from(branch.unwrap_or("main")), - global_cache: DiskSet::new( - get_my_home() - .unwrap() - .unwrap() - .join(".continue/index/.index_cache") - .to_str() - .unwrap(), - ), - tag_cache: DiskSet::new( - Self::index_cache_path_for_tag(dir, branch.unwrap_or("main")) - .to_str() - .unwrap(), - ), - } -======== return self.tag.to_string(); } @@ -270,21 +225,14 @@ impl<'a> IndexCache<'a> { ), tag_cache: DiskSet::new(IndexCache::index_cache_path_for_tag(tag).to_str().unwrap()), }; ->>>>>>>> preview:sync/src/sync/mod.rs } // rev_tags files are just json files with the following format: // { "hash": ["tag1", "tag2", ...], ... } // TODO: You could add_bulk, remove_bulk if this gets slow - -<<<<<<<< HEAD:sync/src/sync.rs - fn read_rev_tags(hash: [u8; ITEM_SIZE]) -> HashMap> { - let rev_tags_path = Self::rev_tags_path(hash); -======== fn read_rev_tags(&self, hash: [u8; ITEM_SIZE]) -> HashMap> { let rev_tags_path = IndexCache::rev_tags_path(hash, self.tag.provider_id); ->>>>>>>> preview:sync/src/sync/mod.rs let mut rev_tags_file = OpenOptions::new() .read(true) .write(true) @@ -297,13 +245,8 @@ impl<'a> IndexCache<'a> { serde_json::from_str(&contents).unwrap_or_default() } -<<<<<<<< HEAD:sync/src/sync.rs - fn write_rev_tags(hash: [u8; ITEM_SIZE], rev_tags: &HashMap>) { - let rev_tags_path = Self::rev_tags_path(hash); -======== fn write_rev_tags(&self, hash: [u8; ITEM_SIZE], rev_tags: HashMap>) { let rev_tags_path = IndexCache::rev_tags_path(hash, self.tag.provider_id); ->>>>>>>> preview:sync/src/sync/mod.rs let mut rev_tags_file = OpenOptions::new() .read(true) .write(true) @@ -532,37 +475,23 @@ mod tests { #[test] fn test_sync() { let ti = std::time::Instant::now(); -<<<<<<<< HEAD:sync/src/sync.rs - let _results = sync( - Path::new("/Users/natesesti/Desktop/continue"), - Some("nate/pyO3"), - ); -======== let tag = Tag { dir: Path::new("../"), branch: "nate/pyO3", provider_id: "default", }; let results = sync(&tag); ->>>>>>>> preview:sync/src/sync/mod.rs println!("Sync took {:?}", ti.elapsed()); // Vast majority (90+%) of this time is spent in compute_tree_for_dir } #[test] fn test_on_vscode_extension() { -<<<<<<<< HEAD:sync/src/sync.rs - let _results = sync( - Path::new("/Users/natesesti/Desktop/continue/extensions/vscode"), - Some("nate/pyO3"), - ); -======== let results = sync(&Tag { dir: Path::new("../extensions/vscode"), branch: "nate/pyO3", provider_id: "default", }); ->>>>>>>> preview:sync/src/sync/mod.rs } #[test] diff --git a/sync/src/sync/mod.rs b/sync/src/sync/mod.rs index 460dcd785..5bea1129e 100644 --- a/sync/src/sync/mod.rs +++ b/sync/src/sync/mod.rs @@ -45,21 +45,6 @@ fn remove_seps_from_path(dir: &Path) -> String { fn path_for_tag(tag: &Tag) -> PathBuf { let mut path = get_my_home().unwrap().unwrap(); path.push(".continue/index/tags"); -<<<<<<<< HEAD:sync/src/sync.rs - path.push(remove_seps_from_path(dir)); - if let Some(branch) = branch { - path.push(branch); - } else { - path.push("main"); - } - path -} - -// /// Stored in ~/.continue/index/.last_sync -// fn get_last_sync_time(dir: &Path, branch: Option<&str>) -> u64 { -// // TODO: Error handle here -// let path = path_for_tag(dir, branch).join(".last_sync"); -======== path.push(remove_seps_from_path(tag.dir)); path.push(tag.branch); path.push(tag.provider_id); @@ -70,7 +55,6 @@ fn path_for_tag(tag: &Tag) -> PathBuf { fn get_last_sync_time(tag: &Tag) -> u64 { // TODO: Error handle here let path = path_for_tag(tag).join(".last_sync"); ->>>>>>>> preview:sync/src/sync/mod.rs // let mut file = File::open(path).unwrap(); // let mut contents = String::new(); @@ -90,22 +74,16 @@ fn write_sync_time(tag: &Tag) { file.write_all(now.to_string().as_bytes()).unwrap(); } -<<<<<<<< HEAD:sync/src/sync.rs -// /// Use stat to find files since last sync time -// pub fn get_modified_files(dir: &Path, branch: Option<&str>) -> Vec { -// let last_sync_time = get_last_sync_time(dir, branch); -======== -/// Use stat to find files since last sync time -pub fn get_modified_files(tag: &Tag) -> Vec { - let last_sync_time = get_last_sync_time(tag); - let mut modified_files = Vec::new(); - for entry in build_walk(tag.dir) { - let entry = entry.unwrap(); - let path = entry.path(); - let metadata = path.metadata().unwrap(); - let modified = metadata.modified().unwrap(); ->>>>>>>> preview:sync/src/sync/mod.rs +/// Use stat to find files since last sync time +// pub fn get_modified_files(tag: &Tag) -> Vec { +// let last_sync_time = get_last_sync_time(tag); +// let mut modified_files = Vec::new(); +// for entry in build_walk(tag.dir) { +// let entry = entry.unwrap(); +// let path = entry.path(); +// let metadata = path.metadata().unwrap(); +// let modified = metadata.modified().unwrap(); // build_walk(dir) // .filter_map(|entry| { // let entry = entry.unwrap(); @@ -226,29 +204,6 @@ impl<'a> IndexCache<'a> { } fn tag_str(&self) -> String { -<<<<<<<< HEAD:sync/src/sync.rs - format!("{}::{}", self.dir.to_str().unwrap(), self.branch) - } - - fn new(dir: &Path, branch: Option<&str>) -> Self { - Self { - dir: Box::from(dir), - branch: Box::from(branch.unwrap_or("main")), - global_cache: DiskSet::new( - get_my_home() - .unwrap() - .unwrap() - .join(".continue/index/.index_cache") - .to_str() - .unwrap(), - ), - tag_cache: DiskSet::new( - Self::index_cache_path_for_tag(dir, branch.unwrap_or("main")) - .to_str() - .unwrap(), - ), - } -======== return self.tag.to_string(); } @@ -270,21 +225,14 @@ impl<'a> IndexCache<'a> { ), tag_cache: DiskSet::new(IndexCache::index_cache_path_for_tag(tag).to_str().unwrap()), }; ->>>>>>>> preview:sync/src/sync/mod.rs } // rev_tags files are just json files with the following format: // { "hash": ["tag1", "tag2", ...], ... } // TODO: You could add_bulk, remove_bulk if this gets slow - -<<<<<<<< HEAD:sync/src/sync.rs - fn read_rev_tags(hash: [u8; ITEM_SIZE]) -> HashMap> { - let rev_tags_path = Self::rev_tags_path(hash); -======== fn read_rev_tags(&self, hash: [u8; ITEM_SIZE]) -> HashMap> { let rev_tags_path = IndexCache::rev_tags_path(hash, self.tag.provider_id); ->>>>>>>> preview:sync/src/sync/mod.rs let mut rev_tags_file = OpenOptions::new() .read(true) .write(true) @@ -297,13 +245,8 @@ impl<'a> IndexCache<'a> { serde_json::from_str(&contents).unwrap_or_default() } -<<<<<<<< HEAD:sync/src/sync.rs - fn write_rev_tags(hash: [u8; ITEM_SIZE], rev_tags: &HashMap>) { - let rev_tags_path = Self::rev_tags_path(hash); -======== fn write_rev_tags(&self, hash: [u8; ITEM_SIZE], rev_tags: HashMap>) { let rev_tags_path = IndexCache::rev_tags_path(hash, self.tag.provider_id); ->>>>>>>> preview:sync/src/sync/mod.rs let mut rev_tags_file = OpenOptions::new() .read(true) .write(true) @@ -532,37 +475,23 @@ mod tests { #[test] fn test_sync() { let ti = std::time::Instant::now(); -<<<<<<<< HEAD:sync/src/sync.rs - let _results = sync( - Path::new("/Users/natesesti/Desktop/continue"), - Some("nate/pyO3"), - ); -======== let tag = Tag { dir: Path::new("../"), branch: "nate/pyO3", provider_id: "default", }; let results = sync(&tag); ->>>>>>>> preview:sync/src/sync/mod.rs println!("Sync took {:?}", ti.elapsed()); // Vast majority (90+%) of this time is spent in compute_tree_for_dir } #[test] fn test_on_vscode_extension() { -<<<<<<<< HEAD:sync/src/sync.rs - let _results = sync( - Path::new("/Users/natesesti/Desktop/continue/extensions/vscode"), - Some("nate/pyO3"), - ); -======== let results = sync(&Tag { dir: Path::new("../extensions/vscode"), branch: "nate/pyO3", provider_id: "default", }); ->>>>>>>> preview:sync/src/sync/mod.rs } #[test] diff --git a/sync/sync.db b/sync/sync.db deleted file mode 100644 index f7d42e766..000000000 Binary files a/sync/sync.db and /dev/null differ