monomind 1.11.8 → 1.11.10
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/github/issue-tracker.md +5 -5
- package/.claude/agents/github/pr-manager.md +5 -5
- package/.claude/agents/github/release-manager.md +3 -3
- package/.claude/agents/github/repo-architect.md +3 -3
- package/.claude/agents/github/swarm-issue.md +1 -1
- package/.claude/agents/github/sync-coordinator.md +1 -1
- package/.claude/agents/github/workflow-automation.md +1 -1
- package/.claude/commands/github/repo-architect.md +1 -1
- package/.claude/commands/github/sync-coordinator.md +1 -1
- package/.claude/commands/mastermind/createorg.md +4 -1
- package/.claude/commands/mastermind/help.md +2 -2
- package/.claude/commands/mastermind/orgs.md +21 -0
- package/.claude/commands/mastermind/orgstatus.md +59 -0
- package/.claude/commands/mastermind/runorg.md +4 -2
- package/.claude/commands/mastermind/stoporg.md +78 -0
- package/.claude/commands/mastermind/swarm.md +1 -1
- package/.claude/helpers/handlers/gates-handler.cjs +135 -0
- package/.claude/helpers/handlers/task-handler.cjs +7 -3
- package/.claude/helpers/hook-handler.cjs +11 -2
- package/.claude/helpers/intelligence.cjs +87 -0
- package/.claude/helpers/learning-service.mjs +60 -0
- package/.claude/helpers/memory.cjs +69 -0
- package/.claude/helpers/router.cjs +68 -0
- package/.claude/helpers/session.cjs +63 -0
- package/.claude/helpers/utils/monograph.cjs +4 -2
- package/.claude/helpers/utils/telemetry.cjs +3 -2
- package/.claude/scheduled_tasks.lock +1 -1
- package/.claude/settings.json +12 -2
- package/.claude/skills/agentic-jujutsu/SKILL.md +1 -1
- package/.claude/skills/hive-mind-advanced/SKILL.md +4 -4
- package/.claude/skills/mastermind/_agent-select.md +2 -2
- package/.claude/skills/mastermind/access.md +11 -11
- package/.claude/skills/mastermind/adapter-manager.md +13 -13
- package/.claude/skills/mastermind/adapters.md +7 -7
- package/.claude/skills/mastermind/agent-detail.md +1 -1
- package/.claude/skills/mastermind/agents.md +5 -5
- package/.claude/skills/mastermind/approval-detail.md +6 -6
- package/.claude/skills/mastermind/approve.md +9 -10
- package/.claude/skills/mastermind/backup.md +2 -2
- package/.claude/skills/mastermind/bootstrap.md +2 -2
- package/.claude/skills/mastermind/companies.md +7 -7
- package/.claude/skills/mastermind/createorg.md +213 -8
- package/.claude/skills/mastermind/diagnose.md +4 -4
- package/.claude/skills/mastermind/env.md +1 -1
- package/.claude/skills/mastermind/environments.md +8 -8
- package/.claude/skills/mastermind/export.md +12 -3
- package/.claude/skills/mastermind/goal-detail.md +9 -9
- package/.claude/skills/mastermind/goals.md +4 -4
- package/.claude/skills/mastermind/heartbeat.md +1 -1
- package/.claude/skills/mastermind/idea.md +4 -4
- package/.claude/skills/mastermind/import.md +8 -8
- package/.claude/skills/mastermind/inbox.md +4 -4
- package/.claude/skills/mastermind/instance-settings.md +9 -9
- package/.claude/skills/mastermind/instance.md +9 -7
- package/.claude/skills/mastermind/invite-landing.md +5 -5
- package/.claude/skills/mastermind/invites.md +12 -12
- package/.claude/skills/mastermind/issue-detail.md +8 -8
- package/.claude/skills/mastermind/monitor.md +11 -11
- package/.claude/skills/mastermind/my-issues.md +6 -6
- package/.claude/skills/mastermind/new-agent.md +4 -4
- package/.claude/skills/mastermind/org-chart.md +8 -6
- package/.claude/skills/mastermind/org-settings.md +58 -21
- package/.claude/skills/mastermind/orgs.md +98 -0
- package/.claude/skills/mastermind/orgstatus.md +194 -0
- package/.claude/skills/mastermind/plan-to-tasks.md +1 -1
- package/.claude/skills/mastermind/plugin-manager.md +12 -12
- package/.claude/skills/mastermind/plugin-settings.md +5 -5
- package/.claude/skills/mastermind/plugins.md +5 -5
- package/.claude/skills/mastermind/profile.md +2 -2
- package/.claude/skills/mastermind/project-detail.md +12 -12
- package/.claude/skills/mastermind/project-workspace.md +4 -4
- package/.claude/skills/mastermind/projects.md +4 -4
- package/.claude/skills/mastermind/review.md +50 -0
- package/.claude/skills/mastermind/routine-detail.md +3 -3
- package/.claude/skills/mastermind/routines.md +7 -6
- package/.claude/skills/mastermind/runorg.md +178 -8
- package/.claude/skills/mastermind/search.md +6 -6
- package/.claude/skills/mastermind/secrets.md +6 -6
- package/.claude/skills/mastermind/skills.md +4 -4
- package/.claude/skills/mastermind/stoporg.md +138 -0
- package/.claude/skills/mastermind/workspace-detail.md +5 -5
- package/.claude/skills/mastermind/workspaces.md +9 -9
- package/.claude/skills/performance-analysis/SKILL.md +3 -3
- package/.claude/skills/sparc-methodology/SKILL.md +2 -2
- package/.claude/skills/swarm-advanced/SKILL.md +4 -4
- package/.claude-plugin/README.md +10 -10
- package/.claude-plugin/docs/INSTALLATION.md +6 -6
- package/.claude-plugin/docs/PLUGIN_SUMMARY.md +9 -9
- package/.claude-plugin/docs/QUICKSTART.md +2 -2
- package/.claude-plugin/docs/STRUCTURE.md +1 -1
- package/.claude-plugin/marketplace.json +5 -5
- package/.claude-plugin/plugin.json +3 -3
- package/README.md +129 -376
- package/package.json +4 -8
- package/packages/@monomind/cli/README.md +129 -376
- package/packages/@monomind/cli/dist/src/agents/registry-builder.d.ts +27 -1
- package/packages/@monomind/cli/dist/src/agents/registry-builder.js +2 -2
- package/packages/@monomind/cli/dist/src/commands/agent.js +4 -9
- package/packages/@monomind/cli/dist/src/commands/analyze.d.ts +1 -1
- package/packages/@monomind/cli/dist/src/commands/analyze.js +1 -1
- package/packages/@monomind/cli/dist/src/commands/claims.d.ts +1 -1
- package/packages/@monomind/cli/dist/src/commands/claims.js +2 -2
- package/packages/@monomind/cli/dist/src/commands/cleanup.d.ts +1 -1
- package/packages/@monomind/cli/dist/src/commands/cleanup.js +1 -1
- package/packages/@monomind/cli/dist/src/commands/completions.d.ts +1 -1
- package/packages/@monomind/cli/dist/src/commands/completions.js +1 -1
- package/packages/@monomind/cli/dist/src/commands/deployment.d.ts +1 -1
- package/packages/@monomind/cli/dist/src/commands/deployment.js +2 -2
- package/packages/@monomind/cli/dist/src/commands/doctor.d.ts +1 -1
- package/packages/@monomind/cli/dist/src/commands/doctor.js +69 -4
- package/packages/@monomind/cli/dist/src/commands/guidance.js +129 -0
- package/packages/@monomind/cli/dist/src/commands/index.js +4 -0
- package/packages/@monomind/cli/dist/src/commands/init.js +18 -0
- package/packages/@monomind/cli/dist/src/commands/monovector/import.d.ts +1 -1
- package/packages/@monomind/cli/dist/src/commands/monovector/import.js +1 -1
- package/packages/@monomind/cli/dist/src/commands/monovector/index.d.ts +1 -1
- package/packages/@monomind/cli/dist/src/commands/monovector/index.js +1 -1
- package/packages/@monomind/cli/dist/src/commands/monovector/setup.d.ts +1 -1
- package/packages/@monomind/cli/dist/src/commands/monovector/setup.js +2 -2
- package/packages/@monomind/cli/dist/src/commands/neural.d.ts +1 -1
- package/packages/@monomind/cli/dist/src/commands/neural.js +2 -2
- package/packages/@monomind/cli/dist/src/commands/performance.d.ts +1 -1
- package/packages/@monomind/cli/dist/src/commands/performance.js +2 -2
- package/packages/@monomind/cli/dist/src/commands/platforms.d.ts +1 -1
- package/packages/@monomind/cli/dist/src/commands/platforms.js +1 -1
- package/packages/@monomind/cli/dist/src/commands/plugins.d.ts +1 -1
- package/packages/@monomind/cli/dist/src/commands/plugins.js +2 -4
- package/packages/@monomind/cli/dist/src/commands/providers.d.ts +1 -1
- package/packages/@monomind/cli/dist/src/commands/providers.js +2 -2
- package/packages/@monomind/cli/dist/src/commands/route.d.ts +1 -1
- package/packages/@monomind/cli/dist/src/commands/route.js +5 -11
- package/packages/@monomind/cli/dist/src/commands/security.d.ts +1 -1
- package/packages/@monomind/cli/dist/src/commands/security.js +140 -91
- package/packages/@monomind/cli/dist/src/dlq/dlq-replayer.d.ts +7 -1
- package/packages/@monomind/cli/dist/src/index.d.ts +1 -1
- package/packages/@monomind/cli/dist/src/index.js +10 -26
- package/packages/@monomind/cli/dist/src/init/claudemd-generator.js +2 -2
- package/packages/@monomind/cli/dist/src/init/executor.js +3 -3
- package/packages/@monomind/cli/dist/src/init/settings-generator.js +2 -2
- package/packages/@monomind/cli/dist/src/mcp-client.d.ts +5 -0
- package/packages/@monomind/cli/dist/src/mcp-client.js +7 -0
- package/packages/@monomind/cli/dist/src/mcp-server.js +17 -1
- package/packages/@monomind/cli/dist/src/mcp-tools/a2a-tools.js +6 -6
- package/packages/@monomind/cli/dist/src/mcp-tools/auto-install.d.ts +2 -2
- package/packages/@monomind/cli/dist/src/mcp-tools/auto-install.js +1 -1
- package/packages/@monomind/cli/dist/src/mcp-tools/hive-mind-tools.js +1 -52
- package/packages/@monomind/cli/dist/src/mcp-tools/index.d.ts +4 -0
- package/packages/@monomind/cli/dist/src/mcp-tools/index.js +4 -0
- package/packages/@monomind/cli/dist/src/mcp-tools/monograph-compat.js +1 -2
- package/packages/@monomind/cli/dist/src/mcp-tools/monograph-tools.js +107 -5
- package/packages/@monomind/cli/dist/src/mcp-tools/security-tools.d.ts +6 -6
- package/packages/@monomind/cli/dist/src/mcp-tools/security-tools.js +48 -61
- package/packages/@monomind/cli/dist/src/memory/memory-bridge.d.ts +0 -1
- package/packages/@monomind/cli/dist/src/memory/memory-bridge.js +232 -57
- package/packages/@monomind/cli/dist/src/memory/memory-initializer.js +3 -32
- package/packages/@monomind/cli/dist/src/plugins/store/discovery.js +0 -69
- package/packages/@monomind/cli/dist/src/routing/embed-worker.d.ts +2 -0
- package/packages/@monomind/cli/dist/src/routing/embed-worker.js +55 -0
- package/packages/@monomind/cli/dist/src/routing/embedder.d.ts +31 -0
- package/packages/@monomind/cli/dist/src/routing/embedder.js +0 -0
- package/packages/@monomind/cli/dist/src/routing/llm-caller.d.ts +1 -1
- package/packages/@monomind/cli/dist/src/routing/llm-caller.js +18 -3
- package/packages/@monomind/cli/dist/src/routing/route-layer-factory.d.ts +9 -0
- package/packages/@monomind/cli/dist/src/routing/route-layer-factory.js +151 -0
- package/packages/@monomind/cli/dist/src/services/worker-daemon.js +0 -1
- package/packages/@monomind/cli/dist/src/suggest.d.ts +1 -1
- package/packages/@monomind/cli/dist/src/suggest.js +1 -1
- package/packages/@monomind/cli/package.json +9 -10
- package/packages/@monomind/cli/scripts/understand-analyze.mjs +1 -1
- package/packages/@monomind/guidance/README.md +6 -6
- package/packages/@monomind/guidance/package.json +9 -1
- package/scripts/install.sh +7 -7
- package/scripts/ua-enrich.mjs +3 -2
- package/packages/@monomind/shared/dist/agent-contract.d.ts +0 -28
- package/packages/@monomind/shared/dist/agent-contract.js +0 -57
- package/packages/@monomind/shared/dist/agent-error-result.d.ts +0 -17
- package/packages/@monomind/shared/dist/agent-error-result.js +0 -23
- package/packages/@monomind/shared/dist/core/config/defaults.d.ts +0 -41
- package/packages/@monomind/shared/dist/core/config/defaults.js +0 -186
- package/packages/@monomind/shared/dist/core/config/index.d.ts +0 -8
- package/packages/@monomind/shared/dist/core/config/index.js +0 -12
- package/packages/@monomind/shared/dist/core/config/loader.d.ts +0 -45
- package/packages/@monomind/shared/dist/core/config/loader.js +0 -238
- package/packages/@monomind/shared/dist/core/config/schema.d.ts +0 -324
- package/packages/@monomind/shared/dist/core/config/schema.js +0 -160
- package/packages/@monomind/shared/dist/core/config/validator.d.ts +0 -92
- package/packages/@monomind/shared/dist/core/config/validator.js +0 -147
- package/packages/@monomind/shared/dist/core/event-bus.d.ts +0 -31
- package/packages/@monomind/shared/dist/core/event-bus.js +0 -197
- package/packages/@monomind/shared/dist/core/index.d.ts +0 -15
- package/packages/@monomind/shared/dist/core/index.js +0 -19
- package/packages/@monomind/shared/dist/core/interfaces/agent.interface.d.ts +0 -200
- package/packages/@monomind/shared/dist/core/interfaces/agent.interface.js +0 -6
- package/packages/@monomind/shared/dist/core/interfaces/coordinator.interface.d.ts +0 -310
- package/packages/@monomind/shared/dist/core/interfaces/coordinator.interface.js +0 -7
- package/packages/@monomind/shared/dist/core/interfaces/event.interface.d.ts +0 -224
- package/packages/@monomind/shared/dist/core/interfaces/event.interface.js +0 -46
- package/packages/@monomind/shared/dist/core/interfaces/index.d.ts +0 -10
- package/packages/@monomind/shared/dist/core/interfaces/index.js +0 -15
- package/packages/@monomind/shared/dist/core/interfaces/memory.interface.d.ts +0 -298
- package/packages/@monomind/shared/dist/core/interfaces/memory.interface.js +0 -7
- package/packages/@monomind/shared/dist/core/interfaces/task.interface.d.ts +0 -185
- package/packages/@monomind/shared/dist/core/interfaces/task.interface.js +0 -6
- package/packages/@monomind/shared/dist/core/orchestrator/event-coordinator.d.ts +0 -35
- package/packages/@monomind/shared/dist/core/orchestrator/event-coordinator.js +0 -101
- package/packages/@monomind/shared/dist/core/orchestrator/health-monitor.d.ts +0 -60
- package/packages/@monomind/shared/dist/core/orchestrator/health-monitor.js +0 -166
- package/packages/@monomind/shared/dist/core/orchestrator/index.d.ts +0 -46
- package/packages/@monomind/shared/dist/core/orchestrator/index.js +0 -64
- package/packages/@monomind/shared/dist/core/orchestrator/lifecycle-manager.d.ts +0 -56
- package/packages/@monomind/shared/dist/core/orchestrator/lifecycle-manager.js +0 -195
- package/packages/@monomind/shared/dist/core/orchestrator/session-manager.d.ts +0 -83
- package/packages/@monomind/shared/dist/core/orchestrator/session-manager.js +0 -193
- package/packages/@monomind/shared/dist/core/orchestrator/task-manager.d.ts +0 -49
- package/packages/@monomind/shared/dist/core/orchestrator/task-manager.js +0 -253
- package/packages/@monomind/shared/dist/events/domain-events.d.ts +0 -282
- package/packages/@monomind/shared/dist/events/domain-events.js +0 -165
- package/packages/@monomind/shared/dist/events/event-store.d.ts +0 -126
- package/packages/@monomind/shared/dist/events/event-store.js +0 -416
- package/packages/@monomind/shared/dist/events/event-store.test.d.ts +0 -8
- package/packages/@monomind/shared/dist/events/event-store.test.js +0 -293
- package/packages/@monomind/shared/dist/events/example-usage.d.ts +0 -10
- package/packages/@monomind/shared/dist/events/example-usage.js +0 -193
- package/packages/@monomind/shared/dist/events/index.d.ts +0 -21
- package/packages/@monomind/shared/dist/events/index.js +0 -22
- package/packages/@monomind/shared/dist/events/projections.d.ts +0 -177
- package/packages/@monomind/shared/dist/events/projections.js +0 -421
- package/packages/@monomind/shared/dist/events/rvf-event-log.d.ts +0 -82
- package/packages/@monomind/shared/dist/events/rvf-event-log.js +0 -340
- package/packages/@monomind/shared/dist/events/state-reconstructor.d.ts +0 -101
- package/packages/@monomind/shared/dist/events/state-reconstructor.js +0 -263
- package/packages/@monomind/shared/dist/events.d.ts +0 -80
- package/packages/@monomind/shared/dist/events.js +0 -249
- package/packages/@monomind/shared/dist/hooks/example-usage.d.ts +0 -42
- package/packages/@monomind/shared/dist/hooks/example-usage.js +0 -351
- package/packages/@monomind/shared/dist/hooks/executor.d.ts +0 -100
- package/packages/@monomind/shared/dist/hooks/executor.js +0 -264
- package/packages/@monomind/shared/dist/hooks/hooks.test.d.ts +0 -9
- package/packages/@monomind/shared/dist/hooks/hooks.test.js +0 -322
- package/packages/@monomind/shared/dist/hooks/index.d.ts +0 -52
- package/packages/@monomind/shared/dist/hooks/index.js +0 -51
- package/packages/@monomind/shared/dist/hooks/registry.d.ts +0 -133
- package/packages/@monomind/shared/dist/hooks/registry.js +0 -277
- package/packages/@monomind/shared/dist/hooks/safety/bash-safety.d.ts +0 -105
- package/packages/@monomind/shared/dist/hooks/safety/bash-safety.js +0 -481
- package/packages/@monomind/shared/dist/hooks/safety/file-organization.d.ts +0 -144
- package/packages/@monomind/shared/dist/hooks/safety/file-organization.js +0 -328
- package/packages/@monomind/shared/dist/hooks/safety/git-commit.d.ts +0 -158
- package/packages/@monomind/shared/dist/hooks/safety/git-commit.js +0 -450
- package/packages/@monomind/shared/dist/hooks/safety/index.d.ts +0 -17
- package/packages/@monomind/shared/dist/hooks/safety/index.js +0 -17
- package/packages/@monomind/shared/dist/hooks/session-hooks.d.ts +0 -234
- package/packages/@monomind/shared/dist/hooks/session-hooks.js +0 -334
- package/packages/@monomind/shared/dist/hooks/task-hooks.d.ts +0 -163
- package/packages/@monomind/shared/dist/hooks/task-hooks.js +0 -326
- package/packages/@monomind/shared/dist/hooks/types.d.ts +0 -267
- package/packages/@monomind/shared/dist/hooks/types.js +0 -62
- package/packages/@monomind/shared/dist/hooks/verify-exports.test.d.ts +0 -9
- package/packages/@monomind/shared/dist/hooks/verify-exports.test.js +0 -93
- package/packages/@monomind/shared/dist/index.d.ts +0 -46
- package/packages/@monomind/shared/dist/index.js +0 -77
- package/packages/@monomind/shared/dist/mcp/connection-pool.d.ts +0 -98
- package/packages/@monomind/shared/dist/mcp/connection-pool.js +0 -364
- package/packages/@monomind/shared/dist/mcp/index.d.ts +0 -69
- package/packages/@monomind/shared/dist/mcp/index.js +0 -84
- package/packages/@monomind/shared/dist/mcp/server.d.ts +0 -166
- package/packages/@monomind/shared/dist/mcp/server.js +0 -593
- package/packages/@monomind/shared/dist/mcp/session-manager.d.ts +0 -136
- package/packages/@monomind/shared/dist/mcp/session-manager.js +0 -335
- package/packages/@monomind/shared/dist/mcp/tool-registry.d.ts +0 -178
- package/packages/@monomind/shared/dist/mcp/tool-registry.js +0 -439
- package/packages/@monomind/shared/dist/mcp/transport/http.d.ts +0 -104
- package/packages/@monomind/shared/dist/mcp/transport/http.js +0 -476
- package/packages/@monomind/shared/dist/mcp/transport/index.d.ts +0 -102
- package/packages/@monomind/shared/dist/mcp/transport/index.js +0 -238
- package/packages/@monomind/shared/dist/mcp/transport/stdio.d.ts +0 -104
- package/packages/@monomind/shared/dist/mcp/transport/stdio.js +0 -263
- package/packages/@monomind/shared/dist/mcp/transport/websocket.d.ts +0 -133
- package/packages/@monomind/shared/dist/mcp/transport/websocket.js +0 -396
- package/packages/@monomind/shared/dist/mcp/types.d.ts +0 -438
- package/packages/@monomind/shared/dist/mcp/types.js +0 -54
- package/packages/@monomind/shared/dist/plugin-interface.d.ts +0 -544
- package/packages/@monomind/shared/dist/plugin-interface.js +0 -23
- package/packages/@monomind/shared/dist/plugin-loader.d.ts +0 -139
- package/packages/@monomind/shared/dist/plugin-loader.js +0 -434
- package/packages/@monomind/shared/dist/plugin-registry.d.ts +0 -183
- package/packages/@monomind/shared/dist/plugin-registry.js +0 -457
- package/packages/@monomind/shared/dist/plugins/index.d.ts +0 -10
- package/packages/@monomind/shared/dist/plugins/index.js +0 -10
- package/packages/@monomind/shared/dist/plugins/official/hive-mind-plugin.d.ts +0 -106
- package/packages/@monomind/shared/dist/plugins/official/hive-mind-plugin.js +0 -241
- package/packages/@monomind/shared/dist/plugins/official/index.d.ts +0 -10
- package/packages/@monomind/shared/dist/plugins/official/index.js +0 -10
- package/packages/@monomind/shared/dist/plugins/official/maestro-plugin.d.ts +0 -121
- package/packages/@monomind/shared/dist/plugins/official/maestro-plugin.js +0 -355
- package/packages/@monomind/shared/dist/plugins/types.d.ts +0 -93
- package/packages/@monomind/shared/dist/plugins/types.js +0 -9
- package/packages/@monomind/shared/dist/reducers.d.ts +0 -33
- package/packages/@monomind/shared/dist/reducers.js +0 -89
- package/packages/@monomind/shared/dist/resilience/bulkhead.d.ts +0 -105
- package/packages/@monomind/shared/dist/resilience/bulkhead.js +0 -206
- package/packages/@monomind/shared/dist/resilience/circuit-breaker.d.ts +0 -132
- package/packages/@monomind/shared/dist/resilience/circuit-breaker.js +0 -233
- package/packages/@monomind/shared/dist/resilience/index.d.ts +0 -19
- package/packages/@monomind/shared/dist/resilience/index.js +0 -19
- package/packages/@monomind/shared/dist/resilience/rate-limiter.d.ts +0 -168
- package/packages/@monomind/shared/dist/resilience/rate-limiter.js +0 -314
- package/packages/@monomind/shared/dist/resilience/retry.d.ts +0 -91
- package/packages/@monomind/shared/dist/resilience/retry.js +0 -159
- package/packages/@monomind/shared/dist/retry-policy.d.ts +0 -14
- package/packages/@monomind/shared/dist/retry-policy.js +0 -23
- package/packages/@monomind/shared/dist/retry-runner.d.ts +0 -21
- package/packages/@monomind/shared/dist/retry-runner.js +0 -57
- package/packages/@monomind/shared/dist/schema-validator.d.ts +0 -46
- package/packages/@monomind/shared/dist/schema-validator.js +0 -133
- package/packages/@monomind/shared/dist/scratchpad.d.ts +0 -23
- package/packages/@monomind/shared/dist/scratchpad.js +0 -32
- package/packages/@monomind/shared/dist/security/index.d.ts +0 -10
- package/packages/@monomind/shared/dist/security/index.js +0 -12
- package/packages/@monomind/shared/dist/security/input-validation.d.ts +0 -73
- package/packages/@monomind/shared/dist/security/input-validation.js +0 -201
- package/packages/@monomind/shared/dist/security/secure-random.d.ts +0 -92
- package/packages/@monomind/shared/dist/security/secure-random.js +0 -142
- package/packages/@monomind/shared/dist/services/index.d.ts +0 -7
- package/packages/@monomind/shared/dist/services/index.js +0 -7
- package/packages/@monomind/shared/dist/services/progress.service.d.ts +0 -124
- package/packages/@monomind/shared/dist/services/progress.service.js +0 -402
- package/packages/@monomind/shared/dist/state-manager.d.ts +0 -34
- package/packages/@monomind/shared/dist/state-manager.js +0 -73
- package/packages/@monomind/shared/dist/state-validator.d.ts +0 -20
- package/packages/@monomind/shared/dist/state-validator.js +0 -49
- package/packages/@monomind/shared/dist/swarm-state.d.ts +0 -52
- package/packages/@monomind/shared/dist/swarm-state.js +0 -18
- package/packages/@monomind/shared/dist/testing/fixture-builder.d.ts +0 -14
- package/packages/@monomind/shared/dist/testing/fixture-builder.js +0 -32
- package/packages/@monomind/shared/dist/testing/index.d.ts +0 -2
- package/packages/@monomind/shared/dist/testing/index.js +0 -2
- package/packages/@monomind/shared/dist/testing/test-model.d.ts +0 -29
- package/packages/@monomind/shared/dist/testing/test-model.js +0 -53
- package/packages/@monomind/shared/dist/types/agent-registry.d.ts +0 -62
- package/packages/@monomind/shared/dist/types/agent-registry.js +0 -8
- package/packages/@monomind/shared/dist/types/agent-version.d.ts +0 -49
- package/packages/@monomind/shared/dist/types/agent-version.js +0 -7
- package/packages/@monomind/shared/dist/types/agent.types.d.ts +0 -137
- package/packages/@monomind/shared/dist/types/agent.types.js +0 -6
- package/packages/@monomind/shared/dist/types/benchmark.d.ts +0 -39
- package/packages/@monomind/shared/dist/types/benchmark.js +0 -6
- package/packages/@monomind/shared/dist/types/communication-flow.d.ts +0 -25
- package/packages/@monomind/shared/dist/types/communication-flow.js +0 -7
- package/packages/@monomind/shared/dist/types/consensus-audit.d.ts +0 -40
- package/packages/@monomind/shared/dist/types/consensus-audit.js +0 -7
- package/packages/@monomind/shared/dist/types/dlq.d.ts +0 -40
- package/packages/@monomind/shared/dist/types/dlq.js +0 -7
- package/packages/@monomind/shared/dist/types/eval.d.ts +0 -59
- package/packages/@monomind/shared/dist/types/eval.js +0 -6
- package/packages/@monomind/shared/dist/types/index.d.ts +0 -19
- package/packages/@monomind/shared/dist/types/index.js +0 -33
- package/packages/@monomind/shared/dist/types/mcp.types.d.ts +0 -266
- package/packages/@monomind/shared/dist/types/mcp.types.js +0 -7
- package/packages/@monomind/shared/dist/types/memory.types.d.ts +0 -236
- package/packages/@monomind/shared/dist/types/memory.types.js +0 -7
- package/packages/@monomind/shared/dist/types/retry.d.ts +0 -72
- package/packages/@monomind/shared/dist/types/retry.js +0 -40
- package/packages/@monomind/shared/dist/types/specialization.d.ts +0 -27
- package/packages/@monomind/shared/dist/types/specialization.js +0 -8
- package/packages/@monomind/shared/dist/types/swarm.types.d.ts +0 -186
- package/packages/@monomind/shared/dist/types/swarm.types.js +0 -65
- package/packages/@monomind/shared/dist/types/task.types.d.ts +0 -178
- package/packages/@monomind/shared/dist/types/task.types.js +0 -32
- package/packages/@monomind/shared/dist/types/termination.d.ts +0 -29
- package/packages/@monomind/shared/dist/types/termination.js +0 -14
- package/packages/@monomind/shared/dist/types/tool-version.d.ts +0 -41
- package/packages/@monomind/shared/dist/types/tool-version.js +0 -8
- package/packages/@monomind/shared/dist/types/trigger.d.ts +0 -40
- package/packages/@monomind/shared/dist/types/trigger.js +0 -8
- package/packages/@monomind/shared/dist/types.d.ts +0 -197
- package/packages/@monomind/shared/dist/types.js +0 -21
- package/packages/@monomind/shared/dist/utils/secure-logger.d.ts +0 -69
- package/packages/@monomind/shared/dist/utils/secure-logger.js +0 -208
|
@@ -1,166 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* V1 Health Monitor
|
|
3
|
-
* Decomposed from orchestrator.ts - Agent health checks
|
|
4
|
-
* ~150 lines (target achieved)
|
|
5
|
-
*/
|
|
6
|
-
import { SystemEventTypes } from '../interfaces/event.interface.js';
|
|
7
|
-
/**
|
|
8
|
-
* Health monitor implementation
|
|
9
|
-
*/
|
|
10
|
-
export class HealthMonitor {
|
|
11
|
-
eventBus;
|
|
12
|
-
config;
|
|
13
|
-
checks = new Map();
|
|
14
|
-
history = [];
|
|
15
|
-
interval;
|
|
16
|
-
listeners = [];
|
|
17
|
-
running = false;
|
|
18
|
-
constructor(eventBus, config = {
|
|
19
|
-
checkInterval: 30000,
|
|
20
|
-
historyLimit: 100,
|
|
21
|
-
degradedThreshold: 1,
|
|
22
|
-
unhealthyThreshold: 2,
|
|
23
|
-
}) {
|
|
24
|
-
this.eventBus = eventBus;
|
|
25
|
-
this.config = config;
|
|
26
|
-
}
|
|
27
|
-
start() {
|
|
28
|
-
if (this.running) {
|
|
29
|
-
return;
|
|
30
|
-
}
|
|
31
|
-
this.running = true;
|
|
32
|
-
this.interval = setInterval(async () => {
|
|
33
|
-
const status = await this.getStatus();
|
|
34
|
-
this.addToHistory(status);
|
|
35
|
-
this.notifyListeners(status);
|
|
36
|
-
this.eventBus.emit(SystemEventTypes.SYSTEM_HEALTHCHECK, { status });
|
|
37
|
-
}, this.config.checkInterval);
|
|
38
|
-
}
|
|
39
|
-
stop() {
|
|
40
|
-
if (this.interval) {
|
|
41
|
-
clearInterval(this.interval);
|
|
42
|
-
this.interval = undefined;
|
|
43
|
-
}
|
|
44
|
-
this.running = false;
|
|
45
|
-
}
|
|
46
|
-
async getStatus() {
|
|
47
|
-
const components = {};
|
|
48
|
-
let unhealthyCount = 0;
|
|
49
|
-
let degradedCount = 0;
|
|
50
|
-
const checkPromises = Array.from(this.checks.entries()).map(async ([name, check]) => {
|
|
51
|
-
try {
|
|
52
|
-
const result = await Promise.race([
|
|
53
|
-
check(),
|
|
54
|
-
this.timeout(5000, 'Health check timeout'),
|
|
55
|
-
]);
|
|
56
|
-
const health = {
|
|
57
|
-
name,
|
|
58
|
-
status: result.healthy ? 'healthy' : 'unhealthy',
|
|
59
|
-
lastCheck: new Date(),
|
|
60
|
-
error: result.error,
|
|
61
|
-
metrics: result.metrics,
|
|
62
|
-
};
|
|
63
|
-
return { name, health };
|
|
64
|
-
}
|
|
65
|
-
catch (error) {
|
|
66
|
-
return {
|
|
67
|
-
name,
|
|
68
|
-
health: {
|
|
69
|
-
name,
|
|
70
|
-
status: 'unhealthy',
|
|
71
|
-
lastCheck: new Date(),
|
|
72
|
-
error: error instanceof Error ? error.message : 'Unknown error',
|
|
73
|
-
},
|
|
74
|
-
};
|
|
75
|
-
}
|
|
76
|
-
});
|
|
77
|
-
const results = await Promise.allSettled(checkPromises);
|
|
78
|
-
for (const result of results) {
|
|
79
|
-
if (result.status === 'fulfilled') {
|
|
80
|
-
const { name, health } = result.value;
|
|
81
|
-
components[name] = health;
|
|
82
|
-
if (health.status === 'unhealthy') {
|
|
83
|
-
unhealthyCount++;
|
|
84
|
-
}
|
|
85
|
-
else if (health.status === 'degraded') {
|
|
86
|
-
degradedCount++;
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
let overallStatus = 'healthy';
|
|
91
|
-
if (unhealthyCount >= this.config.unhealthyThreshold) {
|
|
92
|
-
overallStatus = 'unhealthy';
|
|
93
|
-
}
|
|
94
|
-
else if (unhealthyCount > 0 ||
|
|
95
|
-
degradedCount >= this.config.degradedThreshold) {
|
|
96
|
-
overallStatus = 'degraded';
|
|
97
|
-
}
|
|
98
|
-
return {
|
|
99
|
-
status: overallStatus,
|
|
100
|
-
components,
|
|
101
|
-
timestamp: new Date(),
|
|
102
|
-
};
|
|
103
|
-
}
|
|
104
|
-
registerCheck(name, check) {
|
|
105
|
-
this.checks.set(name, check);
|
|
106
|
-
}
|
|
107
|
-
unregisterCheck(name) {
|
|
108
|
-
this.checks.delete(name);
|
|
109
|
-
}
|
|
110
|
-
getHistory(limit) {
|
|
111
|
-
const count = limit ?? this.config.historyLimit;
|
|
112
|
-
return this.history.slice(-count);
|
|
113
|
-
}
|
|
114
|
-
onHealthChange(callback) {
|
|
115
|
-
this.listeners.push(callback);
|
|
116
|
-
return () => {
|
|
117
|
-
const index = this.listeners.indexOf(callback);
|
|
118
|
-
if (index !== -1) {
|
|
119
|
-
this.listeners.splice(index, 1);
|
|
120
|
-
}
|
|
121
|
-
};
|
|
122
|
-
}
|
|
123
|
-
addToHistory(status) {
|
|
124
|
-
this.history.push(status);
|
|
125
|
-
// Trim history to limit
|
|
126
|
-
if (this.history.length > this.config.historyLimit) {
|
|
127
|
-
this.history = this.history.slice(-this.config.historyLimit);
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
notifyListeners(status) {
|
|
131
|
-
for (const listener of this.listeners) {
|
|
132
|
-
try {
|
|
133
|
-
listener(status);
|
|
134
|
-
}
|
|
135
|
-
catch {
|
|
136
|
-
// Ignore listener errors
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
timeout(ms, message) {
|
|
141
|
-
return new Promise((_, reject) => {
|
|
142
|
-
setTimeout(() => reject(new Error(message)), ms);
|
|
143
|
-
});
|
|
144
|
-
}
|
|
145
|
-
/**
|
|
146
|
-
* Get component health by name
|
|
147
|
-
*/
|
|
148
|
-
async getComponentHealth(name) {
|
|
149
|
-
const status = await this.getStatus();
|
|
150
|
-
return status.components[name];
|
|
151
|
-
}
|
|
152
|
-
/**
|
|
153
|
-
* Check if system is healthy
|
|
154
|
-
*/
|
|
155
|
-
async isHealthy() {
|
|
156
|
-
const status = await this.getStatus();
|
|
157
|
-
return status.status === 'healthy';
|
|
158
|
-
}
|
|
159
|
-
/**
|
|
160
|
-
* Get registered check names
|
|
161
|
-
*/
|
|
162
|
-
getRegisteredChecks() {
|
|
163
|
-
return Array.from(this.checks.keys());
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
//# sourceMappingURL=health-monitor.js.map
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* V1 Orchestrator Facade
|
|
3
|
-
* Unified interface to decomposed orchestrator components
|
|
4
|
-
* ~50 lines (target achieved)
|
|
5
|
-
*/
|
|
6
|
-
import { TaskManager } from './task-manager.js';
|
|
7
|
-
import { SessionManager, type SessionManagerConfig } from './session-manager.js';
|
|
8
|
-
import { HealthMonitor, type HealthMonitorConfig } from './health-monitor.js';
|
|
9
|
-
import { LifecycleManager, type LifecycleManagerConfig } from './lifecycle-manager.js';
|
|
10
|
-
import { EventCoordinator } from './event-coordinator.js';
|
|
11
|
-
import { EventBus } from '../event-bus.js';
|
|
12
|
-
export * from './task-manager.js';
|
|
13
|
-
export * from './session-manager.js';
|
|
14
|
-
export * from './health-monitor.js';
|
|
15
|
-
export * from './lifecycle-manager.js';
|
|
16
|
-
export * from './event-coordinator.js';
|
|
17
|
-
/**
|
|
18
|
-
* Orchestrator facade configuration
|
|
19
|
-
* (Note: For schema-validated config, use OrchestratorConfig from config/schema.ts)
|
|
20
|
-
*/
|
|
21
|
-
export interface OrchestratorFacadeConfig {
|
|
22
|
-
session: SessionManagerConfig;
|
|
23
|
-
health: HealthMonitorConfig;
|
|
24
|
-
lifecycle: LifecycleManagerConfig;
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Default orchestrator facade configuration
|
|
28
|
-
*/
|
|
29
|
-
export declare const defaultOrchestratorFacadeConfig: OrchestratorFacadeConfig;
|
|
30
|
-
/**
|
|
31
|
-
* Create orchestrator components
|
|
32
|
-
*/
|
|
33
|
-
export declare function createOrchestrator(config?: Partial<OrchestratorFacadeConfig>): {
|
|
34
|
-
eventBus: EventBus;
|
|
35
|
-
taskManager: TaskManager;
|
|
36
|
-
sessionManager: SessionManager;
|
|
37
|
-
healthMonitor: HealthMonitor;
|
|
38
|
-
lifecycleManager: LifecycleManager;
|
|
39
|
-
eventCoordinator: EventCoordinator;
|
|
40
|
-
config: OrchestratorFacadeConfig;
|
|
41
|
-
};
|
|
42
|
-
/**
|
|
43
|
-
* Orchestrator type for facade
|
|
44
|
-
*/
|
|
45
|
-
export type OrchestratorComponents = ReturnType<typeof createOrchestrator>;
|
|
46
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* V1 Orchestrator Facade
|
|
3
|
-
* Unified interface to decomposed orchestrator components
|
|
4
|
-
* ~50 lines (target achieved)
|
|
5
|
-
*/
|
|
6
|
-
import { TaskManager } from './task-manager.js';
|
|
7
|
-
import { SessionManager } from './session-manager.js';
|
|
8
|
-
import { HealthMonitor } from './health-monitor.js';
|
|
9
|
-
import { LifecycleManager } from './lifecycle-manager.js';
|
|
10
|
-
import { EventCoordinator } from './event-coordinator.js';
|
|
11
|
-
import { EventBus } from '../event-bus.js';
|
|
12
|
-
export * from './task-manager.js';
|
|
13
|
-
export * from './session-manager.js';
|
|
14
|
-
export * from './health-monitor.js';
|
|
15
|
-
export * from './lifecycle-manager.js';
|
|
16
|
-
export * from './event-coordinator.js';
|
|
17
|
-
/**
|
|
18
|
-
* Default orchestrator facade configuration
|
|
19
|
-
*/
|
|
20
|
-
export const defaultOrchestratorFacadeConfig = {
|
|
21
|
-
session: {
|
|
22
|
-
persistSessions: true,
|
|
23
|
-
dataDir: './data',
|
|
24
|
-
sessionRetentionMs: 3600000,
|
|
25
|
-
},
|
|
26
|
-
health: {
|
|
27
|
-
checkInterval: 30000,
|
|
28
|
-
historyLimit: 100,
|
|
29
|
-
degradedThreshold: 1,
|
|
30
|
-
unhealthyThreshold: 2,
|
|
31
|
-
},
|
|
32
|
-
lifecycle: {
|
|
33
|
-
maxConcurrentAgents: 20,
|
|
34
|
-
spawnTimeout: 30000,
|
|
35
|
-
terminateTimeout: 10000,
|
|
36
|
-
maxSpawnRetries: 3,
|
|
37
|
-
},
|
|
38
|
-
};
|
|
39
|
-
/**
|
|
40
|
-
* Create orchestrator components
|
|
41
|
-
*/
|
|
42
|
-
export function createOrchestrator(config = {}) {
|
|
43
|
-
const mergedConfig = {
|
|
44
|
-
session: { ...defaultOrchestratorFacadeConfig.session, ...config.session },
|
|
45
|
-
health: { ...defaultOrchestratorFacadeConfig.health, ...config.health },
|
|
46
|
-
lifecycle: { ...defaultOrchestratorFacadeConfig.lifecycle, ...config.lifecycle },
|
|
47
|
-
};
|
|
48
|
-
const eventBus = new EventBus();
|
|
49
|
-
const taskManager = new TaskManager(eventBus);
|
|
50
|
-
const sessionManager = new SessionManager(eventBus, mergedConfig.session);
|
|
51
|
-
const healthMonitor = new HealthMonitor(eventBus, mergedConfig.health);
|
|
52
|
-
const lifecycleManager = new LifecycleManager(eventBus, mergedConfig.lifecycle);
|
|
53
|
-
const eventCoordinator = new EventCoordinator(eventBus);
|
|
54
|
-
return {
|
|
55
|
-
eventBus,
|
|
56
|
-
taskManager,
|
|
57
|
-
sessionManager,
|
|
58
|
-
healthMonitor,
|
|
59
|
-
lifecycleManager,
|
|
60
|
-
eventCoordinator,
|
|
61
|
-
config: mergedConfig,
|
|
62
|
-
};
|
|
63
|
-
}
|
|
64
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* V1 Lifecycle Manager
|
|
3
|
-
* Decomposed from orchestrator.ts - Agent spawn/terminate
|
|
4
|
-
* ~150 lines (target achieved)
|
|
5
|
-
*/
|
|
6
|
-
import type { IAgent, IAgentConfig, IAgentLifecycleManager, IAgentPool, AgentStatus } from '../interfaces/agent.interface.js';
|
|
7
|
-
import type { IEventBus } from '../interfaces/event.interface.js';
|
|
8
|
-
/**
|
|
9
|
-
* Agent pool implementation
|
|
10
|
-
*/
|
|
11
|
-
export declare class AgentPool implements IAgentPool {
|
|
12
|
-
private agents;
|
|
13
|
-
add(agent: IAgent): void;
|
|
14
|
-
remove(agentId: string): boolean;
|
|
15
|
-
get(agentId: string): IAgent | undefined;
|
|
16
|
-
getAll(): IAgent[];
|
|
17
|
-
getByStatus(status: AgentStatus): IAgent[];
|
|
18
|
-
getByType(type: string): IAgent[];
|
|
19
|
-
getAvailable(): IAgent[];
|
|
20
|
-
size(): number;
|
|
21
|
-
hasCapacity(maxSize: number): boolean;
|
|
22
|
-
clear(): void;
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Lifecycle manager configuration
|
|
26
|
-
*/
|
|
27
|
-
export interface LifecycleManagerConfig {
|
|
28
|
-
maxConcurrentAgents: number;
|
|
29
|
-
spawnTimeout: number;
|
|
30
|
-
terminateTimeout: number;
|
|
31
|
-
maxSpawnRetries: number;
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Lifecycle manager implementation
|
|
35
|
-
*/
|
|
36
|
-
export declare class LifecycleManager implements IAgentLifecycleManager {
|
|
37
|
-
private eventBus;
|
|
38
|
-
private config;
|
|
39
|
-
private pool;
|
|
40
|
-
constructor(eventBus: IEventBus, config: LifecycleManagerConfig, pool?: IAgentPool);
|
|
41
|
-
spawn(config: IAgentConfig): Promise<IAgent>;
|
|
42
|
-
spawnBatch(configs: IAgentConfig[]): Promise<Map<string, IAgent>>;
|
|
43
|
-
terminate(agentId: string, reason?: string): Promise<void>;
|
|
44
|
-
terminateAll(reason?: string): Promise<void>;
|
|
45
|
-
restart(agentId: string): Promise<IAgent>;
|
|
46
|
-
updateConfig(agentId: string, config: Partial<IAgentConfig>): Promise<void>;
|
|
47
|
-
getAgent(agentId: string): IAgent | undefined;
|
|
48
|
-
getAllAgents(): IAgent[];
|
|
49
|
-
getActiveCount(): number;
|
|
50
|
-
checkHealth(agentId: string): Promise<IAgent['health']>;
|
|
51
|
-
/**
|
|
52
|
-
* Get agent pool
|
|
53
|
-
*/
|
|
54
|
-
getPool(): IAgentPool;
|
|
55
|
-
}
|
|
56
|
-
//# sourceMappingURL=lifecycle-manager.d.ts.map
|
|
@@ -1,195 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* V1 Lifecycle Manager
|
|
3
|
-
* Decomposed from orchestrator.ts - Agent spawn/terminate
|
|
4
|
-
* ~150 lines (target achieved)
|
|
5
|
-
*/
|
|
6
|
-
import { SystemEventTypes } from '../interfaces/event.interface.js';
|
|
7
|
-
/**
|
|
8
|
-
* Agent pool implementation
|
|
9
|
-
*/
|
|
10
|
-
export class AgentPool {
|
|
11
|
-
agents = new Map();
|
|
12
|
-
add(agent) {
|
|
13
|
-
this.agents.set(agent.id, agent);
|
|
14
|
-
}
|
|
15
|
-
remove(agentId) {
|
|
16
|
-
return this.agents.delete(agentId);
|
|
17
|
-
}
|
|
18
|
-
get(agentId) {
|
|
19
|
-
return this.agents.get(agentId);
|
|
20
|
-
}
|
|
21
|
-
getAll() {
|
|
22
|
-
return Array.from(this.agents.values());
|
|
23
|
-
}
|
|
24
|
-
getByStatus(status) {
|
|
25
|
-
return this.getAll().filter(agent => agent.status === status);
|
|
26
|
-
}
|
|
27
|
-
getByType(type) {
|
|
28
|
-
return this.getAll().filter(agent => agent.type === type);
|
|
29
|
-
}
|
|
30
|
-
getAvailable() {
|
|
31
|
-
return this.getAll().filter(agent => (agent.status === 'active' || agent.status === 'idle') &&
|
|
32
|
-
agent.currentTaskCount < agent.config.maxConcurrentTasks);
|
|
33
|
-
}
|
|
34
|
-
size() {
|
|
35
|
-
return this.agents.size;
|
|
36
|
-
}
|
|
37
|
-
hasCapacity(maxSize) {
|
|
38
|
-
return this.agents.size < maxSize;
|
|
39
|
-
}
|
|
40
|
-
clear() {
|
|
41
|
-
this.agents.clear();
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* Lifecycle manager implementation
|
|
46
|
-
*/
|
|
47
|
-
export class LifecycleManager {
|
|
48
|
-
eventBus;
|
|
49
|
-
config;
|
|
50
|
-
pool;
|
|
51
|
-
constructor(eventBus, config, pool) {
|
|
52
|
-
this.eventBus = eventBus;
|
|
53
|
-
this.config = config;
|
|
54
|
-
this.pool = pool ?? new AgentPool();
|
|
55
|
-
}
|
|
56
|
-
async spawn(config) {
|
|
57
|
-
// Validate capacity
|
|
58
|
-
if (!this.pool.hasCapacity(this.config.maxConcurrentAgents)) {
|
|
59
|
-
throw new Error('Maximum concurrent agents reached');
|
|
60
|
-
}
|
|
61
|
-
// Validate agent doesn't already exist
|
|
62
|
-
if (this.pool.get(config.id)) {
|
|
63
|
-
throw new Error(`Agent with ID ${config.id} already exists`);
|
|
64
|
-
}
|
|
65
|
-
const agent = {
|
|
66
|
-
id: config.id,
|
|
67
|
-
name: config.name,
|
|
68
|
-
type: config.type,
|
|
69
|
-
config,
|
|
70
|
-
createdAt: new Date(),
|
|
71
|
-
status: 'spawning',
|
|
72
|
-
currentTaskCount: 0,
|
|
73
|
-
lastActivity: new Date(),
|
|
74
|
-
metrics: {
|
|
75
|
-
tasksCompleted: 0,
|
|
76
|
-
tasksFailed: 0,
|
|
77
|
-
avgTaskDuration: 0,
|
|
78
|
-
errorCount: 0,
|
|
79
|
-
uptime: 0,
|
|
80
|
-
},
|
|
81
|
-
};
|
|
82
|
-
// Add to pool
|
|
83
|
-
this.pool.add(agent);
|
|
84
|
-
// Mark as active
|
|
85
|
-
agent.status = 'active';
|
|
86
|
-
this.eventBus.emit(SystemEventTypes.AGENT_SPAWNED, {
|
|
87
|
-
agentId: agent.id,
|
|
88
|
-
profile: config,
|
|
89
|
-
sessionId: undefined,
|
|
90
|
-
});
|
|
91
|
-
return agent;
|
|
92
|
-
}
|
|
93
|
-
async spawnBatch(configs) {
|
|
94
|
-
const results = new Map();
|
|
95
|
-
// Check total capacity
|
|
96
|
-
if (this.pool.size() + configs.length > this.config.maxConcurrentAgents) {
|
|
97
|
-
throw new Error('Batch would exceed maximum concurrent agents');
|
|
98
|
-
}
|
|
99
|
-
// Spawn in parallel
|
|
100
|
-
const spawnPromises = configs.map(async (config) => {
|
|
101
|
-
try {
|
|
102
|
-
const agent = await this.spawn(config);
|
|
103
|
-
return { id: config.id, agent, error: null };
|
|
104
|
-
}
|
|
105
|
-
catch (error) {
|
|
106
|
-
return { id: config.id, agent: null, error };
|
|
107
|
-
}
|
|
108
|
-
});
|
|
109
|
-
const settled = await Promise.allSettled(spawnPromises);
|
|
110
|
-
for (const result of settled) {
|
|
111
|
-
if (result.status === 'fulfilled' && result.value.agent) {
|
|
112
|
-
results.set(result.value.id, result.value.agent);
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
return results;
|
|
116
|
-
}
|
|
117
|
-
async terminate(agentId, reason) {
|
|
118
|
-
const agent = this.pool.get(agentId);
|
|
119
|
-
if (!agent) {
|
|
120
|
-
throw new Error(`Agent not found: ${agentId}`);
|
|
121
|
-
}
|
|
122
|
-
agent.status = 'terminated';
|
|
123
|
-
// Remove from pool
|
|
124
|
-
this.pool.remove(agentId);
|
|
125
|
-
this.eventBus.emit(SystemEventTypes.AGENT_TERMINATED, {
|
|
126
|
-
agentId,
|
|
127
|
-
reason: reason ?? 'User requested',
|
|
128
|
-
});
|
|
129
|
-
}
|
|
130
|
-
async terminateAll(reason) {
|
|
131
|
-
const agents = this.pool.getAll();
|
|
132
|
-
await Promise.allSettled(agents.map(agent => this.terminate(agent.id, reason)));
|
|
133
|
-
}
|
|
134
|
-
async restart(agentId) {
|
|
135
|
-
const agent = this.pool.get(agentId);
|
|
136
|
-
if (!agent) {
|
|
137
|
-
throw new Error(`Agent not found: ${agentId}`);
|
|
138
|
-
}
|
|
139
|
-
const config = agent.config;
|
|
140
|
-
await this.terminate(agentId, 'Restart requested');
|
|
141
|
-
return this.spawn(config);
|
|
142
|
-
}
|
|
143
|
-
async updateConfig(agentId, config) {
|
|
144
|
-
const agent = this.pool.get(agentId);
|
|
145
|
-
if (!agent) {
|
|
146
|
-
throw new Error(`Agent not found: ${agentId}`);
|
|
147
|
-
}
|
|
148
|
-
Object.assign(agent.config, config);
|
|
149
|
-
}
|
|
150
|
-
getAgent(agentId) {
|
|
151
|
-
return this.pool.get(agentId);
|
|
152
|
-
}
|
|
153
|
-
getAllAgents() {
|
|
154
|
-
return this.pool.getAll();
|
|
155
|
-
}
|
|
156
|
-
getActiveCount() {
|
|
157
|
-
return this.pool.getByStatus('active').length +
|
|
158
|
-
this.pool.getByStatus('idle').length;
|
|
159
|
-
}
|
|
160
|
-
async checkHealth(agentId) {
|
|
161
|
-
const agent = this.pool.get(agentId);
|
|
162
|
-
if (!agent) {
|
|
163
|
-
throw new Error(`Agent not found: ${agentId}`);
|
|
164
|
-
}
|
|
165
|
-
// Simple health check based on metrics
|
|
166
|
-
const errorRate = agent.metrics
|
|
167
|
-
? agent.metrics.errorCount / Math.max(1, agent.metrics.tasksCompleted + agent.metrics.tasksFailed)
|
|
168
|
-
: 0;
|
|
169
|
-
const health = {
|
|
170
|
-
status: errorRate > 0.5 ? 'unhealthy' : errorRate > 0.2 ? 'degraded' : 'healthy',
|
|
171
|
-
lastCheck: new Date(),
|
|
172
|
-
issues: [],
|
|
173
|
-
};
|
|
174
|
-
if (errorRate > 0.2) {
|
|
175
|
-
health.issues?.push(`High error rate: ${(errorRate * 100).toFixed(1)}%`);
|
|
176
|
-
}
|
|
177
|
-
agent.health = health;
|
|
178
|
-
if (health.status !== 'healthy') {
|
|
179
|
-
this.eventBus.emit(SystemEventTypes.AGENT_HEALTH_CHANGED, {
|
|
180
|
-
agentId,
|
|
181
|
-
previousStatus: agent.status,
|
|
182
|
-
currentStatus: agent.status,
|
|
183
|
-
issues: health.issues,
|
|
184
|
-
});
|
|
185
|
-
}
|
|
186
|
-
return health;
|
|
187
|
-
}
|
|
188
|
-
/**
|
|
189
|
-
* Get agent pool
|
|
190
|
-
*/
|
|
191
|
-
getPool() {
|
|
192
|
-
return this.pool;
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
//# sourceMappingURL=lifecycle-manager.js.map
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* V1 Session Manager
|
|
3
|
-
* Decomposed from orchestrator.ts - Session handling
|
|
4
|
-
* ~200 lines (target achieved)
|
|
5
|
-
*/
|
|
6
|
-
import type { IAgentSession } from '../interfaces/agent.interface.js';
|
|
7
|
-
import type { IEventBus } from '../interfaces/event.interface.js';
|
|
8
|
-
import type { AgentProfile } from '../../types/agent.types.js';
|
|
9
|
-
/**
|
|
10
|
-
* Session persistence structure
|
|
11
|
-
*/
|
|
12
|
-
export interface SessionPersistence {
|
|
13
|
-
sessions: Array<IAgentSession & {
|
|
14
|
-
profile: AgentProfile;
|
|
15
|
-
}>;
|
|
16
|
-
metrics: {
|
|
17
|
-
completedTasks: number;
|
|
18
|
-
failedTasks: number;
|
|
19
|
-
totalTaskDuration: number;
|
|
20
|
-
};
|
|
21
|
-
savedAt: Date;
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Session manager configuration
|
|
25
|
-
*/
|
|
26
|
-
export interface SessionManagerConfig {
|
|
27
|
-
persistSessions: boolean;
|
|
28
|
-
dataDir: string;
|
|
29
|
-
sessionRetentionMs?: number;
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* Session manager interface
|
|
33
|
-
*/
|
|
34
|
-
export interface ISessionManager {
|
|
35
|
-
createSession(profile: AgentProfile, terminalId: string, memoryBankId: string): Promise<IAgentSession>;
|
|
36
|
-
getSession(sessionId: string): IAgentSession | undefined;
|
|
37
|
-
getActiveSessions(): IAgentSession[];
|
|
38
|
-
getSessionsByAgent(agentId: string): IAgentSession[];
|
|
39
|
-
terminateSession(sessionId: string): Promise<void>;
|
|
40
|
-
terminateAllSessions(): Promise<void>;
|
|
41
|
-
persistSessions(): Promise<void>;
|
|
42
|
-
restoreSessions(): Promise<SessionPersistence | null>;
|
|
43
|
-
removeSession(sessionId: string): void;
|
|
44
|
-
updateSessionActivity(sessionId: string): void;
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* Session manager implementation
|
|
48
|
-
*/
|
|
49
|
-
export declare class SessionManager implements ISessionManager {
|
|
50
|
-
private eventBus;
|
|
51
|
-
private config;
|
|
52
|
-
private sessions;
|
|
53
|
-
private sessionProfiles;
|
|
54
|
-
private persistencePath;
|
|
55
|
-
constructor(eventBus: IEventBus, config: SessionManagerConfig);
|
|
56
|
-
createSession(profile: AgentProfile, terminalId: string, memoryBankId: string): Promise<IAgentSession>;
|
|
57
|
-
getSession(sessionId: string): IAgentSession | undefined;
|
|
58
|
-
getActiveSessions(): IAgentSession[];
|
|
59
|
-
getSessionsByAgent(agentId: string): IAgentSession[];
|
|
60
|
-
terminateSession(sessionId: string): Promise<void>;
|
|
61
|
-
terminateAllSessions(): Promise<void>;
|
|
62
|
-
removeSession(sessionId: string): void;
|
|
63
|
-
updateSessionActivity(sessionId: string): void;
|
|
64
|
-
persistSessions(): Promise<void>;
|
|
65
|
-
restoreSessions(): Promise<SessionPersistence | null>;
|
|
66
|
-
/**
|
|
67
|
-
* Clean up old terminated sessions
|
|
68
|
-
*/
|
|
69
|
-
cleanupTerminatedSessions(retentionMs?: number): Promise<number>;
|
|
70
|
-
/**
|
|
71
|
-
* Get session profile
|
|
72
|
-
*/
|
|
73
|
-
getSessionProfile(sessionId: string): AgentProfile | undefined;
|
|
74
|
-
/**
|
|
75
|
-
* Get session count
|
|
76
|
-
*/
|
|
77
|
-
getSessionCount(): number;
|
|
78
|
-
/**
|
|
79
|
-
* Get active session count
|
|
80
|
-
*/
|
|
81
|
-
getActiveSessionCount(): number;
|
|
82
|
-
}
|
|
83
|
-
//# sourceMappingURL=session-manager.d.ts.map
|