claude-flow 2.7.35 → 2.7.36

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 (121) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/bin/claude-flow +1 -1
  3. package/dist/src/__tests__/benchmarks/performance.bench.js +0 -19
  4. package/dist/src/__tests__/benchmarks/performance.bench.js.map +1 -1
  5. package/dist/src/__tests__/hook-matchers.test.js.map +1 -1
  6. package/dist/src/agents/agent-registry.js.map +1 -1
  7. package/dist/src/api/auth-service.js.map +1 -1
  8. package/dist/src/api/claude-client-enhanced.js +4 -2
  9. package/dist/src/api/claude-client-enhanced.js.map +1 -1
  10. package/dist/src/api/claude-client.js +4 -2
  11. package/dist/src/api/claude-client.js.map +1 -1
  12. package/dist/src/api/database-service.js.map +1 -1
  13. package/dist/src/api/swarm-api.js +1 -1
  14. package/dist/src/api/swarm-api.js.map +1 -1
  15. package/dist/src/cli/commands/hive-mind/wizard.js +1 -1
  16. package/dist/src/cli/commands/hive-mind/wizard.js.map +1 -1
  17. package/dist/src/cli/simple-cli.js +172 -182
  18. package/dist/src/cli/simple-cli.js.map +1 -1
  19. package/dist/src/cli/simple-commands/init/skills-copier.js +1 -1
  20. package/dist/src/cli/simple-commands/init/skills-copier.js.map +1 -1
  21. package/dist/src/cli/simple-orchestrator.js +1 -1
  22. package/dist/src/cli/simple-orchestrator.js.map +1 -1
  23. package/dist/src/coordination/conflict-resolution.js +1 -1
  24. package/dist/src/coordination/conflict-resolution.js.map +1 -1
  25. package/dist/src/coordination/load-balancer.js +1 -1
  26. package/dist/src/coordination/load-balancer.js.map +1 -1
  27. package/dist/src/core/config.js +1 -1
  28. package/dist/src/core/config.js.map +1 -1
  29. package/dist/src/core/version.js +1 -1
  30. package/dist/src/enterprise/audit-manager.js +1 -1
  31. package/dist/src/enterprise/audit-manager.js.map +1 -1
  32. package/dist/src/providers/openai-provider.js +2 -2
  33. package/dist/src/providers/openai-provider.js.map +1 -1
  34. package/dist/src/sdk/checkpoint-manager.js +1 -1
  35. package/dist/src/sdk/checkpoint-manager.js.map +1 -1
  36. package/dist/src/services/agentic-flow-hooks/workflow-hooks.js +1 -1
  37. package/dist/src/services/agentic-flow-hooks/workflow-hooks.js.map +1 -1
  38. package/dist/src/swarm/coordinator.js +1 -1
  39. package/dist/src/swarm/coordinator.js.map +1 -1
  40. package/dist/src/utils/key-redactor.js.map +1 -1
  41. package/dist/src/utils/metrics-reader.js.map +1 -1
  42. package/dist/src/verification/rollback.js +2 -2
  43. package/dist/src/verification/rollback.js.map +1 -1
  44. package/dist/src/verification/tests/mocks/false-reporting-scenarios.test.js +4 -2
  45. package/dist/src/verification/tests/mocks/false-reporting-scenarios.test.js.map +1 -1
  46. package/docs/.claude-flow/metrics/performance.json +3 -3
  47. package/docs/.claude-flow/metrics/task-metrics.json +3 -3
  48. package/docs/architecture/README.md +555 -0
  49. package/docs/architecture/github-workflows-optimization-strategy.md +1079 -0
  50. package/docs/architecture/workflow-architecture-diagram.md +615 -0
  51. package/docs/architecture/workflow-optimization-implementation-guide.md +593 -0
  52. package/docs/fixes/WORKFLOW_FIXES.md +292 -0
  53. package/docs/fixes/WORKFLOW_FIXES_FINAL_STATUS.md +291 -0
  54. package/docs/fixes/github-workflow-fixes-pr888.md +279 -0
  55. package/docs/fixes/workflow-fixes-action-plan.md +388 -0
  56. package/docs/github-workflow-fixes.md +219 -0
  57. package/docs/reviews/github-workflows-analysis-report.md +820 -0
  58. package/docs/reviews/pr-888-review-report.md +560 -0
  59. package/docs/validation/workflow-fix-verification.md +206 -0
  60. package/package.json +7 -7
  61. package/src/__tests__/benchmarks/performance.bench.ts +2 -25
  62. package/src/__tests__/hook-matchers.test.ts +2 -0
  63. package/src/agents/agent-registry.ts +1 -1
  64. package/src/api/auth-service.ts +1 -1
  65. package/src/api/claude-client-enhanced.ts +2 -1
  66. package/src/api/claude-client.ts +2 -2
  67. package/src/api/database-service.ts +1 -2
  68. package/src/api/swarm-api.ts +2 -2
  69. package/src/cli/commands/hive-mind/wizard.ts +1 -1
  70. package/src/cli/simple-commands/init/skills-copier.js +1 -1
  71. package/src/cli/simple-orchestrator.ts +1 -1
  72. package/src/coordination/conflict-resolution.ts +1 -1
  73. package/src/coordination/load-balancer.ts +1 -1
  74. package/src/core/config.ts +1 -1
  75. package/src/enterprise/audit-manager.ts +1 -1
  76. package/src/providers/openai-provider.ts +2 -2
  77. package/src/sdk/checkpoint-manager.ts +1 -1
  78. package/src/services/agentic-flow-hooks/workflow-hooks.ts +1 -1
  79. package/src/swarm/coordinator.ts +1 -1
  80. package/src/verification/rollback.ts +2 -2
  81. package/src/verification/tests/mocks/false-reporting-scenarios.test.ts +6 -3
  82. /package/docs/{BUG_REPORT_MEMORY_STATS.md → bug-reports/BUG_REPORT_MEMORY_STATS.md} +0 -0
  83. /package/docs/{AUTOMATIC_ERROR_RECOVERY_v2.7.35.md → features/AUTOMATIC_ERROR_RECOVERY_v2.7.35.md} +0 -0
  84. /package/docs/{MCP_2025_FEATURE_CONFIRMATION.md → features/MCP_2025_FEATURE_CONFIRMATION.md} +0 -0
  85. /package/docs/{OPTIONAL_LOCAL_EMBEDDINGS.md → features/OPTIONAL_LOCAL_EMBEDDINGS.md} +0 -0
  86. /package/docs/{mcp-2025-implementation-summary.md → features/mcp-2025-implementation-summary.md} +0 -0
  87. /package/docs/{mcp-spec-2025-implementation-plan.md → features/mcp-spec-2025-implementation-plan.md} +0 -0
  88. /package/docs/{AGENTIC_FLOW_ENABLED_LOG_FIX.md → fixes/AGENTIC_FLOW_ENABLED_LOG_FIX.md} +0 -0
  89. /package/docs/{MEMORY_COMMAND_FIX.md → fixes/MEMORY_COMMAND_FIX.md} +0 -0
  90. /package/docs/{NPX_MEMORY_FIX_v2.7.19.md → fixes/NPX_MEMORY_FIX_v2.7.19.md} +0 -0
  91. /package/docs/{REMOTE_INSTALL_FIX.md → fixes/REMOTE_INSTALL_FIX.md} +0 -0
  92. /package/docs/{SQLITE_FIX_COMPLETE_v2.7.21.md → fixes/SQLITE_FIX_COMPLETE_v2.7.21.md} +0 -0
  93. /package/docs/{NPM_PUBLISH_GUIDE_v2.7.33.md → guides/NPM_PUBLISH_GUIDE_v2.7.33.md} +0 -0
  94. /package/docs/{SWARM_INITIALIZATION_GUIDE.md → guides/SWARM_INITIALIZATION_GUIDE.md} +0 -0
  95. /package/docs/{AGENTDB_BRANCH_MERGE_VERIFICATION.md → integration/AGENTDB_BRANCH_MERGE_VERIFICATION.md} +0 -0
  96. /package/docs/{INTEGRATION_STATUS_FINAL.md → integration/INTEGRATION_STATUS_FINAL.md} +0 -0
  97. /package/docs/{agentic-flow-agentdb-mcp-integration.md → integration/agentic-flow-agentdb-mcp-integration.md} +0 -0
  98. /package/docs/{phase-1-2-implementation-summary.md → integration/phase-1-2-implementation-summary.md} +0 -0
  99. /package/docs/{.github-release-issue-v2.7.33.md → releases/.github-release-issue-v2.7.33.md} +0 -0
  100. /package/docs/{RELEASE_NOTES_v2.7.15.md → releases/RELEASE_NOTES_v2.7.15.md} +0 -0
  101. /package/docs/{RELEASE_NOTES_v2.7.33.md → releases/RELEASE_NOTES_v2.7.33.md} +0 -0
  102. /package/docs/{RELEASE_READINESS_SUMMARY.md → releases/RELEASE_READINESS_SUMMARY.md} +0 -0
  103. /package/docs/{RELEASE_SUMMARY_v2.7.33.md → releases/RELEASE_SUMMARY_v2.7.33.md} +0 -0
  104. /package/docs/{V2.7.14_RELEASE_NOTES.md → releases/V2.7.14_RELEASE_NOTES.md} +0 -0
  105. /package/docs/{V2.7.25_RELEASE_NOTES.md → releases/V2.7.25_RELEASE_NOTES.md} +0 -0
  106. /package/docs/{V2.7.26_RELEASE_SUMMARY.md → releases/V2.7.26_RELEASE_SUMMARY.md} +0 -0
  107. /package/docs/{V2.7.27_RELEASE_NOTES.md → releases/V2.7.27_RELEASE_NOTES.md} +0 -0
  108. /package/docs/{V2.7.28_RELEASE_NOTES.md → releases/V2.7.28_RELEASE_NOTES.md} +0 -0
  109. /package/docs/{AGENTIC_FLOW_INTEGRATION_REVIEW.md → reviews/AGENTIC_FLOW_INTEGRATION_REVIEW.md} +0 -0
  110. /package/docs/{BRANCH_REVIEW_SUMMARY.md → reviews/BRANCH_REVIEW_SUMMARY.md} +0 -0
  111. /package/docs/{DEEP_CODE_REVIEW_v2.7.33.md → reviews/DEEP_CODE_REVIEW_v2.7.33.md} +0 -0
  112. /package/docs/{LATEST_LIBRARIES_REVIEW.md → reviews/LATEST_LIBRARIES_REVIEW.md} +0 -0
  113. /package/docs/{CONFIRMATION_AUTOMATIC_ERROR_RECOVERY.md → testing/CONFIRMATION_AUTOMATIC_ERROR_RECOVERY.md} +0 -0
  114. /package/docs/{DOCKER_TEST_RESULTS_v2.7.35.md → testing/DOCKER_TEST_RESULTS_v2.7.35.md} +0 -0
  115. /package/docs/{REGRESSION_TEST_REPORT_v2.7.33.md → testing/REGRESSION_TEST_REPORT_v2.7.33.md} +0 -0
  116. /package/docs/{V2.7.27_TEST_REPORT.md → testing/V2.7.27_TEST_REPORT.md} +0 -0
  117. /package/docs/{regression-analysis-phase-1-2.md → testing/regression-analysis-phase-1-2.md} +0 -0
  118. /package/docs/{TRANSFORMER_INITIALIZATION_ISSUE.md → troubleshooting/TRANSFORMER_INITIALIZATION_ISSUE.md} +0 -0
  119. /package/docs/{FIX_VERIFICATION_MEMORY_STATS.md → validation/FIX_VERIFICATION_MEMORY_STATS.md} +0 -0
  120. /package/docs/{TOOL_VALIDATION_REPORT.md → validation/TOOL_VALIDATION_REPORT.md} +0 -0
  121. /package/docs/{VALIDATION_REPORT_v2.7.1.md → validation/VALIDATION_REPORT_v2.7.1.md} +0 -0
