swarmdo 1.45.0 → 1.54.1

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 (207) hide show
  1. package/.claude/helpers/hook-handler.cjs +16 -0
  2. package/.claude/helpers/router.cjs +27 -1
  3. package/.claude/settings.local.json +7 -0
  4. package/README.md +6 -2
  5. package/package.json +1 -1
  6. package/v3/@swarmdo/cli/dist/src/agent-bridge/bridge.d.ts +104 -0
  7. package/v3/@swarmdo/cli/dist/src/agent-bridge/bridge.js +133 -0
  8. package/v3/@swarmdo/cli/dist/src/commands/agent.js +133 -1
  9. package/v3/@swarmdo/cli/dist/src/commands/config.js +32 -1
  10. package/v3/@swarmdo/cli/dist/src/commands/hidden-coupling.d.ts +19 -0
  11. package/v3/@swarmdo/cli/dist/src/commands/hidden-coupling.js +92 -0
  12. package/v3/@swarmdo/cli/dist/src/commands/index.js +14 -4
  13. package/v3/@swarmdo/cli/dist/src/commands/ownership.d.ts +18 -0
  14. package/v3/@swarmdo/cli/dist/src/commands/ownership.js +88 -0
  15. package/v3/@swarmdo/cli/dist/src/commands/pack.js +4 -4
  16. package/v3/@swarmdo/cli/dist/src/commands/standup.d.ts +18 -0
  17. package/v3/@swarmdo/cli/dist/src/commands/standup.js +116 -0
  18. package/v3/@swarmdo/cli/dist/src/commands/swarm.js +29 -0
  19. package/v3/@swarmdo/cli/dist/src/config-lint/commands-lint.d.ts +31 -0
  20. package/v3/@swarmdo/cli/dist/src/config-lint/commands-lint.js +127 -0
  21. package/v3/@swarmdo/cli/dist/src/config-lint/lint.d.ts +5 -0
  22. package/v3/@swarmdo/cli/dist/src/config-lint/lint.js +4 -0
  23. package/v3/@swarmdo/cli/dist/src/coupling/hidden.d.ts +45 -0
  24. package/v3/@swarmdo/cli/dist/src/coupling/hidden.js +66 -0
  25. package/v3/@swarmdo/cli/dist/src/init/helpers-generator.js +41 -1
  26. package/v3/@swarmdo/cli/dist/src/mcp-client.js +2 -0
  27. package/v3/@swarmdo/cli/dist/src/mcp-tools/agent-tools.js +166 -0
  28. package/v3/@swarmdo/cli/dist/src/mcp-tools/index.d.ts +1 -0
  29. package/v3/@swarmdo/cli/dist/src/mcp-tools/index.js +1 -0
  30. package/v3/@swarmdo/cli/dist/src/mcp-tools/ownership-tools.d.ts +14 -0
  31. package/v3/@swarmdo/cli/dist/src/mcp-tools/ownership-tools.js +51 -0
  32. package/v3/@swarmdo/cli/dist/src/mcp-tools/profiles.js +1 -0
  33. package/v3/@swarmdo/cli/dist/src/mcp-tools/swarm-tools.d.ts +33 -0
  34. package/v3/@swarmdo/cli/dist/src/mcp-tools/swarm-tools.js +73 -38
  35. package/v3/@swarmdo/cli/dist/src/ownership/ownership.d.ts +61 -0
  36. package/v3/@swarmdo/cli/dist/src/ownership/ownership.js +151 -0
  37. package/v3/@swarmdo/cli/dist/src/pack/pack.d.ts +1 -1
  38. package/v3/@swarmdo/cli/dist/src/pack/pack.js +12 -4
  39. package/v3/@swarmdo/cli/dist/src/redact/redact.js +28 -9
  40. package/v3/@swarmdo/cli/dist/src/standup/standup.d.ts +83 -0
  41. package/v3/@swarmdo/cli/dist/src/standup/standup.js +157 -0
  42. package/v3/@swarmdo/cli/package.json +1 -1
  43. package/v3/@swarmdo/cli-core/dist/src/index.js +1 -1
  44. package/v3/@swarmdo/codex/dist/cli.js +0 -0
  45. package/v3/@swarmdo/hooks/dist/cli/guidance-cli.js +0 -0
  46. package/v3/@swarmdo/hooks/dist/statusline/index.d.ts +3 -3
  47. package/v3/@swarmdo/hooks/dist/statusline/index.js +3 -3
  48. package/v3/@swarmdo/integration/dist/__tests__/agentic-flow-agent.test.js +1 -4
  49. package/v3/@swarmdo/neural/dist/flash-attention.d.ts +1 -1
  50. package/v3/@swarmdo/neural/dist/flash-attention.js +1 -1
  51. package/v3/@swarmdo/plugin-agent-federation/dist/plugin.js +1 -1
  52. package/v3/@swarmdo/plugin-agent-federation/dist/transport/midstream-aware-loader.js +2 -2
  53. package/v3/@swarmdo/plugin-iot-cognitum/dist/application/index.d.ts +2 -0
  54. package/v3/@swarmdo/plugin-iot-cognitum/dist/application/index.js +2 -0
  55. package/v3/@swarmdo/plugin-iot-cognitum/dist/application/iot-coordinator.d.ts +138 -0
  56. package/v3/@swarmdo/plugin-iot-cognitum/dist/application/iot-coordinator.js +418 -0
  57. package/v3/@swarmdo/plugin-iot-cognitum/dist/bin.d.ts +15 -0
  58. package/v3/@swarmdo/plugin-iot-cognitum/dist/bin.js +240 -0
  59. package/v3/@swarmdo/plugin-iot-cognitum/dist/cli-commands.d.ts +7 -0
  60. package/v3/@swarmdo/plugin-iot-cognitum/dist/cli-commands.js +508 -0
  61. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/entities/device-agent.d.ts +54 -0
  62. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/entities/device-agent.js +2 -0
  63. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/entities/device-fleet.d.ts +46 -0
  64. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/entities/device-fleet.js +2 -0
  65. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/entities/device-trust-level.d.ts +18 -0
  66. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/entities/device-trust-level.js +28 -0
  67. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/entities/index.d.ts +5 -0
  68. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/entities/index.js +2 -0
  69. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/entities/telemetry.d.ts +35 -0
  70. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/entities/telemetry.js +2 -0
  71. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/repositories/device-repository.d.ts +11 -0
  72. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/repositories/device-repository.js +2 -0
  73. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/repositories/fleet-repository.d.ts +9 -0
  74. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/repositories/fleet-repository.js +2 -0
  75. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/repositories/index.d.ts +5 -0
  76. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/repositories/index.js +2 -0
  77. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/repositories/telemetry-repository.d.ts +12 -0
  78. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/repositories/telemetry-repository.js +2 -0
  79. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/repositories/trust-history-repository.d.ts +19 -0
  80. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/repositories/trust-history-repository.js +2 -0
  81. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/anomaly-detection-service.d.ts +44 -0
  82. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/anomaly-detection-service.js +117 -0
  83. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/device-lifecycle-service.d.ts +70 -0
  84. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/device-lifecycle-service.js +194 -0
  85. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/firmware-orchestration-service.d.ts +69 -0
  86. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/firmware-orchestration-service.js +139 -0
  87. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/fleet-topology-service.d.ts +34 -0
  88. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/fleet-topology-service.js +101 -0
  89. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/index.d.ts +10 -0
  90. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/index.js +10 -0
  91. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/mesh-service.d.ts +64 -0
  92. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/mesh-service.js +70 -0
  93. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/sona-integration-service.d.ts +44 -0
  94. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/sona-integration-service.js +79 -0
  95. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/telemetry-ingestion-service.d.ts +37 -0
  96. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/telemetry-ingestion-service.js +39 -0
  97. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/telemetry-service.d.ts +67 -0
  98. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/telemetry-service.js +58 -0
  99. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/witness-verification-service.d.ts +45 -0
  100. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/witness-verification-service.js +63 -0
  101. package/v3/@swarmdo/plugin-iot-cognitum/dist/index.d.ts +26 -0
  102. package/v3/@swarmdo/plugin-iot-cognitum/dist/index.js +17 -0
  103. package/v3/@swarmdo/plugin-iot-cognitum/dist/infrastructure/agentdb-telemetry-repository.d.ts +51 -0
  104. package/v3/@swarmdo/plugin-iot-cognitum/dist/infrastructure/agentdb-telemetry-repository.js +110 -0
  105. package/v3/@swarmdo/plugin-iot-cognitum/dist/infrastructure/in-memory-device-repository.d.ts +13 -0
  106. package/v3/@swarmdo/plugin-iot-cognitum/dist/infrastructure/in-memory-device-repository.js +25 -0
  107. package/v3/@swarmdo/plugin-iot-cognitum/dist/infrastructure/in-memory-fleet-repository.d.ts +11 -0
  108. package/v3/@swarmdo/plugin-iot-cognitum/dist/infrastructure/in-memory-fleet-repository.js +19 -0
  109. package/v3/@swarmdo/plugin-iot-cognitum/dist/infrastructure/in-memory-trust-history-repository.d.ts +11 -0
  110. package/v3/@swarmdo/plugin-iot-cognitum/dist/infrastructure/in-memory-trust-history-repository.js +27 -0
  111. package/v3/@swarmdo/plugin-iot-cognitum/dist/infrastructure/index.d.ts +6 -0
  112. package/v3/@swarmdo/plugin-iot-cognitum/dist/infrastructure/index.js +6 -0
  113. package/v3/@swarmdo/plugin-iot-cognitum/dist/infrastructure/seed-client-factory.d.ts +41 -0
  114. package/v3/@swarmdo/plugin-iot-cognitum/dist/infrastructure/seed-client-factory.js +64 -0
  115. package/v3/@swarmdo/plugin-iot-cognitum/dist/mcp-tools.d.ts +8 -0
  116. package/v3/@swarmdo/plugin-iot-cognitum/dist/mcp-tools.js +703 -0
  117. package/v3/@swarmdo/plugin-iot-cognitum/dist/plugin.d.ts +23 -0
  118. package/v3/@swarmdo/plugin-iot-cognitum/dist/plugin.js +239 -0
  119. package/v3/@swarmdo/plugin-iot-cognitum/dist/workers/anomaly-scan-worker.d.ts +17 -0
  120. package/v3/@swarmdo/plugin-iot-cognitum/dist/workers/anomaly-scan-worker.js +42 -0
  121. package/v3/@swarmdo/plugin-iot-cognitum/dist/workers/firmware-watch-worker.d.ts +18 -0
  122. package/v3/@swarmdo/plugin-iot-cognitum/dist/workers/firmware-watch-worker.js +45 -0
  123. package/v3/@swarmdo/plugin-iot-cognitum/dist/workers/health-probe-worker.d.ts +19 -0
  124. package/v3/@swarmdo/plugin-iot-cognitum/dist/workers/health-probe-worker.js +50 -0
  125. package/v3/@swarmdo/plugin-iot-cognitum/dist/workers/mesh-sync-worker.d.ts +19 -0
  126. package/v3/@swarmdo/plugin-iot-cognitum/dist/workers/mesh-sync-worker.js +47 -0
  127. package/v3/@swarmdo/plugin-iot-cognitum/dist/workers/telemetry-ingest-worker.d.ts +17 -0
  128. package/v3/@swarmdo/plugin-iot-cognitum/dist/workers/telemetry-ingest-worker.js +40 -0
  129. package/v3/@swarmdo/plugin-iot-cognitum/dist/workers/witness-audit-worker.d.ts +18 -0
  130. package/v3/@swarmdo/plugin-iot-cognitum/dist/workers/witness-audit-worker.js +51 -0
  131. package/v3/@swarmdo/providers/dist/swarmvector-provider.d.ts +1 -1
  132. package/v3/@swarmdo/providers/dist/swarmvector-provider.js +1 -1
  133. package/v3/@swarmdo/security/dist/input-validator.d.ts +6 -6
  134. package/v3/@swarmdo/shared/dist/hooks/safety/git-commit.js +1 -1
  135. package/v3/@swarmdo/shared/dist/mcp/transport/http.js +1 -8
  136. package/v3/@swarmdo/testing/dist/fixtures/agent-fixtures.d.ts +214 -0
  137. package/v3/@swarmdo/testing/dist/fixtures/agent-fixtures.js +595 -0
  138. package/v3/@swarmdo/testing/dist/fixtures/agents.d.ts +76 -0
  139. package/v3/@swarmdo/testing/dist/fixtures/agents.js +158 -0
  140. package/v3/@swarmdo/testing/dist/fixtures/configurations.d.ts +157 -0
  141. package/v3/@swarmdo/testing/dist/fixtures/configurations.js +337 -0
  142. package/v3/@swarmdo/testing/dist/fixtures/index.d.ts +10 -0
  143. package/v3/@swarmdo/testing/dist/fixtures/index.js +17 -0
  144. package/v3/@swarmdo/testing/dist/fixtures/mcp-fixtures.d.ts +329 -0
  145. package/v3/@swarmdo/testing/dist/fixtures/mcp-fixtures.js +714 -0
  146. package/v3/@swarmdo/testing/dist/fixtures/memory-entries.d.ts +159 -0
  147. package/v3/@swarmdo/testing/dist/fixtures/memory-entries.js +262 -0
  148. package/v3/@swarmdo/testing/dist/fixtures/memory-fixtures.d.ts +290 -0
  149. package/v3/@swarmdo/testing/dist/fixtures/memory-fixtures.js +547 -0
  150. package/v3/@swarmdo/testing/dist/fixtures/swarm-fixtures.d.ts +289 -0
  151. package/v3/@swarmdo/testing/dist/fixtures/swarm-fixtures.js +534 -0
  152. package/v3/@swarmdo/testing/dist/fixtures/tasks.d.ts +106 -0
  153. package/v3/@swarmdo/testing/dist/fixtures/tasks.js +229 -0
  154. package/v3/@swarmdo/testing/dist/helpers/assertion-helpers.d.ts +213 -0
  155. package/v3/@swarmdo/testing/dist/helpers/assertion-helpers.js +435 -0
  156. package/v3/@swarmdo/testing/dist/helpers/assertions.d.ts +135 -0
  157. package/v3/@swarmdo/testing/dist/helpers/assertions.js +217 -0
  158. package/v3/@swarmdo/testing/dist/helpers/create-mock.d.ts +96 -0
  159. package/v3/@swarmdo/testing/dist/helpers/create-mock.js +164 -0
  160. package/v3/@swarmdo/testing/dist/helpers/index.d.ts +14 -0
  161. package/v3/@swarmdo/testing/dist/helpers/index.js +22 -0
  162. package/v3/@swarmdo/testing/dist/helpers/mock-factory.d.ts +323 -0
  163. package/v3/@swarmdo/testing/dist/helpers/mock-factory.js +350 -0
  164. package/v3/@swarmdo/testing/dist/helpers/setup-teardown.d.ts +271 -0
  165. package/v3/@swarmdo/testing/dist/helpers/setup-teardown.js +446 -0
  166. package/v3/@swarmdo/testing/dist/helpers/swarm-instance.d.ts +142 -0
  167. package/v3/@swarmdo/testing/dist/helpers/swarm-instance.js +205 -0
  168. package/v3/@swarmdo/testing/dist/helpers/test-application.d.ts +190 -0
  169. package/v3/@swarmdo/testing/dist/helpers/test-application.js +138 -0
  170. package/v3/@swarmdo/testing/dist/helpers/test-utils.d.ts +274 -0
  171. package/v3/@swarmdo/testing/dist/helpers/test-utils.js +456 -0
  172. package/v3/@swarmdo/testing/dist/index.d.ts +42 -0
  173. package/v3/@swarmdo/testing/dist/index.js +66 -0
  174. package/v3/@swarmdo/testing/dist/mocks/index.d.ts +8 -0
  175. package/v3/@swarmdo/testing/dist/mocks/index.js +10 -0
  176. package/v3/@swarmdo/testing/dist/mocks/mock-mcp-client.d.ts +206 -0
  177. package/v3/@swarmdo/testing/dist/mocks/mock-mcp-client.js +575 -0
  178. package/v3/@swarmdo/testing/dist/mocks/mock-services.d.ts +287 -0
  179. package/v3/@swarmdo/testing/dist/mocks/mock-services.js +563 -0
  180. package/v3/@swarmdo/testing/dist/regression/api-contract.d.ts +109 -0
  181. package/v3/@swarmdo/testing/dist/regression/api-contract.js +374 -0
  182. package/v3/@swarmdo/testing/dist/regression/index.d.ts +18 -0
  183. package/v3/@swarmdo/testing/dist/regression/index.js +18 -0
  184. package/v3/@swarmdo/testing/dist/regression/integration-regression.d.ts +67 -0
  185. package/v3/@swarmdo/testing/dist/regression/integration-regression.js +334 -0
  186. package/v3/@swarmdo/testing/dist/regression/performance-baseline.d.ts +106 -0
  187. package/v3/@swarmdo/testing/dist/regression/performance-baseline.js +268 -0
  188. package/v3/@swarmdo/testing/dist/regression/regression-runner.d.ts +124 -0
  189. package/v3/@swarmdo/testing/dist/regression/regression-runner.js +227 -0
  190. package/v3/@swarmdo/testing/dist/regression/security-regression.d.ts +73 -0
  191. package/v3/@swarmdo/testing/dist/regression/security-regression.js +258 -0
  192. package/v3/@swarmdo/testing/dist/setup.d.ts +43 -0
  193. package/v3/@swarmdo/testing/dist/setup.js +91 -0
  194. package/v3/@swarmdo/testing/dist/v2-compat/api-compat.test.d.ts +10 -0
  195. package/v3/@swarmdo/testing/dist/v2-compat/api-compat.test.js +433 -0
  196. package/v3/@swarmdo/testing/dist/v2-compat/cli-compat.test.d.ts +10 -0
  197. package/v3/@swarmdo/testing/dist/v2-compat/cli-compat.test.js +352 -0
  198. package/v3/@swarmdo/testing/dist/v2-compat/compatibility-validator.d.ts +206 -0
  199. package/v3/@swarmdo/testing/dist/v2-compat/compatibility-validator.js +839 -0
  200. package/v3/@swarmdo/testing/dist/v2-compat/hooks-compat.test.d.ts +10 -0
  201. package/v3/@swarmdo/testing/dist/v2-compat/hooks-compat.test.js +428 -0
  202. package/v3/@swarmdo/testing/dist/v2-compat/index.d.ts +38 -0
  203. package/v3/@swarmdo/testing/dist/v2-compat/index.js +41 -0
  204. package/v3/@swarmdo/testing/dist/v2-compat/mcp-compat.test.d.ts +10 -0
  205. package/v3/@swarmdo/testing/dist/v2-compat/mcp-compat.test.js +419 -0
  206. package/v3/@swarmdo/testing/dist/v2-compat/report-generator.d.ts +34 -0
  207. package/v3/@swarmdo/testing/dist/v2-compat/report-generator.js +372 -0
