odant-work 1.0.42 → 1.0.44

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 (367) hide show
  1. package/#system/certs/russian_trusted_root_ca.pem +32 -32
  2. package/#system/mail.json.example +9 -9
  3. package/#system/package-manifest.json +30 -30
  4. package/#system/settings.json.example +3 -3
  5. package/$server/$folder/$class/$device/class.js +2 -2
  6. package/$server/$folder/$class/$domain/class.js +4 -4
  7. package/$server/$folder/$class/$domain/readme.md +5 -5
  8. package/$server/$folder/$class/$handler/$task/class.js +2 -2
  9. package/$server/$folder/$class/$handler/$trigger/class.js +3 -3
  10. package/$server/$folder/$class/$handler/class.js +9 -9
  11. package/$server/$folder/$class/$handler/handlers/pages/editor/$handler/class.js +5 -5
  12. package/$server/$folder/$class/$handler/readme.md +23 -23
  13. package/$server/$folder/$class/$service/$class/$service/class.js +3 -3
  14. package/$server/$folder/$class/$structure/$base/class.js +9 -9
  15. package/$server/$folder/$class/$structure/$user/class.js +2 -2
  16. package/$server/$folder/$class/$structure/handlers/pages/explorer/$handler/class.js +4 -4
  17. package/$server/$folder/$class/$structure/handlers/pages/form/calendar/$handler/readme.md +40 -40
  18. package/$server/$folder/$class/$structure/handlers/pages/form/database/$handler/database.js +18 -43
  19. package/$server/$folder/$class/$structure/handlers/pages/form/search/$handler/search.js +21 -26
  20. package/$server/$folder/$class/$structure/handlers/pages/site/$handler/readme.md +34 -34
  21. package/$server/$folder/$class/ai/config.js +19 -19
  22. package/$server/$folder/$class/ai/prompt/$method/class.js +41 -41
  23. package/$server/$folder/$class/ai/skills/approval-flow.md +14 -14
  24. package/$server/$folder/$class/ai/skills/backup-check.md +13 -13
  25. package/$server/$folder/$class/ai/skills/computer.md +27 -27
  26. package/$server/$folder/$class/ai/skills/delegate-task.md +15 -15
  27. package/$server/$folder/$class/ai/skills/external-signup.md +14 -14
  28. package/$server/$folder/$class/ai/skills/lan-inventory.md +16 -16
  29. package/$server/$folder/$class/ai/skills/onboarding.md +15 -15
  30. package/$server/$folder/$class/ai/skills/orchestration.md +41 -41
  31. package/$server/$folder/$class/handlers/pages/form/builder/$handler/builder.js +259 -259
  32. package/$server/$folder/$class/handlers/pages/form/editor/$handler/editor.js +19 -19
  33. package/$server/$folder/$class/handlers/pages/form/objects/$handler/objects.js +1 -1
  34. package/$server/$folder/$class/handlers/pages/storage/$handler/storage.js +20 -20
  35. package/$server/$folder/$file/$audio/handlers/preview/$handler/class.js +3 -3
  36. package/$server/$folder/$file/$audio/handlers/preview/$handler/preview.js +88 -88
  37. package/$server/$folder/$file/$call/class.js +10 -10
  38. package/$server/$folder/$file/$call/handlers/preview/$handler/class.js +4 -4
  39. package/$server/$folder/$file/$call/triggers/on_save/$trigger/class.js +48 -48
  40. package/$server/$folder/$file/$data/class.js +16 -16
  41. package/$server/$folder/$file/$data/handlers/pages/form/editor/$handler/class.js +5 -5
  42. package/$server/$folder/$file/$data/handlers/pages/form/editor/$handler/editor.js +26 -26
  43. package/$server/$folder/$file/$devs/$js/class.js +2 -2
  44. package/$server/$folder/$file/$devs/$json/class.js +2 -2
  45. package/$server/$folder/$file/$devs/$ts/class.js +2 -2
  46. package/$server/$folder/$file/$devs/handlers/pages/form/file/$handler/class.js +3 -3
  47. package/$server/$folder/$file/$devs/handlers/pages/form/file/$handler/file.js +30 -30
  48. package/$server/$folder/$file/$eml/class.js +17 -17
  49. package/$server/$folder/$file/$eml/triggers/on_save/$trigger/class.js +97 -97
  50. package/$server/$folder/$file/$ics/class.js +44 -44
  51. package/$server/$folder/$file/$ics/handlers/pages/form/file/$handler/class.js +3 -3
  52. package/$server/$folder/$file/$ics/handlers/pages/form/file/$handler/file.js +10 -10
  53. package/$server/$folder/$file/$ics/handlers/preview/$handler/class.js +3 -3
  54. package/$server/$folder/$file/$ics/handlers/preview/$handler/preview.js +67 -67
  55. package/$server/$folder/$file/$ics/readme.md +21 -21
  56. package/$server/$folder/$file/$image/$svg/class.js +11 -11
  57. package/$server/$folder/$file/$image/handlers/preview/$handler/class.js +3 -3
  58. package/$server/$folder/$file/$image/handlers/preview/$handler/preview.js +33 -33
  59. package/$server/$folder/$file/$ipynb/handlers/pages/form/file/$handler/class.js +3 -3
  60. package/$server/$folder/$file/$logs/class.js +39 -39
  61. package/$server/$folder/$file/$logs/handlers/methods/txt-test/$handler/class.js +4 -4
  62. package/$server/$folder/$file/$md/handlers/pages/form/file/$handler/class.js +3 -3
  63. package/$server/$folder/$file/$md/handlers/pages/form/file/$handler/file.js +63 -63
  64. package/$server/$folder/$file/$office/$outlook/$ics/class.js +227 -227
  65. package/$server/$folder/$file/$office/$word/$rtf/template.rtf +159 -159
  66. package/$server/$folder/$file/$office/handlers/pages/form/file/$handler/file.js +16 -8
  67. package/$server/$folder/$file/$task/handlers/pages/form/file/$handler/ui/dock.js +17 -26
  68. package/$server/$folder/$file/$task/handlers/pages/form/file/$handler/ui/voice-ui.js +94 -94
  69. package/$server/$folder/$file/$task/handlers/preview/$handler/class.js +3 -3
  70. package/$server/$folder/$file/$task/progress.md +20 -20
  71. package/$server/$folder/$file/$task/readme.md +32 -32
  72. package/$server/$folder/$file/$txt/handlers/preview/$handler/class.js +3 -3
  73. package/$server/$folder/$file/$txt/handlers/preview/$handler/preview.js +41 -41
  74. package/$server/$folder/$file/$video/handlers/preview/$handler/class.js +4 -4
  75. package/$server/$folder/$file/$video/handlers/preview/$handler/preview.js +13 -13
  76. package/$server/$folder/$file/class.js +2 -2
  77. package/$server/$folder/$file/handlers/methods/download/$handler/class.js +2 -2
  78. package/$server/$folder/$file/handlers/methods/download/$handler/download.js +4 -4
  79. package/$server/$folder/$file/handlers/pages/form/$handler/class.js +2 -2
  80. package/$server/$folder/$file/handlers/pages/form/file/$handler/class.js +3 -3
  81. package/$server/$folder/$file/handlers/pages/form/file/$handler/file.js +28 -28
  82. package/$server/$folder/$file/readme.md +31 -31
  83. package/$server/$folder/class.js +11 -11
  84. package/$server/$folder/handlers/methods/create/progress.md +15 -15
  85. package/$server/$folder/handlers/pages/form/$handler/class.js +5 -5
  86. package/$server/$folder/handlers/pages/form/$handler/form.js +199 -129
  87. package/$server/$folder/handlers/readme.md +24 -24
  88. package/$server/$folder/lib/calendar-form/calendar-form.js +296 -296
  89. package/$server/$folder/lib/dialogs/confirm/confirm.js +30 -30
  90. package/$server/$folder/lib/dialogs/input/input.js +57 -57
  91. package/$server/$folder/lib/email/settings.js +82 -82
  92. package/$server/$folder/lib/explorer/explorer.js +104 -11
  93. package/$server/$folder/lib/file-viewer/file-viewer.js +8 -8
  94. package/$server/$folder/lib/icon/user/user.js +6 -6
  95. package/$server/$folder/lib/item-data-grid/item-data-grid.js +48 -48
  96. package/$server/$folder/lib/item-form/item-form.js +84 -84
  97. package/$server/$folder/lib/local-models-transfer/local-models-transfer.js +17 -37
  98. package/$server/$folder/lib/menu/progress.md +13 -13
  99. package/$server/$folder/lib/menu/readme.md +29 -29
  100. package/$server/$folder/lib/node/progress.md +13 -13
  101. package/$server/$folder/lib/node/readme.md +29 -29
  102. package/$server/$folder/lib/pack/pack.js +4 -4
  103. package/$server/$folder/lib/prompt-bar/progress.md +13 -13
  104. package/$server/$folder/lib/security/admin/admin.js +30 -30
  105. package/$server/$folder/lib/site-loc/readme.md +16 -16
  106. package/$server/$folder/lib/site-loc/site-loc.js +80 -80
  107. package/$server/$folder/lib/tools/tools.js +24 -6
  108. package/$server/$folder/lib/tree/progress.md +16 -16
  109. package/$server/$folder/readme.md +18 -18
  110. package/$server/readme.md +13 -13
  111. package/.cursor/rules/work.mdc +8 -8
  112. package/.github/workflows/ci.yml +39 -39
  113. package/MODELS/$ai/$folder/$class/$ai/class.js +18 -8
  114. package/MODELS/$ai/$folder/$class/$ai/handlers/pages/form/trainer/$handler/trainer.js +70 -219
  115. package/MODELS/$ai/$folder/$class/$provider/handlers/pages/form/trainer/$handler/trainer.js +19 -41
  116. package/MODELS/$ai/$folder/$class/$provider/readme.md +16 -16
  117. package/MODELS/GigaChat/$provider/readme.md +24 -24
  118. package/MODULES/Register/$module/$folder/$class/$register/class.js +4 -4
  119. package/MODULES/Register/$module/$folder/$class/$struct/class.js +4 -4
  120. package/MODULES/Register/CATALOGS/$catalog/$folder/$class/$virtual/class.js +14 -14
  121. package/MODULES/Register/CATALOGS//320/241/321/203/320/261/321/212/320/265/320/272/321/202/321/213//320/244/320/270/320/267. /320/273/320/270/321/206/320/260/$catalog/class.js" +11 -11
  122. package/MODULES/Register/OPERATIONS//320/240/320/265/320/260/320/273/320/270/320/267/320/260/321/206/320/270/321/217//320/237/320/276/320/272/321/203/320/277/320/260/321/202/320/265/320/273/321/216/$operation/print//320/241/321/207/321/221/321/202 /320/275/320/260 /320/276/320/277/320/273/320/260/321/202/321/203.html" +40 -40
  123. package/MODULES/Register/OPERATIONS//320/240/320/265/320/260/320/273/320/270/320/267/320/260/321/206/320/270/321/217//320/237/320/276/320/272/321/203/320/277/320/260/321/202/320/265/320/273/321/216/$operation/print//320/242/320/276/320/262/320/260/321/200/320/275/320/260/321/217 /320/275/320/260/320/272/320/273/320/260/320/264/320/275/320/260/321/217.html" +56 -56
  124. package/MODULES/Register/REGISTER/$register/$folder/$class/$account/class.js +18 -18
  125. package/MODULES/Register/REGISTER/$register/$folder/$class/$register/class.js +11 -11
  126. package/MODULES/Register/REGISTER/68/01/$account/class.js +1 -1
  127. package/MODULES/Register/REGISTER/68/02/$account/class.js +1 -1
  128. package/MODULES/Register/REGISTER//320/232/320/260/320/264/321/200/320/276/320/262/321/213/320/271 /321/200/320/265/320/267/320/265/321/200/320/262/$account/class.js" +1 -1
  129. package/MODULES/Register/REGISTER//320/232/320/260/320/264/321/200/321/213//320/222 /320/276/321/202/320/277/321/203/321/201/320/272/320/265/$account/class.js" +1 -1
  130. package/MODULES/Register/REGISTER//320/232/320/260/320/264/321/200/321/213//320/240/320/260/320/261/320/276/321/202/320/260/321/216/321/202/$account/class.js +1 -1
  131. package/MODULES/Register/REGISTER//320/242/320/265/321/205/320/275/320/270/321/207/320/265/321/201/320/272/320/270/320/271/$account/class.js +1 -1
  132. package/MODULES/Register/STRUCTS/$struct/$folder/$class/$struct/class.js +4 -4
  133. package/MODULES/Register/STRUCTS/$struct/class.js +4 -4
  134. package/MODULES/Register/STRUCTS//320/220/320/264/321/200/320/265/321/201/$struct/class.js +11 -11
  135. package/MODULES/Register/STRUCTS//320/225/320/264/320/270/320/275/320/270/321/206/320/260 /320/270/320/267/320/274/320/265/321/200/320/265/320/275/320/270/321/217/$struct/class.js" +11 -11
  136. package/MODULES/Register/STRUCTS//320/237/320/260/321/201/320/277/320/276/321/200/321/202/$struct/class.js +11 -11
  137. package/NODES/$node/$folder/$class/$node/class.js +35 -35
  138. package/NODES/$node/class.js +5 -5
  139. package/NODES/$node/handlers/pages/form/network/$handler/class.js +5 -5
  140. package/NODES/$node/handlers/pages/form/network/$handler/network.js +110 -110
  141. package/NODES/teewtew/$node/class.js +2 -2
  142. package/NODES/work.odant.org/$node/class.js +3 -3
  143. package/ORGANIZATIONS/$domain/$folder/$class/$base/$folder/$class/$structure/$base/class.js +17 -17
  144. package/ORGANIZATIONS/$domain/$folder/$class/$base/class.js +4 -4
  145. package/SERVICES/$service/$folder/$storage/$service/class.js +8 -8
  146. package/SERVICES/$service/$folder/$storage/$service/handlers/pages/form/mcp/$handler/mcp.js +18 -43
  147. package/SERVICES/ArgoCD/$service/$folder/$class/$service/class.js +356 -356
  148. package/SERVICES/ArgoCD/$service/$folder/$class/$service/handlers/pages/form/orders/$handler/class.js +244 -244
  149. package/SERVICES/ArgoCD/$service/class.js +4 -4
  150. package/SERVICES/ArgoCD/$service/readme.md +63 -63
  151. package/SERVICES/ArgoCD/PaaS/$service/$folder/$class/$service/class.js +10 -10
  152. package/SERVICES/ArgoCD/PaaS/$service/$folder/$class/$service/methods/checkDomain/$method/class.js +33 -33
  153. package/SERVICES/ArgoCD/PaaS/$service/$folder/$class/$service/methods/provision/$method/class.js +225 -225
  154. package/SERVICES/ArgoCD/PaaS/$service/$folder/$class/$service/methods/submitOrder/$method/class.js +77 -77
  155. package/SERVICES/ArgoCD/PaaS/$service/$folder/$class/$service/readme.md +33 -33
  156. package/SERVICES/ArgoCD/PaaS/$service/class.js +347 -347
  157. package/SERVICES/ArgoCD/PaaS/$service/order/pass.order +8 -8
  158. package/SERVICES/DuckDuckGo/$service/class.js +367 -367
  159. package/SERVICES/SearXNG/$service/class.js +70 -70
  160. package/SERVICES/Telegram/$service/class.js +114 -114
  161. package/SERVICES/Weather/$service/class.js +76 -76
  162. package/SERVICES/Yandex/$service/class.js +120 -120
  163. package/SERVICES/readme.md +43 -43
  164. package/USERS/$users/class.js +2 -2
  165. package/eslint.config.js +51 -51
  166. package/jsconfig.json +37 -37
  167. package/oda/benchmarks/dbmon/lib/ENV.js +213 -213
  168. package/oda/benchmarks/dbmon/lib/ga.js +11 -11
  169. package/oda/benchmarks/dbmon/lib/memory-stats.js +105 -105
  170. package/oda/benchmarks/dbmon/lib/monitor.js +69 -69
  171. package/oda/benchmarks/sierpinski/sierpinski.js +149 -149
  172. package/oda/components/editors/code-editor/code-editor.js +387 -387
  173. package/oda/components/editors/code-editor/src/ace.js +16 -16
  174. package/oda/components/editors/code-editor/src/beautify-css.js +1625 -1625
  175. package/oda/components/editors/code-editor/src/beautify-html.js +3122 -3122
  176. package/oda/components/editors/code-editor/src/beautify.js +4005 -4005
  177. package/oda/components/editors/code-editor/src/ext-beautify.js +7 -7
  178. package/oda/components/editors/code-editor/src/ext-code_lens.js +7 -7
  179. package/oda/components/editors/code-editor/src/ext-elastic_tabstops_lite.js +7 -7
  180. package/oda/components/editors/code-editor/src/ext-emmet.js +7 -7
  181. package/oda/components/editors/code-editor/src/ext-error_marker.js +7 -7
  182. package/oda/components/editors/code-editor/src/ext-hardwrap.js +7 -7
  183. package/oda/components/editors/code-editor/src/ext-keybinding_menu.js +7 -7
  184. package/oda/components/editors/code-editor/src/ext-language_tools.js +7 -7
  185. package/oda/components/editors/code-editor/src/ext-linking.js +7 -7
  186. package/oda/components/editors/code-editor/src/ext-modelist.js +7 -7
  187. package/oda/components/editors/code-editor/src/ext-options.js +7 -7
  188. package/oda/components/editors/code-editor/src/ext-prompt.js +7 -7
  189. package/oda/components/editors/code-editor/src/ext-rtl.js +7 -7
  190. package/oda/components/editors/code-editor/src/ext-searchbox.js +7 -7
  191. package/oda/components/editors/code-editor/src/ext-settings_menu.js +7 -7
  192. package/oda/components/editors/code-editor/src/ext-spellcheck.js +7 -7
  193. package/oda/components/editors/code-editor/src/ext-split.js +7 -7
  194. package/oda/components/editors/code-editor/src/ext-static_highlight.js +7 -7
  195. package/oda/components/editors/code-editor/src/ext-statusbar.js +7 -7
  196. package/oda/components/editors/code-editor/src/ext-textarea.js +7 -7
  197. package/oda/components/editors/code-editor/src/ext-themelist.js +7 -7
  198. package/oda/components/editors/code-editor/src/ext-whitespace.js +7 -7
  199. package/oda/components/editors/code-editor/src/keybinding-emacs.js +7 -7
  200. package/oda/components/editors/code-editor/src/keybinding-sublime.js +7 -7
  201. package/oda/components/editors/code-editor/src/keybinding-vim.js +7 -7
  202. package/oda/components/editors/code-editor/src/keybinding-vscode.js +7 -7
  203. package/oda/components/editors/code-editor/src/mode-css.js +7 -7
  204. package/oda/components/editors/code-editor/src/mode-html.js +7 -7
  205. package/oda/components/editors/code-editor/src/mode-javascript.js +7 -7
  206. package/oda/components/editors/code-editor/src/mode-json.js +7 -7
  207. package/oda/components/editors/code-editor/src/mode-markdown.js +7 -7
  208. package/oda/components/editors/code-editor/src/mode-svg.js +7 -7
  209. package/oda/components/editors/code-editor/src/mode-text.js +7 -7
  210. package/oda/components/editors/code-editor/src/mode-xml.js +7 -7
  211. package/oda/components/editors/code-editor/src/mode-xquery.js +7 -7
  212. package/oda/components/editors/code-editor/src/snippets/css.js +7 -7
  213. package/oda/components/editors/code-editor/src/snippets/html.js +7 -7
  214. package/oda/components/editors/code-editor/src/snippets/javascript.js +7 -7
  215. package/oda/components/editors/code-editor/src/snippets/json.js +7 -7
  216. package/oda/components/editors/code-editor/src/snippets/markdown.js +7 -7
  217. package/oda/components/editors/code-editor/src/snippets/svg.js +7 -7
  218. package/oda/components/editors/code-editor/src/snippets/text.js +7 -7
  219. package/oda/components/editors/code-editor/src/snippets/xml.js +7 -7
  220. package/oda/components/editors/code-editor/src/snippets/xquery.js +7 -7
  221. package/oda/components/editors/code-editor/src/theme-solarized_dark.js +7 -7
  222. package/oda/components/editors/code-editor/src/theme-solarized_light.js +7 -7
  223. package/oda/components/editors/markdown/markdown-editor/lib/font-awesome.min.css +3 -3
  224. package/oda/components/editors/markdown/markdown-editor/lib/readme.md +332 -332
  225. package/oda/components/editors/markdown/markdown-editor/markdown-editor.js +78 -78
  226. package/oda/components/editors/markdown/markdown-viewer/test.md +239 -239
  227. package/oda/components/editors/markdown/markdown.js +76 -76
  228. package/oda/components/inputs/block/readme.md +39 -39
  229. package/oda/components/inputs/checkbox/checkbox.js +92 -92
  230. package/oda/components/inputs/color/color.js +83 -83
  231. package/oda/components/inputs/date/date.js +40 -40
  232. package/oda/components/inputs/input/input.js +219 -219
  233. package/oda/components/inputs/link/readme.md +42 -42
  234. package/oda/components/inputs/markdown-input/markdown-input.js +77 -77
  235. package/oda/components/inputs/numeric/numeric.js +141 -141
  236. package/oda/components/inputs/table-input/readme.md +39 -39
  237. package/oda/components/inputs/text/text.js +88 -88
  238. package/oda/components/inputs/toggle/toggle.js +101 -101
  239. package/oda/components/layouts/app-layout/app-layout.js +4 -1
  240. package/oda/components/layouts/hexagon-layout/hexagon-layout.js +218 -218
  241. package/oda/components/layouts/tabs/tabs.js +784 -395
  242. package/oda/components/menus/menu/index_old.html +140 -140
  243. package/oda/components/menus/menu/menu.js +238 -238
  244. package/oda/components/packets/packets.js +25 -20
  245. package/oda/components/structure/controls-map.js +56 -56
  246. package/oda/components/structure/controls.js +29 -29
  247. package/oda/components/structure/readme.md +31 -31
  248. package/oda/components/structure/structure.js +64 -64
  249. package/oda/components/table/index.html +210 -210
  250. package/oda/components/table/lib/coerce.js +68 -68
  251. package/oda/components/table/lib/column.js +568 -568
  252. package/oda/components/table/readme.md +120 -120
  253. package/oda/components/table/router.js +86 -86
  254. package/oda/components/table/row.js +6 -4
  255. package/oda/components/table/settings.js +89 -89
  256. package/oda/components/table/table.js +2 -2
  257. package/oda/index.html +159 -159
  258. package/oda/tools/icons/icons-set/icons-set.js +60 -60
  259. package/oda/tools/icons/lib/svg/_makeSVG.html +41 -41
  260. package/oda/tools/icons/lib/svg/aws.svg +2679 -2679
  261. package/oda/tools/icons/lib/svg/info.json +46 -46
  262. package/oda/tools/jupyter/demo.ipynb +160 -160
  263. package/oda/tools/jupyter/lib/print_elements.js +73 -73
  264. package/oda/tools/jupyter/test-2.ipynb +305 -305
  265. package/oda/tools/jupyter/test.ipynb +603 -603
  266. package/oda/tools/styles/adoptedStyleSheets.js +333 -333
  267. package/oda/tools/tester/device-preview/devices.json +9 -9
  268. package/opencode.json +9 -9
  269. package/package.json +1 -1
  270. package/publish.cmd +2 -2
  271. package/readme.md +164 -164
  272. package/rules/rules.md +445 -445
  273. package/scripts/SYNC-README.md +107 -107
  274. package/scripts/agent-eval.mjs +223 -223
  275. package/scripts/dump-svn-chat.mjs +9 -9
  276. package/scripts/extract-chat-day.mjs +21 -21
  277. package/scripts/rag-bench.mjs +166 -166
  278. package/scripts/restore-chat.mjs +166 -166
  279. package/scripts/sync-svn-git.bat +129 -129
  280. package/scripts/test-merge.mjs +75 -75
  281. package/scripts/work-desktop-bridge.mjs +101 -101
  282. package/sources/client/field.js +168 -168
  283. package/sources/client/index.js +32 -32
  284. package/sources/client/readme.md +16 -16
  285. package/sources/core.js +91 -91
  286. package/sources/data/choices.js +125 -125
  287. package/sources/data/progress.md +13 -0
  288. package/sources/host/auto-updater.js +12 -1
  289. package/sources/host/babel-merge.js +353 -353
  290. package/sources/host/config.js +48 -48
  291. package/sources/host/email-utils.js +269 -269
  292. package/sources/host/http-server.js +1 -1
  293. package/sources/host/index-db.js +94 -94
  294. package/sources/host/net-guard.js +228 -228
  295. package/sources/host/package-install.js +63 -63
  296. package/sources/host/progress.md +14 -14
  297. package/sources/host/push.js +86 -86
  298. package/sources/host/readme.md +41 -41
  299. package/sources/host/secret-box.js +93 -93
  300. package/sources/host/server-id.js +26 -26
  301. package/sources/host/stun.js +33 -33
  302. package/sources/host/tls-ca.js +60 -60
  303. package/sources/host/vapid.js +14 -14
  304. package/sources/index.html +49 -49
  305. package/sources/manifest.json +49 -49
  306. package/sources/modules/a2a/server.js +608 -608
  307. package/sources/modules/agent/connections.js +442 -442
  308. package/sources/modules/agent/diff.js +69 -69
  309. package/sources/modules/agent/eval.js +222 -222
  310. package/sources/modules/agent/hooks.js +131 -131
  311. package/sources/modules/agent/log.js +43 -43
  312. package/sources/modules/agent/mcp-pool.js +253 -253
  313. package/sources/modules/agent/plugins.js +343 -343
  314. package/sources/modules/agent/recovery.js +89 -89
  315. package/sources/modules/agent/taint.js +100 -100
  316. package/sources/modules/agent/tools/branch.js +311 -311
  317. package/sources/modules/agent/tools/browser.js +254 -254
  318. package/sources/modules/agent/tools/computer.js +120 -120
  319. package/sources/modules/agent/tools/connect.js +316 -316
  320. package/sources/modules/agent/tools/dev/lsp.js +334 -334
  321. package/sources/modules/agent/tools/dev/patch.js +564 -564
  322. package/sources/modules/agent/tools/memory.js +153 -153
  323. package/sources/modules/agent/tools/os-files.js +358 -358
  324. package/sources/modules/agent/tools/plugins.js +80 -80
  325. package/sources/modules/agent/tools/sandbox.js +268 -268
  326. package/sources/modules/agent/types.d.ts +183 -183
  327. package/sources/modules/agent/undo.js +254 -254
  328. package/sources/modules/agent/util.js +179 -179
  329. package/sources/modules/contacts/contacts.js +200 -200
  330. package/sources/modules/contacts/index.html +546 -546
  331. package/sources/modules/lan/discovery.js +192 -192
  332. package/sources/modules/lan/store.js +62 -62
  333. package/sources/modules/mcp/readme.md +70 -70
  334. package/sources/modules/mcp/server.js +525 -525
  335. package/sources/modules/mcp/tokens.js +140 -140
  336. package/sources/modules/nodes/identity.js +123 -123
  337. package/sources/modules/nodes/inbound.js +172 -172
  338. package/sources/modules/nodes/outbound.js +105 -105
  339. package/sources/modules/nodes/signing.js +71 -71
  340. package/sources/modules/rag/embed-worker.js +36 -36
  341. package/sources/modules/rag/readme.md +70 -70
  342. package/sources/modules/readme.md +21 -21
  343. package/sources/modules/sandbox/config.js +74 -74
  344. package/sources/modules/sandbox/driver.js +100 -100
  345. package/sources/modules/sandbox/images/work-computer/Dockerfile +34 -34
  346. package/sources/modules/sandbox/images/work-computer/entrypoint.sh +24 -24
  347. package/sources/modules/sandbox/manager.js +1089 -1089
  348. package/sources/modules/sandbox/readme.md +63 -63
  349. package/sources/modules/sandbox/vnc-proxy.js +296 -296
  350. package/sources/modules/trainer/halogen.js +354 -100
  351. package/sources/modules/trainer/huggingface.js +28 -2
  352. package/sources/modules/trainer/index.js +70 -9
  353. package/sources/modules/trainer/local-engine.js +400 -167
  354. package/sources/modules/trainer/worker/local_infer_worker.py +164 -21
  355. package/sources/readme.md +216 -216
  356. package/sources/server/access/audit.js +138 -138
  357. package/sources/server/access/refs.js +106 -106
  358. package/sources/server/assert-class-id.js +23 -23
  359. package/sources/server/external-source.js +90 -90
  360. package/sources/server/index.js +12 -12
  361. package/sources/server/memory-mark.js +34 -34
  362. package/sources/server/readme.md +110 -110
  363. package/sources/server/safe-node-name.js +67 -67
  364. package/sources/server/upload-mark.js +24 -24
  365. package/sources/server/zip-guard.js +81 -81
  366. package/sources/tester.html +54 -54
  367. package/whitepaper.md +568 -568
