claude-flow-novice 2.15.11 → 2.16.1

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 (741) hide show
  1. package/.claude/cfn-extras/agents/cfn-v3-coordinator.md +517 -0
  2. package/.claude/cfn-extras/skills/GOOGLE_SHEETS_SKILLS_README.md +1 -1
  3. package/.claude/cfn-extras/skills/google-sheets-api-coordinator/SKILL.md +1 -1
  4. package/.claude/cfn-extras/skills/google-sheets-formula-builder/SKILL.md +1 -1
  5. package/.claude/cfn-extras/skills/google-sheets-progress/SKILL.md +1 -1
  6. package/.claude/commands/CFN_LOOP_FRONTEND.md +1 -1
  7. package/.claude/commands/cfn-loop-cli.md +214 -442
  8. package/.claude/commands/cfn-loop-frontend.md +1 -1
  9. package/.claude/commands/cfn-loop-task.md +2 -2
  10. package/.claude/commands/cfn-loop-trigger.md +114 -0
  11. package/.claude/commands/deprecated/cfn-loop.md +2 -2
  12. package/.claude/hooks/cfn-invoke-post-edit-ts.sh +100 -0
  13. package/.claude/hooks/cfn-invoke-post-edit-ts.sh.backup +78 -0
  14. package/.claude/hooks/cfn-invoke-post-edit.sh +53 -5
  15. package/.claude/hooks/cfn-invoke-post-edit.sh.backup +87 -0
  16. package/.claude/hooks/cfn-invoke-pre-edit-ts.sh +116 -0
  17. package/.claude/hooks/cfn-invoke-pre-edit-ts.sh.backup +94 -0
  18. package/.claude/hooks/cfn-invoke-pre-edit.sh +22 -0
  19. package/.claude/hooks/cfn-invoke-pre-edit.sh.backup +88 -0
  20. package/.claude/hooks/cfn-post-edit.config.json +9 -2
  21. package/.claude/root-claude-distribute/CFN-CLAUDE.md +1 -1
  22. package/.claude/skills/cfn-agent-spawning/SKILL.md +48 -1
  23. package/.claude/skills/cfn-agent-spawning/SKILL.md.backup +135 -0
  24. package/.claude/skills/cfn-agent-spawning/TYPESCRIPT_MIGRATION.md +567 -0
  25. package/.claude/skills/cfn-agent-spawning/check-dependencies.sh +22 -0
  26. package/.claude/skills/{cfn-redis-coordination/check-dependencies.sh → cfn-agent-spawning/check-dependencies.sh.backup} +3 -5
  27. package/.claude/skills/cfn-agent-spawning/get-agent-provider-env.sh +22 -0
  28. package/.claude/skills/cfn-agent-spawning/get-agent-provider-env.sh.backup +127 -0
  29. package/.claude/skills/cfn-agent-spawning/parse-agent-provider.sh +22 -0
  30. package/.claude/skills/cfn-agent-spawning/parse-agent-provider.sh.backup +59 -0
  31. package/.claude/skills/cfn-agent-spawning/spawn-agent-wrapper.sh +63 -0
  32. package/.claude/skills/cfn-agent-spawning/spawn-agent-wrapper.sh.backup +41 -0
  33. package/.claude/skills/cfn-agent-spawning/spawn-agent.sh +26 -1
  34. package/.claude/skills/cfn-agent-spawning/spawn-templates.sh +22 -0
  35. package/.claude/skills/cfn-agent-spawning/spawn-templates.sh.backup +613 -0
  36. package/.claude/skills/cfn-agent-spawning/spawn-worker.sh +22 -0
  37. package/.claude/skills/cfn-agent-spawning/spawn-worker.sh.backup +176 -0
  38. package/.claude/skills/cfn-backlog-management/SKILL.md +1 -1
  39. package/.claude/skills/cfn-loop-orchestration/.backups/unknown/1763619700_33aff4a69b99159e4e849107ebc4d09f/metadata.json +8 -0
  40. package/.claude/skills/cfn-loop-orchestration/.backups/unknown/1763619700_33aff4a69b99159e4e849107ebc4d09f/original +271 -0
  41. package/.claude/skills/cfn-loop-orchestration/.backups/unknown/1763619700_33aff4a69b99159e4e849107ebc4d09f/revert.sh +7 -0
  42. package/.claude/skills/cfn-loop-orchestration/.backups/unknown/1763671642_06496e8c399a79db08167cc00ed4b31e/metadata.json +8 -0
  43. package/.claude/skills/cfn-loop-orchestration/.backups/unknown/1763671642_06496e8c399a79db08167cc00ed4b31e/original +325 -0
  44. package/.claude/skills/cfn-loop-orchestration/.backups/unknown/1763671642_06496e8c399a79db08167cc00ed4b31e/revert.sh +7 -0
  45. package/.claude/skills/cfn-loop-orchestration/CLI_IMPLEMENTATION_SUMMARY.md +330 -0
  46. package/.claude/skills/cfn-loop-orchestration/CONFIGURATION_IMPROVEMENTS.md +318 -0
  47. package/.claude/skills/cfn-loop-orchestration/CONTEXT_LOOKUP_MIGRATION.md +308 -0
  48. package/.claude/skills/cfn-loop-orchestration/CONTEXT_LOOKUP_QUICK_START.md +378 -0
  49. package/.claude/skills/cfn-loop-orchestration/E2E_VALIDATION_REPORT.md +262 -0
  50. package/.claude/skills/cfn-loop-orchestration/IMPLEMENTATION_SUMMARY.md +319 -519
  51. package/.claude/skills/cfn-loop-orchestration/NORTH_STAR_E2E_REPORT.md +299 -0
  52. package/.claude/skills/cfn-loop-orchestration/NORTH_STAR_EXECUTION_SUMMARY.md +403 -0
  53. package/.claude/skills/cfn-loop-orchestration/NORTH_STAR_INDEX.md +323 -0
  54. package/.claude/skills/cfn-loop-orchestration/SKILL.md +159 -48
  55. package/.claude/skills/cfn-loop-orchestration/SPAWN_AGENTS_IMPLEMENTATION.md +188 -0
  56. package/.claude/skills/cfn-loop-orchestration/TEST_COVERAGE_REPORT.md +335 -0
  57. package/.claude/skills/cfn-loop-orchestration/TEST_COVERAGE_SUMMARY.md +456 -0
  58. package/.claude/skills/cfn-loop-orchestration/TYPESCRIPT_INTEGRATION_REPORT.md +709 -0
  59. package/.claude/skills/cfn-loop-orchestration/TYPESCRIPT_INTEGRATION_SUMMARY.md +257 -0
  60. package/.claude/skills/cfn-loop-orchestration/VALIDATION_REPORT.md +572 -0
  61. package/.claude/skills/cfn-loop-orchestration/VALIDATION_SUMMARY.txt +196 -0
  62. package/.claude/skills/cfn-loop-orchestration/VALIDATOR_MODULE_GUIDE.md +526 -0
  63. package/.claude/skills/cfn-loop-orchestration/archive/legacy-bash/README.md +167 -0
  64. package/.claude/skills/cfn-loop-orchestration/archive/legacy-bash/orchestrate-enhanced.sh +548 -0
  65. package/.claude/skills/cfn-loop-orchestration/{orchestrate-wrapper.sh → archive/legacy-bash/orchestrate-wrapper.sh} +11 -1
  66. package/.claude/skills/cfn-loop-orchestration/archive/legacy-bash/orchestrate.sh +182 -0
  67. package/.claude/skills/cfn-loop-orchestration/e2e-validation-fixed.js +240 -0
  68. package/.claude/skills/cfn-loop-orchestration/e2e-validation.js +213 -0
  69. package/.claude/skills/cfn-loop-orchestration/package-lock.json +3 -0
  70. package/.claude/skills/cfn-loop-orchestration/package.json +4 -0
  71. package/.claude/skills/cfn-loop-orchestration/run-north-star-e2e.ts +210 -0
  72. package/.claude/skills/cfn-loop-orchestration/src/cli/orchestrator-cli.ts +396 -0
  73. package/.claude/skills/cfn-loop-orchestration/src/helpers/CONFIDENCE_AGGREGATOR.md +564 -0
  74. package/.claude/skills/cfn-loop-orchestration/src/helpers/CONFIDENCE_AGGREGATOR_QUICK_REF.md +241 -0
  75. package/.claude/skills/cfn-loop-orchestration/src/helpers/CONTEXT_INJECTOR_IMPLEMENTATION.md +375 -0
  76. package/.claude/skills/cfn-loop-orchestration/src/helpers/CONTEXT_INJECTOR_QUICK_REFERENCE.md +362 -0
  77. package/.claude/skills/cfn-loop-orchestration/src/helpers/CONTEXT_INJECTOR_README.md +307 -0
  78. package/.claude/skills/cfn-loop-orchestration/src/helpers/CONTEXT_INJECTOR_USAGE_GUIDE.md +508 -0
  79. package/.claude/skills/cfn-loop-orchestration/src/helpers/confidence-aggregator.ts +473 -0
  80. package/.claude/skills/cfn-loop-orchestration/src/helpers/consensus.ts +1 -1
  81. package/.claude/skills/cfn-loop-orchestration/src/helpers/context-injector.ts +349 -0
  82. package/.claude/skills/cfn-loop-orchestration/src/helpers/context-lookup.ts +486 -0
  83. package/.claude/skills/cfn-loop-orchestration/src/helpers/deliverable-verifier.ts +6 -2
  84. package/.claude/skills/cfn-loop-orchestration/src/helpers/gate-check.ts +1 -1
  85. package/.claude/skills/cfn-loop-orchestration/src/helpers/product-owner-decision.ts +316 -0
  86. package/.claude/skills/cfn-loop-orchestration/src/helpers/spawn-agents.ts +357 -0
  87. package/.claude/skills/cfn-loop-orchestration/src/helpers/validator.ts +276 -0
  88. package/.claude/skills/cfn-loop-orchestration/src/index.ts +2 -0
  89. package/.claude/skills/cfn-loop-orchestration/src/orchestrate.ts +743 -2
  90. package/.claude/skills/cfn-loop-orchestration/src/types.ts +56 -0
  91. package/.claude/skills/cfn-loop-orchestration/test-cli.sh +92 -0
  92. package/.claude/skills/cfn-loop-orchestration/test-typescript-integration.sh +442 -0
  93. package/.claude/skills/cfn-loop-orchestration/tests/agent-spawner.test.ts +124 -0
  94. package/.claude/skills/cfn-loop-orchestration/tests/confidence-aggregator.test.ts +604 -0
  95. package/.claude/skills/cfn-loop-orchestration/tests/context-injector.test.ts +561 -0
  96. package/.claude/skills/cfn-loop-orchestration/tests/context-lookup.test.ts +661 -0
  97. package/.claude/skills/cfn-loop-orchestration/tests/deliverable-verifier.test.ts +2 -2
  98. package/.claude/skills/cfn-loop-orchestration/tests/gate-check-edge-cases.test.ts +422 -0
  99. package/.claude/skills/cfn-loop-orchestration/tests/gate-checker.test.ts +276 -0
  100. package/.claude/skills/cfn-loop-orchestration/tests/logger.test.ts +291 -0
  101. package/.claude/skills/cfn-loop-orchestration/tests/north-star-e2e.test.ts +334 -0
  102. package/.claude/skills/cfn-loop-orchestration/tests/redis-coordinator.test.ts +321 -0
  103. package/.claude/skills/cfn-loop-orchestration/tests/spawn-agents.test.ts +284 -0
  104. package/.claude/skills/cfn-loop-orchestration/tests/validator.test.ts +643 -0
  105. package/.claude/skills/cfn-loop-validation/IMPLEMENTATION_SUMMARY.md +672 -0
  106. package/.claude/skills/cfn-loop-validation/INDEX.md +531 -0
  107. package/.claude/skills/cfn-loop-validation/README_TYPESCRIPT.md +454 -0
  108. package/.claude/skills/cfn-loop-validation/SKILL.md +48 -1
  109. package/.claude/skills/cfn-loop-validation/SKILL.md.backup +353 -0
  110. package/.claude/skills/cfn-loop-validation/SKILL_TYPESCRIPT.md +782 -0
  111. package/.claude/skills/cfn-loop-validation/VAPOR_DETECTION_EXAMPLES.md +598 -0
  112. package/.claude/skills/cfn-loop-validation/check-dependencies.sh +22 -0
  113. package/{claude-assets/skills/cfn-redis-coordination/check-dependencies.sh → .claude/skills/cfn-loop-validation/check-dependencies.sh.backup} +4 -5
  114. package/.claude/skills/cfn-loop-validation/detect-vapor.sh +59 -0
  115. package/.claude/skills/cfn-loop-validation/detect-vapor.sh.backup +37 -0
  116. package/.claude/skills/cfn-loop-validation/dist/.tsbuildinfo +1 -0
  117. package/.claude/skills/cfn-loop-validation/dist/cli/detect-vapor.d.ts +14 -0
  118. package/.claude/skills/cfn-loop-validation/dist/cli/detect-vapor.d.ts.map +1 -0
  119. package/.claude/skills/cfn-loop-validation/dist/cli/detect-vapor.js +185 -0
  120. package/.claude/skills/cfn-loop-validation/dist/cli/detect-vapor.js.map +1 -0
  121. package/.claude/skills/cfn-loop-validation/dist/cli/validate-deliverables.d.ts +14 -0
  122. package/.claude/skills/cfn-loop-validation/dist/cli/validate-deliverables.d.ts.map +1 -0
  123. package/.claude/skills/cfn-loop-validation/dist/cli/validate-deliverables.js +176 -0
  124. package/.claude/skills/cfn-loop-validation/dist/cli/validate-deliverables.js.map +1 -0
  125. package/.claude/skills/cfn-loop-validation/dist/cli/validate-gate.d.ts +19 -0
  126. package/.claude/skills/cfn-loop-validation/dist/cli/validate-gate.d.ts.map +1 -0
  127. package/.claude/skills/cfn-loop-validation/dist/cli/validate-gate.js +123 -0
  128. package/.claude/skills/cfn-loop-validation/dist/cli/validate-gate.js.map +1 -0
  129. package/.claude/skills/cfn-loop-validation/dist/types.d.ts +156 -0
  130. package/.claude/skills/cfn-loop-validation/dist/types.d.ts.map +1 -0
  131. package/.claude/skills/cfn-loop-validation/dist/types.js +66 -0
  132. package/.claude/skills/cfn-loop-validation/dist/types.js.map +1 -0
  133. package/.claude/skills/cfn-loop-validation/dist/validator.d.ts +85 -0
  134. package/.claude/skills/cfn-loop-validation/dist/validator.d.ts.map +1 -0
  135. package/.claude/skills/cfn-loop-validation/dist/validator.js +411 -0
  136. package/.claude/skills/cfn-loop-validation/dist/validator.js.map +1 -0
  137. package/.claude/skills/cfn-loop-validation/orchestrate-cfn-loop.sh +22 -0
  138. package/.claude/skills/cfn-loop-validation/orchestrate-cfn-loop.sh.backup +252 -0
  139. package/.claude/skills/cfn-loop-validation/package.json +93 -0
  140. package/.claude/skills/cfn-loop-validation/src/cli/detect-vapor.ts +177 -0
  141. package/.claude/skills/cfn-loop-validation/src/cli/validate-deliverables.ts +161 -0
  142. package/.claude/skills/cfn-loop-validation/src/cli/validate-gate.ts +139 -0
  143. package/.claude/skills/cfn-loop-validation/src/types.ts +215 -0
  144. package/.claude/skills/cfn-loop-validation/src/validator.ts +503 -0
  145. package/.claude/skills/cfn-loop-validation/tests/validator.test.ts +537 -0
  146. package/.claude/skills/{cfn-redis-coordination → cfn-loop-validation}/tsconfig.json +34 -31
  147. package/.claude/skills/cfn-loop-validation/validate-deliverables.sh +59 -0
  148. package/.claude/skills/cfn-loop-validation/validate-deliverables.sh.backup +37 -0
  149. package/.claude/skills/cfn-loop-validation/validate-gate.sh +63 -0
  150. package/.claude/skills/cfn-loop-validation/validate-gate.sh.backup +41 -0
  151. package/.claude/skills/cfn-loop-validation/validate-iteration.sh +22 -0
  152. package/.claude/skills/cfn-loop-validation/validate-iteration.sh.backup +134 -0
  153. package/.claude/skills/cfn-product-owner-decision/SKILL.md +479 -147
  154. package/.claude/skills/cfn-product-owner-decision/TYPESCRIPT_IMPLEMENTATION.md +653 -0
  155. package/.claude/skills/cfn-product-owner-decision/{execute-decision.sh → archive/legacy-bash/execute-decision.sh} +24 -2
  156. package/.claude/skills/pre-edit-backup/SKILL.md +324 -0
  157. package/.claude/skills/pre-edit-backup/SKILL.md.backup +277 -0
  158. package/.claude/skills/pre-edit-backup/backup.sh +22 -0
  159. package/.claude/skills/pre-edit-backup/backup.sh.backup +107 -0
  160. package/claude-assets/agents/cfn-dev-team/analysts/root-cause-analyst.md +2 -2
  161. package/claude-assets/agents/cfn-dev-team/architecture/base-template-generator.md +1 -1
  162. package/claude-assets/agents/cfn-dev-team/coordinators/cfn-frontend-coordinator.md +3 -2
  163. package/claude-assets/agents/cfn-dev-team/coordinators/consensus-builder.md +1 -0
  164. package/claude-assets/agents/cfn-dev-team/coordinators/handoff-coordinator.md +2 -1
  165. package/claude-assets/agents/cfn-dev-team/coordinators/multi-sprint-coordinator.md +1 -0
  166. package/claude-assets/agents/cfn-dev-team/dev-ops/devops-engineer.md +11 -1
  167. package/claude-assets/agents/cfn-dev-team/dev-ops/docker-specialist.md +58 -35
  168. package/claude-assets/agents/cfn-dev-team/dev-ops/github-commit-agent.md +2 -2
  169. package/claude-assets/agents/cfn-dev-team/dev-ops/kubernetes-specialist.md +47 -37
  170. package/claude-assets/agents/cfn-dev-team/developers/api-gateway-specialist.md +18 -18
  171. package/claude-assets/agents/cfn-dev-team/developers/backend-developer.md +40 -58
  172. package/claude-assets/agents/cfn-dev-team/developers/data/data-engineer.md +19 -21
  173. package/claude-assets/agents/cfn-dev-team/developers/database/database-architect.md +20 -29
  174. package/claude-assets/agents/cfn-dev-team/developers/frontend/mobile-dev.md +15 -19
  175. package/claude-assets/agents/cfn-dev-team/developers/frontend/react-frontend-engineer.md +15 -10
  176. package/claude-assets/agents/cfn-dev-team/developers/frontend/typescript-specialist.md +16 -11
  177. package/claude-assets/agents/cfn-dev-team/developers/frontend/ui-designer.md +16 -26
  178. package/claude-assets/agents/cfn-dev-team/developers/graphql-specialist.md +18 -22
  179. package/claude-assets/agents/cfn-dev-team/developers/rust-developer.md +17 -21
  180. package/claude-assets/agents/cfn-dev-team/documentation/pseudocode.md +1 -1
  181. package/claude-assets/agents/cfn-dev-team/product-owners/accessibility-advocate-persona.md +1 -1
  182. package/claude-assets/agents/cfn-dev-team/product-owners/cto-agent.md +1 -1
  183. package/claude-assets/agents/cfn-dev-team/product-owners/power-user-persona.md +1 -1
  184. package/claude-assets/agents/cfn-dev-team/product-owners/product-owner.md +1 -5
  185. package/claude-assets/agents/cfn-dev-team/reviewers/code-reviewer.md +20 -51
  186. package/claude-assets/agents/cfn-dev-team/reviewers/quality/code-quality-validator.md +22 -71
  187. package/claude-assets/agents/cfn-dev-team/reviewers/quality/perf-analyzer.md +21 -64
  188. package/claude-assets/agents/cfn-dev-team/reviewers/quality/performance-benchmarker.md +22 -67
  189. package/claude-assets/agents/cfn-dev-team/reviewers/quality/security-specialist.md +24 -68
  190. package/claude-assets/agents/cfn-dev-team/testers/api-testing-specialist.md +8 -36
  191. package/claude-assets/agents/cfn-dev-team/testers/chaos-engineering-specialist.md +9 -38
  192. package/claude-assets/agents/cfn-dev-team/testers/contract-tester.md +17 -55
  193. package/claude-assets/agents/cfn-dev-team/testers/e2e/playwright-tester.md +1 -1
  194. package/claude-assets/agents/cfn-dev-team/testers/integration-tester.md +18 -56
  195. package/claude-assets/agents/cfn-dev-team/testers/interaction-tester.md +9 -37
  196. package/claude-assets/agents/cfn-dev-team/testers/load-testing-specialist.md +18 -56
  197. package/claude-assets/agents/cfn-dev-team/testers/mutation-testing-specialist.md +18 -49
  198. package/claude-assets/agents/cfn-dev-team/testers/playwright-tester.md +8 -37
  199. package/claude-assets/agents/cfn-dev-team/testers/tester.md +7 -27
  200. package/claude-assets/agents/cfn-dev-team/testers/unit/tdd-london-unit-swarm.md +1 -1
  201. package/claude-assets/agents/cfn-dev-team/utility/agent-builder.md +11 -0
  202. package/claude-assets/agents/cfn-dev-team/utility/analyst.md +13 -29
  203. package/claude-assets/agents/cfn-dev-team/utility/claude-code-expert.md +1 -1
  204. package/claude-assets/agents/cfn-dev-team/utility/code-booster.md +13 -13
  205. package/claude-assets/agents/cfn-dev-team/utility/context-curator.md +7 -2
  206. package/claude-assets/agents/cfn-dev-team/utility/epic-creator.md +6 -11
  207. package/claude-assets/agents/cfn-dev-team/utility/memory-leak-specialist.md +121 -715
  208. package/claude-assets/agents/cfn-dev-team/utility/researcher.md +13 -22
  209. package/claude-assets/agents/cfn-dev-team/utility/z-ai-specialist.md +147 -573
  210. package/claude-assets/agents/custom/cfn-docker-expert.md +103 -0
  211. package/claude-assets/agents/custom/cfn-loops-cli-expert.md +438 -0
  212. package/claude-assets/agents/custom/cfn-redis-operations.md +529 -529
  213. package/claude-assets/agents/custom/cfn-system-expert.md +1 -1
  214. package/claude-assets/agents/custom/trigger-dev-expert.md +369 -0
  215. package/claude-assets/agents/docker-team/micro-sprint-planner.md +747 -747
  216. package/claude-assets/agents/project-only-agents/npm-package-specialist.md +1 -1
  217. package/claude-assets/cfn-extras/agents/cfn-v3-coordinator.md +517 -0
  218. package/claude-assets/cfn-extras/skills/GOOGLE_SHEETS_SKILLS_README.md +1 -1
  219. package/claude-assets/cfn-extras/skills/google-sheets-api-coordinator/SKILL.md +1 -1
  220. package/claude-assets/cfn-extras/skills/google-sheets-formula-builder/SKILL.md +1 -1
  221. package/claude-assets/cfn-extras/skills/google-sheets-progress/SKILL.md +1 -1
  222. package/claude-assets/commands/CFN_LOOP_FRONTEND.md +1 -1
  223. package/claude-assets/commands/cfn-loop-cli.md +214 -442
  224. package/claude-assets/commands/cfn-loop-frontend.md +1 -1
  225. package/claude-assets/commands/cfn-loop-task.md +2 -2
  226. package/claude-assets/commands/cfn-loop-trigger.md +114 -0
  227. package/claude-assets/commands/deprecated/cfn-loop.md +2 -2
  228. package/claude-assets/hooks/GIT-HOOKS-USAGE-EXAMPLES.md +116 -0
  229. package/claude-assets/hooks/README-GIT-HOOKS.md +443 -0
  230. package/claude-assets/hooks/SKILL.md +518 -0
  231. package/claude-assets/hooks/SKILL.md.backup +471 -0
  232. package/claude-assets/hooks/cfn-invoke-post-edit-ts.sh +100 -0
  233. package/claude-assets/hooks/cfn-invoke-post-edit-ts.sh.backup +78 -0
  234. package/claude-assets/hooks/cfn-invoke-post-edit.sh +53 -5
  235. package/claude-assets/hooks/cfn-invoke-post-edit.sh.backup +87 -0
  236. package/claude-assets/hooks/cfn-invoke-pre-edit-ts.sh +116 -0
  237. package/claude-assets/hooks/cfn-invoke-pre-edit-ts.sh.backup +94 -0
  238. package/claude-assets/hooks/cfn-invoke-pre-edit.sh +22 -0
  239. package/claude-assets/hooks/cfn-invoke-pre-edit.sh.backup +88 -0
  240. package/claude-assets/hooks/cfn-post-edit.config.json +9 -2
  241. package/claude-assets/hooks/install-git-hooks.sh +243 -0
  242. package/claude-assets/hooks/subagent-start.sh +98 -0
  243. package/claude-assets/hooks/subagent-stop.sh +93 -0
  244. package/claude-assets/hooks/validators/credential-scanner.sh +172 -0
  245. package/claude-assets/root-claude-distribute/CFN-CLAUDE.md +1 -1
  246. package/claude-assets/skills/cfn-agent-selection-with-fallback/DELIVERABLES.md +409 -0
  247. package/claude-assets/skills/cfn-agent-selection-with-fallback/IMPLEMENTATION_SUMMARY.md +396 -0
  248. package/claude-assets/skills/cfn-agent-selection-with-fallback/INTEGRATION_GUIDE.md +308 -0
  249. package/claude-assets/skills/cfn-agent-selection-with-fallback/QUICK_REFERENCE.md +239 -0
  250. package/claude-assets/skills/cfn-agent-selection-with-fallback/SKILL.md +107 -1
  251. package/claude-assets/skills/cfn-agent-selection-with-fallback/SKILL.md.backup +302 -0
  252. package/claude-assets/skills/cfn-agent-selection-with-fallback/TYPESCRIPT_MIGRATION.md +295 -0
  253. package/claude-assets/skills/cfn-agent-selection-with-fallback/dist/agent-selector.cjs +297 -0
  254. package/claude-assets/skills/cfn-agent-selection-with-fallback/dist/agent-selector.js +297 -0
  255. package/claude-assets/skills/cfn-agent-selection-with-fallback/dist/cli.cjs +96 -0
  256. package/claude-assets/skills/cfn-agent-selection-with-fallback/dist/cli.js +96 -0
  257. package/claude-assets/skills/cfn-agent-selection-with-fallback/select-agents-ts.sh +45 -0
  258. package/claude-assets/skills/cfn-agent-selection-with-fallback/select-agents-ts.sh.backup +23 -0
  259. package/claude-assets/skills/cfn-agent-selection-with-fallback/select-agents.sh +22 -0
  260. package/claude-assets/skills/cfn-agent-selection-with-fallback/select-agents.sh.backup +173 -0
  261. package/claude-assets/skills/cfn-agent-selection-with-fallback/src/agent-selector.test.ts +357 -0
  262. package/claude-assets/skills/cfn-agent-selection-with-fallback/src/agent-selector.ts +350 -0
  263. package/claude-assets/skills/cfn-agent-selection-with-fallback/src/cli.ts +74 -0
  264. package/claude-assets/skills/cfn-agent-selection-with-fallback/task-classifier.sh +22 -0
  265. package/claude-assets/skills/cfn-agent-selection-with-fallback/task-classifier.sh.backup +71 -0
  266. package/claude-assets/skills/cfn-agent-selection-with-fallback/tsconfig.json +18 -0
  267. package/claude-assets/skills/cfn-agent-spawning/SKILL.md +48 -1
  268. package/claude-assets/skills/cfn-agent-spawning/SKILL.md.backup +135 -0
  269. package/claude-assets/skills/cfn-agent-spawning/TYPESCRIPT_MIGRATION.md +567 -0
  270. package/claude-assets/skills/cfn-agent-spawning/check-dependencies.sh +22 -0
  271. package/claude-assets/skills/cfn-agent-spawning/check-dependencies.sh.backup +30 -0
  272. package/claude-assets/skills/cfn-agent-spawning/get-agent-provider-env.sh +22 -0
  273. package/claude-assets/skills/cfn-agent-spawning/get-agent-provider-env.sh.backup +127 -0
  274. package/claude-assets/skills/cfn-agent-spawning/parse-agent-provider.sh +22 -0
  275. package/claude-assets/skills/cfn-agent-spawning/parse-agent-provider.sh.backup +59 -0
  276. package/claude-assets/skills/cfn-agent-spawning/spawn-agent-wrapper.sh +63 -0
  277. package/claude-assets/skills/cfn-agent-spawning/spawn-agent-wrapper.sh.backup +41 -0
  278. package/claude-assets/skills/cfn-agent-spawning/spawn-agent.sh +26 -1
  279. package/claude-assets/skills/cfn-agent-spawning/spawn-templates.sh +22 -0
  280. package/claude-assets/skills/cfn-agent-spawning/spawn-templates.sh.backup +613 -0
  281. package/claude-assets/skills/cfn-agent-spawning/spawn-worker.sh +22 -0
  282. package/claude-assets/skills/cfn-agent-spawning/spawn-worker.sh.backup +176 -0
  283. package/claude-assets/skills/cfn-backlog-management/SKILL.md +1 -1
  284. package/claude-assets/skills/cfn-coordination/agent-completion.sh.backup +36 -0
  285. package/claude-assets/skills/cfn-coordination/coordination-signal.sh.backup +36 -0
  286. package/claude-assets/skills/cfn-coordination/coordination-wait.sh.backup +36 -0
  287. package/claude-assets/skills/cfn-dependency-ingestion/README.md +101 -0
  288. package/claude-assets/skills/cfn-dependency-ingestion/SKILL.md +397 -0
  289. package/claude-assets/skills/cfn-dependency-ingestion/build.sh +23 -0
  290. package/claude-assets/skills/cfn-dependency-ingestion/dist/ingest-dependencies.js +478 -0
  291. package/claude-assets/skills/cfn-dependency-ingestion/ingest-dependencies.sh +295 -0
  292. package/claude-assets/skills/cfn-dependency-ingestion/ingest.sh +237 -0
  293. package/claude-assets/skills/cfn-dependency-ingestion/manifests/cli-mode-dependencies.txt +73 -0
  294. package/claude-assets/skills/cfn-dependency-ingestion/manifests/shared-dependencies.txt +57 -0
  295. package/claude-assets/skills/cfn-dependency-ingestion/manifests/trigger-dev-dependencies.txt +82 -0
  296. package/claude-assets/skills/cfn-dependency-ingestion/manifests/trigger-mode-dependencies.txt +80 -0
  297. package/claude-assets/skills/cfn-dependency-ingestion/src/ingest-dependencies.ts +563 -0
  298. package/claude-assets/skills/cfn-environment-sanitization/sanitize-environment.sh +14 -4
  299. package/claude-assets/skills/cfn-loop-orchestration/.backups/unknown/1763619700_33aff4a69b99159e4e849107ebc4d09f/metadata.json +8 -0
  300. package/claude-assets/skills/cfn-loop-orchestration/.backups/unknown/1763619700_33aff4a69b99159e4e849107ebc4d09f/original +271 -0
  301. package/claude-assets/skills/cfn-loop-orchestration/.backups/unknown/1763619700_33aff4a69b99159e4e849107ebc4d09f/revert.sh +7 -0
  302. package/claude-assets/skills/cfn-loop-orchestration/.backups/unknown/1763671642_06496e8c399a79db08167cc00ed4b31e/metadata.json +8 -0
  303. package/claude-assets/skills/cfn-loop-orchestration/.backups/unknown/1763671642_06496e8c399a79db08167cc00ed4b31e/original +325 -0
  304. package/claude-assets/skills/cfn-loop-orchestration/.backups/unknown/1763671642_06496e8c399a79db08167cc00ed4b31e/revert.sh +7 -0
  305. package/claude-assets/skills/cfn-loop-orchestration/CLI_IMPLEMENTATION_SUMMARY.md +330 -0
  306. package/claude-assets/skills/cfn-loop-orchestration/CONFIGURATION_IMPROVEMENTS.md +318 -0
  307. package/claude-assets/skills/cfn-loop-orchestration/CONTEXT_LOOKUP_MIGRATION.md +308 -0
  308. package/claude-assets/skills/cfn-loop-orchestration/CONTEXT_LOOKUP_QUICK_START.md +378 -0
  309. package/claude-assets/skills/cfn-loop-orchestration/E2E_VALIDATION_REPORT.md +262 -0
  310. package/claude-assets/skills/cfn-loop-orchestration/IMPLEMENTATION_SUMMARY.md +319 -519
  311. package/claude-assets/skills/cfn-loop-orchestration/NORTH_STAR_E2E_REPORT.md +299 -0
  312. package/claude-assets/skills/cfn-loop-orchestration/NORTH_STAR_EXECUTION_SUMMARY.md +403 -0
  313. package/claude-assets/skills/cfn-loop-orchestration/NORTH_STAR_INDEX.md +323 -0
  314. package/claude-assets/skills/cfn-loop-orchestration/SKILL.md +159 -48
  315. package/claude-assets/skills/cfn-loop-orchestration/SPAWN_AGENTS_IMPLEMENTATION.md +188 -0
  316. package/claude-assets/skills/cfn-loop-orchestration/TEST_COVERAGE_REPORT.md +335 -0
  317. package/claude-assets/skills/cfn-loop-orchestration/TEST_COVERAGE_SUMMARY.md +456 -0
  318. package/claude-assets/skills/cfn-loop-orchestration/TYPESCRIPT_INTEGRATION_REPORT.md +709 -0
  319. package/claude-assets/skills/cfn-loop-orchestration/TYPESCRIPT_INTEGRATION_SUMMARY.md +257 -0
  320. package/claude-assets/skills/cfn-loop-orchestration/VALIDATION_REPORT.md +572 -0
  321. package/claude-assets/skills/cfn-loop-orchestration/VALIDATION_SUMMARY.txt +196 -0
  322. package/claude-assets/skills/cfn-loop-orchestration/VALIDATOR_MODULE_GUIDE.md +526 -0
  323. package/claude-assets/skills/cfn-loop-orchestration/archive/legacy-bash/README.md +167 -0
  324. package/claude-assets/skills/cfn-loop-orchestration/archive/legacy-bash/orchestrate-enhanced.sh +548 -0
  325. package/claude-assets/skills/cfn-loop-orchestration/{orchestrate-wrapper.sh → archive/legacy-bash/orchestrate-wrapper.sh} +11 -1
  326. package/claude-assets/skills/cfn-loop-orchestration/archive/legacy-bash/orchestrate.sh +182 -0
  327. package/claude-assets/skills/cfn-loop-orchestration/e2e-validation-fixed.js +240 -0
  328. package/claude-assets/skills/cfn-loop-orchestration/e2e-validation.js +213 -0
  329. package/claude-assets/skills/cfn-loop-orchestration/package-lock.json +3 -0
  330. package/claude-assets/skills/cfn-loop-orchestration/package.json +4 -0
  331. package/claude-assets/skills/cfn-loop-orchestration/run-north-star-e2e.ts +210 -0
  332. package/claude-assets/skills/cfn-loop-orchestration/src/cli/orchestrator-cli.ts +396 -0
  333. package/claude-assets/skills/cfn-loop-orchestration/src/helpers/CONFIDENCE_AGGREGATOR.md +564 -0
  334. package/claude-assets/skills/cfn-loop-orchestration/src/helpers/CONFIDENCE_AGGREGATOR_QUICK_REF.md +241 -0
  335. package/claude-assets/skills/cfn-loop-orchestration/src/helpers/CONTEXT_INJECTOR_IMPLEMENTATION.md +375 -0
  336. package/claude-assets/skills/cfn-loop-orchestration/src/helpers/CONTEXT_INJECTOR_QUICK_REFERENCE.md +362 -0
  337. package/claude-assets/skills/cfn-loop-orchestration/src/helpers/CONTEXT_INJECTOR_README.md +307 -0
  338. package/claude-assets/skills/cfn-loop-orchestration/src/helpers/CONTEXT_INJECTOR_USAGE_GUIDE.md +508 -0
  339. package/claude-assets/skills/cfn-loop-orchestration/src/helpers/confidence-aggregator.ts +473 -0
  340. package/claude-assets/skills/cfn-loop-orchestration/src/helpers/consensus.ts +1 -1
  341. package/claude-assets/skills/cfn-loop-orchestration/src/helpers/context-injector.ts +349 -0
  342. package/claude-assets/skills/cfn-loop-orchestration/src/helpers/context-lookup.ts +486 -0
  343. package/claude-assets/skills/cfn-loop-orchestration/src/helpers/deliverable-verifier.ts +6 -2
  344. package/claude-assets/skills/cfn-loop-orchestration/src/helpers/gate-check.ts +1 -1
  345. package/claude-assets/skills/cfn-loop-orchestration/src/helpers/product-owner-decision.ts +316 -0
  346. package/claude-assets/skills/cfn-loop-orchestration/src/helpers/spawn-agents.ts +357 -0
  347. package/claude-assets/skills/cfn-loop-orchestration/src/helpers/validator.ts +276 -0
  348. package/claude-assets/skills/cfn-loop-orchestration/src/index.ts +2 -0
  349. package/claude-assets/skills/cfn-loop-orchestration/src/orchestrate.ts +743 -2
  350. package/claude-assets/skills/cfn-loop-orchestration/src/types.ts +56 -0
  351. package/claude-assets/skills/cfn-loop-orchestration/test-cli.sh +92 -0
  352. package/claude-assets/skills/cfn-loop-orchestration/test-typescript-integration.sh +442 -0
  353. package/claude-assets/skills/cfn-loop-orchestration/tests/agent-spawner.test.ts +124 -0
  354. package/claude-assets/skills/cfn-loop-orchestration/tests/confidence-aggregator.test.ts +604 -0
  355. package/claude-assets/skills/cfn-loop-orchestration/tests/context-injector.test.ts +561 -0
  356. package/claude-assets/skills/cfn-loop-orchestration/tests/context-lookup.test.ts +661 -0
  357. package/claude-assets/skills/cfn-loop-orchestration/tests/deliverable-verifier.test.ts +2 -2
  358. package/claude-assets/skills/cfn-loop-orchestration/tests/gate-check-edge-cases.test.ts +422 -0
  359. package/claude-assets/skills/cfn-loop-orchestration/tests/gate-checker.test.ts +276 -0
  360. package/claude-assets/skills/cfn-loop-orchestration/tests/logger.test.ts +291 -0
  361. package/claude-assets/skills/cfn-loop-orchestration/tests/north-star-e2e.test.ts +334 -0
  362. package/claude-assets/skills/cfn-loop-orchestration/tests/redis-coordinator.test.ts +321 -0
  363. package/claude-assets/skills/cfn-loop-orchestration/tests/spawn-agents.test.ts +284 -0
  364. package/claude-assets/skills/cfn-loop-orchestration/tests/validator.test.ts +643 -0
  365. package/claude-assets/skills/cfn-loop-output-processing/.eslintrc.json +33 -0
  366. package/claude-assets/skills/cfn-loop-output-processing/DELIVERY_SUMMARY.txt +462 -0
  367. package/claude-assets/skills/cfn-loop-output-processing/DEPRECATION_NOTICE.md +183 -0
  368. package/claude-assets/skills/cfn-loop-output-processing/EXAMPLES.md +609 -0
  369. package/claude-assets/skills/cfn-loop-output-processing/IMPLEMENTATION_SUMMARY.md +418 -0
  370. package/claude-assets/skills/cfn-loop-output-processing/INDEX.md +531 -0
  371. package/claude-assets/skills/cfn-loop-output-processing/MIGRATION.md +362 -0
  372. package/claude-assets/skills/cfn-loop-output-processing/README.md +114 -0
  373. package/claude-assets/skills/cfn-loop-output-processing/SKILL.md +633 -0
  374. package/{.claude/skills/cfn-docker-redis-coordination → claude-assets/skills/cfn-loop-output-processing}/jest.config.js +7 -15
  375. package/claude-assets/skills/cfn-loop-output-processing/package.json +50 -0
  376. package/claude-assets/skills/cfn-loop-output-processing/src/cli/process-loop2.ts +195 -0
  377. package/claude-assets/skills/cfn-loop-output-processing/src/cli/process-loop3.ts +157 -0
  378. package/claude-assets/skills/cfn-loop-output-processing/src/output-processor.ts +632 -0
  379. package/claude-assets/skills/cfn-loop-output-processing/tests/output-processor.test.ts +617 -0
  380. package/claude-assets/skills/{cfn-docker-redis-coordination → cfn-loop-output-processing}/tsconfig.json +16 -7
  381. package/claude-assets/skills/cfn-loop-validation/IMPLEMENTATION_SUMMARY.md +672 -0
  382. package/claude-assets/skills/cfn-loop-validation/INDEX.md +531 -0
  383. package/claude-assets/skills/cfn-loop-validation/README_TYPESCRIPT.md +454 -0
  384. package/claude-assets/skills/cfn-loop-validation/SKILL.md +48 -1
  385. package/claude-assets/skills/cfn-loop-validation/SKILL.md.backup +353 -0
  386. package/claude-assets/skills/cfn-loop-validation/SKILL_TYPESCRIPT.md +782 -0
  387. package/claude-assets/skills/cfn-loop-validation/VAPOR_DETECTION_EXAMPLES.md +598 -0
  388. package/claude-assets/skills/cfn-loop-validation/check-dependencies.sh +22 -0
  389. package/claude-assets/skills/cfn-loop-validation/check-dependencies.sh.backup +31 -0
  390. package/claude-assets/skills/cfn-loop-validation/detect-vapor.sh +59 -0
  391. package/claude-assets/skills/cfn-loop-validation/detect-vapor.sh.backup +37 -0
  392. package/claude-assets/skills/cfn-loop-validation/dist/.tsbuildinfo +1 -0
  393. package/claude-assets/skills/cfn-loop-validation/dist/cli/detect-vapor.d.ts +14 -0
  394. package/claude-assets/skills/cfn-loop-validation/dist/cli/detect-vapor.d.ts.map +1 -0
  395. package/claude-assets/skills/cfn-loop-validation/dist/cli/detect-vapor.js +185 -0
  396. package/claude-assets/skills/cfn-loop-validation/dist/cli/detect-vapor.js.map +1 -0
  397. package/claude-assets/skills/cfn-loop-validation/dist/cli/validate-deliverables.d.ts +14 -0
  398. package/claude-assets/skills/cfn-loop-validation/dist/cli/validate-deliverables.d.ts.map +1 -0
  399. package/claude-assets/skills/cfn-loop-validation/dist/cli/validate-deliverables.js +176 -0
  400. package/claude-assets/skills/cfn-loop-validation/dist/cli/validate-deliverables.js.map +1 -0
  401. package/claude-assets/skills/cfn-loop-validation/dist/cli/validate-gate.d.ts +19 -0
  402. package/claude-assets/skills/cfn-loop-validation/dist/cli/validate-gate.d.ts.map +1 -0
  403. package/claude-assets/skills/cfn-loop-validation/dist/cli/validate-gate.js +123 -0
  404. package/claude-assets/skills/cfn-loop-validation/dist/cli/validate-gate.js.map +1 -0
  405. package/claude-assets/skills/cfn-loop-validation/dist/types.d.ts +156 -0
  406. package/claude-assets/skills/cfn-loop-validation/dist/types.d.ts.map +1 -0
  407. package/claude-assets/skills/cfn-loop-validation/dist/types.js +66 -0
  408. package/claude-assets/skills/cfn-loop-validation/dist/types.js.map +1 -0
  409. package/claude-assets/skills/cfn-loop-validation/dist/validator.d.ts +85 -0
  410. package/claude-assets/skills/cfn-loop-validation/dist/validator.d.ts.map +1 -0
  411. package/claude-assets/skills/cfn-loop-validation/dist/validator.js +411 -0
  412. package/claude-assets/skills/cfn-loop-validation/dist/validator.js.map +1 -0
  413. package/claude-assets/skills/cfn-loop-validation/orchestrate-cfn-loop.sh +22 -0
  414. package/claude-assets/skills/cfn-loop-validation/orchestrate-cfn-loop.sh.backup +252 -0
  415. package/claude-assets/skills/cfn-loop-validation/package.json +93 -0
  416. package/claude-assets/skills/cfn-loop-validation/src/cli/detect-vapor.ts +177 -0
  417. package/claude-assets/skills/cfn-loop-validation/src/cli/validate-deliverables.ts +161 -0
  418. package/claude-assets/skills/cfn-loop-validation/src/cli/validate-gate.ts +139 -0
  419. package/claude-assets/skills/cfn-loop-validation/src/types.ts +215 -0
  420. package/claude-assets/skills/cfn-loop-validation/src/validator.ts +503 -0
  421. package/claude-assets/skills/cfn-loop-validation/tests/validator.test.ts +537 -0
  422. package/claude-assets/skills/{cfn-redis-coordination → cfn-loop-validation}/tsconfig.json +34 -31
  423. package/claude-assets/skills/cfn-loop-validation/validate-deliverables.sh +59 -0
  424. package/claude-assets/skills/cfn-loop-validation/validate-deliverables.sh.backup +37 -0
  425. package/claude-assets/skills/cfn-loop-validation/validate-gate.sh +63 -0
  426. package/claude-assets/skills/cfn-loop-validation/validate-gate.sh.backup +41 -0
  427. package/claude-assets/skills/cfn-loop-validation/validate-iteration.sh +22 -0
  428. package/claude-assets/skills/cfn-loop-validation/validate-iteration.sh.backup +134 -0
  429. package/claude-assets/skills/cfn-product-owner-decision/SKILL.md +479 -147
  430. package/claude-assets/skills/cfn-product-owner-decision/TYPESCRIPT_IMPLEMENTATION.md +653 -0
  431. package/claude-assets/skills/cfn-product-owner-decision/{execute-decision.sh → archive/legacy-bash/execute-decision.sh} +24 -2
  432. package/claude-assets/skills/cfn-provider-routing/README.md +129 -0
  433. package/claude-assets/skills/cfn-provider-routing/SKILL.md +215 -0
  434. package/claude-assets/skills/cfn-provider-routing/resolve-provider-model.ts +223 -0
  435. package/claude-assets/skills/docker-build/build.sh +1 -1
  436. package/claude-assets/skills/pre-edit-backup/SKILL.md +324 -0
  437. package/claude-assets/skills/pre-edit-backup/SKILL.md.backup +277 -0
  438. package/claude-assets/skills/pre-edit-backup/backup.sh +22 -0
  439. package/claude-assets/skills/pre-edit-backup/backup.sh.backup +107 -0
  440. package/dist/agent/skill-mcp-selector.js +2 -1
  441. package/dist/agent/skill-mcp-selector.js.map +1 -1
  442. package/dist/api/auth-endpoints.js +415 -0
  443. package/dist/api/auth-endpoints.js.map +1 -0
  444. package/dist/api/task-endpoints.js +562 -0
  445. package/dist/api/task-endpoints.js.map +1 -0
  446. package/dist/backend/server.js +418 -0
  447. package/dist/backend/server.js.map +1 -0
  448. package/dist/cfn-loop/product-owner/decision-parser.js +356 -0
  449. package/dist/cfn-loop/product-owner/decision-parser.js.map +1 -0
  450. package/dist/cfn-loop/product-owner/index.js +1 -0
  451. package/dist/cfn-loop/product-owner/index.js.map +1 -1
  452. package/dist/cli/agent-command.js +1 -1
  453. package/dist/cli/agent-command.js.map +1 -1
  454. package/dist/cli/agent-completion.js +273 -0
  455. package/dist/cli/agent-completion.js.map +1 -0
  456. package/dist/cli/agent-executor.js +470 -26
  457. package/dist/cli/agent-executor.js.map +1 -1
  458. package/dist/cli/agent-prompt-builder.js +83 -48
  459. package/dist/cli/agent-prompt-builder.js.map +1 -1
  460. package/dist/cli/agent-spawn.js +7 -4
  461. package/dist/cli/agent-spawn.js.map +1 -1
  462. package/dist/cli/agent-spawner.js +546 -0
  463. package/dist/cli/agent-spawner.js.map +1 -0
  464. package/dist/cli/agent-token-manager.js +2 -1
  465. package/dist/cli/agent-token-manager.js.map +1 -1
  466. package/dist/cli/anthropic-client.js +127 -14
  467. package/dist/cli/anthropic-client.js.map +1 -1
  468. package/dist/cli/cfn-context.js +2 -1
  469. package/dist/cli/cfn-context.js.map +1 -1
  470. package/dist/cli/cfn-metrics.js +2 -1
  471. package/dist/cli/cfn-metrics.js.map +1 -1
  472. package/dist/cli/cfn-redis.js +2 -1
  473. package/dist/cli/cfn-redis.js.map +1 -1
  474. package/dist/cli/cli-agent-context.js +2 -0
  475. package/dist/cli/cli-agent-context.js.map +1 -1
  476. package/dist/cli/config-manager.js +90 -356
  477. package/dist/cli/config-manager.js.map +1 -1
  478. package/dist/cli/conversation-fork-cleanup.js +2 -1
  479. package/dist/cli/conversation-fork-cleanup.js.map +1 -1
  480. package/dist/cli/conversation-fork.js +2 -1
  481. package/dist/cli/conversation-fork.js.map +1 -1
  482. package/dist/cli/coordination/agent-messaging.js +415 -0
  483. package/dist/cli/coordination/agent-messaging.js.map +1 -0
  484. package/dist/cli/coordination/wait-for-threshold.js +232 -0
  485. package/dist/cli/coordination/wait-for-threshold.js.map +1 -0
  486. package/dist/cli/index.js +11 -0
  487. package/dist/cli/index.js.map +1 -1
  488. package/dist/cli/iteration-history.js +2 -1
  489. package/dist/cli/iteration-history.js.map +1 -1
  490. package/dist/cli/parse-decision-cli.js +268 -0
  491. package/dist/cli/parse-decision-cli.js.map +1 -0
  492. package/dist/cli/post-edit-hook.js +83 -0
  493. package/dist/cli/post-edit-hook.js.map +1 -0
  494. package/dist/cli/pre-edit-hook.js +77 -0
  495. package/dist/cli/pre-edit-hook.js.map +1 -0
  496. package/dist/cli/process-lifecycle.js +5 -1
  497. package/dist/cli/process-lifecycle.js.map +1 -1
  498. package/dist/cli/spawn-agent-cli.js +244 -0
  499. package/dist/cli/spawn-agent-cli.js.map +1 -0
  500. package/dist/coordination/coordination-wrapper.js +383 -0
  501. package/dist/coordination/coordination-wrapper.js.map +1 -0
  502. package/dist/coordination/redis-waiting-mode.js +4 -0
  503. package/dist/coordination/redis-waiting-mode.js.map +1 -1
  504. package/dist/coordination/store-success-criteria.js +68 -0
  505. package/dist/coordination/store-success-criteria.js.map +1 -0
  506. package/dist/coordination/store-task-context.js +65 -0
  507. package/dist/coordination/store-task-context.js.map +1 -0
  508. package/dist/hooks/backup-manager.js +273 -0
  509. package/dist/hooks/backup-manager.js.map +1 -0
  510. package/dist/hooks/post-edit-validator.js +388 -0
  511. package/dist/hooks/post-edit-validator.js.map +1 -0
  512. package/dist/integration/index.js +19 -0
  513. package/dist/integration/index.js.map +1 -0
  514. package/dist/integration/task-mode-adapter.js +297 -0
  515. package/dist/integration/task-mode-adapter.js.map +1 -0
  516. package/dist/integration/trigger-dev-client.js +253 -0
  517. package/dist/integration/trigger-dev-client.js.map +1 -0
  518. package/dist/integration/trigger-dev-webhooks.js +362 -0
  519. package/dist/integration/trigger-dev-webhooks.js.map +1 -0
  520. package/dist/lib/artifact-registry.js +4 -0
  521. package/dist/lib/artifact-registry.js.map +1 -1
  522. package/dist/lib/connection-pool.js +390 -0
  523. package/dist/lib/connection-pool.js.map +1 -0
  524. package/dist/lib/environment-contract.js +258 -0
  525. package/dist/lib/environment-contract.js.map +1 -0
  526. package/dist/lib/path-validator.js +14 -5
  527. package/dist/lib/path-validator.js.map +1 -1
  528. package/dist/lib/query-optimizer.js +388 -0
  529. package/dist/lib/query-optimizer.js.map +1 -0
  530. package/dist/lib/redis-queue-manager.js +5 -1
  531. package/dist/lib/redis-queue-manager.js.map +1 -1
  532. package/dist/lib/result-cache.js +285 -0
  533. package/dist/lib/result-cache.js.map +1 -0
  534. package/dist/mcp/auth-middleware.js +2 -1
  535. package/dist/mcp/auth-middleware.js.map +1 -1
  536. package/dist/mcp/playwright-mcp-server-auth.js +2 -1
  537. package/dist/mcp/playwright-mcp-server-auth.js.map +1 -1
  538. package/dist/middleware/authentication.js +317 -0
  539. package/dist/middleware/authentication.js.map +1 -0
  540. package/dist/services/authentication.js +669 -0
  541. package/dist/services/authentication.js.map +1 -0
  542. package/dist/services/session-management.js +436 -0
  543. package/dist/services/session-management.js.map +1 -0
  544. package/dist/services/skill-deployment.js +8 -6
  545. package/dist/services/skill-deployment.js.map +1 -1
  546. package/dist/services/user-service.js +710 -0
  547. package/dist/services/user-service.js.map +1 -0
  548. package/dist/types/trigger-dev-events.d.js +10 -0
  549. package/dist/types/trigger-dev-events.d.js.map +1 -0
  550. package/docs/README.md +240 -0
  551. package/package.json +15 -4
  552. package/scripts/build-agent-image.sh +1 -1
  553. package/scripts/compare-workflow-performance.sh +556 -0
  554. package/scripts/cost-allocation-tracker.sh +632 -0
  555. package/scripts/docker-rebuild-all-agents.sh +2 -2
  556. package/scripts/migrate-to-optimized-workflows.sh +438 -0
  557. package/scripts/organize-docs.sh +338 -0
  558. package/scripts/reorganize-tests.sh +280 -0
  559. package/scripts/trigger-dev-setup.sh +279 -0
  560. package/tests/README.md +45 -0
  561. package/.claude/commands/cost-savings-status.md +0 -34
  562. package/.claude/commands/metrics-summary.md +0 -58
  563. package/.claude/skills/cfn-docker-redis-coordination/MIGRATION_SUMMARY.md +0 -348
  564. package/.claude/skills/cfn-docker-redis-coordination/README.md +0 -294
  565. package/.claude/skills/cfn-docker-redis-coordination/SKILL.md +0 -435
  566. package/.claude/skills/cfn-docker-redis-coordination/coordinate.sh +0 -650
  567. package/.claude/skills/cfn-docker-redis-coordination/coordinate.sh.backup-1763145142 +0 -641
  568. package/.claude/skills/cfn-docker-redis-coordination/package-lock.json +0 -5259
  569. package/.claude/skills/cfn-docker-redis-coordination/package.json +0 -40
  570. package/.claude/skills/cfn-docker-redis-coordination/src/coordinator.ts +0 -801
  571. package/.claude/skills/cfn-docker-redis-coordination/src/index.ts +0 -42
  572. package/.claude/skills/cfn-docker-redis-coordination/src/types.ts +0 -351
  573. package/.claude/skills/cfn-docker-redis-coordination/tests/coordinator.test.ts +0 -1464
  574. package/.claude/skills/cfn-docker-redis-coordination/tsconfig.json +0 -30
  575. package/.claude/skills/cfn-loop-orchestration/helpers/auto-tune-timeouts.sh +0 -228
  576. package/.claude/skills/cfn-loop-orchestration/helpers/consensus-ts.sh +0 -104
  577. package/.claude/skills/cfn-loop-orchestration/helpers/consensus.sh +0 -94
  578. package/.claude/skills/cfn-loop-orchestration/helpers/context-injection.sh +0 -142
  579. package/.claude/skills/cfn-loop-orchestration/helpers/context-lookup.sh +0 -359
  580. package/.claude/skills/cfn-loop-orchestration/helpers/deliverable-verifier-ts.sh +0 -123
  581. package/.claude/skills/cfn-loop-orchestration/helpers/deliverable-verifier.sh +0 -71
  582. package/.claude/skills/cfn-loop-orchestration/helpers/gate-check.sh +0 -56
  583. package/.claude/skills/cfn-loop-orchestration/helpers/iteration-manager-ts.sh +0 -89
  584. package/.claude/skills/cfn-loop-orchestration/helpers/iteration-manager.sh +0 -87
  585. package/.claude/skills/cfn-loop-orchestration/helpers/orchestrate-ts.sh +0 -104
  586. package/.claude/skills/cfn-loop-orchestration/helpers/parse-test-results.sh +0 -56
  587. package/.claude/skills/cfn-loop-orchestration/helpers/spawn-agents.sh +0 -290
  588. package/.claude/skills/cfn-loop-orchestration/helpers/timeout-calculator-ts.sh +0 -47
  589. package/.claude/skills/cfn-loop-orchestration/helpers/timeout-calculator.sh +0 -51
  590. package/.claude/skills/cfn-loop-orchestration/orchestrate.sh +0 -1345
  591. package/.claude/skills/cfn-redis-coordination/AGENT_LOGGING.md +0 -280
  592. package/.claude/skills/cfn-redis-coordination/BZPOPMIN_FIX_SUMMARY.md +0 -209
  593. package/.claude/skills/cfn-redis-coordination/CENTRALIZED_REDIS_WRAPPER.md +0 -319
  594. package/.claude/skills/cfn-redis-coordination/agent-log.sh.bak +0 -124
  595. package/.claude/skills/cfn-redis-coordination/config.json +0 -61
  596. package/.claude/skills/cfn-redis-coordination/demos/phase4-wake-queue-test-report.md +0 -82
  597. package/.claude/skills/cfn-redis-coordination/demos/test-bzpopmin-fix.sh +0 -274
  598. package/.claude/skills/cfn-redis-coordination/demos/test-cancel-swarm.sh +0 -0
  599. package/.claude/skills/cfn-redis-coordination/docs/migration/PHASE_3_REDIS_COORDINATION_COMPLETION_REPORT.md +0 -553
  600. package/.claude/skills/cfn-redis-coordination/jest.config.js +0 -23
  601. package/.claude/skills/cfn-redis-coordination/package-lock.json +0 -5272
  602. package/.claude/skills/cfn-redis-coordination/package.json +0 -45
  603. package/.claude/skills/cfn-redis-coordination/src/agent-logger.ts +0 -446
  604. package/.claude/skills/cfn-redis-coordination/src/agent-recovery.ts +0 -454
  605. package/.claude/skills/cfn-redis-coordination/src/completion-reporter.ts +0 -396
  606. package/.claude/skills/cfn-redis-coordination/src/context-manager.ts +0 -327
  607. package/.claude/skills/cfn-redis-coordination/src/index.ts +0 -82
  608. package/.claude/skills/cfn-redis-coordination/src/mode-detector.ts +0 -155
  609. package/.claude/skills/cfn-redis-coordination/src/redis/redis-client.ts +0 -305
  610. package/.claude/skills/cfn-redis-coordination/src/redis/redis-functions.ts +0 -283
  611. package/.claude/skills/cfn-redis-coordination/src/redis-client.ts +0 -654
  612. package/.claude/skills/cfn-redis-coordination/src/result-collector.ts +0 -437
  613. package/.claude/skills/cfn-redis-coordination/src/swarm-manager.ts +0 -494
  614. package/.claude/skills/cfn-redis-coordination/src/task-analyzer.ts +0 -404
  615. package/.claude/skills/cfn-redis-coordination/src/task-executor.ts +0 -423
  616. package/.claude/skills/cfn-redis-coordination/src/types.ts +0 -235
  617. package/.claude/skills/cfn-redis-coordination/src/waiting-coordinator.ts +0 -587
  618. package/.claude/skills/cfn-redis-coordination/store-success-criteria.sh +0 -85
  619. package/.claude/skills/cfn-redis-coordination/test-connection-attempts.js +0 -70
  620. package/.claude/skills/cfn-redis-coordination/test-mode-simple.js +0 -121
  621. package/.claude/skills/cfn-redis-coordination/test-redis-check.js +0 -84
  622. package/.claude/skills/cfn-redis-coordination/test-task-mode-redis.cjs +0 -391
  623. package/.claude/skills/cfn-redis-coordination/tests/coordination.test.ts +0 -788
  624. package/.claude/skills/cfn-redis-coordination/update-all-scripts.sh +0 -67
  625. package/claude-assets/agents/cfn-dev-team/coordinators/cfn-v3-coordinator.md +0 -980
  626. package/claude-assets/agents/cfn-dev-team/dev-ops/monitoring-specialist.md +0 -759
  627. package/claude-assets/agents/custom/test-mcp-access.md +0 -24
  628. package/claude-assets/agents/typescript-specialist.md +0 -280
  629. package/claude-assets/commands/cost-savings-status.md +0 -34
  630. package/claude-assets/commands/metrics-summary.md +0 -58
  631. package/claude-assets/skills/cfn-docker-redis-coordination/MIGRATION_SUMMARY.md +0 -348
  632. package/claude-assets/skills/cfn-docker-redis-coordination/README.md +0 -294
  633. package/claude-assets/skills/cfn-docker-redis-coordination/SKILL.md +0 -435
  634. package/claude-assets/skills/cfn-docker-redis-coordination/coordinate.sh +0 -650
  635. package/claude-assets/skills/cfn-docker-redis-coordination/coordinate.sh.backup-1763145142 +0 -641
  636. package/claude-assets/skills/cfn-docker-redis-coordination/jest.config.js +0 -37
  637. package/claude-assets/skills/cfn-docker-redis-coordination/package-lock.json +0 -5259
  638. package/claude-assets/skills/cfn-docker-redis-coordination/package.json +0 -40
  639. package/claude-assets/skills/cfn-docker-redis-coordination/src/coordinator.ts +0 -801
  640. package/claude-assets/skills/cfn-docker-redis-coordination/src/index.ts +0 -42
  641. package/claude-assets/skills/cfn-docker-redis-coordination/src/types.ts +0 -351
  642. package/claude-assets/skills/cfn-docker-redis-coordination/tests/coordinator.test.ts +0 -1464
  643. package/claude-assets/skills/cfn-loop-orchestration/helpers/auto-tune-timeouts.sh +0 -228
  644. package/claude-assets/skills/cfn-loop-orchestration/helpers/consensus-ts.sh +0 -104
  645. package/claude-assets/skills/cfn-loop-orchestration/helpers/consensus.sh +0 -94
  646. package/claude-assets/skills/cfn-loop-orchestration/helpers/context-injection.sh +0 -142
  647. package/claude-assets/skills/cfn-loop-orchestration/helpers/context-lookup.sh +0 -359
  648. package/claude-assets/skills/cfn-loop-orchestration/helpers/deliverable-verifier-ts.sh +0 -123
  649. package/claude-assets/skills/cfn-loop-orchestration/helpers/deliverable-verifier.sh +0 -71
  650. package/claude-assets/skills/cfn-loop-orchestration/helpers/gate-check.sh +0 -56
  651. package/claude-assets/skills/cfn-loop-orchestration/helpers/iteration-manager-ts.sh +0 -89
  652. package/claude-assets/skills/cfn-loop-orchestration/helpers/iteration-manager.sh +0 -87
  653. package/claude-assets/skills/cfn-loop-orchestration/helpers/orchestrate-ts.sh +0 -104
  654. package/claude-assets/skills/cfn-loop-orchestration/helpers/parse-test-results.sh +0 -56
  655. package/claude-assets/skills/cfn-loop-orchestration/helpers/spawn-agents.sh +0 -290
  656. package/claude-assets/skills/cfn-loop-orchestration/helpers/timeout-calculator-ts.sh +0 -47
  657. package/claude-assets/skills/cfn-loop-orchestration/helpers/timeout-calculator.sh +0 -51
  658. package/claude-assets/skills/cfn-loop-orchestration/orchestrate.sh +0 -1345
  659. package/claude-assets/skills/cfn-redis-cleanup/cleanup-redis.sh +0 -130
  660. package/claude-assets/skills/cfn-redis-coordination/AGENT_LOGGING.md +0 -280
  661. package/claude-assets/skills/cfn-redis-coordination/BZPOPMIN_FIX_SUMMARY.md +0 -209
  662. package/claude-assets/skills/cfn-redis-coordination/CENTRALIZED_REDIS_WRAPPER.md +0 -319
  663. package/claude-assets/skills/cfn-redis-coordination/agent-log.sh.bak +0 -124
  664. package/claude-assets/skills/cfn-redis-coordination/config.json +0 -61
  665. package/claude-assets/skills/cfn-redis-coordination/demos/phase4-wake-queue-test-report.md +0 -82
  666. package/claude-assets/skills/cfn-redis-coordination/demos/test-bzpopmin-fix.sh +0 -274
  667. package/claude-assets/skills/cfn-redis-coordination/demos/test-cancel-swarm.sh +0 -0
  668. package/claude-assets/skills/cfn-redis-coordination/docs/migration/PHASE_3_REDIS_COORDINATION_COMPLETION_REPORT.md +0 -553
  669. package/claude-assets/skills/cfn-redis-coordination/jest.config.js +0 -23
  670. package/claude-assets/skills/cfn-redis-coordination/package-lock.json +0 -5272
  671. package/claude-assets/skills/cfn-redis-coordination/package.json +0 -45
  672. package/claude-assets/skills/cfn-redis-coordination/src/agent-logger.ts +0 -446
  673. package/claude-assets/skills/cfn-redis-coordination/src/agent-recovery.ts +0 -454
  674. package/claude-assets/skills/cfn-redis-coordination/src/completion-reporter.ts +0 -396
  675. package/claude-assets/skills/cfn-redis-coordination/src/context-manager.ts +0 -327
  676. package/claude-assets/skills/cfn-redis-coordination/src/index.ts +0 -82
  677. package/claude-assets/skills/cfn-redis-coordination/src/mode-detector.ts +0 -155
  678. package/claude-assets/skills/cfn-redis-coordination/src/redis/redis-client.ts +0 -305
  679. package/claude-assets/skills/cfn-redis-coordination/src/redis/redis-functions.ts +0 -283
  680. package/claude-assets/skills/cfn-redis-coordination/src/redis-client.ts +0 -654
  681. package/claude-assets/skills/cfn-redis-coordination/src/result-collector.ts +0 -437
  682. package/claude-assets/skills/cfn-redis-coordination/src/swarm-manager.ts +0 -494
  683. package/claude-assets/skills/cfn-redis-coordination/src/task-analyzer.ts +0 -404
  684. package/claude-assets/skills/cfn-redis-coordination/src/task-executor.ts +0 -423
  685. package/claude-assets/skills/cfn-redis-coordination/src/types.ts +0 -235
  686. package/claude-assets/skills/cfn-redis-coordination/src/waiting-coordinator.ts +0 -587
  687. package/claude-assets/skills/cfn-redis-coordination/store-success-criteria.sh +0 -85
  688. package/claude-assets/skills/cfn-redis-coordination/test-connection-attempts.js +0 -70
  689. package/claude-assets/skills/cfn-redis-coordination/test-mode-simple.js +0 -121
  690. package/claude-assets/skills/cfn-redis-coordination/test-redis-check.js +0 -84
  691. package/claude-assets/skills/cfn-redis-coordination/test-task-mode-redis.cjs +0 -391
  692. package/claude-assets/skills/cfn-redis-coordination/tests/coordination.test.ts +0 -788
  693. package/claude-assets/skills/cfn-redis-coordination/update-all-scripts.sh +0 -67
  694. package/claude-assets/skills/cfn-redis-data-extraction/SKILL.md +0 -442
  695. package/claude-assets/skills/cfn-redis-data-extraction/extract.sh +0 -306
  696. package/dist/coordination/index.js +0 -25
  697. package/dist/coordination/index.js.map +0 -1
  698. package/docs/BUG_19_MEMORY_LEAK_TASK_MODE.md +0 -405
  699. package/docs/MEMORY_CLEANUP_GUIDE.md +0 -358
  700. package/docs/MEMORY_LEAK_FIX_SUMMARY.md +0 -322
  701. package/docs/REDIS_CLEANUP_EXECUTIVE_SUMMARY.md +0 -319
  702. package/docs/REDIS_CLEANUP_VERIFICATION_REPORT.md +0 -574
  703. package/tests/test-memory-leak-task-mode.sh +0 -435
  704. /package/.claude/skills/cfn-loop-orchestration/{inject-loop-context.sh → archive/legacy-bash/inject-loop-context.sh} +0 -0
  705. /package/.claude/skills/cfn-loop-orchestration/{monitor-execution.sh → archive/legacy-bash/monitor-execution.sh} +0 -0
  706. /package/.claude/skills/cfn-redis-coordination/{agent-log.sh → agent-log.sh.backup} +0 -0
  707. /package/.claude/skills/cfn-redis-coordination/{agent-recovery.sh → agent-recovery.sh.backup} +0 -0
  708. /package/.claude/skills/cfn-redis-coordination/{analyze-task-complexity.sh → analyze-task-complexity.sh.backup} +0 -0
  709. /package/.claude/skills/cfn-redis-coordination/bash-wrappers/{store-context.sh → store-context.sh.backup} +0 -0
  710. /package/.claude/skills/cfn-redis-coordination/{cancel-swarm.sh → cancel-swarm.sh.backup} +0 -0
  711. /package/.claude/skills/cfn-redis-coordination/{cfn-loop-exec.sh → cfn-loop-exec.sh.backup} +0 -0
  712. /package/.claude/skills/cfn-redis-coordination/{cfn-loop-relaunch.sh → cfn-loop-relaunch.sh.backup} +0 -0
  713. /package/.claude/skills/cfn-redis-coordination/{collect-confidence-scores.sh → collect-confidence-scores.sh.backup} +0 -0
  714. /package/.claude/skills/cfn-redis-coordination/{collect-results.sh → collect-results.sh.backup} +0 -0
  715. /package/.claude/skills/cfn-redis-coordination/{complete-swarm.sh → complete-swarm.sh.backup} +0 -0
  716. /package/.claude/skills/cfn-redis-coordination/{get-context.sh → get-context.sh.backup} +0 -0
  717. /package/.claude/skills/cfn-redis-coordination/{get-success-criteria.sh → get-success-criteria.sh.backup} +0 -0
  718. /package/.claude/skills/cfn-redis-coordination/{invoke-waiting-mode.sh → invoke-waiting-mode.sh.backup} +0 -0
  719. /package/.claude/skills/cfn-redis-coordination/{redis-cli-wrapper.sh → redis-cli-wrapper.sh.backup} +0 -0
  720. /package/.claude/skills/cfn-redis-coordination/{redis-functions.sh → redis-functions.sh.backup} +0 -0
  721. /package/.claude/skills/cfn-redis-coordination/{report-completion.sh → report-completion.sh.backup} +0 -0
  722. /package/.claude/skills/cfn-redis-coordination/{store-context.sh → store-context.sh.backup} +0 -0
  723. /package/claude-assets/skills/cfn-loop-orchestration/{inject-loop-context.sh → archive/legacy-bash/inject-loop-context.sh} +0 -0
  724. /package/claude-assets/skills/cfn-loop-orchestration/{monitor-execution.sh → archive/legacy-bash/monitor-execution.sh} +0 -0
  725. /package/claude-assets/skills/cfn-redis-coordination/{agent-log.sh → agent-log.sh.backup} +0 -0
  726. /package/claude-assets/skills/cfn-redis-coordination/{agent-recovery.sh → agent-recovery.sh.backup} +0 -0
  727. /package/claude-assets/skills/cfn-redis-coordination/{analyze-task-complexity.sh → analyze-task-complexity.sh.backup} +0 -0
  728. /package/claude-assets/skills/cfn-redis-coordination/bash-wrappers/{store-context.sh → store-context.sh.backup} +0 -0
  729. /package/claude-assets/skills/cfn-redis-coordination/{cancel-swarm.sh → cancel-swarm.sh.backup} +0 -0
  730. /package/claude-assets/skills/cfn-redis-coordination/{cfn-loop-exec.sh → cfn-loop-exec.sh.backup} +0 -0
  731. /package/claude-assets/skills/cfn-redis-coordination/{cfn-loop-relaunch.sh → cfn-loop-relaunch.sh.backup} +0 -0
  732. /package/claude-assets/skills/cfn-redis-coordination/{collect-confidence-scores.sh → collect-confidence-scores.sh.backup} +0 -0
  733. /package/claude-assets/skills/cfn-redis-coordination/{collect-results.sh → collect-results.sh.backup} +0 -0
  734. /package/claude-assets/skills/cfn-redis-coordination/{complete-swarm.sh → complete-swarm.sh.backup} +0 -0
  735. /package/claude-assets/skills/cfn-redis-coordination/{get-context.sh → get-context.sh.backup} +0 -0
  736. /package/claude-assets/skills/cfn-redis-coordination/{get-success-criteria.sh → get-success-criteria.sh.backup} +0 -0
  737. /package/claude-assets/skills/cfn-redis-coordination/{invoke-waiting-mode.sh → invoke-waiting-mode.sh.backup} +0 -0
  738. /package/claude-assets/skills/cfn-redis-coordination/{redis-cli-wrapper.sh → redis-cli-wrapper.sh.backup} +0 -0
  739. /package/claude-assets/skills/cfn-redis-coordination/{redis-functions.sh → redis-functions.sh.backup} +0 -0
  740. /package/claude-assets/skills/cfn-redis-coordination/{report-completion.sh → report-completion.sh.backup} +0 -0
  741. /package/claude-assets/skills/cfn-redis-coordination/{store-context.sh → store-context.sh.backup} +0 -0
