diff --git a/.gitignore b/.gitignore index 3293157..56b75c8 100644 --- a/.gitignore +++ b/.gitignore @@ -112,7 +112,6 @@ web_modules/ .yarn-integrity # dotenv environment variable files -.env .env.development.local .env.test.local .env.production.local diff --git a/README.md b/README.md index 99902eb..8dcc4da 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,7 @@ Make sure you have [Node.js](https://nodejs.org/en/) (**download current**) inst ```bash npm install -g catai -catai install vicuna-7b-16k-q4_k_s +catai install llama3-8b-openhermes-dpo-q3_k_s catai up ``` @@ -57,6 +57,7 @@ Commands: active Show active model remove|rm [options] [models...] Remove a model uninstall Uninstall server and delete all models + node-llama-cpp|cpp [options] Node llama.cpp CLI - recompile node-llama-cpp binaries help [command] display help for command ``` @@ -92,14 +93,6 @@ This package uses [node-llama-cpp](https://github.com/withcatai/node-llama-cpp) - linux-ppc64le - win32-x64-msvc -### Memory usage -Runs on most modern computers. Unless your computer is very very old, it should work. - -According to [a llama.cpp discussion thread](https://github.com/ggerganov/llama.cpp/issues/13), here are the memory requirements: - -- 7B => ~4 GB -- 13B => ~8 GB -- 30B => ~16 GB ### Good to know - All download data will be downloaded at `~/catai` folder by default. @@ -125,6 +118,38 @@ const data = await response.text(); For more information, please read the [API guide](https://github.com/withcatai/catai/blob/main/docs/api.md) +## Development API + Node-llama-cpp@beta integration + +You can use the model with [node-llama-cpp@beta](https://github.com/withcatai/node-llama-cpp/pull/105) + +CatAI enables you to easily manage the models and chat with them. + +```ts +import {downloadModel, getModelPath} from 'catai'; + +// download the model, skip if you already have the model +await downloadModel( + "https://huggingface.co/QuantFactory/Meta-Llama-3-8B-Instruct-GGUF/resolve/main/Meta-Llama-3-8B-Instruct.Q2_K.gguf?download=true", + "llama3" +); + +// get the model path with catai +const modelPath = getModelPath("llama3"); + +const llama = await getLlama(); +const model = await llama.loadModel({ + modelPath +}); + +const context = await model.createContext(); +const session = new LlamaChatSession({ + contextSequence: context.getSequence() +}); + +const a1 = await session.prompt("Hi there, how are you?"); +console.log("AI: " + a1); +``` + ## Configuration You can edit the configuration via the web ui. diff --git a/docs/api.md b/docs/api.md index 1c9e9c1..89503aa 100644 --- a/docs/api.md +++ b/docs/api.md @@ -11,7 +11,7 @@ Enable you to chat with the model locally on your computer. ```ts import {createChat} from 'catai'; -const chat = await createChat(); +const chat = await createChat(); // using the default model installed const response = await catai.prompt('Write me 100 words story', token => { progress.stdout.write(token); @@ -20,6 +20,13 @@ const response = await catai.prompt('Write me 100 words story', token => { console.log(`Total text length: ${response.length}`); ``` +You can also specify the model you want to use: + +```ts +import {createChat} from 'catai'; +const chat = await createChat({model: "llama3"}); +``` + If you want to install the model on the fly, please read the [install-api guide](./install-api.md) ## Remote API diff --git a/docs/install-api.md b/docs/install-api.md index f8c15dc..972e929 100644 --- a/docs/install-api.md +++ b/docs/install-api.md @@ -6,10 +6,9 @@ You can install models on the fly using the `FetchModels` class. import {FetchModels} from 'catai'; const allModels = await FetchModels.fetchModels(); -const firstModel = Object.keys(allModels)[0]; const installModel = new FetchModels({ - download: firstModel, + download: "https://huggingface.co/QuantFactory/Meta-Llama-3-8B-Instruct-GGUF/resolve/main/Meta-Llama-3-8B-Instruct.Q2_K.gguf?download=true", latest: true, model: { settings: { @@ -23,27 +22,27 @@ await installModel.startDownload(); After the download is finished, this model will be the active model. -## Configuration +## Using with node-llama-cpp@beta -You can change the active model by changing the `CatAIDB` +You can download the model and use it directly with node-llama-cpp@beta ```ts -import {CatAIDB} from 'catai'; +import {getLlama, LlamaChatSession} from "node-llama-cpp"; +import {getModelPath} from 'catai'; +const modelPath = getModelPath("llama3"); -CatAIDB.db.activeModel = Object.keys(CatAIDB.db.models)[0]; - -await CatAIDB.saveDB(); -``` - -You also can change the model settings by changing the `CatAIDB` - -```ts -import {CatAIDB} from 'catai'; +const llama = await getLlama(); +const model = await llama.loadModel({ + modelPath +}); -const selectedModel = CatAIDB.db.models[CatAIDB.db.activeModel]; -selectedModel.settings.context = 4096; +const context = await model.createContext(); +const session = new LlamaChatSession({ + contextSequence: context.getSequence() +}); -await CatAIDB.saveDB(); +const a1 = await session.prompt("Hi there, how are you?"); +console.log("AI: " + a1); ``` -For extra information about the configuration, please read the [configuration guide](./configuration.md) +For more information on how to use the model, please refer to the [node-llama-cpp beta pull request](https://github.com/withcatai/node-llama-cpp/pull/105) diff --git a/models.json b/models.json index 82edacd..4313e84 100644 --- a/models.json +++ b/models.json @@ -14,7 +14,8 @@ "compressions": "q3_k_s" }, "compatibleCatAIVersionRange": [ - "2.0.9" + "2.0.9", + "3.1.1" ], "settings": { "bind": "node-llama-cpp-v2" @@ -36,7 +37,8 @@ "compressions": "q3_k_s" }, "compatibleCatAIVersionRange": [ - "2.0.9" + "2.0.9", + "3.1.1" ], "settings": { "bind": "node-llama-cpp-v2" @@ -58,7 +60,8 @@ "compressions": "q3_k_s" }, "compatibleCatAIVersionRange": [ - "2.0.13" + "2.0.13", + "3.1.1" ], "settings": { "bind": "node-llama-cpp-v2" @@ -80,7 +83,8 @@ "compressions": "q4_k_s" }, "compatibleCatAIVersionRange": [ - "2.0.13" + "2.0.13", + "3.1.1" ], "settings": { "bind": "node-llama-cpp-v2" @@ -102,7 +106,8 @@ "compressions": "q4_k_m" }, "compatibleCatAIVersionRange": [ - "2.0.13" + "2.0.13", + "3.1.1" ], "settings": { "bind": "node-llama-cpp-v2" @@ -124,7 +129,8 @@ "compressions": "q3_k_s" }, "compatibleCatAIVersionRange": [ - "2.0.13" + "2.0.13", + "3.1.1" ], "settings": { "bind": "node-llama-cpp-v2" @@ -146,7 +152,8 @@ "compressions": "q4_k_s" }, "compatibleCatAIVersionRange": [ - "2.0.14" + "2.0.14", + "3.1.1" ], "settings": { "bind": "node-llama-cpp-v2", @@ -169,7 +176,8 @@ "compressions": "q4_k_s" }, "compatibleCatAIVersionRange": [ - "2.0.14" + "2.0.14", + "3.1.1" ], "settings": { "bind": "node-llama-cpp-v2", @@ -192,7 +200,8 @@ "compressions": "q4_k_s" }, "compatibleCatAIVersionRange": [ - "2.0.14" + "2.0.14", + "3.1.1" ], "settings": { "bind": "node-llama-cpp-v2" @@ -214,7 +223,8 @@ "compressions": "q4_k_s" }, "compatibleCatAIVersionRange": [ - "2.0.14" + "2.0.14", + "3.1.1" ], "settings": { "bind": "node-llama-cpp-v2" @@ -236,7 +246,8 @@ "compressions": "q4_k_s" }, "compatibleCatAIVersionRange": [ - "2.0.14" + "2.0.14", + "3.1.1" ], "settings": { "bind": "node-llama-cpp-v2" @@ -258,7 +269,8 @@ "compressions": "q4_k_s" }, "compatibleCatAIVersionRange": [ - "2.0.14" + "2.0.14", + "3.1.1" ], "settings": { "bind": "node-llama-cpp-v2" @@ -280,7 +292,8 @@ "compressions": "q4_k_s" }, "compatibleCatAIVersionRange": [ - "2.0.14" + "2.0.14", + "3.1.1" ], "settings": { "bind": "node-llama-cpp-v2" @@ -302,7 +315,8 @@ "compressions": "q4_k_s" }, "compatibleCatAIVersionRange": [ - "2.0.14" + "2.0.14", + "3.1.1" ], "settings": { "bind": "node-llama-cpp-v2" @@ -324,7 +338,8 @@ "compressions": "q4_k_s" }, "compatibleCatAIVersionRange": [ - "2.0.14" + "2.0.14", + "3.1.1" ], "settings": { "bind": "node-llama-cpp-v2" @@ -346,7 +361,8 @@ "compressions": "q4_k_s" }, "compatibleCatAIVersionRange": [ - "2.0.14" + "2.0.14", + "3.1.1" ], "settings": { "bind": "node-llama-cpp-v2" @@ -368,7 +384,8 @@ "compressions": "q4_k_s" }, "compatibleCatAIVersionRange": [ - "2.0.14" + "2.0.14", + "3.1.1" ], "settings": { "bind": "node-llama-cpp-v2" @@ -390,7 +407,8 @@ "compressions": "q4_k_s" }, "compatibleCatAIVersionRange": [ - "2.0.14" + "2.0.14", + "3.1.1" ], "settings": { "bind": "node-llama-cpp-v2" @@ -412,7 +430,8 @@ "compressions": "q4_k_s" }, "compatibleCatAIVersionRange": [ - "2.0.14" + "2.0.14", + "3.1.1" ], "settings": { "bind": "node-llama-cpp-v2" @@ -434,12 +453,145 @@ "compressions": "q4_k_s" }, "compatibleCatAIVersionRange": [ - "2.0.14" + "2.0.14", + "3.1.1" ], "settings": { "bind": "node-llama-cpp-v2", "contextSize": 4096 }, "version": 1 + }, + "athena-llama-coder-3-8b-q3_k_s": { + "download": { + "files": { + "model": "Athena-llama-Coder-3-8B.Q3_K_S.gguf" + }, + "repo": "https://huggingface.co/mradermacher/Athena-llama-Coder-3-8B-GGUF", + "commit": "36caf905afa08bd4330f3e2f9373577c77f1278b", + "branch": "main" + }, + "hardwareCompatibility": { + "ramGB": 5.3, + "cpuCors": 3, + "compressions": "q3_k_s" + }, + "compatibleCatAIVersionRange": [ + "3.1.2" + ], + "settings": { + "bind": "node-llama-cpp-v2" + }, + "version": 1 + }, + "mistral-7b-grok-q4_k_s": { + "download": { + "files": { + "model": "mistral-7b-grok.Q4_K_S.gguf" + }, + "repo": "https://huggingface.co/mradermacher/mistral-7b-grok-GGUF", + "commit": "6de84766008c21dbff28d17d55bdb643c1537b02", + "branch": "main" + }, + "hardwareCompatibility": { + "ramGB": 4.4, + "cpuCors": 2, + "compressions": "q4_k_s" + }, + "compatibleCatAIVersionRange": [ + "3.1.2" + ], + "settings": { + "bind": "node-llama-cpp-v2" + }, + "version": 1 + }, + "athena-codezephyr-7b-v0.2-q4_k_s": { + "download": { + "files": { + "model": "Athena-CodeZephyr-7B-v0.2.Q4_K_S.gguf" + }, + "repo": "https://huggingface.co/mradermacher/Athena-CodeZephyr-7B-v0.2-GGUF", + "commit": "d11f71ae501ea32c8e8567765b19c406af8b4a0f", + "branch": "main" + }, + "hardwareCompatibility": { + "ramGB": 4.4, + "cpuCors": 2, + "compressions": "q4_k_s" + }, + "compatibleCatAIVersionRange": [ + "3.1.2" + ], + "settings": { + "bind": "node-llama-cpp-v2" + }, + "version": 1 + }, + "alphallama3-8b-q3_k_s": { + "download": { + "files": { + "model": "Alphallama3-8B.Q3_K_S.gguf" + }, + "repo": "https://huggingface.co/mradermacher/Alphallama3-8B-GGUF", + "commit": "738ab183a3e2ce92b96c9273e5d78960387ad939", + "branch": "main" + }, + "hardwareCompatibility": { + "ramGB": 5.3, + "cpuCors": 3, + "compressions": "q3_k_s" + }, + "compatibleCatAIVersionRange": [ + "3.1.2" + ], + "settings": { + "bind": "node-llama-cpp-v2" + }, + "version": 1 + }, + "llama3-8b-dpo-uncensored-q4_k_s": { + "download": { + "files": { + "model": "Llama3-8B-DPO-uncensored.Q4_K_S.gguf" + }, + "repo": "https://huggingface.co/mradermacher/Llama3-8B-DPO-uncensored-GGUF", + "commit": "af5654c362a9967e2f704658f8aad7429cfcffb7", + "branch": "main" + }, + "hardwareCompatibility": { + "ramGB": 5.3, + "cpuCors": 3, + "compressions": "q4_k_s" + }, + "compatibleCatAIVersionRange": [ + "3.1.2" + ], + "settings": { + "bind": "node-llama-cpp-v2" + }, + "version": 1 + }, + "llama3-8b-openhermes-dpo-q3_k_s": { + "download": { + "files": { + "model": "Llama3-8B-OpenHermes-DPO.Q3_K_S.gguf" + }, + "repo": "https://huggingface.co/mradermacher/Llama3-8B-OpenHermes-DPO-GGUF", + "commit": "c0edd26cf8259267807d02ad8903faac593b099d", + "branch": "main" + }, + "hardwareCompatibility": { + "ramGB": 5.3, + "cpuCors": 3, + "compressions": "q3_k_s" + }, + "compatibleCatAIVersionRange": [ + "3.1.2" + ], + "settings": { + "bind": "node-llama-cpp-v2" + }, + "version": 1 } } diff --git a/server/.env b/server/.env new file mode 100644 index 0000000..2e42643 --- /dev/null +++ b/server/.env @@ -0,0 +1 @@ +CATAI_MODEL_INDEX=../models.json \ No newline at end of file diff --git a/server/package-lock.json b/server/package-lock.json index b31b31b..ee075f5 100644 --- a/server/package-lock.json +++ b/server/package-lock.json @@ -1,18 +1,17 @@ { "name": "catai", - "version": "1.0.0", + "version": "8.0.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "catai", - "version": "1.0.0", + "version": "8.0.0", "hasInstallScript": true, "license": "MIT", "dependencies": { "@tinyhttp/app": "^2.1.4", "@tinyhttp/cors": "^2.0.0", - "await-lock": "^2.2.2", "body-parser": "^1.20.2", "chalk": "^5.3.0", "cli-table3": "^0.6.3", @@ -20,9 +19,10 @@ "execa": "^7.2.0", "fs-extra": "^11.1.1", "get-port": "^6.1.2", - "ipull": "^1.2.0", + "ipull": "^3.2.1", + "lifecycle-utils": "^1.4.1", "multistream": "^4.1.0", - "node-llama-cpp": "3.0.0-beta.1", + "node-llama-cpp": "3.0.0-beta.17", "object-assign-deep": "^0.4.0", "open": "^9.1.0", "ora": "^7.0.1", @@ -58,9 +58,9 @@ "jsdom": "^22.1.0", "semantic-release": "^21.0.7", "tslib": "^2.6.1", - "typedoc": "^0.24.8", + "typedoc": "^0.25.13", "typedoc-plugin-missing-exports": "^2.0.1", - "typescript": "^5.1.6", + "typescript": "^5.4.5", "zx": "^7.2.3" }, "engines": { @@ -266,17 +266,6 @@ "node": ">=0.1.90" } }, - "node_modules/@cspotcode/source-map-support": { - "version": "0.8.1", - "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz", - "integrity": "sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==", - "dependencies": { - "@jridgewell/trace-mapping": "0.3.9" - }, - "engines": { - "node": ">=12" - } - }, "node_modules/@eslint-community/eslint-utils": { "version": "4.4.0", "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz", @@ -333,6 +322,14 @@ "node": "^12.22.0 || ^14.17.0 || >=16.0.0" } }, + "node_modules/@huggingface/jinja": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/@huggingface/jinja/-/jinja-0.2.2.tgz", + "integrity": "sha512-/KPde26khDUIPkTGU82jdtTW9UAuvUTumCAbFs/7giR0SxsvZC4hru51PBvpijH6BVkHcROcvZM/lpy5h1jRRA==", + "engines": { + "node": ">=18" + } + }, "node_modules/@humanwhocodes/config-array": { "version": "0.11.11", "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.11.tgz", @@ -366,28 +363,6 @@ "integrity": "sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA==", "dev": true }, - "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==", - "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==" - }, - "node_modules/@jridgewell/trace-mapping": { - "version": "0.3.9", - "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz", - "integrity": "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==", - "dependencies": { - "@jridgewell/resolve-uri": "^3.0.3", - "@jridgewell/sourcemap-codec": "^1.4.10" - } - }, "node_modules/@kwsites/file-exists": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/@kwsites/file-exists/-/file-exists-1.1.1.tgz", @@ -1182,14 +1157,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/@supercharge/promise-pool": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/@supercharge/promise-pool/-/promise-pool-2.4.0.tgz", - "integrity": "sha512-O9CMipBlq5OObdt1uKJGIzm9cdjpPWfj+a+Zw9EgWKxaMNHKC7EU7X9taj3H0EGQNLOSq2jAcOa3EzxlfHsD6w==", - "engines": { - "node": ">=8" - } - }, "node_modules/@tinyhttp/accepts": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/@tinyhttp/accepts/-/accepts-2.1.0.tgz", @@ -1390,26 +1357,6 @@ "node": ">= 10" } }, - "node_modules/@tsconfig/node10": { - "version": "1.0.9", - "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.9.tgz", - "integrity": "sha512-jNsYVVxU8v5g43Erja32laIDHXeoNvFEpX33OK4d6hljo3jDhCBDhx5dhCCTMWUojscpAagGiRkBKxpdl9fxqA==" - }, - "node_modules/@tsconfig/node12": { - "version": "1.0.11", - "resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.11.tgz", - "integrity": "sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==" - }, - "node_modules/@tsconfig/node14": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.3.tgz", - "integrity": "sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==" - }, - "node_modules/@tsconfig/node16": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.4.tgz", - "integrity": "sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA==" - }, "node_modules/@types/aws-lambda": { "version": "8.10.119", "resolved": "https://registry.npmjs.org/@types/aws-lambda/-/aws-lambda-8.10.119.tgz", @@ -1766,27 +1713,11 @@ "integrity": "sha512-j2afSsaIENvHZN2B8GOpF566vZ5WVk5opAiMTvWgaQT8DkbOqsTfvNAvHoRGU2zzP8cPoqys+xHTRDWW8L+/BA==", "dev": true }, - "node_modules/abstract-level": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/abstract-level/-/abstract-level-1.0.3.tgz", - "integrity": "sha512-t6jv+xHy+VYwc4xqZMn2Pa9DjcdzvzZmQGRjTFc8spIbRGHgBrEKbPq+rYXc7CCo0lxgYvSgKVg9qZAhpVQSjA==", - "dependencies": { - "buffer": "^6.0.3", - "catering": "^2.1.0", - "is-buffer": "^2.0.5", - "level-supports": "^4.0.0", - "level-transcoder": "^1.0.1", - "module-error": "^1.0.1", - "queue-microtask": "^1.2.3" - }, - "engines": { - "node": ">=12" - } - }, "node_modules/acorn": { "version": "8.10.0", "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.10.0.tgz", "integrity": "sha512-F0SAmZ8iUtS//m8DmCTA0jlh6TDKkHQyK6xc6V4KDTyZKA9dnvX9/3sRTVQrWm79glUAZbnmmNcdYwUIHWVybw==", + "dev": true, "bin": { "acorn": "bin/acorn" }, @@ -1803,14 +1734,6 @@ "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" } }, - "node_modules/acorn-walk": { - "version": "8.3.0", - "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.3.0.tgz", - "integrity": "sha512-FS7hV565M5l1R08MXqo8odwMTB02C2UqzB17RVgu9EyuYFBqJZ3/ZY97sQD5FewVu1UyDFc1yztUDrAwT0EypA==", - "engines": { - "node": ">=0.4.0" - } - }, "node_modules/agent-base": { "version": "6.0.2", "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz", @@ -1855,7 +1778,6 @@ "version": "6.2.0", "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-6.2.0.tgz", "integrity": "sha512-kzRaCqXnpzWs+3z5ABPQiVke+iq0KXkHo8xiWV4RPTi5Yli0l97BEQuhXV1s7+aSU/fu1kUuxgS4MsQ0fRuygw==", - "dev": true, "dependencies": { "type-fest": "^3.0.0" }, @@ -1870,7 +1792,6 @@ "version": "3.13.1", "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-3.13.1.tgz", "integrity": "sha512-tLq3bSNx+xSpwvAJnzrK0Ep5CLNWjvFTOp71URMaAEWBfRb9nnJiBoUe0tF8bI4ZFO3omgBR6NvnbzVUT3Ly4g==", - "dev": true, "engines": { "node": ">=14.16" }, @@ -1929,11 +1850,6 @@ "node": "^12.13.0 || ^14.15.0 || >=16.0.0" } }, - "node_modules/arg": { - "version": "4.1.3", - "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", - "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==" - }, "node_modules/argparse": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", @@ -2077,6 +1993,14 @@ "node": ">=0.10.0" } }, + "node_modules/async-retry": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/async-retry/-/async-retry-1.3.3.tgz", + "integrity": "sha512-wfr/jstw9xNi/0teMHrRW7dsz3Lt5ARhYNZ2ewpadnhaIp5mbALhOAP+EAdsC7t4Z6wqsDVv9+W6gm1Dk9mEyw==", + "dependencies": { + "retry": "0.13.1" + } + }, "node_modules/asynckit": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", @@ -2094,17 +2018,12 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/await-lock": { - "version": "2.2.2", - "resolved": "https://registry.npmjs.org/await-lock/-/await-lock-2.2.2.tgz", - "integrity": "sha512-aDczADvlvTGajTDjcjpJMqRkOF6Qdz3YbPZm/PyW6tKPkx2hlYBzxMhEywM/tU72HrVZjgl5VCdRuMlA7pZ8Gw==" - }, "node_modules/axios": { - "version": "1.6.2", - "resolved": "https://registry.npmjs.org/axios/-/axios-1.6.2.tgz", - "integrity": "sha512-7i24Ri4pmDRfJTR7LDBhsOTtcm+9kjX5WiY1X3wIisx6G9So3pfMkEiU7emUBe46oceVImccTEM3k6C5dbVW8A==", + "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.0", + "follow-redirects": "^1.15.6", "form-data": "^4.0.0", "proxy-from-env": "^1.1.0" } @@ -2231,17 +2150,6 @@ "node": ">=8" } }, - "node_modules/browser-level": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/browser-level/-/browser-level-1.0.1.tgz", - "integrity": "sha512-XECYKJ+Dbzw0lbydyQuJzwNXtOpbMSq737qxJN11sIRTErOMShvDpbzTlgju7orJKvx4epULolZAuJGLzCmWRQ==", - "dependencies": { - "abstract-level": "^1.0.2", - "catering": "^2.1.1", - "module-error": "^1.0.2", - "run-parallel-limit": "^1.1.0" - } - }, "node_modules/btoa-lite": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/btoa-lite/-/btoa-lite-1.0.0.tgz", @@ -2357,14 +2265,6 @@ "cdl": "bin/cdl.js" } }, - "node_modules/catering": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/catering/-/catering-2.1.1.tgz", - "integrity": "sha512-K7Qy8O9p76sL3/3m7/zLKbRkyOlSZAgzEaLhyj2mXS8PsCud2Eo4hAb8aLtZqHh0QGqLcb9dlJSu6lHRVENm1w==", - "engines": { - "node": ">=6" - } - }, "node_modules/chalk": { "version": "5.3.0", "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.3.0.tgz", @@ -2389,22 +2289,6 @@ "node": ">=10" } }, - "node_modules/classic-level": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/classic-level/-/classic-level-1.3.0.tgz", - "integrity": "sha512-iwFAJQYtqRTRM0F6L8h4JCt00ZSGdOyqh7yVrhhjrOpFhmBjNlRUey64MCiyo6UmQHMJ+No3c81nujPv+n9yrg==", - "hasInstallScript": true, - "dependencies": { - "abstract-level": "^1.0.2", - "catering": "^2.1.0", - "module-error": "^1.0.1", - "napi-macros": "^2.2.2", - "node-gyp-build": "^4.3.0" - }, - "engines": { - "node": ">=12" - } - }, "node_modules/clean-stack": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/clean-stack/-/clean-stack-2.2.0.tgz", @@ -2427,21 +2311,10 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/cli-progress": { - "version": "3.12.0", - "resolved": "https://registry.npmjs.org/cli-progress/-/cli-progress-3.12.0.tgz", - "integrity": "sha512-tRkV3HJ1ASwm19THiiLIXLO7Im7wlTuKnvkYaTkyoAPefqjNg7W7DHKUlGRxy9vxDvbyCYQkQozvptuMkGCg8A==", - "dependencies": { - "string-width": "^4.2.3" - }, - "engines": { - "node": ">=4" - } - }, "node_modules/cli-spinners": { - "version": "2.9.0", - "resolved": "https://registry.npmjs.org/cli-spinners/-/cli-spinners-2.9.0.tgz", - "integrity": "sha512-4/aL9X3Wh0yiMQlE+eeRhWP6vclO3QRtw1JHKIT0FFUs5FjpFmESqtMvYZ0+lbzBw900b95mS0hohy+qn2VK/g==", + "version": "2.9.2", + "resolved": "https://registry.npmjs.org/cli-spinners/-/cli-spinners-2.9.2.tgz", + "integrity": "sha512-ywqV+5MmyL4E7ybXgKys4DugZbX0FC6LnwrhjuykIjnK9k8OQacQ7axGKnjDXWNhns0xot3bZI5h55H8yo9cJg==", "engines": { "node": ">=6" }, @@ -2477,23 +2350,23 @@ } }, "node_modules/cmake-js": { - "version": "7.2.1", - "resolved": "https://registry.npmjs.org/cmake-js/-/cmake-js-7.2.1.tgz", - "integrity": "sha512-AdPSz9cSIJWdKvm0aJgVu3X8i0U3mNTswJkSHzZISqmYVjZk7Td4oDFg0mCBA383wO+9pG5Ix7pEP1CZH9x2BA==", + "version": "7.3.0", + "resolved": "https://registry.npmjs.org/cmake-js/-/cmake-js-7.3.0.tgz", + "integrity": "sha512-dXs2zq9WxrV87bpJ+WbnGKv8WUBXDw8blNiwNHoRe/it+ptscxhQHKB1SJXa1w+kocLMeP28Tk4/eTCezg4o+w==", "dependencies": { - "axios": "^1.3.2", + "axios": "^1.6.5", "debug": "^4", - "fs-extra": "^10.1.0", + "fs-extra": "^11.2.0", "lodash.isplainobject": "^4.0.6", "memory-stream": "^1.0.0", - "node-api-headers": "^0.0.2", + "node-api-headers": "^1.1.0", "npmlog": "^6.0.2", "rc": "^1.2.7", - "semver": "^7.3.8", - "tar": "^6.1.11", + "semver": "^7.5.4", + "tar": "^6.2.0", "url-join": "^4.0.1", "which": "^2.0.2", - "yargs": "^17.6.0" + "yargs": "^17.7.2" }, "bin": { "cmake-js": "bin/cmake-js" @@ -2502,19 +2375,6 @@ "node": ">= 14.15.0" } }, - "node_modules/cmake-js/node_modules/fs-extra": { - "version": "10.1.0", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-10.1.0.tgz", - "integrity": "sha512-oRXApq54ETRj4eMiFzGnHWGy+zo5raudjuxN0b8H7s/RU2oW0Wvsx9O0ACRN/kRq9E8Vu/ReskGB5o3ji+FzHQ==", - "dependencies": { - "graceful-fs": "^4.2.0", - "jsonfile": "^6.0.1", - "universalify": "^2.0.0" - }, - "engines": { - "node": ">=12" - } - }, "node_modules/cmake-js/node_modules/url-join": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/url-join/-/url-join-4.0.1.tgz", @@ -2594,17 +2454,6 @@ "resolved": "https://registry.npmjs.org/console-control-strings/-/console-control-strings-1.1.0.tgz", "integrity": "sha512-ty/fTekppD2fIwRvnZAVdeOiGd1c7YXEixbgJTNzqcxJWKQnjJ/V1bNEEE6hygpM3WjwHFUVK6HTjWSzV4a8sQ==" }, - "node_modules/content-disposition": { - "version": "0.5.4", - "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz", - "integrity": "sha512-FveZTNuGw04cxlAiWbzi6zTAL/lhehaWbTtgluJh4/E95DqMwTmha3KZN1aAWA8cFIhHzMZUvLevkw5Rqk+tSQ==", - "dependencies": { - "safe-buffer": "5.2.1" - }, - "engines": { - "node": ">= 0.6" - } - }, "node_modules/content-type": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.5.tgz", @@ -2712,11 +2561,6 @@ "url": "https://github.com/sponsors/d-fischer" } }, - "node_modules/create-require": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz", - "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==" - }, "node_modules/cross-env": { "version": "7.0.3", "resolved": "https://registry.npmjs.org/cross-env/-/cross-env-7.0.3.tgz", @@ -2982,14 +2826,6 @@ "npm": "1.2.8000 || >= 1.4.16" } }, - "node_modules/diff": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", - "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", - "engines": { - "node": ">=0.3.1" - } - }, "node_modules/dir-glob": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz", @@ -3702,6 +3538,11 @@ "node": "*" } }, + "node_modules/eventemitter3": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-5.0.1.tgz", + "integrity": "sha512-GWkBvjiSZK87ELrYOSESUYeVIc9mvLLf/nXalMOS5dYrgZq9o5OVkbZAVM06CVxYsCwH9BDZFPlQTlPA1j4ahA==" + }, "node_modules/execa": { "version": "7.2.0", "resolved": "https://registry.npmjs.org/execa/-/execa-7.2.0.tgz", @@ -3842,6 +3683,31 @@ "node": "^10.12.0 || >=12.0.0" } }, + "node_modules/filename-reserved-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/filename-reserved-regex/-/filename-reserved-regex-3.0.0.tgz", + "integrity": "sha512-hn4cQfU6GOT/7cFHXBqeBg2TbrMBgdD0kcjLhvSQYYwm3s4B6cjvBfb7nBALJLAXqmU5xajSa7X2NnUud/VCdw==", + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/filenamify": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/filenamify/-/filenamify-6.0.0.tgz", + "integrity": "sha512-vqIlNogKeyD3yzrm0yhRMQg8hOVwYcYRfjEoODd49iCprMn4HL85gK3HcykQE53EPIpX3HcAbGA5ELQv216dAQ==", + "dependencies": { + "filename-reserved-regex": "^3.0.0" + }, + "engines": { + "node": ">=16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/fill-range": { "version": "7.0.1", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", @@ -3906,9 +3772,9 @@ "dev": true }, "node_modules/follow-redirects": { - "version": "1.15.2", - "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.2.tgz", - "integrity": "sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA==", + "version": "1.15.6", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.6.tgz", + "integrity": "sha512-wWN62YITEaOpSK584EZXJafH1AGpO8RVgElfkuXbTOrPX4fIfOyEpW/CsiNd8JdYrAoOvafRTOEnvsO++qCqFA==", "funding": [ { "type": "individual", @@ -4011,9 +3877,9 @@ } }, "node_modules/fs-extra": { - "version": "11.1.1", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-11.1.1.tgz", - "integrity": "sha512-MGIE4HOvQCeUCzmlHs0vXpih4ysz4wg9qiSAu6cd42lVwPbTM1TjV7RusoyQqMmk/95gdQZX72u+YW+c3eEpFQ==", + "version": "11.2.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-11.2.0.tgz", + "integrity": "sha512-PmDi3uwK5nFuXh7XDTlVnS17xJS7vW36is2+w3xcv8SVxiB4NyATf4ctkVY5bkSjX0Y4nbvZCq1/EjtEyr9ktw==", "dependencies": { "graceful-fs": "^4.2.0", "jsonfile": "^6.0.1", @@ -4023,6 +3889,28 @@ "node": ">=14.14" } }, + "node_modules/fs-minipass": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-2.1.0.tgz", + "integrity": "sha512-V/JgOLFCS+R6Vcq0slCuaeWEdNC3ouDlJMNIsacH2VtALiu9mV4LPrHc5cDl8k5aw6J8jwgWWpiTo5RYhmIzvg==", + "dependencies": { + "minipass": "^3.0.0" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/fs-minipass/node_modules/minipass": { + "version": "3.3.6", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.3.6.tgz", + "integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==", + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", @@ -4096,6 +3984,17 @@ "node": "6.* || 8.* || >= 10.*" } }, + "node_modules/get-east-asian-width": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/get-east-asian-width/-/get-east-asian-width-1.2.0.tgz", + "integrity": "sha512-2nk+7SIVb14QrgXFHcm84tD4bKQz0RxPuMT8Ag5KPOq7J5fEmAg0UbXdTOSHqNuHSU28k55qnceesxXRZGzKWA==", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/get-intrinsic": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.1.tgz", @@ -4635,28 +4534,86 @@ } }, "node_modules/ipull": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/ipull/-/ipull-1.2.0.tgz", - "integrity": "sha512-JFUTzkGTY5VsYRE7HKRUglIqxchw6JF5RgOHDyiGtOw3MkwJLALqv4Gxu6iiBMN0TZH0u9StJCcUdPHBrQWbzQ==", + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ipull/-/ipull-3.2.1.tgz", + "integrity": "sha512-Nn2RiLhSCELtOx6l+MRIYubSstqkOFTwcWXaDmRKmrobbvw6cH+eAiBd6LwGbyVI5KMc62suwBE51uEXejJoJA==", "dependencies": { + "@tinyhttp/content-disposition": "^2.2.0", + "async-retry": "^1.3.3", "chalk": "^5.3.0", - "cli-progress": "^3.12.0", + "cli-spinners": "^2.9.2", "commander": "^10.0.0", - "content-disposition": "^0.5.4", - "execa": "^7.2.0", + "eventemitter3": "^5.0.1", + "filenamify": "^6.0.0", "fs-extra": "^11.1.1", - "level": "^8.0.0", + "is-unicode-supported": "^2.0.0", + "lifecycle-utils": "^1.3.1", + "lodash.debounce": "^4.0.8", + "lowdb": "^7.0.1", "pretty-bytes": "^6.1.0", "pretty-ms": "^8.0.0", - "progress-stream": "^2.0.0", - "turbo-downloader": "^1.3.1", - "wretch": "^2.6.0" + "sleep-promise": "^9.1.0", + "slice-ansi": "^7.1.0", + "stdout-update": "^4.0.1", + "strip-ansi": "^7.1.0" }, "bin": { "ipull": "dist/cli/cli.js" }, "engines": { "node": ">=18.0.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/ido-pluto/ipull?sponsor=1" + } + }, + "node_modules/ipull/node_modules/@tinyhttp/content-disposition": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/@tinyhttp/content-disposition/-/content-disposition-2.2.0.tgz", + "integrity": "sha512-w1dJaSAtcCinOlT/YQg35RnFCOBbCHBGDVhH4yLoiJVtecRAJ2cYMf5HP+UhfbXURa38GC8fkRXO0vODDTjmeg==", + "engines": { + "node": ">=12.20.0" + }, + "funding": { + "type": "individual", + "url": "https://github.com/tinyhttp/tinyhttp?sponsor=1" + } + }, + "node_modules/ipull/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==", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-regex?sponsor=1" + } + }, + "node_modules/ipull/node_modules/is-unicode-supported": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-unicode-supported/-/is-unicode-supported-2.0.0.tgz", + "integrity": "sha512-FRdAyx5lusK1iHG0TWpVtk9+1i+GjrzRffhDg4ovQ7mcidMQ6mj+MhKPmvh7Xwyv5gIS06ns49CA7Sqg7lC22Q==", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/ipull/node_modules/strip-ansi": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz", + "integrity": "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==", + "dependencies": { + "ansi-regex": "^6.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/strip-ansi?sponsor=1" } }, "node_modules/is-array-buffer": { @@ -4707,28 +4664,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/is-buffer": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-2.0.5.tgz", - "integrity": "sha512-i2R6zNFDwgEHJyQUtJEk0XFi1i0dPFn/oqjK3/vPCcDeJvW5NQ83V8QbicfF1SupOaB0h8ntgBC2YiE7dfyctQ==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "engines": { - "node": ">=4" - } - }, "node_modules/is-callable": { "version": "1.2.7", "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.7.tgz", @@ -5205,9 +5140,9 @@ } }, "node_modules/jsonc-parser": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-3.2.0.tgz", - "integrity": "sha512-gfFQZrcTc8CnKXp6Y4/CBT3fTc0OVuDofpre4aEeEpSBPV5X5v4+Vmx+8snU7RLPrNHPKSgLxGo9YuQzz20o+w==", + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-3.2.1.tgz", + "integrity": "sha512-AilxAyFOAcK5wA1+LeaySVBrHsGQvUFCDWXKpZjzaL0PqW+xfBOttn8GNtWKFWqneyMZj41MWF9Kl6iPWLwgOA==", "dev": true }, "node_modules/jsonfile": { @@ -5312,42 +5247,6 @@ "node": ">=6" } }, - "node_modules/level": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/level/-/level-8.0.0.tgz", - "integrity": "sha512-ypf0jjAk2BWI33yzEaaotpq7fkOPALKAgDBxggO6Q9HGX2MRXn0wbP1Jn/tJv1gtL867+YOjOB49WaUF3UoJNQ==", - "dependencies": { - "browser-level": "^1.0.1", - "classic-level": "^1.2.0" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/level" - } - }, - "node_modules/level-supports": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/level-supports/-/level-supports-4.0.1.tgz", - "integrity": "sha512-PbXpve8rKeNcZ9C1mUicC9auIYFyGpkV9/i6g76tLgANwWhtG2v7I4xNBUlkn3lE2/dZF3Pi0ygYGtLc4RXXdA==", - "engines": { - "node": ">=12" - } - }, - "node_modules/level-transcoder": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/level-transcoder/-/level-transcoder-1.0.1.tgz", - "integrity": "sha512-t7bFwFtsQeD8cl8NIoQ2iwxA0CL/9IFw7/9gAjOonH0PWTTiRfY7Hq+Ejbsxh86tXobDQ6IOiddjNYIfOBs06w==", - "dependencies": { - "buffer": "^6.0.3", - "module-error": "^1.0.1" - }, - "engines": { - "node": ">=12" - } - }, "node_modules/levn": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", @@ -5362,9 +5261,9 @@ } }, "node_modules/lifecycle-utils": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/lifecycle-utils/-/lifecycle-utils-1.1.3.tgz", - "integrity": "sha512-jTrF8P3FR8deiZyoPUxfH5W82lkbZ7bjSd/QmGfOCQPDdM0MWKD83KLU2QZdIsC0s7acAk2jA6P+ytbxkMz1rw==" + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/lifecycle-utils/-/lifecycle-utils-1.4.1.tgz", + "integrity": "sha512-l8itA/+LnqlgMWM5AuSanjZk+S0+Ia9TldZPd9JHy4bCfrk1lUmNWKgt+xTuDqKy1sCI0dKZ7234R+wpVcBGUg==" }, "node_modules/lines-and-columns": { "version": "1.2.4", @@ -5433,6 +5332,11 @@ "integrity": "sha512-kZzYOKspf8XVX5AvmQF94gQW0lejFVgb80G85bU4ZWzoJ6C03PQg3coYAUpSTpQWelrZELd3XWgHzw4Ck5kaIw==", "dev": true }, + "node_modules/lodash.debounce": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/lodash.debounce/-/lodash.debounce-4.0.8.tgz", + "integrity": "sha512-FT1yDzDYEoYWhnSGnpE/4Kj1fLZkDFyqRb7fNt6FdYOSxlUWAtp42Eh6Wb0rGIv/m9Bgo7x4GhQbm5Ys4SG5ow==" + }, "node_modules/lodash.escaperegexp": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/lodash.escaperegexp/-/lodash.escaperegexp-4.1.2.tgz", @@ -5507,17 +5411,26 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/lowdb": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/lowdb/-/lowdb-7.0.1.tgz", + "integrity": "sha512-neJAj8GwF0e8EpycYIDFqEPcx9Qz4GUho20jWFR7YiFeXzF1YMLdxB36PypcTSPMA+4+LvgyMacYhlr18Zlymw==", + "dependencies": { + "steno": "^4.0.2" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/typicode" + } + }, "node_modules/lunr": { "version": "2.3.9", "resolved": "https://registry.npmjs.org/lunr/-/lunr-2.3.9.tgz", "integrity": "sha512-zTU3DaZaF3Rt9rhN3uBMGQD3dD2/vFQqnvZCDv4dl5iOzq2IZQqTxu90r4E5J+nP70J3ilqVCrbho2eWaeW8Ow==", "dev": true }, - "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/map-obj": { "version": "4.3.0", "resolved": "https://registry.npmjs.org/map-obj/-/map-obj-4.3.0.tgz", @@ -5913,14 +5826,6 @@ "node": ">=0.10.0" } }, - "node_modules/module-error": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/module-error/-/module-error-1.0.2.tgz", - "integrity": "sha512-0yuvsqSCv8LbaOKhnsQ/T5JhyFlCYLPXK3U2sgV10zoKQwzs/MyfuQUOZQ1V/6OCOJsK/TRgNVrPuPDqtdMFtA==", - "engines": { - "node": ">=10" - } - }, "node_modules/mrmime": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/mrmime/-/mrmime-1.0.1.tgz", @@ -5957,11 +5862,6 @@ "readable-stream": "^3.6.0" } }, - "node_modules/napi-macros": { - "version": "2.2.2", - "resolved": "https://registry.npmjs.org/napi-macros/-/napi-macros-2.2.2.tgz", - "integrity": "sha512-hmEVtAGYzVQpCKdbQea4skABsdXW4RUh5t5mJ2zzqowJS2OyXZTU1KhDVFhx+NlWZ4ap9mqR9TcDO3LTTttd+g==" - }, "node_modules/natural-compare": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", @@ -5994,9 +5894,9 @@ "integrity": "sha512-vgbBJTS4m5/KkE16t5Ly0WW9hz46swAstv0hYYwMtbG7AznRhNyfLRe8HZAiWIpcHzoO7HxhLuBQj9rJ/Ho0ZA==" }, "node_modules/node-api-headers": { - "version": "0.0.2", - "resolved": "https://registry.npmjs.org/node-api-headers/-/node-api-headers-0.0.2.tgz", - "integrity": "sha512-YsjmaKGPDkmhoNKIpkChtCsPVaRE0a274IdERKnuc/E8K1UJdBZ4/mvI006OijlQZHCfpRNOH3dfHQs92se8gg==" + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/node-api-headers/-/node-api-headers-1.1.0.tgz", + "integrity": "sha512-ucQW+SbYCUPfprvmzBsnjT034IGRB2XK8rRc78BgjNKhTdFKgAwAmgW704bKIBmcYW48it0Gkjpkd39Azrwquw==" }, "node_modules/node-domexception": { "version": "1.0.0", @@ -6032,69 +5932,139 @@ "integrity": "sha512-cRVc/kyto/7E5shrWca1Wsea4y6tL9iYJE5FBCius3JQfb/4P4I295PfhgbJQBLTx6lATE4z+wK0rPM4VS2uow==", "dev": true, "dependencies": { - "data-uri-to-buffer": "^4.0.0", - "fetch-blob": "^3.1.4", - "formdata-polyfill": "^4.0.10" + "data-uri-to-buffer": "^4.0.0", + "fetch-blob": "^3.1.4", + "formdata-polyfill": "^4.0.10" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/node-fetch" + } + }, + "node_modules/node-llama-cpp": { + "version": "3.0.0-beta.17", + "resolved": "https://registry.npmjs.org/node-llama-cpp/-/node-llama-cpp-3.0.0-beta.17.tgz", + "integrity": "sha512-yW3rdZTvmUgAOoktWAZfwnXQUQ3vuZ2tkENXEQCIa57eeyN1T2kBDgRHrz/IU7ASugFPagYVUXrlNlL5LpVUgQ==", + "hasInstallScript": true, + "dependencies": { + "@huggingface/jinja": "^0.2.2", + "async-retry": "^1.3.3", + "bytes": "^3.1.2", + "chalk": "^5.3.0", + "chmodrp": "^1.0.2", + "cmake-js": "^7.3.0", + "cross-env": "^7.0.3", + "cross-spawn": "^7.0.3", + "env-var": "^7.3.1", + "filenamify": "^6.0.0", + "fs-extra": "^11.2.0", + "ipull": "^3.0.11", + "is-unicode-supported": "^2.0.0", + "lifecycle-utils": "^1.4.1", + "log-symbols": "^5.1.0", + "node-addon-api": "^7.0.0", + "octokit": "^3.1.0", + "ora": "^7.0.1", + "pretty-ms": "^9.0.0", + "proper-lockfile": "^4.1.2", + "semver": "^7.6.0", + "simple-git": "^3.19.1", + "slice-ansi": "^7.1.0", + "stdout-update": "^4.0.1", + "strip-ansi": "^7.1.0", + "uuid": "^9.0.0", + "which": "^4.0.0", + "yargs": "^17.7.2" + }, + "bin": { + "node-llama-cpp": "dist/cli/cli.js" + }, + "engines": { + "node": ">=18.0.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/giladgd" + }, + "peerDependencies": { + "typescript": ">=5.0.0" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/node-llama-cpp/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==", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-regex?sponsor=1" + } + }, + "node_modules/node-llama-cpp/node_modules/is-unicode-supported": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-unicode-supported/-/is-unicode-supported-2.0.0.tgz", + "integrity": "sha512-FRdAyx5lusK1iHG0TWpVtk9+1i+GjrzRffhDg4ovQ7mcidMQ6mj+MhKPmvh7Xwyv5gIS06ns49CA7Sqg7lC22Q==", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/node-llama-cpp/node_modules/isexe": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-3.1.1.tgz", + "integrity": "sha512-LpB/54B+/2J5hqQ7imZHfdU31OlgQqx7ZicVlkm9kzg9/w8GKLEcFfJl/t7DCEDueOyBAD6zCCwTO6Fzs0NoEQ==", + "engines": { + "node": ">=16" + } + }, + "node_modules/node-llama-cpp/node_modules/pretty-ms": { + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/pretty-ms/-/pretty-ms-9.0.0.tgz", + "integrity": "sha512-E9e9HJ9R9NasGOgPaPE8VMeiPKAyWR5jcFpNnwIejslIhWqdqOrb2wShBsncMPUb+BcCd2OPYfh7p2W6oemTng==", + "dependencies": { + "parse-ms": "^4.0.0" }, "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + "node": ">=18" }, "funding": { - "type": "opencollective", - "url": "https://opencollective.com/node-fetch" + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/node-gyp-build": { - "version": "4.7.1", - "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.7.1.tgz", - "integrity": "sha512-wTSrZ+8lsRRa3I3H8Xr65dLWSgCvY2l4AOnaeKdPA9TB/WYMPaTcrzf3rXvFoVvjKNVnu0CcWSx54qq9GKRUYg==", - "bin": { - "node-gyp-build": "bin.js", - "node-gyp-build-optional": "optional.js", - "node-gyp-build-test": "build-test.js" + "node_modules/node-llama-cpp/node_modules/pretty-ms/node_modules/parse-ms": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/parse-ms/-/parse-ms-4.0.0.tgz", + "integrity": "sha512-TXfryirbmq34y8QBwgqCVLi+8oA3oWx2eAnSn62ITyEhEYaWRlVZ2DvMM9eZbMs/RfxPu/PK/aBLyGj4IrqMHw==", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/node-llama-cpp": { - "version": "3.0.0-beta.1", - "resolved": "https://registry.npmjs.org/node-llama-cpp/-/node-llama-cpp-3.0.0-beta.1.tgz", - "integrity": "sha512-IKCyWA69tPQRNFhiWSnkPTt3Ce7Ij2HauYhrwWbFHO+yIFKlx10x6/Xk6XGt9iR9eLsRle0l8YSnoKDvt2nn0A==", - "hasInstallScript": true, + "node_modules/node-llama-cpp/node_modules/strip-ansi": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz", + "integrity": "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==", "dependencies": { - "chalk": "^5.3.0", - "chmodrp": "^1.0.2", - "cli-progress": "^3.12.0", - "cmake-js": "^7.2.1", - "cross-env": "^7.0.3", - "cross-spawn": "^7.0.3", - "env-var": "^7.3.1", - "fs-extra": "^11.1.1", - "lifecycle-utils": "^1.1.3", - "log-symbols": "^5.1.0", - "node-addon-api": "^7.0.0", - "octokit": "^3.1.0", - "ora": "^7.0.1", - "simple-git": "^3.19.1", - "uuid": "^9.0.0", - "which": "^4.0.0", - "yargs": "^17.7.2" - }, - "bin": { - "node-llama-cpp": "dist/cli/cli.js" + "ansi-regex": "^6.0.1" }, "engines": { - "node": ">=18.0.0" + "node": ">=12" }, "funding": { - "type": "github", - "url": "https://github.com/sponsors/giladgd" - } - }, - "node_modules/node-llama-cpp/node_modules/isexe": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/isexe/-/isexe-3.1.1.tgz", - "integrity": "sha512-LpB/54B+/2J5hqQ7imZHfdU31OlgQqx7ZicVlkm9kzg9/w8GKLEcFfJl/t7DCEDueOyBAD6zCCwTO6Fzs0NoEQ==", - "engines": { - "node": ">=16" + "url": "https://github.com/chalk/strip-ansi?sponsor=1" } }, "node_modules/node-llama-cpp/node_modules/which": { @@ -9988,6 +9958,24 @@ "node": ">= 6" } }, + "node_modules/proper-lockfile": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/proper-lockfile/-/proper-lockfile-4.1.2.tgz", + "integrity": "sha512-TjNPblN4BwAWMXU8s9AEz4JmQxnD1NNL7bNOY/AKUzyamc379FWASUhc/K1pL2noVb+XmZKLL68cjzLsiOAMaA==", + "dependencies": { + "graceful-fs": "^4.2.4", + "retry": "^0.12.0", + "signal-exit": "^3.0.2" + } + }, + "node_modules/proper-lockfile/node_modules/retry": { + "version": "0.12.0", + "resolved": "https://registry.npmjs.org/retry/-/retry-0.12.0.tgz", + "integrity": "sha512-9LkiTwjUh6rT555DtE9rTX+BKByPfrMzEAtnlEtdEwr3Nkffwiihqe2bWADg+OQRjt9gl6ICdmB/ZFDCGAtSow==", + "engines": { + "node": ">= 4" + } + }, "node_modules/proto-list": { "version": "1.2.4", "resolved": "https://registry.npmjs.org/proto-list/-/proto-list-1.2.4.tgz", @@ -10053,6 +10041,7 @@ "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", @@ -10479,6 +10468,14 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/retry": { + "version": "0.13.1", + "resolved": "https://registry.npmjs.org/retry/-/retry-0.13.1.tgz", + "integrity": "sha512-XQBQ3I8W1Cge0Seh+6gjj03LbmRFWuoszgK9ooCpwYIrhhoO80pfq4cUkU5DkknwfOfFteRwlZ56PYOGYyFWdg==", + "engines": { + "node": ">= 4" + } + }, "node_modules/reusify": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", @@ -10629,37 +10626,6 @@ "queue-microtask": "^1.2.2" } }, - "node_modules/run-parallel-limit": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/run-parallel-limit/-/run-parallel-limit-1.1.0.tgz", - "integrity": "sha512-jJA7irRNM91jaKc3Hcl1npHsFLOXOoTkPCUL1JEa1R82O2miplXXRaGdjW/KM/98YQWDhJLiSs793CnXfblJUw==", - "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/rxjs": { - "version": "7.8.1", - "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-7.8.1.tgz", - "integrity": "sha512-AA3TVj+0A2iuIoQkWEK/tqFjBq2j+6PO6Y0zJcvzLAFhEFIO3HL0vls9hWLncZbAAbK0mar7oZ4V079I/qPMxg==", - "optional": true, - "dependencies": { - "tslib": "^2.1.0" - } - }, "node_modules/safe-array-concat": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/safe-array-concat/-/safe-array-concat-1.0.0.tgz", @@ -10891,12 +10857,9 @@ } }, "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==", - "dependencies": { - "lru-cache": "^6.0.0" - }, + "version": "7.6.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.1.tgz", + "integrity": "sha512-f/vbBsu+fOiYt+lmwZV0rVwJScl46HppnOA1ZvIuBWKOTlllpyJ3bfVax76/OrhCH38dyxoDIA8K7uB963IYgA==", "bin": { "semver": "bin/semver.js" }, @@ -10931,17 +10894,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/semver/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==", - "dependencies": { - "yallist": "^4.0.0" - }, - "engines": { - "node": ">=10" - } - }, "node_modules/set-blocking": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", @@ -10972,9 +10924,9 @@ } }, "node_modules/shiki": { - "version": "0.14.4", - "resolved": "https://registry.npmjs.org/shiki/-/shiki-0.14.4.tgz", - "integrity": "sha512-IXCRip2IQzKwxArNNq1S+On4KPML3Yyn8Zzs/xRgcgOWIr8ntIK3IKzjFPfjy/7kt9ZMjc+FItfqHRBg8b6tNQ==", + "version": "0.14.7", + "resolved": "https://registry.npmjs.org/shiki/-/shiki-0.14.7.tgz", + "integrity": "sha512-dNPAPrxSc87ua2sKJ3H5dQ/6ZaY8RNnaAqK+t0eG7p0Soi2ydiqbGOTaZCqaYvA/uZYfS1LJnemt3Q+mSfcPCg==", "dev": true, "dependencies": { "ansi-sequence-parser": "^1.1.0", @@ -11139,6 +11091,51 @@ "node": ">=8" } }, + "node_modules/sleep-promise": { + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/sleep-promise/-/sleep-promise-9.1.0.tgz", + "integrity": "sha512-UHYzVpz9Xn8b+jikYSD6bqvf754xL2uBUzDFwiU6NcdZeifPr6UfgU43xpkPu67VMS88+TI2PSI7Eohgqf2fKA==" + }, + "node_modules/slice-ansi": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-7.1.0.tgz", + "integrity": "sha512-bSiSngZ/jWeX93BqeIAbImyTbEihizcwNjFoRUIY/T1wWQsfsm2Vw1agPKylXvQTU7iASGdHhyqRlqQzfz+Htg==", + "dependencies": { + "ansi-styles": "^6.2.1", + "is-fullwidth-code-point": "^5.0.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/chalk/slice-ansi?sponsor=1" + } + }, + "node_modules/slice-ansi/node_modules/ansi-styles": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.1.tgz", + "integrity": "sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/slice-ansi/node_modules/is-fullwidth-code-point": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-5.0.0.tgz", + "integrity": "sha512-OVa3u9kkBbw7b8Xw5F9P+D/T9X+Z4+JruYVNapTjPYZYUznQ5YfWeFkOj606XYYW8yugTfC8Pj0hYqvi4ryAhA==", + "dependencies": { + "get-east-asian-width": "^1.0.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/source-map": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", @@ -11234,6 +11231,88 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/stdout-update": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/stdout-update/-/stdout-update-4.0.1.tgz", + "integrity": "sha512-wiS21Jthlvl1to+oorePvcyrIkiG/6M3D3VTmDUlJm7Cy6SbFhKkAvX+YBuHLxck/tO3mrdpC/cNesigQc3+UQ==", + "dependencies": { + "ansi-escapes": "^6.2.0", + "ansi-styles": "^6.2.1", + "string-width": "^7.1.0", + "strip-ansi": "^7.1.0" + }, + "engines": { + "node": ">=16.0.0" + } + }, + "node_modules/stdout-update/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==", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-regex?sponsor=1" + } + }, + "node_modules/stdout-update/node_modules/ansi-styles": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.1.tgz", + "integrity": "sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/stdout-update/node_modules/emoji-regex": { + "version": "10.3.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-10.3.0.tgz", + "integrity": "sha512-QpLs9D9v9kArv4lfDEgg1X/gN5XLnf/A6l9cs8SPZLRZR3ZkY9+kwIQTxm+fsSej5UMYGE8fdoaZVIBlqG0XTw==" + }, + "node_modules/stdout-update/node_modules/string-width": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-7.1.0.tgz", + "integrity": "sha512-SEIJCWiX7Kg4c129n48aDRwLbFb2LJmXXFrWBG4NGaRtMQ3myKPKbwrD1BKqQn74oCoNMBVrfDEr5M9YxCsrkw==", + "dependencies": { + "emoji-regex": "^10.3.0", + "get-east-asian-width": "^1.0.0", + "strip-ansi": "^7.1.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/stdout-update/node_modules/strip-ansi": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz", + "integrity": "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==", + "dependencies": { + "ansi-regex": "^6.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/strip-ansi?sponsor=1" + } + }, + "node_modules/steno": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/steno/-/steno-4.0.2.tgz", + "integrity": "sha512-yhPIQXjrlt1xv7dyPQg2P17URmXbuM5pdGkpiMB3RenprfiBlvK415Lctfe0eshk90oA7/tNq7WEiMK8RSP39A==", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/typicode" + } + }, "node_modules/stream-combiner": { "version": "0.0.4", "resolved": "https://registry.npmjs.org/stream-combiner/-/stream-combiner-0.0.4.tgz", @@ -11454,9 +11533,9 @@ "dev": true }, "node_modules/tar": { - "version": "6.1.15", - "resolved": "https://registry.npmjs.org/tar/-/tar-6.1.15.tgz", - "integrity": "sha512-/zKt9UyngnxIT/EAGYuxaMYgOIJiP81ab9ZfkILq4oNLPFX50qyYmu7jRj9qeXoxmJHjGlbH0+cm2uy1WCs10A==", + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/tar/-/tar-6.2.1.tgz", + "integrity": "sha512-DZ4yORTwrbTj/7MZYq2w+/ZFdI6OZ/f9SFHR+71gIVUZhOQPHzVCLpvRnPgyaMpfWxxk/4ONva3GQSyNIKRv6A==", "dependencies": { "chownr": "^2.0.0", "fs-minipass": "^2.0.0", @@ -11469,28 +11548,6 @@ "node": ">=10" } }, - "node_modules/tar/node_modules/fs-minipass": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-2.1.0.tgz", - "integrity": "sha512-V/JgOLFCS+R6Vcq0slCuaeWEdNC3ouDlJMNIsacH2VtALiu9mV4LPrHc5cDl8k5aw6J8jwgWWpiTo5RYhmIzvg==", - "dependencies": { - "minipass": "^3.0.0" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/tar/node_modules/fs-minipass/node_modules/minipass": { - "version": "3.3.6", - "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.3.6.tgz", - "integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==", - "dependencies": { - "yallist": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, "node_modules/temp-dir": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/temp-dir/-/temp-dir-3.0.0.tgz", @@ -11700,56 +11757,6 @@ "typescript": ">=4.2.0" } }, - "node_modules/ts-node": { - "version": "10.9.1", - "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.1.tgz", - "integrity": "sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw==", - "dependencies": { - "@cspotcode/source-map-support": "^0.8.0", - "@tsconfig/node10": "^1.0.7", - "@tsconfig/node12": "^1.0.7", - "@tsconfig/node14": "^1.0.0", - "@tsconfig/node16": "^1.0.2", - "acorn": "^8.4.1", - "acorn-walk": "^8.1.1", - "arg": "^4.1.0", - "create-require": "^1.1.0", - "diff": "^4.0.1", - "make-error": "^1.1.1", - "v8-compile-cache-lib": "^3.0.1", - "yn": "3.1.1" - }, - "bin": { - "ts-node": "dist/bin.js", - "ts-node-cwd": "dist/bin-cwd.js", - "ts-node-esm": "dist/bin-esm.js", - "ts-node-script": "dist/bin-script.js", - "ts-node-transpile-only": "dist/bin-transpile.js", - "ts-script": "dist/bin-script-deprecated.js" - }, - "peerDependencies": { - "@swc/core": ">=1.2.50", - "@swc/wasm": ">=1.2.50", - "@types/node": "*", - "typescript": ">=2.7" - }, - "peerDependenciesMeta": { - "@swc/core": { - "optional": true - }, - "@swc/wasm": { - "optional": true - } - } - }, - "node_modules/ts-node/node_modules/yn": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz", - "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==", - "engines": { - "node": ">=6" - } - }, "node_modules/tsconfig-paths": { "version": "3.14.2", "resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.14.2.tgz", @@ -11766,39 +11773,7 @@ "version": "2.6.2", "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz", "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==", - "devOptional": true - }, - "node_modules/turbo-downloader": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/turbo-downloader/-/turbo-downloader-1.3.1.tgz", - "integrity": "sha512-Xab83bMGopCXew4D8PA0g91qWgQ2JazkUIdJOu0DqjL31hEVV4DguUIavcQ6D1vySzJdaUh2o4gufWqVZ6XDvA==", - "dependencies": { - "@supercharge/promise-pool": "^2.1.0", - "axios": "^0.26.0", - "ts-node": "^10.5.0", - "typed-emitter": "^2.1.0", - "typescript": "^4.5.5" - } - }, - "node_modules/turbo-downloader/node_modules/axios": { - "version": "0.26.1", - "resolved": "https://registry.npmjs.org/axios/-/axios-0.26.1.tgz", - "integrity": "sha512-fPwcX4EvnSHuInCMItEhAGnaSEXRBjtzh9fOtsE6E1G6p7vl7edEeZe11QHf18+6+9gR5PbKV/sGKNaD8YaMeA==", - "dependencies": { - "follow-redirects": "^1.14.8" - } - }, - "node_modules/turbo-downloader/node_modules/typescript": { - "version": "4.9.5", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.5.tgz", - "integrity": "sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==", - "bin": { - "tsc": "bin/tsc", - "tsserver": "bin/tsserver" - }, - "engines": { - "node": ">=4.2.0" - } + "dev": true }, "node_modules/type-check": { "version": "0.4.0", @@ -11901,33 +11876,25 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/typed-emitter": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/typed-emitter/-/typed-emitter-2.1.0.tgz", - "integrity": "sha512-g/KzbYKbH5C2vPkaXGu8DJlHrGKHLsM25Zg9WuC9pMGfuvT+X25tZQWo5fK1BjBm8+UrVE9LDCvaY0CQk+fXDA==", - "optionalDependencies": { - "rxjs": "*" - } - }, "node_modules/typedoc": { - "version": "0.24.8", - "resolved": "https://registry.npmjs.org/typedoc/-/typedoc-0.24.8.tgz", - "integrity": "sha512-ahJ6Cpcvxwaxfu4KtjA8qZNqS43wYt6JL27wYiIgl1vd38WW/KWX11YuAeZhuz9v+ttrutSsgK+XO1CjL1kA3w==", + "version": "0.25.13", + "resolved": "https://registry.npmjs.org/typedoc/-/typedoc-0.25.13.tgz", + "integrity": "sha512-pQqiwiJ+Z4pigfOnnysObszLiU3mVLWAExSPf+Mu06G/qsc3wzbuM56SZQvONhHLncLUhYzOVkjFFpFfL5AzhQ==", "dev": true, "dependencies": { "lunr": "^2.3.9", "marked": "^4.3.0", - "minimatch": "^9.0.0", - "shiki": "^0.14.1" + "minimatch": "^9.0.3", + "shiki": "^0.14.7" }, "bin": { "typedoc": "bin/typedoc" }, "engines": { - "node": ">= 14.14" + "node": ">= 16" }, "peerDependencies": { - "typescript": "4.6.x || 4.7.x || 4.8.x || 4.9.x || 5.0.x || 5.1.x" + "typescript": "4.6.x || 4.7.x || 4.8.x || 4.9.x || 5.0.x || 5.1.x || 5.2.x || 5.3.x || 5.4.x" } }, "node_modules/typedoc-plugin-missing-exports": { @@ -11976,9 +11943,10 @@ } }, "node_modules/typescript": { - "version": "5.1.6", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.1.6.tgz", - "integrity": "sha512-zaWCozRZ6DLEWAWFrVDz1H6FVXzUSfTy5FUMWsQlU8Ym5JP9eO4xkTIROFCQvhQf61z6O/G6ugw3SgAnvvm+HA==", + "version": "5.4.5", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.4.5.tgz", + "integrity": "sha512-vcI4UpRgg81oIRUFwR0WSIHKt11nJ7SAVlYNIu+QpqeyXP+gpQJy/Z4+F0aGxSE4MqwjyXvW/TzgkLAx2AGHwQ==", + "devOptional": true, "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" @@ -12109,11 +12077,6 @@ "uuid": "dist/bin/uuid" } }, - "node_modules/v8-compile-cache-lib": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz", - "integrity": "sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==" - }, "node_modules/validate-npm-package-license": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz", diff --git a/server/package.json b/server/package.json index 9f0ffce..c68c0a7 100644 --- a/server/package.json +++ b/server/package.json @@ -1,6 +1,6 @@ { "name": "catai", - "version": "1.0.0", + "version": "8.0.0", "description": "Chat UI and Local API for the Llama models", "main": "dist/index.js", "type": "module", @@ -35,8 +35,9 @@ "lint:eslint": "eslint --ext .js --ext .ts ../..", "format": "npm run lint:eslint -- --fix", "clean": "rm -rf ./node_modules ./dist ./tsconfig.tsbuildinfo", - "cli": "npm run build && node -r dotenv/config ./dist/cli/cli.js", + "cli": "npm run build && node --env-file='.env' ./dist/cli/cli.js", "new-model": "zx scripts/new-model.js", + "deprecate": "zx scripts/deprecate.js", "prepack": "npm run build && npm run build:front && cp ../README.md ./README.md" }, "repository": { @@ -84,15 +85,14 @@ "jsdom": "^22.1.0", "semantic-release": "^21.0.7", "tslib": "^2.6.1", - "typedoc": "^0.24.8", + "typedoc": "^0.25.13", "typedoc-plugin-missing-exports": "^2.0.1", - "typescript": "^5.1.6", + "typescript": "^5.4.5", "zx": "^7.2.3" }, "dependencies": { "@tinyhttp/app": "^2.1.4", "@tinyhttp/cors": "^2.0.0", - "await-lock": "^2.2.2", "body-parser": "^1.20.2", "chalk": "^5.3.0", "cli-table3": "^0.6.3", @@ -100,9 +100,10 @@ "execa": "^7.2.0", "fs-extra": "^11.1.1", "get-port": "^6.1.2", - "ipull": "^1.2.0", + "ipull": "^3.2.1", + "lifecycle-utils": "^1.4.1", "multistream": "^4.1.0", - "node-llama-cpp": "3.0.0-beta.1", + "node-llama-cpp": "3.0.0-beta.17", "object-assign-deep": "^0.4.0", "open": "^9.1.0", "ora": "^7.0.1", diff --git a/server/scripts/deprecate.js b/server/scripts/deprecate.js new file mode 100644 index 0000000..642ab4c --- /dev/null +++ b/server/scripts/deprecate.js @@ -0,0 +1,15 @@ +let {stdout: catAIVersion} = await $`npm -g info catai version`; +catAIVersion = catAIVersion.trim(); + +const modelsJSONPath = path.join(__dirname, '..', '..', 'models.json'); +const models = await fs.readJSON(modelsJSONPath, 'utf-8'); + +for (const [key, value] of Object.entries(models)) { + if (value.compatibleCatAIVersionRange.length === 1 && value.compatibleCatAIVersionRange[0] != catAIVersion) { + value.compatibleCatAIVersionRange.push(catAIVersion); + } +} + +await fs.writeJSON(modelsJSONPath, models); + +console.log('Deprecation script finished successfully.') diff --git a/server/scripts/new-model.js b/server/scripts/new-model.js index 20f3874..37ab1a7 100644 --- a/server/scripts/new-model.js +++ b/server/scripts/new-model.js @@ -61,6 +61,7 @@ const fileCompressionParametersToSize = { }, 'q3_k_s': { 7: 3, + 8: 4.8, 13: 5.7, 30: 14, 34: 14.6, @@ -75,6 +76,7 @@ const fileCompressionParametersToSize = { }, 'q4_k_s': { 7: 3.9, + 8: 4.8, 13: 7.4, 30: 18.3, 34: 19.1, @@ -170,19 +172,20 @@ async function main() { userLabel = userLabel.trim().toLowerCase(); const [userName, repo, , branch, file] = url.split("/").slice(-5); + const fileWithoutQuery = file.split("?")[0]; const commit = await getLastCommit(userName, repo); const modelInfo = models[userLabel]; const {download} = modelInfo || {}; - if (modelInfo && download.files.model === file && download.commit === commit) { + if (modelInfo && download.files.model === fileWithoutQuery && download.commit === commit) { console.log(`Model already added with label ${userLabel}`); return; } else if (modelInfo) { modelInfo.download.commit = commit; - modelInfo.download.files.model = file; + modelInfo.download.files.model = fileWithoutQuery; modelInfo.version += 0.1; - modelInfo.hardwareCompatibility = calculateCompatibility(file); + modelInfo.hardwareCompatibility = calculateCompatibility(fileWithoutQuery); modelInfo.compatibleCatAIVersionRange = [catAIVersion]; console.log(`Model ${userLabel} updated`); await saveModel(); @@ -192,13 +195,13 @@ async function main() { models[userLabel] = { "download": { "files": { - "model": file + "model": fileWithoutQuery }, "repo": `https://huggingface.co/${userName}/${repo}`, "commit": commit, "branch": branch, }, - "hardwareCompatibility": calculateCompatibility(file), + "hardwareCompatibility": calculateCompatibility(fileWithoutQuery), "compatibleCatAIVersionRange": [catAIVersion], "settings": { "bind": "node-llama-cpp-v2" diff --git a/server/src/cli/commands/install.ts b/server/src/cli/commands/install.ts index 2304904..1ced1bb 100644 --- a/server/src/cli/commands/install.ts +++ b/server/src/cli/commands/install.ts @@ -2,7 +2,7 @@ import {Command} from 'commander'; import ModelCompatibilityChecker from '../../manage-models/about-models/model-compatibility-checker.js'; import prompts from 'prompts'; import AppDb from '../../storage/app-db.js'; -import FetchModels from '../../manage-models/about-models/fetch-models/fetch-models.js'; +import FetchModels from '../../manage-models/about-models/fetch-models.js'; export const installCommand = new Command('install'); diff --git a/server/src/index.ts b/server/src/index.ts index a437086..5b6b0f4 100644 --- a/server/src/index.ts +++ b/server/src/index.ts @@ -1,14 +1,17 @@ import RemoteCatAI from './server/remote/remote-catai.js'; -import FetchModels from './manage-models/about-models/fetch-models/fetch-models.js'; -import createChat from './manage-models/bind-class/bind-class.js'; +import FetchModels from './manage-models/about-models/fetch-models.js'; +import createChat, {getModelPath} from './manage-models/bind-class/bind-class.js'; import CatAIDB from './storage/app-db.js'; import ENV_CONFIG from './storage/config.js'; +const downloadModel = FetchModels.simpleDownload; export { RemoteCatAI, FetchModels, createChat, CatAIDB, + getModelPath, + downloadModel, ENV_CONFIG as CATAI_ENV_CONFIG, }; diff --git a/server/src/manage-models/about-models/fetch-models/fetch-models.ts b/server/src/manage-models/about-models/fetch-models.ts similarity index 81% rename from server/src/manage-models/about-models/fetch-models/fetch-models.ts rename to server/src/manage-models/about-models/fetch-models.ts index 82f7530..60b910b 100644 --- a/server/src/manage-models/about-models/fetch-models/fetch-models.ts +++ b/server/src/manage-models/about-models/fetch-models.ts @@ -1,12 +1,11 @@ import wretch from 'wretch'; -import ENV_CONFIG from '../../../storage/config.js'; -import AppDb, {ModelSettings} from '../../../storage/app-db.js'; -import {CLIPullProgress, pullFileCLI} from 'ipull'; +import ENV_CONFIG from '../../storage/config.js'; +import AppDb, {ModelSettings} from '../../storage/app-db.js'; +import {downloadFile} from 'ipull'; import path from 'path'; import fs from 'fs-extra'; import {pathToFileURL} from 'url'; -import findBestModelBinding from '../best-model-binding.js'; -import ConnectChunksProgress from './connect-chunks-progress.js'; +import findBestModelBinding from './best-model-binding.js'; import objectAssignDeep from 'object-assign-deep'; export type DetailedDownloadInfo = { @@ -22,11 +21,14 @@ export type FetchOptions = { download: string | string[] | DetailedDownloadInfo tag?: string; latest?: boolean; - model?: Partial> + model?: Partial } type RemoteFetchModels = { - [key: string]: DetailedDownloadInfo & { hide: boolean } + [key: string]: { + download: DetailedDownloadInfo, + hide: boolean + } & ModelSettings } const DEFAULT_DOWNLOAD_TYPE = 'model'; @@ -168,31 +170,45 @@ export default class FetchModels { try { new URL(ENV_CONFIG.MODEL_INDEX!); - return this._cachedModels = await wretch(ENV_CONFIG.MODEL_INDEX!).get().json(); + this._cachedModels = await wretch(ENV_CONFIG.MODEL_INDEX!).get().json(); } catch { - return this._cachedModels = await fs.readJSON(ENV_CONFIG.MODEL_INDEX!); + this._cachedModels = await fs.readJSON(ENV_CONFIG.MODEL_INDEX!); } - } - private static async _downloadModelInFiles(urls: string[], savePath: string, type: string) { - if (urls.length === 1) { - await pullFileCLI(urls[0], savePath, type); - return; - } + const reverseMap: RemoteFetchModels = {}; + const allModels = Object.keys(this._cachedModels).reverse(); - const allParts = []; - for (const [index, url] of Object.entries(urls)) { - const partPath = `${savePath}.${index}`; - allParts.push(partPath); - await pullFileCLI(url, partPath, `${type} ${Number(index) + 1}/${urls.length}`); + for(const model of allModels){ + reverseMap[model] = this._cachedModels[model]; } - const progress = new ConnectChunksProgress(allParts, savePath); - await progress.init(); - await new CLIPullProgress(progress, 'Connecting chunks').startPull(); + return this._cachedModels = reverseMap; + } + + private static async _downloadModelInFiles(urls: string[], savePath: string, type: string) { + const downloader = await downloadFile({ + partURLs: urls, + comment: type, + cliProgress: true, + savePath + }); + + await downloader.download(); } private static _findModelTag(modelPath: string) { return modelPath.split(/[\/\\]/).pop()?.split(/[?#]/).shift() || modelPath; } + + static async simpleDownload(downloadURL: string, tag?: string, skipExisting = true){ + if(tag && skipExisting && AppDb.db.models[tag]){ + return; + } + + const downloader = new FetchModels({ + download: downloadURL, + tag + }); + return await downloader.startDownload(); + } } diff --git a/server/src/manage-models/about-models/fetch-models/connect-chunks-progress.ts b/server/src/manage-models/about-models/fetch-models/connect-chunks-progress.ts deleted file mode 100644 index bf55503..0000000 --- a/server/src/manage-models/about-models/fetch-models/connect-chunks-progress.ts +++ /dev/null @@ -1,55 +0,0 @@ -import {IStreamProgress} from 'ipull'; -import fs from 'fs-extra'; -import progress from 'progress-stream'; -import MultiStream from 'multistream'; - -export default class ConnectChunksProgress implements IStreamProgress { - private static _UPDATE_TIME_MS = 100; - private _progress?: ReturnType; - - /** - * Connects chunks into one file, removes chunks after that and reports progress - */ - public constructor(private _files: string[], private _toFile: string) { - } - - public async init(): Promise { - let totalSize = 0; - - for (const file of this._files) { - const stat = await fs.stat(file); - totalSize += stat.size; - } - - this._progress = progress({ - length: totalSize, - time: ConnectChunksProgress._UPDATE_TIME_MS - }); - } - - public async progress(callback: (progressBytes: number, totalBytes: number) => void): Promise { - if (this._progress == null) - throw new Error('Progress is not initialized'); - - this._progress.on('progress', (progress: { transferred: number, length: number }) => { - callback(progress.transferred, progress.length); - }); - - await fs.remove(this._toFile); - - const toFileSteam = fs.createWriteStream(this._toFile); - const stream = new MultiStream( - this._files.map(fromPath => fs.createReadStream(fromPath)) - ); - - stream.pipe(this._progress!).pipe(toFileSteam); - - return new Promise((resolve, reject) => { - stream.once('finish', () => { - this._files.forEach(fs.remove); - resolve(null); - }); - stream.once('error', reject); - }); - } -} diff --git a/server/src/manage-models/about-models/model-compatibility-checker.ts b/server/src/manage-models/about-models/model-compatibility-checker.ts index 6d4d715..9589de5 100644 --- a/server/src/manage-models/about-models/model-compatibility-checker.ts +++ b/server/src/manage-models/about-models/model-compatibility-checker.ts @@ -1,6 +1,6 @@ import chalk from 'chalk'; import * as os from 'os'; -import FetchModels, {DEFAULT_VERSION} from './fetch-models/fetch-models.js'; +import FetchModels, {DEFAULT_VERSION} from './fetch-models.js'; import AppDb, {ModelSettings} from '../../storage/app-db.js'; import {packageJSON} from '../../storage/config.js'; import semver from 'semver'; @@ -28,7 +28,7 @@ class ModelCompatibilityChecker { private static readonly totalMemoryInGB: number = os.totalmem() / GB_IN_BYTES; private static readonly availableMemory: number = os.freemem() / GB_IN_BYTES; - public static checkModelCompatibility({hardwareCompatibility, compatibleCatAIVersionRange}: ModelSettings): Compatibility { + public static checkModelCompatibility({hardwareCompatibility, compatibleCatAIVersionRange}: Pick): Compatibility { if (!compatibleCatAIVersionRange?.[0]) { return { compatibility: '?', diff --git a/server/src/manage-models/bind-class/binds/node-llama-cpp/node-llama-cpp-v2/chat-wrapper/chat-wrapper.ts b/server/src/manage-models/bind-class/binds/node-llama-cpp/node-llama-cpp-v2/chat-wrapper/chat-wrapper.ts deleted file mode 100644 index 9bbb45c..0000000 --- a/server/src/manage-models/bind-class/binds/node-llama-cpp/node-llama-cpp-v2/chat-wrapper/chat-wrapper.ts +++ /dev/null @@ -1,14 +0,0 @@ -export default function createChatWrapper(_package: typeof import('node-llama-cpp'), wrapper: string | null = null) { - switch (wrapper) { - case 'llamaChat': - return new _package.LlamaChatPromptWrapper(); - case 'chatML': - return new _package.ChatMLChatPromptWrapper(); - case 'falconChat': - return new _package.FalconChatPromptWrapper(); - case null: - return new _package.GeneralChatPromptWrapper(); - } - - throw new Error(`Unknown chat wrapper: ${wrapper}`); -} diff --git a/server/src/server/controllers/admin/models-settings.ts b/server/src/server/controllers/admin/models-settings.ts index 4233c97..4beac31 100644 --- a/server/src/server/controllers/admin/models-settings.ts +++ b/server/src/server/controllers/admin/models-settings.ts @@ -1,4 +1,4 @@ -import {getCacheBindClass} from '../../../manage-models/bind-class/bind-class.js'; +import {findLocalModel, getCacheBindClass} from '../../../manage-models/bind-class/bind-class.js'; import AppDb from '../../../storage/app-db.js'; export function getActiveModelSettings(){ diff --git a/server/src/storage/app-db.ts b/server/src/storage/app-db.ts index 6dd14ae..9356d92 100644 --- a/server/src/storage/app-db.ts +++ b/server/src/storage/app-db.ts @@ -7,7 +7,7 @@ export type ModelInnerSettings = T &{ key?: string; } -export type ModelSettings = { +export type ModelSettings = { downloadedFiles: { [fileId: string]: string }, diff --git a/server/tsconfig.json b/server/tsconfig.json index 49e4cd0..8652502 100644 --- a/server/tsconfig.json +++ b/server/tsconfig.json @@ -2,7 +2,7 @@ "compilerOptions": { "rootDir": "./src", "lib": ["es2022"], - "module": "es2022", + "module": "NodeNext", "target": "es2022", "esModuleInterop": true, "noImplicitAny": true,