@@ -1010,6 +1010,100 @@ function httpGetJson(urlStr, headers = {}, timeoutMs = 2500) {
1010
1010
  });
1011
1011
  }
1012
1012
 
1013
+ /**
1014
+ * Разобрать счётчики Prometheus из `GET /metrics` сервера `bubo.exe` / `gufo.exe` / `llama-server`.
1015
+ */
1016
+ export function parseHalogenPrometheusText(rawText = '') {
1017
+ const pick = (names) => {
1018
+ for (const name of names) {
1019
+ const esc = name.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
1020
+ const m = new RegExp(`^${esc}(?:\\{[^}]*\\})?\\s+([+-]?\\d+(?:\\.\\d+)?(?:[eE][+-]?\\d+)?)`, 'm').exec(rawText);
1021
+ if (m) {
1022
+ const v = Number(m[1]);
1023
+ if (Number.isFinite(v))
1024
+ return v;
1025
+ }
1026
+ }
1027
+ return null;
1028
+ };
1029
+ const decodeTokens = pick(['llamacpp:tokens_predicted_total', 'tokens_predicted_total']);
1030
+ const decodeSeconds = pick(['llamacpp:tokens_predicted_seconds_total', 'tokens_predicted_seconds_total']);
1031
+ const prefillTokens = pick(['llamacpp:prompt_tokens_total', 'prompt_tokens_total']);
1032
+ const prefillSeconds = pick(['llamacpp:prompt_seconds_total', 'prompt_seconds_total']);
1033
+ const cachedTokens = pick(['llamacpp:prompt_tokens_cached_total', 'prompt_tokens_cached_total']);
1034
+ const draftRounds = pick(['llamacpp:spec_decode_num_drafts_total', 'spec_decode_num_drafts_total']);
1035
+ const draftTokens = pick(['llamacpp:spec_decode_num_draft_tokens_total', 'spec_decode_num_draft_tokens_total']);
1036
+ const acceptedTokens = pick(['llamacpp:spec_decode_num_accepted_tokens_total', 'spec_decode_num_accepted_tokens_total']);
1037
+ if (decodeTokens === null && draftTokens === null && prefillTokens === null)
1038
+ return null;
1039
+ return {
1040
+ decodeTokens: decodeTokens ?? 0,
1041
+ decodeSeconds: decodeSeconds ?? 0,
1042
+ prefillTokens: prefillTokens ?? 0,
1043
+ prefillSeconds: prefillSeconds ?? 0,
1044
+ cachedTokens: cachedTokens ?? 0,
1045
+ draftRounds: draftRounds ?? 0,
1046
+ draftTokens: draftTokens ?? 0,
1047
+ acceptedTokens: acceptedTokens ?? 0,
1048
+ };
1049
+ }
1050
+
1051
+ /** Считать снимок счётчиков `:8731/metrics` (безопасно возвращает `null`, если эндпоинт недоступен). */
1052
+ export async function readHalogenMetrics(baseUrl = HALOGEN_DEFAULT_BASE_URL, { fetchJson = httpGetJson } = {}) {
1053
+ let origin = `http://127.0.0.1:${HALOGEN_DEFAULT_PORT}`;
1054
+ try { origin = new URL(baseUrl).origin; }
1055
+ catch { /* default */ }
1056
+ try {
1057
+ const res = await fetchJson(`${origin}/metrics`, { Accept: 'text/plain' }, 2000);
1058
+ const text = typeof res === 'string' ? res : String(res?.text || '');
1059
+ return text ? parseHalogenPrometheusText(text) : null;
1060
+ }
1061
+ catch {
1062
+ return null;
1063
+ }
1064
+ }
1065
+
1066
+ /** Вычислить дельту скорости декодирования и КПД спекуляции MTP между двумя снимками `/metrics`. */
1067
+ export function computeHalogenMetricsDelta(before, after) {
1068
+ if (!after)
1069
+ return null;
1070
+ const b = before || {
1071
+ decodeTokens: 0, decodeSeconds: 0, prefillTokens: 0, prefillSeconds: 0,
1072
+ cachedTokens: 0, draftRounds: 0, draftTokens: 0, acceptedTokens: 0,
1073
+ };
1074
+ const dDecodeTokens = Math.max(0, after.decodeTokens - b.decodeTokens);
1075
+ const dDecodeSeconds = Math.max(0, after.decodeSeconds - b.decodeSeconds);
1076
+ const dPrefillTokens = Math.max(0, after.prefillTokens - b.prefillTokens);
1077
+ const dPrefillSeconds = Math.max(0, after.prefillSeconds - b.prefillSeconds);
1078
+ const dDraftRounds = Math.max(0, after.draftRounds - b.draftRounds);
1079
+ const dDraftTokens = Math.max(0, after.draftTokens - b.draftTokens);
1080
+ const dAccepted = Math.max(0, after.acceptedTokens - b.acceptedTokens);
1081
+
1082
+ const serverDecodeTokPerSec = (dDecodeTokens > 0 && dDecodeSeconds > 0.005)
1083
+ ? +(dDecodeTokens / dDecodeSeconds).toFixed(1)
1084
+ : 0;
1085
+ const serverPrefillTokPerSec = (dPrefillTokens > 0 && dPrefillSeconds > 0.005)
1086
+ ? +(dPrefillTokens / dPrefillSeconds).toFixed(1)
1087
+ : 0;
1088
+ const mtpAcceptPct = dDraftTokens > 0
1089
+ ? Math.round((dAccepted / dDraftTokens) * 100)
1090
+ : null;
1091
+ const mtpTokensPerStep = dDraftRounds > 0
1092
+ ? +((dDraftRounds + dAccepted) / dDraftRounds).toFixed(2)
1093
+ : null;
1094
+
1095
+ return {
1096
+ decodeTokens: dDecodeTokens,
1097
+ serverDecodeTokPerSec,
1098
+ serverPrefillTokPerSec,
1099
+ draftRounds: dDraftRounds,
1100
+ draftTokens: dDraftTokens,
1101
+ acceptedTokens: dAccepted,
1102
+ mtpAcceptPct,
1103
+ mtpTokensPerStep,
1104
+ };
1105
+ }
1106
+
1013
1107
  /**
1014
1108
  * Опросить живой сервер на порту `:8731` (Linux `halogen-flash-server`, Windows `Halowin Bubo` / `Gufo` / `Strata`
1015
1109
  * или `llama-server`) по служебным маршрутам:
@@ -1414,18 +1508,23 @@ export async function prepareWindowsBuboRuntime({
1414
1508
  }
1415
1509
 
1416
1510
  /**
1417
- * Настройки движка Halowin Bubo по умолчанию: спекулятивное декодирование (MTP + Draft Head),
1418
- * Prompt Lookup (n-граммы), профиль KV-сессий и NPU-prefill.
1511
+ * Настройки движка Halowin Bubo по умолчанию:
1512
+ * - `profile: 'default'` — 1 сессия, контекст 200K, 8.6 ГБ RAM-кэш снимков и максимальная скорость спекуляции;
1513
+ * - `mtpDraftVocab: 'auto'` — автопереключение словаря черновика MTP латиница ↔ кириллица (без просадки на русском тексте);
1514
+ * - `draftMax: 7` — штатная глубина черновика Bubo (`--draft-tokens 7`);
1515
+ * - `npuPrefill: true` — задействование Ryzen AI NPU для чтения длинных промптов (при наличии драйвера AMD XRT).
1419
1516
  */
