@monoes/monomindcli 1.10.57 → 1.11.1
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/.claude/agents/core/coordinator.md +71 -0
- package/.claude/agents/generated/case-analyst.md +50 -0
- package/.claude/agents/generated/copy-editor.md +45 -0
- package/.claude/agents/generated/court-reporter.md +50 -0
- package/.claude/agents/generated/defender.md +51 -0
- package/.claude/agents/generated/editor-in-chief.md +45 -0
- package/.claude/agents/generated/fact-checker.md +45 -0
- package/.claude/agents/generated/judge.md +51 -0
- package/.claude/agents/generated/prosecutor.md +51 -0
- package/.claude/agents/generated/reporter.md +45 -0
- package/.claude/commands/hooks/README.md +1 -1
- package/.claude/commands/hooks/overview.md +1 -1
- package/.claude/commands/mastermind/_repeat.md +1 -1
- package/.claude/commands/mastermind/do.md +3 -1
- package/.claude/commands/mastermind/help.md +2 -2
- package/.claude/commands/mastermind/master.md +39 -6
- package/.claude/commands/mastermind/memory.md +1 -1
- package/.claude/commands/memory/memory-search.md +2 -2
- package/.claude/commands/monitoring/status.md +1 -1
- package/.claude/commands/{browse.md → monobrowse.md} +2 -2
- package/.claude/commands/sparc.md +1 -1
- package/.claude/helpers/handlers/graph-status-handler.cjs +1 -1
- package/.claude/helpers/loop-tracker.cjs +1 -1
- package/.claude/skills/agent-browser-testing/SKILL.md +1 -1
- package/.claude/skills/hooks-automation/SKILL.md +0 -3
- package/.claude/skills/mastermind/build.md +1 -1
- package/.claude/skills/mastermind/code-quality-reviewer-prompt.md +60 -0
- package/.claude/skills/mastermind/content.md +1 -1
- package/.claude/skills/mastermind/createorg.md +79 -2
- package/.claude/skills/mastermind/design.md +3 -1
- package/.claude/skills/mastermind/finance.md +1 -1
- package/.claude/skills/mastermind/implementer-prompt.md +109 -0
- package/.claude/skills/mastermind/marketing.md +1 -1
- package/.claude/skills/mastermind/ops.md +1 -1
- package/.claude/skills/mastermind/plan.md +20 -2
- package/.claude/skills/mastermind/release.md +1 -1
- package/.claude/skills/mastermind/research.md +1 -1
- package/.claude/skills/mastermind/review.md +1 -1
- package/.claude/skills/mastermind/sales.md +1 -1
- package/.claude/skills/mastermind/spec-reviewer-prompt.md +63 -0
- package/.claude/skills/sparc-methodology/SKILL.md +3 -3
- package/.claude/skills/swarm-advanced/SKILL.md +1 -4
- package/README.md +18 -32
- package/dist/src/agents/registry-builder.d.ts +1 -7
- package/dist/src/agents/registry-builder.d.ts.map +1 -1
- package/dist/src/agents/registry-builder.js +10 -6
- package/dist/src/agents/registry-builder.js.map +1 -1
- package/dist/src/benchmarks/benchmark-runner.d.ts +59 -12
- package/dist/src/benchmarks/benchmark-runner.d.ts.map +1 -1
- package/dist/src/benchmarks/benchmark-runner.js +67 -13
- package/dist/src/benchmarks/benchmark-runner.js.map +1 -1
- package/dist/src/benchmarks/metric-evaluators.d.ts.map +1 -1
- package/dist/src/benchmarks/metric-evaluators.js.map +1 -1
- package/dist/src/benchmarks/pretrain/index.d.ts +0 -13
- package/dist/src/benchmarks/pretrain/index.d.ts.map +1 -1
- package/dist/src/benchmarks/pretrain/index.js.map +1 -1
- package/dist/src/commands/agent-wasm.d.ts +2 -2
- package/dist/src/commands/agent-wasm.js +5 -5
- package/dist/src/commands/agent.d.ts.map +1 -1
- package/dist/src/commands/agent.js +1 -6
- package/dist/src/commands/agent.js.map +1 -1
- package/dist/src/commands/analyze.d.ts +1 -1
- package/dist/src/commands/analyze.d.ts.map +1 -1
- package/dist/src/commands/analyze.js +8 -18
- package/dist/src/commands/analyze.js.map +1 -1
- package/dist/src/commands/doctor.d.ts.map +1 -1
- package/dist/src/commands/doctor.js +53 -3
- package/dist/src/commands/doctor.js.map +1 -1
- package/dist/src/commands/embeddings.d.ts.map +1 -1
- package/dist/src/commands/embeddings.js +9 -33
- package/dist/src/commands/embeddings.js.map +1 -1
- package/dist/src/commands/hooks.d.ts.map +1 -1
- package/dist/src/commands/hooks.js +31 -74
- package/dist/src/commands/hooks.js.map +1 -1
- package/dist/src/commands/index.d.ts +4 -6
- package/dist/src/commands/index.d.ts.map +1 -1
- package/dist/src/commands/index.js +8 -15
- package/dist/src/commands/index.js.map +1 -1
- package/dist/src/commands/init.js +2 -2
- package/dist/src/commands/init.js.map +1 -1
- package/dist/src/commands/issues.d.ts.map +1 -1
- package/dist/src/commands/issues.js +16 -11
- package/dist/src/commands/issues.js.map +1 -1
- package/dist/src/commands/memory.js +6 -6
- package/dist/src/commands/memory.js.map +1 -1
- package/dist/src/commands/migrate.d.ts.map +1 -1
- package/dist/src/commands/migrate.js +1 -2
- package/dist/src/commands/migrate.js.map +1 -1
- package/dist/src/commands/monograph.d.ts.map +1 -1
- package/dist/src/commands/monograph.js +18 -11
- package/dist/src/commands/monograph.js.map +1 -1
- package/dist/src/commands/monovector/backup.d.ts +11 -0
- package/dist/src/commands/monovector/backup.d.ts.map +1 -0
- package/dist/src/commands/{ruvector → monovector}/backup.js +25 -25
- package/dist/src/commands/monovector/backup.js.map +1 -0
- package/dist/src/commands/monovector/benchmark.d.ts +11 -0
- package/dist/src/commands/monovector/benchmark.d.ts.map +1 -0
- package/dist/src/commands/{ruvector → monovector}/benchmark.js +14 -14
- package/dist/src/commands/monovector/benchmark.js.map +1 -0
- package/dist/src/commands/monovector/import.d.ts +18 -0
- package/dist/src/commands/monovector/import.d.ts.map +1 -0
- package/dist/src/commands/{ruvector → monovector}/import.js +21 -21
- package/dist/src/commands/monovector/import.js.map +1 -0
- package/dist/src/commands/{ruvector → monovector}/index.d.ts +6 -6
- package/dist/src/commands/monovector/index.d.ts.map +1 -0
- package/dist/src/commands/{ruvector → monovector}/index.js +22 -22
- package/dist/src/commands/monovector/index.js.map +1 -0
- package/dist/src/commands/monovector/init.d.ts +11 -0
- package/dist/src/commands/monovector/init.d.ts.map +1 -0
- package/dist/src/commands/{ruvector → monovector}/init.js +36 -36
- package/dist/src/commands/monovector/init.js.map +1 -0
- package/dist/src/commands/monovector/migrate.d.ts +11 -0
- package/dist/src/commands/monovector/migrate.d.ts.map +1 -0
- package/dist/src/commands/{ruvector → monovector}/migrate.js +16 -16
- package/dist/src/commands/monovector/migrate.js.map +1 -0
- package/dist/src/commands/{ruvector → monovector}/optimize.d.ts +2 -2
- package/dist/src/commands/monovector/optimize.d.ts.map +1 -0
- package/dist/src/commands/{ruvector → monovector}/optimize.js +10 -10
- package/dist/src/commands/monovector/optimize.js.map +1 -0
- package/dist/src/commands/monovector/setup.d.ts +18 -0
- package/dist/src/commands/monovector/setup.d.ts.map +1 -0
- package/dist/src/commands/{ruvector → monovector}/setup.js +77 -77
- package/dist/src/commands/monovector/setup.js.map +1 -0
- package/dist/src/commands/{ruvector → monovector}/status.d.ts +2 -2
- package/dist/src/commands/monovector/status.d.ts.map +1 -0
- package/dist/src/commands/{ruvector → monovector}/status.js +34 -34
- package/dist/src/commands/monovector/status.js.map +1 -0
- package/dist/src/commands/neural.d.ts +1 -1
- package/dist/src/commands/neural.d.ts.map +1 -1
- package/dist/src/commands/neural.js +31 -608
- package/dist/src/commands/neural.js.map +1 -1
- package/dist/src/commands/performance.d.ts.map +1 -1
- package/dist/src/commands/performance.js +7 -10
- package/dist/src/commands/performance.js.map +1 -1
- package/dist/src/commands/plugins.d.ts.map +1 -1
- package/dist/src/commands/plugins.js +3 -4
- package/dist/src/commands/plugins.js.map +1 -1
- package/dist/src/commands/process.d.ts.map +1 -1
- package/dist/src/commands/process.js +5 -12
- package/dist/src/commands/process.js.map +1 -1
- package/dist/src/commands/progress.d.ts.map +1 -1
- package/dist/src/commands/progress.js +16 -16
- package/dist/src/commands/progress.js.map +1 -1
- package/dist/src/commands/replay.d.ts.map +1 -1
- package/dist/src/commands/replay.js.map +1 -1
- package/dist/src/commands/route.d.ts +2 -2
- package/dist/src/commands/route.js +23 -23
- package/dist/src/commands/route.js.map +1 -1
- package/dist/src/commands/status.d.ts.map +1 -1
- package/dist/src/commands/status.js +0 -3
- package/dist/src/commands/status.js.map +1 -1
- package/dist/src/commands/swarm.d.ts.map +1 -1
- package/dist/src/commands/swarm.js +2 -3
- package/dist/src/commands/swarm.js.map +1 -1
- package/dist/src/config-adapter.d.ts.map +1 -1
- package/dist/src/config-adapter.js +27 -0
- package/dist/src/config-adapter.js.map +1 -1
- package/dist/src/consensus/audit-writer.d.ts +44 -17
- package/dist/src/consensus/audit-writer.d.ts.map +1 -1
- package/dist/src/consensus/audit-writer.js.map +1 -1
- package/dist/src/dlq/dlq-replayer.d.ts +1 -1
- package/dist/src/dlq/dlq-replayer.d.ts.map +1 -1
- package/dist/src/index.js +5 -5
- package/dist/src/index.js.map +1 -1
- package/dist/src/init/claudemd-generator.d.ts.map +1 -1
- package/dist/src/init/claudemd-generator.js +57 -37
- package/dist/src/init/claudemd-generator.js.map +1 -1
- package/dist/src/init/executor.d.ts.map +1 -1
- package/dist/src/init/executor.js +17 -27
- package/dist/src/init/executor.js.map +1 -1
- package/dist/src/init/helpers-generator.js +2 -2
- package/dist/src/init/types.d.ts +1 -1
- package/dist/src/init/types.d.ts.map +1 -1
- package/dist/src/mcp-client.d.ts.map +1 -1
- package/dist/src/mcp-client.js +1 -7
- package/dist/src/mcp-client.js.map +1 -1
- package/dist/src/mcp-server.d.ts.map +1 -1
- package/dist/src/mcp-server.js +9 -1
- package/dist/src/mcp-server.js.map +1 -1
- package/dist/src/mcp-tools/agent-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/agent-tools.js +1 -52
- package/dist/src/mcp-tools/agent-tools.js.map +1 -1
- package/dist/src/mcp-tools/analyze-tools.js +5 -5
- package/dist/src/mcp-tools/analyze-tools.js.map +1 -1
- package/dist/src/mcp-tools/browser-tools.d.ts +1 -1
- package/dist/src/mcp-tools/browser-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/browser-tools.js +6 -5
- package/dist/src/mcp-tools/browser-tools.js.map +1 -1
- package/dist/src/mcp-tools/coordination-tools.d.ts +1 -1
- package/dist/src/mcp-tools/coordination-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/coordination-tools.js +51 -54
- package/dist/src/mcp-tools/coordination-tools.js.map +1 -1
- package/dist/src/mcp-tools/daa-tools.d.ts +1 -1
- package/dist/src/mcp-tools/daa-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/daa-tools.js.map +1 -1
- package/dist/src/mcp-tools/embeddings-tools.js +10 -10
- package/dist/src/mcp-tools/embeddings-tools.js.map +1 -1
- package/dist/src/mcp-tools/guidance-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/guidance-tools.js +0 -24
- package/dist/src/mcp-tools/guidance-tools.js.map +1 -1
- package/dist/src/mcp-tools/hive-mind-tools.js.map +1 -1
- package/dist/src/mcp-tools/hooks-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/hooks-tools.js +189 -480
- package/dist/src/mcp-tools/hooks-tools.js.map +1 -1
- package/dist/src/mcp-tools/index.d.ts +0 -2
- package/dist/src/mcp-tools/index.d.ts.map +1 -1
- package/dist/src/mcp-tools/index.js +0 -2
- package/dist/src/mcp-tools/index.js.map +1 -1
- package/dist/src/mcp-tools/monograph-compat.d.ts +334 -0
- package/dist/src/mcp-tools/monograph-compat.d.ts.map +1 -0
- package/dist/src/mcp-tools/monograph-compat.js +1126 -0
- package/dist/src/mcp-tools/monograph-compat.js.map +1 -0
- package/dist/src/mcp-tools/monograph-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/monograph-tools.js +76 -34
- package/dist/src/mcp-tools/monograph-tools.js.map +1 -1
- package/dist/src/mcp-tools/neural-tools.d.ts +1 -1
- package/dist/src/mcp-tools/neural-tools.js +2 -2
- package/dist/src/mcp-tools/neural-tools.js.map +1 -1
- package/dist/src/mcp-tools/ruvllm-tools.d.ts +2 -2
- package/dist/src/mcp-tools/ruvllm-tools.js +3 -3
- package/dist/src/mcp-tools/terminal-tools.d.ts +1 -1
- package/dist/src/mcp-tools/terminal-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/terminal-tools.js +29 -19
- package/dist/src/mcp-tools/terminal-tools.js.map +1 -1
- package/dist/src/mcp-tools/wasm-agent-tools.d.ts +1 -1
- package/dist/src/mcp-tools/wasm-agent-tools.js +2 -2
- package/dist/src/memory/intelligence.d.ts.map +1 -1
- package/dist/src/memory/intelligence.js +14 -8
- package/dist/src/memory/intelligence.js.map +1 -1
- package/dist/src/memory/memory-bridge.d.ts +17 -2
- package/dist/src/memory/memory-bridge.d.ts.map +1 -1
- package/dist/src/memory/memory-bridge.js +76 -23
- package/dist/src/memory/memory-bridge.js.map +1 -1
- package/dist/src/memory/memory-initializer.d.ts +2 -2
- package/dist/src/memory/memory-initializer.d.ts.map +1 -1
- package/dist/src/memory/memory-initializer.js +37 -39
- package/dist/src/memory/memory-initializer.js.map +1 -1
- package/dist/src/monovector/capabilities.d.ts +34 -0
- package/dist/src/monovector/capabilities.d.ts.map +1 -0
- package/dist/src/monovector/capabilities.js +37 -0
- package/dist/src/monovector/capabilities.js.map +1 -0
- package/dist/src/monovector/command-outcomes.d.ts +37 -0
- package/dist/src/monovector/command-outcomes.d.ts.map +1 -0
- package/dist/src/monovector/command-outcomes.js +87 -0
- package/dist/src/monovector/command-outcomes.js.map +1 -0
- package/dist/src/monovector/coverage-router.d.ts +103 -0
- package/dist/src/monovector/coverage-router.d.ts.map +1 -0
- package/dist/src/monovector/coverage-router.js +337 -0
- package/dist/src/monovector/coverage-router.js.map +1 -0
- package/dist/src/monovector/coverage-tools.d.ts +14 -0
- package/dist/src/monovector/coverage-tools.d.ts.map +1 -0
- package/dist/src/monovector/coverage-tools.js +112 -0
- package/dist/src/monovector/coverage-tools.js.map +1 -0
- package/dist/src/{ruvector → monovector}/diff-classifier.d.ts +2 -2
- package/dist/src/monovector/diff-classifier.d.ts.map +1 -0
- package/dist/src/monovector/diff-classifier.js.map +1 -0
- package/dist/src/monovector/index.d.ts +61 -0
- package/dist/src/monovector/index.d.ts.map +1 -0
- package/dist/src/monovector/index.js +67 -0
- package/dist/src/monovector/index.js.map +1 -0
- package/dist/src/monovector/init-state.d.ts +35 -0
- package/dist/src/monovector/init-state.d.ts.map +1 -0
- package/dist/src/monovector/init-state.js +36 -0
- package/dist/src/monovector/init-state.js.map +1 -0
- package/dist/src/monovector/route-outcomes.d.ts +55 -0
- package/dist/src/monovector/route-outcomes.d.ts.map +1 -0
- package/dist/src/monovector/route-outcomes.js +137 -0
- package/dist/src/monovector/route-outcomes.js.map +1 -0
- package/dist/src/parser.js +3 -3
- package/dist/src/parser.js.map +1 -1
- package/dist/src/plugins/store/discovery.d.ts.map +1 -1
- package/dist/src/plugins/store/discovery.js +0 -31
- package/dist/src/plugins/store/discovery.js.map +1 -1
- package/dist/src/production/circuit-breaker.d.ts +26 -6
- package/dist/src/production/circuit-breaker.d.ts.map +1 -1
- package/dist/src/production/circuit-breaker.js.map +1 -1
- package/dist/src/production/error-handler.d.ts +55 -30
- package/dist/src/production/error-handler.d.ts.map +1 -1
- package/dist/src/production/error-handler.js.map +1 -1
- package/dist/src/production/index.d.ts +3 -20
- package/dist/src/production/index.d.ts.map +1 -1
- package/dist/src/production/index.js +3 -15
- package/dist/src/production/index.js.map +1 -1
- package/dist/src/production/monitoring.d.ts +54 -34
- package/dist/src/production/monitoring.d.ts.map +1 -1
- package/dist/src/production/monitoring.js +12 -14
- package/dist/src/production/monitoring.js.map +1 -1
- package/dist/src/production/rate-limiter.d.ts +64 -19
- package/dist/src/production/rate-limiter.d.ts.map +1 -1
- package/dist/src/production/rate-limiter.js +5 -5
- package/dist/src/production/rate-limiter.js.map +1 -1
- package/dist/src/production/retry.d.ts.map +1 -1
- package/dist/src/production/retry.js +4 -2
- package/dist/src/production/retry.js.map +1 -1
- package/dist/src/services/claim-service.d.ts +50 -59
- package/dist/src/services/claim-service.d.ts.map +1 -1
- package/dist/src/services/claim-service.js +83 -50
- package/dist/src/services/claim-service.js.map +1 -1
- package/dist/src/services/config-file-manager.d.ts.map +1 -1
- package/dist/src/services/config-file-manager.js +8 -1
- package/dist/src/services/config-file-manager.js.map +1 -1
- package/dist/src/services/worker-daemon.d.ts.map +1 -1
- package/dist/src/services/worker-daemon.js +4 -0
- package/dist/src/services/worker-daemon.js.map +1 -1
- package/dist/src/types.d.ts +13 -0
- package/dist/src/types.d.ts.map +1 -1
- package/dist/src/types.js.map +1 -1
- package/dist/src/ui/collector.mjs +51 -11
- package/dist/src/ui/dashboard.html +313 -88
- package/dist/src/ui/server.mjs +163 -8
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +14 -14
- package/scripts/publish-registry.ts +0 -1
- package/.claude/commands/monomind/adr.md +0 -11
- package/.claude/commands/monomind/budget.md +0 -7
- package/.claude/commands/monomind/createtask.md +0 -277
- package/.claude/commands/monomind/do.md +0 -498
- package/.claude/commands/monomind/graph-status.md +0 -7
- package/.claude/commands/monomind/help.md +0 -118
- package/.claude/commands/monomind/idea.md +0 -273
- package/.claude/commands/monomind/improve.md +0 -352
- package/.claude/commands/monomind/loops.md +0 -7
- package/.claude/commands/monomind/memory.md +0 -230
- package/.claude/commands/monomind/repeat.md +0 -257
- package/.claude/commands/monomind/review.md +0 -317
- package/.claude/commands/monomind/specialagents.md +0 -125
- package/.claude/commands/monomind/swarm.md +0 -161
- package/.claude/commands/monomind/understand.md +0 -139
- package/.claude/commands/training/README.md +0 -39
- package/.claude/commands/training/neural-patterns.md +0 -73
- package/.claude/commands/training/neural-train.md +0 -79
- package/dist/src/commands/appliance-advanced.d.ts +0 -9
- package/dist/src/commands/appliance-advanced.d.ts.map +0 -1
- package/dist/src/commands/appliance-advanced.js +0 -238
- package/dist/src/commands/appliance-advanced.js.map +0 -1
- package/dist/src/commands/appliance.d.ts +0 -8
- package/dist/src/commands/appliance.d.ts.map +0 -1
- package/dist/src/commands/appliance.js +0 -406
- package/dist/src/commands/appliance.js.map +0 -1
- package/dist/src/commands/ruvector/backup.d.ts +0 -11
- package/dist/src/commands/ruvector/backup.d.ts.map +0 -1
- package/dist/src/commands/ruvector/backup.js.map +0 -1
- package/dist/src/commands/ruvector/benchmark.d.ts +0 -11
- package/dist/src/commands/ruvector/benchmark.d.ts.map +0 -1
- package/dist/src/commands/ruvector/benchmark.js.map +0 -1
- package/dist/src/commands/ruvector/import.d.ts +0 -18
- package/dist/src/commands/ruvector/import.d.ts.map +0 -1
- package/dist/src/commands/ruvector/import.js.map +0 -1
- package/dist/src/commands/ruvector/index.d.ts.map +0 -1
- package/dist/src/commands/ruvector/index.js.map +0 -1
- package/dist/src/commands/ruvector/init.d.ts +0 -11
- package/dist/src/commands/ruvector/init.d.ts.map +0 -1
- package/dist/src/commands/ruvector/init.js.map +0 -1
- package/dist/src/commands/ruvector/migrate.d.ts +0 -11
- package/dist/src/commands/ruvector/migrate.d.ts.map +0 -1
- package/dist/src/commands/ruvector/migrate.js.map +0 -1
- package/dist/src/commands/ruvector/optimize.d.ts.map +0 -1
- package/dist/src/commands/ruvector/optimize.js.map +0 -1
- package/dist/src/commands/ruvector/setup.d.ts +0 -18
- package/dist/src/commands/ruvector/setup.d.ts.map +0 -1
- package/dist/src/commands/ruvector/setup.js.map +0 -1
- package/dist/src/commands/ruvector/status.d.ts.map +0 -1
- package/dist/src/commands/ruvector/status.js.map +0 -1
- package/dist/src/ruvector/agent-wasm.d.ts +0 -182
- package/dist/src/ruvector/agent-wasm.d.ts.map +0 -1
- package/dist/src/ruvector/agent-wasm.js +0 -316
- package/dist/src/ruvector/agent-wasm.js.map +0 -1
- package/dist/src/ruvector/ast-analyzer.d.ts +0 -67
- package/dist/src/ruvector/ast-analyzer.d.ts.map +0 -1
- package/dist/src/ruvector/ast-analyzer.js +0 -277
- package/dist/src/ruvector/ast-analyzer.js.map +0 -1
- package/dist/src/ruvector/coverage-router.d.ts +0 -160
- package/dist/src/ruvector/coverage-router.d.ts.map +0 -1
- package/dist/src/ruvector/coverage-router.js +0 -539
- package/dist/src/ruvector/coverage-router.js.map +0 -1
- package/dist/src/ruvector/coverage-tools.d.ts +0 -33
- package/dist/src/ruvector/coverage-tools.d.ts.map +0 -1
- package/dist/src/ruvector/coverage-tools.js +0 -157
- package/dist/src/ruvector/coverage-tools.js.map +0 -1
- package/dist/src/ruvector/diff-classifier.d.ts.map +0 -1
- package/dist/src/ruvector/diff-classifier.js.map +0 -1
- package/dist/src/ruvector/enhanced-model-router.d.ts +0 -146
- package/dist/src/ruvector/enhanced-model-router.d.ts.map +0 -1
- package/dist/src/ruvector/enhanced-model-router.js +0 -551
- package/dist/src/ruvector/enhanced-model-router.js.map +0 -1
- package/dist/src/ruvector/flash-attention.d.ts +0 -195
- package/dist/src/ruvector/flash-attention.d.ts.map +0 -1
- package/dist/src/ruvector/flash-attention.js +0 -643
- package/dist/src/ruvector/flash-attention.js.map +0 -1
- package/dist/src/ruvector/graph-analyzer.d.ts +0 -187
- package/dist/src/ruvector/graph-analyzer.d.ts.map +0 -1
- package/dist/src/ruvector/graph-analyzer.js +0 -929
- package/dist/src/ruvector/graph-analyzer.js.map +0 -1
- package/dist/src/ruvector/index.d.ts +0 -67
- package/dist/src/ruvector/index.d.ts.map +0 -1
- package/dist/src/ruvector/index.js +0 -88
- package/dist/src/ruvector/index.js.map +0 -1
- package/dist/src/ruvector/lora-adapter.d.ts +0 -218
- package/dist/src/ruvector/lora-adapter.d.ts.map +0 -1
- package/dist/src/ruvector/lora-adapter.js +0 -455
- package/dist/src/ruvector/lora-adapter.js.map +0 -1
- package/dist/src/ruvector/model-router.d.ts +0 -222
- package/dist/src/ruvector/model-router.d.ts.map +0 -1
- package/dist/src/ruvector/model-router.js +0 -512
- package/dist/src/ruvector/model-router.js.map +0 -1
- package/dist/src/ruvector/moe-router.d.ts +0 -213
- package/dist/src/ruvector/moe-router.d.ts.map +0 -1
- package/dist/src/ruvector/moe-router.js +0 -649
- package/dist/src/ruvector/moe-router.js.map +0 -1
- package/dist/src/ruvector/q-learning-router.d.ts +0 -217
- package/dist/src/ruvector/q-learning-router.d.ts.map +0 -1
- package/dist/src/ruvector/q-learning-router.js +0 -712
- package/dist/src/ruvector/q-learning-router.js.map +0 -1
- package/dist/src/ruvector/ruvllm-wasm.d.ts +0 -179
- package/dist/src/ruvector/ruvllm-wasm.d.ts.map +0 -1
- package/dist/src/ruvector/ruvllm-wasm.js +0 -363
- package/dist/src/ruvector/ruvllm-wasm.js.map +0 -1
- package/dist/src/ruvector/semantic-router.d.ts +0 -77
- package/dist/src/ruvector/semantic-router.d.ts.map +0 -1
- package/dist/src/ruvector/semantic-router.js +0 -178
- package/dist/src/ruvector/semantic-router.js.map +0 -1
- package/dist/src/ruvector/vector-db.d.ts +0 -69
- package/dist/src/ruvector/vector-db.d.ts.map +0 -1
- package/dist/src/ruvector/vector-db.js +0 -243
- package/dist/src/ruvector/vector-db.js.map +0 -1
- package/dist/src/services/ruvector-training.d.ts +0 -222
- package/dist/src/services/ruvector-training.d.ts.map +0 -1
- package/dist/src/services/ruvector-training.js +0 -696
- package/dist/src/services/ruvector-training.js.map +0 -1
- package/dist/src/ui/.monomind/loops/loop-1779095996252-mdjpp.json +0 -11
- package/dist/src/ui/data/agent-avatars.html +0 -763
- package/dist/src/ui/data/agent-avatars.json +0 -966
- package/dist/src/ui/data/avatars/account-strategist.svg +0 -58
- package/dist/src/ui/data/avatars/accounts-payable.svg +0 -54
- package/dist/src/ui/data/avatars/adaptive-coordinator.svg +0 -55
- package/dist/src/ui/data/avatars/adaptive-coordinator2.svg +0 -54
- package/dist/src/ui/data/avatars/ai-citation.svg +0 -57
- package/dist/src/ui/data/avatars/ai-engineer.svg +0 -61
- package/dist/src/ui/data/avatars/analytics-reporter.svg +0 -53
- package/dist/src/ui/data/avatars/api-tester.svg +0 -53
- package/dist/src/ui/data/avatars/architecture.svg +0 -54
- package/dist/src/ui/data/avatars/automation-governance.svg +0 -55
- package/dist/src/ui/data/avatars/backend-dev.svg +0 -53
- package/dist/src/ui/data/avatars/benchmarker.svg +0 -54
- package/dist/src/ui/data/avatars/blockchain-auditor.svg +0 -53
- package/dist/src/ui/data/avatars/byzantine-coord.svg +0 -57
- package/dist/src/ui/data/avatars/case-analyst.svg +0 -57
- package/dist/src/ui/data/avatars/cicd-engineer.svg +0 -55
- package/dist/src/ui/data/avatars/cloud-architect.svg +0 -54
- package/dist/src/ui/data/avatars/code-review-swarm.svg +0 -57
- package/dist/src/ui/data/avatars/coder-v119.svg +0 -57
- package/dist/src/ui/data/avatars/coder.svg +0 -58
- package/dist/src/ui/data/avatars/collective-coord.svg +0 -54
- package/dist/src/ui/data/avatars/compliance-auditor.svg +0 -58
- package/dist/src/ui/data/avatars/consensus-coordinator.svg +0 -54
- package/dist/src/ui/data/avatars/content-creator.svg +0 -54
- package/dist/src/ui/data/avatars/crdt-synchronizer.svg +0 -53
- package/dist/src/ui/data/avatars/cro-specialist.svg +0 -58
- package/dist/src/ui/data/avatars/data-consolidator.svg +0 -54
- package/dist/src/ui/data/avatars/data-engineer.svg +0 -53
- package/dist/src/ui/data/avatars/database-optimizer.svg +0 -61
- package/dist/src/ui/data/avatars/deal-strategist.svg +0 -54
- package/dist/src/ui/data/avatars/defender.svg +0 -53
- package/dist/src/ui/data/avatars/devops-automator.svg +0 -56
- package/dist/src/ui/data/avatars/discovery-coach.svg +0 -54
- package/dist/src/ui/data/avatars/email-marketing.svg +0 -57
- package/dist/src/ui/data/avatars/embedded-firmware.svg +0 -61
- package/dist/src/ui/data/avatars/evidence-collector.svg +0 -57
- package/dist/src/ui/data/avatars/experiment-tracker.svg +0 -53
- package/dist/src/ui/data/avatars/feedback-synthesizer.svg +0 -54
- package/dist/src/ui/data/avatars/finance-tracker.svg +0 -54
- package/dist/src/ui/data/avatars/frontend-developer.svg +0 -54
- package/dist/src/ui/data/avatars/game-audio-engineer.svg +0 -59
- package/dist/src/ui/data/avatars/game-designer.svg +0 -54
- package/dist/src/ui/data/avatars/gossip-coordinator.svg +0 -54
- package/dist/src/ui/data/avatars/hierarchical-coord.svg +0 -54
- package/dist/src/ui/data/avatars/incident-commander.svg +0 -57
- package/dist/src/ui/data/avatars/infrastructure.svg +0 -54
- package/dist/src/ui/data/avatars/input-validator.svg +0 -53
- package/dist/src/ui/data/avatars/ios-developer.svg +0 -54
- package/dist/src/ui/data/avatars/issue-tracker.svg +0 -53
- package/dist/src/ui/data/avatars/judge.svg +0 -55
- package/dist/src/ui/data/avatars/launch-strategist.svg +0 -54
- package/dist/src/ui/data/avatars/legal-compliance.svg +0 -53
- package/dist/src/ui/data/avatars/level-designer.svg +0 -53
- package/dist/src/ui/data/avatars/load-balancer.svg +0 -57
- package/dist/src/ui/data/avatars/mcp-builder.svg +0 -53
- package/dist/src/ui/data/avatars/memory-coordinator.svg +0 -55
- package/dist/src/ui/data/avatars/mesh-coordinator.svg +0 -55
- package/dist/src/ui/data/avatars/ml-developer.svg +0 -58
- package/dist/src/ui/data/avatars/mobile-app-builder.svg +0 -53
- package/dist/src/ui/data/avatars/mobile-dev.svg +0 -54
- package/dist/src/ui/data/avatars/model-qa.svg +0 -58
- package/dist/src/ui/data/avatars/narrative-designer.svg +0 -58
- package/dist/src/ui/data/avatars/outbound-strategist.svg +0 -55
- package/dist/src/ui/data/avatars/path-validator.svg +0 -54
- package/dist/src/ui/data/avatars/payment-agent.svg +0 -53
- package/dist/src/ui/data/avatars/perf-analyzer.svg +0 -58
- package/dist/src/ui/data/avatars/pipeline-analyst.svg +0 -54
- package/dist/src/ui/data/avatars/planner.svg +0 -55
- package/dist/src/ui/data/avatars/pr-manager.svg +0 -54
- package/dist/src/ui/data/avatars/pricing-strategist.svg +0 -54
- package/dist/src/ui/data/avatars/product-manager.svg +0 -54
- package/dist/src/ui/data/avatars/production-validator.svg +0 -54
- package/dist/src/ui/data/avatars/project-shepherd.svg +0 -54
- package/dist/src/ui/data/avatars/proposal-strategist.svg +0 -54
- package/dist/src/ui/data/avatars/prosecutor.svg +0 -57
- package/dist/src/ui/data/avatars/pseudocode.svg +0 -53
- package/dist/src/ui/data/avatars/queen-coordinator.svg +0 -55
- package/dist/src/ui/data/avatars/quorum-manager.svg +0 -53
- package/dist/src/ui/data/avatars/raft-manager.svg +0 -53
- package/dist/src/ui/data/avatars/reality-checker.svg +0 -58
- package/dist/src/ui/data/avatars/recruitment.svg +0 -58
- package/dist/src/ui/data/avatars/refinement.svg +0 -53
- package/dist/src/ui/data/avatars/release-manager.svg +0 -54
- package/dist/src/ui/data/avatars/repo-architect.svg +0 -54
- package/dist/src/ui/data/avatars/researcher.svg +0 -58
- package/dist/src/ui/data/avatars/resource-allocator.svg +0 -53
- package/dist/src/ui/data/avatars/reviewer.svg +0 -53
- package/dist/src/ui/data/avatars/safe-executor.svg +0 -53
- package/dist/src/ui/data/avatars/sales-coach.svg +0 -53
- package/dist/src/ui/data/avatars/sales-engineer.svg +0 -58
- package/dist/src/ui/data/avatars/scout-explorer.svg +0 -58
- package/dist/src/ui/data/avatars/security-architect.svg +0 -54
- package/dist/src/ui/data/avatars/security-auditor.svg +0 -55
- package/dist/src/ui/data/avatars/senior-developer.svg +0 -58
- package/dist/src/ui/data/avatars/senior-pm.svg +0 -58
- package/dist/src/ui/data/avatars/seo-specialist.svg +0 -57
- package/dist/src/ui/data/avatars/social-media.svg +0 -54
- package/dist/src/ui/data/avatars/solidity-engineer.svg +0 -58
- package/dist/src/ui/data/avatars/sparc-coder.svg +0 -58
- package/dist/src/ui/data/avatars/sparc-coord.svg +0 -56
- package/dist/src/ui/data/avatars/specification.svg +0 -57
- package/dist/src/ui/data/avatars/sprint-prioritizer.svg +0 -53
- package/dist/src/ui/data/avatars/sre.svg +0 -54
- package/dist/src/ui/data/avatars/studio-operations.svg +0 -53
- package/dist/src/ui/data/avatars/studio-producer.svg +0 -55
- package/dist/src/ui/data/avatars/support-responder.svg +0 -56
- package/dist/src/ui/data/avatars/system-architect.svg +0 -54
- package/dist/src/ui/data/avatars/task-orchestrator.svg +0 -56
- package/dist/src/ui/data/avatars/technical-artist.svg +0 -53
- package/dist/src/ui/data/avatars/technical-writer.svg +0 -59
- package/dist/src/ui/data/avatars/tester.svg +0 -53
- package/dist/src/ui/data/avatars/threat-detection.svg +0 -61
- package/dist/src/ui/data/avatars/trend-researcher.svg +0 -54
- package/dist/src/ui/data/avatars/trial-director.svg +0 -55
- package/dist/src/ui/data/avatars/unity-architect.svg +0 -54
- package/dist/src/ui/data/avatars/visionos-engineer.svg +0 -57
- package/dist/src/ui/data/avatars/worker-specialist.svg +0 -55
- package/dist/src/ui/data/avatars/workflow-architect.svg +0 -57
- package/dist/src/ui/data/avatars/workflow-automation.svg +0 -54
- package/dist/src/ui/data/avatars/zk-steward.svg +0 -54
- package/dist/src/ui/data/known-projects.json +0 -1
- /package/dist/src/{ruvector → monovector}/diff-classifier.js +0 -0
|
@@ -5,6 +5,14 @@
|
|
|
5
5
|
import { mkdirSync, writeFileSync, renameSync, existsSync, readFileSync, statSync, unlinkSync, readdirSync } from 'fs';
|
|
6
6
|
import { dirname, join, resolve, sep } from 'path';
|
|
7
7
|
import { getProjectCwd } from './types.js';
|
|
8
|
+
import { getCapabilities } from '../monovector/capabilities.js';
|
|
9
|
+
import { randomUUID } from 'node:crypto';
|
|
10
|
+
import { recordRoute, joinOutcome, joinLatestUnresolved } from '../monovector/route-outcomes.js';
|
|
11
|
+
import { recordCommand, deriveRecentSuccess } from '../monovector/command-outcomes.js';
|
|
12
|
+
// Base dir for per-route outcome records — sits alongside routing-outcomes.json
|
|
13
|
+
function getRouteOutcomesBaseDir() {
|
|
14
|
+
return join(getProjectCwd(), '.monomind');
|
|
15
|
+
}
|
|
8
16
|
// Real vector search functions - lazy loaded to avoid circular imports
|
|
9
17
|
let searchEntriesFn = null;
|
|
10
18
|
async function getRealSearchFunction() {
|
|
@@ -64,29 +72,6 @@ async function getEWCConsolidator() {
|
|
|
64
72
|
}
|
|
65
73
|
return ewcConsolidator;
|
|
66
74
|
}
|
|
67
|
-
// MoE Router - lazy loaded
|
|
68
|
-
let moeRouter = null;
|
|
69
|
-
async function getMoERouter() {
|
|
70
|
-
if (!moeRouter) {
|
|
71
|
-
try {
|
|
72
|
-
const { getMoERouter: getMoE } = await import('../ruvector/moe-router.js');
|
|
73
|
-
moeRouter = await getMoE();
|
|
74
|
-
}
|
|
75
|
-
catch {
|
|
76
|
-
moeRouter = null;
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
return moeRouter;
|
|
80
|
-
}
|
|
81
|
-
// Semantic Router - lazy loaded
|
|
82
|
-
// Tries native VectorDb first (16k+ routes/s HNSW), falls back to pure JS (47k routes/s cosine)
|
|
83
|
-
let semanticRouter = null;
|
|
84
|
-
let nativeVectorDb = null;
|
|
85
|
-
let semanticRouterInitialized = false;
|
|
86
|
-
let routerBackend = 'none';
|
|
87
|
-
// Pre-computed embeddings for common task patterns (cached, capped to prevent unbounded growth)
|
|
88
|
-
const MAX_PATTERN_EMBEDDINGS = 2000;
|
|
89
|
-
const TASK_PATTERN_EMBEDDINGS = new Map();
|
|
90
75
|
function generateSimpleEmbedding(text, dimension = 384) {
|
|
91
76
|
// Simple deterministic embedding based on character codes
|
|
92
77
|
// This is for routing purposes where we need consistent, fast embeddings
|
|
@@ -125,7 +110,10 @@ function generateSimpleEmbedding(text, dimension = 384) {
|
|
|
125
110
|
}
|
|
126
111
|
// ── Runtime routing outcome persistence ──────────────────────────────
|
|
127
112
|
// Closes the learning loop: post-task records outcomes → route loads them.
|
|
128
|
-
|
|
113
|
+
// Evaluated lazily via getter so it uses runtime CWD, not import-time CWD
|
|
114
|
+
function getRoutingOutcomesPath() {
|
|
115
|
+
return join(getProjectCwd(), '.monomind', 'routing-outcomes.json');
|
|
116
|
+
}
|
|
129
117
|
const ROUTING_STOPWORDS = new Set([
|
|
130
118
|
'the', 'a', 'an', 'is', 'are', 'was', 'were', 'be', 'been', 'being', 'have', 'has', 'had',
|
|
131
119
|
'do', 'does', 'did', 'will', 'would', 'could', 'should', 'may', 'might', 'shall', 'can',
|
|
@@ -146,8 +134,8 @@ function extractKeywords(text) {
|
|
|
146
134
|
}
|
|
147
135
|
function loadRoutingOutcomes() {
|
|
148
136
|
try {
|
|
149
|
-
if (existsSync(
|
|
150
|
-
const data = JSON.parse(readFileSync(
|
|
137
|
+
if (existsSync(getRoutingOutcomesPath())) {
|
|
138
|
+
const data = JSON.parse(readFileSync(getRoutingOutcomesPath(), 'utf-8'));
|
|
151
139
|
return data.outcomes || [];
|
|
152
140
|
}
|
|
153
141
|
}
|
|
@@ -156,14 +144,14 @@ function loadRoutingOutcomes() {
|
|
|
156
144
|
}
|
|
157
145
|
function saveRoutingOutcomes(outcomes) {
|
|
158
146
|
try {
|
|
159
|
-
const dir = dirname(
|
|
147
|
+
const dir = dirname(getRoutingOutcomesPath());
|
|
160
148
|
if (!existsSync(dir))
|
|
161
149
|
mkdirSync(dir, { recursive: true });
|
|
162
150
|
// Cap at 500 entries to bound file size
|
|
163
151
|
const capped = outcomes.slice(-500);
|
|
164
|
-
const tmp =
|
|
152
|
+
const tmp = getRoutingOutcomesPath() + '.tmp';
|
|
165
153
|
writeFileSync(tmp, JSON.stringify({ outcomes: capped }, null, 2));
|
|
166
|
-
renameSync(tmp,
|
|
154
|
+
renameSync(tmp, getRoutingOutcomesPath());
|
|
167
155
|
}
|
|
168
156
|
catch { /* non-critical */ }
|
|
169
157
|
}
|
|
@@ -257,107 +245,6 @@ const TASK_PATTERNS = {
|
|
|
257
245
|
agents: ['memory-specialist', 'architect', 'coder'],
|
|
258
246
|
},
|
|
259
247
|
};
|
|
260
|
-
/**
|
|
261
|
-
* Get the semantic router with environment detection.
|
|
262
|
-
* Tries native VectorDb first (HNSW, 16k routes/s), falls back to pure JS (47k routes/s cosine).
|
|
263
|
-
*/
|
|
264
|
-
async function getSemanticRouter() {
|
|
265
|
-
if (semanticRouterInitialized) {
|
|
266
|
-
return { router: semanticRouter, backend: routerBackend, native: nativeVectorDb };
|
|
267
|
-
}
|
|
268
|
-
semanticRouterInitialized = true;
|
|
269
|
-
// STEP 1: Try native VectorDb from @ruvector/router (HNSW-backed)
|
|
270
|
-
// Note: Native VectorDb uses a persistent database file which can have lock issues
|
|
271
|
-
// in concurrent environments. We try it first but fall back gracefully to pure JS.
|
|
272
|
-
try {
|
|
273
|
-
// Use createRequire for ESM compatibility with native modules
|
|
274
|
-
const { createRequire } = await import('module');
|
|
275
|
-
const require = createRequire(import.meta.url);
|
|
276
|
-
const router = require('@ruvector/router');
|
|
277
|
-
if (router.VectorDb && router.DistanceMetric) {
|
|
278
|
-
// Try to create VectorDb - may fail with lock error in concurrent envs
|
|
279
|
-
const db = new router.VectorDb({
|
|
280
|
-
dimensions: 384,
|
|
281
|
-
distanceMetric: router.DistanceMetric.Cosine,
|
|
282
|
-
hnswM: 16,
|
|
283
|
-
hnswEfConstruction: 200,
|
|
284
|
-
hnswEfSearch: 100,
|
|
285
|
-
});
|
|
286
|
-
// Initialize with static + runtime-learned task patterns
|
|
287
|
-
for (const [patternName, { keywords }] of Object.entries(getMergedTaskPatterns())) {
|
|
288
|
-
for (const keyword of keywords) {
|
|
289
|
-
const embedding = generateSimpleEmbedding(keyword);
|
|
290
|
-
db.insert(`${patternName}:${keyword}`, embedding);
|
|
291
|
-
if (TASK_PATTERN_EMBEDDINGS.size < MAX_PATTERN_EMBEDDINGS) {
|
|
292
|
-
TASK_PATTERN_EMBEDDINGS.set(`${patternName}:${keyword}`, embedding);
|
|
293
|
-
}
|
|
294
|
-
}
|
|
295
|
-
}
|
|
296
|
-
nativeVectorDb = db;
|
|
297
|
-
routerBackend = 'native';
|
|
298
|
-
return { router: null, backend: routerBackend, native: nativeVectorDb };
|
|
299
|
-
}
|
|
300
|
-
}
|
|
301
|
-
catch (err) {
|
|
302
|
-
// Native not available or database locked - fall back to pure JS
|
|
303
|
-
// Common errors: "Database already open. Cannot acquire lock." or "MODULE_NOT_FOUND"
|
|
304
|
-
// This is expected in concurrent environments or when binary isn't installed
|
|
305
|
-
}
|
|
306
|
-
// STEP 2: Fall back to pure JS SemanticRouter
|
|
307
|
-
try {
|
|
308
|
-
const { SemanticRouter } = await import('../ruvector/semantic-router.js');
|
|
309
|
-
semanticRouter = new SemanticRouter({ dimension: 384 });
|
|
310
|
-
for (const [patternName, { keywords, agents }] of Object.entries(getMergedTaskPatterns())) {
|
|
311
|
-
const embeddings = keywords.map(kw => generateSimpleEmbedding(kw));
|
|
312
|
-
semanticRouter.addIntentWithEmbeddings(patternName, embeddings, { agents, keywords });
|
|
313
|
-
// Cache embeddings for keywords (capped)
|
|
314
|
-
keywords.forEach((kw, i) => {
|
|
315
|
-
if (TASK_PATTERN_EMBEDDINGS.size < MAX_PATTERN_EMBEDDINGS) {
|
|
316
|
-
TASK_PATTERN_EMBEDDINGS.set(kw, embeddings[i]);
|
|
317
|
-
}
|
|
318
|
-
});
|
|
319
|
-
}
|
|
320
|
-
routerBackend = 'pure-js';
|
|
321
|
-
}
|
|
322
|
-
catch {
|
|
323
|
-
semanticRouter = null;
|
|
324
|
-
routerBackend = 'none';
|
|
325
|
-
}
|
|
326
|
-
return { router: semanticRouter, backend: routerBackend, native: nativeVectorDb };
|
|
327
|
-
}
|
|
328
|
-
/**
|
|
329
|
-
* Get router backend info for status display.
|
|
330
|
-
*/
|
|
331
|
-
function getRouterBackendInfo() {
|
|
332
|
-
switch (routerBackend) {
|
|
333
|
-
case 'native':
|
|
334
|
-
return { backend: 'native VectorDb (HNSW)', speed: '16k+ routes/s' };
|
|
335
|
-
case 'pure-js':
|
|
336
|
-
return { backend: 'pure JS (cosine)', speed: '47k routes/s' };
|
|
337
|
-
default:
|
|
338
|
-
return { backend: 'none', speed: 'N/A' };
|
|
339
|
-
}
|
|
340
|
-
}
|
|
341
|
-
// Flash Attention - lazy loaded
|
|
342
|
-
let flashAttention = null;
|
|
343
|
-
async function getFlashAttention() {
|
|
344
|
-
if (!flashAttention) {
|
|
345
|
-
try {
|
|
346
|
-
const { getFlashAttention: getFlash } = await import('../ruvector/flash-attention.js');
|
|
347
|
-
flashAttention = await getFlash();
|
|
348
|
-
}
|
|
349
|
-
catch {
|
|
350
|
-
flashAttention = null;
|
|
351
|
-
}
|
|
352
|
-
}
|
|
353
|
-
return flashAttention;
|
|
354
|
-
}
|
|
355
|
-
// LoRA Adapter removed — superseded by SONA instant adaptation
|
|
356
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
357
|
-
let loraAdapter = null;
|
|
358
|
-
async function getLoRAAdapter() {
|
|
359
|
-
return loraAdapter;
|
|
360
|
-
}
|
|
361
248
|
// In-memory trajectory tracking (persisted on end)
|
|
362
249
|
const activeTrajectories = new Map();
|
|
363
250
|
const MEMORY_DIR = '.monomind/memory';
|
|
@@ -533,50 +420,12 @@ function suggestAgentsForTask(task) {
|
|
|
533
420
|
// Canonical set of valid monomind agent type strings.
|
|
534
421
|
// Patterns whose type is not in this set (e.g. 'action', 'observation', 'routing')
|
|
535
422
|
// are structural labels, not agent names, and must be excluded from routing.
|
|
536
|
-
//
|
|
537
|
-
//
|
|
538
|
-
//
|
|
539
|
-
//
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
async function applyNeuralAdaptation(text, dimensions) {
|
|
543
|
-
if (!_neuralRouterInitPromise) {
|
|
544
|
-
_neuralRouterInitPromise = (async () => {
|
|
545
|
-
try {
|
|
546
|
-
const neural = await import('@monomind/neural').catch(() => null);
|
|
547
|
-
if (neural?.createNeuralLearningSystem) {
|
|
548
|
-
const sys = neural.createNeuralLearningSystem('balanced');
|
|
549
|
-
await sys.initialize();
|
|
550
|
-
_neuralRouterInstance = sys;
|
|
551
|
-
}
|
|
552
|
-
}
|
|
553
|
-
catch {
|
|
554
|
-
_neuralRouterInstance = null;
|
|
555
|
-
}
|
|
556
|
-
})();
|
|
557
|
-
}
|
|
558
|
-
await _neuralRouterInitPromise;
|
|
559
|
-
if (!_neuralRouterInstance)
|
|
560
|
-
return null;
|
|
561
|
-
try {
|
|
562
|
-
const base = new Float32Array(dimensions);
|
|
563
|
-
// Use a hash embedding as the base for the LoRA transform
|
|
564
|
-
const words = text.toLowerCase().split(/\s+/);
|
|
565
|
-
for (let i = 0; i < dimensions; i++) {
|
|
566
|
-
let v = 0;
|
|
567
|
-
for (let w = 0; w < words.length; w++) {
|
|
568
|
-
for (let c = 0; c < words[w].length; c++) {
|
|
569
|
-
v += Math.sin((words[w].charCodeAt(c) * (i + 1) + w * 17) * 0.0137);
|
|
570
|
-
}
|
|
571
|
-
}
|
|
572
|
-
base[i] = v;
|
|
573
|
-
}
|
|
574
|
-
return await _neuralRouterInstance.getSONAManager().applyAdaptations(base);
|
|
575
|
-
}
|
|
576
|
-
catch {
|
|
577
|
-
return null;
|
|
578
|
-
}
|
|
579
|
-
}
|
|
423
|
+
//
|
|
424
|
+
// Lean teardown: the SONA neural LoRA routing adaptation (applyNeuralAdaptation +
|
|
425
|
+
// the @monomind/neural NeuralLearningSystem singleton) has been removed. Routing now
|
|
426
|
+
// uses the pure keyword path plus the deterministic generateSimpleEmbedding query
|
|
427
|
+
// against the pattern index, with outcomes recorded via route-outcomes. No ONNX /
|
|
428
|
+
// LoRA inference happens on the routing hot path anymore.
|
|
580
429
|
const VALID_AGENT_TYPES = new Set([
|
|
581
430
|
'coder', 'reviewer', 'tester', 'planner', 'researcher',
|
|
582
431
|
'architect', 'security-architect', 'security-auditor',
|
|
@@ -712,6 +561,9 @@ export const hooksPostEdit = {
|
|
|
712
561
|
success,
|
|
713
562
|
quality: success ? 0.85 : 0.3,
|
|
714
563
|
agent,
|
|
564
|
+
// B1.2: give the SONA embedder real semantics (the edited file) instead of
|
|
565
|
+
// the opaque task ID.
|
|
566
|
+
task: `edit ${filePath}`,
|
|
715
567
|
});
|
|
716
568
|
}
|
|
717
569
|
catch {
|
|
@@ -779,6 +631,14 @@ export const hooksPostCommand = {
|
|
|
779
631
|
const command = params.command;
|
|
780
632
|
const exitCode = params.exitCode || 0;
|
|
781
633
|
const success = exitCode === 0;
|
|
634
|
+
// Record the real exit code in the time-windowed command-outcome store so
|
|
635
|
+
// post-task can derive a MEASURED success signal (grounded in actual exit
|
|
636
|
+
// codes) when the caller does not explicitly assert --success. Non-fatal.
|
|
637
|
+
await recordCommand(getRouteOutcomesBaseDir(), {
|
|
638
|
+
ts: Date.now(),
|
|
639
|
+
command: typeof command === 'string' ? command.slice(0, 200) : String(command).slice(0, 200),
|
|
640
|
+
exitCode,
|
|
641
|
+
});
|
|
782
642
|
// Persist command outcome via AgentDB
|
|
783
643
|
let _storedIn = 'none';
|
|
784
644
|
try {
|
|
@@ -842,10 +702,26 @@ export const hooksRoute = {
|
|
|
842
702
|
if (agentdbRoute && agentdbRoute.confidence > 0.5) {
|
|
843
703
|
const agents = agentdbRoute.agents.length > 0 ? agentdbRoute.agents : ['coder', 'researcher'];
|
|
844
704
|
const complexity = task.length > 200 ? 'high' : task.length < 50 ? 'low' : 'medium';
|
|
705
|
+
const agentdbMethod = `agentdb-${agentdbRoute.controller}`;
|
|
706
|
+
const agentdbConfidence = Math.round(agentdbRoute.confidence * 100) / 100;
|
|
707
|
+
// Record the route recommendation so post-task can join the actual outcome
|
|
708
|
+
const routeId = randomUUID();
|
|
709
|
+
const caps = await getCapabilities();
|
|
710
|
+
const learningMode = (caps.sona || caps.router === 'native' || caps.attention) ? 'native' : 'js';
|
|
711
|
+
await recordRoute(getRouteOutcomesBaseDir(), {
|
|
712
|
+
routeId,
|
|
713
|
+
ts: Date.now(),
|
|
714
|
+
task,
|
|
715
|
+
recommendedAgent: agents[0],
|
|
716
|
+
routingMethod: agentdbMethod,
|
|
717
|
+
confidence: agentdbConfidence,
|
|
718
|
+
learningMode,
|
|
719
|
+
});
|
|
845
720
|
return {
|
|
721
|
+
routeId,
|
|
846
722
|
task,
|
|
847
723
|
routing: {
|
|
848
|
-
method:
|
|
724
|
+
method: agentdbMethod,
|
|
849
725
|
backend: agentdbRoute.controller,
|
|
850
726
|
latencyMs: 0,
|
|
851
727
|
throughput: 'N/A',
|
|
@@ -875,71 +751,16 @@ export const hooksRoute = {
|
|
|
875
751
|
// AgentDB router not available — fall through to local routing
|
|
876
752
|
}
|
|
877
753
|
}
|
|
878
|
-
//
|
|
879
|
-
const
|
|
880
|
-
? await getSemanticRouter()
|
|
881
|
-
: { router: null, backend: 'none', native: null };
|
|
882
|
-
let semanticResult = [];
|
|
754
|
+
// Deterministic keyword routing is the baseline (and only) local path.
|
|
755
|
+
const semanticResult = [];
|
|
883
756
|
let routingMethod = 'keyword';
|
|
884
|
-
|
|
757
|
+
const routingLatencyMs = 0;
|
|
885
758
|
let backendInfo = '';
|
|
886
|
-
|
|
887
|
-
// Apply LoRA adaptations from the neural system when available.
|
|
888
|
-
// The adapted embedding reflects what was learned in prior sessions
|
|
889
|
-
// (loaded from learned-state.json during _neuralRouterInstance.initialize()).
|
|
890
|
-
let queryEmbedding = generateSimpleEmbedding(queryText);
|
|
891
|
-
try {
|
|
892
|
-
const adapted = await applyNeuralAdaptation(queryText, 768);
|
|
893
|
-
if (adapted)
|
|
894
|
-
queryEmbedding = adapted.slice(0, 384);
|
|
895
|
-
}
|
|
896
|
-
catch { /* fall through to hash embedding */ }
|
|
897
|
-
// Try native VectorDb (HNSW-backed)
|
|
898
|
-
if (native && backend === 'native') {
|
|
899
|
-
const routeStart = performance.now();
|
|
900
|
-
try {
|
|
901
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
902
|
-
const results = native.search(queryEmbedding, 5);
|
|
903
|
-
routingLatencyMs = performance.now() - routeStart;
|
|
904
|
-
routingMethod = 'semantic-native';
|
|
905
|
-
backendInfo = 'native VectorDb (HNSW)';
|
|
906
|
-
// Convert results to semantic format
|
|
907
|
-
const mergedPatterns = getMergedTaskPatterns();
|
|
908
|
-
semanticResult = results.map((r) => {
|
|
909
|
-
const [patternName] = r.id.split(':');
|
|
910
|
-
const pattern = mergedPatterns[patternName];
|
|
911
|
-
return {
|
|
912
|
-
intent: patternName,
|
|
913
|
-
score: 1 - r.score, // Native uses distance (lower is better), convert to similarity
|
|
914
|
-
metadata: {
|
|
915
|
-
agents: pattern?.agents || (patternName.startsWith('learned-') ? [patternName.slice(8)] : ['coder']),
|
|
916
|
-
},
|
|
917
|
-
};
|
|
918
|
-
});
|
|
919
|
-
}
|
|
920
|
-
catch {
|
|
921
|
-
// Native failed, try pure JS fallback
|
|
922
|
-
}
|
|
923
|
-
}
|
|
924
|
-
// Try pure JS SemanticRouter fallback
|
|
925
|
-
if (router && backend === 'pure-js' && semanticResult.length === 0) {
|
|
926
|
-
const routeStart = performance.now();
|
|
927
|
-
semanticResult = router.routeWithEmbedding(queryEmbedding, 3);
|
|
928
|
-
routingLatencyMs = performance.now() - routeStart;
|
|
929
|
-
routingMethod = 'semantic-pure-js';
|
|
930
|
-
backendInfo = 'pure JS (cosine similarity)';
|
|
931
|
-
}
|
|
932
|
-
// Get agents from semantic routing or fall back to keyword
|
|
759
|
+
// Get agents from keyword routing
|
|
933
760
|
let agents;
|
|
934
761
|
let confidence;
|
|
935
762
|
let matchedPattern = '';
|
|
936
|
-
|
|
937
|
-
const topMatch = semanticResult[0];
|
|
938
|
-
agents = topMatch.metadata.agents || ['coder', 'researcher'];
|
|
939
|
-
confidence = topMatch.score;
|
|
940
|
-
matchedPattern = topMatch.intent;
|
|
941
|
-
}
|
|
942
|
-
else {
|
|
763
|
+
{
|
|
943
764
|
// Keyword fallback is the baseline
|
|
944
765
|
const keywordSuggestion = suggestAgentsForTask(task);
|
|
945
766
|
agents = keywordSuggestion.agents;
|
|
@@ -973,7 +794,22 @@ export const hooksRoute = {
|
|
|
973
794
|
: taskLower.includes('simple') || taskLower.includes('fix') || task.length < 50
|
|
974
795
|
? 'low'
|
|
975
796
|
: 'medium';
|
|
797
|
+
const primaryConfidence = Math.round(confidence * 100) / 100;
|
|
798
|
+
// Record the route recommendation so post-task can join the actual outcome
|
|
799
|
+
const routeId = randomUUID();
|
|
800
|
+
const caps = await getCapabilities();
|
|
801
|
+
const learningMode = (caps.sona || caps.router === 'native' || caps.attention) ? 'native' : 'js';
|
|
802
|
+
await recordRoute(getRouteOutcomesBaseDir(), {
|
|
803
|
+
routeId,
|
|
804
|
+
ts: Date.now(),
|
|
805
|
+
task,
|
|
806
|
+
recommendedAgent: agents[0],
|
|
807
|
+
routingMethod,
|
|
808
|
+
confidence: primaryConfidence,
|
|
809
|
+
learningMode,
|
|
810
|
+
});
|
|
976
811
|
return {
|
|
812
|
+
routeId,
|
|
977
813
|
task,
|
|
978
814
|
routing: {
|
|
979
815
|
method: routingMethod,
|
|
@@ -1136,43 +972,8 @@ export const hooksPreTask = {
|
|
|
1136
972
|
: descLower.includes('simple') || descLower.includes('fix') || description.length < 50
|
|
1137
973
|
? 'low'
|
|
1138
974
|
: 'medium';
|
|
1139
|
-
// Enhanced model routing
|
|
1140
|
-
|
|
1141
|
-
try {
|
|
1142
|
-
const { getEnhancedModelRouter } = await import('../ruvector/enhanced-model-router.js');
|
|
1143
|
-
const router = getEnhancedModelRouter();
|
|
1144
|
-
const routeResult = await router.route(description, { filePath });
|
|
1145
|
-
if (routeResult.tier === 1) {
|
|
1146
|
-
// Agent Booster can handle this task
|
|
1147
|
-
modelRouting = {
|
|
1148
|
-
tier: 1,
|
|
1149
|
-
handler: 'agent-booster',
|
|
1150
|
-
canSkipLLM: true,
|
|
1151
|
-
agentBoosterIntent: routeResult.agentBoosterIntent?.type,
|
|
1152
|
-
intentDescription: routeResult.agentBoosterIntent?.description,
|
|
1153
|
-
confidence: routeResult.confidence,
|
|
1154
|
-
estimatedLatencyMs: routeResult.estimatedLatencyMs,
|
|
1155
|
-
estimatedCost: routeResult.estimatedCost,
|
|
1156
|
-
recommendation: `[AGENT_BOOSTER_AVAILABLE] Skip LLM - use Agent Booster for "${routeResult.agentBoosterIntent?.type}"`,
|
|
1157
|
-
};
|
|
1158
|
-
}
|
|
1159
|
-
else {
|
|
1160
|
-
// LLM required
|
|
1161
|
-
modelRouting = {
|
|
1162
|
-
tier: routeResult.tier,
|
|
1163
|
-
handler: routeResult.handler,
|
|
1164
|
-
model: routeResult.model,
|
|
1165
|
-
complexity: routeResult.complexity,
|
|
1166
|
-
confidence: routeResult.confidence,
|
|
1167
|
-
estimatedLatencyMs: routeResult.estimatedLatencyMs,
|
|
1168
|
-
estimatedCost: routeResult.estimatedCost,
|
|
1169
|
-
recommendation: `[TASK_MODEL_RECOMMENDATION] Use model="${routeResult.model}" for this task`,
|
|
1170
|
-
};
|
|
1171
|
-
}
|
|
1172
|
-
}
|
|
1173
|
-
catch {
|
|
1174
|
-
// Enhanced router not available
|
|
1175
|
-
}
|
|
975
|
+
// Enhanced model routing module was never shipped — modelRouting stays undefined.
|
|
976
|
+
const modelRouting = undefined;
|
|
1176
977
|
// ERL: Retrieve past heuristics to inject into recommendations
|
|
1177
978
|
// Source: https://arxiv.org/abs/2603.24639
|
|
1178
979
|
const erlHints = [];
|
|
@@ -1246,12 +1047,37 @@ export const hooksPostTask = {
|
|
|
1246
1047
|
quality: { type: 'number', description: 'Quality score (0-1)' },
|
|
1247
1048
|
task: { type: 'string', description: 'Task description text (used for learning keyword extraction)' },
|
|
1248
1049
|
storeDecisions: { type: 'boolean', description: 'Also store routing decision in memory DB' },
|
|
1050
|
+
routeId: { type: 'string', description: 'Route ID from a prior hooks_route call — joins the recommendation to this outcome' },
|
|
1249
1051
|
},
|
|
1250
1052
|
required: ['taskId'],
|
|
1251
1053
|
},
|
|
1252
1054
|
handler: async (params) => {
|
|
1253
1055
|
const taskId = params.taskId;
|
|
1254
|
-
|
|
1056
|
+
// The success flag, when the caller asserts it (--success true), is taken as
|
|
1057
|
+
// ground truth. But callers usually do NOT pass it. Rather than treating every
|
|
1058
|
+
// unverified task as "unknown" (and thus excluding it from learning), we now
|
|
1059
|
+
// derive a MEASURED success signal from the real command exit codes recorded by
|
|
1060
|
+
// post-command within a recent time window. post-command appends each exit code
|
|
1061
|
+
// to the command-outcome store keyed by timestamp; deriveRecentSuccess returns:
|
|
1062
|
+
// true → recent commands exist and ALL exited 0
|
|
1063
|
+
// false → recent commands exist and ANY exited non-zero
|
|
1064
|
+
// null → no recent commands (genuinely no signal → stays unknown)
|
|
1065
|
+
// Precedence: an explicit --success ALWAYS wins; the derived signal only fills
|
|
1066
|
+
// in when no explicit flag is given; only when there is also no recent command
|
|
1067
|
+
// signal does the outcome stay unknown (and excluded from SONA + route join,
|
|
1068
|
+
// per the existing "unknown ≠ success" principle).
|
|
1069
|
+
const explicitSuccess = typeof params.success === 'boolean';
|
|
1070
|
+
let outcomeKnown = explicitSuccess;
|
|
1071
|
+
let success = params.success !== false;
|
|
1072
|
+
let successSource = explicitSuccess ? 'explicit' : 'unknown';
|
|
1073
|
+
if (!explicitSuccess) {
|
|
1074
|
+
const derived = await deriveRecentSuccess(getRouteOutcomesBaseDir());
|
|
1075
|
+
if (derived !== null) {
|
|
1076
|
+
outcomeKnown = true;
|
|
1077
|
+
success = derived;
|
|
1078
|
+
successSource = 'derived-commands';
|
|
1079
|
+
}
|
|
1080
|
+
}
|
|
1255
1081
|
const agent = params.agent;
|
|
1256
1082
|
const quality = params.quality || (success ? 0.85 : 0.3);
|
|
1257
1083
|
const startTime = Date.now();
|
|
@@ -1264,6 +1090,11 @@ export const hooksPostTask = {
|
|
|
1264
1090
|
success,
|
|
1265
1091
|
quality,
|
|
1266
1092
|
agent,
|
|
1093
|
+
// B1.2: thread the real task description into the SONA trajectory so the
|
|
1094
|
+
// embedder encodes meaning, not the opaque task ID.
|
|
1095
|
+
task: params.task || undefined,
|
|
1096
|
+
// B1.3: only feed the SONA LoRA update when the outcome is actually known.
|
|
1097
|
+
outcomeKnown,
|
|
1267
1098
|
duration: params.duration || undefined,
|
|
1268
1099
|
patterns: params.patterns || undefined,
|
|
1269
1100
|
});
|
|
@@ -1284,11 +1115,14 @@ export const hooksPostTask = {
|
|
|
1284
1115
|
catch {
|
|
1285
1116
|
// Non-fatal
|
|
1286
1117
|
}
|
|
1287
|
-
// Persist routing outcome for runtime learning (file-based, always reliable)
|
|
1118
|
+
// Persist routing outcome for runtime learning (file-based, always reliable).
|
|
1119
|
+
// B1.3: also gate this sibling learning sink on a known outcome — an unverified
|
|
1120
|
+
// task must not train the router as a success either. When the caller did not
|
|
1121
|
+
// assert success, the outcome is unknown and we skip persisting a labeled sample.
|
|
1288
1122
|
const taskText = params.task || '';
|
|
1289
1123
|
const outcomeKeywords = extractKeywords(taskText);
|
|
1290
1124
|
let outcomePersisted = false;
|
|
1291
|
-
if (taskText && agent && agent.length <= 100 && /^[a-zA-Z0-9_-]+$/.test(agent)) {
|
|
1125
|
+
if (outcomeKnown && taskText && agent && agent.length <= 100 && /^[a-zA-Z0-9_-]+$/.test(agent)) {
|
|
1292
1126
|
try {
|
|
1293
1127
|
const outcomes = loadRoutingOutcomes();
|
|
1294
1128
|
outcomes.push({
|
|
@@ -1304,6 +1138,26 @@ export const hooksPostTask = {
|
|
|
1304
1138
|
}
|
|
1305
1139
|
catch { /* non-critical */ }
|
|
1306
1140
|
}
|
|
1141
|
+
// Join this outcome back onto the original route recommendation. This is the
|
|
1142
|
+
// recommendation→actual→success link that routing-accuracy metrics and SONA
|
|
1143
|
+
// labels depend on. When the caller threads an explicit routeId we join that
|
|
1144
|
+
// record; otherwise we auto-correlate to the most recent unresolved route
|
|
1145
|
+
// (within a 10-min window) so the loop closes without the LLM manually
|
|
1146
|
+
// threading the routeId. Only join when the outcome is actually measured —
|
|
1147
|
+
// per "unknown ≠ success", an unverified task must not pollute the metric.
|
|
1148
|
+
if (outcomeKnown) {
|
|
1149
|
+
const outcome = {
|
|
1150
|
+
agentActuallyUsed: agent,
|
|
1151
|
+
measuredSuccess: success,
|
|
1152
|
+
quality: typeof params.quality === 'number' ? params.quality : undefined,
|
|
1153
|
+
};
|
|
1154
|
+
if (params.routeId) {
|
|
1155
|
+
await joinOutcome(getRouteOutcomesBaseDir(), params.routeId, outcome);
|
|
1156
|
+
}
|
|
1157
|
+
else {
|
|
1158
|
+
await joinLatestUnresolved(getRouteOutcomesBaseDir(), outcome);
|
|
1159
|
+
}
|
|
1160
|
+
}
|
|
1307
1161
|
// ERL: Extract and persist structured heuristic for future pre-task injection
|
|
1308
1162
|
// Source: https://arxiv.org/abs/2603.24639
|
|
1309
1163
|
if (taskText && agent && success !== undefined) {
|
|
@@ -1376,6 +1230,8 @@ export const hooksPostTask = {
|
|
|
1376
1230
|
return {
|
|
1377
1231
|
taskId,
|
|
1378
1232
|
success,
|
|
1233
|
+
outcomeKnown,
|
|
1234
|
+
successSource,
|
|
1379
1235
|
duration,
|
|
1380
1236
|
learningUpdates: {
|
|
1381
1237
|
patternsUpdated: feedbackResult?.updated || (success ? 2 : 1),
|
|
@@ -1427,7 +1283,7 @@ export const hooksExplain = {
|
|
|
1427
1283
|
let historicalSuccess = null;
|
|
1428
1284
|
let historicalNote = 'No historical data yet';
|
|
1429
1285
|
try {
|
|
1430
|
-
const outcomesPath =
|
|
1286
|
+
const outcomesPath = getRoutingOutcomesPath();
|
|
1431
1287
|
if (existsSync(outcomesPath)) {
|
|
1432
1288
|
const data = JSON.parse(readFileSync(outcomesPath, 'utf-8'));
|
|
1433
1289
|
const outcomes = data.outcomes || [];
|
|
@@ -1843,7 +1699,11 @@ export const hooksSessionEnd = {
|
|
|
1843
1699
|
handler: async (params) => {
|
|
1844
1700
|
const saveState = params.saveState !== false;
|
|
1845
1701
|
const shouldStopDaemon = params.stopDaemon !== false;
|
|
1846
|
-
|
|
1702
|
+
// Use caller-supplied sessionId if provided, otherwise generate a current-time ID.
|
|
1703
|
+
// The -3600000 offset was incorrect — it prevented matching session-start IDs.
|
|
1704
|
+
const sessionId = typeof params.sessionId === 'string' && params.sessionId
|
|
1705
|
+
? params.sessionId
|
|
1706
|
+
: `session-${Date.now()}`;
|
|
1847
1707
|
// Stop daemon if enabled
|
|
1848
1708
|
let daemonStopped = false;
|
|
1849
1709
|
if (shouldStopDaemon) {
|
|
@@ -1866,7 +1726,7 @@ export const hooksSessionEnd = {
|
|
|
1866
1726
|
// Check for pending-insights.jsonl
|
|
1867
1727
|
let insightCount = 0;
|
|
1868
1728
|
try {
|
|
1869
|
-
const insightsPath =
|
|
1729
|
+
const insightsPath = join(getProjectCwd(), '.monomind', 'data', 'pending-insights.jsonl');
|
|
1870
1730
|
if (existsSync(insightsPath)) {
|
|
1871
1731
|
const content = readFileSync(insightsPath, 'utf-8').trim();
|
|
1872
1732
|
insightCount = content ? content.split('\n').length : 0;
|
|
@@ -2019,10 +1879,10 @@ export const hooksInit = {
|
|
|
2019
1879
|
};
|
|
2020
1880
|
},
|
|
2021
1881
|
};
|
|
2022
|
-
// Intelligence hook -
|
|
1882
|
+
// Intelligence hook - JS pattern/trajectory logging
|
|
2023
1883
|
export const hooksIntelligence = {
|
|
2024
1884
|
name: 'hooks_intelligence',
|
|
2025
|
-
description: '
|
|
1885
|
+
description: 'Intelligence status: pattern/trajectory logging metrics from the memory store',
|
|
2026
1886
|
inputSchema: {
|
|
2027
1887
|
type: 'object',
|
|
2028
1888
|
properties: {
|
|
@@ -2043,29 +1903,25 @@ export const hooksIntelligence = {
|
|
|
2043
1903
|
const realStats = getIntelligenceStatsFromMemory();
|
|
2044
1904
|
// Check actual implementation availability
|
|
2045
1905
|
const sonaAvailable = (await getSONAOptimizer()) !== null;
|
|
2046
|
-
const moeAvailable = (await getMoERouter()) !== null;
|
|
2047
|
-
const flashAvailable = (await getFlashAttention()) !== null;
|
|
2048
|
-
const ewcAvailable = (await getEWCConsolidator()) !== null;
|
|
2049
|
-
const loraAvailable = (await getLoRAAdapter()) !== null;
|
|
2050
1906
|
return {
|
|
2051
1907
|
mode,
|
|
2052
1908
|
status: 'active',
|
|
2053
1909
|
components: {
|
|
2054
1910
|
sona: {
|
|
2055
1911
|
enabled: enableSona,
|
|
2056
|
-
status: sonaAvailable ? 'active' : '
|
|
2057
|
-
implemented: true,
|
|
1912
|
+
status: sonaAvailable ? 'active' : 'idle',
|
|
1913
|
+
implemented: true,
|
|
2058
1914
|
trajectoriesRecorded: realStats.trajectories.total,
|
|
2059
1915
|
trajectoriesSuccessful: realStats.trajectories.successful,
|
|
2060
1916
|
patternsLearned: realStats.patterns.learned,
|
|
2061
|
-
note:
|
|
1917
|
+
note: 'Trajectory + pattern logging (no neural training in the lean build)',
|
|
2062
1918
|
},
|
|
2063
1919
|
moe: {
|
|
2064
|
-
enabled:
|
|
2065
|
-
status:
|
|
2066
|
-
implemented:
|
|
1920
|
+
enabled: false,
|
|
1921
|
+
status: 'removed',
|
|
1922
|
+
implemented: false,
|
|
2067
1923
|
routingDecisions: realStats.routing.decisions,
|
|
2068
|
-
note:
|
|
1924
|
+
note: 'MoE removed in lean build; keyword routing is used instead (see monoes-full-loop)',
|
|
2069
1925
|
},
|
|
2070
1926
|
hnsw: {
|
|
2071
1927
|
enabled: enableHnsw,
|
|
@@ -2073,25 +1929,25 @@ export const hooksIntelligence = {
|
|
|
2073
1929
|
implemented: true,
|
|
2074
1930
|
indexSize: realStats.memory.indexSize,
|
|
2075
1931
|
memorySizeBytes: realStats.memory.memorySizeBytes,
|
|
2076
|
-
note: 'HNSW vector indexing
|
|
1932
|
+
note: 'Pure-JS HNSW vector indexing (O(log n) vs O(n))',
|
|
2077
1933
|
},
|
|
2078
1934
|
flashAttention: {
|
|
2079
|
-
enabled:
|
|
2080
|
-
status:
|
|
2081
|
-
implemented:
|
|
2082
|
-
note:
|
|
1935
|
+
enabled: false,
|
|
1936
|
+
status: 'removed',
|
|
1937
|
+
implemented: false,
|
|
1938
|
+
note: 'Flash Attention removed in lean build; lives on monoes-full-loop branch',
|
|
2083
1939
|
},
|
|
2084
1940
|
ewc: {
|
|
2085
|
-
enabled:
|
|
2086
|
-
status:
|
|
2087
|
-
implemented:
|
|
2088
|
-
note:
|
|
1941
|
+
enabled: false,
|
|
1942
|
+
status: 'removed',
|
|
1943
|
+
implemented: false,
|
|
1944
|
+
note: 'EWC++ removed in lean build; lives on monoes-full-loop branch',
|
|
2089
1945
|
},
|
|
2090
1946
|
lora: {
|
|
2091
|
-
enabled:
|
|
2092
|
-
status:
|
|
2093
|
-
implemented:
|
|
2094
|
-
note:
|
|
1947
|
+
enabled: false,
|
|
1948
|
+
status: 'removed',
|
|
1949
|
+
implemented: false,
|
|
1950
|
+
note: 'LoRA removed in lean build; lives on monoes-full-loop branch',
|
|
2095
1951
|
},
|
|
2096
1952
|
embeddings: {
|
|
2097
1953
|
provider: 'transformers',
|
|
@@ -2110,11 +1966,13 @@ export const hooksIntelligence = {
|
|
|
2110
1966
|
implementationStatus: {
|
|
2111
1967
|
working: [
|
|
2112
1968
|
'memory-store', 'embeddings', 'trajectory-recording', 'claims', 'swarm-coordination',
|
|
2113
|
-
'hnsw-index', 'pattern-storage', '
|
|
2114
|
-
'flash-attention', 'lora-adapter'
|
|
1969
|
+
'hnsw-index', 'pattern-storage', 'keyword-routing'
|
|
2115
1970
|
],
|
|
2116
1971
|
partial: [],
|
|
2117
1972
|
notImplemented: [],
|
|
1973
|
+
removed: [
|
|
1974
|
+
'sona-optimizer', 'ewc-consolidation', 'moe-routing', 'flash-attention', 'lora-adapter'
|
|
1975
|
+
],
|
|
2118
1976
|
},
|
|
2119
1977
|
version: '3.0.0-alpha.102',
|
|
2120
1978
|
};
|
|
@@ -2575,7 +2433,7 @@ export const hooksPatternSearch = {
|
|
|
2575
2433
|
// Intelligence stats hook
|
|
2576
2434
|
export const hooksIntelligenceStats = {
|
|
2577
2435
|
name: 'hooks_intelligence_stats',
|
|
2578
|
-
description: 'Get
|
|
2436
|
+
description: 'Get intelligence-layer statistics (pattern/trajectory logging)',
|
|
2579
2437
|
inputSchema: {
|
|
2580
2438
|
type: 'object',
|
|
2581
2439
|
properties: {
|
|
@@ -2587,9 +2445,6 @@ export const hooksIntelligenceStats = {
|
|
|
2587
2445
|
// Get REAL statistics from actual implementations
|
|
2588
2446
|
const sona = await getSONAOptimizer();
|
|
2589
2447
|
const ewc = await getEWCConsolidator();
|
|
2590
|
-
const moe = await getMoERouter();
|
|
2591
|
-
const flash = await getFlashAttention();
|
|
2592
|
-
const lora = await getLoRAAdapter();
|
|
2593
2448
|
// Fallback to memory store for legacy data
|
|
2594
2449
|
const memoryStats = getIntelligenceStatsFromMemory();
|
|
2595
2450
|
// SONA stats from real implementation
|
|
@@ -2647,59 +2502,21 @@ export const hooksIntelligenceStats = {
|
|
|
2647
2502
|
loadBalance: null,
|
|
2648
2503
|
implementation: 'not-loaded',
|
|
2649
2504
|
};
|
|
2650
|
-
|
|
2651
|
-
|
|
2652
|
-
const activeExperts = Object.values(loadBalance.routingCounts).filter((u) => u > 0).length;
|
|
2653
|
-
// Calculate average utilization as proxy for confidence
|
|
2654
|
-
const utilValues = Object.values(loadBalance.utilization);
|
|
2655
|
-
const avgUtil = utilValues.length > 0 ? utilValues.reduce((a, b) => a + b, 0) / utilValues.length : 0;
|
|
2656
|
-
moeStats = {
|
|
2657
|
-
expertsTotal: 8,
|
|
2658
|
-
expertsActive: activeExperts,
|
|
2659
|
-
routingDecisions: loadBalance.totalRoutings,
|
|
2660
|
-
avgRoutingTimeMs: 0.15, // Theoretical performance
|
|
2661
|
-
avgConfidence: Math.round(avgUtil * 100) / 100,
|
|
2662
|
-
loadBalance: {
|
|
2663
|
-
giniCoefficient: Math.round(loadBalance.giniCoefficient * 1000) / 1000,
|
|
2664
|
-
coefficientOfVariation: Math.round(loadBalance.coefficientOfVariation * 1000) / 1000,
|
|
2665
|
-
expertUsage: loadBalance.routingCounts,
|
|
2666
|
-
},
|
|
2667
|
-
implementation: 'real-moe',
|
|
2668
|
-
};
|
|
2669
|
-
}
|
|
2670
|
-
// Flash Attention stats from real implementation
|
|
2671
|
-
let flashStats = {
|
|
2505
|
+
// Flash Attention stats (native MoE/Flash removed in lean build — defaults only)
|
|
2506
|
+
const flashStats = {
|
|
2672
2507
|
speedup: 1.0,
|
|
2673
2508
|
avgComputeTimeMs: 0,
|
|
2674
2509
|
blockSize: 64,
|
|
2675
2510
|
implementation: 'not-loaded',
|
|
2676
2511
|
};
|
|
2677
|
-
|
|
2678
|
-
|
|
2679
|
-
speedup: Math.round(flash.getSpeedup() * 100) / 100,
|
|
2680
|
-
avgComputeTimeMs: 0, // Would need benchmarking
|
|
2681
|
-
blockSize: 64,
|
|
2682
|
-
implementation: 'real-flash-attention',
|
|
2683
|
-
};
|
|
2684
|
-
}
|
|
2685
|
-
// LoRA stats from real implementation
|
|
2686
|
-
let loraStats = {
|
|
2512
|
+
// LoRA Adapter removed — superseded by SONA instant adaptation
|
|
2513
|
+
const loraStats = {
|
|
2687
2514
|
rank: 8,
|
|
2688
2515
|
alpha: 16,
|
|
2689
2516
|
adaptations: 0,
|
|
2690
2517
|
avgLoss: 0,
|
|
2691
2518
|
implementation: 'not-loaded',
|
|
2692
2519
|
};
|
|
2693
|
-
if (lora) {
|
|
2694
|
-
const realLora = lora.getStats();
|
|
2695
|
-
loraStats = {
|
|
2696
|
-
rank: realLora.rank,
|
|
2697
|
-
alpha: 16, // Default alpha from config
|
|
2698
|
-
adaptations: realLora.totalAdaptations,
|
|
2699
|
-
avgLoss: Math.round(realLora.avgAdaptationNorm * 10000) / 10000,
|
|
2700
|
-
implementation: 'real-lora',
|
|
2701
|
-
};
|
|
2702
|
-
}
|
|
2703
2520
|
const stats = {
|
|
2704
2521
|
sona: sonaStats,
|
|
2705
2522
|
moe: moeStats,
|
|
@@ -2723,9 +2540,9 @@ export const hooksIntelligenceStats = {
|
|
|
2723
2540
|
implementationStatus: {
|
|
2724
2541
|
sona: sona ? 'loaded' : 'not-loaded',
|
|
2725
2542
|
ewc: ewc ? 'loaded' : 'not-loaded',
|
|
2726
|
-
moe:
|
|
2727
|
-
flash:
|
|
2728
|
-
lora:
|
|
2543
|
+
moe: 'not-loaded',
|
|
2544
|
+
flash: 'not-loaded',
|
|
2545
|
+
lora: 'not-loaded',
|
|
2729
2546
|
},
|
|
2730
2547
|
performance: {
|
|
2731
2548
|
sonaLearningMs: sonaStats.avgLearningTimeMs,
|
|
@@ -2812,7 +2629,7 @@ export const hooksIntelligenceLearn = {
|
|
|
2812
2629
|
// Intelligence attention hook
|
|
2813
2630
|
export const hooksIntelligenceAttention = {
|
|
2814
2631
|
name: 'hooks_intelligence_attention',
|
|
2815
|
-
description: 'Compute attention-weighted similarity
|
|
2632
|
+
description: 'Compute attention-weighted similarity (pure-JS cosine/hyperbolic)',
|
|
2816
2633
|
inputSchema: {
|
|
2817
2634
|
type: 'object',
|
|
2818
2635
|
properties: {
|
|
@@ -2829,76 +2646,9 @@ export const hooksIntelligenceAttention = {
|
|
|
2829
2646
|
const startTime = performance.now();
|
|
2830
2647
|
let implementation = 'placeholder';
|
|
2831
2648
|
const results = [];
|
|
2832
|
-
|
|
2833
|
-
|
|
2834
|
-
|
|
2835
|
-
if (moe) {
|
|
2836
|
-
try {
|
|
2837
|
-
// Generate a simple embedding from query (hash-based for demo)
|
|
2838
|
-
const embedding = new Float32Array(384);
|
|
2839
|
-
for (let i = 0; i < 384; i++) {
|
|
2840
|
-
embedding[i] = Math.sin(query.charCodeAt(i % query.length) * (i + 1) * 0.01);
|
|
2841
|
-
}
|
|
2842
|
-
const routingResult = moe.route(embedding);
|
|
2843
|
-
for (let i = 0; i < Math.min(topK, routingResult.experts.length); i++) {
|
|
2844
|
-
const expert = routingResult.experts[i];
|
|
2845
|
-
results.push({
|
|
2846
|
-
index: i,
|
|
2847
|
-
weight: expert.weight,
|
|
2848
|
-
pattern: `Expert: ${expert.name}`,
|
|
2849
|
-
expert: expert.name,
|
|
2850
|
-
});
|
|
2851
|
-
}
|
|
2852
|
-
implementation = 'real-moe-router';
|
|
2853
|
-
}
|
|
2854
|
-
catch {
|
|
2855
|
-
// Fall back to placeholder
|
|
2856
|
-
}
|
|
2857
|
-
}
|
|
2858
|
-
}
|
|
2859
|
-
else if (mode === 'flash') {
|
|
2860
|
-
// Try Flash Attention
|
|
2861
|
-
const flash = await getFlashAttention();
|
|
2862
|
-
if (flash) {
|
|
2863
|
-
try {
|
|
2864
|
-
// Generate query/key/value embeddings
|
|
2865
|
-
const q = new Float32Array(384);
|
|
2866
|
-
const keys = [];
|
|
2867
|
-
const values = [];
|
|
2868
|
-
for (let i = 0; i < 384; i++) {
|
|
2869
|
-
q[i] = Math.sin(query.charCodeAt(i % query.length) * (i + 1) * 0.01);
|
|
2870
|
-
}
|
|
2871
|
-
// Generate some keys/values
|
|
2872
|
-
for (let k = 0; k < topK; k++) {
|
|
2873
|
-
const key = new Float32Array(384);
|
|
2874
|
-
const value = new Float32Array(384);
|
|
2875
|
-
for (let i = 0; i < 384; i++) {
|
|
2876
|
-
key[i] = Math.cos((k + 1) * (i + 1) * 0.01);
|
|
2877
|
-
value[i] = k + 1;
|
|
2878
|
-
}
|
|
2879
|
-
keys.push(key);
|
|
2880
|
-
values.push(value);
|
|
2881
|
-
}
|
|
2882
|
-
const attentionResult = flash.attention([q], keys, values);
|
|
2883
|
-
// Compute softmax weights from output magnitudes
|
|
2884
|
-
const outputMags = attentionResult.output[0]
|
|
2885
|
-
? Array.from(attentionResult.output[0]).slice(0, topK).map(v => Math.abs(v))
|
|
2886
|
-
: new Array(topK).fill(1);
|
|
2887
|
-
const sumMags = outputMags.reduce((a, b) => a + b, 0) || 1;
|
|
2888
|
-
for (let i = 0; i < topK; i++) {
|
|
2889
|
-
results.push({
|
|
2890
|
-
index: i,
|
|
2891
|
-
weight: outputMags[i] / sumMags,
|
|
2892
|
-
pattern: `Flash attention target #${i + 1}`,
|
|
2893
|
-
});
|
|
2894
|
-
}
|
|
2895
|
-
implementation = 'real-flash-attention';
|
|
2896
|
-
}
|
|
2897
|
-
catch {
|
|
2898
|
-
// Fall back to placeholder
|
|
2899
|
-
}
|
|
2900
|
-
}
|
|
2901
|
-
}
|
|
2649
|
+
// Native MoE-router / Flash-attention backends were removed in the lean build.
|
|
2650
|
+
// Both modes degrade to the honest empty result handled below.
|
|
2651
|
+
void mode;
|
|
2902
2652
|
// If no real implementation worked, return empty with honest marker
|
|
2903
2653
|
if (results.length === 0) {
|
|
2904
2654
|
implementation = 'none';
|
|
@@ -2910,10 +2660,8 @@ export const hooksIntelligenceAttention = {
|
|
|
2910
2660
|
results,
|
|
2911
2661
|
stats: {
|
|
2912
2662
|
computeTimeMs,
|
|
2913
|
-
speedup: implementation.startsWith('real-') ? (mode === 'flash' ? '2.49x-7.47x' : '1.5x-3x') : null,
|
|
2914
|
-
memoryReduction: implementation.startsWith('real-') ? (mode === 'flash' ? '50-75%' : '25-40%') : null,
|
|
2915
2663
|
_stub: implementation === 'none',
|
|
2916
|
-
_note: implementation === 'none' ? '
|
|
2664
|
+
_note: implementation === 'none' ? 'Pure-JS similarity only; native attention backends are not part of the lean build.' : undefined,
|
|
2917
2665
|
},
|
|
2918
2666
|
implementation,
|
|
2919
2667
|
};
|
|
@@ -3361,20 +3109,6 @@ export const hooksWorkerDetect = {
|
|
|
3361
3109
|
return result;
|
|
3362
3110
|
},
|
|
3363
3111
|
};
|
|
3364
|
-
// Model router - lazy loaded
|
|
3365
|
-
let modelRouterInstance = null;
|
|
3366
|
-
async function getModelRouterInstance() {
|
|
3367
|
-
if (!modelRouterInstance) {
|
|
3368
|
-
try {
|
|
3369
|
-
const { getModelRouter } = await import('../ruvector/model-router.js');
|
|
3370
|
-
modelRouterInstance = getModelRouter();
|
|
3371
|
-
}
|
|
3372
|
-
catch {
|
|
3373
|
-
modelRouterInstance = null;
|
|
3374
|
-
}
|
|
3375
|
-
}
|
|
3376
|
-
return modelRouterInstance;
|
|
3377
|
-
}
|
|
3378
3112
|
// Model route tool - intelligent model selection
|
|
3379
3113
|
export const hooksModelRoute = {
|
|
3380
3114
|
name: 'hooks_model-route',
|
|
@@ -3390,29 +3124,14 @@ export const hooksModelRoute = {
|
|
|
3390
3124
|
},
|
|
3391
3125
|
handler: async (params) => {
|
|
3392
3126
|
const task = params.task;
|
|
3393
|
-
|
|
3394
|
-
|
|
3395
|
-
// Fallback to simple heuristic
|
|
3396
|
-
const complexity = analyzeComplexityFallback(task);
|
|
3397
|
-
return {
|
|
3398
|
-
model: complexity > 0.7 ? 'opus' : complexity > 0.4 ? 'sonnet' : 'haiku',
|
|
3399
|
-
confidence: 0.7,
|
|
3400
|
-
complexity,
|
|
3401
|
-
reasoning: 'Fallback heuristic (model router not available)',
|
|
3402
|
-
implementation: 'fallback',
|
|
3403
|
-
};
|
|
3404
|
-
}
|
|
3405
|
-
const result = await router.route(task);
|
|
3127
|
+
// Native neural model-router removed in the lean build — keyword complexity heuristic.
|
|
3128
|
+
const complexity = analyzeComplexityFallback(task);
|
|
3406
3129
|
return {
|
|
3407
|
-
model:
|
|
3408
|
-
confidence:
|
|
3409
|
-
|
|
3410
|
-
|
|
3411
|
-
|
|
3412
|
-
alternatives: result.alternatives,
|
|
3413
|
-
inferenceTimeUs: result.inferenceTimeUs,
|
|
3414
|
-
costMultiplier: result.costMultiplier,
|
|
3415
|
-
implementation: 'tiny-dancer-neural',
|
|
3130
|
+
model: complexity > 0.7 ? 'opus' : complexity > 0.4 ? 'sonnet' : 'haiku',
|
|
3131
|
+
confidence: 0.7,
|
|
3132
|
+
complexity,
|
|
3133
|
+
reasoning: 'Keyword complexity heuristic',
|
|
3134
|
+
implementation: 'heuristic',
|
|
3416
3135
|
};
|
|
3417
3136
|
},
|
|
3418
3137
|
};
|
|
@@ -3442,10 +3161,8 @@ export const hooksModelOutcome = {
|
|
|
3442
3161
|
? (exitCode === 0 ? 'success' : 'failure')
|
|
3443
3162
|
: params.outcome;
|
|
3444
3163
|
const outcome = effectiveOutcome;
|
|
3445
|
-
|
|
3446
|
-
|
|
3447
|
-
router.recordOutcome(task, model, outcome);
|
|
3448
|
-
}
|
|
3164
|
+
// Native model-router removed in the lean build — outcome is acknowledged but not
|
|
3165
|
+
// fed to a neural learner (keyword routing has no online-learning store).
|
|
3449
3166
|
return {
|
|
3450
3167
|
recorded: true,
|
|
3451
3168
|
task: task.slice(0, 50),
|
|
@@ -3464,18 +3181,10 @@ export const hooksModelStats = {
|
|
|
3464
3181
|
properties: {},
|
|
3465
3182
|
},
|
|
3466
3183
|
handler: async () => {
|
|
3467
|
-
|
|
3468
|
-
if (!router) {
|
|
3469
|
-
return {
|
|
3470
|
-
available: false,
|
|
3471
|
-
message: 'Model router not initialized',
|
|
3472
|
-
};
|
|
3473
|
-
}
|
|
3474
|
-
const stats = router.getStats();
|
|
3184
|
+
// Native model-router removed in the lean build — no neural routing stats to report.
|
|
3475
3185
|
return {
|
|
3476
|
-
available:
|
|
3477
|
-
|
|
3478
|
-
timestamp: new Date().toISOString(),
|
|
3186
|
+
available: false,
|
|
3187
|
+
message: 'Model router not available in the lean build (keyword routing has no stats)',
|
|
3479
3188
|
};
|
|
3480
3189
|
},
|
|
3481
3190
|
};
|