@monoes/monomindcli 2.9.22 → 2.9.24
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/consensus/quorum-manager.md +35 -54
- package/.claude/agents/core/coordinator.md +14 -18
- package/.claude/agents/core/researcher.md +1 -1
- package/.claude/agents/github/issue-tracker.md +3 -3
- package/.claude/agents/github/{code-review-swarm.md → monoswarm-code-review.md} +1 -1
- package/.claude/agents/github/{swarm-issue.md → monoswarm-issue.md} +1 -1
- package/.claude/agents/github/{multi-repo-swarm.md → monoswarm-multi-repo.md} +1 -1
- package/.claude/agents/github/{swarm-pr.md → monoswarm-pr.md} +1 -1
- package/.claude/agents/github/pr-manager.md +1 -1
- package/.claude/agents/github/release-manager.md +1 -1
- package/.claude/agents/github/repo-architect.md +1 -1
- package/.claude/agents/github/sync-coordinator.md +4 -4
- package/.claude/agents/{hive-mind → monoswarm}/collective-intelligence-coordinator.md +9 -16
- package/.claude/agents/{swarm → monoswarm}/mesh-coordinator.md +19 -24
- package/.claude/agents/{hive-mind/swarm-memory-manager.md → monoswarm/monoswarm-memory-manager.md} +1 -1
- package/.claude/agents/templates/{coordinator-swarm-init.md → coordinator-monoswarm-init.md} +1 -1
- package/.claude/agents/testing/{tdd-london-swarm.md → tdd-london-monoswarm.md} +2 -2
- package/.claude/commands/agents/agent-coordination.md +3 -3
- package/.claude/commands/agents/agent-types.md +1 -1
- package/.claude/commands/automation/self-healing.md +1 -1
- package/.claude/commands/automation/smart-spawn.md +1 -1
- package/.claude/commands/coordination/README.md +1 -1
- package/.claude/commands/coordination/{swarm-init.md → monoswarm-init.md} +2 -2
- package/.claude/commands/coordination/task-orchestrate.md +4 -4
- package/.claude/commands/github/README.md +1 -1
- package/.claude/commands/github/issue-tracker.md +2 -2
- package/.claude/commands/github/pr-manager.md +1 -1
- package/.claude/commands/github/release-manager.md +1 -1
- package/.claude/commands/github/repo-architect.md +1 -1
- package/.claude/commands/github/sync-coordinator.md +2 -2
- package/.claude/commands/hooks/README.md +1 -2
- package/.claude/commands/hooks/overview.md +1 -2
- package/.claude/commands/hooks/setup.md +0 -3
- package/.claude/commands/mastermind/createtask.md +2 -2
- package/.claude/commands/mastermind/do.md +3 -3
- package/.claude/commands/mastermind/help.md +2 -2
- package/.claude/commands/mastermind/ideate.md +1 -1
- package/.claude/commands/mastermind/improve.md +1 -1
- package/.claude/commands/mastermind/memory.md +2 -2
- package/.claude/commands/mastermind/{swarm.md → monoswarm.md} +13 -26
- package/.claude/commands/mastermind/topology.md +1 -1
- package/.claude/commands/memory/README.md +2 -2
- package/.claude/commands/memory/memory-search.md +1 -1
- package/.claude/commands/monoswarm/README.md +59 -0
- package/.claude/commands/monoswarm/consensus.md +61 -0
- package/.claude/commands/monoswarm/init.md +68 -0
- package/.claude/commands/monoswarm/memory.md +55 -0
- package/.claude/commands/monoswarm/monoswarm.md +139 -0
- package/.claude/commands/{swarm → monoswarm}/research.md +2 -2
- package/.claude/commands/monoswarm/spawn.md +49 -0
- package/.claude/commands/monoswarm/status.md +48 -0
- package/.claude/commands/monoswarm/stop.md +46 -0
- package/.claude/commands/optimization/auto-topology.md +9 -9
- package/.claude/commands/stream-chain/run.md +1 -1
- package/.claude/commands/workflows/development.md +1 -1
- package/.claude/commands/workflows/research.md +2 -2
- package/.claude/helpers/audit-log-writer.cjs +72 -0
- package/.claude/helpers/control-start.cjs +84 -26
- package/.claude/helpers/handlers/agent-start-handler.cjs +5 -5
- package/.claude/helpers/handlers/gates-handler.cjs +31 -10
- package/.claude/helpers/handlers/session-restore-handler.cjs +1 -1
- package/.claude/helpers/handlers/task-handler.cjs +4 -4
- package/.claude/helpers/skill-registry.json +4718 -3669
- package/.claude/helpers/statusline.cjs +21 -21
- package/.claude/helpers/token-tracker.cjs +0 -6
- package/.claude/settings.json +2 -3
- package/.claude/skills/hooks-automation/SKILL.md +5 -5
- package/.claude/skills/mastermind-protocol/SKILL.md +3 -3
- package/.claude/skills/memory-toolkit/SKILL.md +2 -2
- package/.claude/skills/{swarm-orchestration → monoswarm}/SKILL.md +106 -42
- package/.claude/skills/specialagent/SKILL.md +1 -1
- package/README.md +31 -12
- package/dist/src/agents/registry-builder.d.ts.map +1 -1
- package/dist/src/agents/registry-builder.js +8 -9
- package/dist/src/agents/registry-builder.js.map +1 -1
- package/dist/src/autopilot-state.d.ts +0 -16
- package/dist/src/autopilot-state.d.ts.map +1 -1
- package/dist/src/autopilot-state.js +6 -21
- package/dist/src/autopilot-state.js.map +1 -1
- package/dist/src/browser/action-builder/analyzer.d.ts.map +1 -1
- package/dist/src/browser/action-builder/analyzer.js +6 -6
- package/dist/src/browser/action-builder/analyzer.js.map +1 -1
- package/dist/src/browser/action-builder/types.d.ts.map +1 -1
- package/dist/src/browser/adapters/gemini.d.ts.map +1 -1
- package/dist/src/browser/adapters/index.d.ts.map +1 -1
- package/dist/src/browser/adapters/index.js +2 -2
- package/dist/src/browser/adapters/index.js.map +1 -1
- package/dist/src/browser/adapters/instagram.d.ts.map +1 -1
- package/dist/src/browser/adapters/linkedin.d.ts.map +1 -1
- package/dist/src/browser/adapters/linkedin.js +9 -1
- package/dist/src/browser/adapters/linkedin.js.map +1 -1
- package/dist/src/browser/adapters/x.d.ts.map +1 -1
- package/dist/src/browser/adapters/x.js +14 -2
- package/dist/src/browser/adapters/x.js.map +1 -1
- package/dist/src/browser/dashboard/server.d.ts.map +1 -1
- package/dist/src/browser/dashboard/server.js +23 -13
- package/dist/src/browser/dashboard/server.js.map +1 -1
- package/dist/src/browser/dashboard/ui.html +5 -5
- package/dist/src/browser/workflow/engine.d.ts +1 -1
- package/dist/src/browser/workflow/engine.d.ts.map +1 -1
- package/dist/src/browser/workflow/engine.js +74 -25
- package/dist/src/browser/workflow/engine.js.map +1 -1
- package/dist/src/browser/workflow/store.d.ts +1 -1
- package/dist/src/browser/workflow/store.d.ts.map +1 -1
- package/dist/src/browser/workflow/store.js +54 -26
- package/dist/src/browser/workflow/store.js.map +1 -1
- package/dist/src/browser/workflow/types.d.ts.map +1 -1
- package/dist/src/capabilities/cap-code.d.ts.map +1 -1
- package/dist/src/capabilities/cap-code.js.map +1 -1
- package/dist/src/capabilities/cap-data.d.ts.map +1 -1
- package/dist/src/capabilities/cap-data.js +28 -8
- package/dist/src/capabilities/cap-data.js.map +1 -1
- package/dist/src/capabilities/cap-documents.d.ts.map +1 -1
- package/dist/src/capabilities/cap-documents.js +136 -54
- package/dist/src/capabilities/cap-documents.js.map +1 -1
- package/dist/src/capabilities/cap-graph.d.ts.map +1 -1
- package/dist/src/capabilities/cap-graph.js +3 -3
- package/dist/src/capabilities/cap-graph.js.map +1 -1
- package/dist/src/capabilities/cap-media.d.ts.map +1 -1
- package/dist/src/capabilities/cap-media.js +1 -1
- package/dist/src/capabilities/cap-media.js.map +1 -1
- package/dist/src/capabilities/cap-timeline.d.ts.map +1 -1
- package/dist/src/capabilities/cap-timeline.js +33 -7
- package/dist/src/capabilities/cap-timeline.js.map +1 -1
- package/dist/src/capabilities/index.d.ts +5 -5
- package/dist/src/capabilities/index.d.ts.map +1 -1
- package/dist/src/capabilities/index.js +5 -5
- package/dist/src/capabilities/index.js.map +1 -1
- package/dist/src/capabilities/manager.d.ts.map +1 -1
- package/dist/src/capabilities/manager.js +6 -6
- package/dist/src/capabilities/manager.js.map +1 -1
- package/dist/src/capabilities/scanner.d.ts.map +1 -1
- package/dist/src/capabilities/scanner.js +103 -14
- package/dist/src/capabilities/scanner.js.map +1 -1
- package/dist/src/commands/agent-lifecycle.d.ts.map +1 -1
- package/dist/src/commands/agent-lifecycle.js +120 -41
- package/dist/src/commands/agent-lifecycle.js.map +1 -1
- package/dist/src/commands/agent-ops.d.ts.map +1 -1
- package/dist/src/commands/agent-ops.js +107 -41
- package/dist/src/commands/agent-ops.js.map +1 -1
- package/dist/src/commands/agent.d.ts.map +1 -1
- package/dist/src/commands/agent.js +11 -3
- package/dist/src/commands/agent.js.map +1 -1
- package/dist/src/commands/analyze-ast.d.ts +1 -1
- package/dist/src/commands/analyze-ast.d.ts.map +1 -1
- package/dist/src/commands/analyze-ast.js +47 -41
- package/dist/src/commands/analyze-ast.js.map +1 -1
- package/dist/src/commands/analyze-diff.d.ts.map +1 -1
- package/dist/src/commands/analyze-diff.js +147 -35
- package/dist/src/commands/analyze-diff.js.map +1 -1
- package/dist/src/commands/analyze-imports.d.ts.map +1 -1
- package/dist/src/commands/analyze-imports.js +74 -30
- package/dist/src/commands/analyze-imports.js.map +1 -1
- package/dist/src/commands/analyze-symbols.d.ts.map +1 -1
- package/dist/src/commands/analyze-symbols.js +55 -41
- package/dist/src/commands/analyze-symbols.js.map +1 -1
- package/dist/src/commands/analyze.d.ts +19 -6
- package/dist/src/commands/analyze.d.ts.map +1 -1
- package/dist/src/commands/analyze.js +90 -28
- 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 +5 -90
- package/dist/src/commands/autopilot.js.map +1 -1
- package/dist/src/commands/browse-action.d.ts.map +1 -1
- package/dist/src/commands/browse-action.js +65 -17
- package/dist/src/commands/browse-action.js.map +1 -1
- package/dist/src/commands/browse-platform.d.ts.map +1 -1
- package/dist/src/commands/browse-platform.js +13 -10
- package/dist/src/commands/browse-platform.js.map +1 -1
- package/dist/src/commands/browse-workflow.d.ts.map +1 -1
- package/dist/src/commands/browse-workflow.js +54 -20
- package/dist/src/commands/browse-workflow.js.map +1 -1
- package/dist/src/commands/browse.d.ts +1 -1
- package/dist/src/commands/browse.js +2 -2
- package/dist/src/commands/browse.js.map +1 -1
- package/dist/src/commands/cleanup.d.ts.map +1 -1
- package/dist/src/commands/cleanup.js +115 -49
- package/dist/src/commands/cleanup.js.map +1 -1
- package/dist/src/commands/completions.d.ts.map +1 -1
- package/dist/src/commands/completions.js +34 -21
- package/dist/src/commands/completions.js.map +1 -1
- package/dist/src/commands/config.d.ts.map +1 -1
- package/dist/src/commands/config.js +95 -54
- package/dist/src/commands/config.js.map +1 -1
- package/dist/src/commands/crash-reporting.d.ts.map +1 -1
- package/dist/src/commands/crash-reporting.js +10 -4
- package/dist/src/commands/crash-reporting.js.map +1 -1
- package/dist/src/commands/design-detect.d.ts.map +1 -1
- package/dist/src/commands/design-detect.js +33 -12
- package/dist/src/commands/design-detect.js.map +1 -1
- package/dist/src/commands/design-palette.d.ts.map +1 -1
- package/dist/src/commands/design-palette.js +770 -380
- package/dist/src/commands/design-palette.js.map +1 -1
- package/dist/src/commands/doc.d.ts.map +1 -1
- package/dist/src/commands/doc.js +272 -60
- package/dist/src/commands/doc.js.map +1 -1
- package/dist/src/commands/doctor-env-checks.d.ts.map +1 -1
- package/dist/src/commands/doctor-env-checks.js +130 -31
- package/dist/src/commands/doctor-env-checks.js.map +1 -1
- package/dist/src/commands/doctor-monoes-checks.d.ts.map +1 -1
- package/dist/src/commands/doctor-monoes-checks.js +20 -7
- package/dist/src/commands/doctor-monoes-checks.js.map +1 -1
- package/dist/src/commands/doctor-project-checks.d.ts +7 -0
- package/dist/src/commands/doctor-project-checks.d.ts.map +1 -1
- package/dist/src/commands/doctor-project-checks.js +476 -114
- package/dist/src/commands/doctor-project-checks.js.map +1 -1
- package/dist/src/commands/doctor.d.ts.map +1 -1
- package/dist/src/commands/doctor.js +139 -60
- package/dist/src/commands/doctor.js.map +1 -1
- package/dist/src/commands/download-embeddings.d.ts.map +1 -1
- package/dist/src/commands/download-embeddings.js +1 -1
- package/dist/src/commands/download-embeddings.js.map +1 -1
- package/dist/src/commands/events.d.ts.map +1 -1
- package/dist/src/commands/events.js +5 -2
- package/dist/src/commands/events.js.map +1 -1
- package/dist/src/commands/guidance.d.ts.map +1 -1
- package/dist/src/commands/guidance.js +38 -14
- package/dist/src/commands/guidance.js.map +1 -1
- package/dist/src/commands/hooks-core-commands.d.ts.map +1 -1
- package/dist/src/commands/hooks-core-commands.js +71 -44
- package/dist/src/commands/hooks-core-commands.js.map +1 -1
- package/dist/src/commands/hooks-coverage-commands.d.ts +1 -2
- package/dist/src/commands/hooks-coverage-commands.d.ts.map +1 -1
- package/dist/src/commands/hooks-coverage-commands.js +140 -58
- package/dist/src/commands/hooks-coverage-commands.js.map +1 -1
- package/dist/src/commands/hooks-coverage-gaps.d.ts.map +1 -1
- package/dist/src/commands/hooks-coverage-gaps.js +74 -36
- package/dist/src/commands/hooks-coverage-gaps.js.map +1 -1
- package/dist/src/commands/hooks-coverage-routing.d.ts.map +1 -1
- package/dist/src/commands/hooks-coverage-routing.js +139 -66
- package/dist/src/commands/hooks-coverage-routing.js.map +1 -1
- package/dist/src/commands/hooks-coverage-utils.d.ts.map +1 -1
- package/dist/src/commands/hooks-coverage-utils.js +27 -8
- package/dist/src/commands/hooks-coverage-utils.js.map +1 -1
- package/dist/src/commands/hooks-extended-commands.d.ts.map +1 -1
- package/dist/src/commands/hooks-extended-commands.js +86 -21
- package/dist/src/commands/hooks-extended-commands.js.map +1 -1
- package/dist/src/commands/hooks-routing-commands.d.ts +1 -2
- package/dist/src/commands/hooks-routing-commands.d.ts.map +1 -1
- package/dist/src/commands/hooks-routing-commands.js +175 -183
- package/dist/src/commands/hooks-routing-commands.js.map +1 -1
- package/dist/src/commands/hooks-workers.d.ts.map +1 -1
- package/dist/src/commands/hooks-workers.js +111 -128
- package/dist/src/commands/hooks-workers.js.map +1 -1
- package/dist/src/commands/hooks.d.ts +1 -1
- package/dist/src/commands/hooks.d.ts.map +1 -1
- package/dist/src/commands/hooks.js +9 -12
- package/dist/src/commands/hooks.js.map +1 -1
- package/dist/src/commands/index.d.ts +1 -1
- package/dist/src/commands/index.d.ts.map +1 -1
- package/dist/src/commands/index.js +2 -2
- package/dist/src/commands/index.js.map +1 -1
- package/dist/src/commands/init-subcommands.d.ts.map +1 -1
- package/dist/src/commands/init-subcommands.js +16 -5
- package/dist/src/commands/init-subcommands.js.map +1 -1
- package/dist/src/commands/init-upgrade.d.ts.map +1 -1
- package/dist/src/commands/init-upgrade.js +46 -23
- package/dist/src/commands/init-upgrade.js.map +1 -1
- package/dist/src/commands/init-wizard.d.ts.map +1 -1
- package/dist/src/commands/init-wizard.js +161 -44
- package/dist/src/commands/init-wizard.js.map +1 -1
- package/dist/src/commands/init.d.ts.map +1 -1
- package/dist/src/commands/init.js +179 -64
- package/dist/src/commands/init.js.map +1 -1
- package/dist/src/commands/mcp.d.ts +1 -0
- package/dist/src/commands/mcp.d.ts.map +1 -1
- package/dist/src/commands/mcp.js +229 -134
- package/dist/src/commands/mcp.js.map +1 -1
- package/dist/src/commands/memory-admin.d.ts.map +1 -1
- package/dist/src/commands/memory-admin.js +67 -48
- package/dist/src/commands/memory-admin.js.map +1 -1
- package/dist/src/commands/memory-crud.d.ts.map +1 -1
- package/dist/src/commands/memory-crud.js +97 -60
- package/dist/src/commands/memory-crud.js.map +1 -1
- package/dist/src/commands/memory-list.d.ts.map +1 -1
- package/dist/src/commands/memory-list.js +6 -6
- package/dist/src/commands/memory-list.js.map +1 -1
- package/dist/src/commands/memory-transfer.d.ts.map +1 -1
- package/dist/src/commands/memory-transfer.js +46 -23
- package/dist/src/commands/memory-transfer.js.map +1 -1
- package/dist/src/commands/memory.d.ts.map +1 -1
- package/dist/src/commands/memory.js +63 -35
- package/dist/src/commands/memory.js.map +1 -1
- package/dist/src/commands/monograph.d.ts.map +1 -1
- package/dist/src/commands/monograph.js +170 -57
- package/dist/src/commands/monograph.js.map +1 -1
- package/dist/src/commands/monoswarm.d.ts +8 -0
- package/dist/src/commands/monoswarm.d.ts.map +1 -0
- package/dist/src/commands/{swarm.js → monoswarm.js} +93 -315
- package/dist/src/commands/monoswarm.js.map +1 -0
- package/dist/src/commands/neural-core.d.ts.map +1 -1
- package/dist/src/commands/neural-core.js +123 -32
- package/dist/src/commands/neural-core.js.map +1 -1
- package/dist/src/commands/neural-optimize.d.ts.map +1 -1
- package/dist/src/commands/neural-optimize.js +95 -130
- package/dist/src/commands/neural-optimize.js.map +1 -1
- package/dist/src/commands/neural-registry.d.ts +1 -2
- package/dist/src/commands/neural-registry.d.ts.map +1 -1
- package/dist/src/commands/neural-registry.js +70 -181
- package/dist/src/commands/neural-registry.js.map +1 -1
- package/dist/src/commands/org-observe.d.ts +13 -3
- package/dist/src/commands/org-observe.d.ts.map +1 -1
- package/dist/src/commands/org-observe.js +308 -131
- package/dist/src/commands/org-observe.js.map +1 -1
- package/dist/src/commands/org-visualize.d.ts.map +1 -1
- package/dist/src/commands/org-visualize.js +10 -5
- package/dist/src/commands/org-visualize.js.map +1 -1
- package/dist/src/commands/org.d.ts +15 -1
- package/dist/src/commands/org.d.ts.map +1 -1
- package/dist/src/commands/org.js +663 -193
- package/dist/src/commands/org.js.map +1 -1
- package/dist/src/commands/performance.d.ts.map +1 -1
- package/dist/src/commands/performance.js +232 -79
- package/dist/src/commands/performance.js.map +1 -1
- package/dist/src/commands/platforms.d.ts +1 -1
- package/dist/src/commands/platforms.d.ts.map +1 -1
- package/dist/src/commands/platforms.js +89 -49
- package/dist/src/commands/platforms.js.map +1 -1
- package/dist/src/commands/providers.d.ts.map +1 -1
- package/dist/src/commands/providers.js +31 -18
- package/dist/src/commands/providers.js.map +1 -1
- package/dist/src/commands/report-crash.d.ts.map +1 -1
- package/dist/src/commands/report-crash.js +17 -5
- package/dist/src/commands/report-crash.js.map +1 -1
- package/dist/src/commands/route.d.ts.map +1 -1
- package/dist/src/commands/route.js +123 -41
- package/dist/src/commands/route.js.map +1 -1
- package/dist/src/commands/search-universal.d.ts +1 -1
- package/dist/src/commands/search-universal.d.ts.map +1 -1
- package/dist/src/commands/search-universal.js +29 -14
- package/dist/src/commands/search-universal.js.map +1 -1
- package/dist/src/commands/security-cve.d.ts.map +1 -1
- package/dist/src/commands/security-cve.js +75 -34
- package/dist/src/commands/security-cve.js.map +1 -1
- package/dist/src/commands/security-misc.d.ts.map +1 -1
- package/dist/src/commands/security-misc.js +362 -102
- package/dist/src/commands/security-misc.js.map +1 -1
- package/dist/src/commands/security-scan.d.ts +13 -0
- package/dist/src/commands/security-scan.d.ts.map +1 -1
- package/dist/src/commands/security-scan.js +222 -57
- package/dist/src/commands/security-scan.js.map +1 -1
- package/dist/src/commands/security.d.ts.map +1 -1
- package/dist/src/commands/security.js +10 -3
- 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 +81 -75
- 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 +59 -129
- 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 +151 -130
- package/dist/src/commands/status.js.map +1 -1
- package/dist/src/commands/task.d.ts.map +1 -1
- package/dist/src/commands/task.js +115 -84
- 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 +67 -32
- package/dist/src/commands/tokens.js.map +1 -1
- package/dist/src/commands/update.d.ts.map +1 -1
- package/dist/src/commands/update.js +3 -5
- package/dist/src/commands/update.js.map +1 -1
- package/dist/src/consensus/audit-writer.d.ts +7 -2
- package/dist/src/consensus/audit-writer.d.ts.map +1 -1
- package/dist/src/consensus/audit-writer.js +19 -11
- package/dist/src/consensus/audit-writer.js.map +1 -1
- package/dist/src/consensus/tally.d.ts.map +1 -1
- package/dist/src/consensus/tally.js +2 -2
- package/dist/src/consensus/tally.js.map +1 -1
- package/dist/src/index.d.ts +7 -7
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +51 -43
- package/dist/src/index.js.map +1 -1
- package/dist/src/init/claudemd-generator.d.ts +1 -1
- package/dist/src/init/claudemd-generator.d.ts.map +1 -1
- package/dist/src/init/claudemd-generator.js +52 -36
- package/dist/src/init/claudemd-generator.js.map +1 -1
- package/dist/src/init/codex-generator.d.ts +16 -0
- package/dist/src/init/codex-generator.d.ts.map +1 -0
- package/dist/src/init/codex-generator.js +180 -0
- package/dist/src/init/codex-generator.js.map +1 -0
- package/dist/src/init/copy-assets.d.ts.map +1 -1
- package/dist/src/init/copy-assets.js +17 -20
- package/dist/src/init/copy-assets.js.map +1 -1
- package/dist/src/init/executor.d.ts +1 -1
- package/dist/src/init/executor.d.ts.map +1 -1
- package/dist/src/init/executor.js +56 -29
- package/dist/src/init/executor.js.map +1 -1
- package/dist/src/init/geminimd-generator.d.ts +1 -1
- package/dist/src/init/geminimd-generator.d.ts.map +1 -1
- package/dist/src/init/geminimd-generator.js +2 -2
- package/dist/src/init/geminimd-generator.js.map +1 -1
- package/dist/src/init/helpers-generator.d.ts.map +1 -1
- package/dist/src/init/helpers-generator.js +7 -7
- package/dist/src/init/helpers-generator.js.map +1 -1
- package/dist/src/init/index.d.ts +8 -7
- package/dist/src/init/index.d.ts.map +1 -1
- package/dist/src/init/index.js +9 -8
- package/dist/src/init/index.js.map +1 -1
- package/dist/src/init/kimi-generator.d.ts +1 -1
- package/dist/src/init/kimi-generator.d.ts.map +1 -1
- package/dist/src/init/kimi-generator.js +34 -28
- package/dist/src/init/kimi-generator.js.map +1 -1
- package/dist/src/init/mcp-generator.d.ts.map +1 -1
- package/dist/src/init/mcp-generator.js +3 -11
- package/dist/src/init/mcp-generator.js.map +1 -1
- package/dist/src/init/opencode-generator.d.ts.map +1 -1
- package/dist/src/init/opencode-generator.js +35 -22
- package/dist/src/init/opencode-generator.js.map +1 -1
- package/dist/src/init/settings-generator.d.ts.map +1 -1
- package/dist/src/init/settings-generator.js +3 -7
- package/dist/src/init/settings-generator.js.map +1 -1
- package/dist/src/init/shared-instructions-generator.d.ts.map +1 -1
- package/dist/src/init/shared-instructions-generator.js +124 -76
- package/dist/src/init/shared-instructions-generator.js.map +1 -1
- package/dist/src/init/shared.d.ts.map +1 -1
- package/dist/src/init/shared.js +26 -25
- package/dist/src/init/shared.js.map +1 -1
- package/dist/src/init/statusline-generator.js +19 -19
- package/dist/src/init/types.d.ts +9 -10
- package/dist/src/init/types.d.ts.map +1 -1
- package/dist/src/init/types.js +10 -8
- package/dist/src/init/types.js.map +1 -1
- package/dist/src/init/upgrade.d.ts.map +1 -1
- package/dist/src/init/upgrade.js +24 -22
- package/dist/src/init/upgrade.js.map +1 -1
- package/dist/src/init/write-antigravity.d.ts.map +1 -1
- package/dist/src/init/write-antigravity.js +15 -7
- package/dist/src/init/write-antigravity.js.map +1 -1
- package/dist/src/init/write-capabilities.d.ts.map +1 -1
- package/dist/src/init/write-capabilities.js +39 -52
- package/dist/src/init/write-capabilities.js.map +1 -1
- package/dist/src/init/write-claude.d.ts.map +1 -1
- package/dist/src/init/write-claude.js +19 -15
- package/dist/src/init/write-claude.js.map +1 -1
- package/dist/src/init/write-codex.d.ts +4 -0
- package/dist/src/init/write-codex.d.ts.map +1 -0
- package/dist/src/init/write-codex.js +122 -0
- package/dist/src/init/write-codex.js.map +1 -0
- package/dist/src/init/write-kimicode.d.ts.map +1 -1
- package/dist/src/init/write-kimicode.js +10 -6
- package/dist/src/init/write-kimicode.js.map +1 -1
- package/dist/src/init/write-opencode.d.ts.map +1 -1
- package/dist/src/init/write-opencode.js +4 -4
- package/dist/src/init/write-opencode.js.map +1 -1
- package/dist/src/init/write-runtime-config.d.ts.map +1 -1
- package/dist/src/init/write-runtime-config.js +24 -24
- package/dist/src/init/write-runtime-config.js.map +1 -1
- package/dist/src/init/write-sample-org.js +1 -1
- package/dist/src/init/write-sample-org.js.map +1 -1
- package/dist/src/knowledge/document-pipeline.d.ts.map +1 -1
- package/dist/src/knowledge/document-pipeline.js +144 -48
- package/dist/src/knowledge/document-pipeline.js.map +1 -1
- package/dist/src/knowledge/eval/corpus.d.ts.map +1 -1
- package/dist/src/knowledge/eval/corpus.js +18 -9
- package/dist/src/knowledge/eval/corpus.js.map +1 -1
- package/dist/src/knowledge/eval/golden-set.d.ts.map +1 -1
- package/dist/src/knowledge/eval/golden-set.js +4286 -136
- package/dist/src/knowledge/eval/golden-set.js.map +1 -1
- package/dist/src/knowledge/eval/harness.d.ts +2 -2
- package/dist/src/knowledge/eval/harness.d.ts.map +1 -1
- package/dist/src/knowledge/eval/harness.js +163 -70
- package/dist/src/knowledge/eval/harness.js.map +1 -1
- package/dist/src/knowledge/eval/metrics.d.ts.map +1 -1
- package/dist/src/knowledge/eval/metrics.js +25 -18
- package/dist/src/knowledge/eval/metrics.js.map +1 -1
- package/dist/src/knowledge/eval/model-presence.d.ts.map +1 -1
- package/dist/src/knowledge/eval/model-presence.js +40 -14
- package/dist/src/knowledge/eval/model-presence.js.map +1 -1
- package/dist/src/knowledge/eval/network-guard.d.ts.map +1 -1
- package/dist/src/knowledge/eval/network-guard.js +22 -10
- package/dist/src/knowledge/eval/network-guard.js.map +1 -1
- package/dist/src/knowledge/eval/retrievers.d.ts.map +1 -1
- package/dist/src/knowledge/eval/retrievers.js +14 -10
- package/dist/src/knowledge/eval/retrievers.js.map +1 -1
- package/dist/src/knowledge/eval/signals.d.ts.map +1 -1
- package/dist/src/knowledge/eval/signals.js +54 -18
- package/dist/src/knowledge/eval/signals.js.map +1 -1
- package/dist/src/mcp-client.d.ts.map +1 -1
- package/dist/src/mcp-client.js +70 -35
- package/dist/src/mcp-client.js.map +1 -1
- package/dist/src/mcp-server.d.ts +1 -9
- package/dist/src/mcp-server.d.ts.map +1 -1
- package/dist/src/mcp-server.js +20 -43
- package/dist/src/mcp-server.js.map +1 -1
- package/dist/src/mcp-tools/agent-tools.d.ts +1 -1
- package/dist/src/mcp-tools/agent-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/agent-tools.js +87 -52
- 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 +34 -17
- package/dist/src/mcp-tools/analyze-tools.js.map +1 -1
- package/dist/src/mcp-tools/auto-install.d.ts.map +1 -1
- package/dist/src/mcp-tools/auto-install.js +3 -3
- package/dist/src/mcp-tools/auto-install.js.map +1 -1
- package/dist/src/mcp-tools/autopilot-tools.d.ts +1 -1
- package/dist/src/mcp-tools/autopilot-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/autopilot-tools.js +32 -70
- package/dist/src/mcp-tools/autopilot-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 +119 -37
- 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 +100 -44
- 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 +36 -15
- package/dist/src/mcp-tools/config-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 +34 -23
- 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 +200 -43
- package/dist/src/mcp-tools/github-tools.js.map +1 -1
- package/dist/src/mcp-tools/graphify-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/graphify-tools.js +2 -2
- package/dist/src/mcp-tools/graphify-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 +461 -115
- package/dist/src/mcp-tools/guidance-tools.js.map +1 -1
- package/dist/src/mcp-tools/hooks-embedding.d.ts +0 -6
- package/dist/src/mcp-tools/hooks-embedding.d.ts.map +1 -1
- package/dist/src/mcp-tools/hooks-embedding.js +170 -59
- package/dist/src/mcp-tools/hooks-embedding.js.map +1 -1
- package/dist/src/mcp-tools/hooks-intelligence.d.ts +0 -9
- package/dist/src/mcp-tools/hooks-intelligence.d.ts.map +1 -1
- package/dist/src/mcp-tools/hooks-intelligence.js +64 -119
- package/dist/src/mcp-tools/hooks-intelligence.js.map +1 -1
- package/dist/src/mcp-tools/hooks-routing.d.ts +1 -2
- package/dist/src/mcp-tools/hooks-routing.d.ts.map +1 -1
- package/dist/src/mcp-tools/hooks-routing.js +92 -165
- package/dist/src/mcp-tools/hooks-routing.js.map +1 -1
- package/dist/src/mcp-tools/hooks-tools.d.ts +1 -1
- package/dist/src/mcp-tools/hooks-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/hooks-tools.js +2 -4
- package/dist/src/mcp-tools/hooks-tools.js.map +1 -1
- package/dist/src/mcp-tools/index.d.ts +18 -19
- package/dist/src/mcp-tools/index.d.ts.map +1 -1
- package/dist/src/mcp-tools/index.js +18 -19
- package/dist/src/mcp-tools/index.js.map +1 -1
- package/dist/src/mcp-tools/knowledge-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/knowledge-tools.js +88 -28
- package/dist/src/mcp-tools/knowledge-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 +157 -40
- package/dist/src/mcp-tools/memory-tools.js.map +1 -1
- package/dist/src/mcp-tools/monodesign-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/monodesign-tools.js +63 -22
- package/dist/src/mcp-tools/monodesign-tools.js.map +1 -1
- package/dist/src/mcp-tools/monograph/agent-history-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/monograph/agent-history-tools.js +22 -9
- package/dist/src/mcp-tools/monograph/agent-history-tools.js.map +1 -1
- package/dist/src/mcp-tools/monograph/build-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/monograph/build-tools.js +37 -16
- package/dist/src/mcp-tools/monograph/build-tools.js.map +1 -1
- package/dist/src/mcp-tools/monograph/group-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/monograph/group-tools.js +57 -20
- package/dist/src/mcp-tools/monograph/group-tools.js.map +1 -1
- package/dist/src/mcp-tools/monograph/health-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/monograph/health-tools.js +13 -7
- package/dist/src/mcp-tools/monograph/health-tools.js.map +1 -1
- package/dist/src/mcp-tools/monograph/impact-tools.js +6 -6
- package/dist/src/mcp-tools/monograph/impact-tools.js.map +1 -1
- package/dist/src/mcp-tools/monograph/index.d.ts.map +1 -1
- package/dist/src/mcp-tools/monograph/index.js +8 -8
- package/dist/src/mcp-tools/monograph/index.js.map +1 -1
- package/dist/src/mcp-tools/monograph/query-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/monograph/query-tools.js +140 -65
- package/dist/src/mcp-tools/monograph/query-tools.js.map +1 -1
- package/dist/src/mcp-tools/monograph/shared.d.ts.map +1 -1
- package/dist/src/mcp-tools/monograph/shared.js +42 -22
- package/dist/src/mcp-tools/monograph/shared.js.map +1 -1
- package/dist/src/mcp-tools/monograph/visualize-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/monograph/visualize-tools.js +87 -36
- package/dist/src/mcp-tools/monograph/visualize-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 +25 -14
- package/dist/src/mcp-tools/monograph-compat.js.map +1 -1
- package/dist/src/mcp-tools/monograph-tools.d.ts +1 -1
- package/dist/src/mcp-tools/monograph-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/monograph-tools.js +1 -1
- package/dist/src/mcp-tools/monograph-tools.js.map +1 -1
- package/dist/src/mcp-tools/monomind-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/monomind-tools.js +1 -1
- package/dist/src/mcp-tools/monomind-tools.js.map +1 -1
- package/dist/src/mcp-tools/monoswarm-tools.d.ts +17 -0
- package/dist/src/mcp-tools/monoswarm-tools.d.ts.map +1 -0
- package/dist/src/mcp-tools/monoswarm-tools.js +1289 -0
- package/dist/src/mcp-tools/monoswarm-tools.js.map +1 -0
- package/dist/src/mcp-tools/performance-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/performance-tools.js +305 -101
- package/dist/src/mcp-tools/performance-tools.js.map +1 -1
- package/dist/src/mcp-tools/quality/coverage-analysis/prioritize-gaps.d.ts.map +1 -1
- package/dist/src/mcp-tools/quality/coverage-analysis/prioritize-gaps.js +9 -4
- package/dist/src/mcp-tools/quality/coverage-analysis/prioritize-gaps.js.map +1 -1
- package/dist/src/mcp-tools/quality/security-compliance/detect-secrets.d.ts +1 -1
- package/dist/src/mcp-tools/quality/security-compliance/detect-secrets.d.ts.map +1 -1
- package/dist/src/mcp-tools/quality/security-compliance/detect-secrets.js +36 -14
- package/dist/src/mcp-tools/quality/security-compliance/detect-secrets.js.map +1 -1
- package/dist/src/mcp-tools/quality-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/quality-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 +2 -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 +117 -53
- 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 +22 -13
- package/dist/src/mcp-tools/session-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 +37 -20
- 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 +59 -22
- 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 +43 -16
- package/dist/src/mcp-tools/terminal-tools.js.map +1 -1
- package/dist/src/mcp-tools/transfer-tools.d.ts +8 -12
- package/dist/src/mcp-tools/transfer-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/transfer-tools.js +11 -14
- package/dist/src/mcp-tools/transfer-tools.js.map +1 -1
- package/dist/src/mcp-tools/types.d.ts +1 -1
- package/dist/src/mcp-tools/types.d.ts.map +1 -1
- package/dist/src/mcp-tools/types.js +1 -1
- package/dist/src/mcp-tools/types.js.map +1 -1
- package/dist/src/memory/bm25-index.d.ts.map +1 -1
- package/dist/src/memory/bm25-index.js.map +1 -1
- package/dist/src/memory/embedding-operations.d.ts.map +1 -1
- package/dist/src/memory/embedding-operations.js +23 -56
- package/dist/src/memory/embedding-operations.js.map +1 -1
- package/dist/src/memory/ewc-consolidation.d.ts.map +1 -1
- package/dist/src/memory/ewc-consolidation.js +31 -27
- package/dist/src/memory/ewc-consolidation.js.map +1 -1
- package/dist/src/memory/hnsw-operations.d.ts +15 -75
- package/dist/src/memory/hnsw-operations.d.ts.map +1 -1
- package/dist/src/memory/hnsw-operations.js +27 -268
- package/dist/src/memory/hnsw-operations.js.map +1 -1
- package/dist/src/memory/intelligence.d.ts +2 -2
- package/dist/src/memory/intelligence.d.ts.map +1 -1
- package/dist/src/memory/intelligence.js +130 -91
- package/dist/src/memory/intelligence.js.map +1 -1
- package/dist/src/memory/memory-bridge.d.ts +24 -24
- package/dist/src/memory/memory-bridge.d.ts.map +1 -1
- package/dist/src/memory/memory-bridge.js +40 -41
- package/dist/src/memory/memory-bridge.js.map +1 -1
- package/dist/src/memory/memory-crud.d.ts +1 -1
- package/dist/src/memory/memory-crud.d.ts.map +1 -1
- package/dist/src/memory/memory-crud.js +82 -67
- package/dist/src/memory/memory-crud.js.map +1 -1
- package/dist/src/memory/memory-initializer.d.ts +7 -8
- package/dist/src/memory/memory-initializer.d.ts.map +1 -1
- package/dist/src/memory/memory-initializer.js +38 -35
- package/dist/src/memory/memory-initializer.js.map +1 -1
- package/dist/src/memory/memory-kg.d.ts.map +1 -1
- package/dist/src/memory/memory-kg.js +173 -41
- package/dist/src/memory/memory-kg.js.map +1 -1
- package/dist/src/memory/memory-migrations.d.ts.map +1 -1
- package/dist/src/memory/memory-migrations.js +11 -7
- package/dist/src/memory/memory-migrations.js.map +1 -1
- package/dist/src/memory/memory-read.d.ts.map +1 -1
- package/dist/src/memory/memory-read.js +50 -35
- package/dist/src/memory/memory-read.js.map +1 -1
- package/dist/src/memory/query-router.d.ts.map +1 -1
- package/dist/src/memory/query-router.js +29 -12
- package/dist/src/memory/query-router.js.map +1 -1
- package/dist/src/memory/sona-optimizer.d.ts +1 -1
- package/dist/src/memory/sona-optimizer.d.ts.map +1 -1
- package/dist/src/memory/sona-optimizer.js +164 -42
- package/dist/src/memory/sona-optimizer.js.map +1 -1
- package/dist/src/memory/text-tokens.d.ts.map +1 -1
- package/dist/src/memory/text-tokens.js +78 -8
- package/dist/src/memory/text-tokens.js.map +1 -1
- package/dist/src/monovector/command-outcomes.d.ts.map +1 -1
- package/dist/src/monovector/command-outcomes.js +23 -8
- 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 +29 -14
- 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 +21 -6
- package/dist/src/monovector/coverage-tools.js.map +1 -1
- package/dist/src/monovector/diff-classifier.d.ts +1 -1
- package/dist/src/monovector/diff-classifier.d.ts.map +1 -1
- package/dist/src/monovector/diff-classifier.js +100 -45
- package/dist/src/monovector/diff-classifier.js.map +1 -1
- package/dist/src/monovector/index.d.ts +3 -4
- package/dist/src/monovector/index.d.ts.map +1 -1
- package/dist/src/monovector/index.js +18 -6
- package/dist/src/monovector/index.js.map +1 -1
- package/dist/src/monovector/init-state.d.ts.map +1 -1
- package/dist/src/monovector/init-state.js +15 -5
- package/dist/src/monovector/init-state.js.map +1 -1
- package/dist/src/monovector/model-outcomes.d.ts +25 -0
- package/dist/src/monovector/model-outcomes.d.ts.map +1 -0
- package/dist/src/monovector/model-outcomes.js +113 -0
- package/dist/src/monovector/model-outcomes.js.map +1 -0
- package/dist/src/monovector/route-outcomes.d.ts.map +1 -1
- package/dist/src/monovector/route-outcomes.js +40 -21
- package/dist/src/monovector/route-outcomes.js.map +1 -1
- package/dist/src/observability/replay-reader.d.ts.map +1 -1
- package/dist/src/observability/replay-reader.js +6 -8
- package/dist/src/observability/replay-reader.js.map +1 -1
- package/dist/src/orgrt/agent-runner.d.ts +9 -3
- package/dist/src/orgrt/agent-runner.d.ts.map +1 -1
- package/dist/src/orgrt/agent-runner.js +1 -1
- package/dist/src/orgrt/agent-runner.js.map +1 -1
- package/dist/src/orgrt/antigravity-runner.d.ts +26 -3
- package/dist/src/orgrt/antigravity-runner.d.ts.map +1 -1
- package/dist/src/orgrt/antigravity-runner.js +295 -125
- package/dist/src/orgrt/antigravity-runner.js.map +1 -1
- package/dist/src/orgrt/approvals.d.ts.map +1 -1
- package/dist/src/orgrt/approvals.js +32 -8
- package/dist/src/orgrt/approvals.js.map +1 -1
- package/dist/src/orgrt/broker.d.ts.map +1 -1
- package/dist/src/orgrt/broker.js +11 -4
- package/dist/src/orgrt/broker.js.map +1 -1
- package/dist/src/orgrt/bus.d.ts.map +1 -1
- package/dist/src/orgrt/bus.js +28 -15
- package/dist/src/orgrt/bus.js.map +1 -1
- package/dist/src/orgrt/checkpoint-ops.d.ts +10 -16
- package/dist/src/orgrt/checkpoint-ops.d.ts.map +1 -1
- package/dist/src/orgrt/checkpoint-ops.js +47 -36
- package/dist/src/orgrt/checkpoint-ops.js.map +1 -1
- package/dist/src/orgrt/checkpoint.d.ts +12 -1
- package/dist/src/orgrt/checkpoint.d.ts.map +1 -1
- package/dist/src/orgrt/checkpoint.js +22 -4
- package/dist/src/orgrt/checkpoint.js.map +1 -1
- package/dist/src/orgrt/codex-runner.d.ts +27 -3
- package/dist/src/orgrt/codex-runner.d.ts.map +1 -1
- package/dist/src/orgrt/codex-runner.js +387 -129
- package/dist/src/orgrt/codex-runner.js.map +1 -1
- package/dist/src/orgrt/copilot-runner.d.ts +1 -1
- package/dist/src/orgrt/copilot-runner.d.ts.map +1 -1
- package/dist/src/orgrt/copilot-runner.js +60 -18
- package/dist/src/orgrt/copilot-runner.js.map +1 -1
- package/dist/src/orgrt/cross-org.d.ts.map +1 -1
- package/dist/src/orgrt/cross-org.js +224 -41
- package/dist/src/orgrt/cross-org.js.map +1 -1
- package/dist/src/orgrt/crush-runner.d.ts +5 -2
- package/dist/src/orgrt/crush-runner.d.ts.map +1 -1
- package/dist/src/orgrt/crush-runner.js +93 -47
- package/dist/src/orgrt/crush-runner.js.map +1 -1
- package/dist/src/orgrt/daemon.d.ts +42 -30
- package/dist/src/orgrt/daemon.d.ts.map +1 -1
- package/dist/src/orgrt/daemon.js +199 -69
- package/dist/src/orgrt/daemon.js.map +1 -1
- package/dist/src/orgrt/decisions.d.ts +3 -2
- package/dist/src/orgrt/decisions.d.ts.map +1 -1
- package/dist/src/orgrt/decisions.js +101 -32
- package/dist/src/orgrt/decisions.js.map +1 -1
- package/dist/src/orgrt/fence.d.ts +2 -2
- package/dist/src/orgrt/fence.d.ts.map +1 -1
- package/dist/src/orgrt/fence.js +13 -5
- package/dist/src/orgrt/fence.js.map +1 -1
- package/dist/src/orgrt/forwarder.js +1 -1
- package/dist/src/orgrt/forwarder.js.map +1 -1
- package/dist/src/orgrt/grok-runner.d.ts +1 -1
- package/dist/src/orgrt/grok-runner.d.ts.map +1 -1
- package/dist/src/orgrt/grok-runner.js +75 -30
- package/dist/src/orgrt/grok-runner.js.map +1 -1
- package/dist/src/orgrt/inbox.d.ts.map +1 -1
- package/dist/src/orgrt/inbox.js +5 -3
- package/dist/src/orgrt/inbox.js.map +1 -1
- package/dist/src/orgrt/kimicode-runner.d.ts +54 -8
- package/dist/src/orgrt/kimicode-runner.d.ts.map +1 -1
- package/dist/src/orgrt/kimicode-runner.js +278 -151
- package/dist/src/orgrt/kimicode-runner.js.map +1 -1
- package/dist/src/orgrt/mailbox.d.ts +26 -1
- package/dist/src/orgrt/mailbox.d.ts.map +1 -1
- package/dist/src/orgrt/mailbox.js +88 -6
- package/dist/src/orgrt/mailbox.js.map +1 -1
- package/dist/src/orgrt/migrate.d.ts.map +1 -1
- package/dist/src/orgrt/migrate.js +38 -25
- package/dist/src/orgrt/migrate.js.map +1 -1
- package/dist/src/orgrt/opencode-runner.d.ts +1 -1
- package/dist/src/orgrt/opencode-runner.d.ts.map +1 -1
- package/dist/src/orgrt/opencode-runner.js +16 -5
- package/dist/src/orgrt/opencode-runner.js.map +1 -1
- package/dist/src/orgrt/org-memory.d.ts +2 -2
- package/dist/src/orgrt/org-memory.d.ts.map +1 -1
- package/dist/src/orgrt/org-memory.js +66 -26
- package/dist/src/orgrt/org-memory.js.map +1 -1
- package/dist/src/orgrt/pi-rpc-runner.d.ts +1 -1
- package/dist/src/orgrt/pi-rpc-runner.d.ts.map +1 -1
- package/dist/src/orgrt/pi-rpc-runner.js +134 -114
- package/dist/src/orgrt/pi-rpc-runner.js.map +1 -1
- package/dist/src/orgrt/pi-runner.d.ts +1 -1
- package/dist/src/orgrt/pi-runner.d.ts.map +1 -1
- package/dist/src/orgrt/pi-runner.js +35 -16
- package/dist/src/orgrt/pi-runner.js.map +1 -1
- package/dist/src/orgrt/policy.d.ts +11 -0
- package/dist/src/orgrt/policy.d.ts.map +1 -1
- package/dist/src/orgrt/policy.js +86 -18
- package/dist/src/orgrt/policy.js.map +1 -1
- package/dist/src/orgrt/prechecks.d.ts.map +1 -1
- package/dist/src/orgrt/prechecks.js +9 -4
- package/dist/src/orgrt/prechecks.js.map +1 -1
- package/dist/src/orgrt/provider.d.ts +29 -1
- package/dist/src/orgrt/provider.d.ts.map +1 -1
- package/dist/src/orgrt/provider.js +62 -2
- package/dist/src/orgrt/provider.js.map +1 -1
- package/dist/src/orgrt/questions.d.ts.map +1 -1
- package/dist/src/orgrt/questions.js +34 -10
- package/dist/src/orgrt/questions.js.map +1 -1
- package/dist/src/orgrt/qwen-rpc-runner.d.ts +56 -0
- package/dist/src/orgrt/qwen-rpc-runner.d.ts.map +1 -0
- package/dist/src/orgrt/qwen-rpc-runner.js +381 -0
- package/dist/src/orgrt/qwen-rpc-runner.js.map +1 -0
- package/dist/src/orgrt/qwen-runner.d.ts +1 -1
- package/dist/src/orgrt/qwen-runner.d.ts.map +1 -1
- package/dist/src/orgrt/qwen-runner.js +42 -23
- package/dist/src/orgrt/qwen-runner.js.map +1 -1
- package/dist/src/orgrt/remote.js +1 -1
- package/dist/src/orgrt/remote.js.map +1 -1
- package/dist/src/orgrt/reporting.d.ts.map +1 -1
- package/dist/src/orgrt/reporting.js +61 -27
- package/dist/src/orgrt/reporting.js.map +1 -1
- package/dist/src/orgrt/scheduler-integration.d.ts.map +1 -1
- package/dist/src/orgrt/scheduler-integration.js +63 -19
- package/dist/src/orgrt/scheduler-integration.js.map +1 -1
- package/dist/src/orgrt/scheduler.d.ts.map +1 -1
- package/dist/src/orgrt/scheduler.js +7 -3
- package/dist/src/orgrt/scheduler.js.map +1 -1
- package/dist/src/orgrt/server.js +1 -1
- package/dist/src/orgrt/server.js.map +1 -1
- package/dist/src/orgrt/session.d.ts +32 -4
- package/dist/src/orgrt/session.d.ts.map +1 -1
- package/dist/src/orgrt/session.js +242 -74
- package/dist/src/orgrt/session.js.map +1 -1
- package/dist/src/orgrt/state-detector.d.ts.map +1 -1
- package/dist/src/orgrt/state-detector.js +6 -2
- package/dist/src/orgrt/state-detector.js.map +1 -1
- package/dist/src/orgrt/task-dag.d.ts +29 -1
- package/dist/src/orgrt/task-dag.d.ts.map +1 -1
- package/dist/src/orgrt/task-dag.js +76 -12
- package/dist/src/orgrt/task-dag.js.map +1 -1
- package/dist/src/orgrt/templates.d.ts.map +1 -1
- package/dist/src/orgrt/templates.js +198 -36
- package/dist/src/orgrt/templates.js.map +1 -1
- package/dist/src/orgrt/test-loop.d.ts.map +1 -1
- package/dist/src/orgrt/test-loop.js +139 -35
- package/dist/src/orgrt/test-loop.js.map +1 -1
- package/dist/src/orgrt/tool-fence.d.ts.map +1 -1
- package/dist/src/orgrt/tool-fence.js +21 -3
- package/dist/src/orgrt/tool-fence.js.map +1 -1
- package/dist/src/orgrt/types.d.ts +32 -1
- package/dist/src/orgrt/types.d.ts.map +1 -1
- package/dist/src/orgrt/types.js +192 -39
- package/dist/src/orgrt/types.js.map +1 -1
- package/dist/src/orgrt/usage-proxy.d.ts +20 -0
- package/dist/src/orgrt/usage-proxy.d.ts.map +1 -1
- package/dist/src/orgrt/usage-proxy.js +25 -15
- package/dist/src/orgrt/usage-proxy.js.map +1 -1
- package/dist/src/orgrt/vercel-providers.d.ts.map +1 -1
- package/dist/src/orgrt/vercel-providers.js +11 -1
- package/dist/src/orgrt/vercel-providers.js.map +1 -1
- package/dist/src/orgrt/vercel-runner.d.ts +1 -1
- package/dist/src/orgrt/vercel-runner.d.ts.map +1 -1
- package/dist/src/orgrt/vercel-runner.js +3 -5
- package/dist/src/orgrt/vercel-runner.js.map +1 -1
- package/dist/src/orgrt/vercel-session-store.d.ts +14 -0
- package/dist/src/orgrt/vercel-session-store.d.ts.map +1 -1
- package/dist/src/orgrt/vercel-session-store.js +3 -3
- package/dist/src/orgrt/vercel-session-store.js.map +1 -1
- package/dist/src/orgrt/visualization.js +3 -4
- package/dist/src/orgrt/visualization.js.map +1 -1
- package/dist/src/output.d.ts +1 -1
- package/dist/src/output.d.ts.map +1 -1
- package/dist/src/output.js +68 -39
- package/dist/src/output.js.map +1 -1
- package/dist/src/parser.d.ts.map +1 -1
- package/dist/src/parser.js +35 -24
- package/dist/src/parser.js.map +1 -1
- package/dist/src/pricing/model-pricing.d.ts.map +1 -1
- package/dist/src/pricing/model-pricing.js +3 -7
- package/dist/src/pricing/model-pricing.js.map +1 -1
- package/dist/src/prompt.d.ts +2 -2
- package/dist/src/prompt.d.ts.map +1 -1
- package/dist/src/prompt.js +49 -41
- package/dist/src/prompt.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 +27 -8
- package/dist/src/routing/llm-caller.js.map +1 -1
- package/dist/src/routing/model-download.d.ts.map +1 -1
- package/dist/src/routing/model-download.js +3 -3
- package/dist/src/routing/model-download.js.map +1 -1
- package/dist/src/routing/route-layer-factory.d.ts.map +1 -1
- package/dist/src/routing/route-layer-factory.js +22 -14
- package/dist/src/routing/route-layer-factory.js.map +1 -1
- package/dist/src/security/audit-log.d.ts +47 -0
- package/dist/src/security/audit-log.d.ts.map +1 -0
- package/dist/src/security/audit-log.js +88 -0
- package/dist/src/security/audit-log.js.map +1 -0
- package/dist/src/services/config-file-manager.d.ts +2 -2
- package/dist/src/services/config-file-manager.d.ts.map +1 -1
- package/dist/src/services/config-file-manager.js +44 -20
- package/dist/src/services/config-file-manager.js.map +1 -1
- package/dist/src/services/crash-reporter.d.ts.map +1 -1
- package/dist/src/services/crash-reporter.js +44 -16
- package/dist/src/services/crash-reporter.js.map +1 -1
- package/dist/src/suggest.d.ts +1 -1
- package/dist/src/suggest.d.ts.map +1 -1
- package/dist/src/suggest.js +57 -57
- package/dist/src/suggest.js.map +1 -1
- package/dist/src/sync/checker.d.ts.map +1 -1
- package/dist/src/sync/checker.js +7 -8
- package/dist/src/sync/checker.js.map +1 -1
- package/dist/src/transfer/anonymization/index.d.ts +1 -1
- package/dist/src/transfer/anonymization/index.js +3 -3
- package/dist/src/transfer/anonymization/index.js.map +1 -1
- package/dist/src/types.d.ts +4 -4
- package/dist/src/types.d.ts.map +1 -1
- package/dist/src/ui/collector.mjs +275 -159
- package/dist/src/ui/dashboard.html +761 -742
- package/dist/src/ui/data/agent-avatars.html +3 -15
- package/dist/src/ui/data/agent-avatars.json +11 -27
- package/dist/src/ui/markdown.js +243 -62
- package/dist/src/ui/mastermind-diagram-fallback.html +29 -29
- package/dist/src/ui/orgs-files.js +99 -46
- package/dist/src/ui/orgs.html +54 -54
- package/dist/src/ui/routes-monograph.mjs +918 -246
- package/dist/src/ui/routes-org.mjs +4234 -2369
- package/dist/src/ui/server.mjs +142 -106
- package/dist/src/update/checker.d.ts.map +1 -1
- package/dist/src/update/checker.js +17 -12
- package/dist/src/update/checker.js.map +1 -1
- package/dist/src/update/executor.d.ts +2 -2
- package/dist/src/update/executor.d.ts.map +1 -1
- package/dist/src/update/executor.js +21 -11
- package/dist/src/update/executor.js.map +1 -1
- package/dist/src/update/index.d.ts +6 -6
- package/dist/src/update/index.d.ts.map +1 -1
- package/dist/src/update/index.js +9 -9
- package/dist/src/update/index.js.map +1 -1
- package/dist/src/update/rate-limiter.d.ts.map +1 -1
- package/dist/src/update/rate-limiter.js +11 -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 +8 -12
- package/dist/src/update/validator.js.map +1 -1
- package/dist/src/utils/cosine-similarity.d.ts.map +1 -1
- package/dist/src/utils/cosine-similarity.js.map +1 -1
- package/dist/src/utils/input-guards.d.ts +1 -1
- package/dist/src/utils/input-guards.d.ts.map +1 -1
- package/dist/src/utils/input-guards.js +24 -9
- package/dist/src/utils/input-guards.js.map +1 -1
- package/dist/src/utils/json-file.d.ts +12 -0
- package/dist/src/utils/json-file.d.ts.map +1 -1
- package/dist/src/utils/json-file.js +14 -3
- package/dist/src/utils/json-file.js.map +1 -1
- package/dist/src/utils/parse-jsonl.d.ts.map +1 -1
- package/dist/src/utils/parse-jsonl.js +1 -3
- package/dist/src/utils/parse-jsonl.js.map +1 -1
- package/dist/src/utils/paths.d.ts.map +1 -1
- package/dist/src/utils/paths.js +2 -2
- package/dist/src/utils/paths.js.map +1 -1
- package/dist/src/utils/redaction.d.ts.map +1 -1
- package/dist/src/utils/redaction.js +1 -1
- package/dist/src/utils/redaction.js.map +1 -1
- package/dist/src/utils/resource-governor.d.ts.map +1 -1
- package/dist/src/utils/resource-governor.js +38 -14
- package/dist/src/utils/resource-governor.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +7 -7
- package/.claude/agents/consensus/crdt-synchronizer.md +0 -977
- package/.claude/commands/hive-mind/README.md +0 -42
- package/.claude/commands/hive-mind/hive-mind-consensus.md +0 -72
- package/.claude/commands/hive-mind/hive-mind-init.md +0 -68
- package/.claude/commands/hive-mind/hive-mind-memory.md +0 -73
- package/.claude/commands/hive-mind/hive-mind-spawn.md +0 -82
- package/.claude/commands/hive-mind/hive-mind-status.md +0 -56
- package/.claude/commands/hive-mind/hive-mind-stop.md +0 -55
- package/.claude/commands/hive-mind/hive-mind.md +0 -87
- package/.claude/commands/swarm/README.md +0 -40
- package/.claude/commands/swarm/swarm.md +0 -79
- package/.claude/skills/hive-mind-advanced/SKILL.md +0 -347
- package/.claude/skills/swarm-advanced/SKILL.md +0 -936
- package/dist/src/commands/swarm.d.ts +0 -8
- package/dist/src/commands/swarm.d.ts.map +0 -1
- package/dist/src/commands/swarm.js.map +0 -1
- package/dist/src/mcp-tools/hive-mind-tools.d.ts +0 -17
- package/dist/src/mcp-tools/hive-mind-tools.d.ts.map +0 -1
- package/dist/src/mcp-tools/hive-mind-tools.js +0 -1239
- package/dist/src/mcp-tools/hive-mind-tools.js.map +0 -1
- package/dist/src/mcp-tools/swarm-tools.d.ts +0 -9
- package/dist/src/mcp-tools/swarm-tools.d.ts.map +0 -1
- package/dist/src/mcp-tools/swarm-tools.js +0 -411
- package/dist/src/mcp-tools/swarm-tools.js.map +0 -1
- package/dist/src/ui/data/avatars/crdt-synchronizer.svg +0 -53
- package/dist/src/ui/data/avatars/gossip-coordinator.svg +0 -54
- package/scripts/deploy-ipfs-node.sh +0 -153
- package/scripts/setup-ipfs-registry.md +0 -365
- /package/.claude/agents/{hive-mind → monoswarm}/scout-explorer.md +0 -0
- /package/.claude/agents/{hive-mind → monoswarm}/worker-specialist.md +0 -0
- /package/.claude/commands/{swarm → monoswarm}/analysis.md +0 -0
- /package/.claude/commands/{swarm → monoswarm}/development.md +0 -0
- /package/.claude/commands/{swarm → monoswarm}/examples.md +0 -0
- /package/.claude/commands/{swarm → monoswarm}/maintenance.md +0 -0
- /package/.claude/commands/{swarm → monoswarm}/optimization.md +0 -0
- /package/.claude/commands/{swarm → monoswarm}/testing.md +0 -0
- /package/dist/src/ui/data/avatars/{code-review-swarm.svg → monoswarm-code-review.svg} +0 -0
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* V1 Intelligence Module
|
|
3
|
-
*
|
|
3
|
+
* SONA and ReasoningBank
|
|
4
4
|
* for adaptive learning and pattern recognition
|
|
5
5
|
*
|
|
6
6
|
* Performance targets:
|
|
7
7
|
* - Signal recording: <0.05ms (achieved: ~0.01ms)
|
|
8
|
-
* - Pattern search: O(
|
|
8
|
+
* - Pattern search: O(n) cosine scan
|
|
9
9
|
* - Memory efficient circular buffers
|
|
10
10
|
*
|
|
11
11
|
* @module v1/cli/intelligence
|
|
12
12
|
*/
|
|
13
|
-
import { existsSync, mkdirSync, readFileSync, statSync,
|
|
13
|
+
import { existsSync, mkdirSync, readFileSync, statSync, unlinkSync, writeFileSync } from 'node:fs';
|
|
14
14
|
import { homedir } from 'node:os';
|
|
15
15
|
import { dirname, join } from 'node:path';
|
|
16
16
|
import { cosineSimilarity as sharedCosineSimilarity } from '../utils/cosine-similarity.js';
|
|
@@ -144,7 +144,7 @@ const DEFAULT_SONA_CONFIG = {
|
|
|
144
144
|
maxTrajectorySize: 100,
|
|
145
145
|
patternThreshold: 0.7,
|
|
146
146
|
maxSignals: 10000,
|
|
147
|
-
maxPatterns: 5000
|
|
147
|
+
maxPatterns: 5000,
|
|
148
148
|
};
|
|
149
149
|
// ============================================================================
|
|
150
150
|
// Optimized Local SONA Implementation
|
|
@@ -237,26 +237,26 @@ class LocalSonaCoordinator {
|
|
|
237
237
|
const rewardMap = {
|
|
238
238
|
success: 1.0,
|
|
239
239
|
partial: 0.5,
|
|
240
|
-
failure: -0.5
|
|
240
|
+
failure: -0.5,
|
|
241
241
|
};
|
|
242
242
|
const reward = rewardMap[verdict] ?? 0;
|
|
243
243
|
// Record the completed trajectory
|
|
244
244
|
const completedTrajectory = {
|
|
245
245
|
steps: [...this.currentTrajectorySteps],
|
|
246
246
|
verdict,
|
|
247
|
-
timestamp: Date.now()
|
|
247
|
+
timestamp: Date.now(),
|
|
248
248
|
};
|
|
249
249
|
this.recordTrajectory(completedTrajectory);
|
|
250
250
|
// Update pattern confidences based on reward
|
|
251
251
|
let patternsUpdated = 0;
|
|
252
|
-
const
|
|
252
|
+
const _allPatterns = bank.getAll();
|
|
253
253
|
for (const step of this.currentTrajectorySteps) {
|
|
254
254
|
if (!step.embedding || step.embedding.length === 0)
|
|
255
255
|
continue;
|
|
256
256
|
// Find patterns similar to this trajectory step
|
|
257
257
|
const similar = bank.findSimilar(step.embedding, {
|
|
258
258
|
k: 3,
|
|
259
|
-
threshold: 0.3
|
|
259
|
+
threshold: 0.3,
|
|
260
260
|
});
|
|
261
261
|
for (const match of similar) {
|
|
262
262
|
const pattern = bank.get(match.id);
|
|
@@ -287,7 +287,9 @@ class LocalSonaCoordinator {
|
|
|
287
287
|
let patternsDistilled = 0;
|
|
288
288
|
let totalEwcPenalty = 0;
|
|
289
289
|
// Get recent successful trajectories
|
|
290
|
-
const recentSuccessful = this.trajectories
|
|
290
|
+
const recentSuccessful = this.trajectories
|
|
291
|
+
.filter((t) => t.verdict === 'success' || t.verdict === 'partial')
|
|
292
|
+
.slice(-10); // last 10 successful
|
|
291
293
|
if (recentSuccessful.length === 0) {
|
|
292
294
|
return { patternsDistilled: 0, ewcPenalty: 0 };
|
|
293
295
|
}
|
|
@@ -296,7 +298,7 @@ class LocalSonaCoordinator {
|
|
|
296
298
|
try {
|
|
297
299
|
const ewcModule = await import('./ewc-consolidation.js');
|
|
298
300
|
ewcConsolidator = await ewcModule.getEWCConsolidator({
|
|
299
|
-
lambda: this.config.ewcLambda
|
|
301
|
+
lambda: this.config.ewcLambda,
|
|
300
302
|
});
|
|
301
303
|
}
|
|
302
304
|
catch {
|
|
@@ -304,7 +306,7 @@ class LocalSonaCoordinator {
|
|
|
304
306
|
}
|
|
305
307
|
const rewardMap = {
|
|
306
308
|
success: 1.0,
|
|
307
|
-
partial: 0.5
|
|
309
|
+
partial: 0.5,
|
|
308
310
|
};
|
|
309
311
|
// Collect confidence changes for EWC Fisher update
|
|
310
312
|
const confidenceChanges = [];
|
|
@@ -315,7 +317,7 @@ class LocalSonaCoordinator {
|
|
|
315
317
|
continue;
|
|
316
318
|
const similar = bank.findSimilar(step.embedding, {
|
|
317
319
|
k: 3,
|
|
318
|
-
threshold: 0.4
|
|
320
|
+
threshold: 0.4,
|
|
319
321
|
});
|
|
320
322
|
for (const match of similar) {
|
|
321
323
|
const pattern = bank.get(match.id);
|
|
@@ -351,7 +353,7 @@ class LocalSonaCoordinator {
|
|
|
351
353
|
id: pattern.id,
|
|
352
354
|
oldConf: oldConfidence,
|
|
353
355
|
newConf: pattern.confidence,
|
|
354
|
-
embedding: pattern.embedding
|
|
356
|
+
embedding: pattern.embedding,
|
|
355
357
|
});
|
|
356
358
|
}
|
|
357
359
|
}
|
|
@@ -360,7 +362,7 @@ class LocalSonaCoordinator {
|
|
|
360
362
|
if (ewcConsolidator && confidenceChanges.length > 0) {
|
|
361
363
|
for (const change of confidenceChanges) {
|
|
362
364
|
// Use confidence delta as gradient proxy
|
|
363
|
-
const gradient = change.embedding.map(e => e * Math.abs(change.newConf - change.oldConf));
|
|
365
|
+
const gradient = change.embedding.map((e) => e * Math.abs(change.newConf - change.oldConf));
|
|
364
366
|
ewcConsolidator.recordGradient(change.id, gradient, true);
|
|
365
367
|
}
|
|
366
368
|
}
|
|
@@ -381,7 +383,7 @@ class LocalSonaCoordinator {
|
|
|
381
383
|
return {
|
|
382
384
|
signalCount: this.signalCount,
|
|
383
385
|
trajectoryCount: this.trajectories.length,
|
|
384
|
-
avgAdaptationMs: this.getAvgAdaptationTime()
|
|
386
|
+
avgAdaptationMs: this.getAvgAdaptationTime(),
|
|
385
387
|
};
|
|
386
388
|
}
|
|
387
389
|
}
|
|
@@ -412,10 +414,11 @@ class LocalReasoningBank {
|
|
|
412
414
|
try {
|
|
413
415
|
const data = readJsonFileSync(getPatternsPath(), []);
|
|
414
416
|
if (Array.isArray(data)) {
|
|
415
|
-
// Validate each persisted pattern.
|
|
416
|
-
//
|
|
417
|
-
//
|
|
418
|
-
//
|
|
417
|
+
// Validate each persisted pattern. patterns.json can be replaced or
|
|
418
|
+
// hand-edited outside the process (a transferred/imported file, or
|
|
419
|
+
// direct tampering) — without bounds checks, a malicious file can
|
|
420
|
+
// inject `confidence: 1e9` (deterministically wins every routing
|
|
421
|
+
// decision) or `keywords: [10000 strings]` (DoS on every
|
|
419
422
|
// findBestPatternMatch call).
|
|
420
423
|
for (const pattern of data) {
|
|
421
424
|
if (!pattern || typeof pattern !== 'object')
|
|
@@ -425,7 +428,8 @@ class LocalReasoningBank {
|
|
|
425
428
|
if (typeof id !== 'string' || id.length === 0 || id.length > 256)
|
|
426
429
|
continue;
|
|
427
430
|
const conf = rec.confidence;
|
|
428
|
-
if (conf !== undefined &&
|
|
431
|
+
if (conf !== undefined &&
|
|
432
|
+
(typeof conf !== 'number' || !Number.isFinite(conf) || conf < 0 || conf > 1)) {
|
|
429
433
|
continue;
|
|
430
434
|
}
|
|
431
435
|
const keywords = rec.keywords;
|
|
@@ -438,7 +442,8 @@ class LocalReasoningBank {
|
|
|
438
442
|
// and hardens against malformed/malicious persisted entries (e.g. a
|
|
439
443
|
// missing embedding array previously reached cosineSim() as `undefined`).
|
|
440
444
|
const rawEmbedding = rec.embedding;
|
|
441
|
-
const embedding = Array.isArray(rawEmbedding) &&
|
|
445
|
+
const embedding = Array.isArray(rawEmbedding) &&
|
|
446
|
+
rawEmbedding.every((v) => typeof v === 'number' && Number.isFinite(v))
|
|
442
447
|
? rawEmbedding
|
|
443
448
|
: [];
|
|
444
449
|
const rawUsage = rec.usageCount;
|
|
@@ -451,9 +456,15 @@ class LocalReasoningBank {
|
|
|
451
456
|
content: typeof rec.content === 'string' ? rec.content : '',
|
|
452
457
|
confidence: typeof conf === 'number' ? conf : 0.5,
|
|
453
458
|
usageCount: typeof rawUsage === 'number' && Number.isFinite(rawUsage) ? rawUsage : 0,
|
|
454
|
-
createdAt: typeof rawCreated === 'number' && Number.isFinite(rawCreated)
|
|
455
|
-
|
|
456
|
-
|
|
459
|
+
createdAt: typeof rawCreated === 'number' && Number.isFinite(rawCreated)
|
|
460
|
+
? rawCreated
|
|
461
|
+
: Date.now(),
|
|
462
|
+
lastUsedAt: typeof rawLastUsed === 'number' && Number.isFinite(rawLastUsed)
|
|
463
|
+
? rawLastUsed
|
|
464
|
+
: Date.now(),
|
|
465
|
+
metadata: rec.metadata && typeof rec.metadata === 'object'
|
|
466
|
+
? rec.metadata
|
|
467
|
+
: undefined,
|
|
457
468
|
};
|
|
458
469
|
this.patterns.set(id, stored);
|
|
459
470
|
this.patternList.push(stored);
|
|
@@ -537,7 +548,7 @@ class LocalReasoningBank {
|
|
|
537
548
|
...pattern,
|
|
538
549
|
usageCount: pattern.usageCount ?? 0,
|
|
539
550
|
createdAt: pattern.createdAt ?? now,
|
|
540
|
-
lastUsedAt: pattern.lastUsedAt ?? now
|
|
551
|
+
lastUsedAt: pattern.lastUsedAt ?? now,
|
|
541
552
|
};
|
|
542
553
|
// Update or insert
|
|
543
554
|
if (this.patterns.has(pattern.id)) {
|
|
@@ -577,9 +588,7 @@ class LocalReasoningBank {
|
|
|
577
588
|
findSimilar(queryEmbedding, options) {
|
|
578
589
|
const { k = 5, threshold = 0.5, type } = options;
|
|
579
590
|
// Filter by type if specified
|
|
580
|
-
const candidates = type
|
|
581
|
-
? this.patternList.filter(p => p.type === type)
|
|
582
|
-
: this.patternList;
|
|
591
|
+
const candidates = type ? this.patternList.filter((p) => p.type === type) : this.patternList;
|
|
583
592
|
// Compute similarities without mutating patterns
|
|
584
593
|
const scored = [];
|
|
585
594
|
for (const pattern of candidates) {
|
|
@@ -590,7 +599,7 @@ class LocalReasoningBank {
|
|
|
590
599
|
}
|
|
591
600
|
// Sort descending and slice, returning snapshot copies with confidence=score
|
|
592
601
|
scored.sort((a, b) => b.score - a.score);
|
|
593
|
-
return scored.slice(0, k).map(s => ({ ...s.pattern, confidence: s.score }));
|
|
602
|
+
return scored.slice(0, k).map((s) => ({ ...s.pattern, confidence: s.score }));
|
|
594
603
|
}
|
|
595
604
|
/**
|
|
596
605
|
* Record that a pattern was used, updating its usage metrics and scheduling
|
|
@@ -618,7 +627,7 @@ class LocalReasoningBank {
|
|
|
618
627
|
stats() {
|
|
619
628
|
return {
|
|
620
629
|
size: this.patterns.size,
|
|
621
|
-
patternCount: this.patternList.length
|
|
630
|
+
patternCount: this.patternList.length,
|
|
622
631
|
};
|
|
623
632
|
}
|
|
624
633
|
/**
|
|
@@ -637,7 +646,7 @@ class LocalReasoningBank {
|
|
|
637
646
|
* Get patterns by type
|
|
638
647
|
*/
|
|
639
648
|
getByType(type) {
|
|
640
|
-
return this.patternList.filter(p => p.type === type);
|
|
649
|
+
return this.patternList.filter((p) => p.type === type);
|
|
641
650
|
}
|
|
642
651
|
/**
|
|
643
652
|
* Delete a pattern by ID
|
|
@@ -647,7 +656,7 @@ class LocalReasoningBank {
|
|
|
647
656
|
if (!pattern)
|
|
648
657
|
return false;
|
|
649
658
|
this.patterns.delete(id);
|
|
650
|
-
const idx = this.patternList.findIndex(p => p.id === id);
|
|
659
|
+
const idx = this.patternList.findIndex((p) => p.id === id);
|
|
651
660
|
if (idx >= 0) {
|
|
652
661
|
this.patternList.splice(idx, 1);
|
|
653
662
|
}
|
|
@@ -672,7 +681,7 @@ let intelligenceInitialized = false;
|
|
|
672
681
|
let initPromise = null;
|
|
673
682
|
let globalStats = {
|
|
674
683
|
trajectoriesRecorded: 0,
|
|
675
|
-
lastAdaptation: null
|
|
684
|
+
lastAdaptation: null,
|
|
676
685
|
};
|
|
677
686
|
// ============================================================================
|
|
678
687
|
// Stats Persistence
|
|
@@ -724,14 +733,14 @@ async function _doInitializeIntelligence(config) {
|
|
|
724
733
|
// Merge config with defaults
|
|
725
734
|
const finalConfig = {
|
|
726
735
|
...DEFAULT_SONA_CONFIG,
|
|
727
|
-
...config
|
|
736
|
+
...config,
|
|
728
737
|
};
|
|
729
738
|
// Initialize local SONA (optimized for <0.05ms)
|
|
730
739
|
sonaCoordinator = new LocalSonaCoordinator(finalConfig);
|
|
731
740
|
// Initialize local ReasoningBank with persistence enabled
|
|
732
741
|
reasoningBank = new LocalReasoningBank({
|
|
733
742
|
maxSize: finalConfig.maxPatterns,
|
|
734
|
-
persistence: true
|
|
743
|
+
persistence: true,
|
|
735
744
|
});
|
|
736
745
|
// Load persisted stats if available
|
|
737
746
|
loadPersistedStats();
|
|
@@ -740,7 +749,9 @@ async function _doInitializeIntelligence(config) {
|
|
|
740
749
|
const neuralPatternsPath = join(getDataDir(), 'patterns.json');
|
|
741
750
|
if (existsSync(neuralPatternsPath) && statSync(neuralPatternsPath).size <= 50 * 1024 * 1024) {
|
|
742
751
|
try {
|
|
743
|
-
const { generateEmbedding: genEmb } = await import('./memory-initializer.js').catch(() => ({
|
|
752
|
+
const { generateEmbedding: genEmb } = await import('./memory-initializer.js').catch(() => ({
|
|
753
|
+
generateEmbedding: null,
|
|
754
|
+
}));
|
|
744
755
|
const raw = readFileSync(neuralPatternsPath, 'utf-8');
|
|
745
756
|
const entries = JSON.parse(raw);
|
|
746
757
|
if (Array.isArray(entries)) {
|
|
@@ -753,17 +764,19 @@ async function _doInitializeIntelligence(config) {
|
|
|
753
764
|
const conf = p.confidence ?? 0.5;
|
|
754
765
|
if (!Number.isFinite(conf) || conf < 0 || conf > 1)
|
|
755
766
|
continue;
|
|
756
|
-
const embedding =
|
|
767
|
+
const embedding = p.embedding && Array.isArray(p.embedding) && p.embedding.length > 0
|
|
757
768
|
? p.embedding
|
|
758
|
-
:
|
|
769
|
+
: genEmb
|
|
770
|
+
? ((await genEmb(p.content))?.embedding ?? [])
|
|
771
|
+
: [];
|
|
759
772
|
if (embedding.some((v) => !Number.isFinite(v)))
|
|
760
773
|
continue;
|
|
761
774
|
// Only store if not already present, or if we now have an embedding
|
|
762
775
|
// where the existing entry has none — avoids inflating usageCount on
|
|
763
776
|
// every cold-start re-seed.
|
|
764
|
-
const existing = reasoningBank
|
|
777
|
+
const existing = reasoningBank?.get(p.id);
|
|
765
778
|
if (!existing || (existing.embedding.length === 0 && embedding.length > 0)) {
|
|
766
|
-
reasoningBank
|
|
779
|
+
reasoningBank?.store({
|
|
767
780
|
id: p.id,
|
|
768
781
|
type: p.type ?? 'general',
|
|
769
782
|
content: p.content,
|
|
@@ -773,7 +786,9 @@ async function _doInitializeIntelligence(config) {
|
|
|
773
786
|
});
|
|
774
787
|
}
|
|
775
788
|
}
|
|
776
|
-
catch {
|
|
789
|
+
catch {
|
|
790
|
+
/* skip invalid entries */
|
|
791
|
+
}
|
|
777
792
|
}
|
|
778
793
|
}
|
|
779
794
|
}
|
|
@@ -788,8 +803,11 @@ async function _doInitializeIntelligence(config) {
|
|
|
788
803
|
// similarity search alongside neural patterns.
|
|
789
804
|
const sonaRouting = loadSonaRoutingPatterns();
|
|
790
805
|
if (sonaRouting.length > 0) {
|
|
791
|
-
const { generateEmbedding } = await import('./memory-initializer.js').catch(() => ({
|
|
792
|
-
|
|
806
|
+
const { generateEmbedding } = await import('./memory-initializer.js').catch(() => ({
|
|
807
|
+
generateEmbedding: null,
|
|
808
|
+
}));
|
|
809
|
+
for (const p of sonaRouting.slice(0, 100)) {
|
|
810
|
+
// cap seeding to 100 entries
|
|
793
811
|
try {
|
|
794
812
|
// M2: validate before seeding — malformed sona-patterns.json must not corrupt bank
|
|
795
813
|
if (!p.id || typeof p.id !== 'string' || p.id.length > 512)
|
|
@@ -803,7 +821,7 @@ async function _doInitializeIntelligence(config) {
|
|
|
803
821
|
// Reject NaN/Infinity in embedding
|
|
804
822
|
if (embedding.some((v) => !Number.isFinite(v)))
|
|
805
823
|
continue;
|
|
806
|
-
reasoningBank
|
|
824
|
+
reasoningBank?.store({
|
|
807
825
|
id: p.id,
|
|
808
826
|
type: p.type,
|
|
809
827
|
content: p.content,
|
|
@@ -812,14 +830,16 @@ async function _doInitializeIntelligence(config) {
|
|
|
812
830
|
usageCount: p.usageCount,
|
|
813
831
|
});
|
|
814
832
|
}
|
|
815
|
-
catch {
|
|
833
|
+
catch {
|
|
834
|
+
/* skip unembeddable entries */
|
|
835
|
+
}
|
|
816
836
|
}
|
|
817
837
|
}
|
|
818
838
|
intelligenceInitialized = true;
|
|
819
839
|
return {
|
|
820
840
|
success: true,
|
|
821
841
|
sonaEnabled: true,
|
|
822
|
-
reasoningBankEnabled: true
|
|
842
|
+
reasoningBankEnabled: true,
|
|
823
843
|
};
|
|
824
844
|
}
|
|
825
845
|
catch (error) {
|
|
@@ -827,7 +847,7 @@ async function _doInitializeIntelligence(config) {
|
|
|
827
847
|
success: false,
|
|
828
848
|
sonaEnabled: false,
|
|
829
849
|
reasoningBankEnabled: false,
|
|
830
|
-
error: error instanceof Error ? error.message : String(error)
|
|
850
|
+
error: error instanceof Error ? error.message : String(error),
|
|
831
851
|
};
|
|
832
852
|
}
|
|
833
853
|
}
|
|
@@ -876,16 +896,16 @@ export async function recordStep(step) {
|
|
|
876
896
|
}
|
|
877
897
|
}
|
|
878
898
|
// Record in SONA - <0.05ms
|
|
879
|
-
sonaCoordinator
|
|
899
|
+
sonaCoordinator?.recordSignal({
|
|
880
900
|
type: step.type,
|
|
881
901
|
content: step.content,
|
|
882
902
|
embedding,
|
|
883
903
|
metadata: step.metadata,
|
|
884
|
-
timestamp: step.timestamp || Date.now()
|
|
904
|
+
timestamp: step.timestamp || Date.now(),
|
|
885
905
|
});
|
|
886
906
|
// Add to current trajectory for outcome tracking
|
|
887
907
|
const stepWithEmbedding = { ...step, embedding };
|
|
888
|
-
sonaCoordinator
|
|
908
|
+
sonaCoordinator?.addTrajectoryStep(stepWithEmbedding);
|
|
889
909
|
// Store in ReasoningBank for retrieval
|
|
890
910
|
if (reasoningBank) {
|
|
891
911
|
reasoningBank.store({
|
|
@@ -894,16 +914,16 @@ export async function recordStep(step) {
|
|
|
894
914
|
embedding,
|
|
895
915
|
content: step.content,
|
|
896
916
|
confidence: 1.0,
|
|
897
|
-
metadata: step.metadata
|
|
917
|
+
metadata: step.metadata,
|
|
898
918
|
});
|
|
899
919
|
}
|
|
900
920
|
// When a 'result' step arrives, end the trajectory and run the confidence-update loop
|
|
901
921
|
if (step.type === 'result' && reasoningBank) {
|
|
902
922
|
// Determine verdict from metadata or default to 'partial'
|
|
903
923
|
const verdict = step.metadata?.verdict || 'partial';
|
|
904
|
-
await sonaCoordinator
|
|
924
|
+
await sonaCoordinator?.endTrajectory(verdict, reasoningBank);
|
|
905
925
|
// Distill learning from recent successful trajectories
|
|
906
|
-
await sonaCoordinator
|
|
926
|
+
await sonaCoordinator?.distillLearning(reasoningBank);
|
|
907
927
|
globalStats.lastAdaptation = Date.now();
|
|
908
928
|
}
|
|
909
929
|
globalStats.trajectoriesRecorded++;
|
|
@@ -925,19 +945,19 @@ export async function recordTrajectory(steps, verdict) {
|
|
|
925
945
|
return false;
|
|
926
946
|
}
|
|
927
947
|
try {
|
|
928
|
-
sonaCoordinator
|
|
948
|
+
sonaCoordinator?.recordTrajectory({
|
|
929
949
|
steps,
|
|
930
950
|
verdict,
|
|
931
|
-
timestamp: Date.now()
|
|
951
|
+
timestamp: Date.now(),
|
|
932
952
|
});
|
|
933
953
|
// Update pattern confidences based on verdict
|
|
934
954
|
if (reasoningBank) {
|
|
935
955
|
// Load steps into the coordinator for endTrajectory processing
|
|
936
956
|
for (const step of steps) {
|
|
937
|
-
sonaCoordinator
|
|
957
|
+
sonaCoordinator?.addTrajectoryStep(step);
|
|
938
958
|
}
|
|
939
|
-
await sonaCoordinator
|
|
940
|
-
await sonaCoordinator
|
|
959
|
+
await sonaCoordinator?.endTrajectory(verdict, reasoningBank);
|
|
960
|
+
await sonaCoordinator?.distillLearning(reasoningBank);
|
|
941
961
|
}
|
|
942
962
|
globalStats.trajectoriesRecorded++;
|
|
943
963
|
globalStats.lastAdaptation = Date.now();
|
|
@@ -982,14 +1002,14 @@ export async function findSimilarPatterns(query, options) {
|
|
|
982
1002
|
// than ONNX/transformer embeddings, so use a lower default threshold
|
|
983
1003
|
const isHashFallback = queryEmbedding.length === 128;
|
|
984
1004
|
const defaultThreshold = isHashFallback ? 0.1 : 0.5;
|
|
985
|
-
const results = reasoningBank
|
|
1005
|
+
const results = reasoningBank?.findSimilar(queryEmbedding, {
|
|
986
1006
|
k: options?.k ?? 5,
|
|
987
1007
|
threshold: options?.threshold ?? defaultThreshold,
|
|
988
|
-
type: options?.type
|
|
1008
|
+
type: options?.type,
|
|
989
1009
|
});
|
|
990
1010
|
// Record usage for each matched pattern (findSimilar is now a pure read)
|
|
991
1011
|
for (const r of results) {
|
|
992
|
-
reasoningBank
|
|
1012
|
+
reasoningBank?.recordUsage(r.id);
|
|
993
1013
|
}
|
|
994
1014
|
return results.map((r) => ({
|
|
995
1015
|
id: r.id,
|
|
@@ -1000,7 +1020,7 @@ export async function findSimilarPatterns(query, options) {
|
|
|
1000
1020
|
usageCount: r.usageCount,
|
|
1001
1021
|
createdAt: r.createdAt,
|
|
1002
1022
|
lastUsedAt: r.lastUsedAt,
|
|
1003
|
-
similarity: r.similarity ?? r.confidence ?? 0.5
|
|
1023
|
+
similarity: r.similarity ?? r.confidence ?? 0.5,
|
|
1004
1024
|
}));
|
|
1005
1025
|
}
|
|
1006
1026
|
catch (e) {
|
|
@@ -1021,7 +1041,7 @@ export function getIntelligenceStats() {
|
|
|
1021
1041
|
patternsLearned: bankStats?.patternCount ?? 0,
|
|
1022
1042
|
trajectoriesRecorded: globalStats.trajectoriesRecorded,
|
|
1023
1043
|
lastAdaptation: globalStats.lastAdaptation,
|
|
1024
|
-
avgAdaptationTime: sonaStats?.avgAdaptationMs ?? 0
|
|
1044
|
+
avgAdaptationTime: sonaStats?.avgAdaptationMs ?? 0,
|
|
1025
1045
|
};
|
|
1026
1046
|
}
|
|
1027
1047
|
/**
|
|
@@ -1050,7 +1070,7 @@ export async function endTrajectoryWithVerdict(verdict) {
|
|
|
1050
1070
|
return null;
|
|
1051
1071
|
}
|
|
1052
1072
|
try {
|
|
1053
|
-
const result = await sonaCoordinator
|
|
1073
|
+
const result = await sonaCoordinator?.endTrajectory(verdict, reasoningBank);
|
|
1054
1074
|
globalStats.lastAdaptation = Date.now();
|
|
1055
1075
|
savePersistedStats();
|
|
1056
1076
|
return result;
|
|
@@ -1074,7 +1094,7 @@ export async function distillLearning() {
|
|
|
1074
1094
|
return null;
|
|
1075
1095
|
}
|
|
1076
1096
|
try {
|
|
1077
|
-
const result = await sonaCoordinator
|
|
1097
|
+
const result = await sonaCoordinator?.distillLearning(reasoningBank);
|
|
1078
1098
|
globalStats.lastAdaptation = Date.now();
|
|
1079
1099
|
savePersistedStats();
|
|
1080
1100
|
return result;
|
|
@@ -1102,7 +1122,7 @@ export function clearIntelligence() {
|
|
|
1102
1122
|
initPromise = null;
|
|
1103
1123
|
globalStats = {
|
|
1104
1124
|
trajectoriesRecorded: 0,
|
|
1105
|
-
lastAdaptation: null
|
|
1125
|
+
lastAdaptation: null,
|
|
1106
1126
|
};
|
|
1107
1127
|
}
|
|
1108
1128
|
/**
|
|
@@ -1122,7 +1142,7 @@ export function benchmarkAdaptation(iterations = 1000) {
|
|
|
1122
1142
|
type: 'test',
|
|
1123
1143
|
content: `benchmark_${i}`,
|
|
1124
1144
|
embedding: testEmbedding,
|
|
1125
|
-
timestamp: Date.now()
|
|
1145
|
+
timestamp: Date.now(),
|
|
1126
1146
|
});
|
|
1127
1147
|
times.push(performance.now() - start);
|
|
1128
1148
|
}
|
|
@@ -1135,7 +1155,7 @@ export function benchmarkAdaptation(iterations = 1000) {
|
|
|
1135
1155
|
avgMs,
|
|
1136
1156
|
minMs,
|
|
1137
1157
|
maxMs,
|
|
1138
|
-
targetMet: avgMs < 0.05
|
|
1158
|
+
targetMet: avgMs < 0.05,
|
|
1139
1159
|
};
|
|
1140
1160
|
}
|
|
1141
1161
|
// ============================================================================
|
|
@@ -1155,13 +1175,15 @@ function loadSonaRoutingPatterns() {
|
|
|
1155
1175
|
return [];
|
|
1156
1176
|
const raw = JSON.parse(readFileSync(sonaPath, 'utf-8'));
|
|
1157
1177
|
const persisted = raw;
|
|
1158
|
-
if (!persisted.patterns ||
|
|
1178
|
+
if (!persisted.patterns ||
|
|
1179
|
+
typeof persisted.patterns !== 'object' ||
|
|
1180
|
+
Array.isArray(persisted.patterns))
|
|
1159
1181
|
return [];
|
|
1160
1182
|
const now = Date.now();
|
|
1161
1183
|
const results = [];
|
|
1162
1184
|
// Cap total entries to prevent DoS via an unbounded patterns map.
|
|
1163
1185
|
// sona-patterns.json is written by the SONA optimizer but could be
|
|
1164
|
-
// replaced
|
|
1186
|
+
// replaced or hand-edited outside the process — validate every field before use.
|
|
1165
1187
|
const MAX_SONA_ENTRIES = 500;
|
|
1166
1188
|
let entryCount = 0;
|
|
1167
1189
|
for (const [key, p] of Object.entries(persisted.patterns)) {
|
|
@@ -1180,8 +1202,9 @@ function loadSonaRoutingPatterns() {
|
|
|
1180
1202
|
if (rawKw === undefined) {
|
|
1181
1203
|
keywords = [key];
|
|
1182
1204
|
}
|
|
1183
|
-
else if (Array.isArray(rawKw) &&
|
|
1184
|
-
|
|
1205
|
+
else if (Array.isArray(rawKw) &&
|
|
1206
|
+
rawKw.length <= 64 &&
|
|
1207
|
+
rawKw.every((k) => typeof k === 'string' && k.length > 0 && k.length <= 128)) {
|
|
1185
1208
|
keywords = rawKw;
|
|
1186
1209
|
}
|
|
1187
1210
|
else {
|
|
@@ -1189,12 +1212,16 @@ function loadSonaRoutingPatterns() {
|
|
|
1189
1212
|
}
|
|
1190
1213
|
// Validate agent string.
|
|
1191
1214
|
const agent = p.agent;
|
|
1192
|
-
if (agent !== undefined &&
|
|
1215
|
+
if (agent !== undefined &&
|
|
1216
|
+
(typeof agent !== 'string' || agent.length === 0 || agent.length > 128))
|
|
1193
1217
|
continue;
|
|
1194
1218
|
// Validate confidence is a finite number in [0, 1].
|
|
1195
1219
|
const rawConf = p.confidence;
|
|
1196
1220
|
const confidence = rawConf !== undefined ? rawConf : 0.5;
|
|
1197
|
-
if (typeof confidence !== 'number' ||
|
|
1221
|
+
if (typeof confidence !== 'number' ||
|
|
1222
|
+
!Number.isFinite(confidence) ||
|
|
1223
|
+
confidence < 0 ||
|
|
1224
|
+
confidence > 1)
|
|
1198
1225
|
continue;
|
|
1199
1226
|
// Validate usage counts are safe integers.
|
|
1200
1227
|
const sc = p.successCount ?? 0;
|
|
@@ -1205,7 +1232,11 @@ function loadSonaRoutingPatterns() {
|
|
|
1205
1232
|
continue;
|
|
1206
1233
|
// Validate createdAt is a reasonable epoch ms value.
|
|
1207
1234
|
const rawTs = p.createdAt;
|
|
1208
|
-
const createdAt =
|
|
1235
|
+
const createdAt = rawTs !== undefined &&
|
|
1236
|
+
typeof rawTs === 'number' &&
|
|
1237
|
+
Number.isFinite(rawTs) &&
|
|
1238
|
+
rawTs >= 0 &&
|
|
1239
|
+
rawTs <= 9.9e12
|
|
1209
1240
|
? rawTs
|
|
1210
1241
|
: now;
|
|
1211
1242
|
results.push({
|
|
@@ -1237,7 +1268,7 @@ export async function getAllPatterns() {
|
|
|
1237
1268
|
if (!init.success)
|
|
1238
1269
|
return [];
|
|
1239
1270
|
}
|
|
1240
|
-
const bankPatterns = reasoningBank
|
|
1271
|
+
const bankPatterns = reasoningBank?.getAll().map((p) => ({
|
|
1241
1272
|
id: p.id,
|
|
1242
1273
|
type: p.type,
|
|
1243
1274
|
embedding: p.embedding,
|
|
@@ -1245,12 +1276,12 @@ export async function getAllPatterns() {
|
|
|
1245
1276
|
confidence: p.confidence,
|
|
1246
1277
|
usageCount: p.usageCount,
|
|
1247
1278
|
createdAt: p.createdAt,
|
|
1248
|
-
lastUsedAt: p.lastUsedAt
|
|
1279
|
+
lastUsedAt: p.lastUsedAt,
|
|
1249
1280
|
}));
|
|
1250
1281
|
// Merge in SONA routing patterns so `neural patterns list` shows what
|
|
1251
1282
|
// the hooks SONA optimizer has learned, not just ReasoningBank entries.
|
|
1252
|
-
const bankIds = new Set(bankPatterns.map(p => p.id));
|
|
1253
|
-
const sonaPatterns = loadSonaRoutingPatterns().filter(p => !bankIds.has(p.id));
|
|
1283
|
+
const bankIds = new Set(bankPatterns.map((p) => p.id));
|
|
1284
|
+
const sonaPatterns = loadSonaRoutingPatterns().filter((p) => !bankIds.has(p.id));
|
|
1254
1285
|
return [...bankPatterns, ...sonaPatterns];
|
|
1255
1286
|
}
|
|
1256
1287
|
/**
|
|
@@ -1262,7 +1293,7 @@ export async function getPatternsByType(type) {
|
|
|
1262
1293
|
if (!init.success)
|
|
1263
1294
|
return [];
|
|
1264
1295
|
}
|
|
1265
|
-
return reasoningBank
|
|
1296
|
+
return reasoningBank?.getByType(type).map((p) => ({
|
|
1266
1297
|
id: p.id,
|
|
1267
1298
|
type: p.type,
|
|
1268
1299
|
embedding: p.embedding,
|
|
@@ -1270,7 +1301,7 @@ export async function getPatternsByType(type) {
|
|
|
1270
1301
|
confidence: p.confidence,
|
|
1271
1302
|
usageCount: p.usageCount,
|
|
1272
1303
|
createdAt: p.createdAt,
|
|
1273
|
-
lastUsedAt: p.lastUsedAt
|
|
1304
|
+
lastUsedAt: p.lastUsedAt,
|
|
1274
1305
|
}));
|
|
1275
1306
|
}
|
|
1276
1307
|
/**
|
|
@@ -1294,7 +1325,7 @@ export async function compactPatterns(threshold = 0.95) {
|
|
|
1294
1325
|
return { before: 0, after: 0, removed: 0 };
|
|
1295
1326
|
}
|
|
1296
1327
|
}
|
|
1297
|
-
const patterns = reasoningBank
|
|
1328
|
+
const patterns = reasoningBank?.getAll();
|
|
1298
1329
|
const before = patterns.length;
|
|
1299
1330
|
// Find duplicates using cosine similarity
|
|
1300
1331
|
const toRemove = new Set();
|
|
@@ -1330,7 +1361,7 @@ export async function compactPatterns(threshold = 0.95) {
|
|
|
1330
1361
|
}
|
|
1331
1362
|
// Remove duplicates
|
|
1332
1363
|
for (const id of toRemove) {
|
|
1333
|
-
reasoningBank
|
|
1364
|
+
reasoningBank?.delete(id);
|
|
1334
1365
|
}
|
|
1335
1366
|
// Flush to disk
|
|
1336
1367
|
flushPatterns();
|
|
@@ -1349,7 +1380,7 @@ export async function deletePattern(id) {
|
|
|
1349
1380
|
if (!init.success)
|
|
1350
1381
|
return false;
|
|
1351
1382
|
}
|
|
1352
|
-
return reasoningBank
|
|
1383
|
+
return reasoningBank?.delete(id);
|
|
1353
1384
|
}
|
|
1354
1385
|
/**
|
|
1355
1386
|
* Clear all patterns (both in memory and on disk)
|
|
@@ -1360,7 +1391,7 @@ export async function clearAllPatterns() {
|
|
|
1360
1391
|
if (!init.success)
|
|
1361
1392
|
return;
|
|
1362
1393
|
}
|
|
1363
|
-
reasoningBank
|
|
1394
|
+
reasoningBank?.clear();
|
|
1364
1395
|
}
|
|
1365
1396
|
const memoryProficiencyStats = {
|
|
1366
1397
|
totalDecisions: 0,
|
|
@@ -1391,20 +1422,26 @@ export async function recordMemoryDecision(input) {
|
|
|
1391
1422
|
if (result)
|
|
1392
1423
|
embedding = result.embedding;
|
|
1393
1424
|
}
|
|
1394
|
-
catch {
|
|
1425
|
+
catch {
|
|
1426
|
+
/* bridge unavailable */
|
|
1427
|
+
}
|
|
1395
1428
|
if (!embedding) {
|
|
1396
1429
|
const { generateEmbedding } = await import('./memory-initializer.js');
|
|
1397
1430
|
embedding = (await generateEmbedding(input.taskDescription)).embedding;
|
|
1398
1431
|
}
|
|
1399
1432
|
// Check for similar existing pattern to avoid redundant storage
|
|
1400
|
-
const existing = reasoningBank
|
|
1433
|
+
const existing = reasoningBank?.findSimilar(embedding, {
|
|
1434
|
+
k: 1,
|
|
1435
|
+
threshold: 0.85,
|
|
1436
|
+
type: 'memory-proficiency',
|
|
1437
|
+
});
|
|
1401
1438
|
if (existing.length > 0) {
|
|
1402
|
-
reasoningBank
|
|
1439
|
+
reasoningBank?.recordUsage(existing[0].id);
|
|
1403
1440
|
memoryProficiencyStats.patternHits++;
|
|
1404
1441
|
return;
|
|
1405
1442
|
}
|
|
1406
1443
|
memoryProficiencyStats.patternMisses++;
|
|
1407
|
-
reasoningBank
|
|
1444
|
+
reasoningBank?.store({
|
|
1408
1445
|
id: `mprof_${Date.now()}_${Math.random().toString(36).substring(2, 7)}`,
|
|
1409
1446
|
type: 'memory-proficiency',
|
|
1410
1447
|
embedding,
|
|
@@ -1416,7 +1453,9 @@ export async function recordMemoryDecision(input) {
|
|
|
1416
1453
|
},
|
|
1417
1454
|
});
|
|
1418
1455
|
}
|
|
1419
|
-
catch {
|
|
1456
|
+
catch {
|
|
1457
|
+
/* non-fatal */
|
|
1458
|
+
}
|
|
1420
1459
|
}
|
|
1421
1460
|
/**
|
|
1422
1461
|
* Return memory proficiency stats for doctor health check.
|
|
@@ -1451,7 +1490,7 @@ export function getPersistenceStatus() {
|
|
|
1451
1490
|
patternsFile,
|
|
1452
1491
|
statsFile,
|
|
1453
1492
|
patternsExist: existsSync(patternsFile),
|
|
1454
|
-
statsExist: existsSync(statsFile)
|
|
1493
|
+
statsExist: existsSync(statsFile),
|
|
1455
1494
|
};
|
|
1456
1495
|
}
|
|
1457
1496
|
//# sourceMappingURL=intelligence.js.map
|