@@ -0,0 +1,206 @@
1
+ # Workflow Fix Verification Checklist
2
+
3
+ ## Pre-Deployment Verification
4
+
5
+ ### ✅ Syntax Validation
6
+ - [x] verification-pipeline.yml passes @action-validator/cli
7
+ - [x] ci.yml passes @action-validator/cli
8
+ - [x] YAML syntax is valid
9
+ - [x] No linting errors
10
+
11
+ ### ✅ Logic Verification
12
+
13
+ #### Issue 1: PR Comment Posting
14
+ ```yaml
15
+ # Conditional: github.event_name == 'pull_request' && github.event.pull_request.number
16
+
17
+ Test Cases:
18
+ 1. ✅ PR event with number → RUNS
19
+ 2. ✅ Push event → SKIPS (no error)
20
+ 3. ✅ Workflow dispatch → SKIPS (no error)
21
+ 4. ✅ PR without number (edge) → SKIPS (no error)
22
+ ```
23
+
24
+ #### Issue 2: Windows CLI Test
25
+ ```yaml
26
+ # Path: bin\claude-flow (Windows native)
27
+ # Fallback: continue-on-error: true
28
+
29
+ Test Cases:
30
+ 1. ✅ Windows build with working CLI → PASSES
31
+ 2. ✅ Windows build with path issues → FAILS (non-blocking)
32
+ 3. ✅ Linux/macOS builds → SKIPS Windows step
33
+ ```
34
+
35
+ ### ✅ Backward Compatibility
36
+ - [x] No changes to existing test logic
37
+ - [x] All continue-on-error flags preserved
38
+ - [x] PR comment functionality unchanged
39
+ - [x] Build matrix unchanged
40
+ - [x] Artifact handling unchanged
41
+
42
+ ### ✅ Best Practices Applied
43
+ - [x] Explicit null checks for optional values
44
+ - [x] Platform-specific path handling
45
+ - [x] Non-blocking tests for optional features
46
+ - [x] Clear conditional logic
47
+ - [x] Proper GitHub context usage
48
+
49
+ ## Post-Deployment Verification
50
+
51
+ ### After Merge to Main
52
+ - [ ] Verify verification-pipeline.yml runs without errors on push
53
+ - [ ] Create test PR and verify comment posts correctly
54
+ - [ ] Verify Windows build completes successfully
55
+ - [ ] Check all artifacts are generated correctly
56
+
57
+ ### Test Commands
58
+ ```bash
59
+ # Local syntax validation
60
+ npx @action-validator/cli .github/workflows/verification-pipeline.yml
61
+ npx @action-validator/cli .github/workflows/ci.yml
62
+
63
+ # Check workflow changes
64
+ git diff main..HEAD -- .github/workflows/
65
+
66
+ # Validate YAML
67
+ yamllint .github/workflows/verification-pipeline.yml
68
+ yamllint .github/workflows/ci.yml
69
+ ```
70
+
71
+ ## Known Issues Resolved
72
+
73
+ ### Issue 1: Verification Report Step Failure
74
+ **Before**:
75
+ - Failed on push events with "Cannot read property 'number' of undefined"
76
+ - Used `context.issue.number` which only exists in issue/PR comment events
77
+
78
+ **After**:
79
+ - Only runs when `github.event.pull_request.number` exists
80
+ - Uses `context.payload.pull_request.number` for safe access
81
+ - Skips gracefully on non-PR events
82
+
83
+ ### Issue 2: Windows Build CLI Test
84
+ **Before**:
85
+ - Used Unix path separator `/` which may fail on Windows PowerShell
86
+ - No fallback protection if test failed
87
+
88
+ **After**:
89
+ - Uses Windows-native backslash `\` for path
90
+ - Added `continue-on-error: true` for non-blocking behavior
91
+ - Consistent with Unix build error handling
92
+
93
+ ## GitHub Actions Context Reference
94
+
95
+ ### Available Context Objects
96
+ ```javascript
97
+ // In Pull Request events:
98
+ github.event.pull_request.number // ✅ PR number
99
+ context.payload.pull_request.number // ✅ Same as above
100
+ github.event.pull_request.head.ref // ✅ PR branch name
101
+
102
+ // In Push events:
103
+ github.event.pull_request // ❌ undefined
104
+ context.issue.number // ❌ undefined
105
+
106
+ // Always available:
107
+ github.ref // ✅ refs/heads/branch-name
108
+ github.sha // ✅ commit SHA
109
+ github.event_name // ✅ push, pull_request, etc.
110
+ ```
111
+
112
+ ### Recommended Conditionals
113
+ ```yaml
114
+ # ✅ GOOD: Explicit checks
115
+ if: github.event_name == 'pull_request' && github.event.pull_request.number
116
+
117
+ # ❌ BAD: Assumes PR context exists
118
+ if: github.event_name == 'pull_request'
119
+ # Then uses: context.issue.number (fails!)
120
+
121
+ # ✅ GOOD: Safe property access
122
+ context.payload.pull_request.number
123
+
124
+ # ❌ BAD: Can fail in non-PR events
125
+ context.issue.number
126
+ ```
127
+
128
+ ## Windows Path Handling
129
+
130
+ ### Path Separator Best Practices
131
+ ```bash
132
+ # ✅ Windows PowerShell (GitHub Actions default)
133
+ node bin\claude-flow --version
134
+
135
+ # ✅ Git Bash on Windows
136
+ node bin/claude-flow --version
137
+
138
+ # ✅ Cross-platform (via npm)
139
+ npm run cli:version
140
+
141
+ # ⚠️ Mixed (works but inconsistent)
142
+ node bin/claude-flow --version # May work in PowerShell
143
+ ```
144
+
145
+ ### Shell Detection in GitHub Actions
146
+ ```yaml
147
+ # Default shells by platform:
148
+ ubuntu-latest: bash
149
+ macos-latest: bash
150
+ windows-latest: pwsh (PowerShell)
151
+
152
+ # Override shell if needed:
153
+ - run: |
154
+ node bin/claude-flow --version
155
+ shell: bash # Force bash on Windows (uses Git Bash)
156
+ ```
157
+
158
+ ## Commit Message Template
159
+ ```
160
+ fix: Resolve GitHub workflow failures in PR #888
161
+
162
+ Issue 1: Verification Report - PR comment posting
163
+ - Add explicit check for github.event.pull_request.number
164
+ - Use context.payload.pull_request.number for safe access
165
+ - Prevents failures on push/workflow_dispatch events
166
+
167
+ Issue 2: Windows Build - CLI binary path handling
168
+ - Change to Windows-native path separator (backslash)
169
+ - Add continue-on-error for non-blocking behavior
170
+ - Ensures build completes even if CLI test fails
171
+
172
+ Validation:
173
+ - Both workflows pass @action-validator/cli syntax check
174
+ - Conditional logic verified for all event types
175
+ - Maintains backward compatibility
176
+ - All existing continue-on-error flags preserved
177
+
178
+ Fixes #888
179
+ ```
180
+
181
+ ## Rollback Plan
182
+ If issues occur post-deployment:
183
+
184
+ ```bash
185
+ # Revert specific files
186
+ git checkout HEAD~1 -- .github/workflows/verification-pipeline.yml
187
+ git checkout HEAD~1 -- .github/workflows/ci.yml
188
+ git commit -m "Revert workflow changes from PR #888"
189
+ git push
190
+ ```
191
+
192
+ ## Success Criteria
193
+ - [x] Workflow syntax validation passes
194
+ - [x] No breaking changes introduced
195
+ - [x] Conditional logic is correct
196
+ - [x] Platform-specific handling works
197
+ - [x] Error handling is appropriate
198
+ - [ ] Post-merge verification passes
199
+ - [ ] Windows build completes successfully
200
+ - [ ] PR comments post correctly
201
+
202
+ ---
203
+
204
+ **Status**: ✅ Ready for merge
205
+ **Reviewed by**: GitHub Actions Workflow Validator
206
+ **Date**: 2025-11-28
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-flow",
3
- "version": "2.7.35",
3
+ "version": "2.7.36",
4
4
  "description": "Enterprise-grade AI agent orchestration with WASM-powered ReasoningBank memory and AgentDB vector database (always uses latest agentic-flow)",
5
5
  "mcpName": "io.github.ruvnet/claude-flow",
6
6
  "main": "cli.mjs",
@@ -26,14 +26,14 @@
26
26
  "dev:build": "tsc --watch",
27
27
  "test": "NODE_OPTIONS='--experimental-vm-modules' jest --bail --maxWorkers=1 --forceExit",
28
28
  "test:watch": "NODE_OPTIONS='--experimental-vm-modules' jest --watch",
29
- "test:unit": "NODE_OPTIONS='--experimental-vm-modules' jest src/__tests__/unit",
30
- "test:integration": "NODE_OPTIONS='--experimental-vm-modules' jest src/__tests__/integration",
31
- "test:e2e": "NODE_OPTIONS='--experimental-vm-modules' jest src/__tests__/e2e",
32
- "test:performance": "NODE_OPTIONS='--experimental-vm-modules' jest src/__tests__/performance",
29
+ "test:unit": "NODE_OPTIONS='--experimental-vm-modules' jest tests/unit --maxWorkers=2 --forceExit",
30
+ "test:integration": "NODE_OPTIONS='--experimental-vm-modules' jest tests/integration --maxWorkers=2 --forceExit",
31
+ "test:e2e": "NODE_OPTIONS='--experimental-vm-modules' jest tests/e2e",
32
+ "test:performance": "NODE_OPTIONS='--experimental-vm-modules' jest tests/performance",
33
33
  "test:cli": "NODE_OPTIONS='--experimental-vm-modules' jest src/cli/__tests__",
34
34
  "test:coverage": "NODE_OPTIONS='--experimental-vm-modules' jest --coverage",
35
- "test:coverage:unit": "NODE_OPTIONS='--experimental-vm-modules' jest src/__tests__/unit --coverage",
36
- "test:coverage:integration": "NODE_OPTIONS='--experimental-vm-modules' jest src/__tests__/integration --coverage",
35
+ "test:coverage:unit": "NODE_OPTIONS='--experimental-vm-modules' jest tests/unit --coverage",
36
+ "test:coverage:integration": "NODE_OPTIONS='--experimental-vm-modules' jest tests/integration --coverage",
37
37
  "test:coverage:e2e": "NODE_OPTIONS='--experimental-vm-modules' jest src/__tests__/e2e --coverage",
38
38
  "test:ci": "NODE_OPTIONS='--experimental-vm-modules' jest --ci --coverage --maxWorkers=2",
39
39
  "test:debug": "NODE_OPTIONS='--experimental-vm-modules --inspect-brk' jest --runInBand --no-cache",
@@ -5,11 +5,10 @@
5
5
  * Benchmarks session forking, hook matchers, and in-process MCP
6
6
  */
7
7
 
8
+ /* eslint-disable no-console */
9
+
8
10
  import { describe, it, expect, beforeAll, afterAll } from '@jest/globals';
9
11
  import { performance } from 'perf_hooks';
10
- import { ClaudeFlowSDKAdapter } from '../../sdk/sdk-config.js';
11
- import { TaskExecutorSDK } from '../../swarm/executor-sdk.js';
12
- import { ClaudeClientV25 } from '../../api/claude-client-v2.5.js';
13
12
 
14
13
  interface BenchmarkResult {
15
14
  name: string;
@@ -89,31 +88,9 @@ class PerformanceBenchmark {
89
88
 
90
89
  describe('Performance Benchmarks', () => {
91
90
  let benchmark: PerformanceBenchmark;
92
- let adapter: ClaudeFlowSDKAdapter;
93
- let executor: TaskExecutorSDK;
94
- let client: ClaudeClientV25;
95
91
 
96
92
  beforeAll(() => {
97
93
  benchmark = new PerformanceBenchmark();
98
-
99
- adapter = new ClaudeFlowSDKAdapter({
100
- apiKey: 'test-api-key',
101
- swarmMode: true,
102
- persistenceEnabled: true,
103
- });
104
-
105
- executor = new TaskExecutorSDK({
106
- apiKey: 'test-api-key',
107
- swarmMode: true,
108
- });
109
-
110
- client = new ClaudeClientV25(
111
- {
112
- apiKey: 'test-api-key',
113
- enableSwarmMode: true,
114
- },
115
- undefined
116
- );
117
94
  });
118
95
 
119
96
  afterAll(() => {
@@ -4,6 +4,8 @@
4
4
  * Comprehensive test suite for hook pattern matching system
5
5
  */
6
6
 
7
+ /* eslint-disable */
8
+
7
9
  import { describe, it, expect, beforeEach, afterEach } from '@jest/globals';
8
10
  import {
9
11
  HookMatcher,
@@ -4,7 +4,7 @@
4
4
  */
5
5
 
6
6
  import type { DistributedMemorySystem } from '../memory/distributed-memory.js';
7
- import type { AgentState, AgentId, AgentType, AgentStatus } from '../swarm/types.js';
7
+ import type { AgentState, AgentType, AgentStatus } from '../swarm/types.js';
8
8
  import { EventEmitter } from 'node:events';
9
9
 
10
10
  export interface AgentRegistryEntry {
@@ -4,7 +4,7 @@
4
4
  */
5
5
 
6
6
  import { ILogger } from '../core/logger.js';
7
- import { AuthenticationError, AuthorizationError } from '../utils/errors.js';
7
+ import { AuthenticationError } from '../utils/errors.js';
8
8
  import { nanoid } from 'nanoid';
9
9
  import { createHash, createHmac, timingSafeEqual } from 'crypto';
10
10
 
@@ -483,9 +483,10 @@ export class EnhancedClaudeAPIClient extends EventEmitter {
483
483
  case 401:
484
484
  case 403:
485
485
  return new ClaudeAuthenticationError(message, errorData);
486
- case 429:
486
+ case 429: {
487
487
  const retryAfter = errorData.error?.retry_after;
488
488
  return new ClaudeRateLimitError(message, retryAfter, errorData);
489
+ }
489
490
  case 500:
490
491
  return new ClaudeInternalServerError(message, errorData);
491
492
  case 503:
@@ -6,7 +6,6 @@
6
6
  import { EventEmitter } from 'events';
7
7
  import { ILogger } from '../core/logger.js';
8
8
  import { ConfigManager } from '../config/config-manager.js';
9
- import { getErrorMessage } from '../utils/error-handler.js';
10
9
  import {
11
10
  ClaudeAPIError,
12
11
  ClaudeInternalServerError,
@@ -655,9 +654,10 @@ export class ClaudeAPIClient extends EventEmitter {
655
654
  case 401:
656
655
  case 403:
657
656
  return new ClaudeAuthenticationError(message, errorData);
658
- case 429:
657
+ case 429: {
659
658
  const retryAfter = errorData.error?.retry_after;
660
659
  return new ClaudeRateLimitError(message, retryAfter, errorData);
660
+ }
661
661
  case 500:
662
662
  return new ClaudeInternalServerError(message, errorData);
663
663
  case 503:
@@ -4,8 +4,7 @@
4
4
  */
5
5
 
6
6
  import { ILogger } from '../core/logger.js';
7
- import { ConfigManager } from '../config/config-manager.js';
8
- import { SwarmError, DatabaseError } from '../utils/errors.js';
7
+ import { DatabaseError } from '../utils/errors.js';
9
8
  import { nanoid } from 'nanoid';
10
9
 
11
10
  export interface DatabaseConfig {
@@ -11,7 +11,7 @@ import { ICoordinationManager } from '../coordination/manager.js';
11
11
  import { SwarmCoordinator } from '../swarm/coordinator.js';
12
12
  import { AgentManager } from '../agents/agent-manager.js';
13
13
  import { ResourceManager } from '../resources/resource-manager.js';
14
- import { Task, Agent, SwarmConfig, SwarmStatus } from '../utils/types.js';
14
+ import { SwarmConfig } from '../utils/types.js';
15
15
  import { ValidationError, SwarmError } from '../utils/errors.js';
16
16
  import { nanoid } from 'nanoid';
17
17
 
@@ -123,7 +123,7 @@ export class SwarmApi {
123
123
  });
124
124
 
125
125
  // Error handling
126
- this.router.use((err: Error, req: any, res: any, next: any) => {
126
+ this.router.use((err: Error, req: any, res: any, _next: any) => {
127
127
  this.logger.error('Swarm API error', {
128
128
  error: err.message,
129
129
  stack: err.stack,
@@ -383,7 +383,7 @@ async function submitTaskWizard() {
383
383
  ]);
384
384
 
385
385
  let taskDescription = '';
386
- let taskConfig: any = {};
386
+ const taskConfig: any = {};
387
387
 
388
388
  if (template === 'custom') {
389
389
  const answers = await inquirer.prompt([
@@ -12,7 +12,7 @@ const __dirname = dirname(__filename);
12
12
  export async function copySkillFiles(targetDir, options = {}) {
13
13
  console.log(' 🚀 copySkillFiles function called');
14
14
  console.log(` 📂 Target directory: ${targetDir}`);
15
- console.log(` ⚙️ Options:`, options);
15
+ console.log(` ⚙️ Options: { force: ${options.force || 'false'}, dryRun: ${options.dryRun || 'false'} }`);
16
16
  console.log(` 📍 __dirname: ${__dirname}`);
17
17
 
18
18
  const { force = false, dryRun = false } = options;
@@ -77,7 +77,7 @@ function startWebUI(host: string, port: number) {
77
77
  const activeConnections: Set<any> = new Set();
78
78
 
79
79
  // CLI output capture system
80
- let cliProcess: any = null;
80
+ const cliProcess: any = null;
81
81
 
82
82
  const consoleHTML = `
