claude-flow-novice 2.15.7 → 2.15.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/.claude/cfn-extras/agents/google-sheets/google-sheets-coordinator.md +1 -1
  2. package/.claude/cfn-extras/docs/GOOGLE_SHEETS_CFN_LOOP.md +13 -11
  3. package/.claude/skills/cfn-loop-orchestration/helpers/consensus-ts.sh +104 -0
  4. package/.claude/skills/cfn-loop-orchestration/helpers/deliverable-verifier-ts.sh +123 -0
  5. package/.claude/skills/cfn-loop-orchestration/helpers/iteration-manager-ts.sh +89 -0
  6. package/.claude/skills/cfn-loop-orchestration/helpers/timeout-calculator-ts.sh +47 -0
  7. package/.claude/skills/cfn-loop-orchestration/src/helpers/deliverable-verifier.ts +103 -0
  8. package/.claude/skills/cfn-loop-orchestration/src/helpers/iteration-manager.ts +45 -0
  9. package/.claude/skills/cfn-loop-orchestration/src/helpers/timeout-calculator.ts +41 -0
  10. package/.claude/skills/cfn-loop-orchestration/tests/consensus.test.ts +1 -1
  11. package/.claude/skills/cfn-loop-orchestration/tests/deliverable-verifier.test.ts +1 -3
  12. package/.claude/skills/cfn-loop-orchestration/tests/iteration-manager.test.ts +1 -1
  13. package/.claude/skills/cfn-redis-coordination/report-completion.sh +55 -10
  14. package/.claude/skills/cfn-redis-coordination/store-context.sh +31 -1
  15. package/claude-assets/agents/cfn-dev-team/coordinators/cfn-frontend-coordinator.md +6 -1
  16. package/claude-assets/agents/cfn-dev-team/coordinators/consensus-builder.md +6 -1
  17. package/claude-assets/agents/cfn-dev-team/coordinators/handoff-coordinator.md +6 -1
  18. package/claude-assets/agents/cfn-dev-team/coordinators/multi-sprint-coordinator.md +6 -1
  19. package/claude-assets/agents/cfn-dev-team/dev-ops/docker-specialist.md +18 -8
  20. package/claude-assets/agents/cfn-dev-team/dev-ops/kubernetes-specialist.md +18 -8
  21. package/claude-assets/agents/cfn-dev-team/developers/api-gateway-specialist.md +18 -8
  22. package/claude-assets/agents/cfn-dev-team/developers/backend-developer.md +17 -7
  23. package/claude-assets/agents/cfn-dev-team/developers/graphql-specialist.md +17 -8
  24. package/claude-assets/agents/cfn-dev-team/developers/rust-developer.md +18 -8
  25. package/claude-assets/agents/cfn-dev-team/reviewers/code-reviewer.md +9 -5
  26. package/claude-assets/agents/cfn-dev-team/reviewers/quality/code-quality-validator.md +13 -6
  27. package/claude-assets/agents/cfn-dev-team/reviewers/quality/perf-analyzer.md +13 -6
  28. package/claude-assets/agents/cfn-dev-team/reviewers/quality/performance-benchmarker.md +13 -6
  29. package/claude-assets/agents/cfn-dev-team/reviewers/quality/security-specialist.md +15 -5
  30. package/claude-assets/agents/cfn-dev-team/testers/api-testing-specialist.md +9 -5
  31. package/claude-assets/agents/cfn-dev-team/testers/chaos-engineering-specialist.md +8 -4
  32. package/claude-assets/agents/cfn-dev-team/testers/interaction-tester.md +16 -13
  33. package/claude-assets/agents/cfn-dev-team/testers/playwright-tester.md +9 -5
  34. package/claude-assets/agents/cfn-dev-team/testers/tester.md +9 -5
  35. package/claude-assets/cfn-extras/agents/google-sheets/google-sheets-coordinator.md +1 -1
  36. package/claude-assets/cfn-extras/docs/GOOGLE_SHEETS_CFN_LOOP.md +13 -11
  37. package/claude-assets/skills/cfn-loop-orchestration/helpers/consensus-ts.sh +104 -0
  38. package/claude-assets/skills/cfn-loop-orchestration/helpers/deliverable-verifier-ts.sh +123 -0
  39. package/claude-assets/skills/cfn-loop-orchestration/helpers/iteration-manager-ts.sh +89 -0
  40. package/claude-assets/skills/cfn-loop-orchestration/helpers/timeout-calculator-ts.sh +47 -0
  41. package/claude-assets/skills/cfn-loop-orchestration/src/helpers/consensus.ts +87 -0
  42. package/claude-assets/skills/cfn-loop-orchestration/src/helpers/deliverable-verifier.ts +103 -0
  43. package/claude-assets/skills/cfn-loop-orchestration/src/helpers/iteration-manager.ts +45 -0
  44. package/claude-assets/skills/cfn-loop-orchestration/src/helpers/timeout-calculator.ts +41 -0
  45. package/claude-assets/skills/cfn-loop-orchestration/tests/consensus.test.ts +1 -1
  46. package/claude-assets/skills/cfn-loop-orchestration/tests/deliverable-verifier.test.ts +1 -3
  47. package/claude-assets/skills/cfn-loop-orchestration/tests/iteration-manager.test.ts +1 -1
  48. package/claude-assets/skills/cfn-redis-coordination/report-completion.sh +55 -10
  49. package/claude-assets/skills/cfn-redis-coordination/store-context.sh +31 -1
  50. package/dist/cli/config-manager.js +109 -91
  51. package/dist/cli/config-manager.js.map +1 -1
  52. package/package.json +1 -1
