claude-flow-novice 2.15.4 → 2.15.6
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/.gs-api-quota.json +16 -0
- package/.claude/cfn-extras/.gs-progress-state.json +22 -0
- package/.claude/cfn-extras/GOOGLE_SHEETS_IMPLEMENTATION_SUMMARY.md +414 -0
- package/.claude/cfn-extras/agents/google-sheets/README.md +114 -0
- package/.claude/cfn-extras/agents/google-sheets/google-sheets-advanced-analytics-specialist.md +288 -0
- package/.claude/cfn-extras/agents/google-sheets/google-sheets-api-integrator.md +127 -0
- package/.claude/cfn-extras/agents/google-sheets/google-sheets-automation-scripting-specialist.md +195 -0
- package/.claude/cfn-extras/agents/google-sheets/google-sheets-business-validator.md +179 -0
- package/.claude/cfn-extras/agents/google-sheets/google-sheets-collaboration-security-specialist.md +240 -0
- package/.claude/cfn-extras/agents/google-sheets/google-sheets-coordinator.md +214 -0
- package/.claude/cfn-extras/agents/google-sheets/google-sheets-data-transformer.md +127 -0
- package/.claude/cfn-extras/agents/google-sheets/google-sheets-data-validation-quality-specialist.md +177 -0
- package/.claude/cfn-extras/agents/google-sheets/google-sheets-data-validator.md +119 -0
- package/.claude/cfn-extras/agents/google-sheets/google-sheets-data-visualization-specialist.md +135 -0
- package/.claude/cfn-extras/agents/google-sheets/google-sheets-design-layout-specialist.md +109 -0
- package/.claude/cfn-extras/agents/google-sheets/google-sheets-formula-engineer.md +127 -0
- package/.claude/cfn-extras/agents/google-sheets/google-sheets-formula-engineering-specialist.md +138 -0
- package/.claude/cfn-extras/agents/google-sheets/google-sheets-formula-validator.md +128 -0
- package/.claude/cfn-extras/agents/google-sheets/google-sheets-generalist.md +645 -0
- package/.claude/cfn-extras/agents/google-sheets/google-sheets-integration-api-specialist.md +258 -0
- package/.claude/cfn-extras/agents/google-sheets/google-sheets-performance-analyst.md +125 -0
- package/.claude/cfn-extras/agents/google-sheets/google-sheets-performance-optimization-specialist.md +211 -0
- package/.claude/cfn-extras/agents/google-sheets/google-sheets-schema-designer.md +130 -0
- package/.claude/cfn-extras/agents/google-sheets/google-sheets-template-architecture-specialist.md +259 -0
- package/.claude/cfn-extras/docs/GOOGLE_SHEETS_CFN_LOOP.md +617 -0
- package/.claude/cfn-extras/skills/GOOGLE_SHEETS_SKILLS_README.md +453 -0
- package/.claude/cfn-extras/skills/google-sheets-api-coordinator/SKILL.md +272 -0
- package/.claude/cfn-extras/skills/google-sheets-api-coordinator/api-call.sh +254 -0
- package/.claude/cfn-extras/skills/google-sheets-api-coordinator/test.sh +174 -0
- package/.claude/cfn-extras/skills/google-sheets-api-coordinator/validate.sh +98 -0
- package/.claude/cfn-extras/skills/google-sheets-decomposition/SKILL.md +269 -0
- package/.claude/cfn-extras/skills/google-sheets-decomposition/decompose.sh +313 -0
- package/.claude/cfn-extras/skills/google-sheets-formula-builder/SKILL.md +237 -0
- package/.claude/cfn-extras/skills/google-sheets-formula-builder/build-formula.sh +220 -0
- package/.claude/cfn-extras/skills/google-sheets-formula-builder/test.sh +172 -0
- package/.claude/cfn-extras/skills/google-sheets-formula-builder/validate.sh +98 -0
- package/.claude/cfn-extras/skills/google-sheets-progress/SKILL.md +287 -0
- package/.claude/cfn-extras/skills/google-sheets-progress/test.sh +385 -0
- package/.claude/cfn-extras/skills/google-sheets-progress/track-progress.sh +516 -0
- package/.claude/cfn-extras/skills/google-sheets-progress/validate.sh +119 -0
- package/.claude/cfn-extras/skills/google-sheets-sprint-order/SKILL.md +277 -0
- package/.claude/cfn-extras/skills/google-sheets-sprint-order/order-sprints.sh +233 -0
- package/.claude/cfn-extras/skills/google-sheets-validation/SKILL.md +352 -0
- package/.claude/cfn-extras/skills/google-sheets-validation/test.sh +355 -0
- package/.claude/cfn-extras/skills/google-sheets-validation/validate-state.sh +374 -0
- package/.claude/cfn-extras/skills/google-sheets-validation/validate.sh +128 -0
- package/.claude/commands/cfn-context.md +10 -0
- package/.claude/commands/cfn-loop-cli.md +44 -14
- package/.claude/commands/google-sheets/google-sheets-loop.md +289 -0
- package/.claude/skills/cfn-agent-selector/SKILL.md +143 -0
- package/.claude/skills/cfn-agent-selector/select-agents.sh +94 -0
- package/.claude/skills/cfn-agent-spawning/get-agent-provider-env.sh +22 -2
- package/.claude/skills/cfn-docker-agent-spawning/spawn-agent.sh +21 -2
- package/.claude/skills/cfn-docker-loop-orchestration/orchestrate.sh +11 -5
- package/.claude/skills/cfn-docker-redis-coordination/MIGRATION_SUMMARY.md +348 -0
- package/.claude/skills/cfn-docker-redis-coordination/README.md +294 -0
- package/.claude/skills/cfn-docker-redis-coordination/jest.config.js +37 -0
- package/.claude/skills/cfn-docker-redis-coordination/package-lock.json +5259 -0
- package/.claude/skills/cfn-docker-redis-coordination/package.json +40 -0
- package/.claude/skills/cfn-docker-redis-coordination/src/coordinator.ts +801 -0
- package/.claude/skills/cfn-docker-redis-coordination/src/index.ts +42 -0
- package/.claude/skills/cfn-docker-redis-coordination/src/types.ts +351 -0
- package/.claude/skills/cfn-docker-redis-coordination/tests/coordinator.test.ts +1464 -0
- package/.claude/skills/cfn-docker-redis-coordination/tsconfig.json +30 -0
- package/.claude/skills/cfn-loop-orchestration/.eslintrc.js +56 -0
- package/.claude/skills/cfn-loop-orchestration/.prettierrc.json +18 -0
- package/.claude/skills/cfn-loop-orchestration/README.md +149 -41
- package/.claude/skills/cfn-loop-orchestration/jest.config.js +67 -0
- package/.claude/skills/cfn-loop-orchestration/orchestrate-wrapper.sh +268 -0
- package/.claude/skills/cfn-loop-orchestration/orchestrate.sh +147 -16
- package/.claude/skills/cfn-loop-orchestration/package-lock.json +5470 -0
- package/.claude/skills/cfn-loop-orchestration/package.json +49 -0
- package/.claude/skills/cfn-loop-orchestration/src/agent-spawner/agent-spawner.ts +34 -0
- package/.claude/skills/cfn-loop-orchestration/src/gate-checker/gate-checker.ts +36 -0
- package/.claude/skills/cfn-loop-orchestration/src/index.ts +14 -0
- package/.claude/skills/cfn-loop-orchestration/src/orchestrator/orchestrator.ts +31 -0
- package/.claude/skills/cfn-loop-orchestration/src/redis/redis-coordinator.ts +72 -0
- package/.claude/skills/cfn-loop-orchestration/src/types.ts +188 -0
- package/.claude/skills/cfn-loop-orchestration/src/utils/logger.ts +32 -0
- package/.claude/skills/cfn-loop-orchestration/tests/setup.ts +22 -0
- package/.claude/skills/cfn-loop-orchestration/tests/types.test.ts +132 -0
- package/.claude/skills/cfn-loop-orchestration/tsconfig.json +54 -0
- package/.claude/skills/cfn-redis-coordination/bash-wrappers/store-context.sh +23 -0
- package/.claude/skills/cfn-redis-coordination/dist/agent-logger.d.ts +92 -0
- package/.claude/skills/cfn-redis-coordination/dist/agent-logger.d.ts.map +1 -0
- package/.claude/skills/cfn-redis-coordination/dist/agent-logger.js +329 -0
- package/.claude/skills/cfn-redis-coordination/dist/agent-logger.js.map +1 -0
- package/.claude/skills/cfn-redis-coordination/dist/agent-recovery.d.ts +75 -0
- package/.claude/skills/cfn-redis-coordination/dist/agent-recovery.d.ts.map +1 -0
- package/.claude/skills/cfn-redis-coordination/dist/agent-recovery.js +302 -0
- package/.claude/skills/cfn-redis-coordination/dist/agent-recovery.js.map +1 -0
- package/.claude/skills/cfn-redis-coordination/dist/completion-reporter.d.ts +58 -0
- package/.claude/skills/cfn-redis-coordination/dist/completion-reporter.d.ts.map +1 -0
- package/.claude/skills/cfn-redis-coordination/dist/completion-reporter.js +237 -0
- package/.claude/skills/cfn-redis-coordination/dist/completion-reporter.js.map +1 -0
- package/.claude/skills/cfn-redis-coordination/dist/context-manager.d.ts +63 -0
- package/.claude/skills/cfn-redis-coordination/dist/context-manager.d.ts.map +1 -0
- package/.claude/skills/cfn-redis-coordination/dist/context-manager.js +230 -0
- package/.claude/skills/cfn-redis-coordination/dist/context-manager.js.map +1 -0
- package/.claude/skills/cfn-redis-coordination/dist/index.d.ts +45 -0
- package/.claude/skills/cfn-redis-coordination/dist/index.d.ts.map +1 -0
- package/.claude/skills/cfn-redis-coordination/dist/index.js +114 -0
- package/.claude/skills/cfn-redis-coordination/dist/index.js.map +1 -0
- package/.claude/skills/cfn-redis-coordination/dist/mode-detector.d.ts +31 -0
- package/.claude/skills/cfn-redis-coordination/dist/mode-detector.d.ts.map +1 -0
- package/.claude/skills/cfn-redis-coordination/dist/mode-detector.js +185 -0
- package/.claude/skills/cfn-redis-coordination/dist/mode-detector.js.map +1 -0
- package/.claude/skills/cfn-redis-coordination/dist/redis-client.d.ts +191 -0
- package/.claude/skills/cfn-redis-coordination/dist/redis-client.d.ts.map +1 -0
- package/.claude/skills/cfn-redis-coordination/dist/redis-client.js +509 -0
- package/.claude/skills/cfn-redis-coordination/dist/redis-client.js.map +1 -0
- package/.claude/skills/cfn-redis-coordination/dist/result-collector.d.ts +75 -0
- package/.claude/skills/cfn-redis-coordination/dist/result-collector.d.ts.map +1 -0
- package/.claude/skills/cfn-redis-coordination/dist/result-collector.js +281 -0
- package/.claude/skills/cfn-redis-coordination/dist/result-collector.js.map +1 -0
- package/.claude/skills/cfn-redis-coordination/dist/swarm-manager.d.ts +75 -0
- package/.claude/skills/cfn-redis-coordination/dist/swarm-manager.d.ts.map +1 -0
- package/.claude/skills/cfn-redis-coordination/dist/swarm-manager.js +354 -0
- package/.claude/skills/cfn-redis-coordination/dist/swarm-manager.js.map +1 -0
- package/.claude/skills/cfn-redis-coordination/dist/task-analyzer.d.ts +62 -0
- package/.claude/skills/cfn-redis-coordination/dist/task-analyzer.d.ts.map +1 -0
- package/.claude/skills/cfn-redis-coordination/dist/task-analyzer.js +305 -0
- package/.claude/skills/cfn-redis-coordination/dist/task-analyzer.js.map +1 -0
- package/.claude/skills/cfn-redis-coordination/dist/task-executor.d.ts +97 -0
- package/.claude/skills/cfn-redis-coordination/dist/task-executor.d.ts.map +1 -0
- package/.claude/skills/cfn-redis-coordination/dist/task-executor.js +283 -0
- package/.claude/skills/cfn-redis-coordination/dist/task-executor.js.map +1 -0
- package/.claude/skills/cfn-redis-coordination/dist/types.d.ts +176 -0
- package/.claude/skills/cfn-redis-coordination/dist/types.d.ts.map +1 -0
- package/.claude/skills/cfn-redis-coordination/dist/types.js +81 -0
- package/.claude/skills/cfn-redis-coordination/dist/types.js.map +1 -0
- package/.claude/skills/cfn-redis-coordination/dist/waiting-coordinator.d.ts +86 -0
- package/.claude/skills/cfn-redis-coordination/dist/waiting-coordinator.d.ts.map +1 -0
- package/.claude/skills/cfn-redis-coordination/dist/waiting-coordinator.js +419 -0
- package/.claude/skills/cfn-redis-coordination/dist/waiting-coordinator.js.map +1 -0
- package/.claude/skills/cfn-redis-coordination/docs/migration/PHASE_3_REDIS_COORDINATION_COMPLETION_REPORT.md +553 -0
- package/.claude/skills/cfn-redis-coordination/invoke-waiting-mode.sh +3 -2
- package/.claude/skills/cfn-redis-coordination/jest.config.js +23 -0
- package/.claude/skills/cfn-redis-coordination/package-lock.json +5272 -0
- package/.claude/skills/cfn-redis-coordination/package.json +45 -0
- package/.claude/skills/cfn-redis-coordination/redis-cli-wrapper.sh +21 -8
- package/.claude/skills/cfn-redis-coordination/redis-functions.sh +3 -2
- package/.claude/skills/cfn-redis-coordination/src/agent-logger.ts +446 -0
- package/.claude/skills/cfn-redis-coordination/src/agent-recovery.ts +454 -0
- package/.claude/skills/cfn-redis-coordination/src/completion-reporter.ts +396 -0
- package/.claude/skills/cfn-redis-coordination/src/context-manager.ts +327 -0
- package/.claude/skills/cfn-redis-coordination/src/index.ts +82 -0
- package/.claude/skills/cfn-redis-coordination/src/mode-detector.ts +155 -0
- package/.claude/skills/cfn-redis-coordination/src/redis/redis-client.ts +305 -0
- package/.claude/skills/cfn-redis-coordination/src/redis/redis-functions.ts +283 -0
- package/.claude/skills/cfn-redis-coordination/src/redis-client.ts +654 -0
- package/.claude/skills/cfn-redis-coordination/src/result-collector.ts +437 -0
- package/.claude/skills/cfn-redis-coordination/src/swarm-manager.ts +494 -0
- package/.claude/skills/cfn-redis-coordination/src/task-analyzer.ts +404 -0
- package/.claude/skills/cfn-redis-coordination/src/task-executor.ts +423 -0
- package/.claude/skills/cfn-redis-coordination/src/types.ts +235 -0
- package/.claude/skills/cfn-redis-coordination/src/waiting-coordinator.ts +587 -0
- package/.claude/skills/cfn-redis-coordination/test-connection-attempts.js +70 -0
- package/.claude/skills/cfn-redis-coordination/test-mode-simple.js +121 -0
- package/.claude/skills/cfn-redis-coordination/test-redis-check.js +84 -0
- package/.claude/skills/cfn-redis-coordination/test-task-mode-redis.cjs +391 -0
- package/.claude/skills/cfn-redis-coordination/tests/coordination.test.ts +779 -0
- package/.claude/skills/cfn-redis-coordination/tsconfig.json +31 -0
- package/claude-assets/agents/cfn-dev-team/coordinators/cfn-v3-coordinator.md +172 -2
- package/claude-assets/agents/cfn-dev-team/testers/api-testing-specialist.md +1 -1
- package/claude-assets/agents/custom/cfn-redis-operations.md +530 -0
- package/claude-assets/agents/custom/cfn-system-expert.md +77 -0
- package/claude-assets/cfn-extras/.gs-api-quota.json +16 -0
- package/claude-assets/cfn-extras/.gs-progress-state.json +22 -0
- package/claude-assets/cfn-extras/GOOGLE_SHEETS_IMPLEMENTATION_SUMMARY.md +414 -0
- package/claude-assets/cfn-extras/agents/google-sheets/README.md +114 -0
- package/claude-assets/cfn-extras/agents/google-sheets/google-sheets-advanced-analytics-specialist.md +288 -0
- package/claude-assets/cfn-extras/agents/google-sheets/google-sheets-api-integrator.md +127 -0
- package/claude-assets/cfn-extras/agents/google-sheets/google-sheets-automation-scripting-specialist.md +195 -0
- package/claude-assets/cfn-extras/agents/google-sheets/google-sheets-business-validator.md +179 -0
- package/claude-assets/cfn-extras/agents/google-sheets/google-sheets-collaboration-security-specialist.md +240 -0
- package/claude-assets/cfn-extras/agents/google-sheets/google-sheets-coordinator.md +214 -0
- package/claude-assets/cfn-extras/agents/google-sheets/google-sheets-data-transformer.md +127 -0
- package/claude-assets/cfn-extras/agents/google-sheets/google-sheets-data-validation-quality-specialist.md +177 -0
- package/claude-assets/cfn-extras/agents/google-sheets/google-sheets-data-validator.md +119 -0
- package/claude-assets/cfn-extras/agents/google-sheets/google-sheets-data-visualization-specialist.md +135 -0
- package/claude-assets/cfn-extras/agents/google-sheets/google-sheets-design-layout-specialist.md +109 -0
- package/claude-assets/cfn-extras/agents/google-sheets/google-sheets-formula-engineer.md +127 -0
- package/claude-assets/cfn-extras/agents/google-sheets/google-sheets-formula-engineering-specialist.md +138 -0
- package/claude-assets/cfn-extras/agents/google-sheets/google-sheets-formula-validator.md +128 -0
- package/claude-assets/cfn-extras/agents/google-sheets/google-sheets-generalist.md +645 -0
- package/claude-assets/cfn-extras/agents/google-sheets/google-sheets-integration-api-specialist.md +258 -0
- package/claude-assets/cfn-extras/agents/google-sheets/google-sheets-performance-analyst.md +125 -0
- package/claude-assets/cfn-extras/agents/google-sheets/google-sheets-performance-optimization-specialist.md +211 -0
- package/claude-assets/cfn-extras/agents/google-sheets/google-sheets-schema-designer.md +130 -0
- package/claude-assets/cfn-extras/agents/google-sheets/google-sheets-template-architecture-specialist.md +259 -0
- package/claude-assets/cfn-extras/docs/GOOGLE_SHEETS_CFN_LOOP.md +617 -0
- package/claude-assets/cfn-extras/skills/GOOGLE_SHEETS_SKILLS_README.md +453 -0
- package/claude-assets/cfn-extras/skills/google-sheets-api-coordinator/SKILL.md +272 -0
- package/claude-assets/cfn-extras/skills/google-sheets-api-coordinator/api-call.sh +254 -0
- package/claude-assets/cfn-extras/skills/google-sheets-api-coordinator/test.sh +174 -0
- package/claude-assets/cfn-extras/skills/google-sheets-api-coordinator/validate.sh +98 -0
- package/claude-assets/cfn-extras/skills/google-sheets-decomposition/SKILL.md +269 -0
- package/claude-assets/cfn-extras/skills/google-sheets-decomposition/decompose.sh +313 -0
- package/claude-assets/cfn-extras/skills/google-sheets-formula-builder/SKILL.md +237 -0
- package/claude-assets/cfn-extras/skills/google-sheets-formula-builder/build-formula.sh +220 -0
- package/claude-assets/cfn-extras/skills/google-sheets-formula-builder/test.sh +172 -0
- package/claude-assets/cfn-extras/skills/google-sheets-formula-builder/validate.sh +98 -0
- package/claude-assets/cfn-extras/skills/google-sheets-progress/SKILL.md +287 -0
- package/claude-assets/cfn-extras/skills/google-sheets-progress/test.sh +385 -0
- package/claude-assets/cfn-extras/skills/google-sheets-progress/track-progress.sh +516 -0
- package/claude-assets/cfn-extras/skills/google-sheets-progress/validate.sh +119 -0
- package/claude-assets/cfn-extras/skills/google-sheets-sprint-order/SKILL.md +277 -0
- package/claude-assets/cfn-extras/skills/google-sheets-sprint-order/order-sprints.sh +233 -0
- package/claude-assets/cfn-extras/skills/google-sheets-validation/SKILL.md +352 -0
- package/claude-assets/cfn-extras/skills/google-sheets-validation/test.sh +355 -0
- package/claude-assets/cfn-extras/skills/google-sheets-validation/validate-state.sh +374 -0
- package/claude-assets/cfn-extras/skills/google-sheets-validation/validate.sh +128 -0
- package/claude-assets/commands/cfn-context.md +10 -0
- package/claude-assets/commands/cfn-loop-cli.md +44 -14
- package/claude-assets/commands/google-sheets/google-sheets-loop.md +289 -0
- package/claude-assets/hooks/cfn-pre-execution/SESSION_START_README.md +87 -0
- package/claude-assets/hooks/cfn-pre-execution/TEST_SESSION_START.md +128 -0
- package/claude-assets/hooks/cfn-pre-execution/session-start-context.sh +111 -0
- package/claude-assets/skills/cfn-agent-selection-with-fallback/INTEGRATION_EXAMPLE.md +209 -0
- package/claude-assets/skills/cfn-agent-selection-with-fallback/README.md +130 -0
- package/claude-assets/skills/cfn-agent-selection-with-fallback/SKILL.md +243 -0
- package/claude-assets/skills/cfn-agent-selection-with-fallback/agent-mappings.json +142 -0
- package/claude-assets/skills/cfn-agent-selection-with-fallback/select-agents.sh +173 -0
- package/claude-assets/skills/cfn-agent-selection-with-fallback/task-classifier.sh +71 -0
- package/claude-assets/skills/cfn-agent-selection-with-fallback/test-agent-selection.sh +282 -0
- package/claude-assets/skills/cfn-agent-selector/SKILL.md +143 -0
- package/claude-assets/skills/cfn-agent-selector/select-agents.sh +94 -0
- package/claude-assets/skills/cfn-agent-spawning/get-agent-provider-env.sh +22 -2
- package/claude-assets/skills/cfn-docker-agent-spawning/spawn-agent.sh +21 -2
- package/claude-assets/skills/cfn-docker-coordination/.eslintrc.json +33 -0
- package/claude-assets/skills/cfn-docker-coordination/README.md +349 -0
- package/claude-assets/skills/cfn-docker-coordination/docker-helpers.sh +433 -0
- package/claude-assets/skills/cfn-docker-coordination/jest.config.js +25 -0
- package/claude-assets/skills/cfn-docker-coordination/package-lock.json +6827 -0
- package/claude-assets/skills/cfn-docker-coordination/package.json +38 -0
- package/claude-assets/skills/cfn-docker-coordination/src/agent-container.ts +471 -0
- package/claude-assets/skills/cfn-docker-coordination/src/docker-client.ts +483 -0
- package/claude-assets/skills/cfn-docker-coordination/src/health-checker.ts +418 -0
- package/claude-assets/skills/cfn-docker-coordination/src/index.ts +45 -0
- package/claude-assets/skills/cfn-docker-coordination/src/network-manager.ts +377 -0
- package/claude-assets/skills/cfn-docker-coordination/src/types.ts +412 -0
- package/claude-assets/skills/cfn-docker-coordination/src/volume-manager.ts +389 -0
- package/claude-assets/skills/cfn-docker-coordination/tests/agent-container.test.ts +379 -0
- package/claude-assets/skills/cfn-docker-coordination/tests/docker-client.test.ts +345 -0
- package/claude-assets/skills/cfn-docker-coordination/tests/health-checker.test.ts +535 -0
- package/claude-assets/skills/cfn-docker-coordination/tests/integration.test.ts +193 -0
- package/claude-assets/skills/cfn-docker-coordination/tests/network-manager.test.ts +352 -0
- package/claude-assets/skills/cfn-docker-coordination/tests/setup.ts +36 -0
- package/claude-assets/skills/cfn-docker-coordination/tsconfig.json +29 -0
- package/claude-assets/skills/cfn-docker-logging/INTEGRATION.md +268 -0
- package/claude-assets/skills/cfn-docker-logging/SAMPLE_OUTPUTS.md +237 -0
- package/claude-assets/skills/cfn-docker-logging/SKILL.md +442 -0
- package/claude-assets/skills/cfn-docker-logging/capture-container-logs.sh +120 -0
- package/claude-assets/skills/cfn-docker-logging/enable-logging.sh +430 -0
- package/claude-assets/skills/cfn-docker-logging/init-hybrid-logging.sh +210 -0
- package/claude-assets/skills/cfn-docker-logging/queries/analytics-summary.sh +87 -0
- package/claude-assets/skills/cfn-docker-logging/queries/query-agent-timeline.sh +51 -0
- package/claude-assets/skills/cfn-docker-logging/queries/query-consensus-history.sh +56 -0
- package/claude-assets/skills/cfn-docker-logging/queries/query-coordination-timeline.sh +39 -0
- package/claude-assets/skills/cfn-docker-logging/queries/query-failed-containers.sh +40 -0
- package/claude-assets/skills/cfn-docker-logging/queries/query-gate-checks.sh +39 -0
- package/claude-assets/skills/cfn-docker-logging/schema.sql +111 -0
- package/claude-assets/skills/cfn-docker-logging/sqlite-helpers.sh +240 -0
- package/claude-assets/skills/cfn-docker-logging/test-hybrid-logging.sh +331 -0
- package/claude-assets/skills/cfn-docker-loop-orchestration/orchestrate.sh +11 -5
- package/claude-assets/skills/cfn-docker-redis-coordination/MIGRATION_SUMMARY.md +348 -0
- package/claude-assets/skills/cfn-docker-redis-coordination/README.md +294 -0
- package/claude-assets/skills/cfn-docker-redis-coordination/jest.config.js +37 -0
- package/claude-assets/skills/cfn-docker-redis-coordination/package-lock.json +5259 -0
- package/claude-assets/skills/cfn-docker-redis-coordination/package.json +40 -0
- package/claude-assets/skills/cfn-docker-redis-coordination/src/coordinator.ts +801 -0
- package/claude-assets/skills/cfn-docker-redis-coordination/src/index.ts +42 -0
- package/claude-assets/skills/cfn-docker-redis-coordination/src/types.ts +351 -0
- package/claude-assets/skills/cfn-docker-redis-coordination/tests/coordinator.test.ts +1464 -0
- package/claude-assets/skills/cfn-docker-redis-coordination/tsconfig.json +30 -0
- package/claude-assets/skills/cfn-error-logging/.eslintrc.json +57 -0
- package/claude-assets/skills/cfn-error-logging/.prettierrc.json +10 -0
- package/claude-assets/skills/cfn-error-logging/MIGRATION_SUMMARY.md +485 -0
- package/claude-assets/skills/cfn-error-logging/package.json +47 -0
- package/claude-assets/skills/cfn-error-logging/src/error-logger.ts +1042 -0
- package/claude-assets/skills/cfn-error-logging/src/index.ts +12 -0
- package/claude-assets/skills/cfn-error-logging/src/types.ts +456 -0
- package/claude-assets/skills/cfn-error-logging/tests/error-logger.test.ts +1302 -0
- package/claude-assets/skills/cfn-error-logging/tsconfig.json +38 -0
- package/claude-assets/skills/cfn-loop-orchestration/.eslintrc.js +56 -0
- package/claude-assets/skills/cfn-loop-orchestration/.prettierrc.json +18 -0
- package/claude-assets/skills/cfn-loop-orchestration/README.md +149 -41
- package/claude-assets/skills/cfn-loop-orchestration/jest.config.js +67 -0
- package/claude-assets/skills/cfn-loop-orchestration/orchestrate-wrapper.sh +268 -0
- package/claude-assets/skills/cfn-loop-orchestration/orchestrate.sh +147 -16
- package/claude-assets/skills/cfn-loop-orchestration/package-lock.json +5470 -0
- package/claude-assets/skills/cfn-loop-orchestration/package.json +49 -0
- package/claude-assets/skills/cfn-loop-orchestration/src/agent-spawner/agent-spawner.ts +34 -0
- package/claude-assets/skills/cfn-loop-orchestration/src/gate-checker/gate-checker.ts +36 -0
- package/claude-assets/skills/cfn-loop-orchestration/src/index.ts +14 -0
- package/claude-assets/skills/cfn-loop-orchestration/src/orchestrator/orchestrator.ts +31 -0
- package/claude-assets/skills/cfn-loop-orchestration/src/redis/redis-coordinator.ts +72 -0
- package/claude-assets/skills/cfn-loop-orchestration/src/types.ts +188 -0
- package/claude-assets/skills/cfn-loop-orchestration/src/utils/logger.ts +32 -0
- package/claude-assets/skills/cfn-loop-orchestration/tests/setup.ts +22 -0
- package/claude-assets/skills/cfn-loop-orchestration/tests/types.test.ts +132 -0
- package/claude-assets/skills/cfn-loop-orchestration/tsconfig.json +54 -0
- package/claude-assets/skills/cfn-redis-coordination/bash-wrappers/store-context.sh +23 -0
- package/claude-assets/skills/cfn-redis-coordination/dist/agent-logger.d.ts +92 -0
- package/claude-assets/skills/cfn-redis-coordination/dist/agent-logger.d.ts.map +1 -0
- package/claude-assets/skills/cfn-redis-coordination/dist/agent-logger.js +329 -0
- package/claude-assets/skills/cfn-redis-coordination/dist/agent-logger.js.map +1 -0
- package/claude-assets/skills/cfn-redis-coordination/dist/agent-recovery.d.ts +75 -0
- package/claude-assets/skills/cfn-redis-coordination/dist/agent-recovery.d.ts.map +1 -0
- package/claude-assets/skills/cfn-redis-coordination/dist/agent-recovery.js +302 -0
- package/claude-assets/skills/cfn-redis-coordination/dist/agent-recovery.js.map +1 -0
- package/claude-assets/skills/cfn-redis-coordination/dist/completion-reporter.d.ts +58 -0
- package/claude-assets/skills/cfn-redis-coordination/dist/completion-reporter.d.ts.map +1 -0
- package/claude-assets/skills/cfn-redis-coordination/dist/completion-reporter.js +237 -0
- package/claude-assets/skills/cfn-redis-coordination/dist/completion-reporter.js.map +1 -0
- package/claude-assets/skills/cfn-redis-coordination/dist/context-manager.d.ts +63 -0
- package/claude-assets/skills/cfn-redis-coordination/dist/context-manager.d.ts.map +1 -0
- package/claude-assets/skills/cfn-redis-coordination/dist/context-manager.js +230 -0
- package/claude-assets/skills/cfn-redis-coordination/dist/context-manager.js.map +1 -0
- package/claude-assets/skills/cfn-redis-coordination/dist/index.d.ts +45 -0
- package/claude-assets/skills/cfn-redis-coordination/dist/index.d.ts.map +1 -0
- package/claude-assets/skills/cfn-redis-coordination/dist/index.js +114 -0
- package/claude-assets/skills/cfn-redis-coordination/dist/index.js.map +1 -0
- package/claude-assets/skills/cfn-redis-coordination/dist/mode-detector.d.ts +31 -0
- package/claude-assets/skills/cfn-redis-coordination/dist/mode-detector.d.ts.map +1 -0
- package/claude-assets/skills/cfn-redis-coordination/dist/mode-detector.js +185 -0
- package/claude-assets/skills/cfn-redis-coordination/dist/mode-detector.js.map +1 -0
- package/claude-assets/skills/cfn-redis-coordination/dist/redis-client.d.ts +191 -0
- package/claude-assets/skills/cfn-redis-coordination/dist/redis-client.d.ts.map +1 -0
- package/claude-assets/skills/cfn-redis-coordination/dist/redis-client.js +509 -0
- package/claude-assets/skills/cfn-redis-coordination/dist/redis-client.js.map +1 -0
- package/claude-assets/skills/cfn-redis-coordination/dist/result-collector.d.ts +75 -0
- package/claude-assets/skills/cfn-redis-coordination/dist/result-collector.d.ts.map +1 -0
- package/claude-assets/skills/cfn-redis-coordination/dist/result-collector.js +281 -0
- package/claude-assets/skills/cfn-redis-coordination/dist/result-collector.js.map +1 -0
- package/claude-assets/skills/cfn-redis-coordination/dist/swarm-manager.d.ts +75 -0
- package/claude-assets/skills/cfn-redis-coordination/dist/swarm-manager.d.ts.map +1 -0
- package/claude-assets/skills/cfn-redis-coordination/dist/swarm-manager.js +354 -0
- package/claude-assets/skills/cfn-redis-coordination/dist/swarm-manager.js.map +1 -0
- package/claude-assets/skills/cfn-redis-coordination/dist/task-analyzer.d.ts +62 -0
- package/claude-assets/skills/cfn-redis-coordination/dist/task-analyzer.d.ts.map +1 -0
- package/claude-assets/skills/cfn-redis-coordination/dist/task-analyzer.js +305 -0
- package/claude-assets/skills/cfn-redis-coordination/dist/task-analyzer.js.map +1 -0
- package/claude-assets/skills/cfn-redis-coordination/dist/task-executor.d.ts +97 -0
- package/claude-assets/skills/cfn-redis-coordination/dist/task-executor.d.ts.map +1 -0
- package/claude-assets/skills/cfn-redis-coordination/dist/task-executor.js +283 -0
- package/claude-assets/skills/cfn-redis-coordination/dist/task-executor.js.map +1 -0
- package/claude-assets/skills/cfn-redis-coordination/dist/types.d.ts +176 -0
- package/claude-assets/skills/cfn-redis-coordination/dist/types.d.ts.map +1 -0
- package/claude-assets/skills/cfn-redis-coordination/dist/types.js +81 -0
- package/claude-assets/skills/cfn-redis-coordination/dist/types.js.map +1 -0
- package/claude-assets/skills/cfn-redis-coordination/dist/waiting-coordinator.d.ts +86 -0
- package/claude-assets/skills/cfn-redis-coordination/dist/waiting-coordinator.d.ts.map +1 -0
- package/claude-assets/skills/cfn-redis-coordination/dist/waiting-coordinator.js +419 -0
- package/claude-assets/skills/cfn-redis-coordination/dist/waiting-coordinator.js.map +1 -0
- package/claude-assets/skills/cfn-redis-coordination/docs/migration/PHASE_3_REDIS_COORDINATION_COMPLETION_REPORT.md +553 -0
- package/claude-assets/skills/cfn-redis-coordination/invoke-waiting-mode.sh +3 -2
- package/claude-assets/skills/cfn-redis-coordination/jest.config.js +23 -0
- package/claude-assets/skills/cfn-redis-coordination/package-lock.json +5272 -0
- package/claude-assets/skills/cfn-redis-coordination/package.json +45 -0
- package/claude-assets/skills/cfn-redis-coordination/redis-cli-wrapper.sh +21 -8
- package/claude-assets/skills/cfn-redis-coordination/redis-functions.sh +3 -2
- package/claude-assets/skills/cfn-redis-coordination/src/agent-logger.ts +446 -0
- package/claude-assets/skills/cfn-redis-coordination/src/agent-recovery.ts +454 -0
- package/claude-assets/skills/cfn-redis-coordination/src/completion-reporter.ts +396 -0
- package/claude-assets/skills/cfn-redis-coordination/src/context-manager.ts +327 -0
- package/claude-assets/skills/cfn-redis-coordination/src/index.ts +82 -0
- package/claude-assets/skills/cfn-redis-coordination/src/mode-detector.ts +155 -0
- package/claude-assets/skills/cfn-redis-coordination/src/redis/redis-client.ts +305 -0
- package/claude-assets/skills/cfn-redis-coordination/src/redis/redis-functions.ts +283 -0
- package/claude-assets/skills/cfn-redis-coordination/src/redis-client.ts +654 -0
- package/claude-assets/skills/cfn-redis-coordination/src/result-collector.ts +437 -0
- package/claude-assets/skills/cfn-redis-coordination/src/swarm-manager.ts +494 -0
- package/claude-assets/skills/cfn-redis-coordination/src/task-analyzer.ts +404 -0
- package/claude-assets/skills/cfn-redis-coordination/src/task-executor.ts +423 -0
- package/claude-assets/skills/cfn-redis-coordination/src/types.ts +235 -0
- package/claude-assets/skills/cfn-redis-coordination/src/waiting-coordinator.ts +587 -0
- package/claude-assets/skills/cfn-redis-coordination/test-connection-attempts.js +70 -0
- package/claude-assets/skills/cfn-redis-coordination/test-mode-simple.js +121 -0
- package/claude-assets/skills/cfn-redis-coordination/test-redis-check.js +84 -0
- package/claude-assets/skills/cfn-redis-coordination/test-task-mode-redis.cjs +391 -0
- package/claude-assets/skills/cfn-redis-coordination/tests/coordination.test.ts +779 -0
- package/claude-assets/skills/cfn-redis-coordination/tsconfig.json +31 -0
- package/claude-assets/skills/cfn-skill-propagation/README.md +233 -0
- package/claude-assets/skills/cfn-skill-propagation/package-lock.json +5174 -0
- package/claude-assets/skills/cfn-skill-propagation/package.json +52 -0
- package/claude-assets/skills/cfn-skill-propagation/propagate-skill-update.sh +32 -0
- package/claude-assets/skills/cfn-skill-propagation/src/cli.ts +75 -0
- package/claude-assets/skills/cfn-skill-propagation/src/database-adapter.ts +239 -0
- package/claude-assets/skills/cfn-skill-propagation/src/file-system-adapter.ts +113 -0
- package/claude-assets/skills/cfn-skill-propagation/src/index.ts +72 -0
- package/claude-assets/skills/cfn-skill-propagation/src/logger.ts +43 -0
- package/claude-assets/skills/cfn-skill-propagation/src/metadata-parser.ts +154 -0
- package/claude-assets/skills/cfn-skill-propagation/src/skill-propagator.ts +274 -0
- package/claude-assets/skills/cfn-skill-propagation/src/skill-validator.ts +179 -0
- package/claude-assets/skills/cfn-skill-propagation/src/types.ts +143 -0
- package/claude-assets/skills/cfn-skill-propagation/src/version-manager.ts +118 -0
- package/claude-assets/skills/cfn-skill-propagation/tests/file-system-adapter.test.ts +91 -0
- package/claude-assets/skills/cfn-skill-propagation/tests/metadata-parser.test.ts +176 -0
- package/claude-assets/skills/cfn-skill-propagation/tests/skill-propagator.test.ts +209 -0
- package/claude-assets/skills/cfn-skill-propagation/tests/skill-validator.test.ts +203 -0
- package/claude-assets/skills/cfn-skill-propagation/tests/version-manager.test.ts +115 -0
- package/claude-assets/skills/cfn-skill-propagation/tsconfig.json +34 -0
- package/claude-assets/skills/task-classifier/SKILL.md +81 -0
- package/claude-assets/skills/task-classifier/classify-task.sh +62 -0
- package/claude-assets/skills/workflow-codification/package-lock.json +5170 -0
- package/claude-assets/skills/workflow-codification/package.json +30 -0
- package/claude-assets/skills/workflow-codification/src/index.ts +24 -0
- package/claude-assets/skills/workflow-codification/src/pattern-analyzer.ts +537 -0
- package/claude-assets/skills/workflow-codification/src/types.ts +180 -0
- package/claude-assets/skills/workflow-codification/tests/pattern-analyzer.test.ts +960 -0
- package/claude-assets/skills/workflow-codification/tsconfig.json +34 -0
- package/claude-assets/skills/workflow-codification/workflow-codification.db +0 -0
- package/dist/agent-spawner/agent-spawner.js +448 -0
- package/dist/agent-spawner/agent-spawner.js.map +1 -0
- package/dist/agent-spawner/index.js +10 -0
- package/dist/agent-spawner/index.js.map +1 -0
- package/dist/agent-spawner/types.js +14 -0
- package/dist/agent-spawner/types.js.map +1 -0
- package/dist/cli/agent-executor.js +47 -1
- package/dist/cli/agent-executor.js.map +1 -1
- package/dist/cli/agent-spawn.js +4 -1
- package/dist/cli/agent-spawn.js.map +1 -1
- package/dist/cli/config-manager.js +109 -91
- package/dist/cli/config-manager.js.map +1 -1
- package/dist/cli/conversation-fork-cleanup.js +201 -0
- package/dist/cli/conversation-fork-cleanup.js.map +1 -0
- package/dist/cli/conversation-fork.js +16 -3
- package/dist/cli/conversation-fork.js.map +1 -1
- package/dist/cli/tool-executor.js +3 -1
- package/dist/cli/tool-executor.js.map +1 -1
- package/dist/gate-checker/gate-checker.js +292 -0
- package/dist/gate-checker/gate-checker.js.map +1 -0
- package/dist/gate-checker/types.js +94 -0
- package/dist/gate-checker/types.js.map +1 -0
- package/dist/lib/database-service/connection-pool-manager.js +2 -1
- package/dist/lib/database-service/connection-pool-manager.js.map +1 -1
- package/dist/orchestrator/index.js +10 -0
- package/dist/orchestrator/index.js.map +1 -0
- package/dist/orchestrator/orchestrate.js +496 -0
- package/dist/orchestrator/orchestrate.js.map +1 -0
- package/dist/orchestrator/types.js +58 -0
- package/dist/orchestrator/types.js.map +1 -0
- package/docs/BUG_19_MEMORY_LEAK_TASK_MODE.md +405 -0
- package/docs/MEMORY_CLEANUP_GUIDE.md +358 -0
- package/docs/MEMORY_LEAK_FIX_SUMMARY.md +322 -0
- package/docs/REDIS_CLEANUP_EXECUTIVE_SUMMARY.md +319 -0
- package/docs/REDIS_CLEANUP_VERIFICATION_REPORT.md +574 -0
- package/package.json +208 -201
- package/readme/README.md +34 -1
- package/scripts/switch-api.sh +142 -4
- package/scripts/verify-no-secrets.sh +6 -13
- package/scripts/verify-redis-cleanup.sh +173 -0
- package/tests/README.md +201 -0
- package/tests/test-memory-leak-task-mode.sh +435 -0
|
@@ -0,0 +1,779 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Comprehensive test suite for Redis coordination modules
|
|
3
|
+
*
|
|
4
|
+
* Tests cover:
|
|
5
|
+
* - Task Mode (Redis stubbed)
|
|
6
|
+
* - CLI Mode (Redis active)
|
|
7
|
+
* - Error scenarios
|
|
8
|
+
* - Input validation
|
|
9
|
+
* - Module integration
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
import {
|
|
13
|
+
ContextManager,
|
|
14
|
+
CompletionReporter,
|
|
15
|
+
ResultCollector,
|
|
16
|
+
WaitingCoordinator,
|
|
17
|
+
SwarmManager,
|
|
18
|
+
AgentRecoveryManager,
|
|
19
|
+
TaskAnalyzer,
|
|
20
|
+
TaskExecutor,
|
|
21
|
+
AgentLogger,
|
|
22
|
+
RedisCoordinator,
|
|
23
|
+
CoordinationError,
|
|
24
|
+
CoordinationErrorType,
|
|
25
|
+
validateTaskId,
|
|
26
|
+
validateAgentId,
|
|
27
|
+
validateConfidence,
|
|
28
|
+
isValidTaskId,
|
|
29
|
+
isValidAgentId,
|
|
30
|
+
isValidConfidence
|
|
31
|
+
} from '../src/index';
|
|
32
|
+
import { ConsoleLogger } from '../src/mode-detector';
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Test utilities
|
|
36
|
+
*/
|
|
37
|
+
|
|
38
|
+
// Mock Redis client
|
|
39
|
+
class MockRedisClient {
|
|
40
|
+
private data: Record<string, any> = {};
|
|
41
|
+
private lists: Record<string, any[]> = {};
|
|
42
|
+
private sets: Record<string, Set<string>> = {};
|
|
43
|
+
private sortedSets: Record<string, Array<[string, number]>> = {};
|
|
44
|
+
|
|
45
|
+
async set(key: string, value: string): Promise<string | null> {
|
|
46
|
+
this.data[key] = value;
|
|
47
|
+
return 'OK';
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
async get(key: string): Promise<string | null> {
|
|
51
|
+
return this.data[key] || null;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
async hset(key: string, ...args: any[]): Promise<number> {
|
|
55
|
+
if (!this.data[key]) {
|
|
56
|
+
this.data[key] = {};
|
|
57
|
+
}
|
|
58
|
+
for (let i = 0; i < args.length; i += 2) {
|
|
59
|
+
this.data[key][args[i]] = args[i + 1];
|
|
60
|
+
}
|
|
61
|
+
return args.length / 2;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
async hgetall(key: string): Promise<Record<string, string> | null> {
|
|
65
|
+
return this.data[key] || {};
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
async hget(key: string, field: string): Promise<string | null> {
|
|
69
|
+
return this.data[key]?.[field] || null;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
async del(...keys: string[]): Promise<number> {
|
|
73
|
+
let count = 0;
|
|
74
|
+
for (const key of keys) {
|
|
75
|
+
if (this.data[key]) {
|
|
76
|
+
delete this.data[key];
|
|
77
|
+
count++;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
return count;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
async expire(key: string, seconds: number): Promise<number> {
|
|
84
|
+
return this.data[key] ? 1 : 0;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
async exists(key: string): Promise<number> {
|
|
88
|
+
return this.data[key] ? 1 : 0;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
async lpush(key: string, ...values: string[]): Promise<number> {
|
|
92
|
+
if (!this.lists[key]) {
|
|
93
|
+
this.lists[key] = [];
|
|
94
|
+
}
|
|
95
|
+
this.lists[key].unshift(...values);
|
|
96
|
+
return this.lists[key].length;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
async blpop(...args: any[]): Promise<[string, string] | null> {
|
|
100
|
+
const keys = args.slice(0, -1);
|
|
101
|
+
for (const key of keys) {
|
|
102
|
+
if (this.lists[key]?.length > 0) {
|
|
103
|
+
const value = this.lists[key].shift();
|
|
104
|
+
return [key, value];
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
return null;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
async lrange(key: string, start: number, stop: number): Promise<string[]> {
|
|
111
|
+
if (!this.lists[key]) return [];
|
|
112
|
+
return this.lists[key].slice(start, stop + 1);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
async zadd(key: string, ...args: string[]): Promise<number> {
|
|
116
|
+
if (!this.sortedSets[key]) {
|
|
117
|
+
this.sortedSets[key] = [];
|
|
118
|
+
}
|
|
119
|
+
for (let i = 0; i < args.length; i += 2) {
|
|
120
|
+
const score = parseFloat(args[i]);
|
|
121
|
+
const member = args[i + 1];
|
|
122
|
+
this.sortedSets[key].push([member, score]);
|
|
123
|
+
}
|
|
124
|
+
return args.length / 2;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
async zrevrange(key: string, start: number, stop: number): Promise<string[]> {
|
|
128
|
+
if (!this.sortedSets[key]) return [];
|
|
129
|
+
const sorted = [...this.sortedSets[key]].sort((a, b) => b[1] - a[1]);
|
|
130
|
+
return sorted.slice(start, stop + 1).map(([member]) => member);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
async zrange(key: string, start: number, stop: number): Promise<string[]> {
|
|
134
|
+
if (!this.sortedSets[key]) return [];
|
|
135
|
+
return this.sortedSets[key].slice(start, stop + 1).map(([member]) => member);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
async zrem(key: string, member: string): Promise<number> {
|
|
139
|
+
if (!this.sortedSets[key]) return 0;
|
|
140
|
+
const before = this.sortedSets[key].length;
|
|
141
|
+
this.sortedSets[key] = this.sortedSets[key].filter(([m]) => m !== member);
|
|
142
|
+
return before - this.sortedSets[key].length;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
async publish(channel: string, message: string): Promise<number> {
|
|
146
|
+
return 1;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
async sadd(key: string, ...members: string[]): Promise<number> {
|
|
150
|
+
if (!this.sets[key]) {
|
|
151
|
+
this.sets[key] = new Set();
|
|
152
|
+
}
|
|
153
|
+
let count = 0;
|
|
154
|
+
for (const member of members) {
|
|
155
|
+
if (!this.sets[key].has(member)) {
|
|
156
|
+
this.sets[key].add(member);
|
|
157
|
+
count++;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
return count;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
async smembers(key: string): Promise<string[]> {
|
|
164
|
+
return Array.from(this.sets[key] || new Set());
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
async quit(): Promise<void> {
|
|
168
|
+
// Mock quit
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* Test suite
|
|
174
|
+
*/
|
|
175
|
+
|
|
176
|
+
describe('Redis Coordination - Validation', () => {
|
|
177
|
+
describe('Type validators', () => {
|
|
178
|
+
it('should validate task IDs', () => {
|
|
179
|
+
expect(isValidTaskId('task-123')).toBe(true);
|
|
180
|
+
expect(isValidTaskId('task_abc')).toBe(true);
|
|
181
|
+
expect(isValidTaskId('')).toBe(false);
|
|
182
|
+
expect(isValidTaskId('a'.repeat(300))).toBe(false);
|
|
183
|
+
expect(isValidTaskId('task@invalid')).toBe(false);
|
|
184
|
+
});
|
|
185
|
+
|
|
186
|
+
it('should validate agent IDs', () => {
|
|
187
|
+
expect(isValidAgentId('agent-1')).toBe(true);
|
|
188
|
+
expect(isValidAgentId('backend_dev')).toBe(true);
|
|
189
|
+
expect(isValidAgentId('')).toBe(false);
|
|
190
|
+
expect(isValidAgentId('a'.repeat(300))).toBe(false);
|
|
191
|
+
});
|
|
192
|
+
|
|
193
|
+
it('should validate confidence scores', () => {
|
|
194
|
+
expect(isValidConfidence(0.5)).toBe(true);
|
|
195
|
+
expect(isValidConfidence(0.0)).toBe(true);
|
|
196
|
+
expect(isValidConfidence(1.0)).toBe(true);
|
|
197
|
+
expect(isValidConfidence(-0.1)).toBe(false);
|
|
198
|
+
expect(isValidConfidence(1.1)).toBe(false);
|
|
199
|
+
expect(isValidConfidence('0.5' as any)).toBe(false);
|
|
200
|
+
});
|
|
201
|
+
|
|
202
|
+
it('should throw on invalid task ID', () => {
|
|
203
|
+
expect(() => validateTaskId('invalid@')).toThrow(CoordinationError);
|
|
204
|
+
});
|
|
205
|
+
|
|
206
|
+
it('should throw on invalid agent ID', () => {
|
|
207
|
+
expect(() => validateAgentId('invalid@')).toThrow(CoordinationError);
|
|
208
|
+
});
|
|
209
|
+
|
|
210
|
+
it('should throw on invalid confidence', () => {
|
|
211
|
+
expect(() => validateConfidence(1.5)).toThrow(CoordinationError);
|
|
212
|
+
});
|
|
213
|
+
});
|
|
214
|
+
});
|
|
215
|
+
|
|
216
|
+
describe('Context Manager', () => {
|
|
217
|
+
let manager: ContextManager;
|
|
218
|
+
let redis: RedisCoordinator;
|
|
219
|
+
let logger: ConsoleLogger;
|
|
220
|
+
|
|
221
|
+
beforeEach(async () => {
|
|
222
|
+
redis = new RedisCoordinator();
|
|
223
|
+
logger = new ConsoleLogger('[Test]');
|
|
224
|
+
// Mock mode as CLI for most tests
|
|
225
|
+
jest.spyOn(redis, 'canUseRedis', 'get').mockReturnValue(true);
|
|
226
|
+
manager = new ContextManager(redis, logger);
|
|
227
|
+
});
|
|
228
|
+
|
|
229
|
+
it('should store and retrieve context', async () => {
|
|
230
|
+
const taskId = 'task-123' as any;
|
|
231
|
+
const context = {
|
|
232
|
+
taskId,
|
|
233
|
+
epic: 'Test task',
|
|
234
|
+
deliverables: ['file1.ts', 'file2.ts'],
|
|
235
|
+
mode: 'standard' as const
|
|
236
|
+
};
|
|
237
|
+
|
|
238
|
+
// In real tests, would use actual Redis
|
|
239
|
+
// For now, just validate the manager is initialized
|
|
240
|
+
expect(manager).toBeDefined();
|
|
241
|
+
});
|
|
242
|
+
|
|
243
|
+
it('should validate context structure', () => {
|
|
244
|
+
const context = {
|
|
245
|
+
taskId: 'task-123' as any,
|
|
246
|
+
epic: 'Test',
|
|
247
|
+
deliverables: ['a', 'b']
|
|
248
|
+
};
|
|
249
|
+
|
|
250
|
+
const result = manager.validateContext(context);
|
|
251
|
+
expect(result.valid).toBe(true);
|
|
252
|
+
expect(result.errors).toHaveLength(0);
|
|
253
|
+
});
|
|
254
|
+
|
|
255
|
+
it('should reject invalid context', () => {
|
|
256
|
+
const context = {
|
|
257
|
+
taskId: 'invalid@' as any,
|
|
258
|
+
deliverables: 'not-an-array' as any
|
|
259
|
+
};
|
|
260
|
+
|
|
261
|
+
const result = manager.validateContext(context);
|
|
262
|
+
expect(result.valid).toBe(false);
|
|
263
|
+
expect(result.errors.length).toBeGreaterThan(0);
|
|
264
|
+
});
|
|
265
|
+
|
|
266
|
+
it('should handle Task Mode gracefully', async () => {
|
|
267
|
+
jest.spyOn(redis, 'canUseRedis', 'get').mockReturnValue(false);
|
|
268
|
+
|
|
269
|
+
const taskId = 'task-456' as any;
|
|
270
|
+
const context = {
|
|
271
|
+
taskId,
|
|
272
|
+
epic: 'Task mode test'
|
|
273
|
+
};
|
|
274
|
+
|
|
275
|
+
// Should not throw in Task Mode
|
|
276
|
+
await expect(manager.storeContext(taskId, context)).resolves.not.toThrow();
|
|
277
|
+
});
|
|
278
|
+
});
|
|
279
|
+
|
|
280
|
+
describe('Completion Reporter', () => {
|
|
281
|
+
let reporter: CompletionReporter;
|
|
282
|
+
let redis: RedisCoordinator;
|
|
283
|
+
let logger: ConsoleLogger;
|
|
284
|
+
|
|
285
|
+
beforeEach(async () => {
|
|
286
|
+
redis = new RedisCoordinator();
|
|
287
|
+
logger = new ConsoleLogger('[Test]');
|
|
288
|
+
jest.spyOn(redis, 'canUseRedis', 'get').mockReturnValue(true);
|
|
289
|
+
reporter = new CompletionReporter(redis, logger);
|
|
290
|
+
});
|
|
291
|
+
|
|
292
|
+
it('should validate confidence range', async () => {
|
|
293
|
+
const taskId = 'task-123' as any;
|
|
294
|
+
const agentId = 'agent-1' as any;
|
|
295
|
+
|
|
296
|
+
await expect(
|
|
297
|
+
reporter.reportCompletion(taskId, agentId, 1.5)
|
|
298
|
+
).rejects.toThrow(CoordinationError);
|
|
299
|
+
});
|
|
300
|
+
|
|
301
|
+
it('should reject invalid task ID', async () => {
|
|
302
|
+
await expect(
|
|
303
|
+
reporter.reportCompletion('invalid@' as any, 'agent-1' as any, 0.8)
|
|
304
|
+
).rejects.toThrow(CoordinationError);
|
|
305
|
+
});
|
|
306
|
+
|
|
307
|
+
it('should reject invalid agent ID', async () => {
|
|
308
|
+
await expect(
|
|
309
|
+
reporter.reportCompletion('task-123' as any, 'invalid@' as any, 0.8)
|
|
310
|
+
).rejects.toThrow(CoordinationError);
|
|
311
|
+
});
|
|
312
|
+
|
|
313
|
+
it('should handle Task Mode gracefully', async () => {
|
|
314
|
+
jest.spyOn(redis, 'canUseRedis', 'get').mockReturnValue(false);
|
|
315
|
+
|
|
316
|
+
const taskId = 'task-123' as any;
|
|
317
|
+
const agentId = 'agent-1' as any;
|
|
318
|
+
|
|
319
|
+
// Should not throw in Task Mode
|
|
320
|
+
await expect(
|
|
321
|
+
reporter.reportCompletion(taskId, agentId, 0.85)
|
|
322
|
+
).resolves.not.toThrow();
|
|
323
|
+
});
|
|
324
|
+
|
|
325
|
+
it('should report test results with valid pass rate', async () => {
|
|
326
|
+
const taskId = 'task-123' as any;
|
|
327
|
+
const agentId = 'agent-1' as any;
|
|
328
|
+
const results = {
|
|
329
|
+
pass: 45,
|
|
330
|
+
fail: 5,
|
|
331
|
+
total: 50,
|
|
332
|
+
passRate: 0.9,
|
|
333
|
+
timestamp: new Date().toISOString()
|
|
334
|
+
};
|
|
335
|
+
|
|
336
|
+
// Should not throw
|
|
337
|
+
await expect(
|
|
338
|
+
reporter.reportTestResults(taskId, agentId, results)
|
|
339
|
+
).resolves.not.toThrow();
|
|
340
|
+
});
|
|
341
|
+
|
|
342
|
+
it('should reject invalid pass rate', async () => {
|
|
343
|
+
const taskId = 'task-123' as any;
|
|
344
|
+
const agentId = 'agent-1' as any;
|
|
345
|
+
const results = {
|
|
346
|
+
pass: 45,
|
|
347
|
+
fail: 5,
|
|
348
|
+
total: 50,
|
|
349
|
+
passRate: 1.5, // Invalid
|
|
350
|
+
timestamp: new Date().toISOString()
|
|
351
|
+
};
|
|
352
|
+
|
|
353
|
+
await expect(
|
|
354
|
+
reporter.reportTestResults(taskId, agentId, results)
|
|
355
|
+
).rejects.toThrow(CoordinationError);
|
|
356
|
+
});
|
|
357
|
+
});
|
|
358
|
+
|
|
359
|
+
describe('Result Collector', () => {
|
|
360
|
+
let collector: ResultCollector;
|
|
361
|
+
let redis: RedisCoordinator;
|
|
362
|
+
let logger: ConsoleLogger;
|
|
363
|
+
|
|
364
|
+
beforeEach(async () => {
|
|
365
|
+
redis = new RedisCoordinator();
|
|
366
|
+
logger = new ConsoleLogger('[Test]');
|
|
367
|
+
jest.spyOn(redis, 'canUseRedis', 'get').mockReturnValue(true);
|
|
368
|
+
collector = new ResultCollector(redis, logger);
|
|
369
|
+
});
|
|
370
|
+
|
|
371
|
+
it('should aggregate confidence scores', () => {
|
|
372
|
+
const results = [
|
|
373
|
+
{ agentId: 'agent-1' as any, confidence: 0.8 },
|
|
374
|
+
{ agentId: 'agent-2' as any, confidence: 0.9 },
|
|
375
|
+
{ agentId: 'agent-3' as any, confidence: 0.7 }
|
|
376
|
+
];
|
|
377
|
+
|
|
378
|
+
const aggregated = collector.aggregateScores(results);
|
|
379
|
+
|
|
380
|
+
expect(aggregated.agentCount).toBe(3);
|
|
381
|
+
expect(aggregated.avgConfidence).toBeCloseTo(0.8, 1);
|
|
382
|
+
expect(aggregated.minConfidence).toBe(0.7);
|
|
383
|
+
expect(aggregated.maxConfidence).toBe(0.9);
|
|
384
|
+
expect(aggregated.consensus).toBeGreaterThan(0);
|
|
385
|
+
expect(aggregated.consensus).toBeLessThanOrEqual(1);
|
|
386
|
+
});
|
|
387
|
+
|
|
388
|
+
it('should reject empty scores array', () => {
|
|
389
|
+
expect(() => collector.aggregateScores([])).toThrow(CoordinationError);
|
|
390
|
+
});
|
|
391
|
+
|
|
392
|
+
it('should return empty results in Task Mode', async () => {
|
|
393
|
+
jest.spyOn(redis, 'canUseRedis', 'get').mockReturnValue(false);
|
|
394
|
+
|
|
395
|
+
const taskId = 'task-123' as any;
|
|
396
|
+
const agentIds = ['agent-1' as any, 'agent-2' as any];
|
|
397
|
+
|
|
398
|
+
const results = await collector.collectResults(taskId, agentIds);
|
|
399
|
+
expect(results).toEqual([]);
|
|
400
|
+
});
|
|
401
|
+
});
|
|
402
|
+
|
|
403
|
+
describe('Waiting Coordinator', () => {
|
|
404
|
+
let coordinator: WaitingCoordinator;
|
|
405
|
+
let redis: RedisCoordinator;
|
|
406
|
+
let logger: ConsoleLogger;
|
|
407
|
+
|
|
408
|
+
beforeEach(async () => {
|
|
409
|
+
redis = new RedisCoordinator();
|
|
410
|
+
logger = new ConsoleLogger('[Test]');
|
|
411
|
+
jest.spyOn(redis, 'canUseRedis', 'get').mockReturnValue(true);
|
|
412
|
+
coordinator = new WaitingCoordinator(redis, logger);
|
|
413
|
+
});
|
|
414
|
+
|
|
415
|
+
it('should validate task ID for wait operations', async () => {
|
|
416
|
+
await expect(
|
|
417
|
+
coordinator.waitForCompletion('invalid@' as any, 'agent-1' as any, 10)
|
|
418
|
+
).rejects.toThrow(CoordinationError);
|
|
419
|
+
});
|
|
420
|
+
|
|
421
|
+
it('should validate agent ID for wait operations', async () => {
|
|
422
|
+
await expect(
|
|
423
|
+
coordinator.waitForCompletion('task-123' as any, 'invalid@' as any, 10)
|
|
424
|
+
).rejects.toThrow(CoordinationError);
|
|
425
|
+
});
|
|
426
|
+
|
|
427
|
+
it('should handle Task Mode gracefully', async () => {
|
|
428
|
+
jest.spyOn(redis, 'canUseRedis', 'get').mockReturnValue(false);
|
|
429
|
+
|
|
430
|
+
const result = await coordinator.waitForCompletion(
|
|
431
|
+
'task-123' as any,
|
|
432
|
+
'agent-1' as any,
|
|
433
|
+
10
|
|
434
|
+
);
|
|
435
|
+
|
|
436
|
+
expect(result.met).toBe(true);
|
|
437
|
+
expect(result.timedOut).toBe(false);
|
|
438
|
+
expect(result.waitedMs).toBe(0);
|
|
439
|
+
});
|
|
440
|
+
|
|
441
|
+
it('should validate condition name', async () => {
|
|
442
|
+
await expect(
|
|
443
|
+
coordinator.waitForCondition('task-123' as any, '', 10)
|
|
444
|
+
).rejects.toThrow(CoordinationError);
|
|
445
|
+
});
|
|
446
|
+
});
|
|
447
|
+
|
|
448
|
+
describe('Swarm Manager', () => {
|
|
449
|
+
let manager: SwarmManager;
|
|
450
|
+
let redis: RedisCoordinator;
|
|
451
|
+
let logger: ConsoleLogger;
|
|
452
|
+
|
|
453
|
+
beforeEach(async () => {
|
|
454
|
+
redis = new RedisCoordinator();
|
|
455
|
+
logger = new ConsoleLogger('[Test]');
|
|
456
|
+
jest.spyOn(redis, 'canUseRedis', 'get').mockReturnValue(true);
|
|
457
|
+
manager = new SwarmManager(redis, logger);
|
|
458
|
+
});
|
|
459
|
+
|
|
460
|
+
it('should reject invalid task ID', async () => {
|
|
461
|
+
await expect(
|
|
462
|
+
manager.createSwarm('invalid@' as any)
|
|
463
|
+
).rejects.toThrow(CoordinationError);
|
|
464
|
+
});
|
|
465
|
+
|
|
466
|
+
it('should handle Task Mode gracefully', async () => {
|
|
467
|
+
jest.spyOn(redis, 'canUseRedis', 'get').mockReturnValue(false);
|
|
468
|
+
|
|
469
|
+
const taskId = 'task-123' as any;
|
|
470
|
+
|
|
471
|
+
await expect(manager.createSwarm(taskId)).resolves.not.toThrow();
|
|
472
|
+
await expect(manager.completeSwarm(taskId)).resolves.not.toThrow();
|
|
473
|
+
await expect(
|
|
474
|
+
manager.cancelSwarm(taskId, 'test')
|
|
475
|
+
).resolves.not.toThrow();
|
|
476
|
+
});
|
|
477
|
+
|
|
478
|
+
it('should return false for non-cancelled swarm in Task Mode', async () => {
|
|
479
|
+
jest.spyOn(redis, 'canUseRedis', 'get').mockReturnValue(false);
|
|
480
|
+
|
|
481
|
+
const taskId = 'task-123' as any;
|
|
482
|
+
const cancelled = await manager.isSwarmCancelled(taskId);
|
|
483
|
+
|
|
484
|
+
expect(cancelled).toBe(false);
|
|
485
|
+
});
|
|
486
|
+
});
|
|
487
|
+
|
|
488
|
+
describe('Agent Recovery Manager', () => {
|
|
489
|
+
let manager: AgentRecoveryManager;
|
|
490
|
+
let redis: RedisCoordinator;
|
|
491
|
+
let logger: ConsoleLogger;
|
|
492
|
+
|
|
493
|
+
beforeEach(async () => {
|
|
494
|
+
redis = new RedisCoordinator();
|
|
495
|
+
logger = new ConsoleLogger('[Test]');
|
|
496
|
+
jest.spyOn(redis, 'canUseRedis', 'get').mockReturnValue(true);
|
|
497
|
+
manager = new AgentRecoveryManager(redis, logger);
|
|
498
|
+
});
|
|
499
|
+
|
|
500
|
+
it('should validate task and agent IDs', async () => {
|
|
501
|
+
await expect(
|
|
502
|
+
manager.recordHeartbeat('invalid@' as any, 'agent-1' as any)
|
|
503
|
+
).rejects.toThrow(CoordinationError);
|
|
504
|
+
|
|
505
|
+
await expect(
|
|
506
|
+
manager.recordHeartbeat('task-123' as any, 'invalid@' as any)
|
|
507
|
+
).rejects.toThrow(CoordinationError);
|
|
508
|
+
});
|
|
509
|
+
|
|
510
|
+
it('should handle Task Mode heartbeat gracefully', async () => {
|
|
511
|
+
jest.spyOn(redis, 'canUseRedis', 'get').mockReturnValue(false);
|
|
512
|
+
|
|
513
|
+
const taskId = 'task-123' as any;
|
|
514
|
+
const agentId = 'agent-1' as any;
|
|
515
|
+
|
|
516
|
+
// Should not throw
|
|
517
|
+
await expect(manager.recordHeartbeat(taskId, agentId)).resolves.not.toThrow();
|
|
518
|
+
});
|
|
519
|
+
|
|
520
|
+
it('should return healthy status for Task Mode agents', async () => {
|
|
521
|
+
jest.spyOn(redis, 'canUseRedis', 'get').mockReturnValue(false);
|
|
522
|
+
|
|
523
|
+
const health = await manager.checkAgentHealth(
|
|
524
|
+
'task-123' as any,
|
|
525
|
+
'agent-1' as any
|
|
526
|
+
);
|
|
527
|
+
|
|
528
|
+
expect(health.status).toBe('healthy');
|
|
529
|
+
});
|
|
530
|
+
});
|
|
531
|
+
|
|
532
|
+
describe('Task Analyzer', () => {
|
|
533
|
+
let analyzer: TaskAnalyzer;
|
|
534
|
+
let redis: RedisCoordinator;
|
|
535
|
+
let logger: ConsoleLogger;
|
|
536
|
+
|
|
537
|
+
beforeEach(async () => {
|
|
538
|
+
redis = new RedisCoordinator();
|
|
539
|
+
logger = new ConsoleLogger('[Test]');
|
|
540
|
+
analyzer = new TaskAnalyzer(redis, logger);
|
|
541
|
+
});
|
|
542
|
+
|
|
543
|
+
it('should reject empty task description', () => {
|
|
544
|
+
expect(() => analyzer.analyzeComplexity('')).toThrow(CoordinationError);
|
|
545
|
+
expect(() => analyzer.analyzeComplexity(' ')).toThrow(CoordinationError);
|
|
546
|
+
});
|
|
547
|
+
|
|
548
|
+
it('should analyze simple task', () => {
|
|
549
|
+
const analysis = analyzer.analyzeComplexity('Fix typo');
|
|
550
|
+
|
|
551
|
+
expect(analysis.complexityScore).toBeLessThan(10);
|
|
552
|
+
expect(analysis.difficulty).toBe('simple');
|
|
553
|
+
expect(analysis.suggestedAgents.loop3Count).toBeGreaterThan(0);
|
|
554
|
+
});
|
|
555
|
+
|
|
556
|
+
it('should analyze complex multi-domain task', () => {
|
|
557
|
+
const analysis = analyzer.analyzeComplexity(
|
|
558
|
+
'Build React dashboard with PostgreSQL backend, Docker deployment, and JWT authentication'
|
|
559
|
+
);
|
|
560
|
+
|
|
561
|
+
expect(analysis.complexityScore).toBeGreaterThan(5);
|
|
562
|
+
expect(analysis.domains.length).toBeGreaterThan(1);
|
|
563
|
+
});
|
|
564
|
+
|
|
565
|
+
it('should calculate priority score', () => {
|
|
566
|
+
const analysis = analyzer.analyzeComplexity('Implement authentication system');
|
|
567
|
+
const priority = analyzer.calculatePriority(analysis);
|
|
568
|
+
|
|
569
|
+
expect(priority).toBeGreaterThan(0);
|
|
570
|
+
});
|
|
571
|
+
|
|
572
|
+
it('should suggest appropriate execution mode', () => {
|
|
573
|
+
const simple = analyzer.analyzeComplexity('Fix small bug');
|
|
574
|
+
expect(analyzer.suggestMode(simple)).toBe('mvp');
|
|
575
|
+
|
|
576
|
+
const complex = analyzer.analyzeComplexity(
|
|
577
|
+
'Enterprise multi-tenant distributed system with ML integration'
|
|
578
|
+
);
|
|
579
|
+
expect(analyzer.suggestMode(complex)).toBe('enterprise');
|
|
580
|
+
});
|
|
581
|
+
});
|
|
582
|
+
|
|
583
|
+
describe('Task Executor', () => {
|
|
584
|
+
let executor: TaskExecutor;
|
|
585
|
+
let redis: RedisCoordinator;
|
|
586
|
+
let logger: ConsoleLogger;
|
|
587
|
+
|
|
588
|
+
beforeEach(async () => {
|
|
589
|
+
redis = new RedisCoordinator();
|
|
590
|
+
logger = new ConsoleLogger('[Test]');
|
|
591
|
+
executor = new TaskExecutor(redis, logger);
|
|
592
|
+
});
|
|
593
|
+
|
|
594
|
+
it('should validate execution config', () => {
|
|
595
|
+
const validConfig = {
|
|
596
|
+
taskId: 'task-123' as any,
|
|
597
|
+
taskDescription: 'Build feature X'
|
|
598
|
+
};
|
|
599
|
+
|
|
600
|
+
const result = executor.validateConfig(validConfig);
|
|
601
|
+
expect(result.valid).toBe(true);
|
|
602
|
+
expect(result.errors).toHaveLength(0);
|
|
603
|
+
});
|
|
604
|
+
|
|
605
|
+
it('should reject invalid task ID', () => {
|
|
606
|
+
const config = {
|
|
607
|
+
taskId: 'invalid@' as any,
|
|
608
|
+
taskDescription: 'Build feature'
|
|
609
|
+
};
|
|
610
|
+
|
|
611
|
+
const result = executor.validateConfig(config);
|
|
612
|
+
expect(result.valid).toBe(false);
|
|
613
|
+
});
|
|
614
|
+
|
|
615
|
+
it('should reject empty task description', () => {
|
|
616
|
+
const config = {
|
|
617
|
+
taskId: 'task-123' as any,
|
|
618
|
+
taskDescription: ''
|
|
619
|
+
};
|
|
620
|
+
|
|
621
|
+
const result = executor.validateConfig(config);
|
|
622
|
+
expect(result.valid).toBe(false);
|
|
623
|
+
});
|
|
624
|
+
|
|
625
|
+
it('should reject invalid iteration count', () => {
|
|
626
|
+
const config = {
|
|
627
|
+
taskId: 'task-123' as any,
|
|
628
|
+
taskDescription: 'Build feature',
|
|
629
|
+
maxIterations: 100
|
|
630
|
+
};
|
|
631
|
+
|
|
632
|
+
const result = executor.validateConfig(config);
|
|
633
|
+
expect(result.valid).toBe(false);
|
|
634
|
+
});
|
|
635
|
+
});
|
|
636
|
+
|
|
637
|
+
describe('Agent Logger', () => {
|
|
638
|
+
let logger: AgentLogger;
|
|
639
|
+
let redis: RedisCoordinator;
|
|
640
|
+
let baseLogger: ConsoleLogger;
|
|
641
|
+
|
|
642
|
+
beforeEach(async () => {
|
|
643
|
+
redis = new RedisCoordinator();
|
|
644
|
+
baseLogger = new ConsoleLogger('[Test]');
|
|
645
|
+
jest.spyOn(redis, 'canUseRedis', 'get').mockReturnValue(true);
|
|
646
|
+
logger = new AgentLogger('task-123' as any, 'agent-1' as any, redis, baseLogger);
|
|
647
|
+
});
|
|
648
|
+
|
|
649
|
+
it('should accept valid task and agent IDs', () => {
|
|
650
|
+
expect(logger).toBeDefined();
|
|
651
|
+
});
|
|
652
|
+
|
|
653
|
+
it('should reject invalid task ID in constructor', () => {
|
|
654
|
+
expect(
|
|
655
|
+
() => new AgentLogger('invalid@' as any, 'agent-1' as any, redis, baseLogger)
|
|
656
|
+
).toThrow(CoordinationError);
|
|
657
|
+
});
|
|
658
|
+
|
|
659
|
+
it('should reject invalid agent ID in constructor', () => {
|
|
660
|
+
expect(
|
|
661
|
+
() => new AgentLogger('task-123' as any, 'invalid@' as any, redis, baseLogger)
|
|
662
|
+
).toThrow(CoordinationError);
|
|
663
|
+
});
|
|
664
|
+
|
|
665
|
+
it('should log messages without throwing', () => {
|
|
666
|
+
expect(() => {
|
|
667
|
+
logger.info('Test message');
|
|
668
|
+
logger.warn('Warning message');
|
|
669
|
+
logger.debug('Debug message');
|
|
670
|
+
}).not.toThrow();
|
|
671
|
+
});
|
|
672
|
+
});
|
|
673
|
+
|
|
674
|
+
describe('Integration scenarios', () => {
|
|
675
|
+
it('should coordinate full agent lifecycle', async () => {
|
|
676
|
+
const redis = new RedisCoordinator();
|
|
677
|
+
const logger = new ConsoleLogger('[Integration]');
|
|
678
|
+
|
|
679
|
+
jest.spyOn(redis, 'canUseRedis', 'get').mockReturnValue(true);
|
|
680
|
+
|
|
681
|
+
const context = new ContextManager(redis, logger);
|
|
682
|
+
const completion = new CompletionReporter(redis, logger);
|
|
683
|
+
const recovery = new AgentRecoveryManager(redis, logger);
|
|
684
|
+
|
|
685
|
+
const taskId = 'integration-test' as any;
|
|
686
|
+
const agentId = 'test-agent' as any;
|
|
687
|
+
|
|
688
|
+
// Agent starts work
|
|
689
|
+
await recovery.recordHeartbeat(taskId, agentId, 12345);
|
|
690
|
+
|
|
691
|
+
// Agent completes
|
|
692
|
+
await completion.reportCompletion(taskId, agentId, 0.92);
|
|
693
|
+
|
|
694
|
+
// Verify context was handled correctly
|
|
695
|
+
expect(context).toBeDefined();
|
|
696
|
+
});
|
|
697
|
+
|
|
698
|
+
it('should handle simultaneous multi-agent coordination', async () => {
|
|
699
|
+
const redis = new RedisCoordinator();
|
|
700
|
+
const logger = new ConsoleLogger('[MultiAgent]');
|
|
701
|
+
|
|
702
|
+
jest.spyOn(redis, 'canUseRedis', 'get').mockReturnValue(true);
|
|
703
|
+
|
|
704
|
+
const coordinator = new WaitingCoordinator(redis, logger);
|
|
705
|
+
const taskId = 'multi-agent-test' as any;
|
|
706
|
+
const agents = [
|
|
707
|
+
'agent-1' as any,
|
|
708
|
+
'agent-2' as any,
|
|
709
|
+
'agent-3' as any
|
|
710
|
+
];
|
|
711
|
+
|
|
712
|
+
// All agents try to complete
|
|
713
|
+
// In Task Mode, should return immediately and successfully
|
|
714
|
+
const result = await coordinator.waitForMultipleAgents(
|
|
715
|
+
taskId,
|
|
716
|
+
agents,
|
|
717
|
+
5
|
|
718
|
+
);
|
|
719
|
+
|
|
720
|
+
expect(result.completed).toBeDefined();
|
|
721
|
+
});
|
|
722
|
+
});
|
|
723
|
+
|
|
724
|
+
describe('Edge cases and error handling', () => {
|
|
725
|
+
it('should handle malformed JSON in context', async () => {
|
|
726
|
+
const redis = new RedisCoordinator();
|
|
727
|
+
const logger = new ConsoleLogger('[Test]');
|
|
728
|
+
jest.spyOn(redis, 'canUseRedis', 'get').mockReturnValue(true);
|
|
729
|
+
const manager = new ContextManager(redis, logger);
|
|
730
|
+
|
|
731
|
+
// Test validation of context structure
|
|
732
|
+
const invalid = {
|
|
733
|
+
taskId: 'task-123' as any,
|
|
734
|
+
deliverables: 'not-array' as any
|
|
735
|
+
};
|
|
736
|
+
|
|
737
|
+
const result = manager.validateContext(invalid);
|
|
738
|
+
expect(result.valid).toBe(false);
|
|
739
|
+
});
|
|
740
|
+
|
|
741
|
+
it('should safely handle Redis connection failures', async () => {
|
|
742
|
+
const redis = new RedisCoordinator();
|
|
743
|
+
const logger = new ConsoleLogger('[Test]');
|
|
744
|
+
|
|
745
|
+
// Simulate Redis unavailable
|
|
746
|
+
jest.spyOn(redis, 'canUseRedis', 'get').mockReturnValue(false);
|
|
747
|
+
|
|
748
|
+
const manager = new ContextManager(redis, logger);
|
|
749
|
+
const taskId = 'task-123' as any;
|
|
750
|
+
|
|
751
|
+
// Should handle gracefully even without Redis
|
|
752
|
+
await expect(
|
|
753
|
+
manager.storeContext(taskId, { taskId })
|
|
754
|
+
).resolves.not.toThrow();
|
|
755
|
+
});
|
|
756
|
+
|
|
757
|
+
it('should validate all input parameters strictly', async () => {
|
|
758
|
+
const redis = new RedisCoordinator();
|
|
759
|
+
const logger = new ConsoleLogger('[Test]');
|
|
760
|
+
const reporter = new CompletionReporter(redis, logger);
|
|
761
|
+
|
|
762
|
+
// Test parameter validation
|
|
763
|
+
const invalidTaskId = 'task@#$%' as any;
|
|
764
|
+
const invalidAgentId = 'agent@#$%' as any;
|
|
765
|
+
const invalidConfidence = 2.5;
|
|
766
|
+
|
|
767
|
+
await expect(
|
|
768
|
+
reporter.reportCompletion(invalidTaskId, 'agent-1' as any, 0.5)
|
|
769
|
+
).rejects.toThrow();
|
|
770
|
+
|
|
771
|
+
await expect(
|
|
772
|
+
reporter.reportCompletion('task-123' as any, invalidAgentId, 0.5)
|
|
773
|
+
).rejects.toThrow();
|
|
774
|
+
|
|
775
|
+
await expect(
|
|
776
|
+
reporter.reportCompletion('task-123' as any, 'agent-1' as any, invalidConfidence)
|
|
777
|
+
).rejects.toThrow();
|
|
778
|
+
});
|
|
779
|
+
});
|