swarmdo 1.4.8 → 1.6.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 (215) hide show
  1. package/.claude/helpers/statusline.cjs +7 -7
  2. package/README.md +9 -6
  3. package/package.json +5 -3
  4. package/v3/@swarmdo/cli/dist/src/commands/compact.d.ts +16 -0
  5. package/v3/@swarmdo/cli/dist/src/commands/compact.js +106 -0
  6. package/v3/@swarmdo/cli/dist/src/commands/hooks.js +26 -24
  7. package/v3/@swarmdo/cli/dist/src/commands/index.js +10 -3
  8. package/v3/@swarmdo/cli/dist/src/commands/integrations.d.ts +14 -0
  9. package/v3/@swarmdo/cli/dist/src/commands/integrations.js +158 -0
  10. package/v3/@swarmdo/cli/dist/src/commands/memory.js +50 -1
  11. package/v3/@swarmdo/cli/dist/src/commands/providers.js +3 -0
  12. package/v3/@swarmdo/cli/dist/src/commands/release.d.ts +15 -0
  13. package/v3/@swarmdo/cli/dist/src/commands/release.js +241 -0
  14. package/v3/@swarmdo/cli/dist/src/commands/security.js +14 -0
  15. package/v3/@swarmdo/cli/dist/src/commands/transcript.js +82 -1
  16. package/v3/@swarmdo/cli/dist/src/commands/usage.js +80 -1
  17. package/v3/@swarmdo/cli/dist/src/compact/compact.d.ts +60 -0
  18. package/v3/@swarmdo/cli/dist/src/compact/compact.js +170 -0
  19. package/v3/@swarmdo/cli/dist/src/config-lint/lint.js +11 -1
  20. package/v3/@swarmdo/cli/dist/src/index.js +4 -2
  21. package/v3/@swarmdo/cli/dist/src/init/statusline-generator.js +6 -6
  22. package/v3/@swarmdo/cli/dist/src/integrations/integrations.d.ts +54 -0
  23. package/v3/@swarmdo/cli/dist/src/integrations/integrations.js +162 -0
  24. package/v3/@swarmdo/cli/dist/src/mcp-tools/agent-execute-core.js +25 -3
  25. package/v3/@swarmdo/cli/dist/src/mcp-tools/agentdb-tools.js +8 -8
  26. package/v3/@swarmdo/cli/dist/src/memory/graph-edge-writer.d.ts +12 -0
  27. package/v3/@swarmdo/cli/dist/src/memory/graph-edge-writer.js +32 -1
  28. package/v3/@swarmdo/cli/dist/src/memory-vault/watch.d.ts +32 -0
  29. package/v3/@swarmdo/cli/dist/src/memory-vault/watch.js +66 -0
  30. package/v3/@swarmdo/cli/dist/src/providers/openrouter-config.d.ts +91 -0
  31. package/v3/@swarmdo/cli/dist/src/providers/openrouter-config.js +186 -0
  32. package/v3/@swarmdo/cli/dist/src/release/release.d.ts +72 -0
  33. package/v3/@swarmdo/cli/dist/src/release/release.js +86 -0
  34. package/v3/@swarmdo/cli/dist/src/resilience/backoff.d.ts +23 -0
  35. package/v3/@swarmdo/cli/dist/src/resilience/backoff.js +30 -0
  36. package/v3/@swarmdo/cli/dist/src/swarmvector/model-router.js +14 -0
  37. package/v3/@swarmdo/cli/dist/src/transcript/search.d.ts +39 -0
  38. package/v3/@swarmdo/cli/dist/src/transcript/search.js +67 -0
  39. package/v3/@swarmdo/cli/dist/src/usage/diff.d.ts +69 -0
  40. package/v3/@swarmdo/cli/dist/src/usage/diff.js +112 -0
  41. package/v3/@swarmdo/cli/package.json +4 -4
  42. package/v3/@swarmdo/cli-core/dist/src/index.js +1 -1
  43. package/v3/@swarmdo/codex/dist/cli.js +0 -0
  44. package/v3/@swarmdo/hooks/dist/cli/guidance-cli.js +0 -0
  45. package/v3/@swarmdo/hooks/dist/statusline/index.d.ts +3 -3
  46. package/v3/@swarmdo/hooks/dist/statusline/index.js +3 -3
  47. package/v3/@swarmdo/integration/dist/__tests__/agentic-flow-agent.test.js +4 -1
  48. package/v3/@swarmdo/neural/dist/flash-attention.d.ts +1 -1
  49. package/v3/@swarmdo/neural/dist/flash-attention.js +1 -1
  50. package/v3/@swarmdo/plugin-agent-federation/dist/plugin.js +1 -1
  51. package/v3/@swarmdo/plugin-agent-federation/dist/transport/midstream-aware-loader.js +2 -2
  52. package/v3/@swarmdo/providers/dist/swarmvector-provider.d.ts +1 -1
  53. package/v3/@swarmdo/providers/dist/swarmvector-provider.js +1 -1
  54. package/v3/@swarmdo/security/dist/input-validator.d.ts +6 -6
  55. package/v3/@swarmdo/shared/dist/hooks/safety/git-commit.js +1 -1
  56. package/v3/@swarmdo/shared/dist/mcp/transport/http.js +8 -1
  57. package/v3/vendor/agentdb/package.json +0 -1
  58. package/v3/vendor/agentic-flow/package.json +0 -1
  59. package/.claude/scheduled_tasks.lock +0 -1
  60. package/.claude/skills/sdo-caveman-compress/scripts/__pycache__/__init__.cpython-314.pyc +0 -0
  61. package/.claude/skills/sdo-caveman-compress/scripts/__pycache__/__main__.cpython-314.pyc +0 -0
  62. package/.claude/skills/sdo-caveman-compress/scripts/__pycache__/cli.cpython-314.pyc +0 -0
  63. package/.claude/skills/sdo-caveman-compress/scripts/__pycache__/compress.cpython-314.pyc +0 -0
  64. package/.claude/skills/sdo-caveman-compress/scripts/__pycache__/detect.cpython-314.pyc +0 -0
  65. package/.claude/skills/sdo-caveman-compress/scripts/__pycache__/validate.cpython-314.pyc +0 -0
  66. package/v3/@swarmdo/plugin-iot-cognitum/dist/application/index.d.ts +0 -2
  67. package/v3/@swarmdo/plugin-iot-cognitum/dist/application/index.js +0 -2
  68. package/v3/@swarmdo/plugin-iot-cognitum/dist/application/iot-coordinator.d.ts +0 -138
  69. package/v3/@swarmdo/plugin-iot-cognitum/dist/application/iot-coordinator.js +0 -418
  70. package/v3/@swarmdo/plugin-iot-cognitum/dist/bin.d.ts +0 -15
  71. package/v3/@swarmdo/plugin-iot-cognitum/dist/bin.js +0 -240
  72. package/v3/@swarmdo/plugin-iot-cognitum/dist/cli-commands.d.ts +0 -7
  73. package/v3/@swarmdo/plugin-iot-cognitum/dist/cli-commands.js +0 -508
  74. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/entities/device-agent.d.ts +0 -54
  75. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/entities/device-agent.js +0 -2
  76. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/entities/device-fleet.d.ts +0 -46
  77. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/entities/device-fleet.js +0 -2
  78. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/entities/device-trust-level.d.ts +0 -18
  79. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/entities/device-trust-level.js +0 -28
  80. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/entities/index.d.ts +0 -5
  81. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/entities/index.js +0 -2
  82. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/entities/telemetry.d.ts +0 -35
  83. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/entities/telemetry.js +0 -2
  84. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/repositories/device-repository.d.ts +0 -11
  85. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/repositories/device-repository.js +0 -2
  86. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/repositories/fleet-repository.d.ts +0 -9
  87. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/repositories/fleet-repository.js +0 -2
  88. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/repositories/index.d.ts +0 -5
  89. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/repositories/index.js +0 -2
  90. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/repositories/telemetry-repository.d.ts +0 -12
  91. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/repositories/telemetry-repository.js +0 -2
  92. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/repositories/trust-history-repository.d.ts +0 -19
  93. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/repositories/trust-history-repository.js +0 -2
  94. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/anomaly-detection-service.d.ts +0 -44
  95. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/anomaly-detection-service.js +0 -117
  96. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/device-lifecycle-service.d.ts +0 -70
  97. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/device-lifecycle-service.js +0 -194
  98. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/firmware-orchestration-service.d.ts +0 -69
  99. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/firmware-orchestration-service.js +0 -139
  100. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/fleet-topology-service.d.ts +0 -34
  101. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/fleet-topology-service.js +0 -101
  102. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/index.d.ts +0 -10
  103. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/index.js +0 -10
  104. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/mesh-service.d.ts +0 -64
  105. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/mesh-service.js +0 -70
  106. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/sona-integration-service.d.ts +0 -44
  107. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/sona-integration-service.js +0 -79
  108. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/telemetry-ingestion-service.d.ts +0 -37
  109. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/telemetry-ingestion-service.js +0 -39
  110. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/telemetry-service.d.ts +0 -67
  111. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/telemetry-service.js +0 -58
  112. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/witness-verification-service.d.ts +0 -45
  113. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/witness-verification-service.js +0 -63
  114. package/v3/@swarmdo/plugin-iot-cognitum/dist/index.d.ts +0 -26
  115. package/v3/@swarmdo/plugin-iot-cognitum/dist/index.js +0 -17
  116. package/v3/@swarmdo/plugin-iot-cognitum/dist/infrastructure/agentdb-telemetry-repository.d.ts +0 -51
  117. package/v3/@swarmdo/plugin-iot-cognitum/dist/infrastructure/agentdb-telemetry-repository.js +0 -110
  118. package/v3/@swarmdo/plugin-iot-cognitum/dist/infrastructure/in-memory-device-repository.d.ts +0 -13
  119. package/v3/@swarmdo/plugin-iot-cognitum/dist/infrastructure/in-memory-device-repository.js +0 -25
  120. package/v3/@swarmdo/plugin-iot-cognitum/dist/infrastructure/in-memory-fleet-repository.d.ts +0 -11
  121. package/v3/@swarmdo/plugin-iot-cognitum/dist/infrastructure/in-memory-fleet-repository.js +0 -19
  122. package/v3/@swarmdo/plugin-iot-cognitum/dist/infrastructure/in-memory-trust-history-repository.d.ts +0 -11
  123. package/v3/@swarmdo/plugin-iot-cognitum/dist/infrastructure/in-memory-trust-history-repository.js +0 -27
  124. package/v3/@swarmdo/plugin-iot-cognitum/dist/infrastructure/index.d.ts +0 -6
  125. package/v3/@swarmdo/plugin-iot-cognitum/dist/infrastructure/index.js +0 -6
  126. package/v3/@swarmdo/plugin-iot-cognitum/dist/infrastructure/seed-client-factory.d.ts +0 -41
  127. package/v3/@swarmdo/plugin-iot-cognitum/dist/infrastructure/seed-client-factory.js +0 -64
  128. package/v3/@swarmdo/plugin-iot-cognitum/dist/mcp-tools.d.ts +0 -8
  129. package/v3/@swarmdo/plugin-iot-cognitum/dist/mcp-tools.js +0 -703
  130. package/v3/@swarmdo/plugin-iot-cognitum/dist/plugin.d.ts +0 -23
  131. package/v3/@swarmdo/plugin-iot-cognitum/dist/plugin.js +0 -239
  132. package/v3/@swarmdo/plugin-iot-cognitum/dist/workers/anomaly-scan-worker.d.ts +0 -17
  133. package/v3/@swarmdo/plugin-iot-cognitum/dist/workers/anomaly-scan-worker.js +0 -42
  134. package/v3/@swarmdo/plugin-iot-cognitum/dist/workers/firmware-watch-worker.d.ts +0 -18
  135. package/v3/@swarmdo/plugin-iot-cognitum/dist/workers/firmware-watch-worker.js +0 -45
  136. package/v3/@swarmdo/plugin-iot-cognitum/dist/workers/health-probe-worker.d.ts +0 -19
  137. package/v3/@swarmdo/plugin-iot-cognitum/dist/workers/health-probe-worker.js +0 -50
  138. package/v3/@swarmdo/plugin-iot-cognitum/dist/workers/mesh-sync-worker.d.ts +0 -19
  139. package/v3/@swarmdo/plugin-iot-cognitum/dist/workers/mesh-sync-worker.js +0 -47
  140. package/v3/@swarmdo/plugin-iot-cognitum/dist/workers/telemetry-ingest-worker.d.ts +0 -17
  141. package/v3/@swarmdo/plugin-iot-cognitum/dist/workers/telemetry-ingest-worker.js +0 -40
  142. package/v3/@swarmdo/plugin-iot-cognitum/dist/workers/witness-audit-worker.d.ts +0 -18
  143. package/v3/@swarmdo/plugin-iot-cognitum/dist/workers/witness-audit-worker.js +0 -51
  144. package/v3/@swarmdo/testing/dist/fixtures/agent-fixtures.d.ts +0 -214
  145. package/v3/@swarmdo/testing/dist/fixtures/agent-fixtures.js +0 -595
  146. package/v3/@swarmdo/testing/dist/fixtures/agents.d.ts +0 -76
  147. package/v3/@swarmdo/testing/dist/fixtures/agents.js +0 -158
  148. package/v3/@swarmdo/testing/dist/fixtures/configurations.d.ts +0 -157
  149. package/v3/@swarmdo/testing/dist/fixtures/configurations.js +0 -337
  150. package/v3/@swarmdo/testing/dist/fixtures/index.d.ts +0 -10
  151. package/v3/@swarmdo/testing/dist/fixtures/index.js +0 -17
  152. package/v3/@swarmdo/testing/dist/fixtures/mcp-fixtures.d.ts +0 -329
  153. package/v3/@swarmdo/testing/dist/fixtures/mcp-fixtures.js +0 -714
  154. package/v3/@swarmdo/testing/dist/fixtures/memory-entries.d.ts +0 -159
  155. package/v3/@swarmdo/testing/dist/fixtures/memory-entries.js +0 -262
  156. package/v3/@swarmdo/testing/dist/fixtures/memory-fixtures.d.ts +0 -290
  157. package/v3/@swarmdo/testing/dist/fixtures/memory-fixtures.js +0 -547
  158. package/v3/@swarmdo/testing/dist/fixtures/swarm-fixtures.d.ts +0 -289
  159. package/v3/@swarmdo/testing/dist/fixtures/swarm-fixtures.js +0 -534
  160. package/v3/@swarmdo/testing/dist/fixtures/tasks.d.ts +0 -106
  161. package/v3/@swarmdo/testing/dist/fixtures/tasks.js +0 -229
  162. package/v3/@swarmdo/testing/dist/helpers/assertion-helpers.d.ts +0 -213
  163. package/v3/@swarmdo/testing/dist/helpers/assertion-helpers.js +0 -435
  164. package/v3/@swarmdo/testing/dist/helpers/assertions.d.ts +0 -135
  165. package/v3/@swarmdo/testing/dist/helpers/assertions.js +0 -217
  166. package/v3/@swarmdo/testing/dist/helpers/create-mock.d.ts +0 -96
  167. package/v3/@swarmdo/testing/dist/helpers/create-mock.js +0 -164
  168. package/v3/@swarmdo/testing/dist/helpers/index.d.ts +0 -14
  169. package/v3/@swarmdo/testing/dist/helpers/index.js +0 -22
  170. package/v3/@swarmdo/testing/dist/helpers/mock-factory.d.ts +0 -323
  171. package/v3/@swarmdo/testing/dist/helpers/mock-factory.js +0 -350
  172. package/v3/@swarmdo/testing/dist/helpers/setup-teardown.d.ts +0 -271
  173. package/v3/@swarmdo/testing/dist/helpers/setup-teardown.js +0 -446
  174. package/v3/@swarmdo/testing/dist/helpers/swarm-instance.d.ts +0 -142
  175. package/v3/@swarmdo/testing/dist/helpers/swarm-instance.js +0 -205
  176. package/v3/@swarmdo/testing/dist/helpers/test-application.d.ts +0 -190
  177. package/v3/@swarmdo/testing/dist/helpers/test-application.js +0 -138
  178. package/v3/@swarmdo/testing/dist/helpers/test-utils.d.ts +0 -274
  179. package/v3/@swarmdo/testing/dist/helpers/test-utils.js +0 -456
  180. package/v3/@swarmdo/testing/dist/index.d.ts +0 -42
  181. package/v3/@swarmdo/testing/dist/index.js +0 -66
  182. package/v3/@swarmdo/testing/dist/mocks/index.d.ts +0 -8
  183. package/v3/@swarmdo/testing/dist/mocks/index.js +0 -10
  184. package/v3/@swarmdo/testing/dist/mocks/mock-mcp-client.d.ts +0 -206
  185. package/v3/@swarmdo/testing/dist/mocks/mock-mcp-client.js +0 -575
  186. package/v3/@swarmdo/testing/dist/mocks/mock-services.d.ts +0 -287
  187. package/v3/@swarmdo/testing/dist/mocks/mock-services.js +0 -563
  188. package/v3/@swarmdo/testing/dist/regression/api-contract.d.ts +0 -109
  189. package/v3/@swarmdo/testing/dist/regression/api-contract.js +0 -374
  190. package/v3/@swarmdo/testing/dist/regression/index.d.ts +0 -18
  191. package/v3/@swarmdo/testing/dist/regression/index.js +0 -18
  192. package/v3/@swarmdo/testing/dist/regression/integration-regression.d.ts +0 -67
  193. package/v3/@swarmdo/testing/dist/regression/integration-regression.js +0 -334
  194. package/v3/@swarmdo/testing/dist/regression/performance-baseline.d.ts +0 -106
  195. package/v3/@swarmdo/testing/dist/regression/performance-baseline.js +0 -268
  196. package/v3/@swarmdo/testing/dist/regression/regression-runner.d.ts +0 -124
  197. package/v3/@swarmdo/testing/dist/regression/regression-runner.js +0 -227
  198. package/v3/@swarmdo/testing/dist/regression/security-regression.d.ts +0 -73
  199. package/v3/@swarmdo/testing/dist/regression/security-regression.js +0 -258
  200. package/v3/@swarmdo/testing/dist/setup.d.ts +0 -43
  201. package/v3/@swarmdo/testing/dist/setup.js +0 -91
  202. package/v3/@swarmdo/testing/dist/v2-compat/api-compat.test.d.ts +0 -10
  203. package/v3/@swarmdo/testing/dist/v2-compat/api-compat.test.js +0 -433
  204. package/v3/@swarmdo/testing/dist/v2-compat/cli-compat.test.d.ts +0 -10
  205. package/v3/@swarmdo/testing/dist/v2-compat/cli-compat.test.js +0 -352
  206. package/v3/@swarmdo/testing/dist/v2-compat/compatibility-validator.d.ts +0 -206
  207. package/v3/@swarmdo/testing/dist/v2-compat/compatibility-validator.js +0 -839
  208. package/v3/@swarmdo/testing/dist/v2-compat/hooks-compat.test.d.ts +0 -10
  209. package/v3/@swarmdo/testing/dist/v2-compat/hooks-compat.test.js +0 -428
  210. package/v3/@swarmdo/testing/dist/v2-compat/index.d.ts +0 -38
  211. package/v3/@swarmdo/testing/dist/v2-compat/index.js +0 -41
  212. package/v3/@swarmdo/testing/dist/v2-compat/mcp-compat.test.d.ts +0 -10
  213. package/v3/@swarmdo/testing/dist/v2-compat/mcp-compat.test.js +0 -419
  214. package/v3/@swarmdo/testing/dist/v2-compat/report-generator.d.ts +0 -34
  215. package/v3/@swarmdo/testing/dist/v2-compat/report-generator.js +0 -372