@@ -100,7 +100,7 @@ npx claude-flow-novice cfn-spawn cfn-v3-coordinator \
100
100
 
101
101
  **Agent Communication Pattern:**
102
102
  - Coordinator receives broadcast messages via coordination layer
103
- - Agents signal completion via `report-completion.sh`
103
+ - Agents signal completion via Redis coordination (CLI mode only)
104
104
  - Validators wait for gate pass signal before starting
105
105
  - Product Owner receives summary and makes decision
106
106
 
@@ -318,12 +318,15 @@ automation_001 (depends on all above)
318
318
  # 3. Signal completion
319
319
  coordination-signal "swarm:${TASK_ID}:${AGENT_ID}:done" "complete"
320
320
 
321
- # 4. Report results
322
- ./.claude/skills/cfn-coordination/report-completion.sh \
323
- --task-id "$TASK_ID" \
324
- --agent-id "$AGENT_ID" \
325
- --confidence 0.95 \
326
- --result '{"deliverables": ["sheet_created"], "tests_passed": 5, "tests_total": 5}'
321
+ # 4. Report results (CLI Mode - uses Redis coordination)
322
+ # Task Mode: Simply return structured JSON output instead
323
+ if [[ -n "${TASK_ID:-}" && -n "${AGENT_ID:-}" ]]; then
324
+ redis-cli HSET "swarm:${TASK_ID}:${AGENT_ID}:result" \
325
+ confidence 0.95 \
326
+ deliverables '["sheet_created"]' \
327
+ tests_passed 5 \
328
+ tests_total 5
329
+ fi
327
330
  ```
328
331
 
329
332
  ### Loop 2 Validation
@@ -336,11 +339,10 @@ coordination-wait "swarm:${TASK_ID}:gate-passed"
336
339
  --sprint-id "$SPRINT_ID" \
337
340
  --validation-type comprehensive
338
341
 
339
- # 3. Report confidence score
340
- ./.claude/skills/cfn-coordination/report-completion.sh \
341
- --task-id "$TASK_ID" \
342
- --agent-id "$AGENT_ID" \
343
- --confidence 0.92
342
+ # 3. Report confidence score (CLI Mode)
343
+ if [[ -n "${TASK_ID:-}" && -n "${AGENT_ID:-}" ]]; then
344
+ redis-cli HSET "swarm:${TASK_ID}:${AGENT_ID}:result" confidence 0.92
345
+ fi
344
346
  ```
345
347
 
346
348
  ## API Quota Management
