odant-work 1.0.53 → 1.0.55
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/#system/certs/russian_trusted_root_ca.pem +32 -32
- package/#system/mail.json.example +9 -9
- package/#system/package-manifest.json +57 -48
- package/#system/settings.json.example +3 -3
- package/$server/$folder/$class/$device/class.js +2 -2
- package/$server/$folder/$class/$domain/class.js +4 -4
- package/$server/$folder/$class/$domain/readme.md +5 -5
- package/$server/$folder/$class/$handler/$task/class.js +2 -2
- package/$server/$folder/$class/$handler/$trigger/class.js +3 -3
- package/$server/$folder/$class/$handler/class.js +9 -9
- package/$server/$folder/$class/$handler/handlers/pages/editor/$handler/class.js +5 -5
- package/$server/$folder/$class/$handler/readme.md +23 -23
- package/$server/$folder/$class/$service/$class/$service/class.js +3 -3
- package/$server/$folder/$class/$structure/$base/class.js +9 -9
- package/$server/$folder/$class/$structure/$project/class.js +15 -0
- package/$server/$folder/$class/$structure/$project/handlers/methods/archive/$handler/class.js +23 -0
- package/$server/$folder/$class/$structure/$project/readme.md +14 -0
- package/$server/$folder/$class/$structure/$server/handlers/methods/distro/$handler/class.js +288 -0
- package/$server/$folder/$class/$structure/$user/class.js +2 -2
- package/$server/$folder/$class/$structure/handlers/pages/explorer/$handler/class.js +4 -4
- package/$server/$folder/$class/$structure/handlers/pages/form/calendar/$handler/readme.md +40 -40
- package/$server/$folder/$class/$structure/handlers/pages/form/database/$handler/class.js +1 -1
- package/$server/$folder/$class/$structure/handlers/pages/form/staff/$handler/staff.js +2 -2
- package/$server/$folder/$class/$structure/handlers/pages/site/$handler/readme.md +34 -34
- package/$server/$folder/$class/ai/config.js +19 -19
- package/$server/$folder/$class/ai/prompt/$method/class.js +41 -41
- package/$server/$folder/$class/ai/skills/approval-flow.md +14 -14
- package/$server/$folder/$class/ai/skills/backup-check.md +13 -13
- package/$server/$folder/$class/ai/skills/computer.md +27 -27
- package/$server/$folder/$class/ai/skills/delegate-task.md +15 -15
- package/$server/$folder/$class/ai/skills/external-signup.md +14 -14
- package/$server/$folder/$class/ai/skills/lan-inventory.md +16 -16
- package/$server/$folder/$class/ai/skills/onboarding.md +15 -15
- package/$server/$folder/$class/ai/skills/orchestration.md +41 -41
- package/$server/$folder/$class/handlers/pages/form/builder/$handler/builder.js +259 -259
- package/$server/$folder/$class/handlers/pages/form/editor/$handler/editor.js +19 -19
- package/$server/$folder/$class/handlers/pages/form/object/$handler/object.js +1 -1
- package/$server/$folder/$class/handlers/pages/form/objects/$handler/objects.js +1 -1
- package/$server/$folder/$class/handlers/pages/storage/$handler/storage.js +20 -20
- package/$server/$folder/$file/$audio/handlers/preview/$handler/class.js +3 -3
- package/$server/$folder/$file/$audio/handlers/preview/$handler/preview.js +88 -88
- package/$server/$folder/$file/$call/class.js +10 -10
- package/$server/$folder/$file/$call/handlers/preview/$handler/class.js +4 -4
- package/$server/$folder/$file/$call/triggers/on_save/$trigger/class.js +48 -48
- package/$server/$folder/$file/$data/class.js +16 -16
- package/$server/$folder/$file/$data/handlers/pages/form/editor/$handler/class.js +5 -5
- package/$server/$folder/$file/$data/handlers/pages/form/editor/$handler/editor.js +26 -26
- package/$server/$folder/$file/$devs/$js/class.js +2 -2
- package/$server/$folder/$file/$devs/$json/class.js +2 -2
- package/$server/$folder/$file/$devs/$ts/class.js +2 -2
- package/$server/$folder/$file/$devs/handlers/pages/form/file/$handler/class.js +3 -3
- package/$server/$folder/$file/$devs/handlers/pages/form/file/$handler/file.js +30 -30
- package/$server/$folder/$file/$eml/class.js +17 -17
- package/$server/$folder/$file/$eml/triggers/on_save/$trigger/class.js +97 -97
- package/$server/$folder/$file/$ics/class.js +44 -44
- package/$server/$folder/$file/$ics/handlers/pages/form/file/$handler/class.js +3 -3
- package/$server/$folder/$file/$ics/handlers/pages/form/file/$handler/file.js +10 -10
- package/$server/$folder/$file/$ics/handlers/preview/$handler/class.js +3 -3
- package/$server/$folder/$file/$ics/handlers/preview/$handler/preview.js +67 -67
- package/$server/$folder/$file/$ics/readme.md +21 -21
- package/$server/$folder/$file/$image/$svg/class.js +11 -11
- package/$server/$folder/$file/$image/handlers/preview/$handler/class.js +3 -3
- package/$server/$folder/$file/$image/handlers/preview/$handler/preview.js +33 -33
- package/$server/$folder/$file/$ipynb/handlers/pages/form/file/$handler/class.js +3 -3
- package/$server/$folder/$file/$logs/class.js +39 -39
- package/$server/$folder/$file/$logs/handlers/methods/txt-test/$handler/class.js +4 -4
- package/$server/$folder/$file/$md/handlers/pages/form/file/$handler/class.js +3 -3
- package/$server/$folder/$file/$md/handlers/pages/form/file/$handler/file.js +63 -63
- package/$server/$folder/$file/$office/$outlook/$ics/class.js +227 -227
- package/$server/$folder/$file/$office/$word/$rtf/template.rtf +159 -159
- package/$server/$folder/$file/$task/handlers/pages/form/file/$handler/ui/voice-ui.js +94 -94
- package/$server/$folder/$file/$task/handlers/preview/$handler/class.js +3 -3
- package/$server/$folder/$file/$task/progress.md +20 -20
- package/$server/$folder/$file/$task/readme.md +32 -32
- package/$server/$folder/$file/$txt/handlers/preview/$handler/class.js +3 -3
- package/$server/$folder/$file/$txt/handlers/preview/$handler/preview.js +41 -41
- package/$server/$folder/$file/$video/handlers/preview/$handler/class.js +4 -4
- package/$server/$folder/$file/$video/handlers/preview/$handler/preview.js +13 -13
- package/$server/$folder/$file/class.js +2 -2
- package/$server/$folder/$file/handlers/methods/download/$handler/class.js +2 -2
- package/$server/$folder/$file/handlers/methods/download/$handler/download.js +4 -4
- package/$server/$folder/$file/handlers/pages/form/$handler/class.js +2 -2
- package/$server/$folder/$file/handlers/pages/form/file/$handler/class.js +3 -3
- package/$server/$folder/$file/handlers/pages/form/file/$handler/file.js +28 -28
- package/$server/$folder/$file/readme.md +31 -31
- package/$server/$folder/class.js +11 -11
- package/$server/$folder/handlers/methods/create/$handler/class.js +21 -10
- package/$server/$folder/handlers/methods/create/progress.md +15 -15
- package/$server/$folder/handlers/pages/form/$handler/class.js +5 -5
- package/$server/$folder/handlers/pages/form/$handler/form.js +1 -1
- package/$server/$folder/handlers/readme.md +24 -24
- package/$server/$folder/lib/calendar-form/calendar-form.js +296 -296
- package/$server/$folder/lib/dialogs/confirm/confirm.js +30 -30
- package/$server/$folder/lib/dialogs/input/input.js +57 -57
- package/$server/$folder/lib/email/settings.js +82 -82
- package/$server/$folder/lib/file-viewer/file-viewer.js +8 -8
- package/$server/$folder/lib/icon/user/user.js +6 -6
- package/$server/$folder/lib/item-data-grid/item-data-grid.js +48 -48
- package/$server/$folder/lib/item-form/item-form.js +84 -84
- package/$server/$folder/lib/menu/progress.md +13 -13
- package/$server/$folder/lib/menu/readme.md +29 -29
- package/$server/$folder/lib/node/node.js +3 -3
- package/$server/$folder/lib/node/progress.md +13 -13
- package/$server/$folder/lib/node/readme.md +29 -29
- package/$server/$folder/lib/pack/pack.js +4 -4
- package/$server/$folder/lib/prompt-bar/progress.md +13 -13
- package/$server/$folder/lib/security/admin/admin.js +30 -30
- package/$server/$folder/lib/site-loc/readme.md +16 -16
- package/$server/$folder/lib/site-loc/site-loc.js +80 -80
- package/$server/$folder/lib/tree/progress.md +16 -16
- package/$server/$folder/lib/tree/tree.js +23 -5
- package/$server/$folder/readme.md +18 -18
- package/$server/readme.md +13 -13
- package/.cursor/rules/work.mdc +8 -8
- package/.github/workflows/ci.yml +39 -39
- package/MODELS/$ai/$folder/$class/$ai/class.js +15 -0
- package/MODELS/$ai/$folder/$class/$ai/handlers/pages/form/trainer/$handler/trainer.js +22 -1
- package/MODELS/$ai/$folder/$class/$provider/handlers/pages/form/trainer/$handler/trainer.js +7 -5
- package/MODELS/$ai/$folder/$class/$provider/readme.md +16 -16
- package/MODELS/GigaChat/$provider/readme.md +24 -24
- package/MODULES/Register/$module/$folder/$class/$register/class.js +4 -4
- package/MODULES/Register/$module/$folder/$class/$struct/class.js +4 -4
- package/MODULES/Register/CATALOGS/$catalog/$folder/$class/$virtual/class.js +14 -14
- 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
- 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
- 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
- package/MODULES/Register/REGISTER/$register/$folder/$class/$account/class.js +18 -18
- package/MODULES/Register/REGISTER/$register/$folder/$class/$register/class.js +11 -11
- package/MODULES/Register/REGISTER/68/01/$account/class.js +1 -1
- package/MODULES/Register/REGISTER/68/02/$account/class.js +1 -1
- 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
- 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
- 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
- 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
- package/MODULES/Register/STRUCTS/$struct/$folder/$class/$struct/class.js +4 -4
- package/MODULES/Register/STRUCTS/$struct/class.js +4 -4
- package/MODULES/Register/STRUCTS//320/220/320/264/321/200/320/265/321/201/$struct/class.js +11 -11
- 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
- package/MODULES/Register/STRUCTS//320/237/320/260/321/201/320/277/320/276/321/200/321/202/$struct/class.js +11 -11
- package/NODES/$node/$folder/$class/$node/class.js +35 -35
- package/NODES/$node/class.js +5 -5
- package/NODES/$node/handlers/pages/form/network/$handler/class.js +5 -5
- package/NODES/$node/handlers/pages/form/network/$handler/network.js +110 -110
- package/NODES/teewtew/$node/class.js +2 -2
- package/NODES/work.odant.org/$node/class.js +3 -3
- package/ORGANIZATIONS/$domain/$folder/$class/$base/$folder/$class/$structure/$base/class.js +17 -17
- package/ORGANIZATIONS/$domain/$folder/$class/$base/class.js +4 -4
- package/PROJECTS/$domain/$folder/$class/$project/class.js +4 -0
- package/PROJECTS/$domain/class.js +4 -0
- package/PROJECTS/$domain/handlers/methods/restore/$handler/class.js +173 -0
- package/PROJECTS/$domain/readme.md +5 -0
- package/SERVICES/$service/$folder/$storage/$service/class.js +8 -8
- package/SERVICES/ArgoCD/$service/$folder/$class/$service/class.js +356 -356
- package/SERVICES/ArgoCD/$service/$folder/$class/$service/handlers/pages/form/orders/$handler/class.js +244 -244
- package/SERVICES/ArgoCD/$service/class.js +4 -4
- package/SERVICES/ArgoCD/$service/readme.md +63 -63
- package/SERVICES/ArgoCD/PaaS/$service/$folder/$class/$service/class.js +10 -10
- package/SERVICES/ArgoCD/PaaS/$service/$folder/$class/$service/methods/checkDomain/$method/class.js +33 -33
- package/SERVICES/ArgoCD/PaaS/$service/$folder/$class/$service/methods/provision/$method/class.js +225 -225
- package/SERVICES/ArgoCD/PaaS/$service/$folder/$class/$service/methods/submitOrder/$method/class.js +77 -77
- package/SERVICES/ArgoCD/PaaS/$service/$folder/$class/$service/readme.md +33 -33
- package/SERVICES/ArgoCD/PaaS/$service/class.js +347 -347
- package/SERVICES/ArgoCD/PaaS/$service/order/pass.order +8 -8
- package/SERVICES/DuckDuckGo/$service/class.js +367 -367
- package/SERVICES/SearXNG/$service/class.js +70 -70
- package/SERVICES/Telegram/$service/class.js +114 -114
- package/SERVICES/Weather/$service/class.js +76 -76
- package/SERVICES/Yandex/$service/class.js +120 -120
- package/SERVICES/readme.md +43 -43
- package/USERS/$users/class.js +2 -2
- package/eslint.config.js +51 -51
- package/jsconfig.json +37 -37
- package/oda/benchmarks/dbmon/lib/ENV.js +213 -213
- package/oda/benchmarks/dbmon/lib/ga.js +11 -11
- package/oda/benchmarks/dbmon/lib/memory-stats.js +105 -105
- package/oda/benchmarks/dbmon/lib/monitor.js +69 -69
- package/oda/benchmarks/sierpinski/sierpinski.js +149 -149
- package/oda/components/editors/code-editor/code-editor.js +387 -387
- package/oda/components/editors/code-editor/src/ace.js +16 -16
- package/oda/components/editors/code-editor/src/beautify-css.js +1625 -1625
- package/oda/components/editors/code-editor/src/beautify-html.js +3122 -3122
- package/oda/components/editors/code-editor/src/beautify.js +4005 -4005
- package/oda/components/editors/code-editor/src/ext-beautify.js +7 -7
- package/oda/components/editors/code-editor/src/ext-code_lens.js +7 -7
- package/oda/components/editors/code-editor/src/ext-elastic_tabstops_lite.js +7 -7
- package/oda/components/editors/code-editor/src/ext-emmet.js +7 -7
- package/oda/components/editors/code-editor/src/ext-error_marker.js +7 -7
- package/oda/components/editors/code-editor/src/ext-hardwrap.js +7 -7
- package/oda/components/editors/code-editor/src/ext-keybinding_menu.js +7 -7
- package/oda/components/editors/code-editor/src/ext-language_tools.js +7 -7
- package/oda/components/editors/code-editor/src/ext-linking.js +7 -7
- package/oda/components/editors/code-editor/src/ext-modelist.js +7 -7
- package/oda/components/editors/code-editor/src/ext-options.js +7 -7
- package/oda/components/editors/code-editor/src/ext-prompt.js +7 -7
- package/oda/components/editors/code-editor/src/ext-rtl.js +7 -7
- package/oda/components/editors/code-editor/src/ext-searchbox.js +7 -7
- package/oda/components/editors/code-editor/src/ext-settings_menu.js +7 -7
- package/oda/components/editors/code-editor/src/ext-spellcheck.js +7 -7
- package/oda/components/editors/code-editor/src/ext-split.js +7 -7
- package/oda/components/editors/code-editor/src/ext-static_highlight.js +7 -7
- package/oda/components/editors/code-editor/src/ext-statusbar.js +7 -7
- package/oda/components/editors/code-editor/src/ext-textarea.js +7 -7
- package/oda/components/editors/code-editor/src/ext-themelist.js +7 -7
- package/oda/components/editors/code-editor/src/ext-whitespace.js +7 -7
- package/oda/components/editors/code-editor/src/keybinding-emacs.js +7 -7
- package/oda/components/editors/code-editor/src/keybinding-sublime.js +7 -7
- package/oda/components/editors/code-editor/src/keybinding-vim.js +7 -7
- package/oda/components/editors/code-editor/src/keybinding-vscode.js +7 -7
- package/oda/components/editors/code-editor/src/mode-css.js +7 -7
- package/oda/components/editors/code-editor/src/mode-html.js +7 -7
- package/oda/components/editors/code-editor/src/mode-javascript.js +7 -7
- package/oda/components/editors/code-editor/src/mode-json.js +7 -7
- package/oda/components/editors/code-editor/src/mode-markdown.js +7 -7
- package/oda/components/editors/code-editor/src/mode-svg.js +7 -7
- package/oda/components/editors/code-editor/src/mode-text.js +7 -7
- package/oda/components/editors/code-editor/src/mode-xml.js +7 -7
- package/oda/components/editors/code-editor/src/mode-xquery.js +7 -7
- package/oda/components/editors/code-editor/src/snippets/css.js +7 -7
- package/oda/components/editors/code-editor/src/snippets/html.js +7 -7
- package/oda/components/editors/code-editor/src/snippets/javascript.js +7 -7
- package/oda/components/editors/code-editor/src/snippets/json.js +7 -7
- package/oda/components/editors/code-editor/src/snippets/markdown.js +7 -7
- package/oda/components/editors/code-editor/src/snippets/svg.js +7 -7
- package/oda/components/editors/code-editor/src/snippets/text.js +7 -7
- package/oda/components/editors/code-editor/src/snippets/xml.js +7 -7
- package/oda/components/editors/code-editor/src/snippets/xquery.js +7 -7
- package/oda/components/editors/code-editor/src/theme-solarized_dark.js +7 -7
- package/oda/components/editors/code-editor/src/theme-solarized_light.js +7 -7
- package/oda/components/editors/markdown/markdown-editor/lib/font-awesome.min.css +3 -3
- package/oda/components/editors/markdown/markdown-editor/lib/readme.md +332 -332
- package/oda/components/editors/markdown/markdown-editor/markdown-editor.js +78 -78
- package/oda/components/editors/markdown/markdown-viewer/test.md +239 -239
- package/oda/components/editors/markdown/markdown.js +76 -76
- package/oda/components/inputs/block/readme.md +39 -39
- package/oda/components/inputs/checkbox/checkbox.js +92 -92
- package/oda/components/inputs/color/color.js +83 -83
- package/oda/components/inputs/date/date.js +40 -40
- package/oda/components/inputs/input/input.js +219 -219
- package/oda/components/inputs/link/readme.md +42 -42
- package/oda/components/inputs/markdown-input/markdown-input.js +77 -77
- package/oda/components/inputs/numeric/numeric.js +141 -141
- package/oda/components/inputs/table-input/readme.md +39 -39
- package/oda/components/inputs/text/text.js +88 -88
- package/oda/components/inputs/toggle/toggle.js +101 -101
- package/oda/components/layouts/hexagon-layout/hexagon-layout.js +218 -218
- package/oda/components/menus/menu/index_old.html +140 -140
- package/oda/components/menus/menu/menu.js +238 -238
- package/oda/components/structure/controls-map.js +56 -56
- package/oda/components/structure/controls.js +29 -29
- package/oda/components/structure/readme.md +31 -31
- package/oda/components/structure/structure.js +64 -64
- package/oda/components/table/index.html +210 -210
- package/oda/components/table/lib/coerce.js +68 -68
- package/oda/components/table/lib/column.js +568 -568
- package/oda/components/table/readme.md +120 -120
- package/oda/components/table/router.js +86 -86
- package/oda/components/table/settings.js +89 -89
- package/oda/index.html +159 -159
- package/oda/tools/icons/icons-set/icons-set.js +60 -60
- package/oda/tools/icons/lib/svg/_makeSVG.html +41 -41
- package/oda/tools/icons/lib/svg/aws.svg +2679 -2679
- package/oda/tools/icons/lib/svg/info.json +46 -46
- package/oda/tools/jupyter/demo.ipynb +160 -160
- package/oda/tools/jupyter/lib/print_elements.js +73 -73
- package/oda/tools/jupyter/test-2.ipynb +305 -305
- package/oda/tools/jupyter/test.ipynb +603 -603
- package/oda/tools/styles/adoptedStyleSheets.js +333 -333
- package/oda/tools/tester/device-preview/devices.json +9 -9
- package/opencode.json +9 -9
- package/package.json +1 -1
- package/publish.cmd +2 -2
- package/readme.md +164 -164
- package/rules/rules.md +445 -445
- package/scripts/SYNC-README.md +107 -107
- package/scripts/agent-eval.mjs +223 -223
- package/scripts/dump-svn-chat.mjs +9 -9
- package/scripts/extract-chat-day.mjs +21 -21
- package/scripts/rag-bench.mjs +166 -166
- package/scripts/restore-chat.mjs +166 -166
- package/scripts/sync-svn-git.bat +129 -129
- package/scripts/test-merge.mjs +75 -75
- package/scripts/work-desktop-bridge.mjs +101 -101
- package/sources/client/field.js +168 -168
- package/sources/client/folder.js +2 -0
- package/sources/client/index.js +32 -32
- package/sources/client/readme.md +16 -16
- package/sources/core.js +91 -91
- package/sources/data/api.js +4 -4
- package/sources/data/choices.js +125 -125
- package/sources/data/classes.js +3 -3
- package/sources/data/db.js +4 -2
- package/sources/data/print.js +1 -1
- package/sources/data/progress.md +15 -0
- package/sources/data/schema.js +3 -3
- package/sources/data/sql-inspector.js +10 -8
- package/sources/host/auto-updater.js +4 -1
- package/sources/host/babel-merge.js +353 -353
- package/sources/host/config.js +48 -48
- package/sources/host/email-utils.js +269 -269
- package/sources/host/http-server.js +7 -0
- package/sources/host/index-db.js +94 -94
- package/sources/host/net-guard.js +228 -228
- package/sources/host/package-install.js +63 -63
- package/sources/host/progress.md +14 -14
- package/sources/host/push.js +86 -86
- package/sources/host/readme.md +41 -41
- package/sources/host/secret-box.js +93 -93
- package/sources/host/server-id.js +26 -26
- package/sources/host/stun.js +33 -33
- package/sources/host/tls-ca.js +60 -60
- package/sources/host/vapid.js +14 -14
- package/sources/host/watch.js +1 -1
- package/sources/index.html +49 -49
- package/sources/manifest.json +49 -49
- package/sources/modules/a2a/server.js +608 -608
- package/sources/modules/agent/connections.js +442 -442
- package/sources/modules/agent/diff.js +69 -69
- package/sources/modules/agent/eval.js +222 -222
- package/sources/modules/agent/hooks.js +131 -131
- package/sources/modules/agent/log.js +43 -43
- package/sources/modules/agent/mcp-pool.js +253 -253
- package/sources/modules/agent/plugins.js +343 -343
- package/sources/modules/agent/recovery.js +89 -89
- package/sources/modules/agent/taint.js +100 -100
- package/sources/modules/agent/tools/branch.js +311 -311
- package/sources/modules/agent/tools/browser.js +254 -254
- package/sources/modules/agent/tools/computer.js +120 -120
- package/sources/modules/agent/tools/connect.js +316 -316
- package/sources/modules/agent/tools/dev/lsp.js +334 -334
- package/sources/modules/agent/tools/dev/patch.js +564 -564
- package/sources/modules/agent/tools/memory.js +153 -153
- package/sources/modules/agent/tools/os-files.js +358 -358
- package/sources/modules/agent/tools/plugins.js +80 -80
- package/sources/modules/agent/tools/sandbox.js +268 -268
- package/sources/modules/agent/tools/work/classes.js +1 -1
- package/sources/modules/agent/tools/work/common.js +5 -5
- package/sources/modules/agent/types.d.ts +183 -183
- package/sources/modules/agent/undo.js +254 -254
- package/sources/modules/agent/util.js +179 -179
- package/sources/modules/contacts/contacts.js +200 -200
- package/sources/modules/contacts/index.html +546 -546
- package/sources/modules/lan/discovery.js +192 -192
- package/sources/modules/lan/store.js +62 -62
- package/sources/modules/mcp/readme.md +70 -70
- package/sources/modules/mcp/server.js +525 -525
- package/sources/modules/mcp/tokens.js +140 -140
- package/sources/modules/nodes/identity.js +123 -123
- package/sources/modules/nodes/inbound.js +172 -172
- package/sources/modules/nodes/outbound.js +105 -105
- package/sources/modules/nodes/signing.js +71 -71
- package/sources/modules/notify/index.js +4 -1
- package/sources/modules/rag/embed-worker.js +36 -36
- package/sources/modules/rag/indexer.js +1 -1
- package/sources/modules/rag/readme.md +70 -70
- package/sources/modules/rag/scope.js +4 -4
- package/sources/modules/readme.md +21 -21
- package/sources/modules/sandbox/config.js +74 -74
- package/sources/modules/sandbox/driver.js +100 -100
- package/sources/modules/sandbox/images/work-computer/Dockerfile +34 -34
- package/sources/modules/sandbox/images/work-computer/entrypoint.sh +24 -24
- package/sources/modules/sandbox/manager.js +1089 -1089
- package/sources/modules/sandbox/readme.md +63 -63
- package/sources/modules/sandbox/vnc-proxy.js +296 -296
- package/sources/modules/trainer/huggingface.js +6 -3
- package/sources/modules/trainer/index.js +67 -2
- package/sources/modules/trainer/local-engine.js +48 -7
- package/sources/modules/trainer/worker/local_infer_worker.py +85 -3
- package/sources/readme.md +216 -216
- package/sources/server/access/audit.js +138 -138
- package/sources/server/access/links.js +2 -2
- package/sources/server/access/refs.js +106 -106
- package/sources/server/access/workplaces.js +2 -2
- package/sources/server/assert-class-id.js +23 -23
- package/sources/server/class/archive.js +15 -13
- package/sources/server/class/base-template.js +146 -6
- package/sources/server/class/distro.js +847 -0
- package/sources/server/class/scaffold.js +1 -0
- package/sources/server/class/search.js +1 -1
- package/sources/server/class/security.js +2 -2
- package/sources/server/class.js +51 -22
- package/sources/server/external-source.js +90 -90
- package/sources/server/folder.js +6 -6
- package/sources/server/index.js +12 -12
- package/sources/server/logs.js +5 -4
- package/sources/server/memory-mark.js +34 -34
- package/sources/server/readme.md +110 -110
- package/sources/server/safe-node-name.js +67 -67
- package/sources/server/server.js +110 -1
- package/sources/server/upload-mark.js +24 -24
- package/sources/server/zip-guard.js +81 -81
- package/sources/tester.html +54 -54
- package/whitepaper.md +568 -568
|
@@ -683,7 +683,7 @@ export function evaluateModelFit(model, usableMemoryGb = 16) {
|
|
|
683
683
|
if (!infGb) {
|
|
684
684
|
return {
|
|
685
685
|
fit: 'unknown',
|
|
686
|
-
fitLabel: '
|
|
686
|
+
fitLabel: 'Число параметров не указано в названии — размер уточнится при установке',
|
|
687
687
|
canInfer: true,
|
|
688
688
|
canTrain: true,
|
|
689
689
|
};
|
|
@@ -730,7 +730,7 @@ export function resolveModelIcon({ repoId = '', modality = 'llm', capabilities =
|
|
|
730
730
|
const caps = Array.isArray(capabilities) ? capabilities : [];
|
|
731
731
|
if (caps.includes('stt'))
|
|
732
732
|
return 'carbon:microphone';
|
|
733
|
-
if (caps.includes('tts'))
|
|
733
|
+
if (caps.includes('tts') || caps.includes('music'))
|
|
734
734
|
return 'carbon:volume-up';
|
|
735
735
|
if (modality === 'video' || caps.includes('video'))
|
|
736
736
|
return 'av:videocam';
|
|
@@ -1174,10 +1174,12 @@ export async function registerLocalModelNode({
|
|
|
1174
1174
|
const aiDir = path.join(rootDir, 'MODELS', 'Local', safeName, '$ai');
|
|
1175
1175
|
await fsp.mkdir(aiDir, { recursive: true });
|
|
1176
1176
|
|
|
1177
|
+
const inferred = inferModalityAndCapabilities({ id: repoId || safeName });
|
|
1177
1178
|
const defaultCaps = modality === 'image' ? ['image']
|
|
1178
1179
|
: modality === 'video' ? ['video']
|
|
1179
1180
|
: modality === 'embed' ? ['embeddings']
|
|
1180
1181
|
: modality === 'vlm' ? ['chat', 'stream', 'vision', 'functions']
|
|
1182
|
+
: modality === 'audio' ? (inferred.capabilities?.length ? inferred.capabilities : ['tts'])
|
|
1181
1183
|
: ['chat', 'stream', 'functions'];
|
|
1182
1184
|
const rawCaps = Array.isArray(capabilities) && capabilities.length ? capabilities : defaultCaps;
|
|
1183
1185
|
const resolvedCaps = [...new Set([
|
|
@@ -1801,12 +1803,13 @@ export async function startHuggingFaceDownload({
|
|
|
1801
1803
|
else if (
|
|
1802
1804
|
fetchImpl === globalThis.fetch
|
|
1803
1805
|
&& process.env.WORK_DISABLE_AUTO_PYTHON !== '1'
|
|
1804
|
-
&& job.files.some(f => /\.(safetensors|onnx)$/i.test(String(f?.name || '')))
|
|
1806
|
+
&& job.files.some(f => /\.(safetensors|onnx|bin|pt|pth)$/i.test(String(f?.name || '')))
|
|
1805
1807
|
) {
|
|
1806
1808
|
job.currentFile = 'Подготовка среды Python и библиотек…';
|
|
1807
1809
|
try {
|
|
1808
1810
|
const capsLow = (Array.isArray(job.capabilities) ? job.capabilities : []).map(c => String(c).toLowerCase());
|
|
1809
1811
|
const depMod = capsLow.includes('rerank') || /rerank/i.test(cleanId) ? 'rerank'
|
|
1812
|
+
: capsLow.includes('music') ? 'music'
|
|
1810
1813
|
: capsLow.includes('tts') ? 'tts'
|
|
1811
1814
|
: (capsLow.includes('stt') || capsLow.includes('asr')) ? 'stt'
|
|
1812
1815
|
: (capsLow.includes('video') || job.modality === 'video') ? 'video'
|
|
@@ -384,6 +384,8 @@ function inferTestModality(ai) {
|
|
|
384
384
|
return 'tts';
|
|
385
385
|
if (caps.includes('stt') || caps.includes('asr') || mod === 'stt' || mod === 'asr')
|
|
386
386
|
return 'stt';
|
|
387
|
+
if (caps.includes('music') || mod === 'music' || /musicgen|audioldm/i.test(String(ai?.id || ai?.model || '')))
|
|
388
|
+
return 'music';
|
|
387
389
|
if (caps.includes('video') || caps.includes('text-to-video') || mod === 'video')
|
|
388
390
|
return 'video';
|
|
389
391
|
if (caps.includes('image') || caps.includes('text-to-image') || mod === 'image')
|
|
@@ -526,6 +528,33 @@ async function runSingleModelSmokeTest(ai, p = {}) {
|
|
|
526
528
|
summary: `Видео ${vid?.frames || 17} кадр. (${vid?.mime || 'video/mp4'}) за ${(durationMs / 1000).toFixed(1)} с`,
|
|
527
529
|
};
|
|
528
530
|
}
|
|
531
|
+
if (modality === 'music') {
|
|
532
|
+
const prompt = String(p.prompt || 'Спокойная современная корпоративная фоновая мелодия, мягкое пианино и лёгкий ритм').trim();
|
|
533
|
+
const rawCaps = Array.isArray(ai?.capabilities) ? ai.capabilities : (Array.isArray(ai?.DATA?.capabilities) ? ai.DATA.capabilities : []);
|
|
534
|
+
const patchedAi = rawCaps.map(c => String(c).toLowerCase()).includes('music')
|
|
535
|
+
? ai
|
|
536
|
+
: Object.assign(Object.create(Object.getPrototypeOf(ai)), ai, { capabilities: ['music'] });
|
|
537
|
+
const mus = await patchedAi.generateMusic({
|
|
538
|
+
prompt,
|
|
539
|
+
durationSec: p.durationSec ? Number(p.durationSec) : (p.duration ? Number(p.duration) : undefined),
|
|
540
|
+
seed: p.seed,
|
|
541
|
+
});
|
|
542
|
+
const totalMs = Math.max(1, Date.now() - t0);
|
|
543
|
+
const loadMs = Number(mus?.loadMs) || 0;
|
|
544
|
+
const durationMs = Number(mus?.genMs || mus?.durationMs) || Math.max(1, totalMs - loadMs);
|
|
545
|
+
return {
|
|
546
|
+
ok: true,
|
|
547
|
+
modality,
|
|
548
|
+
device: mus?.device || '',
|
|
549
|
+
loadMs,
|
|
550
|
+
durationMs,
|
|
551
|
+
totalMs,
|
|
552
|
+
mime: mus?.mime || 'audio/wav',
|
|
553
|
+
audioBase64: mus?.audioBase64 || '',
|
|
554
|
+
sampleRate: mus?.sampleRate || 32000,
|
|
555
|
+
summary: `Аудио WAV (${Math.round((mus?.audioBase64?.length || 0) * 0.75 / 1024)} КБ) за ${(durationMs / 1000).toFixed(1)} с`,
|
|
556
|
+
};
|
|
557
|
+
}
|
|
529
558
|
if (modality === 'embed') {
|
|
530
559
|
const input = Array.isArray(p.input) && p.input.length
|
|
531
560
|
? p.input
|
|
@@ -826,6 +855,42 @@ export const TRAINER_METHODS = Object.freeze({
|
|
|
826
855
|
const resolvedProtocol = d.protocol || (isLocal ? 'local' : 'openai');
|
|
827
856
|
const rawBaseUrl = (d.baseUrl && d.baseUrl !== 'null') ? String(d.baseUrl) : '';
|
|
828
857
|
const cleanBaseUrl = resolvedProtocol === 'local' ? '' : rawBaseUrl;
|
|
858
|
+
|
|
859
|
+
// Автоисправление устаревших метаданных для известных не-LLM моделей
|
|
860
|
+
// (например, если ранняя версия зарегистрировала musicgen-medium с `['chat', 'stream']`).
|
|
861
|
+
let effModality = d.modality || 'llm';
|
|
862
|
+
let effCaps = Array.isArray(d.capabilities) ? d.capabilities : (d.$public?.capabilities || ['chat', 'stream']);
|
|
863
|
+
if (isLocal) {
|
|
864
|
+
const lookupKey = String(d.hfRepo || d.model || this?.id || '').trim();
|
|
865
|
+
const curated = CURATED_HF_MODELS.find(m =>
|
|
866
|
+
m.id.toLowerCase() === lookupKey.toLowerCase()
|
|
867
|
+
|| String(m.folderName || '').toLowerCase() === String(this?.id || '').toLowerCase()
|
|
868
|
+
|| m.id.split('/').pop().toLowerCase() === String(this?.id || '').toLowerCase()
|
|
869
|
+
);
|
|
870
|
+
const inferred = curated || (lookupKey ? inferModalityAndCapabilities({ id: lookupKey }) : null);
|
|
871
|
+
const capsLow = effCaps.map(c => String(c).toLowerCase());
|
|
872
|
+
const looksLikeDefaultChat = capsLow.length === 0 || capsLow.every(c => c === 'chat' || c === 'stream' || c === 'functions');
|
|
873
|
+
if (inferred && inferred.modality && inferred.modality !== 'llm' && looksLikeDefaultChat && !(inferred.capabilities || []).includes('chat')) {
|
|
874
|
+
effModality = inferred.modality;
|
|
875
|
+
effCaps = [...inferred.capabilities];
|
|
876
|
+
try {
|
|
877
|
+
const clsPath = path.join(process.cwd(), 'MODELS', 'Local', this?.id || '', '$ai', 'class.js');
|
|
878
|
+
if (fs.existsSync(clsPath)) {
|
|
879
|
+
const rawCls = fs.readFileSync(clsPath, 'utf-8');
|
|
880
|
+
const mJson = rawCls.match(/export\s+default\s+(\{[\s\S]*\})\s*;?\s*$/);
|
|
881
|
+
if (mJson) {
|
|
882
|
+
const parsed = JSON.parse(mJson[1]);
|
|
883
|
+
parsed.modality = effModality;
|
|
884
|
+
parsed.capabilities = effCaps;
|
|
885
|
+
fs.writeFileSync(clsPath, `/**\n * Локальная модель ИИ: ${parsed.label || this?.id} (${effModality})\n * Репозиторий Hugging Face: ${parsed.hfRepo || 'локальный'}\n */\nexport default ${JSON.stringify(parsed, null, 4)};\n`, 'utf-8');
|
|
886
|
+
this?.reset?.();
|
|
887
|
+
}
|
|
888
|
+
}
|
|
889
|
+
}
|
|
890
|
+
catch { /* ignore */ }
|
|
891
|
+
}
|
|
892
|
+
}
|
|
893
|
+
|
|
829
894
|
const engineSetup = (resolvedProtocol === 'halogen' || weightInfo?.hasGguf)
|
|
830
895
|
? await describeEngineSetup().catch(() => null)
|
|
831
896
|
: null;
|
|
@@ -855,10 +920,10 @@ export const TRAINER_METHODS = Object.freeze({
|
|
|
855
920
|
protocol: resolvedProtocol,
|
|
856
921
|
model: d.model || this?.id || '',
|
|
857
922
|
baseUrl: cleanBaseUrl,
|
|
858
|
-
modality:
|
|
923
|
+
modality: effModality,
|
|
859
924
|
maxTokens: Number(d.maxTokens || d.$public?.maxTokens) || 32768,
|
|
860
925
|
maxOutput: Number(d.maxOutput || d.$public?.maxOutput) || 8192,
|
|
861
|
-
capabilities:
|
|
926
|
+
capabilities: effCaps,
|
|
862
927
|
efforts: Array.isArray(d.efforts) ? d.efforts : [],
|
|
863
928
|
weightsDir: resolvedWeightsRel,
|
|
864
929
|
primaryFile: resolvedPrimaryFile,
|
|
@@ -386,6 +386,8 @@ export function packagesForModality(modality = 'llm', weightsDir = '') {
|
|
|
386
386
|
return ['torch', 'diffusers', 'accelerate', 'pillow', 'transformers', 'safetensors'];
|
|
387
387
|
if ((mod === 'tts' || mod === 'voice') && isPiperOnnxDirSync(weightsDir))
|
|
388
388
|
return ['piper-tts', 'onnxruntime'];
|
|
389
|
+
if (mod === 'music' || mod === 'text-to-audio')
|
|
390
|
+
return ['torch', 'transformers', 'accelerate', 'safetensors', 'soundfile'];
|
|
389
391
|
if (mod === 'tts' || mod === 'voice')
|
|
390
392
|
return ['torch', 'qwen-tts', 'soundfile', 'transformers', 'accelerate', 'safetensors'];
|
|
391
393
|
if (mod === 'stt' || mod === 'asr' || mod === 'audio')
|
|
@@ -767,8 +769,19 @@ export async function* localStreamChat(ai, body = {}, options = {}) {
|
|
|
767
769
|
throw new Error('Загрузка весов модели ещё не завершена (проверьте вкладку «Модели» в /MODELS/Local).');
|
|
768
770
|
}
|
|
769
771
|
|
|
770
|
-
|
|
771
|
-
|
|
772
|
+
const aiCaps = (Array.isArray(ai?.capabilities || ai?.DATA?.capabilities)
|
|
773
|
+
? (ai?.capabilities || ai?.DATA?.capabilities)
|
|
774
|
+
: []).map(c => String(c).toLowerCase());
|
|
775
|
+
const aiMod = String(ai?.modality || ai?.DATA?.modality || '').toLowerCase();
|
|
776
|
+
const nonChatCap = aiCaps.find(c => ['music', 'tts', 'stt', 'asr', 'image', 'video', 'embeddings', 'rerank'].includes(c));
|
|
777
|
+
if (wInsp.hasReadyWeights) {
|
|
778
|
+
if ((nonChatCap && !aiCaps.includes('chat')) || ['image', 'video', 'embed', 'rerank', 'tts', 'stt', 'music'].includes(aiMod)) {
|
|
779
|
+
throw new Error(`Эта модель (${nonChatCap || aiMod}) не предназначена для текстового чата — используйте соответствующий режим в её карточке.`);
|
|
780
|
+
}
|
|
781
|
+
if (!wInsp.hasSafetensors) {
|
|
782
|
+
throw new Error(`Веса модели уже скачаны (формат: ${wInsp.weightFormat || 'other'}), но для локального текстового чата требуются .safetensors + tokenizer.json.`);
|
|
783
|
+
}
|
|
784
|
+
throw new Error('Веса модели (.safetensors) скачаны, но в $ai/#weights отсутствует config.json или tokenizer.json.');
|
|
772
785
|
}
|
|
773
786
|
|
|
774
787
|
throw new Error('Файлы весов модели ещё не скачаны в $ai/#weights (откройте /MODELS/Local для установки).');
|
|
@@ -914,7 +927,7 @@ function assertLocalWeightsReady(ai) {
|
|
|
914
927
|
const wInsp = inspectWeightsDirectorySync(weightsDir);
|
|
915
928
|
if (wInsp.incompatibleOnPlatform)
|
|
916
929
|
throw new Error(wInsp.incompatibleReason);
|
|
917
|
-
if (!wInsp.exists || (!wInsp.hasSafetensors && !wInsp.hasConfig && !hasOnnxModelSync(weightsDir)))
|
|
930
|
+
if (!wInsp.exists || (!wInsp.hasReadyWeights && !wInsp.hasSafetensors && !wInsp.hasConfig && !hasOnnxModelSync(weightsDir)))
|
|
918
931
|
throw new Error('Файлы весов модели ещё не скачаны в $ai/#weights.');
|
|
919
932
|
return weightsDir;
|
|
920
933
|
}
|
|
@@ -962,7 +975,7 @@ export async function localGenerateImage(ai, params = {}) {
|
|
|
962
975
|
const prompt = String(params.prompt || params.post || '').trim();
|
|
963
976
|
if (!prompt)
|
|
964
977
|
throw new Error('generateImage: пустой prompt');
|
|
965
|
-
const isTurbo = /z-image|turbo/i.test(weightsDir) || /z-image|turbo/i.test(String(ai?.model || ai?.id || ''));
|
|
978
|
+
const isTurbo = /z-image|turbo|schnell/i.test(weightsDir) || /z-image|turbo|schnell/i.test(String(ai?.model || ai?.id || ''));
|
|
966
979
|
const defaultSteps = isTurbo ? 4 : 8;
|
|
967
980
|
const res = await runWorkerOp({
|
|
968
981
|
op: 'image',
|
|
@@ -1012,6 +1025,31 @@ export async function localGenerateVideo(ai, params = {}) {
|
|
|
1012
1025
|
};
|
|
1013
1026
|
}
|
|
1014
1027
|
|
|
1028
|
+
export async function localGenerateMusic(ai, params = {}) {
|
|
1029
|
+
const weightsDir = assertLocalWeightsReady(ai);
|
|
1030
|
+
const prompt = String(params.prompt || params.post || '').trim();
|
|
1031
|
+
if (!prompt)
|
|
1032
|
+
throw new Error('generateMusic: пустой prompt');
|
|
1033
|
+
const durationSec = Math.max(2, Math.min(30, Number(params.durationSec || params.duration) || 8));
|
|
1034
|
+
const res = await runWorkerOp({
|
|
1035
|
+
op: 'music',
|
|
1036
|
+
weightsDir,
|
|
1037
|
+
prompt,
|
|
1038
|
+
durationSec,
|
|
1039
|
+
...(params.seed != null ? { seed: Number(params.seed) } : {}),
|
|
1040
|
+
}, 360000);
|
|
1041
|
+
return {
|
|
1042
|
+
mime: res.mime || 'audio/wav',
|
|
1043
|
+
audioBase64: res.audioBase64,
|
|
1044
|
+
sampleRate: Number(res.sampleRate) || 32000,
|
|
1045
|
+
model: String(ai?.model || ai?.id || 'local-music'),
|
|
1046
|
+
device: res.device || '',
|
|
1047
|
+
loadMs: Number(res.loadMs) || 0,
|
|
1048
|
+
genMs: Number(res.genMs || res.durationMs) || 0,
|
|
1049
|
+
durationMs: Number(res.genMs || res.durationMs) || 0,
|
|
1050
|
+
};
|
|
1051
|
+
}
|
|
1052
|
+
|
|
1015
1053
|
export async function localSpeak(ai, params = {}) {
|
|
1016
1054
|
const weightsDir = assertLocalWeightsReady(ai);
|
|
1017
1055
|
const text = String(params.text ?? params.post ?? '').trim().slice(0, 1500);
|
|
@@ -1348,14 +1386,15 @@ export function collectPackagesForAllInstalledModelsSync(rootDir = process.cwd()
|
|
|
1348
1386
|
if (!fs.existsSync(weightsDir))
|
|
1349
1387
|
continue;
|
|
1350
1388
|
const wInsp = inspectWeightsDirectorySync(weightsDir);
|
|
1351
|
-
if (!wInsp.
|
|
1389
|
+
if (!wInsp.hasReadyWeights)
|
|
1352
1390
|
continue;
|
|
1353
1391
|
let mod = '';
|
|
1354
1392
|
const classFile = path.join(aiDir, 'class.js');
|
|
1355
1393
|
if (fs.existsSync(classFile)) {
|
|
1356
1394
|
try {
|
|
1357
1395
|
const raw = fs.readFileSync(classFile, 'utf-8');
|
|
1358
|
-
if (/"
|
|
1396
|
+
if (/"music"/i.test(raw)) mod = 'music';
|
|
1397
|
+
else if (/"tts"/i.test(raw)) mod = 'tts';
|
|
1359
1398
|
else if (/"(stt|asr)"/i.test(raw)) mod = 'stt';
|
|
1360
1399
|
else if (/"video"/i.test(raw)) mod = 'video';
|
|
1361
1400
|
else if (/"(image|text-to-image)"/i.test(raw)) mod = 'image';
|
|
@@ -1366,7 +1405,8 @@ export function collectPackagesForAllInstalledModelsSync(rootDir = process.cwd()
|
|
|
1366
1405
|
}
|
|
1367
1406
|
if (!mod) {
|
|
1368
1407
|
const low = ent.name.toLowerCase();
|
|
1369
|
-
if (low.includes('
|
|
1408
|
+
if (low.includes('musicgen') || low.includes('audioldm')) mod = 'music';
|
|
1409
|
+
else if (low.includes('tts') || low.includes('piper')) mod = 'tts';
|
|
1370
1410
|
else if (low.includes('asr') || low.includes('whisper')) mod = 'stt';
|
|
1371
1411
|
else if (low.includes('video') || low.includes('wan') || low.includes('ltx')) mod = 'video';
|
|
1372
1412
|
else if (low.includes('image') || low.includes('flux') || low.includes('sd')) mod = 'image';
|
|
@@ -1594,6 +1634,7 @@ export const localEngine = Object.freeze({
|
|
|
1594
1634
|
rerank: localRerank,
|
|
1595
1635
|
generateImage: localGenerateImage,
|
|
1596
1636
|
generateVideo: localGenerateVideo,
|
|
1637
|
+
generateMusic: localGenerateMusic,
|
|
1597
1638
|
speak: localSpeak,
|
|
1598
1639
|
transcribe: localTranscribe,
|
|
1599
1640
|
decide: localDecide,
|
|
@@ -1633,6 +1633,85 @@ def handle_tts(req, cache):
|
|
|
1633
1633
|
}
|
|
1634
1634
|
|
|
1635
1635
|
|
|
1636
|
+
def _load_music_pipeline(weights_dir, cache):
|
|
1637
|
+
key = ("music", weights_dir)
|
|
1638
|
+
if key in cache:
|
|
1639
|
+
return cache[key]
|
|
1640
|
+
try:
|
|
1641
|
+
from transformers import AutoProcessor, MusicgenForConditionalGeneration
|
|
1642
|
+
except Exception as e:
|
|
1643
|
+
raise RuntimeError(json.dumps(_missing_pkg_error(e, {"transformers": "transformers"})))
|
|
1644
|
+
device, dtype = _best_device_and_dtype()
|
|
1645
|
+
proc = AutoProcessor.from_pretrained(weights_dir, local_files_only=True)
|
|
1646
|
+
# MusicGen в float16/bfloat16 на ROCm/CUDA заметно быстрее, при сбое — откат на CPU float32
|
|
1647
|
+
load_dtype = dtype if str(device).startswith("cuda") else torch.float32
|
|
1648
|
+
try:
|
|
1649
|
+
mdl = MusicgenForConditionalGeneration.from_pretrained(
|
|
1650
|
+
weights_dir, local_files_only=True, torch_dtype=load_dtype
|
|
1651
|
+
)
|
|
1652
|
+
mdl.to(device)
|
|
1653
|
+
except Exception:
|
|
1654
|
+
if str(device).startswith("cuda") and HAS_TORCH:
|
|
1655
|
+
try:
|
|
1656
|
+
torch.cuda.empty_cache()
|
|
1657
|
+
except Exception:
|
|
1658
|
+
pass
|
|
1659
|
+
device = "cpu"
|
|
1660
|
+
mdl = MusicgenForConditionalGeneration.from_pretrained(
|
|
1661
|
+
weights_dir, local_files_only=True, torch_dtype=torch.float32
|
|
1662
|
+
)
|
|
1663
|
+
mdl.to("cpu")
|
|
1664
|
+
cache[key] = (mdl, proc, device)
|
|
1665
|
+
return cache[key]
|
|
1666
|
+
|
|
1667
|
+
|
|
1668
|
+
def handle_music(req, cache):
|
|
1669
|
+
weights_dir = req["weightsDir"]
|
|
1670
|
+
prompt = str(req.get("prompt", "")).strip() or "upbeat modern ambient corporate piano melody"
|
|
1671
|
+
duration_sec = max(2.0, min(30.0, float(req.get("durationSec") or 8.0)))
|
|
1672
|
+
seed = int(req.get("seed") if req.get("seed") is not None else 42)
|
|
1673
|
+
was_cached = ("music", weights_dir) in cache
|
|
1674
|
+
t_load0 = time.time()
|
|
1675
|
+
mdl, proc, device = _load_music_pipeline(weights_dir, cache)
|
|
1676
|
+
load_ms = 0 if was_cached else int((time.time() - t_load0) * 1000)
|
|
1677
|
+
_seed_torch_deterministic(seed)
|
|
1678
|
+
t_gen0 = time.time()
|
|
1679
|
+
# MusicGen ~50 аудио-токенов на секунду
|
|
1680
|
+
frame_rate = int(getattr(getattr(mdl.config, "audio_encoder", None), "frame_rate", 50) or 50)
|
|
1681
|
+
max_new_tokens = max(50, min(1500, int(duration_sec * frame_rate)))
|
|
1682
|
+
inputs = proc(text=[prompt], padding=True, return_tensors="pt")
|
|
1683
|
+
try:
|
|
1684
|
+
inputs_dev = {k: (v.to(device) if hasattr(v, "to") else v) for k, v in inputs.items()}
|
|
1685
|
+
with torch.inference_mode():
|
|
1686
|
+
audio_values = mdl.generate(**inputs_dev, max_new_tokens=max_new_tokens)
|
|
1687
|
+
except Exception as e:
|
|
1688
|
+
if str(device).startswith("cuda") and _is_recoverable_gpu_error(e):
|
|
1689
|
+
try:
|
|
1690
|
+
torch.cuda.empty_cache()
|
|
1691
|
+
except Exception:
|
|
1692
|
+
pass
|
|
1693
|
+
device = "cpu"
|
|
1694
|
+
mdl = mdl.float().to("cpu")
|
|
1695
|
+
cache[("music", weights_dir)] = (mdl, proc, "cpu")
|
|
1696
|
+
inputs_cpu = {k: (v.to("cpu") if hasattr(v, "to") else v) for k, v in inputs.items()}
|
|
1697
|
+
with torch.inference_mode():
|
|
1698
|
+
audio_values = mdl.generate(**inputs_cpu, max_new_tokens=max_new_tokens)
|
|
1699
|
+
else:
|
|
1700
|
+
raise
|
|
1701
|
+
sr = int(getattr(getattr(mdl.config, "audio_encoder", None), "sampling_rate", 32000) or 32000)
|
|
1702
|
+
wav_tensor = audio_values[0, 0] if getattr(audio_values, "ndim", 0) >= 3 else audio_values[0]
|
|
1703
|
+
gen_ms = max(1, int((time.time() - t_gen0) * 1000))
|
|
1704
|
+
return {
|
|
1705
|
+
"mime": "audio/wav",
|
|
1706
|
+
"audioBase64": _pcm_to_wav_base64(wav_tensor, sr),
|
|
1707
|
+
"sampleRate": sr,
|
|
1708
|
+
"device": _describe_torch_device(device),
|
|
1709
|
+
"loadMs": load_ms,
|
|
1710
|
+
"genMs": gen_ms,
|
|
1711
|
+
"durationMs": gen_ms,
|
|
1712
|
+
}
|
|
1713
|
+
|
|
1714
|
+
|
|
1636
1715
|
def handle_stt(req, cache):
|
|
1637
1716
|
weights_dir = req["weightsDir"]
|
|
1638
1717
|
audio_b64 = req.get("audioBase64", "")
|
|
@@ -1800,7 +1879,7 @@ def _evict_memory_if_needed(
|
|
|
1800
1879
|
def _do():
|
|
1801
1880
|
low_mem = free_gb is not None and free_gb < min_free_gb
|
|
1802
1881
|
for k in list(mod_cache.keys()):
|
|
1803
|
-
if not (isinstance(k, tuple) and len(k) >= 1 and k[0] in ("image", "video")):
|
|
1882
|
+
if not (isinstance(k, tuple) and len(k) >= 1 and k[0] in ("image", "video", "music")):
|
|
1804
1883
|
continue
|
|
1805
1884
|
if k == keep_mod_key:
|
|
1806
1885
|
continue
|
|
@@ -1905,6 +1984,8 @@ def main():
|
|
|
1905
1984
|
needed.extend(["diffusers", "accelerate", "pillow", "transformers", "imageio", "imageio-ffmpeg"])
|
|
1906
1985
|
elif op == "tts":
|
|
1907
1986
|
needed.extend(["qwen-tts", "soundfile", "transformers"])
|
|
1987
|
+
elif op == "music":
|
|
1988
|
+
needed.extend(["transformers", "accelerate", "soundfile"])
|
|
1908
1989
|
elif op == "stt":
|
|
1909
1990
|
needed.extend(["qwen-asr", "soundfile", "transformers"])
|
|
1910
1991
|
print(json.dumps({
|
|
@@ -1914,7 +1995,7 @@ def main():
|
|
|
1914
1995
|
"missingDeps": needed,
|
|
1915
1996
|
}), flush=True)
|
|
1916
1997
|
continue
|
|
1917
|
-
if op in ("embed", "rerank", "image", "video", "tts", "stt"):
|
|
1998
|
+
if op in ("embed", "rerank", "image", "video", "music", "tts", "stt"):
|
|
1918
1999
|
t0 = time.time()
|
|
1919
2000
|
mod_key = (op, str(req.get("weightsDir") or ""))
|
|
1920
2001
|
_evict_memory_if_needed(
|
|
@@ -1926,13 +2007,14 @@ def main():
|
|
|
1926
2007
|
"rerank": handle_rerank,
|
|
1927
2008
|
"image": handle_image,
|
|
1928
2009
|
"video": handle_video,
|
|
2010
|
+
"music": handle_music,
|
|
1929
2011
|
"tts": handle_tts,
|
|
1930
2012
|
"stt": handle_stt,
|
|
1931
2013
|
}[op]
|
|
1932
2014
|
with cache_lock:
|
|
1933
2015
|
res = fn(req, mod_cache)
|
|
1934
2016
|
mod_last_used[mod_key] = time.time()
|
|
1935
|
-
if op in ("image", "video"):
|
|
2017
|
+
if op in ("image", "video", "music"):
|
|
1936
2018
|
_schedule_image_idle_eviction()
|
|
1937
2019
|
if "durationMs" not in res:
|
|
1938
2020
|
res["durationMs"] = int((time.time() - t0) * 1000)
|