@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,402 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AXONIZ Authority Engine — Action gating and auditing.
|
|
3
|
+
* Ensures that all autonomous actions are within permitted bounds.
|
|
4
|
+
*
|
|
5
|
+
* Port of axoniz/core/authority.py
|
|
6
|
+
*
|
|
7
|
+
* Port notes:
|
|
8
|
+
* - `threading.Lock` around `check()` is dropped: the JS event loop is
|
|
9
|
+
* single-threaded and `check()` is fully synchronous (no awaits), so the
|
|
10
|
+
* critical section cannot be interleaved. This is the documented
|
|
11
|
+
* "trivial async mutex only where genuinely needed" case — it is not needed.
|
|
12
|
+
* - `ApprovalDelivery.resolve()` / `setApprovalCallback()` are additive: the
|
|
13
|
+
* Python `ApprovalDelivery` only has `ask()`/`timeout`, yet
|
|
14
|
+
* `axoniz/comms/telegram.py` calls `bot.set_approval_callback(
|
|
15
|
+
* get_engine().delivery.resolve)`. The hook is provided here so the ported
|
|
16
|
+
* Telegram bridge can wire a real approval channel without losing the
|
|
17
|
+
* faithful `ask()` semantics.
|
|
18
|
+
*/
|
|
19
|
+
import fs from "node:fs";
|
|
20
|
+
import { getLogger } from "./logger.js";
|
|
21
|
+
const logger = getLogger();
|
|
22
|
+
/* ── AuthLevel ────────────────────────────────────────────────────────────── */
|
|
23
|
+
/**
|
|
24
|
+
* Numeric authority levels. Mirrors the Python `IntEnum`, including the
|
|
25
|
+
* duplicate-valued test aliases (`AUTONOMOUS`/`LOG_ONLY` = 1, `SOFT_GATE` = 2,
|
|
26
|
+
* `REQUIRE_APPROVAL` = 4).
|
|
27
|
+
*
|
|
28
|
+
* Implemented as a frozen const object + union type instead of a TS `enum` so
|
|
29
|
+
* the module stays fully erasable (runnable by Node's type-stripping test
|
|
30
|
+
* runner as well as by tsc).
|
|
31
|
+
*/
|
|
32
|
+
export const AuthLevel = {
|
|
33
|
+
SAFE: 0,
|
|
34
|
+
READ: 1,
|
|
35
|
+
WRITE: 2,
|
|
36
|
+
EXECUTE: 3,
|
|
37
|
+
SYSTEM: 4,
|
|
38
|
+
DANGEROUS: 5,
|
|
39
|
+
/* Aliases for tests / other modules */
|
|
40
|
+
AUTONOMOUS: 1,
|
|
41
|
+
LOG_ONLY: 1,
|
|
42
|
+
SOFT_GATE: 2,
|
|
43
|
+
REQUIRE_APPROVAL: 4,
|
|
44
|
+
};
|
|
45
|
+
/** Coerce an arbitrary number to a valid AuthLevel (mirrors `AuthLevel(x)`). */
|
|
46
|
+
export function toAuthLevel(value) {
|
|
47
|
+
if (!Number.isInteger(value) || value < 0 || value > 5) {
|
|
48
|
+
throw new Error(`${value} is not a valid AuthLevel`);
|
|
49
|
+
}
|
|
50
|
+
return value;
|
|
51
|
+
}
|
|
52
|
+
/* ── Decision ─────────────────────────────────────────────────────────────── */
|
|
53
|
+
/** Mirrors the `Decision` dataclass (including the extra `id` set by `check`). */
|
|
54
|
+
export class Decision {
|
|
55
|
+
approved;
|
|
56
|
+
reason;
|
|
57
|
+
/** Authority level the action was classified at. */
|
|
58
|
+
level;
|
|
59
|
+
decision_id;
|
|
60
|
+
id = 0;
|
|
61
|
+
constructor(approved, reason, level, decisionId = "") {
|
|
62
|
+
this.approved = approved;
|
|
63
|
+
this.reason = reason;
|
|
64
|
+
this.level = level;
|
|
65
|
+
this.decision_id = decisionId;
|
|
66
|
+
}
|
|
67
|
+
toJSON() {
|
|
68
|
+
return {
|
|
69
|
+
approved: this.approved,
|
|
70
|
+
reason: this.reason,
|
|
71
|
+
level: this.level,
|
|
72
|
+
decision_id: this.decision_id,
|
|
73
|
+
id: this.id,
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
/* ── Escalation rules (hardcoded safety overrides) ────────────────────────── */
|
|
78
|
+
const PATH_ESCALATIONS = ["data/", "etc/", "var/", "system32", ".env", ".git", "audit.jsonl"];
|
|
79
|
+
const COMMAND_ESCALATIONS = ["rm ", "del ", "format ", "mkfs", "> /dev/", "shadow_monarch"];
|
|
80
|
+
/**
|
|
81
|
+
* Return 0 (SAFE) if no escalation is needed; otherwise the minimum level the
|
|
82
|
+
* action must be raised to. Only ever upgrades a level.
|
|
83
|
+
*/
|
|
84
|
+
export function _escalate_check(toolName, args) {
|
|
85
|
+
// Path escalation
|
|
86
|
+
if (["file_write", "file_edit", "file_delete", "file_append"].includes(toolName)) {
|
|
87
|
+
const p = String(args["path"] ?? "")
|
|
88
|
+
.toLowerCase()
|
|
89
|
+
.replace(/\\/g, "/");
|
|
90
|
+
if (PATH_ESCALATIONS.some((x) => p.includes(x))) {
|
|
91
|
+
return AuthLevel.REQUIRE_APPROVAL;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
// Command escalation
|
|
95
|
+
if (["shell_run", "shell_python"].includes(toolName)) {
|
|
96
|
+
const cmd = String(args["command"] ?? "").toLowerCase();
|
|
97
|
+
if (COMMAND_ESCALATIONS.some((x) => cmd.includes(x))) {
|
|
98
|
+
return AuthLevel.REQUIRE_APPROVAL;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
return 0;
|
|
102
|
+
}
|
|
103
|
+
/** camelCase alias. */
|
|
104
|
+
export const escalateCheck = _escalate_check;
|
|
105
|
+
/* ── AuditTrail ───────────────────────────────────────────────────────────── */
|
|
106
|
+
export class AuditTrail {
|
|
107
|
+
path;
|
|
108
|
+
constructor(path, dbPath) {
|
|
109
|
+
this.path = path || dbPath || "audit.jsonl";
|
|
110
|
+
}
|
|
111
|
+
/** Append one JSON line. Failures are swallowed (Python bare `except`). */
|
|
112
|
+
log(entry) {
|
|
113
|
+
try {
|
|
114
|
+
fs.appendFileSync(this.path, `${JSON.stringify(entry)}\n`, "utf-8");
|
|
115
|
+
}
|
|
116
|
+
catch {
|
|
117
|
+
/* best effort */
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
/** Record a gated action (exact Python field set + ordering). */
|
|
121
|
+
record(tool, args, level, approved, reason) {
|
|
122
|
+
this.log({
|
|
123
|
+
tool,
|
|
124
|
+
args,
|
|
125
|
+
level: Math.trunc(level),
|
|
126
|
+
approved,
|
|
127
|
+
reason,
|
|
128
|
+
timestamp: Date.now() / 1000,
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
/** Last `n` parsed entries (empty list when missing/corrupt). */
|
|
132
|
+
recent(n = 10) {
|
|
133
|
+
if (!fs.existsSync(this.path))
|
|
134
|
+
return [];
|
|
135
|
+
try {
|
|
136
|
+
const lines = fs.readFileSync(this.path, "utf-8").split(/\r?\n/).filter((l) => l.length > 0);
|
|
137
|
+
return lines.slice(-n).map((l) => JSON.parse(l));
|
|
138
|
+
}
|
|
139
|
+
catch {
|
|
140
|
+
return [];
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
stats() {
|
|
144
|
+
let rows = [];
|
|
145
|
+
if (fs.existsSync(this.path)) {
|
|
146
|
+
try {
|
|
147
|
+
rows = fs
|
|
148
|
+
.readFileSync(this.path, "utf-8")
|
|
149
|
+
.split(/\r?\n/)
|
|
150
|
+
.filter((l) => l.length > 0)
|
|
151
|
+
.map((l) => JSON.parse(l));
|
|
152
|
+
}
|
|
153
|
+
catch {
|
|
154
|
+
/* Python swallows and keeps rows = [] */
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
return {
|
|
158
|
+
total_actions: rows.length,
|
|
159
|
+
blocked_actions: rows.filter((r) => !(r["approved"] ?? true)).length,
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
/* ── ApprovalLearner ──────────────────────────────────────────────────────── */
|
|
164
|
+
export class ApprovalLearner {
|
|
165
|
+
approvals = new Map();
|
|
166
|
+
denials = new Map();
|
|
167
|
+
is_auto_approved(tool) {
|
|
168
|
+
return (this.approvals.get(tool) ?? 0) >= 3 && (this.denials.get(tool) ?? 0) === 0;
|
|
169
|
+
}
|
|
170
|
+
record_approval(tool) {
|
|
171
|
+
this.approvals.set(tool, (this.approvals.get(tool) ?? 0) + 1);
|
|
172
|
+
this.denials.set(tool, 0);
|
|
173
|
+
}
|
|
174
|
+
record_denial(tool) {
|
|
175
|
+
this.denials.set(tool, (this.denials.get(tool) ?? 0) + 1);
|
|
176
|
+
this.approvals.set(tool, 0);
|
|
177
|
+
}
|
|
178
|
+
/* camelCase aliases */
|
|
179
|
+
isAutoApproved(tool) {
|
|
180
|
+
return this.is_auto_approved(tool);
|
|
181
|
+
}
|
|
182
|
+
recordApproval(tool) {
|
|
183
|
+
this.record_approval(tool);
|
|
184
|
+
}
|
|
185
|
+
recordDenial(tool) {
|
|
186
|
+
this.record_denial(tool);
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
export class ApprovalDelivery {
|
|
190
|
+
timeout;
|
|
191
|
+
/** Optional synchronous approval channel wired in by a CLI/Telegram bridge. */
|
|
192
|
+
callback = null;
|
|
193
|
+
pending = null;
|
|
194
|
+
constructor(timeout = 30.0) {
|
|
195
|
+
this.timeout = timeout;
|
|
196
|
+
}
|
|
197
|
+
/** Additive: install a synchronous approval channel. */
|
|
198
|
+
setApprovalCallback(cb) {
|
|
199
|
+
this.callback = cb;
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* Additive: resolve the approval that `askAsync()` is currently waiting on.
|
|
203
|
+
* `axoniz/comms/telegram.py` wires this into the bot's approval callback.
|
|
204
|
+
*/
|
|
205
|
+
resolve(approved) {
|
|
206
|
+
const p = this.pending;
|
|
207
|
+
this.pending = null;
|
|
208
|
+
if (p)
|
|
209
|
+
p(approved);
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* Faithful port: never prompts interactively (there is no synchronous prompt
|
|
213
|
+
* in Node), so it returns False after printing the approval banner — exactly
|
|
214
|
+
* like the Python implementation when nothing is wired up.
|
|
215
|
+
*/
|
|
216
|
+
ask(tool, args) {
|
|
217
|
+
if (this.timeout <= 0)
|
|
218
|
+
return false;
|
|
219
|
+
if (this.callback) {
|
|
220
|
+
try {
|
|
221
|
+
return this.callback(tool, args);
|
|
222
|
+
}
|
|
223
|
+
catch (e) {
|
|
224
|
+
logger.debug(`[Authority] approval callback failed: ${String(e)}`);
|
|
225
|
+
return false;
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
console.log(`\n ${AuthLevel.DANGEROUS} APPROVAL REQUIRED: ${tool}(${JSON.stringify(args)})`);
|
|
229
|
+
return false;
|
|
230
|
+
}
|
|
231
|
+
/** Additive async variant used by channels that can await a human. */
|
|
232
|
+
async askAsync(tool, args) {
|
|
233
|
+
if (this.timeout <= 0)
|
|
234
|
+
return false;
|
|
235
|
+
if (this.callback) {
|
|
236
|
+
try {
|
|
237
|
+
return this.callback(tool, args);
|
|
238
|
+
}
|
|
239
|
+
catch {
|
|
240
|
+
return false;
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
console.log(`\n ${AuthLevel.DANGEROUS} APPROVAL REQUIRED: ${tool}(${JSON.stringify(args)})`);
|
|
244
|
+
return await new Promise((resolve) => {
|
|
245
|
+
this.pending = resolve;
|
|
246
|
+
const t = setTimeout(() => {
|
|
247
|
+
if (this.pending === resolve) {
|
|
248
|
+
this.pending = null;
|
|
249
|
+
resolve(false);
|
|
250
|
+
}
|
|
251
|
+
}, Math.max(1, this.timeout) * 1000);
|
|
252
|
+
if (typeof t.unref === "function")
|
|
253
|
+
t.unref();
|
|
254
|
+
});
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
/* ── Default rules ────────────────────────────────────────────────────────── */
|
|
258
|
+
export const _DEFAULT_RULES = {
|
|
259
|
+
file_read: 1,
|
|
260
|
+
file_list: 1,
|
|
261
|
+
file_search: 1,
|
|
262
|
+
web_get: 1,
|
|
263
|
+
web_search: 1,
|
|
264
|
+
get_time: 0,
|
|
265
|
+
file_write: 2,
|
|
266
|
+
file_edit: 2,
|
|
267
|
+
file_append: 2,
|
|
268
|
+
file_delete: 4,
|
|
269
|
+
shell_run: 3,
|
|
270
|
+
shell_python: 3,
|
|
271
|
+
git_commit: 2,
|
|
272
|
+
git_push: 3,
|
|
273
|
+
mouse_move: 3,
|
|
274
|
+
mouse_click: 3,
|
|
275
|
+
key_type: 3,
|
|
276
|
+
key_press: 3,
|
|
277
|
+
screen_capture: 1,
|
|
278
|
+
optimize_hardware: 4,
|
|
279
|
+
done: 0,
|
|
280
|
+
};
|
|
281
|
+
/* ── AuthorityEngine ──────────────────────────────────────────────────────── */
|
|
282
|
+
export class AuthorityEngine {
|
|
283
|
+
config;
|
|
284
|
+
audit;
|
|
285
|
+
learner;
|
|
286
|
+
delivery;
|
|
287
|
+
default_level;
|
|
288
|
+
max_auto_level;
|
|
289
|
+
_paused = false;
|
|
290
|
+
_id_counter = 0;
|
|
291
|
+
/** Dynamic per-tool overrides (set_rule). */
|
|
292
|
+
_rules = new Map();
|
|
293
|
+
constructor(config, defaultLevel = 3) {
|
|
294
|
+
this.config = config ?? {};
|
|
295
|
+
const dbPath = (this.config["audit_db"] ?? this.config["db_path"] ?? "axoniz_audit.jsonl");
|
|
296
|
+
this.audit = new AuditTrail(dbPath);
|
|
297
|
+
this.learner = new ApprovalLearner();
|
|
298
|
+
this.delivery = new ApprovalDelivery(Number(this.config["approval_timeout"] ?? 30));
|
|
299
|
+
this.default_level = toAuthLevel(defaultLevel);
|
|
300
|
+
this.max_auto_level = Number(this.config["max_auto_level"] ?? AuthLevel.EXECUTE);
|
|
301
|
+
}
|
|
302
|
+
set_rule(toolName, level) {
|
|
303
|
+
this._rules.set(toolName, toAuthLevel(level));
|
|
304
|
+
}
|
|
305
|
+
/** camelCase alias. */
|
|
306
|
+
setRule(toolName, level) {
|
|
307
|
+
this.set_rule(toolName, level);
|
|
308
|
+
}
|
|
309
|
+
check(toolName, args, _sessionId = "default") {
|
|
310
|
+
this._id_counter += 1;
|
|
311
|
+
if (this._paused) {
|
|
312
|
+
return new Decision(false, "System paused", AuthLevel.DANGEROUS);
|
|
313
|
+
}
|
|
314
|
+
// 1. Base level: Dynamic override -> Default rules -> Default engine level
|
|
315
|
+
const base = this._rules.get(toolName) ?? _DEFAULT_RULES[toolName] ?? this.default_level;
|
|
316
|
+
let level = base;
|
|
317
|
+
// 2. Path & command escalation (hardcoded safety overrides) — upgrade only.
|
|
318
|
+
const escLevel = _escalate_check(toolName, args);
|
|
319
|
+
if (escLevel > 0) {
|
|
320
|
+
level = Math.max(level, escLevel);
|
|
321
|
+
}
|
|
322
|
+
// 3. Learner check (auto-approval of trusted patterns)
|
|
323
|
+
if (this.learner.is_auto_approved(toolName)) {
|
|
324
|
+
level = AuthLevel.SAFE;
|
|
325
|
+
}
|
|
326
|
+
let approved = level <= this.max_auto_level;
|
|
327
|
+
// Match test expectations for the reason string.
|
|
328
|
+
let reason;
|
|
329
|
+
if ((level <= AuthLevel.READ || level === AuthLevel.AUTONOMOUS) && approved) {
|
|
330
|
+
reason = "autonomous";
|
|
331
|
+
}
|
|
332
|
+
else if (approved) {
|
|
333
|
+
reason = "Auto-approved";
|
|
334
|
+
}
|
|
335
|
+
else {
|
|
336
|
+
reason = `Action level ${level} exceeds threshold`;
|
|
337
|
+
}
|
|
338
|
+
if (!approved) {
|
|
339
|
+
// Try delivery
|
|
340
|
+
if (this.delivery.ask(toolName, args)) {
|
|
341
|
+
this.learner.record_approval(toolName);
|
|
342
|
+
approved = true;
|
|
343
|
+
reason = "User approved";
|
|
344
|
+
}
|
|
345
|
+
else {
|
|
346
|
+
this.learner.record_denial(toolName);
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
this.audit.record(toolName, args, level, approved, reason);
|
|
350
|
+
const d = new Decision(approved, reason, Math.trunc(level));
|
|
351
|
+
d.id = this._id_counter;
|
|
352
|
+
d.decision_id = String(this._id_counter);
|
|
353
|
+
return d;
|
|
354
|
+
}
|
|
355
|
+
emergency_pause() {
|
|
356
|
+
this._paused = true;
|
|
357
|
+
}
|
|
358
|
+
resume() {
|
|
359
|
+
this._paused = false;
|
|
360
|
+
}
|
|
361
|
+
summary() {
|
|
362
|
+
return `Authority: ${this._paused ? "PAUSED" : "Active"} | Audit: ${this.audit.path}`;
|
|
363
|
+
}
|
|
364
|
+
recent_audit(n = 10) {
|
|
365
|
+
const rows = this.audit.recent(n);
|
|
366
|
+
if (rows.length === 0)
|
|
367
|
+
return "No audit records.";
|
|
368
|
+
const lines = [];
|
|
369
|
+
for (const r of rows) {
|
|
370
|
+
lines.push(`[${formatTime(Number(r["timestamp"] ?? 0))}] ` +
|
|
371
|
+
`${String(r["tool"])} -> ${r["approved"] ? "OK" : "BLOCKED"} (${String(r["reason"])})`);
|
|
372
|
+
}
|
|
373
|
+
return lines.join("\n");
|
|
374
|
+
}
|
|
375
|
+
/* camelCase aliases */
|
|
376
|
+
emergencyPause() {
|
|
377
|
+
this.emergency_pause();
|
|
378
|
+
}
|
|
379
|
+
recentAudit(n = 10) {
|
|
380
|
+
return this.recent_audit(n);
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
/** `time.strftime('%H:%M:%S', time.localtime(ts))` for a float epoch. */
|
|
384
|
+
function formatTime(ts) {
|
|
385
|
+
const d = new Date(ts * 1000);
|
|
386
|
+
const p = (x) => String(x).padStart(2, "0");
|
|
387
|
+
return `${p(d.getHours())}:${p(d.getMinutes())}:${p(d.getSeconds())}`;
|
|
388
|
+
}
|
|
389
|
+
/* ── Module singleton ─────────────────────────────────────────────────────── */
|
|
390
|
+
let _engine_instance = null;
|
|
391
|
+
export function get_engine(config) {
|
|
392
|
+
if (_engine_instance === null) {
|
|
393
|
+
_engine_instance = new AuthorityEngine(config);
|
|
394
|
+
}
|
|
395
|
+
return _engine_instance;
|
|
396
|
+
}
|
|
397
|
+
export const getEngine = get_engine;
|
|
398
|
+
/** Test/reset hook (not present in Python; additive, keeps the singleton honest). */
|
|
399
|
+
export function _resetEngine() {
|
|
400
|
+
_engine_instance = null;
|
|
401
|
+
}
|
|
402
|
+
//# sourceMappingURL=authority.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"authority.js","sourceRoot":"","sources":["../../src/core/authority.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GA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,IAAI,CAAC;AAC1B,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Async queue bridging callback/push producers to `for await` consumers.
|
|
3
|
+
* Used to turn node-llama-cpp's `onTextChunk` callback into an async iterator,
|
|
4
|
+
* preserving the Python generator-based backend interface.
|
|
5
|
+
*/
|
|
6
|
+
export declare class AsyncQueue<T> implements AsyncIterable<T> {
|
|
7
|
+
private readonly items;
|
|
8
|
+
private readonly waiters;
|
|
9
|
+
private closed;
|
|
10
|
+
private error;
|
|
11
|
+
push(item: T): void;
|
|
12
|
+
close(): void;
|
|
13
|
+
fail(err: unknown): void;
|
|
14
|
+
get failure(): unknown;
|
|
15
|
+
[Symbol.asyncIterator](): AsyncIterator<T>;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=async_queue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"async_queue.d.ts","sourceRoot":"","sources":["../../../src/core/backend/async_queue.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,qBAAa,UAAU,CAAC,CAAC,CAAE,YAAW,aAAa,CAAC,CAAC,CAAC;IACpD,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAW;IACjC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAA6C;IACrE,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,KAAK,CAAiB;IAE9B,IAAI,CAAC,IAAI,EAAE,CAAC,GAAG,IAAI,CAQlB;IAED,KAAK,IAAI,IAAI,CAMZ;IAED,IAAI,CAAC,GAAG,EAAE,OAAO,GAAG,IAAI,CASvB;IAED,IAAI,OAAO,IAAI,OAAO,CAErB;IAED,CAAC,MAAM,CAAC,aAAa,CAAC,IAAI,aAAa,CAAC,CAAC,CAAC,CAmBzC;CACF"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Async queue bridging callback/push producers to `for await` consumers.
|
|
3
|
+
* Used to turn node-llama-cpp's `onTextChunk` callback into an async iterator,
|
|
4
|
+
* preserving the Python generator-based backend interface.
|
|
5
|
+
*/
|
|
6
|
+
export class AsyncQueue {
|
|
7
|
+
items = [];
|
|
8
|
+
waiters = [];
|
|
9
|
+
closed = false;
|
|
10
|
+
error = null;
|
|
11
|
+
push(item) {
|
|
12
|
+
if (this.closed)
|
|
13
|
+
return;
|
|
14
|
+
const waiter = this.waiters.shift();
|
|
15
|
+
if (waiter) {
|
|
16
|
+
waiter({ value: item, done: false });
|
|
17
|
+
}
|
|
18
|
+
else {
|
|
19
|
+
this.items.push(item);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
close() {
|
|
23
|
+
if (this.closed)
|
|
24
|
+
return;
|
|
25
|
+
this.closed = true;
|
|
26
|
+
while (this.waiters.length > 0) {
|
|
27
|
+
this.waiters.shift()({ value: undefined, done: true });
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
fail(err) {
|
|
31
|
+
if (this.closed)
|
|
32
|
+
return;
|
|
33
|
+
this.error = err;
|
|
34
|
+
this.closed = true;
|
|
35
|
+
while (this.waiters.length > 0) {
|
|
36
|
+
const waiter = this.waiters.shift();
|
|
37
|
+
// Surface the error to the consumer on its next pull.
|
|
38
|
+
waiter({ value: undefined, done: true });
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
get failure() {
|
|
42
|
+
return this.error;
|
|
43
|
+
}
|
|
44
|
+
[Symbol.asyncIterator]() {
|
|
45
|
+
return {
|
|
46
|
+
next: () => {
|
|
47
|
+
if (this.items.length > 0) {
|
|
48
|
+
return Promise.resolve({ value: this.items.shift(), done: false });
|
|
49
|
+
}
|
|
50
|
+
if (this.closed) {
|
|
51
|
+
if (this.error)
|
|
52
|
+
return Promise.reject(this.error);
|
|
53
|
+
return Promise.resolve({ value: undefined, done: true });
|
|
54
|
+
}
|
|
55
|
+
return new Promise((resolve) => {
|
|
56
|
+
this.waiters.push(resolve);
|
|
57
|
+
});
|
|
58
|
+
},
|
|
59
|
+
return: () => {
|
|
60
|
+
this.close();
|
|
61
|
+
return Promise.resolve({ value: undefined, done: true });
|
|
62
|
+
},
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
//# sourceMappingURL=async_queue.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"async_queue.js","sourceRoot":"","sources":["../../../src/core/backend/async_queue.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,MAAM,OAAO,UAAU;IACJ,KAAK,GAAQ,EAAE,CAAC;IAChB,OAAO,GAA0C,EAAE,CAAC;IAC7D,MAAM,GAAG,KAAK,CAAC;IACf,KAAK,GAAY,IAAI,CAAC;IAE9B,IAAI,CAAC,IAAO;QACV,IAAI,IAAI,CAAC,MAAM;YAAE,OAAO;QACxB,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;QACpC,IAAI,MAAM,EAAE,CAAC;YACX,MAAM,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;QACvC,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACxB,CAAC;IACH,CAAC;IAED,KAAK;QACH,IAAI,IAAI,CAAC,MAAM;YAAE,OAAO;QACxB,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;QACnB,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC/B,IAAI,CAAC,OAAO,CAAC,KAAK,EAAG,CAAC,EAAE,KAAK,EAAE,SAAkB,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;QACnE,CAAC;IACH,CAAC;IAED,IAAI,CAAC,GAAY;QACf,IAAI,IAAI,CAAC,MAAM;YAAE,OAAO;QACxB,IAAI,CAAC,KAAK,GAAG,GAAG,CAAC;QACjB,IAAI,CAAC,MAAM,GAAG,IAAI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CAAC;CACF"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { activeProvider, type AxonizConfig } from "../config.js";
|
|
2
|
+
import { LlamaCppBackend } from "./llamacpp.js";
|
|
3
|
+
import { LlamaCppServerBackend } from "./llama_server.js";
|
|
4
|
+
import { OpenAICompatibleBackend } from "./openai.js";
|
|
5
|
+
import { OllamaBackend } from "./ollama.js";
|
|
6
|
+
import { LMStudioBackend } from "./lmstudio.js";
|
|
7
|
+
import { Backend, isToolCallResponse, textResponse, toolCallResponse, type BackendHealth, type ChatMessage, type CompletionResult, type TextResponse, type ToolCall, type ToolCallResponse } from "./types.js";
|
|
8
|
+
export { Backend, isToolCallResponse, textResponse, toolCallResponse, LlamaCppBackend, LlamaCppServerBackend, OpenAICompatibleBackend, OllamaBackend, LMStudioBackend, };
|
|
9
|
+
export type { BackendHealth, ChatMessage, CompletionResult, TextResponse, ToolCall, ToolCallResponse, };
|
|
10
|
+
/**
|
|
11
|
+
* Build the right backend from the hierarchical config dict.
|
|
12
|
+
* Falls back to the legacy flat config when `llm` is absent.
|
|
13
|
+
*/
|
|
14
|
+
export declare function getBackend(cfg: AxonizConfig, tools?: unknown[]): Backend;
|
|
15
|
+
export interface ProviderInfo {
|
|
16
|
+
id: string;
|
|
17
|
+
name: string;
|
|
18
|
+
requires: string;
|
|
19
|
+
model_format: string;
|
|
20
|
+
}
|
|
21
|
+
/** All supported providers, for UI display. */
|
|
22
|
+
export declare function listSupportedProviders(): ProviderInfo[];
|
|
23
|
+
export { activeProvider };
|
|
24
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/backend/index.ts"],"names":[],"mappings":"AAMA,OAAO,EAAkB,cAAc,EAAE,KAAK,YAAY,EAAE,MAAM,cAAc,CAAC;AACjF,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EACL,OAAO,EACP,kBAAkB,EAClB,YAAY,EACZ,gBAAgB,EAChB,KAAK,aAAa,EAClB,KAAK,WAAW,EAChB,KAAK,gBAAgB,EACrB,KAAK,YAAY,EACjB,KAAK,QAAQ,EACb,KAAK,gBAAgB,EACtB,MAAM,YAAY,CAAC;AAEpB,OAAO,EACL,OAAO,EACP,kBAAkB,EAClB,YAAY,EACZ,gBAAgB,EAChB,eAAe,EACf,qBAAqB,EACrB,uBAAuB,EACvB,aAAa,EACb,eAAe,GAChB,CAAC;AACF,YAAY,EACV,aAAa,EACb,WAAW,EACX,gBAAgB,EAChB,YAAY,EACZ,QAAQ,EACR,gBAAgB,GACjB,CAAC;AAEF;;;GAGG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,YAAY,EAAE,KAAK,GAAE,OAAO,EAAO,GAAG,OAAO,CA+E5E;AAED,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,+CAA+C;AAC/C,wBAAgB,sBAAsB,IAAI,YAAY,EAAE,CAiCvD;AAED,OAAO,EAAE,cAAc,EAAE,CAAC"}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Backend factory + re-exports.
|
|
3
|
+
* Port of the `Backend` ABC, response types, `get_backend` and
|
|
4
|
+
* `list_supported_providers` from axoniz/core/backend.py.
|
|
5
|
+
*/
|
|
6
|
+
import { debug } from "../debug.js";
|
|
7
|
+
import { providerConfig, activeProvider } from "../config.js";
|
|
8
|
+
import { LlamaCppBackend } from "./llamacpp.js";
|
|
9
|
+
import { LlamaCppServerBackend } from "./llama_server.js";
|
|
10
|
+
import { OpenAICompatibleBackend } from "./openai.js";
|
|
11
|
+
import { OllamaBackend } from "./ollama.js";
|
|
12
|
+
import { LMStudioBackend } from "./lmstudio.js";
|
|
13
|
+
import { Backend, isToolCallResponse, textResponse, toolCallResponse, } from "./types.js";
|
|
14
|
+
export { Backend, isToolCallResponse, textResponse, toolCallResponse, LlamaCppBackend, LlamaCppServerBackend, OpenAICompatibleBackend, OllamaBackend, LMStudioBackend, };
|
|
15
|
+
/**
|
|
16
|
+
* Build the right backend from the hierarchical config dict.
|
|
17
|
+
* Falls back to the legacy flat config when `llm` is absent.
|
|
18
|
+
*/
|
|
19
|
+
export function getBackend(cfg, tools = []) {
|
|
20
|
+
const hasLlm = cfg.llm !== undefined && cfg.llm !== null;
|
|
21
|
+
const prov = hasLlm
|
|
22
|
+
? String(cfg.llm.active_provider ?? "llamacpp")
|
|
23
|
+
: String(cfg.provider ?? cfg.backend ?? "llamacpp")
|
|
24
|
+
.toLowerCase()
|
|
25
|
+
.trim();
|
|
26
|
+
const p = providerConfig(cfg, prov);
|
|
27
|
+
debug(`[Backend Factory] provider=${prov}`);
|
|
28
|
+
const num = (key, fallback) => {
|
|
29
|
+
const v = p[key];
|
|
30
|
+
const n = Number(v);
|
|
31
|
+
return Number.isFinite(n) ? n : fallback;
|
|
32
|
+
};
|
|
33
|
+
const str = (key, fallback) => {
|
|
34
|
+
const v = p[key];
|
|
35
|
+
return v === undefined || v === null || v === "" ? fallback : String(v);
|
|
36
|
+
};
|
|
37
|
+
if (prov === "openai" || prov === "openai_compatible") {
|
|
38
|
+
return new OpenAICompatibleBackend({
|
|
39
|
+
baseUrl: str("base_url", "https://api.openai.com/v1"),
|
|
40
|
+
apiKey: str("api_key", ""),
|
|
41
|
+
modelName: str("model_name", "gpt-4o"),
|
|
42
|
+
temperature: num("temperature", 0.2),
|
|
43
|
+
maxTokens: num("max_tokens", 4096),
|
|
44
|
+
tools,
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
if (prov === "ollama") {
|
|
48
|
+
return new OllamaBackend({
|
|
49
|
+
baseUrl: str("base_url", "http://localhost:11434"),
|
|
50
|
+
modelName: str("model_name", "llama3"),
|
|
51
|
+
temperature: num("temperature", 0.2),
|
|
52
|
+
maxTokens: num("max_tokens", 4096),
|
|
53
|
+
tools,
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
if (prov === "lmstudio") {
|
|
57
|
+
return new LMStudioBackend({
|
|
58
|
+
baseUrl: str("base_url", "http://localhost:1234"),
|
|
59
|
+
modelName: str("model_name", ""),
|
|
60
|
+
apiKey: str("api_key", "lm-studio"),
|
|
61
|
+
temperature: num("temperature", 0.2),
|
|
62
|
+
maxTokens: num("max_tokens", 4096),
|
|
63
|
+
autoLoad: p.auto_load === undefined ? true : Boolean(p.auto_load),
|
|
64
|
+
autoStart: Boolean(p.auto_start),
|
|
65
|
+
lmsBin: str("lms_bin", ""),
|
|
66
|
+
tools,
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
if (prov === "gguf_server" || prov === "llamacpp_server") {
|
|
70
|
+
return new LlamaCppServerBackend({
|
|
71
|
+
baseUrl: str("base_url", "http://localhost:8080"),
|
|
72
|
+
modelPath: str("model_path", ""),
|
|
73
|
+
temperature: num("temperature", 0.2),
|
|
74
|
+
maxTokens: num("max_tokens", 4096),
|
|
75
|
+
nCtx: num("n_ctx", 32768),
|
|
76
|
+
llamaBin: str("llama_bin", ""),
|
|
77
|
+
autoStart: Boolean(p.auto_start),
|
|
78
|
+
nGpuLayers: num("n_gpu_layers", -1),
|
|
79
|
+
tools,
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
// Default: llamacpp (in-process, node-llama-cpp)
|
|
83
|
+
return new LlamaCppBackend({
|
|
84
|
+
modelPath: str("model_path", ""),
|
|
85
|
+
temperature: num("temperature", 0.2),
|
|
86
|
+
maxTokens: num("max_tokens", 4096),
|
|
87
|
+
nCtx: num("n_ctx", 32768),
|
|
88
|
+
nGpuLayers: num("n_gpu_layers", -1),
|
|
89
|
+
tools,
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
/** All supported providers, for UI display. */
|
|
93
|
+
export function listSupportedProviders() {
|
|
94
|
+
return [
|
|
95
|
+
{
|
|
96
|
+
id: "llamacpp",
|
|
97
|
+
name: "LlamaCpp (Direct GGUF)",
|
|
98
|
+
requires: "node-llama-cpp",
|
|
99
|
+
model_format: ".gguf file path",
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
id: "llamacpp_server",
|
|
103
|
+
name: "LlamaCpp Server",
|
|
104
|
+
requires: "llama-server binary",
|
|
105
|
+
model_format: ".gguf file path",
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
id: "lmstudio",
|
|
109
|
+
name: "LM Studio (LMS)",
|
|
110
|
+
requires: "LM Studio running",
|
|
111
|
+
model_format: "model name or path",
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
id: "openai",
|
|
115
|
+
name: "OpenAI / Compatible",
|
|
116
|
+
requires: "api_key + base_url",
|
|
117
|
+
model_format: "model name string",
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
id: "ollama",
|
|
121
|
+
name: "Ollama",
|
|
122
|
+
requires: "Ollama running",
|
|
123
|
+
model_format: "model name string",
|
|
124
|
+
},
|
|
125
|
+
];
|
|
126
|
+
}
|
|
127
|
+
export { activeProvider };
|
|
128
|
+
//# sourceMappingURL=index.js.map
|