@claude-flow/swarm 3.0.0-alpha.8 → 3.0.0-alpha.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 (117) hide show
  1. package/dist/agent-pool.d.ts.map +1 -1
  2. package/dist/agent-pool.js +10 -2
  3. package/dist/agent-pool.js.map +1 -1
  4. package/dist/attention-coordinator.d.ts +5 -4
  5. package/dist/attention-coordinator.d.ts.map +1 -1
  6. package/dist/attention-coordinator.js +17 -10
  7. package/dist/attention-coordinator.js.map +1 -1
  8. package/dist/consensus/byzantine.d.ts +2 -1
  9. package/dist/consensus/byzantine.d.ts.map +1 -1
  10. package/dist/consensus/byzantine.js +34 -8
  11. package/dist/consensus/byzantine.js.map +1 -1
  12. package/dist/consensus/gossip.d.ts +2 -1
  13. package/dist/consensus/gossip.d.ts.map +1 -1
  14. package/dist/consensus/gossip.js +27 -8
  15. package/dist/consensus/gossip.js.map +1 -1
  16. package/dist/consensus/index.d.ts +1 -1
  17. package/dist/consensus/index.d.ts.map +1 -1
  18. package/dist/consensus/index.js +2 -30
  19. package/dist/consensus/index.js.map +1 -1
  20. package/dist/consensus/raft.d.ts +2 -1
  21. package/dist/consensus/raft.d.ts.map +1 -1
  22. package/dist/consensus/raft.js +25 -9
  23. package/dist/consensus/raft.js.map +1 -1
  24. package/dist/index.js +2 -2
  25. package/dist/index.js.map +1 -1
  26. package/dist/message-bus.d.ts.map +1 -1
  27. package/dist/message-bus.js +13 -4
  28. package/dist/message-bus.js.map +1 -1
  29. package/dist/queen-coordinator.d.ts +1 -1
  30. package/dist/queen-coordinator.d.ts.map +1 -1
  31. package/dist/queen-coordinator.js +10 -3
  32. package/dist/queen-coordinator.js.map +1 -1
  33. package/dist/topology-manager.d.ts.map +1 -1
  34. package/dist/topology-manager.js +26 -1
  35. package/dist/topology-manager.js.map +1 -1
  36. package/dist/types.d.ts +3 -12
  37. package/dist/types.d.ts.map +1 -1
  38. package/dist/types.js.map +1 -1
  39. package/dist/unified-coordinator.d.ts +1 -1
  40. package/dist/unified-coordinator.d.ts.map +1 -1
  41. package/dist/unified-coordinator.js +85 -29
  42. package/dist/unified-coordinator.js.map +1 -1
  43. package/package.json +7 -2
  44. package/.claude-flow/data/pending-insights.jsonl +0 -15
  45. package/.claude-flow/hive-mind/state.json +0 -18
  46. package/__tests__/byzantine-transport.test.ts +0 -147
  47. package/__tests__/consensus-failure-injection.test.ts +0 -161
  48. package/__tests__/consensus-transport.test.ts +0 -200
  49. package/__tests__/consensus.test.ts +0 -577
  50. package/__tests__/coordinator.test.ts +0 -501
  51. package/__tests__/federation-transport.test.ts +0 -145
  52. package/__tests__/gossip-transport.test.ts +0 -81
  53. package/__tests__/queen-coordinator.test.ts +0 -1335
  54. package/__tests__/raft-transport.test.ts +0 -121
  55. package/__tests__/topology.test.ts +0 -621
  56. package/ruvector.db +0 -0
  57. package/src/agent-pool.ts +0 -476
  58. package/src/application/commands/create-task.command.ts +0 -124
  59. package/src/application/commands/spawn-agent.command.ts +0 -122
  60. package/src/application/index.ts +0 -30
  61. package/src/application/services/swarm-application-service.ts +0 -200
  62. package/src/attention-coordinator.ts +0 -1000
  63. package/src/consensus/byzantine.ts +0 -514
  64. package/src/consensus/federation-transport.ts +0 -185
  65. package/src/consensus/gossip.ts +0 -599
  66. package/src/consensus/index.ts +0 -326
  67. package/src/consensus/raft.ts +0 -561
  68. package/src/consensus/transport.ts +0 -284
  69. package/src/coordination/agent-registry.ts +0 -544
  70. package/src/coordination/index.ts +0 -23
  71. package/src/coordination/swarm-hub.ts +0 -776
  72. package/src/coordination/task-orchestrator.ts +0 -605
  73. package/src/domain/entities/agent.d.ts +0 -151
  74. package/src/domain/entities/agent.d.ts.map +0 -1
  75. package/src/domain/entities/agent.js +0 -280
  76. package/src/domain/entities/agent.js.map +0 -1
  77. package/src/domain/entities/agent.ts +0 -370
  78. package/src/domain/entities/task.d.ts +0 -133
  79. package/src/domain/entities/task.d.ts.map +0 -1
  80. package/src/domain/entities/task.js +0 -261
  81. package/src/domain/entities/task.js.map +0 -1
  82. package/src/domain/entities/task.ts +0 -319
  83. package/src/domain/index.ts +0 -41
  84. package/src/domain/repositories/agent-repository.interface.d.ts +0 -57
  85. package/src/domain/repositories/agent-repository.interface.d.ts.map +0 -1
  86. package/src/domain/repositories/agent-repository.interface.js +0 -9
  87. package/src/domain/repositories/agent-repository.interface.js.map +0 -1
  88. package/src/domain/repositories/agent-repository.interface.ts +0 -69
  89. package/src/domain/repositories/task-repository.interface.d.ts +0 -61
  90. package/src/domain/repositories/task-repository.interface.d.ts.map +0 -1
  91. package/src/domain/repositories/task-repository.interface.js +0 -9
  92. package/src/domain/repositories/task-repository.interface.js.map +0 -1
  93. package/src/domain/repositories/task-repository.interface.ts +0 -75
  94. package/src/domain/services/coordination-service.ts +0 -320
  95. package/src/federation-hub.d.ts +0 -284
  96. package/src/federation-hub.d.ts.map +0 -1
  97. package/src/federation-hub.js +0 -692
  98. package/src/federation-hub.js.map +0 -1
  99. package/src/federation-hub.ts +0 -979
  100. package/src/index.ts +0 -374
  101. package/src/message-bus.ts +0 -607
  102. package/src/queen-coordinator.ts +0 -2025
  103. package/src/shared/events.ts +0 -285
  104. package/src/shared/types.ts +0 -389
  105. package/src/topology-manager.ts +0 -656
  106. package/src/types.ts +0 -555
  107. package/src/unified-coordinator.ts +0 -1844
  108. package/src/workers/index.ts +0 -65
  109. package/src/workers/worker-dispatch.d.ts +0 -234
  110. package/src/workers/worker-dispatch.d.ts.map +0 -1
  111. package/src/workers/worker-dispatch.js +0 -842
  112. package/src/workers/worker-dispatch.js.map +0 -1
  113. package/src/workers/worker-dispatch.ts +0 -1076
  114. package/tmp.json +0 -0
  115. package/tsconfig.json +0 -9
  116. package/tsconfig.tsbuildinfo +0 -1
  117. package/vitest.config.ts +0 -20