83
83
  <!DOCTYPE html>
@@ -277,7 +277,7 @@ export class ConflictResolver {
277
277
  }
278
278
 
279
279
  // Build context based on conflict type
280
- let context: any = {};
280
+ const context: any = {};
281
281
 
282
282
  if (preferredStrategy === 'priority') {
283
283
  // In a real implementation, fetch agent priorities from configuration
@@ -228,7 +228,7 @@ export class LoadBalancer extends EventEmitter {
228
228
 
229
229
  try {
230
230
  // Filter agents based on constraints
231
- let candidates = this.filterAgentsByConstraints(availableAgents, task, constraints);
231
+ const candidates = this.filterAgentsByConstraints(availableAgents, task, constraints);
232
232
 
233
233
  if (candidates.length === 0) {
234
234
  throw new Error('No suitable agents available for task');
@@ -81,7 +81,7 @@ const FORMAT_PARSERS: Record<string, FormatParser> = {
81
81
  // Simple YAML parser for basic key-value pairs
82
82
  const lines = content.split('\n');
83
83
  const result: any = {};
84
- let current = result;
84
+ const current = result;
85
85
  const stack: any[] = [result];
86
86
 
87
87
  for (const line of lines) {
@@ -728,7 +728,7 @@ export class AuditManager extends EventEmitter {
728
728
  let totalEntries = 0;
729
729
  let verifiedEntries = 0;
730
730
  let corruptedEntries = 0;
731
- let missingEntries = 0;
731
+ const missingEntries = 0;
732
732
 
733
733
  const trails = trailId
734
734
  ? ([this.auditTrails.get(trailId)].filter(Boolean) as AuditTrail[])
@@ -292,8 +292,8 @@ export class OpenAIProvider extends BaseProvider {
292
292
  const reader = response.body!.getReader();
293
293
  const decoder = new TextDecoder();
294
294
  let buffer = '';
295
- let totalPromptTokens = 0;
296
- let totalCompletionTokens = 0;
295
+ const totalPromptTokens = 0;
296
+ const totalCompletionTokens = 0;
297
297
 
298
298
  while (true) {
299
299
  const { done, value } = await reader.read();
@@ -70,7 +70,7 @@ export class RealCheckpointManager extends EventEmitter {
70
70
  queryGenerator: Query,
71
71
  autoCheckpoint: boolean = false
72
72
  ): Promise<void> {
73
- let messages = this.sessionMessages.get(sessionId) || [];
73
+ const messages = this.sessionMessages.get(sessionId) || [];
74
74
  this.sessionMessages.set(sessionId, messages);
75
75
 
76
76
  let messageCount = this.messageCounters.get(sessionId) || 0;
@@ -593,7 +593,7 @@ function applyStepOptimizations(
593
593
  state: any,
594
594
  optimizations: any[]
595
595
  ): any {
596
- let optimizedState = { ...state };
596
+ const optimizedState = { ...state };
597
597
 
598
598
  for (const opt of optimizations) {
599
599
  switch (opt.type) {
@@ -1064,7 +1064,7 @@ export class SwarmCoordinator extends EventEmitter implements SwarmEventEmitter
1064
1064
  private calculateCapabilityMatch(agent: AgentState, task: TaskDefinition): number {
1065
1065
  const requiredCapabilities = task.requirements.capabilities;
1066
1066
  let matches = 0;
1067
- let total = requiredCapabilities.length;
1067
+ const total = requiredCapabilities.length;
1068
1068
 
1069
1069
  for (const capability of requiredCapabilities) {
1070
1070
  if (this.agentHasCapability(agent, capability)) {
@@ -445,7 +445,7 @@ export class StateManager extends EventEmitter {
445
445
  const filename = `${snapshot.id}.snapshot.json`;
446
446
  const filepath = join(this.snapshotDir, filename);
447
447
 
448
- let content = JSON.stringify(snapshot, null, 2);
448
+ const content = JSON.stringify(snapshot, null, 2);
449
449
 
450
450
  if (this.compressionEnabled) {
451
451
  const compressed = await gzipAsync(Buffer.from(content, 'utf-8'));
@@ -1298,7 +1298,7 @@ export class RollbackHistory extends EventEmitter {
1298
1298
  const filename = `${entry.id}.history.json`;
1299
1299
  const filepath = join(this.historyDir, filename);
1300
1300
 
1301
- let content = JSON.stringify(entry, null, 2);
1301
+ const content = JSON.stringify(entry, null, 2);
1302
1302
 
1303
1303
  if (this.compressionEnabled) {
1304
1304
  const compressed = await gzipAsync(Buffer.from(content, 'utf-8'));
@@ -16,7 +16,10 @@ import * as path from 'path';
16
16
  import * as os from 'os';
17
17
 
18
18
  // Import verification components
19
- import TruthScoreCalculator from '../../../../.claude/helpers/truth-score.js';
19
+ // Dynamic import for CommonJS module
20
+ import { createRequire } from 'module';
21
+ const require = createRequire(import.meta.url);
22
+ const TruthScoreCalc = require('../../../../.claude/helpers/truth-score.js');
20
23
 
21
24
  interface MockAgent {
22
25
  id: string;
@@ -86,9 +89,9 @@ describe('False Reporting Detection Scenarios', () => {
86
89
 
87
90
  beforeEach(async () => {
88
91
  tempDir = await fs.mkdtemp(path.join(os.tmpdir(), 'false-reporting-test-'));
89
-
92
+
90
93
  // Setup truth score calculator
91
- truthCalculator = new TruthScoreCalculator();
94
+ truthCalculator = new TruthScoreCalc();
92
95
  truthCalculator.configPath = path.join(tempDir, 'verification.json');
93
96
  truthCalculator.memoryPath = path.join(tempDir, 'truth-scores');
94
97
  await truthCalculator.init();