monomind 1.10.0 → 1.10.2
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/commands/monomind/understand.md +111 -70
- package/.claude/settings.local.json +1 -2
- package/package.json +1 -1
- package/packages/@monomind/cli/bundled-graph/dist/src/analyze.d.ts +32 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/analyze.d.ts.map +1 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/analyze.js +297 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/analyze.js.map +1 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/build.d.ts +8 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/build.d.ts.map +1 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/build.js +73 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/build.js.map +1 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/cache.d.ts +12 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/cache.d.ts.map +1 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/cache.js +43 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/cache.js.map +1 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/cluster.d.ts +5 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/cluster.d.ts.map +1 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/cluster.js +120 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/cluster.js.map +1 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/detect.d.ts +21 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/detect.d.ts.map +1 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/detect.js +195 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/detect.js.map +1 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/export.d.ts +21 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/export.d.ts.map +1 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/export.js +68 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/export.js.map +1 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/extract/index.d.ts +20 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/extract/index.d.ts.map +1 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/extract/index.js +158 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/extract/index.js.map +1 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/extract/languages/c.d.ts +3 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/extract/languages/c.d.ts.map +1 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/extract/languages/c.js +88 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/extract/languages/c.js.map +1 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/extract/languages/cpp.d.ts +3 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/extract/languages/cpp.d.ts.map +1 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/extract/languages/cpp.js +121 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/extract/languages/cpp.js.map +1 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/extract/languages/csharp.d.ts +3 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/extract/languages/csharp.d.ts.map +1 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/extract/languages/csharp.js +121 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/extract/languages/csharp.js.map +1 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/extract/languages/go.d.ts +3 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/extract/languages/go.d.ts.map +1 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/extract/languages/go.js +181 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/extract/languages/go.js.map +1 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/extract/languages/java.d.ts +3 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/extract/languages/java.d.ts.map +1 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/extract/languages/java.js +117 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/extract/languages/java.js.map +1 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/extract/languages/kotlin.d.ts +3 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/extract/languages/kotlin.d.ts.map +1 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/extract/languages/kotlin.js +112 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/extract/languages/kotlin.js.map +1 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/extract/languages/php.d.ts +3 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/extract/languages/php.d.ts.map +1 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/extract/languages/php.js +130 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/extract/languages/php.js.map +1 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/extract/languages/python.d.ts +3 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/extract/languages/python.d.ts.map +1 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/extract/languages/python.js +230 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/extract/languages/python.js.map +1 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/extract/languages/ruby.d.ts +3 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/extract/languages/ruby.d.ts.map +1 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/extract/languages/ruby.js +120 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/extract/languages/ruby.js.map +1 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/extract/languages/rust.d.ts +3 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/extract/languages/rust.d.ts.map +1 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/extract/languages/rust.js +195 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/extract/languages/rust.js.map +1 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/extract/languages/scala.d.ts +3 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/extract/languages/scala.d.ts.map +1 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/extract/languages/scala.js +110 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/extract/languages/scala.js.map +1 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/extract/languages/swift.d.ts +3 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/extract/languages/swift.d.ts.map +1 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/extract/languages/swift.js +122 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/extract/languages/swift.js.map +1 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/extract/languages/typescript.d.ts +3 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/extract/languages/typescript.d.ts.map +1 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/extract/languages/typescript.js +295 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/extract/languages/typescript.js.map +1 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/extract/semantic.d.ts +38 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/extract/semantic.d.ts.map +1 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/extract/semantic.js +242 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/extract/semantic.js.map +1 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/extract/tree-sitter-runner.d.ts +48 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/extract/tree-sitter-runner.d.ts.map +1 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/extract/tree-sitter-runner.js +137 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/extract/tree-sitter-runner.js.map +1 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/extract/types.d.ts +7 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/extract/types.d.ts.map +1 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/extract/types.js +2 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/extract/types.js.map +1 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/index.d.ts +28 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/index.d.ts.map +1 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/index.js +26 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/index.js.map +1 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/pipeline.d.ts +27 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/pipeline.d.ts.map +1 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/pipeline.js +269 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/pipeline.js.map +1 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/report.d.ts +26 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/report.d.ts.map +1 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/report.js +214 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/report.js.map +1 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/types.d.ts +124 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/types.d.ts.map +1 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/types.js +2 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/types.js.map +1 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/visualize.d.ts +4 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/visualize.d.ts.map +1 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/visualize.js +574 -0
- package/packages/@monomind/cli/bundled-graph/dist/src/visualize.js.map +1 -0
- package/packages/@monomind/cli/dist/src/agents/halt-signal.d.ts +25 -0
- package/packages/@monomind/cli/dist/src/agents/halt-signal.js +76 -0
- package/packages/@monomind/cli/dist/src/agents/index.d.ts +18 -0
- package/packages/@monomind/cli/dist/src/agents/index.js +13 -0
- package/packages/@monomind/cli/dist/src/agents/managed-agent.d.ts +41 -0
- package/packages/@monomind/cli/dist/src/agents/managed-agent.js +69 -0
- package/packages/@monomind/cli/dist/src/agents/prompt-experiment.d.ts +23 -0
- package/packages/@monomind/cli/dist/src/agents/prompt-experiment.js +49 -0
- package/packages/@monomind/cli/dist/src/agents/prompt-version-manager.d.ts +22 -0
- package/packages/@monomind/cli/dist/src/agents/prompt-version-manager.js +80 -0
- package/packages/@monomind/cli/dist/src/agents/registry-builder.d.ts +36 -0
- package/packages/@monomind/cli/dist/src/agents/registry-builder.js +200 -0
- package/packages/@monomind/cli/dist/src/agents/registry-query.d.ts +71 -0
- package/packages/@monomind/cli/dist/src/agents/registry-query.js +125 -0
- package/packages/@monomind/cli/dist/src/agents/score-decay.d.ts +19 -0
- package/packages/@monomind/cli/dist/src/agents/score-decay.js +22 -0
- package/packages/@monomind/cli/dist/src/agents/shared-instructions-loader.d.ts +13 -0
- package/packages/@monomind/cli/dist/src/agents/shared-instructions-loader.js +40 -0
- package/packages/@monomind/cli/dist/src/agents/specialization-scorer.d.ts +54 -0
- package/packages/@monomind/cli/dist/src/agents/specialization-scorer.js +212 -0
- package/packages/@monomind/cli/dist/src/agents/termination-watcher.d.ts +30 -0
- package/packages/@monomind/cli/dist/src/agents/termination-watcher.js +84 -0
- package/packages/@monomind/cli/dist/src/agents/trigger-index.d.ts +20 -0
- package/packages/@monomind/cli/dist/src/agents/trigger-index.js +38 -0
- package/packages/@monomind/cli/dist/src/agents/trigger-scanner.d.ts +64 -0
- package/packages/@monomind/cli/dist/src/agents/trigger-scanner.js +308 -0
- package/packages/@monomind/cli/dist/src/agents/version-diff.d.ts +18 -0
- package/packages/@monomind/cli/dist/src/agents/version-diff.js +64 -0
- package/packages/@monomind/cli/dist/src/agents/version-store.d.ts +60 -0
- package/packages/@monomind/cli/dist/src/agents/version-store.js +235 -0
- package/packages/@monomind/cli/dist/src/autopilot-state.d.ts +77 -0
- package/packages/@monomind/cli/dist/src/autopilot-state.js +330 -0
- package/packages/@monomind/cli/dist/src/benchmarks/benchmark-runner.d.ts +87 -0
- package/packages/@monomind/cli/dist/src/benchmarks/benchmark-runner.js +273 -0
- package/packages/@monomind/cli/dist/src/benchmarks/metric-evaluators.d.ts +36 -0
- package/packages/@monomind/cli/dist/src/benchmarks/metric-evaluators.js +114 -0
- package/packages/@monomind/cli/dist/src/benchmarks/pretrain/index.d.ts +58 -0
- package/packages/@monomind/cli/dist/src/benchmarks/pretrain/index.js +404 -0
- package/packages/@monomind/cli/dist/src/commands/agent-wasm.d.ts +14 -0
- package/packages/@monomind/cli/dist/src/commands/agent-wasm.js +333 -0
- package/packages/@monomind/cli/dist/src/commands/agent.d.ts +8 -0
- package/packages/@monomind/cli/dist/src/commands/agent.js +943 -0
- package/packages/@monomind/cli/dist/src/commands/analyze.d.ts +19 -0
- package/packages/@monomind/cli/dist/src/commands/analyze.js +2048 -0
- package/packages/@monomind/cli/dist/src/commands/appliance-advanced.d.ts +9 -0
- package/packages/@monomind/cli/dist/src/commands/appliance-advanced.js +238 -0
- package/packages/@monomind/cli/dist/src/commands/appliance.d.ts +8 -0
- package/packages/@monomind/cli/dist/src/commands/appliance.js +406 -0
- package/packages/@monomind/cli/dist/src/commands/autopilot.d.ts +15 -0
- package/packages/@monomind/cli/dist/src/commands/autopilot.js +362 -0
- package/packages/@monomind/cli/dist/src/commands/benchmark.d.ts +10 -0
- package/packages/@monomind/cli/dist/src/commands/benchmark.js +571 -0
- package/packages/@monomind/cli/dist/src/commands/claims.d.ts +10 -0
- package/packages/@monomind/cli/dist/src/commands/claims.js +632 -0
- package/packages/@monomind/cli/dist/src/commands/cleanup.d.ts +13 -0
- package/packages/@monomind/cli/dist/src/commands/cleanup.js +218 -0
- package/packages/@monomind/cli/dist/src/commands/completions.d.ts +10 -0
- package/packages/@monomind/cli/dist/src/commands/completions.js +539 -0
- package/packages/@monomind/cli/dist/src/commands/config.d.ts +8 -0
- package/packages/@monomind/cli/dist/src/commands/config.js +460 -0
- package/packages/@monomind/cli/dist/src/commands/daemon.d.ts +8 -0
- package/packages/@monomind/cli/dist/src/commands/daemon.js +671 -0
- package/packages/@monomind/cli/dist/src/commands/deployment.d.ts +10 -0
- package/packages/@monomind/cli/dist/src/commands/deployment.js +691 -0
- package/packages/@monomind/cli/dist/src/commands/doctor.d.ts +10 -0
- package/packages/@monomind/cli/dist/src/commands/doctor.js +647 -0
- package/packages/@monomind/cli/dist/src/commands/embeddings.d.ts +18 -0
- package/packages/@monomind/cli/dist/src/commands/embeddings.js +1652 -0
- package/packages/@monomind/cli/dist/src/commands/guidance.d.ts +8 -0
- package/packages/@monomind/cli/dist/src/commands/guidance.js +560 -0
- package/packages/@monomind/cli/dist/src/commands/hive-mind.d.ts +11 -0
- package/packages/@monomind/cli/dist/src/commands/hive-mind.js +1238 -0
- package/packages/@monomind/cli/dist/src/commands/hooks.d.ts +8 -0
- package/packages/@monomind/cli/dist/src/commands/hooks.js +4446 -0
- package/packages/@monomind/cli/dist/src/commands/index.d.ts +119 -0
- package/packages/@monomind/cli/dist/src/commands/index.js +404 -0
- package/packages/@monomind/cli/dist/src/commands/init.d.ts +8 -0
- package/packages/@monomind/cli/dist/src/commands/init.js +853 -0
- package/packages/@monomind/cli/dist/src/commands/issues.d.ts +21 -0
- package/packages/@monomind/cli/dist/src/commands/issues.js +567 -0
- package/packages/@monomind/cli/dist/src/commands/mcp.d.ts +11 -0
- package/packages/@monomind/cli/dist/src/commands/mcp.js +705 -0
- package/packages/@monomind/cli/dist/src/commands/memory.d.ts +8 -0
- package/packages/@monomind/cli/dist/src/commands/memory.js +1596 -0
- package/packages/@monomind/cli/dist/src/commands/migrate.d.ts +8 -0
- package/packages/@monomind/cli/dist/src/commands/migrate.js +790 -0
- package/packages/@monomind/cli/dist/src/commands/monograph.d.ts +8 -0
- package/packages/@monomind/cli/dist/src/commands/monograph.js +526 -0
- package/packages/@monomind/cli/dist/src/commands/neural.d.ts +10 -0
- package/packages/@monomind/cli/dist/src/commands/neural.js +1494 -0
- package/packages/@monomind/cli/dist/src/commands/performance.d.ts +10 -0
- package/packages/@monomind/cli/dist/src/commands/performance.js +601 -0
- package/packages/@monomind/cli/dist/src/commands/plugins.d.ts +11 -0
- package/packages/@monomind/cli/dist/src/commands/plugins.js +796 -0
- package/packages/@monomind/cli/dist/src/commands/process.d.ts +10 -0
- package/packages/@monomind/cli/dist/src/commands/process.js +718 -0
- package/packages/@monomind/cli/dist/src/commands/progress.d.ts +11 -0
- package/packages/@monomind/cli/dist/src/commands/progress.js +259 -0
- package/packages/@monomind/cli/dist/src/commands/providers.d.ts +10 -0
- package/packages/@monomind/cli/dist/src/commands/providers.js +391 -0
- package/packages/@monomind/cli/dist/src/commands/replay.d.ts +8 -0
- package/packages/@monomind/cli/dist/src/commands/replay.js +60 -0
- package/packages/@monomind/cli/dist/src/commands/route.d.ts +16 -0
- package/packages/@monomind/cli/dist/src/commands/route.js +939 -0
- package/packages/@monomind/cli/dist/src/commands/ruvector/backup.d.ts +11 -0
- package/packages/@monomind/cli/dist/src/commands/ruvector/backup.js +746 -0
- package/packages/@monomind/cli/dist/src/commands/ruvector/benchmark.d.ts +11 -0
- package/packages/@monomind/cli/dist/src/commands/ruvector/benchmark.js +489 -0
- package/packages/@monomind/cli/dist/src/commands/ruvector/import.d.ts +18 -0
- package/packages/@monomind/cli/dist/src/commands/ruvector/import.js +359 -0
- package/packages/@monomind/cli/dist/src/commands/ruvector/index.d.ts +29 -0
- package/packages/@monomind/cli/dist/src/commands/ruvector/index.js +129 -0
- package/packages/@monomind/cli/dist/src/commands/ruvector/init.d.ts +11 -0
- package/packages/@monomind/cli/dist/src/commands/ruvector/init.js +481 -0
- package/packages/@monomind/cli/dist/src/commands/ruvector/migrate.d.ts +11 -0
- package/packages/@monomind/cli/dist/src/commands/ruvector/migrate.js +497 -0
- package/packages/@monomind/cli/dist/src/commands/ruvector/optimize.d.ts +11 -0
- package/packages/@monomind/cli/dist/src/commands/ruvector/optimize.js +504 -0
- package/packages/@monomind/cli/dist/src/commands/ruvector/setup.d.ts +18 -0
- package/packages/@monomind/cli/dist/src/commands/ruvector/setup.js +765 -0
- package/packages/@monomind/cli/dist/src/commands/ruvector/status.d.ts +11 -0
- package/packages/@monomind/cli/dist/src/commands/ruvector/status.js +491 -0
- package/packages/@monomind/cli/dist/src/commands/security.d.ts +10 -0
- package/packages/@monomind/cli/dist/src/commands/security.js +943 -0
- package/packages/@monomind/cli/dist/src/commands/session.d.ts +8 -0
- package/packages/@monomind/cli/dist/src/commands/session.js +793 -0
- package/packages/@monomind/cli/dist/src/commands/start.d.ts +8 -0
- package/packages/@monomind/cli/dist/src/commands/start.js +432 -0
- package/packages/@monomind/cli/dist/src/commands/status.d.ts +8 -0
- package/packages/@monomind/cli/dist/src/commands/status.js +591 -0
- package/packages/@monomind/cli/dist/src/commands/swarm.d.ts +8 -0
- package/packages/@monomind/cli/dist/src/commands/swarm.js +812 -0
- package/packages/@monomind/cli/dist/src/commands/task.d.ts +8 -0
- package/packages/@monomind/cli/dist/src/commands/task.js +671 -0
- package/packages/@monomind/cli/dist/src/commands/tokens.d.ts +8 -0
- package/packages/@monomind/cli/dist/src/commands/tokens.js +107 -0
- package/packages/@monomind/cli/dist/src/commands/transfer-store.d.ts +13 -0
- package/packages/@monomind/cli/dist/src/commands/transfer-store.js +428 -0
- package/packages/@monomind/cli/dist/src/commands/ui.js +68 -0
- package/packages/@monomind/cli/dist/src/commands/update.d.ts +8 -0
- package/packages/@monomind/cli/dist/src/commands/update.js +276 -0
- package/packages/@monomind/cli/dist/src/commands/workflow.d.ts +8 -0
- package/packages/@monomind/cli/dist/src/commands/workflow.js +644 -0
- package/packages/@monomind/cli/dist/src/config-adapter.d.ts +16 -0
- package/packages/@monomind/cli/dist/src/config-adapter.js +186 -0
- package/packages/@monomind/cli/dist/src/consensus/audit-writer.d.ts +50 -0
- package/packages/@monomind/cli/dist/src/consensus/audit-writer.js +142 -0
- package/packages/@monomind/cli/dist/src/consensus/index.d.ts +7 -0
- package/packages/@monomind/cli/dist/src/consensus/index.js +6 -0
- package/packages/@monomind/cli/dist/src/consensus/vote-signer.d.ts +36 -0
- package/packages/@monomind/cli/dist/src/consensus/vote-signer.js +71 -0
- package/packages/@monomind/cli/dist/src/context/context-provider.d.ts +44 -0
- package/packages/@monomind/cli/dist/src/context/context-provider.js +25 -0
- package/packages/@monomind/cli/dist/src/context/git-state-provider.d.ts +12 -0
- package/packages/@monomind/cli/dist/src/context/git-state-provider.js +34 -0
- package/packages/@monomind/cli/dist/src/context/index.d.ts +12 -0
- package/packages/@monomind/cli/dist/src/context/index.js +12 -0
- package/packages/@monomind/cli/dist/src/context/project-conventions-provider.d.ts +15 -0
- package/packages/@monomind/cli/dist/src/context/project-conventions-provider.js +19 -0
- package/packages/@monomind/cli/dist/src/context/prompt-assembler.d.ts +26 -0
- package/packages/@monomind/cli/dist/src/context/prompt-assembler.js +93 -0
- package/packages/@monomind/cli/dist/src/context/task-history-provider.d.ts +24 -0
- package/packages/@monomind/cli/dist/src/context/task-history-provider.js +32 -0
- package/packages/@monomind/cli/dist/src/context/user-preferences-provider.d.ts +14 -0
- package/packages/@monomind/cli/dist/src/context/user-preferences-provider.js +27 -0
- package/packages/@monomind/cli/dist/src/dlq/dlq-reader.d.ts +31 -0
- package/packages/@monomind/cli/dist/src/dlq/dlq-reader.js +81 -0
- package/packages/@monomind/cli/dist/src/dlq/dlq-replayer.d.ts +27 -0
- package/packages/@monomind/cli/dist/src/dlq/dlq-replayer.js +90 -0
- package/packages/@monomind/cli/dist/src/dlq/dlq-writer.d.ts +24 -0
- package/packages/@monomind/cli/dist/src/dlq/dlq-writer.js +65 -0
- package/packages/@monomind/cli/dist/src/dlq/index.d.ts +10 -0
- package/packages/@monomind/cli/dist/src/dlq/index.js +7 -0
- package/packages/@monomind/cli/dist/src/eval/dataset-manager.d.ts +33 -0
- package/packages/@monomind/cli/dist/src/eval/dataset-manager.js +107 -0
- package/packages/@monomind/cli/dist/src/eval/dataset-runner.d.ts +23 -0
- package/packages/@monomind/cli/dist/src/eval/dataset-runner.js +59 -0
- package/packages/@monomind/cli/dist/src/eval/index.d.ts +10 -0
- package/packages/@monomind/cli/dist/src/eval/index.js +7 -0
- package/packages/@monomind/cli/dist/src/eval/trace-collector.d.ts +40 -0
- package/packages/@monomind/cli/dist/src/eval/trace-collector.js +102 -0
- package/packages/@monomind/cli/dist/src/index.d.ts +82 -0
- package/packages/@monomind/cli/dist/src/index.js +580 -0
- package/packages/@monomind/cli/dist/src/infrastructure/in-memory-repositories.d.ts +68 -0
- package/packages/@monomind/cli/dist/src/infrastructure/in-memory-repositories.js +264 -0
- package/packages/@monomind/cli/dist/src/init/claudemd-generator.d.ts +25 -0
- package/packages/@monomind/cli/dist/src/init/claudemd-generator.js +558 -0
- package/packages/@monomind/cli/dist/src/init/executor.d.ts +38 -0
- package/packages/@monomind/cli/dist/src/init/executor.js +2172 -0
- package/packages/@monomind/cli/dist/src/init/helpers-generator.d.ts +60 -0
- package/packages/@monomind/cli/dist/src/init/helpers-generator.js +1235 -0
- package/packages/@monomind/cli/dist/src/init/index.d.ts +13 -0
- package/packages/@monomind/cli/dist/src/init/index.js +15 -0
- package/packages/@monomind/cli/dist/src/init/mcp-generator.d.ts +26 -0
- package/packages/@monomind/cli/dist/src/init/mcp-generator.js +99 -0
- package/packages/@monomind/cli/dist/src/init/settings-generator.d.ts +14 -0
- package/packages/@monomind/cli/dist/src/init/settings-generator.js +417 -0
- package/packages/@monomind/cli/dist/src/init/shared-instructions-generator.d.ts +38 -0
- package/packages/@monomind/cli/dist/src/init/shared-instructions-generator.js +586 -0
- package/packages/@monomind/cli/dist/src/init/statusline-generator.d.ts +25 -0
- package/packages/@monomind/cli/dist/src/init/statusline-generator.js +1171 -0
- package/packages/@monomind/cli/dist/src/init/types.d.ts +315 -0
- package/packages/@monomind/cli/dist/src/init/types.js +254 -0
- package/packages/@monomind/cli/dist/src/interactive/interrupt.d.ts +22 -0
- package/packages/@monomind/cli/dist/src/interactive/interrupt.js +71 -0
- package/packages/@monomind/cli/dist/src/mcp/deprecation-injector.d.ts +25 -0
- package/packages/@monomind/cli/dist/src/mcp/deprecation-injector.js +48 -0
- package/packages/@monomind/cli/dist/src/mcp/tool-registry.d.ts +61 -0
- package/packages/@monomind/cli/dist/src/mcp/tool-registry.js +246 -0
- package/packages/@monomind/cli/dist/src/mcp-client.d.ts +92 -0
- package/packages/@monomind/cli/dist/src/mcp-client.js +270 -0
- package/packages/@monomind/cli/dist/src/mcp-server.d.ts +170 -0
- package/packages/@monomind/cli/dist/src/mcp-server.js +829 -0
- package/packages/@monomind/cli/dist/src/mcp-tools/a2a-tools.d.ts +14 -0
- package/packages/@monomind/cli/dist/src/mcp-tools/a2a-tools.js +244 -0
- package/packages/@monomind/cli/dist/src/mcp-tools/agent-tools.d.ts +9 -0
- package/packages/@monomind/cli/dist/src/mcp-tools/agent-tools.js +607 -0
- package/packages/@monomind/cli/dist/src/mcp-tools/agentdb-tools.d.ts +30 -0
- package/packages/@monomind/cli/dist/src/mcp-tools/agentdb-tools.js +596 -0
- package/packages/@monomind/cli/dist/src/mcp-tools/analyze-tools.d.ts +38 -0
- package/packages/@monomind/cli/dist/src/mcp-tools/analyze-tools.js +326 -0
- package/packages/@monomind/cli/dist/src/mcp-tools/auto-install.d.ts +83 -0
- package/packages/@monomind/cli/dist/src/mcp-tools/auto-install.js +129 -0
- package/packages/@monomind/cli/dist/src/mcp-tools/autopilot-tools.d.ts +12 -0
- package/packages/@monomind/cli/dist/src/mcp-tools/autopilot-tools.js +237 -0
- package/packages/@monomind/cli/dist/src/mcp-tools/browser-tools.d.ts +13 -0
- package/packages/@monomind/cli/dist/src/mcp-tools/browser-tools.js +729 -0
- package/packages/@monomind/cli/dist/src/mcp-tools/claims-tools.d.ts +12 -0
- package/packages/@monomind/cli/dist/src/mcp-tools/claims-tools.js +797 -0
- package/packages/@monomind/cli/dist/src/mcp-tools/config-tools.d.ts +8 -0
- package/packages/@monomind/cli/dist/src/mcp-tools/config-tools.js +381 -0
- package/packages/@monomind/cli/dist/src/mcp-tools/coordination-tools.d.ts +13 -0
- package/packages/@monomind/cli/dist/src/mcp-tools/coordination-tools.js +728 -0
- package/packages/@monomind/cli/dist/src/mcp-tools/daa-tools.d.ts +13 -0
- package/packages/@monomind/cli/dist/src/mcp-tools/daa-tools.js +509 -0
- package/packages/@monomind/cli/dist/src/mcp-tools/embeddings-tools.d.ts +9 -0
- package/packages/@monomind/cli/dist/src/mcp-tools/embeddings-tools.js +823 -0
- package/packages/@monomind/cli/dist/src/mcp-tools/github-tools.d.ts +9 -0
- package/packages/@monomind/cli/dist/src/mcp-tools/github-tools.js +485 -0
- package/packages/@monomind/cli/dist/src/mcp-tools/graphify-tools.d.ts +10 -0
- package/packages/@monomind/cli/dist/src/mcp-tools/graphify-tools.js +49 -0
- package/packages/@monomind/cli/dist/src/mcp-tools/guidance-tools.d.ts +15 -0
- package/packages/@monomind/cli/dist/src/mcp-tools/guidance-tools.js +646 -0
- package/packages/@monomind/cli/dist/src/mcp-tools/hive-mind-tools.d.ts +8 -0
- package/packages/@monomind/cli/dist/src/mcp-tools/hive-mind-tools.js +957 -0
- package/packages/@monomind/cli/dist/src/mcp-tools/hooks-tools.d.ts +44 -0
- package/packages/@monomind/cli/dist/src/mcp-tools/hooks-tools.js +3440 -0
- package/packages/@monomind/cli/dist/src/mcp-tools/index.d.ts +39 -0
- package/packages/@monomind/cli/dist/src/mcp-tools/index.js +41 -0
- package/packages/@monomind/cli/dist/src/mcp-tools/memory-tools.d.ts +14 -0
- package/packages/@monomind/cli/dist/src/mcp-tools/memory-tools.js +530 -0
- package/packages/@monomind/cli/dist/src/mcp-tools/monograph-tools.d.ts +9 -0
- package/packages/@monomind/cli/dist/src/mcp-tools/monograph-tools.js +6306 -0
- package/packages/@monomind/cli/dist/src/mcp-tools/neural-tools.d.ts +16 -0
- package/packages/@monomind/cli/dist/src/mcp-tools/neural-tools.js +718 -0
- package/packages/@monomind/cli/dist/src/mcp-tools/performance-tools.d.ts +16 -0
- package/packages/@monomind/cli/dist/src/mcp-tools/performance-tools.js +656 -0
- package/packages/@monomind/cli/dist/src/mcp-tools/progress-tools.d.ts +14 -0
- package/packages/@monomind/cli/dist/src/mcp-tools/progress-tools.js +350 -0
- package/packages/@monomind/cli/dist/src/mcp-tools/request-tracker.d.ts +17 -0
- package/packages/@monomind/cli/dist/src/mcp-tools/request-tracker.js +30 -0
- package/packages/@monomind/cli/dist/src/mcp-tools/ruvllm-tools.d.ts +9 -0
- package/packages/@monomind/cli/dist/src/mcp-tools/ruvllm-tools.js +295 -0
- package/packages/@monomind/cli/dist/src/mcp-tools/security-tools.d.ts +18 -0
- package/packages/@monomind/cli/dist/src/mcp-tools/security-tools.js +434 -0
- package/packages/@monomind/cli/dist/src/mcp-tools/session-tools.d.ts +8 -0
- package/packages/@monomind/cli/dist/src/mcp-tools/session-tools.js +378 -0
- package/packages/@monomind/cli/dist/src/mcp-tools/swarm-tools.d.ts +9 -0
- package/packages/@monomind/cli/dist/src/mcp-tools/swarm-tools.js +317 -0
- package/packages/@monomind/cli/dist/src/mcp-tools/system-tools.d.ts +13 -0
- package/packages/@monomind/cli/dist/src/mcp-tools/system-tools.js +552 -0
- package/packages/@monomind/cli/dist/src/mcp-tools/task-tools.d.ts +8 -0
- package/packages/@monomind/cli/dist/src/mcp-tools/task-tools.js +446 -0
- package/packages/@monomind/cli/dist/src/mcp-tools/terminal-tools.d.ts +8 -0
- package/packages/@monomind/cli/dist/src/mcp-tools/terminal-tools.js +309 -0
- package/packages/@monomind/cli/dist/src/mcp-tools/transfer-tools.d.ts +14 -0
- package/packages/@monomind/cli/dist/src/mcp-tools/transfer-tools.js +401 -0
- package/packages/@monomind/cli/dist/src/mcp-tools/types.d.ts +37 -0
- package/packages/@monomind/cli/dist/src/mcp-tools/types.js +14 -0
- package/packages/@monomind/cli/dist/src/mcp-tools/wasm-agent-tools.d.ts +9 -0
- package/packages/@monomind/cli/dist/src/mcp-tools/wasm-agent-tools.js +230 -0
- package/packages/@monomind/cli/dist/src/mcp-tools/workflow-tools.d.ts +8 -0
- package/packages/@monomind/cli/dist/src/mcp-tools/workflow-tools.js +631 -0
- package/packages/@monomind/cli/dist/src/memory/ewc-consolidation.d.ts +295 -0
- package/packages/@monomind/cli/dist/src/memory/ewc-consolidation.js +632 -0
- package/packages/@monomind/cli/dist/src/memory/intelligence.d.ts +338 -0
- package/packages/@monomind/cli/dist/src/memory/intelligence.js +1049 -0
- package/packages/@monomind/cli/dist/src/memory/memory-bridge.d.ts +410 -0
- package/packages/@monomind/cli/dist/src/memory/memory-bridge.js +1654 -0
- package/packages/@monomind/cli/dist/src/memory/memory-initializer.d.ts +414 -0
- package/packages/@monomind/cli/dist/src/memory/memory-initializer.js +2284 -0
- package/packages/@monomind/cli/dist/src/memory/sona-optimizer.d.ts +234 -0
- package/packages/@monomind/cli/dist/src/memory/sona-optimizer.js +650 -0
- package/packages/@monomind/cli/dist/src/model/complexity-scorer.d.ts +21 -0
- package/packages/@monomind/cli/dist/src/model/complexity-scorer.js +106 -0
- package/packages/@monomind/cli/dist/src/model/index.d.ts +4 -0
- package/packages/@monomind/cli/dist/src/model/index.js +4 -0
- package/packages/@monomind/cli/dist/src/model/model-settings.d.ts +22 -0
- package/packages/@monomind/cli/dist/src/model/model-settings.js +33 -0
- package/packages/@monomind/cli/dist/src/model/model-tier-resolver.d.ts +24 -0
- package/packages/@monomind/cli/dist/src/model/model-tier-resolver.js +65 -0
- package/packages/@monomind/cli/dist/src/observability/replay-reader.d.ts +40 -0
- package/packages/@monomind/cli/dist/src/observability/replay-reader.js +138 -0
- package/packages/@monomind/cli/dist/src/orchestration/index.d.ts +7 -0
- package/packages/@monomind/cli/dist/src/orchestration/index.js +6 -0
- package/packages/@monomind/cli/dist/src/orchestration/mode-dispatcher.d.ts +11 -0
- package/packages/@monomind/cli/dist/src/orchestration/mode-dispatcher.js +31 -0
- package/packages/@monomind/cli/dist/src/orchestration/routing-modes.d.ts +68 -0
- package/packages/@monomind/cli/dist/src/orchestration/routing-modes.js +180 -0
- package/packages/@monomind/cli/dist/src/output.d.ts +133 -0
- package/packages/@monomind/cli/dist/src/output.js +514 -0
- package/packages/@monomind/cli/dist/src/parser.d.ts +59 -0
- package/packages/@monomind/cli/dist/src/parser.js +459 -0
- package/packages/@monomind/cli/dist/src/plugins/manager.d.ts +133 -0
- package/packages/@monomind/cli/dist/src/plugins/manager.js +493 -0
- package/packages/@monomind/cli/dist/src/plugins/store/discovery.d.ts +88 -0
- package/packages/@monomind/cli/dist/src/plugins/store/discovery.js +859 -0
- package/packages/@monomind/cli/dist/src/plugins/store/index.d.ts +76 -0
- package/packages/@monomind/cli/dist/src/plugins/store/index.js +141 -0
- package/packages/@monomind/cli/dist/src/plugins/store/search.d.ts +46 -0
- package/packages/@monomind/cli/dist/src/plugins/store/search.js +230 -0
- package/packages/@monomind/cli/dist/src/plugins/store/types.d.ts +274 -0
- package/packages/@monomind/cli/dist/src/plugins/store/types.js +7 -0
- package/packages/@monomind/cli/dist/src/plugins/tests/demo-plugin-store.d.ts +7 -0
- package/packages/@monomind/cli/dist/src/plugins/tests/demo-plugin-store.js +126 -0
- package/packages/@monomind/cli/dist/src/plugins/tests/standalone-test.d.ts +12 -0
- package/packages/@monomind/cli/dist/src/plugins/tests/standalone-test.js +188 -0
- package/packages/@monomind/cli/dist/src/plugins/tests/test-plugin-store.d.ts +7 -0
- package/packages/@monomind/cli/dist/src/plugins/tests/test-plugin-store.js +206 -0
- package/packages/@monomind/cli/dist/src/production/circuit-breaker.d.ts +101 -0
- package/packages/@monomind/cli/dist/src/production/circuit-breaker.js +248 -0
- package/packages/@monomind/cli/dist/src/production/error-handler.d.ts +94 -0
- package/packages/@monomind/cli/dist/src/production/error-handler.js +321 -0
- package/packages/@monomind/cli/dist/src/production/index.d.ts +23 -0
- package/packages/@monomind/cli/dist/src/production/index.js +18 -0
- package/packages/@monomind/cli/dist/src/production/monitoring.d.ts +161 -0
- package/packages/@monomind/cli/dist/src/production/monitoring.js +360 -0
- package/packages/@monomind/cli/dist/src/production/rate-limiter.d.ts +80 -0
- package/packages/@monomind/cli/dist/src/production/rate-limiter.js +209 -0
- package/packages/@monomind/cli/dist/src/production/retry.d.ts +48 -0
- package/packages/@monomind/cli/dist/src/production/retry.js +179 -0
- package/packages/@monomind/cli/dist/src/prompt.d.ts +44 -0
- package/packages/@monomind/cli/dist/src/prompt.js +501 -0
- package/packages/@monomind/cli/dist/src/runtime/headless.d.ts +60 -0
- package/packages/@monomind/cli/dist/src/runtime/headless.js +284 -0
- package/packages/@monomind/cli/dist/src/ruvector/agent-wasm.d.ts +182 -0
- package/packages/@monomind/cli/dist/src/ruvector/agent-wasm.js +316 -0
- package/packages/@monomind/cli/dist/src/ruvector/ast-analyzer.d.ts +67 -0
- package/packages/@monomind/cli/dist/src/ruvector/ast-analyzer.js +277 -0
- package/packages/@monomind/cli/dist/src/ruvector/coverage-router.d.ts +160 -0
- package/packages/@monomind/cli/dist/src/ruvector/coverage-router.js +539 -0
- package/packages/@monomind/cli/dist/src/ruvector/coverage-tools.d.ts +33 -0
- package/packages/@monomind/cli/dist/src/ruvector/coverage-tools.js +157 -0
- package/packages/@monomind/cli/dist/src/ruvector/diff-classifier.d.ts +176 -0
- package/packages/@monomind/cli/dist/src/ruvector/diff-classifier.js +718 -0
- package/packages/@monomind/cli/dist/src/ruvector/enhanced-model-router.d.ts +146 -0
- package/packages/@monomind/cli/dist/src/ruvector/enhanced-model-router.js +551 -0
- package/packages/@monomind/cli/dist/src/ruvector/flash-attention.d.ts +195 -0
- package/packages/@monomind/cli/dist/src/ruvector/flash-attention.js +643 -0
- package/packages/@monomind/cli/dist/src/ruvector/graph-analyzer.d.ts +187 -0
- package/packages/@monomind/cli/dist/src/ruvector/graph-analyzer.js +929 -0
- package/packages/@monomind/cli/dist/src/ruvector/index.d.ts +39 -0
- package/packages/@monomind/cli/dist/src/ruvector/index.js +76 -0
- package/packages/@monomind/cli/dist/src/ruvector/lora-adapter.d.ts +218 -0
- package/packages/@monomind/cli/dist/src/ruvector/lora-adapter.js +455 -0
- package/packages/@monomind/cli/dist/src/ruvector/model-router.d.ts +222 -0
- package/packages/@monomind/cli/dist/src/ruvector/model-router.js +512 -0
- package/packages/@monomind/cli/dist/src/ruvector/moe-router.d.ts +213 -0
- package/packages/@monomind/cli/dist/src/ruvector/moe-router.js +649 -0
- package/packages/@monomind/cli/dist/src/ruvector/q-learning-router.d.ts +217 -0
- package/packages/@monomind/cli/dist/src/ruvector/q-learning-router.js +712 -0
- package/packages/@monomind/cli/dist/src/ruvector/ruvllm-wasm.d.ts +179 -0
- package/packages/@monomind/cli/dist/src/ruvector/ruvllm-wasm.js +363 -0
- package/packages/@monomind/cli/dist/src/ruvector/semantic-router.d.ts +77 -0
- package/packages/@monomind/cli/dist/src/ruvector/semantic-router.js +178 -0
- package/packages/@monomind/cli/dist/src/ruvector/vector-db.d.ts +69 -0
- package/packages/@monomind/cli/dist/src/ruvector/vector-db.js +243 -0
- package/packages/@monomind/cli/dist/src/services/agentic-flow-bridge.d.ts +50 -0
- package/packages/@monomind/cli/dist/src/services/agentic-flow-bridge.js +95 -0
- package/packages/@monomind/cli/dist/src/services/claim-service.d.ts +206 -0
- package/packages/@monomind/cli/dist/src/services/claim-service.js +849 -0
- package/packages/@monomind/cli/dist/src/services/config-file-manager.d.ts +51 -0
- package/packages/@monomind/cli/dist/src/services/config-file-manager.js +312 -0
- package/packages/@monomind/cli/dist/src/services/container-worker-pool.d.ts +197 -0
- package/packages/@monomind/cli/dist/src/services/container-worker-pool.js +623 -0
- package/packages/@monomind/cli/dist/src/services/headless-worker-executor.d.ts +311 -0
- package/packages/@monomind/cli/dist/src/services/headless-worker-executor.js +1167 -0
- package/packages/@monomind/cli/dist/src/services/index.d.ts +13 -0
- package/packages/@monomind/cli/dist/src/services/index.js +11 -0
- package/packages/@monomind/cli/dist/src/services/registry-api.d.ts +58 -0
- package/packages/@monomind/cli/dist/src/services/registry-api.js +199 -0
- package/packages/@monomind/cli/dist/src/services/ruvector-training.d.ts +222 -0
- package/packages/@monomind/cli/dist/src/services/ruvector-training.js +696 -0
- package/packages/@monomind/cli/dist/src/services/worker-daemon.d.ts +248 -0
- package/packages/@monomind/cli/dist/src/services/worker-daemon.js +1083 -0
- package/packages/@monomind/cli/dist/src/services/worker-queue.d.ts +201 -0
- package/packages/@monomind/cli/dist/src/services/worker-queue.js +594 -0
- package/packages/@monomind/cli/dist/src/suggest.d.ts +53 -0
- package/packages/@monomind/cli/dist/src/suggest.js +209 -0
- package/packages/@monomind/cli/dist/src/swarm/communication-graph.d.ts +25 -0
- package/packages/@monomind/cli/dist/src/swarm/communication-graph.js +77 -0
- package/packages/@monomind/cli/dist/src/swarm/flow-enforcer.d.ts +31 -0
- package/packages/@monomind/cli/dist/src/swarm/flow-enforcer.js +61 -0
- package/packages/@monomind/cli/dist/src/swarm/flow-visualizer.d.ts +19 -0
- package/packages/@monomind/cli/dist/src/swarm/flow-visualizer.js +68 -0
- package/packages/@monomind/cli/dist/src/transfer/anonymization/index.d.ts +25 -0
- package/packages/@monomind/cli/dist/src/transfer/anonymization/index.js +177 -0
- package/packages/@monomind/cli/dist/src/transfer/deploy-seraphine.d.ts +13 -0
- package/packages/@monomind/cli/dist/src/transfer/deploy-seraphine.js +205 -0
- package/packages/@monomind/cli/dist/src/transfer/export.d.ts +25 -0
- package/packages/@monomind/cli/dist/src/transfer/export.js +115 -0
- package/packages/@monomind/cli/dist/src/transfer/index.d.ts +12 -0
- package/packages/@monomind/cli/dist/src/transfer/index.js +31 -0
- package/packages/@monomind/cli/dist/src/transfer/ipfs/client.d.ts +109 -0
- package/packages/@monomind/cli/dist/src/transfer/ipfs/client.js +384 -0
- package/packages/@monomind/cli/dist/src/transfer/ipfs/upload.d.ts +95 -0
- package/packages/@monomind/cli/dist/src/transfer/ipfs/upload.js +420 -0
- package/packages/@monomind/cli/dist/src/transfer/models/seraphine.d.ts +72 -0
- package/packages/@monomind/cli/dist/src/transfer/models/seraphine.js +373 -0
- package/packages/@monomind/cli/dist/src/transfer/serialization/cfp.d.ts +49 -0
- package/packages/@monomind/cli/dist/src/transfer/serialization/cfp.js +183 -0
- package/packages/@monomind/cli/dist/src/transfer/storage/gcs.d.ts +82 -0
- package/packages/@monomind/cli/dist/src/transfer/storage/gcs.js +281 -0
- package/packages/@monomind/cli/dist/src/transfer/storage/index.d.ts +6 -0
- package/packages/@monomind/cli/dist/src/transfer/storage/index.js +6 -0
- package/packages/@monomind/cli/dist/src/transfer/store/discovery.d.ts +91 -0
- package/packages/@monomind/cli/dist/src/transfer/store/discovery.js +437 -0
- package/packages/@monomind/cli/dist/src/transfer/store/download.d.ts +79 -0
- package/packages/@monomind/cli/dist/src/transfer/store/download.js +423 -0
- package/packages/@monomind/cli/dist/src/transfer/store/index.d.ts +84 -0
- package/packages/@monomind/cli/dist/src/transfer/store/index.js +153 -0
- package/packages/@monomind/cli/dist/src/transfer/store/publish.d.ts +76 -0
- package/packages/@monomind/cli/dist/src/transfer/store/publish.js +293 -0
- package/packages/@monomind/cli/dist/src/transfer/store/registry.d.ts +58 -0
- package/packages/@monomind/cli/dist/src/transfer/store/registry.js +301 -0
- package/packages/@monomind/cli/dist/src/transfer/store/search.d.ts +54 -0
- package/packages/@monomind/cli/dist/src/transfer/store/search.js +232 -0
- package/packages/@monomind/cli/dist/src/transfer/store/tests/standalone-test.d.ts +12 -0
- package/packages/@monomind/cli/dist/src/transfer/store/tests/standalone-test.js +190 -0
- package/packages/@monomind/cli/dist/src/transfer/store/types.d.ts +193 -0
- package/packages/@monomind/cli/dist/src/transfer/store/types.js +6 -0
- package/packages/@monomind/cli/dist/src/transfer/test-seraphine.d.ts +6 -0
- package/packages/@monomind/cli/dist/src/transfer/test-seraphine.js +105 -0
- package/packages/@monomind/cli/dist/src/transfer/tests/test-store.d.ts +7 -0
- package/packages/@monomind/cli/dist/src/transfer/tests/test-store.js +214 -0
- package/packages/@monomind/cli/dist/src/transfer/types.d.ts +245 -0
- package/packages/@monomind/cli/dist/src/transfer/types.js +6 -0
- package/packages/@monomind/cli/dist/src/types.d.ts +198 -0
- package/packages/@monomind/cli/dist/src/types.js +38 -0
- package/packages/@monomind/cli/dist/src/update/checker.d.ts +34 -0
- package/packages/@monomind/cli/dist/src/update/checker.js +198 -0
- package/packages/@monomind/cli/dist/src/update/executor.d.ts +32 -0
- package/packages/@monomind/cli/dist/src/update/executor.js +186 -0
- package/packages/@monomind/cli/dist/src/update/index.d.ts +33 -0
- package/packages/@monomind/cli/dist/src/update/index.js +64 -0
- package/packages/@monomind/cli/dist/src/update/rate-limiter.d.ts +31 -0
- package/packages/@monomind/cli/dist/src/update/rate-limiter.js +116 -0
- package/packages/@monomind/cli/dist/src/update/validator.d.ts +17 -0
- package/packages/@monomind/cli/dist/src/update/validator.js +118 -0
- package/packages/@monomind/cli/dist/src/utils/parse-jsonl.d.ts +6 -0
- package/packages/@monomind/cli/dist/src/utils/parse-jsonl.js +22 -0
- package/packages/@monomind/cli/dist/src/workflow/condition-evaluator.d.ts +10 -0
- package/packages/@monomind/cli/dist/src/workflow/condition-evaluator.js +82 -0
- package/packages/@monomind/cli/dist/src/workflow/context-resolver.d.ts +12 -0
- package/packages/@monomind/cli/dist/src/workflow/context-resolver.js +23 -0
- package/packages/@monomind/cli/dist/src/workflow/dag-builder.d.ts +17 -0
- package/packages/@monomind/cli/dist/src/workflow/dag-builder.js +129 -0
- package/packages/@monomind/cli/dist/src/workflow/dag-executor.d.ts +9 -0
- package/packages/@monomind/cli/dist/src/workflow/dag-executor.js +116 -0
- package/packages/@monomind/cli/dist/src/workflow/dag-types.d.ts +41 -0
- package/packages/@monomind/cli/dist/src/workflow/dag-types.js +8 -0
- package/packages/@monomind/cli/dist/src/workflow/dsl-parser.d.ts +12 -0
- package/packages/@monomind/cli/dist/src/workflow/dsl-parser.js +20 -0
- package/packages/@monomind/cli/dist/src/workflow/dsl-schema.d.ts +165 -0
- package/packages/@monomind/cli/dist/src/workflow/dsl-schema.js +82 -0
- package/packages/@monomind/cli/dist/src/workflow/index.d.ts +13 -0
- package/packages/@monomind/cli/dist/src/workflow/index.js +11 -0
- package/packages/@monomind/cli/dist/src/workflow/template-engine.d.ts +11 -0
- package/packages/@monomind/cli/dist/src/workflow/template-engine.js +40 -0
- package/packages/@monomind/cli/dist/src/workflow/workflow-executor.d.ts +29 -0
- package/packages/@monomind/cli/dist/src/workflow/workflow-executor.js +227 -0
- package/packages/@monomind/cli/package.json +2 -1
|
@@ -0,0 +1,829 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CLI MCP Server Management
|
|
3
|
+
*
|
|
4
|
+
* Provides server lifecycle management for MCP integration:
|
|
5
|
+
* - Start/stop/status methods with process management
|
|
6
|
+
* - Health check endpoint integration
|
|
7
|
+
* - Graceful shutdown handling
|
|
8
|
+
* - PID file management for daemon detection
|
|
9
|
+
* - Event-based status monitoring
|
|
10
|
+
*
|
|
11
|
+
* Performance Targets:
|
|
12
|
+
* - Server startup: <400ms
|
|
13
|
+
* - Health check: <10ms
|
|
14
|
+
* - Graceful shutdown: <5s
|
|
15
|
+
*
|
|
16
|
+
* @module @monomind/cli/mcp-server
|
|
17
|
+
* @version 3.0.0
|
|
18
|
+
*/
|
|
19
|
+
import { EventEmitter } from 'events';
|
|
20
|
+
import { execSync } from 'child_process';
|
|
21
|
+
import * as http from 'http';
|
|
22
|
+
import { randomUUID } from 'crypto';
|
|
23
|
+
import * as path from 'path';
|
|
24
|
+
import * as fs from 'fs';
|
|
25
|
+
/**
|
|
26
|
+
* Recursively strip prototype-pollution keys from a JSON-RPC message before
|
|
27
|
+
* downstream tool handlers consume it. Tool handlers commonly do shallow
|
|
28
|
+
* merges like `{ ...defaults, ...input }`, which would propagate
|
|
29
|
+
* `__proto__`/`constructor`/`prototype` payloads onto config objects.
|
|
30
|
+
*/
|
|
31
|
+
const FORBIDDEN_PROTO_KEYS = new Set(['__proto__', 'constructor', 'prototype']);
|
|
32
|
+
function sanitizeJsonRpcMessage(value, depth = 0) {
|
|
33
|
+
if (depth > 16)
|
|
34
|
+
return null;
|
|
35
|
+
if (Array.isArray(value))
|
|
36
|
+
return value.map(v => sanitizeJsonRpcMessage(v, depth + 1));
|
|
37
|
+
if (value !== null && typeof value === 'object') {
|
|
38
|
+
const out = {};
|
|
39
|
+
for (const [k, v] of Object.entries(value)) {
|
|
40
|
+
if (FORBIDDEN_PROTO_KEYS.has(k))
|
|
41
|
+
continue;
|
|
42
|
+
out[k] = sanitizeJsonRpcMessage(v, depth + 1);
|
|
43
|
+
}
|
|
44
|
+
return out;
|
|
45
|
+
}
|
|
46
|
+
return value;
|
|
47
|
+
}
|
|
48
|
+
import * as os from 'os';
|
|
49
|
+
import { fileURLToPath } from 'url';
|
|
50
|
+
import { dirname } from 'path';
|
|
51
|
+
import { trackRequest } from './mcp-tools/request-tracker.js';
|
|
52
|
+
// ESM-compatible __dirname
|
|
53
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
54
|
+
const __dirname = dirname(__filename);
|
|
55
|
+
/**
|
|
56
|
+
* Default configuration
|
|
57
|
+
*/
|
|
58
|
+
/**
|
|
59
|
+
* Resolve a per-user state directory under $HOME/.monomind. /tmp is shared and
|
|
60
|
+
* world-traversable; placing the PID/log files there made them symlink-
|
|
61
|
+
* attackable (a local attacker pre-creates /tmp/monomind-mcp.pid as a symlink
|
|
62
|
+
* to e.g. ~/.ssh/authorized_keys, then a writeFile clobbers the target).
|
|
63
|
+
*/
|
|
64
|
+
function getDefaultStateDir() {
|
|
65
|
+
const home = os.homedir();
|
|
66
|
+
return path.join(home, '.monomind');
|
|
67
|
+
}
|
|
68
|
+
const DEFAULT_OPTIONS = {
|
|
69
|
+
transport: 'stdio',
|
|
70
|
+
host: 'localhost',
|
|
71
|
+
port: 3000,
|
|
72
|
+
pidFile: path.join(getDefaultStateDir(), 'mcp.pid'),
|
|
73
|
+
logFile: path.join(getDefaultStateDir(), 'mcp.log'),
|
|
74
|
+
tools: 'all',
|
|
75
|
+
daemonize: false,
|
|
76
|
+
timeout: 30000,
|
|
77
|
+
};
|
|
78
|
+
/**
|
|
79
|
+
* MCP Server Manager
|
|
80
|
+
*
|
|
81
|
+
* Manages the lifecycle of the MCP server process
|
|
82
|
+
*/
|
|
83
|
+
export class MCPServerManager extends EventEmitter {
|
|
84
|
+
options;
|
|
85
|
+
process;
|
|
86
|
+
server;
|
|
87
|
+
startTime;
|
|
88
|
+
_stdioServerStarted = false;
|
|
89
|
+
healthCheckInterval;
|
|
90
|
+
constructor(options = {}) {
|
|
91
|
+
super();
|
|
92
|
+
this.options = { ...DEFAULT_OPTIONS, ...options };
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Start the MCP server
|
|
96
|
+
*/
|
|
97
|
+
async start() {
|
|
98
|
+
// Check if already running (skip if status reports our own PID —
|
|
99
|
+
// getStatus() returns running=true for the current process in stdio mode
|
|
100
|
+
// even before the server is actually started)
|
|
101
|
+
const status = await this.getStatus();
|
|
102
|
+
if (status.running && status.pid !== process.pid) {
|
|
103
|
+
throw new Error(`MCP Server already running (PID: ${status.pid})`);
|
|
104
|
+
}
|
|
105
|
+
const startTime = performance.now();
|
|
106
|
+
this.startTime = new Date();
|
|
107
|
+
this.emit('starting', { options: this.options });
|
|
108
|
+
try {
|
|
109
|
+
if (this.options.transport === 'stdio') {
|
|
110
|
+
// For stdio transport, spawn the server process
|
|
111
|
+
await this.startStdioServer();
|
|
112
|
+
}
|
|
113
|
+
else {
|
|
114
|
+
// For HTTP/WebSocket, start in-process server
|
|
115
|
+
await this.startHttpServer();
|
|
116
|
+
}
|
|
117
|
+
const duration = performance.now() - startTime;
|
|
118
|
+
// Write PID file
|
|
119
|
+
await this.writePidFile();
|
|
120
|
+
// Start health check monitoring
|
|
121
|
+
this.startHealthMonitoring();
|
|
122
|
+
const finalStatus = await this.getStatus();
|
|
123
|
+
this.emit('started', {
|
|
124
|
+
...finalStatus,
|
|
125
|
+
startupTime: duration,
|
|
126
|
+
});
|
|
127
|
+
return finalStatus;
|
|
128
|
+
}
|
|
129
|
+
catch (error) {
|
|
130
|
+
this.emit('error', error);
|
|
131
|
+
throw error;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Stop the MCP server
|
|
136
|
+
*/
|
|
137
|
+
async stop(force = false) {
|
|
138
|
+
const status = await this.getStatus();
|
|
139
|
+
if (!status.running) {
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
this.emit('stopping', { force });
|
|
143
|
+
try {
|
|
144
|
+
// Stop health monitoring
|
|
145
|
+
if (this.healthCheckInterval) {
|
|
146
|
+
clearInterval(this.healthCheckInterval);
|
|
147
|
+
this.healthCheckInterval = undefined;
|
|
148
|
+
}
|
|
149
|
+
if (this.process) {
|
|
150
|
+
// Graceful shutdown
|
|
151
|
+
if (!force) {
|
|
152
|
+
this.process.kill('SIGTERM');
|
|
153
|
+
await this.waitForExit(5000);
|
|
154
|
+
}
|
|
155
|
+
// Force kill if still running
|
|
156
|
+
if (this.process && !this.process.killed) {
|
|
157
|
+
this.process.kill('SIGKILL');
|
|
158
|
+
}
|
|
159
|
+
this.process = undefined;
|
|
160
|
+
}
|
|
161
|
+
if (this.server) {
|
|
162
|
+
await new Promise((resolve) => {
|
|
163
|
+
this.server.close(() => resolve());
|
|
164
|
+
});
|
|
165
|
+
this.server = undefined;
|
|
166
|
+
}
|
|
167
|
+
if (this._mcpServer) {
|
|
168
|
+
try {
|
|
169
|
+
await this._mcpServer.close();
|
|
170
|
+
}
|
|
171
|
+
catch { /* ignore */ }
|
|
172
|
+
this._mcpServer = undefined;
|
|
173
|
+
}
|
|
174
|
+
// Remove PID file
|
|
175
|
+
await this.removePidFile();
|
|
176
|
+
this.startTime = undefined;
|
|
177
|
+
this.emit('stopped');
|
|
178
|
+
}
|
|
179
|
+
catch (error) {
|
|
180
|
+
this.emit('error', error);
|
|
181
|
+
throw error;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Get server status
|
|
186
|
+
*/
|
|
187
|
+
async getStatus() {
|
|
188
|
+
// Check PID file
|
|
189
|
+
const pid = await this.readPidFile();
|
|
190
|
+
if (!pid) {
|
|
191
|
+
// No PID file found. Detect if we are running in stdio mode
|
|
192
|
+
// (e.g., launched by Claude Code via `claude mcp add`).
|
|
193
|
+
const isStdio = !process.stdin.isTTY;
|
|
194
|
+
const envTransport = process.env.MONOMIND_MCP_TRANSPORT;
|
|
195
|
+
if (isStdio || envTransport === 'stdio' || this._stdioServerStarted) {
|
|
196
|
+
return {
|
|
197
|
+
running: true,
|
|
198
|
+
pid: process.pid,
|
|
199
|
+
transport: 'stdio',
|
|
200
|
+
startedAt: this.startTime?.toISOString(),
|
|
201
|
+
uptime: this.startTime
|
|
202
|
+
? Math.floor((Date.now() - this.startTime.getTime()) / 1000)
|
|
203
|
+
: undefined,
|
|
204
|
+
};
|
|
205
|
+
}
|
|
206
|
+
return { running: false };
|
|
207
|
+
}
|
|
208
|
+
// Check if process is running
|
|
209
|
+
const isRunning = this.isProcessRunning(pid);
|
|
210
|
+
if (!isRunning) {
|
|
211
|
+
// Clean up stale PID file
|
|
212
|
+
await this.removePidFile();
|
|
213
|
+
return { running: false };
|
|
214
|
+
}
|
|
215
|
+
// Build status
|
|
216
|
+
const status = {
|
|
217
|
+
running: true,
|
|
218
|
+
pid,
|
|
219
|
+
transport: this.options.transport,
|
|
220
|
+
host: this.options.host,
|
|
221
|
+
port: this.options.port,
|
|
222
|
+
startedAt: this.startTime?.toISOString(),
|
|
223
|
+
uptime: this.startTime
|
|
224
|
+
? Math.floor((Date.now() - this.startTime.getTime()) / 1000)
|
|
225
|
+
: undefined,
|
|
226
|
+
};
|
|
227
|
+
// Get health status for HTTP transport
|
|
228
|
+
if (this.options.transport !== 'stdio') {
|
|
229
|
+
status.health = await this.checkHealth();
|
|
230
|
+
}
|
|
231
|
+
return status;
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* Check server health
|
|
235
|
+
*/
|
|
236
|
+
async checkHealth() {
|
|
237
|
+
if (this.options.transport === 'stdio') {
|
|
238
|
+
// For stdio, check if process is running
|
|
239
|
+
const pid = await this.readPidFile();
|
|
240
|
+
if (pid === null) {
|
|
241
|
+
return { healthy: false, error: 'No PID file found' };
|
|
242
|
+
}
|
|
243
|
+
if (!this.isProcessRunning(pid)) {
|
|
244
|
+
// Clean up stale PID file
|
|
245
|
+
await this.removePidFile();
|
|
246
|
+
return { healthy: false, error: 'Process not running (cleaned up stale PID)' };
|
|
247
|
+
}
|
|
248
|
+
return { healthy: true };
|
|
249
|
+
}
|
|
250
|
+
// For HTTP/WebSocket, make health check request
|
|
251
|
+
try {
|
|
252
|
+
const response = await this.httpRequest(`http://${this.options.host}:${this.options.port}/health`, 'GET', this.options.timeout);
|
|
253
|
+
return {
|
|
254
|
+
healthy: response.status === 'ok',
|
|
255
|
+
metrics: {
|
|
256
|
+
connections: response.connections || 0,
|
|
257
|
+
},
|
|
258
|
+
};
|
|
259
|
+
}
|
|
260
|
+
catch (error) {
|
|
261
|
+
return {
|
|
262
|
+
healthy: false,
|
|
263
|
+
error: error instanceof Error ? error.message : 'Unknown error',
|
|
264
|
+
};
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
/**
|
|
268
|
+
* Restart the server
|
|
269
|
+
*/
|
|
270
|
+
async restart() {
|
|
271
|
+
await this.stop();
|
|
272
|
+
return await this.start();
|
|
273
|
+
}
|
|
274
|
+
/**
|
|
275
|
+
* Start stdio server in-process
|
|
276
|
+
* Handles stdin/stdout directly like V2 implementation
|
|
277
|
+
*/
|
|
278
|
+
async startStdioServer() {
|
|
279
|
+
this._stdioServerStarted = true;
|
|
280
|
+
// Import the tool registry
|
|
281
|
+
const { listMCPTools, callMCPTool, hasTool } = await import('./mcp-client.js');
|
|
282
|
+
const VERSION = '3.0.0';
|
|
283
|
+
const sessionId = `mcp-${Date.now()}-${randomUUID().slice(0, 8)}`;
|
|
284
|
+
// Log to stderr to not corrupt stdout
|
|
285
|
+
console.error(`[${new Date().toISOString()}] INFO [monomind-mcp] (${sessionId}) Starting in stdio mode`);
|
|
286
|
+
// Auto-initialize memory database before tools are registered (#1524)
|
|
287
|
+
// This ensures memory_store and other memory tools work immediately
|
|
288
|
+
// without waiting for the first tool call to trigger lazy init.
|
|
289
|
+
try {
|
|
290
|
+
const { initializeMemoryDatabase, checkMemoryInitialization } = await import('./memory/memory-initializer.js');
|
|
291
|
+
const status = await checkMemoryInitialization();
|
|
292
|
+
if (!status.initialized) {
|
|
293
|
+
console.error(`[${new Date().toISOString()}] INFO [monomind-mcp] (${sessionId}) Auto-initializing memory database...`);
|
|
294
|
+
const result = await initializeMemoryDatabase({ force: false, verbose: false });
|
|
295
|
+
if (result.success) {
|
|
296
|
+
console.error(`[${new Date().toISOString()}] INFO [monomind-mcp] (${sessionId}) Memory database initialized at ${result.dbPath}`);
|
|
297
|
+
}
|
|
298
|
+
else if (result.error && !result.error.includes('already exists')) {
|
|
299
|
+
console.error(`[${new Date().toISOString()}] WARN [monomind-mcp] (${sessionId}) Memory database init returned: ${result.error}`);
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
else {
|
|
303
|
+
console.error(`[${new Date().toISOString()}] INFO [monomind-mcp] (${sessionId}) Memory database already initialized (v${status.version || 'unknown'})`);
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
catch (memInitError) {
|
|
307
|
+
// Graceful degradation: server continues even if memory init fails.
|
|
308
|
+
// Memory tools will attempt lazy init on first call via ensureInitialized().
|
|
309
|
+
console.error(`[${new Date().toISOString()}] WARN [monomind-mcp] (${sessionId}) Memory auto-init failed (tools will retry on first call): ${memInitError instanceof Error ? memInitError.message : String(memInitError)}`);
|
|
310
|
+
}
|
|
311
|
+
console.error(JSON.stringify({
|
|
312
|
+
arch: process.arch,
|
|
313
|
+
mode: 'mcp-stdio',
|
|
314
|
+
nodeVersion: process.version,
|
|
315
|
+
pid: process.pid,
|
|
316
|
+
platform: process.platform,
|
|
317
|
+
protocol: 'stdio',
|
|
318
|
+
sessionId,
|
|
319
|
+
version: VERSION,
|
|
320
|
+
}));
|
|
321
|
+
// Send server initialization notification
|
|
322
|
+
console.log(JSON.stringify({
|
|
323
|
+
jsonrpc: '2.0',
|
|
324
|
+
method: 'server.initialized',
|
|
325
|
+
params: {
|
|
326
|
+
serverInfo: {
|
|
327
|
+
name: 'monomind',
|
|
328
|
+
version: VERSION,
|
|
329
|
+
capabilities: {
|
|
330
|
+
tools: { listChanged: true },
|
|
331
|
+
resources: { subscribe: true, listChanged: true },
|
|
332
|
+
},
|
|
333
|
+
},
|
|
334
|
+
},
|
|
335
|
+
}));
|
|
336
|
+
// Handle stdin messages (S-5: bounded buffer to prevent OOM)
|
|
337
|
+
const MAX_BUFFER_SIZE = 10 * 1024 * 1024; // 10MB
|
|
338
|
+
let buffer = '';
|
|
339
|
+
process.stdin.on('data', async (chunk) => {
|
|
340
|
+
buffer += chunk.toString();
|
|
341
|
+
if (buffer.length > MAX_BUFFER_SIZE) {
|
|
342
|
+
console.error(`[${new Date().toISOString()}] ERROR [monomind-mcp] Buffer exceeded ${MAX_BUFFER_SIZE} bytes, rejecting`);
|
|
343
|
+
buffer = '';
|
|
344
|
+
console.log(JSON.stringify({
|
|
345
|
+
jsonrpc: '2.0',
|
|
346
|
+
error: { code: -32600, message: 'Request too large' },
|
|
347
|
+
}));
|
|
348
|
+
return;
|
|
349
|
+
}
|
|
350
|
+
// Process complete JSON messages
|
|
351
|
+
let lines = buffer.split('\n');
|
|
352
|
+
buffer = lines.pop() || ''; // Keep incomplete line in buffer
|
|
353
|
+
for (const line of lines) {
|
|
354
|
+
if (line.trim()) {
|
|
355
|
+
try {
|
|
356
|
+
// Sanitize against prototype pollution. JSON.parse on its own does
|
|
357
|
+
// not pollute, but downstream tool handlers that shallow-merge
|
|
358
|
+
// input into option defaults would propagate `__proto__`,
|
|
359
|
+
// `constructor`, or `prototype` keys. Strip them at the boundary.
|
|
360
|
+
const message = sanitizeJsonRpcMessage(JSON.parse(line));
|
|
361
|
+
const response = await this.handleMCPMessage(message, sessionId);
|
|
362
|
+
if (response) {
|
|
363
|
+
console.log(JSON.stringify(response));
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
catch (error) {
|
|
367
|
+
// Log-injection defense: stringify message fragment instead of
|
|
368
|
+
// letting raw line content land in the log unescaped.
|
|
369
|
+
const safeMsg = (error instanceof Error ? error.message : String(error))
|
|
370
|
+
.replace(/[\r\n\x00-\x1f\x7f]/g, '?').slice(0, 500);
|
|
371
|
+
console.error(`[${new Date().toISOString()}] ERROR [monomind-mcp] Failed to parse message: ${safeMsg}`);
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
});
|
|
376
|
+
// Centralized graceful shutdown — clears the health-check interval and
|
|
377
|
+
// removes the PID file before exiting. Without this an abrupt
|
|
378
|
+
// `process.exit(0)` leaves a stale PID file plus a dangling interval and
|
|
379
|
+
// unflushed in-flight tool calls.
|
|
380
|
+
let shuttingDown = false;
|
|
381
|
+
const shutdown = async (reason) => {
|
|
382
|
+
if (shuttingDown)
|
|
383
|
+
return;
|
|
384
|
+
shuttingDown = true;
|
|
385
|
+
console.error(`[${new Date().toISOString()}] INFO [monomind-mcp] (${sessionId}) ${reason}, shutting down...`);
|
|
386
|
+
try {
|
|
387
|
+
if (this.healthCheckInterval) {
|
|
388
|
+
clearInterval(this.healthCheckInterval);
|
|
389
|
+
this.healthCheckInterval = undefined;
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
catch { /* best-effort */ }
|
|
393
|
+
try {
|
|
394
|
+
await this.removePidFile();
|
|
395
|
+
}
|
|
396
|
+
catch { /* best-effort */ }
|
|
397
|
+
process.exit(0);
|
|
398
|
+
};
|
|
399
|
+
process.stdin.on('end', () => { void shutdown('stdin closed'); });
|
|
400
|
+
process.on('SIGINT', () => { void shutdown('Received SIGINT'); });
|
|
401
|
+
process.on('SIGTERM', () => { void shutdown('Received SIGTERM'); });
|
|
402
|
+
// Mark as ready immediately for stdio
|
|
403
|
+
this.emit('ready');
|
|
404
|
+
}
|
|
405
|
+
/**
|
|
406
|
+
* Handle incoming MCP message
|
|
407
|
+
*/
|
|
408
|
+
async handleMCPMessage(message, sessionId) {
|
|
409
|
+
const { listMCPTools, callMCPTool, hasTool } = await import('./mcp-client.js');
|
|
410
|
+
if (!message.method) {
|
|
411
|
+
return {
|
|
412
|
+
jsonrpc: '2.0',
|
|
413
|
+
id: message.id,
|
|
414
|
+
error: { code: -32600, message: 'Invalid Request: missing method' },
|
|
415
|
+
};
|
|
416
|
+
}
|
|
417
|
+
const params = (message.params || {});
|
|
418
|
+
try {
|
|
419
|
+
switch (message.method) {
|
|
420
|
+
case 'initialize':
|
|
421
|
+
return {
|
|
422
|
+
jsonrpc: '2.0',
|
|
423
|
+
id: message.id,
|
|
424
|
+
result: {
|
|
425
|
+
protocolVersion: '2024-11-05',
|
|
426
|
+
serverInfo: { name: 'monomind', version: '3.0.0' },
|
|
427
|
+
capabilities: {
|
|
428
|
+
tools: { listChanged: true },
|
|
429
|
+
resources: { subscribe: true, listChanged: true },
|
|
430
|
+
},
|
|
431
|
+
},
|
|
432
|
+
};
|
|
433
|
+
case 'tools/list':
|
|
434
|
+
const tools = listMCPTools();
|
|
435
|
+
return {
|
|
436
|
+
jsonrpc: '2.0',
|
|
437
|
+
id: message.id,
|
|
438
|
+
result: {
|
|
439
|
+
tools: tools.map(tool => ({
|
|
440
|
+
name: tool.name,
|
|
441
|
+
description: tool.description,
|
|
442
|
+
inputSchema: tool.inputSchema,
|
|
443
|
+
})),
|
|
444
|
+
},
|
|
445
|
+
};
|
|
446
|
+
case 'tools/call': {
|
|
447
|
+
// Strict boundary validation. Without this, `params.name` could be
|
|
448
|
+
// an array/object (silently coerced) and `params.arguments` could be
|
|
449
|
+
// an array (downstream `Object.keys` returns numeric indices).
|
|
450
|
+
if (typeof params.name !== 'string') {
|
|
451
|
+
return {
|
|
452
|
+
jsonrpc: '2.0',
|
|
453
|
+
id: message.id,
|
|
454
|
+
error: { code: -32602, message: 'Invalid params.name: must be a string' },
|
|
455
|
+
};
|
|
456
|
+
}
|
|
457
|
+
const rawArgs = params.arguments;
|
|
458
|
+
if (rawArgs !== undefined && (typeof rawArgs !== 'object' || rawArgs === null || Array.isArray(rawArgs))) {
|
|
459
|
+
return {
|
|
460
|
+
jsonrpc: '2.0',
|
|
461
|
+
id: message.id,
|
|
462
|
+
error: { code: -32602, message: 'Invalid params.arguments: must be an object' },
|
|
463
|
+
};
|
|
464
|
+
}
|
|
465
|
+
const toolName = params.name;
|
|
466
|
+
const toolParams = (rawArgs || {});
|
|
467
|
+
if (!hasTool(toolName)) {
|
|
468
|
+
return {
|
|
469
|
+
jsonrpc: '2.0',
|
|
470
|
+
id: message.id,
|
|
471
|
+
error: { code: -32601, message: `Tool not found: ${toolName}` },
|
|
472
|
+
};
|
|
473
|
+
}
|
|
474
|
+
try {
|
|
475
|
+
const result = await callMCPTool(toolName, toolParams, { sessionId });
|
|
476
|
+
trackRequest(toolName, true);
|
|
477
|
+
return {
|
|
478
|
+
jsonrpc: '2.0',
|
|
479
|
+
id: message.id,
|
|
480
|
+
result: { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] },
|
|
481
|
+
};
|
|
482
|
+
}
|
|
483
|
+
catch (error) {
|
|
484
|
+
trackRequest(toolName, false);
|
|
485
|
+
const errMsg = process.env.NODE_ENV === 'production'
|
|
486
|
+
? 'Tool execution failed'
|
|
487
|
+
: (error instanceof Error ? error.message : 'Tool execution failed');
|
|
488
|
+
return {
|
|
489
|
+
jsonrpc: '2.0',
|
|
490
|
+
id: message.id,
|
|
491
|
+
error: {
|
|
492
|
+
code: -32603,
|
|
493
|
+
message: errMsg,
|
|
494
|
+
},
|
|
495
|
+
};
|
|
496
|
+
}
|
|
497
|
+
}
|
|
498
|
+
case 'notifications/initialized':
|
|
499
|
+
// Client notification - no response needed
|
|
500
|
+
console.error(`[${new Date().toISOString()}] INFO [monomind-mcp] (${sessionId}) Client initialized`);
|
|
501
|
+
return null;
|
|
502
|
+
case 'ping':
|
|
503
|
+
return {
|
|
504
|
+
jsonrpc: '2.0',
|
|
505
|
+
id: message.id,
|
|
506
|
+
result: {},
|
|
507
|
+
};
|
|
508
|
+
default:
|
|
509
|
+
return {
|
|
510
|
+
jsonrpc: '2.0',
|
|
511
|
+
id: message.id,
|
|
512
|
+
error: { code: -32601, message: `Method not found: ${message.method}` },
|
|
513
|
+
};
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
catch (error) {
|
|
517
|
+
// Log-injection defense: caller-controlled `message.method` may contain
|
|
518
|
+
// newlines, ANSI escapes, or other control bytes that forge log lines.
|
|
519
|
+
// JSON.stringify quotes the string and escapes control chars.
|
|
520
|
+
const safeMethod = JSON.stringify(message.method);
|
|
521
|
+
const errMsg = error instanceof Error ? error.message : String(error);
|
|
522
|
+
console.error(`[${new Date().toISOString()}] ERROR [monomind-mcp] Error handling ${safeMethod}: ${errMsg.replace(/[\r\n]/g, ' ')}`);
|
|
523
|
+
// Sanitize outgoing error messages — internal Error.message often
|
|
524
|
+
// contains absolute paths or partial secrets. In production return a
|
|
525
|
+
// generic message; in dev/debug return the full message for triage.
|
|
526
|
+
const isProd = process.env.NODE_ENV === 'production';
|
|
527
|
+
const outMessage = error instanceof Error
|
|
528
|
+
? (isProd ? 'Internal error' : error.message)
|
|
529
|
+
: 'Internal error';
|
|
530
|
+
return {
|
|
531
|
+
jsonrpc: '2.0',
|
|
532
|
+
id: message.id,
|
|
533
|
+
error: { code: -32603, message: outMessage },
|
|
534
|
+
};
|
|
535
|
+
}
|
|
536
|
+
}
|
|
537
|
+
/**
|
|
538
|
+
* Start HTTP server in-process.
|
|
539
|
+
*
|
|
540
|
+
* SECURITY: refuses to bind to non-loopback hosts unless the operator opts
|
|
541
|
+
* in via MONOMIND_MCP_ALLOW_REMOTE=1 AND provides a bearer token via
|
|
542
|
+
* MONOMIND_MCP_TOKEN. Without this gate, `--host 0.0.0.0` exposed every
|
|
543
|
+
* registered tool (including agent_spawn, terminal-tools, system tools) to
|
|
544
|
+
* any LAN attacker as unauthenticated RCE.
|
|
545
|
+
*/
|
|
546
|
+
async startHttpServer() {
|
|
547
|
+
// Loopback gate
|
|
548
|
+
const host = this.options.host;
|
|
549
|
+
const isLoopback = host === 'localhost' || host === '127.0.0.1' || host === '::1' || host === '::ffff:127.0.0.1';
|
|
550
|
+
const allowRemote = process.env.MONOMIND_MCP_ALLOW_REMOTE === '1';
|
|
551
|
+
const token = process.env.MONOMIND_MCP_TOKEN;
|
|
552
|
+
if (!isLoopback && !allowRemote) {
|
|
553
|
+
throw new Error(`Refusing to bind MCP HTTP transport to non-loopback host "${host}". ` +
|
|
554
|
+
`Set MONOMIND_MCP_ALLOW_REMOTE=1 and MONOMIND_MCP_TOKEN=<secret> to enable remote access.`);
|
|
555
|
+
}
|
|
556
|
+
if (!isLoopback && allowRemote && (!token || token.length < 32)) {
|
|
557
|
+
throw new Error('Remote MCP transport requires MONOMIND_MCP_TOKEN to be set to a strong secret (>= 32 chars).');
|
|
558
|
+
}
|
|
559
|
+
// Dynamically import the MCP server package
|
|
560
|
+
// FIX for issue #942: Use proper package import instead of broken relative path
|
|
561
|
+
const { createMCPServer } = await import('@monomind/mcp');
|
|
562
|
+
const logger = {
|
|
563
|
+
debug: (msg, data) => this.emit('log', { level: 'debug', msg, data }),
|
|
564
|
+
info: (msg, data) => this.emit('log', { level: 'info', msg, data }),
|
|
565
|
+
warn: (msg, data) => this.emit('log', { level: 'warn', msg, data }),
|
|
566
|
+
error: (msg, data) => this.emit('log', { level: 'error', msg, data }),
|
|
567
|
+
};
|
|
568
|
+
// SECURITY: actually wire the token into the underlying server's auth
|
|
569
|
+
// config. The startup gate above only *validates* that a token was set —
|
|
570
|
+
// without passing it through here, the token was never enforced on
|
|
571
|
+
// requests. Operators believed their server was protected when it wasn't.
|
|
572
|
+
// For loopback we still configure auth when a token is set, so users who
|
|
573
|
+
// explicitly opt-in to bind 0.0.0.0 with a token get end-to-end protection.
|
|
574
|
+
const authConfig = token && token.length >= 32
|
|
575
|
+
? { enabled: true, method: 'token', tokens: [token] }
|
|
576
|
+
: (isLoopback ? undefined : { enabled: true, method: 'token', tokens: [] });
|
|
577
|
+
const mcpServer = createMCPServer({
|
|
578
|
+
name: 'Monomind MCP Server V1',
|
|
579
|
+
version: '3.0.0',
|
|
580
|
+
transport: this.options.transport,
|
|
581
|
+
host: this.options.host,
|
|
582
|
+
port: this.options.port,
|
|
583
|
+
enableMetrics: true,
|
|
584
|
+
enableCaching: true,
|
|
585
|
+
...(authConfig ? { auth: authConfig } : {}),
|
|
586
|
+
}, logger);
|
|
587
|
+
await mcpServer.start();
|
|
588
|
+
// Store reference for stopping
|
|
589
|
+
this._mcpServer = mcpServer;
|
|
590
|
+
}
|
|
591
|
+
/**
|
|
592
|
+
* Wait for server to be ready
|
|
593
|
+
*/
|
|
594
|
+
async waitForReady(timeout = 10000) {
|
|
595
|
+
// For stdio transport, we're ready immediately (in-process)
|
|
596
|
+
if (this.options.transport === 'stdio') {
|
|
597
|
+
return;
|
|
598
|
+
}
|
|
599
|
+
const startTime = Date.now();
|
|
600
|
+
while (Date.now() - startTime < timeout) {
|
|
601
|
+
const health = await this.checkHealth();
|
|
602
|
+
if (health.healthy) {
|
|
603
|
+
return;
|
|
604
|
+
}
|
|
605
|
+
await this.sleep(100);
|
|
606
|
+
}
|
|
607
|
+
throw new Error('Server failed to start within timeout');
|
|
608
|
+
}
|
|
609
|
+
/**
|
|
610
|
+
* Wait for process to exit
|
|
611
|
+
*/
|
|
612
|
+
async waitForExit(timeout) {
|
|
613
|
+
if (!this.process)
|
|
614
|
+
return;
|
|
615
|
+
return new Promise((resolve) => {
|
|
616
|
+
const timer = setTimeout(() => {
|
|
617
|
+
resolve();
|
|
618
|
+
}, timeout);
|
|
619
|
+
this.process.once('exit', () => {
|
|
620
|
+
clearTimeout(timer);
|
|
621
|
+
resolve();
|
|
622
|
+
});
|
|
623
|
+
});
|
|
624
|
+
}
|
|
625
|
+
/**
|
|
626
|
+
* Start health monitoring
|
|
627
|
+
*/
|
|
628
|
+
startHealthMonitoring() {
|
|
629
|
+
this.healthCheckInterval = setInterval(async () => {
|
|
630
|
+
try {
|
|
631
|
+
const health = await this.checkHealth();
|
|
632
|
+
this.emit('health', health);
|
|
633
|
+
if (!health.healthy) {
|
|
634
|
+
this.emit('unhealthy', health);
|
|
635
|
+
}
|
|
636
|
+
}
|
|
637
|
+
catch (error) {
|
|
638
|
+
this.emit('health-error', error);
|
|
639
|
+
}
|
|
640
|
+
}, 30000);
|
|
641
|
+
this.healthCheckInterval.unref();
|
|
642
|
+
}
|
|
643
|
+
/**
|
|
644
|
+
* Write PID file
|
|
645
|
+
*/
|
|
646
|
+
async writePidFile() {
|
|
647
|
+
const pid = this.process?.pid || process.pid;
|
|
648
|
+
// Ensure the state dir exists (user-private, not /tmp)
|
|
649
|
+
const dir = path.dirname(this.options.pidFile);
|
|
650
|
+
await fs.promises.mkdir(dir, { recursive: true, mode: 0o700 });
|
|
651
|
+
// wx flag = O_CREAT | O_EXCL: fails fast on a pre-existing path including
|
|
652
|
+
// a symlinked one, so we never follow an attacker-staged link to write
|
|
653
|
+
// PIDs into ~/.ssh/authorized_keys or similar.
|
|
654
|
+
try {
|
|
655
|
+
await fs.promises.writeFile(this.options.pidFile, String(pid), { flag: 'wx', mode: 0o600 });
|
|
656
|
+
}
|
|
657
|
+
catch (e) {
|
|
658
|
+
const code = e.code;
|
|
659
|
+
if (code === 'EEXIST') {
|
|
660
|
+
// Stale PID file (the existence-check + isProcessRunning gate above
|
|
661
|
+
// already passed, so the file belongs to a dead daemon). Replace it
|
|
662
|
+
// by unlinking-then-creating with O_EXCL again — never write through
|
|
663
|
+
// an existing path that might be a symlink.
|
|
664
|
+
await fs.promises.unlink(this.options.pidFile);
|
|
665
|
+
await fs.promises.writeFile(this.options.pidFile, String(pid), { flag: 'wx', mode: 0o600 });
|
|
666
|
+
}
|
|
667
|
+
else {
|
|
668
|
+
throw e;
|
|
669
|
+
}
|
|
670
|
+
}
|
|
671
|
+
}
|
|
672
|
+
/**
|
|
673
|
+
* Read PID file
|
|
674
|
+
*/
|
|
675
|
+
async readPidFile() {
|
|
676
|
+
try {
|
|
677
|
+
const content = await fs.promises.readFile(this.options.pidFile, 'utf8');
|
|
678
|
+
const pid = parseInt(content.trim(), 10);
|
|
679
|
+
return isNaN(pid) ? null : pid;
|
|
680
|
+
}
|
|
681
|
+
catch {
|
|
682
|
+
return null;
|
|
683
|
+
}
|
|
684
|
+
}
|
|
685
|
+
/**
|
|
686
|
+
* Remove PID file
|
|
687
|
+
*/
|
|
688
|
+
async removePidFile() {
|
|
689
|
+
try {
|
|
690
|
+
await fs.promises.unlink(this.options.pidFile);
|
|
691
|
+
}
|
|
692
|
+
catch {
|
|
693
|
+
// Ignore errors
|
|
694
|
+
}
|
|
695
|
+
// Also clean up legacy PID file location from older versions
|
|
696
|
+
try {
|
|
697
|
+
const legacyPath = path.join(process.env.MONOMIND_CWD || process.cwd(), '.monomind', 'mcp-server.pid');
|
|
698
|
+
if (legacyPath !== this.options.pidFile) {
|
|
699
|
+
await fs.promises.unlink(legacyPath);
|
|
700
|
+
}
|
|
701
|
+
}
|
|
702
|
+
catch {
|
|
703
|
+
// Ignore — file may not exist
|
|
704
|
+
}
|
|
705
|
+
}
|
|
706
|
+
/**
|
|
707
|
+
* Check if process is running AND is a node/monomind process.
|
|
708
|
+
* Plain `kill -0` returns true for any process with the same owner,
|
|
709
|
+
* which causes false positives when the OS recycles the PID.
|
|
710
|
+
*/
|
|
711
|
+
isProcessRunning(pid) {
|
|
712
|
+
try {
|
|
713
|
+
process.kill(pid, 0);
|
|
714
|
+
}
|
|
715
|
+
catch {
|
|
716
|
+
return false;
|
|
717
|
+
}
|
|
718
|
+
// Verify it's actually our MCP server process (guards against PID reuse by
|
|
719
|
+
// an unrelated Node.js program that happened to get the same PID).
|
|
720
|
+
// We require the command line to mention both "node"/"npx" AND "monomind"/"mcp".
|
|
721
|
+
try {
|
|
722
|
+
const cmdline = execSync(`cat /proc/${pid}/cmdline 2>/dev/null || ps -p ${pid} -o args= 2>/dev/null`, {
|
|
723
|
+
encoding: 'utf8',
|
|
724
|
+
timeout: 1000,
|
|
725
|
+
}).trim();
|
|
726
|
+
const isMonomindMcp = (cmdline.includes('node') || cmdline.includes('npx')) &&
|
|
727
|
+
(cmdline.includes('monomind') || cmdline.includes('mcp'));
|
|
728
|
+
return isMonomindMcp;
|
|
729
|
+
}
|
|
730
|
+
catch {
|
|
731
|
+
// If we can't inspect the process (macOS, Windows, permissions), fall back to kill check
|
|
732
|
+
return true;
|
|
733
|
+
}
|
|
734
|
+
}
|
|
735
|
+
/**
|
|
736
|
+
* Make HTTP request
|
|
737
|
+
*/
|
|
738
|
+
async httpRequest(url, method, timeout) {
|
|
739
|
+
return new Promise((resolve, reject) => {
|
|
740
|
+
const urlObj = new URL(url);
|
|
741
|
+
const req = http.request({
|
|
742
|
+
hostname: urlObj.hostname,
|
|
743
|
+
port: urlObj.port,
|
|
744
|
+
path: urlObj.pathname,
|
|
745
|
+
method,
|
|
746
|
+
timeout,
|
|
747
|
+
}, (res) => {
|
|
748
|
+
let data = '';
|
|
749
|
+
res.on('data', (chunk) => {
|
|
750
|
+
data += chunk;
|
|
751
|
+
});
|
|
752
|
+
res.on('end', () => {
|
|
753
|
+
try {
|
|
754
|
+
resolve(JSON.parse(data));
|
|
755
|
+
}
|
|
756
|
+
catch {
|
|
757
|
+
resolve({ status: res.statusCode === 200 ? 'ok' : 'error' });
|
|
758
|
+
}
|
|
759
|
+
});
|
|
760
|
+
});
|
|
761
|
+
req.on('error', reject);
|
|
762
|
+
req.on('timeout', () => {
|
|
763
|
+
req.destroy();
|
|
764
|
+
reject(new Error('Request timeout'));
|
|
765
|
+
});
|
|
766
|
+
req.end();
|
|
767
|
+
});
|
|
768
|
+
}
|
|
769
|
+
/**
|
|
770
|
+
* Sleep utility
|
|
771
|
+
*/
|
|
772
|
+
sleep(ms) {
|
|
773
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
774
|
+
}
|
|
775
|
+
}
|
|
776
|
+
/**
|
|
777
|
+
* Create MCP server manager
|
|
778
|
+
*/
|
|
779
|
+
export function createMCPServerManager(options) {
|
|
780
|
+
return new MCPServerManager(options);
|
|
781
|
+
}
|
|
782
|
+
/**
|
|
783
|
+
* Singleton server manager instance
|
|
784
|
+
*/
|
|
785
|
+
let serverManager = null;
|
|
786
|
+
let currentTransport = undefined;
|
|
787
|
+
/**
|
|
788
|
+
* Get or create server manager singleton
|
|
789
|
+
*
|
|
790
|
+
* FIX for issue #942: Recreate singleton if transport type changes
|
|
791
|
+
* Previously, once created with stdio (default), HTTP options were ignored
|
|
792
|
+
*/
|
|
793
|
+
export function getServerManager(options) {
|
|
794
|
+
const requestedTransport = options?.transport;
|
|
795
|
+
// Recreate if transport type changes (fixes HTTP transport not working)
|
|
796
|
+
if (serverManager && requestedTransport && requestedTransport !== currentTransport) {
|
|
797
|
+
serverManager = new MCPServerManager(options);
|
|
798
|
+
currentTransport = requestedTransport;
|
|
799
|
+
}
|
|
800
|
+
if (!serverManager) {
|
|
801
|
+
serverManager = new MCPServerManager(options);
|
|
802
|
+
currentTransport = options?.transport;
|
|
803
|
+
}
|
|
804
|
+
return serverManager;
|
|
805
|
+
}
|
|
806
|
+
/**
|
|
807
|
+
* Quick start MCP server
|
|
808
|
+
*/
|
|
809
|
+
export async function startMCPServer(options) {
|
|
810
|
+
const manager = getServerManager(options);
|
|
811
|
+
return await manager.start();
|
|
812
|
+
}
|
|
813
|
+
/**
|
|
814
|
+
* Quick stop MCP server
|
|
815
|
+
*/
|
|
816
|
+
export async function stopMCPServer(force = false) {
|
|
817
|
+
if (serverManager) {
|
|
818
|
+
await serverManager.stop(force);
|
|
819
|
+
}
|
|
820
|
+
}
|
|
821
|
+
/**
|
|
822
|
+
* Get MCP server status
|
|
823
|
+
*/
|
|
824
|
+
export async function getMCPServerStatus() {
|
|
825
|
+
const manager = getServerManager();
|
|
826
|
+
return await manager.getStatus();
|
|
827
|
+
}
|
|
828
|
+
export default MCPServerManager;
|
|
829
|
+
//# sourceMappingURL=mcp-server.js.map
|