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.
Files changed (496) hide show
  1. package/dist/src/cli/commands/guidance.js +668 -487
  2. package/dist/src/cli/commands/index-validate.js +29 -18
  3. package/dist/src/cli/commands/mcp-troubleshoot.js +282 -230
  4. package/dist/src/cli/commands/neural-goal-init.js +125 -92
  5. package/dist/src/cli/commands/swarm-exec.js +393 -317
  6. package/dist/src/cli/commands/validate-framework.js +1100 -983
  7. package/dist/src/cli/commands/validate.js +223 -144
  8. package/dist/src/cli/main.js +1 -1
  9. package/dist/src/cli/simple-commands/__tests__/agent.test.js +277 -265
  10. package/dist/src/cli/simple-commands/__tests__/memory.test.js +7 -6
  11. package/dist/src/cli/simple-commands/__tests__/swarm.test.js +356 -373
  12. package/dist/src/cli/simple-commands/__tests__/task.test.js +7 -6
  13. package/dist/src/cli/simple-commands/agent.js +193 -157
  14. package/dist/src/cli/simple-commands/analysis.js +446 -336
  15. package/dist/src/cli/simple-commands/automation-executor.js +1339 -1095
  16. package/dist/src/cli/simple-commands/automation.js +469 -481
  17. package/dist/src/cli/simple-commands/batch-manager.js +313 -261
  18. package/dist/src/cli/simple-commands/claude-telemetry.js +267 -241
  19. package/dist/src/cli/simple-commands/claude-track.js +90 -68
  20. package/dist/src/cli/simple-commands/concurrent-display.js +320 -266
  21. package/dist/src/cli/simple-commands/config.js +290 -245
  22. package/dist/src/cli/simple-commands/coordination.js +234 -182
  23. package/dist/src/cli/simple-commands/enhanced-ui-views.js +615 -812
  24. package/dist/src/cli/simple-commands/enhanced-webui-complete.js +981 -922
  25. package/dist/src/cli/simple-commands/fix-hook-variables.js +294 -274
  26. package/dist/src/cli/simple-commands/github/gh-coordinator.js +457 -378
  27. package/dist/src/cli/simple-commands/github/github-api.js +574 -535
  28. package/dist/src/cli/simple-commands/github/init.js +303 -276
  29. package/dist/src/cli/simple-commands/github.js +247 -222
  30. package/dist/src/cli/simple-commands/goal.js +63 -51
  31. package/dist/src/cli/simple-commands/hive-mind/auto-save-middleware.js +278 -208
  32. package/dist/src/cli/simple-commands/hive-mind/communication.js +696 -601
  33. package/dist/src/cli/simple-commands/hive-mind/core.js +979 -907
  34. package/dist/src/cli/simple-commands/hive-mind/db-optimizer.js +655 -406
  35. package/dist/src/cli/simple-commands/hive-mind/mcp-wrapper.js +1245 -1125
  36. package/dist/src/cli/simple-commands/hive-mind/memory.js +1090 -854
  37. package/dist/src/cli/simple-commands/hive-mind/performance-optimizer.js +574 -459
  38. package/dist/src/cli/simple-commands/hive-mind/performance-test.js +347 -263
  39. package/dist/src/cli/simple-commands/hive-mind/queen.js +768 -727
  40. package/dist/src/cli/simple-commands/hive-mind/session-manager.js +1049 -745
  41. package/dist/src/cli/simple-commands/hive-mind-optimize.js +283 -227
  42. package/dist/src/cli/simple-commands/hive-mind-wizard.js +217 -174
  43. package/dist/src/cli/simple-commands/hive-mind.js +2282 -1841
  44. package/dist/src/cli/simple-commands/hive.js +79 -90
  45. package/dist/src/cli/simple-commands/hook-safety.js +521 -431
  46. package/dist/src/cli/simple-commands/hooks/session-start-soul.js +254 -203
  47. package/dist/src/cli/simple-commands/hooks.js +1204 -1064
  48. package/dist/src/cli/simple-commands/init/agent-copier.js +319 -294
  49. package/dist/src/cli/simple-commands/init/batch-init.js +562 -496
  50. package/dist/src/cli/simple-commands/init/claude-commands/claude-flow-commands.js +19 -13
  51. package/dist/src/cli/simple-commands/init/claude-commands/optimized-claude-flow-commands.js +19 -13
  52. package/dist/src/cli/simple-commands/init/claude-commands/optimized-slash-commands.js +88 -61
  53. package/dist/src/cli/simple-commands/init/claude-commands/optimized-sparc-commands.js +150 -125
  54. package/dist/src/cli/simple-commands/init/claude-commands/slash-commands.js +49 -42
  55. package/dist/src/cli/simple-commands/init/claude-commands/sparc-commands.js +61 -43
  56. package/dist/src/cli/simple-commands/init/copy-revised-templates.js +147 -141
  57. package/dist/src/cli/simple-commands/init/executable-wrapper.js +44 -31
  58. package/dist/src/cli/simple-commands/init/gitignore-updater.js +90 -64
  59. package/dist/src/cli/simple-commands/init/help.js +107 -104
  60. package/dist/src/cli/simple-commands/init/hive-mind-init.js +528 -509
  61. package/dist/src/cli/simple-commands/init/index.js +1759 -1510
  62. package/dist/src/cli/simple-commands/init/performance-monitor.js +317 -234
  63. package/dist/src/cli/simple-commands/init/rollback/backup-manager.js +504 -441
  64. package/dist/src/cli/simple-commands/init/rollback/index.js +364 -289
  65. package/dist/src/cli/simple-commands/init/rollback/recovery-manager.js +728 -652
  66. package/dist/src/cli/simple-commands/init/rollback/rollback-executor.js +481 -416
  67. package/dist/src/cli/simple-commands/init/rollback/state-tracker.js +448 -369
  68. package/dist/src/cli/simple-commands/init/sparc/roo-readme.js +2 -1
  69. package/dist/src/cli/simple-commands/init/sparc/roomodes-config.js +99 -122
  70. package/dist/src/cli/simple-commands/init/sparc/workflows.js +37 -32
  71. package/dist/src/cli/simple-commands/init/sparc-structure.js +62 -55
  72. package/dist/src/cli/simple-commands/init/template-copier.js +533 -421
  73. package/dist/src/cli/simple-commands/init/templates/coordination-md.js +6 -3
  74. package/dist/src/cli/simple-commands/init/templates/enhanced-templates.js +318 -344
  75. package/dist/src/cli/simple-commands/init/templates/github-safe-enhanced.js +218 -173
  76. package/dist/src/cli/simple-commands/init/templates/github-safe.js +75 -65
  77. package/dist/src/cli/simple-commands/init/templates/memory-bank-md.js +6 -3
  78. package/dist/src/cli/simple-commands/init/templates/readme-files.js +4 -2
  79. package/dist/src/cli/simple-commands/init/templates/safe-hook-patterns.js +230 -187
  80. package/dist/src/cli/simple-commands/init/templates/sparc-modes.js +80 -53
  81. package/dist/src/cli/simple-commands/init/templates/verification-claude-md.js +85 -101
  82. package/dist/src/cli/simple-commands/init/validation/config-validator.js +330 -283
  83. package/dist/src/cli/simple-commands/init/validation/health-checker.js +561 -495
  84. package/dist/src/cli/simple-commands/init/validation/index.js +358 -302
  85. package/dist/src/cli/simple-commands/init/validation/mode-validator.js +359 -308
  86. package/dist/src/cli/simple-commands/init/validation/post-init-validator.js +366 -389
  87. package/dist/src/cli/simple-commands/init/validation/pre-init-validator.js +268 -270
  88. package/dist/src/cli/simple-commands/init/validation/test-runner.js +447 -427
  89. package/dist/src/cli/simple-commands/init.js +2 -1
  90. package/dist/src/cli/simple-commands/mcp-health.js +158 -131
  91. package/dist/src/cli/simple-commands/mcp-integration-layer.js +634 -533
  92. package/dist/src/cli/simple-commands/mcp.js +400 -345
  93. package/dist/src/cli/simple-commands/memory-consolidation.js +537 -426
  94. package/dist/src/cli/simple-commands/memory.js +311 -247
  95. package/dist/src/cli/simple-commands/migrate-hooks.js +46 -39
  96. package/dist/src/cli/simple-commands/monitor.js +363 -294
  97. package/dist/src/cli/simple-commands/neural.js +65 -51
  98. package/dist/src/cli/simple-commands/pair-autofix-only.js +662 -538
  99. package/dist/src/cli/simple-commands/pair-basic.js +656 -528
  100. package/dist/src/cli/simple-commands/pair-old.js +543 -430
  101. package/dist/src/cli/simple-commands/pair-working.js +751 -615
  102. package/dist/src/cli/simple-commands/pair.js +751 -615
  103. package/dist/src/cli/simple-commands/performance-hooks.js +111 -83
  104. package/dist/src/cli/simple-commands/performance-metrics.js +433 -348
  105. package/dist/src/cli/simple-commands/process-ui-enhanced.js +787 -708
  106. package/dist/src/cli/simple-commands/process-ui.js +254 -230
  107. package/dist/src/cli/simple-commands/realtime-update-system.js +611 -525
  108. package/dist/src/cli/simple-commands/sparc/architecture.js +1530 -1704
  109. package/dist/src/cli/simple-commands/sparc/commands.js +516 -438
  110. package/dist/src/cli/simple-commands/sparc/completion.js +1481 -1224
  111. package/dist/src/cli/simple-commands/sparc/coordinator.js +978 -913
  112. package/dist/src/cli/simple-commands/sparc/index.js +298 -241
  113. package/dist/src/cli/simple-commands/sparc/phase-base.js +390 -314
  114. package/dist/src/cli/simple-commands/sparc/pseudocode.js +869 -965
  115. package/dist/src/cli/simple-commands/sparc/refinement.js +1273 -980
  116. package/dist/src/cli/simple-commands/sparc/specification.js +645 -559
  117. package/dist/src/cli/simple-commands/sparc-modes/architect.js +1 -1
  118. package/dist/src/cli/simple-commands/sparc-modes/ask.js +1 -1
  119. package/dist/src/cli/simple-commands/sparc-modes/code.js +1 -1
  120. package/dist/src/cli/simple-commands/sparc-modes/debug.js +1 -1
  121. package/dist/src/cli/simple-commands/sparc-modes/devops.js +1 -1
  122. package/dist/src/cli/simple-commands/sparc-modes/docs-writer.js +1 -1
  123. package/dist/src/cli/simple-commands/sparc-modes/generic.js +1 -1
  124. package/dist/src/cli/simple-commands/sparc-modes/index.js +55 -47
  125. package/dist/src/cli/simple-commands/sparc-modes/integration.js +1 -1
  126. package/dist/src/cli/simple-commands/sparc-modes/mcp.js +1 -1
  127. package/dist/src/cli/simple-commands/sparc-modes/monitoring.js +1 -1
  128. package/dist/src/cli/simple-commands/sparc-modes/optimization.js +1 -1
  129. package/dist/src/cli/simple-commands/sparc-modes/security-review.js +1 -1
  130. package/dist/src/cli/simple-commands/sparc-modes/sparc-orchestrator.js +1 -1
  131. package/dist/src/cli/simple-commands/sparc-modes/spec-pseudocode.js +1 -1
  132. package/dist/src/cli/simple-commands/sparc-modes/supabase-admin.js +1 -1
  133. package/dist/src/cli/simple-commands/sparc-modes/swarm.js +87 -101
  134. package/dist/src/cli/simple-commands/sparc-modes/tdd.js +1 -1
  135. package/dist/src/cli/simple-commands/sparc-modes/tutorial.js +1 -1
  136. package/dist/src/cli/simple-commands/sparc.js +493 -465
  137. package/dist/src/cli/simple-commands/start-ui.js +132 -108
  138. package/dist/src/cli/simple-commands/start-wrapper.js +268 -240
  139. package/dist/src/cli/simple-commands/start.js +1 -1
  140. package/dist/src/cli/simple-commands/status.js +275 -254
  141. package/dist/src/cli/simple-commands/stream-chain-clean.js +171 -128
  142. package/dist/src/cli/simple-commands/stream-chain-fixed.js +82 -61
  143. package/dist/src/cli/simple-commands/stream-chain-real.js +331 -267
  144. package/dist/src/cli/simple-commands/stream-chain-working.js +263 -211
  145. package/dist/src/cli/simple-commands/stream-chain.js +318 -260
  146. package/dist/src/cli/simple-commands/stream-processor.js +315 -290
  147. package/dist/src/cli/simple-commands/swarm-executor.js +222 -189
  148. package/dist/src/cli/simple-commands/swarm-metrics-integration.js +300 -208
  149. package/dist/src/cli/simple-commands/swarm-ui.js +703 -623
  150. package/dist/src/cli/simple-commands/swarm-webui-integration.js +286 -258
  151. package/dist/src/cli/simple-commands/swarm.js +1082 -887
  152. package/dist/src/cli/simple-commands/task.js +206 -161
  153. package/dist/src/cli/simple-commands/timestamp-fix.js +89 -59
  154. package/dist/src/cli/simple-commands/token-tracker.js +316 -258
  155. package/dist/src/cli/simple-commands/tool-execution-framework.js +519 -433
  156. package/dist/src/cli/simple-commands/train-and-stream.js +331 -275
  157. package/dist/src/cli/simple-commands/training-pipeline.js +725 -619
  158. package/dist/src/cli/simple-commands/training.js +227 -170
  159. package/dist/src/cli/simple-commands/verification-hooks.js +284 -261
  160. package/dist/src/cli/simple-commands/verification-integration.js +417 -389
  161. package/dist/src/cli/simple-commands/verification-training-integration.js +606 -486
  162. package/dist/src/cli/simple-commands/verification.js +513 -493
  163. package/dist/src/cli/simple-commands/web-server.js +836 -766
  164. package/dist/src/cli/simple-commands/webui-validator.js +124 -106
  165. package/dist/src/coordination/byzantine-memory-channels.js +25 -1
  166. package/dist/src/coordination/event-bus/demo-wasm-integration.js +251 -212
  167. package/dist/src/coordination/event-bus/qe-event-bus.js +748 -608
  168. package/dist/src/coordination/event-bus/qe-event-bus.test.js +454 -379
  169. package/dist/src/coordination/iteration-tracker.js +454 -363
  170. package/dist/src/index.js +384 -35
  171. package/dist/src/mcp/DEPRECATED.js +60 -46
  172. package/dist/src/mcp/fixes/mcp-error-fixes.js +134 -115
  173. package/dist/src/mcp/implementations/agent-tracker.js +128 -114
  174. package/dist/src/mcp/implementations/daa-tools.js +350 -292
  175. package/dist/src/mcp/implementations/workflow-tools.js +361 -329
  176. package/dist/src/mcp/mcp-config-manager.js +1331 -1183
  177. package/dist/src/mcp/mcp-server-novice-simplified.js +17 -11
  178. package/dist/src/mcp/mcp-server-novice.js +17 -11
  179. package/dist/src/mcp/mcp-server-sdk.js +17 -11
  180. package/dist/src/mcp/mcp-server.js +1484 -1620
  181. package/dist/src/mcp/ruv-swarm-wrapper.js +239 -209
  182. package/dist/src/memory/advanced-serializer.js +589 -609
  183. package/dist/src/memory/enhanced-examples.js +305 -220
  184. package/dist/src/memory/enhanced-memory.js +336 -295
  185. package/dist/src/memory/enhanced-session-serializer.js +492 -408
  186. package/dist/src/memory/fallback-memory-system.js +1021 -900
  187. package/dist/src/memory/fallback-store.js +131 -93
  188. package/dist/src/memory/high-performance-serialization.js +730 -592
  189. package/dist/src/memory/in-memory-store.js +213 -161
  190. package/dist/src/memory/index.js +157 -123
  191. package/dist/src/memory/lock-free-structures.js +764 -578
  192. package/dist/src/memory/memory-mapped-persistence.js +766 -585
  193. package/dist/src/memory/memory-pressure-manager.js +707 -569
  194. package/dist/src/memory/migration.js +445 -358
  195. package/dist/src/memory/shared-memory.js +768 -641
  196. package/dist/src/memory/sqlite-store.js +325 -245
  197. package/dist/src/memory/sqlite-wrapper.js +151 -122
  198. package/dist/src/memory/swarm-memory.js +603 -470
  199. package/dist/src/memory/test-example.js +134 -126
  200. package/dist/src/memory/ultra-fast-memory-store.js +821 -622
  201. package/dist/src/memory/unified-memory-manager.js +437 -356
  202. package/dist/src/swarm/CodeRefactoringSwarm.js +952 -777
  203. package/dist/src/utils/__tests__/github-cli-safety-wrapper.test.js +400 -332
  204. package/dist/src/utils/error-handler.js +2 -36
  205. package/dist/src/utils/github-cli-safe.js +64 -56
  206. package/dist/src/utils/github-cli-safety-wrapper.js +546 -451
  207. package/dist/src/utils/npx-isolated-cache.js +119 -104
  208. package/dist/src/utils/preference-manager.js +652 -622
  209. package/dist/src/utils/timezone-utils.js +105 -86
  210. package/dist/src/web/api/apm-routes.js +353 -0
  211. package/dist/src/web/api/config/api-config.js +184 -0
  212. package/dist/src/web/api/middleware/auth.js +203 -0
  213. package/dist/src/web/api/middleware/cache.js +273 -0
  214. package/dist/src/web/api/middleware/error-handler.js +257 -0
  215. package/dist/src/web/api/middleware/request-logger.js +215 -0
  216. package/dist/src/web/api/middleware/validation.js +323 -0
  217. package/dist/src/web/api/routes/events.js +463 -0
  218. package/dist/src/web/api/routes/hierarchy.js +300 -0
  219. package/dist/src/web/api/routes/index.js +12 -0
  220. package/dist/src/web/api/routes/metrics.js +559 -0
  221. package/dist/src/web/api/routes/parallel-status.js +359 -0
  222. package/dist/src/web/api/routes/status.js +448 -0
  223. package/dist/src/web/api/server.js +462 -0
  224. package/dist/src/web/dashboard/hooks/useWebSocket.js +383 -0
  225. package/dist/src/web/dashboard/index.js +85 -0
  226. package/dist/src/web/dashboard/realtime/CustomSyncManager.js +439 -0
  227. package/dist/src/web/dashboard/realtime/NativeWebSocketManager.js +323 -0
  228. package/dist/src/web/dashboard/realtime/PerformanceBenchmark.js +527 -0
  229. package/dist/src/web/dashboard/realtime/RealtimeCommunicationManager.js +474 -0
  230. package/dist/src/web/dashboard/realtime/RealtimeServer.js +666 -0
  231. package/dist/src/web/dashboard/realtime/SSEManager.js +426 -0
  232. package/dist/src/web/dashboard/types.js +4 -0
  233. package/dist/src/web/messaging/agent-status-tracker.js +453 -0
  234. package/dist/src/web/messaging/human-intervention-system.js +305 -0
  235. package/dist/src/web/messaging/message-filter.js +302 -0
  236. package/dist/src/web/messaging/swarm-message-router.js +324 -0
  237. package/dist/src/web/messaging/transparency-logger.js +421 -0
  238. package/dist/src/web/portal-server.js +460 -0
  239. package/dist/src/web/server.js +322 -0
  240. package/dist/src/web/websocket/apm-websocket-handler.js +453 -0
  241. package/dist/src/web/websocket/websocket-manager.js +780 -0
  242. package/package.json +5 -3
  243. package/dist/src/cli/minimal-main.js +0 -22
  244. package/dist/src/enterprise/analytics-manager.js +0 -1135
  245. package/dist/src/enterprise/audit-manager.js +0 -1115
  246. package/dist/src/enterprise/cloud-manager.js +0 -891
  247. package/dist/src/enterprise/deployment-manager.js +0 -966
  248. package/dist/src/enterprise/index.js +0 -6
  249. package/dist/src/enterprise/project-manager.js +0 -584
  250. package/dist/src/enterprise/security-manager.js +0 -991
  251. package/dist/src/migration/index.js +0 -92
  252. package/dist/src/migration/logger.js +0 -121
  253. package/dist/src/migration/migration-analyzer.js +0 -268
  254. package/dist/src/migration/migration-runner.js +0 -522
  255. package/dist/src/migration/migration-validator.js +0 -285
  256. package/dist/src/migration/progress-reporter.js +0 -150
  257. package/dist/src/migration/rollback-manager.js +0 -321
  258. package/dist/src/migration/tests/migration-system.test.js +0 -7
  259. package/dist/src/migration/types.js +0 -3
  260. package/dist/src/swarm/__tests__/integration.test.js +0 -227
  261. package/dist/src/swarm/__tests__/prompt-copier.test.js +0 -344
  262. package/dist/src/swarm/advanced-orchestrator.js +0 -1095
  263. package/dist/src/swarm/claude-code-interface.js +0 -961
  264. package/dist/src/swarm/claude-flow-executor.js +0 -229
  265. package/dist/src/swarm/consensus-coordinator.js +0 -475
  266. package/dist/src/swarm/coordinator.js +0 -2993
  267. package/dist/src/swarm/direct-executor.js +0 -1180
  268. package/dist/src/swarm/error-recovery/advanced-error-detection.js +0 -691
  269. package/dist/src/swarm/error-recovery/automated-recovery-workflows.js +0 -998
  270. package/dist/src/swarm/error-recovery/error-recovery-coordinator.js +0 -1197
  271. package/dist/src/swarm/error-recovery/recovery-monitoring.js +0 -772
  272. package/dist/src/swarm/error-recovery/resilience-architecture.js +0 -714
  273. package/dist/src/swarm/error-recovery/self-healing-mechanisms.js +0 -1319
  274. package/dist/src/swarm/error-recovery/test-error-recovery-effectiveness.js +0 -808
  275. package/dist/src/swarm/executor-v2.js +0 -322
  276. package/dist/src/swarm/executor.js +0 -815
  277. package/dist/src/swarm/hive-mind-integration.js +0 -703
  278. package/dist/src/swarm/index.js +0 -41
  279. package/dist/src/swarm/json-output-aggregator.js +0 -267
  280. package/dist/src/swarm/large-scale-coordinator.js +0 -542
  281. package/dist/src/swarm/mcp-integration-wrapper.js +0 -628
  282. package/dist/src/swarm/memory.js +0 -1117
  283. package/dist/src/swarm/optimizations/__tests__/optimization.test.js +0 -348
  284. package/dist/src/swarm/optimizations/async-file-manager.js +0 -285
  285. package/dist/src/swarm/optimizations/circular-buffer.js +0 -162
  286. package/dist/src/swarm/optimizations/connection-pool.js +0 -244
  287. package/dist/src/swarm/optimizations/index.js +0 -28
  288. package/dist/src/swarm/optimizations/optimized-executor.js +0 -320
  289. package/dist/src/swarm/optimizations/ttl-map.js +0 -234
  290. package/dist/src/swarm/prompt-cli.js +0 -200
  291. package/dist/src/swarm/prompt-copier-enhanced.js +0 -202
  292. package/dist/src/swarm/prompt-copier.js +0 -381
  293. package/dist/src/swarm/prompt-manager.js +0 -295
  294. package/dist/src/swarm/prompt-utils.js +0 -310
  295. package/dist/src/swarm/result-aggregator.js +0 -718
  296. package/dist/src/swarm/sparc-executor.js +0 -1568
  297. package/dist/src/swarm/strategies/auto.js +0 -758
  298. package/dist/src/swarm/strategies/base.js +0 -128
  299. package/dist/src/swarm/strategies/research.js +0 -914
  300. package/dist/src/swarm/strategies/strategy-metrics-patch.js +0 -2
  301. package/dist/src/swarm/types.js +0 -52
  302. package/dist/src/swarm/workers/copy-worker.js +0 -56
  303. package/dist/src/validators/epic-config-schema.js +0 -214
  304. package/dist/src/validators/index.js +0 -10
  305. package/dist/src/validators/swarm-init-validator.js +0 -259
  306. package/dist/src/validators/todowrite-batching-validator.js +0 -215
  307. package/dist/src/validators/todowrite-integration.js +0 -187
  308. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/documentSymbols/browser/documentSymbols.js +0 -23
  309. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/dropOrPasteInto/browser/copyPasteContribution.js +0 -57
  310. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/dropOrPasteInto/browser/copyPasteController.js +0 -401
  311. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/dropOrPasteInto/browser/defaultProviders.js +0 -181
  312. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/dropOrPasteInto/browser/dropIntoEditorContribution.js +0 -44
  313. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/dropOrPasteInto/browser/dropIntoEditorController.js +0 -157
  314. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/dropOrPasteInto/browser/edit.js +0 -71
  315. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/editorState/browser/editorState.js +0 -112
  316. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/find/browser/findController.js +0 -990
  317. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/find/browser/findDecorations.js +0 -296
  318. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/find/browser/findModel.js +0 -488
  319. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/find/browser/findOptionsWidget.js +0 -138
  320. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/find/browser/findState.js +0 -243
  321. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/find/browser/findWidget.js +0 -1177
  322. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/folding/browser/folding.js +0 -1093
  323. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/folding/browser/foldingDecorations.js +0 -133
  324. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/folding/browser/foldingModel.js +0 -538
  325. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/folding/browser/foldingRanges.js +0 -351
  326. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/fontZoom/browser/fontZoom.js +0 -49
  327. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/format/browser/format.js +0 -360
  328. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/format/browser/formatActions.js +0 -263
  329. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/format/browser/formattingEdit.js +0 -54
  330. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/gotoSymbol/browser/link/clickLinkGesture.js +0 -149
  331. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/hover/browser/contentHover.js +0 -874
  332. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/inlineCompletions/browser/commandIds.js +0 -7
  333. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/inlineCompletions/browser/commands.js +0 -199
  334. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/linesOperations/browser/copyLinesCommand.js +0 -70
  335. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/quickAccess/browser/commandsQuickAccess.js +0 -26
  336. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/quickAccess/browser/editorNavigationQuickAccess.js +0 -153
  337. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/readOnlyMessage/browser/contribution.js +0 -33
  338. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/semanticTokens/browser/documentSemanticTokens.js +0 -354
  339. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/smartSelect/browser/bracketSelections.js +0 -146
  340. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/suggest/browser/completionModel.js +0 -224
  341. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/unicodeHighlighter/browser/bannerController.js +0 -119
  342. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/edcore.main.js +0 -14
  343. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/editor.all.js +0 -63
  344. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/editor.api.js +0 -55
  345. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/editor.main.js +0 -7
  346. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/editor.worker.js +0 -25
  347. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/standalone/browser/colorizer.js +0 -118
  348. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/language/css/css.worker.js +0 -36869
  349. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/language/css/cssMode.js +0 -2035
  350. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/accessibility/browser/accessibilityService.js +0 -88
  351. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/accessibility/common/accessibility.js +0 -9
  352. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/action/common/action.js +0 -7
  353. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/action/common/actionCommonCategories.js +0 -13
  354. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/actionWidget/browser/actionList.js +0 -276
  355. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/actionWidget/browser/actionWidget.js +0 -248
  356. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/actionWidget/common/actionWidget.js +0 -5
  357. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/actions/common/actions.js +0 -409
  358. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/audioCues/browser/audioCueService.js +0 -176
  359. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/clipboard/browser/clipboardService.js +0 -141
  360. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/clipboard/common/clipboardService.js +0 -6
  361. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/commands/common/commands.js +0 -80
  362. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/configuration/common/configuration.js +0 -86
  363. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/configuration/common/configurationModels.js +0 -554
  364. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/configuration/common/configurationRegistry.js +0 -317
  365. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/configuration/common/configurations.js +0 -41
  366. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/contextkey/browser/contextKeyService.js +0 -432
  367. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/contextkey/common/contextkey.js +0 -1547
  368. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/contextkey/common/contextkeys.js +0 -18
  369. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/contextview/browser/contextMenuHandler.js +0 -124
  370. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/contextview/browser/contextMenuService.js +0 -101
  371. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/contextview/browser/contextView.js +0 -7
  372. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/contextview/browser/contextViewService.js +0 -72
  373. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/dialogs/common/dialogs.js +0 -2
  374. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/dnd/browser/dnd.js +0 -36
  375. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/editor/common/editor.js +0 -17
  376. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/environment/common/environment.js +0 -2
  377. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/extensions/common/extensions.js +0 -47
  378. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/files/common/files.js +0 -9
  379. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/history/browser/contextScopedHistoryWidget.js +0 -105
  380. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/instantiation/common/descriptors.js +0 -11
  381. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/instantiation/common/extensions.js +0 -15
  382. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/keybinding/common/abstractKeybindingService.js +0 -277
  383. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/keybinding/common/baseResolvedKeybinding.js +0 -53
  384. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/quickinput/browser/commandsQuickAccess.js +0 -354
  385. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/theme/browser/defaultStyles.js +0 -162
  386. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/theme/common/colorRegistry.js +0 -482
  387. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/basic-languages/abap/abap.js +0 -10
  388. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/basic-languages/apex/apex.js +0 -10
  389. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/basic-languages/azcli/azcli.js +0 -10
  390. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/basic-languages/bat/bat.js +0 -10
  391. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/basic-languages/bicep/bicep.js +0 -11
  392. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/basic-languages/cameligo/cameligo.js +0 -10
  393. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/basic-languages/clojure/clojure.js +0 -10
  394. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/basic-languages/coffee/coffee.js +0 -10
  395. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/basic-languages/cpp/cpp.js +0 -10
  396. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/basic-languages/csharp/csharp.js +0 -10
  397. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/basic-languages/csp/csp.js +0 -10
  398. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/basic-languages/css/css.js +0 -12
  399. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/basic-languages/cypher/cypher.js +0 -10
  400. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/basic-languages/dart/dart.js +0 -10
  401. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/basic-languages/dockerfile/dockerfile.js +0 -10
  402. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/basic-languages/ecl/ecl.js +0 -10
  403. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/basic-languages/elixir/elixir.js +0 -10
  404. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/basic-languages/flow9/flow9.js +0 -10
  405. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/editor/editor.main.js +0 -745
  406. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/editor/editor.main.nls.de.js +0 -31
  407. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/editor/editor.main.nls.es.js +0 -31
  408. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/editor/editor.main.nls.fr.js +0 -29
  409. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/editor/editor.main.nls.it.js +0 -29
  410. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/editor/editor.main.nls.ja.js +0 -31
  411. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/editor/editor.main.nls.js +0 -29
  412. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/editor/editor.main.nls.ko.js +0 -29
  413. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/editor/editor.main.nls.ru.js +0 -31
  414. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/editor/editor.main.nls.zh-cn.js +0 -31
  415. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/editor/editor.main.nls.zh-tw.js +0 -29
  416. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/language/css/cssMode.js +0 -13
  417. package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/language/css/cssWorker.js +0 -81
  418. package/dist/src/web/frontend/node_modules/.multicast-dns-iKseM9bB/cli.js +0 -64
  419. package/dist/src/web/frontend/node_modules/.multicast-dns-iKseM9bB/example.js +0 -36
  420. package/dist/src/web/frontend/node_modules/.multicast-dns-iKseM9bB/index.js +0 -205
  421. package/dist/src/web/frontend/node_modules/.multicast-dns-iKseM9bB/test.js +0 -260
  422. package/dist/src/web/frontend/node_modules/.nanoid-PAMEV9Hd/async/index.browser.js +0 -34
  423. package/dist/src/web/frontend/node_modules/.nanoid-PAMEV9Hd/async/index.js +0 -35
  424. package/dist/src/web/frontend/node_modules/.nanoid-PAMEV9Hd/async/index.native.js +0 -26
  425. package/dist/src/web/frontend/node_modules/.nanoid-PAMEV9Hd/index.browser.js +0 -34
  426. package/dist/src/web/frontend/node_modules/.nanoid-PAMEV9Hd/index.js +0 -45
  427. package/dist/src/web/frontend/node_modules/.nanoid-PAMEV9Hd/nanoid.js +0 -1
  428. package/dist/src/web/frontend/node_modules/.nanoid-PAMEV9Hd/non-secure/index.js +0 -21
  429. package/dist/src/web/frontend/node_modules/.nanoid-PAMEV9Hd/url-alphabet/index.js +0 -3
  430. package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/bin/nodemon.js +0 -16
  431. package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/lib/cli/index.js +0 -49
  432. package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/lib/cli/parse.js +0 -230
  433. package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/lib/config/command.js +0 -43
  434. package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/lib/config/defaults.js +0 -34
  435. package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/lib/config/exec.js +0 -234
  436. package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/lib/config/index.js +0 -93
  437. package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/lib/config/load.js +0 -225
  438. package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/lib/help/index.js +0 -27
  439. package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/lib/index.js +0 -1
  440. package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/lib/monitor/index.js +0 -4
  441. package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/lib/monitor/match.js +0 -287
  442. package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/lib/monitor/run.js +0 -562
  443. package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/lib/monitor/signals.js +0 -34
  444. package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/lib/monitor/watch.js +0 -244
  445. package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/lib/nodemon.js +0 -317
  446. package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/lib/rules/add.js +0 -89
  447. package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/lib/rules/index.js +0 -53
  448. package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/lib/rules/parse.js +0 -43
  449. package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/lib/spawn.js +0 -74
  450. package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/lib/utils/bus.js +0 -44
  451. package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/lib/utils/clone.js +0 -40
  452. package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/lib/utils/colour.js +0 -26
  453. package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/lib/utils/index.js +0 -103
  454. package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/lib/utils/log.js +0 -82
  455. package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/lib/utils/merge.js +0 -47
  456. package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/lib/version.js +0 -100
  457. package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/node_modules/brace-expansion/index.js +0 -201
  458. package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/node_modules/has-flag/index.js +0 -8
  459. package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/node_modules/minimatch/minimatch.js +0 -947
  460. package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/node_modules/supports-color/browser.js +0 -5
  461. package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/node_modules/supports-color/index.js +0 -131
  462. package/dist/src/web/frontend/node_modules/.pidtree-icfat3SQ/bin/pidtree.js +0 -128
  463. package/dist/src/web/frontend/node_modules/.pidtree-icfat3SQ/index.js +0 -49
  464. package/dist/src/web/frontend/node_modules/.pidtree-icfat3SQ/lib/bin.js +0 -61
  465. package/dist/src/web/frontend/node_modules/.pidtree-icfat3SQ/lib/get.js +0 -45
  466. package/dist/src/web/frontend/node_modules/.pidtree-icfat3SQ/lib/pidtree.js +0 -104
  467. package/dist/src/web/frontend/node_modules/.pidtree-icfat3SQ/lib/ps.js +0 -47
  468. package/dist/src/web/frontend/node_modules/.pidtree-icfat3SQ/lib/wmic.js +0 -49
  469. package/dist/src/web/frontend/node_modules/.prettier-ApZm3b7s/doc.js +0 -1270
  470. package/dist/src/web/frontend/node_modules/.prettier-ApZm3b7s/plugins/acorn.js +0 -15
  471. package/dist/src/web/frontend/node_modules/.prettier-ApZm3b7s/plugins/angular.js +0 -2
  472. package/dist/src/web/frontend/node_modules/.prettier-ApZm3b7s/plugins/babel.js +0 -15
  473. package/dist/src/web/frontend/node_modules/.prettier-ApZm3b7s/plugins/estree.js +0 -36
  474. package/dist/src/web/frontend/node_modules/.prettier-ApZm3b7s/plugins/flow.js +0 -19
  475. package/dist/src/web/frontend/node_modules/.prettier-ApZm3b7s/plugins/glimmer.js +0 -29
  476. package/dist/src/web/frontend/node_modules/.prettier-ApZm3b7s/plugins/graphql.js +0 -29
  477. package/dist/src/web/frontend/node_modules/.prettier-ApZm3b7s/plugins/html.js +0 -22
  478. package/dist/src/web/frontend/node_modules/.prettier-ApZm3b7s/plugins/markdown.js +0 -63
  479. package/dist/src/web/frontend/node_modules/.prettier-ApZm3b7s/plugins/meriyah.js +0 -4
  480. package/dist/src/web/frontend/node_modules/.prettier-ApZm3b7s/plugins/postcss.js +0 -54
  481. package/dist/src/web/frontend/node_modules/.prettier-ApZm3b7s/plugins/typescript.js +0 -20
  482. package/dist/src/web/frontend/node_modules/.prettier-ApZm3b7s/plugins/yaml.js +0 -160
  483. package/dist/src/web/frontend/node_modules/.prettier-ApZm3b7s/standalone.js +0 -34
  484. package/dist/src/web/frontend/node_modules/.react-scripts-OTANyoRb/bin/react-scripts.js +0 -58
  485. package/dist/src/web/frontend/node_modules/.react-scripts-OTANyoRb/config/env.js +0 -112
  486. package/dist/src/web/frontend/node_modules/.react-scripts-OTANyoRb/config/getHttpsConfig.js +0 -74
  487. package/dist/src/web/frontend/node_modules/.react-scripts-OTANyoRb/config/jest/babelTransform.js +0 -37
  488. package/dist/src/web/frontend/node_modules/.react-scripts-OTANyoRb/config/jest/cssTransform.js +0 -22
  489. package/dist/src/web/frontend/node_modules/.react-scripts-OTANyoRb/config/jest/fileTransform.js +0 -40
  490. package/dist/src/web/frontend/node_modules/.react-scripts-OTANyoRb/config/modules.js +0 -142
  491. package/dist/src/web/frontend/node_modules/.react-scripts-OTANyoRb/config/paths.js +0 -153
  492. package/dist/src/web/frontend/node_modules/.react-scripts-OTANyoRb/config/webpack/persistentCache/createEnvironmentHash.js +0 -9
  493. package/dist/src/web/frontend/node_modules/.react-scripts-OTANyoRb/config/webpack.config.js +0 -796
  494. package/dist/src/web/frontend/node_modules/.react-scripts-OTANyoRb/config/webpackDevServer.config.js +0 -135
  495. package/dist/src/web/frontend/node_modules/.react-scripts-OTANyoRb/scripts/build.js +0 -225
  496. package/dist/src/web/frontend/node_modules/.react-scripts-OTANyoRb/scripts/eject.js +0 -340