@@ -0,0 +1,104 @@
1
+ #!/usr/bin/env bash
2
+
3
+ ##############################################################################
4
+ # Consensus Checker (TypeScript Wrapper)
5
+ # Collects and validates Loop 2 consensus scores
6
+ #
7
+ # Usage:
8
+ # consensus-ts.sh --scores <score1,score2,...> \
9
+ # --threshold <0.0-1.0> \
10
+ # --mode <mvp|standard|enterprise>
11
+ #
12
+ # Returns:
13
+ # Exit 0: Consensus reached
14
+ # Exit 1: Consensus failed
15
+ ##############################################################################
16
+
17
+ set -euo pipefail
18
+
19
+ # Get script directory
20
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
21
+ HELPERS_DIR="$SCRIPT_DIR/../src/helpers"
22
+
23
+ # Parameters
24
+ SCORES=""
25
+ THRESHOLD=""
26
+ MODE="standard"
27
+
28
+ # Parse arguments
29
+ while [[ $# -gt 0 ]]; do
30
+ case $1 in
31
+ --scores) SCORES="$2"; shift 2 ;;
32
+ --threshold) THRESHOLD="$2"; shift 2 ;;
33
+ --mode) MODE="$2"; shift 2 ;;
34
+ *) echo "Unknown option: $1" >&2; exit 1 ;;
35
+ esac
36
+ done
37
+
38
+ # Validation
39
+ if [ -z "$SCORES" ]; then
40
+ echo "Error: Missing required parameter --scores" >&2
41
+ exit 1
42
+ fi
43
+
44
+ # Convert comma-separated scores to JSON array
45
+ IFS=',' read -ra SCORE_ARRAY <<< "$SCORES"
46
+ SCORES_JSON="["
47
+ for i in "${!SCORE_ARRAY[@]}"; do
48
+ if [ $i -gt 0 ]; then
49
+ SCORES_JSON+=","
50
+ fi
51
+ SCORES_JSON+="${SCORE_ARRAY[$i]}"
52
+ done
53
+ SCORES_JSON+="]"
54
+
55
+ # Build TypeScript invocation
56
+ TS_CODE="
57
+ import { collectConsensus, validateConsensus } from './consensus';
58
+
59
+ const scores = $SCORES_JSON;
60
+ const mode = '$MODE';
61
+ const threshold = ${THRESHOLD:-null};
62
+
63
+ try {
64
+ const consensus = collectConsensus(scores);
65
+ console.log(\`Consensus Statistics:\`);
66
+ console.log(\` Count: \${consensus.count}\`);
67
+ console.log(\` Average: \${consensus.average.toFixed(3)}\`);
68
+ console.log(\` Min: \${consensus.min.toFixed(3)}\`);
69
+ console.log(\` Max: \${consensus.max.toFixed(3)}\`);
70
+ console.log();
71
+
72
+ const validationParams: any = {
73
+ average: consensus.average,
74
+ mode
75
+ };
76
+ if (threshold !== null) {
77
+ validationParams.threshold = threshold;
78
+ }
79
+ const validation = validateConsensus(validationParams);
80
+
81
+ console.log(\`Consensus Validation:\`);
82
+ console.log(\` Mode: \${validation.mode}\`);
83
+ console.log(\` Threshold: \${validation.threshold.toFixed(2)}\`);
84
+ console.log(\` Average: \${validation.average.toFixed(3)}\`);
85
+ console.log(\` Gap: \${validation.gap >= 0 ? '+' : ''}\${validation.gap.toFixed(3)}\`);
86
+ console.log(\` Passed: \${validation.passed}\`);
87
+ console.log();
88
+
89
+ if (validation.passed) {
90
+ console.log('✅ Consensus REACHED - Loop 2 validation successful');
91
+ process.exit(0);
92
+ } else {
93
+ console.log('❌ Consensus FAILED - Iteration required');
94
+ process.exit(1);
95
+ }
96
+ } catch (error: any) {
97
+ console.error('Error:', error.message);
98
+ process.exit(2);
99
+ }
100
+ "
101
+
102
+ # Execute TypeScript code
103
+ cd "$HELPERS_DIR"
104
+ ts-node -e "$TS_CODE"
@@ -0,0 +1,123 @@
1
+ #!/usr/bin/env bash
2
+
3
+ ##############################################################################
4
+ # Deliverable Verifier (TypeScript Wrapper)
5
+ # Verifies expected deliverables exist (prevents "consensus on vapor")
6
+ #
7
+ # Usage:
8
+ # deliverable-verifier-ts.sh --files <file1,file2,...> \
9
+ # [--expected-types <.ext1,.ext2,...>] \
10
+ # [--task-type <description>] \
11
+ # [--require-git-changes]
12
+ #
13
+ # Returns:
14
+ # Exit 0: Deliverables verified
15
+ # Exit 1: Missing deliverables or validation failed
16
+ ##############################################################################
17
+
18
+ set -euo pipefail
19
+
20
+ # Get script directory
21
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
22
+ HELPERS_DIR="$SCRIPT_DIR/../src/helpers"
23
+
24
+ # Parameters
25
+ FILES=""
26
+ EXPECTED_TYPES=""
27
+ TASK_TYPE=""
28
+ REQUIRE_GIT_CHANGES="false"
29
+
30
+ # Parse arguments
31
+ while [[ $# -gt 0 ]]; do
32
+ case $1 in
33
+ --files) FILES="$2"; shift 2 ;;
34
+ --expected-types) EXPECTED_TYPES="$2"; shift 2 ;;
35
+ --task-type) TASK_TYPE="$2"; shift 2 ;;
36
+ --require-git-changes) REQUIRE_GIT_CHANGES="true"; shift 1 ;;
37
+ *) echo "Unknown option: $1" >&2; exit 1 ;;
38
+ esac
39
+ done
40
+
41
+ # Convert comma-separated files to JSON array
42
+ if [ -n "$FILES" ]; then
43
+ IFS=',' read -ra FILE_ARRAY <<< "$FILES"
44
+ FILES_JSON="["
45
+ for i in "${!FILE_ARRAY[@]}"; do
46
+ if [ $i -gt 0 ]; then
47
+ FILES_JSON+=","
48
+ fi
49
+ FILES_JSON+="\"${FILE_ARRAY[$i]}\""
50
+ done
51
+ FILES_JSON+="]"
52
+ else
53
+ FILES_JSON="[]"
54
+ fi
55
+
56
+ # Convert comma-separated types to JSON array
57
+ if [ -n "$EXPECTED_TYPES" ]; then
58
+ IFS=',' read -ra TYPE_ARRAY <<< "$EXPECTED_TYPES"
59
+ TYPES_JSON="["
60
+ for i in "${!TYPE_ARRAY[@]}"; do
61
+ if [ $i -gt 0 ]; then
62
+ TYPES_JSON+=","
63
+ fi
64
+ TYPES_JSON+="\"${TYPE_ARRAY[$i]}\""
65
+ done
66
+ TYPES_JSON+="]"
67
+ else
68
+ TYPES_JSON="undefined"
69
+ fi
70
+
71
+ # Build TypeScript invocation
72
+ TS_CODE="
73
+ import { verifyDeliverables } from './deliverable-verifier';
74
+
75
+ const result = verifyDeliverables({
76
+ files: $FILES_JSON,
77
+ ${EXPECTED_TYPES:+expectedTypes: $TYPES_JSON,}
78
+ ${TASK_TYPE:+taskType: '$TASK_TYPE',}
79
+ requireGitChanges: $REQUIRE_GIT_CHANGES
80
+ });
81
+
82
+ console.log('Deliverable Verification:');
83
+ console.log(\` Files checked: \${result.files.length}\`);
84
+ console.log(\` Found: \${result.found.length}\`);
85
+ console.log(\` Missing: \${result.missing.length}\`);
86
+ if (result.gitChanges !== undefined) {
87
+ console.log(\` Git changes: \${result.gitChanges}\`);
88
+ }
89
+ console.log();
90
+
91
+ if (result.found.length > 0) {
92
+ console.log('Found files:');
93
+ result.found.forEach(file => console.log(\` ✅ \${file}\`));
94
+ console.log();
95
+ }
96
+
97
+ if (result.missing.length > 0) {
98
+ console.log('Missing files:');
99
+ result.missing.forEach(file => console.log(\` ❌ \${file}\`));
100
+ console.log();
101
+ }
102
+
103
+ if (result.typeErrors && result.typeErrors.length > 0) {
104
+ console.log('Type errors:');
105
+ result.typeErrors.forEach(file => console.log(\` ⚠️ \${file}\`));
106
+ console.log();
107
+ }
108
+
109
+ if (result.verified) {
110
+ console.log('✅ Deliverable verification PASSED');
111
+ process.exit(0);
112
+ } else {
113
+ console.log('❌ Deliverable verification FAILED');
114
+ if (result.reason) {
115
+ console.log(\` Reason: \${result.reason}\`);
116
+ }
117
+ process.exit(1);
118
+ }
119
+ "
120
+
121
+ # Execute TypeScript code
122
+ cd "$HELPERS_DIR"
123
+ ts-node -e "$TS_CODE"
@@ -0,0 +1,89 @@
1
+ #!/usr/bin/env bash
2
+
3
+ ##############################################################################
4
+ # Iteration Manager (TypeScript Wrapper)
5
+ # Prepares next iteration and generates wake signals
6
+ #
7
+ # Usage:
8
+ # iteration-manager-ts.sh --current-iteration <n> \
9
+ # --agents <agent1,agent2,...> \
10
+ # [--feedback <json>]
11
+ #
12
+ # Returns:
13
+ # Next iteration metadata (JSON)
14
+ ##############################################################################
15
+
16
+ set -euo pipefail
17
+
18
+ # Get script directory
19
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
20
+ HELPERS_DIR="$SCRIPT_DIR/../src/helpers"
21
+
22
+ # Parameters
23
+ CURRENT_ITERATION=""
24
+ AGENTS=""
25
+ FEEDBACK="{}"
26
+
27
+ # Parse arguments
28
+ while [[ $# -gt 0 ]]; do
29
+ case $1 in
30
+ --current-iteration) CURRENT_ITERATION="$2"; shift 2 ;;
31
+ --agents) AGENTS="$2"; shift 2 ;;
32
+ --feedback) FEEDBACK="$2"; shift 2 ;;
33
+ *) echo "Unknown option: $1" >&2; exit 1 ;;
34
+ esac
35
+ done
36
+
37
+ # Validation
38
+ if [ -z "$CURRENT_ITERATION" ] || [ -z "$AGENTS" ]; then
39
+ echo "Error: Missing required parameters" >&2
40
+ exit 1
41
+ fi
42
+
43
+ # Convert comma-separated agents to JSON array
44
+ IFS=',' read -ra AGENT_ARRAY <<< "$AGENTS"
45
+ AGENTS_JSON="["
46
+ for i in "${!AGENT_ARRAY[@]}"; do
47
+ if [ $i -gt 0 ]; then
48
+ AGENTS_JSON+=","
49
+ fi
50
+ AGENTS_JSON+="\"${AGENT_ARRAY[$i]}\""
51
+ done
52
+ AGENTS_JSON+="]"
53
+
54
+ # Build TypeScript invocation
55
+ TS_CODE="
56
+ import { prepareIteration, wakeAgents } from './iteration-manager';
57
+
58
+ const iteration = prepareIteration({
59
+ currentIteration: $CURRENT_ITERATION,
60
+ feedback: $FEEDBACK
61
+ });
62
+
63
+ console.log('Iteration Preparation:');
64
+ console.log(\` Next Iteration: \${iteration.nextIteration}\`);
65
+ console.log(\` Timestamp: \${iteration.timestamp}\`);
66
+ console.log();
67
+
68
+ const agentIds = $AGENTS_JSON;
69
+ const wake = wakeAgents(agentIds);
70
+
71
+ console.log('Wake Signals Generated:');
72
+ wake.signals.forEach((signal, idx) => {
73
+ console.log(\` [\${idx + 1}] \${signal}\`);
74
+ });
75
+ console.log();
76
+ console.log(\`✅ Prepared iteration \${iteration.nextIteration} for \${agentIds.length} agents\`);
77
+
78
+ // Output JSON for programmatic consumption
79
+ console.log();
80
+ console.log('JSON_OUTPUT:', JSON.stringify({
81
+ nextIteration: iteration.nextIteration,
82
+ timestamp: iteration.timestamp,
83
+ signals: wake.signals
84
+ }));
85
+ "
86
+
87
+ # Execute TypeScript code
88
+ cd "$HELPERS_DIR"
89
+ ts-node -e "$TS_CODE"
@@ -0,0 +1,47 @@
1
+ #!/usr/bin/env bash
2
+
3
+ ##############################################################################
4
+ # Timeout Calculator (TypeScript Wrapper)
5
+ # Calculates mode and phase-specific timeouts for agent execution
6
+ #
7
+ # Usage:
8
+ # timeout-calculator-ts.sh --mode <mvp|standard|enterprise> [--phase <phase-id>]
9
+ #
10
+ # Returns:
11
+ # Timeout value in seconds (stdout)
12
+ ##############################################################################
13
+
14
+ set -euo pipefail
15
+
16
+ # Get script directory
17
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
18
+ HELPERS_DIR="$SCRIPT_DIR/../src/helpers"
19
+
20
+ # Parameters
21
+ MODE="standard"
22
+ PHASE=""
23
+
24
+ # Parse arguments
25
+ while [[ $# -gt 0 ]]; do
26
+ case $1 in
27
+ --mode) MODE="$2"; shift 2 ;;
28
+ --phase) PHASE="$2"; shift 2 ;;
29
+ *) echo "Unknown option: $1" >&2; exit 1 ;;
30
+ esac
31
+ done
32
+
33
+ # Build TypeScript invocation
34
+ TS_CODE="
35
+ import { calculateTimeout } from './timeout-calculator';
36
+
37
+ const timeout = calculateTimeout({
38
+ mode: '$MODE',
39
+ ${PHASE:+phase: '$PHASE'}
40
+ });
41
+
42
+ console.log(timeout);
43
+ "
44
+
45
+ # Execute TypeScript code
46
+ cd "$HELPERS_DIR"
47
+ ts-node -e "$TS_CODE"
@@ -0,0 +1,103 @@
1
+ /**
2
+ * Deliverable Verifier
3
+ * Verifies expected deliverables exist (prevents "consensus on vapor")
4
+ */
5
+
6
+ import * as fs from 'fs';
7
+ import * as path from 'path';
8
+ import { execSync } from 'child_process';
9
+
10
+ export interface VerificationResult {
11
+ verified: boolean;
12
+ files: string[];
13
+ missing: string[];
14
+ found: string[];
15
+ typeErrors?: string[];
16
+ gitChanges?: number;
17
+ requiresChanges?: boolean;
18
+ reason?: string;
19
+ }
20
+
21
+ const IMPLEMENTATION_KEYWORDS = [
22
+ 'create', 'build', 'implement', 'add', 'generate'
23
+ ];
24
+
25
+ /**
26
+ * Verifies expected deliverables exist
27
+ * @param params Verification parameters
28
+ * @returns VerificationResult with detailed verification status
29
+ */
30
+ export function verifyDeliverables(params: {
31
+ files: string[];
32
+ expectedTypes?: string[];
33
+ requireGitChanges?: boolean;
34
+ taskType?: string;
35
+ }): VerificationResult {
36
+ const found: string[] = [];
37
+ const missing: string[] = [];
38
+ const typeErrors: string[] = [];
39
+
40
+ // Check each file
41
+ for (const file of params.files) {
42
+ if (fs.existsSync(file)) {
43
+ found.push(file);
44
+
45
+ // Type validation if expected types specified
46
+ if (params.expectedTypes && params.expectedTypes.length > 0) {
47
+ const ext = path.extname(file);
48
+ if (!params.expectedTypes.includes(ext)) {
49
+ typeErrors.push(file);
50
+ }
51
+ }
52
+ } else {
53
+ missing.push(file);
54
+ }
55
+ }
56
+
57
+ // Git change detection
58
+ let gitChanges = 0;
59
+ if (params.requireGitChanges !== undefined) {
60
+ try {
61
+ const gitStatus = execSync('git status --short', { encoding: 'utf-8' });
62
+ gitChanges = gitStatus.trim().split('\n').filter(line => line.length > 0).length;
63
+ } catch (error) {
64
+ // Git not available or not a git repo
65
+ gitChanges = -1;
66
+ }
67
+ }
68
+
69
+ // Detect if task requires changes (implementation keywords)
70
+ const requiresChanges = params.taskType
71
+ ? IMPLEMENTATION_KEYWORDS.some(keyword =>
72
+ params.taskType!.toLowerCase().includes(keyword)
73
+ )
74
+ : false;
75
+
76
+ // Check for "consensus on vapor"
77
+ let verified = missing.length === 0 && typeErrors.length === 0;
78
+ let reason: string | undefined;
79
+
80
+ if (requiresChanges && params.requireGitChanges && gitChanges === 0 && params.files.length === 0) {
81
+ verified = false;
82
+ reason = 'Implementation task detected but no deliverables created (consensus on vapor)';
83
+ }
84
+
85
+ const result: VerificationResult = {
86
+ verified,
87
+ files: params.files,
88
+ missing,
89
+ found,
90
+ gitChanges,
91
+ requiresChanges
92
+ };
93
+
94
+ // Add optional properties only if they have values
95
+ if (typeErrors.length > 0) {
96
+ result.typeErrors = typeErrors;
97
+ }
98
+ if (reason !== undefined) {
99
+ result.reason = reason;
100
+ }
101
+
102
+ return result;
103
+ }
@@ -0,0 +1,45 @@
1
+ /**
2
+ * Iteration Manager
3
+ * Manages CFN Loop iteration transitions and agent wake operations
4
+ */
5
+
6
+ export interface IterationPreparation {
7
+ nextIteration: number;
8
+ feedback: any;
9
+ timestamp: string;
10
+ }
11
+
12
+ export interface WakeResult {
13
+ signals: string[];
14
+ }
15
+
16
+ /**
17
+ * Prepares next iteration with feedback
18
+ * @param params Current iteration and feedback data
19
+ * @returns IterationPreparation for next iteration
20
+ */
21
+ export function prepareIteration(params: {
22
+ currentIteration: number;
23
+ feedback: any;
24
+ }): IterationPreparation {
25
+ return {
26
+ nextIteration: params.currentIteration + 1,
27
+ feedback: params.feedback,
28
+ timestamp: new Date().toISOString()
29
+ };
30
+ }
31
+
32
+ /**
33
+ * Prepares wake signals for agents
34
+ * @param agentIds Array of agent IDs to wake
35
+ * @returns WakeResult with signal identifiers
36
+ */
37
+ export function wakeAgents(agentIds: string[]): WakeResult {
38
+ const signals = agentIds.map(agentId => {
39
+ return `wake:${agentId}:${Date.now()}`;
40
+ });
41
+
42
+ return {
43
+ signals
44
+ };
45
+ }
@@ -0,0 +1,41 @@
1
+ /**
2
+ * Timeout Calculator
3
+ * Calculates mode and phase-specific timeouts for agent execution
4
+ */
5
+
6
+ export type Mode = 'mvp' | 'standard' | 'enterprise';
7
+
8
+ const BASE_TIMEOUTS: Record<Mode, number> = {
9
+ mvp: 1800, // 30 minutes
10
+ standard: 3600, // 60 minutes
11
+ enterprise: 7200 // 120 minutes
12
+ };
13
+
14
+ const PHASE_MULTIPLIERS: Record<string, number> = {
15
+ 'phase-1': 1.0, // Backend work
16
+ 'phase-2': 1.5, // React components
17
+ 'phase-3': 2.0, // Advanced components
18
+ 'phase-4': 1.0 // Testing/integration
19
+ };
20
+
21
+ /**
22
+ * Calculates timeout based on mode and optional phase
23
+ * @param params Mode and optional phase identifier
24
+ * @returns Timeout in seconds
25
+ */
26
+ export function calculateTimeout(params: {
27
+ mode: Mode;
28
+ phase?: string;
29
+ }): number {
30
+ const baseTimeout = BASE_TIMEOUTS[params.mode] || BASE_TIMEOUTS.standard;
31
+
32
+ if (!params.phase) {
33
+ return baseTimeout;
34
+ }
35
+
36
+ // Normalize phase to lowercase for case-insensitive matching
37
+ const normalizedPhase = params.phase.toLowerCase();
38
+ const multiplier = PHASE_MULTIPLIERS[normalizedPhase] || 1.0;
39
+
40
+ return Math.floor(baseTimeout * multiplier);
41
+ }
@@ -3,7 +3,7 @@
3
3
  * Tests for collecting Loop 2 validator scores and checking thresholds
4
4
  */
5
5
 
6
- import { collectConsensus, validateConsensus, ConsensusResult, ConsensusValidation } from '../src/helpers/consensus';
6
+ import { collectConsensus, validateConsensus } from '../src/helpers/consensus';
7
7
 
8
8
  describe('consensus', () => {
9
9
  describe('collectConsensus', () => {
@@ -3,9 +3,7 @@
3
3
  * Tests for verifying expected deliverables exist (prevents "consensus on vapor")
4
4
  */
5
5
 
6
- import { verifyDeliverables, VerificationResult } from '../src/helpers/deliverable-verifier';
7
- import * as fs from 'fs';
8
- import * as path from 'path';
6
+ import { verifyDeliverables } from '../src/helpers/deliverable-verifier';
9
7
 
10
8
  describe('deliverable-verifier', () => {
11
9
  describe('file existence verification', () => {
@@ -3,7 +3,7 @@
3
3
  * Tests for managing CFN Loop iteration transitions and feedback
4
4
  */
5
5
 
6
- import { prepareIteration, wakeAgents, IterationPreparation } from '../src/helpers/iteration-manager';
6
+ import { prepareIteration, wakeAgents } from '../src/helpers/iteration-manager';
7
7
 
8
8
  describe('iteration-manager', () => {
9
9
  describe('prepareIteration', () => {