1420
1517
  export const DEFAULT_ENGINE_SETTINGS = Object.freeze({
1421
1518
  speculation: 'auto',
1422
- draftMax: 8,
1519
+ draftMax: 7,
1423
1520
  promptLookup: 'auto',
1424
- profile: 'subagents',
1521
+ profile: 'default',
1522
+ mtpDraftVocab: 'auto',
1425
1523
  npuPrefill: true,
1426
1524
  });
1427
1525
 
1428
1526
  const ENGINE_STATE_MODES = ['auto', 'on', 'off'];
1527
+ const ENGINE_PROFILES = ['default', 'subagents', 'exact', 'stock', 'vanilla'];
1429
1528
 
1430
1529
  function clampInt(value, min, max, fallback) {
1431
1530
  const n = Number(value);
@@ -1439,6 +1538,28 @@ export function engineSettingsFile(rootDir = process.cwd()) {
1439
1538
  return path.join(localRuntimeDir(rootDir), 'engine.json');
1440
1539
  }
1441
1540
 
1541
+ /** Файл состояния запущенного процесса движка (`MODELS/Local/$provider/#runtime/engine-state.json`). */
1542
+ export function engineStateFile(rootDir = process.cwd()) {
1543
+ return path.join(localRuntimeDir(rootDir), 'engine-state.json');
1544
+ }
1545
+
1546
+ export function readEngineStateSync(rootDir = process.cwd()) {
1547
+ try {
1548
+ return JSON.parse(fs.readFileSync(engineStateFile(rootDir), 'utf8')) || null;
1549
+ }
1550
+ catch {
1551
+ return null;
1552
+ }
1553
+ }
1554
+
1555
+ export function writeEngineStateSync(rootDir = process.cwd(), state = {}) {
1556
+ try {
1557
+ fs.mkdirSync(localRuntimeDir(rootDir), { recursive: true });
1558
+ fs.writeFileSync(engineStateFile(rootDir), JSON.stringify(state, null, 2), 'utf8');
1559
+ }
1560
+ catch { /* ignore */ }
1561
+ }
1562
+
1442
1563
  /** Прочитать сохранённые настройки движка (с валидацией значений). */
1443
1564
  export function readEngineSettings(rootDir = process.cwd()) {
1444
1565
  let saved = {};
@@ -1447,11 +1568,15 @@ export function readEngineSettings(rootDir = process.cwd()) {
1447
1568
  }
1448
1569
  catch { saved = {}; }
1449
1570
  const mode = v => ENGINE_STATE_MODES.includes(String(v || '')) ? String(v) : '';
1571
+ const savedProfile = ENGINE_PROFILES.includes(String(saved.profile || '')) ? String(saved.profile) : '';
1572
+ const profile = (saved.profileExplicit && savedProfile) ? savedProfile : DEFAULT_ENGINE_SETTINGS.profile;
1450
1573
  return {
1451
1574
  speculation: mode(saved.speculation) || DEFAULT_ENGINE_SETTINGS.speculation,
1452
1575
  promptLookup: mode(saved.promptLookup) || DEFAULT_ENGINE_SETTINGS.promptLookup,
1453
1576
  draftMax: clampInt(saved.draftMax, 1, 32, DEFAULT_ENGINE_SETTINGS.draftMax),
1454
- profile: typeof saved.profile === 'string' && saved.profile ? saved.profile : DEFAULT_ENGINE_SETTINGS.profile,
1577
+ profile,
1578
+ profileExplicit: Boolean(saved.profileExplicit && savedProfile),
1579
+ mtpDraftVocab: ['auto', 'latin', 'full'].includes(String(saved.mtpDraftVocab || '')) ? String(saved.mtpDraftVocab) : 'auto',
1455
1580
  npuPrefill: saved.npuPrefill !== false,
1456
1581
  updatedAt: Number(saved.updatedAt) || 0,
1457
1582
  };
@@ -1460,9 +1585,11 @@ export function readEngineSettings(rootDir = process.cwd()) {
1460
1585
  /** Сохранить настройки движка (частичное обновление). */
1461
1586
  export function writeEngineSettings(rootDir = process.cwd(), patch = {}) {
1462
1587
  const current = readEngineSettings(rootDir);
1588
+ const hasExplicitProfile = Boolean(patch && typeof patch.profile === 'string' && ENGINE_PROFILES.includes(patch.profile));
1463
1589
  const merged = {
1464
1590
  ...current,
1465
1591
  ...(patch && typeof patch === 'object' ? patch : {}),
1592
+ profileExplicit: hasExplicitProfile ? true : current.profileExplicit,
1466
1593
  updatedAt: Date.now(),
1467
1594
  };
1468
1595
  fs.mkdirSync(localRuntimeDir(rootDir), { recursive: true });
@@ -1521,9 +1648,7 @@ function captureProcessOutput(cmd, args, spawnImpl, timeoutMs) {
1521
1648
  }
1522
1649
 
1523
1650
  /**
1524
- * Определить возможности `bubo.exe serve llm` по его же `--help` (с кэшем на 7 дней):
1525
- * поддерживает ли движок `--speculative`, `--draft-max`/`--draft-min`/`--draft-p-min`
1526
- * и динамический Prompt Lookup (`--lookup-cache-dynamic`).
1651
+ * Определить возможности `bubo.exe serve llm` по его `--help` (с кэшем на 7 дней).
1527
1652
  */
1528
1653
  export async function inspectEngineCapabilities({
1529
1654
  rootDir = process.cwd(),
@@ -1551,12 +1676,14 @@ export async function inspectEngineCapabilities({
1551
1676
  flags,
1552
1677
  known: flags.length > 0,
1553
1678
  speculative: flags.includes('--speculative'),
1554
- draftMaxFlag: flags.includes('--draft-max'),
1555
- draftMinFlag: flags.includes('--draft-min'),
1556
- draftPMinFlag: flags.includes('--draft-p-min'),
1557
- lookupFlag: flags.includes('--lookup-cache-dynamic')
1558
- ? '--lookup-cache-dynamic'
1559
- : (flags.includes('--lookup-cache') ? '--lookup-cache' : ''),
1679
+ mtpDraftVocabFlag: flags.includes('--mtp-draft-vocab'),
1680
+ draftTokensFlag: flags.includes('--draft-tokens'),
1681
+ promptLookupFlag: flags.includes('--prompt-lookup'),
1682
+ noPromptLookupFlag: flags.includes('--no-prompt-lookup'),
1683
+ draftMaxFlag: flags.includes('--draft-tokens') || flags.includes('--draft-max'),
1684
+ lookupFlag: flags.includes('--prompt-lookup')
1685
+ ? '--prompt-lookup'
1686
+ : (flags.includes('--lookup-cache-dynamic') ? '--lookup-cache-dynamic' : ''),
1560
1687
  checkedAt: Date.now(),
1561
1688
  helpText: helpText.slice(-4000),
1562
1689
  };
@@ -1569,11 +1696,10 @@ export async function inspectEngineCapabilities({
1569
1696
  }
1570
1697
 
1571
1698
  /**
1572
- * Собрать аргументы движка для спекулятивного декодирования (чистая функция — без побочных эффектов).
1573
- * - `mtp`-предсказатель + `Dense twin` + `Q4_K Draft Head` передаются как веса;
1574
- * - если движок объявляет `--speculative`, добавляется явный режим `mtp` (это и включает спекуляцию);
1575
- * - при режиме `on` дополнительно передаются параметры черновика (`--draft-max` и порог);
1576
- * - `promptLookup` включает n-граммный кэш подсказок там, где движок это поддерживает.
1699
+ * Собрать аргументы и переменные окружения `bubo.exe` для спекулятивного декодирования (по спецификации Bubo v0.1.2):
1700
+ * - `--mtp-model` + `--twin-model` (`GUFO_DENSE_TWIN_MODEL`) + `--draft-head-model` (`GUFO_DRAFT_OUT_MODEL`);
1701
+ * - `--speculative mtp` и `--mtp-draft-vocab auto` (критично для русского текста и кода одновременно);
1702
+ * - `--prompt-lookup` включён в Bubo с MTP по умолчанию (или отключается через `--no-prompt-lookup`).
1577
1703
  */
1578
1704
  export function resolveSpeculationPlan({
1579
1705
  settings = {},
@@ -1589,64 +1715,78 @@ export function resolveSpeculationPlan({
1589
1715
  const twin = Boolean(sidecars?.twinModel);
1590
1716
  const draftHead = Boolean(sidecars?.draftHeadModel);
1591
1717
  const args = [];
1718
+ const envVars = {};
1592
1719
  const reasons = [];
1593
1720
  let enabled = false;
1721
+ let promptLookup = false;
1594
1722
 
1595
1723
  if (cfg.speculation === 'off') {
1596
- reasons.push('Спекулятивное декодирование выключено в настройках движка — веса MTP/Twin/Draft Head не подключаются.');
1724
+ if (flags.has('--no-mtp'))
1725
+ args.push('--no-mtp');
1726
+ if (flags.has('--no-twin'))
1727
+ args.push('--no-twin');
1728
+ if (flags.has('--no-draft-head'))
1729
+ args.push('--no-draft-head');
1730
+ reasons.push('Спекулятивное декодирование отключено — используется только основная модель.');
1597
1731
  }
1598
1732
  else if (!mtp) {
1599
1733
  reasons.push('Файл MTP-предсказателя (mtp-*.gguf) не найден в $ai/#weights — спекуляция недоступна.');
1600
1734
  }
1601
1735
  else {
1602
1736
  args.push('--mtp-model', sidecars.mtpModel);
1603
- if (twin)
1737
+ if (twin) {
1604
1738
  args.push('--twin-model', sidecars.twinModel);
1605
- if (draftHead)
1739
+ envVars.GUFO_DENSE_TWIN_MODEL = sidecars.twinModel;
1740
+ }
1741
+ if (draftHead) {
1606
1742
  args.push('--draft-head-model', sidecars.draftHeadModel);
1607
- if (flags.has('--speculative')) {
1608
- args.push('--speculative', 'mtp');
1743
+ envVars.GUFO_DRAFT_OUT_MODEL = sidecars.draftHeadModel;
1744
+ }
1745
+ if (!capsKnown || flags.has('--speculative')) {
1746
+ if (flags.has('--speculative'))
1747
+ args.push('--speculative', 'mtp');
1609
1748
  enabled = true;
1610
- reasons.push('Движок объявляет --speculative: передан режим «mtp».');
1611
1749
  }
1612
- else if (capsKnown) {
1613
- reasons.push('Движок не объявляет --speculative: спекуляция включается самим флагом --mtp-model (поведение по умолчанию движка).');
1750
+ // Автопереключение словаря черновика латиница ↔ кириллица снимает просадку скорости на русском языке
1751
+ const vocabMode = cfg.mtpDraftVocab || 'auto';
1752
+ if (!capsKnown || flags.has('--mtp-draft-vocab')) {
1753
+ args.push('--mtp-draft-vocab', vocabMode);
1614
1754
  }
1615
- else {
1616
- reasons.push('Возможности движка неизвестны (--help недоступен): дополнительные флаги спекуляции не передавались, работает режим по умолчанию.');
1755
+ if (cfg.speculation === 'on') {
1756
+ const dTok = String(clampInt(cfg.draftMax, 1, 32, DEFAULT_ENGINE_SETTINGS.draftMax));
1757
+ if (flags.has('--draft-tokens'))
1758
+ args.push('--draft-tokens', dTok);
1759
+ else if (flags.has('--draft-max'))
1760
+ args.push('--draft-max', dTok);
1617
1761
  }
1618
- if (enabled) {
1619
- if (cfg.speculation === 'on' && flags.has('--draft-max'))
1620
- args.push('--draft-max', String(clampInt(cfg.draftMax, 1, 32, DEFAULT_ENGINE_SETTINGS.draftMax)));
1621
- if (cfg.speculation === 'on' && flags.has('--draft-min'))
1622
- args.push('--draft-min', '0');
1623
- if (cfg.speculation === 'on' && flags.has('--draft-p-min'))
1624
- args.push('--draft-p-min', '0.6');
1762
+ if (cfg.promptLookup === 'off') {
1763
+ if (flags.has('--no-prompt-lookup'))
1764
+ args.push('--no-prompt-lookup');
1625
1765
  }
1626
- }
1627
-
1628
- let promptLookup = false;
1629
- if (cfg.promptLookup !== 'off' && cfg.speculation !== 'off' && !hasManifest && capabilities?.lookupFlag && lookupPath) {
1630
- args.push(capabilities.lookupFlag, lookupPath);
1631
- promptLookup = true;
1632
- reasons.push('Prompt Lookup (n-граммы) включён: ' + capabilities.lookupFlag + '.');
1633
- }
1634
- else if (cfg.promptLookup === 'on' && !capabilities?.lookupFlag) {
1635
- reasons.push('Prompt Lookup запрошен, но движок не объявляет поддерживаемого флага кэша подсказок.');
1766
+ else {
1767
+ promptLookup = true;
1768
+ if (!hasManifest && flags.has('--lookup-cache-dynamic') && !flags.has('--prompt-lookup') && lookupPath) {
1769
+ args.push('--lookup-cache-dynamic', lookupPath);
1770
+ }
1771
+ }
1772
+ reasons.push(
1773
+ `Активен полный стек спекуляции Bubo: MTP${twin ? ' + Dense Twin' : ''}${draftHead ? ' + Q4_K Draft Head' : ''} (словарь черновика: ${vocabMode}).`
1774
+ );
1636
1775
  }
1637
1776
 
1638
1777
  const mode = cfg.speculation === 'off'
1639
1778
  ? 'off'
1640
- : (!mtp ? 'unavailable' : (enabled ? 'explicit' : 'weights-only'));
1779
+ : (!mtp ? 'unavailable' : (capsKnown && flags.has('--speculative') ? 'explicit' : 'weights-only'));
1641
1780
  const parts = [
1642
- enabled ? 'MTP включён (--speculative mtp)' : (mtp && mode !== 'off' ? 'MTP передан весами' : 'MTP выключен'),
1781
+ mtp && mode !== 'off'
1782
+ ? `MTP${twin ? ' + Twin' : ''}${draftHead ? ' + Draft Head' : ''} (vocab: ${cfg.mtpDraftVocab || 'auto'})`
1783
+ : 'MTP выключен',
1643
1784
  promptLookup ? 'Prompt Lookup вкл.' : 'Prompt Lookup выкл.',
1644
- cfg.speculation === 'on' && enabled ? `draft-max ${cfg.draftMax}` : '',
1645
1785
  ].filter(Boolean);
1646
1786
 
1647
1787
  return {
1648
1788
  mode,
1649
- enabled,
1789
+ enabled: Boolean(mtp && mode !== 'off'),
1650
1790
  promptLookup,
1651
1791
  sidecars: {
1652
1792
  mtp: Boolean(mtp),
@@ -1655,12 +1795,63 @@ export function resolveSpeculationPlan({
1655
1795
  },
1656
1796
  capabilitiesKnown: capsKnown,
1657
1797
  args,
1798
+ envVars,
1658
1799
  reasons,
1659
1800
  summary: parts.join(' · '),
1660
1801
  settings: { ...cfg },
1661
1802
  };
1662
1803
  }
1663
1804
 
1805
+ export function computeBuboLaunchSignature({
1806
+ exePath = '',
1807
+ port = HALOGEN_DEFAULT_PORT,
1808
+ modelPath = '',
1809
+ sidecars = null,
1810
+ profile = 'default',
1811
+ mtpDraftVocab = 'auto',
1812
+ speculation = 'auto',
1813
+ npuPrefill = false,
1814
+ } = {}) {
1815
+ const raw = JSON.stringify({
1816
+ schema: 'bubo-v2.1',
1817
+ exePath,
1818
+ port: Number(port) || HALOGEN_DEFAULT_PORT,
1819
+ modelPath,
1820
+ mtp: sidecars?.mtpModel || '',
1821
+ twin: sidecars?.twinModel || '',
1822
+ draftHead: sidecars?.draftHeadModel || '',
1823
+ mmproj: sidecars?.mmprojModel || '',
1824
+ profile,
1825
+ mtpDraftVocab,
1826
+ speculation,
1827
+ npuPrefill: Boolean(npuPrefill),
1828
+ });
1829
+ return crypto.createHash('sha256').update(raw).digest('hex').slice(0, 16);
1830
+ }
1831
+
1832
+ async function stopStaleBuboProcess({ rootDir = process.cwd(), port = HALOGEN_DEFAULT_PORT, winEnv = null } = {}) {
1833
+ stopHalogenBackend();
1834
+ const prevState = readEngineStateSync(rootDir);
1835
+ if (prevState?.pid && Number.isInteger(prevState.pid) && prevState.pid > 0 && prevState.pid !== process.pid) {
1836
+ try { process.kill(prevState.pid); } catch { /* уже завершён */ }
1837
+ }
1838
+ if (os.platform() === 'win32' && winEnv?.buboExePath && fs.existsSync(winEnv.buboExePath)) {
1839
+ await captureProcessOutput(winEnv.buboExePath, ['stop'], spawn, 3000).catch(() => '');
1840
+ }
1841
+ // Если старый bubo.exe запущен другим экземпляром WORK на этом же порту — аккуратно завершаем именно bubo/gufo на нашем порту
1842
+ if (os.platform() === 'win32') {
1843
+ const psCmd = `$c = Get-NetTCPConnection -LocalPort ${Number(port)} -State Listen -ErrorAction SilentlyContinue | Select-Object -First 1; if ($c) { $p = Get-Process -Id $c.OwningProcess -ErrorAction SilentlyContinue; if ($p -and $p.ProcessName -match '^(bubo|gufo)$') { Stop-Process -Id $p.Id -Force -ErrorAction SilentlyContinue } }`;
1844
+ await captureProcessOutput('powershell.exe', ['-NoProfile', '-Command', psCmd], spawn, 4000).catch(() => '');
1845
+ }
1846
+ const deadline = Date.now() + 8000;
1847
+ while (Date.now() < deadline) {
1848
+ const pr = await probeHalogenServer(`http://127.0.0.1:${port}/v1/chat/completions`, { rootDir }).catch(() => ({ online: false }));
1849
+ if (!pr?.online)
1850
+ break;
1851
+ await new Promise(r => setTimeout(r, 250));
1852
+ }
1853
+ }
1854
+
1664
1855
  /**
1665
1856
  * Полное описание контура спекулятивного декодирования для UI: сохранённые настройки,
1666
1857
  * найденные веса (MTP / Dense twin / Draft head / Vision mmproj), возможности движка и итоговые флаги.
@@ -1678,8 +1869,6 @@ export async function describeEngineSetup({
1678
1869
  const hasManifest = Boolean(gguf && fs.existsSync(path.join(path.dirname(gguf), 'bubo-package.json')));
1679
1870
  const cfg = { ...readEngineSettings(rootDir), ...(settings || {}) };
1680
1871
  const exePath = winEnv.buboExePath || winEnv.gufoExePath || '';
1681
- // Возможности читаем из кэша (быстро); принудительный опрос --help — только по кнопке «Обновить диагностику»
1682
- // и при самом запуске движка (`startHalogenBackend`), чтобы карточка открывалась мгновенно.
1683
1872
  const caps = capabilities !== undefined
1684
1873
  ? capabilities
1685
1874
  : (readEngineCapabilitiesSync(rootDir, exePath)
@@ -1699,6 +1888,7 @@ export async function describeEngineSetup({
1699
1888
  catch { /* ignore */ }
1700
1889
  return { path: p, name: path.basename(p), sizeGb };
1701
1890
  };
1891
+ const stateOnDisk = readEngineStateSync(rootDir);
1702
1892
  return {
1703
1893
  settings: cfg,
1704
1894
  weightsDir,
@@ -1724,14 +1914,22 @@ export async function describeEngineSetup({
1724
1914
  installed: Boolean(winEnv.buboInstalled || winEnv.gufoInstalled),
1725
1915
  runtime: winEnv.buboInstalled ? 'bubo.exe' : (winEnv.gufoInstalled ? 'gufo.exe' : ''),
1726
1916
  exePath,
1917
+ npuReady: Boolean(winEnv.npuDriverInstalled && winEnv.npuKernelsPresent),
1727
1918
  },
1728
1919
  running: _managedInfo ? {
1729
1920
  runtime: _managedInfo.runtime,
1730
- profile: _managedInfo.profile || '',
1731
- speculation: _managedInfo.speculation || null,
1921
+ profile: _managedInfo.profile || cfg.profile,
1922
+ npuPrefill: Boolean(_managedInfo.npuPrefill),
1923
+ speculation: _managedInfo.speculation || plan,
1732
1924
  startedAt: _managedInfo.startedAt,
1733
- } : null,
1734
- fallback: _lastSpeculationFallback,
1925
+ } : (stateOnDisk?.pid ? {
1926
+ runtime: stateOnDisk.runtime || 'bubo',
1927
+ profile: stateOnDisk.profile || cfg.profile,
1928
+ npuPrefill: Boolean(stateOnDisk.npuPrefill),
1929
+ speculation: plan,
1930
+ startedAt: stateOnDisk.startedAt || 0,
1931
+ } : null),
1932
+ fallback: null,
1735
1933
  };
1736
1934
  }
1737
1935
 
@@ -1750,8 +1948,6 @@ export async function startHalogenBackend({
1750
1948
  spawnImpl = spawn,
1751
1949
  settings = null,
1752
1950
  capabilities = undefined,
1753
- retryWithoutSpeculation = true,
1754
- _speculationRetry = false,
1755
1951
  } = {}) {
1756
1952
  const probe = await probeHalogenServer(`http://127.0.0.1:${port}/v1/chat/completions`, { rootDir });
1757
1953
  if (probe.online) {
@@ -1788,15 +1984,14 @@ export async function startHalogenBackend({
1788
1984
  const manifestCandidate = ggufPath ? path.join(path.dirname(ggufPath), 'bubo-package.json') : '';
1789
1985
  const hasBuboManifest = Boolean(manifestCandidate && fs.existsSync(manifestCandidate));
1790
1986
 
1791
- // Настройки спекулятивного декодирования (MTP + Draft Head + Prompt Lookup) из #runtime/engine.json
1792
1987
  const engineSettings = { ...readEngineSettings(rootDir), ...(settings || {}) };
1793
- const activeProfile = profile || engineSettings.profile || 'subagents';
1988
+ const activeProfile = profile || engineSettings.profile || DEFAULT_ENGINE_SETTINGS.profile;
1794
1989
  const prefillEnabled = npuPrefill === null ? engineSettings.npuPrefill !== false : Boolean(npuPrefill);
1990
+ const effectiveNpuPrefill = Boolean(prefillEnabled && winEnv.npuDriverInstalled && winEnv.npuKernelsPresent && activeProfile !== 'exact' && activeProfile !== 'stock' && activeProfile !== 'vanilla');
1795
1991
 
1796
1992
  // 1. Приоритет №1 на Windows: нативный движок Halowin Bubo (`bubo.exe serve llm` на ROCm 10.0.0 gfx1151 + Ryzen AI NPU)
1797
1993
  if (winEnv.buboInstalled && ggufPath && fs.existsSync(ggufPath)) {
1798
1994
  try {
1799
- // Возможности движка (--speculative, --draft-max, --lookup-cache-dynamic) определяются один раз по `--help`
1800
1995
  const caps = capabilities !== undefined
1801
1996
  ? capabilities
1802
1997
  : await inspectEngineCapabilities({ rootDir, exePath: winEnv.buboExePath, spawnImpl });
@@ -1818,12 +2013,23 @@ export async function startHalogenBackend({
1818
2013
  '--served-model-name', 'halogen-qwen3.8-flash-next',
1819
2014
  '--profile', activeProfile,
1820
2015
  ];
1821
- if (prefillEnabled && winEnv.npuDriverInstalled && winEnv.npuKernelsPresent && activeProfile !== 'exact' && activeProfile !== 'stock') {
2016
+ if (effectiveNpuPrefill) {
1822
2017
  args.push('--npu-prefill', 'on');
1823
2018
  }
2019
+ const signature = computeBuboLaunchSignature({
2020
+ exePath: winEnv.buboExePath,
2021
+ port,
2022
+ modelPath: ggufPath,
2023
+ sidecars: resolvedSidecars,
2024
+ profile: activeProfile,
2025
+ mtpDraftVocab: engineSettings.mtpDraftVocab || 'auto',
2026
+ speculation: engineSettings.speculation || 'auto',
2027
+ npuPrefill: effectiveNpuPrefill,
2028
+ });
1824
2029
  const env = {
1825
2030
  ...process.env,
1826
2031
  ...(winEnv.rocmRuntimeDir ? { BUBO_RUNTIME_DIR: winEnv.rocmRuntimeDir } : {}),
2032
+ ...(plan.envVars || {}),
1827
2033
  };
1828
2034
  const proc = spawnImpl(winEnv.buboExePath, args, {
1829
2035
  cwd: path.dirname(winEnv.buboExePath),
@@ -1837,32 +2043,21 @@ export async function startHalogenBackend({
1837
2043
  port,
1838
2044
  modelPath: ggufPath,
1839
2045
  runtime: 'bubo',
1840
- npuPrefill: Boolean(prefillEnabled && winEnv.npuDriverInstalled && winEnv.npuKernelsPresent),
2046
+ npuPrefill: effectiveNpuPrefill,
1841
2047
  profile: activeProfile,
2048
+ signature,
1842
2049
  args,
1843
2050
  speculation: plan,
1844
- onEarlyExit: retryWithoutSpeculation && !_speculationRetry && plan.args.length
1845
- ? async (code) => {
1846
- _lastSpeculationFallback = {
1847
- at: Date.now(),
1848
- reason: `движок завершился с кодом ${code} сразу после запуска со флагами спекуляции`,
1849
- args: plan.args,
1850
- };
1851
- try {
1852
- await startHalogenBackend({
1853
- rootDir,
1854
- port,
1855
- modelPath: ggufPath,
1856
- profile: activeProfile,
1857
- npuPrefill,
1858
- spawnImpl,
1859
- settings: { ...engineSettings, speculation: 'off', promptLookup: 'off' },
1860
- _speculationRetry: true,
1861
- });
1862
- }
1863
- catch { /* останется автономный контур */ }
1864
- }
1865
- : null,
2051
+ });
2052
+ writeEngineStateSync(rootDir, {
2053
+ pid: proc?.pid || null,
2054
+ port,
2055
+ runtime: 'bubo',
2056
+ profile: activeProfile,
2057
+ npuPrefill: effectiveNpuPrefill,
2058
+ signature,
2059
+ args,
2060
+ startedAt: Date.now(),
1866
2061
  });
1867
2062
  return {
1868
2063
  started: true,
@@ -1870,6 +2065,7 @@ export async function startHalogenBackend({
1870
2065
  runtime: 'bubo.exe (AMD ROCm 10.0.0 gfx1151)',
1871
2066
  pid: proc.pid,
1872
2067
  port,
2068
+ signature,
1873
2069
  modelPath: ggufPath,
1874
2070
  windowsEnv: winEnv,
1875
2071
  speculation: {
@@ -2010,23 +2206,63 @@ export async function ensureHalogenBackendRunning({
2010
2206
  }
2011
2207
  catch { /* default */ }
2012
2208
 
2013
- const probe1 = await probeHalogenServer(baseUrl, { rootDir });
2014
- if (probe1.online) {
2015
- return {
2016
- ready: true,
2017
- alreadyRunning: true,
2018
- mode: probe1.mode,
2019
- origin: probe1.origin,
2020
- };
2021
- }
2022
-
2023
- // Проверка на несовместимые Linux-веса (.hgn / .hnpw) на Windows
2024
2209
  const modelFolderName = String(ai?.id || ai?.path || '').split('/').filter(Boolean).pop() || '';
2025
2210
  const candidateWeightsDir = ai?.weightsDir
2026
2211
  ? path.resolve(rootDir, ai.weightsDir)
2027
2212
  : (modelFolderName ? modelWeightsDir(rootDir, modelFolderName, 'Local') : '');
2028
2213
  const wInsp = candidateWeightsDir ? inspectWeightsDirectorySync(candidateWeightsDir, platform) : null;
2029
- const winEnv = inspectWindowsHalogenEnvironment({ rootDir });
2214
+ let winEnv = inspectWindowsHalogenEnvironment({ rootDir });
2215
+
2216
+ const explicitGguf = (wInsp?.hasGguf && candidateWeightsDir)
2217
+ ? (resolveBuboModelFiles(candidateWeightsDir).mainModel || '')
2218
+ : '';
2219
+ const targetGguf = (explicitGguf && fs.existsSync(explicitGguf)) ? explicitGguf : findLocalGgufModel(rootDir);
2220
+
2221
+ const probe1 = await probeHalogenServer(baseUrl, { rootDir });
2222
+ if (probe1.online) {
2223
+ // Если на Windows запущен старый процесс bubo.exe с прежними параметрами (например, --profile subagents с latin-словарём),
2224
+ // автоматически перезапускаем его с актуальной сигнатурой флагов.
2225
+ if (
2226
+ platform === 'win32'
2227
+ && probe1.mode === 'bubo-windows'
2228
+ && winEnv.buboInstalled
2229
+ && targetGguf
2230
+ && fs.existsSync(targetGguf)
2231
+ && spawnImpl === spawn
2232
+ ) {
2233
+ const cfg = readEngineSettings(rootDir);
2234
+ const activeProfile = cfg.profile || DEFAULT_ENGINE_SETTINGS.profile;
2235
+ const effectiveNpu = Boolean(cfg.npuPrefill !== false && winEnv.npuDriverInstalled && winEnv.npuKernelsPresent && activeProfile !== 'exact' && activeProfile !== 'stock' && activeProfile !== 'vanilla');
2236
+ const targetSig = computeBuboLaunchSignature({
2237
+ exePath: winEnv.buboExePath,
2238
+ port,
2239
+ modelPath: targetGguf,
2240
+ sidecars: resolveBuboModelFiles(path.dirname(targetGguf)),
2241
+ profile: activeProfile,
2242
+ mtpDraftVocab: cfg.mtpDraftVocab || 'auto',
2243
+ speculation: cfg.speculation || 'auto',
2244
+ npuPrefill: effectiveNpu,
2245
+ });
2246
+ const currentSig = _managedInfo?.signature || readEngineStateSync(rootDir)?.signature || '';
2247
+ if (currentSig === targetSig) {
2248
+ return {
2249
+ ready: true,
2250
+ alreadyRunning: true,
2251
+ mode: probe1.mode,
2252
+ origin: probe1.origin,
2253
+ };
2254
+ }
2255
+ await stopStaleBuboProcess({ rootDir, port, winEnv });
2256
+ }
2257
+ else {
2258
+ return {
2259
+ ready: true,
2260
+ alreadyRunning: true,
2261
+ mode: probe1.mode,
2262
+ origin: probe1.origin,
2263
+ };
2264
+ }
2265
+ }
2030
2266
 
2031
2267
  if (platform === 'win32' && wInsp?.incompatibleOnPlatform) {
2032
2268
  return {
@@ -2042,9 +2278,27 @@ export async function ensureHalogenBackendRunning({
2042
2278
 
2043
2279
  _backendStartPromise = (async () => {
2044
2280
  try {
2045
- const explicitGguf = (wInsp?.hasGguf && candidateWeightsDir)
2046
- ? (resolveBuboModelFiles(candidateWeightsDir).mainModel || '')
2047
- : '';
2281
+ // Автоматическая развёртка рантайма Halowin Bubo + ROCm 10.0, если веса GGUF уже лежат на диске
2282
+ if (
2283
+ platform === 'win32'
2284
+ && targetGguf
2285
+ && fs.existsSync(targetGguf)
2286
+ && !winEnv.buboInstalled
2287
+ && !winEnv.gufoInstalled
2288
+ && spawnImpl === spawn
2289
+ && process.env.WORK_DISABLE_AUTO_BUBO !== '1'
2290
+ ) {
2291
+ const prep = await prepareWindowsBuboRuntime({ rootDir, step: 'runtime', spawnImpl });
2292
+ if (!prep.ok) {
2293
+ return {
2294
+ ready: false,
2295
+ code: 'RUNTIME_INSTALL_FAILED',
2296
+ reason: `Не удалось автоматически развернуть движок Halowin Bubo: ${prep.error || 'нет доступа к сети'}`,
2297
+ windowsEnv: prep.windowsEnv || winEnv,
2298
+ };
2299
+ }
2300
+ winEnv = prep.windowsEnv || inspectWindowsHalogenEnvironment({ rootDir });
2301
+ }
2048
2302
 
2049
2303
  const startRes = await startHalogenBackend({
2050
2304
  rootDir,