@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,276 @@
|
|
|
1
|
+
// static/js/chatStream.js
|
|
2
|
+
// SSE event handlers extracted from chat.js handleChatSubmit
|
|
3
|
+
// Handles: ui_control events, background stream management
|
|
4
|
+
|
|
5
|
+
import uiModule from './ui.js';
|
|
6
|
+
import Storage from './storage.js';
|
|
7
|
+
import themeModule from './theme.js';
|
|
8
|
+
import markdownModule from './markdown.js';
|
|
9
|
+
import sessionModule from './sessions.js';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Handle a ui_control SSE event — AI-driven UI manipulation.
|
|
13
|
+
* Extracted from the duplicated ui_control + tool_output.ui_event handlers.
|
|
14
|
+
*/
|
|
15
|
+
export function handleUIControl(uiData) {
|
|
16
|
+
var uiEvent = uiData.ui_event || uiData;
|
|
17
|
+
var esc = uiModule.esc;
|
|
18
|
+
|
|
19
|
+
try {
|
|
20
|
+
if (uiEvent === 'toggle' || uiData.ui_event === 'toggle') {
|
|
21
|
+
var toggleMap = {
|
|
22
|
+
web: 'web-toggle', bash: 'bash-toggle', rag: 'rag-toggle',
|
|
23
|
+
research: 'research-toggle', incognito: 'incognito-toggle',
|
|
24
|
+
};
|
|
25
|
+
var btnMap = {
|
|
26
|
+
web: 'web-toggle-btn', bash: 'bash-toggle-btn', rag: 'rag-indicator-btn',
|
|
27
|
+
};
|
|
28
|
+
var chkId = toggleMap[uiData.toggle_name];
|
|
29
|
+
var btnId = btnMap[uiData.toggle_name];
|
|
30
|
+
if (uiData.toggle_name === 'rag' && window._syncRagIndicator) {
|
|
31
|
+
window._syncRagIndicator(!!uiData.state);
|
|
32
|
+
} else {
|
|
33
|
+
if (chkId) {
|
|
34
|
+
var chk = document.getElementById(chkId);
|
|
35
|
+
if (chk) chk.checked = !!uiData.state;
|
|
36
|
+
}
|
|
37
|
+
if (btnId) {
|
|
38
|
+
var btn = document.getElementById(btnId);
|
|
39
|
+
if (btn) btn.classList.toggle('active', !!uiData.state);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
var ts = Storage.getJSON(Storage.KEYS.TOGGLES, {});
|
|
43
|
+
ts[uiData.toggle_name] = !!uiData.state;
|
|
44
|
+
Storage.setJSON(Storage.KEYS.TOGGLES, ts);
|
|
45
|
+
|
|
46
|
+
} else if (uiEvent === 'set_mode' || uiData.ui_event === 'set_mode') {
|
|
47
|
+
var modeVal = uiData.mode;
|
|
48
|
+
var agentBtn = document.getElementById('mode-agent-btn');
|
|
49
|
+
var chatBtn = document.getElementById('mode-chat-btn');
|
|
50
|
+
if (agentBtn && chatBtn) {
|
|
51
|
+
agentBtn.classList.toggle('active', modeVal === 'agent');
|
|
52
|
+
chatBtn.classList.toggle('active', modeVal !== 'agent');
|
|
53
|
+
}
|
|
54
|
+
var ts2 = Storage.getJSON(Storage.KEYS.TOGGLES, {});
|
|
55
|
+
ts2.mode = modeVal;
|
|
56
|
+
Storage.setJSON(Storage.KEYS.TOGGLES, ts2);
|
|
57
|
+
document.querySelectorAll('[data-mode-tool]').forEach(function(b) {
|
|
58
|
+
b.style.display = modeVal === 'agent' ? '' : 'none';
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
} else if (uiEvent === 'switch_model' || uiData.ui_event === 'switch_model') {
|
|
62
|
+
var modelDisplay = document.querySelector('.current-model-name, #current-model');
|
|
63
|
+
if (modelDisplay) modelDisplay.textContent = uiData.model;
|
|
64
|
+
|
|
65
|
+
} else if (uiEvent === 'set_theme' || uiData.ui_event === 'set_theme') {
|
|
66
|
+
var tm = themeModule;
|
|
67
|
+
if (tm && tm.THEMES && tm.applyColors && tm.save) {
|
|
68
|
+
var themeName = uiData.theme_name;
|
|
69
|
+
if (themeName === 'chatgpt') themeName = 'gpt'; // renamed preset
|
|
70
|
+
var customThemes = tm.getCustomThemes ? tm.getCustomThemes() : {};
|
|
71
|
+
var colors = tm.THEMES[themeName] || customThemes[themeName] || uiData.colors;
|
|
72
|
+
if (colors) {
|
|
73
|
+
tm.applyColors(colors);
|
|
74
|
+
tm.save(themeName, colors);
|
|
75
|
+
var grid = document.getElementById('themeGrid');
|
|
76
|
+
if (grid) {
|
|
77
|
+
grid.querySelectorAll('.theme-swatch').forEach(function(s) { s.classList.remove('active'); });
|
|
78
|
+
var sw = grid.querySelector('[data-theme="' + themeName + '"]');
|
|
79
|
+
if (sw) sw.classList.add('active');
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
} else if (uiEvent === 'create_theme' || uiData.ui_event === 'create_theme') {
|
|
85
|
+
var tm2 = themeModule;
|
|
86
|
+
if (tm2 && tm2.applyColors && tm2.save) {
|
|
87
|
+
var colors2 = uiData.colors;
|
|
88
|
+
var name = uiData.theme_name || 'custom';
|
|
89
|
+
if (colors2) {
|
|
90
|
+
tm2.applyColors(colors2);
|
|
91
|
+
tm2.save(name, colors2);
|
|
92
|
+
// Background effects (animated pattern / frosted glass) the model
|
|
93
|
+
// optionally set — apply them live and persist with the theme so
|
|
94
|
+
// they survive re-applying it later.
|
|
95
|
+
var bg = uiData.bg || null;
|
|
96
|
+
var opts = {};
|
|
97
|
+
if (bg) {
|
|
98
|
+
if (bg.pattern && tm2.applyBgPattern) { tm2.applyBgPattern(bg.pattern); opts.bgPattern = bg.pattern; }
|
|
99
|
+
if (bg.effectColor && tm2.applyBgEffectColor) { tm2.applyBgEffectColor(bg.effectColor); opts.bgEffectColor = bg.effectColor; }
|
|
100
|
+
if (bg.effectIntensity != null && tm2.applyBgEffectIntensity) { tm2.applyBgEffectIntensity(bg.effectIntensity); opts.bgEffectIntensity = bg.effectIntensity; }
|
|
101
|
+
if (bg.effectSize != null && tm2.applyBgEffectSize) { tm2.applyBgEffectSize(bg.effectSize); opts.bgEffectSize = bg.effectSize; }
|
|
102
|
+
if (bg.frosted != null && tm2.applyFrostedGlass) { tm2.applyFrostedGlass(bg.frosted); opts.frosted = bg.frosted; }
|
|
103
|
+
}
|
|
104
|
+
if (tm2.saveCustomTheme) tm2.saveCustomTheme(name, colors2, Object.keys(opts).length ? opts : undefined);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
} else if (uiEvent === 'highlight' || uiData.ui_event === 'highlight') {
|
|
109
|
+
document.querySelectorAll('.zero-highlight').forEach(function(e) { e.classList.remove('zero-highlight'); });
|
|
110
|
+
document.querySelectorAll('.zero-hl-label').forEach(function(e) { e.remove(); });
|
|
111
|
+
var target = document.querySelector(uiData.selector);
|
|
112
|
+
if (target) {
|
|
113
|
+
target.classList.add('zero-highlight');
|
|
114
|
+
target.scrollIntoView({ behavior: 'smooth', block: 'nearest' });
|
|
115
|
+
if (uiData.label) {
|
|
116
|
+
var lbl = document.createElement('div');
|
|
117
|
+
lbl.className = 'zero-hl-label';
|
|
118
|
+
lbl.textContent = uiData.label;
|
|
119
|
+
if (!target.style.position) target.style.position = 'relative';
|
|
120
|
+
target.appendChild(lbl);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
} else if (uiEvent === 'clear_highlight' || uiData.ui_event === 'clear_highlight') {
|
|
125
|
+
document.querySelectorAll('.zero-highlight').forEach(function(e) { e.classList.remove('zero-highlight'); });
|
|
126
|
+
document.querySelectorAll('.zero-hl-label').forEach(function(e) { e.remove(); });
|
|
127
|
+
|
|
128
|
+
} else if (uiEvent === 'research_started' || uiData.ui_event === 'research_started') {
|
|
129
|
+
// Agent kicked off deep research — adopt the session into the
|
|
130
|
+
// sidebar immediately so the user sees it without waiting for
|
|
131
|
+
// the 12s active-poll.
|
|
132
|
+
var rsid = uiData.research_session_id || uiData.session_id;
|
|
133
|
+
if (rsid) {
|
|
134
|
+
import('./research/jobs.js').then(function(mod) {
|
|
135
|
+
var fn = mod.adoptSession || (mod.default && mod.default.adoptSession);
|
|
136
|
+
if (fn) fn(rsid);
|
|
137
|
+
}).catch(function(){});
|
|
138
|
+
// The clickable "Open in Deep Research" link is now emitted by the
|
|
139
|
+
// agent loop as a `#research-<id>` markdown anchor in the assistant's
|
|
140
|
+
// response text — it renders as a regular clickable chat link AND
|
|
141
|
+
// persists across refresh (saved with the message). No ephemeral
|
|
142
|
+
// chip injection needed here anymore.
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
} else if (uiEvent === 'open_panel' || uiData.ui_event === 'open_panel') {
|
|
146
|
+
var panel = uiData.panel;
|
|
147
|
+
if (panel === 'documents') {
|
|
148
|
+
import('./documentLibrary.js').then(function(mod) {
|
|
149
|
+
var fn = mod.openLibrary || (mod.default && mod.default.openLibrary);
|
|
150
|
+
if (fn) fn();
|
|
151
|
+
}).catch(function(){});
|
|
152
|
+
} else if (panel === 'gallery') {
|
|
153
|
+
import('./gallery.js').then(function(mod) {
|
|
154
|
+
var fn = mod.openGallery || (mod.default && mod.default.openGallery);
|
|
155
|
+
if (fn) fn();
|
|
156
|
+
}).catch(function(){});
|
|
157
|
+
} else if (panel === 'email') {
|
|
158
|
+
import('./emailLibrary.js').then(function(mod) {
|
|
159
|
+
var fn = mod.openEmailLibrary || (mod.default && mod.default.openEmailLibrary);
|
|
160
|
+
if (fn) fn();
|
|
161
|
+
}).catch(function(){});
|
|
162
|
+
} else if (panel === 'sessions') {
|
|
163
|
+
import('./sessions.js').then(function(mod) {
|
|
164
|
+
var fn = mod.openLibrary || (mod.default && mod.default.openLibrary);
|
|
165
|
+
if (fn) fn();
|
|
166
|
+
}).catch(function(){});
|
|
167
|
+
} else if (panel === 'cookbook') {
|
|
168
|
+
import('./cookbook.js').then(function(mod) {
|
|
169
|
+
var fn = mod.open || (mod.default && mod.default.open);
|
|
170
|
+
if (fn) fn();
|
|
171
|
+
}).catch(function(){});
|
|
172
|
+
} else if (panel === 'notes') {
|
|
173
|
+
import('./notes.js').then(function(mod) {
|
|
174
|
+
var fn = mod.openPanel || mod.openNotes || (mod.default && (mod.default.openPanel || mod.default.openNotes));
|
|
175
|
+
if (fn) fn();
|
|
176
|
+
}).catch(function(){});
|
|
177
|
+
} else if (panel === 'memories' || panel === 'skills' || panel === 'settings') {
|
|
178
|
+
// These live in the sidebar / settings drawer — most just need
|
|
179
|
+
// an existing button click.
|
|
180
|
+
var ids = { memories: 'tool-memory-btn', skills: 'skills-btn', settings: 'open-settings-btn' };
|
|
181
|
+
var btn = document.getElementById(ids[panel]);
|
|
182
|
+
if (btn) btn.click();
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
} else if (uiEvent === 'open_email_reply' || uiData.ui_event === 'open_email_reply') {
|
|
186
|
+
import('./emailInbox.js').then(function(mod) {
|
|
187
|
+
var fn = mod.openReplyDraft || (mod.default && mod.default.openReplyDraft);
|
|
188
|
+
if (fn) fn(uiData.uid, uiData.folder || 'INBOX', uiData.mode || 'reply');
|
|
189
|
+
}).catch(function(e) {
|
|
190
|
+
console.warn('open_email_reply failed:', e);
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
} catch(e) {
|
|
194
|
+
console.warn('ui_control handler error:', e);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
/**
|
|
199
|
+
* Notify user when a background stream completes.
|
|
200
|
+
*/
|
|
201
|
+
export function notifyStreamComplete(sessionId, query) {
|
|
202
|
+
var isHidden = document.hidden;
|
|
203
|
+
var isOtherSession = sessionModule && sessionModule.getCurrentSessionId() !== sessionId;
|
|
204
|
+
if (!isHidden && !isOtherSession) return;
|
|
205
|
+
if (!('Notification' in window) || Notification.permission !== 'granted') return;
|
|
206
|
+
var body = query ? 'Response to "' + query.substring(0, 60) + '" is ready' : 'Your chat response has completed';
|
|
207
|
+
var notification = new Notification('Response Complete', {
|
|
208
|
+
body: body,
|
|
209
|
+
tag: 'stream-' + sessionId,
|
|
210
|
+
});
|
|
211
|
+
notification.onclick = function() {
|
|
212
|
+
window.focus();
|
|
213
|
+
if (isOtherSession && sessionModule) {
|
|
214
|
+
sessionModule.selectSession(sessionId);
|
|
215
|
+
}
|
|
216
|
+
notification.close();
|
|
217
|
+
};
|
|
218
|
+
setTimeout(function() { notification.close(); }, 10000);
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
/**
|
|
222
|
+
* Insert a clickable in-chat toast when a background stream finishes.
|
|
223
|
+
*/
|
|
224
|
+
export function insertStreamDoneToast(sessionId, query) {
|
|
225
|
+
var box = document.getElementById('chat-history');
|
|
226
|
+
if (!box) return;
|
|
227
|
+
var sessions = sessionModule ? sessionModule.getSessions() : [];
|
|
228
|
+
var sess = sessions.find(function(s) { return s.id === sessionId; });
|
|
229
|
+
var name = sess ? sess.name : 'another session';
|
|
230
|
+
var preview = query ? '"' + query.substring(0, 50) + (query.length > 50 ? '...' : '') + '"' : '';
|
|
231
|
+
var div = document.createElement('div');
|
|
232
|
+
div.className = 'msg msg-system stream-done-toast';
|
|
233
|
+
div.innerHTML = '<div class="body">'
|
|
234
|
+
+ '<span class="stream-done-indicator">●</span>'
|
|
235
|
+
+ '<span>Response ready in <strong>' + (name || 'session').replace(/</g, '<') + '</strong>'
|
|
236
|
+
+ (preview ? ' — ' + preview.replace(/</g, '<') : '')
|
|
237
|
+
+ '</span>'
|
|
238
|
+
+ '</div>';
|
|
239
|
+
div.addEventListener('click', function() {
|
|
240
|
+
if (sessionModule) sessionModule.selectSession(sessionId);
|
|
241
|
+
});
|
|
242
|
+
box.appendChild(div);
|
|
243
|
+
uiModule.scrollHistory();
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
/**
|
|
247
|
+
* Notify when research completes (browser notification).
|
|
248
|
+
*/
|
|
249
|
+
export function notifyResearchComplete(sessionId, query) {
|
|
250
|
+
var isHidden = document.hidden;
|
|
251
|
+
var isOtherSession = sessionModule && sessionModule.getCurrentSessionId() !== sessionId;
|
|
252
|
+
if (!isHidden && !isOtherSession) return;
|
|
253
|
+
if (!('Notification' in window) || Notification.permission !== 'granted') return;
|
|
254
|
+
var body = query ? 'Research on "' + query.substring(0, 60) + '" is ready' : 'Your deep research has completed';
|
|
255
|
+
var notification = new Notification('Research Complete', {
|
|
256
|
+
body: body,
|
|
257
|
+
tag: 'research-' + sessionId,
|
|
258
|
+
});
|
|
259
|
+
notification.onclick = function() {
|
|
260
|
+
window.focus();
|
|
261
|
+
if (isOtherSession && sessionModule) {
|
|
262
|
+
sessionModule.selectSession(sessionId);
|
|
263
|
+
}
|
|
264
|
+
notification.close();
|
|
265
|
+
};
|
|
266
|
+
setTimeout(function() { notification.close(); }, 10000);
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
const chatStream = {
|
|
270
|
+
handleUIControl,
|
|
271
|
+
notifyStreamComplete,
|
|
272
|
+
insertStreamDoneToast,
|
|
273
|
+
notifyResearchComplete,
|
|
274
|
+
};
|
|
275
|
+
|
|
276
|
+
export default chatStream;
|
|
@@ -0,0 +1,398 @@
|
|
|
1
|
+
// static/js/codeRunner.js
|
|
2
|
+
|
|
3
|
+
import * as uiModule from './ui.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* In-browser code runner for Python (Pyodide), JavaScript, and HTML
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
let pyodideInstance = null;
|
|
10
|
+
let pyodideLoading = false;
|
|
11
|
+
const pyodideQueue = [];
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Get or create an output panel below the <pre> element
|
|
15
|
+
*/
|
|
16
|
+
function getOrCreatePanel(pre) {
|
|
17
|
+
let panel = pre.nextElementSibling;
|
|
18
|
+
if (panel && panel.classList.contains('code-runner-output')) {
|
|
19
|
+
panel.innerHTML = '';
|
|
20
|
+
panel.style.display = 'block';
|
|
21
|
+
return panel;
|
|
22
|
+
}
|
|
23
|
+
panel = document.createElement('div');
|
|
24
|
+
panel.className = 'code-runner-output';
|
|
25
|
+
pre.parentNode.insertBefore(panel, pre.nextSibling);
|
|
26
|
+
return panel;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Show a loading message in the panel
|
|
31
|
+
*/
|
|
32
|
+
function showLoading(panel, msg) {
|
|
33
|
+
panel.innerHTML = `<div class="code-runner-loading">${msg}</div>`;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Show output text in the panel
|
|
38
|
+
*/
|
|
39
|
+
function showOutput(panel, text, isError) {
|
|
40
|
+
const el = document.createElement('pre');
|
|
41
|
+
el.className = isError ? 'code-runner-pre code-runner-error' : 'code-runner-pre';
|
|
42
|
+
el.textContent = text;
|
|
43
|
+
panel.innerHTML = '';
|
|
44
|
+
panel.appendChild(el);
|
|
45
|
+
// Copy button — visible labeled pill at the top-right of the panel
|
|
46
|
+
// itself (no separate footer / divider, no tiny icon corner).
|
|
47
|
+
if (text) {
|
|
48
|
+
const cbtn = document.createElement('button');
|
|
49
|
+
cbtn.type = 'button';
|
|
50
|
+
cbtn.className = 'code-runner-copy-inline';
|
|
51
|
+
cbtn.innerHTML = '<svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:-2px;margin-right:4px;"><rect x="9" y="9" width="13" height="13" rx="2"/><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/></svg>Copy';
|
|
52
|
+
cbtn.addEventListener('click', (e) => {
|
|
53
|
+
e.stopPropagation();
|
|
54
|
+
e.preventDefault();
|
|
55
|
+
let ok = false;
|
|
56
|
+
try {
|
|
57
|
+
const ta = document.createElement('textarea');
|
|
58
|
+
ta.value = text;
|
|
59
|
+
ta.style.cssText = 'position:fixed;left:0;top:0;width:1px;height:1px;opacity:0;';
|
|
60
|
+
document.body.appendChild(ta);
|
|
61
|
+
ta.focus();
|
|
62
|
+
ta.select();
|
|
63
|
+
ta.setSelectionRange(0, text.length);
|
|
64
|
+
ok = document.execCommand && document.execCommand('copy');
|
|
65
|
+
ta.remove();
|
|
66
|
+
} catch (_) {}
|
|
67
|
+
if (!ok && navigator.clipboard && window.isSecureContext) {
|
|
68
|
+
navigator.clipboard.writeText(text).then(() => {
|
|
69
|
+
if (uiModule.showToast) uiModule.showToast('Copied');
|
|
70
|
+
cbtn.textContent = 'Copied!';
|
|
71
|
+
setTimeout(() => { cbtn.innerHTML = '<svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:-2px;margin-right:4px;"><rect x="9" y="9" width="13" height="13" rx="2"/><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/></svg>Copy'; }, 1500);
|
|
72
|
+
}).catch(() => { if (uiModule.showToast) uiModule.showToast('Copy failed'); });
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
if (uiModule.showToast) uiModule.showToast(ok ? 'Copied' : 'Copy failed');
|
|
76
|
+
const orig = cbtn.innerHTML;
|
|
77
|
+
cbtn.textContent = ok ? 'Copied!' : 'Copy failed';
|
|
78
|
+
setTimeout(() => { cbtn.innerHTML = orig; }, 1500);
|
|
79
|
+
});
|
|
80
|
+
// Button lives directly in the panel — no wrapping bar. The panel is
|
|
81
|
+
// position:relative so the button can sit absolute-top-right of it.
|
|
82
|
+
panel.appendChild(cbtn);
|
|
83
|
+
}
|
|
84
|
+
if (isError) {
|
|
85
|
+
setTimeout(() => { if (panel) panel.style.display = 'none'; }, 7000);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Legacy absolute-positioned copy button — replaced by the inline bar in
|
|
91
|
+
* showOutput. Kept here as no-op so any earlier callers don't crash.
|
|
92
|
+
*/
|
|
93
|
+
function addCopyBtn_unused(panel, text) {
|
|
94
|
+
if (!text) return;
|
|
95
|
+
const btn = document.createElement('button');
|
|
96
|
+
btn.type = 'button'; // Default <button> type is 'submit' — explicit "button" avoids any accidental form submission.
|
|
97
|
+
btn.className = 'code-runner-copy';
|
|
98
|
+
btn.title = 'Copy output';
|
|
99
|
+
btn.innerHTML = '<svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="9" y="9" width="13" height="13" rx="2"/><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/></svg>';
|
|
100
|
+
btn.addEventListener('click', async (e) => {
|
|
101
|
+
e.stopPropagation();
|
|
102
|
+
e.preventDefault();
|
|
103
|
+
// Synchronous copy via a hidden textarea + execCommand — this is the
|
|
104
|
+
// single most reliable path across browsers / non-secure contexts /
|
|
105
|
+
// mobile Firefox. Run BEFORE any async navigator.clipboard attempt so
|
|
106
|
+
// the user-gesture context is preserved.
|
|
107
|
+
let ok = false;
|
|
108
|
+
try {
|
|
109
|
+
const ta = document.createElement('textarea');
|
|
110
|
+
ta.value = text;
|
|
111
|
+
ta.style.cssText = 'position:fixed;left:0;top:0;width:1px;height:1px;opacity:0;';
|
|
112
|
+
document.body.appendChild(ta);
|
|
113
|
+
ta.focus();
|
|
114
|
+
ta.select();
|
|
115
|
+
ta.setSelectionRange(0, text.length);
|
|
116
|
+
ok = document.execCommand && document.execCommand('copy');
|
|
117
|
+
ta.remove();
|
|
118
|
+
} catch (_) {}
|
|
119
|
+
// As a backup, also try the modern clipboard API (won't hurt if the
|
|
120
|
+
// legacy path already copied).
|
|
121
|
+
if (!ok && navigator.clipboard && window.isSecureContext) {
|
|
122
|
+
try { await navigator.clipboard.writeText(text); ok = true; } catch (_) {}
|
|
123
|
+
}
|
|
124
|
+
if (uiModule && uiModule.showToast) {
|
|
125
|
+
uiModule.showToast(ok ? 'Copied' : 'Copy failed');
|
|
126
|
+
}
|
|
127
|
+
const _orig = btn.innerHTML;
|
|
128
|
+
btn.innerHTML = '<svg width="13" height="13" 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>';
|
|
129
|
+
btn.classList.add('copied');
|
|
130
|
+
setTimeout(() => { btn.innerHTML = _orig; btn.classList.remove('copied'); }, 1500);
|
|
131
|
+
});
|
|
132
|
+
panel.prepend(btn);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* Add a collapse/close button to the panel.
|
|
137
|
+
* Disabled \u2014 the run-output panel is now closed via the unified Code\u2194Run
|
|
138
|
+
* toggle in the editor footer, so a separate X was redundant + cluttered.
|
|
139
|
+
*/
|
|
140
|
+
function addCloseBtn(_panel) { /* no-op */ }
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* Lazy-load Pyodide from CDN
|
|
144
|
+
*/
|
|
145
|
+
function loadPyodide() {
|
|
146
|
+
if (pyodideInstance) return Promise.resolve(pyodideInstance);
|
|
147
|
+
if (pyodideLoading) {
|
|
148
|
+
return new Promise((resolve, reject) => {
|
|
149
|
+
pyodideQueue.push({ resolve, reject });
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
pyodideLoading = true;
|
|
153
|
+
|
|
154
|
+
return new Promise((resolve, reject) => {
|
|
155
|
+
const script = document.createElement('script');
|
|
156
|
+
script.src = 'https://cdn.jsdelivr.net/pyodide/v0.27.5/full/pyodide.js';
|
|
157
|
+
script.onload = () => {
|
|
158
|
+
window.loadPyodide({ indexURL: 'https://cdn.jsdelivr.net/pyodide/v0.27.5/full/' })
|
|
159
|
+
.then(py => {
|
|
160
|
+
pyodideInstance = py;
|
|
161
|
+
pyodideLoading = false;
|
|
162
|
+
pyodideQueue.forEach(q => q.resolve(py));
|
|
163
|
+
pyodideQueue.length = 0;
|
|
164
|
+
resolve(py);
|
|
165
|
+
})
|
|
166
|
+
.catch(err => {
|
|
167
|
+
pyodideLoading = false;
|
|
168
|
+
pyodideQueue.forEach(q => q.reject(err));
|
|
169
|
+
pyodideQueue.length = 0;
|
|
170
|
+
reject(err);
|
|
171
|
+
});
|
|
172
|
+
};
|
|
173
|
+
script.onerror = () => {
|
|
174
|
+
pyodideLoading = false;
|
|
175
|
+
const err = new Error('Failed to load Pyodide');
|
|
176
|
+
pyodideQueue.forEach(q => q.reject(err));
|
|
177
|
+
pyodideQueue.length = 0;
|
|
178
|
+
reject(err);
|
|
179
|
+
};
|
|
180
|
+
document.head.appendChild(script);
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
/**
|
|
185
|
+
* Run Python code via Pyodide
|
|
186
|
+
*/
|
|
187
|
+
export async function runPython(code, panel) {
|
|
188
|
+
showLoading(panel, 'Loading Python runtime (first time ~10 MB)...');
|
|
189
|
+
|
|
190
|
+
let py;
|
|
191
|
+
try {
|
|
192
|
+
py = await loadPyodide();
|
|
193
|
+
} catch (e) {
|
|
194
|
+
showOutput(panel, 'Failed to load Python runtime: ' + e.message, true);
|
|
195
|
+
addCloseBtn(panel);
|
|
196
|
+
return;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
showLoading(panel, 'Running...');
|
|
200
|
+
|
|
201
|
+
const wrapper = `
|
|
202
|
+
import sys, io
|
|
203
|
+
_stdout = io.StringIO()
|
|
204
|
+
_stderr = io.StringIO()
|
|
205
|
+
sys.stdout = _stdout
|
|
206
|
+
sys.stderr = _stderr
|
|
207
|
+
try:
|
|
208
|
+
exec(${JSON.stringify(code)})
|
|
209
|
+
except Exception as _e:
|
|
210
|
+
_stderr.write(str(_e))
|
|
211
|
+
finally:
|
|
212
|
+
sys.stdout = sys.__stdout__
|
|
213
|
+
sys.stderr = sys.__stderr__
|
|
214
|
+
(_stdout.getvalue(), _stderr.getvalue())
|
|
215
|
+
`;
|
|
216
|
+
|
|
217
|
+
try {
|
|
218
|
+
const result = await Promise.race([
|
|
219
|
+
py.runPythonAsync(wrapper),
|
|
220
|
+
new Promise((_, reject) => setTimeout(() => reject(new Error('Execution timed out (10 s)')), 10000))
|
|
221
|
+
]);
|
|
222
|
+
|
|
223
|
+
const stdout = result.toJs ? result.toJs()[0] : (result[0] || '');
|
|
224
|
+
const stderr = result.toJs ? result.toJs()[1] : (result[1] || '');
|
|
225
|
+
if (result.destroy) result.destroy();
|
|
226
|
+
|
|
227
|
+
panel.innerHTML = '';
|
|
228
|
+
if (stderr) {
|
|
229
|
+
showOutput(panel, stderr, true);
|
|
230
|
+
} else if (stdout) {
|
|
231
|
+
showOutput(panel, stdout, false);
|
|
232
|
+
} else {
|
|
233
|
+
showOutput(panel, '(no output)', false);
|
|
234
|
+
}
|
|
235
|
+
} catch (e) {
|
|
236
|
+
showOutput(panel, e.message, true);
|
|
237
|
+
}
|
|
238
|
+
addCloseBtn(panel);
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
/**
|
|
242
|
+
* Run JavaScript code in a sandboxed iframe
|
|
243
|
+
*/
|
|
244
|
+
export function runJavaScript(code, panel) {
|
|
245
|
+
showLoading(panel, 'Running...');
|
|
246
|
+
|
|
247
|
+
const iframe = document.createElement('iframe');
|
|
248
|
+
iframe.style.display = 'none';
|
|
249
|
+
iframe.sandbox = 'allow-scripts';
|
|
250
|
+
document.body.appendChild(iframe);
|
|
251
|
+
|
|
252
|
+
let settled = false;
|
|
253
|
+
const cleanup = () => {
|
|
254
|
+
if (iframe.parentNode) iframe.remove();
|
|
255
|
+
};
|
|
256
|
+
|
|
257
|
+
const failsafe = setTimeout(() => {
|
|
258
|
+
if (!settled) {
|
|
259
|
+
settled = true;
|
|
260
|
+
showOutput(panel, 'Execution timed out (10 s)', true);
|
|
261
|
+
addCloseBtn(panel);
|
|
262
|
+
cleanup();
|
|
263
|
+
}
|
|
264
|
+
}, 15000);
|
|
265
|
+
|
|
266
|
+
const onMessage = (e) => {
|
|
267
|
+
if (e.source !== iframe.contentWindow) return;
|
|
268
|
+
if (settled) return;
|
|
269
|
+
settled = true;
|
|
270
|
+
clearTimeout(failsafe);
|
|
271
|
+
window.removeEventListener('message', onMessage);
|
|
272
|
+
|
|
273
|
+
const data = e.data;
|
|
274
|
+
panel.innerHTML = '';
|
|
275
|
+
if (data.error) {
|
|
276
|
+
showOutput(panel, data.error, true);
|
|
277
|
+
} else if (data.logs && data.logs.length > 0) {
|
|
278
|
+
showOutput(panel, data.logs.join('\n'), false);
|
|
279
|
+
} else {
|
|
280
|
+
showOutput(panel, '(no output)', false);
|
|
281
|
+
}
|
|
282
|
+
addCloseBtn(panel);
|
|
283
|
+
cleanup();
|
|
284
|
+
};
|
|
285
|
+
|
|
286
|
+
window.addEventListener('message', onMessage);
|
|
287
|
+
|
|
288
|
+
const wrappedCode = `
|
|
289
|
+
<!DOCTYPE html><html><body><script>
|
|
290
|
+
var _logs = [];
|
|
291
|
+
var _origLog = console.log;
|
|
292
|
+
console.log = function() { _logs.push([].map.call(arguments, function(a) { try { return typeof a === 'object' ? JSON.stringify(a) : String(a); } catch(e) { return String(a); } }).join(' ')); };
|
|
293
|
+
console.warn = function() { _logs.push('[warn] ' + [].map.call(arguments, String).join(' ')); };
|
|
294
|
+
console.error = function() { _logs.push('[error] ' + [].map.call(arguments, String).join(' ')); };
|
|
295
|
+
try {
|
|
296
|
+
var _timer = setTimeout(function() { parent.postMessage({error:'Execution timed out (10 s)'},'*'); }, 10000);
|
|
297
|
+
${code.replace(/<\/script>/gi, '<\\/script>')}
|
|
298
|
+
clearTimeout(_timer);
|
|
299
|
+
parent.postMessage({logs: _logs}, '*');
|
|
300
|
+
} catch(e) {
|
|
301
|
+
parent.postMessage({error: e.toString()}, '*');
|
|
302
|
+
}
|
|
303
|
+
<\/script></body></html>`;
|
|
304
|
+
|
|
305
|
+
iframe.srcdoc = wrappedCode;
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
/**
|
|
309
|
+
* Run code server-side via POST /api/shell/exec
|
|
310
|
+
*/
|
|
311
|
+
export async function runServer(code, panel, lang) {
|
|
312
|
+
showLoading(panel, 'Running on server...');
|
|
313
|
+
var command;
|
|
314
|
+
if (lang === 'python' || lang === 'py') {
|
|
315
|
+
command = 'python3 -c ' + JSON.stringify(code);
|
|
316
|
+
} else {
|
|
317
|
+
command = 'bash -c ' + JSON.stringify(code);
|
|
318
|
+
}
|
|
319
|
+
try {
|
|
320
|
+
var res = await fetch('/api/shell/exec', {
|
|
321
|
+
method: 'POST',
|
|
322
|
+
credentials: 'same-origin',
|
|
323
|
+
headers: { 'Content-Type': 'application/json' },
|
|
324
|
+
body: JSON.stringify({ command: command }),
|
|
325
|
+
});
|
|
326
|
+
var data = await res.json();
|
|
327
|
+
panel.innerHTML = '';
|
|
328
|
+
if (data.stderr && data.stderr.trim()) {
|
|
329
|
+
showOutput(panel, data.stderr, true);
|
|
330
|
+
if (data.stdout && data.stdout.trim()) {
|
|
331
|
+
var stdoutEl = document.createElement('pre');
|
|
332
|
+
stdoutEl.className = 'code-runner-pre';
|
|
333
|
+
stdoutEl.textContent = data.stdout;
|
|
334
|
+
panel.appendChild(stdoutEl);
|
|
335
|
+
}
|
|
336
|
+
} else if (data.stdout && data.stdout.trim()) {
|
|
337
|
+
showOutput(panel, data.stdout, false);
|
|
338
|
+
} else {
|
|
339
|
+
showOutput(panel, '(no output)' + (data.exit_code ? ' — exit code ' + data.exit_code : ''), !data.exit_code ? false : true);
|
|
340
|
+
}
|
|
341
|
+
if (data.exit_code && data.exit_code !== 0) {
|
|
342
|
+
var exitEl = document.createElement('div');
|
|
343
|
+
exitEl.style.cssText = 'font-size:0.75rem;opacity:0.5;padding:2px 8px;';
|
|
344
|
+
exitEl.textContent = 'Exit code: ' + data.exit_code;
|
|
345
|
+
panel.appendChild(exitEl);
|
|
346
|
+
}
|
|
347
|
+
} catch (e) {
|
|
348
|
+
showOutput(panel, 'Execution failed: ' + e.message, true);
|
|
349
|
+
}
|
|
350
|
+
addCloseBtn(panel);
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
/**
|
|
354
|
+
* Run HTML code in its own popup window
|
|
355
|
+
*/
|
|
356
|
+
export function runHTML(code, panel) {
|
|
357
|
+
panel.innerHTML = '';
|
|
358
|
+
|
|
359
|
+
const win = window.open('', '_blank', 'width=800,height=600,menubar=no,toolbar=no,location=no,status=no');
|
|
360
|
+
if (!win) {
|
|
361
|
+
showOutput(panel, 'Popup blocked — please allow popups for this site.', true);
|
|
362
|
+
addCloseBtn(panel);
|
|
363
|
+
return;
|
|
364
|
+
}
|
|
365
|
+
win.document.open();
|
|
366
|
+
win.document.write(code);
|
|
367
|
+
win.document.close();
|
|
368
|
+
|
|
369
|
+
showOutput(panel, 'Opened in new window', false);
|
|
370
|
+
addCloseBtn(panel);
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
/**
|
|
374
|
+
* Main entry point — called when a Run button is clicked
|
|
375
|
+
*/
|
|
376
|
+
export function run(btn) {
|
|
377
|
+
const code = btn.getAttribute('data-code');
|
|
378
|
+
const lang = (btn.getAttribute('data-lang') || '').toLowerCase();
|
|
379
|
+
if (!code) return;
|
|
380
|
+
|
|
381
|
+
const pre = btn.closest('pre');
|
|
382
|
+
if (!pre) return;
|
|
383
|
+
|
|
384
|
+
const panel = getOrCreatePanel(pre);
|
|
385
|
+
|
|
386
|
+
if (lang === 'bash' || lang === 'sh' || lang === 'shell' || lang === 'zsh') {
|
|
387
|
+
runServer(code, panel, 'bash');
|
|
388
|
+
} else if (lang === 'python' || lang === 'py') {
|
|
389
|
+
runServer(code, panel, 'python');
|
|
390
|
+
} else if (lang === 'javascript' || lang === 'js') {
|
|
391
|
+
runJavaScript(code, panel);
|
|
392
|
+
} else if (lang === 'html') {
|
|
393
|
+
runHTML(code, panel);
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
const codeRunnerModule = { run, runPython, runJavaScript, runHTML, runServer };
|
|
398
|
+
export default codeRunnerModule;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// static/js/color/hex.js
|
|
2
|
+
//
|
|
3
|
+
// Parse a CSS hex color into {r, g, b}. Pure — no DOM — so it can be reused
|
|
4
|
+
// across modules and unit-tested under node.
|
|
5
|
+
|
|
6
|
+
// Accepts "#rgb", "#rrggbb" (with or without the leading '#'). Returns null
|
|
7
|
+
// for anything that isn't a valid 3- or 6-digit hex color.
|
|
8
|
+
export function hexToRgb(hex) {
|
|
9
|
+
let h = String(hex || '').trim().replace(/^#/, '');
|
|
10
|
+
if (h.length === 3) h = h.split('').map((c) => c + c).join('');
|
|
11
|
+
if (!/^[0-9a-fA-F]{6}$/.test(h)) return null;
|
|
12
|
+
const n = parseInt(h, 16);
|
|
13
|
+
return { r: (n >> 16) & 255, g: (n >> 8) & 255, b: n & 255 };
|
|
14
|
+
}
|