odant-work 1.0.55 → 1.0.56

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.
Files changed (41) hide show
  1. package/#system/package-manifest.json +32 -38
  2. package/$server/$folder/$class/$structure/$server/class.js +17 -1
  3. package/MODELS/$ai/$folder/$class/$ai/handlers/pages/form/trainer/$handler/trainer.js +26 -1
  4. package/MODELS/$ai/$folder/$class/$provider/handlers/pages/form/trainer/$handler/trainer.js +8 -1
  5. package/SERVICES/$service/$folder/$storage/$service/handlers/pages/form/mcp/$handler/mcp.js +22 -4
  6. package/SERVICES/1C/$service/class.js +209 -0
  7. package/SERVICES/Bitrix24/$service/class.js +180 -0
  8. package/SERVICES/CBR/$service/class.js +263 -0
  9. package/SERVICES/DaData/$service/class.js +352 -0
  10. package/SERVICES/DuckDuckGo/$service/class.js +3 -2
  11. package/SERVICES/RuCalendar/$service/class.js +289 -0
  12. package/SERVICES/SearXNG/$service/class.js +3 -1
  13. package/SERVICES/Telegram/$service/class.js +170 -114
  14. package/SERVICES/Weather/$service/class.js +3 -1
  15. package/SERVICES/Yandex/$service/class.js +4 -2
  16. package/SERVICES/YandexDisk/$service/class.js +191 -0
  17. package/SERVICES/readme.md +31 -43
  18. package/package.json +1 -1
  19. package/sources/data/progress.md +14 -0
  20. package/sources/modules/agent/extensions.js +118 -39
  21. package/sources/modules/agent/voice.js +1 -1
  22. package/sources/modules/trainer/halogen.js +24 -3
  23. package/sources/modules/trainer/huggingface.js +73 -11
  24. package/sources/modules/trainer/index.js +54 -29
  25. package/sources/modules/trainer/local-engine.js +38 -8
  26. package/sources/modules/trainer/paths.js +8 -0
  27. package/sources/modules/trainer/providers.js +14 -0
  28. package/sources/modules/trainer/worker/local_infer_worker.py +160 -1
  29. package/sources/server/access/gateway.js +1 -0
  30. package/SERVICES/ArgoCD/$service/$folder/$class/$service/class.js +0 -356
  31. package/SERVICES/ArgoCD/$service/$folder/$class/$service/handlers/pages/form/orders/$handler/class.js +0 -244
  32. package/SERVICES/ArgoCD/$service/$folder/$class/$service/handlers/pages/form/settings/$handler/class.js +0 -135
  33. package/SERVICES/ArgoCD/$service/class.js +0 -4
  34. package/SERVICES/ArgoCD/$service/readme.md +0 -63
  35. package/SERVICES/ArgoCD/PaaS/$service/$folder/$class/$service/class.js +0 -10
  36. package/SERVICES/ArgoCD/PaaS/$service/$folder/$class/$service/methods/checkDomain/$method/class.js +0 -33
  37. package/SERVICES/ArgoCD/PaaS/$service/$folder/$class/$service/methods/provision/$method/class.js +0 -225
  38. package/SERVICES/ArgoCD/PaaS/$service/$folder/$class/$service/methods/submitOrder/$method/class.js +0 -77
  39. package/SERVICES/ArgoCD/PaaS/$service/$folder/$class/$service/readme.md +0 -33
  40. package/SERVICES/ArgoCD/PaaS/$service/class.js +0 -347
  41. package/SERVICES/ArgoCD/PaaS/$service/order/pass.order +0 -9
@@ -1,6 +1,20 @@
1
1
  # Прогресс: sources/data
2
2
 
3
3
  ## Последние изменения
