swarmdo 1.4.8 → 1.5.0

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 (210) hide show
  1. package/.claude/helpers/statusline.cjs +7 -7
  2. package/README.md +3 -1
  3. package/package.json +5 -3
  4. package/v3/@swarmdo/cli/dist/src/commands/hooks.js +26 -24
  5. package/v3/@swarmdo/cli/dist/src/commands/index.js +4 -0
  6. package/v3/@swarmdo/cli/dist/src/commands/integrations.d.ts +14 -0
  7. package/v3/@swarmdo/cli/dist/src/commands/integrations.js +158 -0
  8. package/v3/@swarmdo/cli/dist/src/commands/memory.js +50 -1
  9. package/v3/@swarmdo/cli/dist/src/commands/providers.js +3 -0
  10. package/v3/@swarmdo/cli/dist/src/commands/release.d.ts +15 -0
  11. package/v3/@swarmdo/cli/dist/src/commands/release.js +224 -0
  12. package/v3/@swarmdo/cli/dist/src/commands/security.js +14 -0
  13. package/v3/@swarmdo/cli/dist/src/commands/transcript.js +82 -1
  14. package/v3/@swarmdo/cli/dist/src/commands/usage.js +80 -1
  15. package/v3/@swarmdo/cli/dist/src/config-lint/lint.js +11 -1
  16. package/v3/@swarmdo/cli/dist/src/init/statusline-generator.js +6 -6
  17. package/v3/@swarmdo/cli/dist/src/integrations/integrations.d.ts +54 -0
  18. package/v3/@swarmdo/cli/dist/src/integrations/integrations.js +162 -0
  19. package/v3/@swarmdo/cli/dist/src/mcp-tools/agent-execute-core.js +25 -3
  20. package/v3/@swarmdo/cli/dist/src/mcp-tools/agentdb-tools.js +8 -8
  21. package/v3/@swarmdo/cli/dist/src/memory/graph-edge-writer.d.ts +12 -0
  22. package/v3/@swarmdo/cli/dist/src/memory/graph-edge-writer.js +32 -1
  23. package/v3/@swarmdo/cli/dist/src/memory-vault/watch.d.ts +32 -0
  24. package/v3/@swarmdo/cli/dist/src/memory-vault/watch.js +66 -0
  25. package/v3/@swarmdo/cli/dist/src/providers/openrouter-config.d.ts +91 -0
  26. package/v3/@swarmdo/cli/dist/src/providers/openrouter-config.js +186 -0
  27. package/v3/@swarmdo/cli/dist/src/release/release.d.ts +72 -0
  28. package/v3/@swarmdo/cli/dist/src/release/release.js +86 -0
  29. package/v3/@swarmdo/cli/dist/src/resilience/backoff.d.ts +23 -0
  30. package/v3/@swarmdo/cli/dist/src/resilience/backoff.js +30 -0
  31. package/v3/@swarmdo/cli/dist/src/swarmvector/model-router.js +14 -0
  32. package/v3/@swarmdo/cli/dist/src/transcript/search.d.ts +39 -0
  33. package/v3/@swarmdo/cli/dist/src/transcript/search.js +67 -0
  34. package/v3/@swarmdo/cli/dist/src/usage/diff.d.ts +69 -0
  35. package/v3/@swarmdo/cli/dist/src/usage/diff.js +112 -0
  36. package/v3/@swarmdo/cli/package.json +4 -4
  37. package/v3/@swarmdo/cli-core/dist/src/index.js +1 -1
  38. package/v3/@swarmdo/codex/dist/cli.js +0 -0
  39. package/v3/@swarmdo/hooks/dist/cli/guidance-cli.js +0 -0
  40. package/v3/@swarmdo/hooks/dist/statusline/index.d.ts +3 -3
  41. package/v3/@swarmdo/hooks/dist/statusline/index.js +3 -3
  42. package/v3/@swarmdo/integration/dist/__tests__/agentic-flow-agent.test.js +4 -1
  43. package/v3/@swarmdo/neural/dist/flash-attention.d.ts +1 -1
  44. package/v3/@swarmdo/neural/dist/flash-attention.js +1 -1
  45. package/v3/@swarmdo/plugin-agent-federation/dist/plugin.js +1 -1
  46. package/v3/@swarmdo/plugin-agent-federation/dist/transport/midstream-aware-loader.js +2 -2
  47. package/v3/@swarmdo/providers/dist/swarmvector-provider.d.ts +1 -1
  48. package/v3/@swarmdo/providers/dist/swarmvector-provider.js +1 -1
  49. package/v3/@swarmdo/security/dist/input-validator.d.ts +6 -6
  50. package/v3/@swarmdo/shared/dist/hooks/safety/git-commit.js +1 -1
  51. package/v3/@swarmdo/shared/dist/mcp/transport/http.js +8 -1
  52. package/v3/vendor/agentdb/package.json +0 -1
  53. package/v3/vendor/agentic-flow/package.json +0 -1
  54. package/.claude/scheduled_tasks.lock +0 -1
  55. package/.claude/skills/sdo-caveman-compress/scripts/__pycache__/__init__.cpython-314.pyc +0 -0
  56. package/.claude/skills/sdo-caveman-compress/scripts/__pycache__/__main__.cpython-314.pyc +0 -0
  57. package/.claude/skills/sdo-caveman-compress/scripts/__pycache__/cli.cpython-314.pyc +0 -0
  58. package/.claude/skills/sdo-caveman-compress/scripts/__pycache__/compress.cpython-314.pyc +0 -0
  59. package/.claude/skills/sdo-caveman-compress/scripts/__pycache__/detect.cpython-314.pyc +0 -0
  60. package/.claude/skills/sdo-caveman-compress/scripts/__pycache__/validate.cpython-314.pyc +0 -0
  61. package/v3/@swarmdo/plugin-iot-cognitum/dist/application/index.d.ts +0 -2
  62. package/v3/@swarmdo/plugin-iot-cognitum/dist/application/index.js +0 -2
  63. package/v3/@swarmdo/plugin-iot-cognitum/dist/application/iot-coordinator.d.ts +0 -138
  64. package/v3/@swarmdo/plugin-iot-cognitum/dist/application/iot-coordinator.js +0 -418
  65. package/v3/@swarmdo/plugin-iot-cognitum/dist/bin.d.ts +0 -15
  66. package/v3/@swarmdo/plugin-iot-cognitum/dist/bin.js +0 -240
  67. package/v3/@swarmdo/plugin-iot-cognitum/dist/cli-commands.d.ts +0 -7
  68. package/v3/@swarmdo/plugin-iot-cognitum/dist/cli-commands.js +0 -508
  69. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/entities/device-agent.d.ts +0 -54
  70. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/entities/device-agent.js +0 -2
  71. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/entities/device-fleet.d.ts +0 -46
  72. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/entities/device-fleet.js +0 -2
  73. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/entities/device-trust-level.d.ts +0 -18
  74. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/entities/device-trust-level.js +0 -28
  75. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/entities/index.d.ts +0 -5
  76. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/entities/index.js +0 -2
  77. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/entities/telemetry.d.ts +0 -35
  78. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/entities/telemetry.js +0 -2
  79. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/repositories/device-repository.d.ts +0 -11
  80. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/repositories/device-repository.js +0 -2
  81. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/repositories/fleet-repository.d.ts +0 -9
  82. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/repositories/fleet-repository.js +0 -2
  83. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/repositories/index.d.ts +0 -5
  84. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/repositories/index.js +0 -2
  85. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/repositories/telemetry-repository.d.ts +0 -12
  86. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/repositories/telemetry-repository.js +0 -2
  87. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/repositories/trust-history-repository.d.ts +0 -19
  88. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/repositories/trust-history-repository.js +0 -2
  89. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/anomaly-detection-service.d.ts +0 -44
  90. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/anomaly-detection-service.js +0 -117
  91. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/device-lifecycle-service.d.ts +0 -70
  92. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/device-lifecycle-service.js +0 -194
  93. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/firmware-orchestration-service.d.ts +0 -69
  94. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/firmware-orchestration-service.js +0 -139
  95. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/fleet-topology-service.d.ts +0 -34
  96. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/fleet-topology-service.js +0 -101
  97. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/index.d.ts +0 -10
  98. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/index.js +0 -10
  99. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/mesh-service.d.ts +0 -64
  100. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/mesh-service.js +0 -70
  101. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/sona-integration-service.d.ts +0 -44
  102. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/sona-integration-service.js +0 -79
  103. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/telemetry-ingestion-service.d.ts +0 -37
  104. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/telemetry-ingestion-service.js +0 -39
  105. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/telemetry-service.d.ts +0 -67
  106. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/telemetry-service.js +0 -58
  107. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/witness-verification-service.d.ts +0 -45
  108. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/witness-verification-service.js +0 -63
  109. package/v3/@swarmdo/plugin-iot-cognitum/dist/index.d.ts +0 -26
  110. package/v3/@swarmdo/plugin-iot-cognitum/dist/index.js +0 -17
  111. package/v3/@swarmdo/plugin-iot-cognitum/dist/infrastructure/agentdb-telemetry-repository.d.ts +0 -51
  112. package/v3/@swarmdo/plugin-iot-cognitum/dist/infrastructure/agentdb-telemetry-repository.js +0 -110
  113. package/v3/@swarmdo/plugin-iot-cognitum/dist/infrastructure/in-memory-device-repository.d.ts +0 -13
  114. package/v3/@swarmdo/plugin-iot-cognitum/dist/infrastructure/in-memory-device-repository.js +0 -25
  115. package/v3/@swarmdo/plugin-iot-cognitum/dist/infrastructure/in-memory-fleet-repository.d.ts +0 -11
  116. package/v3/@swarmdo/plugin-iot-cognitum/dist/infrastructure/in-memory-fleet-repository.js +0 -19
  117. package/v3/@swarmdo/plugin-iot-cognitum/dist/infrastructure/in-memory-trust-history-repository.d.ts +0 -11
  118. package/v3/@swarmdo/plugin-iot-cognitum/dist/infrastructure/in-memory-trust-history-repository.js +0 -27
  119. package/v3/@swarmdo/plugin-iot-cognitum/dist/infrastructure/index.d.ts +0 -6
  120. package/v3/@swarmdo/plugin-iot-cognitum/dist/infrastructure/index.js +0 -6
  121. package/v3/@swarmdo/plugin-iot-cognitum/dist/infrastructure/seed-client-factory.d.ts +0 -41
  122. package/v3/@swarmdo/plugin-iot-cognitum/dist/infrastructure/seed-client-factory.js +0 -64
  123. package/v3/@swarmdo/plugin-iot-cognitum/dist/mcp-tools.d.ts +0 -8
  124. package/v3/@swarmdo/plugin-iot-cognitum/dist/mcp-tools.js +0 -703
  125. package/v3/@swarmdo/plugin-iot-cognitum/dist/plugin.d.ts +0 -23
  126. package/v3/@swarmdo/plugin-iot-cognitum/dist/plugin.js +0 -239
  127. package/v3/@swarmdo/plugin-iot-cognitum/dist/workers/anomaly-scan-worker.d.ts +0 -17
  128. package/v3/@swarmdo/plugin-iot-cognitum/dist/workers/anomaly-scan-worker.js +0 -42
  129. package/v3/@swarmdo/plugin-iot-cognitum/dist/workers/firmware-watch-worker.d.ts +0 -18
  130. package/v3/@swarmdo/plugin-iot-cognitum/dist/workers/firmware-watch-worker.js +0 -45
  131. package/v3/@swarmdo/plugin-iot-cognitum/dist/workers/health-probe-worker.d.ts +0 -19
  132. package/v3/@swarmdo/plugin-iot-cognitum/dist/workers/health-probe-worker.js +0 -50
  133. package/v3/@swarmdo/plugin-iot-cognitum/dist/workers/mesh-sync-worker.d.ts +0 -19
  134. package/v3/@swarmdo/plugin-iot-cognitum/dist/workers/mesh-sync-worker.js +0 -47
  135. package/v3/@swarmdo/plugin-iot-cognitum/dist/workers/telemetry-ingest-worker.d.ts +0 -17
  136. package/v3/@swarmdo/plugin-iot-cognitum/dist/workers/telemetry-ingest-worker.js +0 -40
  137. package/v3/@swarmdo/plugin-iot-cognitum/dist/workers/witness-audit-worker.d.ts +0 -18
  138. package/v3/@swarmdo/plugin-iot-cognitum/dist/workers/witness-audit-worker.js +0 -51
  139. package/v3/@swarmdo/testing/dist/fixtures/agent-fixtures.d.ts +0 -214
  140. package/v3/@swarmdo/testing/dist/fixtures/agent-fixtures.js +0 -595
  141. package/v3/@swarmdo/testing/dist/fixtures/agents.d.ts +0 -76
  142. package/v3/@swarmdo/testing/dist/fixtures/agents.js +0 -158
  143. package/v3/@swarmdo/testing/dist/fixtures/configurations.d.ts +0 -157
  144. package/v3/@swarmdo/testing/dist/fixtures/configurations.js +0 -337
  145. package/v3/@swarmdo/testing/dist/fixtures/index.d.ts +0 -10
  146. package/v3/@swarmdo/testing/dist/fixtures/index.js +0 -17
  147. package/v3/@swarmdo/testing/dist/fixtures/mcp-fixtures.d.ts +0 -329
  148. package/v3/@swarmdo/testing/dist/fixtures/mcp-fixtures.js +0 -714
  149. package/v3/@swarmdo/testing/dist/fixtures/memory-entries.d.ts +0 -159
  150. package/v3/@swarmdo/testing/dist/fixtures/memory-entries.js +0 -262
  151. package/v3/@swarmdo/testing/dist/fixtures/memory-fixtures.d.ts +0 -290
  152. package/v3/@swarmdo/testing/dist/fixtures/memory-fixtures.js +0 -547
  153. package/v3/@swarmdo/testing/dist/fixtures/swarm-fixtures.d.ts +0 -289
  154. package/v3/@swarmdo/testing/dist/fixtures/swarm-fixtures.js +0 -534
  155. package/v3/@swarmdo/testing/dist/fixtures/tasks.d.ts +0 -106
  156. package/v3/@swarmdo/testing/dist/fixtures/tasks.js +0 -229
  157. package/v3/@swarmdo/testing/dist/helpers/assertion-helpers.d.ts +0 -213
  158. package/v3/@swarmdo/testing/dist/helpers/assertion-helpers.js +0 -435
  159. package/v3/@swarmdo/testing/dist/helpers/assertions.d.ts +0 -135
  160. package/v3/@swarmdo/testing/dist/helpers/assertions.js +0 -217
  161. package/v3/@swarmdo/testing/dist/helpers/create-mock.d.ts +0 -96
  162. package/v3/@swarmdo/testing/dist/helpers/create-mock.js +0 -164
  163. package/v3/@swarmdo/testing/dist/helpers/index.d.ts +0 -14
  164. package/v3/@swarmdo/testing/dist/helpers/index.js +0 -22
  165. package/v3/@swarmdo/testing/dist/helpers/mock-factory.d.ts +0 -323
  166. package/v3/@swarmdo/testing/dist/helpers/mock-factory.js +0 -350
  167. package/v3/@swarmdo/testing/dist/helpers/setup-teardown.d.ts +0 -271
  168. package/v3/@swarmdo/testing/dist/helpers/setup-teardown.js +0 -446
  169. package/v3/@swarmdo/testing/dist/helpers/swarm-instance.d.ts +0 -142
  170. package/v3/@swarmdo/testing/dist/helpers/swarm-instance.js +0 -205
  171. package/v3/@swarmdo/testing/dist/helpers/test-application.d.ts +0 -190
  172. package/v3/@swarmdo/testing/dist/helpers/test-application.js +0 -138
  173. package/v3/@swarmdo/testing/dist/helpers/test-utils.d.ts +0 -274
  174. package/v3/@swarmdo/testing/dist/helpers/test-utils.js +0 -456
  175. package/v3/@swarmdo/testing/dist/index.d.ts +0 -42
  176. package/v3/@swarmdo/testing/dist/index.js +0 -66
  177. package/v3/@swarmdo/testing/dist/mocks/index.d.ts +0 -8
  178. package/v3/@swarmdo/testing/dist/mocks/index.js +0 -10
  179. package/v3/@swarmdo/testing/dist/mocks/mock-mcp-client.d.ts +0 -206
  180. package/v3/@swarmdo/testing/dist/mocks/mock-mcp-client.js +0 -575
  181. package/v3/@swarmdo/testing/dist/mocks/mock-services.d.ts +0 -287
  182. package/v3/@swarmdo/testing/dist/mocks/mock-services.js +0 -563
  183. package/v3/@swarmdo/testing/dist/regression/api-contract.d.ts +0 -109
  184. package/v3/@swarmdo/testing/dist/regression/api-contract.js +0 -374
  185. package/v3/@swarmdo/testing/dist/regression/index.d.ts +0 -18
  186. package/v3/@swarmdo/testing/dist/regression/index.js +0 -18
  187. package/v3/@swarmdo/testing/dist/regression/integration-regression.d.ts +0 -67
  188. package/v3/@swarmdo/testing/dist/regression/integration-regression.js +0 -334
  189. package/v3/@swarmdo/testing/dist/regression/performance-baseline.d.ts +0 -106
  190. package/v3/@swarmdo/testing/dist/regression/performance-baseline.js +0 -268
  191. package/v3/@swarmdo/testing/dist/regression/regression-runner.d.ts +0 -124
  192. package/v3/@swarmdo/testing/dist/regression/regression-runner.js +0 -227
  193. package/v3/@swarmdo/testing/dist/regression/security-regression.d.ts +0 -73
  194. package/v3/@swarmdo/testing/dist/regression/security-regression.js +0 -258
  195. package/v3/@swarmdo/testing/dist/setup.d.ts +0 -43
  196. package/v3/@swarmdo/testing/dist/setup.js +0 -91
  197. package/v3/@swarmdo/testing/dist/v2-compat/api-compat.test.d.ts +0 -10
  198. package/v3/@swarmdo/testing/dist/v2-compat/api-compat.test.js +0 -433
  199. package/v3/@swarmdo/testing/dist/v2-compat/cli-compat.test.d.ts +0 -10
  200. package/v3/@swarmdo/testing/dist/v2-compat/cli-compat.test.js +0 -352
  201. package/v3/@swarmdo/testing/dist/v2-compat/compatibility-validator.d.ts +0 -206
  202. package/v3/@swarmdo/testing/dist/v2-compat/compatibility-validator.js +0 -839
  203. package/v3/@swarmdo/testing/dist/v2-compat/hooks-compat.test.d.ts +0 -10
  204. package/v3/@swarmdo/testing/dist/v2-compat/hooks-compat.test.js +0 -428
  205. package/v3/@swarmdo/testing/dist/v2-compat/index.d.ts +0 -38
  206. package/v3/@swarmdo/testing/dist/v2-compat/index.js +0 -41
  207. package/v3/@swarmdo/testing/dist/v2-compat/mcp-compat.test.d.ts +0 -10
  208. package/v3/@swarmdo/testing/dist/v2-compat/mcp-compat.test.js +0 -419
  209. package/v3/@swarmdo/testing/dist/v2-compat/report-generator.d.ts +0 -34
  210. package/v3/@swarmdo/testing/dist/v2-compat/report-generator.js +0 -372