@@ -0,0 +1,534 @@
1
+ /**
2
+ * @swarmdo/testing - Swarm Fixtures
3
+ *
4
+ * Comprehensive mock swarm configurations, topologies, and coordination fixtures.
5
+ * Supports hierarchical-mesh, adaptive, and all consensus protocols.
6
+ *
7
+ * Based on ADR-003 (Single Coordination Engine) and V3 swarm specifications.
8
+ */
9
+ import { vi } from 'vitest';
10
+ /**
11
+ * Pre-defined swarm configurations for testing
12
+ */
13
+ export const swarmConfigs = {
14
+ v3Default: {
15
+ topology: 'hierarchical-mesh',
16
+ maxAgents: 15,
17
+ name: 'V3 Default Swarm',
18
+ description: 'Standard V3 15-agent hierarchical-mesh swarm',
19
+ coordination: {
20
+ consensusProtocol: 'raft',
21
+ heartbeatInterval: 1000,
22
+ electionTimeout: 5000,
23
+ consensusRequired: true,
24
+ timeoutMs: 8000,
25
+ retryPolicy: { maxRetries: 3, backoffMs: 1000 },
26
+ },
27
+ communication: {
28
+ protocol: 'quic',
29
+ maxMessageSize: 1048576, // 1MB
30
+ retryAttempts: 3,
31
+ compressionEnabled: true,
32
+ encryptionEnabled: true,
33
+ },
34
+ autoScale: {
35
+ enabled: true,
36
+ minAgents: 5,
37
+ maxAgents: 15,
38
+ scaleUpThreshold: 0.8,
39
+ scaleDownThreshold: 0.3,
40
+ cooldownMs: 30000,
41
+ },
42
+ healthCheck: {
43
+ enabled: true,
44
+ interval: 5000,
45
+ timeout: 2000,
46
+ unhealthyThreshold: 3,
47
+ healthyThreshold: 2,
48
+ },
49
+ },
50
+ minimal: {
51
+ topology: 'mesh',
52
+ maxAgents: 5,
53
+ name: 'Minimal Swarm',
54
+ description: 'Lightweight swarm for testing',
55
+ coordination: {
56
+ consensusProtocol: 'gossip',
57
+ heartbeatInterval: 2000,
58
+ electionTimeout: 10000,
59
+ consensusRequired: false,
60
+ timeoutMs: 5000,
61
+ retryPolicy: { maxRetries: 5, backoffMs: 500 },
62
+ },
63
+ communication: {
64
+ protocol: 'tcp',
65
+ maxMessageSize: 65536, // 64KB
66
+ retryAttempts: 5,
67
+ },
68
+ },
69
+ highPerformance: {
70
+ topology: 'adaptive',
71
+ maxAgents: 50,
72
+ name: 'High Performance Swarm',
73
+ description: 'Optimized for maximum throughput',
74
+ coordination: {
75
+ consensusProtocol: 'pbft',
76
+ heartbeatInterval: 500,
77
+ electionTimeout: 3000,
78
+ consensusRequired: true,
79
+ timeoutMs: 5000,
80
+ retryPolicy: { maxRetries: 2, backoffMs: 250 },
81
+ },
82
+ communication: {
83
+ protocol: 'quic',
84
+ maxMessageSize: 4194304, // 4MB
85
+ retryAttempts: 2,
86
+ compressionEnabled: true,
87
+ encryptionEnabled: true,
88
+ },
89
+ autoScale: {
90
+ enabled: true,
91
+ minAgents: 10,
92
+ maxAgents: 50,
93
+ scaleUpThreshold: 0.7,
94
+ scaleDownThreshold: 0.2,
95
+ cooldownMs: 15000,
96
+ },
97
+ },
98
+ byzantineFault: {
99
+ topology: 'mesh',
100
+ maxAgents: 7,
101
+ name: 'Byzantine Fault Tolerant Swarm',
102
+ description: 'Tolerant to malicious actors',
103
+ coordination: {
104
+ consensusProtocol: 'byzantine',
105
+ heartbeatInterval: 1000,
106
+ electionTimeout: 10000,
107
+ consensusRequired: true,
108
+ timeoutMs: 15000,
109
+ retryPolicy: { maxRetries: 5, backoffMs: 2000 },
110
+ },
111
+ communication: {
112
+ protocol: 'tcp',
113
+ maxMessageSize: 1048576,
114
+ retryAttempts: 3,
115
+ encryptionEnabled: true,
116
+ },
117
+ },
118
+ hierarchicalOnly: {
119
+ topology: 'hierarchical',
120
+ maxAgents: 20,
121
+ name: 'Hierarchical Swarm',
122
+ description: 'Pure hierarchical coordination',
123
+ coordination: {
124
+ consensusProtocol: 'raft',
125
+ heartbeatInterval: 1000,
126
+ electionTimeout: 5000,
127
+ consensusRequired: false,
128
+ timeoutMs: 5000,
129
+ retryPolicy: { maxRetries: 3, backoffMs: 1000 },
130
+ },
131
+ communication: {
132
+ protocol: 'websocket',
133
+ maxMessageSize: 524288, // 512KB
134
+ retryAttempts: 3,
135
+ },
136
+ },
137
+ ringTopology: {
138
+ topology: 'ring',
139
+ maxAgents: 10,
140
+ name: 'Ring Topology Swarm',
141
+ description: 'Token-passing ring coordination',
142
+ coordination: {
143
+ consensusProtocol: 'gossip',
144
+ heartbeatInterval: 1500,
145
+ electionTimeout: 8000,
146
+ consensusRequired: true,
147
+ timeoutMs: 8000,
148
+ retryPolicy: { maxRetries: 4, backoffMs: 750 },
149
+ },
150
+ communication: {
151
+ protocol: 'tcp',
152
+ maxMessageSize: 262144, // 256KB
153
+ retryAttempts: 4,
154
+ },
155
+ },
156
+ };
157
+ /**
158
+ * Pre-defined swarm states for testing
159
+ */
160
+ export const swarmStates = {
161
+ active: {
162
+ id: 'swarm-001',
163
+ topology: 'hierarchical-mesh',
164
+ status: 'active',
165
+ agentCount: 15,
166
+ activeAgentCount: 15,
167
+ leaderId: 'agent-queen-001',
168
+ createdAt: new Date('2024-01-01T00:00:00Z'),
169
+ lastHeartbeat: new Date(),
170
+ },
171
+ initializing: {
172
+ id: 'swarm-002',
173
+ topology: 'mesh',
174
+ status: 'initializing',
175
+ agentCount: 5,
176
+ activeAgentCount: 3,
177
+ createdAt: new Date(),
178
+ },
179
+ coordinating: {
180
+ id: 'swarm-003',
181
+ topology: 'adaptive',
182
+ status: 'coordinating',
183
+ agentCount: 10,
184
+ activeAgentCount: 10,
185
+ leaderId: 'agent-coordinator-001',
186
+ createdAt: new Date('2024-01-10T00:00:00Z'),
187
+ lastHeartbeat: new Date(),
188
+ },
189
+ consensus: {
190
+ id: 'swarm-004',
191
+ topology: 'hierarchical-mesh',
192
+ status: 'consensus',
193
+ agentCount: 15,
194
+ activeAgentCount: 14,
195
+ leaderId: 'agent-queen-001',
196
+ createdAt: new Date('2024-01-05T00:00:00Z'),
197
+ lastHeartbeat: new Date(),
198
+ },
199
+ error: {
200
+ id: 'swarm-005',
201
+ topology: 'mesh',
202
+ status: 'error',
203
+ agentCount: 8,
204
+ activeAgentCount: 3,
205
+ createdAt: new Date('2024-01-01T00:00:00Z'),
206
+ lastHeartbeat: new Date(Date.now() - 60000), // 1 minute ago
207
+ },
208
+ shutdown: {
209
+ id: 'swarm-006',
210
+ topology: 'hierarchical',
211
+ status: 'shutdown',
212
+ agentCount: 10,
213
+ activeAgentCount: 0,
214
+ createdAt: new Date('2024-01-01T00:00:00Z'),
215
+ },
216
+ };
217
+ /**
218
+ * Pre-defined swarm tasks for testing
219
+ */
220
+ export const swarmTasks = {
221
+ securityScan: {
222
+ id: 'task-security-001',
223
+ name: 'Security Scan',
224
+ type: 'security',
225
+ payload: { target: './src', scanType: 'full', severity: 'high' },
226
+ priority: 100,
227
+ status: 'pending',
228
+ createdAt: new Date(),
229
+ },
230
+ codeReview: {
231
+ id: 'task-review-001',
232
+ name: 'Code Review',
233
+ type: 'review',
234
+ payload: { files: ['src/main.ts'], rules: ['security', 'performance'] },
235
+ priority: 80,
236
+ status: 'assigned',
237
+ assignedTo: 'agent-reviewer-001',
238
+ createdAt: new Date(),
239
+ },
240
+ implementation: {
241
+ id: 'task-impl-001',
242
+ name: 'Feature Implementation',
243
+ type: 'coding',
244
+ payload: { feature: 'path-validation', module: 'security' },
245
+ priority: 70,
246
+ status: 'running',
247
+ assignedTo: 'agent-coder-001',
248
+ createdAt: new Date(Date.now() - 60000),
249
+ startedAt: new Date(Date.now() - 30000),
250
+ },
251
+ testing: {
252
+ id: 'task-test-001',
253
+ name: 'Unit Testing',
254
+ type: 'testing',
255
+ payload: { framework: 'vitest', coverage: 0.90 },
256
+ priority: 75,
257
+ status: 'completed',
258
+ assignedTo: 'agent-tester-001',
259
+ createdAt: new Date(Date.now() - 120000),
260
+ startedAt: new Date(Date.now() - 90000),
261
+ completedAt: new Date(Date.now() - 30000),
262
+ },
263
+ orchestration: {
264
+ id: 'task-orch-001',
265
+ name: 'Task Orchestration',
266
+ type: 'coordination',
267
+ payload: { subtasks: ['task-impl-001', 'task-test-001'], parallel: true },
268
+ priority: 90,
269
+ status: 'running',
270
+ assignedTo: 'agent-queen-001',
271
+ dependencies: ['task-security-001'],
272
+ createdAt: new Date(Date.now() - 180000),
273
+ startedAt: new Date(Date.now() - 120000),
274
+ },
275
+ };
276
+ /**
277
+ * Pre-defined swarm messages for testing
278
+ */
279
+ export const swarmMessages = {
280
+ taskAssignment: {
281
+ id: 'msg-001',
282
+ from: 'agent-queen-001',
283
+ to: 'agent-coder-001',
284
+ type: 'task',
285
+ payload: swarmTasks.implementation,
286
+ timestamp: new Date(),
287
+ correlationId: 'corr-001',
288
+ priority: 70,
289
+ },
290
+ taskResult: {
291
+ id: 'msg-002',
292
+ from: 'agent-coder-001',
293
+ to: 'agent-queen-001',
294
+ type: 'result',
295
+ payload: { taskId: 'task-impl-001', success: true, duration: 5000 },
296
+ timestamp: new Date(),
297
+ correlationId: 'corr-001',
298
+ replyTo: 'msg-001',
299
+ },
300
+ heartbeat: {
301
+ id: 'msg-003',
302
+ from: 'agent-queen-001',
303
+ to: 'broadcast',
304
+ type: 'heartbeat',
305
+ payload: { status: 'active', load: 0.6, taskCount: 5 },
306
+ timestamp: new Date(),
307
+ ttl: 5000,
308
+ },
309
+ election: {
310
+ id: 'msg-004',
311
+ from: 'agent-swarm-001',
312
+ to: 'broadcast',
313
+ type: 'election',
314
+ payload: { term: 5, candidateId: 'agent-swarm-001', lastLogIndex: 100 },
315
+ timestamp: new Date(),
316
+ priority: 100,
317
+ },
318
+ coordination: {
319
+ id: 'msg-005',
320
+ from: 'agent-queen-001',
321
+ to: 'agent-swarm-001',
322
+ type: 'coordination',
323
+ payload: { action: 'scale-up', targetAgents: 3 },
324
+ timestamp: new Date(),
325
+ correlationId: 'corr-002',
326
+ },
327
+ statusUpdate: {
328
+ id: 'msg-006',
329
+ from: 'agent-memory-001',
330
+ to: 'agent-queen-001',
331
+ type: 'status',
332
+ payload: { status: 'busy', currentTask: 'indexing', progress: 0.75 },
333
+ timestamp: new Date(),
334
+ },
335
+ };
336
+ /**
337
+ * Pre-defined coordination results for testing
338
+ */
339
+ export const coordinationResults = {
340
+ successful: {
341
+ success: true,
342
+ completedTasks: 10,
343
+ failedTasks: 0,
344
+ totalDuration: 15000,
345
+ agentMetrics: new Map([
346
+ ['agent-queen-001', { tasksCompleted: 3, tasksFailed: 0, averageTaskDuration: 200, messagesProcessed: 50, totalDuration: 600 }],
347
+ ['agent-coder-001', { tasksCompleted: 4, tasksFailed: 0, averageTaskDuration: 2000, messagesProcessed: 20, totalDuration: 8000 }],
348
+ ['agent-tester-001', { tasksCompleted: 3, tasksFailed: 0, averageTaskDuration: 1500, messagesProcessed: 15, totalDuration: 4500 }],
349
+ ]),
350
+ consensusRounds: 2,
351
+ },
352
+ partialFailure: {
353
+ success: true,
354
+ completedTasks: 8,
355
+ failedTasks: 2,
356
+ totalDuration: 20000,
357
+ agentMetrics: new Map([
358
+ ['agent-queen-001', { tasksCompleted: 2, tasksFailed: 0, averageTaskDuration: 250, messagesProcessed: 40, totalDuration: 500 }],
359
+ ['agent-coder-001', { tasksCompleted: 4, tasksFailed: 1, averageTaskDuration: 2500, messagesProcessed: 25, totalDuration: 10000 }],
360
+ ['agent-tester-001', { tasksCompleted: 2, tasksFailed: 1, averageTaskDuration: 2000, messagesProcessed: 18, totalDuration: 4000 }],
361
+ ]),
362
+ consensusRounds: 3,
363
+ },
364
+ failed: {
365
+ success: false,
366
+ completedTasks: 2,
367
+ failedTasks: 8,
368
+ totalDuration: 30000,
369
+ agentMetrics: new Map([
370
+ ['agent-queen-001', { tasksCompleted: 1, tasksFailed: 2, averageTaskDuration: 500, messagesProcessed: 60, totalDuration: 500 }],
371
+ ['agent-coder-001', { tasksCompleted: 1, tasksFailed: 3, averageTaskDuration: 5000, messagesProcessed: 30, totalDuration: 5000 }],
372
+ ]),
373
+ consensusRounds: 5,
374
+ },
375
+ };
376
+ /**
377
+ * Factory function to create swarm config with overrides
378
+ */
379
+ export function createSwarmConfig(base = 'v3Default', overrides) {
380
+ return mergeDeep(swarmConfigs[base], (overrides ?? {}));
381
+ }
382
+ /**
383
+ * Factory function to create swarm state with overrides
384
+ */
385
+ export function createSwarmState(base = 'active', overrides) {
386
+ return {
387
+ ...swarmStates[base],
388
+ ...overrides,
389
+ id: overrides?.id ?? swarmStates[base].id,
390
+ createdAt: overrides?.createdAt ?? swarmStates[base].createdAt,
391
+ };
392
+ }
393
+ /**
394
+ * Factory function to create swarm task with overrides
395
+ */
396
+ export function createSwarmTask(base = 'implementation', overrides) {
397
+ return {
398
+ ...swarmTasks[base],
399
+ ...overrides,
400
+ id: overrides?.id ?? `task-${Date.now()}-${Math.random().toString(36).slice(2, 7)}`,
401
+ createdAt: overrides?.createdAt ?? new Date(),
402
+ };
403
+ }
404
+ /**
405
+ * Factory function to create swarm message with overrides
406
+ */
407
+ export function createSwarmMessage(type, payload, overrides) {
408
+ return {
409
+ id: `msg-${Date.now()}-${Math.random().toString(36).slice(2, 7)}`,
410
+ from: 'agent-sender',
411
+ to: 'agent-receiver',
412
+ type,
413
+ payload,
414
+ timestamp: new Date(),
415
+ ...overrides,
416
+ };
417
+ }
418
+ /**
419
+ * Factory function to create consensus request
420
+ */
421
+ export function createConsensusRequest(topic, options, overrides) {
422
+ return {
423
+ topic,
424
+ options,
425
+ requiredVotes: 'majority',
426
+ timeout: 5000,
427
+ ...overrides,
428
+ };
429
+ }
430
+ /**
431
+ * Factory function to create coordination result
432
+ */
433
+ export function createCoordinationResult(base = 'successful', overrides) {
434
+ return {
435
+ ...coordinationResults[base],
436
+ ...overrides,
437
+ };
438
+ }
439
+ /**
440
+ * Create a batch of swarm tasks for testing
441
+ */
442
+ export function createSwarmTaskBatch(count, type = 'coding') {
443
+ return Array.from({ length: count }, (_, i) => ({
444
+ id: `batch-task-${i}`,
445
+ name: `Batch Task ${i + 1}`,
446
+ type,
447
+ payload: { index: i },
448
+ priority: Math.floor(Math.random() * 100),
449
+ status: 'pending',
450
+ createdAt: new Date(),
451
+ }));
452
+ }
453
+ /**
454
+ * Deep merge utility
455
+ */
456
+ function mergeDeep(target, source) {
457
+ const output = { ...target };
458
+ for (const key of Object.keys(source)) {
459
+ const sourceValue = source[key];
460
+ if (sourceValue && typeof sourceValue === 'object' && !Array.isArray(sourceValue)) {
461
+ output[key] = mergeDeep(target[key] ?? {}, sourceValue);
462
+ }
463
+ else {
464
+ output[key] = sourceValue;
465
+ }
466
+ }
467
+ return output;
468
+ }
469
+ /**
470
+ * Invalid swarm configurations for error testing
471
+ */
472
+ export const invalidSwarmConfigs = {
473
+ zeroAgents: createSwarmConfig('v3Default', { maxAgents: 0 }),
474
+ negativeHeartbeat: createSwarmConfig('v3Default', {
475
+ coordination: {
476
+ consensusProtocol: 'raft',
477
+ heartbeatInterval: -100,
478
+ electionTimeout: 5000,
479
+ },
480
+ }),
481
+ invalidTopology: {
482
+ ...swarmConfigs.v3Default,
483
+ topology: 'invalid-topology',
484
+ },
485
+ invalidProtocol: createSwarmConfig('v3Default', {
486
+ coordination: {
487
+ consensusProtocol: 'invalid-protocol',
488
+ heartbeatInterval: 1000,
489
+ electionTimeout: 5000,
490
+ },
491
+ }),
492
+ zeroMessageSize: createSwarmConfig('v3Default', {
493
+ communication: {
494
+ protocol: 'quic',
495
+ maxMessageSize: 0,
496
+ retryAttempts: 3,
497
+ },
498
+ }),
499
+ };
500
+ /**
501
+ * Create a mock swarm coordinator
502
+ */
503
+ export function createMockSwarmCoordinator() {
504
+ return {
505
+ initialize: vi.fn().mockResolvedValue(swarmStates.active),
506
+ coordinate: vi.fn().mockResolvedValue(coordinationResults.successful),
507
+ shutdown: vi.fn().mockResolvedValue(undefined),
508
+ addAgent: vi.fn().mockResolvedValue(undefined),
509
+ removeAgent: vi.fn().mockResolvedValue(undefined),
510
+ getState: vi.fn().mockReturnValue(swarmStates.active),
511
+ broadcast: vi.fn().mockResolvedValue(undefined),
512
+ requestConsensus: vi.fn().mockResolvedValue({
513
+ topic: 'test',
514
+ decision: 'option-1',
515
+ votes: new Map(),
516
+ consensus: true,
517
+ votingDuration: 100,
518
+ participatingAgents: [],
519
+ }),
520
+ };
521
+ }
522
+ /**
523
+ * Create a mock message bus
524
+ */
525
+ export function createMockMessageBus() {
526
+ return {
527
+ publish: vi.fn().mockResolvedValue(undefined),
528
+ subscribe: vi.fn().mockReturnValue(() => { }),
529
+ unsubscribe: vi.fn(),
530
+ request: vi.fn().mockResolvedValue(swarmMessages.taskResult),
531
+ getStats: vi.fn().mockReturnValue({ messagesSent: 0, messagesReceived: 0 }),
532
+ };
533
+ }
534
+ //# sourceMappingURL=swarm-fixtures.js.map
@@ -0,0 +1,106 @@
1
+ /**
2
+ * V3 Swarmdo Task Fixtures
3
+ *
4
+ * Test data for task-related testing
5
+ * Following London School principle of explicit test data
6
+ */
7
+ /**
8
+ * Task definition interface
9
+ */
10
+ export interface TaskDefinition {
11
+ name: string;
12
+ type: string;
13
+ payload: unknown;
14
+ priority?: number;
15
+ metadata?: Record<string, unknown>;
16
+ }
17
+ /**
18
+ * Task instance interface
19
+ */
20
+ export interface TaskInstance {
21
+ id: string;
22
+ name: string;
23
+ type: string;
24
+ status: TaskStatus;
25
+ payload: unknown;
26
+ priority: number;
27
+ createdAt: Date;
28
+ startedAt?: Date;
29
+ completedAt?: Date;
30
+ error?: string;
31
+ }
32
+ export type TaskStatus = 'pending' | 'running' | 'completed' | 'failed' | 'cancelled';
33
+ /**
34
+ * Task result interface
35
+ */
36
+ export interface TaskResult {
37
+ taskId: string;
38
+ success: boolean;
39
+ output?: unknown;
40
+ error?: Error;
41
+ duration: number;
42
+ metrics?: TaskMetrics;
43
+ }
44
+ /**
45
+ * Task metrics interface
46
+ */
47
+ export interface TaskMetrics {
48
+ cpuTime: number;
49
+ memoryUsage: number;
50
+ ioOperations: number;
51
+ }
52
+ /**
53
+ * Pre-defined task definitions for testing
54
+ */
55
+ export declare const taskDefinitions: Record<string, TaskDefinition>;
56
+ /**
57
+ * Pre-defined task instances for testing
58
+ */
59
+ export declare const taskInstances: Record<string, TaskInstance>;
60
+ /**
61
+ * Pre-defined task results for testing
62
+ */
63
+ export declare const taskResults: Record<string, TaskResult>;
64
+ /**
65
+ * Factory function to create task definition with overrides
66
+ */
67
+ export declare function createTaskDefinition(base: keyof typeof taskDefinitions, overrides?: Partial<TaskDefinition>): TaskDefinition;
68
+ /**
69
+ * Factory function to create task instance with overrides
70
+ */
71
+ export declare function createTaskInstance(base: keyof typeof taskInstances, overrides?: Partial<TaskInstance>): TaskInstance;
72
+ /**
73
+ * Factory function to create task result with overrides
74
+ */
75
+ export declare function createTaskResult(base: keyof typeof taskResults, overrides?: Partial<TaskResult>): TaskResult;
76
+ /**
77
+ * Invalid task definitions for error testing
78
+ */
79
+ export declare const invalidTaskDefinitions: {
80
+ emptyName: {
81
+ name: string;
82
+ type: string;
83
+ payload: {};
84
+ };
85
+ emptyType: {
86
+ name: string;
87
+ type: string;
88
+ payload: {};
89
+ };
90
+ nullPayload: {
91
+ name: string;
92
+ type: string;
93
+ payload: null;
94
+ };
95
+ invalidPriority: {
96
+ name: string;
97
+ type: string;
98
+ payload: {};
99
+ priority: number;
100
+ };
101
+ };
102
+ /**
103
+ * Task batch for swarm testing
104
+ */
105
+ export declare function createTaskBatch(count: number, type?: string): TaskDefinition[];
106
+ //# sourceMappingURL=tasks.d.ts.map