4
+ - [~17:15, 19.11] Поддержка `Kokoro-82M` (`kokoro`), исправление классификации `LTX-2.5-GGUF` и честная диагностика single-file / ComfyUI моделей (`FLUX.2-klein-4b-fp8`, `LTX-2.5-GGUF`) (`sources/modules/trainer/{paths,huggingface,providers,halogen,local-engine,index}.js`, `sources/modules/trainer/worker/local_infer_worker.py`, `sources/modules/agent/voice.js`, `MODELS/$ai/$folder/$class/{$ai,$provider}/handlers/pages/form/trainer/$handler/trainer.js`, `tests/halogen-speculation.test.js`):
5
+ - **Поддержка `hexgrad/Kokoro-82M` (`_find_kokoro_files`, `_handle_tts_kokoro`):** `local_infer_worker.py` и `local-engine.js` распознают `kokoro-v1_0.pth` + `config.json` + `voices/*.pt`, автоматически подтягивают Python-пакет `kokoro` + `soundfile` вместо `qwen-tts` и озвучивают локально без обращений к сети; в карточке `$ai` добавлены пресеты голосов (`af_heart`, `af_bella`, `am_adam`, `am_michael`, `bf_emma`, `bm_george`) и английская тестовая фраза по умолчанию.
6
+ - **Классификация `LTX-2.5-GGUF` и изоляция `bubo.exe` (`huggingface.js`, `halogen.js`, `index.js`, `local-engine.js`):** `inferModalityAndCapabilities` распознаёт `ltx-2` / `ltx-2.5` / `ltxv` как `video`, `registerLocalModelNode` не назначает `protocol: 'openai'` видео/аудио/image-моделям в `.gguf`, `trainer_model_info` автоматически исправляет ранее сохранённые карточки (`modality: 'video'`, `protocol: 'local'`, `icon: 'av:videocam'`), а `findLocalGgufModel` и `localStreamChat` больше не передают диффузионные `.gguf` в `bubo.exe`.
7
+ - **Диагностика single-file / ComfyUI чекпоинтов (`FLUX.2-klein-4b-fp8`, `LTX-2.5-GGUF`):** `assessDiffusionRepoCompatibility`, `evaluateAiNodeActivitySync`, `localGenerateImage/Video` и каталог `/MODELS/Local` заранее предупреждают о моделях без `model_index.json` (пайплайна Diffusers), блокируют ошибочную установку и отображают понятное объяснение с кнопкой удаления несовместимых весов.
8
+ - [~16:10, 19.11] Предустановленный пакет российских сервисов и бизнес-коннекторов в `/SERVICES` (`CBR`, `DaData`, `RuCalendar`, `1C`, `Bitrix24`, `YandexDisk`, `Telegram + MAX`), обновление `MCP_PRESETS` под РФ и фикс `400 Bad Request` в `distro_info` (`SERVICES/{CBR,DaData,RuCalendar,1C,Bitrix24,YandexDisk,Telegram,Yandex,SearXNG,DuckDuckGo,Weather}/$service/class.js`, `SERVICES/$service/$folder/$storage/$service/handlers/pages/form/mcp/$handler/mcp.js`, `sources/modules/agent/extensions.js`, `sources/server/access/gateway.js`, `$server/$folder/$class/$structure/$server/class.js`, `tests/system-projects-distro.test.js`, `odant-work@1.0.56`):
9
+ - **1. Справочно-финансовые сервисы РФ («из коробки» без ключей):**
10
+ - **`/SERVICES/CBR` («Банк России / ЦБ РФ»)** — официальные курсы валют ЦБ РФ на любую дату (`get_rates`), валютный калькулятор по курсу ЦБ (`convert_currency`) и действующая ключевая ставка Банка России для расчёта пеней по ст. 395 ГК РФ (`get_key_rate`).
11
+ - **`/SERVICES/DaData` («Контрагенты и банки РФ: ИНН / ЕГРЮЛ / БИК / ФИАС»)** — офлайн-проверка контрольных разрядов ИНН (10/12 цифр), ОГРН/ОГРНИП (13/15 цифр), БИК и ключевания 20-значного расчётного счёта по методике ФНС и ЦБ РФ (`validate_requisites`), поиск банка по БИК (`find_bank`), а при указании бесплатного ключа DaData — автозаполнение карточки контрагента из ЕГРЮЛ/ЕГРИП по ИНН (`find_party`) и нормализация адресов ФИАС/ГАР (`clean_address`).
12
+ - **`/SERVICES/RuCalendar` («Производственный календарь РФ»)** — проверка любого дня по ТК РФ ст. 112 и постановлениям Правительства РФ о переносах выходных (`check_date`), расчёт количества рабочих дней и нормы часов (40/36/24 ч) между датами (`workdays_between`) и расчёт дедлайнов в рабочих днях РФ (`add_workdays`).
13
+ - **2. Корпоративные интеграции РФ и зачистка `/SERVICES`:**
14
+ - Добавлены коннекторы **`/SERVICES/1C` («1С:Предприятие OData»)** (`list_entities`, `query_entities`, `get_counterparty_by_inn`, `create_entity`), **`/SERVICES/Bitrix24` («Битрикс24 CRM»)** (`list_deals`, `list_leads`, `create_lead`, `create_task`) и **`/SERVICES/YandexDisk` («Яндекс 360 / Яндекс.Диск»)** (`list_files`, `get_download_link`, `upload_text`, `publish_resource`); удалён устаревший внутренний `ArgoCD/PaaS`.
15
+ - **`/SERVICES/Telegram` («Telegram и MAX: Уведомления»)** объединён с российским мессенджером **MAX** (`platform-api.max.ru`) и автоматически подхватывает ботов из вкладки «Мессенджеры» (`sources/modules/notify`).
16
+ - Витрина **`MCP_PRESETS`** дополнена российскими шаблонами (`1С:Предприятие MCP`, `Яндекс.Трекер / Yandex Cloud MCP`, `GitVerse / GitFlic MCP`, `Контур.Диадок / СБИС ЭДО MCP`, `Wildberries и Ozon Seller MCP`, `PostgreSQL / PostgresPro MCP`).
17
+ - **3. Фикс `400 Bad Request` на `?distro_info` / `?export_distro`:** методы `distro_info` и `export_distro` добавлены в `GATEWAY.MEMBERS` (`sources/server/access/gateway.js`) и в горяче-перезагружаемый слой `$server/$folder/$class/$structure/$server/class.js`.
4
18
  - [~15:30, 19.11] Виртуальная системная папка `SYSTEM` и чистый корень `WORK`, раздел «Проекты» (`/PROJECTS` + тип `$project` без вложенной оргструктуры) и создание автономного дистрибутива («функционального клона») из работающей системы (`sources/server/{server,folder,class,logs}.js`, `sources/server/class/{scaffold,base-template,archive,distro,security,search}.js`, `sources/data/{db,api,classes,schema,print,sql-inspector}.js`, `$server/$folder/lib/{tree/tree,node/node}.js`, `$server/$folder/handlers/methods/create/$handler/class.js`, `$server/$folder/$class/$structure/$project/**`, `PROJECTS/$domain/**`, `$server/$folder/$class/$structure/$server/handlers/methods/distro/$handler/class.js`, `tests/system-projects-distro.test.js`, `odant-work@1.0.55`):
5
19
  - **1. Чистый корень `WORK` и виртуальная системная папка `SYSTEM` (`sources/server/server.js`, `$server/$folder/lib/tree/tree.js`):**
6
20
  - В корне дерева `WORK` под основными разделами (`Организации`, `Проекты`, `Модули`, `Модели ИИ`, `Сеть`, `Сервисы и MCP`, `USERS`) снаружи оставлены только презентационные материалы и пользовательская документация (`docs`, `readme.md`, `whitepaper.md`, `whitepaper.pdf`).
@@ -22,11 +22,80 @@ import { ENGINE_AI, loadDocs } from './resources.js';
22
22
  export const SKILL_ID_RE = /^[a-z0-9][a-z0-9_-]{0,63}$/i;
23
23
  const SECRET_KEY_NAME = /(key|token|secret|auth|password|bearer|credential)/i;
24
24
 