package/src/index.ts DELETED
@@ -1,374 +0,0 @@
1
- /**
2
- * @claude-flow/swarm
3
- * V3 Unified Swarm Coordination Module (ADR-003)
4
- *
5
- * ADR-003 IMPLEMENTATION:
6
- * This module provides ONE CANONICAL coordination engine: UnifiedSwarmCoordinator
7
- * SwarmHub is maintained ONLY as a compatibility layer for existing code.
8
- *
9
- * Provides 15-agent hierarchical mesh coordination with consensus algorithms.
10
- *
11
- * Features:
12
- * - Unified SwarmCoordinator consolidating 4 legacy systems
13
- * - Multiple topology support: mesh, hierarchical, centralized, hybrid
14
- * - Consensus algorithms: raft, byzantine, gossip
15
- * - Agent pool management with workload balancing
16
- * - Message bus for inter-agent communication
17
- *
18
- * Performance Targets:
19
- * - Agent coordination: <100ms for 15 agents
20
- * - Consensus: <100ms
21
- * - Message throughput: 1000+ msgs/sec
22
- *
23
- * Recommended Usage:
24
- * ```typescript
25
- * import { createUnifiedSwarmCoordinator } from '@claude-flow/swarm';
26
- *
27
- * const coordinator = createUnifiedSwarmCoordinator({
28
- * topology: { type: 'hierarchical', maxAgents: 15 },
29
- * consensus: { algorithm: 'raft', threshold: 0.66 },
30
- * });
31
- *
32
- * await coordinator.initialize();
33
- * ```
34
- *
35
- * @module @claude-flow/swarm
36
- * @version 3.0.0-alpha.1
37
- */
38
-
39
- // =============================================================================
40
- // Types
41
- // =============================================================================
42
-
43
- export * from './types.js';
44
-
45
- // Re-export commonly used types for convenience
46
- export type {
47
- SwarmId,
48
- AgentId,
49
- TaskId,
50
- AgentState,
51
- AgentType,
52
- AgentStatus,
53
- AgentCapabilities,
54
- AgentMetrics,
55
- TaskDefinition,
56
- TaskType,
57
- TaskStatus,
58
- TaskPriority,
59
- TopologyType,
60
- TopologyConfig,
61
- TopologyState,
62
- TopologyNode,
63
- ConsensusAlgorithm,
64
- ConsensusConfig,
65
- ConsensusProposal,
66
- ConsensusVote,
67
- ConsensusResult,
68
- Message,
69
- MessageType,
70
- MessageBusConfig,
71
- MessageBusStats,
72
- CoordinatorConfig,
73
- CoordinatorState,
74
- CoordinatorMetrics,
75
- SwarmStatus,
76
- SwarmEvent,
77
- SwarmEventType,
78
- PerformanceReport,
79
- AgentPoolConfig,
80
- AgentPoolState,
81
- } from './types.js';
82
-
83
- // =============================================================================
84
- // Unified Coordinator
85
- // =============================================================================
86
-
87
- export {
88
- UnifiedSwarmCoordinator,
89
- createUnifiedSwarmCoordinator,
90
- } from './unified-coordinator.js';
91
-
92
- // Domain types for 15-agent hierarchy
93
- export type {
94
- AgentDomain,
95
- DomainConfig,
96
- TaskAssignment,
97
- ParallelExecutionResult,
98
- DomainStatus,
99
- } from './unified-coordinator.js';
100
-
101
- // =============================================================================
102
- // Queen Coordinator (Hive-Mind Central Orchestrator)
103
- // =============================================================================
104
-
105
- export {
106
- QueenCoordinator,
107
- createQueenCoordinator,
108
- } from './queen-coordinator.js';
109
-
110
- // Queen Coordinator types
111
- export type {
112
- // Configuration
113
- QueenCoordinatorConfig,
114
-
115
- // Task Analysis
116
- TaskAnalysis,
117
- SubTask,
118
- MatchedPattern,
119
- ResourceRequirements,
120
-
121
- // Delegation
122
- DelegationPlan,
123
- AgentAssignment,
124
- ParallelAssignment,
125
- ExecutionStrategy,
126
- AgentScore,
127
-
128
- // Health Monitoring
129
- HealthReport,
130
- DomainHealthStatus,
131
- AgentHealthEntry,
132
- Bottleneck,
133
- HealthAlert,
134
- HealthMetrics,
135
-
136
- // Consensus
137
- Decision,
138
- DecisionType,
139
- ConsensusType,
140
-
141
- // Learning
142
- TaskResult,
143
- TaskMetrics,
144
-
145
- // Interfaces
146
- ISwarmCoordinator,
147
- INeuralLearningSystem,
148
- IMemoryService,
149
- PatternMatchResult,
150
- MemoryRetrievalResult,
151
- SearchResultEntry,
152
- MemoryStoreEntry,
153
- } from './queen-coordinator.js';
154
-
155
- // =============================================================================
156
- // Topology Manager
157
- // =============================================================================
158
-
159
- export {
160
- TopologyManager,
161
- createTopologyManager,
162
- } from './topology-manager.js';
163
-
164
- // =============================================================================
165
- // Message Bus
166
- // =============================================================================
167
-
168
- export {
169
- MessageBus,
170
- createMessageBus,
171
- } from './message-bus.js';
172
-
173
- // =============================================================================
174
- // Agent Pool
175
- // =============================================================================
176
-
177
- export {
178
- AgentPool,
179
- createAgentPool,
180
- } from './agent-pool.js';
181
-
182
- // =============================================================================
183
- // Consensus Engines
184
- // =============================================================================
185
-
186
- export {
187
- ConsensusEngine,
188
- createConsensusEngine,
189
- selectOptimalAlgorithm,
190
- RaftConsensus,
191
- ByzantineConsensus,
192
- GossipConsensus,
193
- } from './consensus/index.js';
194
-
195
- export type {
196
- RaftConfig,
197
- ByzantineConfig,
198
- GossipConfig,
199
- } from './consensus/index.js';
200
-
201
- // ADR-095 G2.2 — pluggable consensus transport. Re-export so consumers
202
- // (@claude-flow/cli's hive-consensus-runtime, downstream plugins) don't
203
- // have to deep-import from ./consensus/* or ./consensus/transport.js.
204
- export {
205
- LocalTransport,
206
- LocalTransportRegistry,
207
- defaultLocalRegistry,
208
- FederationTransport,
209
- generateNodeKeyPair,
210
- signMessage,
211
- verifyMessage,
212
- canonicalizeForSigning,
213
- messageDigest,
214
- } from './consensus/index.js';
215
-
216
- export type {
217
- ConsensusTransport,
218
- ConsensusMessage,
219
- ConsensusReply,
220
- ConsensusMessageHandler,
221
- NodeKeyPair,
222
- LocalTransportOptions,
223
- AgenticFlowTransportLike,
224
- FederationTransportOptions,
225
- } from './consensus/index.js';
226
-
227
- // =============================================================================
228
- // Coordination Components
229
- // =============================================================================
230
-
231
- export {
232
- AgentRegistry,
233
- createAgentRegistry,
234
- type IAgentRegistry,
235
- } from './coordination/agent-registry.js';
236
-
237
- export {
238
- TaskOrchestrator,
239
- createTaskOrchestrator,
240
- type ITaskOrchestrator,
241
- type TaskSpec,
242
- } from './coordination/task-orchestrator.js';
243
-
244
- /**
245
- * @deprecated SwarmHub is a compatibility layer. Use UnifiedSwarmCoordinator directly.
246
- *
247
- * Migration:
248
- * ```typescript
249
- * // OLD:
250
- * import { createSwarmHub } from '@claude-flow/swarm';
251
- * const hub = createSwarmHub();
252
- *
253
- * // NEW:
254
- * import { createUnifiedSwarmCoordinator } from '@claude-flow/swarm';
255
- * const coordinator = createUnifiedSwarmCoordinator();
256
- * ```
257
- */
258
- export {
259
- SwarmHub,
260
- createSwarmHub,
261
- type ISwarmHub,
262
- } from './coordination/swarm-hub.js';
263
-
264
- // =============================================================================
265
- // Worker Dispatch (agentic-flow@alpha compatible)
266
- // =============================================================================
267
-
268
- export {
269
- WorkerDispatchService,
270
- getWorkerDispatchService,
271
- type WorkerTrigger,
272
- type WorkerStatus,
273
- type WorkerInstance,
274
- type WorkerResult,
275
- type DispatchOptions,
276
- type TriggerDetectionResult,
277
- type WorkerConfig,
278
- type WorkerMetrics,
279
- type WorkerArtifact,
280
- } from './workers/worker-dispatch.js';
281
-
282
- // =============================================================================
283
- // Attention Coordinator (Flash/MoE/GraphRoPE)
284
- // =============================================================================
285
-
286
- export {
287
- AttentionCoordinator,
288
- createAttentionCoordinator,
289
- type AttentionType,
290
- type AttentionCoordinatorConfig,
291
- type CoordinationResult,
292
- type ExpertRoutingResult,
293
- type AgentOutput,
294
- type Task as AttentionTask,
295
- type SpecializedAgent,
296
- type SwarmTopology,
297
- type GraphContext,
298
- } from './attention-coordinator.js';
299
-
300
- // =============================================================================
301
- // Federation Hub (Ephemeral Agent Coordination)
302
- // =============================================================================
303
-
304
- export {
305
- FederationHub,
306
- createFederationHub,
307
- getDefaultFederationHub,
308
- resetDefaultFederationHub,
309
- type FederationId,
310
- type SwarmId as FederationSwarmId,
311
- type EphemeralAgentId,
312
- type FederationConfig,
313
- type SwarmRegistration,
314
- type EphemeralAgent,
315
- type SpawnEphemeralOptions,
316
- type SpawnResult,
317
- type FederationMessage,
318
- type ConsensusProposal as FederationConsensusProposal,
319
- type FederationStats,
320
- type FederationEvent,
321
- type FederationEventType,
322
- } from './federation-hub.js';
323
-
324
- // =============================================================================
325
- // Default Export
326
- // =============================================================================
327
-
328
- import { UnifiedSwarmCoordinator, createUnifiedSwarmCoordinator } from './unified-coordinator.js';
329
- export default UnifiedSwarmCoordinator;
330
-
331
- // =============================================================================
332
- // Constants
333
- // =============================================================================
334
-
335
- /** Module version */
336
- export const VERSION = '3.0.0-alpha.1';
337
-
338
- /** Performance targets for swarm operations */
339
- export const PERFORMANCE_TARGETS = {
340
- /** Maximum latency for coordinating 15 agents */
341
- COORDINATION_LATENCY_MS: 100,
342
- /** Maximum latency for consensus operations */
343
- CONSENSUS_LATENCY_MS: 100,
344
- /** Minimum message throughput */
345
- MESSAGE_THROUGHPUT: 1000,
346
- } as const;
347
-
348
- /** Supported topology types */
349
- export const TOPOLOGY_TYPES = ['mesh', 'hierarchical', 'centralized', 'hybrid'] as const;
350
-
351
- /** Supported consensus algorithms */
352
- export const CONSENSUS_ALGORITHMS = ['raft', 'byzantine', 'gossip', 'paxos'] as const;
353
-
354
- /** Default swarm configuration */
355
- export const DEFAULT_CONFIG = {
356
- topology: {
357
- type: 'hierarchical' as const,
358
- maxAgents: 15,
359
- },
360
- consensus: {
361
- algorithm: 'raft' as const,
362
- threshold: 0.66,
363
- timeoutMs: 5000,
364
- },
365
- messageBus: {
366
- maxQueueSize: 10000,
367
- batchSize: 100,
368
- },
369
- agentPool: {
370
- minAgents: 1,
371
- maxAgents: 15,
372
- idleTimeoutMs: 300000,
373
- },
374
- } as const;