odant-work 1.0.90 → 1.0.92

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 (326) hide show
  1. package/#system/package-manifest.json +275 -246
  2. package/$server/$folder/$class/$data/$catalog/$folder/$class/$data/$catalog/$virtual/class.js +4 -0
  3. package/$server/$folder/$class/$data/$catalog/$folder/$class/$data/$catalog/class.js +4 -0
  4. package/$server/$folder/$class/$data/$catalog/$virtual/$folder/$class/$data/$catalog/$virtual/class.js +4 -0
  5. package/$server/$folder/$class/$data/$catalog/$virtual/class.js +8 -0
  6. package/{MODULES/Register/CATALOGS/$catalog/$folder/$class → $server/$folder/$class/$data}/$catalog/class.js +1 -0
  7. package/$server/$folder/$class/$data/$operation/$folder/$class/$data/$operation/class.js +4 -0
  8. package/{MODULES/Register/OPERATIONS/$operation/$folder/$class → $server/$folder/$class/$data}/$operation/class.js +1 -0
  9. package/$server/$folder/$class/$data/$register/$account/$folder/$class/$data/$register/$account/class.js +4 -0
  10. package/$server/$folder/$class/$data/$register/$account/class.js +8 -0
  11. package/$server/$folder/$class/$data/$register/$folder/$class/$data/$register/$account/class.js +4 -0
  12. package/$server/$folder/$class/$data/$register/$folder/$class/$data/$register/class.js +4 -0
  13. package/$server/$folder/$class/$data/$register/class.js +8 -0
  14. package/$server/$folder/$class/$data/$struct/$folder/$class/$data/$struct/class.js +4 -0
  15. package/$server/$folder/$class/$data/$struct/class.js +5 -0
  16. package/$server/$folder/$class/$data/class.js +5 -0
  17. package/$server/$folder/$class/$data/handlers/pages/form/objects/$handler/class.js +2158 -0
  18. package/$server/$folder/$class/$data/handlers/pages/form/objects/object/$handler/class.js +1377 -0
  19. package/$server/$folder/$class/$domain/$folder/$class/$domain/class.js +4 -0
  20. package/$server/$folder/$class/$domain/handlers/methods/restore/$handler/class.js +5 -5
  21. package/$server/$folder/$class/$domain/readme.md +1 -1
  22. package/$server/$folder/$class/$handler/$method/class.js +4 -0
  23. package/$server/$folder/$class/$handler/$timer/class.js +4 -0
  24. package/$server/$folder/$class/$module/$folder/$class/$data/$catalog/class.js +4 -0
  25. package/$server/$folder/$class/$module/$folder/$class/$data/$operation/class.js +4 -0
  26. package/$server/$folder/$class/$module/$folder/$class/$data/$register/class.js +4 -0
  27. package/$server/$folder/$class/$module/$folder/$class/$data/$struct/class.js +4 -0
  28. package/$server/$folder/$class/$module/$folder/$class/$domain/class.js +4 -0
  29. package/$server/$folder/$class/$module/$folder/$class/$module/class.js +4 -0
  30. package/$server/$folder/$class/$module/class.js +418 -6
  31. package/$server/$folder/$class/{handlers/pages/form/system/$handler/tabs/mcp.js → $module/handlers/pages/form/system/mcp/$handler/class.js} +261 -220
  32. package/$server/$folder/$class/$module/handlers/pages/form/system/modules/$handler/class.js +7 -0
  33. package/$server/$folder/$class/$structure/$folder/$class/$structure/class.js +4 -0
  34. package/$server/$folder/$class/$structure/$organization/$folder/$class/$data/$catalog/class.js +4 -0
  35. package/$server/$folder/$class/$structure/$organization/$folder/$class/$data/$operation/class.js +4 -0
  36. package/$server/$folder/$class/$structure/$organization/$folder/$class/$data/$register/class.js +4 -0
  37. package/$server/$folder/$class/$structure/$organization/$folder/$class/$data/$struct/class.js +4 -0
  38. package/$server/$folder/$class/$structure/$organization/$folder/$class/$domain/class.js +4 -0
  39. package/$server/$folder/$class/$structure/$organization/$folder/$class/$module/class.js +4 -0
  40. package/{ORGANIZATIONS/$domain/$folder/$class/$base → $server/$folder/$class/$structure/$organization/$folder/$class/$structure/$organization}/class.js +4 -5
  41. package/$server/$folder/$class/$structure/$organization/$folder/$class/$structure/class.js +4 -0
  42. package/{ORGANIZATIONS/$domain/$folder/$class/$base/$folder/$class/$structure/$base → $server/$folder/$class/$structure/$organization}/class.js +19 -17
  43. package/$server/$folder/$class/$structure/$organization/handlers/pages/form/system/requisites/$handler/class.js +3 -0
  44. package/$server/$folder/$class/$structure/{$base/handlers/pages/site/$handler/site.js → $organization/handlers/pages/site/$handler/class.js} +352 -365
  45. package/$server/$folder/$class/$structure/$project/$folder/$class/$data/$catalog/class.js +4 -0
  46. package/$server/$folder/$class/$structure/$project/$folder/$class/$data/$operation/class.js +4 -0
  47. package/$server/$folder/$class/$structure/$project/$folder/$class/$data/$register/class.js +4 -0
  48. package/$server/$folder/$class/$structure/$project/$folder/$class/$data/$struct/class.js +4 -0
  49. package/$server/$folder/$class/$structure/$project/$folder/$class/$domain/class.js +4 -0
  50. package/$server/$folder/$class/$structure/$project/$folder/$class/$module/class.js +4 -0
  51. package/$server/$folder/$class/$structure/$project/class.js +1 -0
  52. package/$server/$folder/$class/$structure/$project/readme.md +1 -1
  53. package/$server/$folder/$class/$structure/$server/$folder/$class/$domain/class.js +4 -0
  54. package/$server/$folder/$class/$structure/$server/handlers/pages/form/system/database/$handler/class.js +3 -0
  55. package/$server/$folder/$class/{handlers/pages/form/system/$handler/tabs/license.js → $structure/$server/handlers/pages/form/system/license/$handler/class.js} +104 -103
  56. package/$server/$folder/$class/$structure/$server/handlers/pages/site/$handler/{site.js → class.js} +45 -30
  57. package/$server/$folder/$class/$structure/$user/handlers/pages/form/system/agent/$handler/class.js +3 -0
  58. package/$server/$folder/$class/$structure/$user/handlers/pages/form/system/messengers/$handler/class.js +3 -0
  59. package/$server/$folder/$class/$structure/$user/handlers/pages/form/system/modules/$handler/class.js +3 -0
  60. package/$server/$folder/$class/$structure/$user/handlers/pages/form/system/profile/$handler/class.js +18 -0
  61. package/$server/$folder/$class/$structure/ai/system.md +1 -1
  62. package/$server/$folder/$class/$structure/class.js +1 -1
  63. package/$server/$folder/$class/$structure/handlers/methods/archive/$handler/class.js +3 -3
  64. package/$server/$folder/$class/$structure/handlers/pages/data/$handler/class.js +309 -8
  65. package/$server/$folder/$class/$structure/handlers/pages/explorer/$handler/class.js +15 -4
  66. package/$server/$folder/$class/$structure/handlers/pages/form/calendar/$handler/class.js +1281 -7
  67. package/$server/$folder/$class/$structure/handlers/pages/form/chat/$handler/class.js +2216 -6
  68. package/$server/$folder/$class/$structure/handlers/pages/form/email/$handler/class.js +1304 -6
  69. package/$server/$folder/$class/$structure/handlers/pages/form/email/$handler/methods/refresh/$method/class.js +1 -1
  70. package/$server/$folder/$class/$structure/handlers/pages/form/search/$handler/class.js +305 -9
  71. package/$server/$folder/$class/{handlers/pages/form/system/$handler/tabs/agent.js → $structure/handlers/pages/form/system/agent/$handler/class.js} +329 -320
  72. package/$server/$folder/$class/{handlers/pages/form/system/$handler/tabs/database.js → $structure/handlers/pages/form/system/database/$handler/class.js} +510 -577
  73. package/$server/$folder/$class/{handlers/pages/form/system/$handler/tabs/messengers.js → $structure/handlers/pages/form/system/messengers/$handler/class.js} +143 -144
  74. package/$server/$folder/$class/$structure/handlers/pages/form/system/modules/$handler/class.js +270 -0
  75. package/$server/$folder/$class/$structure/handlers/pages/form/system/staff/$handler/class.js +2114 -0
  76. package/$server/$folder/$class/$structure/handlers/pages/site/$handler/class.js +229 -4
  77. package/$server/$folder/$class/$structure/handlers/pages/site/$handler/readme.md +1 -1
  78. package/$server/$folder/$class/$structure/readme.md +3 -3
  79. package/$server/$folder/$class/$users/$folder/$class/$structure/$user/class.js +4 -0
  80. package/$server/$folder/$class/$users/class.js +4 -0
  81. package/$server/$folder/$class/ai/agents/integrator-1c.md +1 -1
  82. package/$server/$folder/$class/ai/agents/it-admin.md +1 -1
  83. package/$server/$folder/$class/ai/agents/org-architect.md +4 -4
  84. package/$server/$folder/$class/ai/agents/readme.md +1 -1
  85. package/$server/$folder/$class/ai/agents/schema-validator.md +2 -2
  86. package/$server/$folder/$class/ai/skills/lan-inventory.md +2 -2
  87. package/$server/$folder/$class/ai/skills/org-structure.md +1 -1
  88. package/$server/$folder/$class/ai/skills/printer-setup.md +1 -1
  89. package/$server/$folder/$class/ai/skills/telegram-notify.md +2 -2
  90. package/$server/$folder/$class/ai/skills/work-scenarios.md +3 -3
  91. package/$server/$folder/$class/ai/system.md +14 -8
  92. package/$server/$folder/$class/class.js +2 -6
  93. package/$server/$folder/$class/handlers/pages/form/folder/$handler/class.js +3 -0
  94. package/$server/$folder/$class/handlers/pages/form/system/$handler/class.js +2 -4
  95. package/$server/$folder/$class/handlers/pages/form/system/files/$handler/class.js +7 -0
  96. package/$server/$folder/$class/handlers/pages/form/system/requisites/$handler/class.js +100 -0
  97. package/$server/$folder/$class/handlers/pages/storage/$handler/class.js +25 -6
  98. package/$server/$folder/$file/$data/handlers/pages/form/editor/$handler/class.js +32 -5
  99. package/$server/$folder/$file/$devs/handlers/pages/form/file/$handler/class.js +31 -3
  100. package/$server/$folder/$file/$ics/handlers/pages/form/file/$handler/class.js +11 -3
  101. package/$server/$folder/$file/$ipynb/handlers/pages/form/file/$handler/class.js +83 -3
  102. package/$server/$folder/$file/$md/handlers/pages/form/file/$handler/class.js +61 -3
  103. package/$server/$folder/$file/$office/handlers/pages/form/file/$handler/class.js +1699 -2
  104. package/$server/$folder/$file/$task/handlers/pages/form/file/$handler/class.js +827 -2
  105. package/$server/$folder/$file/$task/handlers/pages/form/file/$handler/readme.md +1 -1
  106. package/$server/$folder/$file/handlers/pages/form/file/$handler/class.js +33 -3
  107. package/$server/$folder/$file/handlers/pages/form/folder/$handler/class.js +3 -0
  108. package/$server/$folder/handlers/methods/create/$handler/class.js +5 -5
  109. package/$server/$folder/handlers/pages/form/$handler/class.js +2467 -3
  110. package/$server/$folder/handlers/pages/form/folder/$handler/class.js +22 -0
  111. package/$server/$folder/handlers/readme.md +1 -1
  112. package/$server/$folder/lib/chat-item/chat-item.js +5 -10
  113. package/$server/$folder/lib/consultant/consultant.js +7 -10
  114. package/$server/$folder/lib/explorer/explorer.js +1 -1
  115. package/$server/$folder/lib/icon/icon.js +1 -1
  116. package/$server/$folder/lib/menu/menu.js +3 -2
  117. package/$server/$folder/lib/messenger-settings/messenger-settings.js +4 -4
  118. package/$server/$folder/lib/node/node.js +3 -3
  119. package/$server/$folder/lib/prompt-bar/prompt-bar.js +2 -2
  120. package/$server/$folder/lib/role/role.js +1 -2
  121. package/$server/$folder/lib/security/admin/admin.js +3 -3
  122. package/$server/$folder/lib/security/security.js +4 -4
  123. package/$server/$folder/lib/security/users/users.js +2 -5
  124. package/$server/$folder/lib/site-loc/site-loc.js +3 -3
  125. package/$server/$folder/lib/tree/tree.js +14 -22
  126. package/$server/class.js +1 -0
  127. package/AGENTS.md +21 -13
  128. package/{$server/$folder/$class/handlers/pages/form/system/$handler/tabs/ai-model.js → MODELS/$ai/$folder/$class/$ai/handlers/pages/form/system/ai/$handler/class.js} +385 -425
  129. package/{$server/$folder/$class/handlers/pages/form/system/$handler/tabs/ai-provider.js → MODELS/$ai/$folder/$class/$provider/handlers/pages/form/system/ai/$handler/class.js} +157 -161
  130. package/{$server/$folder/$class/handlers/pages/form/system/$handler/tabs/ai-root.js → MODELS/$ai/handlers/pages/form/system/ai/$handler/class.js} +34 -33
  131. package/{$server/$folder/$class/handlers/pages/form/system/$handler/tabs/ai-local.js → MODELS/Local/$provider/handlers/pages/form/system/ai/$handler/class.js} +572 -622
  132. package/MODULES/$domain/class.js +85 -4
  133. package/MODULES/$domain/handlers/pages/form/system/mcp/$handler/class.js +7 -0
  134. package/MODULES/$domain/readme.md +7 -6
  135. package/{SERVICES/1C/$service → MODULES/1C/$module}/class.js +7 -1
  136. package/MODULES/2GIS/$module/class.js +32 -0
  137. package/MODULES/2GIS/$module/readme.md +57 -0
  138. package/{SERVICES/Bitrix24/$service → MODULES/Bitrix24/$module}/class.js +7 -2
  139. package/{SERVICES/CBR/$service → MODULES/CBR/$module}/class.js +5 -0
  140. package/{SERVICES/DaData/$service → MODULES/DaData/$module}/class.js +9 -3
  141. package/MODULES/Geo//320/232/320/260/321/200/321/202/320/260/$catalog/handlers/pages/form/map/$handler/class.js +648 -21
  142. package/MODULES/KLADR/$module/handlers/pages/form/kladr/$handler/class.js +140 -6
  143. package/{SERVICES/Marketplaces/$service → MODULES/Marketplaces/$domain}/class.js +1 -1
  144. package/{SERVICES/Marketplaces/Ozon/$service → MODULES/Marketplaces/Ozon/$module}/class.js +1 -1
  145. package/{SERVICES/Marketplaces/Wildberries/$service → MODULES/Marketplaces/Wildberries/$module}/class.js +1 -1
  146. package/{SERVICES/Marketplaces/YandexMarket/$service → MODULES/Marketplaces/YandexMarket/$module}/class.js +1 -1
  147. package/MODULES/Process/$module/readme.md +1 -1
  148. package/MODULES/Process//320/227/320/260/320/264/320/260/321/207/320/270 /320/270 /321/215/321/202/320/260/320/277/321/213/$catalog/handlers/pages/form/gantt/$handler/class.js" +305 -6
  149. package/MODULES/Process//320/227/320/260/320/264/320/260/321/207/320/270 /320/270 /321/215/321/202/320/260/320/277/321/213/$catalog/handlers/pages/form/scheduler/$handler/class.js" +241 -6
  150. package/MODULES/Process//320/241/321/205/320/265/320/274/321/213 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/320/276/320/262/$catalog/handlers/pages/form/bpmn/$handler/class.js" +515 -16
  151. package/MODULES/Register/CATALOGS/$catalog/$folder/$class/{$virtual → $data/$catalog/$virtual}/class.js +3 -0
  152. package/MODULES/Register/CATALOGS/$catalog/$folder/$class/$data/$catalog/$virtual/handlers/pages/form/objects/$handler/class.js +3 -0
  153. package/MODULES/Register/CATALOGS/$catalog/$folder/$class/{$virtual/handlers/pages/form/virtual/$handler/virtual.js → $data/$catalog/$virtual/handlers/pages/form/virtual/$handler/class.js} +413 -390
  154. package/MODULES/Register/CATALOGS/$catalog/$folder/$class/$data/$catalog/class.js +14 -0
  155. package/MODULES/Register/CATALOGS/$catalog/class.js +7 -14
  156. package/MODULES/Register/CATALOGS//320/241/320/276/321/202/321/200/321/203/320/264/320/275/320/270/320/272/320/270/$virtual/$folder/$class/$data/$catalog/$virtual/class.js +9 -0
  157. package/MODULES/Register/CATALOGS//320/241/320/276/321/202/321/200/321/203/320/264/320/275/320/270/320/272/320/270/$virtual/class.js +0 -7
  158. package/MODULES/Register/CATALOGS//320/241/321/203/320/261/321/212/320/265/320/272/321/202/321/213/$catalog/$folder/$class/$data/$catalog/class.js +11 -0
  159. package/MODULES/Register/CATALOGS//320/241/321/203/320/261/321/212/320/265/320/272/321/202/321/213/$catalog/class.js +0 -9
  160. package/MODULES/Register/OPERATIONS/$operation/$folder/$class/$data/$operation/class.js +16 -0
  161. package/MODULES/Register/OPERATIONS/$operation/class.js +0 -9
  162. package/MODULES/Register/OPERATIONS//320/232/320/260/320/264/321/200/321/213/$operation/$folder/$class/$data/$operation/class.js +8 -0
  163. package/MODULES/Register/OPERATIONS//320/232/320/260/320/264/321/200/321/213/$operation/class.js +4 -10
  164. package/MODULES/Register/OPERATIONS//320/232/320/260/321/201/321/201/320/260/$operation/$folder/$class/$data/$operation/class.js +8 -0
  165. package/MODULES/Register/OPERATIONS//320/232/320/260/321/201/321/201/320/260/$operation/class.js +0 -6
  166. package/MODULES/Register/OPERATIONS//320/232/320/276/320/274/320/274/321/203/320/275/320/270/320/272/320/260/321/206/320/270/320/270/$operation/$folder/$class/$data/$operation/class.js +8 -0
  167. package/MODULES/Register/OPERATIONS//320/232/320/276/320/274/320/274/321/203/320/275/320/270/320/272/320/260/321/206/320/270/320/270/$operation/class.js +4 -10
  168. package/MODULES/Register/OPERATIONS//320/237/320/273/320/260/321/202/320/265/320/266/320/270 /321/201 /321/200/320/260/321/201/321/207/321/221/321/202/320/275/320/276/320/263/320/276 /321/201/321/207/321/221/321/202/320/260/$operation/$folder/$class/$data/$operation/class.js" +10 -0
  169. package/MODULES/Register/OPERATIONS//320/237/320/273/320/260/321/202/320/265/320/266/320/270 /321/201 /321/200/320/260/321/201/321/207/321/221/321/202/320/275/320/276/320/263/320/276 /321/201/321/207/321/221/321/202/320/260/$operation/class.js" +4 -12
  170. package/MODULES/Register/OPERATIONS//320/237/320/276/321/201/321/202/321/203/320/277/320/273/320/265/320/275/320/270/321/217 /320/275/320/260 /321/200/320/260/321/201/321/207/321/221/321/202/320/275/321/213/320/271 /321/201/321/207/321/221/321/202/$operation/$folder/$class/$data/$operation/class.js" +10 -0
  171. package/MODULES/Register/OPERATIONS//320/237/320/276/321/201/321/202/321/203/320/277/320/273/320/265/320/275/320/270/321/217 /320/275/320/260 /321/200/320/260/321/201/321/207/321/221/321/202/320/275/321/213/320/271 /321/201/321/207/321/221/321/202/$operation/class.js" +4 -12
  172. package/MODULES/Register/OPERATIONS//320/240/320/265/320/260/320/273/320/270/320/267/320/260/321/206/320/270/321/217/$operation/$folder/$class/$data/$operation/class.js +24 -0
  173. package/MODULES/Register/OPERATIONS//320/240/320/265/320/260/320/273/320/270/320/267/320/260/321/206/320/270/321/217/$operation/class.js +0 -22
  174. package/MODULES/Register/REGISTER/$register/$folder/$class/{$account/handlers/pages/form/analysis/$handler/analysis.js → $data/$register/$account/handlers/pages/form/analysis/$handler/class.js} +9 -4
  175. package/MODULES/Register/REGISTER/$register/$folder/$class/{$account/handlers/pages/form/postings/$handler/postings.js → $data/$register/$account/handlers/pages/form/postings/$handler/class.js} +845 -753
  176. package/MODULES/Register/REGISTER/$register/$folder/$class/{$account/handlers/pages/form/turnovers/$handler/turnovers.js → $data/$register/$account/handlers/pages/form/turnovers/$handler/class.js} +9 -4
  177. package/MODULES/Register/REGISTER/$register/{$folder/$class/$register/handlers/pages/form/journal/$handler/journal.js → handlers/pages/form/journal/$handler/class.js} +382 -329
  178. package/MODULES/Register/REGISTER/$register/handlers/pages/form/sheet/$handler/class.js +807 -0
  179. package/MODULES/Register/REGISTER/10/$account/$folder/$class/$data/$register/$account/class.js +21 -0
  180. package/MODULES/Register/REGISTER/10/$account/class.js +0 -19
  181. package/MODULES/Register/REGISTER//320/232/320/260/320/264/321/200/321/213/$account/$folder/$class/$data/$register/$account/class.js +14 -0
  182. package/MODULES/Register/REGISTER//320/232/320/260/320/264/321/200/321/213/$account/class.js +4 -16
  183. package/{SERVICES/SearXNG/$service → MODULES/SearXNG/$module}/class.js +5 -0
  184. package/{SERVICES/Yandex/$service → MODULES/Yandex/$module}/class.js +7 -0
  185. package/{SERVICES/YandexDisk/$service → MODULES/YandexDisk/$module}/class.js +8 -2
  186. package/NODES/$node/handlers/pages/form/network/$handler/class.js +122 -5
  187. package/ORGANIZATIONS/$domain/$folder/$class/$structure/$organization/class.js +5 -0
  188. package/ORGANIZATIONS/$domain/class.js +5 -5
  189. package/oda/components/inputs/link/link.js +1 -1
  190. package/package.json +1 -1
  191. package/readme.md +6 -7
  192. package/scripts/check-architecture.mjs +541 -0
  193. package/scripts/cleanup-storage.mjs +1 -1
  194. package/scripts/demo-seed.mjs +3 -3
  195. package/scripts/import-bis.mjs +33 -15
  196. package/scripts/import-delovaya.mjs +26 -14
  197. package/sources/client/class.js +19 -10
  198. package/sources/client/folder.js +10 -22
  199. package/sources/client/handler.js +75 -33
  200. package/sources/data/api.js +9 -10
  201. package/sources/data/classes.js +85 -9
  202. package/sources/data/db.js +10 -6
  203. package/sources/data/print.js +15 -41
  204. package/sources/data/readme.md +5 -5
  205. package/sources/data/schema.js +206 -118
  206. package/sources/data/sql-inspector.js +7 -7
  207. package/sources/host/auth-methods.js +2 -5
  208. package/sources/host/auto-updater.js +1 -2
  209. package/sources/host/babel-merge.js +174 -129
  210. package/sources/host/prewarm.js +1 -1
  211. package/sources/host/watch.js +1 -1
  212. package/sources/index.html +1 -1
  213. package/sources/modules/agent/extensions.js +48 -38
  214. package/sources/modules/agent/index.js +1 -1
  215. package/sources/modules/agent/node-rules.js +69 -41
  216. package/sources/modules/agent/permissions.js +1 -1
  217. package/sources/modules/agent/plugins.js +11 -11
  218. package/sources/modules/agent/resources.js +96 -52
  219. package/sources/modules/agent/tools/net.js +1 -1
  220. package/sources/modules/agent/tools/services.js +7 -7
  221. package/sources/modules/agent/tools/work/access.js +10 -8
  222. package/sources/modules/agent/tools/work/classes.js +26 -47
  223. package/sources/modules/agent/tools/work/common.js +8 -10
  224. package/sources/modules/agent/tools/work/data.js +4 -4
  225. package/sources/modules/agent/triggers.js +1 -1
  226. package/sources/modules/agent/twin-bus.js +4 -4
  227. package/sources/modules/agent/voice.js +1 -1
  228. package/sources/modules/call/call.js +4 -4
  229. package/sources/modules/kladr/index.js +3 -3
  230. package/sources/modules/lan/register.js +7 -7
  231. package/sources/modules/mcp-marketplaces/ozon.js +1 -1
  232. package/sources/modules/mcp-marketplaces/wildberries.js +1 -1
  233. package/sources/modules/mcp-marketplaces/yandex-market.js +1 -1
  234. package/sources/modules/nodes/mount.js +2 -4
  235. package/sources/modules/notify/index.js +18 -18
  236. package/sources/modules/rag/extract.js +9 -2
  237. package/sources/modules/rag/indexer.js +1 -1
  238. package/sources/modules/rag/scope.js +7 -33
  239. package/sources/modules/trainer/dataset.js +2 -2
  240. package/sources/modules/trainer/local-engine.js +1 -1
  241. package/sources/page.html +2 -2
  242. package/sources/readme.md +1 -1
  243. package/sources/server/access/gateway.js +19 -19
  244. package/sources/server/access/invites.js +4 -5
  245. package/sources/server/access/links.js +10 -8
  246. package/sources/server/access/policy.js +65 -39
  247. package/sources/server/access/workplaces.js +20 -14
  248. package/sources/server/chat-threads.js +4 -4
  249. package/sources/server/class/archive.js +15 -15
  250. package/sources/server/class/base-template.js +13 -9
  251. package/sources/server/class/distro.js +3 -4
  252. package/sources/server/class/feed.js +3 -3
  253. package/sources/server/class/mail-calendar.js +9 -8
  254. package/sources/server/class/scaffold.js +110 -60
  255. package/sources/server/class/search.js +2 -2
  256. package/sources/server/class/security.js +76 -94
  257. package/sources/server/class.js +181 -64
  258. package/sources/server/file.js +2 -2
  259. package/sources/server/folder.js +376 -191
  260. package/sources/server/handler.js +52 -13
  261. package/sources/server/logs.js +7 -7
  262. package/sources/server/node.js +12 -43
  263. package/sources/server/server.js +16 -17
  264. package/$server/$folder/$class/$device/class.js +0 -3
  265. package/$server/$folder/$class/$handler/$task/class.js +0 -3
  266. package/$server/$folder/$class/$service/$class/$service/class.js +0 -4
  267. package/$server/$folder/$class/$structure/$base/class.js +0 -10
  268. package/$server/$folder/$class/$structure/$base/roots_1/roots.test +0 -0
  269. package/$server/$folder/$class/$structure/handlers/pages/data/$handler/data.js +0 -313
  270. package/$server/$folder/$class/$structure/handlers/pages/explorer/$handler/explorer.js +0 -16
  271. package/$server/$folder/$class/$structure/handlers/pages/form/calendar/$handler/calendar.js +0 -1226
  272. package/$server/$folder/$class/$structure/handlers/pages/form/chat/$handler/chat.js +0 -2217
  273. package/$server/$folder/$class/$structure/handlers/pages/form/email/$handler/email.js +0 -1188
  274. package/$server/$folder/$class/$structure/handlers/pages/form/search/$handler/search.js +0 -289
  275. package/$server/$folder/$class/$structure/handlers/pages/site/$handler/site.js +0 -240
  276. package/$server/$folder/$class/handlers/pages/form/object/$handler/class.js +0 -33
  277. package/$server/$folder/$class/handlers/pages/form/object/$handler/object.js +0 -1371
  278. package/$server/$folder/$class/handlers/pages/form/objects/$handler/class.js +0 -33
  279. package/$server/$folder/$class/handlers/pages/form/objects/$handler/objects.js +0 -2130
  280. package/$server/$folder/$class/handlers/pages/form/system/$handler/system.js +0 -384
  281. package/$server/$folder/$class/handlers/pages/form/system/$handler/tabs/modules.js +0 -244
  282. package/$server/$folder/$class/handlers/pages/form/system/$handler/tabs/staff.js +0 -2126
  283. package/$server/$folder/$class/handlers/pages/storage/$handler/storage.js +0 -21
  284. package/$server/$folder/$file/$data/handlers/pages/form/editor/$handler/editor.js +0 -27
  285. package/$server/$folder/$file/$devs/handlers/pages/form/file/$handler/file.js +0 -31
  286. package/$server/$folder/$file/$ics/handlers/pages/form/file/$handler/file.js +0 -10
  287. package/$server/$folder/$file/$ipynb/handlers/pages/form/file/$handler/file.js +0 -72
  288. package/$server/$folder/$file/$md/handlers/pages/form/file/$handler/file.js +0 -63
  289. package/$server/$folder/$file/$office/handlers/pages/form/file/$handler/file.js +0 -1845
  290. package/$server/$folder/$file/$task/handlers/pages/form/file/$handler/file.js +0 -785
  291. package/$server/$folder/$file/handlers/pages/form/file/$handler/file.js +0 -29
  292. package/$server/$folder/handlers/pages/form/$handler/form.js +0 -2122
  293. package/MODULES/Geo//320/232/320/260/321/200/321/202/320/260/$catalog/handlers/pages/form/map/$handler/map.js +0 -623
  294. package/MODULES/KLADR/$module/handlers/pages/form/kladr/$handler/kladr.js +0 -134
  295. package/MODULES/Process//320/227/320/260/320/264/320/260/321/207/320/270 /320/270 /321/215/321/202/320/260/320/277/321/213/$catalog/handlers/pages/form/gantt/$handler/gantt.js" +0 -293
  296. package/MODULES/Process//320/227/320/260/320/264/320/260/321/207/320/270 /320/270 /321/215/321/202/320/260/320/277/321/213/$catalog/handlers/pages/form/scheduler/$handler/scheduler.js" +0 -234
  297. package/MODULES/Process//320/241/321/205/320/265/320/274/321/213 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/320/276/320/262/$catalog/handlers/pages/form/bpmn/$handler/bpmn.js" +0 -406
  298. package/MODULES/Register/CATALOGS/$catalog/$folder/$class/$virtual/handlers/pages/form/virtual/$handler/class.js +0 -6
  299. package/MODULES/Register/REGISTER/$register/$folder/$class/$account/handlers/pages/form/analysis/$handler/class.js +0 -9
  300. package/MODULES/Register/REGISTER/$register/$folder/$class/$account/handlers/pages/form/postings/$handler/class.js +0 -9
  301. package/MODULES/Register/REGISTER/$register/$folder/$class/$account/handlers/pages/form/turnovers/$handler/class.js +0 -9
  302. package/MODULES/Register/REGISTER/$register/$folder/$class/$register/handlers/pages/form/journal/$handler/class.js +0 -6
  303. package/MODULES/Register/REGISTER/$register/$folder/$class/$register/handlers/pages/form/sheet/$handler/class.js +0 -6
  304. package/MODULES/Register/REGISTER/$register/$folder/$class/$register/handlers/pages/form/sheet/$handler/sheet.js +0 -808
  305. package/NODES/$node/handlers/pages/form/network/$handler/network.js +0 -110
  306. package/SERVICES/$service/$folder/$storage/$service/class.js +0 -8
  307. package/SERVICES/$service/class.js +0 -442
  308. package/SERVICES/readme.md +0 -36
  309. /package/$server/$folder/$class/$structure/{$base → $organization}/icon.png +0 -0
  310. /package/{SERVICES/DuckDuckGo/$service → MODULES/DuckDuckGo/$module}/class.js +0 -0
  311. /package/MODULES/KLADR/$module/$folder/$class/{$catalog → $data/$catalog}/class.js +0 -0
  312. /package/MODULES/Process/$module/$folder/$class/{$catalog → $data/$catalog}/class.js +0 -0
  313. /package/MODULES/Register/$module/$folder/$class/{$catalog → $data/$catalog}/class.js +0 -0
  314. /package/MODULES/Register/$module/$folder/$class/{$operation → $data/$operation}/class.js +0 -0
  315. /package/MODULES/Register/$module/$folder/$class/{$register → $data/$register}/class.js +0 -0
  316. /package/MODULES/Register/$module/$folder/$class/{$struct → $data/$struct}/class.js +0 -0
  317. /package/MODULES/Register/CATALOGS/$catalog/$folder/$class/{$virtual/$folder/$class → $data/$catalog/$virtual/$folder/$class/$data/$catalog}/$virtual/class.js +0 -0
  318. /package/MODULES/Register/OPERATIONS//320/237/320/273/320/260/321/202/320/265/320/266/320/270 /321/201 /321/200/320/260/321/201/321/207/321/221/321/202/320/275/320/276/320/263/320/276 /321/201/321/207/321/221/321/202/320/260/$operation/{print → $folder/$class/$data/$operation/print}//320/237/320/273/320/260/321/202/321/221/320/266/320/275/320/276/320/265 /320/277/320/276/321/200/321/203/321/207/320/265/320/275/320/270/320/265.html" +0 -0
  319. /package/MODULES/Register/REGISTER/$register/$folder/$class/{$account → $data/$register/$account}/class.js +0 -0
  320. /package/MODULES/Register/REGISTER/$register/$folder/$class/{$account → $data/$register/$account}/readme.md +0 -0
  321. /package/MODULES/Register/REGISTER/$register/$folder/$class/{$register → $data/$register}/class.js +0 -0
  322. /package/MODULES/Register/STRUCTS/$struct/$folder/$class/{$struct → $data/$struct}/class.js +0 -0
  323. /package/{SERVICES/RuCalendar/$service → MODULES/RuCalendar/$module}/class.js +0 -0
  324. /package/{SERVICES/Telegram/$service → MODULES/Telegram/$module}/class.js +0 -0
  325. /package/{SERVICES/Weather/$service → MODULES/Weather/$module}/class.js +0 -0
  326. /package/PROJECTS/$domain/$folder/$class/{$project → $structure/$project}/class.js +0 -0