25
- /** Пресеты популярных MCP-серверов для быстрой установки в /SERVICES. */
25
+ /** Пресеты популярных MCP-серверов для быстрой установки в /SERVICES (с фокусом на РФ и локальную инфраструктуру). */
26
26
  export const MCP_PRESETS = [
27
+ {
28
+ id: '1c-mcp',
29
+ label: '1С:Предприятие MCP (OData / HTTP)',
30
+ description: 'Подключение внешнего или корпоративного MCP-шлюза 1С:Предприятие 8.3 (Бухгалтерия, УНФ, УТ, ERP)',
31
+ icon: 'carbon:data-share',
32
+ transport: 'http',
33
+ mcp: {
34
+ url: 'http://localhost:8090/mcp/1c',
35
+ headers: { Authorization: 'secret:onec_mcp_token' },
36
+ },
37
+ },
38
+ {
39
+ id: 'yandex-tracker',
40
+ label: 'Яндекс.Трекер / Yandex Cloud MCP',
41
+ description: 'Управление задачами, очередями и спринтами в Яндекс.Трекере и ресурсами Yandex Cloud',
42
+ icon: 'carbon:task-complete',
43
+ transport: 'http',
44
+ mcp: {
45
+ url: 'https://mcp.cloud.yandex.net/tracker/mcp',
46
+ headers: {
47
+ Authorization: 'secret:yandex_oauth_token',
48
+ 'X-Org-ID': 'secret:yandex_org_id',
49
+ },
50
+ },
51
+ },
52
+ {
53
+ id: 'gitverse',
54
+ label: 'GitVerse / GitFlic MCP (РФ)',
55
+ description: 'Работа с российскими хостингами Git-репозиториев, запросами на слияние и задачами (GitVerse Сбер / GitFlic)',
56
+ icon: 'carbon:branch',
57
+ transport: 'http',
58
+ mcp: {
59
+ url: 'https://api.gitverse.ru/mcp',
60
+ headers: { Authorization: 'secret:gitverse_token' },
61
+ },
62
+ },
63
+ {
64
+ id: 'diadoc-edo',
65
+ label: 'Контур.Диадок / СБИС (ЭДО MCP)',
66
+ description: 'Проверка статуса УПД, актов, счетов-фактур и формализованных документов ЭДО',
67
+ icon: 'carbon:document-signed',
68
+ transport: 'http',
69
+ mcp: {
70
+ url: 'http://localhost:8091/mcp/diadoc',
71
+ headers: { Authorization: 'secret:diadoc_token' },
72
+ },
73
+ },
74
+ {
75
+ id: 'marketplaces-ru',
76
+ label: 'Wildberries и Ozon Seller MCP',
77
+ description: 'Остатки на складах, карточки товаров, заказы и финансовые отчёты селлера WB / Ozon',
78
+ icon: 'carbon:shopping-cart',
79
+ transport: 'http',
80
+ mcp: {
81
+ url: 'http://localhost:8092/mcp/marketplaces',
82
+ headers: { Authorization: 'secret:marketplace_api_key' },
83
+ },
84
+ },
85
+ {
86
+ id: 'postgres',
87
+ label: 'PostgreSQL / PostgresPro MCP',
88
+ description: 'Инспекция схемы и безопасные SQL-запросы к корпоративным БД PostgreSQL и PostgresPro',
89
+ icon: 'carbon:data-base',
90
+ transport: 'stdio',
91
+ mcp: {
92
+ command: 'npx',
93
+ args: ['-y', '@modelcontextprotocol/server-postgres', 'postgresql://localhost/mydb'],
94
+ },
95
+ },
27
96
  {
28
97
  id: 'filesystem',
29
- label: 'Filesystem MCP',
98
+ label: 'Filesystem MCP (Локальные файлы)',
30
99
  description: 'Доступ к разрешённым локальным каталогам через официальный @modelcontextprotocol/server-filesystem',
31
100
  icon: 'carbon:folder-details',
32
101
  transport: 'stdio',
@@ -36,25 +105,25 @@ export const MCP_PRESETS = [
36
105
  },
37
106
  },
38
107
  {
39
- id: 'git',
40
- label: 'Git MCP',
41
- description: 'Чтение истории, веток, diff и коммитов репозитория через mcp-server-git',
42
- icon: 'carbon:branch',
108
+ id: 'playwright',
109
+ label: 'Playwright Browser MCP (Браузер)',
110
+ description: 'Управление браузером, снапшоты DOM и автоматизация веб-интерфейсов (@playwright/mcp)',
111
+ icon: 'carbon:application-web',
43
112
  transport: 'stdio',
44
113
  mcp: {
45
- command: 'uvx',
46
- args: ['mcp-server-git', '--repository', '.'],
114
+ command: 'npx',
115
+ args: ['-y', '@playwright/mcp@latest'],
47
116
  },
48
117
  },
49
118
  {
50
- id: 'fetch',
51
- label: 'Fetch MCP',
52
- description: 'Загрузка веб-страниц и конвертация HTML в Markdown для ИИ-агентов',
53
- icon: 'carbon:earth',
119
+ id: 'git',
120
+ label: 'Git MCP (Репозиторий)',
121
+ description: 'Чтение истории, веток, diff и коммитов локального репозитория через mcp-server-git',
122
+ icon: 'carbon:branch',
54
123
  transport: 'stdio',
55
124
  mcp: {
56
125
  command: 'uvx',
57
- args: ['mcp-server-fetch'],
126
+ args: ['mcp-server-git', '--repository', '.'],
58
127
  },
59
128
  },
60
129
  {
@@ -69,25 +138,14 @@ export const MCP_PRESETS = [
69
138
  },
70
139
  },
71
140
  {
72
- id: 'playwright',
73
- label: 'Playwright Browser MCP',
74
- description: 'Управление браузером, снапшоты DOM и автоматизация веб-интерфейсов (@playwright/mcp)',
75
- icon: 'carbon:application-web',
76
- transport: 'stdio',
77
- mcp: {
78
- command: 'npx',
79
- args: ['-y', '@playwright/mcp@latest'],
80
- },
81
- },
82
- {
83
- id: 'postgres',
84
- label: 'PostgreSQL MCP',
85
- description: 'Инспекция схемы и безопасные SQL-запросы к БД PostgreSQL',
86
- icon: 'carbon:data-base',
141
+ id: 'fetch',
142
+ label: 'Fetch MCP',
143
+ description: 'Загрузка веб-страниц и конвертация HTML в Markdown для ИИ-агентов',
144
+ icon: 'carbon:earth',
87
145
  transport: 'stdio',
88
146
  mcp: {
89
- command: 'npx',
90
- args: ['-y', '@modelcontextprotocol/server-postgres', 'postgresql://localhost/mydb'],
147
+ command: 'uvx',
148
+ args: ['mcp-server-fetch'],
91
149
  },
92
150
  },
93
151
  {
@@ -105,7 +163,7 @@ export const MCP_PRESETS = [
105
163
  {
106
164
  id: 'remote-http',
107
165
  label: 'Remote HTTP MCP',
108
- description: 'Подключение внешнего MCP-сервера по протоколу Streamable HTTP / SSE',
166
+ description: 'Подключение любого внешнего MCP-сервера по протоколу Streamable HTTP / SSE',
109
167
  icon: 'carbon:cloud-service-management',
110
168
  transport: 'http',
111
169
  mcp: {
@@ -817,16 +875,24 @@ export async function listMcpCatalog() {
817
875
  catch { /* fallback to reading class.js */ }
818
876
 
819
877
  if (!data) {
820
- try {
821
- const clsFile = path.join(servicesDir, e.name, '$service', 'class.js');
822
- if (fs.existsSync(clsFile)) {
878
+ const clsFile = path.join(servicesDir, e.name, '$service', 'class.js');
879
+ if (fs.existsSync(clsFile)) {
880
+ try {
823
881
  const raw = await fsp.readFile(clsFile, 'utf-8');
824
882
  const m = raw.match(/export\s+default\s+(\{[\s\S]*\})\s*;?\s*$/);
825
883
  if (m)
826
884
  data = JSON.parse(m[1]);
827
885
  }
886
+ catch { /* fallback to dynamic import */ }
887
+ if (!data) {
888
+ try {
889
+ const { pathToFileURL } = await import('node:url');
890
+ const mod = await import(pathToFileURL(clsFile).href + '?t=' + Date.now());
891
+ data = mod?.default || null;
892
+ }
893
+ catch { /* ignore */ }
894
+ }
828
895
  }
829
- catch { /* ignore */ }
830
896
  }
831
897
 
832
898
  if (!data || typeof data !== 'object')
@@ -926,22 +992,35 @@ export async function installMcpServers(input = {}, ctx = {}) {
926
992
  return { installed };
927
993
  }
928
994
 
929
- /** Включить или выключить MCP-сервер в `/SERVICES/<id>`. */
995
+ /** Включить или выключить сервис / MCP-сервер в `/SERVICES/<id>`. */
930
996
  export async function setMcpServerEnabled({ id, enabled }, ctx = {}) {
931
997
  if (ctx?.session && !(await isAdmin(ctx.session)))
932
- throw new Error('Доступ запрещён: управлять MCP-серверами может только руководитель (BOSS)');
998
+ throw new Error('Доступ запрещён: управлять сервисами и MCP может только руководитель (BOSS)');
933
999
  const cleanId = normalizeMcpServerId(id);
934
1000
  const clsFile = path.join(process.cwd(), 'SERVICES', cleanId, '$service', 'class.js');
935
1001
  if (!fs.existsSync(clsFile))
936
- throw new Error(`MCP-сервер /SERVICES/${cleanId} не найден`);
1002
+ throw new Error(`Сервис /SERVICES/${cleanId} не найден`);
937
1003
 
938
1004
  const item = await globalThis.WORK?.get_item?.('/SERVICES/' + cleanId).catch(() => null);
939
1005
  const current = (item && typeof item.import === 'function' ? await item.import().catch(() => null) : null) || {};
1006
+ const flag = Boolean(enabled);
1007
+
1008
+ if (!current.mcp) {
1009
+ const rawText = await fsp.readFile(clsFile, 'utf-8');
1010
+ const nextText = /\benabled\s*:\s*(true|false)\b/.test(rawText)
1011
+ ? rawText.replace(/\benabled\s*:\s*(true|false)\b/, `enabled: ${flag}`)
1012
+ : rawText.replace(/export\s+default\s*\{/, `export default {\n enabled: ${flag},`);
1013
+ await fsp.writeFile(clsFile, nextText, 'utf-8');
1014
+ resetServiceRegistry();
1015
+ item?.reset?.();
1016
+ return { id: cleanId, enabled: flag };
1017
+ }
1018
+
940
1019
  const updated = {
941
1020
  icon: current.icon || 'carbon:plug',
942
1021
  label: current.label || cleanId,
943
1022
  description: current.description || `MCP-сервер ${cleanId}`,
944
- enabled: Boolean(enabled),
1023
+ enabled: flag,
945
1024
  mcp: current.mcp || {},
946
1025
  };
947
1026
  await fsp.writeFile(clsFile, `/** MCP-сервер ${updated.label} (/SERVICES/${cleanId}). */\nexport default ${JSON.stringify(updated, null, 4)};\n`, 'utf-8');
@@ -55,7 +55,7 @@ async function localVoiceModel(cap) {
55
55
  const piper = matches.find(m => /piper/i.test(String(m.id || m.model || m.path || '')));
56
56
  if (piper)
57
57
  return piper;
58
- const fast = matches.find(m => /0\.6b|customvoice|kokoro/i.test(String(m.id || m.model || m.path || '')));
58
+ const fast = matches.find(m => /0\.6b|customvoice/i.test(String(m.id || m.model || m.path || '')));
59
59
  if (fast)
60
60
  return fast;
61
61
  }
@@ -1271,8 +1271,26 @@ export function resolveBuboModelFiles(weightsDir) {
1271
1271
  return { mainModel, mtpModel, mmprojModel, twinModel, draftHeadModel };
1272
1272
  }
1273
1273
 
1274
+ function isNonLlmModelDir(modelDir, folderName = '', mainFile = '') {
1275
+ const joined = `${folderName} ${path.basename(mainFile || '')}`.toLowerCase();
1276
+ if (/\b(ltx(?:[-_.]?(?:video|2(?:\.\d+)?|v))?|wan2(?:\.\d+)?|hunyuan[-_.]?video|cogvideo|flux|sdxl|z-image|qwen-image|sd3\.5|hidream|chroma|musicgen|audioldm|kokoro|piper)\b/.test(joined))
1277
+ return true;
1278
+ try {
1279
+ const clsPath = path.join(modelDir, '$ai', 'class.js');
1280
+ if (fs.existsSync(clsPath)) {
1281
+ const raw = fs.readFileSync(clsPath, 'utf-8');
1282
+ const m = raw.match(/"modality"\s*:\s*"([^"]+)"/i);
1283
+ if (m && ['video', 'image', 'audio', 'embed'].includes(m[1].toLowerCase()))
1284
+ return true;
1285
+ }
1286
+ }
1287
+ catch { /* ignore */ }
1288
+ return false;
1289
+ }
1290
+
1274
1291
  /**
1275
- * Найти локальный GGUF-файл модели в метапапках моделей `/MODELS/Local/<Модель>/$ai/#weights`.
1292
+ * Найти локальный GGUF-файл LLM-модели в метапапках моделей `/MODELS/Local/<Модель>/$ai/#weights`.
1293
+ * Пропускает диффузионные и аудио-модели (LTX, Flux, Wan и т.д.), которые не запускаются через LLM-движок `bubo.exe`.
1276
1294
  */
1277
1295
  function findLocalGgufModel(rootDir = process.cwd()) {
1278
1296
  const preferred = resolveBuboModelFiles(modelWeightsDir(rootDir, 'Qwen3.8-Flash-Next', 'Local'));
@@ -1286,9 +1304,12 @@ function findLocalGgufModel(rootDir = process.cwd()) {
1286
1304
  for (const entry of fs.readdirSync(localRoot, { withFileTypes: true })) {
1287
1305
  if (!entry.isDirectory() || entry.name.startsWith('$') || entry.name.startsWith('#') || entry.name === 'models')
1288
1306
  continue;
1289
- for (const dir of [modelWeightsDir(rootDir, entry.name, 'Local'), path.join(localRoot, entry.name, '#weights')]) {
1307
+ const modelDir = path.join(localRoot, entry.name);
1308
+ if (isNonLlmModelDir(modelDir, entry.name))
1309
+ continue;
1310
+ for (const dir of [modelWeightsDir(rootDir, entry.name, 'Local'), path.join(modelDir, '#weights')]) {
1290
1311
  const resolved = resolveBuboModelFiles(dir);
1291
- if (resolved.mainModel)
1312
+ if (resolved.mainModel && !isNonLlmModelDir(modelDir, entry.name, resolved.mainModel))
1292
1313
  return resolved.mainModel;
1293
1314
  }
1294
1315
  }
@@ -582,18 +582,28 @@ export function inferModalityAndCapabilities(row = {}) {
582
582
  const ptag = String(row.pipeline_tag || '').toLowerCase();
583
583
  const tags = (Array.isArray(row.tags) ? row.tags : []).map(t => String(t).toLowerCase());
584
584
  const joined = `${id.toLowerCase()} ${ptag} ${tags.join(' ')}`;
585
+ const isGgufRepo = tags.includes('gguf') || /gguf/i.test(id);
585
586
 
586
- if (ptag.includes('video') || /\b(t2v|i2v|wan2|ltx-video|hunyuanvideo|cogvideo)\b/.test(joined)) {
587
+ if (
588
+ ptag.includes('video')
589
+ || tags.some(t => /text-to-video|image-to-video|text-to-audio-video|image-to-audio-video|video-generation/i.test(t))
590
+ || /\b(t2v|i2v|t2av|i2av|wan2(?:\.\d+)?|ltx(?:[-_.]?(?:video|2(?:\.\d+)?|v))?|hunyuan[-_.]?video|cogvideox?|mochi[-_.]?1|skyreels|framepack|animatediff)\b/.test(joined)
591
+ ) {
587
592
  return {
588
593
  modality: 'video',
589
- capabilities: ['video', 'lora'],
594
+ capabilities: isGgufRepo ? ['video'] : ['video', 'lora'],
590
595
  whatItDoes: 'Генерация и обработка видеороликов по текстовому описанию или кадру',
591
596
  };
592
597
  }
593
- if (ptag === 'text-to-image' || ptag === 'image-to-image' || /\b(flux|sdxl|stable-diffusion|z-image)\b/.test(joined)) {
598
+ if (
599
+ ptag === 'text-to-image'
600
+ || ptag === 'image-to-image'
601
+ || tags.some(t => /text-to-image|image-to-image|diffusion-single-file/i.test(t))
602
+ || /\b(flux|sdxl|stable-diffusion|z-image|qwen-image|sd3\.5|hidream|chroma)\b/.test(joined)
603
+ ) {
594
604
  return {
595
605
  modality: 'image',
596
- capabilities: ['image', 'lora'],
606
+ capabilities: isGgufRepo ? ['image'] : ['image', 'lora'],
597
607
  whatItDoes: 'Генерация и редактирование иллюстраций, фотографий и графики по тексту',
598
608
  };
599
609
  }
@@ -755,18 +765,51 @@ export function resolveModelIcon({ repoId = '', modality = 'llm', capabilities =
755
765
  return 'ai:ollama';
756
766
  }
757
767
 
768
+ export function assessDiffusionRepoCompatibility({ id = '', modality = 'llm', format = '', tags = [], library_name = '', files = null } = {}) {
769
+ const mod = String(modality || '').toLowerCase();
770
+ if (mod !== 'image' && mod !== 'video')
771
+ return { diffusersCompatible: true, compatibilityNote: '' };
772
+ const lowTags = (Array.isArray(tags) ? tags : []).map(t => String(t).toLowerCase());
773
+ const lib = String(library_name || '').toLowerCase();
774
+ const isGguf = format === 'gguf' || lowTags.includes('gguf') || /gguf/i.test(String(id || ''));
775
+
776
+ if (Array.isArray(files) && files.length) {
777
+ const hasModelIndex = files.some(f => String(f?.name || '').toLowerCase() === 'model_index.json');
778
+ const hasWeights = files.some(f => f?.kind === 'gguf' || f?.kind === 'safetensors');
779
+ if (hasWeights && !hasModelIndex) {
780
+ return {
781
+ diffusersCompatible: false,
782
+ compatibilityNote: 'Чекпоинт формата ComfyUI / single-file / GGUF без model_index.json (пайплайна Diffusers) — не запускается автономно в WORK. Выберите полноценную модель Diffusers (Z-Image-Turbo, Lightricks/LTX-Video, Wan2.1-T2V).',
783
+ };
784
+ }
785
+ return { diffusersCompatible: true, compatibilityNote: '' };
786
+ }
787
+
788
+ if (lib === 'diffusion-single-file' || lowTags.includes('diffusion-single-file') || lowTags.includes('comfyui') || isGguf) {
789
+ return {
790
+ diffusersCompatible: false,
791
+ compatibilityNote: 'Чекпоинт формата ComfyUI / single-file / GGUF без пайплайна Diffusers — не запускается автономно в WORK. Выберите полноценную модель Diffusers (Z-Image-Turbo, Lightricks/LTX-Video, Wan2.1-T2V).',
792
+ };
793
+ }
794
+ return { diffusersCompatible: true, compatibilityNote: '' };
795
+ }
796
+
758
797
  function decorateModelCard(m, usableMemoryGb) {
759
798
  const fitInfo = evaluateModelFit(m, usableMemoryGb);
760
799
  const modDef = MODEL_MODALITIES.find(x => x.id === m.modality) || MODEL_MODALITIES[1];
761
800
  const capabilityBadges = (m.capabilities || []).map(cid => MODEL_CAPABILITIES[cid] || { id: cid, label: cid, desc: '' });
762
801
  const icon = m.icon || resolveModelIcon({ repoId: m.id, modality: m.modality, capabilities: m.capabilities });
802
+ const diffCompat = m.curated
803
+ ? { diffusersCompatible: true, compatibilityNote: '' }
804
+ : assessDiffusionRepoCompatibility(m);
763
805
  return {
764
806
  ...m,
765
807
  icon,
766
808
  modalityLabel: modDef.shortLabel,
767
809
  capabilityBadges,
768
810
  ...fitInfo,
769
- recommendedForHost: fitInfo.fit === 'optimal',
811
+ ...diffCompat,
812
+ recommendedForHost: fitInfo.fit === 'optimal' && diffCompat.diffusersCompatible,
770
813
  };
771
814
  }
772
815
 
@@ -881,11 +924,12 @@ export async function searchHuggingFaceModels({
881
924
  capabilities: inferred.capabilities,
882
925
  whatItDoes: inferred.whatItDoes,
883
926
  format,
927
+ library_name: row.library_name || '',
884
928
  paramsB: est.paramsB,
885
929
  ramRequiredGb: est.ramRequiredGb,
886
930
  trainRamGb: est.trainRamGb,
887
931
  recommendedFor: row.pipeline_tag || inferred.whatItDoes,
888
- tags: tags.slice(0, 8),
932
+ tags: tags.slice(0, 12),
889
933
  downloads: Number(row.downloads) || 0,
890
934
  likes: Number(row.likes) || 0,
891
935
  curated: false,
@@ -966,6 +1010,16 @@ export async function inspectHuggingFaceRepo(repoId, {
966
1010
  const fitInfo = evaluateModelFit({ ramRequiredGb: totalWeightGb, trainRamGb: +(totalWeightGb * 1.5).toFixed(1) }, usableMemoryGb);
967
1011
  const capabilityBadges = (inferred.capabilities || []).map(cid => MODEL_CAPABILITIES[cid] || { id: cid, label: cid, desc: '' });
968
1012
  const icon = resolveModelIcon({ repoId: info.id || cleanId, modality: inferred.modality, capabilities: inferred.capabilities });
1013
+ const diffCompat = curated
1014
+ ? { diffusersCompatible: true, compatibilityNote: '' }
1015
+ : assessDiffusionRepoCompatibility({
1016
+ id: info.id || cleanId,
1017
+ modality: inferred.modality,
1018
+ format: quants.length ? 'gguf' : 'safetensors',
1019
+ tags: info.tags || [],
1020
+ library_name: info.library_name || '',
1021
+ files,
1022
+ });
969
1023
 
970
1024
  return {
971
1025
  id: info.id || cleanId,
@@ -982,6 +1036,7 @@ export async function inspectHuggingFaceRepo(repoId, {
982
1036
  quants,
983
1037
  totalWeightGb,
984
1038
  ...fitInfo,
1039
+ ...diffCompat,
985
1040
  curated,
986
1041
  };
987
1042
  }
@@ -1189,12 +1244,16 @@ export async function registerLocalModelNode({
1189
1244
  ])];
1190
1245
  const icon = customIcon || resolveModelIcon({ repoId: repoId || safeName, modality, capabilities: resolvedCaps });
1191
1246
 
1192
- const resolvedProtocol = protocol || (String(primaryFile || '').endsWith('.gguf') ? 'openai' : 'local');
1193
- const cleanBaseUrl = (baseUrl === null || baseUrl === 'null')
1247
+ const effModLow = String(modality || 'llm').toLowerCase();
1248
+ const supportsGgufChat = !['video', 'image', 'audio', 'embed'].includes(effModLow);
1249
+ const resolvedProtocol = protocol || (supportsGgufChat && String(primaryFile || '').endsWith('.gguf') ? 'openai' : 'local');
1250
+ const cleanBaseUrl = resolvedProtocol === 'local'
1194
1251
  ? ''
1195
- : (typeof baseUrl === 'string' && baseUrl.trim()
1196
- ? baseUrl.trim()
1197
- : (resolvedProtocol === 'local' ? '' : 'http://127.0.0.1:8731/v1/chat/completions'));
1252
+ : ((baseUrl === null || baseUrl === 'null')
1253
+ ? ''
1254
+ : (typeof baseUrl === 'string' && baseUrl.trim()
1255
+ ? baseUrl.trim()
1256
+ : 'http://127.0.0.1:8731/v1/chat/completions'));
1198
1257
 
1199
1258
  const meta = {
1200
1259
  label: String(label || safeName),
@@ -1412,6 +1471,9 @@ export async function startHuggingFaceDownload({
1412
1471
  proxyUrl: effProxy,
1413
1472
  fetchImpl,
1414
1473
  });
1474
+ if (repoMeta.diffusersCompatible === false && !files?.length) {
1475
+ throw new Error(repoMeta.compatibilityNote || `Репозиторий ${cleanId} содержит single-file/ComfyUI веса без пайплайна Diffusers.`);
1476
+ }
1415
1477
  selected = selectFilesToDownload(repoMeta, { files, quant, modality: nodeMeta?.modality || repoMeta.modality });
1416
1478
  }
1417
1479
  if (!selected.length)
@@ -28,6 +28,7 @@ import {
28
28
  repairLocalModelWeightsIfNeeded,
29
29
  getWeightsRepairState,
30
30
  readLocalModelMetaSync,
31
+ resolveModelIcon,
31
32
  } from './huggingface.js';
32
33
  import {
33
34
  buildWorkDataset,
@@ -386,7 +387,7 @@ function inferTestModality(ai) {
386
387
  return 'stt';
387
388
  if (caps.includes('music') || mod === 'music' || /musicgen|audioldm/i.test(String(ai?.id || ai?.model || '')))
388
389
  return 'music';
389
- if (caps.includes('video') || caps.includes('text-to-video') || mod === 'video')
390
+ if (caps.includes('video') || caps.includes('text-to-video') || mod === 'video' || /\b(ltx(?:[-_.]?(?:video|2(?:\.\d+)?|v))?|wan2(?:\.\d+)?|hunyuan[-_.]?video|cogvideo)\b/i.test(String(ai?.id || ai?.model || d.hfRepo || '')))
390
391
  return 'video';
391
392
  if (caps.includes('image') || caps.includes('text-to-image') || mod === 'image')
392
393
  return 'image';
@@ -438,12 +439,15 @@ async function runSingleModelSmokeTest(ai, p = {}) {
438
439
  const t0 = Date.now();
439
440
  try {
440
441
  if (modality === 'tts') {
441
- const text = String(p.text || p.prompt || 'Привет! Проверка локального синтеза речи WORK.').trim();
442
+ const isKokoro = /kokoro/i.test(`${ai?.id || ''} ${ai?.model || ''} ${ai?.DATA?.hfRepo || ''}`);
443
+ const text = String(p.text || p.prompt || (isKokoro
444
+ ? 'Hello! Local Kokoro-82M speech synthesis in WORK is working smoothly.'
445
+ : 'Привет! Проверка локального синтеза речи WORK.')).trim();
442
446
  const buf = await ai.speak({
443
447
  text,
444
448
  language: p.language,
445
449
  instructions: p.instructions,
446
- voice: p.voice,
450
+ voice: p.voice || (isKokoro ? 'af_heart' : undefined),
447
451
  seed: p.seed,
448
452
  refAudioBase64: p.refAudioBase64,
449
453
  refText: p.refText,
@@ -839,27 +843,14 @@ export const TRAINER_METHODS = Object.freeze({
839
843
  if (ext)
840
844
  weightInfo = { ...(weightInfo || {}), weightFormat: ext };
841
845
  }
842
- if (d.protocol === 'halogen' || weightInfo?.hasGguf || weightInfo?.hasBuboManifest) {
843
- halogenProbe = await probeHalogenServer(d.baseUrl || HALOGEN_DEFAULT_BASE_URL).catch(() => null);
844
- let winEnv = halogenProbe?.windowsEnv || null;
845
- if (!winEnv) {
846
- try { winEnv = inspectWindowsHalogenEnvironment(); }
847
- catch { winEnv = null; }
848
- }
849
- if (os.platform() === 'win32' && !halogenProbe?.online && winEnv && !winEnv.buboInstalled && !winEnv.gufoInstalled) {
850
- needsRuntime = true;
851
- }
852
- }
853
- }
854
-
855
- const resolvedProtocol = d.protocol || (isLocal ? 'local' : 'openai');
856
- const rawBaseUrl = (d.baseUrl && d.baseUrl !== 'null') ? String(d.baseUrl) : '';
857
- const cleanBaseUrl = resolvedProtocol === 'local' ? '' : rawBaseUrl;
858
-
859
846
  // Автоисправление устаревших метаданных для известных не-LLM моделей
860
- // (например, если ранняя версия зарегистрировала musicgen-medium с `['chat', 'stream']`).
847
+ // (например, если ранняя версия зарегистрировала musicgen-medium или LTX-2.5-GGUF с `['chat', 'stream']` / `openai`).
861
848
  let effModality = d.modality || 'llm';
862
849
  let effCaps = Array.isArray(d.capabilities) ? d.capabilities : (d.$public?.capabilities || ['chat', 'stream']);
850
+ let resolvedProtocol = d.protocol || (isLocal ? 'local' : 'openai');
851
+ let rawBaseUrl = (d.baseUrl && d.baseUrl !== 'null') ? String(d.baseUrl) : '';
852
+ let effIcon = d.icon || this?.icon || 'carbon:machine-learning-model';
853
+ let effFnCalling = d.functionCalling;
863
854
  if (isLocal) {
864
855
  const lookupKey = String(d.hfRepo || d.model || this?.id || '').trim();
865
856
  const curated = CURATED_HF_MODELS.find(m =>
@@ -870,9 +861,14 @@ export const TRAINER_METHODS = Object.freeze({
870
861
  const inferred = curated || (lookupKey ? inferModalityAndCapabilities({ id: lookupKey }) : null);
871
862
  const capsLow = effCaps.map(c => String(c).toLowerCase());
872
863
  const looksLikeDefaultChat = capsLow.length === 0 || capsLow.every(c => c === 'chat' || c === 'stream' || c === 'functions');
873
- if (inferred && inferred.modality && inferred.modality !== 'llm' && looksLikeDefaultChat && !(inferred.capabilities || []).includes('chat')) {
864
+ const inferredNonLlm = inferred && inferred.modality && inferred.modality !== 'llm' && !(inferred.capabilities || []).includes('chat');
865
+ if (inferredNonLlm && (looksLikeDefaultChat || resolvedProtocol === 'openai')) {
874
866
  effModality = inferred.modality;
875
867
  effCaps = [...inferred.capabilities];
868
+ resolvedProtocol = 'local';
869
+ rawBaseUrl = '';
870
+ effFnCalling = false;
871
+ effIcon = resolveModelIcon({ repoId: lookupKey, modality: effModality, capabilities: effCaps });
876
872
  try {
877
873
  const clsPath = path.join(process.cwd(), 'MODELS', 'Local', this?.id || '', '$ai', 'class.js');
878
874
  if (fs.existsSync(clsPath)) {
@@ -882,7 +878,19 @@ export const TRAINER_METHODS = Object.freeze({
882
878
  const parsed = JSON.parse(mJson[1]);
883
879
  parsed.modality = effModality;
884
880
  parsed.capabilities = effCaps;
881
+ parsed.protocol = 'local';
882
+ parsed.baseUrl = '';
883
+ parsed.functionCalling = false;
884
+ parsed.icon = effIcon;
885
885
  fs.writeFileSync(clsPath, `/**\n * Локальная модель ИИ: ${parsed.label || this?.id} (${effModality})\n * Репозиторий Hugging Face: ${parsed.hfRepo || 'локальный'}\n */\nexport default ${JSON.stringify(parsed, null, 4)};\n`, 'utf-8');
886
+ if (this?.DATA) {
887
+ this.DATA.modality = effModality;
888
+ this.DATA.capabilities = effCaps;
889
+ this.DATA.protocol = 'local';
890
+ this.DATA.baseUrl = '';
891
+ this.DATA.functionCalling = false;
892
+ this.DATA.icon = effIcon;
893
+ }
886
894
  this?.reset?.();
887
895
  }
888
896
  }
@@ -890,8 +898,25 @@ export const TRAINER_METHODS = Object.freeze({
890
898
  catch { /* ignore */ }
891
899
  }
892
900
  }
901
+ const cleanBaseUrl = resolvedProtocol === 'local' ? '' : rawBaseUrl;
902
+ const isGgufLlm = Boolean(weightInfo?.hasGguf && !['video', 'image', 'audio', 'embed'].includes(String(effModality || '').toLowerCase()));
903
+
904
+ if (isLocal && (resolvedProtocol === 'halogen' || isGgufLlm || weightInfo?.hasBuboManifest)) {
905
+ halogenProbe = await probeHalogenServer(cleanBaseUrl || d.baseUrl || HALOGEN_DEFAULT_BASE_URL).catch(() => null);
906
+ let winEnv = halogenProbe?.windowsEnv || null;
907
+ if (!winEnv) {
908
+ try { winEnv = inspectWindowsHalogenEnvironment(); }
909
+ catch { winEnv = null; }
910
+ }
911
+ if (os.platform() === 'win32' && !halogenProbe?.online && winEnv && !winEnv.buboInstalled && !winEnv.gufoInstalled) {
912
+ needsRuntime = true;
913
+ }
914
+ }
893
915
 
894
- const engineSetup = (resolvedProtocol === 'halogen' || weightInfo?.hasGguf)
916
+ const actReeval = (effFnCalling === false && !act.active && act.incompatibleOnPlatform)
917
+ ? act
918
+ : evaluateAiNodeActivitySync(this);
919
+ const engineSetup = (resolvedProtocol === 'halogen' || isGgufLlm)
895
920
  ? await describeEngineSetup().catch(() => null)
896
921
  : null;
897
922
 
@@ -913,7 +938,7 @@ export const TRAINER_METHODS = Object.freeze({
913
938
  return {
914
939
  id: this?.id || '',
915
940
  label: d.label || this?.label || this?.id || '',
916
- icon: d.icon || this?.icon || 'carbon:machine-learning-model',
941
+ icon: effIcon,
917
942
  path: itemPath,
918
943
  providerName: providerId,
919
944
  isLocal,
@@ -928,11 +953,11 @@ export const TRAINER_METHODS = Object.freeze({
928
953
  weightsDir: resolvedWeightsRel,
929
954
  primaryFile: resolvedPrimaryFile,
930
955
  enabled: d.enabled !== false,
931
- aiActive: act.active,
932
- aiStatusReason: act.reason,
956
+ aiActive: actReeval.active,
957
+ aiStatusReason: actReeval.reason,
933
958
  weightFormat: weightInfo?.weightFormat || '',
934
- incompatibleOnPlatform: Boolean(act.incompatibleOnPlatform || weightInfo?.incompatibleOnPlatform),
935
- incompatibleReason: act.incompatibleOnPlatform ? act.reason : (weightInfo?.incompatibleReason || ''),
959
+ incompatibleOnPlatform: Boolean(actReeval.incompatibleOnPlatform || weightInfo?.incompatibleOnPlatform),
960
+ incompatibleReason: actReeval.incompatibleOnPlatform ? actReeval.reason : (weightInfo?.incompatibleReason || ''),
936
961
  sizeGb,
937
962
  needsRuntime: false,
938
963
  runtimeAutoInstall: needsRuntime,
@@ -942,7 +967,7 @@ export const TRAINER_METHODS = Object.freeze({
942
967
  speculation: engineSetup?.plan || halogenProbe?.speculation || null,
943
968
  weightsRepair,
944
969
  engineSetup,
945
- engineSettings: (resolvedProtocol === 'halogen' || weightInfo?.hasGguf) ? readEngineSettings(process.cwd()) : null,
970
+ engineSettings: (resolvedProtocol === 'halogen' || isGgufLlm) ? readEngineSettings(process.cwd()) : null,
946
971
  pythonProvision: getPythonProvisionState(),
947
972
  windowsEnv: halogenProbe?.windowsEnv || (() => { try { return inspectWindowsHalogenEnvironment(); } catch { return null; } })(),
948
973
  };