odant-work 1.0.25 → 1.0.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/#system/package-manifest.json +18 -16
- package/MODELS/$ai/$folder/$class/$provider/handlers/pages/form/trainer/$handler/trainer.js +1 -1
- package/MODELS/Local/$provider/class.js +2 -2
- package/package.json +1 -1
- package/scripts/check-ignored-code.mjs +4 -2
- package/sources/data/progress.md +4 -0
- package/sources/host/auto-updater.js +1 -0
- package/sources/modules/license/index.js +4 -2
- package/sources/modules/trainer/dataset.js +5 -2
- package/sources/modules/trainer/halogen.js +48 -23
- package/sources/modules/trainer/huggingface.js +109 -36
- package/sources/modules/trainer/local-engine.js +8 -2
- package/sources/modules/trainer/paths.js +257 -0
- package/sources/modules/trainer/providers.js +23 -6
- package/sources/modules/trainer/runner.js +57 -31
- package/sources/modules/trainer/transfer.js +142 -136
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"packageName": "odant-work",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.26",
|
|
4
4
|
"createdAt": 1794658837090,
|
|
5
|
-
"updatedAt":
|
|
5
|
+
"updatedAt": 1794752170390,
|
|
6
6
|
"files": {
|
|
7
7
|
"run.mjs": "f8918c612e8641e9beee06221be6680aa6fd21f25468451f2ac857fd51772266",
|
|
8
|
-
"package.json": "
|
|
9
|
-
"package-lock.json": "
|
|
8
|
+
"package.json": "e919c1ae3ffe3cc9b9192f6dd840dd67e208655b7c5f20688d9334710050106f",
|
|
9
|
+
"package-lock.json": "c1bc3578da04ec084fd6dc489c180ade97ee3fbc968a5bb7089f5934d8e2e5e0",
|
|
10
10
|
"sources/client/class.js": "c3fb8f143fc83aaa2df1ddeddd412d2d4dfe88656578095babe2df34fb3b3922",
|
|
11
11
|
"sources/client/field.js": "ffdd50fa8b6ec515cc42da5fca96658ff2b20e274601a1f926e0031372467a19",
|
|
12
12
|
"sources/client/file.js": "667101d75fa30840370d5be232e518aaac7c1fd52ca05a12da560eef6c0848b0",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"sources/data/objects.js": "23f51d5b00cd766fe27879b874738bc9bd9056bd6e27285fb7a52926c0dbc6a8",
|
|
27
27
|
"sources/data/posting.js": "6595bb9ec632539ae7629504db327d25a491e61c1cdc598bb43d08ea0d45548d",
|
|
28
28
|
"sources/data/print.js": "704f0f2fc80c6466a4196e4650d763150cf9b592eab14ea67ece85d51100107c",
|
|
29
|
-
"sources/data/progress.md": "
|
|
29
|
+
"sources/data/progress.md": "1d25d252119386a7804448a7388a9488e5d8301edca96b25acbe4ee27b5bca9e",
|
|
30
30
|
"sources/data/readme.md": "593fa2ae07aa91bc26d7542275da6953a9cd419240a9a49e00cb62fb9d5d8e36",
|
|
31
31
|
"sources/data/reports.js": "0330f404860fe2589a7d46a2f0fe690ca23249bd841a062a26718742d4fd11d6",
|
|
32
32
|
"sources/data/schema.js": "2a598b33c9352e3b673639dda302caeb13620cf978960cbcaee906f7bb852d50",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"sources/data/time.js": "cb34c1137685e83265938bb007859dfc1fca3548588d1663ee01e1affc87a09a",
|
|
36
36
|
"sources/data/workspace.js": "afbc007c16a26e86de2753794e0e7387218e97aba378047a5f37ea7961e3e921",
|
|
37
37
|
"sources/host/auth-methods.js": "d4cc34ea5b56bb314ea903c065706135e12ff685f69e6234658588c92d2c6509",
|
|
38
|
-
"sources/host/auto-updater.js": "
|
|
38
|
+
"sources/host/auto-updater.js": "20291deccd7ffbe2bd4a0ee7a91c7f266d191deaaf7ac4edca5be443bf64f892",
|
|
39
39
|
"sources/host/babel-merge.js": "11d5b65cae03aeabd09f06f65bee78f6fd0131eab125cc87c0dcaaf2d10e08a5",
|
|
40
40
|
"sources/host/config.js": "f41058d2ef46afc0ac5e262a0f31064d3288ab3794c4d45c0761498e775f60ae",
|
|
41
41
|
"sources/host/email-utils.js": "618f474b92c85675aeeb7584c1ef7d73441b9efc1463b9b836e7facb86e5d558",
|
|
@@ -135,7 +135,7 @@
|
|
|
135
135
|
"sources/modules/lan/scan.js": "bbc92272776b198c09f987af8c09c635f48341ac3311127ec958751f01570f82",
|
|
136
136
|
"sources/modules/lan/store.js": "fed7da49bbf508216b51ea3bc2b30e1e1ff5261edc3cbee57690d4e3130ae9e7",
|
|
137
137
|
"sources/modules/lan/subnet.js": "3d95231b206ba2ddc5fb8cff3002ca2c980a4e856e18cb505c24e7d81d643684",
|
|
138
|
-
"sources/modules/license/index.js": "
|
|
138
|
+
"sources/modules/license/index.js": "be69ecbd54e760a6fee6fa4b2975f4f3459c0d92c6ae09806103462fed9af38c",
|
|
139
139
|
"sources/modules/mcp/readme.md": "d2adeace29386f0e520907a9c48a99e61bd05f5275c2af3aefb9e2ab73ddf7bf",
|
|
140
140
|
"sources/modules/mcp/server.js": "7e0e85b08a7fd9efe2a6b280249d9692920f1abcc702ea5e016ac0d668be2e9b",
|
|
141
141
|
"sources/modules/mcp/tokens.js": "154b69cb70a0ea9087de4f96b5b4e72e6e481f27dae3f255d920e3ccbc837c57",
|
|
@@ -172,16 +172,17 @@
|
|
|
172
172
|
"sources/modules/sandbox/readme.md": "aff13ff47f0a4d8e332cc7718c75382af6bf0514126fa6ff086e413b71880322",
|
|
173
173
|
"sources/modules/sandbox/stream.js": "bfa74c918642e4fa5af170fdde52d825865f4fd09f771da5305898ac4738d4de",
|
|
174
174
|
"sources/modules/sandbox/vnc-proxy.js": "1c75c2b24d579f254de1c4727621fbbcc7e8a10360f638f4cf1c4bd91184d103",
|
|
175
|
-
"sources/modules/trainer/dataset.js": "
|
|
175
|
+
"sources/modules/trainer/dataset.js": "e631e1feda2958cf93436cb48a331958d7b029aa52bd42247865e87504b642f7",
|
|
176
176
|
"sources/modules/trainer/downloader.js": "3a36dfd9956c7aaeafa0743fdb6dc55525866bfbc5305a336a1e1c88ed05dd22",
|
|
177
|
-
"sources/modules/trainer/halogen.js": "
|
|
178
|
-
"sources/modules/trainer/huggingface.js": "
|
|
177
|
+
"sources/modules/trainer/halogen.js": "1637f1d1a52a68eeef4652b240d19007fc417c03c4215405077067651ab1f3c6",
|
|
178
|
+
"sources/modules/trainer/huggingface.js": "b9d9a38a63585680ccffbed8e7b00ae590bd3f4d0ed09438f934f27b25019097",
|
|
179
179
|
"sources/modules/trainer/index.js": "97b85d7fd3d4a60438418868965f67c0c0928523085c3752159620bb19b6d8ba",
|
|
180
|
-
"sources/modules/trainer/local-engine.js": "
|
|
181
|
-
"sources/modules/trainer/
|
|
182
|
-
"sources/modules/trainer/
|
|
180
|
+
"sources/modules/trainer/local-engine.js": "7f63e8d914bd89f06f69af2d3914a4c65379443d42a4ffa3c91200030c64a9df",
|
|
181
|
+
"sources/modules/trainer/paths.js": "aebfaad32f3acf85a794ce0dd3a43ca544042205683d9d1e754a53abc117d95a",
|
|
182
|
+
"sources/modules/trainer/providers.js": "958cd0b929467a033683c2e68e1a01d9ec6234a3e926ef6dd16d6025400e9a9c",
|
|
183
|
+
"sources/modules/trainer/runner.js": "23ce1ab20927ccc8c335f4b6c5cc655c1d7d92ef63a1ffb13c4d9c5abf893886",
|
|
183
184
|
"sources/modules/trainer/tar-stream.js": "52f1739579a01818b53d04a93fd05a91c49a0716019f309a6fca951ba112794f",
|
|
184
|
-
"sources/modules/trainer/transfer.js": "
|
|
185
|
+
"sources/modules/trainer/transfer.js": "2c603d538e0f85e1794e2f304081fac136f0ff72f85d8b00c2141c7402b3a1fb",
|
|
185
186
|
"sources/modules/trainer/worker/local_infer_worker.py": "7b001d75c64ac3ae6de650f6d738f22bfc21b6bd0694b57248e5b40966deb443",
|
|
186
187
|
"sources/modules/trainer/worker/unsloth_train.py": "7774d94ffa6f60eed20c57a8dfdc12621d5d9f74d594c605dff32ff70e321e33",
|
|
187
188
|
"sources/modules/user-profile/user-profile.js": "5c8fd002809848b204aee83a44161375e8144bffcc048fde748f4f778162bbef",
|
|
@@ -974,7 +975,7 @@
|
|
|
974
975
|
"MODELS/$ai/$folder/$class/$provider/handlers/pages/form/provider/$handler/class.js": "8d327820cefd696d351ac4fa7998994039e4d57ef7a9f8ae297209e4dd1b0a9e",
|
|
975
976
|
"MODELS/$ai/$folder/$class/$provider/handlers/pages/form/provider/$handler/provider.js": "b9ddf0040a9cd12e0dacd2dd3a61a1f0e62686cc664d02ef446326bc3991f4ce",
|
|
976
977
|
"MODELS/$ai/$folder/$class/$provider/handlers/pages/form/trainer/$handler/class.js": "06b279a1c053deb37dd7401c84df7f9370309b8dfbd35b368ab1bab4f635cb3f",
|
|
977
|
-
"MODELS/$ai/$folder/$class/$provider/handlers/pages/form/trainer/$handler/trainer.js": "
|
|
978
|
+
"MODELS/$ai/$folder/$class/$provider/handlers/pages/form/trainer/$handler/trainer.js": "551b44fc3b86ca86d09c4b2f0dfa961396a1ccdaa14ec93acaaee47ab01483ca",
|
|
978
979
|
"MODELS/$ai/$folder/$class/$provider/readme.md": "d6ceef2010231ab121510c3d3f35630dd7009a069c7723f6673a0e264799b227",
|
|
979
980
|
"MODELS/$ai/class.js": "54e1bbbde88f8b1f272ff7f5cad87243407591748a44719b7ec90ae2b4962de7",
|
|
980
981
|
"MODELS/$ai/readme.md": "90d70305a2c85312282cf67cc468a0f0b417495cb3d5b3d2ca60c6f44b81cb77",
|
|
@@ -986,8 +987,9 @@
|
|
|
986
987
|
"MODELS/GigaChat/GigaChat 2 Pro/$ai/class.js": "c4f4e712ec6053b68cf4a789e6a82d044af7cb4f2bbae6ccc6ef0b1fe388dd56",
|
|
987
988
|
"MODELS/GigaChat/GigaChat Embeddings/$ai/class.js": "f68c9ca4f7aefa287a34ebfd8522866ba3b10ad500ee01727cae8687e9858b64",
|
|
988
989
|
"MODELS/Local/$provider/$folder/$class/$ai/class.js": "15862b03c00e3a0fbde31fdcbe173c3c782dbe28dc9e97d731dc1440da5ba448",
|
|
989
|
-
"MODELS/Local/$provider/class.js": "
|
|
990
|
+
"MODELS/Local/$provider/class.js": "5cbbd436ae0dbacc7432941aec6c98ac97e6274c5f83ba196bef844f213bf691",
|
|
990
991
|
"MODELS/Local/$provider/handlers/methods/transfer/$handler/class.js": "429bc336fadec8ded4443da989375c2fb4fa9000eb95ef6fc41c330aab22ac23",
|
|
992
|
+
"MODELS/Local/Qwen3.8-Flash-Next/$ai/class.js": "de4d47f9fd80ae0f791c2a7e2ed221692d1ee43024a6659ef24975a69d54a2bd",
|
|
991
993
|
"MODELS/MTS-AI/$provider/$folder/$class/$ai/class.js": "cbb38faf8f50df3ca48aba16e5b71078e1280aa756dc61a9a510eb14c8269d55",
|
|
992
994
|
"MODELS/MTS-AI/$provider/class.js": "024d943c3c5d45e83a9a2022311033ed2bb3832da25b77e972d6fa7bf2250ff9",
|
|
993
995
|
"MODELS/MTS-AI/Cotype Lite/$ai/class.js": "7f7e7e94a0fc7eea1397fa6f0ed3926997872fff410a7b8051a637fe6d8c9693",
|
|
@@ -850,7 +850,7 @@ export default {
|
|
|
850
850
|
id: d.folderName || halo?.nodeName || d.repoId,
|
|
851
851
|
repoId: d.repoId || halo?.hfRepo || '',
|
|
852
852
|
label: halo?.label || d.label || d.folderName || d.repoId,
|
|
853
|
-
desc: halo?.role || d.repoId || `Папка
|
|
853
|
+
desc: halo?.role || d.repoId || `Папка модели: ${d.folderName}/$ai/#weights`,
|
|
854
854
|
icon: halo?.icon || 'ai:ollama',
|
|
855
855
|
modality: halo?.modality || d.modality || 'llm',
|
|
856
856
|
isHalo: Boolean(halo),
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* Local — единый провайдер ($provider) локальных моделей ИИ, дообучения (LoRA / SFT / GRPO)
|
|
3
3
|
* и аппаратного контура Halo (AMD Ryzen™ AI Max+ PRO 395/495 · 128–192 ГБ Unified Memory: GPU + NPU).
|
|
4
4
|
*
|
|
5
|
-
* В чистой поставке папка /MODELS/Local
|
|
6
|
-
*
|
|
5
|
+
* В чистой поставке папка /MODELS/Local содержит только метапапку $provider — дочерние узлы моделей ($ai)
|
|
6
|
+
* создаются автоматически при установке модели (веса и загрузка хранятся внутри метапапки модели $ai/#weights).
|
|
7
7
|
*/
|
|
8
8
|
export default {
|
|
9
9
|
icon: 'carbon:chip',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "odant-work",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.26",
|
|
4
4
|
"description": "ODANT-WORK — платформа цифровой организации (встроенная система учёта, документооборот, управление процессами и приватный мультимодальный ИИ)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "sources/work.js",
|
|
@@ -53,8 +53,11 @@ if (!candidates.length) {
|
|
|
53
53
|
process.exit(1);
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
+
const NPM_INTENTIONAL_EXCLUDE = /^MODELS\/(?:odant|Halogen)\/|^MODELS\/Local\/(?!\$provider\/)/;
|
|
57
|
+
const gitCandidates = candidates.filter(f => !/^MODELS\/Local\/(?!\$provider\/)/.test(f));
|
|
58
|
+
|
|
56
59
|
// git check-ignore --stdin печатает только игнорируемые пути; код 1 — «ни один» (это норма)
|
|
57
|
-
const res = spawnSync('git', ['check-ignore', '--no-index', '--stdin'], { cwd: ROOT, input:
|
|
60
|
+
const res = spawnSync('git', ['check-ignore', '--no-index', '--stdin'], { cwd: ROOT, input: gitCandidates.join('\n') + '\n', encoding: 'utf-8' });
|
|
58
61
|
if (res.error) {
|
|
59
62
|
console.error('check-ignored-code: git недоступен (' + res.error.message + ')');
|
|
60
63
|
process.exit(1);
|
|
@@ -69,7 +72,6 @@ if (ignored.length) {
|
|
|
69
72
|
|
|
70
73
|
// Проверяем также .npmignore через npm pack --dry-run --json (кроме tests и license-server)
|
|
71
74
|
const NPM_CODE_ROOTS = new Set(['$server', 'sources', 'oda', 'scripts', 'rules', 'MODELS', 'NODES', 'SERVICES']);
|
|
72
|
-
const NPM_INTENTIONAL_EXCLUDE = /^MODELS\/(?:odant|Halogen)\/|^MODELS\/Local\/(?!\$provider\/)/;
|
|
73
75
|
const npmCandidates = candidates.filter(f => {
|
|
74
76
|
if (NPM_INTENTIONAL_EXCLUDE.test(f))
|
|
75
77
|
return false;
|
package/sources/data/progress.md
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
# Прогресс: sources/data
|
|
2
2
|
|
|
3
3
|
## Последние изменения
|
|
4
|
+
- [17:14, 15.11] Приведение `MODELS/Local` к правилу метапапок ODANT/WORK (`sources/modules/trainer/{paths,huggingface,runner,dataset,halogen,local-engine,providers,transfer}.js`, `sources/modules/license/index.js`, `sources/host/auto-updater.js`, `scripts/check-ignored-code.mjs`, `.gitignore`, `.npmignore`, `MODELS/Local/$provider/class.js`, `tests/{trainer-transfer,trainer-unsloth,halogen-provider}.test.js`, `odant-work@1.0.26`):
|
|
5
|
+
- **Всё относящееся к классу — внутри метапапки (`paths.js`):** служебные каталоги провайдера `Local` (`#datasets`, `#adapters`, `#runtime`, `#cache`, `#tmp`) перенесены внутрь его метапапки `MODELS/Local/$provider/`. Внутри `MODELS/Local/` остаются только `$provider/` и дети-модели `MODELS/Local/<Модель>/`.
|
|
6
|
+
- **Загрузка и веса каждой модели — внутри её метапапки `$ai`:** внешняя папка `MODELS/Local/#downloads` упразднена; загрузка с Hugging Face (`.part` + `download-state.json`) и итоговые веса пишутся сразу в `MODELS/Local/<Модель>/$ai/#weights/`, а узел `$ai/class.js` создаётся при старте (оставаясь неактивным, пока веса не докачаны и в `#weights` нет готовых файлов весов). Устранена гонка фоновой записи `download-state.json` с его удалением после завершения загрузки (`stateWriteChain`).
|
|
7
|
+
- **Безопасная авто-миграция (`migrateLocalModelsLayoutSync`):** существующие папки `#downloads/<Модель>`, `<Модель>/#weights`, `#datasets`, `#adapters`, `#runtime`, `#cache` автоматически и без потерь переносятся внутрь `$ai` и `$provider` (в т.ч. перенесены уже скачанные гигабайты `Qwen3.8-Flash-Next`), сохранена совместимость с импортом старых бэкапов и `.tar`.
|
|
4
8
|
- [16:44, 15.11] Панель «Сеть» и переключение настроек загрузок на лету (`sources/modules/trainer/{huggingface,index}.js`, `MODELS/$ai/$folder/$class/$provider/handlers/pages/form/trainer/$handler/trainer.js`, `tests/trainer-downloader.test.js`, `odant-work@1.0.24`):
|
|
5
9
|
- **Кнопка «Сохранить настройки» активна только при наличии изменений (`hasNetworkChanges`):** пока поля в панели «Сеть» совпадают с сохранённой конфигурацией, кнопка `disabled` (`.btn:disabled` с приглушённым видом). Очистка прокси/токена («Сбросить» / «Удалить») меняет форму локально и применяется на сервер единым сохранением.
|
|
6
10
|
- **Бесшовный перезапуск активных загрузок при смене сетевых настроек (`restartActiveHuggingFaceDownloads`):** при сохранении новых настроек (`trainer_network_set`) текущие активные загрузки ставят воркеры на паузу, дожидаются закрытия файловых дескрипторов и сразу возобновляются с тех же диапазонов на новом источнике, прокси или числе потоков.
|
|
@@ -103,6 +103,7 @@ export function isProtectedUserPath(relPath) {
|
|
|
103
103
|
if (
|
|
104
104
|
rel.includes('/#weights/') || rel.includes('/#datasets/') || rel.includes('/#adapters/')
|
|
105
105
|
|| rel.includes('/#downloads/') || rel.includes('/#cache/') || rel.includes('/#runtime/')
|
|
106
|
+
|| rel.includes('/#tmp/')
|
|
106
107
|
)
|
|
107
108
|
return true;
|
|
108
109
|
if (/\.(safetensors|gguf|bin|pt|pth|onnx)$/i.test(rel))
|
|
@@ -850,13 +850,15 @@ export function inspectPreinstalledModels(rootDir = '.') {
|
|
|
850
850
|
return PAK_HARDWARE_SPEC.preinstalledModels.map(m => {
|
|
851
851
|
const rel = m.path.replace(/^\/+/, '');
|
|
852
852
|
const classFile = path.join(rootDir, rel, '$ai', 'class.js');
|
|
853
|
-
const
|
|
853
|
+
const canonicalWeightsDir = path.join(rootDir, rel, '$ai', '#weights');
|
|
854
|
+
const legacyWeightsDir = path.join(rootDir, rel, '#weights');
|
|
855
|
+
const weightsDir = fs.existsSync(canonicalWeightsDir) ? canonicalWeightsDir : legacyWeightsDir;
|
|
854
856
|
const configured = fs.existsSync(classFile);
|
|
855
857
|
let weightsReady = false;
|
|
856
858
|
try {
|
|
857
859
|
if (fs.existsSync(weightsDir)) {
|
|
858
860
|
const files = fs.readdirSync(weightsDir);
|
|
859
|
-
weightsReady = files.some(f => /\.(safetensors|gguf|bin|onnx)$/i.test(f));
|
|
861
|
+
weightsReady = files.some(f => !f.endsWith('.part') && /\.(safetensors|gguf|bin|onnx|hgn|hnpw)$/i.test(f));
|
|
860
862
|
}
|
|
861
863
|
}
|
|
862
864
|
catch { /* ignore */ }
|
|
@@ -16,6 +16,7 @@ import { classSchema, checkSchema, objectTitle } from '../../data/schema.js';
|
|
|
16
16
|
import { queryObjects } from '../../data/objects.js';
|
|
17
17
|
import { previewEntries } from '../../data/posting.js';
|
|
18
18
|
import { trialBalance, journal } from '../../data/reports.js';
|
|
19
|
+
import { localDatasetsDir, migrateLocalModelsLayoutSync } from './paths.js';
|
|
19
20
|
|
|
20
21
|
const SECRET_PATTERNS = [
|
|
21
22
|
/\bsk-[A-Za-z0-9_-]{16,}\b/g,
|
|
@@ -317,7 +318,8 @@ export async function buildWorkDataset({
|
|
|
317
318
|
});
|
|
318
319
|
|
|
319
320
|
const safeName = String(name || 'work-sft-dataset').replace(/[^A-Za-z0-9_.-]/g, '-');
|
|
320
|
-
|
|
321
|
+
migrateLocalModelsLayoutSync(rootDir);
|
|
322
|
+
const datasetsDir = localDatasetsDir(rootDir);
|
|
321
323
|
await fsp.mkdir(datasetsDir, { recursive: true });
|
|
322
324
|
|
|
323
325
|
const jsonlFile = path.join(datasetsDir, `${safeName}.jsonl`);
|
|
@@ -353,7 +355,8 @@ export async function buildWorkDataset({
|
|
|
353
355
|
* Список собранных датасетов в `MODELS/Local/#datasets/`.
|
|
354
356
|
*/
|
|
355
357
|
export async function listWorkDatasets(rootDir = process.cwd()) {
|
|
356
|
-
|
|
358
|
+
migrateLocalModelsLayoutSync(rootDir);
|
|
359
|
+
const datasetsDir = localDatasetsDir(rootDir);
|
|
357
360
|
if (!fs.existsSync(datasetsDir))
|
|
358
361
|
return [];
|
|
359
362
|
const entries = await fsp.readdir(datasetsDir);
|
|
@@ -36,6 +36,14 @@ import crypto from 'node:crypto';
|
|
|
36
36
|
import { spawn } from 'node:child_process';
|
|
37
37
|
import { startHuggingFaceDownload, listHuggingFaceDownloads, registerLocalModelNode } from './huggingface.js';
|
|
38
38
|
import { loadTrainerNetworkSettings, createNetworkFetch, downloadFileMultipart } from './downloader.js';
|
|
39
|
+
import {
|
|
40
|
+
localRuntimeDir,
|
|
41
|
+
localCacheDir,
|
|
42
|
+
modelWeightsDir,
|
|
43
|
+
modelClassFile,
|
|
44
|
+
migrateLocalModelsLayoutSync,
|
|
45
|
+
WEIGHT_FILE_EXT_RE,
|
|
46
|
+
} from './paths.js';
|
|
39
47
|
|
|
40
48
|
export const HALOGEN_DEFAULT_PORT = Number(process.env.HALOGEN_API_PORT) || 8731;
|
|
41
49
|
export const HALOGEN_DEFAULT_BASE_URL = process.env.HALOGEN_BASE_URL || `http://127.0.0.1:${HALOGEN_DEFAULT_PORT}/v1/chat/completions`;
|
|
@@ -467,16 +475,16 @@ export function computeHalogenMemoryPlan({
|
|
|
467
475
|
` --served-model-name halogen-qwen3.8-flash-next ^`,
|
|
468
476
|
` --profile ${kvSlots > 1 ? 'subagents' : 'default'} --context ${contextTokens} ^`,
|
|
469
477
|
` --npu-prefill on ^`,
|
|
470
|
-
` --cache-disk "MODELS\\Local\\#cache\\disk"`,
|
|
478
|
+
` --cache-disk "MODELS\\Local\\$provider\\#cache\\disk"`,
|
|
471
479
|
].join('\n');
|
|
472
480
|
|
|
473
481
|
const windowsGufoServicesCommand = [
|
|
474
|
-
`gufo.exe serve --host 127.0.0.1 --port ${HALOGEN_DEFAULT_PORT} llm --model "MODELS\\Local\\Qwen3.8-Flash-Next\\#weights\\Qwen3.8-Flash-Next-UD-Q4_K_XL-00001-of-00004.gguf" --served-model-name halogen-qwen3.8-flash-next --speculative mtp`,
|
|
475
|
-
`gufo.exe serve asr --model "MODELS\\Local\\Qwen3-ASR-NPU\\#weights"`,
|
|
476
|
-
`gufo.exe serve tts --model "MODELS\\Local\\Qwen3-TTS-NPU\\#weights"`,
|
|
477
|
-
`gufo.exe serve embedding --model "MODELS\\Local\\Qwen3-Embedding-NPU\\#weights"`,
|
|
478
|
-
`gufo.exe serve image --model "MODELS\\Local\\Flux2-Klein-NPU\\#weights"`,
|
|
479
|
-
`gufo.exe serve decision --model "MODELS\\Local\\Decider-NPU\\#weights"`,
|
|
482
|
+
`gufo.exe serve --host 127.0.0.1 --port ${HALOGEN_DEFAULT_PORT} llm --model "MODELS\\Local\\Qwen3.8-Flash-Next\\$ai\\#weights\\Qwen3.8-Flash-Next-UD-Q4_K_XL-00001-of-00004.gguf" --served-model-name halogen-qwen3.8-flash-next --speculative mtp`,
|
|
483
|
+
`gufo.exe serve asr --model "MODELS\\Local\\Qwen3-ASR-NPU\\$ai\\#weights"`,
|
|
484
|
+
`gufo.exe serve tts --model "MODELS\\Local\\Qwen3-TTS-NPU\\$ai\\#weights"`,
|
|
485
|
+
`gufo.exe serve embedding --model "MODELS\\Local\\Qwen3-Embedding-NPU\\$ai\\#weights"`,
|
|
486
|
+
`gufo.exe serve image --model "MODELS\\Local\\Flux2-Klein-NPU\\$ai\\#weights"`,
|
|
487
|
+
`gufo.exe serve decision --model "MODELS\\Local\\Decider-NPU\\$ai\\#weights"`,
|
|
480
488
|
].join('\n');
|
|
481
489
|
|
|
482
490
|
const windowsStrataCommand = `strata launch --family qwen --model iq3_s --port ${HALOGEN_DEFAULT_PORT}`;
|
|
@@ -530,8 +538,11 @@ export function computeHalogenMemoryPlan({
|
|
|
530
538
|
export function inspectWindowsHalogenEnvironment({ rootDir = process.cwd() } = {}) {
|
|
531
539
|
const localAppData = process.env.LOCALAPPDATA || path.join(os.homedir(), 'AppData', 'Local');
|
|
532
540
|
const systemRoot = process.env.SystemRoot || 'C:\\Windows';
|
|
541
|
+
const rtBase = localRuntimeDir(rootDir);
|
|
533
542
|
|
|
534
543
|
const buboCandidates = [
|
|
544
|
+
path.join(rtBase, 'bubo', 'bin', 'bubo.exe'),
|
|
545
|
+
path.join(rtBase, 'bubo', 'bubo.exe'),
|
|
535
546
|
path.join(rootDir, 'MODELS', 'Local', '#runtime', 'bubo', 'bin', 'bubo.exe'),
|
|
536
547
|
path.join(rootDir, 'MODELS', 'Local', '#runtime', 'bubo', 'bubo.exe'),
|
|
537
548
|
path.join(rootDir, 'MODELS', 'Halogen', '#runtime', 'bubo', 'bin', 'bubo.exe'),
|
|
@@ -544,10 +555,11 @@ export function inspectWindowsHalogenEnvironment({ rootDir = process.cwd() } = {
|
|
|
544
555
|
? (path.basename(path.dirname(buboExePath)).toLowerCase() === 'bin'
|
|
545
556
|
? path.dirname(path.dirname(buboExePath))
|
|
546
557
|
: path.dirname(buboExePath))
|
|
547
|
-
: path.join(
|
|
558
|
+
: path.join(rtBase, 'bubo');
|
|
548
559
|
|
|
549
560
|
const rocmCandidates = [
|
|
550
561
|
process.env.BUBO_RUNTIME_DIR || '',
|
|
562
|
+
path.join(rtBase, 'bubo', 'runtime', 'rocm-10.0.0-gfx1151'),
|
|
551
563
|
path.join(rootDir, 'MODELS', 'Local', '#runtime', 'bubo', 'runtime', 'rocm-10.0.0-gfx1151'),
|
|
552
564
|
path.join(rootDir, 'MODELS', 'Halogen', '#runtime', 'bubo', 'runtime', 'rocm-10.0.0-gfx1151'),
|
|
553
565
|
path.join(localAppData, 'Bubo', 'runtime', 'rocm-10.0.0-gfx1151'),
|
|
@@ -556,6 +568,7 @@ export function inspectWindowsHalogenEnvironment({ rootDir = process.cwd() } = {
|
|
|
556
568
|
|
|
557
569
|
const manifestCandidates = [
|
|
558
570
|
process.env.BUBO_MANIFEST || '',
|
|
571
|
+
path.join(modelWeightsDir(rootDir, 'Qwen3.8-Flash-Next', 'Local'), 'bubo-package.json'),
|
|
559
572
|
path.join(rootDir, 'MODELS', 'Local', 'models', 'qwen38-flash-next-base-ud-q4-k-xl-v1', 'bubo-package.json'),
|
|
560
573
|
path.join(rootDir, 'MODELS', 'Local', 'models', 'huihui-qwen38-flash-next-ud-q4-k-xl-v1', 'bubo-package.json'),
|
|
561
574
|
path.join(rootDir, 'MODELS', 'Local', 'Qwen3.8-Flash-Next', '#weights', 'bubo-package.json'),
|
|
@@ -568,6 +581,8 @@ export function inspectWindowsHalogenEnvironment({ rootDir = process.cwd() } = {
|
|
|
568
581
|
const buboManifestPath = manifestCandidates.find(p => fs.existsSync(p)) || null;
|
|
569
582
|
|
|
570
583
|
const gufoCandidates = [
|
|
584
|
+
path.join(rtBase, 'gufo', 'gufo.exe'),
|
|
585
|
+
path.join(rtBase, 'bubo', 'bin', 'gufo.exe'),
|
|
571
586
|
path.join(rootDir, 'MODELS', 'Local', '#runtime', 'gufo', 'gufo.exe'),
|
|
572
587
|
path.join(rootDir, 'MODELS', 'Local', '#runtime', 'bubo', 'bin', 'gufo.exe'),
|
|
573
588
|
path.join(rootDir, 'MODELS', 'Halogen', '#runtime', 'gufo', 'gufo.exe'),
|
|
@@ -579,6 +594,7 @@ export function inspectWindowsHalogenEnvironment({ rootDir = process.cwd() } = {
|
|
|
579
594
|
const strataCandidates = [
|
|
580
595
|
path.join(localAppData, 'Programs', 'Strata', 'strata.exe'),
|
|
581
596
|
path.join(localAppData, 'Strata', 'strata.exe'),
|
|
597
|
+
path.join(rtBase, 'strata', 'strata.exe'),
|
|
582
598
|
path.join(rootDir, 'MODELS', 'Local', '#runtime', 'strata', 'strata.exe'),
|
|
583
599
|
path.join(rootDir, 'MODELS', 'Halogen', '#runtime', 'strata', 'strata.exe'),
|
|
584
600
|
];
|
|
@@ -789,6 +805,7 @@ function findLocalGgufModel(rootDir = process.cwd()) {
|
|
|
789
805
|
if (!entry.isDirectory() || entry.name.startsWith('$') || entry.name.startsWith('#'))
|
|
790
806
|
continue;
|
|
791
807
|
const candidates = [
|
|
808
|
+
path.join(base, entry.name, '$ai', '#weights'),
|
|
792
809
|
path.join(base, entry.name, '#weights'),
|
|
793
810
|
path.join(base, entry.name),
|
|
794
811
|
];
|
|
@@ -819,7 +836,8 @@ export async function prepareWindowsBuboRuntime({
|
|
|
819
836
|
fetchImpl = globalThis.fetch,
|
|
820
837
|
spawnImpl = spawn,
|
|
821
838
|
} = {}) {
|
|
822
|
-
|
|
839
|
+
migrateLocalModelsLayoutSync(rootDir);
|
|
840
|
+
const runtimeRoot = localRuntimeDir(rootDir);
|
|
823
841
|
const buboDir = path.join(runtimeRoot, 'bubo');
|
|
824
842
|
const rocmDir = path.join(buboDir, 'runtime', 'rocm-10.0.0-gfx1151');
|
|
825
843
|
const modelsOutDir = path.join(rootDir, 'MODELS', 'Local');
|
|
@@ -1010,7 +1028,7 @@ export async function startHalogenBackend({
|
|
|
1010
1028
|
}
|
|
1011
1029
|
|
|
1012
1030
|
const winEnv = inspectWindowsHalogenEnvironment({ rootDir });
|
|
1013
|
-
const cacheDir =
|
|
1031
|
+
const cacheDir = localCacheDir(rootDir);
|
|
1014
1032
|
fs.mkdirSync(path.join(cacheDir, 'disk'), { recursive: true });
|
|
1015
1033
|
fs.mkdirSync(path.join(cacheDir, 'slots'), { recursive: true });
|
|
1016
1034
|
|
|
@@ -1363,12 +1381,12 @@ export async function ensureHalogenModelNodes(rootDir = process.cwd(), { models
|
|
|
1363
1381
|
|
|
1364
1382
|
const registered = [];
|
|
1365
1383
|
for (const spec of targets) {
|
|
1366
|
-
const weightsDir =
|
|
1384
|
+
const weightsDir = modelWeightsDir(rootDir, spec.nodeName, 'Local');
|
|
1367
1385
|
if (onlyWithWeights) {
|
|
1368
1386
|
let hasFiles = false;
|
|
1369
1387
|
try {
|
|
1370
1388
|
if (fs.existsSync(weightsDir)) {
|
|
1371
|
-
hasFiles = fs.readdirSync(weightsDir).some(f => !f.endsWith('.part') && f !== 'hf-manifest.json');
|
|
1389
|
+
hasFiles = fs.readdirSync(weightsDir).some(f => !f.endsWith('.part') && f !== 'hf-manifest.json' && f !== 'download-state.json');
|
|
1372
1390
|
}
|
|
1373
1391
|
}
|
|
1374
1392
|
catch { /* ignore */ }
|
|
@@ -1405,30 +1423,37 @@ export async function ensureHalogenModelNodes(rootDir = process.cwd(), { models
|
|
|
1405
1423
|
* Проверить наличие скачанных весов и узлов `$ai` для каждой модели из `HALOGEN_MODELS_CATALOG` в `MODELS/Local/<nodeName>/#weights`.
|
|
1406
1424
|
*/
|
|
1407
1425
|
export function inspectHalogenCatalogWithStatus(rootDir = process.cwd()) {
|
|
1408
|
-
|
|
1426
|
+
migrateLocalModelsLayoutSync(rootDir);
|
|
1427
|
+
const activeDownloads = listHuggingFaceDownloads(rootDir);
|
|
1409
1428
|
return HALOGEN_MODELS_CATALOG.map(spec => {
|
|
1410
|
-
const localWeightsDir =
|
|
1411
|
-
const
|
|
1412
|
-
const
|
|
1429
|
+
const localWeightsDir = modelWeightsDir(rootDir, spec.nodeName, 'Local');
|
|
1430
|
+
const legacyLocalDir = path.join(rootDir, 'MODELS', 'Local', spec.nodeName, '#weights');
|
|
1431
|
+
const legacyHalogenDir = path.join(rootDir, 'MODELS', 'Halogen', spec.nodeName, '#weights');
|
|
1432
|
+
const weightsDir = fs.existsSync(localWeightsDir) ? localWeightsDir
|
|
1433
|
+
: (fs.existsSync(legacyLocalDir) ? legacyLocalDir
|
|
1434
|
+
: (fs.existsSync(legacyHalogenDir) ? legacyHalogenDir : localWeightsDir));
|
|
1413
1435
|
let downloadedFiles = [];
|
|
1436
|
+
let hasPendingDownload = false;
|
|
1414
1437
|
if (fs.existsSync(weightsDir)) {
|
|
1415
1438
|
try {
|
|
1416
|
-
|
|
1417
|
-
|
|
1439
|
+
const rawEntries = fs.readdirSync(weightsDir);
|
|
1440
|
+
hasPendingDownload = rawEntries.some(f => f.endsWith('.part') || f === 'download-state.json');
|
|
1441
|
+
downloadedFiles = rawEntries
|
|
1442
|
+
.filter(f => !f.endsWith('.part') && f !== 'hf-manifest.json' && f !== 'download-state.json' && !f.endsWith('.tmp'));
|
|
1418
1443
|
}
|
|
1419
1444
|
catch { /* ignore */ }
|
|
1420
1445
|
}
|
|
1421
|
-
const nodeConfigured = fs.existsSync(
|
|
1446
|
+
const nodeConfigured = fs.existsSync(modelClassFile(rootDir, spec.nodeName, 'Local'));
|
|
1422
1447
|
const activeJob = activeDownloads.find(d =>
|
|
1423
|
-
d.status === 'downloading'
|
|
1448
|
+
(d.status === 'downloading' || d.status === 'paused' || d.status === 'failed')
|
|
1424
1449
|
&& (d.repoId === spec.hfRepo || d.folderName === spec.nodeName || d.modelPath === spec.path)
|
|
1425
1450
|
) || null;
|
|
1426
|
-
const hasRealWeightFile = downloadedFiles.some(f =>
|
|
1451
|
+
const hasRealWeightFile = downloadedFiles.some(f => WEIGHT_FILE_EXT_RE.test(f));
|
|
1427
1452
|
return {
|
|
1428
1453
|
...spec,
|
|
1429
1454
|
nodeConfigured,
|
|
1430
1455
|
weightsDir: path.relative(rootDir, weightsDir).replace(/\\/g, '/'),
|
|
1431
|
-
weightsDownloaded: !activeJob && hasRealWeightFile,
|
|
1456
|
+
weightsDownloaded: !activeJob && !hasPendingDownload && hasRealWeightFile,
|
|
1432
1457
|
downloadedFiles,
|
|
1433
1458
|
activeDownload: activeJob,
|
|
1434
1459
|
};
|
|
@@ -1461,7 +1486,7 @@ export async function downloadHalogenBundle({
|
|
|
1461
1486
|
)
|
|
1462
1487
|
: [...HALOGEN_MODELS_CATALOG];
|
|
1463
1488
|
|
|
1464
|
-
const existingDownloads = listHuggingFaceDownloads();
|
|
1489
|
+
const existingDownloads = listHuggingFaceDownloads(rootDir);
|
|
1465
1490
|
const jobs = [];
|
|
1466
1491
|
let startedCount = 0;
|
|
1467
1492
|
let alreadyActiveCount = 0;
|