@@ -1,10 +1,9 @@
1
- /**
2
- * form/trainer («Модели ИИ» на /MODELS/Local) — чистый интерфейс управления локальными моделями ИИ:
3
- * - встроенный в WORK сервер локального ИИ (автозапуск по запросу, постоянный режим на Halo ≥ 128 ГБ, выгрузка при простое на обычных ПК);
4
- * - вкладка «Модели»: установленные модели (Вкл/Выкл, Удалить с диска) + установка моделей в 1 клик (включая комплект Halo);
5
- * - вкладка «Дообучение»: двухшаговый мастер (1. Собрать данные организации → 2. Дообучить модель LoRA).
6
- */
7
1
  export default {
2
+ label: 'Модели ИИ',
3
+ icon: 'carbon:chip',
4
+ order: 5,
5
+ tag: 'system-tab-ai-local',
6
+ component: {
8
7
  imports: 'oda//button, oda//icon, oda//tabs',
9
8
  template: /*html*/`
10
9
  <style>
@@ -605,7 +604,7 @@ export default {
605
604
  <div class="card">
606
605
  <div class="section-title">Шаг 1. Собрать обучающий набор из организации</div>
607
606
  <div class="field">
608
- <label>Организация ($base)</label>
607
+ <label>Организация ($organization)</label>
609
608
  <input :value="datasetBasePath" placeholder="/ORGANIZATIONS/Моё предприятие" @input="datasetBasePath = $this.value">
610
609
  </div>
611
610
  <div class="field">
@@ -678,21 +677,35 @@ export default {
678
677
  </div>
679
678
  </div>
680
679
  `,
680
+ $item: {
681
+ $def: null,
682
+ set(n) {
683
+ if (n) this.reloadAll().then(() => this.searchHf());
684
+ }
685
+ },
681
686
  activeTab: 'models',
682
687
  get trainerTabItems() {
683
- return [
684
- { id: 'models', label: 'Модели', icon: 'carbon:machine-learning-model', count: this.localModels?.length || 0, showZeroCount: true },
685
- { id: 'train', label: 'Дообучение', icon: 'carbon:education', count: this.adapters?.length || 0, showZeroCount: true },
686
- ];
688
+ return [{
689
+ id: 'models',
690
+ label: 'Модели',
691
+ icon: 'carbon:machine-learning-model',
692
+ count: this.localModels?.length || 0,
693
+ showZeroCount: true
694
+ }, {
695
+ id: 'train',
696
+ label: 'Дообучение',
697
+ icon: 'carbon:education',
698
+ count: this.adapters?.length || 0,
699
+ showZeroCount: true
700
+ }];
687
701
  },
688
702
  get trainerTabIndex() {
689
- const idx = this.trainerTabItems.findIndex(t => t.id === this.activeTab);
690
- return idx >= 0 ? idx : 0;
703
+ const idx = this.trainerTabItems.findIndex(t => t.id === this.activeTab);
704
+ return idx >= 0 ? idx : 0;
691
705
  },
692
706
  onTrainerTabSelect(e) {
693
- const id = e?.detail?.item?.id;
694
- if (id)
695
- this.activeTab = id;
707
+ const id = e?.detail?.item?.id;
708
+ if (id) this.activeTab = id;
696
709
  },
697
710
  hardware: null,
698
711
  runtime: null,
@@ -738,709 +751,646 @@ export default {
738
751
  installingPythonDeps: false,
739
752
  checkAllResult: null,
740
753
  _pollTimer: null,
741
-
742
754
  get missingPythonPkgs() {
743
- const res = this.checkAllResult;
744
- if (!res)
745
- return [];
746
- const set = new Set();
747
- const pkgs = res.pythonDeps?.packages || {};
748
- for (const [k, ok] of Object.entries(pkgs)) {
749
- if (!ok)
750
- set.add(k);
751
- }
752
- for (const r of (res.results || [])) {
753
- for (const dep of (r.missingDeps || []))
754
- set.add(dep);
755
- }
756
- return [...set];
755
+ const res = this.checkAllResult;
756
+ if (!res) return [];
757
+ const set = new Set();
758
+ const pkgs = res.pythonDeps?.packages || {};
759
+ for (const [k, ok] of Object.entries(pkgs)) {
760
+ if (!ok) set.add(k);
761
+ }
762
+ for (const r of res.results || []) {
763
+ for (const dep of r.missingDeps || []) set.add(dep);
764
+ }
765
+ return [...set];
757
766
  },
758
-
759
767
  get hasNetworkChanges() {
760
- const n = this.network || {};
761
- const savedPreset = n.sourcePreset || 'official';
762
- const savedEndpoint = String(n.endpointUrl || 'https://huggingface.co').replace(/\/+$/, '');
763
- const savedThreads = Number(n.threads) || 8;
764
- const savedProxy = String(n.proxyUrl || '').trim();
765
-
766
- if (String(this.netPreset || 'official') !== savedPreset)
767
- return true;
768
- const curEndpoint = this.netPreset === 'official'
769
- ? 'https://huggingface.co'
770
- : (this.netPreset === 'hf-mirror' ? 'https://hf-mirror.com' : String(this.netEndpoint || '').trim().replace(/\/+$/, ''));
771
- if (this.netPreset === 'custom' && curEndpoint !== savedEndpoint)
772
- return true;
773
- if (Number(this.netThreads || 8) !== savedThreads)
774
- return true;
775
- if (this.netClearProxy && Boolean(savedProxy || n.hasProxy))
776
- return true;
777
- if (String(this.netProxy || '').trim() !== savedProxy)
778
- return true;
779
- if (this.netClearToken && Boolean(n.hasToken))
780
- return true;
781
- if (String(this.netToken || '').trim() !== '')
782
- return true;
783
- return false;
768
+ const n = this.network || {};
769
+ const savedPreset = n.sourcePreset || 'official';
770
+ const savedEndpoint = String(n.endpointUrl || 'https://huggingface.co').replace(/\/+$/, '');
771
+ const savedThreads = Number(n.threads) || 8;
772
+ const savedProxy = String(n.proxyUrl || '').trim();
773
+ if (String(this.netPreset || 'official') !== savedPreset) return true;
774
+ const curEndpoint = this.netPreset === 'official' ? 'https://huggingface.co' : this.netPreset === 'hf-mirror' ? 'https://hf-mirror.com' : String(this.netEndpoint || '').trim().replace(/\/+$/, '');
775
+ if (this.netPreset === 'custom' && curEndpoint !== savedEndpoint) return true;
776
+ if (Number(this.netThreads || 8) !== savedThreads) return true;
777
+ if (this.netClearProxy && Boolean(savedProxy || n.hasProxy)) return true;
778
+ if (String(this.netProxy || '').trim() !== savedProxy) return true;
779
+ if (this.netClearToken && Boolean(n.hasToken)) return true;
780
+ if (String(this.netToken || '').trim() !== '') return true;
781
+ return false;
784
782
  },
785
783
  get networkSummary() {
786
- const n = this.network;
787
- const src = n?.sourceLabel || 'huggingface.co';
788
- const thr = n?.threads || this.netThreads || 8;
789
- const pxy = n?.hasProxy ? ' · прокси' : '';
790
- return `${src} · ${thr} пот.${pxy}`;
784
+ const n = this.network;
785
+ const src = n?.sourceLabel || 'huggingface.co';
786
+ const thr = n?.threads || this.netThreads || 8;
787
+ const pxy = n?.hasProxy ? ' · прокси' : '';
788
+ return `${src} · ${thr} пот.${pxy}`;
791
789
  },
792
-
793
790
  get categoryTabs() {
794
- return [
795
- { id: 'all', label: 'Все', icon: 'icons:apps' },
796
- { id: 'installed', label: `Установленные (${(this.localModels || []).length})`, icon: 'icons:check' },
797
- { id: 'llm', label: 'Чат и Код', icon: 'carbon:chat' },
798
- { id: 'vlm', label: 'Зрение и Документы', icon: 'carbon:image-search' },
799
- { id: 'audio', label: 'Речь и Голос', icon: 'carbon:microphone' },
800
- { id: 'image', label: 'Картинки', icon: 'carbon:paint-brush' },
801
- { id: 'video', label: 'Видео', icon: 'av:videocam' },
802
- { id: 'embed', label: 'Поиск (RAG)', icon: 'carbon:search-locate' },
803
- { id: 'halo', label: 'Комплект Halo (128–192 ГБ)', icon: 'carbon:chip' },
804
- ];
791
+ return [{
792
+ id: 'all',
793
+ label: 'Все',
794
+ icon: 'icons:apps'
795
+ }, {
796
+ id: 'installed',
797
+ label: `Установленные (${(this.localModels || []).length})`,
798
+ icon: 'icons:check'
799
+ }, {
800
+ id: 'llm',
801
+ label: 'Чат и Код',
802
+ icon: 'carbon:chat'
803
+ }, {
804
+ id: 'vlm',
805
+ label: 'Зрение и Документы',
806
+ icon: 'carbon:image-search'
807
+ }, {
808
+ id: 'audio',
809
+ label: 'Речь и Голос',
810
+ icon: 'carbon:microphone'
811
+ }, {
812
+ id: 'image',
813
+ label: 'Картинки',
814
+ icon: 'carbon:paint-brush'
815
+ }, {
816
+ id: 'video',
817
+ label: 'Видео',
818
+ icon: 'av:videocam'
819
+ }, {
820
+ id: 'embed',
821
+ label: 'Поиск (RAG)',
822
+ icon: 'carbon:search-locate'
823
+ }, {
824
+ id: 'halo',
825
+ label: 'Комплект Halo (128–192 ГБ)',
826
+ icon: 'carbon:chip'
827
+ }];
805
828
  },
806
829
  get activeDownloads() {
807
- return (this.downloads || []).filter(d => d.status === 'downloading');
830
+ return (this.downloads || []).filter(d => d.status === 'downloading');
808
831
  },
809
832
  get activeTransfers() {
810
- return (this.transfers || []).filter(t => t.status === 'running');
833
+ return (this.transfers || []).filter(t => t.status === 'running');
811
834
  },
812
835
  get hasAvailableHalo() {
813
- return (this.halogenCatalog || []).some(h =>
814
- !h.weightsDownloaded
815
- && !this.isRepoInstalled(h.hfRepo, h.nodeName)
816
- && !this.getDownloadEntry(h.hfRepo, h.nodeName)
817
- );
836
+ return (this.halogenCatalog || []).some(h => !h.weightsDownloaded && !this.isRepoInstalled(h.hfRepo, h.nodeName) && !this.getDownloadEntry(h.hfRepo, h.nodeName));
818
837
  },
819
838
  get unifiedModels() {
820
- const mod = String(this.hfModality || 'all');
821
- const q = String(this.hfQuery || '').trim().toLowerCase();
822
- const haloByNode = new Map();
823
- const haloByRepo = new Map();
824
- for (const h of this.halogenCatalog || []) {
825
- if (h?.nodeName)
826
- haloByNode.set(h.nodeName.toLowerCase(), h);
827
- if (h?.hfRepo)
828
- haloByRepo.set(h.hfRepo.toLowerCase(), h);
829
- }
830
-
831
- const list = [];
832
- const findEntry = (id, repoId) => {
833
- const idLow = String(id || '').toLowerCase();
834
- const repoLow = String(repoId || '').toLowerCase();
835
- const shortRepo = repoLow ? repoLow.split('/').pop() : '';
836
- return list.find(x =>
837
- (idLow && (x.id?.toLowerCase() === idLow || x.download?.folderName?.toLowerCase() === idLow))
838
- || (repoLow && x.repoId?.toLowerCase() === repoLow)
839
- || (shortRepo && x.id?.toLowerCase() === shortRepo)
840
- ) || null;
841
- };
839
+ const mod = String(this.hfModality || 'all');
840
+ const q = String(this.hfQuery || '').trim().toLowerCase();
841
+ const haloByNode = new Map();
842
+ const haloByRepo = new Map();
843
+ for (const h of this.halogenCatalog || []) {
844
+ if (h?.nodeName) haloByNode.set(h.nodeName.toLowerCase(), h);
845
+ if (h?.hfRepo) haloByRepo.set(h.hfRepo.toLowerCase(), h);
846
+ }
847
+ const list = [];
848
+ const findEntry = (id, repoId) => {
849
+ const idLow = String(id || '').toLowerCase();
850
+ const repoLow = String(repoId || '').toLowerCase();
851
+ const shortRepo = repoLow ? repoLow.split('/').pop() : '';
852
+ return list.find(x => idLow && (x.id?.toLowerCase() === idLow || x.download?.folderName?.toLowerCase() === idLow) || repoLow && x.repoId?.toLowerCase() === repoLow || shortRepo && x.id?.toLowerCase() === shortRepo) || null;
853
+ };
842
854
 
843
- // 1. Установленные локальные модели
844
- for (const m of this.localModels || []) {
845
- const halo = haloByNode.get(String(m.id || '').toLowerCase())
846
- || haloByRepo.get(String(m.model || '').toLowerCase());
847
- const incompatible = Boolean(m.incompatibleOnPlatform);
848
- list.push({
849
- key: `inst:${m.id}`,
850
- id: m.id,
851
- repoId: halo?.hfRepo || (String(m.model || '').includes('/') ? m.model : ''),
852
- label: m.label || halo?.label || m.id,
853
- desc: `Путь: ${m.path}${m.sizeGb ? ` · На диске: ${m.sizeGb} ГБ` : ''}`,
854
- icon: m.icon || halo?.icon || 'ai:ollama',
855
- modality: m.modality || halo?.modality || 'llm',
856
- isHalo: Boolean(halo),
857
- state: 'installed',
858
- dotClass: incompatible ? 'warn' : (m.active ? 'on' : 'off'),
859
- path: m.path,
860
- enabled: m.enabled !== false,
861
- active: Boolean(m.active) && !incompatible,
862
- incompatibleOnPlatform: incompatible,
863
- incompatibleReason: m.incompatibleReason || '',
864
- sizeGb: m.sizeGb || 0,
865
- ramGb: m.sizeGb || halo?.ramGb || 4,
866
- fit: 'optimal',
867
- device: m.launchPassport?.computeDevice || halo?.device || '',
868
- launchPassport: m.launchPassport || null,
869
- download: null,
870
- progressPct: 100,
871
- etaText: '',
872
- });
873
- }
874
-
875
- // 2. Активные, приостановленные и упавшие загрузки (в т.ч. .part на диске)
876
- for (const d of this.downloads || []) {
877
- if (d.status === 'completed' || d.status === 'cancelled')
878
- continue;
879
- const halo = haloByNode.get(String(d.folderName || '').toLowerCase())
880
- || haloByRepo.get(String(d.repoId || '').toLowerCase());
881
- const existing = findEntry(d.folderName, d.repoId);
882
- const state = d.status === 'downloading' ? 'downloading' : (d.status === 'failed' ? 'failed' : 'paused');
883
- const progressPct = d.totalBytes > 0
884
- ? Math.min(99, Math.max(0, Number(d.progress) || Math.round((d.downloadedBytes / d.totalBytes) * 100)))
885
- : (d.downloadedBytes > 0 ? 15 : 0);
886
- const etaText = d.stalled ? '' : this.formatEta(d.etaSeconds);
887
- if (existing) {
888
- if (existing.state !== 'installed') {
889
- existing.state = state;
890
- existing.dotClass = state === 'downloading' ? 'on' : 'warn';
891
- existing.download = d;
892
- existing.progressPct = progressPct;
893
- existing.etaText = etaText;
894
- }
895
- continue;
896
- }
897
- list.push({
898
- key: `dl:${d.id || d.folderName}`,
899
- id: d.folderName || halo?.nodeName || d.repoId,
900
- repoId: d.repoId || halo?.hfRepo || '',
901
- label: halo?.label || d.label || d.folderName || d.repoId,
902
- desc: halo?.role || d.repoId || `Папка модели: ${d.folderName}/$ai/#weights`,
903
- icon: halo?.icon || 'ai:ollama',
904
- modality: halo?.modality || d.modality || 'llm',
905
- isHalo: Boolean(halo),
906
- state,
907
- dotClass: state === 'downloading' ? 'on' : 'warn',
908
- ramGb: halo?.ramGb || 4,
909
- fit: 'optimal',
910
- device: halo?.device || '',
911
- download: d,
912
- progressPct,
913
- etaText,
914
- });
915
- }
855
+ // 1. Установленные локальные модели
856
+ for (const m of this.localModels || []) {
857
+ const halo = haloByNode.get(String(m.id || '').toLowerCase()) || haloByRepo.get(String(m.model || '').toLowerCase());
858
+ const incompatible = Boolean(m.incompatibleOnPlatform);
859
+ list.push({
860
+ key: `inst:${m.id}`,
861
+ id: m.id,
862
+ repoId: halo?.hfRepo || (String(m.model || '').includes('/') ? m.model : ''),
863
+ label: m.label || halo?.label || m.id,
864
+ desc: `Путь: ${m.path}${m.sizeGb ? ` · На диске: ${m.sizeGb} ГБ` : ''}`,
865
+ icon: m.icon || halo?.icon || 'ai:ollama',
866
+ modality: m.modality || halo?.modality || 'llm',
867
+ isHalo: Boolean(halo),
868
+ state: 'installed',
869
+ dotClass: incompatible ? 'warn' : m.active ? 'on' : 'off',
870
+ path: m.path,
871
+ enabled: m.enabled !== false,
872
+ active: Boolean(m.active) && !incompatible,
873
+ incompatibleOnPlatform: incompatible,
874
+ incompatibleReason: m.incompatibleReason || '',
875
+ sizeGb: m.sizeGb || 0,
876
+ ramGb: m.sizeGb || halo?.ramGb || 4,
877
+ fit: 'optimal',
878
+ device: m.launchPassport?.computeDevice || halo?.device || '',
879
+ launchPassport: m.launchPassport || null,
880
+ download: null,
881
+ progressPct: 100,
882
+ etaText: ''
883
+ });
884
+ }
916
885
 
917
- // 3. Каталог Halo
918
- for (const h of this.halogenCatalog || []) {
919
- if (findEntry(h.nodeName, h.hfRepo))
920
- continue;
921
- const dl = h.activeDownload || null;
922
- const state = dl?.status === 'downloading' ? 'downloading' : (dl?.status === 'failed' ? 'failed' : 'available');
923
- const progressPct = dl ? Math.min(99, Math.max(1, Number(dl.progress) || 5)) : 0;
924
- list.push({
925
- key: `halo:${h.nodeName}`,
926
- id: h.nodeName,
927
- repoId: h.hfRepo,
928
- label: h.label || h.nodeName,
929
- desc: h.role || '',
930
- icon: h.icon || 'ai:qwen',
931
- modality: h.modality || 'llm',
932
- isHalo: true,
933
- state,
934
- dotClass: state === 'downloading' ? 'on' : 'off',
935
- ramGb: h.ramGb || 4,
936
- fit: 'optimal',
937
- device: h.device || '',
938
- download: dl,
939
- progressPct,
940
- etaText: '',
941
- });
942
- }
886
+ // 2. Активные, приостановленные и упавшие загрузки (в т.ч. .part на диске)
887
+ for (const d of this.downloads || []) {
888
+ if (d.status === 'completed' || d.status === 'cancelled') continue;
889
+ const halo = haloByNode.get(String(d.folderName || '').toLowerCase()) || haloByRepo.get(String(d.repoId || '').toLowerCase());
890
+ const existing = findEntry(d.folderName, d.repoId);
891
+ const state = d.status === 'downloading' ? 'downloading' : d.status === 'failed' ? 'failed' : 'paused';
892
+ const progressPct = d.totalBytes > 0 ? Math.min(99, Math.max(0, Number(d.progress) || Math.round(d.downloadedBytes / d.totalBytes * 100))) : d.downloadedBytes > 0 ? 15 : 0;
893
+ const etaText = d.stalled ? '' : this.formatEta(d.etaSeconds);
894
+ if (existing) {
895
+ if (existing.state !== 'installed') {
896
+ existing.state = state;
897
+ existing.dotClass = state === 'downloading' ? 'on' : 'warn';
898
+ existing.download = d;
899
+ existing.progressPct = progressPct;
900
+ existing.etaText = etaText;
901
+ }
902
+ continue;
903
+ }
904
+ list.push({
905
+ key: `dl:${d.id || d.folderName}`,
906
+ id: d.folderName || halo?.nodeName || d.repoId,
907
+ repoId: d.repoId || halo?.hfRepo || '',
908
+ label: halo?.label || d.label || d.folderName || d.repoId,
909
+ desc: halo?.role || d.repoId || `Папка модели: ${d.folderName}/$ai/#weights`,
910
+ icon: halo?.icon || 'ai:ollama',
911
+ modality: halo?.modality || d.modality || 'llm',
912
+ isHalo: Boolean(halo),
913
+ state,
914
+ dotClass: state === 'downloading' ? 'on' : 'warn',
915
+ ramGb: halo?.ramGb || 4,
916
+ fit: 'optimal',
917
+ device: halo?.device || '',
918
+ download: d,
919
+ progressPct,
920
+ etaText
921
+ });
922
+ }
943
923
 
944
- // 4. Каталог Hugging Face
945
- for (const item of this.hfModels || []) {
946
- const short = String(item.id || '').split('/').pop();
947
- const targetId = item.folderName || short || item.id;
948
- if (findEntry(targetId, item.id) || (short && findEntry(short, item.id)))
949
- continue;
950
- list.push({
951
- key: `hf:${item.id}`,
952
- id: targetId,
953
- repoId: item.id,
954
- label: item.modelName || item.id,
955
- desc: item.whatItDoes || item.recommendedFor || '',
956
- icon: item.icon || 'ai:ollama',
957
- modality: item.modality || 'llm',
958
- isHalo: Boolean(item.buboPackage),
959
- buboPackage: Boolean(item.buboPackage),
960
- haloNodeName: item.haloNodeName || '',
961
- state: 'available',
962
- dotClass: 'off',
963
- ramGb: Number(item.ramRequiredGb) || 0,
964
- fit: item.fit || 'unknown',
965
- fitLabel: item.fitLabel || '',
966
- diffusersCompatible: item.diffusersCompatible !== false,
967
- compatibilityNote: item.compatibilityNote || '',
968
- device: '',
969
- download: null,
970
- progressPct: 0,
971
- etaText: '',
972
- });
973
- }
924
+ // 3. Каталог Halo
925
+ for (const h of this.halogenCatalog || []) {
926
+ if (findEntry(h.nodeName, h.hfRepo)) continue;
927
+ const dl = h.activeDownload || null;
928
+ const state = dl?.status === 'downloading' ? 'downloading' : dl?.status === 'failed' ? 'failed' : 'available';
929
+ const progressPct = dl ? Math.min(99, Math.max(1, Number(dl.progress) || 5)) : 0;
930
+ list.push({
931
+ key: `halo:${h.nodeName}`,
932
+ id: h.nodeName,
933
+ repoId: h.hfRepo,
934
+ label: h.label || h.nodeName,
935
+ desc: h.role || '',
936
+ icon: h.icon || 'ai:qwen',
937
+ modality: h.modality || 'llm',
938
+ isHalo: true,
939
+ state,
940
+ dotClass: state === 'downloading' ? 'on' : 'off',
941
+ ramGb: h.ramGb || 4,
942
+ fit: 'optimal',
943
+ device: h.device || '',
944
+ download: dl,
945
+ progressPct,
946
+ etaText: ''
947
+ });
948
+ }
974
949
 
975
- const rank = { downloading: 0, paused: 1, failed: 1, installed: 2, available: 3 };
976
- return list
977
- .filter(item => {
978
- if (mod === 'installed')
979
- return item.state === 'installed';
980
- if (mod === 'halo')
981
- return item.isHalo;
982
- if (mod !== 'all' && item.modality !== mod)
983
- return false;
984
- if (q && mod !== 'halo' && mod !== 'installed') {
985
- const hay = `${item.label} ${item.id} ${item.repoId} ${item.desc}`.toLowerCase();
986
- if (!hay.includes(q))
987
- return false;
988
- }
989
- if (this.hfFilter === 'fit' && item.state === 'available' && item.fit === 'too_large')
990
- return false;
991
- return true;
992
- })
993
- .sort((a, b) => (rank[a.state] ?? 9) - (rank[b.state] ?? 9));
950
+ // 4. Каталог Hugging Face
951
+ for (const item of this.hfModels || []) {
952
+ const short = String(item.id || '').split('/').pop();
953
+ const targetId = item.folderName || short || item.id;
954
+ if (findEntry(targetId, item.id) || short && findEntry(short, item.id)) continue;
955
+ list.push({
956
+ key: `hf:${item.id}`,
957
+ id: targetId,
958
+ repoId: item.id,
959
+ label: item.modelName || item.id,
960
+ desc: item.whatItDoes || item.recommendedFor || '',
961
+ icon: item.icon || 'ai:ollama',
962
+ modality: item.modality || 'llm',
963
+ isHalo: Boolean(item.buboPackage),
964
+ buboPackage: Boolean(item.buboPackage),
965
+ haloNodeName: item.haloNodeName || '',
966
+ state: 'available',
967
+ dotClass: 'off',
968
+ ramGb: Number(item.ramRequiredGb) || 0,
969
+ fit: item.fit || 'unknown',
970
+ fitLabel: item.fitLabel || '',
971
+ diffusersCompatible: item.diffusersCompatible !== false,
972
+ compatibilityNote: item.compatibilityNote || '',
973
+ device: '',
974
+ download: null,
975
+ progressPct: 0,
976
+ etaText: ''
977
+ });
978
+ }
979
+ const rank = {
980
+ downloading: 0,
981
+ paused: 1,
982
+ failed: 1,
983
+ installed: 2,
984
+ available: 3
985
+ };
986
+ return list.filter(item => {
987
+ if (mod === 'installed') return item.state === 'installed';
988
+ if (mod === 'halo') return item.isHalo;
989
+ if (mod !== 'all' && item.modality !== mod) return false;
990
+ if (q && mod !== 'halo' && mod !== 'installed') {
991
+ const hay = `${item.label} ${item.id} ${item.repoId} ${item.desc}`.toLowerCase();
992
+ if (!hay.includes(q)) return false;
993
+ }
994
+ if (this.hfFilter === 'fit' && item.state === 'available' && item.fit === 'too_large') return false;
995
+ return true;
996
+ }).sort((a, b) => (rank[a.state] ?? 9) - (rank[b.state] ?? 9));
994
997
  },
995
998
  formatEta(sec) {
996
- const s = Number(sec);
997
- if (!Number.isFinite(s) || s <= 0)
998
- return '';
999
- if (s < 60)
1000
- return `~${s} с`;
1001
- if (s < 3600)
1002
- return `~${Math.floor(s / 60)} мин ${s % 60} с`;
1003
- const h = Math.floor(s / 3600);
1004
- const m = Math.floor((s % 3600) / 60);
1005
- return `~${h} ч ${m} мин`;
999
+ const s = Number(sec);
1000
+ if (!Number.isFinite(s) || s <= 0) return '';
1001
+ if (s < 60) return `~${s} с`;
1002
+ if (s < 3600) return `~${Math.floor(s / 60)} мин ${s % 60} с`;
1003
+ const h = Math.floor(s / 3600);
1004
+ const m = Math.floor(s % 3600 / 60);
1005
+ return `~${h} ч ${m} мин`;
1006
1006
  },
1007
1007
  fmtDownloadBytes(bytes) {
1008
- const b = Number(bytes) || 0;
1009
- if (b <= 0)
1010
- return '0 МБ';
1011
- if (b < 1024 * 1024)
1012
- return `${Math.round(b / 1024)} КБ`;
1013
- if (b < 1024 ** 3)
1014
- return `${(b / (1024 * 1024)).toFixed(1)} МБ`;
1015
- return `${(b / (1024 ** 3)).toFixed(2)} ГБ`;
1008
+ const b = Number(bytes) || 0;
1009
+ if (b <= 0) return '0 МБ';
1010
+ if (b < 1024 * 1024) return `${Math.round(b / 1024)} КБ`;
1011
+ if (b < 1024 ** 3) return `${(b / (1024 * 1024)).toFixed(1)} МБ`;
1012
+ return `${(b / 1024 ** 3).toFixed(2)} ГБ`;
1016
1013
  },
1017
1014
  isRepoInstalled(repoId, nodeName = '') {
1018
- if (!repoId && !nodeName)
1019
- return false;
1020
- const shortName = repoId ? String(repoId).split('/').pop().toLowerCase() : '';
1021
- const nodeLower = nodeName ? String(nodeName).toLowerCase() : '';
1022
- const repoLower = repoId ? String(repoId).toLowerCase() : '';
1023
- return (this.localModels || []).some(m => {
1024
- const mId = String(m.id || '').toLowerCase();
1025
- const mModel = String(m.model || '').toLowerCase();
1026
- return (shortName && mId === shortName)
1027
- || (nodeLower && mId === nodeLower)
1028
- || (repoLower && mModel === repoLower);
1029
- });
1015
+ if (!repoId && !nodeName) return false;
1016
+ const shortName = repoId ? String(repoId).split('/').pop().toLowerCase() : '';
1017
+ const nodeLower = nodeName ? String(nodeName).toLowerCase() : '';
1018
+ const repoLower = repoId ? String(repoId).toLowerCase() : '';
1019
+ return (this.localModels || []).some(m => {
1020
+ const mId = String(m.id || '').toLowerCase();
1021
+ const mModel = String(m.model || '').toLowerCase();
1022
+ return shortName && mId === shortName || nodeLower && mId === nodeLower || repoLower && mModel === repoLower;
1023
+ });
1030
1024
  },
1031
1025
  getDownloadEntry(repoId, nodeName = '') {
1032
- if (!repoId && !nodeName)
1033
- return null;
1034
- return (this.downloads || []).find(d =>
1035
- (d.status === 'downloading' || d.status === 'paused' || d.status === 'failed')
1036
- && ((repoId && d.repoId === repoId) || (nodeName && d.folderName === nodeName))
1037
- ) || null;
1026
+ if (!repoId && !nodeName) return null;
1027
+ return (this.downloads || []).find(d => (d.status === 'downloading' || d.status === 'paused' || d.status === 'failed') && (repoId && d.repoId === repoId || nodeName && d.folderName === nodeName)) || null;
1038
1028
  },
1039
1029
  async attached() {
1040
- await this.reloadAll();
1041
- await this.searchHf();
1042
- this._pollTimer = setInterval(() => {
1043
- if (
1044
- this.activeDownloads.length
1045
- || this.activeTransfers.length
1046
- || this.halogenPrepareState?.status === 'running'
1047
- || (this.jobs || []).some(j => j.status === 'running')
1048
- ) {
1049
- this.reloadAll();
1050
- }
1051
- }, 1200);
1030
+ await this.reloadAll();
1031
+ await this.searchHf();
1032
+ this._pollTimer = setInterval(() => {
1033
+ if (this.activeDownloads.length || this.activeTransfers.length || this.halogenPrepareState?.status === 'running' || (this.jobs || []).some(j => j.status === 'running')) {
1034
+ this.reloadAll();
1035
+ }
1036
+ }, 1200);
1052
1037
  },
1053
1038
  detached() {
1054
- if (this._pollTimer) {
1055
- clearInterval(this._pollTimer);
1056
- this._pollTimer = null;
1057
- }
1039
+ if (this._pollTimer) {
1040
+ clearInterval(this._pollTimer);
1041
+ this._pollTimer = null;
1042
+ }
1058
1043
  },
1059
1044
  async _call(method, params = {}) {
1060
- this.error = '';
1061
- if (!this.$item)
1062
- return null;
1063
- try {
1064
- return await this.$item.fetch(method, params);
1065
- }
1066
- catch (e) {
1067
- this.error = String(e?.message || e);
1068
- return null;
1069
- }
1045
+ this.error = '';
1046
+ if (!this.$item) return null;
1047
+ try {
1048
+ return await this.$item.fetch(method, params);
1049
+ } catch (e) {
1050
+ this.error = String(e?.message || e);
1051
+ return null;
1052
+ }
1070
1053
  },
1071
1054
  async checkAllModels() {
1072
- if (!this.$item)
1073
- return;
1074
- this.checkingAll = true;
1075
- this.error = '';
1076
- this.notice = '';
1077
- try {
1078
- const res = await this.$item.fetch('trainer_check_all_models');
1079
- this.checkAllResult = res;
1080
- const total = (res?.results || []).filter(r => !r.skipped).length;
1081
- const passed = (res?.results || []).filter(r => r.ok).length;
1082
- this.notice = `Проверка завершена: работает ${passed} из ${total} активных моделей.`;
1083
- }
1084
- catch (e) {
1085
- this.error = String(e?.message || e);
1086
- }
1087
- finally {
1088
- this.checkingAll = false;
1089
- }
1055
+ if (!this.$item) return;
1056
+ this.checkingAll = true;
1057
+ this.error = '';
1058
+ this.notice = '';
1059
+ try {
1060
+ const res = await this.$item.fetch('trainer_check_all_models');
1061
+ this.checkAllResult = res;
1062
+ const total = (res?.results || []).filter(r => !r.skipped).length;
1063
+ const passed = (res?.results || []).filter(r => r.ok).length;
1064
+ this.notice = `Проверка завершена: работает ${passed} из ${total} активных моделей.`;
1065
+ } catch (e) {
1066
+ this.error = String(e?.message || e);
1067
+ } finally {
1068
+ this.checkingAll = false;
1069
+ }
1090
1070
  },
1091
1071
  async installMissingPythonDeps() {
1092
- if (!this.$item || !this.missingPythonPkgs.length)
1093
- return;
1094
- this.installingPythonDeps = true;
1095
- this.error = '';
1096
- this.notice = '';
1097
- try {
1098
- const res = await this.$item.fetch('trainer_install_python_deps', {}, { packages: this.missingPythonPkgs });
1099
- if (res?.ok) {
1100
- this.notice = 'Пакеты установлены: ' + (res.packages || []).join(', ') + '. Повторяем проверку…';
1101
- await this.checkAllModels();
1102
- }
1103
- else {
1104
- this.error = res?.error || 'Не удалось установить Python-пакеты.';
1105
- }
1106
- }
1107
- catch (e) {
1108
- this.error = String(e?.message || e);
1109
- }
1110
- finally {
1111
- this.installingPythonDeps = false;
1112
- }
1072
+ if (!this.$item || !this.missingPythonPkgs.length) return;
1073
+ this.installingPythonDeps = true;
1074
+ this.error = '';
1075
+ this.notice = '';
1076
+ try {
1077
+ const res = await this.$item.fetch('trainer_install_python_deps', {}, {
1078
+ packages: this.missingPythonPkgs
1079
+ });
1080
+ if (res?.ok) {
1081
+ this.notice = 'Пакеты установлены: ' + (res.packages || []).join(', ') + '. Повторяем проверку…';
1082
+ await this.checkAllModels();
1083
+ } else {
1084
+ this.error = res?.error || 'Не удалось установить Python-пакеты.';
1085
+ }
1086
+ } catch (e) {
1087
+ this.error = String(e?.message || e);
1088
+ } finally {
1089
+ this.installingPythonDeps = false;
1090
+ }
1113
1091
  },
1114
1092
  _invalidateClientModelsTree() {
1115
- for (const w of [window, window.parent, window.top]) {
1116
- try {
1117
- const wk = w?.WORK;
1118
- if (!wk?.items)
1119
- continue;
1120
- for (const k of Object.keys(wk.items)) {
1121
- if (k === '/MODELS' || k.startsWith('/MODELS/')) {
1122
- const node = wk.items[k];
1123
- if (node?.[w.R]?.cache)
1124
- delete node[w.R].cache.items;
1125
- node?.reset?.();
1126
- }
1127
- }
1093
+ for (const w of [window, window.parent, window.top]) {
1094
+ try {
1095
+ const wk = w?.WORK;
1096
+ if (!wk?.items) continue;
1097
+ for (const k of Object.keys(wk.items)) {
1098
+ if (k === '/MODELS' || k.startsWith('/MODELS/')) {
1099
+ const node = wk.items[k];
1100
+ if (node?.[w.R]?.cache) delete node[w.R].cache.items;
1101
+ node?.reset?.();
1128
1102
  }
1129
- catch { /* ignore cross-frame */ }
1130
- }
1103
+ }
1104
+ } catch {/* ignore cross-frame */}
1105
+ }
1131
1106
  },
1132
1107
  async reloadAll() {
1133
- const prevCount = this.localModels?.length || 0;
1134
- const st = await this._call('trainer_status');
1135
- if (!st)
1136
- return;
1137
- if (st.hardware) {
1138
- const firstLoad = !this.hardware;
1139
- this.hardware = st.hardware;
1140
- if (firstLoad && st.hardware.recommendedBaseModel) {
1141
- this.trainBaseModel = st.hardware.recommendedBaseModel;
1142
- this.trainLoraR = st.hardware.recommendedLoraR || 16;
1143
- this.trainMaxSeq = st.hardware.recommendedMaxSeq || 8192;
1144
- }
1145
- }
1146
- this.runtime = st.runtime || null;
1147
- this.localModels = st.models || [];
1148
- this.adapters = st.adapters || [];
1149
- this.datasets = st.datasets || [];
1150
- this.downloads = st.downloads || [];
1151
- this.jobs = st.jobs || [];
1152
- this.transfers = st.transfers || [];
1153
- if (st.network) {
1154
- const hadChanges = this.hasNetworkChanges;
1155
- this.network = st.network;
1156
- if (!hadChanges)
1157
- this._applyNetworkState(st.network);
1158
- }
1159
- if (st.halogen?.catalog)
1160
- this.halogenCatalog = st.halogen.catalog;
1161
- this.halogenPrepareState = st.halogen?.windowsEnv?.prepareState || null;
1162
- if (this.localModels.length !== prevCount)
1163
- this._invalidateClientModelsTree();
1108
+ const prevCount = this.localModels?.length || 0;
1109
+ const st = await this._call('trainer_status');
1110
+ if (!st) return;
1111
+ if (st.hardware) {
1112
+ const firstLoad = !this.hardware;
1113
+ this.hardware = st.hardware;
1114
+ if (firstLoad && st.hardware.recommendedBaseModel) {
1115
+ this.trainBaseModel = st.hardware.recommendedBaseModel;
1116
+ this.trainLoraR = st.hardware.recommendedLoraR || 16;
1117
+ this.trainMaxSeq = st.hardware.recommendedMaxSeq || 8192;
1118
+ }
1119
+ }
1120
+ this.runtime = st.runtime || null;
1121
+ this.localModels = st.models || [];
1122
+ this.adapters = st.adapters || [];
1123
+ this.datasets = st.datasets || [];
1124
+ this.downloads = st.downloads || [];
1125
+ this.jobs = st.jobs || [];
1126
+ this.transfers = st.transfers || [];
1127
+ if (st.network) {
1128
+ const hadChanges = this.hasNetworkChanges;
1129
+ this.network = st.network;
1130
+ if (!hadChanges) this._applyNetworkState(st.network);
1131
+ }
1132
+ if (st.halogen?.catalog) this.halogenCatalog = st.halogen.catalog;
1133
+ this.halogenPrepareState = st.halogen?.windowsEnv?.prepareState || null;
1134
+ if (this.localModels.length !== prevCount) this._invalidateClientModelsTree();
1164
1135
  },
1165
1136
  lowSpeedHint(dl) {
1166
- const sp = dl?.avgSpeedMBs || dl?.speedMBs || 0;
1167
- if (dl?.stalled)
1168
- return `Источник не передаёт данные ${dl.idleSec || 0} с — соединение переподключается автоматически. Если простой повторяется, смените источник на HF-Mirror или включите прокси/VPN.`;
1169
- if (dl?.usingProxy)
1170
- return `Низкая скорость через прокси (${sp} МБ/с). Проверьте скорость прокси-сервера или попробуйте другой источник.`;
1171
- if (dl?.sourceLabel === 'hf-mirror' || String(dl?.endpointUrl || '').includes('hf-mirror'))
1172
- return `Низкая скорость на HF-Mirror (${sp} МБ/с). Попробуйте указать прокси или включить VPN.`;
1173
- return `Низкая скорость (${sp} МБ/с). Попробуйте переключить источник на HF-Mirror или указать прокси для моделей.`;
1137
+ const sp = dl?.avgSpeedMBs || dl?.speedMBs || 0;
1138
+ if (dl?.stalled) return `Источник не передаёт данные ${dl.idleSec || 0} с — соединение переподключается автоматически. Если простой повторяется, смените источник на HF-Mirror или включите прокси/VPN.`;
1139
+ if (dl?.usingProxy) return `Низкая скорость через прокси (${sp} МБ/с). Проверьте скорость прокси-сервера или попробуйте другой источник.`;
1140
+ if (dl?.sourceLabel === 'hf-mirror' || String(dl?.endpointUrl || '').includes('hf-mirror')) return `Низкая скорость на HF-Mirror (${sp} МБ/с). Попробуйте указать прокси или включить VPN.`;
1141
+ return `Низкая скорость (${sp} МБ/с). Попробуйте переключить источник на HF-Mirror или указать прокси для моделей.`;
1174
1142
  },
1175
1143
  _applyNetworkState(n) {
1176
- if (!n)
1177
- return;
1178
- this.netPreset = n.sourcePreset || 'official';
1179
- this.netEndpoint = n.endpointUrl || 'https://huggingface.co';
1180
- this.netProxy = n.proxyUrl || '';
1181
- this.netHasProxy = Boolean(n.hasProxy);
1182
- this.netThreads = Number(n.threads) || 8;
1183
- this.netHasToken = Boolean(n.hasToken);
1184
- this.netTokenMask = n.tokenMask || '';
1185
- this.netToken = '';
1186
- this.netClearProxy = false;
1187
- this.netClearToken = false;
1144
+ if (!n) return;
1145
+ this.netPreset = n.sourcePreset || 'official';
1146
+ this.netEndpoint = n.endpointUrl || 'https://huggingface.co';
1147
+ this.netProxy = n.proxyUrl || '';
1148
+ this.netHasProxy = Boolean(n.hasProxy);
1149
+ this.netThreads = Number(n.threads) || 8;
1150
+ this.netHasToken = Boolean(n.hasToken);
1151
+ this.netTokenMask = n.tokenMask || '';
1152
+ this.netToken = '';
1153
+ this.netClearProxy = false;
1154
+ this.netClearToken = false;
1188
1155
  },
1189
1156
  toggleNetworkPanel() {
1190
- this.networkOpen = !this.networkOpen;
1191
- if (this.networkOpen && this.network && !this.hasNetworkChanges)
1192
- this._applyNetworkState(this.network);
1193
- if (this.networkOpen)
1194
- this._focusNetworkPanel();
1157
+ this.networkOpen = !this.networkOpen;
1158
+ if (this.networkOpen && this.network && !this.hasNetworkChanges) this._applyNetworkState(this.network);
1159
+ if (this.networkOpen) this._focusNetworkPanel();
1195
1160
  },
1196
1161
  openNetworkPanel() {
1197
- this.networkOpen = true;
1198
- if (this.network && !this.hasNetworkChanges)
1199
- this._applyNetworkState(this.network);
1200
- this._focusNetworkPanel();
1162
+ this.networkOpen = true;
1163
+ if (this.network && !this.hasNetworkChanges) this._applyNetworkState(this.network);
1164
+ this._focusNetworkPanel();
1201
1165
  },
1202
1166
  _focusNetworkPanel() {
1203
- this.async(() => {
1204
- const panel = this.__shadowRoot__?.getElementById?.('networkPanel') || this.shadowRoot?.getElementById?.('networkPanel');
1205
- panel?.scrollIntoView?.({ behavior: 'smooth', block: 'center' });
1206
- panel?.querySelector?.('select, input')?.focus?.();
1207
- }, 50);
1167
+ this.async(() => {
1168
+ const panel = this.__shadowRoot__?.getElementById?.('networkPanel') || this.shadowRoot?.getElementById?.('networkPanel');
1169
+ panel?.scrollIntoView?.({
1170
+ behavior: 'smooth',
1171
+ block: 'center'
1172
+ });
1173
+ panel?.querySelector?.('select, input')?.focus?.();
1174
+ }, 50);
1208
1175
  },
1209
1176
  onNetworkPresetChange(val) {
1210
- this.netPreset = String(val || 'official');
1211
- if (this.netPreset === 'official')
1212
- this.netEndpoint = 'https://huggingface.co';
1213
- else if (this.netPreset === 'hf-mirror')
1214
- this.netEndpoint = 'https://hf-mirror.com';
1177
+ this.netPreset = String(val || 'official');
1178
+ if (this.netPreset === 'official') this.netEndpoint = 'https://huggingface.co';else if (this.netPreset === 'hf-mirror') this.netEndpoint = 'https://hf-mirror.com';
1215
1179
  },
1216
1180
  setNetworkField(field, val) {
1217
- this[field] = val;
1218
- if (field === 'netProxy' && String(val || '').trim())
1219
- this.netClearProxy = false;
1220
- if (field === 'netToken' && String(val || '').trim())
1221
- this.netClearToken = false;
1181
+ this[field] = val;
1182
+ if (field === 'netProxy' && String(val || '').trim()) this.netClearProxy = false;
1183
+ if (field === 'netToken' && String(val || '').trim()) this.netClearToken = false;
1222
1184
  },
1223
1185
  async saveNetworkSettings() {
1224
- if (!this.hasNetworkChanges)
1225
- return;
1226
- this.netBusy = true;
1227
- try {
1228
- const payload = {
1229
- sourcePreset: this.netPreset,
1230
- endpointUrl: this.netPreset === 'official'
1231
- ? 'https://huggingface.co'
1232
- : (this.netPreset === 'hf-mirror' ? 'https://hf-mirror.com' : this.netEndpoint),
1233
- proxyUrl: this.netProxy,
1234
- threads: this.netThreads,
1235
- };
1236
- if (this.netClearProxy && !String(this.netProxy || '').trim())
1237
- payload.clearProxy = true;
1238
- if (this.netClearToken && !String(this.netToken || '').trim())
1239
- payload.clearToken = true;
1240
- else if (this.netToken)
1241
- payload.token = this.netToken;
1242
- const res = await this._call('trainer_network_set', payload);
1243
- if (res) {
1244
- this.network = res;
1245
- this._applyNetworkState(res);
1246
- const extra = res.restartedCount > 0
1247
- ? ` · активных загрузок перезапущено на новых настройках: ${res.restartedCount}`
1248
- : '';
1249
- this.notice = `Сетевые настройки загрузчика сохранены (${res.sourceLabel}, ${res.threads} потоков${extra}).`;
1250
- if (res.restartedCount > 0)
1251
- await this.reloadAll();
1252
- }
1253
- }
1254
- finally {
1255
- this.netBusy = false;
1256
- }
1186
+ if (!this.hasNetworkChanges) return;
1187
+ this.netBusy = true;
1188
+ try {
1189
+ const payload = {
1190
+ sourcePreset: this.netPreset,
1191
+ endpointUrl: this.netPreset === 'official' ? 'https://huggingface.co' : this.netPreset === 'hf-mirror' ? 'https://hf-mirror.com' : this.netEndpoint,
1192
+ proxyUrl: this.netProxy,
1193
+ threads: this.netThreads
1194
+ };
1195
+ if (this.netClearProxy && !String(this.netProxy || '').trim()) payload.clearProxy = true;
1196
+ if (this.netClearToken && !String(this.netToken || '').trim()) payload.clearToken = true;else if (this.netToken) payload.token = this.netToken;
1197
+ const res = await this._call('trainer_network_set', payload);
1198
+ if (res) {
1199
+ this.network = res;
1200
+ this._applyNetworkState(res);
1201
+ const extra = res.restartedCount > 0 ? ` · активных загрузок перезапущено на новых настройках: ${res.restartedCount}` : '';
1202
+ this.notice = `Сетевые настройки загрузчика сохранены (${res.sourceLabel}, ${res.threads} потоков${extra}).`;
1203
+ if (res.restartedCount > 0) await this.reloadAll();
1204
+ }
1205
+ } finally {
1206
+ this.netBusy = false;
1207
+ }
1257
1208
  },
1258
1209
  clearNetworkProxy() {
1259
- this.netProxy = '';
1260
- this.netClearProxy = Boolean(this.network?.hasProxy || this.network?.proxyUrl);
1210
+ this.netProxy = '';
1211
+ this.netClearProxy = Boolean(this.network?.hasProxy || this.network?.proxyUrl);
1261
1212
  },
1262
1213
  clearNetworkToken() {
1263
- this.netToken = '';
1264
- this.netClearToken = Boolean(this.network?.hasToken);
1214
+ this.netToken = '';
1215
+ this.netClearToken = Boolean(this.network?.hasToken);
1265
1216
  },
1266
1217
  async setModality(mod) {
1267
- this.hfModality = String(mod || 'all');
1268
- if (this.hfModality !== 'halo' && this.hfModality !== 'installed') {
1269
- await this.searchHf();
1270
- }
1218
+ this.hfModality = String(mod || 'all');
1219
+ if (this.hfModality !== 'halo' && this.hfModality !== 'installed') {
1220
+ await this.searchHf();
1221
+ }
1271
1222
  },
1272
1223
  async installUnifiedModel(item) {
1273
- if (!item)
1274
- return;
1275
- if (item.download && (item.state === 'paused' || item.state === 'failed')) {
1276
- await this.resumeDownload(item);
1277
- return;
1278
- }
1279
- if (item.buboPackage || item.haloNodeName)
1280
- await this.downloadHalogenModel(item.haloNodeName || 'Qwen3.8-Flash-Next');
1281
- else if (item.isHalo)
1282
- await this.downloadHalogenModel(item.id);
1283
- else
1284
- await this.installModelOneClick(item.repoId);
1224
+ if (!item) return;
1225
+ if (item.download && (item.state === 'paused' || item.state === 'failed')) {
1226
+ await this.resumeDownload(item);
1227
+ return;
1228
+ }
1229
+ if (item.buboPackage || item.haloNodeName) await this.downloadHalogenModel(item.haloNodeName || 'Qwen3.8-Flash-Next');else if (item.isHalo) await this.downloadHalogenModel(item.id);else await this.installModelOneClick(item.repoId);
1285
1230
  },
1286
1231
  async pauseDownload(item) {
1287
- const jobId = item?.download?.id || item?.id || item;
1288
- if (!jobId)
1289
- return;
1290
- await this._call('trainer_hf_pause', { jobId });
1291
- this.notice = `Загрузка «${item?.label || jobId}» поставлена на паузу (скачанное сохранено для докачки).`;
1292
- await this.reloadAll();
1232
+ const jobId = item?.download?.id || item?.id || item;
1233
+ if (!jobId) return;
1234
+ await this._call('trainer_hf_pause', {
1235
+ jobId
1236
+ });
1237
+ this.notice = `Загрузка «${item?.label || jobId}» поставлена на паузу (скачанное сохранено для докачки).`;
1238
+ await this.reloadAll();
1293
1239
  },
1294
1240
  async resumeDownload(item) {
1295
- const dl = item?.download || item || {};
1296
- const job = await this._call('trainer_hf_resume', {
1297
- jobId: dl.id || '',
1298
- folderName: dl.folderName || item?.id || '',
1299
- repoId: item?.repoId || dl.repoId || '',
1300
- quant: (this.hardware?.usableMemoryGb || 12) >= 24 ? 'Q8_0' : 'Q4_K_M',
1301
- });
1302
- if (job) {
1303
- this.notice = `Возобновлена докачка модели «${item?.label || dl.folderName || item?.repoId}»…`;
1304
- await this.reloadAll();
1305
- }
1241
+ const dl = item?.download || item || {};
1242
+ const job = await this._call('trainer_hf_resume', {
1243
+ jobId: dl.id || '',
1244
+ folderName: dl.folderName || item?.id || '',
1245
+ repoId: item?.repoId || dl.repoId || '',
1246
+ quant: (this.hardware?.usableMemoryGb || 12) >= 24 ? 'Q8_0' : 'Q4_K_M'
1247
+ });
1248
+ if (job) {
1249
+ this.notice = `Возобновлена докачка модели «${item?.label || dl.folderName || item?.repoId}»…`;
1250
+ await this.reloadAll();
1251
+ }
1306
1252
  },
1307
1253
  async discardDownload(item) {
1308
- const dl = item?.download || item || {};
1309
- await this._call('trainer_hf_discard', {
1310
- jobId: dl.id || '',
1311
- folderName: dl.folderName || item?.id || '',
1312
- });
1313
- this.notice = `Недокачанные файлы «${item?.label || dl.folderName}» удалены.`;
1314
- await this.reloadAll();
1254
+ const dl = item?.download || item || {};
1255
+ await this._call('trainer_hf_discard', {
1256
+ jobId: dl.id || '',
1257
+ folderName: dl.folderName || item?.id || ''
1258
+ });
1259
+ this.notice = `Недокачанные файлы «${item?.label || dl.folderName}» удалены.`;
1260
+ await this.reloadAll();
1315
1261
  },
1316
1262
  async setHfFilter(val) {
1317
- this.hfFilter = String(val || 'all');
1318
- await this.searchHf();
1263
+ this.hfFilter = String(val || 'all');
1264
+ await this.searchHf();
1319
1265
  },
1320
1266
  async searchHf() {
1321
- const res = await this._call('trainer_hf_search', {
1322
- query: this.hfQuery,
1323
- modality: (this.hfModality === 'halo' || this.hfModality === 'installed') ? 'all' : this.hfModality,
1324
- filter: this.hfFilter,
1325
- });
1326
- if (res?.items)
1327
- this.hfModels = res.items;
1267
+ const res = await this._call('trainer_hf_search', {
1268
+ query: this.hfQuery,
1269
+ modality: this.hfModality === 'halo' || this.hfModality === 'installed' ? 'all' : this.hfModality,
1270
+ filter: this.hfFilter
1271
+ });
1272
+ if (res?.items) this.hfModels = res.items;
1328
1273
  },
1329
1274
  async installModelOneClick(repoId) {
1330
- if (!repoId)
1331
- return;
1332
- this.notice = '';
1333
- const quant = (this.hardware?.usableMemoryGb || 12) >= 24 ? 'Q8_0' : 'Q4_K_M';
1334
- const job = await this._call('trainer_hf_download', {
1335
- repoId,
1336
- quant,
1337
- });
1338
- if (job) {
1339
- this.notice = `Начата установка модели «${repoId}»…`;
1340
- await this.reloadAll();
1341
- this._invalidateClientModelsTree();
1342
- }
1275
+ if (!repoId) return;
1276
+ this.notice = '';
1277
+ const quant = (this.hardware?.usableMemoryGb || 12) >= 24 ? 'Q8_0' : 'Q4_K_M';
1278
+ const job = await this._call('trainer_hf_download', {
1279
+ repoId,
1280
+ quant
1281
+ });
1282
+ if (job) {
1283
+ this.notice = `Начата установка модели «${repoId}»…`;
1284
+ await this.reloadAll();
1285
+ this._invalidateClientModelsTree();
1286
+ }
1343
1287
  },
1344
1288
  async cancelDownload(jobId) {
1345
- await this._call('trainer_hf_cancel', { jobId });
1346
- await this.reloadAll();
1289
+ await this._call('trainer_hf_cancel', {
1290
+ jobId
1291
+ });
1292
+ await this.reloadAll();
1347
1293
  },
1348
1294
  async cancelTransfer(jobId) {
1349
- await this._call('trainer_transfer_cancel', { jobId });
1350
- await this.reloadAll();
1295
+ await this._call('trainer_transfer_cancel', {
1296
+ jobId
1297
+ });
1298
+ await this.reloadAll();
1351
1299
  },
1352
1300
  async openTransferDialog(mode = 'export') {
1353
- const mod = await import('/$server/$folder/lib/local-models-transfer/local-models-transfer.js');
1354
- await mod.openLocalModelsTransferDialog(this.$item, {
1355
- mode,
1356
- onComplete: async () => {
1357
- await this.reloadAll();
1358
- this._invalidateClientModelsTree();
1359
- },
1360
- });
1361
- await this.reloadAll();
1301
+ const mod = await import('/$server/$folder/lib/local-models-transfer/local-models-transfer.js');
1302
+ await mod.openLocalModelsTransferDialog(this.$item, {
1303
+ mode,
1304
+ onComplete: async () => {
1305
+ await this.reloadAll();
1306
+ this._invalidateClientModelsTree();
1307
+ }
1308
+ });
1309
+ await this.reloadAll();
1362
1310
  },
1363
1311
  async toggleLocalModel(modelPath, checked) {
1364
- await this._call('provider_toggle_model', {
1365
- nodePath: modelPath,
1366
- enabled: checked,
1367
- });
1368
- await this.reloadAll();
1369
- this._invalidateClientModelsTree();
1312
+ await this._call('provider_toggle_model', {
1313
+ nodePath: modelPath,
1314
+ enabled: checked
1315
+ });
1316
+ await this.reloadAll();
1317
+ this._invalidateClientModelsTree();
1370
1318
  },
1371
1319
  async deleteLocalModel(modelId) {
1372
- if (!modelId)
1373
- return;
1374
- const res = await this._call('trainer_delete_model', { modelId });
1375
- if (res?.ok) {
1376
- this.notice = `Модель «${modelId}» и её веса удалены с диска.`;
1377
- await this.reloadAll();
1378
- this._invalidateClientModelsTree();
1379
- }
1320
+ if (!modelId) return;
1321
+ const res = await this._call('trainer_delete_model', {
1322
+ modelId
1323
+ });
1324
+ if (res?.ok) {
1325
+ this.notice = `Модель «${modelId}» и её веса удалены с диска.`;
1326
+ await this.reloadAll();
1327
+ this._invalidateClientModelsTree();
1328
+ }
1380
1329
  },
1381
1330
  async releaseMemory() {
1382
- const res = await this._call('trainer_release_memory');
1383
- if (res?.ok) {
1384
- this.runtime = res.runtime || this.runtime;
1385
- this.notice = 'Оперативная память и видеопамять локального ИИ освобождены.';
1386
- }
1331
+ const res = await this._call('trainer_release_memory');
1332
+ if (res?.ok) {
1333
+ this.runtime = res.runtime || this.runtime;
1334
+ this.notice = 'Оперативная память и видеопамять локального ИИ освобождены.';
1335
+ }
1387
1336
  },
1388
1337
  async downloadHalogenModel(nodeName) {
1389
- if (!nodeName)
1390
- return;
1391
- const res = await this._call('halogen_download_bundle', { models: nodeName });
1392
- if (res) {
1393
- const warn = Array.isArray(res.warnings) && res.warnings.length ? ` (${res.warnings.join(' ')})` : '';
1394
- this.notice = `Начата установка модели «${nodeName}» в /MODELS/Local…${warn}`;
1395
- await this.reloadAll();
1396
- this._invalidateClientModelsTree();
1397
- }
1338
+ if (!nodeName) return;
1339
+ const res = await this._call('halogen_download_bundle', {
1340
+ models: nodeName
1341
+ });
1342
+ if (res) {
1343
+ const warn = Array.isArray(res.warnings) && res.warnings.length ? ` (${res.warnings.join(' ')})` : '';
1344
+ this.notice = `Начата установка модели «${nodeName}» в /MODELS/Local…${warn}`;
1345
+ await this.reloadAll();
1346
+ this._invalidateClientModelsTree();
1347
+ }
1398
1348
  },
1399
1349
  async downloadHalogenBundleAll() {
1400
- const res = await this._call('halogen_download_bundle', {});
1401
- if (res) {
1402
- const warn = Array.isArray(res.warnings) && res.warnings.length ? ` (${res.warnings.join(' ')})` : '';
1403
- this.notice = `Начата установка комплекта Halo (${res.totalModels} моделей) в /MODELS/Local…${warn}`;
1404
- await this.reloadAll();
1405
- this._invalidateClientModelsTree();
1406
- }
1350
+ const res = await this._call('halogen_download_bundle', {});
1351
+ if (res) {
1352
+ const warn = Array.isArray(res.warnings) && res.warnings.length ? ` (${res.warnings.join(' ')})` : '';
1353
+ this.notice = `Начата установка комплекта Halo (${res.totalModels} моделей) в /MODELS/Local…${warn}`;
1354
+ await this.reloadAll();
1355
+ this._invalidateClientModelsTree();
1356
+ }
1407
1357
  },
1408
1358
  async buildDataset() {
1409
- const sources = [];
1410
- if (this.srcTasks)
1411
- sources.push('tasks');
1412
- if (this.srcAccounting)
1413
- sources.push('accounting');
1414
- if (this.srcClasses)
1415
- sources.push('classes');
1416
- const ds = await this._call('trainer_dataset_build', {
1417
- name: this.datasetName,
1418
- basePath: this.datasetBasePath,
1419
- sources: sources.join(','),
1420
- });
1421
- if (ds) {
1422
- this.trainDatasetName = `${ds.name}.jsonl`;
1423
- this.notice = `Обучающий набор «${ds.name}» собран (${ds.totalExamples} примеров).`;
1424
- await this.reloadAll();
1425
- }
1359
+ const sources = [];
1360
+ if (this.srcTasks) sources.push('tasks');
1361
+ if (this.srcAccounting) sources.push('accounting');
1362
+ if (this.srcClasses) sources.push('classes');
1363
+ const ds = await this._call('trainer_dataset_build', {
1364
+ name: this.datasetName,
1365
+ basePath: this.datasetBasePath,
1366
+ sources: sources.join(',')
1367
+ });
1368
+ if (ds) {
1369
+ this.trainDatasetName = `${ds.name}.jsonl`;
1370
+ this.notice = `Обучающий набор «${ds.name}» собран (${ds.totalExamples} примеров).`;
1371
+ await this.reloadAll();
1372
+ }
1426
1373
  },
1427
1374
  async startTraining() {
1428
- const job = await this._call('trainer_start', {
1429
- adapterName: this.trainAdapterName,
1430
- baseModel: this.trainBaseModel,
1431
- datasetName: this.trainDatasetName,
1432
- mode: this.trainMode,
1433
- loraR: this.trainLoraR,
1434
- maxSeqLength: this.trainMaxSeq,
1435
- basePath: this.datasetBasePath,
1436
- });
1437
- if (job) {
1438
- this.notice = `Запущено дообучение модели «${this.trainAdapterName}»…`;
1439
- await this.reloadAll();
1440
- }
1441
- },
1442
- async stopTraining(jobId) {
1443
- await this._call('trainer_stop', { jobId });
1375
+ const job = await this._call('trainer_start', {
1376
+ adapterName: this.trainAdapterName,
1377
+ baseModel: this.trainBaseModel,
1378
+ datasetName: this.trainDatasetName,
1379
+ mode: this.trainMode,
1380
+ loraR: this.trainLoraR,
1381
+ maxSeqLength: this.trainMaxSeq,
1382
+ basePath: this.datasetBasePath
1383
+ });
1384
+ if (job) {
1385
+ this.notice = `Запущено дообучение модели «${this.trainAdapterName}»…`;
1444
1386
  await this.reloadAll();
1387
+ }
1445
1388
  },
1446
- }
1389
+ async stopTraining(jobId) {
1390
+ await this._call('trainer_stop', {
1391
+ jobId
1392
+ });
1393
+ await this.reloadAll();
1394
+ }
1395
+ }
1396
+ };