@fraziym/axoniz 0.1.0
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/LICENSE +21 -0
- package/README.md +76 -0
- package/dist/agents/definition.d.ts +15 -0
- package/dist/agents/definition.d.ts.map +1 -0
- package/dist/agents/definition.js +41 -0
- package/dist/agents/definition.js.map +1 -0
- package/dist/agents/index.d.ts +12 -0
- package/dist/agents/index.d.ts.map +1 -0
- package/dist/agents/index.js +11 -0
- package/dist/agents/index.js.map +1 -0
- package/dist/agents/registry.d.ts +17 -0
- package/dist/agents/registry.d.ts.map +1 -0
- package/dist/agents/registry.js +23 -0
- package/dist/agents/registry.js.map +1 -0
- package/dist/agents/specialized.d.ts +31 -0
- package/dist/agents/specialized.d.ts.map +1 -0
- package/dist/agents/specialized.js +75 -0
- package/dist/agents/specialized.js.map +1 -0
- package/dist/awareness/index.d.ts +14 -0
- package/dist/awareness/index.d.ts.map +1 -0
- package/dist/awareness/index.js +22 -0
- package/dist/awareness/index.js.map +1 -0
- package/dist/awareness/service.d.ts +180 -0
- package/dist/awareness/service.d.ts.map +1 -0
- package/dist/awareness/service.js +789 -0
- package/dist/awareness/service.js.map +1 -0
- package/dist/cli/entry.d.ts +13 -0
- package/dist/cli/entry.d.ts.map +1 -0
- package/dist/cli/entry.js +35 -0
- package/dist/cli/entry.js.map +1 -0
- package/dist/comms/telegram.d.ts +41 -0
- package/dist/comms/telegram.d.ts.map +1 -0
- package/dist/comms/telegram.js +332 -0
- package/dist/comms/telegram.js.map +1 -0
- package/dist/core/agent.d.ts +252 -0
- package/dist/core/agent.d.ts.map +1 -0
- package/dist/core/agent.js +1399 -0
- package/dist/core/agent.js.map +1 -0
- package/dist/core/auth.d.ts +23 -0
- package/dist/core/auth.d.ts.map +1 -0
- package/dist/core/auth.js +113 -0
- package/dist/core/auth.js.map +1 -0
- package/dist/core/authority.d.ts +118 -0
- package/dist/core/authority.d.ts.map +1 -0
- package/dist/core/authority.js +402 -0
- package/dist/core/authority.js.map +1 -0
- package/dist/core/backend/async_queue.d.ts +17 -0
- package/dist/core/backend/async_queue.d.ts.map +1 -0
- package/dist/core/backend/async_queue.js +66 -0
- package/dist/core/backend/async_queue.js.map +1 -0
- package/dist/core/backend/index.d.ts +24 -0
- package/dist/core/backend/index.d.ts.map +1 -0
- package/dist/core/backend/index.js +128 -0
- package/dist/core/backend/index.js.map +1 -0
- package/dist/core/backend/llama_server.d.ts +39 -0
- package/dist/core/backend/llama_server.d.ts.map +1 -0
- package/dist/core/backend/llama_server.js +182 -0
- package/dist/core/backend/llama_server.js.map +1 -0
- package/dist/core/backend/llamacpp.d.ts +40 -0
- package/dist/core/backend/llamacpp.d.ts.map +1 -0
- package/dist/core/backend/llamacpp.js +200 -0
- package/dist/core/backend/llamacpp.js.map +1 -0
- package/dist/core/backend/lmstudio.d.ts +53 -0
- package/dist/core/backend/lmstudio.d.ts.map +1 -0
- package/dist/core/backend/lmstudio.js +274 -0
- package/dist/core/backend/lmstudio.js.map +1 -0
- package/dist/core/backend/ollama.d.ts +25 -0
- package/dist/core/backend/ollama.d.ts.map +1 -0
- package/dist/core/backend/ollama.js +86 -0
- package/dist/core/backend/ollama.js.map +1 -0
- package/dist/core/backend/openai.d.ts +27 -0
- package/dist/core/backend/openai.d.ts.map +1 -0
- package/dist/core/backend/openai.js +84 -0
- package/dist/core/backend/openai.js.map +1 -0
- package/dist/core/backend/types.d.ts +73 -0
- package/dist/core/backend/types.d.ts.map +1 -0
- package/dist/core/backend/types.js +137 -0
- package/dist/core/backend/types.js.map +1 -0
- package/dist/core/chat_store.d.ts +77 -0
- package/dist/core/chat_store.d.ts.map +1 -0
- package/dist/core/chat_store.js +332 -0
- package/dist/core/chat_store.js.map +1 -0
- package/dist/core/cli.d.ts +82 -0
- package/dist/core/cli.d.ts.map +1 -0
- package/dist/core/cli.js +602 -0
- package/dist/core/cli.js.map +1 -0
- package/dist/core/config.d.ts +127 -0
- package/dist/core/config.d.ts.map +1 -0
- package/dist/core/config.js +295 -0
- package/dist/core/config.js.map +1 -0
- package/dist/core/debug.d.ts +8 -0
- package/dist/core/debug.d.ts.map +1 -0
- package/dist/core/debug.js +8 -0
- package/dist/core/debug.js.map +1 -0
- package/dist/core/downloader.d.ts +31 -0
- package/dist/core/downloader.d.ts.map +1 -0
- package/dist/core/downloader.js +180 -0
- package/dist/core/downloader.js.map +1 -0
- package/dist/core/errors.d.ts +80 -0
- package/dist/core/errors.d.ts.map +1 -0
- package/dist/core/errors.js +134 -0
- package/dist/core/errors.js.map +1 -0
- package/dist/core/extras.d.ts +160 -0
- package/dist/core/extras.d.ts.map +1 -0
- package/dist/core/extras.js +553 -0
- package/dist/core/extras.js.map +1 -0
- package/dist/core/health.d.ts +27 -0
- package/dist/core/health.d.ts.map +1 -0
- package/dist/core/health.js +96 -0
- package/dist/core/health.js.map +1 -0
- package/dist/core/history.d.ts +50 -0
- package/dist/core/history.d.ts.map +1 -0
- package/dist/core/history.js +276 -0
- package/dist/core/history.js.map +1 -0
- package/dist/core/index.d.ts +6 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/index.js +6 -0
- package/dist/core/index.js.map +1 -0
- package/dist/core/intelligence/ast_index.d.ts +255 -0
- package/dist/core/intelligence/ast_index.d.ts.map +1 -0
- package/dist/core/intelligence/ast_index.js +1369 -0
- package/dist/core/intelligence/ast_index.js.map +1 -0
- package/dist/core/intelligence/confidence.d.ts +113 -0
- package/dist/core/intelligence/confidence.d.ts.map +1 -0
- package/dist/core/intelligence/confidence.js +298 -0
- package/dist/core/intelligence/confidence.js.map +1 -0
- package/dist/core/intelligence/context_compressor.d.ts +80 -0
- package/dist/core/intelligence/context_compressor.d.ts.map +1 -0
- package/dist/core/intelligence/context_compressor.js +245 -0
- package/dist/core/intelligence/context_compressor.js.map +1 -0
- package/dist/core/intelligence/daemon.d.ts +247 -0
- package/dist/core/intelligence/daemon.d.ts.map +1 -0
- package/dist/core/intelligence/daemon.js +842 -0
- package/dist/core/intelligence/daemon.js.map +1 -0
- package/dist/core/intelligence/index.d.ts +60 -0
- package/dist/core/intelligence/index.d.ts.map +1 -0
- package/dist/core/intelligence/index.js +101 -0
- package/dist/core/intelligence/index.js.map +1 -0
- package/dist/core/intelligence/predictor.d.ts +246 -0
- package/dist/core/intelligence/predictor.d.ts.map +1 -0
- package/dist/core/intelligence/predictor.js +590 -0
- package/dist/core/intelligence/predictor.js.map +1 -0
- package/dist/core/intelligence/reflex.d.ts +84 -0
- package/dist/core/intelligence/reflex.d.ts.map +1 -0
- package/dist/core/intelligence/reflex.js +344 -0
- package/dist/core/intelligence/reflex.js.map +1 -0
- package/dist/core/intelligence/self_correction.d.ts +121 -0
- package/dist/core/intelligence/self_correction.d.ts.map +1 -0
- package/dist/core/intelligence/self_correction.js +327 -0
- package/dist/core/intelligence/self_correction.js.map +1 -0
- package/dist/core/intelligence/skill_distiller.d.ts +100 -0
- package/dist/core/intelligence/skill_distiller.d.ts.map +1 -0
- package/dist/core/intelligence/skill_distiller.js +246 -0
- package/dist/core/intelligence/skill_distiller.js.map +1 -0
- package/dist/core/intelligence/swarm.d.ts +330 -0
- package/dist/core/intelligence/swarm.d.ts.map +1 -0
- package/dist/core/intelligence/swarm.js +1064 -0
- package/dist/core/intelligence/swarm.js.map +1 -0
- package/dist/core/intelligence/trajectory.d.ts +107 -0
- package/dist/core/intelligence/trajectory.d.ts.map +1 -0
- package/dist/core/intelligence/trajectory.js +330 -0
- package/dist/core/intelligence/trajectory.js.map +1 -0
- package/dist/core/logger.d.ts +111 -0
- package/dist/core/logger.d.ts.map +1 -0
- package/dist/core/logger.js +640 -0
- package/dist/core/logger.js.map +1 -0
- package/dist/core/loop.d.ts +123 -0
- package/dist/core/loop.d.ts.map +1 -0
- package/dist/core/loop.js +423 -0
- package/dist/core/loop.js.map +1 -0
- package/dist/core/memory.d.ts +81 -0
- package/dist/core/memory.d.ts.map +1 -0
- package/dist/core/memory.js +328 -0
- package/dist/core/memory.js.map +1 -0
- package/dist/core/metrics.d.ts +29 -0
- package/dist/core/metrics.d.ts.map +1 -0
- package/dist/core/metrics.js +109 -0
- package/dist/core/metrics.js.map +1 -0
- package/dist/core/models.d.ts +51 -0
- package/dist/core/models.d.ts.map +1 -0
- package/dist/core/models.js +146 -0
- package/dist/core/models.js.map +1 -0
- package/dist/core/optimizer.d.ts +34 -0
- package/dist/core/optimizer.d.ts.map +1 -0
- package/dist/core/optimizer.js +131 -0
- package/dist/core/optimizer.js.map +1 -0
- package/dist/core/persona.d.ts +35 -0
- package/dist/core/persona.d.ts.map +1 -0
- package/dist/core/persona.js +126 -0
- package/dist/core/persona.js.map +1 -0
- package/dist/core/rate_limit.d.ts +23 -0
- package/dist/core/rate_limit.d.ts.map +1 -0
- package/dist/core/rate_limit.js +62 -0
- package/dist/core/rate_limit.js.map +1 -0
- package/dist/core/runner.d.ts +63 -0
- package/dist/core/runner.d.ts.map +1 -0
- package/dist/core/runner.js +671 -0
- package/dist/core/runner.js.map +1 -0
- package/dist/core/stream_parser.d.ts +43 -0
- package/dist/core/stream_parser.d.ts.map +1 -0
- package/dist/core/stream_parser.js +140 -0
- package/dist/core/stream_parser.js.map +1 -0
- package/dist/core/tool_schemas.d.ts +26 -0
- package/dist/core/tool_schemas.d.ts.map +1 -0
- package/dist/core/tool_schemas.js +124 -0
- package/dist/core/tool_schemas.js.map +1 -0
- package/dist/core/which.d.ts +2 -0
- package/dist/core/which.d.ts.map +1 -0
- package/dist/core/which.js +35 -0
- package/dist/core/which.js.map +1 -0
- package/dist/goals/index.d.ts +9 -0
- package/dist/goals/index.d.ts.map +1 -0
- package/dist/goals/index.js +17 -0
- package/dist/goals/index.js.map +1 -0
- package/dist/goals/service.d.ts +115 -0
- package/dist/goals/service.d.ts.map +1 -0
- package/dist/goals/service.js +415 -0
- package/dist/goals/service.js.map +1 -0
- package/dist/goals/types.d.ts +47 -0
- package/dist/goals/types.d.ts.map +1 -0
- package/dist/goals/types.js +66 -0
- package/dist/goals/types.js.map +1 -0
- package/dist/index.d.ts +22 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +22 -0
- package/dist/index.js.map +1 -0
- package/dist/integrations/autonomous_startup.d.ts +51 -0
- package/dist/integrations/autonomous_startup.d.ts.map +1 -0
- package/dist/integrations/autonomous_startup.js +419 -0
- package/dist/integrations/autonomous_startup.js.map +1 -0
- package/dist/integrations/goose.d.ts +105 -0
- package/dist/integrations/goose.d.ts.map +1 -0
- package/dist/integrations/goose.js +408 -0
- package/dist/integrations/goose.js.map +1 -0
- package/dist/integrations/index.d.ts +21 -0
- package/dist/integrations/index.d.ts.map +1 -0
- package/dist/integrations/index.js +17 -0
- package/dist/integrations/index.js.map +1 -0
- package/dist/integrations/mcp.d.ts +73 -0
- package/dist/integrations/mcp.d.ts.map +1 -0
- package/dist/integrations/mcp.js +307 -0
- package/dist/integrations/mcp.js.map +1 -0
- package/dist/integrations/mempalace.d.ts +18 -0
- package/dist/integrations/mempalace.d.ts.map +1 -0
- package/dist/integrations/mempalace.js +25 -0
- package/dist/integrations/mempalace.js.map +1 -0
- package/dist/integrations/multi_agent.d.ts +82 -0
- package/dist/integrations/multi_agent.d.ts.map +1 -0
- package/dist/integrations/multi_agent.js +280 -0
- package/dist/integrations/multi_agent.js.map +1 -0
- package/dist/integrations/unified_memory.d.ts +415 -0
- package/dist/integrations/unified_memory.d.ts.map +1 -0
- package/dist/integrations/unified_memory.js +1489 -0
- package/dist/integrations/unified_memory.js.map +1 -0
- package/dist/roles/beru.yaml +48 -0
- package/dist/sidecar/client.d.ts +63 -0
- package/dist/sidecar/client.d.ts.map +1 -0
- package/dist/sidecar/client.js +222 -0
- package/dist/sidecar/client.js.map +1 -0
- package/dist/sidecar/index.d.ts +7 -0
- package/dist/sidecar/index.d.ts.map +1 -0
- package/dist/sidecar/index.js +6 -0
- package/dist/sidecar/index.js.map +1 -0
- package/dist/startup.d.ts +22 -0
- package/dist/startup.d.ts.map +1 -0
- package/dist/startup.js +194 -0
- package/dist/startup.js.map +1 -0
- package/dist/tools/_internal.d.ts +90 -0
- package/dist/tools/_internal.d.ts.map +1 -0
- package/dist/tools/_internal.js +375 -0
- package/dist/tools/_internal.js.map +1 -0
- package/dist/tools/_smoke.d.ts +2 -0
- package/dist/tools/_smoke.d.ts.map +1 -0
- package/dist/tools/_smoke.js +203 -0
- package/dist/tools/_smoke.js.map +1 -0
- package/dist/tools/axodex_tools.d.ts +51 -0
- package/dist/tools/axodex_tools.d.ts.map +1 -0
- package/dist/tools/axodex_tools.js +181 -0
- package/dist/tools/axodex_tools.js.map +1 -0
- package/dist/tools/code_tools.d.ts +33 -0
- package/dist/tools/code_tools.d.ts.map +1 -0
- package/dist/tools/code_tools.js +191 -0
- package/dist/tools/code_tools.js.map +1 -0
- package/dist/tools/computer_tools.d.ts +59 -0
- package/dist/tools/computer_tools.d.ts.map +1 -0
- package/dist/tools/computer_tools.js +348 -0
- package/dist/tools/computer_tools.js.map +1 -0
- package/dist/tools/file_tools.d.ts +51 -0
- package/dist/tools/file_tools.d.ts.map +1 -0
- package/dist/tools/file_tools.js +424 -0
- package/dist/tools/file_tools.js.map +1 -0
- package/dist/tools/index.d.ts +13 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +13 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/shell_tools.d.ts +39 -0
- package/dist/tools/shell_tools.d.ts.map +1 -0
- package/dist/tools/shell_tools.js +163 -0
- package/dist/tools/shell_tools.js.map +1 -0
- package/dist/tools/web_tools.d.ts +31 -0
- package/dist/tools/web_tools.d.ts.map +1 -0
- package/dist/tools/web_tools.js +117 -0
- package/dist/tools/web_tools.js.map +1 -0
- package/dist/voice/index.d.ts +41 -0
- package/dist/voice/index.d.ts.map +1 -0
- package/dist/voice/index.js +58 -0
- package/dist/voice/index.js.map +1 -0
- package/dist/voice/light_daemon.d.ts +197 -0
- package/dist/voice/light_daemon.d.ts.map +1 -0
- package/dist/voice/light_daemon.js +746 -0
- package/dist/voice/light_daemon.js.map +1 -0
- package/dist/voice/setup.d.ts +63 -0
- package/dist/voice/setup.d.ts.map +1 -0
- package/dist/voice/setup.js +443 -0
- package/dist/voice/setup.js.map +1 -0
- package/dist/voice/stt.d.ts +148 -0
- package/dist/voice/stt.d.ts.map +1 -0
- package/dist/voice/stt.js +361 -0
- package/dist/voice/stt.js.map +1 -0
- package/dist/voice/tts.d.ts +168 -0
- package/dist/voice/tts.d.ts.map +1 -0
- package/dist/voice/tts.js +698 -0
- package/dist/voice/tts.js.map +1 -0
- package/dist/voice/voice_loop.d.ts +101 -0
- package/dist/voice/voice_loop.d.ts.map +1 -0
- package/dist/voice/voice_loop.js +463 -0
- package/dist/voice/voice_loop.js.map +1 -0
- package/dist/voice/wake_word.d.ts +153 -0
- package/dist/voice/wake_word.d.ts.map +1 -0
- package/dist/voice/wake_word.js +458 -0
- package/dist/voice/wake_word.js.map +1 -0
- package/dist/voice/wav.d.ts +99 -0
- package/dist/voice/wav.d.ts.map +1 -0
- package/dist/voice/wav.js +306 -0
- package/dist/voice/wav.js.map +1 -0
- package/dist/web/broker.d.ts +33 -0
- package/dist/web/broker.d.ts.map +1 -0
- package/dist/web/broker.js +58 -0
- package/dist/web/broker.js.map +1 -0
- package/dist/web/open_browser.d.ts +2 -0
- package/dist/web/open_browser.d.ts.map +1 -0
- package/dist/web/open_browser.js +42 -0
- package/dist/web/open_browser.js.map +1 -0
- package/dist/web/server.d.ts +54 -0
- package/dist/web/server.d.ts.map +1 -0
- package/dist/web/server.js +831 -0
- package/dist/web/server.js.map +1 -0
- package/dist/web/static/app.js +4121 -0
- package/dist/web/static/index.html +2281 -0
- package/dist/web/static/js/MODULE_SUMMARY.md +124 -0
- package/dist/web/static/js/a11y.js +165 -0
- package/dist/web/static/js/admin.js +2145 -0
- package/dist/web/static/js/assistant.js +475 -0
- package/dist/web/static/js/calendar/reminders.js +114 -0
- package/dist/web/static/js/calendar/utils.js +166 -0
- package/dist/web/static/js/calendar.js +3348 -0
- package/dist/web/static/js/censor.js +356 -0
- package/dist/web/static/js/chat.js +4546 -0
- package/dist/web/static/js/chatRenderer.js +2294 -0
- package/dist/web/static/js/chatStream.js +276 -0
- package/dist/web/static/js/codeRunner.js +398 -0
- package/dist/web/static/js/color/hex.js +14 -0
- package/dist/web/static/js/colorPicker.js +453 -0
- package/dist/web/static/js/compare/icons.js +77 -0
- package/dist/web/static/js/compare/index.js +1482 -0
- package/dist/web/static/js/compare/models.js +104 -0
- package/dist/web/static/js/compare/panes.js +817 -0
- package/dist/web/static/js/compare/probe.js +78 -0
- package/dist/web/static/js/compare/scoreboard.js +223 -0
- package/dist/web/static/js/compare/selector.js +1335 -0
- package/dist/web/static/js/compare/state.js +58 -0
- package/dist/web/static/js/compare/stream.js +695 -0
- package/dist/web/static/js/compare/vote.js +254 -0
- package/dist/web/static/js/cookbook-diagnosis.js +694 -0
- package/dist/web/static/js/cookbook-hwfit.js +1888 -0
- package/dist/web/static/js/cookbook.js +2093 -0
- package/dist/web/static/js/cookbookDownload.js +633 -0
- package/dist/web/static/js/cookbookProgressSignal.js +29 -0
- package/dist/web/static/js/cookbookRunning.js +3506 -0
- package/dist/web/static/js/cookbookServe.js +2128 -0
- package/dist/web/static/js/document.js +9731 -0
- package/dist/web/static/js/documentLibrary.js +3376 -0
- package/dist/web/static/js/dragSort.js +265 -0
- package/dist/web/static/js/editor/ai-inpaint.js +374 -0
- package/dist/web/static/js/editor/ai-models.js +273 -0
- package/dist/web/static/js/editor/ai-rembg.js +230 -0
- package/dist/web/static/js/editor/ai-tool-runner.js +147 -0
- package/dist/web/static/js/editor/ai-tools-misc.js +216 -0
- package/dist/web/static/js/editor/build/controls.js +366 -0
- package/dist/web/static/js/editor/build/popups.js +112 -0
- package/dist/web/static/js/editor/build/right-panel.js +200 -0
- package/dist/web/static/js/editor/build/toolbar.js +73 -0
- package/dist/web/static/js/editor/build/topbar.js +131 -0
- package/dist/web/static/js/editor/build/transform-popup.js +109 -0
- package/dist/web/static/js/editor/canvas-coords.js +21 -0
- package/dist/web/static/js/editor/canvas-events.js +197 -0
- package/dist/web/static/js/editor/canvas-transforms.js +132 -0
- package/dist/web/static/js/editor/checkerboard.js +24 -0
- package/dist/web/static/js/editor/clipboard-and-drop.js +133 -0
- package/dist/web/static/js/editor/composite-helpers.js +83 -0
- package/dist/web/static/js/editor/filters/blur.js +118 -0
- package/dist/web/static/js/editor/filters/edge-feather.js +70 -0
- package/dist/web/static/js/editor/fx/adj-popup.js +677 -0
- package/dist/web/static/js/editor/fx/filter-string.js +38 -0
- package/dist/web/static/js/editor/fx/histogram.js +67 -0
- package/dist/web/static/js/editor/fx/pixel-pass.js +249 -0
- package/dist/web/static/js/editor/harmonize-masks.js +116 -0
- package/dist/web/static/js/editor/history-panel.js +176 -0
- package/dist/web/static/js/editor/keyboard-shortcuts.js +271 -0
- package/dist/web/static/js/editor/layer-helpers.js +131 -0
- package/dist/web/static/js/editor/layer-panel.js +600 -0
- package/dist/web/static/js/editor/mask-utils.js +91 -0
- package/dist/web/static/js/editor/shortcuts-popover.js +149 -0
- package/dist/web/static/js/editor/slider-ux.js +191 -0
- package/dist/web/static/js/editor/snap.js +107 -0
- package/dist/web/static/js/editor/state.js +257 -0
- package/dist/web/static/js/editor/stroke-pipeline.js +162 -0
- package/dist/web/static/js/editor/stroke-tool-sliders.js +64 -0
- package/dist/web/static/js/editor/tools/clone.js +81 -0
- package/dist/web/static/js/editor/tools/crop.js +137 -0
- package/dist/web/static/js/editor/tools/flood-fill.js +72 -0
- package/dist/web/static/js/editor/tools/lasso-mask.js +171 -0
- package/dist/web/static/js/editor/tools/lasso.js +65 -0
- package/dist/web/static/js/editor/tools/move.js +79 -0
- package/dist/web/static/js/editor/tools/stroke.js +123 -0
- package/dist/web/static/js/editor/tools/transform-drag.js +174 -0
- package/dist/web/static/js/editor/tools/transform-handles.js +271 -0
- package/dist/web/static/js/editor/tools/transform-session.js +381 -0
- package/dist/web/static/js/editor/tools/wand.js +46 -0
- package/dist/web/static/js/editor/wire-import.js +148 -0
- package/dist/web/static/js/editor/wire-inpaint-controls.js +164 -0
- package/dist/web/static/js/editor/wire-merge-buttons.js +103 -0
- package/dist/web/static/js/editor/wire-selection-controls.js +170 -0
- package/dist/web/static/js/editor/wire-topbar-menus.js +174 -0
- package/dist/web/static/js/editor/wire-topbar-overflow.js +49 -0
- package/dist/web/static/js/editor/wire-topbar.js +188 -0
- package/dist/web/static/js/emailInbox.js +1245 -0
- package/dist/web/static/js/emailLibrary/replyRecipients.js +27 -0
- package/dist/web/static/js/emailLibrary/signatureFold.js +339 -0
- package/dist/web/static/js/emailLibrary/state.js +34 -0
- package/dist/web/static/js/emailLibrary/utils.js +202 -0
- package/dist/web/static/js/emailLibrary.js +5217 -0
- package/dist/web/static/js/emojiPicker.js +311 -0
- package/dist/web/static/js/escMenuStack.js +102 -0
- package/dist/web/static/js/fileHandler.js +295 -0
- package/dist/web/static/js/gallery.js +2835 -0
- package/dist/web/static/js/galleryEditor.js +3798 -0
- package/dist/web/static/js/group.js +955 -0
- package/dist/web/static/js/init.js +405 -0
- package/dist/web/static/js/keyboard-shortcuts.js +292 -0
- package/dist/web/static/js/langIcons.js +187 -0
- package/dist/web/static/js/markdown/tableRow.js +19 -0
- package/dist/web/static/js/markdown.js +806 -0
- package/dist/web/static/js/memory.js +1418 -0
- package/dist/web/static/js/modalManager.js +1552 -0
- package/dist/web/static/js/modalSnap.js +782 -0
- package/dist/web/static/js/model/matchKey.js +19 -0
- package/dist/web/static/js/modelPicker.js +695 -0
- package/dist/web/static/js/modelSort.js +33 -0
- package/dist/web/static/js/models.js +642 -0
- package/dist/web/static/js/notes.js +5054 -0
- package/dist/web/static/js/package.json +1 -0
- package/dist/web/static/js/platform.js +47 -0
- package/dist/web/static/js/presets.js +1110 -0
- package/dist/web/static/js/providers.js +93 -0
- package/dist/web/static/js/rag.js +177 -0
- package/dist/web/static/js/research/jobs.js +335 -0
- package/dist/web/static/js/research/panel.js +1233 -0
- package/dist/web/static/js/researchSynapse.js +225 -0
- package/dist/web/static/js/search-chat.js +201 -0
- package/dist/web/static/js/search.js +52 -0
- package/dist/web/static/js/section-management.js +260 -0
- package/dist/web/static/js/sessions.js +3108 -0
- package/dist/web/static/js/settings.js +4991 -0
- package/dist/web/static/js/sidebar-layout.js +573 -0
- package/dist/web/static/js/signature.js +504 -0
- package/dist/web/static/js/skills.js +1908 -0
- package/dist/web/static/js/slashAutocomplete.js +267 -0
- package/dist/web/static/js/slashCommands.js +6099 -0
- package/dist/web/static/js/spinner.js +406 -0
- package/dist/web/static/js/storage.js +123 -0
- package/dist/web/static/js/tasks.js +2699 -0
- package/dist/web/static/js/theme.js +2086 -0
- package/dist/web/static/js/tileManager.js +386 -0
- package/dist/web/static/js/tourAutoplay.js +133 -0
- package/dist/web/static/js/tourHints.js +179 -0
- package/dist/web/static/js/tts-ai.js +521 -0
- package/dist/web/static/js/ui.js +1288 -0
- package/dist/web/static/js/util/ordinal.js +13 -0
- package/dist/web/static/js/voiceRecorder.js +283 -0
- package/dist/web/static/js/windowDrag.js +326 -0
- package/dist/web/static/js/windowResize.js +233 -0
- package/dist/web/static/landing.html +824 -0
- package/dist/web/static/lib/docx.umd.min.js +20116 -0
- package/dist/web/static/lib/highlight.min.js +1213 -0
- package/dist/web/static/lib/html2pdf.bundle.min.js +3 -0
- package/dist/web/static/lib/mammoth.browser.min.js +21 -0
- package/dist/web/static/lib/qrcode.min.js +8 -0
- package/dist/web/static/lib/xlsx.full.min.js +24 -0
- package/dist/web/static/login.html +582 -0
- package/dist/web/static/manifest.json +15 -0
- package/dist/web/static/style.css +35733 -0
- package/dist/web/static/sw.js +144 -0
- package/dist/workflows/engine.d.ts +162 -0
- package/dist/workflows/engine.d.ts.map +1 -0
- package/dist/workflows/engine.js +625 -0
- package/dist/workflows/engine.js.map +1 -0
- package/dist/workflows/index.d.ts +8 -0
- package/dist/workflows/index.d.ts.map +1 -0
- package/dist/workflows/index.js +14 -0
- package/dist/workflows/index.js.map +1 -0
- package/package.json +112 -0
|
@@ -0,0 +1,633 @@
|
|
|
1
|
+
// ============================================
|
|
2
|
+
// COOKBOOK DOWNLOAD SUB-MODULE
|
|
3
|
+
// Download tab: SSE streaming, model download,
|
|
4
|
+
// panel rendering, command building
|
|
5
|
+
// ============================================
|
|
6
|
+
|
|
7
|
+
import uiModule from './ui.js';
|
|
8
|
+
import { _diagnose, _showDiagnosis, _clearDiagnosis } from './cookbook-diagnosis.js';
|
|
9
|
+
|
|
10
|
+
// Shared state/functions injected by init()
|
|
11
|
+
let _envState;
|
|
12
|
+
let _sshCmd;
|
|
13
|
+
let _getPort;
|
|
14
|
+
let _getPlatform;
|
|
15
|
+
let _isWindows;
|
|
16
|
+
let _buildEnvPrefix;
|
|
17
|
+
let _buildServeCmd;
|
|
18
|
+
let _detectBackend;
|
|
19
|
+
let _detectToolParser;
|
|
20
|
+
let _loadPresets;
|
|
21
|
+
let _savePresets;
|
|
22
|
+
let _copyText;
|
|
23
|
+
let _persistEnvState;
|
|
24
|
+
let modelLogo;
|
|
25
|
+
let esc;
|
|
26
|
+
let _addTask;
|
|
27
|
+
let _renderRunningTab;
|
|
28
|
+
let _loadTasks;
|
|
29
|
+
let _saveTasks;
|
|
30
|
+
|
|
31
|
+
// Storage keys
|
|
32
|
+
const SERVE_STATE_KEY = 'cookbook-serve-state';
|
|
33
|
+
|
|
34
|
+
// ── Panel field helpers ──
|
|
35
|
+
|
|
36
|
+
export function _setPanelField(panel, field, value) {
|
|
37
|
+
const input = panel.querySelector(`[data-field="${field}"]`);
|
|
38
|
+
if (!input) return;
|
|
39
|
+
if (input.tagName === 'SELECT') {
|
|
40
|
+
input.value = value;
|
|
41
|
+
} else if (input.type === 'checkbox') {
|
|
42
|
+
input.checked = !!value;
|
|
43
|
+
} else {
|
|
44
|
+
input.value = value;
|
|
45
|
+
}
|
|
46
|
+
input.dispatchEvent(new Event('input', { bubbles: true }));
|
|
47
|
+
input.dispatchEvent(new Event('change', { bubbles: true }));
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export function _setPanelCheckbox(panel, field, checked) {
|
|
51
|
+
const cb = panel.querySelector(`[data-field="${field}"]`);
|
|
52
|
+
if (cb) {
|
|
53
|
+
cb.checked = checked;
|
|
54
|
+
cb.dispatchEvent(new Event('change', { bubbles: true }));
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// ── Command builder: download ──
|
|
59
|
+
|
|
60
|
+
function _firstGgufSource(model) {
|
|
61
|
+
const sources = Array.isArray(model?.gguf_sources) ? model.gguf_sources : [];
|
|
62
|
+
return sources.find(src => src && src.repo) || null;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
function _looksLikeGgufRepo(model) {
|
|
66
|
+
const haystack = `${model?.quant_repo || ''} ${model?.repo_id || ''} ${model?.path || ''} ${model?.name || ''}`.toLowerCase();
|
|
67
|
+
return !!model?.is_gguf || haystack.includes('gguf') || haystack.includes('.gguf');
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
function _ggufDownloadSource(model, backend) {
|
|
71
|
+
if (backend !== 'llamacpp') return null;
|
|
72
|
+
const source = _firstGgufSource(model);
|
|
73
|
+
if (source) return source;
|
|
74
|
+
if (_looksLikeGgufRepo(model)) {
|
|
75
|
+
const repo = model?.quant_repo || model?.repo_id || model?.name;
|
|
76
|
+
if (repo) return { repo };
|
|
77
|
+
}
|
|
78
|
+
return null;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
function _ggufIncludePattern(model, source) {
|
|
82
|
+
if (source?.file) return source.file;
|
|
83
|
+
if (model?.quant) return `*${model.quant}*`;
|
|
84
|
+
return '*.gguf';
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
function _missingGgufMessage(model) {
|
|
88
|
+
const name = model?.name || 'this model';
|
|
89
|
+
if (/\bnvfp4\b/i.test(name)) {
|
|
90
|
+
return `${name} is an NVIDIA NVFP4 checkpoint, not a GGUF download. Pick the base model row with an Unsloth GGUF source, or paste the GGUF repo directly.`;
|
|
91
|
+
}
|
|
92
|
+
return `No GGUF source is configured for ${name}. Pick a model with a GGUF source, or paste the GGUF repo in Download.`;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
function _bashQuote(value) {
|
|
96
|
+
return "'" + String(value ?? '').replace(/'/g, "'\\''") + "'";
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
function _missingGgufCommand(model) {
|
|
100
|
+
const msg = _missingGgufMessage(model);
|
|
101
|
+
if (_isWindows()) {
|
|
102
|
+
return `Write-Error ${JSON.stringify(msg)}; exit 1`;
|
|
103
|
+
}
|
|
104
|
+
return `printf '%s\\n' ${_bashQuote(msg)} >&2; exit 1`;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
export function _buildDownloadCmd(model, backend) {
|
|
108
|
+
let cmd = '';
|
|
109
|
+
if (backend === 'ollama') {
|
|
110
|
+
cmd = `ollama pull ${model.name.split('/').pop().toLowerCase()}`;
|
|
111
|
+
} else {
|
|
112
|
+
const ggufSource = _ggufDownloadSource(model, backend);
|
|
113
|
+
if (backend === 'llamacpp' && !ggufSource) {
|
|
114
|
+
cmd = _missingGgufCommand(model);
|
|
115
|
+
} else {
|
|
116
|
+
const repo = ggufSource?.repo || model.name;
|
|
117
|
+
const includePattern = backend === 'llamacpp' ? _ggufIncludePattern(model, ggufSource) : null;
|
|
118
|
+
const includeArg = includePattern ? `, allow_patterns=["${includePattern.replace(/\\/g, '\\\\').replace(/"/g, '\\"')}"]` : '';
|
|
119
|
+
// Reflect the server's download target in the preview (matches the real
|
|
120
|
+
// download path built server-side). '' = default HF cache.
|
|
121
|
+
const _dlDir = (_envState.servers.find(s => s.host === (_envState.remoteHost || '')) || {}).downloadDir || '';
|
|
122
|
+
const _localDirArg = _dlDir ? `, local_dir=os.path.expanduser('${_dlDir.replace(/\/$/, '')}/${repo.split('/').pop()}')` : '';
|
|
123
|
+
const _py = _isWindows() ? 'python' : 'python3';
|
|
124
|
+
cmd = `${_py} -u -c "
|
|
125
|
+
import sys, time, os
|
|
126
|
+
os.environ['HF_HUB_DISABLE_PROGRESS_BARS']='0'
|
|
127
|
+
os.environ['TQDM_DISABLE']='0'
|
|
128
|
+
_lp={}
|
|
129
|
+
class T:
|
|
130
|
+
def __init__(s,*a,**k):
|
|
131
|
+
s.it=a[0] if a else k.get('iterable');s.total=k.get('total');s.desc=k.get('desc','');s.n=0;s.st=time.time();s._c=False
|
|
132
|
+
if s.it is not None and s.total is None:
|
|
133
|
+
try: s.total=len(s.it)
|
|
134
|
+
except: pass
|
|
135
|
+
def __iter__(s):
|
|
136
|
+
if s.it is None: return
|
|
137
|
+
for i in s.it: yield i; s.update(1)
|
|
138
|
+
def __enter__(s): return s
|
|
139
|
+
def __exit__(s,*a): s.close()
|
|
140
|
+
def __len__(s): return s.total or 0
|
|
141
|
+
def update(s,n=1):
|
|
142
|
+
s.n+=n;t=s.total or 0
|
|
143
|
+
if t==0: return
|
|
144
|
+
now=time.time();k=id(s)
|
|
145
|
+
if now-_lp.get(k,0)<0.5 and s.n<t: return
|
|
146
|
+
_lp[k]=now;p=int(100*s.n/t);e=now-s.st;sp=s.n/e if e>0 else 0;d=(s.desc or '').strip()
|
|
147
|
+
if t>=1073741824: ds=f'{s.n/1073741824:.2f}';ts=f'{t/1073741824:.2f}GB';ss=f'{sp/1048576:.1f}MB/s'
|
|
148
|
+
elif t>=1048576: ds=f'{s.n/1048576:.1f}';ts=f'{t/1048576:.1f}MB';ss=f'{sp/1048576:.1f}MB/s'
|
|
149
|
+
else: ds=str(s.n);ts=str(t);ss=f'{sp:.0f}/s'
|
|
150
|
+
f=int(20*s.n/t);bar='#'*f+'-'*(20-f)
|
|
151
|
+
print(f'FILE {d} [{bar}] {p}% {ds}/{ts} {ss}',flush=True)
|
|
152
|
+
def set_description(s,d=None,refresh=True): s.desc=d or ''
|
|
153
|
+
def set_postfix(s,*a,**k): pass
|
|
154
|
+
def set_postfix_str(s,st='',refresh=True): pass
|
|
155
|
+
def reset(s,total=None): s.n=0;s.total=total if total is not None else s.total;s.st=time.time()
|
|
156
|
+
def refresh(s): pass
|
|
157
|
+
def close(s): s._c=True
|
|
158
|
+
def clear(s): pass
|
|
159
|
+
def display(s,msg=None,pos=None): pass
|
|
160
|
+
@property
|
|
161
|
+
def format_dict(s): return {'n':s.n,'total':s.total,'elapsed':time.time()-s.st}
|
|
162
|
+
import tqdm;tqdm.tqdm=T
|
|
163
|
+
try: import tqdm.auto;tqdm.auto.tqdm=T
|
|
164
|
+
except: pass
|
|
165
|
+
try:
|
|
166
|
+
import huggingface_hub.utils;huggingface_hub.utils.tqdm=T
|
|
167
|
+
if hasattr(huggingface_hub.utils,'_tqdm'): huggingface_hub.utils._tqdm.tqdm=T
|
|
168
|
+
except: pass
|
|
169
|
+
from huggingface_hub import snapshot_download
|
|
170
|
+
repo='${repo}'
|
|
171
|
+
print(f'START {repo}',flush=True)
|
|
172
|
+
try:
|
|
173
|
+
path=snapshot_download(repo${includeArg}${_localDirArg})
|
|
174
|
+
print(f'DONE {path}',flush=True)
|
|
175
|
+
except Exception as e:
|
|
176
|
+
print(f'ERROR {e}',file=sys.stderr,flush=True);sys.exit(1)
|
|
177
|
+
"`;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
const prefix = _buildEnvPrefix();
|
|
181
|
+
let full = prefix ? prefix + ' ' + cmd : cmd;
|
|
182
|
+
if (_envState.remoteHost) {
|
|
183
|
+
full = _sshCmd(_envState.remoteHost, full, _getPort(_envState.remoteHost));
|
|
184
|
+
}
|
|
185
|
+
return full;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
// ── Panel rendering helpers ──
|
|
189
|
+
|
|
190
|
+
function _getPanelFields(panel) {
|
|
191
|
+
const vals = {};
|
|
192
|
+
panel.querySelectorAll('.hwfit-f').forEach(el => {
|
|
193
|
+
const key = el.dataset.field;
|
|
194
|
+
if (!key) return;
|
|
195
|
+
if (el.type === 'checkbox') {
|
|
196
|
+
vals[key] = el.checked;
|
|
197
|
+
} else {
|
|
198
|
+
vals[key] = el.value;
|
|
199
|
+
}
|
|
200
|
+
});
|
|
201
|
+
return vals;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
function _syncEnvFromPanel(panel) {
|
|
205
|
+
const f = _getPanelFields(panel);
|
|
206
|
+
if (f.env_type !== undefined) _envState.env = f.env_type;
|
|
207
|
+
if (f.env_path !== undefined) _envState.envPath = f.env_path;
|
|
208
|
+
if (f.hf_token !== undefined) _envState.hfToken = f.hf_token;
|
|
209
|
+
if (f.gpus !== undefined) _envState.gpus = f.gpus;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
export function _wirePanelEvents(panel, model, backend) {
|
|
213
|
+
// Populate env fields from _envState
|
|
214
|
+
const envFields = {
|
|
215
|
+
env_type: _envState.env || 'none',
|
|
216
|
+
env_path: _envState.envPath || '',
|
|
217
|
+
hf_token: _envState.hfToken || '',
|
|
218
|
+
gpus: _envState.gpus || '',
|
|
219
|
+
};
|
|
220
|
+
for (const [field, val] of Object.entries(envFields)) {
|
|
221
|
+
const el = panel.querySelector(`[data-field="${field}"]`);
|
|
222
|
+
if (el && val) el.value = val;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
// All inputs: update cmd preview + sync env state
|
|
226
|
+
panel.querySelectorAll('.hwfit-f').forEach(input => {
|
|
227
|
+
const evts = input.tagName === 'SELECT' ? ['change'] : ['input', 'change'];
|
|
228
|
+
for (const evt of evts) {
|
|
229
|
+
input.addEventListener(evt, () => {
|
|
230
|
+
_updatePanelCmd(panel, model, backend);
|
|
231
|
+
const f = input.dataset.field;
|
|
232
|
+
if (f === 'env_type') { _envState.env = input.value; _persistEnvState(); }
|
|
233
|
+
else if (f === 'env_path') { _envState.envPath = input.value; _persistEnvState(); }
|
|
234
|
+
else if (f === 'hf_token') { _envState.hfToken = input.value; _persistEnvState(); }
|
|
235
|
+
else if (f === 'gpus') { _envState.gpus = input.value; _persistEnvState(); }
|
|
236
|
+
});
|
|
237
|
+
}
|
|
238
|
+
});
|
|
239
|
+
|
|
240
|
+
// Download button
|
|
241
|
+
const dlBtn = panel.querySelector('.hwfit-dl-btn');
|
|
242
|
+
if (dlBtn) {
|
|
243
|
+
dlBtn.addEventListener('click', () => {
|
|
244
|
+
if (backend === 'ollama') {
|
|
245
|
+
_runPanelCmd(panel, _buildDownloadCmd(model, backend), { timeout: 0 });
|
|
246
|
+
} else {
|
|
247
|
+
_runModelDownload(panel, model, backend);
|
|
248
|
+
}
|
|
249
|
+
});
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
// Stop button
|
|
253
|
+
const stopBtn = panel.querySelector('.hwfit-stop-btn');
|
|
254
|
+
if (stopBtn) {
|
|
255
|
+
stopBtn.addEventListener('click', () => {
|
|
256
|
+
if (panel._cookbookAbort) panel._cookbookAbort.abort();
|
|
257
|
+
});
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
// Kill & close output button
|
|
261
|
+
const killBtn = panel.querySelector('.cookbook-output-kill');
|
|
262
|
+
if (killBtn) {
|
|
263
|
+
killBtn.addEventListener('click', () => {
|
|
264
|
+
if (panel._cookbookAbort) panel._cookbookAbort.abort();
|
|
265
|
+
const outputText = panel.querySelector('.cookbook-output-pre')?.textContent || '';
|
|
266
|
+
const tmuxMatch = outputText.match(/Started tmux session: (cookbook-[a-f0-9]+)/);
|
|
267
|
+
if (tmuxMatch) {
|
|
268
|
+
fetch('/api/shell/exec', {
|
|
269
|
+
method: 'POST',
|
|
270
|
+
credentials: 'same-origin',
|
|
271
|
+
headers: { 'Content-Type': 'application/json' },
|
|
272
|
+
body: JSON.stringify({ command: `tmux kill-session -t ${tmuxMatch[1]} 2>/dev/null` }),
|
|
273
|
+
}).catch(() => {});
|
|
274
|
+
}
|
|
275
|
+
const wrap = panel.querySelector('.cookbook-output-wrap');
|
|
276
|
+
if (wrap) wrap.classList.add('hidden');
|
|
277
|
+
const output = panel.querySelector('.cookbook-output-pre');
|
|
278
|
+
if (output) output.textContent = '';
|
|
279
|
+
_clearDiagnosis(panel);
|
|
280
|
+
});
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
// Copy button
|
|
284
|
+
const copyBtn = panel.querySelector('.hwfit-copy-btn');
|
|
285
|
+
if (copyBtn) {
|
|
286
|
+
copyBtn.addEventListener('click', () => {
|
|
287
|
+
const cmd = panel.querySelector('.hwfit-panel-cmd')?.textContent || '';
|
|
288
|
+
_copyText(cmd).then(() => {
|
|
289
|
+
copyBtn.textContent = 'Copied';
|
|
290
|
+
setTimeout(() => { copyBtn.textContent = 'Copy'; }, 1500);
|
|
291
|
+
});
|
|
292
|
+
});
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
// Save button
|
|
296
|
+
const saveBtn = panel.querySelector('.hwfit-save-btn');
|
|
297
|
+
if (saveBtn) {
|
|
298
|
+
saveBtn.addEventListener('click', () => {
|
|
299
|
+
const shortName = model.name.split('/').pop() || model.name;
|
|
300
|
+
const name = prompt('Preset name:', shortName);
|
|
301
|
+
if (!name) return;
|
|
302
|
+
const fields = _getPanelFields(panel);
|
|
303
|
+
const presets = _loadPresets();
|
|
304
|
+
presets.push({ name, model: model.name, backend, fields });
|
|
305
|
+
_savePresets(presets);
|
|
306
|
+
uiModule.showToast('Preset saved');
|
|
307
|
+
});
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
// Output copy button
|
|
311
|
+
const outputCopyBtn = panel.querySelector('.cookbook-output-copy');
|
|
312
|
+
if (outputCopyBtn) {
|
|
313
|
+
outputCopyBtn.addEventListener('click', (e) => {
|
|
314
|
+
e.stopPropagation();
|
|
315
|
+
const text = panel.querySelector('.cookbook-output-pre')?.textContent || '';
|
|
316
|
+
_copyText(text).then(() => {
|
|
317
|
+
const origHTML = outputCopyBtn.innerHTML;
|
|
318
|
+
outputCopyBtn.innerHTML = '<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><polyline points="20 6 9 17 4 12"/></svg>';
|
|
319
|
+
outputCopyBtn.classList.add('copied');
|
|
320
|
+
setTimeout(() => {
|
|
321
|
+
outputCopyBtn.innerHTML = origHTML;
|
|
322
|
+
outputCopyBtn.classList.remove('copied');
|
|
323
|
+
}, 1500);
|
|
324
|
+
});
|
|
325
|
+
});
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
function _updatePanelCmd(panel, model, backend) {
|
|
330
|
+
const pre = panel.querySelector('.hwfit-panel-cmd');
|
|
331
|
+
if (!pre) return;
|
|
332
|
+
const f = _getPanelFields(panel);
|
|
333
|
+
_syncEnvFromPanel(panel);
|
|
334
|
+
if (backend === 'llamacpp') {
|
|
335
|
+
f._gguf_path = (model.gguf_sources && model.gguf_sources.length)
|
|
336
|
+
? model.gguf_sources[0].file || 'model.gguf'
|
|
337
|
+
: 'model.gguf';
|
|
338
|
+
}
|
|
339
|
+
const cmd = _buildServeCmd(f, model.name, backend);
|
|
340
|
+
const prefix = _buildEnvPrefix();
|
|
341
|
+
let full = prefix ? prefix + ' ' + cmd : cmd;
|
|
342
|
+
if (f.extra && f.extra.trim()) full += ' ' + f.extra.trim();
|
|
343
|
+
if (_envState.remoteHost) full = _sshCmd(_envState.remoteHost, full, _getPort(_envState.remoteHost));
|
|
344
|
+
pre.textContent = full;
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
// ── SSE streaming ──
|
|
348
|
+
|
|
349
|
+
export async function _runPanelCmd(panel, cmd, opts = {}) {
|
|
350
|
+
const outputWrap = panel.querySelector('.cookbook-output-wrap');
|
|
351
|
+
const output = panel.querySelector('.cookbook-output-pre');
|
|
352
|
+
if (outputWrap) outputWrap.classList.remove('hidden');
|
|
353
|
+
output.classList.remove('cookbook-output-error');
|
|
354
|
+
output.textContent = '';
|
|
355
|
+
_clearDiagnosis(panel);
|
|
356
|
+
|
|
357
|
+
const controller = new AbortController();
|
|
358
|
+
panel._cookbookAbort = controller;
|
|
359
|
+
|
|
360
|
+
const serveBtn = panel.querySelector('.hwfit-serve-btn');
|
|
361
|
+
const stopBtn = panel.querySelector('.hwfit-stop-btn');
|
|
362
|
+
if (serveBtn) serveBtn.style.display = 'none';
|
|
363
|
+
if (stopBtn) stopBtn.style.display = '';
|
|
364
|
+
|
|
365
|
+
let fullOutput = '';
|
|
366
|
+
const payload = { command: cmd };
|
|
367
|
+
if (opts.timeout !== undefined) payload.timeout = opts.timeout;
|
|
368
|
+
if (opts.use_pty) payload.use_pty = true;
|
|
369
|
+
if (opts.use_tmux) payload.use_tmux = true;
|
|
370
|
+
|
|
371
|
+
try {
|
|
372
|
+
const res = await fetch('/api/shell/stream', {
|
|
373
|
+
method: 'POST',
|
|
374
|
+
credentials: 'same-origin',
|
|
375
|
+
headers: { 'Content-Type': 'application/json' },
|
|
376
|
+
body: JSON.stringify(payload),
|
|
377
|
+
signal: controller.signal,
|
|
378
|
+
});
|
|
379
|
+
|
|
380
|
+
if (!res.ok) {
|
|
381
|
+
output.classList.add('cookbook-output-error');
|
|
382
|
+
output.textContent = 'HTTP ' + res.status + ': ' + (await res.text());
|
|
383
|
+
return;
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
const reader = res.body.getReader();
|
|
387
|
+
const decoder = new TextDecoder();
|
|
388
|
+
let buf = '';
|
|
389
|
+
let exitCode = null;
|
|
390
|
+
|
|
391
|
+
while (true) {
|
|
392
|
+
const { done, value } = await reader.read();
|
|
393
|
+
if (done) break;
|
|
394
|
+
buf += decoder.decode(value, { stream: true });
|
|
395
|
+
|
|
396
|
+
let idx;
|
|
397
|
+
while ((idx = buf.indexOf('\n\n')) !== -1) {
|
|
398
|
+
const chunk = buf.slice(0, idx);
|
|
399
|
+
buf = buf.slice(idx + 2);
|
|
400
|
+
for (const line of chunk.split('\n')) {
|
|
401
|
+
if (!line.startsWith('data: ')) continue;
|
|
402
|
+
try {
|
|
403
|
+
const ev = JSON.parse(line.slice(6));
|
|
404
|
+
if (ev.data !== undefined) {
|
|
405
|
+
const isProgress = /^FILE .+\d+%/.test(ev.data) || /\d+%\|/.test(ev.data);
|
|
406
|
+
if (isProgress && output.textContent) {
|
|
407
|
+
const lines = output.textContent.split('\n');
|
|
408
|
+
const lastLine = lines[lines.length - 1] || '';
|
|
409
|
+
const curFile = ev.data.match(/^FILE\s+(\S+)/)?.[1];
|
|
410
|
+
const prevFile = lastLine.match(/^FILE\s+(\S+)/)?.[1];
|
|
411
|
+
if (curFile && prevFile && curFile === prevFile) {
|
|
412
|
+
lines[lines.length - 1] = ev.data;
|
|
413
|
+
output.textContent = lines.join('\n');
|
|
414
|
+
} else {
|
|
415
|
+
output.textContent += '\n' + ev.data;
|
|
416
|
+
}
|
|
417
|
+
} else {
|
|
418
|
+
output.textContent += (output.textContent ? '\n' : '') + ev.data;
|
|
419
|
+
}
|
|
420
|
+
output.scrollTop = output.scrollHeight;
|
|
421
|
+
fullOutput += ev.data + '\n';
|
|
422
|
+
const diag = _diagnose(fullOutput);
|
|
423
|
+
if (diag) _showDiagnosis(panel, diag, fullOutput);
|
|
424
|
+
}
|
|
425
|
+
if (ev.exit_code !== undefined) {
|
|
426
|
+
exitCode = ev.exit_code;
|
|
427
|
+
}
|
|
428
|
+
} catch (_) {}
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
if (!output.textContent) output.textContent = '(no output)';
|
|
434
|
+
if (exitCode !== null && exitCode !== 0) {
|
|
435
|
+
output.classList.add('cookbook-output-error');
|
|
436
|
+
const diag = _diagnose(fullOutput);
|
|
437
|
+
if (diag) _showDiagnosis(panel, diag, fullOutput);
|
|
438
|
+
}
|
|
439
|
+
} catch (err) {
|
|
440
|
+
if (err.name === 'AbortError') {
|
|
441
|
+
output.textContent += (output.textContent ? '\n' : '') + '(stopped)';
|
|
442
|
+
} else {
|
|
443
|
+
output.classList.add('cookbook-output-error');
|
|
444
|
+
output.textContent += (output.textContent ? '\n' : '') + 'Request failed: ' + err.message;
|
|
445
|
+
}
|
|
446
|
+
} finally {
|
|
447
|
+
if (serveBtn) serveBtn.style.display = '';
|
|
448
|
+
if (stopBtn) stopBtn.style.display = 'none';
|
|
449
|
+
delete panel._cookbookAbort;
|
|
450
|
+
}
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
// ── Model download (dedicated endpoint, tmux-backed) ──
|
|
454
|
+
|
|
455
|
+
export async function _runModelDownload(panel, model, backend, hostOverride) {
|
|
456
|
+
const ggufSource = _ggufDownloadSource(model, backend);
|
|
457
|
+
if (backend === 'llamacpp' && !ggufSource) {
|
|
458
|
+
uiModule.showToast(_missingGgufMessage(model));
|
|
459
|
+
return;
|
|
460
|
+
}
|
|
461
|
+
const repo = ggufSource?.repo || model.quant_repo || model.name;
|
|
462
|
+
const include = backend === 'llamacpp' ? _ggufIncludePattern(model, ggufSource) : null;
|
|
463
|
+
|
|
464
|
+
_syncEnvFromPanel(panel);
|
|
465
|
+
|
|
466
|
+
// The host is whatever the caller resolved from the dropdown the user picked
|
|
467
|
+
// (passed explicitly as hostOverride). We do NOT trust _envState.remoteHost
|
|
468
|
+
// here: there can be more than one copy of the cookbook state in memory and
|
|
469
|
+
// they disagree on the active host. The servers LIST is consistent, so we look
|
|
470
|
+
// up the matching server to get its env / path / platform / port.
|
|
471
|
+
let host;
|
|
472
|
+
if (hostOverride !== undefined) {
|
|
473
|
+
host = hostOverride || '';
|
|
474
|
+
} else {
|
|
475
|
+
// No explicit host passed: resolve from the visible server dropdown rather
|
|
476
|
+
// than _envState.remoteHost (unreliable — multiple state copies disagree).
|
|
477
|
+
const ssEl = document.getElementById('hwfit-server-select') || document.getElementById('hwfit-dl-server');
|
|
478
|
+
// Dropdown values are host strings now ('local' for local); resolve by host
|
|
479
|
+
// (numeric fallback for any stale value).
|
|
480
|
+
const _ssv = ssEl ? ssEl.value : null;
|
|
481
|
+
const _dsrv = (_ssv && _ssv !== 'local') ? (_envState.servers.find(s => s.host === _ssv) || _envState.servers[parseInt(_ssv)]) : null;
|
|
482
|
+
if (_dsrv) {
|
|
483
|
+
host = _dsrv.host;
|
|
484
|
+
} else if (ssEl && ssEl.value === 'local') {
|
|
485
|
+
host = '';
|
|
486
|
+
} else {
|
|
487
|
+
host = _envState.remoteHost || '';
|
|
488
|
+
}
|
|
489
|
+
}
|
|
490
|
+
const srv = _envState.servers.find(s => s.host === host) || {};
|
|
491
|
+
const env = host ? (srv.env || 'none') : (_envState.env || 'none');
|
|
492
|
+
const envPath = host ? (srv.envPath || '') : (_envState.envPath || '');
|
|
493
|
+
const platform = host ? (srv.platform || '') : (_envState.platform || '');
|
|
494
|
+
const isWin = host ? (platform === 'windows') : _isWindows();
|
|
495
|
+
|
|
496
|
+
const payload = { repo_id: repo };
|
|
497
|
+
if (include) payload.include = include;
|
|
498
|
+
// Large downloads are where hf_transfer most often dies near the end. Use the
|
|
499
|
+
// plain HuggingFace downloader up front for big model files; it is slower, but
|
|
500
|
+
// resumes cached partials more reliably.
|
|
501
|
+
if ((model.required_gb || 0) >= 10 || backend === 'llamacpp') payload.disable_hf_transfer = true;
|
|
502
|
+
if (_envState.hfToken) payload.hf_token = _envState.hfToken;
|
|
503
|
+
if (host) { payload.remote_host = host; const _sp = _getPort(host); if (_sp) payload.ssh_port = _sp; }
|
|
504
|
+
if (platform) payload.platform = platform;
|
|
505
|
+
// If this server has a directory flagged as the download target, send it so
|
|
506
|
+
// the backend downloads into <dir>/<model> instead of the default HF cache.
|
|
507
|
+
if (srv.downloadDir) payload.local_dir = srv.downloadDir;
|
|
508
|
+
if (isWin) {
|
|
509
|
+
if (env === 'venv' && envPath) {
|
|
510
|
+
payload.env_prefix = '& ' + (envPath.endsWith('\\Scripts\\Activate.ps1') ? envPath : envPath + '\\Scripts\\Activate.ps1');
|
|
511
|
+
} else if (env === 'conda' && envPath) {
|
|
512
|
+
payload.env_prefix = 'conda activate ' + envPath;
|
|
513
|
+
}
|
|
514
|
+
} else {
|
|
515
|
+
if (env === 'venv' && envPath) {
|
|
516
|
+
payload.env_prefix = 'source ' + (envPath.endsWith('/bin/activate') ? envPath : envPath + '/bin/activate');
|
|
517
|
+
} else if (env === 'conda' && envPath) {
|
|
518
|
+
payload.env_prefix = 'eval "$(conda shell.bash hook)" && conda activate ' + envPath;
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
const shortName = (model.name || repo).split('/').pop();
|
|
523
|
+
const targetHost = host || 'local';
|
|
524
|
+
|
|
525
|
+
const tasks = _loadTasks();
|
|
526
|
+
const sameDownload = (t) => {
|
|
527
|
+
if (!t || t.type !== 'download') return false;
|
|
528
|
+
const tRepo = t?.payload?.repo_id || t?.repo_id || t?.repo || t?.name || '';
|
|
529
|
+
const tHost = t?.remoteHost || t?.payload?.remote_host || 'local';
|
|
530
|
+
return String(tRepo) === String(payload.repo_id) && String(tHost || 'local') === String(targetHost);
|
|
531
|
+
};
|
|
532
|
+
const duplicate = tasks.find(t => sameDownload(t) && (t.status === 'running' || t.status === 'queued'));
|
|
533
|
+
if (duplicate) {
|
|
534
|
+
_renderRunningTab();
|
|
535
|
+
uiModule.showToast(`${shortName} is already ${duplicate.status === 'queued' ? 'queued' : 'downloading'}`);
|
|
536
|
+
return;
|
|
537
|
+
}
|
|
538
|
+
// Also catch zombie "done" tasks — the cookbook may have lost track of a
|
|
539
|
+
// download (server restart, stale state) while its tmux session is still
|
|
540
|
+
// alive on the host. Probe it; if alive, flip back to running + treat as
|
|
541
|
+
// duplicate so we don't kick off a second concurrent download writing to
|
|
542
|
+
// the same target dir.
|
|
543
|
+
const zombieCandidate = tasks.find(t => sameDownload(t)
|
|
544
|
+
&& ['done', 'error', 'crashed', 'stopped'].includes(t.status)
|
|
545
|
+
&& t.sessionId && !String(t.sessionId).startsWith('queue-'));
|
|
546
|
+
if (zombieCandidate) {
|
|
547
|
+
try {
|
|
548
|
+
const _zh = zombieCandidate.remoteHost || '';
|
|
549
|
+
const _zPort = (_envState.servers || []).find(s => s.host === _zh)?.port;
|
|
550
|
+
const _sshPf = _zh ? `ssh ${_zPort && _zPort !== '22' ? `-p ${_zPort} ` : ''}${_zh} '` : '';
|
|
551
|
+
const _sshSf = _zh ? `'` : '';
|
|
552
|
+
const _probeCmd = `${_sshPf}tmux has-session -t ${zombieCandidate.sessionId} 2>/dev/null${_sshSf}`;
|
|
553
|
+
const _r = await fetch('/api/shell/exec', {
|
|
554
|
+
method: 'POST', credentials: 'same-origin',
|
|
555
|
+
headers: { 'Content-Type': 'application/json' },
|
|
556
|
+
body: JSON.stringify({ command: _probeCmd, timeout: 5 }),
|
|
557
|
+
});
|
|
558
|
+
const _d = await _r.json();
|
|
559
|
+
if (_d.exit_code === 0) {
|
|
560
|
+
// tmux still alive → not actually done. Revive + tell the user.
|
|
561
|
+
const _fresh = _loadTasks();
|
|
562
|
+
const _ft = _fresh.find(t => t.sessionId === zombieCandidate.sessionId);
|
|
563
|
+
if (_ft) {
|
|
564
|
+
_ft.status = 'running';
|
|
565
|
+
_ft._selfHealed = true;
|
|
566
|
+
_saveTasks(_fresh);
|
|
567
|
+
}
|
|
568
|
+
_renderRunningTab();
|
|
569
|
+
uiModule.showToast(`${shortName} is still downloading (was marked finished after a restart — revived)`);
|
|
570
|
+
return;
|
|
571
|
+
}
|
|
572
|
+
} catch { /* probe failed — fall through and let the user launch */ }
|
|
573
|
+
}
|
|
574
|
+
const activeOnHost = tasks.find(t => t.type === 'download' && (t.status === 'running' || t.status === 'queued') && (t.remoteHost || 'local') === targetHost);
|
|
575
|
+
|
|
576
|
+
if (activeOnHost) {
|
|
577
|
+
const queueId = `queue-${Date.now().toString(36)}`;
|
|
578
|
+
const allTasks = _loadTasks();
|
|
579
|
+
allTasks.push({ id: queueId, sessionId: queueId, name: shortName, type: 'download', status: 'queued', output: '', ts: Date.now(), payload, remoteHost: host });
|
|
580
|
+
_saveTasks(allTasks);
|
|
581
|
+
_renderRunningTab();
|
|
582
|
+
uiModule.showToast(`Queued ${shortName} — waiting for current download`);
|
|
583
|
+
return;
|
|
584
|
+
}
|
|
585
|
+
|
|
586
|
+
try {
|
|
587
|
+
const res = await fetch('/api/model/download', {
|
|
588
|
+
method: 'POST',
|
|
589
|
+
credentials: 'same-origin',
|
|
590
|
+
headers: { 'Content-Type': 'application/json' },
|
|
591
|
+
body: JSON.stringify(payload),
|
|
592
|
+
});
|
|
593
|
+
if (!res.ok) {
|
|
594
|
+
// Errors carry actionable text (e.g. "tmux is required …"); keep them up
|
|
595
|
+
// long enough to read, matching the serve path's duration (issue #1355).
|
|
596
|
+
uiModule.showToast('Download failed: HTTP ' + res.status, 9000);
|
|
597
|
+
return;
|
|
598
|
+
}
|
|
599
|
+
const data = await res.json();
|
|
600
|
+
if (!data.ok) {
|
|
601
|
+
uiModule.showToast('Download failed: ' + (data.error || ''), 9000);
|
|
602
|
+
return;
|
|
603
|
+
}
|
|
604
|
+
_addTask(data.session_id, shortName, 'download', payload);
|
|
605
|
+
uiModule.showToast(`Downloading ${shortName}...`);
|
|
606
|
+
} catch (e) {
|
|
607
|
+
uiModule.showToast('Download failed: ' + e.message, 9000);
|
|
608
|
+
}
|
|
609
|
+
}
|
|
610
|
+
|
|
611
|
+
// ── Init ──
|
|
612
|
+
|
|
613
|
+
export function initDownload(shared) {
|
|
614
|
+
_envState = shared._envState;
|
|
615
|
+
_sshCmd = shared._sshCmd;
|
|
616
|
+
_getPort = shared._getPort;
|
|
617
|
+
_getPlatform = shared._getPlatform;
|
|
618
|
+
_isWindows = shared._isWindows;
|
|
619
|
+
_buildEnvPrefix = shared._buildEnvPrefix;
|
|
620
|
+
_buildServeCmd = shared._buildServeCmd;
|
|
621
|
+
_detectBackend = shared._detectBackend;
|
|
622
|
+
_detectToolParser = shared._detectToolParser;
|
|
623
|
+
_loadPresets = shared._loadPresets;
|
|
624
|
+
_savePresets = shared._savePresets;
|
|
625
|
+
_copyText = shared._copyText;
|
|
626
|
+
_persistEnvState = shared._persistEnvState;
|
|
627
|
+
modelLogo = shared.modelLogo;
|
|
628
|
+
esc = shared.esc;
|
|
629
|
+
_addTask = shared._addTask;
|
|
630
|
+
_renderRunningTab = shared._renderRunningTab;
|
|
631
|
+
_loadTasks = shared._loadTasks;
|
|
632
|
+
_saveTasks = shared._saveTasks;
|
|
633
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// static/js/cookbookProgressSignal.js
|
|
2
|
+
/**
|
|
3
|
+
* Liveness signal for a running cookbook download/install. The watchdog treats a
|
|
4
|
+
* task as stalled when this signal stays unchanged for too long, so it must move
|
|
5
|
+
* whenever the task is genuinely making progress.
|
|
6
|
+
*
|
|
7
|
+
* During a model DOWNLOAD the honest signal is the downloaded-byte counter
|
|
8
|
+
* ("1.81G" from "1.81G/2.49G"): it climbs while transferring and freezes when
|
|
9
|
+
* stuck — and unlike a % bar or speed/ETA it doesn't keep animating on a frozen
|
|
10
|
+
* frame. That path is kept exactly as-is.
|
|
11
|
+
*
|
|
12
|
+
* But a dependency install (e.g. vllm) spends long stretches with NO byte
|
|
13
|
+
* counter — pip dependency resolution and the native CUDA build/compile. A
|
|
14
|
+
* byte-only signal freezes there, so the watchdog falsely declares the install
|
|
15
|
+
* stale and restarts it mid-build, looping forever (#1568). When there's no byte
|
|
16
|
+
* counter, fall back to a fingerprint of the output tail: resolver/compile lines
|
|
17
|
+
* keep changing while the process is alive, and only a truly hung process leaves
|
|
18
|
+
* the tail frozen.
|
|
19
|
+
*
|
|
20
|
+
* Pure (string in, string out) so it's unit-testable; cookbookRunning.js pulls
|
|
21
|
+
* in browser-only modules and can't load under node.
|
|
22
|
+
*/
|
|
23
|
+
export function computeProgressSignal(bytes, dlAgg, lastPct, snapshot) {
|
|
24
|
+
if (bytes) return bytes;
|
|
25
|
+
const base = dlAgg != null ? String(dlAgg) : (lastPct || '0');
|
|
26
|
+
// No byte counter → use the output tail so a build/resolve phase that emits new
|
|
27
|
+
// lines counts as progress instead of a false stall (#1568).
|
|
28
|
+
return base + '|' + String(snapshot || '').slice(-300);
|
|
29
|
+
}
|