claude-flow-novice 2.15.11 → 2.16.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/cfn-extras/agents/cfn-v3-coordinator.md +517 -0
- package/.claude/cfn-extras/skills/GOOGLE_SHEETS_SKILLS_README.md +1 -1
- package/.claude/cfn-extras/skills/google-sheets-api-coordinator/SKILL.md +1 -1
- package/.claude/cfn-extras/skills/google-sheets-formula-builder/SKILL.md +1 -1
- package/.claude/cfn-extras/skills/google-sheets-progress/SKILL.md +1 -1
- package/.claude/commands/CFN_LOOP_FRONTEND.md +1 -1
- package/.claude/commands/cfn-loop-cli.md +214 -442
- package/.claude/commands/cfn-loop-frontend.md +1 -1
- package/.claude/commands/cfn-loop-task.md +2 -2
- package/.claude/commands/cfn-loop-trigger.md +114 -0
- package/.claude/commands/deprecated/cfn-loop.md +2 -2
- 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 +53 -5
- 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/hooks/cfn-post-edit.config.json +9 -2
- package/.claude/root-claude-distribute/CFN-CLAUDE.md +1 -1
- 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-backlog-management/SKILL.md +1 -1
- 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/skills/cfn-loop-orchestration/{orchestrate-wrapper.sh → 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/skills/cfn-product-owner-decision/{execute-decision.sh → 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/analysts/root-cause-analyst.md +2 -2
- package/claude-assets/agents/cfn-dev-team/architecture/base-template-generator.md +1 -1
- package/claude-assets/agents/cfn-dev-team/coordinators/cfn-frontend-coordinator.md +3 -2
- package/claude-assets/agents/cfn-dev-team/coordinators/consensus-builder.md +1 -0
- package/claude-assets/agents/cfn-dev-team/coordinators/handoff-coordinator.md +2 -1
- 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 +11 -1
- package/claude-assets/agents/cfn-dev-team/dev-ops/docker-specialist.md +58 -35
- package/claude-assets/agents/cfn-dev-team/dev-ops/github-commit-agent.md +2 -2
- package/claude-assets/agents/cfn-dev-team/dev-ops/kubernetes-specialist.md +47 -37
- package/claude-assets/agents/cfn-dev-team/developers/api-gateway-specialist.md +18 -18
- 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 +19 -21
- package/claude-assets/agents/cfn-dev-team/developers/database/database-architect.md +20 -29
- 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 +16 -11
- package/claude-assets/agents/cfn-dev-team/developers/frontend/ui-designer.md +16 -26
- package/claude-assets/agents/cfn-dev-team/developers/graphql-specialist.md +18 -22
- package/claude-assets/agents/cfn-dev-team/developers/rust-developer.md +17 -21
- package/claude-assets/agents/cfn-dev-team/documentation/pseudocode.md +1 -1
- package/claude-assets/agents/cfn-dev-team/product-owners/accessibility-advocate-persona.md +1 -1
- package/claude-assets/agents/cfn-dev-team/product-owners/cto-agent.md +1 -1
- package/claude-assets/agents/cfn-dev-team/product-owners/power-user-persona.md +1 -1
- 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 +24 -68
- package/claude-assets/agents/cfn-dev-team/testers/api-testing-specialist.md +8 -36
- package/claude-assets/agents/cfn-dev-team/testers/chaos-engineering-specialist.md +9 -38
- package/claude-assets/agents/cfn-dev-team/testers/contract-tester.md +17 -55
- package/claude-assets/agents/cfn-dev-team/testers/e2e/playwright-tester.md +1 -1
- package/claude-assets/agents/cfn-dev-team/testers/integration-tester.md +18 -56
- 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 +18 -56
- package/claude-assets/agents/cfn-dev-team/testers/mutation-testing-specialist.md +18 -49
- 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/testers/unit/tdd-london-unit-swarm.md +1 -1
- package/claude-assets/agents/cfn-dev-team/utility/agent-builder.md +11 -0
- package/claude-assets/agents/cfn-dev-team/utility/analyst.md +13 -29
- package/claude-assets/agents/cfn-dev-team/utility/claude-code-expert.md +1 -1
- 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 +6 -11
- package/claude-assets/agents/cfn-dev-team/utility/memory-leak-specialist.md +121 -715
- package/claude-assets/agents/cfn-dev-team/utility/researcher.md +13 -22
- package/claude-assets/agents/cfn-dev-team/utility/z-ai-specialist.md +147 -573
- package/claude-assets/agents/custom/cfn-docker-expert.md +103 -0
- package/claude-assets/agents/custom/cfn-loops-cli-expert.md +438 -0
- package/claude-assets/agents/custom/cfn-redis-operations.md +529 -529
- package/claude-assets/agents/custom/cfn-system-expert.md +1 -1
- package/claude-assets/agents/custom/trigger-dev-expert.md +369 -0
- package/claude-assets/agents/docker-team/micro-sprint-planner.md +747 -747
- package/claude-assets/agents/project-only-agents/npm-package-specialist.md +1 -1
- package/claude-assets/cfn-extras/agents/cfn-v3-coordinator.md +517 -0
- package/claude-assets/cfn-extras/skills/GOOGLE_SHEETS_SKILLS_README.md +1 -1
- package/claude-assets/cfn-extras/skills/google-sheets-api-coordinator/SKILL.md +1 -1
- package/claude-assets/cfn-extras/skills/google-sheets-formula-builder/SKILL.md +1 -1
- package/claude-assets/cfn-extras/skills/google-sheets-progress/SKILL.md +1 -1
- package/claude-assets/commands/CFN_LOOP_FRONTEND.md +1 -1
- package/claude-assets/commands/cfn-loop-cli.md +214 -442
- package/claude-assets/commands/cfn-loop-frontend.md +1 -1
- package/claude-assets/commands/cfn-loop-task.md +2 -2
- package/claude-assets/commands/cfn-loop-trigger.md +114 -0
- package/claude-assets/commands/deprecated/cfn-loop.md +2 -2
- package/claude-assets/hooks/GIT-HOOKS-USAGE-EXAMPLES.md +116 -0
- package/claude-assets/hooks/README-GIT-HOOKS.md +443 -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 +53 -5
- 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/hooks/cfn-post-edit.config.json +9 -2
- package/claude-assets/hooks/install-git-hooks.sh +243 -0
- package/claude-assets/hooks/subagent-start.sh +98 -0
- package/claude-assets/hooks/subagent-stop.sh +93 -0
- package/claude-assets/hooks/validators/credential-scanner.sh +172 -0
- package/claude-assets/root-claude-distribute/CFN-CLAUDE.md +1 -1
- 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-backlog-management/SKILL.md +1 -1
- 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 +397 -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/ingest.sh +237 -0
- package/claude-assets/skills/cfn-dependency-ingestion/manifests/cli-mode-dependencies.txt +73 -0
- package/claude-assets/skills/cfn-dependency-ingestion/manifests/shared-dependencies.txt +57 -0
- package/claude-assets/skills/cfn-dependency-ingestion/manifests/trigger-dev-dependencies.txt +82 -0
- package/claude-assets/skills/cfn-dependency-ingestion/manifests/trigger-mode-dependencies.txt +80 -0
- package/claude-assets/skills/cfn-dependency-ingestion/src/ingest-dependencies.ts +563 -0
- package/claude-assets/skills/cfn-environment-sanitization/sanitize-environment.sh +14 -4
- 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-assets/skills/cfn-loop-orchestration/{orchestrate-wrapper.sh → 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-assets/skills/cfn-product-owner-decision/{execute-decision.sh → 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 +215 -0
- package/claude-assets/skills/cfn-provider-routing/resolve-provider-model.ts +223 -0
- package/claude-assets/skills/docker-build/build.sh +1 -1
- 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/agent/skill-mcp-selector.js +2 -1
- package/dist/agent/skill-mcp-selector.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-executor.js +470 -26
- package/dist/cli/agent-executor.js.map +1 -1
- package/dist/cli/agent-prompt-builder.js +83 -48
- package/dist/cli/agent-prompt-builder.js.map +1 -1
- package/dist/cli/agent-spawn.js +7 -4
- package/dist/cli/agent-spawn.js.map +1 -1
- package/dist/cli/agent-spawner.js +546 -0
- package/dist/cli/agent-spawner.js.map +1 -0
- package/dist/cli/agent-token-manager.js +2 -1
- package/dist/cli/agent-token-manager.js.map +1 -1
- package/dist/cli/anthropic-client.js +127 -14
- package/dist/cli/anthropic-client.js.map +1 -1
- package/dist/cli/cfn-context.js +2 -1
- package/dist/cli/cfn-context.js.map +1 -1
- package/dist/cli/cfn-metrics.js +2 -1
- package/dist/cli/cfn-metrics.js.map +1 -1
- package/dist/cli/cfn-redis.js +2 -1
- package/dist/cli/cfn-redis.js.map +1 -1
- package/dist/cli/cli-agent-context.js +2 -0
- package/dist/cli/cli-agent-context.js.map +1 -1
- package/dist/cli/config-manager.js +90 -356
- package/dist/cli/config-manager.js.map +1 -1
- package/dist/cli/conversation-fork-cleanup.js +2 -1
- package/dist/cli/conversation-fork-cleanup.js.map +1 -1
- package/dist/cli/conversation-fork.js +2 -1
- package/dist/cli/conversation-fork.js.map +1 -1
- package/dist/cli/coordination/agent-messaging.js +415 -0
- package/dist/cli/coordination/agent-messaging.js.map +1 -0
- package/dist/cli/coordination/wait-for-threshold.js +232 -0
- package/dist/cli/coordination/wait-for-threshold.js.map +1 -0
- package/dist/cli/index.js +11 -0
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/iteration-history.js +2 -1
- package/dist/cli/iteration-history.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/process-lifecycle.js +5 -1
- package/dist/cli/process-lifecycle.js.map +1 -1
- package/dist/cli/spawn-agent-cli.js +244 -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/redis-waiting-mode.js +4 -0
- package/dist/coordination/redis-waiting-mode.js.map +1 -1
- 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/artifact-registry.js +4 -0
- package/dist/lib/artifact-registry.js.map +1 -1
- package/dist/lib/connection-pool.js +390 -0
- package/dist/lib/connection-pool.js.map +1 -0
- package/dist/lib/environment-contract.js +258 -0
- package/dist/lib/environment-contract.js.map +1 -0
- package/dist/lib/path-validator.js +14 -5
- package/dist/lib/path-validator.js.map +1 -1
- package/dist/lib/query-optimizer.js +388 -0
- package/dist/lib/query-optimizer.js.map +1 -0
- package/dist/lib/redis-queue-manager.js +5 -1
- package/dist/lib/redis-queue-manager.js.map +1 -1
- package/dist/lib/result-cache.js +285 -0
- package/dist/lib/result-cache.js.map +1 -0
- package/dist/mcp/auth-middleware.js +2 -1
- package/dist/mcp/auth-middleware.js.map +1 -1
- package/dist/mcp/playwright-mcp-server-auth.js +2 -1
- package/dist/mcp/playwright-mcp-server-auth.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 +15 -4
- package/scripts/build-agent-image.sh +1 -1
- package/scripts/compare-workflow-performance.sh +556 -0
- package/scripts/cost-allocation-tracker.sh +632 -0
- package/scripts/docker-rebuild-all-agents.sh +2 -2
- package/scripts/migrate-to-optimized-workflows.sh +438 -0
- package/scripts/organize-docs.sh +338 -0
- package/scripts/reorganize-tests.sh +280 -0
- package/scripts/trigger-dev-setup.sh +279 -0
- package/tests/README.md +45 -0
- package/.claude/commands/cost-savings-status.md +0 -34
- package/.claude/commands/metrics-summary.md +0 -58
- 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/cfn-dev-team/dev-ops/monitoring-specialist.md +0 -759
- package/claude-assets/agents/custom/test-mcp-access.md +0 -24
- package/claude-assets/agents/typescript-specialist.md +0 -280
- package/claude-assets/commands/cost-savings-status.md +0 -34
- package/claude-assets/commands/metrics-summary.md +0 -58
- 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/tests/test-memory-leak-task-mode.sh +0 -435
- /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,232 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Wait for Threshold Completion - Parallel Agent Coordination
|
|
4
|
+
*
|
|
5
|
+
* Waits for N/M agents to complete (e.g., 3/4 = 75% threshold) before continuing.
|
|
6
|
+
* Enables parallel agent spawning with graceful degradation on partial completion.
|
|
7
|
+
*
|
|
8
|
+
* Usage:
|
|
9
|
+
* npx tsx src/cli/coordination/wait-for-threshold.ts \
|
|
10
|
+
* --task-id <id> \
|
|
11
|
+
* --total-agents <n> \
|
|
12
|
+
* --threshold <0.0-1.0> \
|
|
13
|
+
* --timeout <seconds>
|
|
14
|
+
*
|
|
15
|
+
* Example:
|
|
16
|
+
* # Wait for 3/4 agents (75%) with 120s timeout
|
|
17
|
+
* npx tsx src/cli/coordination/wait-for-threshold.ts \
|
|
18
|
+
* --task-id cfn-cli-12345 \
|
|
19
|
+
* --total-agents 4 \
|
|
20
|
+
* --threshold 0.75 \
|
|
21
|
+
* --timeout 120
|
|
22
|
+
*/ import { createClient } from 'redis';
|
|
23
|
+
/**
|
|
24
|
+
* Wait for threshold completion of agents
|
|
25
|
+
*
|
|
26
|
+
* Uses Redis BLPOP with short timeouts to poll for completion signals
|
|
27
|
+
* while tracking progress toward the threshold.
|
|
28
|
+
*/ export async function waitForThreshold(config) {
|
|
29
|
+
const { taskId, totalAgents, threshold, timeoutSeconds, redisHost = process.env.CFN_REDIS_HOST || 'localhost', redisPort = parseInt(process.env.CFN_REDIS_PORT || '6379', 10), redisPassword = process.env.CFN_REDIS_PASSWORD || undefined } = config;
|
|
30
|
+
const requiredCount = Math.ceil(totalAgents * threshold);
|
|
31
|
+
const signalKey = `cfn-completion:${taskId}`;
|
|
32
|
+
const completed = [];
|
|
33
|
+
const startTime = Date.now();
|
|
34
|
+
const timeoutMs = timeoutSeconds * 1000;
|
|
35
|
+
// Connect to Redis
|
|
36
|
+
const client = createClient({
|
|
37
|
+
socket: {
|
|
38
|
+
host: redisHost,
|
|
39
|
+
port: redisPort
|
|
40
|
+
},
|
|
41
|
+
password: redisPassword || undefined
|
|
42
|
+
});
|
|
43
|
+
try {
|
|
44
|
+
await client.connect();
|
|
45
|
+
console.log(`[wait-threshold] Connected to Redis at ${redisHost}:${redisPort}`);
|
|
46
|
+
console.log(`[wait-threshold] Waiting for ${requiredCount}/${totalAgents} agents (${(threshold * 100).toFixed(0)}% threshold)`);
|
|
47
|
+
console.log(`[wait-threshold] Signal key: ${signalKey}`);
|
|
48
|
+
console.log(`[wait-threshold] Timeout: ${timeoutSeconds}s`);
|
|
49
|
+
// Poll loop with short BLPOP timeouts
|
|
50
|
+
const pollIntervalSeconds = 5; // Check every 5 seconds
|
|
51
|
+
while(completed.length < requiredCount){
|
|
52
|
+
const elapsed = Date.now() - startTime;
|
|
53
|
+
// Check overall timeout
|
|
54
|
+
if (elapsed >= timeoutMs) {
|
|
55
|
+
console.log(`[wait-threshold] Timeout reached after ${(elapsed / 1000).toFixed(1)}s`);
|
|
56
|
+
break;
|
|
57
|
+
}
|
|
58
|
+
// Calculate remaining time for this poll
|
|
59
|
+
const remainingMs = timeoutMs - elapsed;
|
|
60
|
+
const pollTimeout = Math.min(pollIntervalSeconds, Math.ceil(remainingMs / 1000));
|
|
61
|
+
try {
|
|
62
|
+
// BLPOP with short timeout - returns null on timeout
|
|
63
|
+
const result = await client.blPop(signalKey, pollTimeout);
|
|
64
|
+
if (result) {
|
|
65
|
+
try {
|
|
66
|
+
const signal = JSON.parse(result.element);
|
|
67
|
+
completed.push(signal);
|
|
68
|
+
console.log(`[wait-threshold] Received signal ${completed.length}/${requiredCount}: ${signal.agentId} (${signal.status})`);
|
|
69
|
+
// Check if threshold met
|
|
70
|
+
if (completed.length >= requiredCount) {
|
|
71
|
+
console.log(`[wait-threshold] Threshold met! ${completed.length}/${totalAgents} agents completed`);
|
|
72
|
+
break;
|
|
73
|
+
}
|
|
74
|
+
} catch (parseErr) {
|
|
75
|
+
console.warn(`[wait-threshold] Failed to parse signal: ${result.element}`);
|
|
76
|
+
}
|
|
77
|
+
} else {
|
|
78
|
+
// Timeout on BLPOP - no signal received, continue polling
|
|
79
|
+
const elapsedSec = ((Date.now() - startTime) / 1000).toFixed(1);
|
|
80
|
+
console.log(`[wait-threshold] Polling... ${completed.length}/${requiredCount} completed (${elapsedSec}s elapsed)`);
|
|
81
|
+
}
|
|
82
|
+
} catch (blpopErr) {
|
|
83
|
+
// Redis error during BLPOP
|
|
84
|
+
console.error(`[wait-threshold] BLPOP error:`, blpopErr);
|
|
85
|
+
break;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
const elapsedMs = Date.now() - startTime;
|
|
89
|
+
const thresholdMet = completed.length >= requiredCount;
|
|
90
|
+
return {
|
|
91
|
+
success: thresholdMet,
|
|
92
|
+
completed,
|
|
93
|
+
timedOut: !thresholdMet && Date.now() - startTime >= timeoutMs,
|
|
94
|
+
thresholdMet,
|
|
95
|
+
completedCount: completed.length,
|
|
96
|
+
requiredCount,
|
|
97
|
+
totalAgents,
|
|
98
|
+
elapsedMs
|
|
99
|
+
};
|
|
100
|
+
} finally{
|
|
101
|
+
await client.disconnect();
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Parse CLI arguments
|
|
106
|
+
*/ function parseArgs(args) {
|
|
107
|
+
const config = {
|
|
108
|
+
threshold: 0.75,
|
|
109
|
+
timeoutSeconds: 120
|
|
110
|
+
};
|
|
111
|
+
for(let i = 0; i < args.length; i++){
|
|
112
|
+
const arg = args[i];
|
|
113
|
+
const value = args[i + 1];
|
|
114
|
+
switch(arg){
|
|
115
|
+
case '--task-id':
|
|
116
|
+
case '-t':
|
|
117
|
+
config.taskId = value;
|
|
118
|
+
i++;
|
|
119
|
+
break;
|
|
120
|
+
case '--total-agents':
|
|
121
|
+
case '-n':
|
|
122
|
+
config.totalAgents = parseInt(value, 10);
|
|
123
|
+
i++;
|
|
124
|
+
break;
|
|
125
|
+
case '--threshold':
|
|
126
|
+
config.threshold = parseFloat(value);
|
|
127
|
+
i++;
|
|
128
|
+
break;
|
|
129
|
+
case '--timeout':
|
|
130
|
+
config.timeoutSeconds = parseInt(value, 10);
|
|
131
|
+
i++;
|
|
132
|
+
break;
|
|
133
|
+
case '--redis-host':
|
|
134
|
+
config.redisHost = value;
|
|
135
|
+
i++;
|
|
136
|
+
break;
|
|
137
|
+
case '--redis-port':
|
|
138
|
+
config.redisPort = parseInt(value, 10);
|
|
139
|
+
i++;
|
|
140
|
+
break;
|
|
141
|
+
case '--help':
|
|
142
|
+
case '-h':
|
|
143
|
+
printHelp();
|
|
144
|
+
process.exit(0);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
// Validate required fields
|
|
148
|
+
if (!config.taskId) {
|
|
149
|
+
console.error('Error: --task-id is required');
|
|
150
|
+
return null;
|
|
151
|
+
}
|
|
152
|
+
if (!config.totalAgents || config.totalAgents < 1) {
|
|
153
|
+
console.error('Error: --total-agents must be a positive integer');
|
|
154
|
+
return null;
|
|
155
|
+
}
|
|
156
|
+
if (config.threshold < 0 || config.threshold > 1) {
|
|
157
|
+
console.error('Error: --threshold must be between 0.0 and 1.0');
|
|
158
|
+
return null;
|
|
159
|
+
}
|
|
160
|
+
return config;
|
|
161
|
+
}
|
|
162
|
+
function printHelp() {
|
|
163
|
+
console.log(`
|
|
164
|
+
Wait for Threshold Completion - Parallel Agent Coordination
|
|
165
|
+
|
|
166
|
+
USAGE:
|
|
167
|
+
npx tsx src/cli/coordination/wait-for-threshold.ts [OPTIONS]
|
|
168
|
+
|
|
169
|
+
OPTIONS:
|
|
170
|
+
-t, --task-id <id> Task ID for coordination (required)
|
|
171
|
+
-n, --total-agents <n> Total number of agents spawned (required)
|
|
172
|
+
--threshold <0.0-1.0> Completion threshold (default: 0.75 = 75%)
|
|
173
|
+
--timeout <seconds> Overall timeout (default: 120)
|
|
174
|
+
--redis-host <host> Redis host (default: localhost)
|
|
175
|
+
--redis-port <port> Redis port (default: 6379)
|
|
176
|
+
-h, --help Show this help message
|
|
177
|
+
|
|
178
|
+
EXAMPLES:
|
|
179
|
+
# Wait for 3/4 agents (75%) with 120s timeout
|
|
180
|
+
npx tsx src/cli/coordination/wait-for-threshold.ts \\
|
|
181
|
+
--task-id cfn-cli-12345 \\
|
|
182
|
+
--total-agents 4 \\
|
|
183
|
+
--threshold 0.75 \\
|
|
184
|
+
--timeout 120
|
|
185
|
+
|
|
186
|
+
# Wait for all agents (100%) with 300s timeout
|
|
187
|
+
npx tsx src/cli/coordination/wait-for-threshold.ts \\
|
|
188
|
+
--task-id cfn-cli-12345 \\
|
|
189
|
+
--total-agents 4 \\
|
|
190
|
+
--threshold 1.0 \\
|
|
191
|
+
--timeout 300
|
|
192
|
+
|
|
193
|
+
OUTPUT:
|
|
194
|
+
JSON result with completion status:
|
|
195
|
+
{
|
|
196
|
+
"success": true,
|
|
197
|
+
"thresholdMet": true,
|
|
198
|
+
"completedCount": 3,
|
|
199
|
+
"requiredCount": 3,
|
|
200
|
+
"totalAgents": 4,
|
|
201
|
+
"elapsedMs": 45000,
|
|
202
|
+
"completed": [...]
|
|
203
|
+
}
|
|
204
|
+
`);
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* CLI entry point
|
|
208
|
+
*/ async function main() {
|
|
209
|
+
const config = parseArgs(process.argv.slice(2));
|
|
210
|
+
if (!config) {
|
|
211
|
+
console.error('Use --help for usage information');
|
|
212
|
+
process.exit(1);
|
|
213
|
+
}
|
|
214
|
+
try {
|
|
215
|
+
const result = await waitForThreshold(config);
|
|
216
|
+
// Output result as JSON for scripting
|
|
217
|
+
console.log('\n[wait-threshold] Result:');
|
|
218
|
+
console.log(JSON.stringify(result, null, 2));
|
|
219
|
+
// Exit with appropriate code
|
|
220
|
+
process.exit(result.success ? 0 : 1);
|
|
221
|
+
} catch (error) {
|
|
222
|
+
console.error('[wait-threshold] Fatal error:', error);
|
|
223
|
+
process.exit(2);
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
// Run if called directly
|
|
227
|
+
if (import.meta.url.endsWith(process.argv[1]?.replace(/\\/g, '/') || '')) {
|
|
228
|
+
main();
|
|
229
|
+
}
|
|
230
|
+
export { parseArgs };
|
|
231
|
+
|
|
232
|
+
//# sourceMappingURL=wait-for-threshold.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/cli/coordination/wait-for-threshold.ts"],"sourcesContent":["#!/usr/bin/env node\r\n/**\r\n * Wait for Threshold Completion - Parallel Agent Coordination\r\n *\r\n * Waits for N/M agents to complete (e.g., 3/4 = 75% threshold) before continuing.\r\n * Enables parallel agent spawning with graceful degradation on partial completion.\r\n *\r\n * Usage:\r\n * npx tsx src/cli/coordination/wait-for-threshold.ts \\\r\n * --task-id <id> \\\r\n * --total-agents <n> \\\r\n * --threshold <0.0-1.0> \\\r\n * --timeout <seconds>\r\n *\r\n * Example:\r\n * # Wait for 3/4 agents (75%) with 120s timeout\r\n * npx tsx src/cli/coordination/wait-for-threshold.ts \\\r\n * --task-id cfn-cli-12345 \\\r\n * --total-agents 4 \\\r\n * --threshold 0.75 \\\r\n * --timeout 120\r\n */\r\n\r\nimport { createClient, RedisClientType } from 'redis';\r\n\r\nexport interface ThresholdConfig {\r\n taskId: string;\r\n totalAgents: number;\r\n threshold: number; // 0.75 for 3/4\r\n timeoutSeconds: number;\r\n redisHost?: string;\r\n redisPort?: number;\r\n redisPassword?: string;\r\n}\r\n\r\nexport interface CompletionSignal {\r\n agentId: string;\r\n taskId: string;\r\n status: 'completed' | 'failed' | 'timeout';\r\n timestamp: string;\r\n confidence?: number;\r\n metadata?: Record<string, unknown>;\r\n}\r\n\r\nexport interface ThresholdResult {\r\n success: boolean;\r\n completed: CompletionSignal[];\r\n timedOut: boolean;\r\n thresholdMet: boolean;\r\n completedCount: number;\r\n requiredCount: number;\r\n totalAgents: number;\r\n elapsedMs: number;\r\n}\r\n\r\n/**\r\n * Wait for threshold completion of agents\r\n *\r\n * Uses Redis BLPOP with short timeouts to poll for completion signals\r\n * while tracking progress toward the threshold.\r\n */\r\nexport async function waitForThreshold(config: ThresholdConfig): Promise<ThresholdResult> {\r\n const {\r\n taskId,\r\n totalAgents,\r\n threshold,\r\n timeoutSeconds,\r\n redisHost = process.env.CFN_REDIS_HOST || 'localhost',\r\n redisPort = parseInt(process.env.CFN_REDIS_PORT || '6379', 10),\r\n redisPassword = process.env.CFN_REDIS_PASSWORD || undefined\r\n } = config;\r\n\r\n const requiredCount = Math.ceil(totalAgents * threshold);\r\n const signalKey = `cfn-completion:${taskId}`;\r\n const completed: CompletionSignal[] = [];\r\n const startTime = Date.now();\r\n const timeoutMs = timeoutSeconds * 1000;\r\n\r\n // Connect to Redis\r\n const client: RedisClientType = createClient({\r\n socket: { host: redisHost, port: redisPort },\r\n password: redisPassword || undefined\r\n });\r\n\r\n try {\r\n await client.connect();\r\n console.log(`[wait-threshold] Connected to Redis at ${redisHost}:${redisPort}`);\r\n console.log(`[wait-threshold] Waiting for ${requiredCount}/${totalAgents} agents (${(threshold * 100).toFixed(0)}% threshold)`);\r\n console.log(`[wait-threshold] Signal key: ${signalKey}`);\r\n console.log(`[wait-threshold] Timeout: ${timeoutSeconds}s`);\r\n\r\n // Poll loop with short BLPOP timeouts\r\n const pollIntervalSeconds = 5; // Check every 5 seconds\r\n\r\n while (completed.length < requiredCount) {\r\n const elapsed = Date.now() - startTime;\r\n\r\n // Check overall timeout\r\n if (elapsed >= timeoutMs) {\r\n console.log(`[wait-threshold] Timeout reached after ${(elapsed / 1000).toFixed(1)}s`);\r\n break;\r\n }\r\n\r\n // Calculate remaining time for this poll\r\n const remainingMs = timeoutMs - elapsed;\r\n const pollTimeout = Math.min(pollIntervalSeconds, Math.ceil(remainingMs / 1000));\r\n\r\n try {\r\n // BLPOP with short timeout - returns null on timeout\r\n const result = await client.blPop(signalKey, pollTimeout);\r\n\r\n if (result) {\r\n try {\r\n const signal: CompletionSignal = JSON.parse(result.element);\r\n completed.push(signal);\r\n\r\n console.log(`[wait-threshold] Received signal ${completed.length}/${requiredCount}: ${signal.agentId} (${signal.status})`);\r\n\r\n // Check if threshold met\r\n if (completed.length >= requiredCount) {\r\n console.log(`[wait-threshold] Threshold met! ${completed.length}/${totalAgents} agents completed`);\r\n break;\r\n }\r\n } catch (parseErr) {\r\n console.warn(`[wait-threshold] Failed to parse signal: ${result.element}`);\r\n }\r\n } else {\r\n // Timeout on BLPOP - no signal received, continue polling\r\n const elapsedSec = ((Date.now() - startTime) / 1000).toFixed(1);\r\n console.log(`[wait-threshold] Polling... ${completed.length}/${requiredCount} completed (${elapsedSec}s elapsed)`);\r\n }\r\n } catch (blpopErr) {\r\n // Redis error during BLPOP\r\n console.error(`[wait-threshold] BLPOP error:`, blpopErr);\r\n break;\r\n }\r\n }\r\n\r\n const elapsedMs = Date.now() - startTime;\r\n const thresholdMet = completed.length >= requiredCount;\r\n\r\n return {\r\n success: thresholdMet,\r\n completed,\r\n timedOut: !thresholdMet && (Date.now() - startTime) >= timeoutMs,\r\n thresholdMet,\r\n completedCount: completed.length,\r\n requiredCount,\r\n totalAgents,\r\n elapsedMs\r\n };\r\n\r\n } finally {\r\n await client.disconnect();\r\n }\r\n}\r\n\r\n/**\r\n * Parse CLI arguments\r\n */\r\nfunction parseArgs(args: string[]): ThresholdConfig | null {\r\n const config: Partial<ThresholdConfig> = {\r\n threshold: 0.75,\r\n timeoutSeconds: 120\r\n };\r\n\r\n for (let i = 0; i < args.length; i++) {\r\n const arg = args[i];\r\n const value = args[i + 1];\r\n\r\n switch (arg) {\r\n case '--task-id':\r\n case '-t':\r\n config.taskId = value;\r\n i++;\r\n break;\r\n case '--total-agents':\r\n case '-n':\r\n config.totalAgents = parseInt(value, 10);\r\n i++;\r\n break;\r\n case '--threshold':\r\n config.threshold = parseFloat(value);\r\n i++;\r\n break;\r\n case '--timeout':\r\n config.timeoutSeconds = parseInt(value, 10);\r\n i++;\r\n break;\r\n case '--redis-host':\r\n config.redisHost = value;\r\n i++;\r\n break;\r\n case '--redis-port':\r\n config.redisPort = parseInt(value, 10);\r\n i++;\r\n break;\r\n case '--help':\r\n case '-h':\r\n printHelp();\r\n process.exit(0);\r\n }\r\n }\r\n\r\n // Validate required fields\r\n if (!config.taskId) {\r\n console.error('Error: --task-id is required');\r\n return null;\r\n }\r\n if (!config.totalAgents || config.totalAgents < 1) {\r\n console.error('Error: --total-agents must be a positive integer');\r\n return null;\r\n }\r\n if (config.threshold! < 0 || config.threshold! > 1) {\r\n console.error('Error: --threshold must be between 0.0 and 1.0');\r\n return null;\r\n }\r\n\r\n return config as ThresholdConfig;\r\n}\r\n\r\nfunction printHelp(): void {\r\n console.log(`\r\nWait for Threshold Completion - Parallel Agent Coordination\r\n\r\nUSAGE:\r\n npx tsx src/cli/coordination/wait-for-threshold.ts [OPTIONS]\r\n\r\nOPTIONS:\r\n -t, --task-id <id> Task ID for coordination (required)\r\n -n, --total-agents <n> Total number of agents spawned (required)\r\n --threshold <0.0-1.0> Completion threshold (default: 0.75 = 75%)\r\n --timeout <seconds> Overall timeout (default: 120)\r\n --redis-host <host> Redis host (default: localhost)\r\n --redis-port <port> Redis port (default: 6379)\r\n -h, --help Show this help message\r\n\r\nEXAMPLES:\r\n # Wait for 3/4 agents (75%) with 120s timeout\r\n npx tsx src/cli/coordination/wait-for-threshold.ts \\\\\r\n --task-id cfn-cli-12345 \\\\\r\n --total-agents 4 \\\\\r\n --threshold 0.75 \\\\\r\n --timeout 120\r\n\r\n # Wait for all agents (100%) with 300s timeout\r\n npx tsx src/cli/coordination/wait-for-threshold.ts \\\\\r\n --task-id cfn-cli-12345 \\\\\r\n --total-agents 4 \\\\\r\n --threshold 1.0 \\\\\r\n --timeout 300\r\n\r\nOUTPUT:\r\n JSON result with completion status:\r\n {\r\n \"success\": true,\r\n \"thresholdMet\": true,\r\n \"completedCount\": 3,\r\n \"requiredCount\": 3,\r\n \"totalAgents\": 4,\r\n \"elapsedMs\": 45000,\r\n \"completed\": [...]\r\n }\r\n`);\r\n}\r\n\r\n/**\r\n * CLI entry point\r\n */\r\nasync function main(): Promise<void> {\r\n const config = parseArgs(process.argv.slice(2));\r\n\r\n if (!config) {\r\n console.error('Use --help for usage information');\r\n process.exit(1);\r\n }\r\n\r\n try {\r\n const result = await waitForThreshold(config);\r\n\r\n // Output result as JSON for scripting\r\n console.log('\\n[wait-threshold] Result:');\r\n console.log(JSON.stringify(result, null, 2));\r\n\r\n // Exit with appropriate code\r\n process.exit(result.success ? 0 : 1);\r\n } catch (error) {\r\n console.error('[wait-threshold] Fatal error:', error);\r\n process.exit(2);\r\n }\r\n}\r\n\r\n// Run if called directly\r\nif (import.meta.url.endsWith(process.argv[1]?.replace(/\\\\/g, '/') || '')) {\r\n main();\r\n}\r\n\r\nexport { parseArgs };\r\n"],"names":["createClient","waitForThreshold","config","taskId","totalAgents","threshold","timeoutSeconds","redisHost","process","env","CFN_REDIS_HOST","redisPort","parseInt","CFN_REDIS_PORT","redisPassword","CFN_REDIS_PASSWORD","undefined","requiredCount","Math","ceil","signalKey","completed","startTime","Date","now","timeoutMs","client","socket","host","port","password","connect","console","log","toFixed","pollIntervalSeconds","length","elapsed","remainingMs","pollTimeout","min","result","blPop","signal","JSON","parse","element","push","agentId","status","parseErr","warn","elapsedSec","blpopErr","error","elapsedMs","thresholdMet","success","timedOut","completedCount","disconnect","parseArgs","args","i","arg","value","parseFloat","printHelp","exit","main","argv","slice","stringify","url","endsWith","replace"],"mappings":";AACA;;;;;;;;;;;;;;;;;;;;CAoBC,GAED,SAASA,YAAY,QAAyB,QAAQ;AAgCtD;;;;;CAKC,GACD,OAAO,eAAeC,iBAAiBC,MAAuB;IAC5D,MAAM,EACJC,MAAM,EACNC,WAAW,EACXC,SAAS,EACTC,cAAc,EACdC,YAAYC,QAAQC,GAAG,CAACC,cAAc,IAAI,WAAW,EACrDC,YAAYC,SAASJ,QAAQC,GAAG,CAACI,cAAc,IAAI,QAAQ,GAAG,EAC9DC,gBAAgBN,QAAQC,GAAG,CAACM,kBAAkB,IAAIC,SAAS,EAC5D,GAAGd;IAEJ,MAAMe,gBAAgBC,KAAKC,IAAI,CAACf,cAAcC;IAC9C,MAAMe,YAAY,CAAC,eAAe,EAAEjB,QAAQ;IAC5C,MAAMkB,YAAgC,EAAE;IACxC,MAAMC,YAAYC,KAAKC,GAAG;IAC1B,MAAMC,YAAYnB,iBAAiB;IAEnC,mBAAmB;IACnB,MAAMoB,SAA0B1B,aAAa;QAC3C2B,QAAQ;YAAEC,MAAMrB;YAAWsB,MAAMlB;QAAU;QAC3CmB,UAAUhB,iBAAiBE;IAC7B;IAEA,IAAI;QACF,MAAMU,OAAOK,OAAO;QACpBC,QAAQC,GAAG,CAAC,CAAC,uCAAuC,EAAE1B,UAAU,CAAC,EAAEI,WAAW;QAC9EqB,QAAQC,GAAG,CAAC,CAAC,6BAA6B,EAAEhB,cAAc,CAAC,EAAEb,YAAY,SAAS,EAAE,AAACC,CAAAA,YAAY,GAAE,EAAG6B,OAAO,CAAC,GAAG,YAAY,CAAC;QAC9HF,QAAQC,GAAG,CAAC,CAAC,6BAA6B,EAAEb,WAAW;QACvDY,QAAQC,GAAG,CAAC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{ agentCommand } from './agent-command.js';
|
|
|
86
86
|
case '--debug':
|
|
87
87
|
options.debug = true;
|
|
88
88
|
break;
|
|
89
|
+
case '--provider':
|
|
90
|
+
options.provider = value;
|
|
91
|
+
i++;
|
|
92
|
+
break;
|
|
89
93
|
}
|
|
90
94
|
}
|
|
91
95
|
return {
|
|
@@ -112,6 +116,9 @@ Examples:
|
|
|
112
116
|
# Spawn an agent
|
|
113
117
|
npx claude-flow-novice agent coder --context "Implement feature"
|
|
114
118
|
|
|
119
|
+
# Spawn an agent with ZAI provider
|
|
120
|
+
npx claude-flow-novice agent coder --provider zai --context "Implement feature"
|
|
121
|
+
|
|
115
122
|
# List available agents
|
|
116
123
|
npx claude-flow-novice agent --list
|
|
117
124
|
|
|
@@ -139,6 +146,10 @@ For more information:
|
|
|
139
146
|
const { command, agentType, options } = parseArgs(args);
|
|
140
147
|
switch(command){
|
|
141
148
|
case 'agent':
|
|
149
|
+
// Set provider environment variable if specified
|
|
150
|
+
if (options.provider) {
|
|
151
|
+
process.env.CLAUDE_API_PROVIDER = options.provider;
|
|
152
|
+
}
|
|
142
153
|
await agentCommand(agentType, options);
|
|
143
154
|
break;
|
|
144
155
|
default:
|
package/dist/cli/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/cli/index.ts"],"sourcesContent":["#!/usr/bin/env node\r\n/**\r\n * CLI Entry Point - v2.1\r\n *\r\n * Handles agent spawning commands with memory management:\r\n * npx claude-flow-novice agent <type> [options]\r\n */\r\n\r\n// Load environment variables from .env file\r\nimport 'dotenv/config';\r\n\r\n// Apply safe memory defaults if not configured\r\nif (!process.env.NODE_OPTIONS) {\r\n // Set conservative 8GB limit (reduced from default 16GB)\r\n process.env.NODE_OPTIONS = '--max-old-space-size=8192';\r\n} else if (!process.env.NODE_OPTIONS.includes('max-old-space-size')) {\r\n // Append memory limit to existing NODE_OPTIONS\r\n process.env.NODE_OPTIONS += ' --max-old-space-size=8192';\r\n}\r\n\r\n// Enable memory profiling in development/debug mode\r\nif (process.env.NODE_ENV === 'development' || process.env.CLAUDE_DEBUG) {\r\n if (!process.env.NODE_OPTIONS.includes('inspect')) {\r\n process.env.NODE_OPTIONS += ' --inspect=0.0.0.0:9229';\r\n }\r\n if (!process.env.NODE_OPTIONS.includes('heap-prof')) {\r\n process.env.NODE_OPTIONS += ' --heap-prof';\r\n }\r\n}\r\n\r\nimport { VERSION } from '../core/index.js';\r\nimport { agentCommand, AgentCommandOptions } from './agent-command.js';\r\n\r\n/**\r\n * Parse command line arguments\r\n */\r\nfunction parseArgs(args: string[]): { command: string; agentType?: string; options: AgentCommandOptions } {\r\n const command = args[0] || 'help';\r\n const agentType = args[1] && !args[1].startsWith('--') ? args[1] : undefined;\r\n const options: AgentCommandOptions = {};\r\n\r\n // Parse options and capture positional context argument\r\n for (let i = agentType ? 2 : 1; i < args.length; i++) {\r\n const arg = args[i];\r\n const value = args[i + 1];\r\n\r\n // Capture non-flag positional arguments as context (before any flags)\r\n if (!arg.startsWith('--') && !options.context) {\r\n options.context = arg;\r\n continue;\r\n }\r\n\r\n switch (arg) {\r\n case '--task-id':\r\n options.taskId = value;\r\n i++;\r\n break;\r\n case '--iteration':\r\n options.iteration = parseInt(value, 10);\r\n i++;\r\n break;\r\n case '--agent-id':\r\n options.agentId = value;\r\n i++;\r\n break;\r\n case '--context':\r\n options.context = value;\r\n i++;\r\n break;\r\n case '--mode':\r\n options.mode = value;\r\n i++;\r\n break;\r\n case '--priority':\r\n options.priority = parseInt(value, 10);\r\n i++;\r\n break;\r\n case '--parent-task-id':\r\n options.parentTaskId = value;\r\n i++;\r\n break;\r\n case '--list':\r\n options.list = true;\r\n break;\r\n case '--help':\r\n case '-h':\r\n options.help = true;\r\n break;\r\n case '--memory-limit':\r\n options.memoryLimit = parseInt(value, 10);\r\n i++;\r\n break;\r\n case '--enable-profiling':\r\n options.enableProfiling = true;\r\n break;\r\n case '--debug':\r\n options.debug = true;\r\n break;\r\n }\r\n }\r\n\r\n return { command, agentType, options };\r\n}\r\n\r\n/**\r\n * Display main CLI help\r\n */\r\nfunction displayHelp(): void {\r\n console.log(`\r\nClaude Flow Novice CLI v${VERSION}\r\n\r\nUsage:\r\n npx claude-flow-novice <command> [options]\r\n\r\nCommands:\r\n agent <type> [options] Spawn an agent for task execution\r\n --version Show version number\r\n --help Show this help message\r\n\r\nExamples:\r\n # Spawn an agent\r\n npx claude-flow-novice agent coder --context \"Implement feature\"\r\n\r\n # List available agents\r\n npx claude-flow-novice agent --list\r\n\r\n # Show version\r\n npx claude-flow-novice --version\r\n\r\nFor more information:\r\n https://github.com/yourusername/claude-flow-novice\r\n`);\r\n}\r\n\r\n/**\r\n * Main CLI entry point\r\n */\r\nasync function main() {\r\n const args = process.argv.slice(2);\r\n\r\n // Handle version flag\r\n if (args.includes('--version') || args.includes('-v')) {\r\n console.log(`Claude Flow Novice v${VERSION}`);\r\n return;\r\n }\r\n\r\n // Handle help flag\r\n if (args.length === 0 || args.includes('--help') || args.includes('-h')) {\r\n displayHelp();\r\n return;\r\n }\r\n\r\n const { command, agentType, options } = parseArgs(args);\r\n\r\n switch (command) {\r\n case 'agent':\r\n await agentCommand(agentType, options);\r\n break;\r\n\r\n default:\r\n console.error(`Unknown command: ${command}`);\r\n console.log('Run with --help for usage information');\r\n process.exit(1);\r\n }\r\n}\r\n\r\n// Run CLI\r\nmain().catch((error) => {\r\n console.error('[claude-flow-novice] Fatal error:', error);\r\n process.exit(1);\r\n});\r\n"],"names":["process","env","NODE_OPTIONS","includes","NODE_ENV","CLAUDE_DEBUG","VERSION","agentCommand","parseArgs","args","command","agentType","startsWith","undefined","options","i","length","arg","value","context","taskId","iteration","parseInt","agentId","mode","priority","parentTaskId","list","help","memoryLimit","enableProfiling","debug","displayHelp","console","log","main","argv","slice","error","exit","catch"],"mappings":";AACA;;;;;CAKC,GAED,4CAA4C;AAC5C,OAAO,gBAAgB;AAEvB,+CAA+C;AAC/C,IAAI,CAACA,QAAQC,GAAG,CAAC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,SAAS,GAAGC,SAASJ,OAAO;gBACpCH;gBACA;YACF,KAAK;gBACHD,QAAQS,OAAO,GAAGL;gBAClBH;gBACA;YACF,KAAK;gBACHD,QAAQK,OAAO,GAAGD;gBAClBH;gBACA;YACF,KAAK;gBACHD,QAAQU,IAAI,GAAGN;gBACfH;gBACA;YACF,KAAK;gBACHD,QAAQW,QAAQ,GAAGH,SAASJ,OAAO;gBACnCH;gBACA;YACF,KAAK;gBACHD,QAAQY,YAAY,GAAGR;gBACvBH;gBACA;YACF,KAAK;gBACHD,QAAQa,IAAI,GAAG;gBACf;YACF,KAAK;YACL,KAAK;gBACHb,QAAQc,IAAI,GAAG;gBACf;YACF,KAAK;gBACHd,QAAQe,WAAW,GAAGP,SAASJ,OAAO;gBACtCH;gBACA;YACF,KAAK;gBACHD,QAAQgB,eAAe,GAAG;gBAC1B;YACF,KAAK;gBACHhB,QAAQiB,KAAK,GAAG;gBAChB;QACJ;IACF;IAEA,OAAO;
|
|
1
|
+
{"version":3,"sources":["../../src/cli/index.ts"],"sourcesContent":["#!/usr/bin/env node\r\n/**\r\n * CLI Entry Point - v2.1\r\n *\r\n * Handles agent spawning commands with memory management:\r\n * npx claude-flow-novice agent <type> [options]\r\n */\r\n\r\n// Load environment variables from .env file\r\nimport 'dotenv/config';\r\n\r\n// Apply safe memory defaults if not configured\r\nif (!process.env.NODE_OPTIONS) {\r\n // Set conservative 8GB limit (reduced from default 16GB)\r\n process.env.NODE_OPTIONS = '--max-old-space-size=8192';\r\n} else if (!process.env.NODE_OPTIONS.includes('max-old-space-size')) {\r\n // Append memory limit to existing NODE_OPTIONS\r\n process.env.NODE_OPTIONS += ' --max-old-space-size=8192';\r\n}\r\n\r\n// Enable memory profiling in development/debug mode\r\nif (process.env.NODE_ENV === 'development' || process.env.CLAUDE_DEBUG) {\r\n if (!process.env.NODE_OPTIONS.includes('inspect')) {\r\n process.env.NODE_OPTIONS += ' --inspect=0.0.0.0:9229';\r\n }\r\n if (!process.env.NODE_OPTIONS.includes('heap-prof')) {\r\n process.env.NODE_OPTIONS += ' --heap-prof';\r\n }\r\n}\r\n\r\nimport { VERSION } from '../core/index.js';\r\nimport { agentCommand, AgentCommandOptions } from './agent-command.js';\r\n\r\n/**\r\n * Parse command line arguments\r\n */\r\nfunction parseArgs(args: string[]): { command: string; agentType?: string; options: AgentCommandOptions } {\r\n const command = args[0] || 'help';\r\n const agentType = args[1] && !args[1].startsWith('--') ? args[1] : undefined;\r\n const options: AgentCommandOptions = {};\r\n\r\n // Parse options and capture positional context argument\r\n for (let i = agentType ? 2 : 1; i < args.length; i++) {\r\n const arg = args[i];\r\n const value = args[i + 1];\r\n\r\n // Capture non-flag positional arguments as context (before any flags)\r\n if (!arg.startsWith('--') && !options.context) {\r\n options.context = arg;\r\n continue;\r\n }\r\n\r\n switch (arg) {\r\n case '--task-id':\r\n options.taskId = value;\r\n i++;\r\n break;\r\n case '--iteration':\r\n options.iteration = parseInt(value, 10);\r\n i++;\r\n break;\r\n case '--agent-id':\r\n options.agentId = value;\r\n i++;\r\n break;\r\n case '--context':\r\n options.context = value;\r\n i++;\r\n break;\r\n case '--mode':\r\n options.mode = value;\r\n i++;\r\n break;\r\n case '--priority':\r\n options.priority = parseInt(value, 10);\r\n i++;\r\n break;\r\n case '--parent-task-id':\r\n options.parentTaskId = value;\r\n i++;\r\n break;\r\n case '--list':\r\n options.list = true;\r\n break;\r\n case '--help':\r\n case '-h':\r\n options.help = true;\r\n break;\r\n case '--memory-limit':\r\n options.memoryLimit = parseInt(value, 10);\r\n i++;\r\n break;\r\n case '--enable-profiling':\r\n options.enableProfiling = true;\r\n break;\r\n case '--debug':\r\n options.debug = true;\r\n break;\r\n case '--provider':\r\n options.provider = value;\r\n i++;\r\n break;\r\n }\r\n }\r\n\r\n return { command, agentType, options };\r\n}\r\n\r\n/**\r\n * Display main CLI help\r\n */\r\nfunction displayHelp(): void {\r\n console.log(`\r\nClaude Flow Novice CLI v${VERSION}\r\n\r\nUsage:\r\n npx claude-flow-novice <command> [options]\r\n\r\nCommands:\r\n agent <type> [options] Spawn an agent for task execution\r\n --version Show version number\r\n --help Show this help message\r\n\r\nExamples:\r\n # Spawn an agent\r\n npx claude-flow-novice agent coder --context \"Implement feature\"\r\n\r\n # Spawn an agent with ZAI provider\r\n npx claude-flow-novice agent coder --provider zai --context \"Implement feature\"\r\n\r\n # List available agents\r\n npx claude-flow-novice agent --list\r\n\r\n # Show version\r\n npx claude-flow-novice --version\r\n\r\nFor more information:\r\n https://github.com/yourusername/claude-flow-novice\r\n`);\r\n}\r\n\r\n/**\r\n * Main CLI entry point\r\n */\r\nasync function main() {\r\n const args = process.argv.slice(2);\r\n\r\n // Handle version flag\r\n if (args.includes('--version') || args.includes('-v')) {\r\n console.log(`Claude Flow Novice v${VERSION}`);\r\n return;\r\n }\r\n\r\n // Handle help flag\r\n if (args.length === 0 || args.includes('--help') || args.includes('-h')) {\r\n displayHelp();\r\n return;\r\n }\r\n\r\n const { command, agentType, options } = parseArgs(args);\r\n\r\n switch (command) {\r\n case 'agent':\r\n // Set provider environment variable if specified\r\n if (options.provider) {\r\n process.env.CLAUDE_API_PROVIDER = options.provider;\r\n }\r\n await agentCommand(agentType, options);\r\n break;\r\n\r\n default:\r\n console.error(`Unknown command: ${command}`);\r\n console.log('Run with --help for usage information');\r\n process.exit(1);\r\n }\r\n}\r\n\r\n// Run CLI\r\nmain().catch((error) => {\r\n console.error('[claude-flow-novice] Fatal error:', error);\r\n process.exit(1);\r\n});\r\n"],"names":["process","env","NODE_OPTIONS","includes","NODE_ENV","CLAUDE_DEBUG","VERSION","agentCommand","parseArgs","args","command","agentType","startsWith","undefined","options","i","length","arg","value","context","taskId","iteration","parseInt","agentId","mode","priority","parentTaskId","list","help","memoryLimit","enableProfiling","debug","provider","displayHelp","console","log","main","argv","slice","CLAUDE_API_PROVIDER","error","exit","catch"],"mappings":";AACA;;;;;CAKC,GAED,4CAA4C;AAC5C,OAAO,gBAAgB;AAEvB,+CAA+C;AAC/C,IA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AAEC,SAAS,EAAEG,OAAO,EAAE,GAAGN,UAAUC;IAElD,OAAQC;QACN,KAAK;YACH,iDAAiD;YACjD,IAAII,QAAQkB,QAAQ,EAAE;gBACpBhC,QAAQC,GAAG,CAACsC,mBAAmB,GAAGzB,QAAQkB,QAAQ;YACpD;YACA,MAAMzB,aAAaI,WAAWG;YAC9B;QAEF;YACEoB,QAAQM,KAAK,CAAC,CAAC,iBAAiB,EAAE9B,SAAS;YAC3CwB,QAAQC,GAAG,CAAC;YACZnC,QAAQyC,IAAI,CAAC;IACjB;AACF;AAEA,UAAU;AACVL,OAAOM,KAAK,CAAC,CAACF;IACZN,QAAQM,KAAK,CAAC,qCAAqCA;IACnDxC,QAAQyC,IAAI,CAAC;AACf"}
|
|
@@ -11,7 +11,8 @@
|
|
|
11
11
|
* Sprint 3 - Phase 2 Implementation
|
|
12
12
|
*/ import { execSync } from 'child_process';
|
|
13
13
|
// Bug #6 Fix: Read Redis connection parameters from process.env
|
|
14
|
-
|
|
14
|
+
// FIX: Default to 'localhost' for CLI mode (host execution), not 'cfn-redis' (Docker)
|
|
15
|
+
const redisHost = process.env.CFN_REDIS_HOST || 'localhost';
|
|
15
16
|
const redisPort = process.env.CFN_REDIS_PORT || '6379';
|
|
16
17
|
/**
|
|
17
18
|
* Load iteration history for an agent from Redis
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/cli/iteration-history.ts"],"sourcesContent":["/**\r\n * Iteration History Management\r\n *\r\n * Loads and formats iteration history from Redis for CLI-spawned agents.\r\n * Enables agents to learn from previous attempts and feedback.\r\n *\r\n * Storage Pattern:\r\n * swarm:${TASK_ID}:${AGENT_ID}:result:iteration-${N} → Result text + confidence\r\n * swarm:${TASK_ID}:${AGENT_ID}:feedback:iteration-${N} → Validator feedback\r\n *\r\n * Sprint 3 - Phase 2 Implementation\r\n */\r\n\r\nimport { execSync } from 'child_process';\r\n\r\n// Bug #6 Fix: Read Redis connection parameters from process.env\r\nconst redisHost = process.env.CFN_REDIS_HOST || 'cfn-redis';\r\nconst redisPort = process.env.CFN_REDIS_PORT || '6379';\r\n\r\nexport interface IterationResult {\r\n iteration: number;\r\n result: string;\r\n confidence: number;\r\n timestamp: string;\r\n feedback?: string;\r\n}\r\n\r\n/**\r\n * Load iteration history for an agent from Redis\r\n *\r\n * @param taskId - Task identifier\r\n * @param agentId - Agent identifier\r\n * @param currentIteration - Current iteration number (loads 1 to N-1)\r\n * @returns Array of iteration results\r\n */\r\nexport async function loadIterationHistory(\r\n taskId: string,\r\n agentId: string,\r\n currentIteration: number\r\n): Promise<IterationResult[]> {\r\n const history: IterationResult[] = [];\r\n\r\n // Load previous iterations (1 to currentIteration - 1)\r\n for (let i = 1; i < currentIteration; i++) {\r\n try {\r\n // Load result data\r\n const resultKey = `swarm:${taskId}:${agentId}:result:iteration-${i}`;\r\n const resultJson = execSync(`redis-cli -h ${redisHost} -p ${redisPort} get \"${resultKey}\"`, { encoding: 'utf8' }).trim();\r\n\r\n if (resultJson === '(nil)' || !resultJson) {\r\n // No result for this iteration (shouldn't happen in normal flow)\r\n continue;\r\n }\r\n\r\n const resultData = JSON.parse(resultJson);\r\n\r\n // Load feedback data (may not exist for all iterations)\r\n const feedbackKey = `swarm:${taskId}:${agentId}:feedback:iteration-${i}`;\r\n let feedback: string | undefined;\r\n\r\n try {\r\n const feedbackJson = execSync(`redis-cli -h ${redisHost} -p ${redisPort} get \"${feedbackKey}\"`, { encoding: 'utf8' }).trim();\r\n if (feedbackJson !== '(nil)' && feedbackJson) {\r\n const feedbackData = JSON.parse(feedbackJson);\r\n feedback = feedbackData.feedback || feedbackData.comments;\r\n }\r\n } catch (err) {\r\n // Feedback may not exist for this iteration\r\n feedback = undefined;\r\n }\r\n\r\n history.push({\r\n iteration: i,\r\n result: resultData.result || resultData.output || '',\r\n confidence: resultData.confidence || 0,\r\n timestamp: resultData.timestamp || new Date().toISOString(),\r\n feedback\r\n });\r\n } catch (err) {\r\n console.error(`[iteration-history] Failed to load iteration ${i}:`, err);\r\n // Continue loading other iterations\r\n }\r\n }\r\n\r\n return history;\r\n}\r\n\r\n/**\r\n * Store iteration result in Redis\r\n *\r\n * @param taskId - Task identifier\r\n * @param agentId - Agent identifier\r\n * @param iteration - Iteration number\r\n * @param result - Result text/output\r\n * @param confidence - Confidence score (0.0-1.0)\r\n */\r\nexport async function storeIterationResult(\r\n taskId: string,\r\n agentId: string,\r\n iteration: number,\r\n result: string,\r\n confidence: number\r\n): Promise<void> {\r\n const resultKey = `swarm:${taskId}:${agentId}:result:iteration-${iteration}`;\r\n const resultData = {\r\n result,\r\n confidence,\r\n timestamp: new Date().toISOString(),\r\n iteration\r\n };\r\n\r\n const resultJson = JSON.stringify(resultData);\r\n\r\n try {\r\n // Store with 24 hour TTL\r\n execSync(`redis-cli -h ${redisHost} -p ${redisPort} setex \"${resultKey}\" 86400 '${resultJson.replace(/'/g, \"'\\\\''\")}'`, {\r\n encoding: 'utf8'\r\n });\r\n console.log(`[iteration-history] Stored result for iteration ${iteration}`);\r\n } catch (err) {\r\n console.error(`[iteration-history] Failed to store result:`, err);\r\n throw err;\r\n }\r\n}\r\n\r\n/**\r\n * Format iteration history as markdown for system prompt\r\n *\r\n * @param history - Array of iteration results\r\n * @param currentIteration - Current iteration number\r\n * @returns Formatted markdown string\r\n */\r\nexport function formatIterationHistory(\r\n history: IterationResult[],\r\n currentIteration: number\r\n): string {\r\n if (history.length === 0) {\r\n return `## Current Iteration: ${currentIteration}\r\n\r\nThis is your first attempt at this task. No previous iteration history available.\r\n`;\r\n }\r\n\r\n const sections: string[] = [];\r\n\r\n sections.push('## Iteration History');\r\n sections.push('');\r\n sections.push('Learn from your previous attempts and feedback:');\r\n sections.push('');\r\n\r\n // Format each iteration\r\n for (const iter of history) {\r\n sections.push(`### Iteration ${iter.iteration}`);\r\n sections.push('');\r\n\r\n sections.push('**Result:**');\r\n sections.push(iter.result.substring(0, 500)); // Truncate to 500 chars\r\n if (iter.result.length > 500) {\r\n sections.push('... (truncated)');\r\n }\r\n sections.push('');\r\n\r\n if (iter.feedback) {\r\n sections.push('**Feedback from Validators:**');\r\n sections.push(iter.feedback);\r\n sections.push('');\r\n }\r\n\r\n sections.push(`**Confidence:** ${iter.confidence.toFixed(2)}`);\r\n sections.push(`**Timestamp:** ${iter.timestamp}`);\r\n sections.push('');\r\n sections.push('---');\r\n sections.push('');\r\n }\r\n\r\n // Add current iteration context\r\n sections.push(`## Current Iteration: ${currentIteration}`);\r\n sections.push('');\r\n\r\n if (history.length > 0) {\r\n const lastIteration = history[history.length - 1];\r\n if (lastIteration.feedback) {\r\n sections.push('**Your Task:** Address the feedback from the previous iteration:');\r\n sections.push('');\r\n sections.push(lastIteration.feedback);\r\n sections.push('');\r\n } else {\r\n sections.push(`**Your Task:** Improve upon iteration ${lastIteration.iteration} (confidence: ${lastIteration.confidence.toFixed(2)})`);\r\n sections.push('');\r\n }\r\n }\r\n\r\n return sections.join('\\n');\r\n}\r\n\r\n/**\r\n * Check if iteration history exists for an agent\r\n *\r\n * @param taskId - Task identifier\r\n * @param agentId - Agent identifier\r\n * @returns True if any iteration history exists\r\n */\r\nexport async function hasIterationHistory(\r\n taskId: string,\r\n agentId: string\r\n): Promise<boolean> {\r\n try {\r\n const pattern = `swarm:${taskId}:${agentId}:result:iteration-*`;\r\n const keys = execSync(`redis-cli -h ${redisHost} -p ${redisPort} --scan --pattern \"${pattern}\"`, { encoding: 'utf8' }).trim();\r\n return keys.length > 0;\r\n } catch (err) {\r\n return false;\r\n }\r\n}\r\n\r\n/**\r\n * Get the latest iteration number for an agent\r\n *\r\n * @param taskId - Task identifier\r\n * @param agentId - Agent identifier\r\n * @returns Latest iteration number (0 if no history)\r\n */\r\nexport async function getLatestIteration(\r\n taskId: string,\r\n agentId: string\r\n): Promise<number> {\r\n try {\r\n const pattern = `swarm:${taskId}:${agentId}:result:iteration-*`;\r\n const keys = execSync(`redis-cli -h ${redisHost} -p ${redisPort} --scan --pattern \"${pattern}\"`, { encoding: 'utf8' })\r\n .trim()\r\n .split('\\n')\r\n .filter((k) => k.length > 0);\r\n\r\n if (keys.length === 0) return 0;\r\n\r\n // Extract iteration numbers and find max\r\n const iterations = keys.map((key) => {\r\n const match = key.match(/iteration-(\\d+)$/);\r\n return match ? parseInt(match[1], 10) : 0;\r\n });\r\n\r\n return Math.max(...iterations);\r\n } catch (err) {\r\n return 0;\r\n }\r\n}\r\n"],"names":["execSync","redisHost","process","env","CFN_REDIS_HOST","redisPort","CFN_REDIS_PORT","loadIterationHistory","taskId","agentId","currentIteration","history","i","resultKey","resultJson","encoding","trim","resultData","JSON","parse","feedbackKey","feedback","feedbackJson","feedbackData","comments","err","undefined","push","iteration","result","output","confidence","timestamp","Date","toISOString","console","error","storeIterationResult","stringify","replace","log","formatIterationHistory","length","sections","iter","substring","toFixed","lastIteration","join","hasIterationHistory","pattern","keys","getLatestIteration","split","filter","k","iterations","map","key","match","parseInt","Math","max"],"mappings":"AAAA;;;;;;;;;;;CAWC,GAED,SAASA,QAAQ,QAAQ,gBAAgB;AAEzC,gEAAgE;AAChE,MAAMC,YAAYC,QAAQC,GAAG,CAACC,cAAc,IAAI;AAChD,MAAMC,YAAYH,QAAQC,GAAG,CAACG,cAAc,IAAI;AAUhD;;;;;;;CAOC,GACD,OAAO,eAAeC,qBACpBC,MAAc,EACdC,OAAe,EACfC,gBAAwB;IAExB,MAAMC,UAA6B,EAAE;IAErC,uDAAuD;IACvD,IAAK,IAAIC,IAAI,GAAGA,IAAIF,kBAAkBE,IAAK;QACzC,IAAI;YACF,mBAAmB;YACnB,MAAMC,YAAY,CAAC,MAAM,EAAEL,OAAO,CAAC,EAAEC,QAAQ,kBAAkB,EAAEG,GAAG;YACpE,MAAME,aAAad,SAAS,CAAC,aAAa,EAAEC,UAAU,IAAI,EAAEI,UAAU,MAAM,EAAEQ,UAAU,CAAC,CAAC,EAAE;gBAAEE,UAAU;YAAO,GAAGC,IAAI;YAEtH,IAAIF,eAAe,WAAW,CAACA,YAAY;gBAEz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C,EAAEC,QAAQ,mBAAmB,CAAC;QAC/D,MAAM0C,OAAOnD,SAAS,CAAC,aAAa,EAAEC,UAAU,IAAI,EAAEI,UAAU,mBAAmB,EAAE6C,QAAQ,CAAC,CAAC,EAAE;YAAEnC,UAAU;QAAO,GACjHC,IAAI,GACJqC,KAAK,CAAC,MACNC,MAAM,CAAC,CAACC,IAAMA,EAAEb,MAAM,GAAG;QAE5B,IAAIS,KAAKT,MAAM,KAAK,GAAG,OAAO;QAE9B,yCAAyC;QACzC,MAAMc,aAAaL,KAAKM,GAAG,CAAC,CAACC;YAC3B,MAAMC,QAAQD,IAAIC,KAAK,CAAC;YACxB,OAAOA,QAAQC,SAASD,KAAK,CAAC,EAAE,EAAE,MAAM;QAC1C;QAEA,OAAOE,KAAKC,GAAG,IAAIN;IACrB,EAAE,OAAO/B,KAAK;QACZ,OAAO;IACT;AACF"}
|
|
1
|
+
{"version":3,"sources":["../../src/cli/iteration-history.ts"],"sourcesContent":["/**\r\n * Iteration History Management\r\n *\r\n * Loads and formats iteration history from Redis for CLI-spawned agents.\r\n * Enables agents to learn from previous attempts and feedback.\r\n *\r\n * Storage Pattern:\r\n * swarm:${TASK_ID}:${AGENT_ID}:result:iteration-${N} → Result text + confidence\r\n * swarm:${TASK_ID}:${AGENT_ID}:feedback:iteration-${N} → Validator feedback\r\n *\r\n * Sprint 3 - Phase 2 Implementation\r\n */\r\n\r\nimport { execSync } from 'child_process';\r\n\r\n// Bug #6 Fix: Read Redis connection parameters from process.env\r\n// FIX: Default to 'localhost' for CLI mode (host execution), not 'cfn-redis' (Docker)\r\nconst redisHost = process.env.CFN_REDIS_HOST || 'localhost';\r\nconst redisPort = process.env.CFN_REDIS_PORT || '6379';\r\n\r\nexport interface IterationResult {\r\n iteration: number;\r\n result: string;\r\n confidence: number;\r\n timestamp: string;\r\n feedback?: string;\r\n}\r\n\r\n/**\r\n * Load iteration history for an agent from Redis\r\n *\r\n * @param taskId - Task identifier\r\n * @param agentId - Agent identifier\r\n * @param currentIteration - Current iteration number (loads 1 to N-1)\r\n * @returns Array of iteration results\r\n */\r\nexport async function loadIterationHistory(\r\n taskId: string,\r\n agentId: string,\r\n currentIteration: number\r\n): Promise<IterationResult[]> {\r\n const history: IterationResult[] = [];\r\n\r\n // Load previous iterations (1 to currentIteration - 1)\r\n for (let i = 1; i < currentIteration; i++) {\r\n try {\r\n // Load result data\r\n const resultKey = `swarm:${taskId}:${agentId}:result:iteration-${i}`;\r\n const resultJson = execSync(`redis-cli -h ${redisHost} -p ${redisPort} get \"${resultKey}\"`, { encoding: 'utf8' }).trim();\r\n\r\n if (resultJson === '(nil)' || !resultJson) {\r\n // No result for this iteration (shouldn't happen in normal flow)\r\n continue;\r\n }\r\n\r\n const resultData = JSON.parse(resultJson);\r\n\r\n // Load feedback data (may not exist for all iterations)\r\n const feedbackKey = `swarm:${taskId}:${agentId}:feedback:iteration-${i}`;\r\n let feedback: string | undefined;\r\n\r\n try {\r\n const feedbackJson = execSync(`redis-cli -h ${redisHost} -p ${redisPort} get \"${feedbackKey}\"`, { encoding: 'utf8' }).trim();\r\n if (feedbackJson !== '(nil)' && feedbackJson) {\r\n const feedbackData = JSON.parse(feedbackJson);\r\n feedback = feedbackData.feedback || feedbackData.comments;\r\n }\r\n } catch (err) {\r\n // Feedback may not exist for this iteration\r\n feedback = undefined;\r\n }\r\n\r\n history.push({\r\n iteration: i,\r\n result: resultData.result || resultData.output || '',\r\n confidence: resultData.confidence || 0,\r\n timestamp: resultData.timestamp || new Date().toISOString(),\r\n feedback\r\n });\r\n } catch (err) {\r\n console.error(`[iteration-history] Failed to load iteration ${i}:`, err);\r\n // Continue loading other iterations\r\n }\r\n }\r\n\r\n return history;\r\n}\r\n\r\n/**\r\n * Store iteration result in Redis\r\n *\r\n * @param taskId - Task identifier\r\n * @param agentId - Agent identifier\r\n * @param iteration - Iteration number\r\n * @param result - Result text/output\r\n * @param confidence - Confidence score (0.0-1.0)\r\n */\r\nexport async function storeIterationResult(\r\n taskId: string,\r\n agentId: string,\r\n iteration: number,\r\n result: string,\r\n confidence: number\r\n): Promise<void> {\r\n const resultKey = `swarm:${taskId}:${agentId}:result:iteration-${iteration}`;\r\n const resultData = {\r\n result,\r\n confidence,\r\n timestamp: new Date().toISOString(),\r\n iteration\r\n };\r\n\r\n const resultJson = JSON.stringify(resultData);\r\n\r\n try {\r\n // Store with 24 hour TTL\r\n execSync(`redis-cli -h ${redisHost} -p ${redisPort} setex \"${resultKey}\" 86400 '${resultJson.replace(/'/g, \"'\\\\''\")}'`, {\r\n encoding: 'utf8'\r\n });\r\n console.log(`[iteration-history] Stored result for iteration ${iteration}`);\r\n } catch (err) {\r\n console.error(`[iteration-history] Failed to store result:`, err);\r\n throw err;\r\n }\r\n}\r\n\r\n/**\r\n * Format iteration history as markdown for system prompt\r\n *\r\n * @param history - Array of iteration results\r\n * @param currentIteration - Current iteration number\r\n * @returns Formatted markdown string\r\n */\r\nexport function formatIterationHistory(\r\n history: IterationResult[],\r\n currentIteration: number\r\n): string {\r\n if (history.length === 0) {\r\n return `## Current Iteration: ${currentIteration}\r\n\r\nThis is your first attempt at this task. No previous iteration history available.\r\n`;\r\n }\r\n\r\n const sections: string[] = [];\r\n\r\n sections.push('## Iteration History');\r\n sections.push('');\r\n sections.push('Learn from your previous attempts and feedback:');\r\n sections.push('');\r\n\r\n // Format each iteration\r\n for (const iter of history) {\r\n sections.push(`### Iteration ${iter.iteration}`);\r\n sections.push('');\r\n\r\n sections.push('**Result:**');\r\n sections.push(iter.result.substring(0, 500)); // Truncate to 500 chars\r\n if (iter.result.length > 500) {\r\n sections.push('... (truncated)');\r\n }\r\n sections.push('');\r\n\r\n if (iter.feedback) {\r\n sections.push('**Feedback from Validators:**');\r\n sections.push(iter.feedback);\r\n sections.push('');\r\n }\r\n\r\n sections.push(`**Confidence:** ${iter.confidence.toFixed(2)}`);\r\n sections.push(`**Timestamp:** ${iter.timestamp}`);\r\n sections.push('');\r\n sections.push('---');\r\n sections.push('');\r\n }\r\n\r\n // Add current iteration context\r\n sections.push(`## Current Iteration: ${currentIteration}`);\r\n sections.push('');\r\n\r\n if (history.length > 0) {\r\n const lastIteration = history[history.length - 1];\r\n if (lastIteration.feedback) {\r\n sections.push('**Your Task:** Address the feedback from the previous iteration:');\r\n sections.push('');\r\n sections.push(lastIteration.feedback);\r\n sections.push('');\r\n } else {\r\n sections.push(`**Your Task:** Improve upon iteration ${lastIteration.iteration} (confidence: ${lastIteration.confidence.toFixed(2)})`);\r\n sections.push('');\r\n }\r\n }\r\n\r\n return sections.join('\\n');\r\n}\r\n\r\n/**\r\n * Check if iteration history exists for an agent\r\n *\r\n * @param taskId - Task identifier\r\n * @param agentId - Agent identifier\r\n * @returns True if any iteration history exists\r\n */\r\nexport async function hasIterationHistory(\r\n taskId: string,\r\n agentId: string\r\n): Promise<boolean> {\r\n try {\r\n const pattern = `swarm:${taskId}:${agentId}:result:iteration-*`;\r\n const keys = execSync(`redis-cli -h ${redisHost} -p ${redisPort} --scan --pattern \"${pattern}\"`, { encoding: 'utf8' }).trim();\r\n return keys.length > 0;\r\n } catch (err) {\r\n return false;\r\n }\r\n}\r\n\r\n/**\r\n * Get the latest iteration number for an agent\r\n *\r\n * @param taskId - Task identifier\r\n * @param agentId - Agent identifier\r\n * @returns Latest iteration number (0 if no history)\r\n */\r\nexport async function getLatestIteration(\r\n taskId: string,\r\n agentId: string\r\n): Promise<number> {\r\n try {\r\n const pattern = `swarm:${taskId}:${agentId}:result:iteration-*`;\r\n const keys = execSync(`redis-cli -h ${redisHost} -p ${redisPort} --scan --pattern \"${pattern}\"`, { encoding: 'utf8' })\r\n .trim()\r\n .split('\\n')\r\n .filter((k) => k.length > 0);\r\n\r\n if (keys.length === 0) return 0;\r\n\r\n // Extract iteration numbers and find max\r\n const iterations = keys.map((key) => {\r\n const match = key.match(/iteration-(\\d+)$/);\r\n return match ? parseInt(match[1], 10) : 0;\r\n });\r\n\r\n return Math.max(...iterations);\r\n } catch (err) {\r\n return 0;\r\n }\r\n}\r\n"],"names":["execSync","redisHost","process","env","CFN_REDIS_HOST","redisPort","CFN_REDIS_PORT","loadIterationHistory","taskId","agentId","currentIteration","history","i","resultKey","resultJson","encoding","trim","resultData","JSON","parse","feedbackKey","feedback","feedbackJson","feedbackData","comments","err","undefined","push","iteration","result","output","confidence","timestamp","Date","toISOString","console","error","storeIterationResult","stringify","replace","log","formatIterationHistory","length","sections","iter","substring","toFixed","lastIteration","join","hasIterationHistory","pattern","keys","getLatestIteration","split","filter","k","iterations","map","key","match","parseInt","Math","max"],"mappings":"AAAA;;;;;;;;;;;CAWC,GAED,SAASA,QAAQ,QAAQ,gBAAgB;AAEzC,gEAAgE;AAChE,sFAAsF;AACtF,MAAMC,YAAYC,QAAQC,GAAG,CAACC,cAAc,IAAI;AAChD,MAAMC,YAAYH,QAAQC,GAAG,CAACG,cAAc,IAAI;AAUhD;;;;;;;CAOC,GACD,OAAO,eAAeC,qBACpBC,MAAc,EACdC,OAAe,EACfC,gBAAwB;IAExB,MAAMC,UAA6B,EAAE;IAErC,uDAAuD;IACvD,IAAK,IAAIC,IAAI,GAAGA,IAAIF,kBAAkBE,IAAK;QACzC,IAAI;YACF,mBAAmB;YACnB,MAAMC,YAAY,CAAC,MAAM,EAAEL,OAAO,CAAC,EAAEC,QAAQ,kBAAkB,EAAEG,GAAG;YACpE,MAAME,aAAad,SAAS,CAAC,aAAa,EAAEC,UAAU,IAAI,EAAEI,UAAU,MAAM,EAAEQ,UAAU,CAAC,CAAC,EAAE;gBAAEE,UAAU;YAAO,GAAGC,IAAI;YAEtH,IAAIF,eAAe,WAAW,CAACA,YAAY;gBAEzC;YACF;YAEA,MAAMG,aAAaC,KAAKC,KAAK,CAACL;YAE9B,wDAAwD;YACxD,MAAMM,cAAc,CAAC,MAAM,EAAEZ,OAAO,CAAC,EAAEC,QAAQ,oBAAoB,EAAEG,GAAG;YACxE,IAAIS;YAEJ,IAAI;gBACF,MAAMC,eAAetB,SAAS,CAAC,aAAa,EAAEC,UAA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