@@ -1,323 +0,0 @@
1
- import { type MockedInterface } from './create-mock.js';
2
- import type { V3AgentType, AgentInstance, AgentMetrics } from '../fixtures/agent-fixtures.js';
3
- import type { SearchResult, VectorQuery } from '../fixtures/memory-fixtures.js';
4
- import type { SwarmState, SwarmConfig, SwarmTask, CoordinationResult } from '../fixtures/swarm-fixtures.js';
5
- import type { MCPTool, MCPToolResult, MCPSessionContext } from '../fixtures/mcp-fixtures.js';
6
- /**
7
- * Event bus interface for DDD events
8
- */
9
- export interface IEventBus {
10
- publish(event: DomainEvent): Promise<void>;
11
- subscribe(eventType: string, handler: EventHandler): () => void;
12
- unsubscribe(eventType: string, handler: EventHandler): void;
13
- getSubscriberCount(eventType: string): number;
14
- }
15
- /**
16
- * Domain event interface
17
- */
18
- export interface DomainEvent {
19
- id: string;
20
- type: string;
21
- payload: unknown;
22
- timestamp: Date;
23
- correlationId?: string;
24
- causationId?: string;
25
- metadata?: Record<string, unknown>;
26
- }
27
- /**
28
- * Event handler type
29
- */
30
- export type EventHandler = (event: DomainEvent) => Promise<void>;
31
- /**
32
- * Task manager interface
33
- */
34
- export interface ITaskManager {
35
- create(definition: TaskDefinition): Promise<Task>;
36
- execute(taskId: string): Promise<TaskResult>;
37
- cancel(taskId: string): Promise<void>;
38
- getStatus(taskId: string): Promise<TaskStatus>;
39
- getTask(taskId: string): Promise<Task | null>;
40
- listTasks(filters?: TaskFilters): Promise<Task[]>;
41
- }
42
- /**
43
- * Task definition interface
44
- */
45
- export interface TaskDefinition {
46
- name: string;
47
- type: string;
48
- payload: unknown;
49
- priority?: number;
50
- dependencies?: string[];
51
- deadline?: Date;
52
- }
53
- /**
54
- * Task interface
55
- */
56
- export interface Task {
57
- id: string;
58
- name: string;
59
- type: string;
60
- status: TaskStatus;
61
- payload: unknown;
62
- priority: number;
63
- createdAt: Date;
64
- startedAt?: Date;
65
- completedAt?: Date;
66
- }
67
- /**
68
- * Task status type
69
- */
70
- export type TaskStatus = 'pending' | 'running' | 'completed' | 'failed' | 'cancelled';
71
- /**
72
- * Task result interface
73
- */
74
- export interface TaskResult {
75
- taskId: string;
76
- success: boolean;
77
- output?: unknown;
78
- error?: Error;
79
- duration: number;
80
- }
81
- /**
82
- * Task filters interface
83
- */
84
- export interface TaskFilters {
85
- status?: TaskStatus;
86
- type?: string;
87
- assignedTo?: string;
88
- limit?: number;
89
- offset?: number;
90
- }
91
- /**
92
- * Agent lifecycle interface
93
- */
94
- export interface IAgentLifecycle {
95
- spawn(config: AgentConfig): Promise<AgentSpawnResult>;
96
- terminate(agentId: string, options?: TerminateOptions): Promise<void>;
97
- getAgent(agentId: string): Promise<AgentInstance | null>;
98
- listAgents(filters?: AgentFilters): Promise<AgentInstance[]>;
99
- getMetrics(agentId: string): Promise<AgentMetrics>;
100
- healthCheck(agentId: string): Promise<AgentHealthCheck>;
101
- }
102
- /**
103
- * Agent config interface
104
- */
105
- export interface AgentConfig {
106
- type: V3AgentType;
107
- name: string;
108
- capabilities?: string[];
109
- priority?: number;
110
- }
111
- /**
112
- * Agent spawn result interface
113
- */
114
- export interface AgentSpawnResult {
115
- agent: AgentInstance;
116
- sessionId: string;
117
- startupTime: number;
118
- success: boolean;
119
- }
120
- /**
121
- * Terminate options interface
122
- */
123
- export interface TerminateOptions {
124
- graceful?: boolean;
125
- timeout?: number;
126
- cancelTasks?: boolean;
127
- }
128
- /**
129
- * Agent filters interface
130
- */
131
- export interface AgentFilters {
132
- type?: V3AgentType;
133
- status?: string;
134
- capability?: string;
135
- }
136
- /**
137
- * Agent health check interface
138
- */
139
- export interface AgentHealthCheck {
140
- healthy: boolean;
141
- issues?: string[];
142
- lastActivity: Date;
143
- metrics: AgentMetrics;
144
- }
145
- /**
146
- * Memory service interface
147
- */
148
- export interface IMemoryService {
149
- store(key: string, value: unknown, metadata?: Record<string, unknown>): Promise<void>;
150
- retrieve(key: string): Promise<unknown>;
151
- search(query: VectorQuery): Promise<SearchResult[]>;
152
- delete(key: string): Promise<void>;
153
- clear(): Promise<void>;
154
- getStats(): Promise<MemoryStats>;
155
- createIndex(name: string, config: IndexConfig): Promise<void>;
156
- }
157
- /**
158
- * Memory stats interface
159
- */
160
- export interface MemoryStats {
161
- totalEntries: number;
162
- totalSizeBytes: number;
163
- vectorCount: number;
164
- cacheHitRate: number;
165
- }
166
- /**
167
- * Index config interface
168
- */
169
- export interface IndexConfig {
170
- dimensions: number;
171
- metric: 'cosine' | 'euclidean' | 'dot';
172
- M?: number;
173
- efConstruction?: number;
174
- }
175
- /**
176
- * Security service interface
177
- */
178
- export interface ISecurityService {
179
- validatePath(path: string): boolean;
180
- validateInput(input: string, options?: InputValidationOptions): {
181
- valid: boolean;
182
- errors?: string[];
183
- };
184
- hashPassword(password: string): Promise<string>;
185
- verifyPassword(password: string, hash: string): Promise<boolean>;
186
- generateToken(payload: Record<string, unknown>, expiresIn?: number): Promise<string>;
187
- verifyToken(token: string): Promise<Record<string, unknown>>;
188
- executeSecurely(command: string, options?: ExecuteOptions): Promise<ExecuteResult>;
189
- }
190
- /**
191
- * Input validation options
192
- */
193
- export interface InputValidationOptions {
194
- maxLength?: number;
195
- allowedChars?: RegExp;
196
- sanitize?: boolean;
197
- }
198
- /**
199
- * Execute options interface
200
- */
201
- export interface ExecuteOptions {
202
- timeout?: number;
203
- cwd?: string;
204
- shell?: boolean;
205
- allowedCommands?: string[];
206
- }
207
- /**
208
- * Execute result interface
209
- */
210
- export interface ExecuteResult {
211
- stdout: string;
212
- stderr: string;
213
- exitCode: number;
214
- duration: number;
215
- }
216
- /**
217
- * Swarm coordinator interface
218
- */
219
- export interface ISwarmCoordinator {
220
- initialize(config: SwarmConfig): Promise<SwarmState>;
221
- coordinate(agents: string[], task: SwarmTask): Promise<CoordinationResult>;
222
- shutdown(graceful?: boolean): Promise<void>;
223
- getState(): SwarmState;
224
- addAgent(agentId: string): Promise<void>;
225
- removeAgent(agentId: string): Promise<void>;
226
- broadcast(message: unknown): Promise<void>;
227
- }
228
- /**
229
- * MCP client interface
230
- */
231
- export interface IMCPClient {
232
- connect(): Promise<void>;
233
- disconnect(): Promise<void>;
234
- callTool(name: string, params: Record<string, unknown>): Promise<MCPToolResult>;
235
- listTools(): Promise<MCPTool[]>;
236
- isConnected(): boolean;
237
- getSession(): MCPSessionContext | null;
238
- }
239
- /**
240
- * Logger interface
241
- */
242
- export interface ILogger {
243
- debug(message: string, context?: Record<string, unknown>): void;
244
- info(message: string, context?: Record<string, unknown>): void;
245
- warn(message: string, context?: Record<string, unknown>): void;
246
- error(message: string, error?: Error, context?: Record<string, unknown>): void;
247
- }
248
- /**
249
- * Create mock event bus with behavior tracking
250
- */
251
- export declare function createMockEventBus(): MockedInterface<IEventBus> & {
252
- publishedEvents: DomainEvent[];
253
- };
254
- /**
255
- * Create mock task manager with realistic behavior
256
- */
257
- export declare function createMockTaskManager(): MockedInterface<ITaskManager> & {
258
- tasks: Map<string, Task>;
259
- };
260
- /**
261
- * Create mock agent lifecycle
262
- */
263
- export declare function createMockAgentLifecycle(): MockedInterface<IAgentLifecycle> & {
264
- agents: Map<string, AgentInstance>;
265
- };
266
- /**
267
- * Create mock memory service
268
- */
269
- export declare function createMockMemoryService(): MockedInterface<IMemoryService> & {
270
- entries: Map<string, {
271
- value: unknown;
272
- metadata?: Record<string, unknown>;
273
- }>;
274
- };
275
- /**
276
- * Create mock security service
277
- */
278
- export declare function createMockSecurityService(): MockedInterface<ISecurityService>;
279
- /**
280
- * Create mock swarm coordinator
281
- */
282
- export declare function createMockSwarmCoordinator(): MockedInterface<ISwarmCoordinator> & {
283
- state: SwarmState;
284
- };
285
- /**
286
- * Create mock MCP client
287
- */
288
- export declare function createMockMCPClient(): MockedInterface<IMCPClient> & {
289
- connected: boolean;
290
- };
291
- /**
292
- * Create mock logger with captured logs
293
- */
294
- export declare function createMockLogger(): MockedInterface<ILogger> & {
295
- logs: Array<{
296
- level: string;
297
- message: string;
298
- context?: Record<string, unknown>;
299
- error?: Error;
300
- }>;
301
- };
302
- /**
303
- * Create a complete test application with all mock services
304
- */
305
- export declare function createMockApplication(): MockApplication;
306
- /**
307
- * Mock application type
308
- */
309
- export interface MockApplication {
310
- eventBus: ReturnType<typeof createMockEventBus>;
311
- taskManager: ReturnType<typeof createMockTaskManager>;
312
- agentLifecycle: ReturnType<typeof createMockAgentLifecycle>;
313
- memoryService: ReturnType<typeof createMockMemoryService>;
314
- securityService: ReturnType<typeof createMockSecurityService>;
315
- swarmCoordinator: ReturnType<typeof createMockSwarmCoordinator>;
316
- mcpClient: ReturnType<typeof createMockMCPClient>;
317
- logger: ReturnType<typeof createMockLogger>;
318
- }
319
- /**
320
- * Reset all mocks in the application
321
- */
322
- export declare function resetMockApplication(app: MockApplication): void;
323
- //# sourceMappingURL=mock-factory.d.ts.map
@@ -1,350 +0,0 @@
1
- /**
2
- * @swarmdo/testing - Mock Factory
3
- *
4
- * Factory functions for creating comprehensive mocks of V3 services and components.
5
- * Implements London School TDD patterns with behavior verification.
6
- */
7
- import { vi } from 'vitest';
8
- import { createMock } from './create-mock.js';
9
- /**
10
- * Create mock event bus with behavior tracking
11
- */
12
- export function createMockEventBus() {
13
- const publishedEvents = [];
14
- const subscribers = new Map();
15
- const mock = createMock();
16
- mock.publish.mockImplementation(async (event) => {
17
- publishedEvents.push(event);
18
- const handlers = subscribers.get(event.type);
19
- if (handlers) {
20
- for (const handler of handlers) {
21
- await handler(event);
22
- }
23
- }
24
- });
25
- mock.subscribe.mockImplementation((eventType, handler) => {
26
- if (!subscribers.has(eventType)) {
27
- subscribers.set(eventType, new Set());
28
- }
29
- subscribers.get(eventType).add(handler);
30
- return () => subscribers.get(eventType)?.delete(handler);
31
- });
32
- mock.unsubscribe.mockImplementation((eventType, handler) => {
33
- subscribers.get(eventType)?.delete(handler);
34
- });
35
- mock.getSubscriberCount.mockImplementation((eventType) => {
36
- return subscribers.get(eventType)?.size ?? 0;
37
- });
38
- return Object.assign(mock, { publishedEvents });
39
- }
40
- /**
41
- * Create mock task manager with realistic behavior
42
- */
43
- export function createMockTaskManager() {
44
- const tasks = new Map();
45
- let taskCounter = 0;
46
- const mock = createMock();
47
- mock.create.mockImplementation(async (definition) => {
48
- const task = {
49
- id: `task-${++taskCounter}`,
50
- name: definition.name,
51
- type: definition.type,
52
- status: 'pending',
53
- payload: definition.payload,
54
- priority: definition.priority ?? 50,
55
- createdAt: new Date(),
56
- };
57
- tasks.set(task.id, task);
58
- return task;
59
- });
60
- mock.execute.mockImplementation(async (taskId) => {
61
- const task = tasks.get(taskId);
62
- if (!task) {
63
- throw new Error(`Task ${taskId} not found`);
64
- }
65
- task.status = 'running';
66
- task.startedAt = new Date();
67
- // Simulate execution
68
- await new Promise(resolve => setTimeout(resolve, 10));
69
- task.status = 'completed';
70
- task.completedAt = new Date();
71
- return {
72
- taskId,
73
- success: true,
74
- duration: task.completedAt.getTime() - task.startedAt.getTime(),
75
- };
76
- });
77
- mock.cancel.mockImplementation(async (taskId) => {
78
- const task = tasks.get(taskId);
79
- if (task) {
80
- task.status = 'cancelled';
81
- }
82
- });
83
- mock.getStatus.mockImplementation(async (taskId) => {
84
- const task = tasks.get(taskId);
85
- return task?.status ?? 'pending';
86
- });
87
- mock.getTask.mockImplementation(async (taskId) => {
88
- return tasks.get(taskId) ?? null;
89
- });
90
- mock.listTasks.mockImplementation(async (filters) => {
91
- let result = Array.from(tasks.values());
92
- if (filters?.status) {
93
- result = result.filter(t => t.status === filters.status);
94
- }
95
- if (filters?.type) {
96
- result = result.filter(t => t.type === filters.type);
97
- }
98
- if (filters?.limit) {
99
- result = result.slice(filters.offset ?? 0, (filters.offset ?? 0) + filters.limit);
100
- }
101
- return result;
102
- });
103
- return Object.assign(mock, { tasks });
104
- }
105
- /**
106
- * Create mock agent lifecycle
107
- */
108
- export function createMockAgentLifecycle() {
109
- const agents = new Map();
110
- let agentCounter = 0;
111
- const mock = createMock();
112
- mock.spawn.mockImplementation(async (config) => {
113
- const agent = {
114
- id: `agent-${config.type}-${++agentCounter}`,
115
- type: config.type,
116
- name: config.name,
117
- status: 'idle',
118
- capabilities: config.capabilities ?? [],
119
- createdAt: new Date(),
120
- };
121
- agents.set(agent.id, agent);
122
- return {
123
- agent,
124
- sessionId: `session-${Date.now()}`,
125
- startupTime: Math.random() * 100 + 50,
126
- success: true,
127
- };
128
- });
129
- mock.terminate.mockImplementation(async (agentId) => {
130
- const agent = agents.get(agentId);
131
- if (agent) {
132
- agent.status = 'terminated';
133
- }
134
- });
135
- mock.getAgent.mockImplementation(async (agentId) => {
136
- return agents.get(agentId) ?? null;
137
- });
138
- mock.listAgents.mockImplementation(async (filters) => {
139
- let result = Array.from(agents.values());
140
- if (filters?.type) {
141
- result = result.filter(a => a.type === filters.type);
142
- }
143
- if (filters?.status) {
144
- result = result.filter(a => a.status === filters.status);
145
- }
146
- if (filters?.capability) {
147
- result = result.filter(a => a.capabilities.includes(filters.capability));
148
- }
149
- return result;
150
- });
151
- mock.getMetrics.mockImplementation(async () => ({
152
- tasksCompleted: Math.floor(Math.random() * 100),
153
- tasksFailed: Math.floor(Math.random() * 10),
154
- avgTaskDuration: Math.random() * 1000,
155
- totalDuration: Math.random() * 10000,
156
- errorRate: Math.random() * 0.1,
157
- memoryUsageMb: Math.random() * 256,
158
- }));
159
- mock.healthCheck.mockImplementation(async (agentId) => {
160
- const agent = agents.get(agentId);
161
- return {
162
- healthy: agent?.status !== 'error' && agent?.status !== 'terminated',
163
- lastActivity: new Date(),
164
- metrics: {
165
- tasksCompleted: 50,
166
- tasksFailed: 1,
167
- avgTaskDuration: 200,
168
- totalDuration: 10000,
169
- errorRate: 0.02,
170
- memoryUsageMb: 128,
171
- },
172
- };
173
- });
174
- return Object.assign(mock, { agents });
175
- }
176
- /**
177
- * Create mock memory service
178
- */
179
- export function createMockMemoryService() {
180
- const entries = new Map();
181
- const mock = createMock();
182
- mock.store.mockImplementation(async (key, value, metadata) => {
183
- entries.set(key, { value, metadata });
184
- });
185
- mock.retrieve.mockImplementation(async (key) => {
186
- return entries.get(key)?.value ?? null;
187
- });
188
- mock.search.mockImplementation(async () => []);
189
- mock.delete.mockImplementation(async (key) => {
190
- entries.delete(key);
191
- });
192
- mock.clear.mockImplementation(async () => {
193
- entries.clear();
194
- });
195
- mock.getStats.mockImplementation(async () => ({
196
- totalEntries: entries.size,
197
- totalSizeBytes: entries.size * 100,
198
- vectorCount: 0,
199
- cacheHitRate: 0.85,
200
- }));
201
- mock.createIndex.mockResolvedValue(undefined);
202
- return Object.assign(mock, { entries });
203
- }
204
- /**
205
- * Create mock security service
206
- */
207
- export function createMockSecurityService() {
208
- const mock = createMock();
209
- mock.validatePath.mockImplementation((path) => {
210
- const blocked = ['../', '~/', '/etc/', '/tmp/', '/var/'];
211
- return !blocked.some(pattern => path.includes(pattern));
212
- });
213
- mock.validateInput.mockImplementation((input, options) => {
214
- const maxLength = options?.maxLength ?? 10000;
215
- if (input.length > maxLength) {
216
- return { valid: false, errors: [`Input exceeds maximum length of ${maxLength}`] };
217
- }
218
- return { valid: true };
219
- });
220
- mock.hashPassword.mockImplementation(async (password) => {
221
- return `hashed:${Buffer.from(password).toString('base64')}`;
222
- });
223
- mock.verifyPassword.mockImplementation(async (password, hash) => {
224
- return hash === `hashed:${Buffer.from(password).toString('base64')}`;
225
- });
226
- mock.generateToken.mockImplementation(async (payload) => {
227
- return `token:${Buffer.from(JSON.stringify(payload)).toString('base64')}`;
228
- });
229
- mock.verifyToken.mockImplementation(async (token) => {
230
- if (!token.startsWith('token:')) {
231
- throw new Error('Invalid token');
232
- }
233
- return JSON.parse(Buffer.from(token.slice(6), 'base64').toString());
234
- });
235
- mock.executeSecurely.mockImplementation(async () => ({
236
- stdout: '',
237
- stderr: '',
238
- exitCode: 0,
239
- duration: 100,
240
- }));
241
- return mock;
242
- }
243
- /**
244
- * Create mock swarm coordinator
245
- */
246
- export function createMockSwarmCoordinator() {
247
- const state = {
248
- id: 'swarm-test',
249
- topology: 'hierarchical-mesh',
250
- status: 'active',
251
- agentCount: 0,
252
- activeAgentCount: 0,
253
- createdAt: new Date(),
254
- };
255
- const mock = createMock();
256
- mock.initialize.mockImplementation(async (config) => {
257
- state.topology = config.topology;
258
- state.status = 'active';
259
- return state;
260
- });
261
- mock.coordinate.mockImplementation(async (agents, task) => ({
262
- success: true,
263
- completedTasks: 1,
264
- failedTasks: 0,
265
- totalDuration: 1000,
266
- agentMetrics: new Map(),
267
- }));
268
- mock.shutdown.mockImplementation(async () => {
269
- state.status = 'shutdown';
270
- state.activeAgentCount = 0;
271
- });
272
- mock.getState.mockImplementation(() => state);
273
- mock.addAgent.mockImplementation(async () => {
274
- state.agentCount++;
275
- state.activeAgentCount++;
276
- });
277
- mock.removeAgent.mockImplementation(async () => {
278
- state.agentCount--;
279
- state.activeAgentCount--;
280
- });
281
- mock.broadcast.mockResolvedValue(undefined);
282
- return Object.assign(mock, { state });
283
- }
284
- /**
285
- * Create mock MCP client
286
- */
287
- export function createMockMCPClient() {
288
- let connected = false;
289
- const mock = createMock();
290
- mock.connect.mockImplementation(async () => {
291
- connected = true;
292
- });
293
- mock.disconnect.mockImplementation(async () => {
294
- connected = false;
295
- });
296
- mock.callTool.mockImplementation(async () => ({
297
- content: [{ type: 'text', text: 'Success' }],
298
- }));
299
- mock.listTools.mockResolvedValue([]);
300
- mock.isConnected.mockImplementation(() => connected);
301
- mock.getSession.mockReturnValue(null);
302
- return Object.assign(mock, { connected });
303
- }
304
- /**
305
- * Create mock logger with captured logs
306
- */
307
- export function createMockLogger() {
308
- const logs = [];
309
- const mock = createMock();
310
- mock.debug.mockImplementation((message, context) => {
311
- logs.push({ level: 'debug', message, context });
312
- });
313
- mock.info.mockImplementation((message, context) => {
314
- logs.push({ level: 'info', message, context });
315
- });
316
- mock.warn.mockImplementation((message, context) => {
317
- logs.push({ level: 'warn', message, context });
318
- });
319
- mock.error.mockImplementation((message, error, context) => {
320
- logs.push({ level: 'error', message, context, error });
321
- });
322
- return Object.assign(mock, { logs });
323
- }
324
- /**
325
- * Create a complete test application with all mock services
326
- */
327
- export function createMockApplication() {
328
- return {
329
- eventBus: createMockEventBus(),
330
- taskManager: createMockTaskManager(),
331
- agentLifecycle: createMockAgentLifecycle(),
332
- memoryService: createMockMemoryService(),
333
- securityService: createMockSecurityService(),
334
- swarmCoordinator: createMockSwarmCoordinator(),
335
- mcpClient: createMockMCPClient(),
336
- logger: createMockLogger(),
337
- };
338
- }
339
- /**
340
- * Reset all mocks in the application
341
- */
342
- export function resetMockApplication(app) {
343
- vi.clearAllMocks();
344
- app.eventBus.publishedEvents.length = 0;
345
- app.taskManager.tasks.clear();
346
- app.agentLifecycle.agents.clear();
347
- app.memoryService.entries.clear();
348
- app.logger.logs.length = 0;
349
- }
350
- //# sourceMappingURL=mock-factory.js.map