claude-flow-novice 2.15.11 → 2.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/cfn-extras/agents/cfn-v3-coordinator.md +517 -0
- package/.claude/commands/cfn-loop-cli.md +158 -464
- package/.claude/commands/cfn-loop-trigger.md +114 -0
- package/.claude/hooks/cfn-invoke-post-edit-ts.sh +100 -0
- package/.claude/hooks/cfn-invoke-post-edit-ts.sh.backup +78 -0
- package/.claude/hooks/cfn-invoke-post-edit.sh +22 -0
- package/.claude/hooks/cfn-invoke-post-edit.sh.backup +87 -0
- package/.claude/hooks/cfn-invoke-pre-edit-ts.sh +116 -0
- package/.claude/hooks/cfn-invoke-pre-edit-ts.sh.backup +94 -0
- package/.claude/hooks/cfn-invoke-pre-edit.sh +22 -0
- package/.claude/hooks/cfn-invoke-pre-edit.sh.backup +88 -0
- package/.claude/skills/cfn-agent-spawning/SKILL.md +48 -1
- package/.claude/skills/cfn-agent-spawning/SKILL.md.backup +135 -0
- package/.claude/skills/cfn-agent-spawning/TYPESCRIPT_MIGRATION.md +567 -0
- package/.claude/skills/cfn-agent-spawning/check-dependencies.sh +22 -0
- package/.claude/skills/{cfn-redis-coordination/check-dependencies.sh → cfn-agent-spawning/check-dependencies.sh.backup} +3 -5
- package/.claude/skills/cfn-agent-spawning/get-agent-provider-env.sh +22 -0
- package/.claude/skills/cfn-agent-spawning/get-agent-provider-env.sh.backup +127 -0
- package/.claude/skills/cfn-agent-spawning/parse-agent-provider.sh +22 -0
- package/.claude/skills/cfn-agent-spawning/parse-agent-provider.sh.backup +59 -0
- package/.claude/skills/cfn-agent-spawning/spawn-agent-wrapper.sh +63 -0
- package/.claude/skills/cfn-agent-spawning/spawn-agent-wrapper.sh.backup +41 -0
- package/.claude/skills/cfn-agent-spawning/spawn-agent.sh +26 -1
- package/.claude/skills/cfn-agent-spawning/spawn-templates.sh +22 -0
- package/.claude/skills/cfn-agent-spawning/spawn-templates.sh.backup +613 -0
- package/.claude/skills/cfn-agent-spawning/spawn-worker.sh +22 -0
- package/.claude/skills/cfn-agent-spawning/spawn-worker.sh.backup +176 -0
- package/.claude/skills/cfn-loop-orchestration/.backups/unknown/1763619700_33aff4a69b99159e4e849107ebc4d09f/metadata.json +8 -0
- package/.claude/skills/cfn-loop-orchestration/.backups/unknown/1763619700_33aff4a69b99159e4e849107ebc4d09f/original +271 -0
- package/.claude/skills/cfn-loop-orchestration/.backups/unknown/1763619700_33aff4a69b99159e4e849107ebc4d09f/revert.sh +7 -0
- package/.claude/skills/cfn-loop-orchestration/.backups/unknown/1763671642_06496e8c399a79db08167cc00ed4b31e/metadata.json +8 -0
- package/.claude/skills/cfn-loop-orchestration/.backups/unknown/1763671642_06496e8c399a79db08167cc00ed4b31e/original +325 -0
- package/.claude/skills/cfn-loop-orchestration/.backups/unknown/1763671642_06496e8c399a79db08167cc00ed4b31e/revert.sh +7 -0
- package/.claude/skills/cfn-loop-orchestration/CLI_IMPLEMENTATION_SUMMARY.md +330 -0
- package/.claude/skills/cfn-loop-orchestration/CONFIGURATION_IMPROVEMENTS.md +318 -0
- package/.claude/skills/cfn-loop-orchestration/CONTEXT_LOOKUP_MIGRATION.md +308 -0
- package/.claude/skills/cfn-loop-orchestration/CONTEXT_LOOKUP_QUICK_START.md +378 -0
- package/.claude/skills/cfn-loop-orchestration/E2E_VALIDATION_REPORT.md +262 -0
- package/.claude/skills/cfn-loop-orchestration/IMPLEMENTATION_SUMMARY.md +319 -519
- package/.claude/skills/cfn-loop-orchestration/NORTH_STAR_E2E_REPORT.md +299 -0
- package/.claude/skills/cfn-loop-orchestration/NORTH_STAR_EXECUTION_SUMMARY.md +403 -0
- package/.claude/skills/cfn-loop-orchestration/NORTH_STAR_INDEX.md +323 -0
- package/.claude/skills/cfn-loop-orchestration/SKILL.md +159 -48
- package/.claude/skills/cfn-loop-orchestration/SPAWN_AGENTS_IMPLEMENTATION.md +188 -0
- package/.claude/skills/cfn-loop-orchestration/TEST_COVERAGE_REPORT.md +335 -0
- package/.claude/skills/cfn-loop-orchestration/TEST_COVERAGE_SUMMARY.md +456 -0
- package/.claude/skills/cfn-loop-orchestration/TYPESCRIPT_INTEGRATION_REPORT.md +709 -0
- package/.claude/skills/cfn-loop-orchestration/TYPESCRIPT_INTEGRATION_SUMMARY.md +257 -0
- package/.claude/skills/cfn-loop-orchestration/VALIDATION_REPORT.md +572 -0
- package/.claude/skills/cfn-loop-orchestration/VALIDATION_SUMMARY.txt +196 -0
- package/.claude/skills/cfn-loop-orchestration/VALIDATOR_MODULE_GUIDE.md +526 -0
- package/.claude/skills/cfn-loop-orchestration/archive/legacy-bash/README.md +167 -0
- package/.claude/skills/cfn-loop-orchestration/archive/legacy-bash/orchestrate-enhanced.sh +548 -0
- package/{claude-assets/skills/cfn-loop-orchestration → .claude/skills/cfn-loop-orchestration/archive/legacy-bash}/orchestrate-wrapper.sh +11 -1
- package/.claude/skills/cfn-loop-orchestration/archive/legacy-bash/orchestrate.sh +182 -0
- package/.claude/skills/cfn-loop-orchestration/e2e-validation-fixed.js +240 -0
- package/.claude/skills/cfn-loop-orchestration/e2e-validation.js +213 -0
- package/.claude/skills/cfn-loop-orchestration/package-lock.json +3 -0
- package/.claude/skills/cfn-loop-orchestration/package.json +4 -0
- package/.claude/skills/cfn-loop-orchestration/run-north-star-e2e.ts +210 -0
- package/.claude/skills/cfn-loop-orchestration/src/cli/orchestrator-cli.ts +396 -0
- package/.claude/skills/cfn-loop-orchestration/src/helpers/CONFIDENCE_AGGREGATOR.md +564 -0
- package/.claude/skills/cfn-loop-orchestration/src/helpers/CONFIDENCE_AGGREGATOR_QUICK_REF.md +241 -0
- package/.claude/skills/cfn-loop-orchestration/src/helpers/CONTEXT_INJECTOR_IMPLEMENTATION.md +375 -0
- package/.claude/skills/cfn-loop-orchestration/src/helpers/CONTEXT_INJECTOR_QUICK_REFERENCE.md +362 -0
- package/.claude/skills/cfn-loop-orchestration/src/helpers/CONTEXT_INJECTOR_README.md +307 -0
- package/.claude/skills/cfn-loop-orchestration/src/helpers/CONTEXT_INJECTOR_USAGE_GUIDE.md +508 -0
- package/.claude/skills/cfn-loop-orchestration/src/helpers/confidence-aggregator.ts +473 -0
- package/.claude/skills/cfn-loop-orchestration/src/helpers/consensus.ts +1 -1
- package/.claude/skills/cfn-loop-orchestration/src/helpers/context-injector.ts +349 -0
- package/.claude/skills/cfn-loop-orchestration/src/helpers/context-lookup.ts +486 -0
- package/.claude/skills/cfn-loop-orchestration/src/helpers/deliverable-verifier.ts +6 -2
- package/.claude/skills/cfn-loop-orchestration/src/helpers/gate-check.ts +1 -1
- package/.claude/skills/cfn-loop-orchestration/src/helpers/product-owner-decision.ts +316 -0
- package/.claude/skills/cfn-loop-orchestration/src/helpers/spawn-agents.ts +357 -0
- package/.claude/skills/cfn-loop-orchestration/src/helpers/validator.ts +276 -0
- package/.claude/skills/cfn-loop-orchestration/src/index.ts +2 -0
- package/.claude/skills/cfn-loop-orchestration/src/orchestrate.ts +743 -2
- package/.claude/skills/cfn-loop-orchestration/src/types.ts +56 -0
- package/.claude/skills/cfn-loop-orchestration/test-cli.sh +92 -0
- package/.claude/skills/cfn-loop-orchestration/test-typescript-integration.sh +442 -0
- package/.claude/skills/cfn-loop-orchestration/tests/agent-spawner.test.ts +124 -0
- package/.claude/skills/cfn-loop-orchestration/tests/confidence-aggregator.test.ts +604 -0
- package/.claude/skills/cfn-loop-orchestration/tests/context-injector.test.ts +561 -0
- package/.claude/skills/cfn-loop-orchestration/tests/context-lookup.test.ts +661 -0
- package/.claude/skills/cfn-loop-orchestration/tests/deliverable-verifier.test.ts +2 -2
- package/.claude/skills/cfn-loop-orchestration/tests/gate-check-edge-cases.test.ts +422 -0
- package/.claude/skills/cfn-loop-orchestration/tests/gate-checker.test.ts +276 -0
- package/.claude/skills/cfn-loop-orchestration/tests/logger.test.ts +291 -0
- package/.claude/skills/cfn-loop-orchestration/tests/north-star-e2e.test.ts +334 -0
- package/.claude/skills/cfn-loop-orchestration/tests/redis-coordinator.test.ts +321 -0
- package/.claude/skills/cfn-loop-orchestration/tests/spawn-agents.test.ts +284 -0
- package/.claude/skills/cfn-loop-orchestration/tests/validator.test.ts +643 -0
- package/.claude/skills/cfn-loop-validation/IMPLEMENTATION_SUMMARY.md +672 -0
- package/.claude/skills/cfn-loop-validation/INDEX.md +531 -0
- package/.claude/skills/cfn-loop-validation/README_TYPESCRIPT.md +454 -0
- package/.claude/skills/cfn-loop-validation/SKILL.md +48 -1
- package/.claude/skills/cfn-loop-validation/SKILL.md.backup +353 -0
- package/.claude/skills/cfn-loop-validation/SKILL_TYPESCRIPT.md +782 -0
- package/.claude/skills/cfn-loop-validation/VAPOR_DETECTION_EXAMPLES.md +598 -0
- package/.claude/skills/cfn-loop-validation/check-dependencies.sh +22 -0
- package/{claude-assets/skills/cfn-redis-coordination/check-dependencies.sh → .claude/skills/cfn-loop-validation/check-dependencies.sh.backup} +4 -5
- package/.claude/skills/cfn-loop-validation/detect-vapor.sh +59 -0
- package/.claude/skills/cfn-loop-validation/detect-vapor.sh.backup +37 -0
- package/.claude/skills/cfn-loop-validation/dist/.tsbuildinfo +1 -0
- package/.claude/skills/cfn-loop-validation/dist/cli/detect-vapor.d.ts +14 -0
- package/.claude/skills/cfn-loop-validation/dist/cli/detect-vapor.d.ts.map +1 -0
- package/.claude/skills/cfn-loop-validation/dist/cli/detect-vapor.js +185 -0
- package/.claude/skills/cfn-loop-validation/dist/cli/detect-vapor.js.map +1 -0
- package/.claude/skills/cfn-loop-validation/dist/cli/validate-deliverables.d.ts +14 -0
- package/.claude/skills/cfn-loop-validation/dist/cli/validate-deliverables.d.ts.map +1 -0
- package/.claude/skills/cfn-loop-validation/dist/cli/validate-deliverables.js +176 -0
- package/.claude/skills/cfn-loop-validation/dist/cli/validate-deliverables.js.map +1 -0
- package/.claude/skills/cfn-loop-validation/dist/cli/validate-gate.d.ts +19 -0
- package/.claude/skills/cfn-loop-validation/dist/cli/validate-gate.d.ts.map +1 -0
- package/.claude/skills/cfn-loop-validation/dist/cli/validate-gate.js +123 -0
- package/.claude/skills/cfn-loop-validation/dist/cli/validate-gate.js.map +1 -0
- package/.claude/skills/cfn-loop-validation/dist/types.d.ts +156 -0
- package/.claude/skills/cfn-loop-validation/dist/types.d.ts.map +1 -0
- package/.claude/skills/cfn-loop-validation/dist/types.js +66 -0
- package/.claude/skills/cfn-loop-validation/dist/types.js.map +1 -0
- package/.claude/skills/cfn-loop-validation/dist/validator.d.ts +85 -0
- package/.claude/skills/cfn-loop-validation/dist/validator.d.ts.map +1 -0
- package/.claude/skills/cfn-loop-validation/dist/validator.js +411 -0
- package/.claude/skills/cfn-loop-validation/dist/validator.js.map +1 -0
- package/.claude/skills/cfn-loop-validation/orchestrate-cfn-loop.sh +22 -0
- package/.claude/skills/cfn-loop-validation/orchestrate-cfn-loop.sh.backup +252 -0
- package/.claude/skills/cfn-loop-validation/package.json +93 -0
- package/.claude/skills/cfn-loop-validation/src/cli/detect-vapor.ts +177 -0
- package/.claude/skills/cfn-loop-validation/src/cli/validate-deliverables.ts +161 -0
- package/.claude/skills/cfn-loop-validation/src/cli/validate-gate.ts +139 -0
- package/.claude/skills/cfn-loop-validation/src/types.ts +215 -0
- package/.claude/skills/cfn-loop-validation/src/validator.ts +503 -0
- package/.claude/skills/cfn-loop-validation/tests/validator.test.ts +537 -0
- package/.claude/skills/{cfn-redis-coordination → cfn-loop-validation}/tsconfig.json +34 -31
- package/.claude/skills/cfn-loop-validation/validate-deliverables.sh +59 -0
- package/.claude/skills/cfn-loop-validation/validate-deliverables.sh.backup +37 -0
- package/.claude/skills/cfn-loop-validation/validate-gate.sh +63 -0
- package/.claude/skills/cfn-loop-validation/validate-gate.sh.backup +41 -0
- package/.claude/skills/cfn-loop-validation/validate-iteration.sh +22 -0
- package/.claude/skills/cfn-loop-validation/validate-iteration.sh.backup +134 -0
- package/.claude/skills/cfn-product-owner-decision/SKILL.md +479 -147
- package/.claude/skills/cfn-product-owner-decision/TYPESCRIPT_IMPLEMENTATION.md +653 -0
- package/{claude-assets/skills/cfn-product-owner-decision → .claude/skills/cfn-product-owner-decision/archive/legacy-bash}/execute-decision.sh +24 -2
- package/.claude/skills/pre-edit-backup/SKILL.md +324 -0
- package/.claude/skills/pre-edit-backup/SKILL.md.backup +277 -0
- package/.claude/skills/pre-edit-backup/backup.sh +22 -0
- package/.claude/skills/pre-edit-backup/backup.sh.backup +107 -0
- package/claude-assets/agents/cfn-dev-team/coordinators/cfn-frontend-coordinator.md +1 -0
- package/claude-assets/agents/cfn-dev-team/coordinators/consensus-builder.md +1 -0
- package/claude-assets/agents/cfn-dev-team/coordinators/handoff-coordinator.md +1 -0
- package/claude-assets/agents/cfn-dev-team/coordinators/multi-sprint-coordinator.md +1 -0
- package/claude-assets/agents/cfn-dev-team/dev-ops/devops-engineer.md +10 -0
- package/claude-assets/agents/cfn-dev-team/dev-ops/docker-specialist.md +56 -33
- package/claude-assets/agents/cfn-dev-team/dev-ops/kubernetes-specialist.md +46 -36
- package/claude-assets/agents/cfn-dev-team/dev-ops/monitoring-specialist.md +9 -0
- package/claude-assets/agents/cfn-dev-team/developers/api-gateway-specialist.md +17 -17
- package/claude-assets/agents/cfn-dev-team/developers/backend-developer.md +40 -58
- package/claude-assets/agents/cfn-dev-team/developers/data/data-engineer.md +18 -20
- package/claude-assets/agents/cfn-dev-team/developers/database/database-architect.md +19 -28
- package/claude-assets/agents/cfn-dev-team/developers/frontend/mobile-dev.md +15 -19
- package/claude-assets/agents/cfn-dev-team/developers/frontend/react-frontend-engineer.md +15 -10
- package/claude-assets/agents/cfn-dev-team/developers/frontend/typescript-specialist.md +15 -10
- package/claude-assets/agents/cfn-dev-team/developers/frontend/ui-designer.md +15 -25
- package/claude-assets/agents/cfn-dev-team/developers/graphql-specialist.md +17 -21
- package/claude-assets/agents/cfn-dev-team/developers/rust-developer.md +17 -21
- package/claude-assets/agents/cfn-dev-team/product-owners/product-owner.md +1 -5
- package/claude-assets/agents/cfn-dev-team/reviewers/code-reviewer.md +20 -51
- package/claude-assets/agents/cfn-dev-team/reviewers/quality/code-quality-validator.md +22 -71
- package/claude-assets/agents/cfn-dev-team/reviewers/quality/perf-analyzer.md +21 -64
- package/claude-assets/agents/cfn-dev-team/reviewers/quality/performance-benchmarker.md +22 -67
- package/claude-assets/agents/cfn-dev-team/reviewers/quality/security-specialist.md +23 -67
- package/claude-assets/agents/cfn-dev-team/testers/api-testing-specialist.md +7 -35
- package/claude-assets/agents/cfn-dev-team/testers/chaos-engineering-specialist.md +8 -37
- package/claude-assets/agents/cfn-dev-team/testers/contract-tester.md +16 -54
- package/claude-assets/agents/cfn-dev-team/testers/integration-tester.md +17 -55
- package/claude-assets/agents/cfn-dev-team/testers/interaction-tester.md +9 -37
- package/claude-assets/agents/cfn-dev-team/testers/load-testing-specialist.md +17 -55
- package/claude-assets/agents/cfn-dev-team/testers/mutation-testing-specialist.md +17 -48
- package/claude-assets/agents/cfn-dev-team/testers/playwright-tester.md +8 -37
- package/claude-assets/agents/cfn-dev-team/testers/tester.md +7 -27
- package/claude-assets/agents/cfn-dev-team/utility/analyst.md +12 -28
- package/claude-assets/agents/cfn-dev-team/utility/code-booster.md +13 -13
- package/claude-assets/agents/cfn-dev-team/utility/context-curator.md +7 -2
- package/claude-assets/agents/cfn-dev-team/utility/epic-creator.md +5 -10
- package/claude-assets/agents/cfn-dev-team/utility/memory-leak-specialist.md +120 -714
- package/claude-assets/agents/cfn-dev-team/utility/researcher.md +12 -21
- package/claude-assets/agents/cfn-dev-team/utility/z-ai-specialist.md +146 -572
- package/claude-assets/agents/custom/cfn-docker-expert.md +102 -0
- package/claude-assets/agents/custom/cfn-loops-cli-expert.md +129 -0
- package/claude-assets/cfn-extras/agents/cfn-v3-coordinator.md +517 -0
- package/claude-assets/commands/cfn-loop-cli.md +158 -464
- package/claude-assets/commands/cfn-loop-trigger.md +114 -0
- package/claude-assets/hooks/SKILL.md +518 -0
- package/claude-assets/hooks/SKILL.md.backup +471 -0
- package/claude-assets/hooks/cfn-invoke-post-edit-ts.sh +100 -0
- package/claude-assets/hooks/cfn-invoke-post-edit-ts.sh.backup +78 -0
- package/claude-assets/hooks/cfn-invoke-post-edit.sh +22 -0
- package/claude-assets/hooks/cfn-invoke-post-edit.sh.backup +87 -0
- package/claude-assets/hooks/cfn-invoke-pre-edit-ts.sh +116 -0
- package/claude-assets/hooks/cfn-invoke-pre-edit-ts.sh.backup +94 -0
- package/claude-assets/hooks/cfn-invoke-pre-edit.sh +22 -0
- package/claude-assets/hooks/cfn-invoke-pre-edit.sh.backup +88 -0
- package/claude-assets/skills/cfn-agent-selection-with-fallback/DELIVERABLES.md +409 -0
- package/claude-assets/skills/cfn-agent-selection-with-fallback/IMPLEMENTATION_SUMMARY.md +396 -0
- package/claude-assets/skills/cfn-agent-selection-with-fallback/INTEGRATION_GUIDE.md +308 -0
- package/claude-assets/skills/cfn-agent-selection-with-fallback/QUICK_REFERENCE.md +239 -0
- package/claude-assets/skills/cfn-agent-selection-with-fallback/SKILL.md +107 -1
- package/claude-assets/skills/cfn-agent-selection-with-fallback/SKILL.md.backup +302 -0
- package/claude-assets/skills/cfn-agent-selection-with-fallback/TYPESCRIPT_MIGRATION.md +295 -0
- package/claude-assets/skills/cfn-agent-selection-with-fallback/dist/agent-selector.cjs +297 -0
- package/claude-assets/skills/cfn-agent-selection-with-fallback/dist/agent-selector.js +297 -0
- package/claude-assets/skills/cfn-agent-selection-with-fallback/dist/cli.cjs +96 -0
- package/claude-assets/skills/cfn-agent-selection-with-fallback/dist/cli.js +96 -0
- package/claude-assets/skills/cfn-agent-selection-with-fallback/select-agents-ts.sh +45 -0
- package/claude-assets/skills/cfn-agent-selection-with-fallback/select-agents-ts.sh.backup +23 -0
- package/claude-assets/skills/cfn-agent-selection-with-fallback/select-agents.sh +22 -0
- package/claude-assets/skills/cfn-agent-selection-with-fallback/select-agents.sh.backup +173 -0
- package/claude-assets/skills/cfn-agent-selection-with-fallback/src/agent-selector.test.ts +357 -0
- package/claude-assets/skills/cfn-agent-selection-with-fallback/src/agent-selector.ts +350 -0
- package/claude-assets/skills/cfn-agent-selection-with-fallback/src/cli.ts +74 -0
- package/claude-assets/skills/cfn-agent-selection-with-fallback/task-classifier.sh +22 -0
- package/claude-assets/skills/cfn-agent-selection-with-fallback/task-classifier.sh.backup +71 -0
- package/claude-assets/skills/cfn-agent-selection-with-fallback/tsconfig.json +18 -0
- package/claude-assets/skills/cfn-agent-spawning/SKILL.md +48 -1
- package/claude-assets/skills/cfn-agent-spawning/SKILL.md.backup +135 -0
- package/claude-assets/skills/cfn-agent-spawning/TYPESCRIPT_MIGRATION.md +567 -0
- package/claude-assets/skills/cfn-agent-spawning/check-dependencies.sh +22 -0
- package/claude-assets/skills/cfn-agent-spawning/check-dependencies.sh.backup +30 -0
- package/claude-assets/skills/cfn-agent-spawning/get-agent-provider-env.sh +22 -0
- package/claude-assets/skills/cfn-agent-spawning/get-agent-provider-env.sh.backup +127 -0
- package/claude-assets/skills/cfn-agent-spawning/parse-agent-provider.sh +22 -0
- package/claude-assets/skills/cfn-agent-spawning/parse-agent-provider.sh.backup +59 -0
- package/claude-assets/skills/cfn-agent-spawning/spawn-agent-wrapper.sh +63 -0
- package/claude-assets/skills/cfn-agent-spawning/spawn-agent-wrapper.sh.backup +41 -0
- package/claude-assets/skills/cfn-agent-spawning/spawn-agent.sh +26 -1
- package/claude-assets/skills/cfn-agent-spawning/spawn-templates.sh +22 -0
- package/claude-assets/skills/cfn-agent-spawning/spawn-templates.sh.backup +613 -0
- package/claude-assets/skills/cfn-agent-spawning/spawn-worker.sh +22 -0
- package/claude-assets/skills/cfn-agent-spawning/spawn-worker.sh.backup +176 -0
- package/claude-assets/skills/cfn-coordination/agent-completion.sh.backup +36 -0
- package/claude-assets/skills/cfn-coordination/coordination-signal.sh.backup +36 -0
- package/claude-assets/skills/cfn-coordination/coordination-wait.sh.backup +36 -0
- package/claude-assets/skills/cfn-dependency-ingestion/README.md +101 -0
- package/claude-assets/skills/cfn-dependency-ingestion/SKILL.md +369 -0
- package/claude-assets/skills/cfn-dependency-ingestion/build.sh +23 -0
- package/claude-assets/skills/cfn-dependency-ingestion/dist/ingest-dependencies.js +478 -0
- package/claude-assets/skills/cfn-dependency-ingestion/ingest-dependencies.sh +295 -0
- package/claude-assets/skills/cfn-dependency-ingestion/src/ingest-dependencies.ts +563 -0
- package/claude-assets/skills/cfn-loop-orchestration/.backups/unknown/1763619700_33aff4a69b99159e4e849107ebc4d09f/metadata.json +8 -0
- package/claude-assets/skills/cfn-loop-orchestration/.backups/unknown/1763619700_33aff4a69b99159e4e849107ebc4d09f/original +271 -0
- package/claude-assets/skills/cfn-loop-orchestration/.backups/unknown/1763619700_33aff4a69b99159e4e849107ebc4d09f/revert.sh +7 -0
- package/claude-assets/skills/cfn-loop-orchestration/.backups/unknown/1763671642_06496e8c399a79db08167cc00ed4b31e/metadata.json +8 -0
- package/claude-assets/skills/cfn-loop-orchestration/.backups/unknown/1763671642_06496e8c399a79db08167cc00ed4b31e/original +325 -0
- package/claude-assets/skills/cfn-loop-orchestration/.backups/unknown/1763671642_06496e8c399a79db08167cc00ed4b31e/revert.sh +7 -0
- package/claude-assets/skills/cfn-loop-orchestration/CLI_IMPLEMENTATION_SUMMARY.md +330 -0
- package/claude-assets/skills/cfn-loop-orchestration/CONFIGURATION_IMPROVEMENTS.md +318 -0
- package/claude-assets/skills/cfn-loop-orchestration/CONTEXT_LOOKUP_MIGRATION.md +308 -0
- package/claude-assets/skills/cfn-loop-orchestration/CONTEXT_LOOKUP_QUICK_START.md +378 -0
- package/claude-assets/skills/cfn-loop-orchestration/E2E_VALIDATION_REPORT.md +262 -0
- package/claude-assets/skills/cfn-loop-orchestration/IMPLEMENTATION_SUMMARY.md +319 -519
- package/claude-assets/skills/cfn-loop-orchestration/NORTH_STAR_E2E_REPORT.md +299 -0
- package/claude-assets/skills/cfn-loop-orchestration/NORTH_STAR_EXECUTION_SUMMARY.md +403 -0
- package/claude-assets/skills/cfn-loop-orchestration/NORTH_STAR_INDEX.md +323 -0
- package/claude-assets/skills/cfn-loop-orchestration/SKILL.md +159 -48
- package/claude-assets/skills/cfn-loop-orchestration/SPAWN_AGENTS_IMPLEMENTATION.md +188 -0
- package/claude-assets/skills/cfn-loop-orchestration/TEST_COVERAGE_REPORT.md +335 -0
- package/claude-assets/skills/cfn-loop-orchestration/TEST_COVERAGE_SUMMARY.md +456 -0
- package/claude-assets/skills/cfn-loop-orchestration/TYPESCRIPT_INTEGRATION_REPORT.md +709 -0
- package/claude-assets/skills/cfn-loop-orchestration/TYPESCRIPT_INTEGRATION_SUMMARY.md +257 -0
- package/claude-assets/skills/cfn-loop-orchestration/VALIDATION_REPORT.md +572 -0
- package/claude-assets/skills/cfn-loop-orchestration/VALIDATION_SUMMARY.txt +196 -0
- package/claude-assets/skills/cfn-loop-orchestration/VALIDATOR_MODULE_GUIDE.md +526 -0
- package/claude-assets/skills/cfn-loop-orchestration/archive/legacy-bash/README.md +167 -0
- package/claude-assets/skills/cfn-loop-orchestration/archive/legacy-bash/orchestrate-enhanced.sh +548 -0
- package/{.claude/skills/cfn-loop-orchestration → claude-assets/skills/cfn-loop-orchestration/archive/legacy-bash}/orchestrate-wrapper.sh +11 -1
- package/claude-assets/skills/cfn-loop-orchestration/archive/legacy-bash/orchestrate.sh +182 -0
- package/claude-assets/skills/cfn-loop-orchestration/e2e-validation-fixed.js +240 -0
- package/claude-assets/skills/cfn-loop-orchestration/e2e-validation.js +213 -0
- package/claude-assets/skills/cfn-loop-orchestration/package-lock.json +3 -0
- package/claude-assets/skills/cfn-loop-orchestration/package.json +4 -0
- package/claude-assets/skills/cfn-loop-orchestration/run-north-star-e2e.ts +210 -0
- package/claude-assets/skills/cfn-loop-orchestration/src/cli/orchestrator-cli.ts +396 -0
- package/claude-assets/skills/cfn-loop-orchestration/src/helpers/CONFIDENCE_AGGREGATOR.md +564 -0
- package/claude-assets/skills/cfn-loop-orchestration/src/helpers/CONFIDENCE_AGGREGATOR_QUICK_REF.md +241 -0
- package/claude-assets/skills/cfn-loop-orchestration/src/helpers/CONTEXT_INJECTOR_IMPLEMENTATION.md +375 -0
- package/claude-assets/skills/cfn-loop-orchestration/src/helpers/CONTEXT_INJECTOR_QUICK_REFERENCE.md +362 -0
- package/claude-assets/skills/cfn-loop-orchestration/src/helpers/CONTEXT_INJECTOR_README.md +307 -0
- package/claude-assets/skills/cfn-loop-orchestration/src/helpers/CONTEXT_INJECTOR_USAGE_GUIDE.md +508 -0
- package/claude-assets/skills/cfn-loop-orchestration/src/helpers/confidence-aggregator.ts +473 -0
- package/claude-assets/skills/cfn-loop-orchestration/src/helpers/consensus.ts +1 -1
- package/claude-assets/skills/cfn-loop-orchestration/src/helpers/context-injector.ts +349 -0
- package/claude-assets/skills/cfn-loop-orchestration/src/helpers/context-lookup.ts +486 -0
- package/claude-assets/skills/cfn-loop-orchestration/src/helpers/deliverable-verifier.ts +6 -2
- package/claude-assets/skills/cfn-loop-orchestration/src/helpers/gate-check.ts +1 -1
- package/claude-assets/skills/cfn-loop-orchestration/src/helpers/product-owner-decision.ts +316 -0
- package/claude-assets/skills/cfn-loop-orchestration/src/helpers/spawn-agents.ts +357 -0
- package/claude-assets/skills/cfn-loop-orchestration/src/helpers/validator.ts +276 -0
- package/claude-assets/skills/cfn-loop-orchestration/src/index.ts +2 -0
- package/claude-assets/skills/cfn-loop-orchestration/src/orchestrate.ts +743 -2
- package/claude-assets/skills/cfn-loop-orchestration/src/types.ts +56 -0
- package/claude-assets/skills/cfn-loop-orchestration/test-cli.sh +92 -0
- package/claude-assets/skills/cfn-loop-orchestration/test-typescript-integration.sh +442 -0
- package/claude-assets/skills/cfn-loop-orchestration/tests/agent-spawner.test.ts +124 -0
- package/claude-assets/skills/cfn-loop-orchestration/tests/confidence-aggregator.test.ts +604 -0
- package/claude-assets/skills/cfn-loop-orchestration/tests/context-injector.test.ts +561 -0
- package/claude-assets/skills/cfn-loop-orchestration/tests/context-lookup.test.ts +661 -0
- package/claude-assets/skills/cfn-loop-orchestration/tests/deliverable-verifier.test.ts +2 -2
- package/claude-assets/skills/cfn-loop-orchestration/tests/gate-check-edge-cases.test.ts +422 -0
- package/claude-assets/skills/cfn-loop-orchestration/tests/gate-checker.test.ts +276 -0
- package/claude-assets/skills/cfn-loop-orchestration/tests/logger.test.ts +291 -0
- package/claude-assets/skills/cfn-loop-orchestration/tests/north-star-e2e.test.ts +334 -0
- package/claude-assets/skills/cfn-loop-orchestration/tests/redis-coordinator.test.ts +321 -0
- package/claude-assets/skills/cfn-loop-orchestration/tests/spawn-agents.test.ts +284 -0
- package/claude-assets/skills/cfn-loop-orchestration/tests/validator.test.ts +643 -0
- package/claude-assets/skills/cfn-loop-output-processing/.eslintrc.json +33 -0
- package/claude-assets/skills/cfn-loop-output-processing/DELIVERY_SUMMARY.txt +462 -0
- package/claude-assets/skills/cfn-loop-output-processing/DEPRECATION_NOTICE.md +183 -0
- package/claude-assets/skills/cfn-loop-output-processing/EXAMPLES.md +609 -0
- package/claude-assets/skills/cfn-loop-output-processing/IMPLEMENTATION_SUMMARY.md +418 -0
- package/claude-assets/skills/cfn-loop-output-processing/INDEX.md +531 -0
- package/claude-assets/skills/cfn-loop-output-processing/MIGRATION.md +362 -0
- package/claude-assets/skills/cfn-loop-output-processing/README.md +114 -0
- package/claude-assets/skills/cfn-loop-output-processing/SKILL.md +633 -0
- package/{.claude/skills/cfn-docker-redis-coordination → claude-assets/skills/cfn-loop-output-processing}/jest.config.js +7 -15
- package/claude-assets/skills/cfn-loop-output-processing/package.json +50 -0
- package/claude-assets/skills/cfn-loop-output-processing/src/cli/process-loop2.ts +195 -0
- package/claude-assets/skills/cfn-loop-output-processing/src/cli/process-loop3.ts +157 -0
- package/claude-assets/skills/cfn-loop-output-processing/src/output-processor.ts +632 -0
- package/claude-assets/skills/cfn-loop-output-processing/tests/output-processor.test.ts +617 -0
- package/claude-assets/skills/{cfn-docker-redis-coordination → cfn-loop-output-processing}/tsconfig.json +16 -7
- package/claude-assets/skills/cfn-loop-validation/IMPLEMENTATION_SUMMARY.md +672 -0
- package/claude-assets/skills/cfn-loop-validation/INDEX.md +531 -0
- package/claude-assets/skills/cfn-loop-validation/README_TYPESCRIPT.md +454 -0
- package/claude-assets/skills/cfn-loop-validation/SKILL.md +48 -1
- package/claude-assets/skills/cfn-loop-validation/SKILL.md.backup +353 -0
- package/claude-assets/skills/cfn-loop-validation/SKILL_TYPESCRIPT.md +782 -0
- package/claude-assets/skills/cfn-loop-validation/VAPOR_DETECTION_EXAMPLES.md +598 -0
- package/claude-assets/skills/cfn-loop-validation/check-dependencies.sh +22 -0
- package/claude-assets/skills/cfn-loop-validation/check-dependencies.sh.backup +31 -0
- package/claude-assets/skills/cfn-loop-validation/detect-vapor.sh +59 -0
- package/claude-assets/skills/cfn-loop-validation/detect-vapor.sh.backup +37 -0
- package/claude-assets/skills/cfn-loop-validation/dist/.tsbuildinfo +1 -0
- package/claude-assets/skills/cfn-loop-validation/dist/cli/detect-vapor.d.ts +14 -0
- package/claude-assets/skills/cfn-loop-validation/dist/cli/detect-vapor.d.ts.map +1 -0
- package/claude-assets/skills/cfn-loop-validation/dist/cli/detect-vapor.js +185 -0
- package/claude-assets/skills/cfn-loop-validation/dist/cli/detect-vapor.js.map +1 -0
- package/claude-assets/skills/cfn-loop-validation/dist/cli/validate-deliverables.d.ts +14 -0
- package/claude-assets/skills/cfn-loop-validation/dist/cli/validate-deliverables.d.ts.map +1 -0
- package/claude-assets/skills/cfn-loop-validation/dist/cli/validate-deliverables.js +176 -0
- package/claude-assets/skills/cfn-loop-validation/dist/cli/validate-deliverables.js.map +1 -0
- package/claude-assets/skills/cfn-loop-validation/dist/cli/validate-gate.d.ts +19 -0
- package/claude-assets/skills/cfn-loop-validation/dist/cli/validate-gate.d.ts.map +1 -0
- package/claude-assets/skills/cfn-loop-validation/dist/cli/validate-gate.js +123 -0
- package/claude-assets/skills/cfn-loop-validation/dist/cli/validate-gate.js.map +1 -0
- package/claude-assets/skills/cfn-loop-validation/dist/types.d.ts +156 -0
- package/claude-assets/skills/cfn-loop-validation/dist/types.d.ts.map +1 -0
- package/claude-assets/skills/cfn-loop-validation/dist/types.js +66 -0
- package/claude-assets/skills/cfn-loop-validation/dist/types.js.map +1 -0
- package/claude-assets/skills/cfn-loop-validation/dist/validator.d.ts +85 -0
- package/claude-assets/skills/cfn-loop-validation/dist/validator.d.ts.map +1 -0
- package/claude-assets/skills/cfn-loop-validation/dist/validator.js +411 -0
- package/claude-assets/skills/cfn-loop-validation/dist/validator.js.map +1 -0
- package/claude-assets/skills/cfn-loop-validation/orchestrate-cfn-loop.sh +22 -0
- package/claude-assets/skills/cfn-loop-validation/orchestrate-cfn-loop.sh.backup +252 -0
- package/claude-assets/skills/cfn-loop-validation/package.json +93 -0
- package/claude-assets/skills/cfn-loop-validation/src/cli/detect-vapor.ts +177 -0
- package/claude-assets/skills/cfn-loop-validation/src/cli/validate-deliverables.ts +161 -0
- package/claude-assets/skills/cfn-loop-validation/src/cli/validate-gate.ts +139 -0
- package/claude-assets/skills/cfn-loop-validation/src/types.ts +215 -0
- package/claude-assets/skills/cfn-loop-validation/src/validator.ts +503 -0
- package/claude-assets/skills/cfn-loop-validation/tests/validator.test.ts +537 -0
- package/claude-assets/skills/{cfn-redis-coordination → cfn-loop-validation}/tsconfig.json +34 -31
- package/claude-assets/skills/cfn-loop-validation/validate-deliverables.sh +59 -0
- package/claude-assets/skills/cfn-loop-validation/validate-deliverables.sh.backup +37 -0
- package/claude-assets/skills/cfn-loop-validation/validate-gate.sh +63 -0
- package/claude-assets/skills/cfn-loop-validation/validate-gate.sh.backup +41 -0
- package/claude-assets/skills/cfn-loop-validation/validate-iteration.sh +22 -0
- package/claude-assets/skills/cfn-loop-validation/validate-iteration.sh.backup +134 -0
- package/claude-assets/skills/cfn-product-owner-decision/SKILL.md +479 -147
- package/claude-assets/skills/cfn-product-owner-decision/TYPESCRIPT_IMPLEMENTATION.md +653 -0
- package/{.claude/skills/cfn-product-owner-decision → claude-assets/skills/cfn-product-owner-decision/archive/legacy-bash}/execute-decision.sh +24 -2
- package/claude-assets/skills/cfn-provider-routing/README.md +129 -0
- package/claude-assets/skills/cfn-provider-routing/SKILL.md +192 -0
- package/claude-assets/skills/cfn-provider-routing/resolve-provider-model.ts +223 -0
- package/claude-assets/skills/pre-edit-backup/SKILL.md +324 -0
- package/claude-assets/skills/pre-edit-backup/SKILL.md.backup +277 -0
- package/claude-assets/skills/pre-edit-backup/backup.sh +22 -0
- package/claude-assets/skills/pre-edit-backup/backup.sh.backup +107 -0
- package/dist/agents/agent-loader.js +146 -165
- package/dist/agents/agent-loader.js.map +1 -1
- package/dist/api/auth-endpoints.js +415 -0
- package/dist/api/auth-endpoints.js.map +1 -0
- package/dist/api/task-endpoints.js +562 -0
- package/dist/api/task-endpoints.js.map +1 -0
- package/dist/backend/server.js +418 -0
- package/dist/backend/server.js.map +1 -0
- package/dist/cfn-loop/product-owner/decision-parser.js +356 -0
- package/dist/cfn-loop/product-owner/decision-parser.js.map +1 -0
- package/dist/cfn-loop/product-owner/index.js +1 -0
- package/dist/cfn-loop/product-owner/index.js.map +1 -1
- package/dist/cli/agent-command.js +1 -1
- package/dist/cli/agent-command.js.map +1 -1
- package/dist/cli/agent-completion.js +273 -0
- package/dist/cli/agent-completion.js.map +1 -0
- package/dist/cli/agent-prompt-builder.js +83 -48
- package/dist/cli/agent-prompt-builder.js.map +1 -1
- package/dist/cli/agent-spawner.js +499 -0
- package/dist/cli/agent-spawner.js.map +1 -0
- package/dist/cli/anthropic-client.js +10 -3
- package/dist/cli/anthropic-client.js.map +1 -1
- package/dist/cli/config-manager.js +91 -109
- package/dist/cli/index.js +11 -0
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/parse-decision-cli.js +268 -0
- package/dist/cli/parse-decision-cli.js.map +1 -0
- package/dist/cli/post-edit-hook.js +83 -0
- package/dist/cli/post-edit-hook.js.map +1 -0
- package/dist/cli/pre-edit-hook.js +77 -0
- package/dist/cli/pre-edit-hook.js.map +1 -0
- package/dist/cli/spawn-agent-cli.js +209 -0
- package/dist/cli/spawn-agent-cli.js.map +1 -0
- package/dist/coordination/coordination-wrapper.js +383 -0
- package/dist/coordination/coordination-wrapper.js.map +1 -0
- package/dist/coordination/store-success-criteria.js +68 -0
- package/dist/coordination/store-success-criteria.js.map +1 -0
- package/dist/coordination/store-task-context.js +65 -0
- package/dist/coordination/store-task-context.js.map +1 -0
- package/dist/hooks/backup-manager.js +273 -0
- package/dist/hooks/backup-manager.js.map +1 -0
- package/dist/hooks/post-edit-validator.js +388 -0
- package/dist/hooks/post-edit-validator.js.map +1 -0
- package/dist/integration/index.js +19 -0
- package/dist/integration/index.js.map +1 -0
- package/dist/integration/task-mode-adapter.js +297 -0
- package/dist/integration/task-mode-adapter.js.map +1 -0
- package/dist/integration/trigger-dev-client.js +253 -0
- package/dist/integration/trigger-dev-client.js.map +1 -0
- package/dist/integration/trigger-dev-webhooks.js +362 -0
- package/dist/integration/trigger-dev-webhooks.js.map +1 -0
- package/dist/lib/path-validator.js +14 -5
- package/dist/lib/path-validator.js.map +1 -1
- package/dist/lib/redis-queue-manager.js +5 -1
- package/dist/lib/redis-queue-manager.js.map +1 -1
- package/dist/middleware/authentication.js +317 -0
- package/dist/middleware/authentication.js.map +1 -0
- package/dist/services/authentication.js +669 -0
- package/dist/services/authentication.js.map +1 -0
- package/dist/services/session-management.js +436 -0
- package/dist/services/session-management.js.map +1 -0
- package/dist/services/skill-deployment.js +8 -6
- package/dist/services/skill-deployment.js.map +1 -1
- package/dist/services/user-service.js +710 -0
- package/dist/services/user-service.js.map +1 -0
- package/dist/types/trigger-dev-events.d.js +10 -0
- package/dist/types/trigger-dev-events.d.js.map +1 -0
- package/docs/README.md +240 -0
- package/package.json +13 -4
- package/scripts/compare-workflow-performance.sh +556 -0
- package/scripts/migrate-to-optimized-workflows.sh +438 -0
- package/scripts/organize-docs.sh +338 -0
- package/scripts/trigger-dev-setup.sh +267 -0
- package/.claude/skills/cfn-docker-redis-coordination/MIGRATION_SUMMARY.md +0 -348
- package/.claude/skills/cfn-docker-redis-coordination/README.md +0 -294
- package/.claude/skills/cfn-docker-redis-coordination/SKILL.md +0 -435
- package/.claude/skills/cfn-docker-redis-coordination/coordinate.sh +0 -650
- package/.claude/skills/cfn-docker-redis-coordination/coordinate.sh.backup-1763145142 +0 -641
- package/.claude/skills/cfn-docker-redis-coordination/package-lock.json +0 -5259
- package/.claude/skills/cfn-docker-redis-coordination/package.json +0 -40
- package/.claude/skills/cfn-docker-redis-coordination/src/coordinator.ts +0 -801
- package/.claude/skills/cfn-docker-redis-coordination/src/index.ts +0 -42
- package/.claude/skills/cfn-docker-redis-coordination/src/types.ts +0 -351
- package/.claude/skills/cfn-docker-redis-coordination/tests/coordinator.test.ts +0 -1464
- package/.claude/skills/cfn-docker-redis-coordination/tsconfig.json +0 -30
- package/.claude/skills/cfn-loop-orchestration/helpers/auto-tune-timeouts.sh +0 -228
- package/.claude/skills/cfn-loop-orchestration/helpers/consensus-ts.sh +0 -104
- package/.claude/skills/cfn-loop-orchestration/helpers/consensus.sh +0 -94
- package/.claude/skills/cfn-loop-orchestration/helpers/context-injection.sh +0 -142
- package/.claude/skills/cfn-loop-orchestration/helpers/context-lookup.sh +0 -359
- package/.claude/skills/cfn-loop-orchestration/helpers/deliverable-verifier-ts.sh +0 -123
- package/.claude/skills/cfn-loop-orchestration/helpers/deliverable-verifier.sh +0 -71
- package/.claude/skills/cfn-loop-orchestration/helpers/gate-check.sh +0 -56
- package/.claude/skills/cfn-loop-orchestration/helpers/iteration-manager-ts.sh +0 -89
- package/.claude/skills/cfn-loop-orchestration/helpers/iteration-manager.sh +0 -87
- package/.claude/skills/cfn-loop-orchestration/helpers/orchestrate-ts.sh +0 -104
- package/.claude/skills/cfn-loop-orchestration/helpers/parse-test-results.sh +0 -56
- package/.claude/skills/cfn-loop-orchestration/helpers/spawn-agents.sh +0 -290
- package/.claude/skills/cfn-loop-orchestration/helpers/timeout-calculator-ts.sh +0 -47
- package/.claude/skills/cfn-loop-orchestration/helpers/timeout-calculator.sh +0 -51
- package/.claude/skills/cfn-loop-orchestration/orchestrate.sh +0 -1345
- package/.claude/skills/cfn-redis-coordination/AGENT_LOGGING.md +0 -280
- package/.claude/skills/cfn-redis-coordination/BZPOPMIN_FIX_SUMMARY.md +0 -209
- package/.claude/skills/cfn-redis-coordination/CENTRALIZED_REDIS_WRAPPER.md +0 -319
- package/.claude/skills/cfn-redis-coordination/agent-log.sh.bak +0 -124
- package/.claude/skills/cfn-redis-coordination/config.json +0 -61
- package/.claude/skills/cfn-redis-coordination/demos/phase4-wake-queue-test-report.md +0 -82
- package/.claude/skills/cfn-redis-coordination/demos/test-bzpopmin-fix.sh +0 -274
- package/.claude/skills/cfn-redis-coordination/demos/test-cancel-swarm.sh +0 -0
- package/.claude/skills/cfn-redis-coordination/docs/migration/PHASE_3_REDIS_COORDINATION_COMPLETION_REPORT.md +0 -553
- package/.claude/skills/cfn-redis-coordination/jest.config.js +0 -23
- package/.claude/skills/cfn-redis-coordination/package-lock.json +0 -5272
- package/.claude/skills/cfn-redis-coordination/package.json +0 -45
- package/.claude/skills/cfn-redis-coordination/src/agent-logger.ts +0 -446
- package/.claude/skills/cfn-redis-coordination/src/agent-recovery.ts +0 -454
- package/.claude/skills/cfn-redis-coordination/src/completion-reporter.ts +0 -396
- package/.claude/skills/cfn-redis-coordination/src/context-manager.ts +0 -327
- package/.claude/skills/cfn-redis-coordination/src/index.ts +0 -82
- package/.claude/skills/cfn-redis-coordination/src/mode-detector.ts +0 -155
- package/.claude/skills/cfn-redis-coordination/src/redis/redis-client.ts +0 -305
- package/.claude/skills/cfn-redis-coordination/src/redis/redis-functions.ts +0 -283
- package/.claude/skills/cfn-redis-coordination/src/redis-client.ts +0 -654
- package/.claude/skills/cfn-redis-coordination/src/result-collector.ts +0 -437
- package/.claude/skills/cfn-redis-coordination/src/swarm-manager.ts +0 -494
- package/.claude/skills/cfn-redis-coordination/src/task-analyzer.ts +0 -404
- package/.claude/skills/cfn-redis-coordination/src/task-executor.ts +0 -423
- package/.claude/skills/cfn-redis-coordination/src/types.ts +0 -235
- package/.claude/skills/cfn-redis-coordination/src/waiting-coordinator.ts +0 -587
- package/.claude/skills/cfn-redis-coordination/store-success-criteria.sh +0 -85
- package/.claude/skills/cfn-redis-coordination/test-connection-attempts.js +0 -70
- package/.claude/skills/cfn-redis-coordination/test-mode-simple.js +0 -121
- package/.claude/skills/cfn-redis-coordination/test-redis-check.js +0 -84
- package/.claude/skills/cfn-redis-coordination/test-task-mode-redis.cjs +0 -391
- package/.claude/skills/cfn-redis-coordination/tests/coordination.test.ts +0 -788
- package/.claude/skills/cfn-redis-coordination/update-all-scripts.sh +0 -67
- package/claude-assets/agents/cfn-dev-team/coordinators/cfn-v3-coordinator.md +0 -980
- package/claude-assets/agents/typescript-specialist.md +0 -280
- package/claude-assets/skills/cfn-docker-redis-coordination/MIGRATION_SUMMARY.md +0 -348
- package/claude-assets/skills/cfn-docker-redis-coordination/README.md +0 -294
- package/claude-assets/skills/cfn-docker-redis-coordination/SKILL.md +0 -435
- package/claude-assets/skills/cfn-docker-redis-coordination/coordinate.sh +0 -650
- package/claude-assets/skills/cfn-docker-redis-coordination/coordinate.sh.backup-1763145142 +0 -641
- package/claude-assets/skills/cfn-docker-redis-coordination/jest.config.js +0 -37
- package/claude-assets/skills/cfn-docker-redis-coordination/package-lock.json +0 -5259
- package/claude-assets/skills/cfn-docker-redis-coordination/package.json +0 -40
- package/claude-assets/skills/cfn-docker-redis-coordination/src/coordinator.ts +0 -801
- package/claude-assets/skills/cfn-docker-redis-coordination/src/index.ts +0 -42
- package/claude-assets/skills/cfn-docker-redis-coordination/src/types.ts +0 -351
- package/claude-assets/skills/cfn-docker-redis-coordination/tests/coordinator.test.ts +0 -1464
- package/claude-assets/skills/cfn-loop-orchestration/helpers/auto-tune-timeouts.sh +0 -228
- package/claude-assets/skills/cfn-loop-orchestration/helpers/consensus-ts.sh +0 -104
- package/claude-assets/skills/cfn-loop-orchestration/helpers/consensus.sh +0 -94
- package/claude-assets/skills/cfn-loop-orchestration/helpers/context-injection.sh +0 -142
- package/claude-assets/skills/cfn-loop-orchestration/helpers/context-lookup.sh +0 -359
- package/claude-assets/skills/cfn-loop-orchestration/helpers/deliverable-verifier-ts.sh +0 -123
- package/claude-assets/skills/cfn-loop-orchestration/helpers/deliverable-verifier.sh +0 -71
- package/claude-assets/skills/cfn-loop-orchestration/helpers/gate-check.sh +0 -56
- package/claude-assets/skills/cfn-loop-orchestration/helpers/iteration-manager-ts.sh +0 -89
- package/claude-assets/skills/cfn-loop-orchestration/helpers/iteration-manager.sh +0 -87
- package/claude-assets/skills/cfn-loop-orchestration/helpers/orchestrate-ts.sh +0 -104
- package/claude-assets/skills/cfn-loop-orchestration/helpers/parse-test-results.sh +0 -56
- package/claude-assets/skills/cfn-loop-orchestration/helpers/spawn-agents.sh +0 -290
- package/claude-assets/skills/cfn-loop-orchestration/helpers/timeout-calculator-ts.sh +0 -47
- package/claude-assets/skills/cfn-loop-orchestration/helpers/timeout-calculator.sh +0 -51
- package/claude-assets/skills/cfn-loop-orchestration/orchestrate.sh +0 -1345
- package/claude-assets/skills/cfn-redis-cleanup/cleanup-redis.sh +0 -130
- package/claude-assets/skills/cfn-redis-coordination/AGENT_LOGGING.md +0 -280
- package/claude-assets/skills/cfn-redis-coordination/BZPOPMIN_FIX_SUMMARY.md +0 -209
- package/claude-assets/skills/cfn-redis-coordination/CENTRALIZED_REDIS_WRAPPER.md +0 -319
- package/claude-assets/skills/cfn-redis-coordination/agent-log.sh.bak +0 -124
- package/claude-assets/skills/cfn-redis-coordination/config.json +0 -61
- package/claude-assets/skills/cfn-redis-coordination/demos/phase4-wake-queue-test-report.md +0 -82
- package/claude-assets/skills/cfn-redis-coordination/demos/test-bzpopmin-fix.sh +0 -274
- package/claude-assets/skills/cfn-redis-coordination/demos/test-cancel-swarm.sh +0 -0
- package/claude-assets/skills/cfn-redis-coordination/docs/migration/PHASE_3_REDIS_COORDINATION_COMPLETION_REPORT.md +0 -553
- package/claude-assets/skills/cfn-redis-coordination/jest.config.js +0 -23
- package/claude-assets/skills/cfn-redis-coordination/package-lock.json +0 -5272
- package/claude-assets/skills/cfn-redis-coordination/package.json +0 -45
- package/claude-assets/skills/cfn-redis-coordination/src/agent-logger.ts +0 -446
- package/claude-assets/skills/cfn-redis-coordination/src/agent-recovery.ts +0 -454
- package/claude-assets/skills/cfn-redis-coordination/src/completion-reporter.ts +0 -396
- package/claude-assets/skills/cfn-redis-coordination/src/context-manager.ts +0 -327
- package/claude-assets/skills/cfn-redis-coordination/src/index.ts +0 -82
- package/claude-assets/skills/cfn-redis-coordination/src/mode-detector.ts +0 -155
- package/claude-assets/skills/cfn-redis-coordination/src/redis/redis-client.ts +0 -305
- package/claude-assets/skills/cfn-redis-coordination/src/redis/redis-functions.ts +0 -283
- package/claude-assets/skills/cfn-redis-coordination/src/redis-client.ts +0 -654
- package/claude-assets/skills/cfn-redis-coordination/src/result-collector.ts +0 -437
- package/claude-assets/skills/cfn-redis-coordination/src/swarm-manager.ts +0 -494
- package/claude-assets/skills/cfn-redis-coordination/src/task-analyzer.ts +0 -404
- package/claude-assets/skills/cfn-redis-coordination/src/task-executor.ts +0 -423
- package/claude-assets/skills/cfn-redis-coordination/src/types.ts +0 -235
- package/claude-assets/skills/cfn-redis-coordination/src/waiting-coordinator.ts +0 -587
- package/claude-assets/skills/cfn-redis-coordination/store-success-criteria.sh +0 -85
- package/claude-assets/skills/cfn-redis-coordination/test-connection-attempts.js +0 -70
- package/claude-assets/skills/cfn-redis-coordination/test-mode-simple.js +0 -121
- package/claude-assets/skills/cfn-redis-coordination/test-redis-check.js +0 -84
- package/claude-assets/skills/cfn-redis-coordination/test-task-mode-redis.cjs +0 -391
- package/claude-assets/skills/cfn-redis-coordination/tests/coordination.test.ts +0 -788
- package/claude-assets/skills/cfn-redis-coordination/update-all-scripts.sh +0 -67
- package/claude-assets/skills/cfn-redis-data-extraction/SKILL.md +0 -442
- package/claude-assets/skills/cfn-redis-data-extraction/extract.sh +0 -306
- package/dist/coordination/index.js +0 -25
- package/dist/coordination/index.js.map +0 -1
- package/docs/BUG_19_MEMORY_LEAK_TASK_MODE.md +0 -405
- package/docs/MEMORY_CLEANUP_GUIDE.md +0 -358
- package/docs/MEMORY_LEAK_FIX_SUMMARY.md +0 -322
- package/docs/REDIS_CLEANUP_EXECUTIVE_SUMMARY.md +0 -319
- package/docs/REDIS_CLEANUP_VERIFICATION_REPORT.md +0 -574
- /package/.claude/skills/cfn-loop-orchestration/{inject-loop-context.sh → archive/legacy-bash/inject-loop-context.sh} +0 -0
- /package/.claude/skills/cfn-loop-orchestration/{monitor-execution.sh → archive/legacy-bash/monitor-execution.sh} +0 -0
- /package/.claude/skills/cfn-redis-coordination/{agent-log.sh → agent-log.sh.backup} +0 -0
- /package/.claude/skills/cfn-redis-coordination/{agent-recovery.sh → agent-recovery.sh.backup} +0 -0
- /package/.claude/skills/cfn-redis-coordination/{analyze-task-complexity.sh → analyze-task-complexity.sh.backup} +0 -0
- /package/.claude/skills/cfn-redis-coordination/bash-wrappers/{store-context.sh → store-context.sh.backup} +0 -0
- /package/.claude/skills/cfn-redis-coordination/{cancel-swarm.sh → cancel-swarm.sh.backup} +0 -0
- /package/.claude/skills/cfn-redis-coordination/{cfn-loop-exec.sh → cfn-loop-exec.sh.backup} +0 -0
- /package/.claude/skills/cfn-redis-coordination/{cfn-loop-relaunch.sh → cfn-loop-relaunch.sh.backup} +0 -0
- /package/.claude/skills/cfn-redis-coordination/{collect-confidence-scores.sh → collect-confidence-scores.sh.backup} +0 -0
- /package/.claude/skills/cfn-redis-coordination/{collect-results.sh → collect-results.sh.backup} +0 -0
- /package/.claude/skills/cfn-redis-coordination/{complete-swarm.sh → complete-swarm.sh.backup} +0 -0
- /package/.claude/skills/cfn-redis-coordination/{get-context.sh → get-context.sh.backup} +0 -0
- /package/.claude/skills/cfn-redis-coordination/{get-success-criteria.sh → get-success-criteria.sh.backup} +0 -0
- /package/.claude/skills/cfn-redis-coordination/{invoke-waiting-mode.sh → invoke-waiting-mode.sh.backup} +0 -0
- /package/.claude/skills/cfn-redis-coordination/{redis-cli-wrapper.sh → redis-cli-wrapper.sh.backup} +0 -0
- /package/.claude/skills/cfn-redis-coordination/{redis-functions.sh → redis-functions.sh.backup} +0 -0
- /package/.claude/skills/cfn-redis-coordination/{report-completion.sh → report-completion.sh.backup} +0 -0
- /package/.claude/skills/cfn-redis-coordination/{store-context.sh → store-context.sh.backup} +0 -0
- /package/claude-assets/skills/cfn-loop-orchestration/{inject-loop-context.sh → archive/legacy-bash/inject-loop-context.sh} +0 -0
- /package/claude-assets/skills/cfn-loop-orchestration/{monitor-execution.sh → archive/legacy-bash/monitor-execution.sh} +0 -0
- /package/claude-assets/skills/cfn-redis-coordination/{agent-log.sh → agent-log.sh.backup} +0 -0
- /package/claude-assets/skills/cfn-redis-coordination/{agent-recovery.sh → agent-recovery.sh.backup} +0 -0
- /package/claude-assets/skills/cfn-redis-coordination/{analyze-task-complexity.sh → analyze-task-complexity.sh.backup} +0 -0
- /package/claude-assets/skills/cfn-redis-coordination/bash-wrappers/{store-context.sh → store-context.sh.backup} +0 -0
- /package/claude-assets/skills/cfn-redis-coordination/{cancel-swarm.sh → cancel-swarm.sh.backup} +0 -0
- /package/claude-assets/skills/cfn-redis-coordination/{cfn-loop-exec.sh → cfn-loop-exec.sh.backup} +0 -0
- /package/claude-assets/skills/cfn-redis-coordination/{cfn-loop-relaunch.sh → cfn-loop-relaunch.sh.backup} +0 -0
- /package/claude-assets/skills/cfn-redis-coordination/{collect-confidence-scores.sh → collect-confidence-scores.sh.backup} +0 -0
- /package/claude-assets/skills/cfn-redis-coordination/{collect-results.sh → collect-results.sh.backup} +0 -0
- /package/claude-assets/skills/cfn-redis-coordination/{complete-swarm.sh → complete-swarm.sh.backup} +0 -0
- /package/claude-assets/skills/cfn-redis-coordination/{get-context.sh → get-context.sh.backup} +0 -0
- /package/claude-assets/skills/cfn-redis-coordination/{get-success-criteria.sh → get-success-criteria.sh.backup} +0 -0
- /package/claude-assets/skills/cfn-redis-coordination/{invoke-waiting-mode.sh → invoke-waiting-mode.sh.backup} +0 -0
- /package/claude-assets/skills/cfn-redis-coordination/{redis-cli-wrapper.sh → redis-cli-wrapper.sh.backup} +0 -0
- /package/claude-assets/skills/cfn-redis-coordination/{redis-functions.sh → redis-functions.sh.backup} +0 -0
- /package/claude-assets/skills/cfn-redis-coordination/{report-completion.sh → report-completion.sh.backup} +0 -0
- /package/claude-assets/skills/cfn-redis-coordination/{store-context.sh → store-context.sh.backup} +0 -0
|
@@ -0,0 +1,209 @@
|
|
|
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 } from 'path';
|
|
15
|
+
/**
|
|
16
|
+
* Parse command-line arguments
|
|
17
|
+
*/ function parseArgs(args) {
|
|
18
|
+
const parsed = {
|
|
19
|
+
background: true
|
|
20
|
+
};
|
|
21
|
+
for(let i = 0; i < args.length; i++){
|
|
22
|
+
const arg = args[i];
|
|
23
|
+
if (arg === '--help') {
|
|
24
|
+
parsed.help = true;
|
|
25
|
+
} else if (arg === '--version') {
|
|
26
|
+
parsed.version = true;
|
|
27
|
+
} else if (arg === '--json') {
|
|
28
|
+
parsed.json = true;
|
|
29
|
+
} else if (arg === '--foreground') {
|
|
30
|
+
parsed.background = false;
|
|
31
|
+
} else if (arg === '--background') {
|
|
32
|
+
parsed.background = true;
|
|
33
|
+
} else if (arg === '--task-id' || arg === '-t') {
|
|
34
|
+
parsed.taskId = args[++i];
|
|
35
|
+
} else if (arg === '--iteration' || arg === '-i') {
|
|
36
|
+
parsed.iteration = parseInt(args[++i], 10);
|
|
37
|
+
} else if (arg === '--mode' || arg === '-m') {
|
|
38
|
+
parsed.mode = args[++i];
|
|
39
|
+
} else if (arg === '--provider' || arg === '-p') {
|
|
40
|
+
parsed.provider = args[++i];
|
|
41
|
+
} else if (arg === '--model') {
|
|
42
|
+
parsed.model = args[++i];
|
|
43
|
+
} else if (!arg.startsWith('-')) {
|
|
44
|
+
if (!parsed.agentType) {
|
|
45
|
+
parsed.agentType = arg;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
return parsed;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Print help message
|
|
53
|
+
*/ function printHelp() {
|
|
54
|
+
console.log(`
|
|
55
|
+
Agent Spawning CLI
|
|
56
|
+
|
|
57
|
+
USAGE:
|
|
58
|
+
spawn-agent-cli <agent-type> [OPTIONS]
|
|
59
|
+
|
|
60
|
+
ARGUMENTS:
|
|
61
|
+
<agent-type> Type of agent to spawn (e.g., backend-dev, tester)
|
|
62
|
+
|
|
63
|
+
OPTIONS:
|
|
64
|
+
-t, --task-id <id> Task ID for coordination (required for CLI mode)
|
|
65
|
+
-i, --iteration <n> Iteration number (default: 1)
|
|
66
|
+
-m, --mode <mode> Mode: mvp, standard, enterprise (default: standard)
|
|
67
|
+
-p, --provider <p> Provider: zai, anthropic, etc. (default: auto-detect)
|
|
68
|
+
--model <model> Explicit model name (default: auto-detect)
|
|
69
|
+
--foreground Run in foreground (default: background)
|
|
70
|
+
--background Run in background (default)
|
|
71
|
+
--json Output result as JSON
|
|
72
|
+
-h, --help Show this help message
|
|
73
|
+
-v, --version Show version information
|
|
74
|
+
|
|
75
|
+
EXAMPLES:
|
|
76
|
+
# Basic agent spawn
|
|
77
|
+
spawn-agent-cli backend-dev --task-id task-123
|
|
78
|
+
|
|
79
|
+
# With explicit iteration
|
|
80
|
+
spawn-agent-cli tester --task-id task-123 --iteration 2
|
|
81
|
+
|
|
82
|
+
# With custom provider
|
|
83
|
+
spawn-agent-cli reviewer --task-id task-123 --provider anthropic
|
|
84
|
+
|
|
85
|
+
# JSON output for integration
|
|
86
|
+
spawn-agent-cli coder --task-id task-123 --json
|
|
87
|
+
|
|
88
|
+
ENVIRONMENT VARIABLES:
|
|
89
|
+
TASK_ID Task ID (can be set instead of --task-id)
|
|
90
|
+
PROJECT_ROOT Project root directory (default: cwd)
|
|
91
|
+
AGENT_ID Custom agent ID (default: generated)
|
|
92
|
+
`);
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Print version information
|
|
96
|
+
*/ function printVersion() {
|
|
97
|
+
try {
|
|
98
|
+
const packageJson = JSON.parse(readFileSync(resolve(__dirname, '../../package.json'), 'utf-8'));
|
|
99
|
+
console.log(`spawn-agent-cli v${packageJson.version}`);
|
|
100
|
+
} catch {
|
|
101
|
+
console.log('spawn-agent-cli v1.0.0');
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Validate CLI arguments
|
|
106
|
+
*/ function validateArgs(args) {
|
|
107
|
+
const errors = [];
|
|
108
|
+
if (!args.agentType) {
|
|
109
|
+
errors.push('Agent type is required');
|
|
110
|
+
}
|
|
111
|
+
const taskId = args.taskId || process.env.TASK_ID;
|
|
112
|
+
if (!taskId) {
|
|
113
|
+
errors.push('Task ID is required (--task-id or TASK_ID env var)');
|
|
114
|
+
}
|
|
115
|
+
if (args.taskId && !/^[a-zA-Z0-9_.-]{1,64}$/.test(args.taskId)) {
|
|
116
|
+
errors.push('Invalid task ID format');
|
|
117
|
+
}
|
|
118
|
+
if (args.iteration && (args.iteration < 1 || !Number.isInteger(args.iteration))) {
|
|
119
|
+
errors.push('Iteration must be a positive integer');
|
|
120
|
+
}
|
|
121
|
+
if (args.mode && ![
|
|
122
|
+
'mvp',
|
|
123
|
+
'standard',
|
|
124
|
+
'enterprise'
|
|
125
|
+
].includes(args.mode)) {
|
|
126
|
+
errors.push('Mode must be mvp, standard, or enterprise');
|
|
127
|
+
}
|
|
128
|
+
return {
|
|
129
|
+
valid: errors.length === 0,
|
|
130
|
+
errors
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Format output based on options
|
|
135
|
+
*/ function formatOutput(result, json = false) {
|
|
136
|
+
if (json) {
|
|
137
|
+
return JSON.stringify(result, null, 2);
|
|
138
|
+
}
|
|
139
|
+
if (typeof result === 'object' && result !== null) {
|
|
140
|
+
const obj = result;
|
|
141
|
+
if (obj.status === 'failed') {
|
|
142
|
+
return `ERROR: ${obj.error || 'Failed to spawn agent'}`;
|
|
143
|
+
}
|
|
144
|
+
return `Agent spawned: ${obj.agentId} (PID: ${obj.pid})`;
|
|
145
|
+
}
|
|
146
|
+
return String(result);
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Main CLI function
|
|
150
|
+
*/ async function main() {
|
|
151
|
+
const args = parseArgs(process.argv.slice(2));
|
|
152
|
+
// Handle flags
|
|
153
|
+
if (args.help) {
|
|
154
|
+
printHelp();
|
|
155
|
+
process.exit(0);
|
|
156
|
+
}
|
|
157
|
+
if (args.version) {
|
|
158
|
+
printVersion();
|
|
159
|
+
process.exit(0);
|
|
160
|
+
}
|
|
161
|
+
// Validate arguments
|
|
162
|
+
const taskId = args.taskId || process.env.TASK_ID;
|
|
163
|
+
const validation = validateArgs({
|
|
164
|
+
...args,
|
|
165
|
+
taskId
|
|
166
|
+
});
|
|
167
|
+
if (!validation.valid) {
|
|
168
|
+
console.error('Argument validation failed:');
|
|
169
|
+
validation.errors.forEach((err)=>console.error(` - ${err}`));
|
|
170
|
+
console.error('Use --help for usage information');
|
|
171
|
+
process.exit(1);
|
|
172
|
+
}
|
|
173
|
+
// Create spawner
|
|
174
|
+
const projectRoot = process.env.PROJECT_ROOT || process.cwd();
|
|
175
|
+
const spawner = new AgentSpawner(projectRoot);
|
|
176
|
+
// Build config
|
|
177
|
+
const config = {
|
|
178
|
+
agentType: args.agentType,
|
|
179
|
+
taskId: taskId,
|
|
180
|
+
iteration: args.iteration || 1,
|
|
181
|
+
mode: args.mode || 'standard',
|
|
182
|
+
provider: args.provider,
|
|
183
|
+
model: args.model,
|
|
184
|
+
background: args.background !== false,
|
|
185
|
+
env: {
|
|
186
|
+
TASK_ID: taskId
|
|
187
|
+
}
|
|
188
|
+
};
|
|
189
|
+
try {
|
|
190
|
+
// Spawn agent
|
|
191
|
+
const result = await spawner.spawnAgent(config);
|
|
192
|
+
// Output result
|
|
193
|
+
console.log(formatOutput(result, args.json));
|
|
194
|
+
// Exit with appropriate code
|
|
195
|
+
process.exit(result.status === 'spawned' ? 0 : 1);
|
|
196
|
+
} catch (error) {
|
|
197
|
+
const errorMsg = error instanceof Error ? error.message : String(error);
|
|
198
|
+
console.error(`ERROR: ${errorMsg}`);
|
|
199
|
+
process.exit(2);
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
// Run main function
|
|
203
|
+
main().catch((error)=>{
|
|
204
|
+
console.error('Unexpected error:', error);
|
|
205
|
+
process.exit(2);
|
|
206
|
+
});
|
|
207
|
+
export { parseArgs, validateArgs, formatOutput };
|
|
208
|
+
|
|
209
|
+
//# 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 } from 'path';\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 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.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 --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 * 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 if (args.taskId && !/^[a-zA-Z0-9_.-]{1,64}$/.test(args.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\r\n const config = {\r\n agentType: args.agentType!,\r\n taskId: taskId!,\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 background: args.background !== false,\r\n env: {\r\n TASK_ID: taskId!\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 };\r\n"],"names":["AgentSpawner","readFileSync","resolve","parseArgs","args","parsed","background","i","length","arg","help","version","json","taskId","iteration","parseInt","mode","provider","model","startsWith","agentType","printHelp","console","log","printVersion","packageJson","JSON","parse","__dirname","validateArgs","errors","push","process","env","TASK_ID","test","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","config","spawnAgent","errorMsg","Error","message","catch"],"mappings":";AACA;;;;;;;;;;CAUC,GAED,SAASA,YAAY,QAAQ,kBAAkB;AAC/C,SAAwBC,YAAY,QAAQ,KAAK;AACjD,SAASC,OAAO,QAAQ,OAAO;AAgB/B;;CAEC,GACD,SAASC,UAAUC,IAAc;IAC/B,MAAMC,SAAkB;QACtBC,YAAY;IACd;IAEA,IAAK,IAAIC,IAAI,GAAGA,IAAIH,KAAKI,MAAM,EAAED,IAAK;QACpC,MAAME,MAAML,IAAI,CAACG,EAAE;QAEnB,IAAIE,QAAQ,UAAU;YACpBJ,OAAOK,IAAI,GAAG;QAChB,OAAO,IAAID,QAAQ,aAAa;YAC9BJ,OAAOM,OAAO,GAAG;QACnB,OAAO,IAAIF,QAAQ,UAAU;YAC3BJ,OAAOO,IAAI,GAAG;QAChB,OAAO,IAAIH,QAAQ,gBAAgB;YACjCJ,OAAOC,UAAU,GAAG;QACtB,OAAO,IAAIG,QAAQ,gBAAgB;YACjCJ,OAAOC,UAAU,GAAG;QACtB,OAAO,IAAIG,QAAQ,eAAeA,QAAQ,MAAM;YAC9CJ,OAAOQ,MAAM,GAAGT,IAAI,CAAC,EAAEG,EAAE;QAC3B,OAAO,IAAIE,QAAQ,iBAAiBA,QAAQ,MAAM;YAChDJ,OAAOS,SAAS,GAAGC,SAASX,IAAI,CAAC,EAAEG,EAAE,EAAE;QACzC,OAAO,IAAIE,QAAQ,Y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AAC,IAAI,EAAEU,KAAK;QAC3DjC,QAAQuB,KAAK,CAAC;QACdb,QAAQoB,IAAI,CAAC;IACf;IAEA,iBAAiB;IACjB,MAAMI,cAAcxB,QAAQC,GAAG,CAACwB,YAAY,IAAIzB,QAAQ0B,GAAG;IAC3D,MAAMC,UAAU,IAAI3D,aAAawD;IAEjC,eAAe;IACf,MAAMI,SAAS;QACbxC,WAAWhB,KAAKgB,SAAS;QACzBP,QAAQA;QACRC,WAAWV,KAAKU,SAAS,IAAI;QAC7BE,MAAMZ,KAAKY,IAAI,IAAI;QACnBC,UAAUb,KAAKa,QAAQ;QACvBC,OAAOd,KAAKc,KAAK;QACjBZ,YAAYF,KAAKE,UAAU,KAAK;QAChC2B,KAAK;YACHC,SAASrB;QACX;IACF;IAEA,IAAI;QACF,cAAc;QACd,MAAM4B,SAAS,MAAMkB,QAAQE,UAAU,CAACD;QAExC,gBAAgB;QAChBtC,QAAQC,GAAG,CAACiB,aAAaC,QAAQrC,KAAKQ,IAAI;QAE1C,6BAA6B;QAC7BoB,QAAQoB,IAAI,CAACX,OAAOG,MAAM,KAAK,YAAY,IAAI;IACjD,EAAE,OAAOC,OAAO;QACd,MAAMiB,WAAWjB,iBAAiBkB,QAAQlB,MAAMmB,OAAO,GAAGhB,OAAOH;QACjEvB,QAAQuB,KAAK,CAAC,CAAC,OAAO,EAAEiB,UAAU;QAClC9B,QAAQoB,IAAI,CAAC;IACf;AACF;AAEA,oBAAoB;AACpBH,OAAOgB,KAAK,CAAC,CAACpB;IACZvB,QAAQuB,KAAK,CAAC,qBAAqBA;IACnCb,QAAQoB,IAAI,CAAC;AACf;AAEA,SAASjD,SAAS,EAAE0B,YAAY,EAAEW,YAAY,GAAG"}
|
|
@@ -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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/coordination/coordination-wrapper.ts"],"sourcesContent":["/**\r\n * Unified TypeScript Coordination Wrapper\r\n *\r\n * Provides a type-safe interface for all Redis-based coordination operations\r\n * in the CFN Loop critical path. Wraps the existing redis-coordinator with\r\n * semantic coordination methods for:\r\n * - Agent lifecycle management\r\n * - Signal/wait primitives\r\n * - Consensus collection\r\n * - Task state management\r\n *\r\n * Key patterns:\r\n * - swarm:* namespace for unified coordination\r\n * - Backward compatible with cfn_loop:task:* legacy namespace\r\n * - Type-safe agent state tracking\r\n * - Automatic timeout handling\r\n */\r\n\r\nimport Redis from 'ioredis';\nimport type { Redis as RedisClient } from 'ioredis';\nimport { EventEmitter } from 'events';\r\n\r\n/**\r\n * Configuration for coordination wrapper\r\n */\r\nexport interface CoordinationConfig {\r\n redisHost: string;\r\n redisPort: number;\r\n redisDb?: number;\r\n taskId: string;\r\n namespace?: 'swarm' | 'cfn_loop';\r\n defaultTimeout?: number;\r\n}\r\n\r\n/**\r\n * Agent state as tracked in Redis\r\n */\r\nexport interface AgentState {\r\n agentId: string;\r\n type: string;\r\n status: 'spawned' | 'running' | 'waiting' | 'completed' | 'failed';\r\n confidence?: number;\r\n testPassRate?: number;\r\n testsRun?: number;\r\n testsPassed?: number;\r\n result?: Record<string, unknown>;\r\n timestamp: string;\r\n iteration?: number;\r\n}\r\n\r\n/**\r\n * Consensus score from validator\r\n */\r\nexport interface ConsensusScore {\r\n agentId: string;\r\n score: number;\r\n feedback?: string;\r\n timestamp: string;\r\n}\r\n\r\n/**\r\n * Task state snapshot\r\n */\r\nexport interface TaskState {\r\n taskId: string;\r\n status: 'pending' | 'in_progress' | 'completed' | 'failed';\r\n context: Record<string, unknown>;\r\n agents: AgentState[];\r\n consensus?: number;\r\n iteration: number;\r\n updatedAt: string;\r\n}\r\n\r\n/**\r\n * Coordination signal/wait result\r\n */\r\nexport interface SignalResult {\r\n received: boolean;\r\n message?: string;\r\n timestamp?: string;\r\n timeout: boolean;\r\n}\r\n\r\n/**\r\n * Unified Coordination Wrapper\r\n *\r\n * Provides semantic coordination methods that abstract away Redis key patterns\r\n * and protocol details while maintaining type safety.\r\n */\r\nexport class CoordinationWrapper extends EventEmitter {\r\n private redis: RedisClient;\r\n private taskId: string;\r\n private namespace: 'swarm' | 'cfn_loop';\r\n private defaultTimeout: number;\r\n private isConnected: boolean = false;\r\n\r\n constructor(config: CoordinationConfig) {\r\n super();\r\n this.taskId = config.taskId;\r\n this.namespace = config.namespace || 'swarm';\r\n this.defaultTimeout = config.defaultTimeout || 120000; // 120 seconds\r\n\r\n // Create Redis client with provided configuration\r\n this.redis = new (Redis as any)({\r\n host: config.redisHost,\r\n port: config.redisPort,\r\n db: config.redisDb || 0,\r\n lazyConnect: true,\r\n maxRetriesPerRequest: null, // Needed for blocking operations\r\n enableReadyCheck: false\r\n });\r\n\r\n // Set up error handling\r\n this.redis.on('error', (error) => {\r\n this.emit('redis-error', error);\r\n });\r\n\r\n this.redis.on('connect', () => {\r\n this.isConnected = true;\r\n this.emit('connected');\r\n });\r\n\r\n this.redis.on('disconnect', () => {\r\n this.isConnected = false;\r\n this.emit('disconnected');\r\n });\r\n }\r\n\r\n /**\r\n * Connect to Redis\r\n */\r\n async connect(): Promise<void> {\r\n if (!this.isConnected) {\r\n await this.redis.connect();\r\n }\r\n }\r\n\r\n /**\r\n * Disconnect from Redis\r\n */\r\n async disconnect(): Promise<void> {\r\n if (this.isConnected) {\r\n await this.redis.disconnect();\r\n }\r\n }\r\n\r\n /**\r\n * Check if connected to Redis\r\n */\r\n isReady(): boolean {\r\n return this.isConnected;\r\n }\r\n\r\n /**\r\n * AGENT LIFECYCLE MANAGEMENT\r\n */\r\n\r\n /**\r\n * Register a spawned agent in the coordination system\r\n */\r\n async registerAgent(agentId: string, agentType: string): Promise<void> {\r\n const state: AgentState = {\r\n agentId,\r\n type: agentType,\r\n status: 'spawned',\r\n timestamp: new Date().toISOString()\r\n };\r\n\r\n const key = this.getAgentStateKey(agentId);\r\n await this.redis.set(key, JSON.stringify(state), 'EX', 86400); // 24h expiry\r\n }\r\n\r\n /**\r\n * Update agent status\r\n */\r\n async updateAgentStatus(\r\n agentId: string,\r\n status: AgentState['status']\r\n ): Promise<void> {\r\n const key = this.getAgentStateKey(agentId);\r\n const state = await this.getAgentState(agentId);\r\n\r\n if (!state) {\r\n throw new Error(`Agent ${agentId} not registered`);\r\n }\r\n\r\n state.status = status;\r\n state.timestamp = new Date().toISOString();\r\n\r\n await this.redis.set(key, JSON.stringify(state), 'EX', 86400);\r\n }\r\n\r\n /**\r\n * Signal agent completion with confidence score\r\n */\r\n async signalCompletion(\r\n agentId: string,\r\n confidence: number,\r\n options?: {\r\n testPassRate?: number;\r\n testsRun?: number;\r\n testsPassed?: number;\r\n result?: Record<string, unknown>;\r\n iteration?: number;\r\n }\r\n ): Promise<void> {\r\n const key = this.getAgentStateKey(agentId);\r\n const state = await this.getAgentState(agentId);\r\n\r\n if (!state) {\r\n throw new Error(`Agent ${agentId} not registered`);\r\n }\r\n\r\n state.status = 'completed';\r\n state.confidence = confidence;\r\n state.testPassRate = options?.testPassRate;\r\n state.testsRun = options?.testsRun;\r\n state.testsPassed = options?.testsPassed;\r\n state.result = options?.result;\r\n state.iteration = options?.iteration;\r\n state.timestamp = new Date().toISOString();\r\n\r\n // Store in agent state with 24h expiry\r\n await this.redis.set(key, JSON.stringify(state), 'EX', 86400);\r\n\r\n // Also publish completion signal to waiting agents\r\n const channel = this.getCompletionChannel(agentId);\r\n await this.redis.publish(channel, JSON.stringify(state));\r\n\r\n // Add to completion leaderboard for consensus collection\r\n const leaderboardKey = this.getCompletionLeaderboardKey();\r\n await this.redis.zadd(\r\n leaderboardKey,\r\n confidence * 100, // Score for sorting\r\n JSON.stringify({\r\n agentId,\r\n confidence,\r\n timestamp: state.timestamp\r\n })\r\n );\r\n }\r\n\r\n /**\r\n * Get agent state\r\n */\r\n async getAgentState(agentId: string): Promise<AgentState | null> {\r\n const key = this.getAgentStateKey(agentId);\r\n const data = await this.redis.get(key);\r\n\r\n if (!data) {\r\n return null;\r\n }\r\n\r\n return JSON.parse(data) as AgentState;\r\n }\r\n\r\n /**\r\n * Get all agents in current task\r\n */\r\n async getAllAgents(): Promise<AgentState[]> {\r\n const pattern = this.getAgentStateKeyPattern();\r\n const keys = await this.redis.keys(pattern);\r\n\r\n const agents: AgentState[] = [];\r\n for (const key of keys) {\r\n const data = await this.redis.get(key);\r\n if (data) {\r\n agents.push(JSON.parse(data) as AgentState);\r\n }\r\n }\r\n\r\n return agents;\r\n }\r\n\r\n /**\r\n * COORDINATION PRIMITIVES\r\n */\r\n\r\n /**\r\n * Wait for a coordination signal with timeout\r\n */\r\n async waitForSignal(\r\n channel: string,\r\n timeoutMs?: number\r\n ): Promise<SignalResult> {\r\n const timeout = timeoutMs || this.defaultTimeout;\r\n const timeoutSeconds = Math.ceil(timeout / 1000);\r\n\r\n try {\r\n // Use BLPOP to block-wait on a list\r\n const listKey = this.getSignalKey(channel);\r\n const result = await this.redis.blpop(listKey, timeoutSeconds);\r\n\r\n if (result === null) {\r\n return {\r\n received: false,\r\n timeout: true\r\n };\r\n }\r\n\r\n return {\r\n received: true,\r\n message: result[1],\r\n timestamp: new Date().toISOString(),\r\n timeout: false\r\n };\r\n } catch (error) {\r\n return {\r\n received: false,\r\n timeout: false\r\n };\r\n }\r\n }\r\n\r\n /**\r\n * Broadcast a signal to all waiting agents\r\n */\r\n async broadcastSignal(channel: string, message: string): Promise<void> {\r\n // Use pub/sub for broadcast (fire-and-forget to subscribers)\r\n await this.redis.publish(channel, message);\r\n\r\n // Also store in a list for new subscribers (via BLPOP pattern)\r\n const listKey = this.getSignalKey(channel);\r\n await this.redis.lpush(listKey, message);\r\n\r\n // Keep only recent signals (last 100)\r\n await this.redis.ltrim(listKey, 0, 99);\r\n\r\n // Expire the list after 1 hour\r\n await this.redis.expire(listKey, 3600);\r\n }\r\n\r\n /**\r\n * Subscribe to signal channel (pub/sub pattern)\r\n */\r\n subscribeToSignal(\r\n channel: string,\r\n callback: (message: string) => void\r\n ): () => void {\r\n // Create a separate subscriber for pub/sub\r\n const subscriber = this.redis.duplicate();\r\n\r\n subscriber.on('message', (chan, message) => {\r\n if (chan === channel) {\r\n callback(message);\r\n }\r\n });\r\n\r\n subscriber.subscribe(channel);\r\n\r\n // Return unsubscribe function\r\n return () => {\r\n subscriber.unsubscribe(channel);\r\n subscriber.disconnect();\r\n };\r\n }\r\n\r\n /**\r\n * CONSENSUS & VALIDATION\r\n */\r\n\r\n /**\r\n * Collect consensus scores from multiple validators\r\n */\r\n async collectConsensus(\r\n agentIds: string[],\r\n timeoutMs?: number\r\n ): Promise<ConsensusScore[]> {\r\n const timeout = timeoutMs || this.defaultTimeout;\r\n const startTime = Date.now();\r\n const scores: ConsensusScore[] = [];\r\n\r\n for (const agentId of agentIds) {\r\n const elapsed = Date.now() - startTime;\r\n const remaining = Math.max(1, timeout - elapsed);\r\n const remainingSeconds = Math.ceil(remaining / 1000);\r\n\r\n // Wait for each validator to report consensus\r\n const scoreKey = this.getConsensusKey(agentId);\r\n const data = await this.redis.blpop(scoreKey, remainingSeconds);\r\n\r\n if (data) {\r\n const score = JSON.parse(data[1]) as ConsensusScore;\r\n scores.push(score);\r\n }\r\n }\r\n\r\n return scores;\r\n }\r\n\r\n /**\r\n * Report a consensus score\r\n */\r\n async reportConsensusScore(\r\n agentId: string,\r\n score: number,\r\n feedback?: string\r\n ): Promise<void> {\r\n const consensusScore: ConsensusScore = {\r\n agentId,\r\n score,\r\n feedback,\r\n timestamp: new Date().toISOString()\r\n };\r\n\r\n const key = this.getConsensusKey(agentId);\r\n await this.redis.lpush(key, JSON.stringify(consensusScore));\r\n await this.redis.expire(key, 86400); // 24h expiry\r\n }\r\n\r\n /**\r\n * Calculate average consensus from scores\r\n */\r\n calculateAverageConsensus(scores: ConsensusScore[]): number {\r\n if (scores.length === 0) {\r\n return 0;\r\n }\r\n\r\n const sum = scores.reduce((acc, score) => acc + score.score, 0);\r\n return sum / scores.length;\r\n }\r\n\r\n /**\r\n * TASK STATE MANAGEMENT\r\n */\r\n\r\n /**\r\n * Store task context (usually CFN Loop parameters)\r\n */\r\n async storeTaskContext(context: Record<string, unknown>): Promise<void> {\r\n const key = this.getTaskContextKey();\r\n await this.redis.set(key, JSON.stringify(context), 'EX', 86400);\r\n }\r\n\r\n /**\r\n * Load task context\r\n */\r\n async loadTaskContext(): Promise<Record<string, unknown> | null> {\r\n const key = this.getTaskContextKey();\r\n const data = await this.redis.get(key);\r\n\r\n if (!data) {\r\n return null;\r\n }\r\n\r\n return JSON.parse(data) as Record<string, unknown>;\r\n }\r\n\r\n /**\r\n * Update task status\r\n */\r\n async updateTaskStatus(\r\n status: TaskState['status'],\r\n iteration?: number\r\n ): Promise<void> {\r\n const key = this.getTaskStatusKey();\r\n\r\n const state: Partial<TaskState> = {\r\n taskId: this.taskId,\r\n status,\r\n updatedAt: new Date().toISOString()\r\n };\r\n\r\n if (iteration !== undefined) {\r\n state.iteration = iteration;\r\n }\r\n\r\n // Get existing context if available\r\n const contextData = await this.loadTaskContext();\r\n if (contextData) {\r\n state.context = contextData;\r\n }\r\n\r\n // Get all agents\r\n state.agents = await this.getAllAgents();\r\n\r\n await this.redis.set(key, JSON.stringify(state), 'EX', 86400);\r\n }\r\n\r\n /**\r\n * Get full task state snapshot\r\n */\r\n async getTaskState(): Promise<TaskState | null> {\r\n const key = this.getTaskStatusKey();\r\n const data = await this.redis.get(key);\r\n\r\n if (!data) {\r\n return null;\r\n }\r\n\r\n return JSON.parse(data) as TaskState;\r\n }\r\n\r\n /**\r\n * HELPER METHODS FOR KEY GENERATION\r\n */\r\n\r\n private getAgentStateKey(agentId: string): string {\r\n if (this.namespace === 'cfn_loop') {\r\n return `cfn_loop:task:${this.taskId}:agent:${agentId}`;\r\n }\r\n return `${this.namespace}:${this.taskId}:agent:${agentId}`;\r\n }\r\n\r\n private getAgentStateKeyPattern(): string {\r\n if (this.namespace === 'cfn_loop') {\r\n return `cfn_loop:task:${this.taskId}:agent:*`;\r\n }\r\n return `${this.namespace}:${this.taskId}:agent:*`;\r\n }\r\n\r\n private getCompletionChannel(agentId: string): string {\r\n if (this.namespace === 'cfn_loop') {\r\n return `cfn_loop:task:${this.taskId}:completion:${agentId}`;\r\n }\r\n return `${this.namespace}:${this.taskId}:completion`;\r\n }\r\n\r\n private getCompletionLeaderboardKey(): string {\r\n if (this.namespace === 'cfn_loop') {\r\n return `cfn_loop:task:${this.taskId}:completions`;\r\n }\r\n return `${this.namespace}:${this.taskId}:completions`;\r\n }\r\n\r\n private getSignalKey(channel: string): string {\r\n if (this.namespace === 'cfn_loop') {\r\n return `cfn_loop:task:${this.taskId}:signal:${channel}`;\r\n }\r\n return `${this.namespace}:${this.taskId}:signal:${channel}`;\r\n }\r\n\r\n private getConsensusKey(agentId: string): string {\r\n if (this.namespace === 'cfn_loop') {\r\n return `cfn_loop:task:${this.taskId}:consensus:${agentId}`;\r\n }\r\n return `${this.namespace}:${this.taskId}:consensus:${agentId}`;\r\n }\r\n\r\n private getTaskContextKey(): string {\r\n if (this.namespace === 'cfn_loop') {\r\n return `cfn_loop:task:${this.taskId}:context`;\r\n }\r\n return `${this.namespace}:${this.taskId}:context`;\r\n }\r\n\r\n private getTaskStatusKey(): string {\r\n if (this.namespace === 'cfn_loop') {\r\n return `cfn_loop:task:${this.taskId}:status`;\r\n }\r\n return `${this.namespace}:${this.taskId}:status`;\r\n }\r\n\r\n /**\r\n * CLEANUP & UTILITIES\r\n */\r\n\r\n /**\r\n * Clear all coordination state for this task\r\n */\r\n async clearTaskState(): Promise<void> {\r\n const pattern = this.getTaskKeysPattern();\r\n const keys = await this.redis.keys(pattern);\r\n\r\n if (keys.length > 0) {\r\n await this.redis.del(...keys);\r\n }\r\n }\r\n\r\n private getTaskKeysPattern(): string {\r\n if (this.namespace === 'cfn_loop') {\r\n return `cfn_loop:task:${this.taskId}:*`;\r\n }\r\n return `${this.namespace}:${this.taskId}:*`;\r\n }\r\n\r\n /**\r\n * Get Redis client for advanced operations\r\n */\r\n getRedisClient(): RedisClient {\r\n return this.redis;\r\n }\r\n}\r\n\r\nexport default CoordinationWrapper;\r\n"],"names":["Redis","EventEmitter","CoordinationWrapper","redis","taskId","namespace","defaultTimeout","isConnected","config","host","redisHost","port","redisPort","db","redisDb","lazyConnect","maxRetriesPerRequest","enableReadyCheck","on","error","emit","connect","disconnect","isReady","registerAgent","agentId","agentType","state","type","status","timestamp","Date","toISOString","key","getAgentStateKey","set","JSON","stringify","updateAgentStatus","getAgentState","Error","signalCompletion","confidence","options","testPassRate","testsRun","testsPassed","result","iteration","channel","getCompletionChannel","publish","leaderboardKey","getCompletionLeaderboardKey","zadd","data","get","parse","getAllAgents","pattern","getAgentStateKeyPattern","keys","agents","push","waitForSignal","timeoutMs","timeout","timeoutSeconds","Math","ceil","listKey","getSignalKey","blpop","received","message","broadcastSignal","lpush","ltrim","expire","subscribeToSignal","callback","subscriber","duplicate","chan","subscribe","unsubscribe","collectConsensus","agentIds","startTime","now","scores","elapsed","remaining","max","remainingSeconds","scoreKey","getConsensusKey","score","reportConsensusScore","feedback","consensusScore","calculateAverageConsensus","length","sum","reduce","acc","storeTaskContext","context","getTaskContextKey","loadTaskContext","updateTaskStatus","getTaskStatusKey","updatedAt","undefined","contextData","getTaskState","clearTaskState","getTaskKeysPattern","del","getRedisClient"],"mappings":"AAAA;;;;;;;;;;;;;;;;CAgBC,GAED,OAAOA,WAAW,UAAU;AAE5B,SAASC,YAAY,QAAQ,SAAS;AA+DtC;;;;;CAKC,GACD,OAAO,MAAMC,4BAA4BD;IAC/BE,MAAmB;IACnBC,OAAe;IACfC,UAAgC;IAChCC,eAAuB;IACvBC,cAAuB,MAAM;IAErC,YAAYC,MAA0B,CAAE;QACtC,KAAK;QACL,IAAI,CAACJ,MAAM,GAAGI,OAAOJ,MAAM;QAC3B,IAAI,CAACC,SAAS,GAAGG,OAAOH,SAAS,IAAI;QACrC,IAAI,CAACC,cAAc,GAAGE,OAAOF,cAAc,IAAI,QAAQ,cAAc;QAErE,kDAAkD;QAClD,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