claude-flow-novice 2.0.4 → 2.0.5
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/dist/src/cli/commands/guidance.js +668 -487
- package/dist/src/cli/commands/index-validate.js +29 -18
- package/dist/src/cli/commands/mcp-troubleshoot.js +282 -230
- package/dist/src/cli/commands/neural-goal-init.js +125 -92
- package/dist/src/cli/commands/swarm-exec.js +393 -317
- package/dist/src/cli/commands/validate-framework.js +1100 -983
- package/dist/src/cli/commands/validate.js +223 -144
- package/dist/src/cli/main.js +1 -1
- package/dist/src/cli/simple-commands/__tests__/agent.test.js +277 -265
- package/dist/src/cli/simple-commands/__tests__/memory.test.js +7 -6
- package/dist/src/cli/simple-commands/__tests__/swarm.test.js +356 -373
- package/dist/src/cli/simple-commands/__tests__/task.test.js +7 -6
- package/dist/src/cli/simple-commands/agent.js +193 -157
- package/dist/src/cli/simple-commands/analysis.js +446 -336
- package/dist/src/cli/simple-commands/automation-executor.js +1339 -1095
- package/dist/src/cli/simple-commands/automation.js +469 -481
- package/dist/src/cli/simple-commands/batch-manager.js +313 -261
- package/dist/src/cli/simple-commands/claude-telemetry.js +267 -241
- package/dist/src/cli/simple-commands/claude-track.js +90 -68
- package/dist/src/cli/simple-commands/concurrent-display.js +320 -266
- package/dist/src/cli/simple-commands/config.js +290 -245
- package/dist/src/cli/simple-commands/coordination.js +234 -182
- package/dist/src/cli/simple-commands/enhanced-ui-views.js +615 -812
- package/dist/src/cli/simple-commands/enhanced-webui-complete.js +981 -922
- package/dist/src/cli/simple-commands/fix-hook-variables.js +294 -274
- package/dist/src/cli/simple-commands/github/gh-coordinator.js +457 -378
- package/dist/src/cli/simple-commands/github/github-api.js +574 -535
- package/dist/src/cli/simple-commands/github/init.js +303 -276
- package/dist/src/cli/simple-commands/github.js +247 -222
- package/dist/src/cli/simple-commands/goal.js +63 -51
- package/dist/src/cli/simple-commands/hive-mind/auto-save-middleware.js +278 -208
- package/dist/src/cli/simple-commands/hive-mind/communication.js +696 -601
- package/dist/src/cli/simple-commands/hive-mind/core.js +979 -907
- package/dist/src/cli/simple-commands/hive-mind/db-optimizer.js +655 -406
- package/dist/src/cli/simple-commands/hive-mind/mcp-wrapper.js +1245 -1125
- package/dist/src/cli/simple-commands/hive-mind/memory.js +1090 -854
- package/dist/src/cli/simple-commands/hive-mind/performance-optimizer.js +574 -459
- package/dist/src/cli/simple-commands/hive-mind/performance-test.js +347 -263
- package/dist/src/cli/simple-commands/hive-mind/queen.js +768 -727
- package/dist/src/cli/simple-commands/hive-mind/session-manager.js +1049 -745
- package/dist/src/cli/simple-commands/hive-mind-optimize.js +283 -227
- package/dist/src/cli/simple-commands/hive-mind-wizard.js +217 -174
- package/dist/src/cli/simple-commands/hive-mind.js +2282 -1841
- package/dist/src/cli/simple-commands/hive.js +79 -90
- package/dist/src/cli/simple-commands/hook-safety.js +521 -431
- package/dist/src/cli/simple-commands/hooks/session-start-soul.js +254 -203
- package/dist/src/cli/simple-commands/hooks.js +1204 -1064
- package/dist/src/cli/simple-commands/init/agent-copier.js +319 -294
- package/dist/src/cli/simple-commands/init/batch-init.js +562 -496
- package/dist/src/cli/simple-commands/init/claude-commands/claude-flow-commands.js +19 -13
- package/dist/src/cli/simple-commands/init/claude-commands/optimized-claude-flow-commands.js +19 -13
- package/dist/src/cli/simple-commands/init/claude-commands/optimized-slash-commands.js +88 -61
- package/dist/src/cli/simple-commands/init/claude-commands/optimized-sparc-commands.js +150 -125
- package/dist/src/cli/simple-commands/init/claude-commands/slash-commands.js +49 -42
- package/dist/src/cli/simple-commands/init/claude-commands/sparc-commands.js +61 -43
- package/dist/src/cli/simple-commands/init/copy-revised-templates.js +147 -141
- package/dist/src/cli/simple-commands/init/executable-wrapper.js +44 -31
- package/dist/src/cli/simple-commands/init/gitignore-updater.js +90 -64
- package/dist/src/cli/simple-commands/init/help.js +107 -104
- package/dist/src/cli/simple-commands/init/hive-mind-init.js +528 -509
- package/dist/src/cli/simple-commands/init/index.js +1759 -1510
- package/dist/src/cli/simple-commands/init/performance-monitor.js +317 -234
- package/dist/src/cli/simple-commands/init/rollback/backup-manager.js +504 -441
- package/dist/src/cli/simple-commands/init/rollback/index.js +364 -289
- package/dist/src/cli/simple-commands/init/rollback/recovery-manager.js +728 -652
- package/dist/src/cli/simple-commands/init/rollback/rollback-executor.js +481 -416
- package/dist/src/cli/simple-commands/init/rollback/state-tracker.js +448 -369
- package/dist/src/cli/simple-commands/init/sparc/roo-readme.js +2 -1
- package/dist/src/cli/simple-commands/init/sparc/roomodes-config.js +99 -122
- package/dist/src/cli/simple-commands/init/sparc/workflows.js +37 -32
- package/dist/src/cli/simple-commands/init/sparc-structure.js +62 -55
- package/dist/src/cli/simple-commands/init/template-copier.js +533 -421
- package/dist/src/cli/simple-commands/init/templates/coordination-md.js +6 -3
- package/dist/src/cli/simple-commands/init/templates/enhanced-templates.js +318 -344
- package/dist/src/cli/simple-commands/init/templates/github-safe-enhanced.js +218 -173
- package/dist/src/cli/simple-commands/init/templates/github-safe.js +75 -65
- package/dist/src/cli/simple-commands/init/templates/memory-bank-md.js +6 -3
- package/dist/src/cli/simple-commands/init/templates/readme-files.js +4 -2
- package/dist/src/cli/simple-commands/init/templates/safe-hook-patterns.js +230 -187
- package/dist/src/cli/simple-commands/init/templates/sparc-modes.js +80 -53
- package/dist/src/cli/simple-commands/init/templates/verification-claude-md.js +85 -101
- package/dist/src/cli/simple-commands/init/validation/config-validator.js +330 -283
- package/dist/src/cli/simple-commands/init/validation/health-checker.js +561 -495
- package/dist/src/cli/simple-commands/init/validation/index.js +358 -302
- package/dist/src/cli/simple-commands/init/validation/mode-validator.js +359 -308
- package/dist/src/cli/simple-commands/init/validation/post-init-validator.js +366 -389
- package/dist/src/cli/simple-commands/init/validation/pre-init-validator.js +268 -270
- package/dist/src/cli/simple-commands/init/validation/test-runner.js +447 -427
- package/dist/src/cli/simple-commands/init.js +2 -1
- package/dist/src/cli/simple-commands/mcp-health.js +158 -131
- package/dist/src/cli/simple-commands/mcp-integration-layer.js +634 -533
- package/dist/src/cli/simple-commands/mcp.js +400 -345
- package/dist/src/cli/simple-commands/memory-consolidation.js +537 -426
- package/dist/src/cli/simple-commands/memory.js +311 -247
- package/dist/src/cli/simple-commands/migrate-hooks.js +46 -39
- package/dist/src/cli/simple-commands/monitor.js +363 -294
- package/dist/src/cli/simple-commands/neural.js +65 -51
- package/dist/src/cli/simple-commands/pair-autofix-only.js +662 -538
- package/dist/src/cli/simple-commands/pair-basic.js +656 -528
- package/dist/src/cli/simple-commands/pair-old.js +543 -430
- package/dist/src/cli/simple-commands/pair-working.js +751 -615
- package/dist/src/cli/simple-commands/pair.js +751 -615
- package/dist/src/cli/simple-commands/performance-hooks.js +111 -83
- package/dist/src/cli/simple-commands/performance-metrics.js +433 -348
- package/dist/src/cli/simple-commands/process-ui-enhanced.js +787 -708
- package/dist/src/cli/simple-commands/process-ui.js +254 -230
- package/dist/src/cli/simple-commands/realtime-update-system.js +611 -525
- package/dist/src/cli/simple-commands/sparc/architecture.js +1530 -1704
- package/dist/src/cli/simple-commands/sparc/commands.js +516 -438
- package/dist/src/cli/simple-commands/sparc/completion.js +1481 -1224
- package/dist/src/cli/simple-commands/sparc/coordinator.js +978 -913
- package/dist/src/cli/simple-commands/sparc/index.js +298 -241
- package/dist/src/cli/simple-commands/sparc/phase-base.js +390 -314
- package/dist/src/cli/simple-commands/sparc/pseudocode.js +869 -965
- package/dist/src/cli/simple-commands/sparc/refinement.js +1273 -980
- package/dist/src/cli/simple-commands/sparc/specification.js +645 -559
- package/dist/src/cli/simple-commands/sparc-modes/architect.js +1 -1
- package/dist/src/cli/simple-commands/sparc-modes/ask.js +1 -1
- package/dist/src/cli/simple-commands/sparc-modes/code.js +1 -1
- package/dist/src/cli/simple-commands/sparc-modes/debug.js +1 -1
- package/dist/src/cli/simple-commands/sparc-modes/devops.js +1 -1
- package/dist/src/cli/simple-commands/sparc-modes/docs-writer.js +1 -1
- package/dist/src/cli/simple-commands/sparc-modes/generic.js +1 -1
- package/dist/src/cli/simple-commands/sparc-modes/index.js +55 -47
- package/dist/src/cli/simple-commands/sparc-modes/integration.js +1 -1
- package/dist/src/cli/simple-commands/sparc-modes/mcp.js +1 -1
- package/dist/src/cli/simple-commands/sparc-modes/monitoring.js +1 -1
- package/dist/src/cli/simple-commands/sparc-modes/optimization.js +1 -1
- package/dist/src/cli/simple-commands/sparc-modes/security-review.js +1 -1
- package/dist/src/cli/simple-commands/sparc-modes/sparc-orchestrator.js +1 -1
- package/dist/src/cli/simple-commands/sparc-modes/spec-pseudocode.js +1 -1
- package/dist/src/cli/simple-commands/sparc-modes/supabase-admin.js +1 -1
- package/dist/src/cli/simple-commands/sparc-modes/swarm.js +87 -101
- package/dist/src/cli/simple-commands/sparc-modes/tdd.js +1 -1
- package/dist/src/cli/simple-commands/sparc-modes/tutorial.js +1 -1
- package/dist/src/cli/simple-commands/sparc.js +493 -465
- package/dist/src/cli/simple-commands/start-ui.js +132 -108
- package/dist/src/cli/simple-commands/start-wrapper.js +268 -240
- package/dist/src/cli/simple-commands/start.js +1 -1
- package/dist/src/cli/simple-commands/status.js +275 -254
- package/dist/src/cli/simple-commands/stream-chain-clean.js +171 -128
- package/dist/src/cli/simple-commands/stream-chain-fixed.js +82 -61
- package/dist/src/cli/simple-commands/stream-chain-real.js +331 -267
- package/dist/src/cli/simple-commands/stream-chain-working.js +263 -211
- package/dist/src/cli/simple-commands/stream-chain.js +318 -260
- package/dist/src/cli/simple-commands/stream-processor.js +315 -290
- package/dist/src/cli/simple-commands/swarm-executor.js +222 -189
- package/dist/src/cli/simple-commands/swarm-metrics-integration.js +300 -208
- package/dist/src/cli/simple-commands/swarm-ui.js +703 -623
- package/dist/src/cli/simple-commands/swarm-webui-integration.js +286 -258
- package/dist/src/cli/simple-commands/swarm.js +1082 -887
- package/dist/src/cli/simple-commands/task.js +206 -161
- package/dist/src/cli/simple-commands/timestamp-fix.js +89 -59
- package/dist/src/cli/simple-commands/token-tracker.js +316 -258
- package/dist/src/cli/simple-commands/tool-execution-framework.js +519 -433
- package/dist/src/cli/simple-commands/train-and-stream.js +331 -275
- package/dist/src/cli/simple-commands/training-pipeline.js +725 -619
- package/dist/src/cli/simple-commands/training.js +227 -170
- package/dist/src/cli/simple-commands/verification-hooks.js +284 -261
- package/dist/src/cli/simple-commands/verification-integration.js +417 -389
- package/dist/src/cli/simple-commands/verification-training-integration.js +606 -486
- package/dist/src/cli/simple-commands/verification.js +513 -493
- package/dist/src/cli/simple-commands/web-server.js +836 -766
- package/dist/src/cli/simple-commands/webui-validator.js +124 -106
- package/dist/src/coordination/byzantine-memory-channels.js +25 -1
- package/dist/src/coordination/event-bus/demo-wasm-integration.js +251 -212
- package/dist/src/coordination/event-bus/qe-event-bus.js +748 -608
- package/dist/src/coordination/event-bus/qe-event-bus.test.js +454 -379
- package/dist/src/coordination/iteration-tracker.js +454 -363
- package/dist/src/index.js +384 -35
- package/dist/src/mcp/DEPRECATED.js +60 -46
- package/dist/src/mcp/fixes/mcp-error-fixes.js +134 -115
- package/dist/src/mcp/implementations/agent-tracker.js +128 -114
- package/dist/src/mcp/implementations/daa-tools.js +350 -292
- package/dist/src/mcp/implementations/workflow-tools.js +361 -329
- package/dist/src/mcp/mcp-config-manager.js +1331 -1183
- package/dist/src/mcp/mcp-server-novice-simplified.js +17 -11
- package/dist/src/mcp/mcp-server-novice.js +17 -11
- package/dist/src/mcp/mcp-server-sdk.js +17 -11
- package/dist/src/mcp/mcp-server.js +1484 -1620
- package/dist/src/mcp/ruv-swarm-wrapper.js +239 -209
- package/dist/src/memory/advanced-serializer.js +589 -609
- package/dist/src/memory/enhanced-examples.js +305 -220
- package/dist/src/memory/enhanced-memory.js +336 -295
- package/dist/src/memory/enhanced-session-serializer.js +492 -408
- package/dist/src/memory/fallback-memory-system.js +1021 -900
- package/dist/src/memory/fallback-store.js +131 -93
- package/dist/src/memory/high-performance-serialization.js +730 -592
- package/dist/src/memory/in-memory-store.js +213 -161
- package/dist/src/memory/index.js +157 -123
- package/dist/src/memory/lock-free-structures.js +764 -578
- package/dist/src/memory/memory-mapped-persistence.js +766 -585
- package/dist/src/memory/memory-pressure-manager.js +707 -569
- package/dist/src/memory/migration.js +445 -358
- package/dist/src/memory/shared-memory.js +768 -641
- package/dist/src/memory/sqlite-store.js +325 -245
- package/dist/src/memory/sqlite-wrapper.js +151 -122
- package/dist/src/memory/swarm-memory.js +603 -470
- package/dist/src/memory/test-example.js +134 -126
- package/dist/src/memory/ultra-fast-memory-store.js +821 -622
- package/dist/src/memory/unified-memory-manager.js +437 -356
- package/dist/src/swarm/CodeRefactoringSwarm.js +952 -777
- package/dist/src/utils/__tests__/github-cli-safety-wrapper.test.js +400 -332
- package/dist/src/utils/error-handler.js +2 -36
- package/dist/src/utils/github-cli-safe.js +64 -56
- package/dist/src/utils/github-cli-safety-wrapper.js +546 -451
- package/dist/src/utils/npx-isolated-cache.js +119 -104
- package/dist/src/utils/preference-manager.js +652 -622
- package/dist/src/utils/timezone-utils.js +105 -86
- package/dist/src/web/api/apm-routes.js +353 -0
- package/dist/src/web/api/config/api-config.js +184 -0
- package/dist/src/web/api/middleware/auth.js +203 -0
- package/dist/src/web/api/middleware/cache.js +273 -0
- package/dist/src/web/api/middleware/error-handler.js +257 -0
- package/dist/src/web/api/middleware/request-logger.js +215 -0
- package/dist/src/web/api/middleware/validation.js +323 -0
- package/dist/src/web/api/routes/events.js +463 -0
- package/dist/src/web/api/routes/hierarchy.js +300 -0
- package/dist/src/web/api/routes/index.js +12 -0
- package/dist/src/web/api/routes/metrics.js +559 -0
- package/dist/src/web/api/routes/parallel-status.js +359 -0
- package/dist/src/web/api/routes/status.js +448 -0
- package/dist/src/web/api/server.js +462 -0
- package/dist/src/web/dashboard/hooks/useWebSocket.js +383 -0
- package/dist/src/web/dashboard/index.js +85 -0
- package/dist/src/web/dashboard/realtime/CustomSyncManager.js +439 -0
- package/dist/src/web/dashboard/realtime/NativeWebSocketManager.js +323 -0
- package/dist/src/web/dashboard/realtime/PerformanceBenchmark.js +527 -0
- package/dist/src/web/dashboard/realtime/RealtimeCommunicationManager.js +474 -0
- package/dist/src/web/dashboard/realtime/RealtimeServer.js +666 -0
- package/dist/src/web/dashboard/realtime/SSEManager.js +426 -0
- package/dist/src/web/dashboard/types.js +4 -0
- package/dist/src/web/messaging/agent-status-tracker.js +453 -0
- package/dist/src/web/messaging/human-intervention-system.js +305 -0
- package/dist/src/web/messaging/message-filter.js +302 -0
- package/dist/src/web/messaging/swarm-message-router.js +324 -0
- package/dist/src/web/messaging/transparency-logger.js +421 -0
- package/dist/src/web/portal-server.js +460 -0
- package/dist/src/web/server.js +322 -0
- package/dist/src/web/websocket/apm-websocket-handler.js +453 -0
- package/dist/src/web/websocket/websocket-manager.js +780 -0
- package/package.json +5 -3
- package/dist/src/cli/minimal-main.js +0 -22
- package/dist/src/enterprise/analytics-manager.js +0 -1135
- package/dist/src/enterprise/audit-manager.js +0 -1115
- package/dist/src/enterprise/cloud-manager.js +0 -891
- package/dist/src/enterprise/deployment-manager.js +0 -966
- package/dist/src/enterprise/index.js +0 -6
- package/dist/src/enterprise/project-manager.js +0 -584
- package/dist/src/enterprise/security-manager.js +0 -991
- package/dist/src/migration/index.js +0 -92
- package/dist/src/migration/logger.js +0 -121
- package/dist/src/migration/migration-analyzer.js +0 -268
- package/dist/src/migration/migration-runner.js +0 -522
- package/dist/src/migration/migration-validator.js +0 -285
- package/dist/src/migration/progress-reporter.js +0 -150
- package/dist/src/migration/rollback-manager.js +0 -321
- package/dist/src/migration/tests/migration-system.test.js +0 -7
- package/dist/src/migration/types.js +0 -3
- package/dist/src/swarm/__tests__/integration.test.js +0 -227
- package/dist/src/swarm/__tests__/prompt-copier.test.js +0 -344
- package/dist/src/swarm/advanced-orchestrator.js +0 -1095
- package/dist/src/swarm/claude-code-interface.js +0 -961
- package/dist/src/swarm/claude-flow-executor.js +0 -229
- package/dist/src/swarm/consensus-coordinator.js +0 -475
- package/dist/src/swarm/coordinator.js +0 -2993
- package/dist/src/swarm/direct-executor.js +0 -1180
- package/dist/src/swarm/error-recovery/advanced-error-detection.js +0 -691
- package/dist/src/swarm/error-recovery/automated-recovery-workflows.js +0 -998
- package/dist/src/swarm/error-recovery/error-recovery-coordinator.js +0 -1197
- package/dist/src/swarm/error-recovery/recovery-monitoring.js +0 -772
- package/dist/src/swarm/error-recovery/resilience-architecture.js +0 -714
- package/dist/src/swarm/error-recovery/self-healing-mechanisms.js +0 -1319
- package/dist/src/swarm/error-recovery/test-error-recovery-effectiveness.js +0 -808
- package/dist/src/swarm/executor-v2.js +0 -322
- package/dist/src/swarm/executor.js +0 -815
- package/dist/src/swarm/hive-mind-integration.js +0 -703
- package/dist/src/swarm/index.js +0 -41
- package/dist/src/swarm/json-output-aggregator.js +0 -267
- package/dist/src/swarm/large-scale-coordinator.js +0 -542
- package/dist/src/swarm/mcp-integration-wrapper.js +0 -628
- package/dist/src/swarm/memory.js +0 -1117
- package/dist/src/swarm/optimizations/__tests__/optimization.test.js +0 -348
- package/dist/src/swarm/optimizations/async-file-manager.js +0 -285
- package/dist/src/swarm/optimizations/circular-buffer.js +0 -162
- package/dist/src/swarm/optimizations/connection-pool.js +0 -244
- package/dist/src/swarm/optimizations/index.js +0 -28
- package/dist/src/swarm/optimizations/optimized-executor.js +0 -320
- package/dist/src/swarm/optimizations/ttl-map.js +0 -234
- package/dist/src/swarm/prompt-cli.js +0 -200
- package/dist/src/swarm/prompt-copier-enhanced.js +0 -202
- package/dist/src/swarm/prompt-copier.js +0 -381
- package/dist/src/swarm/prompt-manager.js +0 -295
- package/dist/src/swarm/prompt-utils.js +0 -310
- package/dist/src/swarm/result-aggregator.js +0 -718
- package/dist/src/swarm/sparc-executor.js +0 -1568
- package/dist/src/swarm/strategies/auto.js +0 -758
- package/dist/src/swarm/strategies/base.js +0 -128
- package/dist/src/swarm/strategies/research.js +0 -914
- package/dist/src/swarm/strategies/strategy-metrics-patch.js +0 -2
- package/dist/src/swarm/types.js +0 -52
- package/dist/src/swarm/workers/copy-worker.js +0 -56
- package/dist/src/validators/epic-config-schema.js +0 -214
- package/dist/src/validators/index.js +0 -10
- package/dist/src/validators/swarm-init-validator.js +0 -259
- package/dist/src/validators/todowrite-batching-validator.js +0 -215
- package/dist/src/validators/todowrite-integration.js +0 -187
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/documentSymbols/browser/documentSymbols.js +0 -23
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/dropOrPasteInto/browser/copyPasteContribution.js +0 -57
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/dropOrPasteInto/browser/copyPasteController.js +0 -401
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/dropOrPasteInto/browser/defaultProviders.js +0 -181
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/dropOrPasteInto/browser/dropIntoEditorContribution.js +0 -44
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/dropOrPasteInto/browser/dropIntoEditorController.js +0 -157
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/dropOrPasteInto/browser/edit.js +0 -71
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/editorState/browser/editorState.js +0 -112
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/find/browser/findController.js +0 -990
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/find/browser/findDecorations.js +0 -296
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/find/browser/findModel.js +0 -488
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/find/browser/findOptionsWidget.js +0 -138
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/find/browser/findState.js +0 -243
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/find/browser/findWidget.js +0 -1177
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/folding/browser/folding.js +0 -1093
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/folding/browser/foldingDecorations.js +0 -133
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/folding/browser/foldingModel.js +0 -538
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/folding/browser/foldingRanges.js +0 -351
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/fontZoom/browser/fontZoom.js +0 -49
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/format/browser/format.js +0 -360
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/format/browser/formatActions.js +0 -263
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/format/browser/formattingEdit.js +0 -54
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/gotoSymbol/browser/link/clickLinkGesture.js +0 -149
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/hover/browser/contentHover.js +0 -874
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/inlineCompletions/browser/commandIds.js +0 -7
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/inlineCompletions/browser/commands.js +0 -199
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/linesOperations/browser/copyLinesCommand.js +0 -70
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/quickAccess/browser/commandsQuickAccess.js +0 -26
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/quickAccess/browser/editorNavigationQuickAccess.js +0 -153
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/readOnlyMessage/browser/contribution.js +0 -33
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/semanticTokens/browser/documentSemanticTokens.js +0 -354
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/smartSelect/browser/bracketSelections.js +0 -146
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/suggest/browser/completionModel.js +0 -224
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/unicodeHighlighter/browser/bannerController.js +0 -119
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/edcore.main.js +0 -14
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/editor.all.js +0 -63
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/editor.api.js +0 -55
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/editor.main.js +0 -7
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/editor.worker.js +0 -25
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/standalone/browser/colorizer.js +0 -118
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/language/css/css.worker.js +0 -36869
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/language/css/cssMode.js +0 -2035
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/accessibility/browser/accessibilityService.js +0 -88
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/accessibility/common/accessibility.js +0 -9
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/action/common/action.js +0 -7
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/action/common/actionCommonCategories.js +0 -13
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/actionWidget/browser/actionList.js +0 -276
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/actionWidget/browser/actionWidget.js +0 -248
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/actionWidget/common/actionWidget.js +0 -5
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/actions/common/actions.js +0 -409
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/audioCues/browser/audioCueService.js +0 -176
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/clipboard/browser/clipboardService.js +0 -141
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/clipboard/common/clipboardService.js +0 -6
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/commands/common/commands.js +0 -80
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/configuration/common/configuration.js +0 -86
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/configuration/common/configurationModels.js +0 -554
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/configuration/common/configurationRegistry.js +0 -317
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/configuration/common/configurations.js +0 -41
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/contextkey/browser/contextKeyService.js +0 -432
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/contextkey/common/contextkey.js +0 -1547
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/contextkey/common/contextkeys.js +0 -18
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/contextview/browser/contextMenuHandler.js +0 -124
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/contextview/browser/contextMenuService.js +0 -101
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/contextview/browser/contextView.js +0 -7
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/contextview/browser/contextViewService.js +0 -72
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/dialogs/common/dialogs.js +0 -2
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/dnd/browser/dnd.js +0 -36
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/editor/common/editor.js +0 -17
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/environment/common/environment.js +0 -2
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/extensions/common/extensions.js +0 -47
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/files/common/files.js +0 -9
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/history/browser/contextScopedHistoryWidget.js +0 -105
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/instantiation/common/descriptors.js +0 -11
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/instantiation/common/extensions.js +0 -15
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/keybinding/common/abstractKeybindingService.js +0 -277
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/keybinding/common/baseResolvedKeybinding.js +0 -53
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/quickinput/browser/commandsQuickAccess.js +0 -354
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/theme/browser/defaultStyles.js +0 -162
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/theme/common/colorRegistry.js +0 -482
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/basic-languages/abap/abap.js +0 -10
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/basic-languages/apex/apex.js +0 -10
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/basic-languages/azcli/azcli.js +0 -10
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/basic-languages/bat/bat.js +0 -10
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/basic-languages/bicep/bicep.js +0 -11
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/basic-languages/cameligo/cameligo.js +0 -10
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/basic-languages/clojure/clojure.js +0 -10
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/basic-languages/coffee/coffee.js +0 -10
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/basic-languages/cpp/cpp.js +0 -10
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/basic-languages/csharp/csharp.js +0 -10
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/basic-languages/csp/csp.js +0 -10
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/basic-languages/css/css.js +0 -12
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/basic-languages/cypher/cypher.js +0 -10
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/basic-languages/dart/dart.js +0 -10
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/basic-languages/dockerfile/dockerfile.js +0 -10
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/basic-languages/ecl/ecl.js +0 -10
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/basic-languages/elixir/elixir.js +0 -10
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/basic-languages/flow9/flow9.js +0 -10
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/editor/editor.main.js +0 -745
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/editor/editor.main.nls.de.js +0 -31
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/editor/editor.main.nls.es.js +0 -31
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/editor/editor.main.nls.fr.js +0 -29
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/editor/editor.main.nls.it.js +0 -29
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/editor/editor.main.nls.ja.js +0 -31
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/editor/editor.main.nls.js +0 -29
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/editor/editor.main.nls.ko.js +0 -29
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/editor/editor.main.nls.ru.js +0 -31
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/editor/editor.main.nls.zh-cn.js +0 -31
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/editor/editor.main.nls.zh-tw.js +0 -29
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/language/css/cssMode.js +0 -13
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/language/css/cssWorker.js +0 -81
- package/dist/src/web/frontend/node_modules/.multicast-dns-iKseM9bB/cli.js +0 -64
- package/dist/src/web/frontend/node_modules/.multicast-dns-iKseM9bB/example.js +0 -36
- package/dist/src/web/frontend/node_modules/.multicast-dns-iKseM9bB/index.js +0 -205
- package/dist/src/web/frontend/node_modules/.multicast-dns-iKseM9bB/test.js +0 -260
- package/dist/src/web/frontend/node_modules/.nanoid-PAMEV9Hd/async/index.browser.js +0 -34
- package/dist/src/web/frontend/node_modules/.nanoid-PAMEV9Hd/async/index.js +0 -35
- package/dist/src/web/frontend/node_modules/.nanoid-PAMEV9Hd/async/index.native.js +0 -26
- package/dist/src/web/frontend/node_modules/.nanoid-PAMEV9Hd/index.browser.js +0 -34
- package/dist/src/web/frontend/node_modules/.nanoid-PAMEV9Hd/index.js +0 -45
- package/dist/src/web/frontend/node_modules/.nanoid-PAMEV9Hd/nanoid.js +0 -1
- package/dist/src/web/frontend/node_modules/.nanoid-PAMEV9Hd/non-secure/index.js +0 -21
- package/dist/src/web/frontend/node_modules/.nanoid-PAMEV9Hd/url-alphabet/index.js +0 -3
- package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/bin/nodemon.js +0 -16
- package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/lib/cli/index.js +0 -49
- package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/lib/cli/parse.js +0 -230
- package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/lib/config/command.js +0 -43
- package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/lib/config/defaults.js +0 -34
- package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/lib/config/exec.js +0 -234
- package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/lib/config/index.js +0 -93
- package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/lib/config/load.js +0 -225
- package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/lib/help/index.js +0 -27
- package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/lib/index.js +0 -1
- package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/lib/monitor/index.js +0 -4
- package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/lib/monitor/match.js +0 -287
- package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/lib/monitor/run.js +0 -562
- package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/lib/monitor/signals.js +0 -34
- package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/lib/monitor/watch.js +0 -244
- package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/lib/nodemon.js +0 -317
- package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/lib/rules/add.js +0 -89
- package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/lib/rules/index.js +0 -53
- package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/lib/rules/parse.js +0 -43
- package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/lib/spawn.js +0 -74
- package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/lib/utils/bus.js +0 -44
- package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/lib/utils/clone.js +0 -40
- package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/lib/utils/colour.js +0 -26
- package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/lib/utils/index.js +0 -103
- package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/lib/utils/log.js +0 -82
- package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/lib/utils/merge.js +0 -47
- package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/lib/version.js +0 -100
- package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/node_modules/brace-expansion/index.js +0 -201
- package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/node_modules/has-flag/index.js +0 -8
- package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/node_modules/minimatch/minimatch.js +0 -947
- package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/node_modules/supports-color/browser.js +0 -5
- package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/node_modules/supports-color/index.js +0 -131
- package/dist/src/web/frontend/node_modules/.pidtree-icfat3SQ/bin/pidtree.js +0 -128
- package/dist/src/web/frontend/node_modules/.pidtree-icfat3SQ/index.js +0 -49
- package/dist/src/web/frontend/node_modules/.pidtree-icfat3SQ/lib/bin.js +0 -61
- package/dist/src/web/frontend/node_modules/.pidtree-icfat3SQ/lib/get.js +0 -45
- package/dist/src/web/frontend/node_modules/.pidtree-icfat3SQ/lib/pidtree.js +0 -104
- package/dist/src/web/frontend/node_modules/.pidtree-icfat3SQ/lib/ps.js +0 -47
- package/dist/src/web/frontend/node_modules/.pidtree-icfat3SQ/lib/wmic.js +0 -49
- package/dist/src/web/frontend/node_modules/.prettier-ApZm3b7s/doc.js +0 -1270
- package/dist/src/web/frontend/node_modules/.prettier-ApZm3b7s/plugins/acorn.js +0 -15
- package/dist/src/web/frontend/node_modules/.prettier-ApZm3b7s/plugins/angular.js +0 -2
- package/dist/src/web/frontend/node_modules/.prettier-ApZm3b7s/plugins/babel.js +0 -15
- package/dist/src/web/frontend/node_modules/.prettier-ApZm3b7s/plugins/estree.js +0 -36
- package/dist/src/web/frontend/node_modules/.prettier-ApZm3b7s/plugins/flow.js +0 -19
- package/dist/src/web/frontend/node_modules/.prettier-ApZm3b7s/plugins/glimmer.js +0 -29
- package/dist/src/web/frontend/node_modules/.prettier-ApZm3b7s/plugins/graphql.js +0 -29
- package/dist/src/web/frontend/node_modules/.prettier-ApZm3b7s/plugins/html.js +0 -22
- package/dist/src/web/frontend/node_modules/.prettier-ApZm3b7s/plugins/markdown.js +0 -63
- package/dist/src/web/frontend/node_modules/.prettier-ApZm3b7s/plugins/meriyah.js +0 -4
- package/dist/src/web/frontend/node_modules/.prettier-ApZm3b7s/plugins/postcss.js +0 -54
- package/dist/src/web/frontend/node_modules/.prettier-ApZm3b7s/plugins/typescript.js +0 -20
- package/dist/src/web/frontend/node_modules/.prettier-ApZm3b7s/plugins/yaml.js +0 -160
- package/dist/src/web/frontend/node_modules/.prettier-ApZm3b7s/standalone.js +0 -34
- package/dist/src/web/frontend/node_modules/.react-scripts-OTANyoRb/bin/react-scripts.js +0 -58
- package/dist/src/web/frontend/node_modules/.react-scripts-OTANyoRb/config/env.js +0 -112
- package/dist/src/web/frontend/node_modules/.react-scripts-OTANyoRb/config/getHttpsConfig.js +0 -74
- package/dist/src/web/frontend/node_modules/.react-scripts-OTANyoRb/config/jest/babelTransform.js +0 -37
- package/dist/src/web/frontend/node_modules/.react-scripts-OTANyoRb/config/jest/cssTransform.js +0 -22
- package/dist/src/web/frontend/node_modules/.react-scripts-OTANyoRb/config/jest/fileTransform.js +0 -40
- package/dist/src/web/frontend/node_modules/.react-scripts-OTANyoRb/config/modules.js +0 -142
- package/dist/src/web/frontend/node_modules/.react-scripts-OTANyoRb/config/paths.js +0 -153
- package/dist/src/web/frontend/node_modules/.react-scripts-OTANyoRb/config/webpack/persistentCache/createEnvironmentHash.js +0 -9
- package/dist/src/web/frontend/node_modules/.react-scripts-OTANyoRb/config/webpack.config.js +0 -796
- package/dist/src/web/frontend/node_modules/.react-scripts-OTANyoRb/config/webpackDevServer.config.js +0 -135
- package/dist/src/web/frontend/node_modules/.react-scripts-OTANyoRb/scripts/build.js +0 -225
- package/dist/src/web/frontend/node_modules/.react-scripts-OTANyoRb/scripts/eject.js +0 -340
|
@@ -1,980 +1,1045 @@
|
|
|
1
1
|
// SPARC Coordinator
|
|
2
2
|
// Integrates SPARC methodology with swarm system for enhanced coordination
|
|
3
|
+
|
|
4
|
+
import { SparcPhase } from './phase-base.js';
|
|
5
|
+
|
|
3
6
|
export class SparcCoordinator {
|
|
4
|
-
|
|
7
|
+
constructor(phases, options = {}) {
|
|
8
|
+
this.phases = phases;
|
|
9
|
+
this.options = options;
|
|
10
|
+
this.swarmId = null;
|
|
11
|
+
this.agents = [];
|
|
12
|
+
this.phaseAgents = new Map();
|
|
13
|
+
this.coordination = {
|
|
14
|
+
strategy: 'adaptive',
|
|
15
|
+
topology: 'hierarchical',
|
|
16
|
+
communication: 'event-driven',
|
|
17
|
+
loadBalancing: 'capability-based',
|
|
18
|
+
};
|
|
19
|
+
this.metrics = {
|
|
20
|
+
phaseExecutions: 0,
|
|
21
|
+
agentUtilization: {},
|
|
22
|
+
coordinationEfficiency: 0,
|
|
23
|
+
qualityGates: [],
|
|
24
|
+
learningData: [],
|
|
25
|
+
};
|
|
26
|
+
this.neuralContext = null;
|
|
27
|
+
this.swarmEnabled = options.swarmEnabled || false;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
5
31
|
* Initialize swarm for SPARC execution
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
console.log('🐝 Initializing SPARC Swarm Coordination');
|
|
12
|
-
try {
|
|
13
|
-
// Initialize swarm using ruv-swarm hooks
|
|
14
|
-
const swarmConfig = {
|
|
15
|
-
topology: this.coordination.topology,
|
|
16
|
-
maxAgents: this.calculateOptimalAgentCount(),
|
|
17
|
-
strategy: 'sparc_methodology',
|
|
18
|
-
communication: this.coordination.communication,
|
|
19
|
-
loadBalancing: this.coordination.loadBalancing
|
|
20
|
-
};
|
|
21
|
-
this.swarmId = await this.executeSwarmHook('swarm_init', swarmConfig);
|
|
22
|
-
console.log(`🆔 Swarm initialized: ${this.swarmId}`);
|
|
23
|
-
// Spawn specialized SPARC agents
|
|
24
|
-
await this.spawnSparcAgents();
|
|
25
|
-
// Setup inter-phase coordination
|
|
26
|
-
await this.setupPhaseCoordination();
|
|
27
|
-
console.log('✅ SPARC Swarm coordination initialized');
|
|
28
|
-
} catch (error) {
|
|
29
|
-
console.warn(`⚠️ Swarm initialization failed: ${error.message}`);
|
|
30
|
-
console.log('🔄 Falling back to standalone mode');
|
|
31
|
-
this.swarmEnabled = false;
|
|
32
|
-
}
|
|
32
|
+
*/
|
|
33
|
+
async initializeSwarm() {
|
|
34
|
+
if (!this.swarmEnabled) {
|
|
35
|
+
console.log('🔄 SPARC running in standalone mode');
|
|
36
|
+
return;
|
|
33
37
|
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
38
|
+
|
|
39
|
+
console.log('🐝 Initializing SPARC Swarm Coordination');
|
|
40
|
+
|
|
41
|
+
try {
|
|
42
|
+
// Initialize swarm using ruv-swarm hooks
|
|
43
|
+
const swarmConfig = {
|
|
44
|
+
topology: this.coordination.topology,
|
|
45
|
+
maxAgents: this.calculateOptimalAgentCount(),
|
|
46
|
+
strategy: 'sparc_methodology',
|
|
47
|
+
communication: this.coordination.communication,
|
|
48
|
+
loadBalancing: this.coordination.loadBalancing,
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
this.swarmId = await this.executeSwarmHook('swarm_init', swarmConfig);
|
|
52
|
+
console.log(`🆔 Swarm initialized: ${this.swarmId}`);
|
|
53
|
+
|
|
54
|
+
// Spawn specialized SPARC agents
|
|
55
|
+
await this.spawnSparcAgents();
|
|
56
|
+
|
|
57
|
+
// Setup inter-phase coordination
|
|
58
|
+
await this.setupPhaseCoordination();
|
|
59
|
+
|
|
60
|
+
console.log('✅ SPARC Swarm coordination initialized');
|
|
61
|
+
} catch (error) {
|
|
62
|
+
console.warn(`⚠️ Swarm initialization failed: ${error.message}`);
|
|
63
|
+
console.log('🔄 Falling back to standalone mode');
|
|
64
|
+
this.swarmEnabled = false;
|
|
41
65
|
}
|
|
42
|
-
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Calculate optimal agent count based on SPARC phases
|
|
70
|
+
*/
|
|
71
|
+
calculateOptimalAgentCount() {
|
|
72
|
+
const baseAgents = Object.keys(this.phases).length; // One per phase
|
|
73
|
+
const complexityMultiplier = this.assessTaskComplexity();
|
|
74
|
+
const parallelismFactor = this.options.parallelExecution ? 2 : 1;
|
|
75
|
+
|
|
76
|
+
return Math.min(20, Math.max(5, baseAgents * complexityMultiplier * parallelismFactor));
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
43
80
|
* Assess task complexity for agent allocation
|
|
44
|
-
*/
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
81
|
+
*/
|
|
82
|
+
assessTaskComplexity() {
|
|
83
|
+
const taskDescription = this.options.taskDescription || '';
|
|
84
|
+
const complexityKeywords = [
|
|
85
|
+
'complex',
|
|
86
|
+
'enterprise',
|
|
87
|
+
'scalable',
|
|
88
|
+
'distributed',
|
|
89
|
+
'microservice',
|
|
90
|
+
'integration',
|
|
91
|
+
];
|
|
92
|
+
const matchedKeywords = complexityKeywords.filter((keyword) =>
|
|
93
|
+
taskDescription.toLowerCase().includes(keyword),
|
|
94
|
+
);
|
|
95
|
+
|
|
96
|
+
if (matchedKeywords.length >= 3) return 3; // High complexity
|
|
97
|
+
if (matchedKeywords.length >= 1) return 2; // Medium complexity
|
|
98
|
+
return 1; // Low complexity
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/**
|
|
60
102
|
* Spawn specialized SPARC agents
|
|
61
|
-
*/
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
const agentId = await this.executeSwarmHook('agent_spawn', {
|
|
121
|
-
type: agentSpec.type,
|
|
122
|
-
role: agentSpec.role,
|
|
123
|
-
capabilities: agentSpec.capabilities,
|
|
124
|
-
maxConcurrentTasks: this.getAgentConcurrency(agentSpec.type),
|
|
125
|
-
specialization: 'sparc_methodology'
|
|
126
|
-
});
|
|
127
|
-
const agent = {
|
|
128
|
-
id: agentId,
|
|
129
|
-
type: agentSpec.type,
|
|
130
|
-
role: agentSpec.role,
|
|
131
|
-
capabilities: agentSpec.capabilities,
|
|
132
|
-
status: 'ready',
|
|
133
|
-
currentPhase: null,
|
|
134
|
-
assignedTasks: [],
|
|
135
|
-
performance: {
|
|
136
|
-
tasksCompleted: 0,
|
|
137
|
-
averageTime: 0,
|
|
138
|
-
qualityScore: 1.0,
|
|
139
|
-
efficiency: 1.0
|
|
140
|
-
}
|
|
141
|
-
};
|
|
142
|
-
this.agents.push(agent);
|
|
143
|
-
console.log(` 🤖 Spawned ${agentSpec.role} (${agentSpec.type})`);
|
|
144
|
-
} catch (error) {
|
|
145
|
-
console.warn(`⚠️ Failed to spawn ${agentSpec.role}: ${error.message}`);
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
/**
|
|
150
|
-
* Get agent concurrency based on type
|
|
151
|
-
*/ getAgentConcurrency(agentType) {
|
|
152
|
-
const concurrencyMap = {
|
|
153
|
-
sparc_specification: 2,
|
|
154
|
-
sparc_pseudocode: 1,
|
|
155
|
-
sparc_architecture: 3,
|
|
156
|
-
sparc_refinement: 4,
|
|
157
|
-
sparc_completion: 2,
|
|
158
|
-
sparc_coordinator: 1
|
|
103
|
+
*/
|
|
104
|
+
async spawnSparcAgents() {
|
|
105
|
+
const agentTypes = [
|
|
106
|
+
{
|
|
107
|
+
type: 'sparc_specification',
|
|
108
|
+
role: 'Requirements Analyst',
|
|
109
|
+
capabilities: ['analysis', 'documentation', 'validation'],
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
type: 'sparc_pseudocode',
|
|
113
|
+
role: 'Logic Designer',
|
|
114
|
+
capabilities: ['design', 'flowcharts', 'algorithms'],
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
type: 'sparc_architecture',
|
|
118
|
+
role: 'System Architect',
|
|
119
|
+
capabilities: ['architecture', 'design_patterns', 'scalability'],
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
type: 'sparc_refinement',
|
|
123
|
+
role: 'TDD Engineer',
|
|
124
|
+
capabilities: ['testing', 'refactoring', 'code_quality'],
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
type: 'sparc_completion',
|
|
128
|
+
role: 'Integration Specialist',
|
|
129
|
+
capabilities: ['integration', 'deployment', 'validation'],
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
type: 'sparc_coordinator',
|
|
133
|
+
role: 'SPARC Orchestrator',
|
|
134
|
+
capabilities: ['coordination', 'monitoring', 'optimization'],
|
|
135
|
+
},
|
|
136
|
+
];
|
|
137
|
+
|
|
138
|
+
for (const agentSpec of agentTypes) {
|
|
139
|
+
try {
|
|
140
|
+
const agentId = await this.executeSwarmHook('agent_spawn', {
|
|
141
|
+
type: agentSpec.type,
|
|
142
|
+
role: agentSpec.role,
|
|
143
|
+
capabilities: agentSpec.capabilities,
|
|
144
|
+
maxConcurrentTasks: this.getAgentConcurrency(agentSpec.type),
|
|
145
|
+
specialization: 'sparc_methodology',
|
|
146
|
+
});
|
|
147
|
+
|
|
148
|
+
const agent = {
|
|
149
|
+
id: agentId,
|
|
150
|
+
type: agentSpec.type,
|
|
151
|
+
role: agentSpec.role,
|
|
152
|
+
capabilities: agentSpec.capabilities,
|
|
153
|
+
status: 'ready',
|
|
154
|
+
currentPhase: null,
|
|
155
|
+
assignedTasks: [],
|
|
156
|
+
performance: {
|
|
157
|
+
tasksCompleted: 0,
|
|
158
|
+
averageTime: 0,
|
|
159
|
+
qualityScore: 1.0,
|
|
160
|
+
efficiency: 1.0,
|
|
161
|
+
},
|
|
159
162
|
};
|
|
160
|
-
|
|
163
|
+
|
|
164
|
+
this.agents.push(agent);
|
|
165
|
+
console.log(` 🤖 Spawned ${agentSpec.role} (${agentSpec.type})`);
|
|
166
|
+
} catch (error) {
|
|
167
|
+
console.warn(`⚠️ Failed to spawn ${agentSpec.role}: ${error.message}`);
|
|
168
|
+
}
|
|
161
169
|
}
|
|
162
|
-
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* Get agent concurrency based on type
|
|
174
|
+
*/
|
|
175
|
+
getAgentConcurrency(agentType) {
|
|
176
|
+
const concurrencyMap = {
|
|
177
|
+
sparc_specification: 2,
|
|
178
|
+
sparc_pseudocode: 1,
|
|
179
|
+
sparc_architecture: 3,
|
|
180
|
+
sparc_refinement: 4,
|
|
181
|
+
sparc_completion: 2,
|
|
182
|
+
sparc_coordinator: 1,
|
|
183
|
+
};
|
|
184
|
+
|
|
185
|
+
return concurrencyMap[agentType] || 2;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
/**
|
|
163
189
|
* Setup phase coordination
|
|
164
|
-
*/
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
this.phaseAgents.get(phaseName).push(agent);
|
|
173
|
-
}
|
|
190
|
+
*/
|
|
191
|
+
async setupPhaseCoordination() {
|
|
192
|
+
// Map agents to phases
|
|
193
|
+
for (const agent of this.agents) {
|
|
194
|
+
const phaseName = agent.type.replace('sparc_', '');
|
|
195
|
+
if (this.phases[phaseName]) {
|
|
196
|
+
if (!this.phaseAgents.has(phaseName)) {
|
|
197
|
+
this.phaseAgents.set(phaseName, []);
|
|
174
198
|
}
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
phases: Object.keys(this.phases),
|
|
178
|
-
dependencies: {
|
|
179
|
-
pseudocode: [
|
|
180
|
-
'specification'
|
|
181
|
-
],
|
|
182
|
-
architecture: [
|
|
183
|
-
'specification',
|
|
184
|
-
'pseudocode'
|
|
185
|
-
],
|
|
186
|
-
refinement: [
|
|
187
|
-
'specification',
|
|
188
|
-
'pseudocode',
|
|
189
|
-
'architecture'
|
|
190
|
-
],
|
|
191
|
-
completion: [
|
|
192
|
-
'specification',
|
|
193
|
-
'pseudocode',
|
|
194
|
-
'architecture',
|
|
195
|
-
'refinement'
|
|
196
|
-
]
|
|
197
|
-
}
|
|
198
|
-
});
|
|
199
|
-
// Setup quality gates between phases
|
|
200
|
-
await this.setupQualityGates();
|
|
199
|
+
this.phaseAgents.get(phaseName).push(agent);
|
|
200
|
+
}
|
|
201
201
|
}
|
|
202
|
-
|
|
202
|
+
|
|
203
|
+
// Setup phase dependencies
|
|
204
|
+
await this.executeSwarmHook('setup_dependencies', {
|
|
205
|
+
phases: Object.keys(this.phases),
|
|
206
|
+
dependencies: {
|
|
207
|
+
pseudocode: ['specification'],
|
|
208
|
+
architecture: ['specification', 'pseudocode'],
|
|
209
|
+
refinement: ['specification', 'pseudocode', 'architecture'],
|
|
210
|
+
completion: ['specification', 'pseudocode', 'architecture', 'refinement'],
|
|
211
|
+
},
|
|
212
|
+
});
|
|
213
|
+
|
|
214
|
+
// Setup quality gates between phases
|
|
215
|
+
await this.setupQualityGates();
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
/**
|
|
203
219
|
* Setup quality gates between phases
|
|
204
|
-
*/
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
threshold: 0.8
|
|
237
|
-
},
|
|
238
|
-
{
|
|
239
|
-
phase: 'completion',
|
|
240
|
-
criteria: [
|
|
241
|
-
'validation_passed',
|
|
242
|
-
'deployment_successful'
|
|
243
|
-
],
|
|
244
|
-
threshold: 0.9
|
|
245
|
-
}
|
|
246
|
-
];
|
|
247
|
-
for (const gate of qualityGates){
|
|
248
|
-
await this.executeSwarmHook('register_quality_gate', gate);
|
|
249
|
-
}
|
|
220
|
+
*/
|
|
221
|
+
async setupQualityGates() {
|
|
222
|
+
const qualityGates = [
|
|
223
|
+
{
|
|
224
|
+
phase: 'specification',
|
|
225
|
+
criteria: ['requirements_complete', 'acceptance_criteria_defined'],
|
|
226
|
+
threshold: 0.9,
|
|
227
|
+
},
|
|
228
|
+
{
|
|
229
|
+
phase: 'pseudocode',
|
|
230
|
+
criteria: ['flow_diagram_complete', 'algorithms_defined'],
|
|
231
|
+
threshold: 0.85,
|
|
232
|
+
},
|
|
233
|
+
{
|
|
234
|
+
phase: 'architecture',
|
|
235
|
+
criteria: ['components_defined', 'patterns_selected'],
|
|
236
|
+
threshold: 0.85,
|
|
237
|
+
},
|
|
238
|
+
{
|
|
239
|
+
phase: 'refinement',
|
|
240
|
+
criteria: ['tests_passing', 'code_quality_acceptable'],
|
|
241
|
+
threshold: 0.8,
|
|
242
|
+
},
|
|
243
|
+
{
|
|
244
|
+
phase: 'completion',
|
|
245
|
+
criteria: ['validation_passed', 'deployment_successful'],
|
|
246
|
+
threshold: 0.9,
|
|
247
|
+
},
|
|
248
|
+
];
|
|
249
|
+
|
|
250
|
+
for (const gate of qualityGates) {
|
|
251
|
+
await this.executeSwarmHook('register_quality_gate', gate);
|
|
250
252
|
}
|
|
251
|
-
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
/**
|
|
252
256
|
* Pre-phase coordination
|
|
253
|
-
*/
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
257
|
+
*/
|
|
258
|
+
async prePhase(phaseName) {
|
|
259
|
+
if (!this.swarmEnabled) return;
|
|
260
|
+
|
|
261
|
+
console.log(`🔄 Pre-phase coordination: ${phaseName}`);
|
|
262
|
+
|
|
263
|
+
try {
|
|
264
|
+
// Load neural context for the phase
|
|
265
|
+
await this.loadNeuralContext(phaseName);
|
|
266
|
+
|
|
267
|
+
// Assign agents to phase
|
|
268
|
+
await this.assignAgentsToPhase(phaseName);
|
|
269
|
+
|
|
270
|
+
// Prepare phase environment
|
|
271
|
+
await this.preparePhaseEnvironment(phaseName);
|
|
272
|
+
|
|
273
|
+
// Store phase initiation in memory
|
|
274
|
+
await this.executeSwarmHook('memory_store', {
|
|
275
|
+
key: `sparc_phase_${phaseName}_start`,
|
|
276
|
+
value: {
|
|
277
|
+
timestamp: Date.now(),
|
|
278
|
+
agents: this.phaseAgents.get(phaseName)?.map((a) => a.id) || [],
|
|
279
|
+
neuralContext: this.neuralContext,
|
|
280
|
+
},
|
|
281
|
+
});
|
|
282
|
+
} catch (error) {
|
|
283
|
+
console.warn(`⚠️ Pre-phase coordination failed for ${phaseName}: ${error.message}`);
|
|
275
284
|
}
|
|
276
|
-
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
/**
|
|
277
288
|
* Load neural context for phase
|
|
278
|
-
*/
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
289
|
+
*/
|
|
290
|
+
async loadNeuralContext(phaseName) {
|
|
291
|
+
try {
|
|
292
|
+
const neuralData = await this.executeSwarmHook('neural_load_context', {
|
|
293
|
+
phase: phaseName,
|
|
294
|
+
methodology: 'sparc',
|
|
295
|
+
taskType: this.classifyTaskType(),
|
|
296
|
+
});
|
|
297
|
+
|
|
298
|
+
this.neuralContext = {
|
|
299
|
+
phase: phaseName,
|
|
300
|
+
patterns: neuralData.patterns || [],
|
|
301
|
+
insights: neuralData.insights || [],
|
|
302
|
+
recommendations: neuralData.recommendations || [],
|
|
303
|
+
confidence: neuralData.confidence || 0.5,
|
|
304
|
+
};
|
|
305
|
+
|
|
306
|
+
console.log(
|
|
307
|
+
`🧠 Neural context loaded for ${phaseName} (confidence: ${this.neuralContext.confidence.toFixed(2)})`,
|
|
308
|
+
);
|
|
309
|
+
} catch (error) {
|
|
310
|
+
console.warn(`⚠️ Neural context loading failed: ${error.message}`);
|
|
311
|
+
this.neuralContext = {
|
|
312
|
+
phase: phaseName,
|
|
313
|
+
patterns: [],
|
|
314
|
+
insights: [],
|
|
315
|
+
recommendations: [],
|
|
316
|
+
confidence: 0.5,
|
|
317
|
+
};
|
|
303
318
|
}
|
|
304
|
-
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
/**
|
|
305
322
|
* Classify task type for neural learning
|
|
306
|
-
*/
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
323
|
+
*/
|
|
324
|
+
classifyTaskType() {
|
|
325
|
+
const taskDescription = this.options.taskDescription || '';
|
|
326
|
+
const taskLower = taskDescription.toLowerCase();
|
|
327
|
+
|
|
328
|
+
if (taskLower.includes('api') || taskLower.includes('service')) return 'api_development';
|
|
329
|
+
if (taskLower.includes('ui') || taskLower.includes('frontend')) return 'frontend_development';
|
|
330
|
+
if (taskLower.includes('data') || taskLower.includes('database')) return 'data_management';
|
|
331
|
+
if (taskLower.includes('test') || taskLower.includes('testing')) return 'testing';
|
|
332
|
+
if (taskLower.includes('deploy') || taskLower.includes('infrastructure')) return 'deployment';
|
|
333
|
+
|
|
334
|
+
return 'general_development';
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
/**
|
|
317
338
|
* Assign agents to phase
|
|
318
|
-
*/
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
const coordinator = this.agents.find((a)=>a.type === 'sparc_coordinator');
|
|
333
|
-
if (coordinator) {
|
|
334
|
-
coordinator.currentPhase = phaseName;
|
|
335
|
-
coordinator.status = 'assigned';
|
|
336
|
-
await this.executeSwarmHook('agent_assign', {
|
|
337
|
-
agentId: coordinator.id,
|
|
338
|
-
phase: phaseName,
|
|
339
|
-
priority: this.getPhasePriority(phaseName),
|
|
340
|
-
context: this.neuralContext
|
|
341
|
-
});
|
|
342
|
-
}
|
|
343
|
-
}
|
|
339
|
+
*/
|
|
340
|
+
async assignAgentsToPhase(phaseName) {
|
|
341
|
+
const phaseAgents = this.phaseAgents.get(phaseName) || [];
|
|
342
|
+
|
|
343
|
+
for (const agent of phaseAgents) {
|
|
344
|
+
agent.currentPhase = phaseName;
|
|
345
|
+
agent.status = 'assigned';
|
|
346
|
+
|
|
347
|
+
await this.executeSwarmHook('agent_assign', {
|
|
348
|
+
agentId: agent.id,
|
|
349
|
+
phase: phaseName,
|
|
350
|
+
priority: this.getPhasePriority(phaseName),
|
|
351
|
+
context: this.neuralContext,
|
|
352
|
+
});
|
|
344
353
|
}
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
354
|
+
|
|
355
|
+
// If no dedicated agents, assign general coordinator
|
|
356
|
+
if (phaseAgents.length === 0) {
|
|
357
|
+
const coordinator = this.agents.find((a) => a.type === 'sparc_coordinator');
|
|
358
|
+
if (coordinator) {
|
|
359
|
+
coordinator.currentPhase = phaseName;
|
|
360
|
+
coordinator.status = 'assigned';
|
|
361
|
+
|
|
362
|
+
await this.executeSwarmHook('agent_assign', {
|
|
363
|
+
agentId: coordinator.id,
|
|
364
|
+
phase: phaseName,
|
|
365
|
+
priority: this.getPhasePriority(phaseName),
|
|
366
|
+
context: this.neuralContext,
|
|
367
|
+
});
|
|
368
|
+
}
|
|
356
369
|
}
|
|
357
|
-
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
/**
|
|
373
|
+
* Get phase priority for scheduling
|
|
374
|
+
*/
|
|
375
|
+
getPhasePriority(phaseName) {
|
|
376
|
+
const priorities = {
|
|
377
|
+
specification: 5, // Highest priority
|
|
378
|
+
pseudocode: 4,
|
|
379
|
+
architecture: 4,
|
|
380
|
+
refinement: 3,
|
|
381
|
+
completion: 2,
|
|
382
|
+
};
|
|
383
|
+
|
|
384
|
+
return priorities[phaseName] || 1;
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
/**
|
|
358
388
|
* Prepare phase environment
|
|
359
|
-
*/
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
]
|
|
377
|
-
});
|
|
378
|
-
}
|
|
389
|
+
*/
|
|
390
|
+
async preparePhaseEnvironment(phaseName) {
|
|
391
|
+
// Create phase-specific workspace
|
|
392
|
+
await this.executeSwarmHook('create_workspace', {
|
|
393
|
+
phase: phaseName,
|
|
394
|
+
namespace: this.options.namespace || 'sparc',
|
|
395
|
+
isolation: true,
|
|
396
|
+
});
|
|
397
|
+
|
|
398
|
+
// Load previous phase artifacts
|
|
399
|
+
const dependencies = this.getPhaseDependencies(phaseName);
|
|
400
|
+
for (const dependency of dependencies) {
|
|
401
|
+
await this.executeSwarmHook('load_artifacts', {
|
|
402
|
+
fromPhase: dependency,
|
|
403
|
+
toPhase: phaseName,
|
|
404
|
+
artifactTypes: ['outputs', 'decisions', 'validations'],
|
|
405
|
+
});
|
|
379
406
|
}
|
|
380
|
-
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
/**
|
|
381
410
|
* Get phase dependencies
|
|
382
|
-
*/
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
],
|
|
397
|
-
completion: [
|
|
398
|
-
'specification',
|
|
399
|
-
'pseudocode',
|
|
400
|
-
'architecture',
|
|
401
|
-
'refinement'
|
|
402
|
-
]
|
|
403
|
-
};
|
|
404
|
-
return dependencies[phaseName] || [];
|
|
405
|
-
}
|
|
406
|
-
/**
|
|
411
|
+
*/
|
|
412
|
+
getPhaseDependencies(phaseName) {
|
|
413
|
+
const dependencies = {
|
|
414
|
+
specification: [],
|
|
415
|
+
pseudocode: ['specification'],
|
|
416
|
+
architecture: ['specification', 'pseudocode'],
|
|
417
|
+
refinement: ['specification', 'pseudocode', 'architecture'],
|
|
418
|
+
completion: ['specification', 'pseudocode', 'architecture', 'refinement'],
|
|
419
|
+
};
|
|
420
|
+
|
|
421
|
+
return dependencies[phaseName] || [];
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
/**
|
|
407
425
|
* Post-phase coordination
|
|
408
|
-
*/
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
}
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
426
|
+
*/
|
|
427
|
+
async postPhase(phaseName, result) {
|
|
428
|
+
if (!this.swarmEnabled) return;
|
|
429
|
+
|
|
430
|
+
console.log(`✅ Post-phase coordination: ${phaseName}`);
|
|
431
|
+
|
|
432
|
+
try {
|
|
433
|
+
// Validate phase results
|
|
434
|
+
const validation = await this.validatePhaseResults(phaseName, result);
|
|
435
|
+
|
|
436
|
+
// Update agent performance
|
|
437
|
+
await this.updateAgentPerformance(phaseName, result, validation);
|
|
438
|
+
|
|
439
|
+
// Store phase completion in memory
|
|
440
|
+
await this.executeSwarmHook('memory_store', {
|
|
441
|
+
key: `sparc_phase_${phaseName}_complete`,
|
|
442
|
+
value: {
|
|
443
|
+
timestamp: Date.now(),
|
|
444
|
+
result: result,
|
|
445
|
+
validation: validation,
|
|
446
|
+
agents:
|
|
447
|
+
this.phaseAgents.get(phaseName)?.map((a) => ({
|
|
448
|
+
id: a.id,
|
|
449
|
+
performance: a.performance,
|
|
450
|
+
})) || [],
|
|
451
|
+
},
|
|
452
|
+
});
|
|
453
|
+
|
|
454
|
+
// Neural learning from phase execution
|
|
455
|
+
if (this.options.neuralLearning) {
|
|
456
|
+
await this.recordNeuralLearning(phaseName, result, validation);
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
// Prepare handoff to next phase
|
|
460
|
+
await this.preparePhaseHandoff(phaseName, result);
|
|
461
|
+
|
|
462
|
+
// Update metrics
|
|
463
|
+
this.updateCoordinationMetrics(phaseName, result, validation);
|
|
464
|
+
} catch (error) {
|
|
465
|
+
console.warn(`⚠️ Post-phase coordination failed for ${phaseName}: ${error.message}`);
|
|
440
466
|
}
|
|
441
|
-
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
/**
|
|
442
470
|
* Validate phase results
|
|
443
|
-
*/
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
471
|
+
*/
|
|
472
|
+
async validatePhaseResults(phaseName, result) {
|
|
473
|
+
const validation = {
|
|
474
|
+
phase: phaseName,
|
|
475
|
+
passed: true,
|
|
476
|
+
score: 0,
|
|
477
|
+
issues: [],
|
|
478
|
+
recommendations: [],
|
|
479
|
+
};
|
|
480
|
+
|
|
481
|
+
try {
|
|
482
|
+
// Execute swarm-based validation
|
|
483
|
+
const swarmValidation = await this.executeSwarmHook('validate_phase', {
|
|
484
|
+
phase: phaseName,
|
|
485
|
+
result: result,
|
|
486
|
+
criteria: this.getValidationCriteria(phaseName),
|
|
487
|
+
});
|
|
488
|
+
|
|
489
|
+
validation.passed = swarmValidation.passed;
|
|
490
|
+
validation.score = swarmValidation.score;
|
|
491
|
+
validation.issues = swarmValidation.issues || [];
|
|
492
|
+
validation.recommendations = swarmValidation.recommendations || [];
|
|
493
|
+
} catch (error) {
|
|
494
|
+
console.warn(`⚠️ Swarm validation failed: ${error.message}`);
|
|
495
|
+
// Fallback to basic validation
|
|
496
|
+
validation.passed = !!result;
|
|
497
|
+
validation.score = result ? 85 : 0;
|
|
469
498
|
}
|
|
470
|
-
|
|
499
|
+
|
|
500
|
+
return validation;
|
|
501
|
+
}
|
|
502
|
+
|
|
503
|
+
/**
|
|
471
504
|
* Get validation criteria for phase
|
|
472
|
-
*/
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
],
|
|
502
|
-
qualityThresholds: {
|
|
503
|
-
modularity: 0.8,
|
|
504
|
-
scalability: 0.75
|
|
505
|
-
}
|
|
506
|
-
},
|
|
507
|
-
refinement: {
|
|
508
|
-
requiredFields: [
|
|
509
|
-
'testResults',
|
|
510
|
-
'codeQuality',
|
|
511
|
-
'implementations'
|
|
512
|
-
],
|
|
513
|
-
qualityThresholds: {
|
|
514
|
-
testCoverage: 0.8,
|
|
515
|
-
codeQuality: 0.75
|
|
516
|
-
}
|
|
517
|
-
},
|
|
518
|
-
completion: {
|
|
519
|
-
requiredFields: [
|
|
520
|
-
'validation',
|
|
521
|
-
'deployment',
|
|
522
|
-
'documentation'
|
|
523
|
-
],
|
|
524
|
-
qualityThresholds: {
|
|
525
|
-
completeness: 0.9,
|
|
526
|
-
readiness: 0.85
|
|
527
|
-
}
|
|
528
|
-
}
|
|
529
|
-
};
|
|
530
|
-
return criteria[phaseName] || {
|
|
531
|
-
requiredFields: [],
|
|
532
|
-
qualityThresholds: {}
|
|
533
|
-
};
|
|
534
|
-
}
|
|
535
|
-
/**
|
|
505
|
+
*/
|
|
506
|
+
getValidationCriteria(phaseName) {
|
|
507
|
+
const criteria = {
|
|
508
|
+
specification: {
|
|
509
|
+
requiredFields: ['requirements', 'acceptanceCriteria', 'userStories'],
|
|
510
|
+
qualityThresholds: { completeness: 0.9, clarity: 0.8 },
|
|
511
|
+
},
|
|
512
|
+
pseudocode: {
|
|
513
|
+
requiredFields: ['flowDiagram', 'pseudocode', 'algorithms'],
|
|
514
|
+
qualityThresholds: { completeness: 0.85, complexity: 0.7 },
|
|
515
|
+
},
|
|
516
|
+
architecture: {
|
|
517
|
+
requiredFields: ['systemDesign', 'components', 'designPatterns'],
|
|
518
|
+
qualityThresholds: { modularity: 0.8, scalability: 0.75 },
|
|
519
|
+
},
|
|
520
|
+
refinement: {
|
|
521
|
+
requiredFields: ['testResults', 'codeQuality', 'implementations'],
|
|
522
|
+
qualityThresholds: { testCoverage: 0.8, codeQuality: 0.75 },
|
|
523
|
+
},
|
|
524
|
+
completion: {
|
|
525
|
+
requiredFields: ['validation', 'deployment', 'documentation'],
|
|
526
|
+
qualityThresholds: { completeness: 0.9, readiness: 0.85 },
|
|
527
|
+
},
|
|
528
|
+
};
|
|
529
|
+
|
|
530
|
+
return criteria[phaseName] || { requiredFields: [], qualityThresholds: {} };
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
/**
|
|
536
534
|
* Update agent performance metrics
|
|
537
|
-
*/
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
535
|
+
*/
|
|
536
|
+
async updateAgentPerformance(phaseName, result, validation) {
|
|
537
|
+
const phaseAgents = this.phaseAgents.get(phaseName) || [];
|
|
538
|
+
|
|
539
|
+
for (const agent of phaseAgents) {
|
|
540
|
+
agent.performance.tasksCompleted += 1;
|
|
541
|
+
|
|
542
|
+
// Update quality score based on validation
|
|
543
|
+
const qualityScore = validation.score / 100;
|
|
544
|
+
agent.performance.qualityScore = (agent.performance.qualityScore + qualityScore) / 2;
|
|
545
|
+
|
|
546
|
+
// Update efficiency based on execution time
|
|
547
|
+
const executionTime = Date.now() - this.getPhaseStartTime(phaseName);
|
|
548
|
+
const expectedTime = this.getExpectedPhaseTime(phaseName);
|
|
549
|
+
const efficiency = Math.min(1, expectedTime / executionTime);
|
|
550
|
+
agent.performance.efficiency = (agent.performance.efficiency + efficiency) / 2;
|
|
551
|
+
|
|
552
|
+
// Update average time
|
|
553
|
+
agent.performance.averageTime = (agent.performance.averageTime + executionTime) / 2;
|
|
554
|
+
|
|
555
|
+
// Store performance update
|
|
556
|
+
await this.executeSwarmHook('update_agent_performance', {
|
|
557
|
+
agentId: agent.id,
|
|
558
|
+
performance: agent.performance,
|
|
559
|
+
phase: phaseName,
|
|
560
|
+
});
|
|
558
561
|
}
|
|
559
|
-
|
|
562
|
+
}
|
|
563
|
+
|
|
564
|
+
/**
|
|
560
565
|
* Get phase start time
|
|
561
|
-
*/
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
+
*/
|
|
567
|
+
getPhaseStartTime(phaseName) {
|
|
568
|
+
// This would typically be stored in memory or agent state
|
|
569
|
+
return Date.now() - 5 * 60 * 1000; // Default to 5 minutes ago
|
|
570
|
+
}
|
|
571
|
+
|
|
572
|
+
/**
|
|
566
573
|
* Get expected phase execution time
|
|
567
|
-
*/
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
574
|
+
*/
|
|
575
|
+
getExpectedPhaseTime(phaseName) {
|
|
576
|
+
const expectedTimes = {
|
|
577
|
+
specification: 10 * 60 * 1000, // 10 minutes
|
|
578
|
+
pseudocode: 5 * 60 * 1000, // 5 minutes
|
|
579
|
+
architecture: 15 * 60 * 1000, // 15 minutes
|
|
580
|
+
refinement: 20 * 60 * 1000, // 20 minutes
|
|
581
|
+
completion: 10 * 60 * 1000, // 10 minutes
|
|
582
|
+
};
|
|
583
|
+
|
|
584
|
+
return expectedTimes[phaseName] || 10 * 60 * 1000;
|
|
585
|
+
}
|
|
586
|
+
|
|
587
|
+
/**
|
|
578
588
|
* Record neural learning from phase execution
|
|
579
|
-
*/
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
589
|
+
*/
|
|
590
|
+
async recordNeuralLearning(phaseName, result, validation) {
|
|
591
|
+
try {
|
|
592
|
+
const learningData = {
|
|
593
|
+
phase: phaseName,
|
|
594
|
+
taskType: this.classifyTaskType(),
|
|
595
|
+
methodology: 'sparc',
|
|
596
|
+
execution: {
|
|
597
|
+
result: result,
|
|
598
|
+
validation: validation,
|
|
599
|
+
timestamp: Date.now(),
|
|
600
|
+
},
|
|
601
|
+
context: {
|
|
602
|
+
taskDescription: this.options.taskDescription,
|
|
603
|
+
neuralContext: this.neuralContext,
|
|
604
|
+
agentPerformance: this.getAgentPerformanceData(phaseName),
|
|
605
|
+
},
|
|
606
|
+
outcomes: {
|
|
607
|
+
success: validation.passed,
|
|
608
|
+
quality: validation.score,
|
|
609
|
+
efficiency: this.calculatePhaseEfficiency(phaseName),
|
|
610
|
+
learnings: this.extractLearnings(phaseName, result, validation),
|
|
611
|
+
},
|
|
612
|
+
};
|
|
613
|
+
|
|
614
|
+
await this.executeSwarmHook('neural_record_learning', learningData);
|
|
615
|
+
|
|
616
|
+
// Train neural patterns based on this execution
|
|
617
|
+
await this.executeSwarmHook('neural_train', {
|
|
618
|
+
data: learningData,
|
|
619
|
+
updateWeights: true,
|
|
620
|
+
savePattern: true,
|
|
621
|
+
});
|
|
622
|
+
|
|
623
|
+
console.log(`🧠 Neural learning recorded for ${phaseName}`);
|
|
624
|
+
} catch (error) {
|
|
625
|
+
console.warn(`⚠️ Neural learning failed: ${error.message}`);
|
|
613
626
|
}
|
|
614
|
-
|
|
627
|
+
}
|
|
628
|
+
|
|
629
|
+
/**
|
|
615
630
|
* Get agent performance data for phase
|
|
616
|
-
*/
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
}
|
|
624
|
-
|
|
631
|
+
*/
|
|
632
|
+
getAgentPerformanceData(phaseName) {
|
|
633
|
+
const phaseAgents = this.phaseAgents.get(phaseName) || [];
|
|
634
|
+
return phaseAgents.map((agent) => ({
|
|
635
|
+
id: agent.id,
|
|
636
|
+
type: agent.type,
|
|
637
|
+
performance: agent.performance,
|
|
638
|
+
}));
|
|
639
|
+
}
|
|
640
|
+
|
|
641
|
+
/**
|
|
625
642
|
* Calculate phase efficiency
|
|
626
|
-
*/
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
643
|
+
*/
|
|
644
|
+
calculatePhaseEfficiency(phaseName) {
|
|
645
|
+
const phaseAgents = this.phaseAgents.get(phaseName) || [];
|
|
646
|
+
if (phaseAgents.length === 0) return 0.5;
|
|
647
|
+
|
|
648
|
+
const avgEfficiency =
|
|
649
|
+
phaseAgents.reduce((sum, agent) => sum + agent.performance.efficiency, 0) /
|
|
650
|
+
phaseAgents.length;
|
|
651
|
+
return avgEfficiency;
|
|
652
|
+
}
|
|
653
|
+
|
|
654
|
+
/**
|
|
633
655
|
* Extract learnings from phase execution
|
|
634
|
-
*/
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
656
|
+
*/
|
|
657
|
+
extractLearnings(phaseName, result, validation) {
|
|
658
|
+
const learnings = [];
|
|
659
|
+
|
|
660
|
+
if (validation.passed) {
|
|
661
|
+
learnings.push(`${phaseName} phase executed successfully`);
|
|
662
|
+
if (validation.score > 90) {
|
|
663
|
+
learnings.push(`High quality output achieved in ${phaseName}`);
|
|
664
|
+
}
|
|
665
|
+
} else {
|
|
666
|
+
learnings.push(`${phaseName} phase encountered issues: ${validation.issues.join(', ')}`);
|
|
667
|
+
}
|
|
668
|
+
|
|
669
|
+
if (validation.recommendations.length > 0) {
|
|
670
|
+
learnings.push(`Recommendations for ${phaseName}: ${validation.recommendations.join(', ')}`);
|
|
648
671
|
}
|
|
649
|
-
|
|
672
|
+
|
|
673
|
+
return learnings;
|
|
674
|
+
}
|
|
675
|
+
|
|
676
|
+
/**
|
|
650
677
|
* Prepare handoff to next phase
|
|
651
|
-
*/
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
678
|
+
*/
|
|
679
|
+
async preparePhaseHandoff(phaseName, result) {
|
|
680
|
+
const nextPhase = this.getNextPhase(phaseName);
|
|
681
|
+
if (!nextPhase) return;
|
|
682
|
+
|
|
683
|
+
// Prepare artifacts for next phase
|
|
684
|
+
await this.executeSwarmHook('prepare_handoff', {
|
|
685
|
+
fromPhase: phaseName,
|
|
686
|
+
toPhase: nextPhase,
|
|
687
|
+
artifacts: {
|
|
688
|
+
outputs: result,
|
|
689
|
+
decisions: this.extractDecisions(result),
|
|
690
|
+
context: this.neuralContext,
|
|
691
|
+
},
|
|
692
|
+
});
|
|
693
|
+
|
|
694
|
+
// Pre-warm next phase agents
|
|
695
|
+
const nextPhaseAgents = this.phaseAgents.get(nextPhase) || [];
|
|
696
|
+
for (const agent of nextPhaseAgents) {
|
|
697
|
+
await this.executeSwarmHook('agent_prewarm', {
|
|
698
|
+
agentId: agent.id,
|
|
699
|
+
phase: nextPhase,
|
|
700
|
+
context: result,
|
|
701
|
+
});
|
|
673
702
|
}
|
|
674
|
-
|
|
703
|
+
}
|
|
704
|
+
|
|
705
|
+
/**
|
|
675
706
|
* Get next phase in SPARC sequence
|
|
676
|
-
*/
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
}
|
|
687
|
-
/**
|
|
707
|
+
*/
|
|
708
|
+
getNextPhase(currentPhase) {
|
|
709
|
+
const sequence = ['specification', 'pseudocode', 'architecture', 'refinement', 'completion'];
|
|
710
|
+
const currentIndex = sequence.indexOf(currentPhase);
|
|
711
|
+
return currentIndex >= 0 && currentIndex < sequence.length - 1
|
|
712
|
+
? sequence[currentIndex + 1]
|
|
713
|
+
: null;
|
|
714
|
+
}
|
|
715
|
+
|
|
716
|
+
/**
|
|
688
717
|
* Extract decisions from phase result
|
|
689
|
-
*/
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
decisions.push(...result.designDecisions);
|
|
696
|
-
}
|
|
697
|
-
if (result.qualityGates) {
|
|
698
|
-
decisions.push(...result.qualityGates.map((gate)=>({
|
|
699
|
-
decision: `Quality gate: ${gate.name}`,
|
|
700
|
-
rationale: gate.rationale || 'Quality assurance',
|
|
701
|
-
impact: gate.impact || 'process'
|
|
702
|
-
})));
|
|
703
|
-
}
|
|
704
|
-
return decisions;
|
|
718
|
+
*/
|
|
719
|
+
extractDecisions(result) {
|
|
720
|
+
const decisions = [];
|
|
721
|
+
|
|
722
|
+
if (result.architecturalDecisions) {
|
|
723
|
+
decisions.push(...result.architecturalDecisions);
|
|
705
724
|
}
|
|
706
|
-
|
|
725
|
+
|
|
726
|
+
if (result.designDecisions) {
|
|
727
|
+
decisions.push(...result.designDecisions);
|
|
728
|
+
}
|
|
729
|
+
|
|
730
|
+
if (result.qualityGates) {
|
|
731
|
+
decisions.push(
|
|
732
|
+
...result.qualityGates.map((gate) => ({
|
|
733
|
+
decision: `Quality gate: ${gate.name}`,
|
|
734
|
+
rationale: gate.rationale || 'Quality assurance',
|
|
735
|
+
impact: gate.impact || 'process',
|
|
736
|
+
})),
|
|
737
|
+
);
|
|
738
|
+
}
|
|
739
|
+
|
|
740
|
+
return decisions;
|
|
741
|
+
}
|
|
742
|
+
|
|
743
|
+
/**
|
|
707
744
|
* Update coordination metrics
|
|
708
|
-
*/
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
this.metrics.agentUtilization[agent.id].phases += 1;
|
|
721
|
-
this.metrics.agentUtilization[agent.id].quality += validation.score;
|
|
722
|
-
}
|
|
723
|
-
// Update coordination efficiency
|
|
724
|
-
const efficiency = this.calculatePhaseEfficiency(phaseName);
|
|
725
|
-
this.metrics.coordinationEfficiency = (this.metrics.coordinationEfficiency + efficiency) / 2;
|
|
726
|
-
// Record quality gate
|
|
727
|
-
this.metrics.qualityGates.push({
|
|
728
|
-
phase: phaseName,
|
|
729
|
-
passed: validation.passed,
|
|
730
|
-
score: validation.score,
|
|
731
|
-
timestamp: Date.now()
|
|
732
|
-
});
|
|
733
|
-
// Record learning data
|
|
734
|
-
if (validation.passed) {
|
|
735
|
-
this.metrics.learningData.push({
|
|
736
|
-
phase: phaseName,
|
|
737
|
-
success: true,
|
|
738
|
-
quality: validation.score,
|
|
739
|
-
patterns: this.neuralContext?.patterns || []
|
|
740
|
-
});
|
|
741
|
-
}
|
|
745
|
+
*/
|
|
746
|
+
updateCoordinationMetrics(phaseName, result, validation) {
|
|
747
|
+
this.metrics.phaseExecutions += 1;
|
|
748
|
+
|
|
749
|
+
// Update agent utilization
|
|
750
|
+
const phaseAgents = this.phaseAgents.get(phaseName) || [];
|
|
751
|
+
for (const agent of phaseAgents) {
|
|
752
|
+
if (!this.metrics.agentUtilization[agent.id]) {
|
|
753
|
+
this.metrics.agentUtilization[agent.id] = { phases: 0, totalTime: 0, quality: 0 };
|
|
754
|
+
}
|
|
755
|
+
this.metrics.agentUtilization[agent.id].phases += 1;
|
|
756
|
+
this.metrics.agentUtilization[agent.id].quality += validation.score;
|
|
742
757
|
}
|
|
743
|
-
|
|
758
|
+
|
|
759
|
+
// Update coordination efficiency
|
|
760
|
+
const efficiency = this.calculatePhaseEfficiency(phaseName);
|
|
761
|
+
this.metrics.coordinationEfficiency = (this.metrics.coordinationEfficiency + efficiency) / 2;
|
|
762
|
+
|
|
763
|
+
// Record quality gate
|
|
764
|
+
this.metrics.qualityGates.push({
|
|
765
|
+
phase: phaseName,
|
|
766
|
+
passed: validation.passed,
|
|
767
|
+
score: validation.score,
|
|
768
|
+
timestamp: Date.now(),
|
|
769
|
+
});
|
|
770
|
+
|
|
771
|
+
// Record learning data
|
|
772
|
+
if (validation.passed) {
|
|
773
|
+
this.metrics.learningData.push({
|
|
774
|
+
phase: phaseName,
|
|
775
|
+
success: true,
|
|
776
|
+
quality: validation.score,
|
|
777
|
+
patterns: this.neuralContext?.patterns || [],
|
|
778
|
+
});
|
|
779
|
+
}
|
|
780
|
+
}
|
|
781
|
+
|
|
782
|
+
/**
|
|
744
783
|
* Finalize coordination
|
|
745
|
-
*/
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
784
|
+
*/
|
|
785
|
+
async finalize() {
|
|
786
|
+
if (!this.swarmEnabled) return;
|
|
787
|
+
|
|
788
|
+
console.log('🏁 Finalizing SPARC coordination');
|
|
789
|
+
|
|
790
|
+
try {
|
|
791
|
+
// Generate coordination report
|
|
792
|
+
const report = await this.generateCoordinationReport();
|
|
793
|
+
|
|
794
|
+
// Store final metrics
|
|
795
|
+
await this.executeSwarmHook('memory_store', {
|
|
796
|
+
key: 'sparc_coordination_final',
|
|
797
|
+
value: {
|
|
798
|
+
metrics: this.metrics,
|
|
799
|
+
report: report,
|
|
800
|
+
timestamp: Date.now(),
|
|
801
|
+
},
|
|
802
|
+
});
|
|
803
|
+
|
|
804
|
+
// Shutdown agents
|
|
805
|
+
for (const agent of this.agents) {
|
|
806
|
+
await this.executeSwarmHook('agent_shutdown', {
|
|
807
|
+
agentId: agent.id,
|
|
808
|
+
graceful: true,
|
|
809
|
+
});
|
|
810
|
+
}
|
|
811
|
+
|
|
812
|
+
// Shutdown swarm
|
|
813
|
+
await this.executeSwarmHook('swarm_shutdown', {
|
|
814
|
+
swarmId: this.swarmId,
|
|
815
|
+
preserveData: true,
|
|
816
|
+
});
|
|
817
|
+
|
|
818
|
+
console.log('✅ SPARC coordination finalized');
|
|
819
|
+
} catch (error) {
|
|
820
|
+
console.warn(`⚠️ Coordination finalization failed: ${error.message}`);
|
|
776
821
|
}
|
|
777
|
-
|
|
822
|
+
}
|
|
823
|
+
|
|
824
|
+
/**
|
|
778
825
|
* Generate coordination report
|
|
779
|
-
*/
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
826
|
+
*/
|
|
827
|
+
async generateCoordinationReport() {
|
|
828
|
+
const report = {
|
|
829
|
+
summary: {
|
|
830
|
+
phasesExecuted: this.metrics.phaseExecutions,
|
|
831
|
+
agentsUtilized: Object.keys(this.metrics.agentUtilization).length,
|
|
832
|
+
coordinationEfficiency: this.metrics.coordinationEfficiency,
|
|
833
|
+
qualityGatesPassed: this.metrics.qualityGates.filter((g) => g.passed).length,
|
|
834
|
+
totalQualityGates: this.metrics.qualityGates.length,
|
|
835
|
+
},
|
|
836
|
+
agentPerformance: this.calculateAgentPerformanceSummary(),
|
|
837
|
+
phaseAnalysis: this.analyzePhasePerformance(),
|
|
838
|
+
recommendations: this.generateRecommendations(),
|
|
839
|
+
neuralInsights: this.extractNeuralInsights(),
|
|
840
|
+
};
|
|
841
|
+
|
|
842
|
+
return report;
|
|
843
|
+
}
|
|
844
|
+
|
|
845
|
+
/**
|
|
796
846
|
* Calculate agent performance summary
|
|
797
|
-
*/
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
847
|
+
*/
|
|
848
|
+
calculateAgentPerformanceSummary() {
|
|
849
|
+
const summary = {};
|
|
850
|
+
|
|
851
|
+
for (const agent of this.agents) {
|
|
852
|
+
summary[agent.id] = {
|
|
853
|
+
type: agent.type,
|
|
854
|
+
role: agent.role,
|
|
855
|
+
tasksCompleted: agent.performance.tasksCompleted,
|
|
856
|
+
averageQuality: agent.performance.qualityScore,
|
|
857
|
+
efficiency: agent.performance.efficiency,
|
|
858
|
+
averageTime: agent.performance.averageTime,
|
|
859
|
+
};
|
|
810
860
|
}
|
|
811
|
-
|
|
861
|
+
|
|
862
|
+
return summary;
|
|
863
|
+
}
|
|
864
|
+
|
|
865
|
+
/**
|
|
812
866
|
* Analyze phase performance
|
|
813
|
-
*/
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
867
|
+
*/
|
|
868
|
+
analyzePhasePerformance() {
|
|
869
|
+
const analysis = {};
|
|
870
|
+
|
|
871
|
+
for (const gate of this.metrics.qualityGates) {
|
|
872
|
+
if (!analysis[gate.phase]) {
|
|
873
|
+
analysis[gate.phase] = {
|
|
874
|
+
executions: 0,
|
|
875
|
+
passed: 0,
|
|
876
|
+
averageScore: 0,
|
|
877
|
+
totalScore: 0,
|
|
878
|
+
};
|
|
879
|
+
}
|
|
880
|
+
|
|
881
|
+
analysis[gate.phase].executions += 1;
|
|
882
|
+
if (gate.passed) analysis[gate.phase].passed += 1;
|
|
883
|
+
analysis[gate.phase].totalScore += gate.score;
|
|
884
|
+
}
|
|
885
|
+
|
|
886
|
+
// Calculate averages
|
|
887
|
+
for (const phase of Object.keys(analysis)) {
|
|
888
|
+
analysis[phase].averageScore = analysis[phase].totalScore / analysis[phase].executions;
|
|
889
|
+
analysis[phase].successRate = analysis[phase].passed / analysis[phase].executions;
|
|
834
890
|
}
|
|
835
|
-
|
|
891
|
+
|
|
892
|
+
return analysis;
|
|
893
|
+
}
|
|
894
|
+
|
|
895
|
+
/**
|
|
836
896
|
* Generate recommendations for improvement
|
|
837
|
-
*/
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
// Analyze quality gates
|
|
851
|
-
const qualityGateSuccess = this.metrics.qualityGates.filter((g)=>g.passed).length / this.metrics.qualityGates.length;
|
|
852
|
-
if (qualityGateSuccess < 0.8) {
|
|
853
|
-
recommendations.push('Review quality gate criteria and provide additional agent training');
|
|
854
|
-
}
|
|
855
|
-
return recommendations;
|
|
897
|
+
*/
|
|
898
|
+
generateRecommendations() {
|
|
899
|
+
const recommendations = [];
|
|
900
|
+
|
|
901
|
+
// Analyze agent utilization
|
|
902
|
+
const avgUtilization =
|
|
903
|
+
Object.values(this.metrics.agentUtilization).reduce((sum, agent) => sum + agent.phases, 0) /
|
|
904
|
+
Object.keys(this.metrics.agentUtilization).length;
|
|
905
|
+
|
|
906
|
+
if (avgUtilization < 2) {
|
|
907
|
+
recommendations.push('Consider reducing agent count for better utilization');
|
|
908
|
+
} else if (avgUtilization > 4) {
|
|
909
|
+
recommendations.push('Consider increasing agent count to distribute load');
|
|
856
910
|
}
|
|
857
|
-
|
|
911
|
+
|
|
912
|
+
// Analyze coordination efficiency
|
|
913
|
+
if (this.metrics.coordinationEfficiency < 0.7) {
|
|
914
|
+
recommendations.push('Improve coordination efficiency through better task decomposition');
|
|
915
|
+
}
|
|
916
|
+
|
|
917
|
+
// Analyze quality gates
|
|
918
|
+
const qualityGateSuccess =
|
|
919
|
+
this.metrics.qualityGates.filter((g) => g.passed).length / this.metrics.qualityGates.length;
|
|
920
|
+
if (qualityGateSuccess < 0.8) {
|
|
921
|
+
recommendations.push('Review quality gate criteria and provide additional agent training');
|
|
922
|
+
}
|
|
923
|
+
|
|
924
|
+
return recommendations;
|
|
925
|
+
}
|
|
926
|
+
|
|
927
|
+
/**
|
|
858
928
|
* Extract neural insights
|
|
859
|
-
*/
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
929
|
+
*/
|
|
930
|
+
extractNeuralInsights() {
|
|
931
|
+
const insights = [];
|
|
932
|
+
|
|
933
|
+
// Pattern analysis
|
|
934
|
+
const successfulPatterns = this.metrics.learningData.filter((d) => d.success);
|
|
935
|
+
if (successfulPatterns.length > 0) {
|
|
936
|
+
insights.push(`${successfulPatterns.length} successful execution patterns identified`);
|
|
937
|
+
}
|
|
938
|
+
|
|
939
|
+
// Quality analysis
|
|
940
|
+
const avgQuality =
|
|
941
|
+
this.metrics.learningData.reduce((sum, d) => sum + d.quality, 0) /
|
|
942
|
+
this.metrics.learningData.length;
|
|
943
|
+
if (avgQuality > 85) {
|
|
944
|
+
insights.push('High quality outcomes consistently achieved');
|
|
945
|
+
} else if (avgQuality < 70) {
|
|
946
|
+
insights.push('Quality improvements needed in execution');
|
|
874
947
|
}
|
|
875
|
-
|
|
948
|
+
|
|
949
|
+
return insights;
|
|
950
|
+
}
|
|
951
|
+
|
|
952
|
+
/**
|
|
876
953
|
* Execute swarm hook with error handling
|
|
877
|
-
*/
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
}
|
|
893
|
-
const process = spawn('npx', args, {
|
|
894
|
-
stdio: 'pipe'
|
|
895
|
-
});
|
|
896
|
-
let output = '';
|
|
897
|
-
let error = '';
|
|
898
|
-
process.stdout.on('data', (data)=>{
|
|
899
|
-
output += data.toString();
|
|
900
|
-
});
|
|
901
|
-
process.stderr.on('data', (data)=>{
|
|
902
|
-
error += data.toString();
|
|
903
|
-
});
|
|
904
|
-
process.on('close', (code)=>{
|
|
905
|
-
if (code === 0) {
|
|
906
|
-
try {
|
|
907
|
-
const result = JSON.parse(output);
|
|
908
|
-
resolve(result);
|
|
909
|
-
} catch (parseError) {
|
|
910
|
-
resolve(output.trim());
|
|
911
|
-
}
|
|
912
|
-
} else {
|
|
913
|
-
reject(new Error(`Hook ${hookName} failed: ${error}`));
|
|
914
|
-
}
|
|
915
|
-
});
|
|
916
|
-
process.on('error', (err)=>{
|
|
917
|
-
reject(err);
|
|
918
|
-
});
|
|
919
|
-
});
|
|
920
|
-
} catch (error) {
|
|
921
|
-
throw new Error(`Failed to execute swarm hook ${hookName}: ${error.message}`);
|
|
954
|
+
*/
|
|
955
|
+
async executeSwarmHook(hookName, data = {}) {
|
|
956
|
+
if (!this.swarmEnabled) {
|
|
957
|
+
throw new Error('Swarm not enabled');
|
|
958
|
+
}
|
|
959
|
+
|
|
960
|
+
try {
|
|
961
|
+
const { spawn } = await import('child_process');
|
|
962
|
+
|
|
963
|
+
return new Promise((resolve, reject) => {
|
|
964
|
+
const args = ['ruv-swarm', 'hook', hookName];
|
|
965
|
+
|
|
966
|
+
// Add data as JSON argument
|
|
967
|
+
if (Object.keys(data).length > 0) {
|
|
968
|
+
args.push('--data', JSON.stringify(data));
|
|
922
969
|
}
|
|
970
|
+
|
|
971
|
+
const process = spawn('npx', args, {
|
|
972
|
+
stdio: 'pipe',
|
|
973
|
+
});
|
|
974
|
+
|
|
975
|
+
let output = '';
|
|
976
|
+
let error = '';
|
|
977
|
+
|
|
978
|
+
process.stdout.on('data', (data) => {
|
|
979
|
+
output += data.toString();
|
|
980
|
+
});
|
|
981
|
+
|
|
982
|
+
process.stderr.on('data', (data) => {
|
|
983
|
+
error += data.toString();
|
|
984
|
+
});
|
|
985
|
+
|
|
986
|
+
process.on('close', (code) => {
|
|
987
|
+
if (code === 0) {
|
|
988
|
+
try {
|
|
989
|
+
const result = JSON.parse(output);
|
|
990
|
+
resolve(result);
|
|
991
|
+
} catch (parseError) {
|
|
992
|
+
resolve(output.trim());
|
|
993
|
+
}
|
|
994
|
+
} else {
|
|
995
|
+
reject(new Error(`Hook ${hookName} failed: ${error}`));
|
|
996
|
+
}
|
|
997
|
+
});
|
|
998
|
+
|
|
999
|
+
process.on('error', (err) => {
|
|
1000
|
+
reject(err);
|
|
1001
|
+
});
|
|
1002
|
+
});
|
|
1003
|
+
} catch (error) {
|
|
1004
|
+
throw new Error(`Failed to execute swarm hook ${hookName}: ${error.message}`);
|
|
923
1005
|
}
|
|
924
|
-
|
|
1006
|
+
}
|
|
1007
|
+
|
|
1008
|
+
/**
|
|
925
1009
|
* Record learning from SPARC execution
|
|
926
|
-
*/
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
1010
|
+
*/
|
|
1011
|
+
async recordLearning(learningData) {
|
|
1012
|
+
if (!this.options.neuralLearning) return;
|
|
1013
|
+
|
|
1014
|
+
try {
|
|
1015
|
+
await this.executeSwarmHook('neural_record_learning', {
|
|
1016
|
+
methodology: 'sparc',
|
|
1017
|
+
data: learningData,
|
|
1018
|
+
timestamp: Date.now(),
|
|
1019
|
+
});
|
|
1020
|
+
} catch (error) {
|
|
1021
|
+
console.warn(`⚠️ Failed to record learning: ${error.message}`);
|
|
937
1022
|
}
|
|
938
|
-
|
|
1023
|
+
}
|
|
1024
|
+
|
|
1025
|
+
/**
|
|
939
1026
|
* Get coordination status
|
|
940
|
-
*/
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
}
|
|
957
|
-
constructor(phases, options = {}){
|
|
958
|
-
this.phases = phases;
|
|
959
|
-
this.options = options;
|
|
960
|
-
this.swarmId = null;
|
|
961
|
-
this.agents = [];
|
|
962
|
-
this.phaseAgents = new Map();
|
|
963
|
-
this.coordination = {
|
|
964
|
-
strategy: 'adaptive',
|
|
965
|
-
topology: 'hierarchical',
|
|
966
|
-
communication: 'event-driven',
|
|
967
|
-
loadBalancing: 'capability-based'
|
|
968
|
-
};
|
|
969
|
-
this.metrics = {
|
|
970
|
-
phaseExecutions: 0,
|
|
971
|
-
agentUtilization: {},
|
|
972
|
-
coordinationEfficiency: 0,
|
|
973
|
-
qualityGates: [],
|
|
974
|
-
learningData: []
|
|
975
|
-
};
|
|
976
|
-
this.neuralContext = null;
|
|
977
|
-
this.swarmEnabled = options.swarmEnabled || false;
|
|
978
|
-
}
|
|
1027
|
+
*/
|
|
1028
|
+
getStatus() {
|
|
1029
|
+
return {
|
|
1030
|
+
swarmEnabled: this.swarmEnabled,
|
|
1031
|
+
swarmId: this.swarmId,
|
|
1032
|
+
agentCount: this.agents.length,
|
|
1033
|
+
phaseAgents: Object.fromEntries(
|
|
1034
|
+
Array.from(this.phaseAgents.entries()).map(([phase, agents]) => [
|
|
1035
|
+
phase,
|
|
1036
|
+
agents.map((a) => ({ id: a.id, type: a.type, status: a.status })),
|
|
1037
|
+
]),
|
|
1038
|
+
),
|
|
1039
|
+
metrics: this.metrics,
|
|
1040
|
+
coordination: this.coordination,
|
|
1041
|
+
};
|
|
1042
|
+
}
|
|
979
1043
|
}
|
|
1044
|
+
|
|
980
1045
|
export default SparcCoordinator;
|