@monoes/monomindcli 1.11.14 → 1.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/agents/generated/channel-intelligence-director.md +87 -0
- package/.claude/agents/generated/chief-growth-officer.md +88 -0
- package/.claude/agents/generated/content-seo-strategist.md +90 -0
- package/.claude/agents/generated/developer-community-strategist.md +91 -0
- package/.claude/agents/generated/outreach-partnership-strategist.md +90 -0
- package/.claude/agents/generated/social-media-strategist.md +91 -0
- package/.claude/agents/generated/video-visual-strategist.md +90 -0
- package/.claude/commands/mastermind/master.md +1 -1
- package/.claude/helpers/auto-memory-hook.mjs +13 -4
- package/.claude/helpers/control-start.cjs +5 -0
- package/.claude/helpers/event-logger.cjs +114 -0
- package/.claude/helpers/handlers/adr-draft-handler.cjs +19 -5
- package/.claude/helpers/handlers/agent-start-handler.cjs +13 -4
- package/.claude/helpers/handlers/compact-handler.cjs +2 -0
- package/.claude/helpers/handlers/edit-handler.cjs +1 -1
- package/.claude/helpers/handlers/gates-handler.cjs +3 -0
- package/.claude/helpers/handlers/graph-status-handler.cjs +14 -8
- package/.claude/helpers/handlers/loops-status-handler.cjs +5 -2
- package/.claude/helpers/handlers/route-handler.cjs +24 -10
- package/.claude/helpers/handlers/session-handler.cjs +11 -4
- package/.claude/helpers/handlers/session-restore-handler.cjs +35 -19
- package/.claude/helpers/handlers/task-handler.cjs +13 -5
- package/.claude/helpers/hook-handler.cjs +40 -0
- package/.claude/helpers/intelligence.cjs +130 -53
- package/.claude/helpers/loop-tracker.cjs +15 -3
- package/.claude/helpers/memory-palace.cjs +461 -0
- package/.claude/helpers/memory.cjs +138 -14
- package/.claude/helpers/metrics-db.mjs +87 -0
- package/.claude/helpers/router.cjs +300 -42
- package/.claude/helpers/session.cjs +89 -30
- package/.claude/helpers/statusline.cjs +148 -4
- package/.claude/helpers/toggle-statusline.cjs +73 -0
- package/.claude/helpers/token-tracker.cjs +934 -0
- package/.claude/helpers/utils/micro-agents.cjs +20 -4
- package/.claude/helpers/utils/monograph.cjs +39 -4
- package/.claude/helpers/utils/telemetry.cjs +3 -3
- package/.claude/skills/mastermind/_protocol.md +25 -15
- package/.claude/skills/mastermind/architect.md +3 -3
- package/.claude/skills/mastermind/autodev.md +4 -2
- package/.claude/skills/mastermind/idea.md +10 -0
- package/.claude/skills/mastermind/ops.md +3 -3
- package/.claude/skills/mastermind/runorg.md +153 -86
- package/dist/src/agents/registry-builder.d.ts.map +1 -1
- package/dist/src/agents/registry-builder.js +2 -0
- package/dist/src/agents/registry-builder.js.map +1 -1
- package/dist/src/autopilot-state.d.ts.map +1 -1
- package/dist/src/autopilot-state.js +10 -5
- package/dist/src/autopilot-state.js.map +1 -1
- package/dist/src/benchmarks/benchmark-runner.d.ts.map +1 -1
- package/dist/src/benchmarks/benchmark-runner.js +13 -0
- 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 +20 -9
- package/dist/src/benchmarks/metric-evaluators.js.map +1 -1
- package/dist/src/browser/actions.d.ts.map +1 -1
- package/dist/src/browser/actions.js +10 -3
- package/dist/src/browser/actions.js.map +1 -1
- package/dist/src/browser/browser.d.ts.map +1 -1
- package/dist/src/browser/browser.js +12 -2
- package/dist/src/browser/browser.js.map +1 -1
- package/dist/src/browser/cdp.d.ts.map +1 -1
- package/dist/src/browser/cdp.js +21 -3
- package/dist/src/browser/cdp.js.map +1 -1
- package/dist/src/browser/har.d.ts.map +1 -1
- package/dist/src/browser/har.js +27 -5
- package/dist/src/browser/har.js.map +1 -1
- package/dist/src/commands/agent.d.ts.map +1 -1
- package/dist/src/commands/agent.js +11 -8
- package/dist/src/commands/agent.js.map +1 -1
- package/dist/src/commands/analyze.d.ts.map +1 -1
- package/dist/src/commands/analyze.js +36 -21
- package/dist/src/commands/analyze.js.map +1 -1
- package/dist/src/commands/autopilot.d.ts.map +1 -1
- package/dist/src/commands/autopilot.js +12 -4
- package/dist/src/commands/autopilot.js.map +1 -1
- package/dist/src/commands/benchmark.d.ts.map +1 -1
- package/dist/src/commands/benchmark.js +51 -8
- package/dist/src/commands/benchmark.js.map +1 -1
- package/dist/src/commands/browse.d.ts.map +1 -1
- package/dist/src/commands/browse.js +5 -2
- package/dist/src/commands/browse.js.map +1 -1
- package/dist/src/commands/claims.d.ts.map +1 -1
- package/dist/src/commands/claims.js +29 -11
- package/dist/src/commands/claims.js.map +1 -1
- package/dist/src/commands/cleanup.d.ts.map +1 -1
- package/dist/src/commands/cleanup.js +25 -5
- package/dist/src/commands/cleanup.js.map +1 -1
- package/dist/src/commands/config.d.ts.map +1 -1
- package/dist/src/commands/config.js +15 -7
- package/dist/src/commands/config.js.map +1 -1
- package/dist/src/commands/daemon.d.ts.map +1 -1
- package/dist/src/commands/daemon.js +6 -0
- package/dist/src/commands/daemon.js.map +1 -1
- package/dist/src/commands/deployment.d.ts.map +1 -1
- package/dist/src/commands/deployment.js +34 -19
- package/dist/src/commands/deployment.js.map +1 -1
- package/dist/src/commands/doctor.d.ts.map +1 -1
- package/dist/src/commands/doctor.js +133 -15
- package/dist/src/commands/doctor.js.map +1 -1
- package/dist/src/commands/guidance.d.ts.map +1 -1
- package/dist/src/commands/guidance.js +15 -2
- package/dist/src/commands/guidance.js.map +1 -1
- package/dist/src/commands/hive-mind.d.ts.map +1 -1
- package/dist/src/commands/hive-mind.js +37 -14
- package/dist/src/commands/hive-mind.js.map +1 -1
- package/dist/src/commands/hooks.d.ts.map +1 -1
- package/dist/src/commands/hooks.js +42 -25
- package/dist/src/commands/hooks.js.map +1 -1
- package/dist/src/commands/init.d.ts.map +1 -1
- package/dist/src/commands/init.js +9 -4
- 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 +29 -26
- package/dist/src/commands/issues.js.map +1 -1
- package/dist/src/commands/mcp.d.ts.map +1 -1
- package/dist/src/commands/mcp.js +11 -5
- package/dist/src/commands/mcp.js.map +1 -1
- package/dist/src/commands/memory.d.ts.map +1 -1
- package/dist/src/commands/memory.js +10 -0
- package/dist/src/commands/memory.js.map +1 -1
- package/dist/src/commands/migrate.js +5 -5
- 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 -5
- package/dist/src/commands/monograph.js.map +1 -1
- package/dist/src/commands/monovector/backup.d.ts.map +1 -1
- package/dist/src/commands/monovector/backup.js +8 -2
- package/dist/src/commands/monovector/backup.js.map +1 -1
- package/dist/src/commands/monovector/benchmark.d.ts.map +1 -1
- package/dist/src/commands/monovector/benchmark.js +20 -7
- package/dist/src/commands/monovector/benchmark.js.map +1 -1
- package/dist/src/commands/monovector/import.d.ts.map +1 -1
- package/dist/src/commands/monovector/import.js +15 -0
- package/dist/src/commands/monovector/import.js.map +1 -1
- package/dist/src/commands/monovector/migrate.d.ts.map +1 -1
- package/dist/src/commands/monovector/migrate.js +4 -1
- package/dist/src/commands/monovector/migrate.js.map +1 -1
- package/dist/src/commands/monovector/optimize.d.ts.map +1 -1
- package/dist/src/commands/monovector/optimize.js +11 -0
- package/dist/src/commands/monovector/optimize.js.map +1 -1
- package/dist/src/commands/monovector/setup.d.ts.map +1 -1
- package/dist/src/commands/monovector/setup.js +11 -1
- package/dist/src/commands/monovector/setup.js.map +1 -1
- package/dist/src/commands/neural.js +1 -1
- 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 +20 -7
- package/dist/src/commands/performance.js.map +1 -1
- package/dist/src/commands/platforms.d.ts.map +1 -1
- package/dist/src/commands/platforms.js +90 -8
- package/dist/src/commands/platforms.js.map +1 -1
- package/dist/src/commands/plugins.d.ts.map +1 -1
- package/dist/src/commands/plugins.js +12 -5
- 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 +33 -10
- 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 +5 -3
- package/dist/src/commands/progress.js.map +1 -1
- package/dist/src/commands/providers.js +5 -5
- package/dist/src/commands/providers.js.map +1 -1
- package/dist/src/commands/replay.d.ts.map +1 -1
- package/dist/src/commands/replay.js +8 -2
- package/dist/src/commands/replay.js.map +1 -1
- package/dist/src/commands/route.d.ts.map +1 -1
- package/dist/src/commands/route.js +27 -7
- package/dist/src/commands/route.js.map +1 -1
- package/dist/src/commands/security.d.ts.map +1 -1
- package/dist/src/commands/security.js +4 -0
- package/dist/src/commands/security.js.map +1 -1
- package/dist/src/commands/session.d.ts.map +1 -1
- package/dist/src/commands/session.js +12 -1
- package/dist/src/commands/session.js.map +1 -1
- package/dist/src/commands/start.d.ts.map +1 -1
- package/dist/src/commands/start.js +11 -4
- package/dist/src/commands/start.js.map +1 -1
- package/dist/src/commands/status.d.ts.map +1 -1
- package/dist/src/commands/status.js +7 -4
- 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 +27 -13
- package/dist/src/commands/swarm.js.map +1 -1
- package/dist/src/commands/task.d.ts.map +1 -1
- package/dist/src/commands/task.js +26 -11
- package/dist/src/commands/task.js.map +1 -1
- package/dist/src/commands/tokens.d.ts.map +1 -1
- package/dist/src/commands/tokens.js +7 -2
- package/dist/src/commands/tokens.js.map +1 -1
- package/dist/src/commands/transfer-store.d.ts.map +1 -1
- package/dist/src/commands/transfer-store.js +36 -22
- package/dist/src/commands/transfer-store.js.map +1 -1
- package/dist/src/commands/update.d.ts.map +1 -1
- package/dist/src/commands/update.js +15 -3
- package/dist/src/commands/update.js.map +1 -1
- package/dist/src/commands/workflow.d.ts.map +1 -1
- package/dist/src/commands/workflow.js +39 -6
- package/dist/src/commands/workflow.js.map +1 -1
- package/dist/src/consensus/audit-writer.d.ts.map +1 -1
- package/dist/src/consensus/audit-writer.js +18 -7
- package/dist/src/consensus/audit-writer.js.map +1 -1
- package/dist/src/consensus/vote-signer.d.ts.map +1 -1
- package/dist/src/consensus/vote-signer.js +25 -8
- package/dist/src/consensus/vote-signer.js.map +1 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +7 -3
- package/dist/src/index.js.map +1 -1
- package/dist/src/init/executor.d.ts.map +1 -1
- package/dist/src/init/executor.js +14 -11
- package/dist/src/init/executor.js.map +1 -1
- package/dist/src/init/shared-instructions-generator.d.ts.map +1 -1
- package/dist/src/init/shared-instructions-generator.js +20 -4
- package/dist/src/init/shared-instructions-generator.js.map +1 -1
- package/dist/src/init/statusline-generator.d.ts.map +1 -1
- package/dist/src/init/statusline-generator.js +36 -15
- package/dist/src/init/statusline-generator.js.map +1 -1
- package/dist/src/mcp-tools/a2a-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/a2a-tools.js +98 -13
- package/dist/src/mcp-tools/a2a-tools.js.map +1 -1
- package/dist/src/mcp-tools/agent-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/agent-tools.js +16 -3
- package/dist/src/mcp-tools/agent-tools.js.map +1 -1
- package/dist/src/mcp-tools/analyze-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/analyze-tools.js +80 -17
- package/dist/src/mcp-tools/analyze-tools.js.map +1 -1
- package/dist/src/mcp-tools/browser-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/browser-tools.js +84 -22
- package/dist/src/mcp-tools/browser-tools.js.map +1 -1
- package/dist/src/mcp-tools/claims-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/claims-tools.js +35 -7
- package/dist/src/mcp-tools/claims-tools.js.map +1 -1
- package/dist/src/mcp-tools/config-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/config-tools.js +82 -17
- package/dist/src/mcp-tools/config-tools.js.map +1 -1
- package/dist/src/mcp-tools/coordination-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/coordination-tools.js +37 -4
- package/dist/src/mcp-tools/coordination-tools.js.map +1 -1
- package/dist/src/mcp-tools/daa-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/daa-tools.js +49 -7
- package/dist/src/mcp-tools/daa-tools.js.map +1 -1
- package/dist/src/mcp-tools/embeddings-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/embeddings-tools.js +45 -18
- package/dist/src/mcp-tools/embeddings-tools.js.map +1 -1
- package/dist/src/mcp-tools/github-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/github-tools.js +75 -25
- package/dist/src/mcp-tools/github-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 +32 -10
- package/dist/src/mcp-tools/guidance-tools.js.map +1 -1
- package/dist/src/mcp-tools/hive-mind-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/hive-mind-tools.js +91 -20
- 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 +188 -29
- package/dist/src/mcp-tools/hooks-tools.js.map +1 -1
- package/dist/src/mcp-tools/memory-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/memory-tools.js +25 -7
- package/dist/src/mcp-tools/memory-tools.js.map +1 -1
- package/dist/src/mcp-tools/monograph-compat.d.ts.map +1 -1
- package/dist/src/mcp-tools/monograph-compat.js +11 -2
- package/dist/src/mcp-tools/monograph-compat.js.map +1 -1
- package/dist/src/mcp-tools/monograph-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/monograph-tools.js +476 -62
- package/dist/src/mcp-tools/monograph-tools.js.map +1 -1
- package/dist/src/mcp-tools/neural-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/neural-tools.js +44 -9
- package/dist/src/mcp-tools/neural-tools.js.map +1 -1
- package/dist/src/mcp-tools/performance-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/performance-tools.js +45 -10
- package/dist/src/mcp-tools/performance-tools.js.map +1 -1
- package/dist/src/mcp-tools/progress-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/progress-tools.js +7 -4
- package/dist/src/mcp-tools/progress-tools.js.map +1 -1
- package/dist/src/mcp-tools/request-tracker.d.ts.map +1 -1
- package/dist/src/mcp-tools/request-tracker.js +15 -1
- package/dist/src/mcp-tools/request-tracker.js.map +1 -1
- package/dist/src/mcp-tools/security-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/security-tools.js +61 -9
- package/dist/src/mcp-tools/security-tools.js.map +1 -1
- package/dist/src/mcp-tools/session-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/session-tools.js +45 -14
- package/dist/src/mcp-tools/session-tools.js.map +1 -1
- package/dist/src/mcp-tools/swarm-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/swarm-tools.js +15 -3
- package/dist/src/mcp-tools/swarm-tools.js.map +1 -1
- package/dist/src/mcp-tools/system-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/system-tools.js +14 -7
- package/dist/src/mcp-tools/system-tools.js.map +1 -1
- package/dist/src/mcp-tools/task-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/task-tools.js +52 -10
- package/dist/src/mcp-tools/task-tools.js.map +1 -1
- package/dist/src/mcp-tools/terminal-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/terminal-tools.js +40 -6
- package/dist/src/mcp-tools/terminal-tools.js.map +1 -1
- package/dist/src/mcp-tools/transfer-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/transfer-tools.js +37 -4
- package/dist/src/mcp-tools/transfer-tools.js.map +1 -1
- package/dist/src/mcp-tools/workflow-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/workflow-tools.js +29 -6
- package/dist/src/mcp-tools/workflow-tools.js.map +1 -1
- package/dist/src/memory/ewc-consolidation.d.ts.map +1 -1
- package/dist/src/memory/ewc-consolidation.js +26 -10
- package/dist/src/memory/ewc-consolidation.js.map +1 -1
- package/dist/src/memory/intelligence.d.ts.map +1 -1
- package/dist/src/memory/intelligence.js +80 -19
- package/dist/src/memory/intelligence.js.map +1 -1
- package/dist/src/memory/memory-bridge.d.ts.map +1 -1
- package/dist/src/memory/memory-bridge.js +21 -2
- package/dist/src/memory/memory-bridge.js.map +1 -1
- package/dist/src/memory/memory-initializer.d.ts.map +1 -1
- package/dist/src/memory/memory-initializer.js +67 -3
- package/dist/src/memory/memory-initializer.js.map +1 -1
- package/dist/src/memory/sona-optimizer.d.ts.map +1 -1
- package/dist/src/memory/sona-optimizer.js +14 -4
- package/dist/src/memory/sona-optimizer.js.map +1 -1
- package/dist/src/monovector/command-outcomes.d.ts.map +1 -1
- package/dist/src/monovector/command-outcomes.js +43 -7
- package/dist/src/monovector/command-outcomes.js.map +1 -1
- package/dist/src/monovector/coverage-router.d.ts.map +1 -1
- package/dist/src/monovector/coverage-router.js +8 -4
- package/dist/src/monovector/coverage-router.js.map +1 -1
- package/dist/src/monovector/coverage-tools.d.ts.map +1 -1
- package/dist/src/monovector/coverage-tools.js +6 -3
- package/dist/src/monovector/coverage-tools.js.map +1 -1
- package/dist/src/monovector/diff-classifier.d.ts.map +1 -1
- package/dist/src/monovector/diff-classifier.js +13 -0
- package/dist/src/monovector/diff-classifier.js.map +1 -1
- package/dist/src/monovector/route-outcomes.d.ts +2 -1
- package/dist/src/monovector/route-outcomes.d.ts.map +1 -1
- package/dist/src/monovector/route-outcomes.js +46 -4
- package/dist/src/monovector/route-outcomes.js.map +1 -1
- package/dist/src/plugins/manager.d.ts.map +1 -1
- package/dist/src/plugins/manager.js +8 -3
- package/dist/src/plugins/manager.js.map +1 -1
- package/dist/src/plugins/store/discovery.d.ts.map +1 -1
- package/dist/src/plugins/store/discovery.js +46 -2
- package/dist/src/plugins/store/discovery.js.map +1 -1
- package/dist/src/plugins/store/search.d.ts.map +1 -1
- package/dist/src/plugins/store/search.js +5 -4
- package/dist/src/plugins/store/search.js.map +1 -1
- package/dist/src/production/circuit-breaker.d.ts.map +1 -1
- package/dist/src/production/circuit-breaker.js +17 -3
- package/dist/src/production/circuit-breaker.js.map +1 -1
- package/dist/src/production/error-handler.d.ts.map +1 -1
- package/dist/src/production/error-handler.js +3 -0
- package/dist/src/production/error-handler.js.map +1 -1
- package/dist/src/production/monitoring.d.ts.map +1 -1
- package/dist/src/production/monitoring.js +20 -3
- package/dist/src/production/monitoring.js.map +1 -1
- package/dist/src/production/rate-limiter.d.ts.map +1 -1
- package/dist/src/production/rate-limiter.js +13 -4
- 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 +17 -9
- package/dist/src/production/retry.js.map +1 -1
- package/dist/src/routing/embed-worker.js +6 -2
- package/dist/src/routing/embed-worker.js.map +1 -1
- package/dist/src/routing/embedder.d.ts.map +1 -1
- package/dist/src/routing/embedder.js +0 -0
- package/dist/src/routing/embedder.js.map +1 -1
- package/dist/src/routing/llm-caller.d.ts.map +1 -1
- package/dist/src/routing/llm-caller.js +13 -2
- package/dist/src/routing/llm-caller.js.map +1 -1
- package/dist/src/routing/route-layer-factory.d.ts.map +1 -1
- package/dist/src/routing/route-layer-factory.js +18 -3
- package/dist/src/routing/route-layer-factory.js.map +1 -1
- package/dist/src/services/claim-service.d.ts +1 -0
- package/dist/src/services/claim-service.d.ts.map +1 -1
- package/dist/src/services/claim-service.js +8 -0
- 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 +14 -2
- package/dist/src/services/config-file-manager.js.map +1 -1
- package/dist/src/services/headless-worker-executor.d.ts.map +1 -1
- package/dist/src/services/headless-worker-executor.js +18 -2
- package/dist/src/services/headless-worker-executor.js.map +1 -1
- package/dist/src/services/worker-daemon.d.ts.map +1 -1
- package/dist/src/services/worker-daemon.js +348 -17
- package/dist/src/services/worker-daemon.js.map +1 -1
- package/dist/src/transfer/anonymization/index.d.ts +0 -3
- package/dist/src/transfer/anonymization/index.d.ts.map +1 -1
- package/dist/src/transfer/anonymization/index.js +16 -1
- package/dist/src/transfer/anonymization/index.js.map +1 -1
- package/dist/src/transfer/export.d.ts.map +1 -1
- package/dist/src/transfer/export.js +8 -0
- package/dist/src/transfer/export.js.map +1 -1
- package/dist/src/transfer/ipfs/upload.d.ts.map +1 -1
- package/dist/src/transfer/ipfs/upload.js +33 -3
- package/dist/src/transfer/ipfs/upload.js.map +1 -1
- package/dist/src/transfer/serialization/cfp.d.ts.map +1 -1
- package/dist/src/transfer/serialization/cfp.js +8 -2
- package/dist/src/transfer/serialization/cfp.js.map +1 -1
- package/dist/src/transfer/storage/gcs.d.ts.map +1 -1
- package/dist/src/transfer/storage/gcs.js +37 -3
- package/dist/src/transfer/storage/gcs.js.map +1 -1
- package/dist/src/transfer/store/discovery.d.ts.map +1 -1
- package/dist/src/transfer/store/discovery.js +45 -3
- package/dist/src/transfer/store/discovery.js.map +1 -1
- package/dist/src/transfer/store/download.d.ts.map +1 -1
- package/dist/src/transfer/store/download.js +5 -0
- package/dist/src/transfer/store/download.js.map +1 -1
- package/dist/src/transfer/store/publish.d.ts.map +1 -1
- package/dist/src/transfer/store/publish.js +13 -1
- package/dist/src/transfer/store/publish.js.map +1 -1
- package/dist/src/transfer/store/registry.d.ts +8 -0
- package/dist/src/transfer/store/registry.d.ts.map +1 -1
- package/dist/src/transfer/store/registry.js +30 -5
- package/dist/src/transfer/store/registry.js.map +1 -1
- package/dist/src/transfer/store/search.d.ts.map +1 -1
- package/dist/src/transfer/store/search.js +20 -5
- package/dist/src/transfer/store/search.js.map +1 -1
- package/dist/src/ui/collector.mjs +39 -5
- package/dist/src/ui/dashboard.html +1603 -1284
- package/dist/src/ui/orgs.html +722 -12
- package/dist/src/ui/server.mjs +717 -136
- package/dist/src/update/checker.d.ts.map +1 -1
- package/dist/src/update/checker.js +59 -7
- package/dist/src/update/checker.js.map +1 -1
- package/dist/src/update/executor.d.ts.map +1 -1
- package/dist/src/update/executor.js +50 -3
- package/dist/src/update/executor.js.map +1 -1
- package/dist/src/update/index.d.ts.map +1 -1
- package/dist/src/update/index.js +18 -1
- package/dist/src/update/index.js.map +1 -1
- package/dist/src/update/rate-limiter.d.ts +6 -0
- package/dist/src/update/rate-limiter.d.ts.map +1 -1
- package/dist/src/update/rate-limiter.js +79 -7
- package/dist/src/update/rate-limiter.js.map +1 -1
- package/dist/src/update/validator.d.ts.map +1 -1
- package/dist/src/update/validator.js +52 -1
- package/dist/src/update/validator.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -3
- package/dist/src/ui/data/mastermind-events.jsonl +0 -59
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* - testgaps: Test coverage analysis (20 min interval)
|
|
11
11
|
*/
|
|
12
12
|
import { EventEmitter } from 'events';
|
|
13
|
-
import { existsSync, mkdirSync, writeFileSync, renameSync, readFileSync, appendFileSync, unlinkSync } from 'fs';
|
|
13
|
+
import { existsSync, mkdirSync, writeFileSync, renameSync, readFileSync, appendFileSync, unlinkSync, statSync } from 'fs';
|
|
14
14
|
import { cpus } from 'os';
|
|
15
15
|
import { join, resolve } from 'path';
|
|
16
16
|
import { HeadlessWorkerExecutor, isHeadlessWorker, } from './headless-worker-executor.js';
|
|
@@ -106,14 +106,15 @@ export class WorkerDaemon extends EventEmitter {
|
|
|
106
106
|
this.headlessAvailable = await this.headlessExecutor.isAvailable();
|
|
107
107
|
if (this.headlessAvailable) {
|
|
108
108
|
this.log('info', 'Claude Code headless mode available - AI workers enabled');
|
|
109
|
-
// Forward headless executor events
|
|
110
|
-
|
|
109
|
+
// Forward headless executor events.
|
|
110
|
+
// The executor emits 'start', 'complete', 'error' (not 'execution:*').
|
|
111
|
+
this.headlessExecutor.on('start', (data) => {
|
|
111
112
|
this.emit('headless:start', data);
|
|
112
113
|
});
|
|
113
|
-
this.headlessExecutor.on('
|
|
114
|
+
this.headlessExecutor.on('complete', (data) => {
|
|
114
115
|
this.emit('headless:complete', data);
|
|
115
116
|
});
|
|
116
|
-
this.headlessExecutor.on('
|
|
117
|
+
this.headlessExecutor.on('error', (data) => {
|
|
117
118
|
this.emit('headless:error', data);
|
|
118
119
|
});
|
|
119
120
|
this.headlessExecutor.on('output', (data) => {
|
|
@@ -189,6 +190,12 @@ export class WorkerDaemon extends EventEmitter {
|
|
|
189
190
|
return {};
|
|
190
191
|
}
|
|
191
192
|
try {
|
|
193
|
+
// Guard against OOM from an oversized config file (tampered or corrupted).
|
|
194
|
+
const configSize = statSync(configPath).size;
|
|
195
|
+
if (configSize > 1_048_576 /* 1 MB */) {
|
|
196
|
+
this.log('warn', `config.json is unusually large (${configSize} bytes) — ignoring daemon config`);
|
|
197
|
+
return {};
|
|
198
|
+
}
|
|
192
199
|
const raw = JSON.parse(readFileSync(configPath, 'utf-8'));
|
|
193
200
|
// Support both flat keys at root and nested under scopes.project
|
|
194
201
|
const cfg = raw?.scopes?.project ?? raw;
|
|
@@ -271,6 +278,12 @@ export class WorkerDaemon extends EventEmitter {
|
|
|
271
278
|
// Try to restore state from file
|
|
272
279
|
if (existsSync(this.config.stateFile)) {
|
|
273
280
|
try {
|
|
281
|
+
// Guard against OOM from an oversized state file (tampered or corrupted).
|
|
282
|
+
const stateSize = statSync(this.config.stateFile).size;
|
|
283
|
+
if (stateSize > 5_242_880 /* 5 MB */) {
|
|
284
|
+
this.log('warn', `daemon-state.json is unusually large (${stateSize} bytes) — starting with fresh state`);
|
|
285
|
+
return;
|
|
286
|
+
}
|
|
274
287
|
const saved = JSON.parse(readFileSync(this.config.stateFile, 'utf-8'));
|
|
275
288
|
// CRITICAL: Restore worker config (including enabled flag) from saved state
|
|
276
289
|
// This fixes #950: daemon enable command not persisting worker state
|
|
@@ -555,6 +568,17 @@ export class WorkerDaemon extends EventEmitter {
|
|
|
555
568
|
const state = this.workers.get(workerConfig.type);
|
|
556
569
|
const workerId = `${workerConfig.type}_${Date.now()}`;
|
|
557
570
|
const startTime = Date.now();
|
|
571
|
+
// Track the headless executionId assigned by HeadlessWorkerExecutor so we
|
|
572
|
+
// can cancel it precisely on timeout. The executor generates its own ID
|
|
573
|
+
// (format: `${type}_${ts}_${random}`) which never matches workerId, so we
|
|
574
|
+
// capture it from the 'start' event instead.
|
|
575
|
+
let headlessExecutionId = null;
|
|
576
|
+
const onHeadlessStart = (data) => {
|
|
577
|
+
headlessExecutionId = data.executionId ?? null;
|
|
578
|
+
};
|
|
579
|
+
if (this.headlessExecutor) {
|
|
580
|
+
this.headlessExecutor.on('start', onHeadlessStart);
|
|
581
|
+
}
|
|
558
582
|
// Track running worker
|
|
559
583
|
this.runningWorkers.add(workerConfig.type);
|
|
560
584
|
state.isRunning = true;
|
|
@@ -566,11 +590,13 @@ export class WorkerDaemon extends EventEmitter {
|
|
|
566
590
|
// cancelAll() was too broad — it would kill concurrent healthy workers.
|
|
567
591
|
const output = await this.runWithTimeout(() => this.runWorkerLogic(workerConfig), this.config.workerTimeoutMs, `Worker ${workerConfig.type} timed out after ${this.config.workerTimeoutMs / 1000}s`, () => {
|
|
568
592
|
if (this.headlessExecutor) {
|
|
569
|
-
//
|
|
570
|
-
//
|
|
571
|
-
|
|
572
|
-
|
|
593
|
+
// Use the exact executionId captured from the 'start' event.
|
|
594
|
+
// Fall back to cancelByType only if we didn't capture an ID yet
|
|
595
|
+
// (e.g. timeout fired before the executor emitted 'start').
|
|
596
|
+
if (headlessExecutionId && this.headlessExecutor.cancel(headlessExecutionId)) {
|
|
597
|
+
return;
|
|
573
598
|
}
|
|
599
|
+
this.headlessExecutor.cancelByType(workerConfig.type);
|
|
574
600
|
}
|
|
575
601
|
});
|
|
576
602
|
const durationMs = Date.now() - startTime;
|
|
@@ -615,6 +641,10 @@ export class WorkerDaemon extends EventEmitter {
|
|
|
615
641
|
finally {
|
|
616
642
|
// Remove from running set and process queue
|
|
617
643
|
this.runningWorkers.delete(workerConfig.type);
|
|
644
|
+
// Unsubscribe the executionId capture listener regardless of outcome
|
|
645
|
+
if (this.headlessExecutor) {
|
|
646
|
+
this.headlessExecutor.off('start', onHeadlessStart);
|
|
647
|
+
}
|
|
618
648
|
this.processPendingWorkers();
|
|
619
649
|
}
|
|
620
650
|
}
|
|
@@ -731,6 +761,59 @@ export class WorkerDaemon extends EventEmitter {
|
|
|
731
761
|
},
|
|
732
762
|
scannedAt: Date.now(),
|
|
733
763
|
};
|
|
764
|
+
// Enrich with monograph graph stats for LLM context injection.
|
|
765
|
+
// Lazy-import to avoid hard dependency; silently skip on any error.
|
|
766
|
+
try {
|
|
767
|
+
const { openDb, closeDb, countNodes, countEdges } = await import('@monoes/monograph');
|
|
768
|
+
const dbPath = join(this.projectRoot, '.monomind', 'monograph.db');
|
|
769
|
+
if (existsSync(dbPath)) {
|
|
770
|
+
const db = openDb(dbPath);
|
|
771
|
+
try {
|
|
772
|
+
// Node/edge counts
|
|
773
|
+
map['graph'] = {
|
|
774
|
+
nodes: countNodes(db),
|
|
775
|
+
edges: countEdges(db),
|
|
776
|
+
};
|
|
777
|
+
// Top 3 god nodes (high degree internal files) — same SQL as monograph_god_nodes tool
|
|
778
|
+
const excluded = ['File', 'Folder', 'Community', 'Concept'];
|
|
779
|
+
const rows = db.prepare(`
|
|
780
|
+
SELECT n.name, n.file_path, n.start_line,
|
|
781
|
+
COUNT(DISTINCT e1.id) + COUNT(DISTINCT e2.id) AS degree
|
|
782
|
+
FROM nodes n
|
|
783
|
+
LEFT JOIN edges e1 ON e1.source_id = n.id
|
|
784
|
+
LEFT JOIN edges e2 ON e2.target_id = n.id
|
|
785
|
+
WHERE n.label NOT IN (${excluded.map(() => '?').join(',')})
|
|
786
|
+
GROUP BY n.id HAVING degree > 0
|
|
787
|
+
ORDER BY degree DESC LIMIT 3
|
|
788
|
+
`).all(...excluded);
|
|
789
|
+
if (rows.length > 0) {
|
|
790
|
+
map['topFiles'] = rows.map(r => ({
|
|
791
|
+
ref: r.file_path
|
|
792
|
+
? (r.start_line != null ? `${r.file_path}:${r.start_line}` : r.file_path)
|
|
793
|
+
: r.name,
|
|
794
|
+
degree: r.degree,
|
|
795
|
+
}));
|
|
796
|
+
}
|
|
797
|
+
// Index staleness via git — same approach as monograph_health tool
|
|
798
|
+
try {
|
|
799
|
+
const { execSync } = await import('child_process');
|
|
800
|
+
const lastHash = db.prepare("SELECT value FROM meta WHERE key = 'last_commit_hash' LIMIT 1").get()?.value;
|
|
801
|
+
if (lastHash) {
|
|
802
|
+
const countOut = execSync(`git -C ${JSON.stringify(this.projectRoot)} rev-list --count ${lastHash}..HEAD`, { timeout: 5000 }).toString().trim();
|
|
803
|
+
const commitsBehind = parseInt(countOut, 10);
|
|
804
|
+
if (!isNaN(commitsBehind)) {
|
|
805
|
+
map['graphStaleness'] = { commitsBehind };
|
|
806
|
+
}
|
|
807
|
+
}
|
|
808
|
+
}
|
|
809
|
+
catch { /* git unavailable — skip staleness */ }
|
|
810
|
+
}
|
|
811
|
+
finally {
|
|
812
|
+
closeDb(db);
|
|
813
|
+
}
|
|
814
|
+
}
|
|
815
|
+
}
|
|
816
|
+
catch { /* monograph unavailable — skip graph enrichment */ }
|
|
734
817
|
const metricsFileTmp1 = metricsFile + '.tmp';
|
|
735
818
|
writeFileSync(metricsFileTmp1, JSON.stringify(map, null, 2));
|
|
736
819
|
renameSync(metricsFileTmp1, metricsFile);
|
|
@@ -752,12 +835,74 @@ export class WorkerDaemon extends EventEmitter {
|
|
|
752
835
|
checks: {
|
|
753
836
|
envFilesProtected: !existsSync(join(this.projectRoot, '.env.local')),
|
|
754
837
|
gitIgnoreExists: existsSync(join(this.projectRoot, '.gitignore')),
|
|
755
|
-
noHardcodedSecrets:
|
|
838
|
+
noHardcodedSecrets: null, // Not checked in local mode — requires AI-powered scan
|
|
756
839
|
},
|
|
757
840
|
riskLevel: 'low',
|
|
758
841
|
recommendations: [],
|
|
759
842
|
note: 'Install Claude Code CLI for AI-powered security analysis',
|
|
760
843
|
};
|
|
844
|
+
// Enrich with monograph high-centrality files and surprising cross-community edges.
|
|
845
|
+
// God-node files are high-value targets for security review: they are imported by
|
|
846
|
+
// many consumers, so a vulnerability there has the largest blast radius.
|
|
847
|
+
// Cross-community edges reveal unexpected coupling that may indicate hidden attack surfaces.
|
|
848
|
+
try {
|
|
849
|
+
const { openDb, closeDb } = await import('@monoes/monograph');
|
|
850
|
+
const dbPath = join(this.projectRoot, '.monomind', 'monograph.db');
|
|
851
|
+
if (existsSync(dbPath)) {
|
|
852
|
+
const db = openDb(dbPath);
|
|
853
|
+
try {
|
|
854
|
+
const godFileRows = db.prepare(`
|
|
855
|
+
SELECT n.file_path,
|
|
856
|
+
COUNT(DISTINCT e1.id) + COUNT(DISTINCT e2.id) AS degree
|
|
857
|
+
FROM nodes n
|
|
858
|
+
LEFT JOIN edges e1 ON e1.source_id = n.id
|
|
859
|
+
LEFT JOIN edges e2 ON e2.target_id = n.id
|
|
860
|
+
WHERE n.label NOT IN ('File','Folder','Community','Concept')
|
|
861
|
+
AND n.file_path IS NOT NULL
|
|
862
|
+
AND n.file_path NOT LIKE '%node_modules%'
|
|
863
|
+
AND n.file_path NOT LIKE '%/dist/%'
|
|
864
|
+
AND n.file_path NOT LIKE '%.test.%'
|
|
865
|
+
AND n.file_path NOT LIKE '%.spec.%'
|
|
866
|
+
GROUP BY n.file_path
|
|
867
|
+
ORDER BY degree DESC
|
|
868
|
+
LIMIT 5
|
|
869
|
+
`).all();
|
|
870
|
+
const surpriseRows = db.prepare(`
|
|
871
|
+
SELECT n1.name as src_name, n2.name as tgt_name, e.relation, e.confidence_score,
|
|
872
|
+
n1.file_path as src_file, n2.file_path as tgt_file
|
|
873
|
+
FROM edges e
|
|
874
|
+
JOIN nodes n1 ON n1.id = e.source_id
|
|
875
|
+
JOIN nodes n2 ON n2.id = e.target_id
|
|
876
|
+
WHERE e.confidence != 'EXTRACTED'
|
|
877
|
+
AND n1.community_id IS NOT NULL
|
|
878
|
+
AND n2.community_id IS NOT NULL
|
|
879
|
+
AND n1.community_id != n2.community_id
|
|
880
|
+
ORDER BY e.confidence_score ASC
|
|
881
|
+
LIMIT 5
|
|
882
|
+
`).all();
|
|
883
|
+
if (godFileRows.length > 0) {
|
|
884
|
+
audit['priorityScanTargets'] = godFileRows.map(r => ({
|
|
885
|
+
file: r.file_path.replace(this.projectRoot + '/', '').replace(this.projectRoot + '\\', ''),
|
|
886
|
+
degree: r.degree,
|
|
887
|
+
reason: 'high-centrality: vulnerability here affects the most consumers',
|
|
888
|
+
}));
|
|
889
|
+
}
|
|
890
|
+
if (surpriseRows.length > 0) {
|
|
891
|
+
audit['unexpectedCoupling'] = surpriseRows.map(r => ({
|
|
892
|
+
edge: `${r.src_name} --${r.relation}--> ${r.tgt_name}`,
|
|
893
|
+
srcFile: r.src_file ?? '(unknown)',
|
|
894
|
+
tgtFile: r.tgt_file ?? '(unknown)',
|
|
895
|
+
confidenceScore: r.confidence_score,
|
|
896
|
+
reason: 'cross-community edge: may indicate hidden dependency or attack surface',
|
|
897
|
+
}));
|
|
898
|
+
}
|
|
899
|
+
}
|
|
900
|
+
finally {
|
|
901
|
+
closeDb(db);
|
|
902
|
+
}
|
|
903
|
+
}
|
|
904
|
+
}
|
|
905
|
+
catch { /* monograph unavailable — skip graph enrichment */ }
|
|
761
906
|
const auditFileTmp = auditFile + '.tmp';
|
|
762
907
|
writeFileSync(auditFileTmp, JSON.stringify(audit, null, 2));
|
|
763
908
|
renameSync(auditFileTmp, auditFile);
|
|
@@ -779,8 +924,8 @@ export class WorkerDaemon extends EventEmitter {
|
|
|
779
924
|
memoryUsage: process.memoryUsage(),
|
|
780
925
|
uptime: process.uptime(),
|
|
781
926
|
optimizations: {
|
|
782
|
-
cacheHitRate:
|
|
783
|
-
avgResponseTime:
|
|
927
|
+
cacheHitRate: null, // Not measured in local mode — requires AI-powered analysis
|
|
928
|
+
avgResponseTime: null, // Not measured in local mode — requires AI-powered analysis
|
|
784
929
|
},
|
|
785
930
|
note: 'Install Claude Code CLI for AI-powered optimization suggestions',
|
|
786
931
|
};
|
|
@@ -897,13 +1042,95 @@ export class WorkerDaemon extends EventEmitter {
|
|
|
897
1042
|
* Local ultralearn worker (fallback when headless unavailable)
|
|
898
1043
|
*/
|
|
899
1044
|
async runUltralearnWorkerLocal() {
|
|
900
|
-
|
|
1045
|
+
const result = {
|
|
901
1046
|
timestamp: new Date().toISOString(),
|
|
902
1047
|
mode: 'local',
|
|
903
1048
|
patternsLearned: 0,
|
|
904
1049
|
insightsGained: [],
|
|
905
|
-
note: 'Install Claude Code CLI for AI-powered deep learning',
|
|
906
1050
|
};
|
|
1051
|
+
// Enrich with monograph community clusters and bridge-node patterns for LLM context injection.
|
|
1052
|
+
// Bridge nodes (symbols that cross community boundaries) are architecturally significant —
|
|
1053
|
+
// they represent coupling points an LLM should be aware of when reasoning about change impact.
|
|
1054
|
+
try {
|
|
1055
|
+
const { openDb, closeDb, countNodes, countEdges } = await import('@monoes/monograph');
|
|
1056
|
+
const dbPath = join(this.projectRoot, '.monomind', 'monograph.db');
|
|
1057
|
+
if (existsSync(dbPath)) {
|
|
1058
|
+
const db = openDb(dbPath);
|
|
1059
|
+
try {
|
|
1060
|
+
const nodeCount = countNodes(db);
|
|
1061
|
+
const edgeCount = countEdges(db);
|
|
1062
|
+
const communityRows = db.prepare(`
|
|
1063
|
+
SELECT community_id, COUNT(*) AS member_count
|
|
1064
|
+
FROM nodes
|
|
1065
|
+
WHERE community_id IS NOT NULL
|
|
1066
|
+
AND label NOT IN ('File','Folder','Community','Concept')
|
|
1067
|
+
GROUP BY community_id
|
|
1068
|
+
ORDER BY member_count DESC
|
|
1069
|
+
LIMIT 5
|
|
1070
|
+
`).all();
|
|
1071
|
+
const bridgeRows = db.prepare(`
|
|
1072
|
+
SELECT n.name, n.label, n.file_path, n.start_line,
|
|
1073
|
+
COUNT(DISTINCT e.id) AS cross_edges
|
|
1074
|
+
FROM nodes n
|
|
1075
|
+
JOIN edges e ON (e.source_id = n.id OR e.target_id = n.id)
|
|
1076
|
+
JOIN nodes n2 ON (
|
|
1077
|
+
CASE WHEN e.source_id = n.id THEN e.target_id ELSE e.source_id END = n2.id
|
|
1078
|
+
)
|
|
1079
|
+
WHERE n.community_id IS NOT NULL
|
|
1080
|
+
AND n2.community_id IS NOT NULL
|
|
1081
|
+
AND n.community_id != n2.community_id
|
|
1082
|
+
AND n.label NOT IN ('File','Folder','Community','Concept')
|
|
1083
|
+
AND (n.file_path IS NULL OR (
|
|
1084
|
+
n.file_path NOT LIKE '%node_modules%'
|
|
1085
|
+
AND n.file_path NOT LIKE '%/dist/%'
|
|
1086
|
+
AND n.file_path NOT LIKE '%.test.%'
|
|
1087
|
+
AND n.file_path NOT LIKE '%.spec.%'
|
|
1088
|
+
))
|
|
1089
|
+
GROUP BY n.id
|
|
1090
|
+
ORDER BY cross_edges DESC
|
|
1091
|
+
LIMIT 5
|
|
1092
|
+
`).all();
|
|
1093
|
+
const insights = result['insightsGained'];
|
|
1094
|
+
if (communityRows.length > 0) {
|
|
1095
|
+
insights.push({
|
|
1096
|
+
category: 'community_clusters',
|
|
1097
|
+
description: `Top ${communityRows.length} community clusters by size`,
|
|
1098
|
+
items: communityRows.map(r => ({
|
|
1099
|
+
communityId: r.community_id,
|
|
1100
|
+
memberCount: r.member_count,
|
|
1101
|
+
})),
|
|
1102
|
+
});
|
|
1103
|
+
}
|
|
1104
|
+
if (bridgeRows.length > 0) {
|
|
1105
|
+
insights.push({
|
|
1106
|
+
category: 'bridge_nodes',
|
|
1107
|
+
description: `Top ${bridgeRows.length} bridge nodes crossing community boundaries (high coupling risk)`,
|
|
1108
|
+
items: bridgeRows.map(r => {
|
|
1109
|
+
const loc = r.file_path
|
|
1110
|
+
? (r.start_line != null ? `${r.file_path}:${r.start_line}` : r.file_path)
|
|
1111
|
+
: '(unknown)';
|
|
1112
|
+
return {
|
|
1113
|
+
name: r.name,
|
|
1114
|
+
label: r.label,
|
|
1115
|
+
location: loc,
|
|
1116
|
+
crossCommunityEdges: r.cross_edges,
|
|
1117
|
+
};
|
|
1118
|
+
}),
|
|
1119
|
+
});
|
|
1120
|
+
result['patternsLearned'] = bridgeRows.length + communityRows.length;
|
|
1121
|
+
}
|
|
1122
|
+
result['graph'] = { nodes: nodeCount, edges: edgeCount };
|
|
1123
|
+
}
|
|
1124
|
+
finally {
|
|
1125
|
+
closeDb(db);
|
|
1126
|
+
}
|
|
1127
|
+
}
|
|
1128
|
+
else {
|
|
1129
|
+
result['note'] = 'Monograph index not built — run `monomind monograph build` for deep learning';
|
|
1130
|
+
}
|
|
1131
|
+
}
|
|
1132
|
+
catch { /* monograph unavailable — return minimal result */ }
|
|
1133
|
+
return result;
|
|
907
1134
|
}
|
|
908
1135
|
/**
|
|
909
1136
|
* Local refactor worker (fallback when headless unavailable)
|
|
@@ -921,13 +1148,106 @@ export class WorkerDaemon extends EventEmitter {
|
|
|
921
1148
|
* Local deepdive worker (fallback when headless unavailable)
|
|
922
1149
|
*/
|
|
923
1150
|
async runDeepdiveWorkerLocal() {
|
|
924
|
-
|
|
1151
|
+
const deepdiveFile = join(this.projectRoot, '.monomind', 'metrics', 'deepdive.json');
|
|
1152
|
+
const metricsDir = join(this.projectRoot, '.monomind', 'metrics');
|
|
1153
|
+
if (!existsSync(metricsDir)) {
|
|
1154
|
+
mkdirSync(metricsDir, { recursive: true });
|
|
1155
|
+
}
|
|
1156
|
+
const result = {
|
|
925
1157
|
timestamp: new Date().toISOString(),
|
|
926
1158
|
mode: 'local',
|
|
927
|
-
analysisDepth: '
|
|
1159
|
+
analysisDepth: 'graph',
|
|
928
1160
|
findings: [],
|
|
929
|
-
note: 'Install Claude Code CLI for AI-powered deep code analysis',
|
|
930
1161
|
};
|
|
1162
|
+
// Enrich with monograph god nodes and high-degree file analysis for LLM context injection.
|
|
1163
|
+
// Lazy-import to avoid hard dependency; silently skip on any error.
|
|
1164
|
+
try {
|
|
1165
|
+
const { openDb, closeDb, countNodes, countEdges } = await import('@monoes/monograph');
|
|
1166
|
+
const dbPath = join(this.projectRoot, '.monomind', 'monograph.db');
|
|
1167
|
+
if (existsSync(dbPath)) {
|
|
1168
|
+
const db = openDb(dbPath);
|
|
1169
|
+
try {
|
|
1170
|
+
const nodeCount = countNodes(db);
|
|
1171
|
+
const edgeCount = countEdges(db);
|
|
1172
|
+
const godNodeRows = db.prepare(`
|
|
1173
|
+
SELECT n.name, n.file_path, n.label,
|
|
1174
|
+
COUNT(DISTINCT e1.id) + COUNT(DISTINCT e2.id) AS degree
|
|
1175
|
+
FROM nodes n
|
|
1176
|
+
LEFT JOIN edges e1 ON e1.source_id = n.id
|
|
1177
|
+
LEFT JOIN edges e2 ON e2.target_id = n.id
|
|
1178
|
+
WHERE n.label NOT IN ('File','Folder','Community','Concept')
|
|
1179
|
+
AND (n.file_path IS NULL OR (
|
|
1180
|
+
n.file_path NOT LIKE '%node_modules%'
|
|
1181
|
+
AND n.file_path NOT LIKE '%/dist/%'
|
|
1182
|
+
AND n.file_path NOT LIKE '%.test.%'
|
|
1183
|
+
AND n.file_path NOT LIKE '%.spec.%'
|
|
1184
|
+
))
|
|
1185
|
+
GROUP BY n.id
|
|
1186
|
+
ORDER BY degree DESC
|
|
1187
|
+
LIMIT 5
|
|
1188
|
+
`).all();
|
|
1189
|
+
const godNodes = godNodeRows.map(r => ({
|
|
1190
|
+
name: r.name,
|
|
1191
|
+
label: r.label,
|
|
1192
|
+
file: r.file_path ?? '(unknown)',
|
|
1193
|
+
degree: r.degree,
|
|
1194
|
+
}));
|
|
1195
|
+
const fileRows = db.prepare(`
|
|
1196
|
+
SELECT n.file_path,
|
|
1197
|
+
COUNT(DISTINCT e2.id) AS in_deg,
|
|
1198
|
+
COUNT(DISTINCT e1.id) AS out_deg
|
|
1199
|
+
FROM nodes n
|
|
1200
|
+
LEFT JOIN edges e1 ON e1.source_id = n.id
|
|
1201
|
+
LEFT JOIN edges e2 ON e2.target_id = n.id
|
|
1202
|
+
WHERE n.label = 'File'
|
|
1203
|
+
AND n.file_path NOT LIKE '%node_modules%'
|
|
1204
|
+
AND n.file_path NOT LIKE '%/dist/%'
|
|
1205
|
+
AND n.file_path NOT LIKE '%.test.%'
|
|
1206
|
+
AND n.file_path NOT LIKE '%.spec.%'
|
|
1207
|
+
GROUP BY n.id
|
|
1208
|
+
ORDER BY (in_deg + out_deg) DESC
|
|
1209
|
+
LIMIT 5
|
|
1210
|
+
`).all();
|
|
1211
|
+
const highDegFiles = fileRows.map(r => ({
|
|
1212
|
+
file: r.file_path
|
|
1213
|
+
.replace(this.projectRoot + '/', '')
|
|
1214
|
+
.replace(this.projectRoot + '\\', ''),
|
|
1215
|
+
inDegree: r.in_deg,
|
|
1216
|
+
outDegree: r.out_deg,
|
|
1217
|
+
totalDegree: r.in_deg + r.out_deg,
|
|
1218
|
+
}));
|
|
1219
|
+
const findings = [];
|
|
1220
|
+
if (godNodes.length > 0) {
|
|
1221
|
+
findings.push({
|
|
1222
|
+
category: 'god_nodes',
|
|
1223
|
+
description: `Top ${godNodes.length} high-centrality symbols (most imported/referenced)`,
|
|
1224
|
+
items: godNodes,
|
|
1225
|
+
});
|
|
1226
|
+
}
|
|
1227
|
+
if (highDegFiles.length > 0) {
|
|
1228
|
+
findings.push({
|
|
1229
|
+
category: 'high_degree_files',
|
|
1230
|
+
description: `Top ${highDegFiles.length} files by total edge degree (import + export connections)`,
|
|
1231
|
+
items: highDegFiles,
|
|
1232
|
+
});
|
|
1233
|
+
}
|
|
1234
|
+
result['graph'] = { nodes: nodeCount, edges: edgeCount };
|
|
1235
|
+
result['findings'] = findings;
|
|
1236
|
+
result['analysisDepth'] = 'graph';
|
|
1237
|
+
}
|
|
1238
|
+
finally {
|
|
1239
|
+
closeDb(db);
|
|
1240
|
+
}
|
|
1241
|
+
}
|
|
1242
|
+
else {
|
|
1243
|
+
result['note'] = 'Monograph index not built — run `monomind monograph build` for deep analysis';
|
|
1244
|
+
}
|
|
1245
|
+
}
|
|
1246
|
+
catch { /* monograph unavailable — return minimal result */ }
|
|
1247
|
+
const deepdiveFileTmp = deepdiveFile + '.tmp';
|
|
1248
|
+
writeFileSync(deepdiveFileTmp, JSON.stringify(result, null, 2));
|
|
1249
|
+
renameSync(deepdiveFileTmp, deepdiveFile);
|
|
1250
|
+
return result;
|
|
931
1251
|
}
|
|
932
1252
|
/**
|
|
933
1253
|
* Local benchmark worker
|
|
@@ -1042,6 +1362,17 @@ export class WorkerDaemon extends EventEmitter {
|
|
|
1042
1362
|
try {
|
|
1043
1363
|
const logFile = join(this.config.logDir, 'daemon.log');
|
|
1044
1364
|
appendFileSync(logFile, logMessage + '\n');
|
|
1365
|
+
// Opportunistic rotation: keep the log under 10 MB. When exceeded,
|
|
1366
|
+
// discard the oldest half so recent entries are always retained.
|
|
1367
|
+
const MAX_LOG_BYTES = 10 * 1024 * 1024;
|
|
1368
|
+
if (statSync(logFile).size > MAX_LOG_BYTES) {
|
|
1369
|
+
const content = readFileSync(logFile, 'utf-8');
|
|
1370
|
+
const lines = content.split('\n').filter(Boolean);
|
|
1371
|
+
const trimmed = lines.slice(Math.floor(lines.length / 2)).join('\n') + '\n';
|
|
1372
|
+
const tmp = `${logFile}.${process.pid}.${Date.now()}.tmp`;
|
|
1373
|
+
writeFileSync(tmp, trimmed);
|
|
1374
|
+
renameSync(tmp, logFile);
|
|
1375
|
+
}
|
|
1045
1376
|
}
|
|
1046
1377
|
catch {
|
|
1047
1378
|
// Ignore log write errors
|