@@ -4,371 +4,469 @@
4
4
  * This module provides the core infrastructure for executing automation
5
5
  * workflows with Claude CLI integration, while preserving existing
6
6
  * swarm and hive-mind functionality.
7
- */ import { promises as fs } from "fs";
8
- import { spawn } from "child_process";
9
- import { join } from "path";
10
- import { printSuccess, printError } from "../utils.js";
7
+ */
8
+
9
+ import { promises as fs } from 'fs';
10
+ import { spawn } from 'child_process';
11
+ import { join, dirname } from 'path';
12
+ import { printSuccess, printError, printWarning } from '../utils.js';
13
+
11
14
  // Simple ID generator
12
15
  function generateId(prefix = 'id') {
13
- return `${prefix}-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
16
+ return `${prefix}-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
14
17
  }
18
+
15
19
  /**
16
20
  * WorkflowExecutor - Core class for executing automation workflows
17
- */ export class WorkflowExecutor {
18
- /**
19
- * Execute a workflow from JSON definition
20
- */ async executeWorkflow(workflowData, variables = {}) {
21
- try {
22
- // Store workflow for reference
23
- this.currentWorkflow = workflowData;
24
- if (this.options.logLevel === 'quiet') {
25
- console.log(`🚀 Executing workflow: ${this.executionId}`);
26
- } else {
27
- console.log(`🚀 Starting workflow execution: ${this.executionId}`);
28
- console.log(`📋 Workflow: ${workflowData.name}`);
29
- console.log(`🎯 Strategy: MLE-STAR Machine Learning Engineering`);
30
- if (this.options.enableClaude) {
31
- console.log(`🤖 Claude CLI Integration: Enabled`);
32
- }
33
- if (this.options.nonInteractive) {
34
- console.log(`🖥️ Non-Interactive Mode: Enabled`);
35
- if (this.options.outputFormat === 'stream-json') {
36
- console.log();
37
- console.log('● Running MLE-STAR workflow with Claude CLI integration');
38
- console.log(' ⎿ Command format: claude --print --output-format stream-json --verbose --dangerously-skip-permissions');
39
- console.log(' ⎿ Each agent will show real-time stream output below');
40
- console.log(' ⎿ Interactive-style formatting enabled');
41
- }
42
- }
43
- }
44
- console.log();
45
- // Pre-execution hooks
46
- if (this.hooksEnabled) {
47
- await this.executeHook('pre-task', {
48
- description: `Execute workflow: ${workflowData.name}`,
49
- sessionId: this.sessionId
50
- });
51
- }
52
- // Validate workflow
53
- this.validateWorkflow(workflowData);
54
- // Apply variable substitutions
55
- const processedWorkflow = this.applyVariables(workflowData, variables);
56
- // Initialize agents if Claude integration is enabled
57
- if (this.options.enableClaude) {
58
- await this.initializeClaudeAgents(processedWorkflow.agents);
59
- }
60
- // Execute workflow phases
61
- const result = await this.executeWorkflowTasks(processedWorkflow);
62
- // Post-execution hooks
63
- if (this.hooksEnabled) {
64
- await this.executeHook('post-task', {
65
- taskId: this.executionId,
66
- sessionId: this.sessionId,
67
- result: result.success ? 'success' : 'failure'
68
- });
69
- }
70
- const duration = Date.now() - this.startTime;
71
- if (result.success) {
72
- printSuccess(`✅ Workflow completed successfully in ${this.formatDuration(duration)}`);
73
- console.log(`📊 Tasks: ${result.completedTasks}/${result.totalTasks} completed`);
74
- console.log(`🆔 Execution ID: ${this.executionId}`);
75
- } else {
76
- printError(`❌ Workflow failed after ${this.formatDuration(duration)}`);
77
- console.log(`📊 Tasks: ${result.completedTasks}/${result.totalTasks} completed`);
78
- console.log(`❌ Errors: ${this.errors.length}`);
79
- }
80
- // Cleanup Claude instances
81
- if (this.options.enableClaude) {
82
- await this.cleanupClaudeInstances();
83
- }
84
- return result;
85
- } catch (error) {
86
- printError(`Workflow execution failed: ${error.message}`);
87
- await this.cleanupClaudeInstances();
88
- throw error;
89
- }
21
+ */
22
+ export class WorkflowExecutor {
23
+ constructor(options = {}) {
24
+ this.options = {
25
+ enableClaude: false,
26
+ nonInteractive: false,
27
+ outputFormat: 'text',
28
+ maxConcurrency: 3,
29
+ timeout: 3600000, // 1 hour default
30
+ logLevel: 'info',
31
+ ...options,
32
+ };
33
+
34
+ // Increase timeout for ML workflows
35
+ if (options.workflowType === 'ml' || options.workflowName?.toLowerCase().includes('mle')) {
36
+ this.options.timeout = 7200000; // 2 hours for ML workflows
90
37
  }
91
- /**
92
- * Initialize Claude CLI instances for agents
93
- */ async initializeClaudeAgents(agents) {
94
- if (!agents || agents.length === 0) {
95
- return;
96
- }
97
- // Check if Claude CLI is available
98
- if (!await this.isClaudeAvailable()) {
99
- throw new Error('Claude CLI not found. Please install Claude Code: https://claude.ai/code');
38
+
39
+ // Execution state
40
+ this.executionId = generateId('workflow-exec');
41
+ this.startTime = Date.now();
42
+ this.activeTasks = new Map();
43
+ this.claudeInstances = new Map();
44
+ this.results = new Map();
45
+ this.errors = [];
46
+ this.currentWorkflow = null;
47
+
48
+ // Stream chaining support
49
+ this.taskOutputStreams = new Map(); // Store output streams for chaining
50
+ this.enableChaining = options.enableChaining !== false; // Default to true
51
+
52
+ // Hooks integration
53
+ this.hooksEnabled = true;
54
+ this.sessionId = generateId('automation-session');
55
+ }
56
+
57
+ /**
58
+ * Execute a workflow from JSON definition
59
+ */
60
+ async executeWorkflow(workflowData, variables = {}) {
61
+ try {
62
+ // Store workflow for reference
63
+ this.currentWorkflow = workflowData;
64
+
65
+ if (this.options.logLevel === 'quiet') {
66
+ console.log(`🚀 Executing workflow: ${this.executionId}`);
67
+ } else {
68
+ console.log(`🚀 Starting workflow execution: ${this.executionId}`);
69
+ console.log(`📋 Workflow: ${workflowData.name}`);
70
+ console.log(`🎯 Strategy: MLE-STAR Machine Learning Engineering`);
71
+
72
+ if (this.options.enableClaude) {
73
+ console.log(`🤖 Claude CLI Integration: Enabled`);
100
74
  }
75
+
101
76
  if (this.options.nonInteractive) {
102
- // Non-interactive mode: agents are spawned per task instead
103
- if (this.options.logLevel !== 'quiet') {
104
- console.log(`🤖 Non-interactive mode: Claude instances will be spawned per task`);
105
- console.log(`📋 Each task will launch its own Claude process with specific prompts`);
106
- }
107
- return;
108
- } else {
109
- // Interactive mode: spawn single Claude instance with master coordination prompt
110
- console.log(`🤖 Interactive mode: Initializing single Claude instance for workflow coordination...`);
111
- try {
112
- // Create master coordination prompt for all agents and workflow
113
- const masterPrompt = this.createMasterCoordinationPrompt(agents);
114
- // Spawn single Claude instance for workflow coordination
115
- const claudeProcess = await this.spawnClaudeInstance({
116
- id: 'master-coordinator',
117
- name: 'Workflow Coordinator',
118
- type: 'coordinator'
119
- }, masterPrompt);
120
- // Store as master coordinator
121
- this.claudeInstances.set('master-coordinator', {
122
- process: claudeProcess,
123
- agent: {
124
- id: 'master-coordinator',
125
- name: 'Workflow Coordinator',
126
- type: 'coordinator'
127
- },
128
- status: 'active',
129
- startTime: Date.now(),
130
- agents: agents
131
- });
132
- console.log(` ✅ Master Workflow Coordinator (PID: ${claudeProcess.pid})`);
133
- console.log(` 🎯 Coordinating ${agents.length} sub-agents via concurrent streams`);
134
- console.log(` 📋 Agents: ${agents.map((a)=>a.name).join(', ')}`);
135
- } catch (error) {
136
- console.error(` ❌ Failed to initialize master coordinator: ${error.message}`);
137
- this.errors.push({
138
- type: 'master_coordinator_initialization',
139
- error: error.message,
140
- timestamp: new Date()
141
- });
142
- }
77
+ console.log(`🖥️ Non-Interactive Mode: Enabled`);
78
+ if (this.options.outputFormat === 'stream-json') {
143
79
  console.log();
80
+ console.log('● Running MLE-STAR workflow with Claude CLI integration');
81
+ console.log(
82
+ ' ⎿ Command format: claude --print --output-format stream-json --verbose --dangerously-skip-permissions',
83
+ );
84
+ console.log(' ⎿ Each agent will show real-time stream output below');
85
+ console.log(' ⎿ Interactive-style formatting enabled');
86
+ }
144
87
  }
88
+ }
89
+
90
+ console.log();
91
+
92
+ // Pre-execution hooks
93
+ if (this.hooksEnabled) {
94
+ await this.executeHook('pre-task', {
95
+ description: `Execute workflow: ${workflowData.name}`,
96
+ sessionId: this.sessionId,
97
+ });
98
+ }
99
+
100
+ // Validate workflow
101
+ this.validateWorkflow(workflowData);
102
+
103
+ // Apply variable substitutions
104
+ const processedWorkflow = this.applyVariables(workflowData, variables);
105
+
106
+ // Initialize agents if Claude integration is enabled
107
+ if (this.options.enableClaude) {
108
+ await this.initializeClaudeAgents(processedWorkflow.agents);
109
+ }
110
+
111
+ // Execute workflow phases
112
+ const result = await this.executeWorkflowTasks(processedWorkflow);
113
+
114
+ // Post-execution hooks
115
+ if (this.hooksEnabled) {
116
+ await this.executeHook('post-task', {
117
+ taskId: this.executionId,
118
+ sessionId: this.sessionId,
119
+ result: result.success ? 'success' : 'failure',
120
+ });
121
+ }
122
+
123
+ const duration = Date.now() - this.startTime;
124
+
125
+ if (result.success) {
126
+ printSuccess(`✅ Workflow completed successfully in ${this.formatDuration(duration)}`);
127
+ console.log(`📊 Tasks: ${result.completedTasks}/${result.totalTasks} completed`);
128
+ console.log(`🆔 Execution ID: ${this.executionId}`);
129
+ } else {
130
+ printError(`❌ Workflow failed after ${this.formatDuration(duration)}`);
131
+ console.log(`📊 Tasks: ${result.completedTasks}/${result.totalTasks} completed`);
132
+ console.log(`❌ Errors: ${this.errors.length}`);
133
+ }
134
+
135
+ // Cleanup Claude instances
136
+ if (this.options.enableClaude) {
137
+ await this.cleanupClaudeInstances();
138
+ }
139
+
140
+ return result;
141
+ } catch (error) {
142
+ printError(`Workflow execution failed: ${error.message}`);
143
+ await this.cleanupClaudeInstances();
144
+ throw error;
145
+ }
146
+ }
147
+
148
+ /**
149
+ * Initialize Claude CLI instances for agents
150
+ */
151
+ async initializeClaudeAgents(agents) {
152
+ if (!agents || agents.length === 0) {
153
+ return;
154
+ }
155
+
156
+ // Check if Claude CLI is available
157
+ if (!(await this.isClaudeAvailable())) {
158
+ throw new Error('Claude CLI not found. Please install Claude Code: https://claude.ai/code');
159
+ }
160
+
161
+ if (this.options.nonInteractive) {
162
+ // Non-interactive mode: agents are spawned per task instead
163
+ if (this.options.logLevel !== 'quiet') {
164
+ console.log(`🤖 Non-interactive mode: Claude instances will be spawned per task`);
165
+ console.log(`📋 Each task will launch its own Claude process with specific prompts`);
166
+ }
167
+ return;
168
+ } else {
169
+ // Interactive mode: spawn single Claude instance with master coordination prompt
170
+ console.log(
171
+ `🤖 Interactive mode: Initializing single Claude instance for workflow coordination...`,
172
+ );
173
+
174
+ try {
175
+ // Create master coordination prompt for all agents and workflow
176
+ const masterPrompt = this.createMasterCoordinationPrompt(agents);
177
+
178
+ // Spawn single Claude instance for workflow coordination
179
+ const claudeProcess = await this.spawnClaudeInstance(
180
+ {
181
+ id: 'master-coordinator',
182
+ name: 'Workflow Coordinator',
183
+ type: 'coordinator',
184
+ },
185
+ masterPrompt,
186
+ );
187
+
188
+ // Store as master coordinator
189
+ this.claudeInstances.set('master-coordinator', {
190
+ process: claudeProcess,
191
+ agent: { id: 'master-coordinator', name: 'Workflow Coordinator', type: 'coordinator' },
192
+ status: 'active',
193
+ startTime: Date.now(),
194
+ agents: agents, // Store agent definitions for reference
195
+ });
196
+
197
+ console.log(` ✅ Master Workflow Coordinator (PID: ${claudeProcess.pid})`);
198
+ console.log(` 🎯 Coordinating ${agents.length} sub-agents via concurrent streams`);
199
+ console.log(` 📋 Agents: ${agents.map((a) => a.name).join(', ')}`);
200
+ } catch (error) {
201
+ console.error(` ❌ Failed to initialize master coordinator: ${error.message}`);
202
+ this.errors.push({
203
+ type: 'master_coordinator_initialization',
204
+ error: error.message,
205
+ timestamp: new Date(),
206
+ });
207
+ }
208
+
209
+ console.log();
145
210
  }
146
- /**
211
+ }
212
+
213
+ /**
147
214
  * Check if Claude CLI is available
148
- */ async isClaudeAvailable() {
149
- try {
150
- const { execSync } = await import("child_process");
151
- execSync('which claude', {
152
- stdio: 'ignore'
153
- });
154
- return true;
155
- } catch {
156
- return false;
157
- }
215
+ */
216
+ async isClaudeAvailable() {
217
+ try {
218
+ const { execSync } = await import('child_process');
219
+ execSync('which claude', { stdio: 'ignore' });
220
+ return true;
221
+ } catch {
222
+ return false;
158
223
  }
159
- /**
224
+ }
225
+
226
+ /**
160
227
  * Spawn a Claude CLI instance for an agent
161
228
  * @param {Object} agent - The agent configuration
162
229
  * @param {string} prompt - The prompt for the agent
163
230
  * @param {Object} options - Additional options
164
231
  * @param {Stream} options.inputStream - Optional input stream from previous agent
165
232
  * @param {boolean} options.enableChaining - Whether to enable stream-json chaining
166
- */ async spawnClaudeInstance(agent1, prompt, options = {}) {
167
- const claudeArgs = [];
168
- // Add flags based on mode
169
- if (this.options.nonInteractive) {
170
- // Non-interactive mode: use --print with stream-json output
171
- claudeArgs.push('--print');
172
- if (this.options.outputFormat === 'stream-json') {
173
- claudeArgs.push('--output-format', 'stream-json');
174
- claudeArgs.push('--verbose'); // Required for stream-json
175
- // Add input format if we're chaining from a previous agent
176
- if (options.inputStream) {
177
- claudeArgs.push('--input-format', 'stream-json');
178
- }
179
- }
180
- }
181
- // Always skip permissions for automated workflows (both interactive and non-interactive)
182
- claudeArgs.push('--dangerously-skip-permissions');
183
- // Always add the prompt as the final argument
184
- claudeArgs.push(prompt);
185
- // Only show command details in verbose mode
186
- if (this.options.logLevel === 'debug') {
187
- const displayPrompt = prompt.length > 100 ? prompt.substring(0, 100) + '...' : prompt;
188
- const flagsDisplay = this.options.nonInteractive ? this.options.outputFormat === 'stream-json' ? options.inputStream ? '--print --input-format stream-json --output-format stream-json --verbose --dangerously-skip-permissions' : '--print --output-format stream-json --verbose --dangerously-skip-permissions' : '--print --dangerously-skip-permissions' : '--dangerously-skip-permissions';
189
- console.log(` 🤖 Spawning Claude for ${agent1.name}: claude ${flagsDisplay} "${displayPrompt}"`);
190
- } else if (this.options.logLevel !== 'quiet') {
191
- console.log(` 🚀 Starting ${agent1.name}`);
192
- }
193
- // Determine stdio configuration based on mode and chaining
194
- const stdioConfig = this.options.nonInteractive ? [
195
- options.inputStream ? 'pipe' : 'inherit',
196
- 'pipe',
197
- 'pipe'
198
- ] // Non-interactive: pipe for chaining
199
- : [
200
- 'inherit',
201
- 'inherit',
202
- 'inherit'
203
- ]; // Interactive: inherit all for normal Claude interaction
204
- // Spawn Claude process
205
- const claudeProcess = spawn('claude', claudeArgs, {
206
- stdio: stdioConfig,
207
- shell: false
208
- });
209
- // If we have an input stream, pipe it to Claude's stdin
210
- if (options.inputStream && claudeProcess.stdin) {
211
- console.log(` 🔗 Chaining: Piping output from previous agent to ${agent1.name}`);
212
- options.inputStream.pipe(claudeProcess.stdin);
233
+ */
234
+ async spawnClaudeInstance(agent, prompt, options = {}) {
235
+ const claudeArgs = [];
236
+
237
+ // Add flags based on mode
238
+ if (this.options.nonInteractive) {
239
+ // Non-interactive mode: use --print with stream-json output
240
+ claudeArgs.push('--print');
241
+ if (this.options.outputFormat === 'stream-json') {
242
+ claudeArgs.push('--output-format', 'stream-json');
243
+ claudeArgs.push('--verbose'); // Required for stream-json
244
+
245
+ // Add input format if we're chaining from a previous agent
246
+ if (options.inputStream) {
247
+ claudeArgs.push('--input-format', 'stream-json');
213
248
  }
214
- // Handle stdout with stream processor for better formatting (only in non-interactive mode)
215
- if (this.options.nonInteractive && this.options.outputFormat === 'stream-json' && claudeProcess.stdout) {
216
- // Import and use stream processor
217
- const { createStreamProcessor } = await import("./stream-processor.js");
218
- const streamProcessor = createStreamProcessor(agent1.name, this.getAgentIcon(agent1.id), {
219
- verbose: this.options.logLevel === 'debug',
220
- logLevel: this.options.logLevel,
221
- taskId: agent1.taskId,
222
- agentId: agent1.id,
223
- display: null
224
- });
225
- // Pipe stdout through processor
226
- claudeProcess.stdout.pipe(streamProcessor);
227
- // Handle stderr for non-interactive mode
228
- claudeProcess.stderr.on('data', (data)=>{
229
- const message = data.toString().trim();
230
- if (message) {
231
- console.error(` ❌ [${agent1.name}] Error: ${message}`);
232
- }
233
- });
234
- } else if (this.options.nonInteractive && this.options.outputFormat !== 'stream-json') {
235
- // For non-interactive non-stream-json output, show stdout directly
236
- claudeProcess.stdout.on('data', (data)=>{
237
- console.log(data.toString().trimEnd());
238
- });
239
- claudeProcess.stderr.on('data', (data)=>{
240
- console.error(data.toString().trimEnd());
241
- });
249
+ }
250
+ }
251
+
252
+ // Always skip permissions for automated workflows (both interactive and non-interactive)
253
+ claudeArgs.push('--dangerously-skip-permissions');
254
+
255
+ // Always add the prompt as the final argument
256
+ claudeArgs.push(prompt);
257
+
258
+ // Only show command details in verbose mode
259
+ if (this.options.logLevel === 'debug') {
260
+ const displayPrompt = prompt.length > 100 ? prompt.substring(0, 100) + '...' : prompt;
261
+ const flagsDisplay = this.options.nonInteractive
262
+ ? this.options.outputFormat === 'stream-json'
263
+ ? options.inputStream
264
+ ? '--print --input-format stream-json --output-format stream-json --verbose --dangerously-skip-permissions'
265
+ : '--print --output-format stream-json --verbose --dangerously-skip-permissions'
266
+ : '--print --dangerously-skip-permissions'
267
+ : '--dangerously-skip-permissions';
268
+ console.log(
269
+ ` 🤖 Spawning Claude for ${agent.name}: claude ${flagsDisplay} "${displayPrompt}"`,
270
+ );
271
+ } else if (this.options.logLevel !== 'quiet') {
272
+ console.log(` 🚀 Starting ${agent.name}`);
273
+ }
274
+
275
+ // Determine stdio configuration based on mode and chaining
276
+ const stdioConfig = this.options.nonInteractive
277
+ ? [options.inputStream ? 'pipe' : 'inherit', 'pipe', 'pipe'] // Non-interactive: pipe for chaining
278
+ : ['inherit', 'inherit', 'inherit']; // Interactive: inherit all for normal Claude interaction
279
+
280
+ // Spawn Claude process
281
+ const claudeProcess = spawn('claude', claudeArgs, {
282
+ stdio: stdioConfig,
283
+ shell: false,
284
+ });
285
+
286
+ // If we have an input stream, pipe it to Claude's stdin
287
+ if (options.inputStream && claudeProcess.stdin) {
288
+ console.log(` 🔗 Chaining: Piping output from previous agent to ${agent.name}`);
289
+ options.inputStream.pipe(claudeProcess.stdin);
290
+ }
291
+
292
+ // Handle stdout with stream processor for better formatting (only in non-interactive mode)
293
+ if (
294
+ this.options.nonInteractive &&
295
+ this.options.outputFormat === 'stream-json' &&
296
+ claudeProcess.stdout
297
+ ) {
298
+ // Import and use stream processor
299
+ const { createStreamProcessor } = await import('./stream-processor.js');
300
+ const streamProcessor = createStreamProcessor(agent.name, this.getAgentIcon(agent.id), {
301
+ verbose: this.options.logLevel === 'debug',
302
+ logLevel: this.options.logLevel,
303
+ taskId: agent.taskId,
304
+ agentId: agent.id,
305
+ display: null, // Interactive-style formatting instead of concurrent display
306
+ });
307
+
308
+ // Pipe stdout through processor
309
+ claudeProcess.stdout.pipe(streamProcessor);
310
+
311
+ // Handle stderr for non-interactive mode
312
+ claudeProcess.stderr.on('data', (data) => {
313
+ const message = data.toString().trim();
314
+ if (message) {
315
+ console.error(` ❌ [${agent.name}] Error: ${message}`);
242
316
  }
243
- // Note: In interactive mode, stdio is inherited so Claude handles its own I/O
244
- // Handle process events
245
- claudeProcess.on('error', (error)=>{
246
- console.error(`❌ Claude instance error for ${agent1.name}:`, error.message);
247
- this.errors.push({
248
- type: 'claude_instance_error',
249
- agent: agent1.id,
250
- error: error.message,
251
- timestamp: new Date()
252
- });
253
- });
254
- claudeProcess.on('exit', (code)=>{
255
- const instance = this.claudeInstances.get(agent1.id);
256
- if (instance) {
257
- instance.status = code === 0 ? 'completed' : 'failed';
258
- instance.exitCode = code;
259
- instance.endTime = Date.now();
260
- }
261
- });
262
- return claudeProcess;
317
+ });
318
+ } else if (this.options.nonInteractive && this.options.outputFormat !== 'stream-json') {
319
+ // For non-interactive non-stream-json output, show stdout directly
320
+ claudeProcess.stdout.on('data', (data) => {
321
+ console.log(data.toString().trimEnd());
322
+ });
323
+
324
+ claudeProcess.stderr.on('data', (data) => {
325
+ console.error(data.toString().trimEnd());
326
+ });
263
327
  }
264
- /**
328
+ // Note: In interactive mode, stdio is inherited so Claude handles its own I/O
329
+
330
+ // Handle process events
331
+ claudeProcess.on('error', (error) => {
332
+ console.error(`❌ Claude instance error for ${agent.name}:`, error.message);
333
+ this.errors.push({
334
+ type: 'claude_instance_error',
335
+ agent: agent.id,
336
+ error: error.message,
337
+ timestamp: new Date(),
338
+ });
339
+ });
340
+
341
+ claudeProcess.on('exit', (code) => {
342
+ const instance = this.claudeInstances.get(agent.id);
343
+ if (instance) {
344
+ instance.status = code === 0 ? 'completed' : 'failed';
345
+ instance.exitCode = code;
346
+ instance.endTime = Date.now();
347
+ }
348
+ });
349
+
350
+ return claudeProcess;
351
+ }
352
+
353
+ /**
265
354
  * Handle Claude stream events
266
- */ handleClaudeStreamEvent(agent1, event) {
267
- if (this.options.outputFormat === 'stream-json') {
268
- // Create concise formatted JSON with summary
269
- const summary = this.getEventSummary(event);
270
- const icon = this.getEventIcon(event.type);
271
- // Simplified output for better readability
272
- const output = {
273
- t: new Date().toISOString().split('T')[1].split('.')[0],
274
- agent: `${this.getAgentIcon(agent1.id)} ${agent1.name}`,
275
- phase: this.currentPhase,
276
- event: `${icon} ${summary}`
277
- };
278
- // Add relevant details based on event type
279
- if (event.type === 'tool_use' && event.name) {
280
- output.tool = event.name;
281
- } else if (event.type === 'error' && event.error) {
282
- output.error = event.error;
283
- }
284
- console.log(JSON.stringify(output));
285
- } else {
286
- // Format output for text mode
287
- switch(event.type){
288
- case 'tool_use':
289
- console.log(` [${agent1.name}] 🔧 Using tool: ${event.name}`);
290
- break;
291
- case 'message':
292
- console.log(` [${agent1.name}] 💬 ${event.content}`);
293
- break;
294
- case 'completion':
295
- console.log(` [${agent1.name}] ✅ Task completed`);
296
- break;
297
- case 'error':
298
- console.error(` [${agent1.name}] ❌ Error: ${event.error}`);
299
- break;
300
- default:
301
- // Log other events in debug mode
302
- if (this.options.logLevel === 'debug') {
303
- console.log(` [${agent1.name}] ${event.type}: ${JSON.stringify(event)}`);
304
- }
305
- }
306
- }
355
+ */
356
+ handleClaudeStreamEvent(agent, event) {
357
+ if (this.options.outputFormat === 'stream-json') {
358
+ // Create concise formatted JSON with summary
359
+ const summary = this.getEventSummary(event);
360
+ const icon = this.getEventIcon(event.type);
361
+
362
+ // Simplified output for better readability
363
+ const output = {
364
+ t: new Date().toISOString().split('T')[1].split('.')[0], // HH:MM:SS
365
+ agent: `${this.getAgentIcon(agent.id)} ${agent.name}`,
366
+ phase: this.currentPhase,
367
+ event: `${icon} ${summary}`,
368
+ };
369
+
370
+ // Add relevant details based on event type
371
+ if (event.type === 'tool_use' && event.name) {
372
+ output.tool = event.name;
373
+ } else if (event.type === 'error' && event.error) {
374
+ output.error = event.error;
375
+ }
376
+
377
+ console.log(JSON.stringify(output));
378
+ } else {
379
+ // Format output for text mode
380
+ switch (event.type) {
381
+ case 'tool_use':
382
+ console.log(` [${agent.name}] 🔧 Using tool: ${event.name}`);
383
+ break;
384
+ case 'message':
385
+ console.log(` [${agent.name}] 💬 ${event.content}`);
386
+ break;
387
+ case 'completion':
388
+ console.log(` [${agent.name}] ✅ Task completed`);
389
+ break;
390
+ case 'error':
391
+ console.error(` [${agent.name}] Error: ${event.error}`);
392
+ break;
393
+ default:
394
+ // Log other events in debug mode
395
+ if (this.options.logLevel === 'debug') {
396
+ console.log(` [${agent.name}] ${event.type}: ${JSON.stringify(event)}`);
397
+ }
398
+ }
307
399
  }
308
- /**
400
+ }
401
+
402
+ /**
309
403
  * Get a brief summary of an event
310
- */ getEventSummary(event) {
311
- switch(event.type){
312
- case 'tool_use':
313
- return `Using ${event.name} tool`;
314
- case 'message':
315
- return event.content?.substring(0, 100) + (event.content?.length > 100 ? '...' : '');
316
- case 'completion':
317
- return 'Task completed successfully';
318
- case 'error':
319
- return `Error: ${event.error}`;
320
- case 'status':
321
- return event.status || 'Status update';
322
- default:
323
- return event.type;
324
- }
404
+ */
405
+ getEventSummary(event) {
406
+ switch (event.type) {
407
+ case 'tool_use':
408
+ return `Using ${event.name} tool`;
409
+ case 'message':
410
+ return event.content?.substring(0, 100) + (event.content?.length > 100 ? '...' : '');
411
+ case 'completion':
412
+ return 'Task completed successfully';
413
+ case 'error':
414
+ return `Error: ${event.error}`;
415
+ case 'status':
416
+ return event.status || 'Status update';
417
+ default:
418
+ return event.type;
325
419
  }
326
- /**
420
+ }
421
+
422
+ /**
327
423
  * Get icon for event type
328
- */ getEventIcon(eventType) {
329
- const icons = {
330
- tool_use: '🔧',
331
- message: '💬',
332
- completion: '',
333
- error: '',
334
- status: '📊',
335
- init: '🚀',
336
- thinking: '🤔',
337
- result: '📋'
338
- };
339
- return icons[eventType] || '📌';
340
- }
341
- /**
424
+ */
425
+ getEventIcon(eventType) {
426
+ const icons = {
427
+ tool_use: '🔧',
428
+ message: '💬',
429
+ completion: '',
430
+ error: '',
431
+ status: '📊',
432
+ init: '🚀',
433
+ thinking: '🤔',
434
+ result: '📋',
435
+ };
436
+ return icons[eventType] || '📌';
437
+ }
438
+
439
+ /**
342
440
  * Create task-specific Claude prompt with comprehensive MLE-STAR instructions
343
- */ createTaskPrompt(task, agent1, workflow) {
344
- // Use the claudePrompt from the task if available
345
- if (task.claudePrompt) {
346
- // Apply variable substitutions to the prompt
347
- let basePrompt = task.claudePrompt;
348
- const allVariables = {
349
- ...workflow.variables,
350
- ...task.input
351
- };
352
- for (const [key, value] of Object.entries(allVariables)){
353
- const pattern = new RegExp(`\\$\\{${key}\\}`, 'g');
354
- basePrompt = basePrompt.replace(pattern, value);
355
- }
356
- // Create comprehensive task prompt with MLE-STAR methodology
357
- return `🎯 MLE-STAR AGENT TASK EXECUTION
441
+ */
442
+ createTaskPrompt(task, agent, workflow) {
443
+ // Use the claudePrompt from the task if available
444
+ if (task.claudePrompt) {
445
+ // Apply variable substitutions to the prompt
446
+ let basePrompt = task.claudePrompt;
447
+ const allVariables = { ...workflow.variables, ...task.input };
358
448
 
359
- You are the **${agent1.name}** (${agent1.type}) in a coordinated MLE-STAR automation workflow.
449
+ for (const [key, value] of Object.entries(allVariables)) {
450
+ const pattern = new RegExp(`\\$\\{${key}\\}`, 'g');
451
+ basePrompt = basePrompt.replace(pattern, value);
452
+ }
453
+
454
+ // Create comprehensive task prompt with MLE-STAR methodology
455
+ return `🎯 MLE-STAR AGENT TASK EXECUTION
456
+
457
+ You are the **${agent.name}** (${agent.type}) in a coordinated MLE-STAR automation workflow.
360
458
 
361
459
  📋 IMMEDIATE TASK:
362
460
  ${basePrompt}
363
461
 
364
462
  🤖 AGENT ROLE & SPECIALIZATION:
365
- ${this.getAgentRoleDescription(agent1.type)}
463
+ ${this.getAgentRoleDescription(agent.type)}
366
464
 
367
465
  🎯 AGENT CAPABILITIES:
368
- ${agent1.config?.capabilities?.join(', ') || 'general automation'}
466
+ ${agent.config?.capabilities?.join(', ') || 'general automation'}
369
467
 
370
468
  🔬 MLE-STAR METHODOLOGY FOCUS:
371
- ${this.getMethodologyGuidance(agent1.type)}
469
+ ${this.getMethodologyGuidance(agent.type)}
372
470
 
373
471
  🔧 COORDINATION REQUIREMENTS:
374
472
  1. **HOOKS INTEGRATION** (CRITICAL):
@@ -377,20 +475,20 @@ ${this.getMethodologyGuidance(agent1.type)}
377
475
  - WHEN complete: \`npx claude-flow@alpha hooks post-task --task-id "${task.id}"\`
378
476
 
379
477
  2. **MEMORY STORAGE** (CRITICAL):
380
- - Store findings: \`npx claude-flow@alpha memory store "agent/${agent1.id}/findings" "[your_findings]"\`
381
- - Store results: \`npx claude-flow@alpha memory store "agent/${agent1.id}/results" "[your_results]"\`
478
+ - Store findings: \`npx claude-flow@alpha memory store "agent/${agent.id}/findings" "[your_findings]"\`
479
+ - Store results: \`npx claude-flow@alpha memory store "agent/${agent.id}/results" "[your_results]"\`
382
480
  - Check other agents: \`npx claude-flow@alpha memory search "agent/*"\`
383
481
 
384
482
  3. **SESSION COORDINATION**:
385
483
  - Session ID: ${this.sessionId}
386
484
  - Execution ID: ${this.executionId}
387
485
  - Task ID: ${task.id}
388
- - Agent ID: ${agent1.id}
486
+ - Agent ID: ${agent.id}
389
487
 
390
488
  4. **WORKFLOW PIPELINE AWARENESS**:
391
- - Your position: ${this.getAgentPositionInPipeline(agent1.type)}
392
- - Coordinate with: ${this.getCoordinationPartners(agent1.type)}
393
- - File naming: Use \`${agent1.id}_[component].[ext]\` convention
489
+ - Your position: ${this.getAgentPositionInPipeline(agent.type)}
490
+ - Coordinate with: ${this.getCoordinationPartners(agent.type)}
491
+ - File naming: Use \`${agent.id}_[component].[ext]\` convention
394
492
 
395
493
  5. **OUTPUT REQUIREMENTS**:
396
494
  - Use detailed progress reporting
@@ -414,30 +512,33 @@ ${this.getMethodologyGuidance(agent1.type)}
414
512
  - Ready for next pipeline phase
415
513
 
416
514
  Begin execution now with the hooks pre-task command.`;
417
- } else {
418
- // Fallback to full agent prompt
419
- return this.createAgentPrompt(agent1);
420
- }
515
+ } else {
516
+ // Fallback to full agent prompt
517
+ return this.createAgentPrompt(agent);
421
518
  }
422
- /**
519
+ }
520
+
521
+ /**
423
522
  * Create agent-specific Claude prompt
424
- */ createAgentPrompt(agent1) {
425
- const { config } = agent1;
426
- const capabilities = config?.capabilities?.join(', ') || 'general automation';
427
- return `You are the ${agent1.name} in a coordinated MLE-STAR automation workflow.
523
+ */
524
+ createAgentPrompt(agent) {
525
+ const { config } = agent;
526
+ const capabilities = config?.capabilities?.join(', ') || 'general automation';
527
+
528
+ return `You are the ${agent.name} in a coordinated MLE-STAR automation workflow.
428
529
 
429
- 🎯 AGENT ROLE: ${agent1.type.toUpperCase()}
530
+ 🎯 AGENT ROLE: ${agent.type.toUpperCase()}
430
531
  📋 CAPABILITIES: ${capabilities}
431
- 🆔 AGENT ID: ${agent1.id}
532
+ 🆔 AGENT ID: ${agent.id}
432
533
 
433
534
  CRITICAL COORDINATION REQUIREMENTS:
434
535
  1. HOOKS: Use claude-flow-novice hooks for coordination:
435
536
  - Run "npx claude-flow@alpha hooks pre-task --description '[your task]'" before starting
436
537
  - Run "npx claude-flow@alpha hooks post-edit --file '[file]'" after each file operation
437
- - Run "npx claude-flow@alpha hooks post-task --task-id '${agent1.id}'" when complete
538
+ - Run "npx claude-flow@alpha hooks post-task --task-id '${agent.id}'" when complete
438
539
 
439
540
  2. MEMORY: Store all findings and results:
440
- - Use "npx claude-flow@alpha memory store 'agent/${agent1.id}/[key]' '[value]'" for important data
541
+ - Use "npx claude-flow@alpha memory store 'agent/${agent.id}/[key]' '[value]'" for important data
441
542
  - Check "npx claude-flow@alpha memory search 'agent/*'" for coordination with other agents
442
543
 
443
544
  3. SESSION: Maintain session coordination:
@@ -448,24 +549,27 @@ AGENT-SPECIFIC CONFIGURATION:
448
549
  ${JSON.stringify(config, null, 2)}
449
550
 
450
551
  MLE-STAR METHODOLOGY FOCUS:
451
- ${this.getMethodologyGuidance(agent1.type)}
552
+ ${this.getMethodologyGuidance(agent.type)}
452
553
 
453
554
  WORKFLOW COORDINATION:
454
555
  - Work with other agents in the pipeline: Search → Foundation → Refinement → Ensemble → Validation
455
556
  - Share findings through memory system
456
- - Use proper file naming conventions: ${agent1.id}_[component].[ext]
557
+ - Use proper file naming conventions: ${agent.id}_[component].[ext]
457
558
  - Follow MLE-STAR best practices for your role
458
559
 
459
560
  Execute your role in the MLE-STAR workflow with full coordination and hook integration.`;
460
- }
461
- /**
561
+ }
562
+
563
+ /**
462
564
  * Create master coordination prompt for interactive mode
463
- */ createMasterCoordinationPrompt(agents) {
464
- const workflowData = this.currentWorkflow || {
465
- name: 'MLE-STAR Workflow',
466
- description: 'Machine Learning Engineering via Search and Targeted Refinement'
467
- };
468
- return `🚀 MLE-STAR WORKFLOW COORDINATION MASTER
565
+ */
566
+ createMasterCoordinationPrompt(agents) {
567
+ const workflowData = this.currentWorkflow || {
568
+ name: 'MLE-STAR Workflow',
569
+ description: 'Machine Learning Engineering via Search and Targeted Refinement',
570
+ };
571
+
572
+ return `🚀 MLE-STAR WORKFLOW COORDINATION MASTER
469
573
 
470
574
  You are the MASTER COORDINATOR for a comprehensive MLE-STAR (Machine Learning Engineering via Search and Targeted Refinement) workflow.
471
575
 
@@ -475,11 +579,15 @@ You are the MASTER COORDINATOR for a comprehensive MLE-STAR (Machine Learning En
475
579
  🔄 SESSION ID: ${this.sessionId}
476
580
 
477
581
  🤖 SUB-AGENTS TO COORDINATE (${agents.length} total):
478
- ${agents.map((agent1, index)=>`
479
- ${index + 1}. ${agent1.name} (${agent1.type})
480
- 🎯 Role: ${this.getAgentRoleDescription(agent1.type)}
481
- 📋 Capabilities: ${agent1.config?.capabilities?.join(', ') || 'general automation'}
482
- 🆔 ID: ${agent1.id}`).join('')}
582
+ ${agents
583
+ .map(
584
+ (agent, index) => `
585
+ ${index + 1}. ${agent.name} (${agent.type})
586
+ 🎯 Role: ${this.getAgentRoleDescription(agent.type)}
587
+ 📋 Capabilities: ${agent.config?.capabilities?.join(', ') || 'general automation'}
588
+ 🆔 ID: ${agent.id}`,
589
+ )
590
+ .join('')}
483
591
 
484
592
  🔧 CRITICAL: USE CONCURRENT STREAMS FOR PARALLEL EXECUTION
485
593
 
@@ -530,24 +638,28 @@ METHODOLOGY PHASES:
530
638
  ${this.getMasterMethodologyGuide()}
531
639
 
532
640
  🚀 BEGIN: Start by deploying all sub-agents with detailed prompts using the Task tool for concurrent execution. Each agent should receive comprehensive instructions for their specific MLE-STAR role.`;
533
- }
534
- /**
641
+ }
642
+
643
+ /**
535
644
  * Get agent role description for coordination
536
- */ getAgentRoleDescription(agentType) {
537
- const roles = {
538
- researcher: 'Web Search & Foundation Discovery - Find state-of-the-art approaches',
539
- coder: 'Model Implementation & Training Pipeline - Build foundation models',
540
- optimizer: 'Performance Tuning & Architecture Refinement - Optimize models',
541
- analyst: 'Ensemble Methods & Meta-Learning - Combine multiple approaches',
542
- tester: 'Validation & Debugging - Ensure quality and performance',
543
- coordinator: 'Workflow Orchestration - Manage overall pipeline'
544
- };
545
- return roles[agentType] || 'Specialized automation task execution';
546
- }
547
- /**
645
+ */
646
+ getAgentRoleDescription(agentType) {
647
+ const roles = {
648
+ researcher: 'Web Search & Foundation Discovery - Find state-of-the-art approaches',
649
+ coder: 'Model Implementation & Training Pipeline - Build foundation models',
650
+ optimizer: 'Performance Tuning & Architecture Refinement - Optimize models',
651
+ analyst: 'Ensemble Methods & Meta-Learning - Combine multiple approaches',
652
+ tester: 'Validation & Debugging - Ensure quality and performance',
653
+ coordinator: 'Workflow Orchestration - Manage overall pipeline',
654
+ };
655
+ return roles[agentType] || 'Specialized automation task execution';
656
+ }
657
+
658
+ /**
548
659
  * Get comprehensive methodology guide for master coordinator
549
- */ getMasterMethodologyGuide() {
550
- return `
660
+ */
661
+ getMasterMethodologyGuide() {
662
+ return `
551
663
  PHASE 1 - SEARCH & FOUNDATION (Parallel):
552
664
  🔬 Search Agent: Research ML approaches, algorithms, and best practices
553
665
  💻 Foundation Agent: Implement baseline models and training infrastructure
@@ -564,796 +676,928 @@ COORDINATION KEY POINTS:
564
676
  - Maintain communication through progress updates
565
677
  - Each phase builds on previous phases
566
678
  - Final deliverable: Production-ready ML pipeline`;
567
- }
568
- /**
679
+ }
680
+
681
+ /**
569
682
  * Get agent position in MLE-STAR pipeline
570
- */ getAgentPositionInPipeline(agentType) {
571
- const positions = {
572
- researcher: 'Phase 1: Search & Foundation Discovery (Parallel with Foundation)',
573
- coder: 'Phase 1: Foundation Model Building (Parallel with Search)',
574
- optimizer: 'Phase 2: Refinement & Optimization (Sequential, depends on Phase 1)',
575
- analyst: 'Phase 3: Ensemble & Meta-Learning (Parallel with Validation)',
576
- tester: 'Phase 3: Validation & Debugging (Parallel with Ensemble)',
577
- coordinator: 'All Phases: Workflow Orchestration & Coordination'
578
- };
579
- return positions[agentType] || 'Specialized task execution';
580
- }
581
- /**
683
+ */
684
+ getAgentPositionInPipeline(agentType) {
685
+ const positions = {
686
+ researcher: 'Phase 1: Search & Foundation Discovery (Parallel with Foundation)',
687
+ coder: 'Phase 1: Foundation Model Building (Parallel with Search)',
688
+ optimizer: 'Phase 2: Refinement & Optimization (Sequential, depends on Phase 1)',
689
+ analyst: 'Phase 3: Ensemble & Meta-Learning (Parallel with Validation)',
690
+ tester: 'Phase 3: Validation & Debugging (Parallel with Ensemble)',
691
+ coordinator: 'All Phases: Workflow Orchestration & Coordination',
692
+ };
693
+ return positions[agentType] || 'Specialized task execution';
694
+ }
695
+
696
+ /**
582
697
  * Get coordination partners for agent type
583
- */ getCoordinationPartners(agentType) {
584
- const partners = {
585
- researcher: 'Foundation Agent (parallel), Refinement Agent (handoff)',
586
- coder: 'Search Agent (parallel), Refinement Agent (handoff)',
587
- optimizer: 'Search & Foundation Agents (input), Ensemble & Validation Agents (handoff)',
588
- analyst: 'Refinement Agent (input), Validation Agent (parallel)',
589
- tester: 'All previous agents (validation), Ensemble Agent (parallel)',
590
- coordinator: 'All agents (orchestration and monitoring)'
591
- };
592
- return partners[agentType] || 'Other workflow agents as needed';
593
- }
594
- /**
698
+ */
699
+ getCoordinationPartners(agentType) {
700
+ const partners = {
701
+ researcher: 'Foundation Agent (parallel), Refinement Agent (handoff)',
702
+ coder: 'Search Agent (parallel), Refinement Agent (handoff)',
703
+ optimizer: 'Search & Foundation Agents (input), Ensemble & Validation Agents (handoff)',
704
+ analyst: 'Refinement Agent (input), Validation Agent (parallel)',
705
+ tester: 'All previous agents (validation), Ensemble Agent (parallel)',
706
+ coordinator: 'All agents (orchestration and monitoring)',
707
+ };
708
+ return partners[agentType] || 'Other workflow agents as needed';
709
+ }
710
+
711
+ /**
595
712
  * Get methodology guidance for agent type
596
- */ getMethodologyGuidance(agentType) {
597
- const guidance = {
598
- researcher: `SEARCH PHASE - Web Research & Foundation Discovery:
713
+ */
714
+ getMethodologyGuidance(agentType) {
715
+ const guidance = {
716
+ researcher: `SEARCH PHASE - Web Research & Foundation Discovery:
599
717
  - Search for state-of-the-art ML approaches for the problem domain
600
718
  - Find winning Kaggle solutions and benchmark results
601
719
  - Identify promising model architectures and techniques
602
720
  - Document implementation examples and model cards
603
721
  - Focus on proven, recent approaches with good performance`,
604
- coder: `FOUNDATION PHASE - Initial Model Building:
722
+
723
+ coder: `FOUNDATION PHASE - Initial Model Building:
605
724
  - Analyze dataset characteristics and problem type
606
725
  - Implement baseline models based on research findings
607
726
  - Create robust preprocessing pipelines
608
727
  - Build modular, testable code components
609
728
  - Establish performance baselines for comparison`,
610
- optimizer: `REFINEMENT PHASE - Targeted Component Optimization:
729
+
730
+ optimizer: `REFINEMENT PHASE - Targeted Component Optimization:
611
731
  - Perform ablation analysis to identify high-impact components
612
732
  - Focus deep optimization on most impactful pipeline elements
613
733
  - Use iterative improvement with structured feedback
614
734
  - Implement advanced feature engineering techniques
615
735
  - Optimize hyperparameters systematically`,
616
- architect: `ENSEMBLE PHASE - Intelligent Model Combination:
736
+
737
+ architect: `ENSEMBLE PHASE - Intelligent Model Combination:
617
738
  - Create sophisticated ensemble strategies beyond simple averaging
618
739
  - Implement stacking with meta-learners
619
740
  - Use dynamic weighting and mixture of experts
620
741
  - Apply Bayesian model averaging where appropriate
621
742
  - Optimize ensemble composition for maximum performance`,
622
- tester: `VALIDATION PHASE - Comprehensive Testing & Debugging:
743
+
744
+ tester: `VALIDATION PHASE - Comprehensive Testing & Debugging:
623
745
  - Implement rigorous cross-validation strategies
624
746
  - Detect and prevent data leakage
625
747
  - Perform error analysis and debugging
626
748
  - Validate model robustness and generalization
627
749
  - Ensure production readiness with quality checks`,
628
- coordinator: `ORCHESTRATION PHASE - Workflow Management:
750
+
751
+ coordinator: `ORCHESTRATION PHASE - Workflow Management:
629
752
  - Coordinate between all agents and phases
630
753
  - Monitor progress and performance metrics
631
754
  - Manage resource allocation and scheduling
632
755
  - Handle error recovery and workflow adaptation
633
- - Prepare final deployment and documentation`
634
- };
635
- return guidance[agentType] || 'Focus on your specialized capabilities and coordinate with other agents.';
636
- }
637
- /**
756
+ - Prepare final deployment and documentation`,
757
+ };
758
+
759
+ return (
760
+ guidance[agentType] ||
761
+ 'Focus on your specialized capabilities and coordinate with other agents.'
762
+ );
763
+ }
764
+
765
+ /**
638
766
  * Execute workflow tasks with dependency management
639
- */ async executeWorkflowTasks(workflow) {
640
- const { tasks, dependencies = {} } = workflow;
641
- let completedTasks = 0;
642
- let failedTasks = 0;
643
- const totalTasks = tasks.length;
644
- // Task status tracking
645
- const taskStatuses = new Map();
646
- tasks.forEach((task)=>{
647
- taskStatuses.set(task.id, {
648
- name: task.name || task.id,
649
- status: 'pending',
650
- agent: task.assignTo,
651
- startTime: null,
652
- endTime: null,
653
- summary: ''
654
- });
655
- });
656
- // Create task execution plan based on dependencies
657
- const executionPlan = this.createExecutionPlan(tasks, dependencies);
658
- console.log(`📋 Executing ${totalTasks} tasks in ${executionPlan.length} phases...`);
659
- console.log();
660
- // Note: Concurrent display disabled in favor of interactive-style stream processing
661
- let concurrentDisplay = null;
662
- // if (this.options.nonInteractive && this.options.outputFormat === 'stream-json') {
663
- // const { createConcurrentDisplay } = await import('./concurrent-display.js');
664
- //
665
- // // Get all agents and their tasks
666
- // const agentTasks = workflow.agents?.map(agent => ({
667
- // id: agent.id,
668
- // name: agent.name,
669
- // type: agent.type,
670
- // tasks: tasks.filter(t => t.assignTo === agent.id).map(t => t.name)
671
- // })) || [];
672
- //
673
- // concurrentDisplay = createConcurrentDisplay(agentTasks);
674
- // concurrentDisplay.start();
675
- //
676
- // // Store reference for stream processors
677
- // this.concurrentDisplay = concurrentDisplay;
678
- // }
679
- // Execute tasks phase by phase
680
- for (const [phaseIndex, phaseTasks] of executionPlan.entries()){
681
- this.currentPhase = `Phase ${phaseIndex + 1}`;
682
- // Show regular task board or update concurrent display
683
- if (!concurrentDisplay) {
684
- if (this.options.logLevel === 'quiet') {
685
- console.log(`\n🔄 Phase ${phaseIndex + 1}: Running ${phaseTasks.length} tasks`);
686
- } else {
687
- console.log(`\n🔄 Phase ${phaseIndex + 1}: ${phaseTasks.length} concurrent tasks`);
688
- }
689
- this.displayTaskBoard(taskStatuses, phaseTasks);
690
- }
691
- // Mark tasks as in-progress
692
- phaseTasks.forEach((task)=>{
693
- const status = taskStatuses.get(task.id);
694
- status.status = 'in-progress';
695
- status.startTime = Date.now();
696
- });
697
- // Execute tasks in this phase (potentially in parallel)
698
- const phasePromises = phaseTasks.map(async (task)=>{
699
- const taskStatus = taskStatuses.get(task.id);
700
- try {
701
- // Show task starting
702
- console.log(`\n 🚀 Starting: ${task.name || task.id}`);
703
- console.log(` Agent: ${task.assignTo}`);
704
- console.log(` Description: ${task.description?.substring(0, 80)}...`);
705
- const result = await this.executeTask(task, workflow);
706
- taskStatus.status = result.success ? 'completed' : 'failed';
707
- taskStatus.endTime = Date.now();
708
- taskStatus.summary = result.success ? `✅ Completed in ${this.formatDuration(result.duration)}` : `❌ Failed: ${result.error?.message || 'Unknown error'}`;
709
- return result;
710
- } catch (error) {
711
- taskStatus.status = 'failed';
712
- taskStatus.endTime = Date.now();
713
- taskStatus.summary = `❌ Error: ${error.message}`;
714
- throw error;
715
- }
716
- });
717
- // Wait for all phase tasks to complete
718
- const phaseResults = await Promise.allSettled(phasePromises);
719
- // Process phase results
720
- for (const [taskIndex, result] of phaseResults.entries()){
721
- const task = phaseTasks[taskIndex];
722
- const taskStatus = taskStatuses.get(task.id);
723
- if (result.status === 'fulfilled' && result.value.success) {
724
- completedTasks++;
725
- this.results.set(task.id, result.value);
726
- } else {
727
- failedTasks++;
728
- const error = result.status === 'rejected' ? result.reason : result.value.error;
729
- this.errors.push({
730
- type: 'task_execution',
731
- task: task.id,
732
- error: error.message || error,
733
- timestamp: new Date()
734
- });
735
- // Check if we should fail fast
736
- if (workflow.settings?.failurePolicy === 'fail-fast') {
737
- console.log(`\n🛑 Failing fast due to task failure`);
738
- break;
739
- }
740
- }
741
- }
742
- // Show updated task board
743
- if (!concurrentDisplay) {
744
- console.log(`\n📊 Phase ${phaseIndex + 1} Complete:`);
745
- this.displayTaskBoard(taskStatuses);
746
- }
747
- // Stop if fail-fast and we have failures
748
- if (workflow.settings?.failurePolicy === 'fail-fast' && failedTasks > 0) {
749
- break;
750
- }
767
+ */
768
+ async executeWorkflowTasks(workflow) {
769
+ const { tasks, dependencies = {} } = workflow;
770
+
771
+ let completedTasks = 0;
772
+ let failedTasks = 0;
773
+ const totalTasks = tasks.length;
774
+
775
+ // Task status tracking
776
+ const taskStatuses = new Map();
777
+ tasks.forEach((task) => {
778
+ taskStatuses.set(task.id, {
779
+ name: task.name || task.id,
780
+ status: 'pending',
781
+ agent: task.assignTo,
782
+ startTime: null,
783
+ endTime: null,
784
+ summary: '',
785
+ });
786
+ });
787
+
788
+ // Create task execution plan based on dependencies
789
+ const executionPlan = this.createExecutionPlan(tasks, dependencies);
790
+
791
+ console.log(`📋 Executing ${totalTasks} tasks in ${executionPlan.length} phases...`);
792
+ console.log();
793
+
794
+ // Note: Concurrent display disabled in favor of interactive-style stream processing
795
+ let concurrentDisplay = null;
796
+ // if (this.options.nonInteractive && this.options.outputFormat === 'stream-json') {
797
+ // const { createConcurrentDisplay } = await import('./concurrent-display.js');
798
+ //
799
+ // // Get all agents and their tasks
800
+ // const agentTasks = workflow.agents?.map(agent => ({
801
+ // id: agent.id,
802
+ // name: agent.name,
803
+ // type: agent.type,
804
+ // tasks: tasks.filter(t => t.assignTo === agent.id).map(t => t.name)
805
+ // })) || [];
806
+ //
807
+ // concurrentDisplay = createConcurrentDisplay(agentTasks);
808
+ // concurrentDisplay.start();
809
+ //
810
+ // // Store reference for stream processors
811
+ // this.concurrentDisplay = concurrentDisplay;
812
+ // }
813
+
814
+ // Execute tasks phase by phase
815
+ for (const [phaseIndex, phaseTasks] of executionPlan.entries()) {
816
+ this.currentPhase = `Phase ${phaseIndex + 1}`;
817
+
818
+ // Show regular task board or update concurrent display
819
+ if (!concurrentDisplay) {
820
+ if (this.options.logLevel === 'quiet') {
821
+ console.log(`\n🔄 Phase ${phaseIndex + 1}: Running ${phaseTasks.length} tasks`);
822
+ } else {
823
+ console.log(`\n🔄 Phase ${phaseIndex + 1}: ${phaseTasks.length} concurrent tasks`);
824
+ }
825
+ this.displayTaskBoard(taskStatuses, phaseTasks);
826
+ }
827
+
828
+ // Mark tasks as in-progress
829
+ phaseTasks.forEach((task) => {
830
+ const status = taskStatuses.get(task.id);
831
+ status.status = 'in-progress';
832
+ status.startTime = Date.now();
833
+ });
834
+
835
+ // Execute tasks in this phase (potentially in parallel)
836
+ const phasePromises = phaseTasks.map(async (task) => {
837
+ const taskStatus = taskStatuses.get(task.id);
838
+
839
+ try {
840
+ // Show task starting
841
+ console.log(`\n 🚀 Starting: ${task.name || task.id}`);
842
+ console.log(` Agent: ${task.assignTo}`);
843
+ console.log(` Description: ${task.description?.substring(0, 80)}...`);
844
+
845
+ const result = await this.executeTask(task, workflow);
846
+
847
+ taskStatus.status = result.success ? 'completed' : 'failed';
848
+ taskStatus.endTime = Date.now();
849
+ taskStatus.summary = result.success
850
+ ? `✅ Completed in ${this.formatDuration(result.duration)}`
851
+ : `❌ Failed: ${result.error?.message || 'Unknown error'}`;
852
+
853
+ return result;
854
+ } catch (error) {
855
+ taskStatus.status = 'failed';
856
+ taskStatus.endTime = Date.now();
857
+ taskStatus.summary = `❌ Error: ${error.message}`;
858
+ throw error;
751
859
  }
752
- // Final summary
753
- if (!concurrentDisplay) {
754
- console.log(`\n📊 Final Workflow Summary:`);
755
- this.displayTaskBoard(taskStatuses);
860
+ });
861
+
862
+ // Wait for all phase tasks to complete
863
+ const phaseResults = await Promise.allSettled(phasePromises);
864
+
865
+ // Process phase results
866
+ for (const [taskIndex, result] of phaseResults.entries()) {
867
+ const task = phaseTasks[taskIndex];
868
+ const taskStatus = taskStatuses.get(task.id);
869
+
870
+ if (result.status === 'fulfilled' && result.value.success) {
871
+ completedTasks++;
872
+ this.results.set(task.id, result.value);
756
873
  } else {
757
- // Stop concurrent display
758
- concurrentDisplay.stop();
759
- console.log(); // Add some space after display
874
+ failedTasks++;
875
+ const error = result.status === 'rejected' ? result.reason : result.value.error;
876
+ this.errors.push({
877
+ type: 'task_execution',
878
+ task: task.id,
879
+ error: error.message || error,
880
+ timestamp: new Date(),
881
+ });
882
+
883
+ // Check if we should fail fast
884
+ if (workflow.settings?.failurePolicy === 'fail-fast') {
885
+ console.log(`\n🛑 Failing fast due to task failure`);
886
+ break;
887
+ }
760
888
  }
761
- return {
762
- success: failedTasks === 0,
763
- totalTasks,
764
- completedTasks,
765
- failedTasks,
766
- executionId: this.executionId,
767
- duration: Date.now() - this.startTime,
768
- results: Object.fromEntries(this.results),
769
- errors: this.errors
770
- };
889
+ }
890
+
891
+ // Show updated task board
892
+ if (!concurrentDisplay) {
893
+ console.log(`\n📊 Phase ${phaseIndex + 1} Complete:`);
894
+ this.displayTaskBoard(taskStatuses);
895
+ }
896
+
897
+ // Stop if fail-fast and we have failures
898
+ if (workflow.settings?.failurePolicy === 'fail-fast' && failedTasks > 0) {
899
+ break;
900
+ }
771
901
  }
772
- /**
902
+
903
+ // Final summary
904
+ if (!concurrentDisplay) {
905
+ console.log(`\n📊 Final Workflow Summary:`);
906
+ this.displayTaskBoard(taskStatuses);
907
+ } else {
908
+ // Stop concurrent display
909
+ concurrentDisplay.stop();
910
+ console.log(); // Add some space after display
911
+ }
912
+
913
+ return {
914
+ success: failedTasks === 0,
915
+ totalTasks,
916
+ completedTasks,
917
+ failedTasks,
918
+ executionId: this.executionId,
919
+ duration: Date.now() - this.startTime,
920
+ results: Object.fromEntries(this.results),
921
+ errors: this.errors,
922
+ };
923
+ }
924
+
925
+ /**
773
926
  * Display task board showing current status
774
- */ displayTaskBoard(taskStatuses, highlightTasks = []) {
775
- // In quiet mode, just show simple progress
776
- if (this.options.logLevel === 'quiet') {
777
- const totalTasks = taskStatuses.size;
778
- const completedTasks = Array.from(taskStatuses.values()).filter((s)=>s.status === 'completed').length;
779
- const activeTasks = Array.from(taskStatuses.values()).filter((s)=>s.status === 'in-progress').length;
780
- console.log(`📊 Progress: ${completedTasks}/${totalTasks} completed, ${activeTasks} active`);
781
- return;
782
- }
783
- const frames = [
784
- '⠋',
785
- '⠙',
786
- '⠹',
787
- '⠸',
788
- '⠼',
789
- '⠴',
790
- '⠦',
791
- '⠧',
792
- '⠇',
793
- ''
794
- ];
795
- const frameIndex = Math.floor(Date.now() / 100) % frames.length;
796
- const spinner = frames[frameIndex];
797
- console.log('\n╔═══════════════════════════════════════════════════════════════╗');
798
- console.log('║ 🤖 CONCURRENT TASK STATUS ║');
799
- console.log('╠═══════════════════════════════════════════════════════════════╣');
800
- // Group by status
801
- const statusGroups = {
802
- 'in-progress': [],
803
- completed: [],
804
- failed: [],
805
- pending: []
927
+ */
928
+ displayTaskBoard(taskStatuses, highlightTasks = []) {
929
+ // In quiet mode, just show simple progress
930
+ if (this.options.logLevel === 'quiet') {
931
+ const totalTasks = taskStatuses.size;
932
+ const completedTasks = Array.from(taskStatuses.values()).filter(
933
+ (s) => s.status === 'completed',
934
+ ).length;
935
+ const activeTasks = Array.from(taskStatuses.values()).filter(
936
+ (s) => s.status === 'in-progress',
937
+ ).length;
938
+ console.log(`📊 Progress: ${completedTasks}/${totalTasks} completed, ${activeTasks} active`);
939
+ return;
940
+ }
941
+
942
+ const frames = ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏'];
943
+ const frameIndex = Math.floor(Date.now() / 100) % frames.length;
944
+ const spinner = frames[frameIndex];
945
+
946
+ console.log('\n╔═══════════════════════════════════════════════════════════════╗');
947
+ console.log('║ 🤖 CONCURRENT TASK STATUS ║');
948
+ console.log('╠═══════════════════════════════════════════════════════════════╣');
949
+
950
+ // Group by status
951
+ const statusGroups = {
952
+ 'in-progress': [],
953
+ completed: [],
954
+ failed: [],
955
+ pending: [],
956
+ };
957
+
958
+ taskStatuses.forEach((status, taskId) => {
959
+ statusGroups[status.status].push({ taskId, ...status });
960
+ });
961
+
962
+ // Show in-progress tasks with animation
963
+ if (statusGroups['in-progress'].length > 0) {
964
+ console.log(
965
+ `║ ${spinner} RUNNING (${statusGroups['in-progress'].length} agents): ║`,
966
+ );
967
+ statusGroups['in-progress'].forEach((task) => {
968
+ const duration = task.startTime ? this.formatDuration(Date.now() - task.startTime) : '';
969
+ const progress = this.getProgressBar(Date.now() - task.startTime, 60000); // 1 min expected
970
+ const agentIcon = this.getAgentIcon(task.agent);
971
+ console.log(
972
+ `║ ${agentIcon} ${task.name.padEnd(25)} ${progress} ${duration.padStart(8)} ║`,
973
+ );
974
+ });
975
+ }
976
+
977
+ // Show completed tasks
978
+ if (statusGroups['completed'].length > 0) {
979
+ console.log(
980
+ `║ ✅ COMPLETED (${statusGroups['completed'].length}): ║`,
981
+ );
982
+ statusGroups['completed'].forEach((task) => {
983
+ const duration =
984
+ task.endTime && task.startTime ? this.formatDuration(task.endTime - task.startTime) : '';
985
+ console.log(`║ ✓ ${task.name.padEnd(35)} ${duration.padStart(10)} ║`);
986
+ });
987
+ }
988
+
989
+ // Show failed tasks
990
+ if (statusGroups['failed'].length > 0) {
991
+ console.log(
992
+ `║ ❌ FAILED (${statusGroups['failed'].length}): ║`,
993
+ );
994
+ statusGroups['failed'].forEach((task) => {
995
+ const errorMsg = (task.summary || '').substring(0, 25);
996
+ console.log(`║ ✗ ${task.name.padEnd(25)} ${errorMsg.padEnd(20)} ║`);
997
+ });
998
+ }
999
+
1000
+ // Show pending tasks count
1001
+ if (statusGroups['pending'].length > 0) {
1002
+ console.log(
1003
+ `║ ⏳ QUEUED: ${statusGroups['pending'].length} tasks waiting ║`,
1004
+ );
1005
+ }
1006
+
1007
+ // Summary stats
1008
+ const total = taskStatuses.size;
1009
+ const completed = statusGroups['completed'].length;
1010
+ const failed = statusGroups['failed'].length;
1011
+ const progress = total > 0 ? Math.floor(((completed + failed) / total) * 100) : 0;
1012
+
1013
+ console.log('╠═══════════════════════════════════════════════════════════════╣');
1014
+ console.log(
1015
+ `║ 📊 Progress: ${progress}% (${completed}/${total}) │ ⚡ Active: ${statusGroups['in-progress'].length} │ ❌ Failed: ${failed} ║`,
1016
+ );
1017
+ console.log('╚═══════════════════════════════════════════════════════════════╝');
1018
+ }
1019
+
1020
+ /**
1021
+ * Get progress bar visualization
1022
+ */
1023
+ getProgressBar(elapsed, expected) {
1024
+ const progress = Math.min(elapsed / expected, 1);
1025
+ const filled = Math.floor(progress * 10);
1026
+ const empty = 10 - filled;
1027
+ return '[' + '█'.repeat(filled) + '░'.repeat(empty) + ']';
1028
+ }
1029
+
1030
+ /**
1031
+ * Get agent icon based on type
1032
+ */
1033
+ getAgentIcon(agentId) {
1034
+ const icons = {
1035
+ search: '🔍',
1036
+ foundation: '🏗️',
1037
+ refinement: '🔧',
1038
+ ensemble: '🎯',
1039
+ validation: '✅',
1040
+ coordinator: '🎮',
1041
+ researcher: '🔬',
1042
+ coder: '💻',
1043
+ optimizer: '⚡',
1044
+ architect: '🏛️',
1045
+ tester: '🧪',
1046
+ };
1047
+
1048
+ // Extract agent type from ID
1049
+ const type = agentId?.split('_')[0] || 'default';
1050
+ return icons[type] || '🤖';
1051
+ }
1052
+
1053
+ /**
1054
+ * Execute a single task
1055
+ */
1056
+ async executeTask(task, workflow) {
1057
+ const startTime = Date.now();
1058
+
1059
+ try {
1060
+ // Store task execution in memory if hooks enabled
1061
+ if (this.hooksEnabled) {
1062
+ await this.executeHook('notify', {
1063
+ message: `Starting task: ${task.name || task.id}`,
1064
+ sessionId: this.sessionId,
1065
+ });
1066
+ }
1067
+
1068
+ if (this.options.nonInteractive && this.options.outputFormat === 'stream-json') {
1069
+ console.log(`\n● ${task.name || task.id} - Starting Execution`);
1070
+ console.log(` ⎿ ${task.description}`);
1071
+ console.log(` ⎿ Agent: ${task.assignTo}`);
1072
+ } else {
1073
+ console.log(` 🔄 Executing: ${task.description}`);
1074
+ }
1075
+
1076
+ // For demonstration/testing mode (when Claude integration is disabled)
1077
+ // we simulate successful task completion
1078
+ if (!this.options.enableClaude) {
1079
+ // Simulate variable execution time
1080
+ const executionTime = Math.min(
1081
+ 1000 + Math.random() * 3000, // 1-4 seconds simulation
1082
+ task.timeout || 30000,
1083
+ );
1084
+
1085
+ await new Promise((resolve) => setTimeout(resolve, executionTime));
1086
+
1087
+ // Simulate successful completion for demo/testing
1088
+ const result = {
1089
+ success: true,
1090
+ taskId: task.id,
1091
+ duration: Date.now() - startTime,
1092
+ output: {
1093
+ status: 'completed',
1094
+ agent: task.assignTo,
1095
+ executionTime: Date.now() - startTime,
1096
+ metadata: {
1097
+ timestamp: new Date().toISOString(),
1098
+ executionId: this.executionId,
1099
+ mode: 'simulation',
1100
+ },
1101
+ },
806
1102
  };
807
- taskStatuses.forEach((status, taskId)=>{
808
- statusGroups[status.status].push({
809
- taskId,
810
- ...status
1103
+
1104
+ // Store result in memory
1105
+ if (this.hooksEnabled) {
1106
+ await this.storeTaskResult(task.id, result.output);
1107
+ }
1108
+
1109
+ return result;
1110
+ } else {
1111
+ // When Claude integration is enabled, delegate to actual Claude instance
1112
+
1113
+ // Check if we have a master coordinator (interactive mode)
1114
+ const masterCoordinator = this.claudeInstances.get('master-coordinator');
1115
+ if (masterCoordinator && !this.options.nonInteractive) {
1116
+ // Interactive mode: All tasks are coordinated by the master coordinator
1117
+ console.log(` 🎯 Task delegated to Master Coordinator: ${task.description}`);
1118
+
1119
+ // In interactive mode, the master coordinator handles all tasks
1120
+ // We just wait for the master coordinator process to complete
1121
+ const completionPromise = new Promise((resolve, reject) => {
1122
+ masterCoordinator.process.on('exit', (code) => {
1123
+ if (code === 0) {
1124
+ resolve({ success: true, code });
1125
+ } else {
1126
+ reject(new Error(`Master coordinator exited with code ${code}`));
1127
+ }
811
1128
  });
812
- });
813
- // Show in-progress tasks with animation
814
- if (statusGroups['in-progress'].length > 0) {
815
- console.log(`║ ${spinner} RUNNING (${statusGroups['in-progress'].length} agents): ║`);
816
- statusGroups['in-progress'].forEach((task)=>{
817
- const duration = task.startTime ? this.formatDuration(Date.now() - task.startTime) : '';
818
- const progress = this.getProgressBar(Date.now() - task.startTime, 60000); // 1 min expected
819
- const agentIcon = this.getAgentIcon(task.agent);
820
- console.log(`║ ${agentIcon} ${task.name.padEnd(25)} ${progress} ${duration.padStart(8)} ║`);
1129
+
1130
+ masterCoordinator.process.on('error', (err) => {
1131
+ reject(err);
821
1132
  });
1133
+ });
1134
+
1135
+ // For interactive mode, we use a longer timeout since user interaction is involved
1136
+ const timeout = Math.max(this.options.timeout, 1800000); // 30 minutes minimum for interactive
1137
+ const timeoutPromise = new Promise((_, reject) => {
1138
+ setTimeout(() => reject(new Error('Interactive session timeout')), timeout);
1139
+ });
1140
+
1141
+ try {
1142
+ await Promise.race([completionPromise, timeoutPromise]);
1143
+
1144
+ const result = {
1145
+ success: true,
1146
+ taskId: task.id,
1147
+ duration: Date.now() - startTime,
1148
+ output: {
1149
+ status: 'completed',
1150
+ agent: 'master-coordinator',
1151
+ executionTime: Date.now() - startTime,
1152
+ metadata: {
1153
+ timestamp: new Date().toISOString(),
1154
+ executionId: this.executionId,
1155
+ mode: 'interactive-coordination',
1156
+ },
1157
+ },
1158
+ };
1159
+
1160
+ // Store result in memory
1161
+ if (this.hooksEnabled) {
1162
+ await this.storeTaskResult(task.id, result.output);
1163
+ }
1164
+
1165
+ return result;
1166
+ } catch (error) {
1167
+ throw new Error(`Task execution failed: ${error.message}`);
1168
+ }
822
1169
  }
823
- // Show completed tasks
824
- if (statusGroups['completed'].length > 0) {
825
- console.log(`║ COMPLETED (${statusGroups['completed'].length}): ║`);
826
- statusGroups['completed'].forEach((task)=>{
827
- const duration = task.endTime && task.startTime ? this.formatDuration(task.endTime - task.startTime) : '';
828
- console.log(`║ ✓ ${task.name.padEnd(35)} ${duration.padStart(10)} ║`);
1170
+
1171
+ // Non-interactive mode or no master coordinator: use individual Claude instances
1172
+ const claudeInstance = this.claudeInstances.get(task.assignTo);
1173
+ if (!claudeInstance) {
1174
+ // If no pre-spawned instance, create one for this task
1175
+ const agent = workflow.agents.find((a) => a.id === task.assignTo);
1176
+ if (!agent) {
1177
+ throw new Error(`No agent definition found for: ${task.assignTo}`);
1178
+ }
1179
+
1180
+ // Create task-specific prompt
1181
+ const taskPrompt = this.createTaskPrompt(task, agent, workflow);
1182
+
1183
+ // Check if we should chain from a previous task
1184
+ let chainOptions = {};
1185
+ if (
1186
+ this.enableChaining &&
1187
+ this.options.outputFormat === 'stream-json' &&
1188
+ task.depends?.length > 0
1189
+ ) {
1190
+ // Get the output stream from the last dependency
1191
+ const lastDependency = task.depends[task.depends.length - 1];
1192
+ const dependencyStream = this.taskOutputStreams.get(lastDependency);
1193
+ if (dependencyStream) {
1194
+ console.log(` 🔗 Enabling stream chaining from ${lastDependency} to ${task.id}`);
1195
+ chainOptions.inputStream = dependencyStream;
1196
+ }
1197
+ }
1198
+
1199
+ // Spawn Claude instance for this specific task
1200
+ const taskClaudeProcess = await this.spawnClaudeInstance(agent, taskPrompt, chainOptions);
1201
+
1202
+ // Store the output stream for potential chaining
1203
+ if (
1204
+ this.enableChaining &&
1205
+ this.options.outputFormat === 'stream-json' &&
1206
+ taskClaudeProcess.stdout
1207
+ ) {
1208
+ this.taskOutputStreams.set(task.id, taskClaudeProcess.stdout);
1209
+ }
1210
+
1211
+ // Store the instance
1212
+ this.claudeInstances.set(agent.id, {
1213
+ process: taskClaudeProcess,
1214
+ agent: agent,
1215
+ status: 'active',
1216
+ startTime: Date.now(),
1217
+ taskId: task.id,
1218
+ });
1219
+
1220
+ // Wait for task completion or timeout
1221
+ // Use longer timeout for ML tasks
1222
+ const baseTimeout = this.options.timeout || 60000;
1223
+ const isMLTask =
1224
+ task.type?.toLowerCase().includes('ml') ||
1225
+ task.type?.toLowerCase().includes('model') ||
1226
+ task.type?.toLowerCase().includes('search') ||
1227
+ task.type?.toLowerCase().includes('analysis') ||
1228
+ this.options.workflowType === 'ml';
1229
+ const timeout = task.timeout || (isMLTask ? Math.max(baseTimeout, 300000) : baseTimeout); // Min 5 minutes for ML tasks
1230
+
1231
+ if (this.options.logLevel === 'debug' || this.options.verbose) {
1232
+ console.log(
1233
+ ` ⏱️ Timeout: ${this.formatDuration(timeout)} (Base: ${this.formatDuration(baseTimeout)}, ML Task: ${isMLTask})`,
1234
+ );
1235
+ }
1236
+
1237
+ const completionPromise = new Promise((resolve, reject) => {
1238
+ taskClaudeProcess.on('exit', (code) => {
1239
+ if (code === 0) {
1240
+ resolve({ success: true, code });
1241
+ } else {
1242
+ reject(new Error(`Process exited with code ${code}`));
1243
+ }
829
1244
  });
830
- }
831
- // Show failed tasks
832
- if (statusGroups['failed'].length > 0) {
833
- console.log(`║ ❌ FAILED (${statusGroups['failed'].length}): ║`);
834
- statusGroups['failed'].forEach((task)=>{
835
- const errorMsg = (task.summary || '').substring(0, 25);
836
- console.log(`║ ✗ ${task.name.padEnd(25)} ${errorMsg.padEnd(20)} ║`);
1245
+
1246
+ taskClaudeProcess.on('error', (err) => {
1247
+ reject(err);
837
1248
  });
838
- }
839
- // Show pending tasks count
840
- if (statusGroups['pending'].length > 0) {
841
- console.log(`║ QUEUED: ${statusGroups['pending'].length} tasks waiting ║`);
842
- }
843
- // Summary stats
844
- const total = taskStatuses.size;
845
- const completed = statusGroups['completed'].length;
846
- const failed = statusGroups['failed'].length;
847
- const progress = total > 0 ? Math.floor((completed + failed) / total * 100) : 0;
848
- console.log('╠═══════════════════════════════════════════════════════════════╣');
849
- console.log(`║ 📊 Progress: ${progress}% (${completed}/${total}) │ ⚡ Active: ${statusGroups['in-progress'].length} │ ❌ Failed: ${failed} ║`);
850
- console.log('╚═══════════════════════════════════════════════════════════════╝');
851
- }
852
- /**
853
- * Get progress bar visualization
854
- */ getProgressBar(elapsed, expected) {
855
- const progress = Math.min(elapsed / expected, 1);
856
- const filled = Math.floor(progress * 10);
857
- const empty = 10 - filled;
858
- return '[' + '█'.repeat(filled) + '░'.repeat(empty) + ']';
859
- }
860
- /**
861
- * Get agent icon based on type
862
- */ getAgentIcon(agentId) {
863
- const icons = {
864
- search: '🔍',
865
- foundation: '🏗️',
866
- refinement: '🔧',
867
- ensemble: '🎯',
868
- validation: '✅',
869
- coordinator: '🎮',
870
- researcher: '🔬',
871
- coder: '💻',
872
- optimizer: '⚡',
873
- architect: '🏛️',
874
- tester: '🧪'
875
- };
876
- // Extract agent type from ID
877
- const type = agentId?.split('_')[0] || 'default';
878
- return icons[type] || '🤖';
879
- }
880
- /**
881
- * Execute a single task
882
- */ async executeTask(task, workflow) {
883
- const startTime = Date.now();
884
- try {
885
- // Store task execution in memory if hooks enabled
1249
+ });
1250
+
1251
+ const timeoutPromise = new Promise((_, reject) => {
1252
+ // Use a much longer timeout for ML tasks since Claude is actively working
1253
+ const actualTimeout = isMLTask ? Math.max(timeout, 600000) : timeout; // 10 min minimum for ML
1254
+ setTimeout(() => reject(new Error('Task timeout')), actualTimeout);
1255
+ });
1256
+
1257
+ try {
1258
+ await Promise.race([completionPromise, timeoutPromise]);
1259
+
1260
+ const result = {
1261
+ success: true,
1262
+ taskId: task.id,
1263
+ duration: Date.now() - startTime,
1264
+ output: {
1265
+ status: 'completed',
1266
+ agent: task.assignTo,
1267
+ executionTime: Date.now() - startTime,
1268
+ metadata: {
1269
+ timestamp: new Date().toISOString(),
1270
+ executionId: this.executionId,
1271
+ mode: 'claude-task-execution',
1272
+ },
1273
+ },
1274
+ };
1275
+
1276
+ // Store result in memory
886
1277
  if (this.hooksEnabled) {
887
- await this.executeHook('notify', {
888
- message: `Starting task: ${task.name || task.id}`,
889
- sessionId: this.sessionId
890
- });
891
- }
892
- if (this.options.nonInteractive && this.options.outputFormat === 'stream-json') {
893
- console.log(`\n● ${task.name || task.id} - Starting Execution`);
894
- console.log(` ⎿ ${task.description}`);
895
- console.log(` ⎿ Agent: ${task.assignTo}`);
896
- } else {
897
- console.log(` 🔄 Executing: ${task.description}`);
1278
+ await this.storeTaskResult(task.id, result.output);
898
1279
  }
899
- // For demonstration/testing mode (when Claude integration is disabled)
900
- // we simulate successful task completion
901
- if (!this.options.enableClaude) {
902
- // Simulate variable execution time
903
- const executionTime = Math.min(1000 + Math.random() * 3000, task.timeout || 30000);
904
- await new Promise((resolve)=>setTimeout(resolve, executionTime));
905
- // Simulate successful completion for demo/testing
906
- const result = {
907
- success: true,
908
- taskId: task.id,
909
- duration: Date.now() - startTime,
910
- output: {
911
- status: 'completed',
912
- agent: task.assignTo,
913
- executionTime: Date.now() - startTime,
914
- metadata: {
915
- timestamp: new Date().toISOString(),
916
- executionId: this.executionId,
917
- mode: 'simulation'
918
- }
919
- }
920
- };
921
- // Store result in memory
922
- if (this.hooksEnabled) {
923
- await this.storeTaskResult(task.id, result.output);
924
- }
925
- return result;
926
- } else {
927
- // When Claude integration is enabled, delegate to actual Claude instance
928
- // Check if we have a master coordinator (interactive mode)
929
- const masterCoordinator = this.claudeInstances.get('master-coordinator');
930
- if (masterCoordinator && !this.options.nonInteractive) {
931
- // Interactive mode: All tasks are coordinated by the master coordinator
932
- console.log(` 🎯 Task delegated to Master Coordinator: ${task.description}`);
933
- // In interactive mode, the master coordinator handles all tasks
934
- // We just wait for the master coordinator process to complete
935
- const completionPromise = new Promise((resolve, reject)=>{
936
- masterCoordinator.process.on('exit', (code)=>{
937
- if (code === 0) {
938
- resolve({
939
- success: true,
940
- code
941
- });
942
- } else {
943
- reject(new Error(`Master coordinator exited with code ${code}`));
944
- }
945
- });
946
- masterCoordinator.process.on('error', (err)=>{
947
- reject(err);
948
- });
949
- });
950
- // For interactive mode, we use a longer timeout since user interaction is involved
951
- const timeout = Math.max(this.options.timeout, 1800000); // 30 minutes minimum for interactive
952
- const timeoutPromise = new Promise((_, reject)=>{
953
- setTimeout(()=>reject(new Error('Interactive session timeout')), timeout);
954
- });
955
- try {
956
- await Promise.race([
957
- completionPromise,
958
- timeoutPromise
959
- ]);
960
- const result = {
961
- success: true,
962
- taskId: task.id,
963
- duration: Date.now() - startTime,
964
- output: {
965
- status: 'completed',
966
- agent: 'master-coordinator',
967
- executionTime: Date.now() - startTime,
968
- metadata: {
969
- timestamp: new Date().toISOString(),
970
- executionId: this.executionId,
971
- mode: 'interactive-coordination'
972
- }
973
- }
974
- };
975
- // Store result in memory
976
- if (this.hooksEnabled) {
977
- await this.storeTaskResult(task.id, result.output);
978
- }
979
- return result;
980
- } catch (error) {
981
- throw new Error(`Task execution failed: ${error.message}`);
982
- }
983
- }
984
- // Non-interactive mode or no master coordinator: use individual Claude instances
985
- const claudeInstance = this.claudeInstances.get(task.assignTo);
986
- if (!claudeInstance) {
987
- // If no pre-spawned instance, create one for this task
988
- const agent1 = workflow.agents.find((a)=>a.id === task.assignTo);
989
- if (!agent1) {
990
- throw new Error(`No agent definition found for: ${task.assignTo}`);
991
- }
992
- // Create task-specific prompt
993
- const taskPrompt = this.createTaskPrompt(task, agent1, workflow);
994
- // Check if we should chain from a previous task
995
- let chainOptions = {};
996
- if (this.enableChaining && this.options.outputFormat === 'stream-json' && task.depends?.length > 0) {
997
- // Get the output stream from the last dependency
998
- const lastDependency = task.depends[task.depends.length - 1];
999
- const dependencyStream = this.taskOutputStreams.get(lastDependency);
1000
- if (dependencyStream) {
1001
- console.log(` 🔗 Enabling stream chaining from ${lastDependency} to ${task.id}`);
1002
- chainOptions.inputStream = dependencyStream;
1003
- }
1004
- }
1005
- // Spawn Claude instance for this specific task
1006
- const taskClaudeProcess = await this.spawnClaudeInstance(agent1, taskPrompt, chainOptions);
1007
- // Store the output stream for potential chaining
1008
- if (this.enableChaining && this.options.outputFormat === 'stream-json' && taskClaudeProcess.stdout) {
1009
- this.taskOutputStreams.set(task.id, taskClaudeProcess.stdout);
1010
- }
1011
- // Store the instance
1012
- this.claudeInstances.set(agent1.id, {
1013
- process: taskClaudeProcess,
1014
- agent: agent1,
1015
- status: 'active',
1016
- startTime: Date.now(),
1017
- taskId: task.id
1018
- });
1019
- // Wait for task completion or timeout
1020
- // Use longer timeout for ML tasks
1021
- const baseTimeout = this.options.timeout || 60000;
1022
- const isMLTask = task.type?.toLowerCase().includes('ml') || task.type?.toLowerCase().includes('model') || task.type?.toLowerCase().includes('search') || task.type?.toLowerCase().includes('analysis') || this.options.workflowType === 'ml';
1023
- const timeout = task.timeout || (isMLTask ? Math.max(baseTimeout, 300000) : baseTimeout); // Min 5 minutes for ML tasks
1024
- if (this.options.logLevel === 'debug' || this.options.verbose) {
1025
- console.log(` ⏱️ Timeout: ${this.formatDuration(timeout)} (Base: ${this.formatDuration(baseTimeout)}, ML Task: ${isMLTask})`);
1026
- }
1027
- const completionPromise = new Promise((resolve, reject)=>{
1028
- taskClaudeProcess.on('exit', (code)=>{
1029
- if (code === 0) {
1030
- resolve({
1031
- success: true,
1032
- code
1033
- });
1034
- } else {
1035
- reject(new Error(`Process exited with code ${code}`));
1036
- }
1037
- });
1038
- taskClaudeProcess.on('error', (err)=>{
1039
- reject(err);
1040
- });
1041
- });
1042
- const timeoutPromise = new Promise((_, reject)=>{
1043
- // Use a much longer timeout for ML tasks since Claude is actively working
1044
- const actualTimeout = isMLTask ? Math.max(timeout, 600000) : timeout; // 10 min minimum for ML
1045
- setTimeout(()=>reject(new Error('Task timeout')), actualTimeout);
1046
- });
1047
- try {
1048
- await Promise.race([
1049
- completionPromise,
1050
- timeoutPromise
1051
- ]);
1052
- const result = {
1053
- success: true,
1054
- taskId: task.id,
1055
- duration: Date.now() - startTime,
1056
- output: {
1057
- status: 'completed',
1058
- agent: task.assignTo,
1059
- executionTime: Date.now() - startTime,
1060
- metadata: {
1061
- timestamp: new Date().toISOString(),
1062
- executionId: this.executionId,
1063
- mode: 'claude-task-execution'
1064
- }
1065
- }
1066
- };
1067
- // Store result in memory
1068
- if (this.hooksEnabled) {
1069
- await this.storeTaskResult(task.id, result.output);
1070
- }
1071
- return result;
1072
- } catch (error) {
1073
- throw error;
1074
- }
1075
- } else {
1076
- // Use existing Claude instance
1077
- // In a full implementation, this would send the task to the running instance
1078
- // For now, we'll spawn a new instance per task for simplicity
1079
- const agent1 = claudeInstance.agent;
1080
- const taskPrompt = this.createTaskPrompt(task, agent1, workflow);
1081
- // Check if we should chain from a previous task
1082
- let chainOptions = {};
1083
- if (this.enableChaining && this.options.outputFormat === 'stream-json' && task.depends?.length > 0) {
1084
- // Get the output stream from the last dependency
1085
- const lastDependency = task.depends[task.depends.length - 1];
1086
- const dependencyStream = this.taskOutputStreams.get(lastDependency);
1087
- if (dependencyStream) {
1088
- console.log(` 🔗 Enabling stream chaining from ${lastDependency} to ${task.id}`);
1089
- chainOptions.inputStream = dependencyStream;
1090
- }
1091
- }
1092
- // For now, spawn a new instance for each task
1093
- const taskClaudeProcess = await this.spawnClaudeInstance(agent1, taskPrompt, chainOptions);
1094
- // Store the output stream for potential chaining
1095
- if (this.enableChaining && this.options.outputFormat === 'stream-json' && taskClaudeProcess.stdout) {
1096
- this.taskOutputStreams.set(task.id, taskClaudeProcess.stdout);
1097
- }
1098
- // Wait for completion
1099
- // Use longer timeout for ML tasks
1100
- const baseTimeout = this.options.timeout || 60000;
1101
- const isMLTask = task.type?.toLowerCase().includes('ml') || task.type?.toLowerCase().includes('model') || task.type?.toLowerCase().includes('search') || task.type?.toLowerCase().includes('analysis') || this.options.workflowType === 'ml';
1102
- const timeout = task.timeout || (isMLTask ? Math.max(baseTimeout, 300000) : baseTimeout); // Min 5 minutes for ML tasks
1103
- if (this.options.logLevel === 'debug' || this.options.verbose) {
1104
- console.log(` ⏱️ Timeout: ${this.formatDuration(timeout)} (Base: ${this.formatDuration(baseTimeout)}, ML Task: ${isMLTask})`);
1105
- }
1106
- const completionPromise = new Promise((resolve, reject)=>{
1107
- taskClaudeProcess.on('exit', (code)=>{
1108
- if (code === 0) {
1109
- resolve({
1110
- success: true,
1111
- code
1112
- });
1113
- } else {
1114
- reject(new Error(`Process exited with code ${code}`));
1115
- }
1116
- });
1117
- taskClaudeProcess.on('error', (err)=>{
1118
- reject(err);
1119
- });
1120
- });
1121
- const timeoutPromise = new Promise((_, reject)=>{
1122
- // Use a much longer timeout for ML tasks since Claude is actively working
1123
- const actualTimeout = isMLTask ? Math.max(timeout, 600000) : timeout; // 10 min minimum for ML
1124
- setTimeout(()=>reject(new Error('Task timeout')), actualTimeout);
1125
- });
1126
- try {
1127
- await Promise.race([
1128
- completionPromise,
1129
- timeoutPromise
1130
- ]);
1131
- const result = {
1132
- success: true,
1133
- taskId: task.id,
1134
- duration: Date.now() - startTime,
1135
- output: {
1136
- status: 'completed',
1137
- agent: task.assignTo,
1138
- executionTime: Date.now() - startTime,
1139
- metadata: {
1140
- timestamp: new Date().toISOString(),
1141
- executionId: this.executionId,
1142
- mode: 'claude-task-execution'
1143
- }
1144
- }
1145
- };
1146
- // Store result in memory
1147
- if (this.hooksEnabled) {
1148
- await this.storeTaskResult(task.id, result.output);
1149
- }
1150
- return result;
1151
- } catch (error) {
1152
- throw error;
1153
- }
1154
- }
1280
+
1281
+ return result;
1282
+ } catch (error) {
1283
+ throw error;
1284
+ }
1285
+ } else {
1286
+ // Use existing Claude instance
1287
+ // In a full implementation, this would send the task to the running instance
1288
+ // For now, we'll spawn a new instance per task for simplicity
1289
+
1290
+ const agent = claudeInstance.agent;
1291
+ const taskPrompt = this.createTaskPrompt(task, agent, workflow);
1292
+
1293
+ // Check if we should chain from a previous task
1294
+ let chainOptions = {};
1295
+ if (
1296
+ this.enableChaining &&
1297
+ this.options.outputFormat === 'stream-json' &&
1298
+ task.depends?.length > 0
1299
+ ) {
1300
+ // Get the output stream from the last dependency
1301
+ const lastDependency = task.depends[task.depends.length - 1];
1302
+ const dependencyStream = this.taskOutputStreams.get(lastDependency);
1303
+ if (dependencyStream) {
1304
+ console.log(` 🔗 Enabling stream chaining from ${lastDependency} to ${task.id}`);
1305
+ chainOptions.inputStream = dependencyStream;
1155
1306
  }
1156
- } catch (error) {
1157
- return {
1158
- success: false,
1159
- taskId: task.id,
1160
- duration: Date.now() - startTime,
1161
- error: error
1307
+ }
1308
+
1309
+ // For now, spawn a new instance for each task
1310
+ const taskClaudeProcess = await this.spawnClaudeInstance(agent, taskPrompt, chainOptions);
1311
+
1312
+ // Store the output stream for potential chaining
1313
+ if (
1314
+ this.enableChaining &&
1315
+ this.options.outputFormat === 'stream-json' &&
1316
+ taskClaudeProcess.stdout
1317
+ ) {
1318
+ this.taskOutputStreams.set(task.id, taskClaudeProcess.stdout);
1319
+ }
1320
+
1321
+ // Wait for completion
1322
+ // Use longer timeout for ML tasks
1323
+ const baseTimeout = this.options.timeout || 60000;
1324
+ const isMLTask =
1325
+ task.type?.toLowerCase().includes('ml') ||
1326
+ task.type?.toLowerCase().includes('model') ||
1327
+ task.type?.toLowerCase().includes('search') ||
1328
+ task.type?.toLowerCase().includes('analysis') ||
1329
+ this.options.workflowType === 'ml';
1330
+ const timeout = task.timeout || (isMLTask ? Math.max(baseTimeout, 300000) : baseTimeout); // Min 5 minutes for ML tasks
1331
+
1332
+ if (this.options.logLevel === 'debug' || this.options.verbose) {
1333
+ console.log(
1334
+ ` ⏱️ Timeout: ${this.formatDuration(timeout)} (Base: ${this.formatDuration(baseTimeout)}, ML Task: ${isMLTask})`,
1335
+ );
1336
+ }
1337
+
1338
+ const completionPromise = new Promise((resolve, reject) => {
1339
+ taskClaudeProcess.on('exit', (code) => {
1340
+ if (code === 0) {
1341
+ resolve({ success: true, code });
1342
+ } else {
1343
+ reject(new Error(`Process exited with code ${code}`));
1344
+ }
1345
+ });
1346
+
1347
+ taskClaudeProcess.on('error', (err) => {
1348
+ reject(err);
1349
+ });
1350
+ });
1351
+
1352
+ const timeoutPromise = new Promise((_, reject) => {
1353
+ // Use a much longer timeout for ML tasks since Claude is actively working
1354
+ const actualTimeout = isMLTask ? Math.max(timeout, 600000) : timeout; // 10 min minimum for ML
1355
+ setTimeout(() => reject(new Error('Task timeout')), actualTimeout);
1356
+ });
1357
+
1358
+ try {
1359
+ await Promise.race([completionPromise, timeoutPromise]);
1360
+
1361
+ const result = {
1362
+ success: true,
1363
+ taskId: task.id,
1364
+ duration: Date.now() - startTime,
1365
+ output: {
1366
+ status: 'completed',
1367
+ agent: task.assignTo,
1368
+ executionTime: Date.now() - startTime,
1369
+ metadata: {
1370
+ timestamp: new Date().toISOString(),
1371
+ executionId: this.executionId,
1372
+ mode: 'claude-task-execution',
1373
+ },
1374
+ },
1162
1375
  };
1376
+
1377
+ // Store result in memory
1378
+ if (this.hooksEnabled) {
1379
+ await this.storeTaskResult(task.id, result.output);
1380
+ }
1381
+
1382
+ return result;
1383
+ } catch (error) {
1384
+ throw error;
1385
+ }
1163
1386
  }
1387
+ }
1388
+ } catch (error) {
1389
+ return {
1390
+ success: false,
1391
+ taskId: task.id,
1392
+ duration: Date.now() - startTime,
1393
+ error: error,
1394
+ };
1164
1395
  }
1165
- /**
1396
+ }
1397
+
1398
+ /**
1166
1399
  * Create execution plan based on task dependencies
1167
- */ createExecutionPlan(tasks, dependencies) {
1168
- const taskMap = new Map(tasks.map((task)=>[
1169
- task.id,
1170
- task
1171
- ]));
1172
- const completed = new Set();
1173
- const phases = [];
1174
- while(completed.size < tasks.length){
1175
- const readyTasks = tasks.filter((task)=>{
1176
- if (completed.has(task.id)) return false;
1177
- const deps = task.depends || dependencies[task.id] || [];
1178
- return deps.every((dep)=>completed.has(dep));
1179
- });
1180
- if (readyTasks.length === 0) {
1181
- throw new Error('Circular dependency detected or invalid dependencies');
1182
- }
1183
- phases.push(readyTasks);
1184
- readyTasks.forEach((task)=>completed.add(task.id));
1185
- }
1186
- return phases;
1400
+ */
1401
+ createExecutionPlan(tasks, dependencies) {
1402
+ const taskMap = new Map(tasks.map((task) => [task.id, task]));
1403
+ const completed = new Set();
1404
+ const phases = [];
1405
+
1406
+ while (completed.size < tasks.length) {
1407
+ const readyTasks = tasks.filter((task) => {
1408
+ if (completed.has(task.id)) return false;
1409
+
1410
+ const deps = task.depends || dependencies[task.id] || [];
1411
+ return deps.every((dep) => completed.has(dep));
1412
+ });
1413
+
1414
+ if (readyTasks.length === 0) {
1415
+ throw new Error('Circular dependency detected or invalid dependencies');
1416
+ }
1417
+
1418
+ phases.push(readyTasks);
1419
+ readyTasks.forEach((task) => completed.add(task.id));
1187
1420
  }
1188
- /**
1421
+
1422
+ return phases;
1423
+ }
1424
+
1425
+ /**
1189
1426
  * Execute a hook command
1190
- */ async executeHook(hookType, params) {
1191
- try {
1192
- const { execSync } = await import("child_process");
1193
- let hookCommand = `npx claude-flow@alpha hooks ${hookType}`;
1194
- if (params.description) {
1195
- hookCommand += ` --description "${params.description}"`;
1196
- }
1197
- if (params.file) {
1198
- hookCommand += ` --file "${params.file}"`;
1199
- }
1200
- if (params.taskId) {
1201
- hookCommand += ` --task-id "${params.taskId}"`;
1202
- }
1203
- if (params.sessionId) {
1204
- hookCommand += ` --session-id "${params.sessionId}"`;
1205
- }
1206
- if (params.message) {
1207
- hookCommand += ` --message "${params.message}"`;
1208
- }
1209
- execSync(hookCommand, {
1210
- stdio: 'pipe'
1211
- });
1212
- } catch (error) {
1213
- // Hooks are optional, don't fail the workflow if they fail
1214
- console.debug(`Hook ${hookType} failed:`, error.message);
1215
- }
1427
+ */
1428
+ async executeHook(hookType, params) {
1429
+ try {
1430
+ const { execSync } = await import('child_process');
1431
+
1432
+ let hookCommand = `npx claude-flow@alpha hooks ${hookType}`;
1433
+
1434
+ if (params.description) {
1435
+ hookCommand += ` --description "${params.description}"`;
1436
+ }
1437
+ if (params.file) {
1438
+ hookCommand += ` --file "${params.file}"`;
1439
+ }
1440
+ if (params.taskId) {
1441
+ hookCommand += ` --task-id "${params.taskId}"`;
1442
+ }
1443
+ if (params.sessionId) {
1444
+ hookCommand += ` --session-id "${params.sessionId}"`;
1445
+ }
1446
+ if (params.message) {
1447
+ hookCommand += ` --message "${params.message}"`;
1448
+ }
1449
+
1450
+ execSync(hookCommand, { stdio: 'pipe' });
1451
+ } catch (error) {
1452
+ // Hooks are optional, don't fail the workflow if they fail
1453
+ console.debug(`Hook ${hookType} failed:`, error.message);
1216
1454
  }
1217
- /**
1455
+ }
1456
+
1457
+ /**
1218
1458
  * Store task result in memory
1219
- */ async storeTaskResult(taskId, result) {
1220
- try {
1221
- const { execSync } = await import("child_process");
1222
- const resultJson = JSON.stringify(result);
1223
- execSync(`npx claude-flow@alpha memory store "workflow/${this.executionId}/${taskId}" '${resultJson}'`, {
1224
- stdio: 'pipe'
1225
- });
1226
- } catch (error) {
1227
- console.debug(`Failed to store task result for ${taskId}:`, error.message);
1228
- }
1459
+ */
1460
+ async storeTaskResult(taskId, result) {
1461
+ try {
1462
+ const { execSync } = await import('child_process');
1463
+ const resultJson = JSON.stringify(result);
1464
+
1465
+ execSync(
1466
+ `npx claude-flow@alpha memory store "workflow/${this.executionId}/${taskId}" '${resultJson}'`,
1467
+ {
1468
+ stdio: 'pipe',
1469
+ },
1470
+ );
1471
+ } catch (error) {
1472
+ console.debug(`Failed to store task result for ${taskId}:`, error.message);
1229
1473
  }
1230
- /**
1474
+ }
1475
+
1476
+ /**
1231
1477
  * Validate workflow definition
1232
- */ validateWorkflow(workflow) {
1233
- if (!workflow.name) {
1234
- throw new Error('Workflow name is required');
1235
- }
1236
- if (!workflow.tasks || workflow.tasks.length === 0) {
1237
- throw new Error('Workflow must contain at least one task');
1238
- }
1239
- // Validate task structure
1240
- for (const task of workflow.tasks){
1241
- if (!task.id || !task.type || !task.description) {
1242
- throw new Error(`Task ${task.id || 'unknown'} is missing required fields`);
1243
- }
1244
- }
1245
- // Validate agent assignments
1246
- if (workflow.agents) {
1247
- const agentIds = new Set(workflow.agents.map((a)=>a.id));
1248
- for (const task of workflow.tasks){
1249
- if (task.assignTo && !agentIds.has(task.assignTo)) {
1250
- throw new Error(`Task ${task.id} assigned to unknown agent: ${task.assignTo}`);
1251
- }
1252
- }
1478
+ */
1479
+ validateWorkflow(workflow) {
1480
+ if (!workflow.name) {
1481
+ throw new Error('Workflow name is required');
1482
+ }
1483
+
1484
+ if (!workflow.tasks || workflow.tasks.length === 0) {
1485
+ throw new Error('Workflow must contain at least one task');
1486
+ }
1487
+
1488
+ // Validate task structure
1489
+ for (const task of workflow.tasks) {
1490
+ if (!task.id || !task.type || !task.description) {
1491
+ throw new Error(`Task ${task.id || 'unknown'} is missing required fields`);
1492
+ }
1493
+ }
1494
+
1495
+ // Validate agent assignments
1496
+ if (workflow.agents) {
1497
+ const agentIds = new Set(workflow.agents.map((a) => a.id));
1498
+ for (const task of workflow.tasks) {
1499
+ if (task.assignTo && !agentIds.has(task.assignTo)) {
1500
+ throw new Error(`Task ${task.id} assigned to unknown agent: ${task.assignTo}`);
1253
1501
  }
1502
+ }
1254
1503
  }
1255
- /**
1504
+ }
1505
+
1506
+ /**
1256
1507
  * Apply variable substitutions to workflow
1257
- */ applyVariables(workflow, variables) {
1258
- const allVariables = {
1259
- ...workflow.variables,
1260
- ...variables
1261
- };
1262
- const workflowStr = JSON.stringify(workflow);
1263
- // Simple variable substitution
1264
- let processedStr = workflowStr;
1265
- for (const [key, value] of Object.entries(allVariables)){
1266
- const pattern = new RegExp(`\\$\\{${key}\\}`, 'g');
1267
- processedStr = processedStr.replace(pattern, value);
1268
- }
1269
- return JSON.parse(processedStr);
1508
+ */
1509
+ applyVariables(workflow, variables) {
1510
+ const allVariables = { ...workflow.variables, ...variables };
1511
+ const workflowStr = JSON.stringify(workflow);
1512
+
1513
+ // Simple variable substitution
1514
+ let processedStr = workflowStr;
1515
+ for (const [key, value] of Object.entries(allVariables)) {
1516
+ const pattern = new RegExp(`\\$\\{${key}\\}`, 'g');
1517
+ processedStr = processedStr.replace(pattern, value);
1270
1518
  }
1271
- /**
1519
+
1520
+ return JSON.parse(processedStr);
1521
+ }
1522
+
1523
+ /**
1272
1524
  * Cleanup Claude instances
1273
- */ async cleanupClaudeInstances() {
1274
- if (this.claudeInstances.size === 0) return;
1275
- console.log('🧹 Cleaning up Claude instances...');
1276
- for (const [agentId, instance] of this.claudeInstances.entries()){
1277
- try {
1278
- if (instance.process && !instance.process.killed) {
1279
- instance.process.kill('SIGTERM');
1280
- // Wait for graceful shutdown, then force kill if needed
1281
- setTimeout(()=>{
1282
- if (!instance.process.killed) {
1283
- instance.process.kill('SIGKILL');
1284
- }
1285
- }, 5000);
1286
- }
1287
- console.log(` ✅ Cleaned up ${instance.agent.name}`);
1288
- } catch (error) {
1289
- console.error(` ❌ Error cleaning up ${instance.agent.name}:`, error.message);
1525
+ */
1526
+ async cleanupClaudeInstances() {
1527
+ if (this.claudeInstances.size === 0) return;
1528
+
1529
+ console.log('🧹 Cleaning up Claude instances...');
1530
+
1531
+ for (const [agentId, instance] of this.claudeInstances.entries()) {
1532
+ try {
1533
+ if (instance.process && !instance.process.killed) {
1534
+ instance.process.kill('SIGTERM');
1535
+
1536
+ // Wait for graceful shutdown, then force kill if needed
1537
+ setTimeout(() => {
1538
+ if (!instance.process.killed) {
1539
+ instance.process.kill('SIGKILL');
1290
1540
  }
1541
+ }, 5000);
1291
1542
  }
1292
- this.claudeInstances.clear();
1543
+
1544
+ console.log(` ✅ Cleaned up ${instance.agent.name}`);
1545
+ } catch (error) {
1546
+ console.error(` ❌ Error cleaning up ${instance.agent.name}:`, error.message);
1547
+ }
1293
1548
  }
1294
- /**
1549
+
1550
+ this.claudeInstances.clear();
1551
+ }
1552
+
1553
+ /**
1295
1554
  * Format duration in human readable format
1296
- */ formatDuration(ms) {
1297
- const seconds = Math.floor(ms / 1000);
1298
- const minutes = Math.floor(seconds / 60);
1299
- const hours = Math.floor(minutes / 60);
1300
- if (hours > 0) {
1301
- return `${hours}h ${minutes % 60}m ${seconds % 60}s`;
1302
- } else if (minutes > 0) {
1303
- return `${minutes}m ${seconds % 60}s`;
1304
- } else {
1305
- return `${seconds}s`;
1306
- }
1307
- }
1308
- constructor(options = {}){
1309
- this.options = {
1310
- enableClaude: false,
1311
- nonInteractive: false,
1312
- outputFormat: 'text',
1313
- maxConcurrency: 3,
1314
- timeout: 3600000,
1315
- logLevel: 'info',
1316
- ...options
1317
- };
1318
- // Increase timeout for ML workflows
1319
- if (options.workflowType === 'ml' || options.workflowName?.toLowerCase().includes('mle')) {
1320
- this.options.timeout = 7200000; // 2 hours for ML workflows
1321
- }
1322
- // Execution state
1323
- this.executionId = generateId('workflow-exec');
1324
- this.startTime = Date.now();
1325
- this.activeTasks = new Map();
1326
- this.claudeInstances = new Map();
1327
- this.results = new Map();
1328
- this.errors = [];
1329
- this.currentWorkflow = null;
1330
- // Stream chaining support
1331
- this.taskOutputStreams = new Map(); // Store output streams for chaining
1332
- this.enableChaining = options.enableChaining !== false; // Default to true
1333
- // Hooks integration
1334
- this.hooksEnabled = true;
1335
- this.sessionId = generateId('automation-session');
1555
+ */
1556
+ formatDuration(ms) {
1557
+ const seconds = Math.floor(ms / 1000);
1558
+ const minutes = Math.floor(seconds / 60);
1559
+ const hours = Math.floor(minutes / 60);
1560
+
1561
+ if (hours > 0) {
1562
+ return `${hours}h ${minutes % 60}m ${seconds % 60}s`;
1563
+ } else if (minutes > 0) {
1564
+ return `${minutes}m ${seconds % 60}s`;
1565
+ } else {
1566
+ return `${seconds}s`;
1336
1567
  }
1568
+ }
1337
1569
  }
1570
+
1338
1571
  /**
1339
1572
  * Load workflow from file
1340
- */ export async function loadWorkflowFromFile(filePath) {
1341
- try {
1342
- const content = await fs.readFile(filePath, 'utf-8');
1343
- if (filePath.endsWith('.json')) {
1344
- return JSON.parse(content);
1345
- } else if (filePath.endsWith('.yaml') || filePath.endsWith('.yml')) {
1346
- // For now, just return error - YAML support can be added later
1347
- throw new Error('YAML workflows not yet supported');
1348
- } else {
1349
- throw new Error('Unsupported workflow file format. Use .json or .yaml');
1350
- }
1351
- } catch (error) {
1352
- throw new Error(`Failed to load workflow: ${error.message}`);
1573
+ */
1574
+ export async function loadWorkflowFromFile(filePath) {
1575
+ try {
1576
+ const content = await fs.readFile(filePath, 'utf-8');
1577
+
1578
+ if (filePath.endsWith('.json')) {
1579
+ return JSON.parse(content);
1580
+ } else if (filePath.endsWith('.yaml') || filePath.endsWith('.yml')) {
1581
+ // For now, just return error - YAML support can be added later
1582
+ throw new Error('YAML workflows not yet supported');
1583
+ } else {
1584
+ throw new Error('Unsupported workflow file format. Use .json or .yaml');
1353
1585
  }
1586
+ } catch (error) {
1587
+ throw new Error(`Failed to load workflow: ${error.message}`);
1588
+ }
1354
1589
  }
1590
+
1355
1591
  /**
1356
1592
  * Get default MLE-STAR workflow path
1357
- */ export function getMLEStarWorkflowPath() {
1358
- return join(process.cwd(), 'src', 'cli', 'simple-commands', 'templates', 'mle-star-workflow.json');
1593
+ */
1594
+ export function getMLEStarWorkflowPath() {
1595
+ return join(
1596
+ process.cwd(),
1597
+ 'src',
1598
+ 'cli',
1599
+ 'simple-commands',
1600
+ 'templates',
1601
+ 'mle-star-workflow.json',
1602
+ );
1359
1603
  }