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.
- package/.claude/helpers/hook-handler.cjs +16 -0
- package/.claude/helpers/router.cjs +27 -1
- package/.claude/settings.local.json +7 -0
- package/README.md +6 -2
- package/package.json +1 -1
- package/v3/@swarmdo/cli/dist/src/agent-bridge/bridge.d.ts +104 -0
- package/v3/@swarmdo/cli/dist/src/agent-bridge/bridge.js +133 -0
- package/v3/@swarmdo/cli/dist/src/commands/agent.js +133 -1
- package/v3/@swarmdo/cli/dist/src/commands/config.js +32 -1
- package/v3/@swarmdo/cli/dist/src/commands/hidden-coupling.d.ts +19 -0
- package/v3/@swarmdo/cli/dist/src/commands/hidden-coupling.js +92 -0
- package/v3/@swarmdo/cli/dist/src/commands/index.js +14 -4
- package/v3/@swarmdo/cli/dist/src/commands/ownership.d.ts +18 -0
- package/v3/@swarmdo/cli/dist/src/commands/ownership.js +88 -0
- package/v3/@swarmdo/cli/dist/src/commands/pack.js +4 -4
- package/v3/@swarmdo/cli/dist/src/commands/standup.d.ts +18 -0
- package/v3/@swarmdo/cli/dist/src/commands/standup.js +116 -0
- package/v3/@swarmdo/cli/dist/src/commands/swarm.js +29 -0
- package/v3/@swarmdo/cli/dist/src/config-lint/commands-lint.d.ts +31 -0
- package/v3/@swarmdo/cli/dist/src/config-lint/commands-lint.js +127 -0
- package/v3/@swarmdo/cli/dist/src/config-lint/lint.d.ts +5 -0
- package/v3/@swarmdo/cli/dist/src/config-lint/lint.js +4 -0
- package/v3/@swarmdo/cli/dist/src/coupling/hidden.d.ts +45 -0
- package/v3/@swarmdo/cli/dist/src/coupling/hidden.js +66 -0
- package/v3/@swarmdo/cli/dist/src/init/helpers-generator.js +41 -1
- package/v3/@swarmdo/cli/dist/src/mcp-client.js +2 -0
- package/v3/@swarmdo/cli/dist/src/mcp-tools/agent-tools.js +166 -0
- package/v3/@swarmdo/cli/dist/src/mcp-tools/index.d.ts +1 -0
- package/v3/@swarmdo/cli/dist/src/mcp-tools/index.js +1 -0
- package/v3/@swarmdo/cli/dist/src/mcp-tools/ownership-tools.d.ts +14 -0
- package/v3/@swarmdo/cli/dist/src/mcp-tools/ownership-tools.js +51 -0
- package/v3/@swarmdo/cli/dist/src/mcp-tools/profiles.js +1 -0
- package/v3/@swarmdo/cli/dist/src/mcp-tools/swarm-tools.d.ts +33 -0
- package/v3/@swarmdo/cli/dist/src/mcp-tools/swarm-tools.js +73 -38
- package/v3/@swarmdo/cli/dist/src/ownership/ownership.d.ts +61 -0
- package/v3/@swarmdo/cli/dist/src/ownership/ownership.js +151 -0
- package/v3/@swarmdo/cli/dist/src/pack/pack.d.ts +1 -1
- package/v3/@swarmdo/cli/dist/src/pack/pack.js +12 -4
- package/v3/@swarmdo/cli/dist/src/redact/redact.js +28 -9
- package/v3/@swarmdo/cli/dist/src/standup/standup.d.ts +83 -0
- package/v3/@swarmdo/cli/dist/src/standup/standup.js +157 -0
- package/v3/@swarmdo/cli/package.json +1 -1
- package/v3/@swarmdo/cli-core/dist/src/index.js +1 -1
- package/v3/@swarmdo/codex/dist/cli.js +0 -0
- package/v3/@swarmdo/hooks/dist/cli/guidance-cli.js +0 -0
- package/v3/@swarmdo/hooks/dist/statusline/index.d.ts +3 -3
- package/v3/@swarmdo/hooks/dist/statusline/index.js +3 -3
- package/v3/@swarmdo/integration/dist/__tests__/agentic-flow-agent.test.js +1 -4
- package/v3/@swarmdo/neural/dist/flash-attention.d.ts +1 -1
- package/v3/@swarmdo/neural/dist/flash-attention.js +1 -1
- package/v3/@swarmdo/plugin-agent-federation/dist/plugin.js +1 -1
- package/v3/@swarmdo/plugin-agent-federation/dist/transport/midstream-aware-loader.js +2 -2
- package/v3/@swarmdo/plugin-iot-cognitum/dist/application/index.d.ts +2 -0
- package/v3/@swarmdo/plugin-iot-cognitum/dist/application/index.js +2 -0
- package/v3/@swarmdo/plugin-iot-cognitum/dist/application/iot-coordinator.d.ts +138 -0
- package/v3/@swarmdo/plugin-iot-cognitum/dist/application/iot-coordinator.js +418 -0
- package/v3/@swarmdo/plugin-iot-cognitum/dist/bin.d.ts +15 -0
- package/v3/@swarmdo/plugin-iot-cognitum/dist/bin.js +240 -0
- package/v3/@swarmdo/plugin-iot-cognitum/dist/cli-commands.d.ts +7 -0
- package/v3/@swarmdo/plugin-iot-cognitum/dist/cli-commands.js +508 -0
- package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/entities/device-agent.d.ts +54 -0
- package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/entities/device-agent.js +2 -0
- package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/entities/device-fleet.d.ts +46 -0
- package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/entities/device-fleet.js +2 -0
- package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/entities/device-trust-level.d.ts +18 -0
- package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/entities/device-trust-level.js +28 -0
- package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/entities/index.d.ts +5 -0
- package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/entities/index.js +2 -0
- package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/entities/telemetry.d.ts +35 -0
- package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/entities/telemetry.js +2 -0
- package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/repositories/device-repository.d.ts +11 -0
- package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/repositories/device-repository.js +2 -0
- package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/repositories/fleet-repository.d.ts +9 -0
- package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/repositories/fleet-repository.js +2 -0
- package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/repositories/index.d.ts +5 -0
- package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/repositories/index.js +2 -0
- package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/repositories/telemetry-repository.d.ts +12 -0
- package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/repositories/telemetry-repository.js +2 -0
- package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/repositories/trust-history-repository.d.ts +19 -0
- package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/repositories/trust-history-repository.js +2 -0
- package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/anomaly-detection-service.d.ts +44 -0
- package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/anomaly-detection-service.js +117 -0
- package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/device-lifecycle-service.d.ts +70 -0
- package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/device-lifecycle-service.js +194 -0
- package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/firmware-orchestration-service.d.ts +69 -0
- package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/firmware-orchestration-service.js +139 -0
- package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/fleet-topology-service.d.ts +34 -0
- package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/fleet-topology-service.js +101 -0
- package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/index.d.ts +10 -0
- package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/index.js +10 -0
- package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/mesh-service.d.ts +64 -0
- package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/mesh-service.js +70 -0
- package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/sona-integration-service.d.ts +44 -0
- package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/sona-integration-service.js +79 -0
- package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/telemetry-ingestion-service.d.ts +37 -0
- package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/telemetry-ingestion-service.js +39 -0
- package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/telemetry-service.d.ts +67 -0
- package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/telemetry-service.js +58 -0
- package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/witness-verification-service.d.ts +45 -0
- package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/witness-verification-service.js +63 -0
- package/v3/@swarmdo/plugin-iot-cognitum/dist/index.d.ts +26 -0
- package/v3/@swarmdo/plugin-iot-cognitum/dist/index.js +17 -0
- package/v3/@swarmdo/plugin-iot-cognitum/dist/infrastructure/agentdb-telemetry-repository.d.ts +51 -0
- package/v3/@swarmdo/plugin-iot-cognitum/dist/infrastructure/agentdb-telemetry-repository.js +110 -0
- package/v3/@swarmdo/plugin-iot-cognitum/dist/infrastructure/in-memory-device-repository.d.ts +13 -0
- package/v3/@swarmdo/plugin-iot-cognitum/dist/infrastructure/in-memory-device-repository.js +25 -0
- package/v3/@swarmdo/plugin-iot-cognitum/dist/infrastructure/in-memory-fleet-repository.d.ts +11 -0
- package/v3/@swarmdo/plugin-iot-cognitum/dist/infrastructure/in-memory-fleet-repository.js +19 -0
- package/v3/@swarmdo/plugin-iot-cognitum/dist/infrastructure/in-memory-trust-history-repository.d.ts +11 -0
- package/v3/@swarmdo/plugin-iot-cognitum/dist/infrastructure/in-memory-trust-history-repository.js +27 -0
- package/v3/@swarmdo/plugin-iot-cognitum/dist/infrastructure/index.d.ts +6 -0
- package/v3/@swarmdo/plugin-iot-cognitum/dist/infrastructure/index.js +6 -0
- package/v3/@swarmdo/plugin-iot-cognitum/dist/infrastructure/seed-client-factory.d.ts +41 -0
- package/v3/@swarmdo/plugin-iot-cognitum/dist/infrastructure/seed-client-factory.js +64 -0
- package/v3/@swarmdo/plugin-iot-cognitum/dist/mcp-tools.d.ts +8 -0
- package/v3/@swarmdo/plugin-iot-cognitum/dist/mcp-tools.js +703 -0
- package/v3/@swarmdo/plugin-iot-cognitum/dist/plugin.d.ts +23 -0
- package/v3/@swarmdo/plugin-iot-cognitum/dist/plugin.js +239 -0
- package/v3/@swarmdo/plugin-iot-cognitum/dist/workers/anomaly-scan-worker.d.ts +17 -0
- package/v3/@swarmdo/plugin-iot-cognitum/dist/workers/anomaly-scan-worker.js +42 -0
- package/v3/@swarmdo/plugin-iot-cognitum/dist/workers/firmware-watch-worker.d.ts +18 -0
- package/v3/@swarmdo/plugin-iot-cognitum/dist/workers/firmware-watch-worker.js +45 -0
- package/v3/@swarmdo/plugin-iot-cognitum/dist/workers/health-probe-worker.d.ts +19 -0
- package/v3/@swarmdo/plugin-iot-cognitum/dist/workers/health-probe-worker.js +50 -0
- package/v3/@swarmdo/plugin-iot-cognitum/dist/workers/mesh-sync-worker.d.ts +19 -0
- package/v3/@swarmdo/plugin-iot-cognitum/dist/workers/mesh-sync-worker.js +47 -0
- package/v3/@swarmdo/plugin-iot-cognitum/dist/workers/telemetry-ingest-worker.d.ts +17 -0
- package/v3/@swarmdo/plugin-iot-cognitum/dist/workers/telemetry-ingest-worker.js +40 -0
- package/v3/@swarmdo/plugin-iot-cognitum/dist/workers/witness-audit-worker.d.ts +18 -0
- package/v3/@swarmdo/plugin-iot-cognitum/dist/workers/witness-audit-worker.js +51 -0
- package/v3/@swarmdo/providers/dist/swarmvector-provider.d.ts +1 -1
- package/v3/@swarmdo/providers/dist/swarmvector-provider.js +1 -1
- package/v3/@swarmdo/security/dist/input-validator.d.ts +6 -6
- package/v3/@swarmdo/shared/dist/hooks/safety/git-commit.js +1 -1
- package/v3/@swarmdo/shared/dist/mcp/transport/http.js +1 -8
- package/v3/@swarmdo/testing/dist/fixtures/agent-fixtures.d.ts +214 -0
- package/v3/@swarmdo/testing/dist/fixtures/agent-fixtures.js +595 -0
- package/v3/@swarmdo/testing/dist/fixtures/agents.d.ts +76 -0
- package/v3/@swarmdo/testing/dist/fixtures/agents.js +158 -0
- package/v3/@swarmdo/testing/dist/fixtures/configurations.d.ts +157 -0
- package/v3/@swarmdo/testing/dist/fixtures/configurations.js +337 -0
- package/v3/@swarmdo/testing/dist/fixtures/index.d.ts +10 -0
- package/v3/@swarmdo/testing/dist/fixtures/index.js +17 -0
- package/v3/@swarmdo/testing/dist/fixtures/mcp-fixtures.d.ts +329 -0
- package/v3/@swarmdo/testing/dist/fixtures/mcp-fixtures.js +714 -0
- package/v3/@swarmdo/testing/dist/fixtures/memory-entries.d.ts +159 -0
- package/v3/@swarmdo/testing/dist/fixtures/memory-entries.js +262 -0
- package/v3/@swarmdo/testing/dist/fixtures/memory-fixtures.d.ts +290 -0
- package/v3/@swarmdo/testing/dist/fixtures/memory-fixtures.js +547 -0
- package/v3/@swarmdo/testing/dist/fixtures/swarm-fixtures.d.ts +289 -0
- package/v3/@swarmdo/testing/dist/fixtures/swarm-fixtures.js +534 -0
- package/v3/@swarmdo/testing/dist/fixtures/tasks.d.ts +106 -0
- package/v3/@swarmdo/testing/dist/fixtures/tasks.js +229 -0
- package/v3/@swarmdo/testing/dist/helpers/assertion-helpers.d.ts +213 -0
- package/v3/@swarmdo/testing/dist/helpers/assertion-helpers.js +435 -0
- package/v3/@swarmdo/testing/dist/helpers/assertions.d.ts +135 -0
- package/v3/@swarmdo/testing/dist/helpers/assertions.js +217 -0
- package/v3/@swarmdo/testing/dist/helpers/create-mock.d.ts +96 -0
- package/v3/@swarmdo/testing/dist/helpers/create-mock.js +164 -0
- package/v3/@swarmdo/testing/dist/helpers/index.d.ts +14 -0
- package/v3/@swarmdo/testing/dist/helpers/index.js +22 -0
- package/v3/@swarmdo/testing/dist/helpers/mock-factory.d.ts +323 -0
- package/v3/@swarmdo/testing/dist/helpers/mock-factory.js +350 -0
- package/v3/@swarmdo/testing/dist/helpers/setup-teardown.d.ts +271 -0
- package/v3/@swarmdo/testing/dist/helpers/setup-teardown.js +446 -0
- package/v3/@swarmdo/testing/dist/helpers/swarm-instance.d.ts +142 -0
- package/v3/@swarmdo/testing/dist/helpers/swarm-instance.js +205 -0
- package/v3/@swarmdo/testing/dist/helpers/test-application.d.ts +190 -0
- package/v3/@swarmdo/testing/dist/helpers/test-application.js +138 -0
- package/v3/@swarmdo/testing/dist/helpers/test-utils.d.ts +274 -0
- package/v3/@swarmdo/testing/dist/helpers/test-utils.js +456 -0
- package/v3/@swarmdo/testing/dist/index.d.ts +42 -0
- package/v3/@swarmdo/testing/dist/index.js +66 -0
- package/v3/@swarmdo/testing/dist/mocks/index.d.ts +8 -0
- package/v3/@swarmdo/testing/dist/mocks/index.js +10 -0
- package/v3/@swarmdo/testing/dist/mocks/mock-mcp-client.d.ts +206 -0
- package/v3/@swarmdo/testing/dist/mocks/mock-mcp-client.js +575 -0
- package/v3/@swarmdo/testing/dist/mocks/mock-services.d.ts +287 -0
- package/v3/@swarmdo/testing/dist/mocks/mock-services.js +563 -0
- package/v3/@swarmdo/testing/dist/regression/api-contract.d.ts +109 -0
- package/v3/@swarmdo/testing/dist/regression/api-contract.js +374 -0
- package/v3/@swarmdo/testing/dist/regression/index.d.ts +18 -0
- package/v3/@swarmdo/testing/dist/regression/index.js +18 -0
- package/v3/@swarmdo/testing/dist/regression/integration-regression.d.ts +67 -0
- package/v3/@swarmdo/testing/dist/regression/integration-regression.js +334 -0
- package/v3/@swarmdo/testing/dist/regression/performance-baseline.d.ts +106 -0
- package/v3/@swarmdo/testing/dist/regression/performance-baseline.js +268 -0
- package/v3/@swarmdo/testing/dist/regression/regression-runner.d.ts +124 -0
- package/v3/@swarmdo/testing/dist/regression/regression-runner.js +227 -0
- package/v3/@swarmdo/testing/dist/regression/security-regression.d.ts +73 -0
- package/v3/@swarmdo/testing/dist/regression/security-regression.js +258 -0
- package/v3/@swarmdo/testing/dist/setup.d.ts +43 -0
- package/v3/@swarmdo/testing/dist/setup.js +91 -0
- package/v3/@swarmdo/testing/dist/v2-compat/api-compat.test.d.ts +10 -0
- package/v3/@swarmdo/testing/dist/v2-compat/api-compat.test.js +433 -0
- package/v3/@swarmdo/testing/dist/v2-compat/cli-compat.test.d.ts +10 -0
- package/v3/@swarmdo/testing/dist/v2-compat/cli-compat.test.js +352 -0
- package/v3/@swarmdo/testing/dist/v2-compat/compatibility-validator.d.ts +206 -0
- package/v3/@swarmdo/testing/dist/v2-compat/compatibility-validator.js +839 -0
- package/v3/@swarmdo/testing/dist/v2-compat/hooks-compat.test.d.ts +10 -0
- package/v3/@swarmdo/testing/dist/v2-compat/hooks-compat.test.js +428 -0
- package/v3/@swarmdo/testing/dist/v2-compat/index.d.ts +38 -0
- package/v3/@swarmdo/testing/dist/v2-compat/index.js +41 -0
- package/v3/@swarmdo/testing/dist/v2-compat/mcp-compat.test.d.ts +10 -0
- package/v3/@swarmdo/testing/dist/v2-compat/mcp-compat.test.js +419 -0
- package/v3/@swarmdo/testing/dist/v2-compat/report-generator.d.ts +34 -0
- package/v3/@swarmdo/testing/dist/v2-compat/report-generator.js +372 -0
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @swarmdo/testing - Mock Services
|
|
3
|
+
*
|
|
4
|
+
* Comprehensive mock implementations of V3 core services.
|
|
5
|
+
* Provides realistic behavior for testing with full state tracking.
|
|
6
|
+
*/
|
|
7
|
+
import { type Mock } from 'vitest';
|
|
8
|
+
import type { V3AgentType } from '../fixtures/agent-fixtures.js';
|
|
9
|
+
/**
|
|
10
|
+
* Mock AgentDB - Vector database mock with HNSW simulation
|
|
11
|
+
*/
|
|
12
|
+
export declare class MockAgentDB {
|
|
13
|
+
private vectors;
|
|
14
|
+
private indexConfig;
|
|
15
|
+
insert: Mock<(id: string, embedding: number[], metadata?: Record<string, unknown>) => Promise<void>>;
|
|
16
|
+
search: Mock<(embedding: number[], k: number, threshold?: number) => Promise<{
|
|
17
|
+
id: string;
|
|
18
|
+
score: number;
|
|
19
|
+
metadata: Record<string, unknown>;
|
|
20
|
+
}[]>>;
|
|
21
|
+
delete: Mock<(id: string) => Promise<void>>;
|
|
22
|
+
update: Mock<(id: string, embedding: number[], metadata?: Record<string, unknown>) => Promise<void>>;
|
|
23
|
+
getVector: Mock<(id: string) => Promise<{
|
|
24
|
+
embedding: number[];
|
|
25
|
+
metadata: Record<string, unknown>;
|
|
26
|
+
} | null>>;
|
|
27
|
+
getStats: Mock<() => {
|
|
28
|
+
vectorCount: number;
|
|
29
|
+
indexSize: number;
|
|
30
|
+
dimensions: number;
|
|
31
|
+
M: number;
|
|
32
|
+
efConstruction: number;
|
|
33
|
+
}>;
|
|
34
|
+
rebuildIndex: Mock<() => Promise<void>>;
|
|
35
|
+
clear: Mock<() => void>;
|
|
36
|
+
private cosineSimilarity;
|
|
37
|
+
/**
|
|
38
|
+
* Configure the mock index
|
|
39
|
+
*/
|
|
40
|
+
configure(config: Partial<typeof this.indexConfig>): void;
|
|
41
|
+
/**
|
|
42
|
+
* Get all stored vectors (for testing)
|
|
43
|
+
*/
|
|
44
|
+
getAllVectors(): Map<string, {
|
|
45
|
+
embedding: number[];
|
|
46
|
+
metadata: Record<string, unknown>;
|
|
47
|
+
}>;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Mock Unified Swarm Coordinator
|
|
51
|
+
*/
|
|
52
|
+
export declare class MockSwarmCoordinator {
|
|
53
|
+
private agents;
|
|
54
|
+
private state;
|
|
55
|
+
private messageQueue;
|
|
56
|
+
private taskQueue;
|
|
57
|
+
initialize: Mock<(config: SwarmInitConfig) => Promise<SwarmState>>;
|
|
58
|
+
shutdown: Mock<(graceful?: boolean) => Promise<void>>;
|
|
59
|
+
addAgent: Mock<(config: AgentConfig) => Promise<MockSwarmAgent>>;
|
|
60
|
+
removeAgent: Mock<(agentId: string) => Promise<void>>;
|
|
61
|
+
coordinate: Mock<(task: SwarmTask) => Promise<{
|
|
62
|
+
success: boolean;
|
|
63
|
+
error: string;
|
|
64
|
+
taskId: string;
|
|
65
|
+
duration: number;
|
|
66
|
+
results?: undefined;
|
|
67
|
+
} | {
|
|
68
|
+
success: boolean;
|
|
69
|
+
taskId: string;
|
|
70
|
+
duration: number;
|
|
71
|
+
results: TaskResult[];
|
|
72
|
+
error?: undefined;
|
|
73
|
+
}>>;
|
|
74
|
+
broadcast: Mock<(message: Omit<SwarmMessage, "id" | "timestamp">) => Promise<void>>;
|
|
75
|
+
sendMessage: Mock<(message: SwarmMessage) => Promise<void>>;
|
|
76
|
+
requestConsensus: Mock<(<T>(request: ConsensusRequest<T>) => Promise<ConsensusResponse<T>>)>;
|
|
77
|
+
getState: Mock<() => {
|
|
78
|
+
id: string;
|
|
79
|
+
topology: string;
|
|
80
|
+
status: string;
|
|
81
|
+
agentCount: number;
|
|
82
|
+
activeAgentCount: number;
|
|
83
|
+
leaderId?: string;
|
|
84
|
+
createdAt: Date;
|
|
85
|
+
}>;
|
|
86
|
+
getAgent: Mock<(id: string) => MockSwarmAgent | undefined>;
|
|
87
|
+
getAgents: Mock<() => MockSwarmAgent[]>;
|
|
88
|
+
getMessageQueue: Mock<() => SwarmMessage[]>;
|
|
89
|
+
getTaskQueue: Mock<() => SwarmTask[]>;
|
|
90
|
+
private electNewLeader;
|
|
91
|
+
reset(): void;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Mock Swarm Agent
|
|
95
|
+
*/
|
|
96
|
+
export declare class MockSwarmAgent {
|
|
97
|
+
readonly id: string;
|
|
98
|
+
readonly config: AgentConfig;
|
|
99
|
+
status: 'idle' | 'busy' | 'terminated';
|
|
100
|
+
priority: number;
|
|
101
|
+
private messages;
|
|
102
|
+
private taskResults;
|
|
103
|
+
execute: Mock;
|
|
104
|
+
receive: Mock;
|
|
105
|
+
send: Mock;
|
|
106
|
+
terminate: Mock;
|
|
107
|
+
constructor(id: string, config: AgentConfig);
|
|
108
|
+
canHandle(taskType: string): boolean;
|
|
109
|
+
getMessages(): SwarmMessage[];
|
|
110
|
+
getTaskResults(): TaskResult[];
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Mock Memory Service with caching
|
|
114
|
+
*/
|
|
115
|
+
export declare class MockMemoryService {
|
|
116
|
+
private store;
|
|
117
|
+
private cache;
|
|
118
|
+
private cacheHits;
|
|
119
|
+
private cacheMisses;
|
|
120
|
+
set: Mock<(key: string, value: unknown, metadata?: MemoryMetadata) => Promise<void>>;
|
|
121
|
+
get: Mock<(key: string) => Promise<unknown>>;
|
|
122
|
+
delete: Mock<(key: string) => Promise<void>>;
|
|
123
|
+
search: Mock<(query: VectorSearchQuery) => Promise<SearchResult[]>>;
|
|
124
|
+
clear: Mock<() => Promise<void>>;
|
|
125
|
+
getStats: Mock<() => {
|
|
126
|
+
totalEntries: number;
|
|
127
|
+
cacheSize: number;
|
|
128
|
+
cacheHitRate: number;
|
|
129
|
+
cacheHits: number;
|
|
130
|
+
cacheMisses: number;
|
|
131
|
+
}>;
|
|
132
|
+
prune: Mock<() => Promise<number>>;
|
|
133
|
+
reset(): void;
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Mock Event Bus with history tracking
|
|
137
|
+
*/
|
|
138
|
+
export declare class MockEventBus {
|
|
139
|
+
private subscribers;
|
|
140
|
+
private history;
|
|
141
|
+
private maxHistorySize;
|
|
142
|
+
publish: Mock<(event: DomainEvent) => Promise<void>>;
|
|
143
|
+
subscribe: Mock<(eventType: string, handler: EventHandler) => () => void>;
|
|
144
|
+
unsubscribe: Mock<(eventType: string, handler: EventHandler) => void>;
|
|
145
|
+
getHistory(eventType?: string): DomainEvent[];
|
|
146
|
+
getSubscriberCount(eventType: string): number;
|
|
147
|
+
clear(): void;
|
|
148
|
+
reset(): void;
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Mock Security Service
|
|
152
|
+
*/
|
|
153
|
+
export declare class MockSecurityService {
|
|
154
|
+
private blockedPaths;
|
|
155
|
+
private allowedCommands;
|
|
156
|
+
private tokens;
|
|
157
|
+
validatePath: Mock<(path: string) => boolean>;
|
|
158
|
+
validateInput: Mock<(input: string, options?: InputValidationOptions) => {
|
|
159
|
+
valid: boolean;
|
|
160
|
+
sanitized: string;
|
|
161
|
+
errors: string[] | undefined;
|
|
162
|
+
}>;
|
|
163
|
+
hashPassword: Mock<(password: string) => Promise<string>>;
|
|
164
|
+
verifyPassword: Mock<(password: string, hash: string) => Promise<boolean>>;
|
|
165
|
+
generateToken: Mock<(payload: Record<string, unknown>, expiresIn?: number) => Promise<string>>;
|
|
166
|
+
verifyToken: Mock<(token: string) => Promise<Record<string, unknown>>>;
|
|
167
|
+
executeSecurely: Mock<(command: string, options?: ExecuteOptions) => Promise<{
|
|
168
|
+
stdout: string;
|
|
169
|
+
stderr: string;
|
|
170
|
+
exitCode: number;
|
|
171
|
+
duration: number;
|
|
172
|
+
}>>;
|
|
173
|
+
private sanitize;
|
|
174
|
+
reset(): void;
|
|
175
|
+
}
|
|
176
|
+
interface SwarmState {
|
|
177
|
+
id: string;
|
|
178
|
+
topology: string;
|
|
179
|
+
status: string;
|
|
180
|
+
agentCount: number;
|
|
181
|
+
activeAgentCount: number;
|
|
182
|
+
leaderId?: string;
|
|
183
|
+
createdAt: Date;
|
|
184
|
+
}
|
|
185
|
+
interface SwarmInitConfig {
|
|
186
|
+
topology?: string;
|
|
187
|
+
maxAgents?: number;
|
|
188
|
+
}
|
|
189
|
+
interface AgentConfig {
|
|
190
|
+
type: V3AgentType;
|
|
191
|
+
name?: string;
|
|
192
|
+
capabilities?: string[];
|
|
193
|
+
priority?: number;
|
|
194
|
+
}
|
|
195
|
+
interface SwarmTask {
|
|
196
|
+
id: string;
|
|
197
|
+
type: string;
|
|
198
|
+
payload: unknown;
|
|
199
|
+
priority?: number;
|
|
200
|
+
maxAgents?: number;
|
|
201
|
+
}
|
|
202
|
+
interface SwarmMessage {
|
|
203
|
+
id: string;
|
|
204
|
+
from: string;
|
|
205
|
+
to: string;
|
|
206
|
+
type: string;
|
|
207
|
+
payload: unknown;
|
|
208
|
+
timestamp: Date;
|
|
209
|
+
}
|
|
210
|
+
interface TaskResult {
|
|
211
|
+
taskId: string;
|
|
212
|
+
agentId: string;
|
|
213
|
+
success: boolean;
|
|
214
|
+
output?: unknown;
|
|
215
|
+
error?: Error;
|
|
216
|
+
duration: number;
|
|
217
|
+
}
|
|
218
|
+
interface ConsensusRequest<T> {
|
|
219
|
+
topic: string;
|
|
220
|
+
options: T[];
|
|
221
|
+
voters?: string[];
|
|
222
|
+
timeout?: number;
|
|
223
|
+
}
|
|
224
|
+
interface ConsensusResponse<T> {
|
|
225
|
+
topic: string;
|
|
226
|
+
decision: T | null;
|
|
227
|
+
votes: Map<string, T>;
|
|
228
|
+
consensus: boolean;
|
|
229
|
+
votingDuration: number;
|
|
230
|
+
participatingAgents: string[];
|
|
231
|
+
}
|
|
232
|
+
interface MemoryMetadata {
|
|
233
|
+
type: 'short-term' | 'long-term' | 'semantic' | 'episodic';
|
|
234
|
+
tags: string[];
|
|
235
|
+
ttl?: number;
|
|
236
|
+
[key: string]: unknown;
|
|
237
|
+
}
|
|
238
|
+
interface VectorSearchQuery {
|
|
239
|
+
embedding?: number[];
|
|
240
|
+
topK: number;
|
|
241
|
+
threshold?: number;
|
|
242
|
+
filters?: Record<string, unknown>;
|
|
243
|
+
}
|
|
244
|
+
interface SearchResult {
|
|
245
|
+
key: string;
|
|
246
|
+
value: unknown;
|
|
247
|
+
score: number;
|
|
248
|
+
metadata: MemoryMetadata;
|
|
249
|
+
}
|
|
250
|
+
interface DomainEvent {
|
|
251
|
+
id: string;
|
|
252
|
+
type: string;
|
|
253
|
+
payload: unknown;
|
|
254
|
+
timestamp: Date;
|
|
255
|
+
correlationId?: string;
|
|
256
|
+
}
|
|
257
|
+
type EventHandler = (event: DomainEvent) => Promise<void>;
|
|
258
|
+
interface InputValidationOptions {
|
|
259
|
+
maxLength?: number;
|
|
260
|
+
allowedChars?: RegExp;
|
|
261
|
+
sanitize?: boolean;
|
|
262
|
+
}
|
|
263
|
+
interface ExecuteOptions {
|
|
264
|
+
timeout?: number;
|
|
265
|
+
cwd?: string;
|
|
266
|
+
shell?: boolean;
|
|
267
|
+
}
|
|
268
|
+
/**
|
|
269
|
+
* Create all mock services as a bundle
|
|
270
|
+
*/
|
|
271
|
+
export declare function createMockServices(): MockServiceBundle;
|
|
272
|
+
/**
|
|
273
|
+
* Mock service bundle interface
|
|
274
|
+
*/
|
|
275
|
+
export interface MockServiceBundle {
|
|
276
|
+
agentDB: MockAgentDB;
|
|
277
|
+
swarmCoordinator: MockSwarmCoordinator;
|
|
278
|
+
memoryService: MockMemoryService;
|
|
279
|
+
eventBus: MockEventBus;
|
|
280
|
+
securityService: MockSecurityService;
|
|
281
|
+
}
|
|
282
|
+
/**
|
|
283
|
+
* Reset all mock services
|
|
284
|
+
*/
|
|
285
|
+
export declare function resetMockServices(services: MockServiceBundle): void;
|
|
286
|
+
export {};
|
|
287
|
+
//# sourceMappingURL=mock-services.d.ts.map
|