@@ -1,217 +0,0 @@
1
- /**
2
- * V3 Swarmdo Custom Assertions
3
- *
4
- * London School TDD Custom Assertions
5
- * - Behavior-focused assertions
6
- * - Interaction verification helpers
7
- * - Contract testing utilities
8
- */
9
- import { expect } from 'vitest';
10
- /**
11
- * Assert that a mock was called in a specific sequence
12
- *
13
- * @example
14
- * assertCallSequence([
15
- * [mockRepo.findById, ['123']],
16
- * [mockValidator.validate, [user]],
17
- * [mockRepo.save, [user]],
18
- * ]);
19
- */
20
- export function assertCallSequence(sequence) {
21
- const calls = [];
22
- for (const [mock, expectedArgs] of sequence) {
23
- const mockCalls = mock.mock.calls;
24
- const invocationOrder = mock.mock.invocationCallOrder;
25
- for (let i = 0; i < mockCalls.length; i++) {
26
- if (JSON.stringify(mockCalls[i]) === JSON.stringify(expectedArgs)) {
27
- calls.push({
28
- mock,
29
- args: mockCalls[i],
30
- order: invocationOrder[i],
31
- });
32
- break;
33
- }
34
- }
35
- }
36
- expect(calls.length).toBe(sequence.length);
37
- for (let i = 1; i < calls.length; i++) {
38
- expect(calls[i].order).toBeGreaterThan(calls[i - 1].order);
39
- }
40
- }
41
- /**
42
- * Assert that a mock was NOT called with specific arguments
43
- *
44
- * @example
45
- * assertNotCalledWith(mockRepo.save, [invalidUser]);
46
- */
47
- export function assertNotCalledWith(mock, args) {
48
- const wasCalledWith = mock.mock.calls.some((call) => JSON.stringify(call) === JSON.stringify(args));
49
- expect(wasCalledWith).toBe(false);
50
- }
51
- /**
52
- * Assert interaction count for behavior verification
53
- *
54
- * @example
55
- * assertInteractionCount(mockService.process, 3);
56
- */
57
- export function assertInteractionCount(mock, expectedCount) {
58
- expect(mock.mock.calls.length).toBe(expectedCount);
59
- }
60
- /**
61
- * Assert that all mocks in a group were called
62
- *
63
- * @example
64
- * assertAllCalled([mockA.method, mockB.method, mockC.method]);
65
- */
66
- export function assertAllCalled(mocks) {
67
- for (const mock of mocks) {
68
- expect(mock).toHaveBeenCalled();
69
- }
70
- }
71
- /**
72
- * Assert that none of the mocks were called
73
- *
74
- * @example
75
- * assertNoneCalled([mockA.method, mockB.method]);
76
- */
77
- export function assertNoneCalled(mocks) {
78
- for (const mock of mocks) {
79
- expect(mock).not.toHaveBeenCalled();
80
- }
81
- }
82
- /**
83
- * Assert contract compliance
84
- * Verifies that an object implements expected interface
85
- *
86
- * @example
87
- * assertContractCompliance(userService, UserServiceContract);
88
- */
89
- export function assertContractCompliance(implementation, contract) {
90
- for (const [method, spec] of Object.entries(contract.methods)) {
91
- expect(typeof implementation[method]).toBe('function');
92
- }
93
- }
94
- /**
95
- * Assert async operation timing
96
- *
97
- * @example
98
- * await assertTimingWithin(async () => service.process(), 100);
99
- */
100
- export async function assertTimingWithin(operation, maxMs) {
101
- const start = Date.now();
102
- await operation();
103
- const duration = Date.now() - start;
104
- expect(duration).toBeLessThanOrEqual(maxMs);
105
- }
106
- /**
107
- * Assert that an async operation completes within expected time range
108
- *
109
- * @example
110
- * await assertTimingRange(async () => service.process(), 50, 150);
111
- */
112
- export async function assertTimingRange(operation, minMs, maxMs) {
113
- const start = Date.now();
114
- await operation();
115
- const duration = Date.now() - start;
116
- expect(duration).toBeGreaterThanOrEqual(minMs);
117
- expect(duration).toBeLessThanOrEqual(maxMs);
118
- }
119
- /**
120
- * Assert error type and message
121
- *
122
- * @example
123
- * await assertThrowsWithMessage(
124
- * async () => service.validate(invalid),
125
- * ValidationError,
126
- * 'Invalid input'
127
- * );
128
- */
129
- export async function assertThrowsWithMessage(operation, ErrorType, expectedMessage) {
130
- let error = null;
131
- try {
132
- await operation();
133
- }
134
- catch (e) {
135
- error = e;
136
- }
137
- expect(error).toBeInstanceOf(ErrorType);
138
- if (typeof expectedMessage === 'string') {
139
- expect(error?.message).toContain(expectedMessage);
140
- }
141
- else {
142
- expect(error?.message).toMatch(expectedMessage);
143
- }
144
- }
145
- /**
146
- * Assert domain event was published
147
- *
148
- * @example
149
- * await assertEventPublished(mockEventBus, 'UserCreated', { userId: '123' });
150
- */
151
- export function assertEventPublished(eventBusMock, eventType, expectedPayload) {
152
- const publishCalls = eventBusMock.mock.calls;
153
- const matchingEvent = publishCalls.find((call) => {
154
- const event = call[0];
155
- return event.type === eventType;
156
- });
157
- expect(matchingEvent).toBeDefined();
158
- if (expectedPayload && matchingEvent) {
159
- const actualPayload = matchingEvent[0].payload;
160
- expect(actualPayload).toMatchObject(expectedPayload);
161
- }
162
- }
163
- /**
164
- * Assert that mock returns expected values in sequence
165
- *
166
- * @example
167
- * assertMockSequence(mockCounter.next, [1, 2, 3]);
168
- */
169
- export async function assertMockSequence(mock, expectedValues) {
170
- for (const expected of expectedValues) {
171
- const result = await mock();
172
- expect(result).toEqual(expected);
173
- }
174
- }
175
- /**
176
- * Security assertion - verify sensitive data handling
177
- *
178
- * @example
179
- * assertNoSensitiveDataLogged(mockLogger, ['password', 'token', 'secret']);
180
- */
181
- export function assertNoSensitiveDataLogged(loggerMock, sensitivePatterns) {
182
- const allCalls = loggerMock.mock.calls;
183
- for (const call of allCalls) {
184
- const logContent = JSON.stringify(call);
185
- for (const pattern of sensitivePatterns) {
186
- expect(logContent.toLowerCase()).not.toContain(pattern.toLowerCase());
187
- }
188
- }
189
- }
190
- /**
191
- * Performance assertion - verify operation meets target
192
- *
193
- * @example
194
- * await assertPerformanceTarget(
195
- * async () => await search.execute(query),
196
- * { targetMs: 100, iterations: 10 }
197
- * );
198
- */
199
- export async function assertPerformanceTarget(operation, config) {
200
- const { targetMs, iterations, warmupIterations = 3 } = config;
201
- // Warmup
202
- for (let i = 0; i < warmupIterations; i++) {
203
- await operation();
204
- }
205
- const timings = [];
206
- for (let i = 0; i < iterations; i++) {
207
- const start = performance.now();
208
- await operation();
209
- timings.push(performance.now() - start);
210
- }
211
- const averageMs = timings.reduce((a, b) => a + b, 0) / timings.length;
212
- const minMs = Math.min(...timings);
213
- const maxMs = Math.max(...timings);
214
- expect(averageMs).toBeLessThanOrEqual(targetMs);
215
- return { averageMs, minMs, maxMs };
216
- }
217
- //# sourceMappingURL=assertions.js.map
@@ -1,96 +0,0 @@
1
- /**
2
- * V3 Swarmdo Mock Factory
3
- *
4
- * London School TDD Mock Creation Utilities
5
- * - Creates type-safe mocks for behavior verification
6
- * - Supports deep mocking for complex objects
7
- * - Enables interaction tracking for behavior testing
8
- */
9
- import { type Mock } from 'vitest';
10
- /**
11
- * Type for a fully mocked interface
12
- */
13
- export type MockedInterface<T> = {
14
- [K in keyof T]: T[K] extends (...args: infer A) => infer R ? Mock<(...args: A) => R> : T[K];
15
- };
16
- /**
17
- * Create a shallow mock of an interface
18
- * Each method becomes a vi.fn() for behavior verification
19
- *
20
- * @example
21
- * const mockRepo = createMock<UserRepository>();
22
- * mockRepo.findById.mockResolvedValue(user);
23
- * expect(mockRepo.save).toHaveBeenCalledWith(user);
24
- */
25
- export declare function createMock<T extends object>(): MockedInterface<T>;
26
- /**
27
- * Create a deep mock that handles nested objects
28
- * Useful for complex interfaces with nested dependencies
29
- *
30
- * @example
31
- * const mockService = createDeepMock<ComplexService>();
32
- * mockService.nested.method.mockReturnValue(result);
33
- */
34
- export declare function createDeepMock<T extends object>(): MockedInterface<T>;
35
- /**
36
- * Create a spy mock that wraps an existing object
37
- * Preserves original behavior while enabling verification
38
- *
39
- * @example
40
- * const spied = createSpyMock(realService);
41
- * await spied.process();
42
- * expect(spied.process).toHaveBeenCalled();
43
- */
44
- export declare function createSpyMock<T extends object>(target: T): MockedInterface<T>;
45
- /**
46
- * Create a mock with predefined behavior
47
- * Useful for common test scenarios
48
- *
49
- * @example
50
- * const mockRepo = createMockWithBehavior<UserRepository>({
51
- * findById: async (id) => ({ id, name: 'Test' }),
52
- * save: async (user) => user,
53
- * });
54
- */
55
- export declare function createMockWithBehavior<T extends object>(implementations: Partial<{
56
- [K in keyof T]: T[K];
57
- }>): MockedInterface<T>;
58
- /**
59
- * Create a mock that fails on first call, succeeds on retry
60
- * Useful for testing retry logic and error handling
61
- *
62
- * @example
63
- * const mockApi = createRetryMock<ApiClient>('fetch', new Error('Network'), data);
64
- */
65
- export declare function createRetryMock<T extends object>(methodName: keyof T, firstError: Error, successValue: unknown): MockedInterface<T>;
66
- /**
67
- * Create a sequence mock that returns different values per call
68
- * Useful for testing stateful interactions
69
- *
70
- * @example
71
- * const mockCounter = createSequenceMock<Counter>('next', [1, 2, 3, 4, 5]);
72
- */
73
- export declare function createSequenceMock<T extends object>(methodName: keyof T, values: unknown[]): MockedInterface<T>;
74
- /**
75
- * Interaction recorder for complex behavior verification
76
- * Tracks all calls across multiple mocks
77
- *
78
- * @example
79
- * const recorder = new InteractionRecorder();
80
- * recorder.track('repo', mockRepo);
81
- * recorder.track('notifier', mockNotifier);
82
- * await service.process();
83
- * expect(recorder.getInteractionOrder()).toEqual(['repo.save', 'notifier.notify']);
84
- */
85
- export declare class InteractionRecorder {
86
- private interactions;
87
- track<T extends object>(name: string, mock: MockedInterface<T>): void;
88
- getInteractions(): Array<{
89
- name: string;
90
- method: string;
91
- args: unknown[];
92
- }>;
93
- getInteractionOrder(): string[];
94
- clear(): void;
95
- }
96
- //# sourceMappingURL=create-mock.d.ts.map
@@ -1,164 +0,0 @@
1
- /**
2
- * V3 Swarmdo Mock Factory
3
- *
4
- * London School TDD Mock Creation Utilities
5
- * - Creates type-safe mocks for behavior verification
6
- * - Supports deep mocking for complex objects
7
- * - Enables interaction tracking for behavior testing
8
- */
9
- import { vi } from 'vitest';
10
- /**
11
- * Create a shallow mock of an interface
12
- * Each method becomes a vi.fn() for behavior verification
13
- *
14
- * @example
15
- * const mockRepo = createMock<UserRepository>();
16
- * mockRepo.findById.mockResolvedValue(user);
17
- * expect(mockRepo.save).toHaveBeenCalledWith(user);
18
- */
19
- export function createMock() {
20
- return new Proxy({}, {
21
- get: (target, prop) => {
22
- if (typeof prop === 'string' && !(prop in target)) {
23
- target[prop] = vi.fn();
24
- }
25
- return target[prop];
26
- },
27
- });
28
- }
29
- /**
30
- * Create a deep mock that handles nested objects
31
- * Useful for complex interfaces with nested dependencies
32
- *
33
- * @example
34
- * const mockService = createDeepMock<ComplexService>();
35
- * mockService.nested.method.mockReturnValue(result);
36
- */
37
- export function createDeepMock() {
38
- const cache = new Map();
39
- return new Proxy({}, {
40
- get: (target, prop) => {
41
- if (!cache.has(prop)) {
42
- const mock = vi.fn();
43
- // Allow chaining for nested access
44
- mock.mockReturnValue =
45
- mock.mockReturnValue.bind(mock);
46
- cache.set(prop, mock);
47
- }
48
- return cache.get(prop);
49
- },
50
- });
51
- }
52
- /**
53
- * Create a spy mock that wraps an existing object
54
- * Preserves original behavior while enabling verification
55
- *
56
- * @example
57
- * const spied = createSpyMock(realService);
58
- * await spied.process();
59
- * expect(spied.process).toHaveBeenCalled();
60
- */
61
- export function createSpyMock(target) {
62
- const spied = { ...target };
63
- for (const key of Object.keys(target)) {
64
- const value = target[key];
65
- if (typeof value === 'function') {
66
- spied[key] = vi.fn(value.bind(target));
67
- }
68
- }
69
- return spied;
70
- }
71
- /**
72
- * Create a mock with predefined behavior
73
- * Useful for common test scenarios
74
- *
75
- * @example
76
- * const mockRepo = createMockWithBehavior<UserRepository>({
77
- * findById: async (id) => ({ id, name: 'Test' }),
78
- * save: async (user) => user,
79
- * });
80
- */
81
- export function createMockWithBehavior(implementations) {
82
- const mock = createMock();
83
- for (const [key, impl] of Object.entries(implementations)) {
84
- if (typeof impl === 'function') {
85
- mock[key].mockImplementation(impl);
86
- }
87
- }
88
- return mock;
89
- }
90
- /**
91
- * Create a mock that fails on first call, succeeds on retry
92
- * Useful for testing retry logic and error handling
93
- *
94
- * @example
95
- * const mockApi = createRetryMock<ApiClient>('fetch', new Error('Network'), data);
96
- */
97
- export function createRetryMock(methodName, firstError, successValue) {
98
- const mock = createMock();
99
- mock[methodName]
100
- .mockRejectedValueOnce(firstError)
101
- .mockResolvedValue(successValue);
102
- return mock;
103
- }
104
- /**
105
- * Create a sequence mock that returns different values per call
106
- * Useful for testing stateful interactions
107
- *
108
- * @example
109
- * const mockCounter = createSequenceMock<Counter>('next', [1, 2, 3, 4, 5]);
110
- */
111
- export function createSequenceMock(methodName, values) {
112
- const mock = createMock();
113
- const fn = mock[methodName];
114
- values.forEach((value, index) => {
115
- if (index === values.length - 1) {
116
- fn.mockReturnValue(value);
117
- }
118
- else {
119
- fn.mockReturnValueOnce(value);
120
- }
121
- });
122
- return mock;
123
- }
124
- /**
125
- * Interaction recorder for complex behavior verification
126
- * Tracks all calls across multiple mocks
127
- *
128
- * @example
129
- * const recorder = new InteractionRecorder();
130
- * recorder.track('repo', mockRepo);
131
- * recorder.track('notifier', mockNotifier);
132
- * await service.process();
133
- * expect(recorder.getInteractionOrder()).toEqual(['repo.save', 'notifier.notify']);
134
- */
135
- export class InteractionRecorder {
136
- interactions = [];
137
- track(name, mock) {
138
- for (const key of Object.keys(mock)) {
139
- const method = mock[key];
140
- if (typeof method?.mockImplementation === 'function') {
141
- const original = method.getMockImplementation();
142
- method.mockImplementation((...args) => {
143
- this.interactions.push({
144
- name,
145
- method: key,
146
- args,
147
- timestamp: Date.now(),
148
- });
149
- return original?.(...args);
150
- });
151
- }
152
- }
153
- }
154
- getInteractions() {
155
- return this.interactions.map(({ name, method, args }) => ({ name, method, args }));
156
- }
157
- getInteractionOrder() {
158
- return this.interactions.map(({ name, method }) => `${name}.${method}`);
159
- }
160
- clear() {
161
- this.interactions = [];
162
- }
163
- }
164
- //# sourceMappingURL=create-mock.js.map
@@ -1,14 +0,0 @@
1
- /**
2
- * V3 Swarmdo Test Helpers Index
3
- *
4
- * Central export for all test helpers
5
- */
6
- export { createMock, createDeepMock, createSpyMock, createMockWithBehavior, createRetryMock, createSequenceMock, InteractionRecorder, type MockedInterface, } from './create-mock.js';
7
- export { createTestApplication, type TestApplication, type IEventBus, type ITaskManager, type IAgentLifecycle, type IMemoryService, type ISecurityService, type ISwarmCoordinator, } from './test-application.js';
8
- export { createSwarmTestInstance, SwarmTestInstance, type V3AgentType, type SwarmTopology, type SwarmAgent, type SwarmMessage, type SwarmTask, type SwarmTaskResult, } from './swarm-instance.js';
9
- export { assertCallSequence, assertNotCalledWith, assertInteractionCount, assertAllCalled, assertNoneCalled, assertContractCompliance, assertTimingWithin, assertTimingRange, assertThrowsWithMessage, assertEventPublished, assertMockSequence, assertNoSensitiveDataLogged, assertPerformanceTarget, type ContractDefinition, } from './assertions.js';
10
- export { waitFor, waitUntilChanged, retry, withTimeout, sleep, createDeferred, parallelLimit, measureTime, createMockClock, createTestEmitter, createCallSpy, createMockStream, collectStream, generateTestId, createTestContext, expectToReject, createTrackedMock, TimeoutError, type WaitForOptions, type WaitUntilChangedOptions, type RetryOptions, type Deferred, type MockClock, type TestEmitter, type CallSpy, type MockStreamOptions, type TestContext, type TrackedMock, } from './test-utils.js';
11
- export { createMockEventBus, createMockTaskManager, createMockAgentLifecycle, createMockMemoryService, createMockSecurityService, createMockSwarmCoordinator, createMockMCPClient, createMockLogger, createMockApplication, resetMockApplication, type MockApplication, type ILogger, type IMCPClient, type DomainEvent, type EventHandler, type Task, type TaskDefinition, type TaskResult, type TaskStatus, type TaskFilters, type AgentConfig, type AgentSpawnResult, type TerminateOptions, type AgentFilters, type AgentHealthCheck, type MemoryStats, type IndexConfig, type InputValidationOptions, type ExecuteOptions, type ExecuteResult, } from './mock-factory.js';
12
- export { assertCalledWithPattern, assertEventOrder, assertEventNotPublished, assertMocksCalledInOrder, assertCalledNTimesWith, assertCompletesWithin, assertThrowsError, assertNoSensitiveData, assertMatchesSnapshot, assertV3PerformanceTargets, assertValidDomainObject, assertOnlyCalledWithAllowed, assertPartialOrder, assertAllPass, assertNonePass, assertSameElements, assertMockReturnsSequence, assertValidStateTransition, assertRetryPattern, assertDependencyInjected, registerCustomMatchers, type SnapshotOptions, type V3PerformanceMetrics, type RetryPatternOptions, } from './assertion-helpers.js';
13
- export { createSetupContext, getGlobalContext, resetGlobalContext, configureTestEnvironment, createTestSuite, createTestScope, createInMemoryDatabaseHelper, createNetworkTestHelper, createInMemoryFileSystemHelper, createPerformanceTestHelper, setupV3Tests, flushPromises, withTestTimeout, type SetupContext, type CleanupFunction, type Disposable, type TestEnvironmentConfig, type TestSuiteHelpers, type TestScope, type DatabaseTestHelper, type NetworkTestHelper, type MockFetchResponse, type FileSystemTestHelper, type PerformanceTestHelper, type V3TestConfig, } from './setup-teardown.js';
14
- //# sourceMappingURL=index.d.ts.map
@@ -1,22 +0,0 @@
1
- /**
2
- * V3 Swarmdo Test Helpers Index
3
- *
4
- * Central export for all test helpers
5
- */
6
- // Mock factory utilities
7
- export { createMock, createDeepMock, createSpyMock, createMockWithBehavior, createRetryMock, createSequenceMock, InteractionRecorder, } from './create-mock.js';
8
- // Test application builder
9
- export { createTestApplication, } from './test-application.js';
10
- // Swarm test instance
11
- export { createSwarmTestInstance, SwarmTestInstance, } from './swarm-instance.js';
12
- // Custom assertions (legacy)
13
- export { assertCallSequence, assertNotCalledWith, assertInteractionCount, assertAllCalled, assertNoneCalled, assertContractCompliance, assertTimingWithin, assertTimingRange, assertThrowsWithMessage, assertEventPublished, assertMockSequence, assertNoSensitiveDataLogged, assertPerformanceTarget, } from './assertions.js';
14
- // Test utilities (waitFor, retry, timeout, etc.)
15
- export { waitFor, waitUntilChanged, retry, withTimeout, sleep, createDeferred, parallelLimit, measureTime, createMockClock, createTestEmitter, createCallSpy, createMockStream, collectStream, generateTestId, createTestContext, expectToReject, createTrackedMock, TimeoutError, } from './test-utils.js';
16
- // Mock factory (comprehensive service mocks)
17
- export { createMockEventBus, createMockTaskManager, createMockAgentLifecycle, createMockMemoryService, createMockSecurityService, createMockSwarmCoordinator, createMockMCPClient, createMockLogger, createMockApplication, resetMockApplication, } from './mock-factory.js';
18
- // Assertion helpers (enhanced)
19
- export { assertCalledWithPattern, assertEventOrder, assertEventNotPublished, assertMocksCalledInOrder, assertCalledNTimesWith, assertCompletesWithin, assertThrowsError, assertNoSensitiveData, assertMatchesSnapshot, assertV3PerformanceTargets, assertValidDomainObject, assertOnlyCalledWithAllowed, assertPartialOrder, assertAllPass, assertNonePass, assertSameElements, assertMockReturnsSequence, assertValidStateTransition, assertRetryPattern, assertDependencyInjected, registerCustomMatchers, } from './assertion-helpers.js';
20
- // Setup and teardown helpers
21
- export { createSetupContext, getGlobalContext, resetGlobalContext, configureTestEnvironment, createTestSuite, createTestScope, createInMemoryDatabaseHelper, createNetworkTestHelper, createInMemoryFileSystemHelper, createPerformanceTestHelper, setupV3Tests, flushPromises, withTestTimeout, } from './setup-teardown.js';
22
- //# sourceMappingURL=index.js.map