claude-flow-novice 2.15.3 → 2.15.4
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/skills/advanced-features/cfn-agent-swap/recommend-swap.sh +59 -59
- package/.claude/cfn-extras/skills/analytics/cfn-improvement-recommender/recommend-improvements.sh +91 -91
- package/.claude/cfn-extras/skills/analytics/cfn-pattern-extraction/extract-patterns.sh +79 -79
- package/.claude/cfn-extras/skills/analytics/cfn-retrospective-report/generate-report.sh +100 -100
- package/.claude/cfn-extras/skills/analytics/cfn-telemetry/start-telemetry.sh +110 -110
- package/.claude/cfn-extras/skills/deprecated/cfn-ace-system/add-bullet.sh +145 -145
- package/.claude/cfn-extras/skills/deprecated/cfn-ace-system/log-merge.sh +67 -67
- package/.claude/cfn-extras/skills/deprecated/cfn-ace-system/monitor-injection-performance.sh +137 -137
- package/.claude/cfn-extras/skills/deprecated/cfn-ace-system/optimize-injection-pipeline.sh +168 -168
- package/.claude/cfn-extras/skills/deprecated/cfn-ace-system/query-reflections.sh +35 -35
- package/.claude/cfn-extras/skills/deprecated/cfn-ace-system/store-reflection.sh +45 -45
- package/.claude/cfn-extras/skills/deprecated/cfn-ace-system/track-ab-test.sh +41 -41
- package/.claude/cfn-extras/skills/deprecated/cfn-ace-system/update-reflection.sh +41 -41
- package/.claude/cfn-extras/skills/deprecated/cfn-cli-setup/validate-cli-environment.sh +191 -191
- package/.claude/cfn-extras/skills/marketing/cfn-marketing-ad-campaigns/operations/create-campaign.sh +231 -231
- package/.claude/cfn-extras/skills/marketing/cfn-marketing-ad-campaigns/operations/get-campaign-performance.sh +190 -190
- package/.claude/cfn-extras/skills/marketing/cfn-marketing-ad-campaigns/operations/pause-campaign.sh +142 -142
- package/.claude/cfn-extras/skills/marketing/cfn-marketing-ad-campaigns/operations/set-budget.sh +181 -181
- package/.claude/cfn-extras/skills/marketing/cfn-marketing-ad-campaigns/operations/update-bid-strategy.sh +133 -133
- package/.claude/cfn-extras/skills/marketing/cfn-marketing-chatbot-conversations/operations/get-conversation-history.sh +121 -121
- package/.claude/cfn-extras/skills/marketing/cfn-marketing-chatbot-conversations/operations/qualify-lead.sh +156 -156
- package/.claude/cfn-extras/skills/marketing/cfn-marketing-chatbot-conversations/operations/schedule-demo.sh +181 -181
- package/.claude/cfn-extras/skills/marketing/cfn-marketing-chatbot-conversations/operations/send-message.sh +137 -137
- package/.claude/cfn-extras/skills/marketing/cfn-marketing-chatbot-conversations/operations/transfer-to-human.sh +179 -179
- package/.claude/cfn-extras/skills/marketing/cfn-marketing-sms-campaigns/operations/create-campaign.sh +183 -183
- package/.claude/cfn-extras/skills/marketing/cfn-marketing-sms-campaigns/operations/get-delivery-status.sh +139 -139
- package/.claude/cfn-extras/skills/marketing/cfn-marketing-sms-campaigns/operations/opt-out.sh +150 -150
- package/.claude/cfn-extras/skills/marketing/cfn-marketing-sms-campaigns/operations/schedule-campaign.sh +187 -187
- package/.claude/cfn-extras/skills/marketing/cfn-marketing-sms-campaigns/operations/send-sms.sh +181 -181
- package/.claude/cfn-extras/skills/ui-portal/cfn-web-portal/test-web-portal-skill.sh +50 -50
- package/.claude/cfn-extras/skills/ui-portal/cfn-web-portal/validate-deployment.sh +84 -84
- package/.claude/cfn-extras/skills/utility/cfn-environment-sanitization/sanitize-environment.sh +243 -243
- package/.claude/commands/cfn-loop-cli.md +16 -2
- package/.claude/commands/switch-api.md +31 -10
- package/.claude/hooks/cfn-lint-sql-injection.sh +61 -0
- package/.claude/hooks/cfn-post-edit-cfn-retrospective.sh +33 -2
- package/.claude/hooks/cfn-pre-edit-security-warning.sh +40 -0
- package/.claude/skills/cfn-agent-spawning/spawn-agent.sh +22 -24
- package/.claude/skills/cfn-docker-agent-spawning/SKILL.md +28 -4
- package/.claude/skills/cfn-docker-agent-spawning/spawn-agent.sh +3 -1
- package/.claude/skills/cfn-docker-loop-orchestration/orchestrate.sh +224 -20
- package/.claude/skills/cfn-loop-orchestration/helpers/gate-check.sh +550 -46
- package/.claude/skills/cfn-loop-orchestration/helpers/parse-test-results.sh +277 -0
- package/.claude/skills/cfn-loop-orchestration/orchestrate.sh +184 -23
- package/.claude/skills/cfn-loop-orchestration/security_utils.sh +24 -0
- package/.claude/skills/cfn-loop-orchestration/test-iteration-context-injection.sh +366 -0
- package/.claude/skills/cfn-redis-coordination/CENTRALIZED_REDIS_WRAPPER.md +319 -0
- package/.claude/skills/cfn-redis-coordination/agent-log.sh +4 -0
- package/.claude/skills/cfn-redis-coordination/agent-log.sh.bak +124 -0
- package/.claude/skills/cfn-redis-coordination/agent-recovery.sh +2 -2
- package/.claude/skills/cfn-redis-coordination/collect-confidence-scores.sh +30 -0
- package/.claude/skills/cfn-redis-coordination/get-context.sh +33 -0
- package/.claude/skills/cfn-redis-coordination/get-success-criteria.sh +54 -0
- package/.claude/skills/cfn-redis-coordination/invoke-waiting-mode.sh +3 -0
- package/.claude/skills/cfn-redis-coordination/redis-cli-wrapper.sh +24 -3
- package/.claude/skills/cfn-redis-coordination/redis-functions.sh +33 -0
- package/.claude/skills/cfn-redis-coordination/report-completion.sh +24 -31
- package/.claude/skills/cfn-redis-coordination/store-context.sh +4 -0
- package/.claude/skills/cfn-redis-coordination/store-success-criteria.sh +85 -0
- package/.claude/skills/cfn-redis-coordination/update-all-scripts.sh +67 -0
- package/.claude/skills/cfn-sqlite-memory/ttl-cleanup.sh +17 -25
- package/.claude/skills/cfn-transparency-middleware/test-e2e.sh +15 -0
- package/.claude/skills/cfn-transparency-middleware/tests/input-validation.sh +15 -0
- package/README.md +116 -475
- package/claude-assets/agents/cfn-dev-team/README.md +103 -0
- package/claude-assets/agents/cfn-dev-team/architecture/goal-planner.md +1 -1
- package/claude-assets/agents/cfn-dev-team/coordinators/cfn-frontend-coordinator.md +77 -15
- package/claude-assets/agents/cfn-dev-team/coordinators/cfn-v3-coordinator.md +355 -6
- package/claude-assets/agents/cfn-dev-team/coordinators/consensus-builder.md +82 -1
- package/claude-assets/agents/cfn-dev-team/coordinators/handoff-coordinator.md +82 -1
- package/claude-assets/agents/cfn-dev-team/coordinators/multi-sprint-coordinator.md +77 -15
- package/claude-assets/agents/cfn-dev-team/dev-ops/docker-specialist.md +99 -12
- package/claude-assets/agents/cfn-dev-team/dev-ops/github-commit-agent.md +1 -1
- package/claude-assets/agents/cfn-dev-team/dev-ops/kubernetes-specialist.md +97 -0
- package/claude-assets/agents/cfn-dev-team/dev-ops/monitoring-specialist.md +20 -1
- package/claude-assets/agents/cfn-dev-team/developers/api-gateway-specialist.md +97 -0
- package/claude-assets/agents/cfn-dev-team/developers/backend-developer.md +110 -13
- package/claude-assets/agents/cfn-dev-team/developers/data/data-engineer.md +106 -15
- package/claude-assets/agents/cfn-dev-team/developers/database/database-architect.md +115 -11
- package/claude-assets/agents/cfn-dev-team/developers/frontend/mobile-dev.md +94 -7
- package/claude-assets/agents/cfn-dev-team/developers/frontend/react-frontend-engineer.md +87 -9
- package/claude-assets/agents/cfn-dev-team/developers/frontend/typescript-specialist.md +85 -7
- package/claude-assets/agents/cfn-dev-team/developers/frontend/ui-designer.md +160 -28
- package/claude-assets/agents/cfn-dev-team/developers/graphql-specialist.md +101 -19
- package/claude-assets/agents/cfn-dev-team/developers/rust-developer.md +108 -14
- package/claude-assets/agents/cfn-dev-team/reviewers/{reviewer.md → code-reviewer.md} +95 -8
- package/claude-assets/agents/cfn-dev-team/reviewers/quality/code-quality-validator.md +107 -7
- package/claude-assets/agents/cfn-dev-team/reviewers/quality/perf-analyzer.md +98 -7
- package/claude-assets/agents/cfn-dev-team/reviewers/quality/performance-benchmarker.md +95 -7
- package/claude-assets/agents/cfn-dev-team/reviewers/quality/security-specialist.md +136 -9
- package/claude-assets/agents/cfn-dev-team/testers/api-testing-specialist.md +108 -1
- package/claude-assets/agents/cfn-dev-team/testers/chaos-engineering-specialist.md +107 -13
- package/claude-assets/agents/cfn-dev-team/testers/contract-tester.md +737 -0
- 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 +828 -0
- package/claude-assets/agents/cfn-dev-team/testers/interaction-tester.md +106 -7
- package/claude-assets/agents/cfn-dev-team/testers/load-testing-specialist.md +77 -0
- package/claude-assets/agents/cfn-dev-team/testers/mutation-testing-specialist.md +684 -0
- package/claude-assets/agents/cfn-dev-team/testers/playwright-tester.md +110 -1
- package/claude-assets/agents/cfn-dev-team/testers/tester.md +94 -7
- package/claude-assets/agents/cfn-dev-team/utility/code-booster.md +1 -3
- package/claude-assets/agents/cfn-dev-team/utility/epic-creator.md +87 -13
- package/claude-assets/agents/cfn-dev-team/utility/memory-leak-specialist.md +103 -7
- package/claude-assets/agents/cfn-dev-team/utility/researcher.md +1 -3
- package/claude-assets/agents/cfn-dev-team/utility/z-ai-specialist.md +94 -7
- package/claude-assets/agents/docker-coordinators/cfn-docker-v3-coordinator.md +46 -0
- package/claude-assets/agents/project-only-agents/npm-package-specialist.md +1 -1
- package/claude-assets/cfn-extras/skills/advanced-features/cfn-agent-swap/recommend-swap.sh +59 -59
- package/claude-assets/cfn-extras/skills/analytics/cfn-improvement-recommender/recommend-improvements.sh +91 -91
- package/claude-assets/cfn-extras/skills/analytics/cfn-pattern-extraction/extract-patterns.sh +79 -79
- package/claude-assets/cfn-extras/skills/analytics/cfn-retrospective-report/generate-report.sh +100 -100
- package/claude-assets/cfn-extras/skills/analytics/cfn-telemetry/start-telemetry.sh +110 -110
- package/claude-assets/cfn-extras/skills/deprecated/cfn-ace-system/add-bullet.sh +145 -145
- package/claude-assets/cfn-extras/skills/deprecated/cfn-ace-system/log-merge.sh +67 -67
- package/claude-assets/cfn-extras/skills/deprecated/cfn-ace-system/monitor-injection-performance.sh +137 -137
- package/claude-assets/cfn-extras/skills/deprecated/cfn-ace-system/optimize-injection-pipeline.sh +168 -168
- package/claude-assets/cfn-extras/skills/deprecated/cfn-ace-system/query-reflections.sh +35 -35
- package/claude-assets/cfn-extras/skills/deprecated/cfn-ace-system/store-reflection.sh +45 -45
- package/claude-assets/cfn-extras/skills/deprecated/cfn-ace-system/track-ab-test.sh +41 -41
- package/claude-assets/cfn-extras/skills/deprecated/cfn-ace-system/update-reflection.sh +41 -41
- package/claude-assets/cfn-extras/skills/deprecated/cfn-cli-setup/validate-cli-environment.sh +191 -191
- package/claude-assets/cfn-extras/skills/marketing/cfn-marketing-ad-campaigns/operations/create-campaign.sh +231 -231
- package/claude-assets/cfn-extras/skills/marketing/cfn-marketing-ad-campaigns/operations/get-campaign-performance.sh +190 -190
- package/claude-assets/cfn-extras/skills/marketing/cfn-marketing-ad-campaigns/operations/pause-campaign.sh +142 -142
- package/claude-assets/cfn-extras/skills/marketing/cfn-marketing-ad-campaigns/operations/set-budget.sh +181 -181
- package/claude-assets/cfn-extras/skills/marketing/cfn-marketing-ad-campaigns/operations/update-bid-strategy.sh +133 -133
- package/claude-assets/cfn-extras/skills/marketing/cfn-marketing-chatbot-conversations/operations/get-conversation-history.sh +121 -121
- package/claude-assets/cfn-extras/skills/marketing/cfn-marketing-chatbot-conversations/operations/qualify-lead.sh +156 -156
- package/claude-assets/cfn-extras/skills/marketing/cfn-marketing-chatbot-conversations/operations/schedule-demo.sh +181 -181
- package/claude-assets/cfn-extras/skills/marketing/cfn-marketing-chatbot-conversations/operations/send-message.sh +137 -137
- package/claude-assets/cfn-extras/skills/marketing/cfn-marketing-chatbot-conversations/operations/transfer-to-human.sh +179 -179
- package/claude-assets/cfn-extras/skills/marketing/cfn-marketing-sms-campaigns/operations/create-campaign.sh +183 -183
- package/claude-assets/cfn-extras/skills/marketing/cfn-marketing-sms-campaigns/operations/get-delivery-status.sh +139 -139
- package/claude-assets/cfn-extras/skills/marketing/cfn-marketing-sms-campaigns/operations/opt-out.sh +150 -150
- package/claude-assets/cfn-extras/skills/marketing/cfn-marketing-sms-campaigns/operations/schedule-campaign.sh +187 -187
- package/claude-assets/cfn-extras/skills/marketing/cfn-marketing-sms-campaigns/operations/send-sms.sh +181 -181
- package/claude-assets/cfn-extras/skills/ui-portal/cfn-web-portal/test-web-portal-skill.sh +50 -50
- package/claude-assets/cfn-extras/skills/ui-portal/cfn-web-portal/validate-deployment.sh +84 -84
- package/claude-assets/cfn-extras/skills/utility/cfn-environment-sanitization/sanitize-environment.sh +243 -243
- package/claude-assets/commands/cfn-loop-cli.md +16 -2
- package/claude-assets/commands/switch-api.md +31 -10
- package/claude-assets/hooks/cfn-lint-sql-injection.sh +61 -0
- package/claude-assets/hooks/cfn-post-edit-cfn-retrospective.sh +33 -2
- package/claude-assets/hooks/cfn-pre-edit-security-warning.sh +40 -0
- package/claude-assets/hooks/detect-hardcoded-credentials.sh +212 -0
- package/claude-assets/skills/SKILL_TEMPLATE.md +774 -0
- package/claude-assets/skills/agent-lifecycle/execute-lifecycle-hook.sh +84 -113
- package/claude-assets/skills/agent-lifecycle/simple-audit.sh +33 -6
- package/claude-assets/skills/agent-template-generator/SKILL.md +440 -0
- package/claude-assets/skills/agent-template-generator/generate-agent.sh +405 -0
- package/claude-assets/skills/agent-validation-linter/SKILL.md +589 -0
- package/claude-assets/skills/agent-validation-linter/lint-agents.sh +271 -0
- package/claude-assets/skills/bootstrap/bash-fundamentals.md +786 -0
- package/claude-assets/skills/bootstrap/database-connection.md +464 -0
- package/claude-assets/skills/bootstrap/error-handling.md +580 -0
- package/claude-assets/skills/bootstrap/file-operations.md +699 -0
- package/claude-assets/skills/bootstrap/skill-loader.md +616 -0
- package/claude-assets/skills/bootstrap/sqlite-params.sh +287 -0
- package/claude-assets/skills/cfn-agent-spawning/spawn-agent.sh +22 -24
- package/claude-assets/skills/cfn-automatic-memory-persistence/test-memory-persistence.sh +17 -16
- package/claude-assets/skills/cfn-deployment/SKILL.md +293 -0
- package/claude-assets/skills/cfn-deployment/execute.sh +21 -0
- package/claude-assets/skills/cfn-docker-agent-spawning/SKILL.md +28 -4
- package/claude-assets/skills/cfn-docker-agent-spawning/spawn-agent.sh +3 -1
- package/claude-assets/skills/cfn-docker-loop-orchestration/orchestrate.sh +224 -20
- package/claude-assets/skills/cfn-environment-sanitization/sanitize-environment.sh +38 -0
- package/claude-assets/skills/cfn-error-batching-strategy/lib/core-functions.sh +47 -47
- package/claude-assets/skills/cfn-file-operations/SKILL.md +290 -0
- package/claude-assets/skills/cfn-file-operations/execute.sh +129 -0
- package/claude-assets/skills/cfn-file-operations/lib/atomic-write.sh +294 -0
- package/claude-assets/skills/cfn-file-operations/lib/lock.sh +361 -0
- package/claude-assets/skills/cfn-file-operations/test.sh +369 -0
- package/claude-assets/skills/cfn-log-operations/SKILL.md +308 -0
- package/claude-assets/skills/cfn-log-operations/execute.sh +420 -0
- package/claude-assets/skills/cfn-log-operations/lib/rotate.sh +406 -0
- package/claude-assets/skills/cfn-log-operations/lib/search.sh +448 -0
- package/claude-assets/skills/cfn-log-operations/test.sh +394 -0
- package/claude-assets/skills/cfn-loop-orchestration/helpers/gate-check.sh +550 -46
- package/claude-assets/skills/cfn-loop-orchestration/helpers/parse-test-results.sh +277 -0
- package/claude-assets/skills/cfn-loop-orchestration/orchestrate.sh +184 -23
- package/claude-assets/skills/cfn-loop-orchestration/security_utils.sh +24 -0
- package/claude-assets/skills/cfn-loop-orchestration/test-iteration-context-injection.sh +366 -0
- package/claude-assets/skills/cfn-parameterized-queries/SKILL.md +339 -0
- package/claude-assets/skills/cfn-playbook/query-playbook.sh +19 -15
- package/claude-assets/skills/cfn-playbook/update-playbook.sh +25 -14
- package/claude-assets/skills/cfn-process-instrumentation/instrument-process.sh +44 -0
- package/claude-assets/skills/cfn-promotion/SKILL.md +305 -0
- package/claude-assets/skills/cfn-redis-coordination/CENTRALIZED_REDIS_WRAPPER.md +319 -0
- package/claude-assets/skills/cfn-redis-coordination/agent-log.sh +4 -0
- package/claude-assets/skills/cfn-redis-coordination/agent-log.sh.bak +124 -0
- package/claude-assets/skills/cfn-redis-coordination/agent-recovery.sh +2 -2
- package/claude-assets/skills/cfn-redis-coordination/collect-confidence-scores.sh +30 -0
- package/claude-assets/skills/cfn-redis-coordination/get-context.sh +33 -0
- package/claude-assets/skills/cfn-redis-coordination/get-success-criteria.sh +54 -0
- package/claude-assets/skills/cfn-redis-coordination/invoke-waiting-mode.sh +3 -0
- package/claude-assets/skills/cfn-redis-coordination/redis-cli-wrapper.sh +24 -3
- package/claude-assets/skills/cfn-redis-coordination/redis-functions.sh +33 -0
- package/claude-assets/skills/cfn-redis-coordination/report-completion.sh +24 -31
- package/claude-assets/skills/cfn-redis-coordination/store-context.sh +4 -0
- package/claude-assets/skills/cfn-redis-coordination/store-success-criteria.sh +85 -0
- package/claude-assets/skills/cfn-redis-coordination/update-all-scripts.sh +67 -0
- package/claude-assets/skills/cfn-skill-loader/SKILL.md +466 -0
- package/claude-assets/skills/cfn-skill-loader/execute.sh +344 -0
- package/claude-assets/skills/cfn-sqlite-memory/ttl-cleanup.sh +17 -25
- package/claude-assets/skills/cfn-task-audit/get-audit-data.sh +42 -21
- package/claude-assets/skills/cfn-task-audit/store-task-audit.sh +17 -10
- package/claude-assets/skills/cfn-test-runner/detect-regressions.sh +17 -14
- package/claude-assets/skills/cfn-test-runner/detect-regressions.sh.backup-1763392821 +55 -0
- package/claude-assets/skills/cfn-test-runner/store-benchmarks.sh +17 -19
- package/claude-assets/skills/cfn-transparency-middleware/test-e2e.sh +15 -0
- package/claude-assets/skills/cfn-transparency-middleware/tests/input-validation.sh +15 -0
- package/claude-assets/skills/cfn-utilities/SKILL.md +237 -0
- package/claude-assets/skills/cfn-utilities/execute.sh +32 -0
- package/claude-assets/skills/cfn-utilities/lib/errors.sh +56 -0
- package/claude-assets/skills/cfn-utilities/lib/file-ops.sh +164 -0
- package/claude-assets/skills/cfn-utilities/lib/logging.sh +77 -0
- package/claude-assets/skills/cfn-utilities/lib/retry.sh +127 -0
- package/claude-assets/skills/cfn-utilities/test.sh +317 -0
- package/claude-assets/skills/integration/agent-handoff.sh +62 -64
- package/claude-assets/skills/json-validation/SKILL.md +431 -0
- package/claude-assets/skills/json-validation/test-validate-success-criteria.sh +421 -0
- package/claude-assets/skills/json-validation/validate-success-criteria.sh +197 -0
- package/claude-assets/skills/redis-coordination/validate-parameters.sh +34 -0
- package/claude-assets/skills/workflow-codification/DEPLOY_QUICK_REFERENCE.md +106 -0
- package/claude-assets/skills/workflow-codification/PROPAGATE_UPDATE_QUICK_REFERENCE.md +366 -0
- package/claude-assets/skills/workflow-codification/deploy-approved-skill.sh +481 -0
- package/claude-assets/skills/workflow-codification/deploy-approved-skill.sh.backup-1763392820 +512 -0
- package/claude-assets/skills/workflow-codification/lib/security-utils.sh +204 -0
- package/claude-assets/skills/workflow-codification/propagate-skill-update.sh +648 -0
- package/claude-assets/skills/workflow-codification/propagate-skill-update.sh.backup-1763392820 +664 -0
- package/claude-assets/skills/workflow-codification/test-integration.sh +15 -0
- package/claude-assets/skills/workflow-codification/test-metadata-update.sh +350 -0
- package/claude-assets/skills/workflow-codification/track-cost-savings.sh +55 -14
- package/claude-assets/skills/workflow-codification/track-cost-savings.sh.backup-1763392821 +445 -0
- package/claude-assets/skills/workflow-codification/track-edge-case.sh +27 -60
- package/claude-assets/skills/workflow-codification/workflow-codification.db +0 -0
- package/dist/ace/ace-curator.js +10 -2
- package/dist/ace/ace-curator.js.map +1 -1
- package/dist/ace/ace-generator.js +4 -0
- package/dist/ace/ace-generator.js.map +1 -1
- package/dist/ace/ace-reflector.js +1 -1
- package/dist/ace/ace-reflector.js.map +1 -1
- package/dist/ace/context-injection.js +24 -2
- package/dist/ace/context-injection.js.map +1 -1
- package/dist/agents/agent-loader.js +146 -165
- package/dist/agents/agent-loader.js.map +1 -1
- package/dist/agents/task-agent-integration.js +1 -1
- package/dist/agents/task-agent-integration.js.map +1 -1
- package/dist/api/health-endpoints.js +390 -0
- package/dist/api/health-endpoints.js.map +1 -0
- package/dist/cli/agent-executor.js +4 -1
- package/dist/cli/agent-executor.js.map +1 -1
- package/dist/cli/agent-prompt-builder.js +89 -1
- package/dist/cli/agent-prompt-builder.js.map +1 -1
- package/dist/cli/agent-spawn.js +130 -37
- package/dist/cli/agent-spawn.js.map +1 -1
- package/dist/cli/skill-cache-validator.js +412 -0
- package/dist/cli/skill-cache-validator.js.map +1 -0
- package/dist/cli/skill-cli.js +991 -0
- package/dist/cli/skill-cli.js.map +1 -0
- package/dist/cli/skill-execution-logger.js +284 -0
- package/dist/cli/skill-execution-logger.js.map +1 -0
- package/dist/cli/skill-loader.js +457 -0
- package/dist/cli/skill-loader.js.map +1 -0
- package/dist/coordination/event-bus.js +2 -2
- package/dist/coordination/event-bus.js.map +1 -1
- package/dist/coordination/fleet-manager.js +1 -1
- package/dist/coordination/fleet-manager.js.map +1 -1
- package/dist/coordination/index.js +23 -9
- package/dist/coordination/index.js.map +1 -1
- package/dist/coordination/types/fleet-manager.types.js.map +1 -1
- package/dist/db/migration-manager.js +483 -0
- package/dist/db/migration-manager.js.map +1 -0
- package/dist/db/skills-query.js +535 -0
- package/dist/db/skills-query.js.map +1 -0
- package/dist/integration/DatabaseHandoff.js +1 -1
- package/dist/integration/DatabaseHandoff.js.map +1 -1
- package/dist/jobs/edge-case-analyzer.js +367 -0
- package/dist/jobs/edge-case-analyzer.js.map +1 -0
- package/dist/jobs/promotion-sla-enforcer.js +288 -0
- package/dist/jobs/promotion-sla-enforcer.js.map +1 -0
- package/dist/lib/agent-output-parser.js.map +1 -1
- package/dist/lib/agent-output-validator.js.map +1 -1
- package/dist/lib/agent-workspace.js +281 -0
- package/dist/lib/agent-workspace.js.map +1 -0
- package/dist/lib/atomic-file-writer.js +377 -0
- package/dist/lib/atomic-file-writer.js.map +1 -0
- package/dist/lib/backup-manager.js +779 -0
- package/dist/lib/backup-manager.js.map +1 -0
- package/dist/lib/checkpoint-manager.js +837 -0
- package/dist/lib/checkpoint-manager.js.map +1 -0
- package/dist/lib/circuit-breaker.js +340 -0
- package/dist/lib/circuit-breaker.js.map +1 -0
- package/dist/lib/completion-signal-handler.js +243 -0
- package/dist/lib/completion-signal-handler.js.map +1 -0
- package/dist/lib/config-manager.js +312 -0
- package/dist/lib/config-manager.js.map +1 -0
- package/dist/lib/config-migrator.js +386 -0
- package/dist/lib/config-migrator.js.map +1 -0
- package/dist/lib/config-validator.js.map +1 -1
- package/dist/lib/correlation-cache.js +311 -0
- package/dist/lib/correlation-cache.js.map +1 -0
- package/dist/lib/correlation.js +263 -0
- package/dist/lib/correlation.js.map +1 -0
- package/dist/lib/database-service/connection-pool-manager.js +520 -0
- package/dist/lib/database-service/connection-pool-manager.js.map +1 -0
- package/dist/lib/database-service/correlation.js +329 -0
- package/dist/lib/database-service/correlation.js.map +1 -0
- package/dist/lib/database-service/errors.js +120 -0
- package/dist/lib/database-service/errors.js.map +1 -0
- package/dist/lib/database-service/index.js +168 -0
- package/dist/lib/database-service/index.js.map +1 -0
- package/dist/lib/database-service/postgres-adapter.js +526 -0
- package/dist/lib/database-service/postgres-adapter.js.map +1 -0
- package/dist/lib/database-service/redis-adapter.js +360 -0
- package/dist/lib/database-service/redis-adapter.js.map +1 -0
- package/dist/lib/database-service/sqlite-adapter.js +544 -0
- package/dist/lib/database-service/sqlite-adapter.js.map +1 -0
- package/dist/lib/database-service/transaction-manager.js +773 -0
- package/dist/lib/database-service/transaction-manager.js.map +1 -0
- package/dist/lib/database-service/types.js +23 -0
- package/dist/lib/database-service/types.js.map +1 -0
- package/dist/lib/deadlock-resolver.js +292 -0
- package/dist/lib/deadlock-resolver.js.map +1 -0
- package/dist/lib/distributed-lock.js +451 -0
- package/dist/lib/distributed-lock.js.map +1 -0
- package/dist/lib/edge-case-deduplicator.js +227 -0
- package/dist/lib/edge-case-deduplicator.js.map +1 -0
- package/dist/lib/encryption-manager.js +322 -0
- package/dist/lib/encryption-manager.js.map +1 -0
- package/dist/lib/error-aggregator.js +234 -0
- package/dist/lib/error-aggregator.js.map +1 -0
- package/dist/lib/errors.js +287 -0
- package/dist/lib/errors.js.map +1 -0
- package/dist/lib/file-lock-manager.js +578 -0
- package/dist/lib/file-lock-manager.js.map +1 -0
- package/dist/lib/file-operations.js +367 -0
- package/dist/lib/file-operations.js.map +1 -0
- package/dist/lib/idempotent-write.js +237 -0
- package/dist/lib/idempotent-write.js.map +1 -0
- package/dist/lib/integration-schema-validator.js +522 -0
- package/dist/lib/integration-schema-validator.js.map +1 -0
- package/dist/lib/lock-health-monitor.js +298 -0
- package/dist/lib/lock-health-monitor.js.map +1 -0
- package/dist/lib/log-shipper.js +422 -0
- package/dist/lib/log-shipper.js.map +1 -0
- package/dist/lib/logging.js +146 -0
- package/dist/lib/logging.js.map +1 -0
- package/dist/lib/message-deduplicator.js +439 -0
- package/dist/lib/message-deduplicator.js.map +1 -0
- package/dist/lib/multi-system-query.js +604 -0
- package/dist/lib/multi-system-query.js.map +1 -0
- package/dist/lib/orphan-detector.js +332 -0
- package/dist/lib/orphan-detector.js.map +1 -0
- package/dist/lib/password-generator.js +166 -0
- package/dist/lib/password-generator.js.map +1 -0
- package/dist/lib/path-validator.js +429 -0
- package/dist/lib/path-validator.js.map +1 -0
- package/dist/lib/query-translator.js +905 -0
- package/dist/lib/query-translator.js.map +1 -0
- package/dist/lib/queue-recovery.js +469 -0
- package/dist/lib/queue-recovery.js.map +1 -0
- package/dist/lib/redis-queue-manager.js +512 -0
- package/dist/lib/redis-queue-manager.js.map +1 -0
- package/dist/lib/reflection-archiver.js +272 -0
- package/dist/lib/reflection-archiver.js.map +1 -0
- package/dist/lib/retry-manager.js +453 -0
- package/dist/lib/retry-manager.js.map +1 -0
- package/dist/lib/retry.js +262 -0
- package/dist/lib/retry.js.map +1 -0
- package/dist/lib/schema-transform.js +695 -0
- package/dist/lib/schema-transform.js.map +1 -0
- package/dist/lib/schema-validator.js +491 -0
- package/dist/lib/schema-validator.js.map +1 -0
- package/dist/lib/skill-cache.js +297 -0
- package/dist/lib/skill-cache.js.map +1 -0
- package/dist/lib/skill-content-manager.js +337 -0
- package/dist/lib/skill-content-manager.js.map +1 -0
- package/dist/lib/skill-frontmatter-parser.js +237 -0
- package/dist/lib/skill-frontmatter-parser.js.map +1 -0
- package/dist/lib/skill-git-integration.js +275 -0
- package/dist/lib/skill-git-integration.js.map +1 -0
- package/dist/lib/skill-markdown-validator.js +396 -0
- package/dist/lib/skill-markdown-validator.js.map +1 -0
- package/dist/lib/skill-output-parser.js +312 -0
- package/dist/lib/skill-output-parser.js.map +1 -0
- package/dist/lib/unified-query-api.js +467 -0
- package/dist/lib/unified-query-api.js.map +1 -0
- package/dist/middleware/auth-middleware.js +350 -0
- package/dist/middleware/auth-middleware.js.map +1 -0
- package/dist/middleware/schema-validation.js +347 -0
- package/dist/middleware/schema-validation.js.map +1 -0
- package/dist/providers/anthropic-provider.js +1 -1
- package/dist/providers/anthropic-provider.js.map +1 -1
- package/dist/providers/provider-factory.js +2 -2
- package/dist/providers/provider-factory.js.map +1 -1
- package/dist/services/edge-case-analyzer.js +321 -0
- package/dist/services/edge-case-analyzer.js.map +1 -0
- package/dist/services/edge-case-deduplicator.js +266 -0
- package/dist/services/edge-case-deduplicator.js.map +1 -0
- package/dist/services/edge-case-detector.js +337 -0
- package/dist/services/edge-case-detector.js.map +1 -0
- package/dist/services/edge-case-tracker.js +547 -0
- package/dist/services/edge-case-tracker.js.map +1 -0
- package/dist/services/health-check-system.js +586 -0
- package/dist/services/health-check-system.js.map +1 -0
- package/dist/services/metrics-logger.js +412 -0
- package/dist/services/metrics-logger.js.map +1 -0
- package/dist/services/patch-generator.js +378 -0
- package/dist/services/patch-generator.js.map +1 -0
- package/dist/services/patch-validator.js +337 -0
- package/dist/services/patch-validator.js.map +1 -0
- package/dist/services/performance-monitor.js +811 -0
- package/dist/services/performance-monitor.js.map +1 -0
- package/dist/services/promotion-pipeline.js +918 -0
- package/dist/services/promotion-pipeline.js.map +1 -0
- package/dist/services/promotion-validator.js +394 -0
- package/dist/services/promotion-validator.js.map +1 -0
- package/dist/services/reflection-logger.js +388 -0
- package/dist/services/reflection-logger.js.map +1 -0
- package/dist/services/skill-deployment.js +472 -0
- package/dist/services/skill-deployment.js.map +1 -0
- package/dist/services/skill-loader.js +427 -0
- package/dist/services/skill-loader.js.map +1 -0
- package/dist/services/skill-promotion.js +372 -0
- package/dist/services/skill-promotion.js.map +1 -0
- package/dist/services/skill-validator.js +454 -0
- package/dist/services/skill-validator.js.map +1 -0
- package/dist/services/skill-versioning.js +244 -0
- package/dist/services/skill-versioning.js.map +1 -0
- package/dist/services/workspace-supervisor.js +597 -0
- package/dist/services/workspace-supervisor.js.map +1 -0
- package/dist/types/edge-case.js +45 -0
- package/dist/types/edge-case.js.map +1 -0
- package/package.json +201 -177
- package/readme/README.md +19 -4
- package/scripts/backup-cleanup.sh +627 -0
- package/scripts/cleanup-workspaces.sh +412 -0
- package/scripts/cleanup-yaml-configs.sh +141 -0
- package/scripts/deploy-approved-skills.sh +263 -0
- package/scripts/health-check.sh +447 -0
- package/scripts/log-aggregator.sh +554 -0
- package/scripts/log-monitor.sh +629 -0
- package/scripts/manage-agent-workspaces.sh +434 -0
- package/scripts/migrate-schema.sh +533 -0
- package/scripts/promote-staged-skills.sh +423 -0
- package/scripts/verify-no-secrets.sh +88 -35
- package/.claude/cfn-extras/agents/deprecated-coordinators/adaptive-coordinator.md.backup +0 -161
- package/.claude/cfn-extras/agents/deprecated-coordinators/blocking-coordinator-example.md.backup +0 -728
- package/.claude/cfn-extras/agents/deprecated-coordinators/mesh-coordinator.md.backup +0 -131
- package/.claude/skills/agent-lifecycle/SKILL.md +0 -60
- package/.claude/skills/agent-lifecycle/execute-lifecycle-hook.sh +0 -573
- package/.claude/skills/agent-lifecycle/simple-audit.sh +0 -31
- package/.claude/skills/cfn-agent-spawning/spawn-agent.sh.backup +0 -273
- package/.claude/skills/cfn-loop-orchestration/orchestrate.sh.backup +0 -949
- package/README.md.backup_before_replace +0 -781
- package/claude-assets/cfn-extras/agents/deprecated-coordinators/adaptive-coordinator.md.backup +0 -161
- package/claude-assets/cfn-extras/agents/deprecated-coordinators/blocking-coordinator-example.md.backup +0 -728
- package/claude-assets/cfn-extras/agents/deprecated-coordinators/mesh-coordinator.md.backup +0 -131
- package/claude-assets/skills/cfn-agent-spawning/spawn-agent.sh.backup +0 -273
- package/claude-assets/skills/cfn-loop-orchestration/orchestrate.sh.backup +0 -949
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Retry logic with exponential backoff for CFN system
|
|
3
|
+
|
|
4
|
+
# Source logging if not already loaded
|
|
5
|
+
if ! declare -f log_info >/dev/null 2>&1; then
|
|
6
|
+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
7
|
+
source "$SCRIPT_DIR/logging.sh"
|
|
8
|
+
fi
|
|
9
|
+
|
|
10
|
+
# Retry command with exponential backoff
|
|
11
|
+
# Usage: retry_with_backoff max_attempts base_delay_sec command [args...]
|
|
12
|
+
# Example: retry_with_backoff 3 2 curl -f https://api.example.com
|
|
13
|
+
retry_with_backoff() {
|
|
14
|
+
local max_attempts="${1:-3}"
|
|
15
|
+
local base_delay="${2:-2}"
|
|
16
|
+
shift 2
|
|
17
|
+
local command=("$@")
|
|
18
|
+
|
|
19
|
+
local attempt=1
|
|
20
|
+
local delay=$base_delay
|
|
21
|
+
|
|
22
|
+
while [ $attempt -le "$max_attempts" ]; do
|
|
23
|
+
log_debug "Attempt $attempt/$max_attempts: ${command[*]}" "{\"attempt\":$attempt,\"max\":$max_attempts}"
|
|
24
|
+
|
|
25
|
+
# Execute command and capture exit code immediately
|
|
26
|
+
"${command[@]}"
|
|
27
|
+
local exit_code=$?
|
|
28
|
+
|
|
29
|
+
# Check if command succeeded
|
|
30
|
+
if [ $exit_code -eq 0 ]; then
|
|
31
|
+
if [ $attempt -gt 1 ]; then
|
|
32
|
+
log_info "Command succeeded after retries" "{\"attempts\":$attempt,\"command\":\"${command[0]}\"}"
|
|
33
|
+
fi
|
|
34
|
+
return 0
|
|
35
|
+
fi
|
|
36
|
+
|
|
37
|
+
# Last attempt failed
|
|
38
|
+
if [ $attempt -eq "$max_attempts" ]; then
|
|
39
|
+
log_error "Command failed after $max_attempts attempts" "{\"command\":\"${command[0]}\",\"exit_code\":$exit_code}"
|
|
40
|
+
return $exit_code
|
|
41
|
+
fi
|
|
42
|
+
|
|
43
|
+
# Calculate next delay (exponential backoff: delay = base * 2^(attempt-1))
|
|
44
|
+
log_warn "Command failed, retrying in ${delay}s" "{\"attempt\":$attempt,\"delay\":$delay,\"exit_code\":$exit_code}"
|
|
45
|
+
sleep "$delay"
|
|
46
|
+
|
|
47
|
+
attempt=$((attempt + 1))
|
|
48
|
+
delay=$((delay * 2))
|
|
49
|
+
done
|
|
50
|
+
|
|
51
|
+
return 1
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
# Retry with fixed delay (no exponential backoff)
|
|
55
|
+
# Usage: retry_fixed max_attempts delay_sec command [args...]
|
|
56
|
+
retry_fixed() {
|
|
57
|
+
local max_attempts="${1:-3}"
|
|
58
|
+
local delay="${2:-2}"
|
|
59
|
+
shift 2
|
|
60
|
+
local command=("$@")
|
|
61
|
+
|
|
62
|
+
local attempt=1
|
|
63
|
+
|
|
64
|
+
while [ $attempt -le "$max_attempts" ]; do
|
|
65
|
+
log_debug "Attempt $attempt/$max_attempts: ${command[*]}" "{\"attempt\":$attempt}"
|
|
66
|
+
|
|
67
|
+
"${command[@]}"
|
|
68
|
+
local exit_code=$?
|
|
69
|
+
|
|
70
|
+
if [ $exit_code -eq 0 ]; then
|
|
71
|
+
return 0
|
|
72
|
+
fi
|
|
73
|
+
|
|
74
|
+
if [ $attempt -eq "$max_attempts" ]; then
|
|
75
|
+
log_error "Command failed after $max_attempts attempts" "{\"command\":\"${command[0]}\",\"exit_code\":$exit_code}"
|
|
76
|
+
return $exit_code
|
|
77
|
+
fi
|
|
78
|
+
|
|
79
|
+
log_warn "Command failed, retrying in ${delay}s" "{\"attempt\":$attempt,\"delay\":$delay}"
|
|
80
|
+
sleep "$delay"
|
|
81
|
+
|
|
82
|
+
attempt=$((attempt + 1))
|
|
83
|
+
done
|
|
84
|
+
|
|
85
|
+
return 1
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
# Retry until timeout (wall-clock timeout instead of attempt count)
|
|
89
|
+
# Usage: retry_until_timeout timeout_sec delay_sec command [args...]
|
|
90
|
+
retry_until_timeout() {
|
|
91
|
+
local timeout_sec="${1:-60}"
|
|
92
|
+
local delay="${2:-2}"
|
|
93
|
+
shift 2
|
|
94
|
+
local command=("$@")
|
|
95
|
+
|
|
96
|
+
local start_time
|
|
97
|
+
start_time=$(date +%s)
|
|
98
|
+
local end_time=$((start_time + timeout_sec))
|
|
99
|
+
|
|
100
|
+
local attempt=1
|
|
101
|
+
|
|
102
|
+
while [ "$(date +%s)" -lt "$end_time" ]; do
|
|
103
|
+
log_debug "Attempt $attempt (timeout in $((end_time - $(date +%s)))s): ${command[*]}" "{\"attempt\":$attempt}"
|
|
104
|
+
|
|
105
|
+
"${command[@]}"
|
|
106
|
+
local exit_code=$?
|
|
107
|
+
|
|
108
|
+
if [ $exit_code -eq 0 ]; then
|
|
109
|
+
return 0
|
|
110
|
+
fi
|
|
111
|
+
|
|
112
|
+
local current_time
|
|
113
|
+
current_time=$(date +%s)
|
|
114
|
+
|
|
115
|
+
if [ "$current_time" -ge "$end_time" ]; then
|
|
116
|
+
log_error "Command timed out after ${timeout_sec}s" "{\"command\":\"${command[0]}\",\"attempts\":$attempt,\"exit_code\":$exit_code}"
|
|
117
|
+
return 130 # Timeout exit code
|
|
118
|
+
fi
|
|
119
|
+
|
|
120
|
+
log_warn "Command failed, retrying in ${delay}s" "{\"attempt\":$attempt,\"remaining_time\":$((end_time - current_time))}"
|
|
121
|
+
sleep "$delay"
|
|
122
|
+
|
|
123
|
+
attempt=$((attempt + 1))
|
|
124
|
+
done
|
|
125
|
+
|
|
126
|
+
return 130
|
|
127
|
+
}
|
|
@@ -0,0 +1,317 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# CFN Utilities Test Suite
|
|
3
|
+
# Tests all utility functions in lib/
|
|
4
|
+
|
|
5
|
+
set -euo pipefail
|
|
6
|
+
|
|
7
|
+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
8
|
+
source "$SCRIPT_DIR/execute.sh"
|
|
9
|
+
|
|
10
|
+
# Test counters
|
|
11
|
+
TESTS_RUN=0
|
|
12
|
+
TESTS_PASSED=0
|
|
13
|
+
TESTS_FAILED=0
|
|
14
|
+
|
|
15
|
+
# Test result helpers
|
|
16
|
+
pass() {
|
|
17
|
+
echo "PASS: $1"
|
|
18
|
+
TESTS_PASSED=$((TESTS_PASSED + 1))
|
|
19
|
+
TESTS_RUN=$((TESTS_RUN + 1))
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
fail() {
|
|
23
|
+
echo "FAIL: $1"
|
|
24
|
+
TESTS_FAILED=$((TESTS_FAILED + 1))
|
|
25
|
+
TESTS_RUN=$((TESTS_RUN + 1))
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
assert_equals() {
|
|
29
|
+
local expected="$1"
|
|
30
|
+
local actual="$2"
|
|
31
|
+
local test_name="$3"
|
|
32
|
+
|
|
33
|
+
if [ "$expected" = "$actual" ]; then
|
|
34
|
+
pass "$test_name"
|
|
35
|
+
else
|
|
36
|
+
fail "$test_name (expected: '$expected', got: '$actual')"
|
|
37
|
+
fi
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
assert_contains() {
|
|
41
|
+
local haystack="$1"
|
|
42
|
+
local needle="$2"
|
|
43
|
+
local test_name="$3"
|
|
44
|
+
|
|
45
|
+
if [[ "$haystack" == *"$needle"* ]]; then
|
|
46
|
+
pass "$test_name"
|
|
47
|
+
else
|
|
48
|
+
fail "$test_name (string '$needle' not found in output)"
|
|
49
|
+
fi
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
assert_success() {
|
|
53
|
+
local test_name="$1"
|
|
54
|
+
pass "$test_name"
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
assert_failure() {
|
|
58
|
+
local test_name="$1"
|
|
59
|
+
fail "$test_name"
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
# Cleanup temporary test files
|
|
63
|
+
cleanup() {
|
|
64
|
+
rm -f /tmp/cfn-test-*
|
|
65
|
+
}
|
|
66
|
+
trap cleanup EXIT
|
|
67
|
+
|
|
68
|
+
echo "=== CFN Utilities Test Suite ==="
|
|
69
|
+
echo ""
|
|
70
|
+
|
|
71
|
+
# ===== LOGGING TESTS =====
|
|
72
|
+
echo "--- Testing Logging Functions ---"
|
|
73
|
+
|
|
74
|
+
# Test: log_json outputs valid JSON
|
|
75
|
+
output=$(log_json "info" "test message" '{"key":"value"}' 2>&1)
|
|
76
|
+
if echo "$output" | grep -q '"timestamp"' && echo "$output" | grep -q '"level":"info"' && echo "$output" | grep -q '"message":"test message"'; then
|
|
77
|
+
pass "log_json outputs valid JSON structure"
|
|
78
|
+
else
|
|
79
|
+
fail "log_json output invalid: $output"
|
|
80
|
+
fi
|
|
81
|
+
|
|
82
|
+
# Test: log_info outputs to stderr
|
|
83
|
+
output=$(log_info "info test" '{}' 2>&1 >/dev/null)
|
|
84
|
+
if echo "$output" | grep -q '"level":"info"'; then
|
|
85
|
+
pass "log_info outputs to stderr"
|
|
86
|
+
else
|
|
87
|
+
fail "log_info output incorrect"
|
|
88
|
+
fi
|
|
89
|
+
|
|
90
|
+
# Test: log_error includes error level
|
|
91
|
+
output=$(log_error "error test" '{"code":"E001"}' 2>&1)
|
|
92
|
+
if echo "$output" | grep -q '"level":"error"' && echo "$output" | grep -q 'E001'; then
|
|
93
|
+
pass "log_error includes error level and context"
|
|
94
|
+
else
|
|
95
|
+
fail "log_error output incorrect"
|
|
96
|
+
fi
|
|
97
|
+
|
|
98
|
+
# Test: log_debug respects LOG_LEVEL
|
|
99
|
+
LOG_LEVEL=info
|
|
100
|
+
output=$(log_debug "debug test" '{}' 2>&1)
|
|
101
|
+
if [ -z "$output" ]; then
|
|
102
|
+
pass "log_debug respects LOG_LEVEL=info (no output)"
|
|
103
|
+
else
|
|
104
|
+
fail "log_debug should not output when LOG_LEVEL=info"
|
|
105
|
+
fi
|
|
106
|
+
|
|
107
|
+
LOG_LEVEL=debug
|
|
108
|
+
output=$(log_debug "debug test" '{}' 2>&1)
|
|
109
|
+
if echo "$output" | grep -q '"level":"debug"'; then
|
|
110
|
+
pass "log_debug outputs when LOG_LEVEL=debug"
|
|
111
|
+
else
|
|
112
|
+
fail "log_debug should output when LOG_LEVEL=debug"
|
|
113
|
+
fi
|
|
114
|
+
|
|
115
|
+
# Test: generate_correlation_id produces output
|
|
116
|
+
corr_id=$(generate_correlation_id)
|
|
117
|
+
if [ -n "$corr_id" ]; then
|
|
118
|
+
pass "generate_correlation_id produces non-empty ID"
|
|
119
|
+
else
|
|
120
|
+
fail "generate_correlation_id produced empty ID"
|
|
121
|
+
fi
|
|
122
|
+
|
|
123
|
+
# ===== ERROR HANDLING TESTS =====
|
|
124
|
+
echo ""
|
|
125
|
+
echo "--- Testing Error Handling Functions ---"
|
|
126
|
+
|
|
127
|
+
# Test: error_handle returns error code
|
|
128
|
+
if error_handle "test error" '{}' 2>/dev/null; then
|
|
129
|
+
fail "error_handle should return non-zero exit code"
|
|
130
|
+
else
|
|
131
|
+
pass "error_handle returns non-zero exit code"
|
|
132
|
+
fi
|
|
133
|
+
|
|
134
|
+
# Test: is_error_code detects specific codes
|
|
135
|
+
EXITCODE=7
|
|
136
|
+
if is_error_code $EXITCODE 7; then
|
|
137
|
+
pass "is_error_code detects correct exit code"
|
|
138
|
+
else
|
|
139
|
+
fail "is_error_code should detect exit code 7"
|
|
140
|
+
fi
|
|
141
|
+
|
|
142
|
+
# Test: get_error_context returns JSON structure
|
|
143
|
+
test_exit_42() { return 42; }
|
|
144
|
+
test_exit_42 || true
|
|
145
|
+
context=$(get_error_context)
|
|
146
|
+
if echo "$context" | grep -q '"exit_code"' && echo "$context" | grep -q '"line"'; then
|
|
147
|
+
pass "get_error_context returns JSON structure"
|
|
148
|
+
else
|
|
149
|
+
fail "get_error_context output invalid: $context"
|
|
150
|
+
fi
|
|
151
|
+
|
|
152
|
+
# ===== RETRY TESTS =====
|
|
153
|
+
echo ""
|
|
154
|
+
echo "--- Testing Retry Functions ---"
|
|
155
|
+
|
|
156
|
+
# Test: retry_with_backoff succeeds on first try
|
|
157
|
+
counter=0
|
|
158
|
+
test_command() {
|
|
159
|
+
counter=$((counter + 1))
|
|
160
|
+
return 0
|
|
161
|
+
}
|
|
162
|
+
if retry_with_backoff 3 1 test_command 2>/dev/null; then
|
|
163
|
+
pass "retry_with_backoff succeeds immediately"
|
|
164
|
+
else
|
|
165
|
+
fail "retry_with_backoff should succeed"
|
|
166
|
+
fi
|
|
167
|
+
|
|
168
|
+
# Test: retry_with_backoff retries on failure
|
|
169
|
+
attempt_count=0
|
|
170
|
+
failing_command() {
|
|
171
|
+
attempt_count=$((attempt_count + 1))
|
|
172
|
+
[ $attempt_count -ge 3 ]
|
|
173
|
+
}
|
|
174
|
+
if retry_with_backoff 5 1 failing_command 2>/dev/null; then
|
|
175
|
+
assert_equals "3" "$attempt_count" "retry_with_backoff retries correct number of times"
|
|
176
|
+
else
|
|
177
|
+
fail "retry_with_backoff should eventually succeed"
|
|
178
|
+
fi
|
|
179
|
+
|
|
180
|
+
# Test: retry_with_backoff gives up after max attempts
|
|
181
|
+
always_fail() {
|
|
182
|
+
return 1
|
|
183
|
+
}
|
|
184
|
+
if retry_with_backoff 2 1 always_fail 2>/dev/null; then
|
|
185
|
+
fail "retry_with_backoff should fail after max attempts"
|
|
186
|
+
else
|
|
187
|
+
pass "retry_with_backoff gives up after max attempts"
|
|
188
|
+
fi
|
|
189
|
+
|
|
190
|
+
# Test: retry_fixed uses fixed delay
|
|
191
|
+
fixed_count=0
|
|
192
|
+
fixed_test() {
|
|
193
|
+
fixed_count=$((fixed_count + 1))
|
|
194
|
+
[ $fixed_count -ge 2 ]
|
|
195
|
+
}
|
|
196
|
+
if retry_fixed 3 1 fixed_test 2>/dev/null; then
|
|
197
|
+
pass "retry_fixed works with fixed delay"
|
|
198
|
+
else
|
|
199
|
+
fail "retry_fixed should succeed"
|
|
200
|
+
fi
|
|
201
|
+
|
|
202
|
+
# ===== FILE OPERATIONS TESTS =====
|
|
203
|
+
echo ""
|
|
204
|
+
echo "--- Testing File Operations ---"
|
|
205
|
+
|
|
206
|
+
# Test: atomic_write creates file
|
|
207
|
+
test_file="/tmp/cfn-test-atomic-$$"
|
|
208
|
+
if atomic_write "$test_file" "test content" 2>/dev/null; then
|
|
209
|
+
if [ -f "$test_file" ] && [ "$(cat "$test_file")" = "test content" ]; then
|
|
210
|
+
pass "atomic_write creates file with correct content"
|
|
211
|
+
else
|
|
212
|
+
fail "atomic_write file content incorrect"
|
|
213
|
+
fi
|
|
214
|
+
else
|
|
215
|
+
fail "atomic_write failed"
|
|
216
|
+
fi
|
|
217
|
+
|
|
218
|
+
# Test: atomic_write is actually atomic (no .tmp files left)
|
|
219
|
+
test_file2="/tmp/cfn-test-atomic2-$$"
|
|
220
|
+
atomic_write "$test_file2" "content" 2>/dev/null
|
|
221
|
+
if ! ls /tmp/cfn-test-atomic2-$$.tmp* 2>/dev/null; then
|
|
222
|
+
pass "atomic_write cleans up temporary files"
|
|
223
|
+
else
|
|
224
|
+
fail "atomic_write left temporary files"
|
|
225
|
+
fi
|
|
226
|
+
|
|
227
|
+
# Test: acquire_lock creates lock file
|
|
228
|
+
lock_file="/tmp/cfn-test-lock-$$"
|
|
229
|
+
if acquire_lock "$lock_file" 5 2>/dev/null; then
|
|
230
|
+
if [ -f "$lock_file" ] && [ "$(cat "$lock_file")" = "$$" ]; then
|
|
231
|
+
pass "acquire_lock creates lock file with PID"
|
|
232
|
+
release_lock "$lock_file" 2>/dev/null
|
|
233
|
+
else
|
|
234
|
+
fail "acquire_lock file content incorrect"
|
|
235
|
+
release_lock "$lock_file" 2>/dev/null
|
|
236
|
+
fi
|
|
237
|
+
else
|
|
238
|
+
fail "acquire_lock failed"
|
|
239
|
+
fi
|
|
240
|
+
|
|
241
|
+
# Test: acquire_lock blocks concurrent access
|
|
242
|
+
lock_file2="/tmp/cfn-test-lock2-$$"
|
|
243
|
+
acquire_lock "$lock_file2" 30 2>/dev/null
|
|
244
|
+
if acquire_lock "$lock_file2" 1 2>/dev/null; then
|
|
245
|
+
fail "acquire_lock should block when lock is held"
|
|
246
|
+
release_lock "$lock_file2" 2>/dev/null
|
|
247
|
+
else
|
|
248
|
+
pass "acquire_lock blocks concurrent access"
|
|
249
|
+
release_lock "$lock_file2" 2>/dev/null
|
|
250
|
+
fi
|
|
251
|
+
|
|
252
|
+
# Test: release_lock removes lock file
|
|
253
|
+
lock_file3="/tmp/cfn-test-lock3-$$"
|
|
254
|
+
acquire_lock "$lock_file3" 5 2>/dev/null
|
|
255
|
+
if release_lock "$lock_file3" 2>/dev/null; then
|
|
256
|
+
if [ ! -f "$lock_file3" ]; then
|
|
257
|
+
pass "release_lock removes lock file"
|
|
258
|
+
else
|
|
259
|
+
fail "release_lock did not remove lock file"
|
|
260
|
+
fi
|
|
261
|
+
else
|
|
262
|
+
fail "release_lock failed"
|
|
263
|
+
fi
|
|
264
|
+
|
|
265
|
+
# Test: with_lock executes command with lock
|
|
266
|
+
lock_file4="/tmp/cfn-test-lock4-$$"
|
|
267
|
+
output_file="/tmp/cfn-test-output-$$"
|
|
268
|
+
if with_lock "$lock_file4" 5 bash -c "echo 'locked' > $output_file" 2>/dev/null; then
|
|
269
|
+
if [ -f "$output_file" ] && [ "$(cat "$output_file")" = "locked" ]; then
|
|
270
|
+
pass "with_lock executes command successfully"
|
|
271
|
+
else
|
|
272
|
+
fail "with_lock command did not execute correctly"
|
|
273
|
+
fi
|
|
274
|
+
else
|
|
275
|
+
fail "with_lock failed"
|
|
276
|
+
fi
|
|
277
|
+
|
|
278
|
+
# Test: with_lock releases lock after execution
|
|
279
|
+
if [ -f "$lock_file4" ]; then
|
|
280
|
+
fail "with_lock did not release lock after execution"
|
|
281
|
+
else
|
|
282
|
+
pass "with_lock releases lock after execution"
|
|
283
|
+
fi
|
|
284
|
+
|
|
285
|
+
# Test: is_locked detects active locks
|
|
286
|
+
lock_file5="/tmp/cfn-test-lock5-$$"
|
|
287
|
+
acquire_lock "$lock_file5" 5 2>/dev/null
|
|
288
|
+
if is_locked "$lock_file5"; then
|
|
289
|
+
pass "is_locked detects active lock"
|
|
290
|
+
else
|
|
291
|
+
fail "is_locked should detect active lock"
|
|
292
|
+
fi
|
|
293
|
+
release_lock "$lock_file5" 2>/dev/null
|
|
294
|
+
|
|
295
|
+
# Test: is_locked returns false when no lock
|
|
296
|
+
lock_file6="/tmp/cfn-test-lock6-$$"
|
|
297
|
+
if is_locked "$lock_file6"; then
|
|
298
|
+
fail "is_locked should return false when no lock exists"
|
|
299
|
+
else
|
|
300
|
+
pass "is_locked returns false when no lock exists"
|
|
301
|
+
fi
|
|
302
|
+
|
|
303
|
+
# ===== SUMMARY =====
|
|
304
|
+
echo ""
|
|
305
|
+
echo "==================================="
|
|
306
|
+
echo "Tests run: $TESTS_RUN"
|
|
307
|
+
echo "Passed: $TESTS_PASSED"
|
|
308
|
+
echo "Failed: $TESTS_FAILED"
|
|
309
|
+
echo "==================================="
|
|
310
|
+
|
|
311
|
+
if [ $TESTS_FAILED -eq 0 ]; then
|
|
312
|
+
echo "All tests passed!"
|
|
313
|
+
exit 0
|
|
314
|
+
else
|
|
315
|
+
echo "Some tests failed!"
|
|
316
|
+
exit 1
|
|
317
|
+
fi
|
|
@@ -16,6 +16,11 @@
|
|
|
16
16
|
|
|
17
17
|
set -euo pipefail
|
|
18
18
|
|
|
19
|
+
# Source parameterized query library for SQL injection prevention
|
|
20
|
+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
21
|
+
PROJECT_ROOT="$(cd "$SCRIPT_DIR/../../.." && pwd)"
|
|
22
|
+
source "$PROJECT_ROOT/.claude/skills/bootstrap/sqlite-params.sh"
|
|
23
|
+
|
|
19
24
|
# Configuration
|
|
20
25
|
AGENT_STATE_DB="${AGENT_STATE_DB:-./.claude/agents/state/agent-state.db}"
|
|
21
26
|
HEARTBEAT_INTERVAL="${HEARTBEAT_INTERVAL:-30}"
|
|
@@ -132,23 +137,15 @@ agent_spawn() {
|
|
|
132
137
|
|
|
133
138
|
log_info "Spawning agent" "{\"agent_id\":\"$agent_id\",\"agent_type\":\"$agent_type\",\"task_id\":\"$task_id\"}"
|
|
134
139
|
|
|
135
|
-
# Register agent in database
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
) VALUES (
|
|
140
|
-
|
|
141
|
-
'$agent_type',
|
|
142
|
-
'$task_id',
|
|
143
|
-
'spawned',
|
|
144
|
-
'$(date -u +"%Y-%m-%dT%H:%M:%SZ")',
|
|
145
|
-
$timeout_seconds,
|
|
146
|
-
'$metadata'
|
|
147
|
-
);
|
|
148
|
-
SQL
|
|
140
|
+
# Register agent in database - using parameterized query
|
|
141
|
+
local spawned_timestamp
|
|
142
|
+
spawned_timestamp=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
|
|
143
|
+
sqlite_insert "$AGENT_STATE_DB" \
|
|
144
|
+
"INSERT INTO agents (agent_id, agent_type, task_id, status, spawned_at, timeout_seconds, metadata) VALUES (?1, ?2, ?3, 'spawned', ?4, ?5, ?6);" \
|
|
145
|
+
"$agent_id" "$agent_type" "$task_id" "$spawned_timestamp" "$timeout_seconds" "$metadata"
|
|
149
146
|
|
|
150
147
|
# Standard agent spawn command (customizable via environment)
|
|
151
|
-
local spawn_cmd="${AGENT_SPAWN_CMD:-
|
|
148
|
+
local spawn_cmd="${AGENT_SPAWN_CMD:-cfn-spawn agent}"
|
|
152
149
|
|
|
153
150
|
# Spawn agent in background (example - replace with actual spawn mechanism)
|
|
154
151
|
(
|
|
@@ -157,10 +154,10 @@ SQL
|
|
|
157
154
|
export TASK_ID="$task_id"
|
|
158
155
|
export AGENT_TYPE="$agent_type"
|
|
159
156
|
|
|
160
|
-
# Update status to running
|
|
161
|
-
|
|
162
|
-
UPDATE agents SET status = 'running', pid =
|
|
163
|
-
|
|
157
|
+
# Update status to running - using parameterized query
|
|
158
|
+
sqlite_update "$AGENT_STATE_DB" \
|
|
159
|
+
"UPDATE agents SET status = 'running', pid = ?1 WHERE agent_id = ?2;" \
|
|
160
|
+
"$$" "$agent_id"
|
|
164
161
|
|
|
165
162
|
# Start heartbeat in background
|
|
166
163
|
agent_heartbeat_loop "$agent_id" "$task_id" &
|
|
@@ -186,10 +183,10 @@ SQL
|
|
|
186
183
|
|
|
187
184
|
local agent_pid=$!
|
|
188
185
|
|
|
189
|
-
# Update PID in database
|
|
190
|
-
|
|
191
|
-
UPDATE agents SET pid =
|
|
192
|
-
|
|
186
|
+
# Update PID in database - using parameterized query
|
|
187
|
+
sqlite_update "$AGENT_STATE_DB" \
|
|
188
|
+
"UPDATE agents SET pid = ?1 WHERE agent_id = ?2;" \
|
|
189
|
+
"$agent_pid" "$agent_id"
|
|
193
190
|
|
|
194
191
|
log_info "Agent spawned successfully" "{\"agent_id\":\"$agent_id\",\"pid\":$agent_pid}"
|
|
195
192
|
|
|
@@ -208,13 +205,13 @@ agent_heartbeat() {
|
|
|
208
205
|
local timestamp
|
|
209
206
|
timestamp=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
|
|
210
207
|
|
|
211
|
-
# Update last heartbeat in agents table
|
|
212
|
-
|
|
213
|
-
UPDATE agents SET last_heartbeat =
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
);
|
|
217
|
-
|
|
208
|
+
# Update last heartbeat in agents table - using parameterized queries
|
|
209
|
+
sqlite_update "$AGENT_STATE_DB" \
|
|
210
|
+
"UPDATE agents SET last_heartbeat = ?1 WHERE agent_id = ?2;" \
|
|
211
|
+
"$timestamp" "$agent_id"
|
|
212
|
+
sqlite_insert "$AGENT_STATE_DB" \
|
|
213
|
+
"INSERT INTO heartbeats (agent_id, task_id, timestamp, metadata) VALUES (?1, ?2, ?3, ?4);" \
|
|
214
|
+
"$agent_id" "$task_id" "$timestamp" "$metadata"
|
|
218
215
|
|
|
219
216
|
log_debug "Heartbeat sent" "{\"agent_id\":\"$agent_id\",\"task_id\":\"$task_id\"}"
|
|
220
217
|
}
|
|
@@ -229,9 +226,9 @@ agent_heartbeat_loop() {
|
|
|
229
226
|
agent_heartbeat "$agent_id" "$task_id" || break
|
|
230
227
|
sleep "$HEARTBEAT_INTERVAL"
|
|
231
228
|
|
|
232
|
-
# Check if agent is still alive
|
|
229
|
+
# Check if agent is still alive - using parameterized query
|
|
233
230
|
local status
|
|
234
|
-
status=$(
|
|
231
|
+
status=$(sqlite_select "$AGENT_STATE_DB" "SELECT status FROM agents WHERE agent_id = ?1;" "$agent_id" || echo "unknown")
|
|
235
232
|
|
|
236
233
|
if [[ "$status" == "completed" ]] || [[ "$status" == "failed" ]] || [[ "$status" == "timeout" ]]; then
|
|
237
234
|
log_debug "Heartbeat loop stopping" "{\"agent_id\":\"$agent_id\",\"status\":\"$status\"}"
|
|
@@ -253,15 +250,10 @@ agent_complete() {
|
|
|
253
250
|
local timestamp
|
|
254
251
|
timestamp=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
|
|
255
252
|
|
|
256
|
-
# Update agent status
|
|
257
|
-
|
|
258
|
-
UPDATE agents SET
|
|
259
|
-
|
|
260
|
-
completed_at = '$timestamp',
|
|
261
|
-
confidence = $confidence,
|
|
262
|
-
result = '$result'
|
|
263
|
-
WHERE agent_id = '$agent_id';
|
|
264
|
-
SQL
|
|
253
|
+
# Update agent status - using parameterized query
|
|
254
|
+
sqlite_update "$AGENT_STATE_DB" \
|
|
255
|
+
"UPDATE agents SET status = 'completed', completed_at = ?1, confidence = ?2, result = ?3 WHERE agent_id = ?4;" \
|
|
256
|
+
"$timestamp" "$confidence" "$result" "$agent_id"
|
|
265
257
|
|
|
266
258
|
log_info "Agent completed" "{\"agent_id\":\"$agent_id\",\"task_id\":\"$task_id\",\"confidence\":$confidence}"
|
|
267
259
|
|
|
@@ -294,14 +286,10 @@ agent_fail() {
|
|
|
294
286
|
EOF
|
|
295
287
|
)
|
|
296
288
|
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
confidence = 0.0,
|
|
302
|
-
result = '$error_result'
|
|
303
|
-
WHERE agent_id = '$agent_id';
|
|
304
|
-
SQL
|
|
289
|
+
# Update agent status for failure - using parameterized query
|
|
290
|
+
sqlite_update "$AGENT_STATE_DB" \
|
|
291
|
+
"UPDATE agents SET status = 'failed', completed_at = ?1, confidence = 0.0, result = ?2 WHERE agent_id = ?3;" \
|
|
292
|
+
"$timestamp" "$error_result" "$agent_id"
|
|
305
293
|
|
|
306
294
|
log_error "Agent failed" "{\"agent_id\":\"$agent_id\",\"task_id\":\"$task_id\",\"error\":\"$error_message\"}"
|
|
307
295
|
}
|
|
@@ -314,8 +302,9 @@ SQL
|
|
|
314
302
|
agent_check_timeout() {
|
|
315
303
|
local agent_id="$1"
|
|
316
304
|
|
|
305
|
+
# Get agent data - using parameterized query
|
|
317
306
|
local agent_data
|
|
318
|
-
agent_data=$(
|
|
307
|
+
agent_data=$(sqlite_select "$AGENT_STATE_DB" "SELECT spawned_at, timeout_seconds, status, pid FROM agents WHERE agent_id = ?1;" "$agent_id" | tr '|' ' ')
|
|
319
308
|
|
|
320
309
|
read -r spawned_at timeout_seconds status pid <<< "$agent_data"
|
|
321
310
|
|
|
@@ -349,14 +338,14 @@ agent_check_timeout() {
|
|
|
349
338
|
fi
|
|
350
339
|
fi
|
|
351
340
|
|
|
352
|
-
# Mark as timeout
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
WHERE agent_id =
|
|
359
|
-
|
|
341
|
+
# Mark as timeout - using parameterized query
|
|
342
|
+
local timeout_timestamp
|
|
343
|
+
timeout_timestamp=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
|
|
344
|
+
local timeout_result
|
|
345
|
+
timeout_result="{\"error\": \"Agent exceeded timeout\", \"elapsed_seconds\": $elapsed}"
|
|
346
|
+
sqlite_update "$AGENT_STATE_DB" \
|
|
347
|
+
"UPDATE agents SET status = 'timeout', completed_at = ?1, result = ?2 WHERE agent_id = ?3;" \
|
|
348
|
+
"$timeout_timestamp" "$timeout_result" "$agent_id"
|
|
360
349
|
|
|
361
350
|
return 1
|
|
362
351
|
fi
|
|
@@ -380,9 +369,9 @@ agent_wait_for_completion() {
|
|
|
380
369
|
start_time=$(date +%s)
|
|
381
370
|
|
|
382
371
|
while true; do
|
|
383
|
-
# Check status
|
|
372
|
+
# Check status - using parameterized query
|
|
384
373
|
local status
|
|
385
|
-
status=$(
|
|
374
|
+
status=$(sqlite_select "$AGENT_STATE_DB" "SELECT status FROM agents WHERE agent_id = ?1;" "$agent_id" || echo "unknown")
|
|
386
375
|
|
|
387
376
|
if [[ "$status" == "completed" ]]; then
|
|
388
377
|
log_info "Agent completed successfully" "{\"agent_id\":\"$agent_id\"}"
|
|
@@ -416,8 +405,11 @@ agent_wait_for_completion() {
|
|
|
416
405
|
agent_get_status() {
|
|
417
406
|
local agent_id="$1"
|
|
418
407
|
|
|
408
|
+
# Get status - using parameterized query (manual JSON mode as sqlite_select doesn't support -json flag)
|
|
419
409
|
local status_json
|
|
420
|
-
status_json=$(sqlite3 -json "$AGENT_STATE_DB" "
|
|
410
|
+
status_json=$(sqlite3 -json "$AGENT_STATE_DB" ".parameter init
|
|
411
|
+
.parameter set ?1 \"$agent_id\"
|
|
412
|
+
SELECT * FROM agents WHERE agent_id = ?1;" | jq '.[0]')
|
|
421
413
|
|
|
422
414
|
echo "$status_json"
|
|
423
415
|
}
|
|
@@ -428,8 +420,11 @@ agent_get_status() {
|
|
|
428
420
|
agent_get_by_task() {
|
|
429
421
|
local task_id="$1"
|
|
430
422
|
|
|
423
|
+
# Get agents by task - using parameterized query (manual JSON mode)
|
|
431
424
|
local agents_json
|
|
432
|
-
agents_json=$(sqlite3 -json "$AGENT_STATE_DB" "
|
|
425
|
+
agents_json=$(sqlite3 -json "$AGENT_STATE_DB" ".parameter init
|
|
426
|
+
.parameter set ?1 \"$task_id\"
|
|
427
|
+
SELECT * FROM agents WHERE task_id = ?1 ORDER BY spawned_at DESC;")
|
|
433
428
|
|
|
434
429
|
echo "$agents_json"
|
|
435
430
|
}
|
|
@@ -440,8 +435,11 @@ agent_get_by_task() {
|
|
|
440
435
|
agent_get_heartbeats() {
|
|
441
436
|
local agent_id="$1"
|
|
442
437
|
|
|
438
|
+
# Get heartbeats - using parameterized query (manual JSON mode)
|
|
443
439
|
local heartbeats_json
|
|
444
|
-
heartbeats_json=$(sqlite3 -json "$AGENT_STATE_DB" "
|
|
440
|
+
heartbeats_json=$(sqlite3 -json "$AGENT_STATE_DB" ".parameter init
|
|
441
|
+
.parameter set ?1 \"$agent_id\"
|
|
442
|
+
SELECT * FROM heartbeats WHERE agent_id = ?1 ORDER BY timestamp DESC LIMIT 100;")
|
|
445
443
|
|
|
446
444
|
echo "$heartbeats_json"
|
|
447
445
|
}
|
|
@@ -477,7 +475,7 @@ CONFIGURATION:
|
|
|
477
475
|
HEARTBEAT_INTERVAL - Heartbeat frequency in seconds (default: 30)
|
|
478
476
|
COMPLETION_TIMEOUT - Default completion timeout (default: 300)
|
|
479
477
|
LOG_FILE - Structured log file (default: /tmp/agent-handoff.log)
|
|
480
|
-
AGENT_SPAWN_CMD - Agent spawn command (default:
|
|
478
|
+
AGENT_SPAWN_CMD - Agent spawn command (default: cfn-spawn agent)
|
|
481
479
|
|
|
482
480
|
BEFORE (Ad-hoc):
|
|
483
481
|
# ❌ No correlation, no heartbeat, no timeout handling
|