@@ -0,0 +1,244 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Agent Spawning CLI Entry Point
4
+ *
5
+ * Provides command-line interface for spawning agents.
6
+ * Fully backward compatible with bash version.
7
+ *
8
+ * Usage:
9
+ * spawn-agent-cli <agent-type> --task-id <id> [--iteration N] [--mode mode]
10
+ * spawn-agent-cli --help
11
+ * spawn-agent-cli --version
12
+ */ import { AgentSpawner } from './agent-spawner';
13
+ import { readFileSync } from 'fs';
14
+ import { resolve, dirname } from 'path';
15
+ import { fileURLToPath } from 'url';
16
+ // ESM-compatible __dirname
17
+ const __filename = fileURLToPath(import.meta.url);
18
+ const __dirname = dirname(__filename);
19
+ /**
20
+ * Parse command-line arguments
21
+ */ function parseArgs(args) {
22
+ const parsed = {
23
+ background: true
24
+ };
25
+ for(let i = 0; i < args.length; i++){
26
+ const arg = args[i];
27
+ if (arg === '--help') {
28
+ parsed.help = true;
29
+ } else if (arg === '--version') {
30
+ parsed.version = true;
31
+ } else if (arg === '--json') {
32
+ parsed.json = true;
33
+ } else if (arg === '--foreground') {
34
+ parsed.background = false;
35
+ } else if (arg === '--background') {
36
+ parsed.background = true;
37
+ } else if (arg === '--task-id' || arg === '-t') {
38
+ parsed.taskId = args[++i];
39
+ } else if (arg === '--iteration' || arg === '-i') {
40
+ parsed.iteration = parseInt(args[++i], 10);
41
+ } else if (arg === '--mode' || arg === '-m') {
42
+ parsed.mode = args[++i];
43
+ } else if (arg === '--provider' || arg === '-p') {
44
+ parsed.provider = args[++i];
45
+ } else if (arg === '--model') {
46
+ parsed.model = args[++i];
47
+ } else if (arg === '--prompt') {
48
+ parsed.prompt = args[++i];
49
+ } else if (!arg.startsWith('-')) {
50
+ if (!parsed.agentType) {
51
+ parsed.agentType = arg;
52
+ }
53
+ }
54
+ }
55
+ return parsed;
56
+ }
57
+ /**
58
+ * Print help message
59
+ */ function printHelp() {
60
+ console.log(`
61
+ Agent Spawning CLI
62
+
63
+ USAGE:
64
+ spawn-agent-cli <agent-type> [OPTIONS]
65
+
66
+ ARGUMENTS:
67
+ <agent-type> Type of agent to spawn (e.g., backend-dev, tester)
68
+
69
+ OPTIONS:
70
+ -t, --task-id <id> Task ID for coordination (required for CLI mode)
71
+ -i, --iteration <n> Iteration number (default: 1)
72
+ -m, --mode <mode> Mode: mvp, standard, enterprise (default: standard)
73
+ -p, --provider <p> Provider: zai, anthropic, etc. (default: auto-detect)
74
+ --model <model> Explicit model name (default: auto-detect)
75
+ --prompt <text> Task prompt/description to pass to agent
76
+ --foreground Run in foreground (default: background)
77
+ --background Run in background (default)
78
+ --json Output result as JSON
79
+ -h, --help Show this help message
80
+ -v, --version Show version information
81
+
82
+ EXAMPLES:
83
+ # Basic agent spawn
84
+ spawn-agent-cli backend-dev --task-id task-123
85
+
86
+ # With explicit iteration
87
+ spawn-agent-cli tester --task-id task-123 --iteration 2
88
+
89
+ # With custom provider
90
+ spawn-agent-cli reviewer --task-id task-123 --provider anthropic
91
+
92
+ # JSON output for integration
93
+ spawn-agent-cli coder --task-id task-123 --json
94
+
95
+ ENVIRONMENT VARIABLES:
96
+ TASK_ID Task ID (can be set instead of --task-id)
97
+ PROJECT_ROOT Project root directory (default: cwd)
98
+ AGENT_ID Custom agent ID (default: generated)
99
+ `);
100
+ }
101
+ /**
102
+ * Print version information
103
+ */ function printVersion() {
104
+ try {
105
+ const packageJson = JSON.parse(readFileSync(resolve(__dirname, '../../package.json'), 'utf-8'));
106
+ console.log(`spawn-agent-cli v${packageJson.version}`);
107
+ } catch {
108
+ console.log('spawn-agent-cli v1.0.0');
109
+ }
110
+ }
111
+ /**
112
+ * Phase 1: Mode Prefix Function for CLI/Trigger.dev Collision Mitigation
113
+ *
114
+ * Generates task ID with mode prefix to prevent Redis key collisions between
115
+ * CLI mode and Trigger.dev Docker mode. Both modes share identical Redis coordination
116
+ * patterns and must use isolated namespaces.
117
+ *
118
+ * @param rawTaskId - Original task ID without prefix
119
+ * @param mode - Execution mode: 'cli' for CLI mode, 'trigger' for Trigger.dev
120
+ * @returns Prefixed task ID in format "MODE:rawTaskId"
121
+ *
122
+ * Example:
123
+ * generateTaskId('task-123', 'cli') => 'cli:task-123'
124
+ * generateTaskId('task-123', 'trigger') => 'trigger:task-123'
125
+ *
126
+ * Redis Key Isolation (After):
127
+ * CLI: cfn:task:cli:task-123:status
128
+ * Trigger: cfn:task:trigger:task-123:status
129
+ */ function generateTaskId(rawTaskId, mode) {
130
+ // Don't add prefix if task ID already has a namespace prefix
131
+ if (/^[a-z]+:/.test(rawTaskId)) {
132
+ return rawTaskId;
133
+ }
134
+ return `${mode}:${rawTaskId}`;
135
+ }
136
+ /**
137
+ * Validate CLI arguments
138
+ */ function validateArgs(args) {
139
+ const errors = [];
140
+ if (!args.agentType) {
141
+ errors.push('Agent type is required');
142
+ }
143
+ const taskId = args.taskId || process.env.TASK_ID;
144
+ if (!taskId) {
145
+ errors.push('Task ID is required (--task-id or TASK_ID env var)');
146
+ }
147
+ // Allow optional namespace prefix (e.g., "cli:", "task:") for coordination routing
148
+ if (taskId && !/^([a-z]+:)?[a-zA-Z0-9_.-]{1,64}$/.test(taskId)) {
149
+ errors.push('Invalid task ID format');
150
+ }
151
+ if (args.iteration && (args.iteration < 1 || !Number.isInteger(args.iteration))) {
152
+ errors.push('Iteration must be a positive integer');
153
+ }
154
+ if (args.mode && ![
155
+ 'mvp',
156
+ 'standard',
157
+ 'enterprise'
158
+ ].includes(args.mode)) {
159
+ errors.push('Mode must be mvp, standard, or enterprise');
160
+ }
161
+ return {
162
+ valid: errors.length === 0,
163
+ errors
164
+ };
165
+ }
166
+ /**
167
+ * Format output based on options
168
+ */ function formatOutput(result, json = false) {
169
+ if (json) {
170
+ return JSON.stringify(result, null, 2);
171
+ }
172
+ if (typeof result === 'object' && result !== null) {
173
+ const obj = result;
174
+ if (obj.status === 'failed') {
175
+ return `ERROR: ${obj.error || 'Failed to spawn agent'}`;
176
+ }
177
+ return `Agent spawned: ${obj.agentId} (PID: ${obj.pid})`;
178
+ }
179
+ return String(result);
180
+ }
181
+ /**
182
+ * Main CLI function
183
+ */ async function main() {
184
+ const args = parseArgs(process.argv.slice(2));
185
+ // Handle flags
186
+ if (args.help) {
187
+ printHelp();
188
+ process.exit(0);
189
+ }
190
+ if (args.version) {
191
+ printVersion();
192
+ process.exit(0);
193
+ }
194
+ // Validate arguments
195
+ const taskId = args.taskId || process.env.TASK_ID;
196
+ const validation = validateArgs({
197
+ ...args,
198
+ taskId
199
+ });
200
+ if (!validation.valid) {
201
+ console.error('Argument validation failed:');
202
+ validation.errors.forEach((err)=>console.error(` - ${err}`));
203
+ console.error('Use --help for usage information');
204
+ process.exit(1);
205
+ }
206
+ // Create spawner
207
+ const projectRoot = process.env.PROJECT_ROOT || process.cwd();
208
+ const spawner = new AgentSpawner(projectRoot);
209
+ // Build config with CLI mode prefix for Redis key isolation (Phase 1)
210
+ const prefixedTaskId = generateTaskId(taskId, 'cli');
211
+ const config = {
212
+ agentType: args.agentType,
213
+ taskId: prefixedTaskId,
214
+ iteration: args.iteration || 1,
215
+ mode: args.mode || 'standard',
216
+ provider: args.provider,
217
+ model: args.model,
218
+ prompt: args.prompt,
219
+ background: args.background !== false,
220
+ env: {
221
+ TASK_ID: prefixedTaskId
222
+ }
223
+ };
224
+ try {
225
+ // Spawn agent
226
+ const result = await spawner.spawnAgent(config);
227
+ // Output result
228
+ console.log(formatOutput(result, args.json));
229
+ // Exit with appropriate code
230
+ process.exit(result.status === 'spawned' ? 0 : 1);
231
+ } catch (error) {
232
+ const errorMsg = error instanceof Error ? error.message : String(error);
233
+ console.error(`ERROR: ${errorMsg}`);
234
+ process.exit(2);
235
+ }
236
+ }
237
+ // Run main function
238
+ main().catch((error)=>{
239
+ console.error('Unexpected error:', error);
240
+ process.exit(2);
241
+ });
242
+ export { parseArgs, validateArgs, formatOutput, generateTaskId };
243
+
244
+ //# sourceMappingURL=spawn-agent-cli.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/cli/spawn-agent-cli.ts"],"sourcesContent":["#!/usr/bin/env node\r\n/**\r\n * Agent Spawning CLI Entry Point\r\n *\r\n * Provides command-line interface for spawning agents.\r\n * Fully backward compatible with bash version.\r\n *\r\n * Usage:\r\n * spawn-agent-cli <agent-type> --task-id <id> [--iteration N] [--mode mode]\r\n * spawn-agent-cli --help\r\n * spawn-agent-cli --version\r\n */\r\n\r\nimport { AgentSpawner } from './agent-spawner';\r\nimport { writeFileSync, readFileSync } from 'fs';\r\nimport { resolve, dirname } from 'path';\r\nimport { fileURLToPath } from 'url';\r\n\r\n// ESM-compatible __dirname\r\nconst __filename = fileURLToPath(import.meta.url);\r\nconst __dirname = dirname(__filename);\r\n\r\ninterface CLIArgs {\r\n agentType?: string;\r\n taskId?: string;\r\n iteration?: number;\r\n mode?: 'mvp' | 'standard' | 'enterprise';\r\n provider?: string;\r\n model?: string;\r\n prompt?: string;\r\n background?: boolean;\r\n help?: boolean;\r\n version?: boolean;\r\n json?: boolean;\r\n [key: string]: unknown;\r\n}\r\n\r\n/**\r\n * Parse command-line arguments\r\n */\r\nfunction parseArgs(args: string[]): CLIArgs {\r\n const parsed: CLIArgs = {\r\n background: true\r\n };\r\n\r\n for (let i = 0; i < args.length; i++) {\r\n const arg = args[i];\r\n\r\n if (arg === '--help') {\r\n parsed.help = true;\r\n } else if (arg === '--version') {\r\n parsed.version = true;\r\n } else if (arg === '--json') {\r\n parsed.json = true;\r\n } else if (arg === '--foreground') {\r\n parsed.background = false;\r\n } else if (arg === '--background') {\r\n parsed.background = true;\r\n } else if (arg === '--task-id' || arg === '-t') {\r\n parsed.taskId = args[++i];\r\n } else if (arg === '--iteration' || arg === '-i') {\r\n parsed.iteration = parseInt(args[++i], 10);\r\n } else if (arg === '--mode' || arg === '-m') {\r\n parsed.mode = args[++i] as 'mvp' | 'standard' | 'enterprise';\r\n } else if (arg === '--provider' || arg === '-p') {\r\n parsed.provider = args[++i];\r\n } else if (arg === '--model') {\r\n parsed.model = args[++i];\r\n } else if (arg === '--prompt') {\r\n parsed.prompt = args[++i];\r\n } else if (!arg.startsWith('-')) {\r\n if (!parsed.agentType) {\r\n parsed.agentType = arg;\r\n }\r\n }\r\n }\r\n\r\n return parsed;\r\n}\r\n\r\n/**\r\n * Print help message\r\n */\r\nfunction printHelp(): void {\r\n console.log(`\r\nAgent Spawning CLI\r\n\r\nUSAGE:\r\n spawn-agent-cli <agent-type> [OPTIONS]\r\n\r\nARGUMENTS:\r\n <agent-type> Type of agent to spawn (e.g., backend-dev, tester)\r\n\r\nOPTIONS:\r\n -t, --task-id <id> Task ID for coordination (required for CLI mode)\r\n -i, --iteration <n> Iteration number (default: 1)\r\n -m, --mode <mode> Mode: mvp, standard, enterprise (default: standard)\r\n -p, --provider <p> Provider: zai, anthropic, etc. (default: auto-detect)\r\n --model <model> Explicit model name (default: auto-detect)\r\n --prompt <text> Task prompt/description to pass to agent\r\n --foreground Run in foreground (default: background)\r\n --background Run in background (default)\r\n --json Output result as JSON\r\n -h, --help Show this help message\r\n -v, --version Show version information\r\n\r\nEXAMPLES:\r\n # Basic agent spawn\r\n spawn-agent-cli backend-dev --task-id task-123\r\n\r\n # With explicit iteration\r\n spawn-agent-cli tester --task-id task-123 --iteration 2\r\n\r\n # With custom provider\r\n spawn-agent-cli reviewer --task-id task-123 --provider anthropic\r\n\r\n # JSON output for integration\r\n spawn-agent-cli coder --task-id task-123 --json\r\n\r\nENVIRONMENT VARIABLES:\r\n TASK_ID Task ID (can be set instead of --task-id)\r\n PROJECT_ROOT Project root directory (default: cwd)\r\n AGENT_ID Custom agent ID (default: generated)\r\n`);\r\n}\r\n\r\n/**\r\n * Print version information\r\n */\r\nfunction printVersion(): void {\r\n try {\r\n const packageJson = JSON.parse(\r\n readFileSync(resolve(__dirname, '../../package.json'), 'utf-8')\r\n );\r\n console.log(`spawn-agent-cli v${packageJson.version}`);\r\n } catch {\r\n console.log('spawn-agent-cli v1.0.0');\r\n }\r\n}\r\n\r\n/**\r\n * Phase 1: Mode Prefix Function for CLI/Trigger.dev Collision Mitigation\r\n *\r\n * Generates task ID with mode prefix to prevent Redis key collisions between\r\n * CLI mode and Trigger.dev Docker mode. Both modes share identical Redis coordination\r\n * patterns and must use isolated namespaces.\r\n *\r\n * @param rawTaskId - Original task ID without prefix\r\n * @param mode - Execution mode: 'cli' for CLI mode, 'trigger' for Trigger.dev\r\n * @returns Prefixed task ID in format \"MODE:rawTaskId\"\r\n *\r\n * Example:\r\n * generateTaskId('task-123', 'cli') => 'cli:task-123'\r\n * generateTaskId('task-123', 'trigger') => 'trigger:task-123'\r\n *\r\n * Redis Key Isolation (After):\r\n * CLI: cfn:task:cli:task-123:status\r\n * Trigger: cfn:task:trigger:task-123:status\r\n */\r\nfunction generateTaskId(rawTaskId: string, mode: 'cli' | 'trigger'): string {\r\n // Don't add prefix if task ID already has a namespace prefix\r\n if (/^[a-z]+:/.test(rawTaskId)) {\r\n return rawTaskId;\r\n }\r\n return `${mode}:${rawTaskId}`;\r\n}\r\n\r\n/**\r\n * Validate CLI arguments\r\n */\r\nfunction validateArgs(args: CLIArgs): { valid: boolean; errors: string[] } {\r\n const errors: string[] = [];\r\n\r\n if (!args.agentType) {\r\n errors.push('Agent type is required');\r\n }\r\n\r\n const taskId = args.taskId || process.env.TASK_ID;\r\n if (!taskId) {\r\n errors.push('Task ID is required (--task-id or TASK_ID env var)');\r\n }\r\n\r\n // Allow optional namespace prefix (e.g., \"cli:\", \"task:\") for coordination routing\r\n if (taskId && !/^([a-z]+:)?[a-zA-Z0-9_.-]{1,64}$/.test(taskId)) {\r\n errors.push('Invalid task ID format');\r\n }\r\n\r\n if (args.iteration && (args.iteration < 1 || !Number.isInteger(args.iteration))) {\r\n errors.push('Iteration must be a positive integer');\r\n }\r\n\r\n if (args.mode && !['mvp', 'standard', 'enterprise'].includes(args.mode)) {\r\n errors.push('Mode must be mvp, standard, or enterprise');\r\n }\r\n\r\n return {\r\n valid: errors.length === 0,\r\n errors\r\n };\r\n}\r\n\r\n/**\r\n * Format output based on options\r\n */\r\nfunction formatOutput(result: unknown, json: boolean = false): string {\r\n if (json) {\r\n return JSON.stringify(result, null, 2);\r\n }\r\n\r\n if (typeof result === 'object' && result !== null) {\r\n const obj = result as Record<string, unknown>;\r\n if (obj.status === 'failed') {\r\n return `ERROR: ${obj.error || 'Failed to spawn agent'}`;\r\n }\r\n return `Agent spawned: ${obj.agentId} (PID: ${obj.pid})`;\r\n }\r\n\r\n return String(result);\r\n}\r\n\r\n/**\r\n * Main CLI function\r\n */\r\nasync function main(): Promise<void> {\r\n const args = parseArgs(process.argv.slice(2));\r\n\r\n // Handle flags\r\n if (args.help) {\r\n printHelp();\r\n process.exit(0);\r\n }\r\n\r\n if (args.version) {\r\n printVersion();\r\n process.exit(0);\r\n }\r\n\r\n // Validate arguments\r\n const taskId = args.taskId || process.env.TASK_ID;\r\n const validation = validateArgs({ ...args, taskId });\r\n\r\n if (!validation.valid) {\r\n console.error('Argument validation failed:');\r\n validation.errors.forEach(err => console.error(` - ${err}`));\r\n console.error('Use --help for usage information');\r\n process.exit(1);\r\n }\r\n\r\n // Create spawner\r\n const projectRoot = process.env.PROJECT_ROOT || process.cwd();\r\n const spawner = new AgentSpawner(projectRoot);\r\n\r\n // Build config with CLI mode prefix for Redis key isolation (Phase 1)\r\n const prefixedTaskId = generateTaskId(taskId!, 'cli');\r\n const config = {\r\n agentType: args.agentType!,\r\n taskId: prefixedTaskId,\r\n iteration: args.iteration || 1,\r\n mode: args.mode || 'standard' as const,\r\n provider: args.provider,\r\n model: args.model,\r\n prompt: args.prompt,\r\n background: args.background !== false,\r\n env: {\r\n TASK_ID: prefixedTaskId\r\n }\r\n };\r\n\r\n try {\r\n // Spawn agent\r\n const result = await spawner.spawnAgent(config);\r\n\r\n // Output result\r\n console.log(formatOutput(result, args.json));\r\n\r\n // Exit with appropriate code\r\n process.exit(result.status === 'spawned' ? 0 : 1);\r\n } catch (error) {\r\n const errorMsg = error instanceof Error ? error.message : String(error);\r\n console.error(`ERROR: ${errorMsg}`);\r\n process.exit(2);\r\n }\r\n}\r\n\r\n// Run main function\r\nmain().catch((error) => {\r\n console.error('Unexpected error:', error);\r\n process.exit(2);\r\n});\r\n\r\nexport { parseArgs, validateArgs, formatOutput, generateTaskId };\r\n"],"names":["AgentSpawner","readFileSync","resolve","dirname","fileURLToPath","__filename","url","__dirname","parseArgs","args","parsed","background","i","length","arg","help","version","json","taskId","iteration","parseInt","mode","provider","model","prompt","startsWith","agentType","printHelp","console","log","printVersion","packageJson","JSON","parse","generateTaskId","rawTaskId","test","validateArgs","errors","push","process","env","TASK_ID","Number","isInteger","includes","valid","formatOutput","result","stringify","obj","status","error","agentId","pid","String","main","argv","slice","exit","validation","forEach","err","projectRoot","PROJECT_ROOT","cwd","spawner","prefixedTaskId","config","spawnAgent","errorMsg","Error","message","catch"],"mappings":"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"}
@@ -0,0 +1,383 @@
1
+ /**
2
+ * Unified TypeScript Coordination Wrapper
3
+ *
4
+ * Provides a type-safe interface for all Redis-based coordination operations
5
+ * in the CFN Loop critical path. Wraps the existing redis-coordinator with
6
+ * semantic coordination methods for:
7
+ * - Agent lifecycle management
8
+ * - Signal/wait primitives
9
+ * - Consensus collection
10
+ * - Task state management
11
+ *
12
+ * Key patterns:
13
+ * - swarm:* namespace for unified coordination
14
+ * - Backward compatible with cfn_loop:task:* legacy namespace
15
+ * - Type-safe agent state tracking
16
+ * - Automatic timeout handling
17
+ */ import Redis from 'ioredis';
18
+ import { EventEmitter } from 'events';
19
+ /**
20
+ * Unified Coordination Wrapper
21
+ *
22
+ * Provides semantic coordination methods that abstract away Redis key patterns
23
+ * and protocol details while maintaining type safety.
24
+ */ export class CoordinationWrapper extends EventEmitter {
25
+ redis;
26
+ taskId;
27
+ namespace;
28
+ defaultTimeout;
29
+ isConnected = false;
30
+ constructor(config){
31
+ super();
32
+ this.taskId = config.taskId;
33
+ this.namespace = config.namespace || 'swarm';
34
+ this.defaultTimeout = config.defaultTimeout || 120000; // 120 seconds
35
+ // Create Redis client with provided configuration
36
+ this.redis = new Redis({
37
+ host: config.redisHost,
38
+ port: config.redisPort,
39
+ db: config.redisDb || 0,
40
+ lazyConnect: true,
41
+ maxRetriesPerRequest: null,
42
+ enableReadyCheck: false
43
+ });
44
+ // Set up error handling
45
+ this.redis.on('error', (error)=>{
46
+ this.emit('redis-error', error);
47
+ });
48
+ this.redis.on('connect', ()=>{
49
+ this.isConnected = true;
50
+ this.emit('connected');
51
+ });
52
+ this.redis.on('disconnect', ()=>{
53
+ this.isConnected = false;
54
+ this.emit('disconnected');
55
+ });
56
+ }
57
+ /**
58
+ * Connect to Redis
59
+ */ async connect() {
60
+ if (!this.isConnected) {
61
+ await this.redis.connect();
62
+ }
63
+ }
64
+ /**
65
+ * Disconnect from Redis
66
+ */ async disconnect() {
67
+ if (this.isConnected) {
68
+ await this.redis.disconnect();
69
+ }
70
+ }
71
+ /**
72
+ * Check if connected to Redis
73
+ */ isReady() {
74
+ return this.isConnected;
75
+ }
76
+ /**
77
+ * AGENT LIFECYCLE MANAGEMENT
78
+ */ /**
79
+ * Register a spawned agent in the coordination system
80
+ */ async registerAgent(agentId, agentType) {
81
+ const state = {
82
+ agentId,
83
+ type: agentType,
84
+ status: 'spawned',
85
+ timestamp: new Date().toISOString()
86
+ };
87
+ const key = this.getAgentStateKey(agentId);
88
+ await this.redis.set(key, JSON.stringify(state), 'EX', 86400); // 24h expiry
89
+ }
90
+ /**
91
+ * Update agent status
92
+ */ async updateAgentStatus(agentId, status) {
93
+ const key = this.getAgentStateKey(agentId);
94
+ const state = await this.getAgentState(agentId);
95
+ if (!state) {
96
+ throw new Error(`Agent ${agentId} not registered`);
97
+ }
98
+ state.status = status;
99
+ state.timestamp = new Date().toISOString();
100
+ await this.redis.set(key, JSON.stringify(state), 'EX', 86400);
101
+ }
102
+ /**
103
+ * Signal agent completion with confidence score
104
+ */ async signalCompletion(agentId, confidence, options) {
105
+ const key = this.getAgentStateKey(agentId);
106
+ const state = await this.getAgentState(agentId);
107
+ if (!state) {
108
+ throw new Error(`Agent ${agentId} not registered`);
109
+ }
110
+ state.status = 'completed';
111
+ state.confidence = confidence;
112
+ state.testPassRate = options?.testPassRate;
113
+ state.testsRun = options?.testsRun;
114
+ state.testsPassed = options?.testsPassed;
115
+ state.result = options?.result;
116
+ state.iteration = options?.iteration;
117
+ state.timestamp = new Date().toISOString();
118
+ // Store in agent state with 24h expiry
119
+ await this.redis.set(key, JSON.stringify(state), 'EX', 86400);
120
+ // Also publish completion signal to waiting agents
121
+ const channel = this.getCompletionChannel(agentId);
122
+ await this.redis.publish(channel, JSON.stringify(state));
123
+ // Add to completion leaderboard for consensus collection
124
+ const leaderboardKey = this.getCompletionLeaderboardKey();
125
+ await this.redis.zadd(leaderboardKey, confidence * 100, JSON.stringify({
126
+ agentId,
127
+ confidence,
128
+ timestamp: state.timestamp
129
+ }));
130
+ }
131
+ /**
132
+ * Get agent state
133
+ */ async getAgentState(agentId) {
134
+ const key = this.getAgentStateKey(agentId);
135
+ const data = await this.redis.get(key);
136
+ if (!data) {
137
+ return null;
138
+ }
139
+ return JSON.parse(data);
140
+ }
141
+ /**
142
+ * Get all agents in current task
143
+ */ async getAllAgents() {
144
+ const pattern = this.getAgentStateKeyPattern();
145
+ const keys = await this.redis.keys(pattern);
146
+ const agents = [];
147
+ for (const key of keys){
148
+ const data = await this.redis.get(key);
149
+ if (data) {
150
+ agents.push(JSON.parse(data));
151
+ }
152
+ }
153
+ return agents;
154
+ }
155
+ /**
156
+ * COORDINATION PRIMITIVES
157
+ */ /**
158
+ * Wait for a coordination signal with timeout
159
+ */ async waitForSignal(channel, timeoutMs) {
160
+ const timeout = timeoutMs || this.defaultTimeout;
161
+ const timeoutSeconds = Math.ceil(timeout / 1000);
162
+ try {
163
+ // Use BLPOP to block-wait on a list
164
+ const listKey = this.getSignalKey(channel);
165
+ const result = await this.redis.blpop(listKey, timeoutSeconds);
166
+ if (result === null) {
167
+ return {
168
+ received: false,
169
+ timeout: true
170
+ };
171
+ }
172
+ return {
173
+ received: true,
174
+ message: result[1],
175
+ timestamp: new Date().toISOString(),
176
+ timeout: false
177
+ };
178
+ } catch (error) {
179
+ return {
180
+ received: false,
181
+ timeout: false
182
+ };
183
+ }
184
+ }
185
+ /**
186
+ * Broadcast a signal to all waiting agents
187
+ */ async broadcastSignal(channel, message) {
188
+ // Use pub/sub for broadcast (fire-and-forget to subscribers)
189
+ await this.redis.publish(channel, message);
190
+ // Also store in a list for new subscribers (via BLPOP pattern)
191
+ const listKey = this.getSignalKey(channel);
192
+ await this.redis.lpush(listKey, message);
193
+ // Keep only recent signals (last 100)
194
+ await this.redis.ltrim(listKey, 0, 99);
195
+ // Expire the list after 1 hour
196
+ await this.redis.expire(listKey, 3600);
197
+ }
198
+ /**
199
+ * Subscribe to signal channel (pub/sub pattern)
200
+ */ subscribeToSignal(channel, callback) {
201
+ // Create a separate subscriber for pub/sub
202
+ const subscriber = this.redis.duplicate();
203
+ subscriber.on('message', (chan, message)=>{
204
+ if (chan === channel) {
205
+ callback(message);
206
+ }
207
+ });
208
+ subscriber.subscribe(channel);
209
+ // Return unsubscribe function
210
+ return ()=>{
211
+ subscriber.unsubscribe(channel);
212
+ subscriber.disconnect();
213
+ };
214
+ }
215
+ /**
216
+ * CONSENSUS & VALIDATION
217
+ */ /**
218
+ * Collect consensus scores from multiple validators
219
+ */ async collectConsensus(agentIds, timeoutMs) {
220
+ const timeout = timeoutMs || this.defaultTimeout;
221
+ const startTime = Date.now();
222
+ const scores = [];
223
+ for (const agentId of agentIds){
224
+ const elapsed = Date.now() - startTime;
225
+ const remaining = Math.max(1, timeout - elapsed);
226
+ const remainingSeconds = Math.ceil(remaining / 1000);
227
+ // Wait for each validator to report consensus
228
+ const scoreKey = this.getConsensusKey(agentId);
229
+ const data = await this.redis.blpop(scoreKey, remainingSeconds);
230
+ if (data) {
231
+ const score = JSON.parse(data[1]);
232
+ scores.push(score);
233
+ }
234
+ }
235
+ return scores;
236
+ }
237
+ /**
238
+ * Report a consensus score
239
+ */ async reportConsensusScore(agentId, score, feedback) {
240
+ const consensusScore = {
241
+ agentId,
242
+ score,
243
+ feedback,
244
+ timestamp: new Date().toISOString()
245
+ };
246
+ const key = this.getConsensusKey(agentId);
247
+ await this.redis.lpush(key, JSON.stringify(consensusScore));
248
+ await this.redis.expire(key, 86400); // 24h expiry
249
+ }
250
+ /**
251
+ * Calculate average consensus from scores
252
+ */ calculateAverageConsensus(scores) {
253
+ if (scores.length === 0) {
254
+ return 0;
255
+ }
256
+ const sum = scores.reduce((acc, score)=>acc + score.score, 0);
257
+ return sum / scores.length;
258
+ }
259
+ /**
260
+ * TASK STATE MANAGEMENT
261
+ */ /**
262
+ * Store task context (usually CFN Loop parameters)
263
+ */ async storeTaskContext(context) {
264
+ const key = this.getTaskContextKey();
265
+ await this.redis.set(key, JSON.stringify(context), 'EX', 86400);
266
+ }
267
+ /**
268
+ * Load task context
269
+ */ async loadTaskContext() {
270
+ const key = this.getTaskContextKey();
271
+ const data = await this.redis.get(key);
272
+ if (!data) {
273
+ return null;
274
+ }
275
+ return JSON.parse(data);
276
+ }
277
+ /**
278
+ * Update task status
279
+ */ async updateTaskStatus(status, iteration) {
280
+ const key = this.getTaskStatusKey();
281
+ const state = {
282
+ taskId: this.taskId,
283
+ status,
284
+ updatedAt: new Date().toISOString()
285
+ };
286
+ if (iteration !== undefined) {
287
+ state.iteration = iteration;
288
+ }
289
+ // Get existing context if available
290
+ const contextData = await this.loadTaskContext();
291
+ if (contextData) {
292
+ state.context = contextData;
293
+ }
294
+ // Get all agents
295
+ state.agents = await this.getAllAgents();
296
+ await this.redis.set(key, JSON.stringify(state), 'EX', 86400);
297
+ }
298
+ /**
299
+ * Get full task state snapshot
300
+ */ async getTaskState() {
301
+ const key = this.getTaskStatusKey();
302
+ const data = await this.redis.get(key);
303
+ if (!data) {
304
+ return null;
305
+ }
306
+ return JSON.parse(data);
307
+ }
308
+ /**
309
+ * HELPER METHODS FOR KEY GENERATION
310
+ */ getAgentStateKey(agentId) {
311
+ if (this.namespace === 'cfn_loop') {
312
+ return `cfn_loop:task:${this.taskId}:agent:${agentId}`;
313
+ }
314
+ return `${this.namespace}:${this.taskId}:agent:${agentId}`;
315
+ }
316
+ getAgentStateKeyPattern() {
317
+ if (this.namespace === 'cfn_loop') {
318
+ return `cfn_loop:task:${this.taskId}:agent:*`;
319
+ }
320
+ return `${this.namespace}:${this.taskId}:agent:*`;
321
+ }
322
+ getCompletionChannel(agentId) {
323
+ if (this.namespace === 'cfn_loop') {
324
+ return `cfn_loop:task:${this.taskId}:completion:${agentId}`;
325
+ }
326
+ return `${this.namespace}:${this.taskId}:completion`;
327
+ }
328
+ getCompletionLeaderboardKey() {
329
+ if (this.namespace === 'cfn_loop') {
330
+ return `cfn_loop:task:${this.taskId}:completions`;
331
+ }
332
+ return `${this.namespace}:${this.taskId}:completions`;
333
+ }
334
+ getSignalKey(channel) {
335
+ if (this.namespace === 'cfn_loop') {
336
+ return `cfn_loop:task:${this.taskId}:signal:${channel}`;
337
+ }
338
+ return `${this.namespace}:${this.taskId}:signal:${channel}`;
339
+ }
340
+ getConsensusKey(agentId) {
341
+ if (this.namespace === 'cfn_loop') {
342
+ return `cfn_loop:task:${this.taskId}:consensus:${agentId}`;
343
+ }
344
+ return `${this.namespace}:${this.taskId}:consensus:${agentId}`;
345
+ }
346
+ getTaskContextKey() {
347
+ if (this.namespace === 'cfn_loop') {
348
+ return `cfn_loop:task:${this.taskId}:context`;
349
+ }
350
+ return `${this.namespace}:${this.taskId}:context`;
351
+ }
352
+ getTaskStatusKey() {
353
+ if (this.namespace === 'cfn_loop') {
354
+ return `cfn_loop:task:${this.taskId}:status`;
355
+ }
356
+ return `${this.namespace}:${this.taskId}:status`;
357
+ }
358
+ /**
359
+ * CLEANUP & UTILITIES
360
+ */ /**
361
+ * Clear all coordination state for this task
362
+ */ async clearTaskState() {
363
+ const pattern = this.getTaskKeysPattern();
364
+ const keys = await this.redis.keys(pattern);
365
+ if (keys.length > 0) {
366
+ await this.redis.del(...keys);
367
+ }
368
+ }
369
+ getTaskKeysPattern() {
370
+ if (this.namespace === 'cfn_loop') {
371
+ return `cfn_loop:task:${this.taskId}:*`;
372
+ }
373
+ return `${this.namespace}:${this.taskId}:*`;
374
+ }
375
+ /**
376
+ * Get Redis client for advanced operations
377
+ */ getRedisClient() {
378
+ return this.redis;
379
+ }
380
+ }
381
+ export default CoordinationWrapper;
382
+
383
+ //# sourceMappingURL=coordination-wrapper.js.map