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.
- package/.claude/helpers/statusline.cjs +7 -7
- package/README.md +3 -1
- package/package.json +5 -3
- package/v3/@swarmdo/cli/dist/src/commands/hooks.js +26 -24
- package/v3/@swarmdo/cli/dist/src/commands/index.js +4 -0
- package/v3/@swarmdo/cli/dist/src/commands/integrations.d.ts +14 -0
- package/v3/@swarmdo/cli/dist/src/commands/integrations.js +158 -0
- package/v3/@swarmdo/cli/dist/src/commands/memory.js +50 -1
- package/v3/@swarmdo/cli/dist/src/commands/providers.js +3 -0
- package/v3/@swarmdo/cli/dist/src/commands/release.d.ts +15 -0
- package/v3/@swarmdo/cli/dist/src/commands/release.js +224 -0
- package/v3/@swarmdo/cli/dist/src/commands/security.js +14 -0
- package/v3/@swarmdo/cli/dist/src/commands/transcript.js +82 -1
- package/v3/@swarmdo/cli/dist/src/commands/usage.js +80 -1
- package/v3/@swarmdo/cli/dist/src/config-lint/lint.js +11 -1
- package/v3/@swarmdo/cli/dist/src/init/statusline-generator.js +6 -6
- package/v3/@swarmdo/cli/dist/src/integrations/integrations.d.ts +54 -0
- package/v3/@swarmdo/cli/dist/src/integrations/integrations.js +162 -0
- package/v3/@swarmdo/cli/dist/src/mcp-tools/agent-execute-core.js +25 -3
- package/v3/@swarmdo/cli/dist/src/mcp-tools/agentdb-tools.js +8 -8
- package/v3/@swarmdo/cli/dist/src/memory/graph-edge-writer.d.ts +12 -0
- package/v3/@swarmdo/cli/dist/src/memory/graph-edge-writer.js +32 -1
- package/v3/@swarmdo/cli/dist/src/memory-vault/watch.d.ts +32 -0
- package/v3/@swarmdo/cli/dist/src/memory-vault/watch.js +66 -0
- package/v3/@swarmdo/cli/dist/src/providers/openrouter-config.d.ts +91 -0
- package/v3/@swarmdo/cli/dist/src/providers/openrouter-config.js +186 -0
- package/v3/@swarmdo/cli/dist/src/release/release.d.ts +72 -0
- package/v3/@swarmdo/cli/dist/src/release/release.js +86 -0
- package/v3/@swarmdo/cli/dist/src/resilience/backoff.d.ts +23 -0
- package/v3/@swarmdo/cli/dist/src/resilience/backoff.js +30 -0
- package/v3/@swarmdo/cli/dist/src/swarmvector/model-router.js +14 -0
- package/v3/@swarmdo/cli/dist/src/transcript/search.d.ts +39 -0
- package/v3/@swarmdo/cli/dist/src/transcript/search.js +67 -0
- package/v3/@swarmdo/cli/dist/src/usage/diff.d.ts +69 -0
- package/v3/@swarmdo/cli/dist/src/usage/diff.js +112 -0
- package/v3/@swarmdo/cli/package.json +4 -4
- 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 +4 -1
- 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/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 +8 -1
- package/v3/vendor/agentdb/package.json +0 -1
- package/v3/vendor/agentic-flow/package.json +0 -1
- package/.claude/scheduled_tasks.lock +0 -1
- package/.claude/skills/sdo-caveman-compress/scripts/__pycache__/__init__.cpython-314.pyc +0 -0
- package/.claude/skills/sdo-caveman-compress/scripts/__pycache__/__main__.cpython-314.pyc +0 -0
- package/.claude/skills/sdo-caveman-compress/scripts/__pycache__/cli.cpython-314.pyc +0 -0
- package/.claude/skills/sdo-caveman-compress/scripts/__pycache__/compress.cpython-314.pyc +0 -0
- package/.claude/skills/sdo-caveman-compress/scripts/__pycache__/detect.cpython-314.pyc +0 -0
- package/.claude/skills/sdo-caveman-compress/scripts/__pycache__/validate.cpython-314.pyc +0 -0
- package/v3/@swarmdo/plugin-iot-cognitum/dist/application/index.d.ts +0 -2
- package/v3/@swarmdo/plugin-iot-cognitum/dist/application/index.js +0 -2
- package/v3/@swarmdo/plugin-iot-cognitum/dist/application/iot-coordinator.d.ts +0 -138
- package/v3/@swarmdo/plugin-iot-cognitum/dist/application/iot-coordinator.js +0 -418
- package/v3/@swarmdo/plugin-iot-cognitum/dist/bin.d.ts +0 -15
- package/v3/@swarmdo/plugin-iot-cognitum/dist/bin.js +0 -240
- package/v3/@swarmdo/plugin-iot-cognitum/dist/cli-commands.d.ts +0 -7
- package/v3/@swarmdo/plugin-iot-cognitum/dist/cli-commands.js +0 -508
- package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/entities/device-agent.d.ts +0 -54
- package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/entities/device-agent.js +0 -2
- package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/entities/device-fleet.d.ts +0 -46
- package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/entities/device-fleet.js +0 -2
- package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/entities/device-trust-level.d.ts +0 -18
- package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/entities/device-trust-level.js +0 -28
- package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/entities/index.d.ts +0 -5
- package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/entities/index.js +0 -2
- package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/entities/telemetry.d.ts +0 -35
- package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/entities/telemetry.js +0 -2
- package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/repositories/device-repository.d.ts +0 -11
- package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/repositories/device-repository.js +0 -2
- package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/repositories/fleet-repository.d.ts +0 -9
- package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/repositories/fleet-repository.js +0 -2
- package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/repositories/index.d.ts +0 -5
- package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/repositories/index.js +0 -2
- package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/repositories/telemetry-repository.d.ts +0 -12
- package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/repositories/telemetry-repository.js +0 -2
- package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/repositories/trust-history-repository.d.ts +0 -19
- package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/repositories/trust-history-repository.js +0 -2
- package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/anomaly-detection-service.d.ts +0 -44
- package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/anomaly-detection-service.js +0 -117
- package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/device-lifecycle-service.d.ts +0 -70
- package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/device-lifecycle-service.js +0 -194
- package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/firmware-orchestration-service.d.ts +0 -69
- package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/firmware-orchestration-service.js +0 -139
- package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/fleet-topology-service.d.ts +0 -34
- package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/fleet-topology-service.js +0 -101
- package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/index.d.ts +0 -10
- package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/index.js +0 -10
- package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/mesh-service.d.ts +0 -64
- package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/mesh-service.js +0 -70
- package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/sona-integration-service.d.ts +0 -44
- package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/sona-integration-service.js +0 -79
- package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/telemetry-ingestion-service.d.ts +0 -37
- package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/telemetry-ingestion-service.js +0 -39
- package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/telemetry-service.d.ts +0 -67
- package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/telemetry-service.js +0 -58
- package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/witness-verification-service.d.ts +0 -45
- package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/witness-verification-service.js +0 -63
- package/v3/@swarmdo/plugin-iot-cognitum/dist/index.d.ts +0 -26
- package/v3/@swarmdo/plugin-iot-cognitum/dist/index.js +0 -17
- package/v3/@swarmdo/plugin-iot-cognitum/dist/infrastructure/agentdb-telemetry-repository.d.ts +0 -51
- package/v3/@swarmdo/plugin-iot-cognitum/dist/infrastructure/agentdb-telemetry-repository.js +0 -110
- package/v3/@swarmdo/plugin-iot-cognitum/dist/infrastructure/in-memory-device-repository.d.ts +0 -13
- package/v3/@swarmdo/plugin-iot-cognitum/dist/infrastructure/in-memory-device-repository.js +0 -25
- package/v3/@swarmdo/plugin-iot-cognitum/dist/infrastructure/in-memory-fleet-repository.d.ts +0 -11
- package/v3/@swarmdo/plugin-iot-cognitum/dist/infrastructure/in-memory-fleet-repository.js +0 -19
- package/v3/@swarmdo/plugin-iot-cognitum/dist/infrastructure/in-memory-trust-history-repository.d.ts +0 -11
- package/v3/@swarmdo/plugin-iot-cognitum/dist/infrastructure/in-memory-trust-history-repository.js +0 -27
- package/v3/@swarmdo/plugin-iot-cognitum/dist/infrastructure/index.d.ts +0 -6
- package/v3/@swarmdo/plugin-iot-cognitum/dist/infrastructure/index.js +0 -6
- package/v3/@swarmdo/plugin-iot-cognitum/dist/infrastructure/seed-client-factory.d.ts +0 -41
- package/v3/@swarmdo/plugin-iot-cognitum/dist/infrastructure/seed-client-factory.js +0 -64
- package/v3/@swarmdo/plugin-iot-cognitum/dist/mcp-tools.d.ts +0 -8
- package/v3/@swarmdo/plugin-iot-cognitum/dist/mcp-tools.js +0 -703
- package/v3/@swarmdo/plugin-iot-cognitum/dist/plugin.d.ts +0 -23
- package/v3/@swarmdo/plugin-iot-cognitum/dist/plugin.js +0 -239
- package/v3/@swarmdo/plugin-iot-cognitum/dist/workers/anomaly-scan-worker.d.ts +0 -17
- package/v3/@swarmdo/plugin-iot-cognitum/dist/workers/anomaly-scan-worker.js +0 -42
- package/v3/@swarmdo/plugin-iot-cognitum/dist/workers/firmware-watch-worker.d.ts +0 -18
- package/v3/@swarmdo/plugin-iot-cognitum/dist/workers/firmware-watch-worker.js +0 -45
- package/v3/@swarmdo/plugin-iot-cognitum/dist/workers/health-probe-worker.d.ts +0 -19
- package/v3/@swarmdo/plugin-iot-cognitum/dist/workers/health-probe-worker.js +0 -50
- package/v3/@swarmdo/plugin-iot-cognitum/dist/workers/mesh-sync-worker.d.ts +0 -19
- package/v3/@swarmdo/plugin-iot-cognitum/dist/workers/mesh-sync-worker.js +0 -47
- package/v3/@swarmdo/plugin-iot-cognitum/dist/workers/telemetry-ingest-worker.d.ts +0 -17
- package/v3/@swarmdo/plugin-iot-cognitum/dist/workers/telemetry-ingest-worker.js +0 -40
- package/v3/@swarmdo/plugin-iot-cognitum/dist/workers/witness-audit-worker.d.ts +0 -18
- package/v3/@swarmdo/plugin-iot-cognitum/dist/workers/witness-audit-worker.js +0 -51
- package/v3/@swarmdo/testing/dist/fixtures/agent-fixtures.d.ts +0 -214
- package/v3/@swarmdo/testing/dist/fixtures/agent-fixtures.js +0 -595
- package/v3/@swarmdo/testing/dist/fixtures/agents.d.ts +0 -76
- package/v3/@swarmdo/testing/dist/fixtures/agents.js +0 -158
- package/v3/@swarmdo/testing/dist/fixtures/configurations.d.ts +0 -157
- package/v3/@swarmdo/testing/dist/fixtures/configurations.js +0 -337
- package/v3/@swarmdo/testing/dist/fixtures/index.d.ts +0 -10
- package/v3/@swarmdo/testing/dist/fixtures/index.js +0 -17
- package/v3/@swarmdo/testing/dist/fixtures/mcp-fixtures.d.ts +0 -329
- package/v3/@swarmdo/testing/dist/fixtures/mcp-fixtures.js +0 -714
- package/v3/@swarmdo/testing/dist/fixtures/memory-entries.d.ts +0 -159
- package/v3/@swarmdo/testing/dist/fixtures/memory-entries.js +0 -262
- package/v3/@swarmdo/testing/dist/fixtures/memory-fixtures.d.ts +0 -290
- package/v3/@swarmdo/testing/dist/fixtures/memory-fixtures.js +0 -547
- package/v3/@swarmdo/testing/dist/fixtures/swarm-fixtures.d.ts +0 -289
- package/v3/@swarmdo/testing/dist/fixtures/swarm-fixtures.js +0 -534
- package/v3/@swarmdo/testing/dist/fixtures/tasks.d.ts +0 -106
- package/v3/@swarmdo/testing/dist/fixtures/tasks.js +0 -229
- package/v3/@swarmdo/testing/dist/helpers/assertion-helpers.d.ts +0 -213
- package/v3/@swarmdo/testing/dist/helpers/assertion-helpers.js +0 -435
- package/v3/@swarmdo/testing/dist/helpers/assertions.d.ts +0 -135
- package/v3/@swarmdo/testing/dist/helpers/assertions.js +0 -217
- package/v3/@swarmdo/testing/dist/helpers/create-mock.d.ts +0 -96
- package/v3/@swarmdo/testing/dist/helpers/create-mock.js +0 -164
- package/v3/@swarmdo/testing/dist/helpers/index.d.ts +0 -14
- package/v3/@swarmdo/testing/dist/helpers/index.js +0 -22
- package/v3/@swarmdo/testing/dist/helpers/mock-factory.d.ts +0 -323
- package/v3/@swarmdo/testing/dist/helpers/mock-factory.js +0 -350
- package/v3/@swarmdo/testing/dist/helpers/setup-teardown.d.ts +0 -271
- package/v3/@swarmdo/testing/dist/helpers/setup-teardown.js +0 -446
- package/v3/@swarmdo/testing/dist/helpers/swarm-instance.d.ts +0 -142
- package/v3/@swarmdo/testing/dist/helpers/swarm-instance.js +0 -205
- package/v3/@swarmdo/testing/dist/helpers/test-application.d.ts +0 -190
- package/v3/@swarmdo/testing/dist/helpers/test-application.js +0 -138
- package/v3/@swarmdo/testing/dist/helpers/test-utils.d.ts +0 -274
- package/v3/@swarmdo/testing/dist/helpers/test-utils.js +0 -456
- package/v3/@swarmdo/testing/dist/index.d.ts +0 -42
- package/v3/@swarmdo/testing/dist/index.js +0 -66
- package/v3/@swarmdo/testing/dist/mocks/index.d.ts +0 -8
- package/v3/@swarmdo/testing/dist/mocks/index.js +0 -10
- package/v3/@swarmdo/testing/dist/mocks/mock-mcp-client.d.ts +0 -206
- package/v3/@swarmdo/testing/dist/mocks/mock-mcp-client.js +0 -575
- package/v3/@swarmdo/testing/dist/mocks/mock-services.d.ts +0 -287
- package/v3/@swarmdo/testing/dist/mocks/mock-services.js +0 -563
- package/v3/@swarmdo/testing/dist/regression/api-contract.d.ts +0 -109
- package/v3/@swarmdo/testing/dist/regression/api-contract.js +0 -374
- package/v3/@swarmdo/testing/dist/regression/index.d.ts +0 -18
- package/v3/@swarmdo/testing/dist/regression/index.js +0 -18
- package/v3/@swarmdo/testing/dist/regression/integration-regression.d.ts +0 -67
- package/v3/@swarmdo/testing/dist/regression/integration-regression.js +0 -334
- package/v3/@swarmdo/testing/dist/regression/performance-baseline.d.ts +0 -106
- package/v3/@swarmdo/testing/dist/regression/performance-baseline.js +0 -268
- package/v3/@swarmdo/testing/dist/regression/regression-runner.d.ts +0 -124
- package/v3/@swarmdo/testing/dist/regression/regression-runner.js +0 -227
- package/v3/@swarmdo/testing/dist/regression/security-regression.d.ts +0 -73
- package/v3/@swarmdo/testing/dist/regression/security-regression.js +0 -258
- package/v3/@swarmdo/testing/dist/setup.d.ts +0 -43
- package/v3/@swarmdo/testing/dist/setup.js +0 -91
- package/v3/@swarmdo/testing/dist/v2-compat/api-compat.test.d.ts +0 -10
- package/v3/@swarmdo/testing/dist/v2-compat/api-compat.test.js +0 -433
- package/v3/@swarmdo/testing/dist/v2-compat/cli-compat.test.d.ts +0 -10
- package/v3/@swarmdo/testing/dist/v2-compat/cli-compat.test.js +0 -352
- package/v3/@swarmdo/testing/dist/v2-compat/compatibility-validator.d.ts +0 -206
- package/v3/@swarmdo/testing/dist/v2-compat/compatibility-validator.js +0 -839
- package/v3/@swarmdo/testing/dist/v2-compat/hooks-compat.test.d.ts +0 -10
- package/v3/@swarmdo/testing/dist/v2-compat/hooks-compat.test.js +0 -428
- package/v3/@swarmdo/testing/dist/v2-compat/index.d.ts +0 -38
- package/v3/@swarmdo/testing/dist/v2-compat/index.js +0 -41
- package/v3/@swarmdo/testing/dist/v2-compat/mcp-compat.test.d.ts +0 -10
- package/v3/@swarmdo/testing/dist/v2-compat/mcp-compat.test.js +0 -419
- package/v3/@swarmdo/testing/dist/v2-compat/report-generator.d.ts +0 -34
- package/v3/@swarmdo/testing/dist/v2-compat/report-generator.js +0 -372
|
@@ -1,142 +0,0 @@
|
|
|
1
|
-
import { type MockedInterface } from './create-mock.js';
|
|
2
|
-
/**
|
|
3
|
-
* Agent types for V3 15-agent swarm
|
|
4
|
-
*/
|
|
5
|
-
export type V3AgentType = 'queen-coordinator' | 'security-architect' | 'security-auditor' | 'memory-specialist' | 'swarm-specialist' | 'integration-architect' | 'performance-engineer' | 'core-architect' | 'test-architect' | 'project-coordinator' | 'coder' | 'reviewer' | 'tester' | 'planner' | 'researcher';
|
|
6
|
-
/**
|
|
7
|
-
* Swarm topology types
|
|
8
|
-
*/
|
|
9
|
-
export type SwarmTopology = 'hierarchical' | 'mesh' | 'adaptive' | 'hierarchical-mesh';
|
|
10
|
-
/**
|
|
11
|
-
* Agent interface for swarm testing
|
|
12
|
-
*/
|
|
13
|
-
export interface SwarmAgent {
|
|
14
|
-
id: string;
|
|
15
|
-
type: V3AgentType;
|
|
16
|
-
status: 'idle' | 'busy' | 'terminated';
|
|
17
|
-
capabilities: string[];
|
|
18
|
-
execute(task: SwarmTask): Promise<SwarmTaskResult>;
|
|
19
|
-
communicate(message: SwarmMessage): Promise<void>;
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Swarm message interface
|
|
23
|
-
*/
|
|
24
|
-
export interface SwarmMessage {
|
|
25
|
-
from: string;
|
|
26
|
-
to: string | 'broadcast';
|
|
27
|
-
type: 'task' | 'result' | 'status' | 'coordination';
|
|
28
|
-
payload: unknown;
|
|
29
|
-
timestamp: Date;
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* Swarm task interface
|
|
33
|
-
*/
|
|
34
|
-
export interface SwarmTask {
|
|
35
|
-
id: string;
|
|
36
|
-
type: string;
|
|
37
|
-
payload: unknown;
|
|
38
|
-
priority: number;
|
|
39
|
-
assignedTo?: string;
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* Swarm task result
|
|
43
|
-
*/
|
|
44
|
-
export interface SwarmTaskResult {
|
|
45
|
-
taskId: string;
|
|
46
|
-
agentId: string;
|
|
47
|
-
success: boolean;
|
|
48
|
-
output?: unknown;
|
|
49
|
-
error?: Error;
|
|
50
|
-
duration: number;
|
|
51
|
-
}
|
|
52
|
-
/**
|
|
53
|
-
* Swarm coordination result
|
|
54
|
-
*/
|
|
55
|
-
export interface SwarmCoordinationResult {
|
|
56
|
-
success: boolean;
|
|
57
|
-
completedTasks: number;
|
|
58
|
-
failedTasks: number;
|
|
59
|
-
totalDuration: number;
|
|
60
|
-
agentMetrics: Map<string, AgentMetrics>;
|
|
61
|
-
}
|
|
62
|
-
/**
|
|
63
|
-
* Agent metrics
|
|
64
|
-
*/
|
|
65
|
-
export interface AgentMetrics {
|
|
66
|
-
tasksCompleted: number;
|
|
67
|
-
tasksFailed: number;
|
|
68
|
-
averageTaskDuration: number;
|
|
69
|
-
totalDuration: number;
|
|
70
|
-
}
|
|
71
|
-
/**
|
|
72
|
-
* Create a test swarm instance with mocked agents
|
|
73
|
-
*/
|
|
74
|
-
export declare function createSwarmTestInstance(config?: {
|
|
75
|
-
topology?: SwarmTopology;
|
|
76
|
-
agentTypes?: V3AgentType[];
|
|
77
|
-
}): SwarmTestInstance;
|
|
78
|
-
/**
|
|
79
|
-
* Swarm test instance class
|
|
80
|
-
*/
|
|
81
|
-
export declare class SwarmTestInstance {
|
|
82
|
-
readonly topology: SwarmTopology;
|
|
83
|
-
private readonly agentTypes;
|
|
84
|
-
private agents;
|
|
85
|
-
private messages;
|
|
86
|
-
private taskResults;
|
|
87
|
-
private interactionRecorder;
|
|
88
|
-
private isInitialized;
|
|
89
|
-
constructor(topology: SwarmTopology, agentTypes: V3AgentType[]);
|
|
90
|
-
private initializeAgents;
|
|
91
|
-
private createMockAgent;
|
|
92
|
-
private getCapabilitiesForType;
|
|
93
|
-
/**
|
|
94
|
-
* Initialize the swarm
|
|
95
|
-
*/
|
|
96
|
-
initialize(): Promise<void>;
|
|
97
|
-
/**
|
|
98
|
-
* Get an agent by type
|
|
99
|
-
*/
|
|
100
|
-
getAgent(type: V3AgentType): MockedInterface<SwarmAgent> | undefined;
|
|
101
|
-
/**
|
|
102
|
-
* Get all agents
|
|
103
|
-
*/
|
|
104
|
-
getAllAgents(): MockedInterface<SwarmAgent>[];
|
|
105
|
-
/**
|
|
106
|
-
* Get agent by ID
|
|
107
|
-
*/
|
|
108
|
-
getAgentById(id: string): MockedInterface<SwarmAgent> | undefined;
|
|
109
|
-
/**
|
|
110
|
-
* Get all messages
|
|
111
|
-
*/
|
|
112
|
-
getMessages(): SwarmMessage[];
|
|
113
|
-
/**
|
|
114
|
-
* Get task results
|
|
115
|
-
*/
|
|
116
|
-
getTaskResults(): SwarmTaskResult[];
|
|
117
|
-
/**
|
|
118
|
-
* Get interaction order for behavior verification
|
|
119
|
-
*/
|
|
120
|
-
getInteractionOrder(): string[];
|
|
121
|
-
/**
|
|
122
|
-
* Get all interactions
|
|
123
|
-
*/
|
|
124
|
-
getInteractions(): Array<{
|
|
125
|
-
name: string;
|
|
126
|
-
method: string;
|
|
127
|
-
args: unknown[];
|
|
128
|
-
}>;
|
|
129
|
-
/**
|
|
130
|
-
* Coordinate a task across agents
|
|
131
|
-
*/
|
|
132
|
-
coordinate(task: SwarmTask): Promise<SwarmCoordinationResult>;
|
|
133
|
-
/**
|
|
134
|
-
* Shutdown the swarm
|
|
135
|
-
*/
|
|
136
|
-
shutdown(): Promise<void>;
|
|
137
|
-
/**
|
|
138
|
-
* Reset the swarm state
|
|
139
|
-
*/
|
|
140
|
-
reset(): void;
|
|
141
|
-
}
|
|
142
|
-
//# sourceMappingURL=swarm-instance.d.ts.map
|
|
@@ -1,205 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* V3 Swarmdo Swarm Test Instance
|
|
3
|
-
*
|
|
4
|
-
* Creates isolated swarm instances for testing
|
|
5
|
-
* Supports 15-agent V3 swarm topology testing
|
|
6
|
-
*/
|
|
7
|
-
import { vi } from 'vitest';
|
|
8
|
-
import { createMock, InteractionRecorder } from './create-mock.js';
|
|
9
|
-
/**
|
|
10
|
-
* Create a test swarm instance with mocked agents
|
|
11
|
-
*/
|
|
12
|
-
export function createSwarmTestInstance(config) {
|
|
13
|
-
const topology = config?.topology ?? 'hierarchical-mesh';
|
|
14
|
-
const agentTypes = config?.agentTypes ?? [
|
|
15
|
-
'queen-coordinator',
|
|
16
|
-
'security-architect',
|
|
17
|
-
'security-auditor',
|
|
18
|
-
'memory-specialist',
|
|
19
|
-
'swarm-specialist',
|
|
20
|
-
];
|
|
21
|
-
return new SwarmTestInstance(topology, agentTypes);
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Swarm test instance class
|
|
25
|
-
*/
|
|
26
|
-
export class SwarmTestInstance {
|
|
27
|
-
topology;
|
|
28
|
-
agentTypes;
|
|
29
|
-
agents = new Map();
|
|
30
|
-
messages = [];
|
|
31
|
-
taskResults = [];
|
|
32
|
-
interactionRecorder;
|
|
33
|
-
isInitialized = false;
|
|
34
|
-
constructor(topology, agentTypes) {
|
|
35
|
-
this.topology = topology;
|
|
36
|
-
this.agentTypes = agentTypes;
|
|
37
|
-
this.interactionRecorder = new InteractionRecorder();
|
|
38
|
-
this.initializeAgents();
|
|
39
|
-
}
|
|
40
|
-
initializeAgents() {
|
|
41
|
-
for (const type of this.agentTypes) {
|
|
42
|
-
const id = `${type}-${Date.now()}-${Math.random().toString(36).slice(2, 7)}`;
|
|
43
|
-
const agent = this.createMockAgent(id, type);
|
|
44
|
-
this.agents.set(id, agent);
|
|
45
|
-
this.interactionRecorder.track(id, agent);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
createMockAgent(id, type) {
|
|
49
|
-
const mock = createMock();
|
|
50
|
-
// Set default properties
|
|
51
|
-
Object.defineProperty(mock, 'id', { value: id, writable: false });
|
|
52
|
-
Object.defineProperty(mock, 'type', { value: type, writable: false });
|
|
53
|
-
Object.defineProperty(mock, 'status', { value: 'idle', writable: true });
|
|
54
|
-
Object.defineProperty(mock, 'capabilities', {
|
|
55
|
-
value: this.getCapabilitiesForType(type),
|
|
56
|
-
writable: false
|
|
57
|
-
});
|
|
58
|
-
// Configure default behavior
|
|
59
|
-
mock.execute.mockImplementation(async (task) => {
|
|
60
|
-
const result = {
|
|
61
|
-
taskId: task.id,
|
|
62
|
-
agentId: id,
|
|
63
|
-
success: true,
|
|
64
|
-
duration: Math.random() * 100 + 10,
|
|
65
|
-
};
|
|
66
|
-
this.taskResults.push(result);
|
|
67
|
-
return result;
|
|
68
|
-
});
|
|
69
|
-
mock.communicate.mockImplementation(async (message) => {
|
|
70
|
-
this.messages.push(message);
|
|
71
|
-
});
|
|
72
|
-
return mock;
|
|
73
|
-
}
|
|
74
|
-
getCapabilitiesForType(type) {
|
|
75
|
-
const capabilities = {
|
|
76
|
-
'queen-coordinator': ['orchestration', 'task-distribution', 'agent-management'],
|
|
77
|
-
'security-architect': ['security-design', 'threat-modeling', 'security-review'],
|
|
78
|
-
'security-auditor': ['cve-detection', 'vulnerability-scanning', 'security-testing'],
|
|
79
|
-
'memory-specialist': ['memory-optimization', 'agentdb-integration', 'caching'],
|
|
80
|
-
'swarm-specialist': ['coordination', 'consensus', 'communication'],
|
|
81
|
-
'integration-architect': ['api-design', 'system-integration', 'compatibility'],
|
|
82
|
-
'performance-engineer': ['optimization', 'benchmarking', 'profiling'],
|
|
83
|
-
'core-architect': ['ddd-design', 'architecture', 'domain-modeling'],
|
|
84
|
-
'test-architect': ['tdd', 'test-design', 'quality-assurance'],
|
|
85
|
-
'project-coordinator': ['project-management', 'scheduling', 'reporting'],
|
|
86
|
-
'coder': ['coding', 'implementation', 'debugging'],
|
|
87
|
-
'reviewer': ['code-review', 'quality-check', 'suggestions'],
|
|
88
|
-
'tester': ['testing', 'test-execution', 'coverage'],
|
|
89
|
-
'planner': ['planning', 'estimation', 'roadmap'],
|
|
90
|
-
'researcher': ['research', 'analysis', 'documentation'],
|
|
91
|
-
};
|
|
92
|
-
return capabilities[type];
|
|
93
|
-
}
|
|
94
|
-
/**
|
|
95
|
-
* Initialize the swarm
|
|
96
|
-
*/
|
|
97
|
-
async initialize() {
|
|
98
|
-
this.isInitialized = true;
|
|
99
|
-
// Simulate initialization delay
|
|
100
|
-
await new Promise(resolve => setTimeout(resolve, 1));
|
|
101
|
-
}
|
|
102
|
-
/**
|
|
103
|
-
* Get an agent by type
|
|
104
|
-
*/
|
|
105
|
-
getAgent(type) {
|
|
106
|
-
for (const [_, agent] of this.agents) {
|
|
107
|
-
if (agent.type === type) {
|
|
108
|
-
return agent;
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
return undefined;
|
|
112
|
-
}
|
|
113
|
-
/**
|
|
114
|
-
* Get all agents
|
|
115
|
-
*/
|
|
116
|
-
getAllAgents() {
|
|
117
|
-
return Array.from(this.agents.values());
|
|
118
|
-
}
|
|
119
|
-
/**
|
|
120
|
-
* Get agent by ID
|
|
121
|
-
*/
|
|
122
|
-
getAgentById(id) {
|
|
123
|
-
return this.agents.get(id);
|
|
124
|
-
}
|
|
125
|
-
/**
|
|
126
|
-
* Get all messages
|
|
127
|
-
*/
|
|
128
|
-
getMessages() {
|
|
129
|
-
return [...this.messages];
|
|
130
|
-
}
|
|
131
|
-
/**
|
|
132
|
-
* Get task results
|
|
133
|
-
*/
|
|
134
|
-
getTaskResults() {
|
|
135
|
-
return [...this.taskResults];
|
|
136
|
-
}
|
|
137
|
-
/**
|
|
138
|
-
* Get interaction order for behavior verification
|
|
139
|
-
*/
|
|
140
|
-
getInteractionOrder() {
|
|
141
|
-
return this.interactionRecorder.getInteractionOrder();
|
|
142
|
-
}
|
|
143
|
-
/**
|
|
144
|
-
* Get all interactions
|
|
145
|
-
*/
|
|
146
|
-
getInteractions() {
|
|
147
|
-
return this.interactionRecorder.getInteractions();
|
|
148
|
-
}
|
|
149
|
-
/**
|
|
150
|
-
* Coordinate a task across agents
|
|
151
|
-
*/
|
|
152
|
-
async coordinate(task) {
|
|
153
|
-
if (!this.isInitialized) {
|
|
154
|
-
throw new Error('Swarm not initialized');
|
|
155
|
-
}
|
|
156
|
-
const startTime = Date.now();
|
|
157
|
-
const results = [];
|
|
158
|
-
// Simulate coordination based on topology
|
|
159
|
-
const queen = this.getAgent('queen-coordinator');
|
|
160
|
-
if (queen && this.topology.includes('hierarchical')) {
|
|
161
|
-
await queen.communicate({
|
|
162
|
-
from: 'coordinator',
|
|
163
|
-
to: 'broadcast',
|
|
164
|
-
type: 'task',
|
|
165
|
-
payload: task,
|
|
166
|
-
timestamp: new Date(),
|
|
167
|
-
});
|
|
168
|
-
}
|
|
169
|
-
// Execute task on appropriate agent
|
|
170
|
-
for (const agent of this.agents.values()) {
|
|
171
|
-
const result = await agent.execute(task);
|
|
172
|
-
results.push(result);
|
|
173
|
-
}
|
|
174
|
-
const completedTasks = results.filter(r => r.success).length;
|
|
175
|
-
const failedTasks = results.filter(r => !r.success).length;
|
|
176
|
-
return {
|
|
177
|
-
success: failedTasks === 0,
|
|
178
|
-
completedTasks,
|
|
179
|
-
failedTasks,
|
|
180
|
-
totalDuration: Date.now() - startTime,
|
|
181
|
-
agentMetrics: new Map(),
|
|
182
|
-
};
|
|
183
|
-
}
|
|
184
|
-
/**
|
|
185
|
-
* Shutdown the swarm
|
|
186
|
-
*/
|
|
187
|
-
async shutdown() {
|
|
188
|
-
for (const agent of this.agents.values()) {
|
|
189
|
-
Object.defineProperty(agent, 'status', { value: 'terminated', writable: true });
|
|
190
|
-
}
|
|
191
|
-
this.isInitialized = false;
|
|
192
|
-
}
|
|
193
|
-
/**
|
|
194
|
-
* Reset the swarm state
|
|
195
|
-
*/
|
|
196
|
-
reset() {
|
|
197
|
-
this.messages = [];
|
|
198
|
-
this.taskResults = [];
|
|
199
|
-
this.interactionRecorder.clear();
|
|
200
|
-
for (const agent of this.agents.values()) {
|
|
201
|
-
vi.clearAllMocks();
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
//# sourceMappingURL=swarm-instance.js.map
|
|
@@ -1,190 +0,0 @@
|
|
|
1
|
-
import { type MockedInterface } from './create-mock.js';
|
|
2
|
-
/**
|
|
3
|
-
* Core domain interfaces for testing
|
|
4
|
-
*/
|
|
5
|
-
export interface IEventBus {
|
|
6
|
-
publish(event: DomainEvent): Promise<void>;
|
|
7
|
-
subscribe(eventType: string, handler: EventHandler): void;
|
|
8
|
-
unsubscribe(eventType: string, handler: EventHandler): void;
|
|
9
|
-
}
|
|
10
|
-
export interface ITaskManager {
|
|
11
|
-
create(task: TaskDefinition): Promise<Task>;
|
|
12
|
-
execute(taskId: string): Promise<TaskResult>;
|
|
13
|
-
cancel(taskId: string): Promise<void>;
|
|
14
|
-
getStatus(taskId: string): Promise<TaskStatus>;
|
|
15
|
-
}
|
|
16
|
-
export interface IAgentLifecycle {
|
|
17
|
-
spawn(config: AgentConfig): Promise<Agent>;
|
|
18
|
-
terminate(agentId: string): Promise<void>;
|
|
19
|
-
getAgent(agentId: string): Promise<Agent | null>;
|
|
20
|
-
listAgents(): Promise<Agent[]>;
|
|
21
|
-
}
|
|
22
|
-
export interface IMemoryService {
|
|
23
|
-
store(key: string, value: unknown, metadata?: MemoryMetadata): Promise<void>;
|
|
24
|
-
retrieve(key: string): Promise<unknown>;
|
|
25
|
-
search(query: VectorQuery): Promise<SearchResult[]>;
|
|
26
|
-
delete(key: string): Promise<void>;
|
|
27
|
-
}
|
|
28
|
-
export interface ISecurityService {
|
|
29
|
-
validatePath(path: string): boolean;
|
|
30
|
-
hashPassword(password: string): Promise<string>;
|
|
31
|
-
verifyPassword(password: string, hash: string): Promise<boolean>;
|
|
32
|
-
executeSecurely(command: string, options?: ExecuteOptions): Promise<ExecuteResult>;
|
|
33
|
-
}
|
|
34
|
-
export interface ISwarmCoordinator {
|
|
35
|
-
initialize(config: SwarmConfig): Promise<void>;
|
|
36
|
-
coordinate(agents: Agent[], task: Task): Promise<CoordinationResult>;
|
|
37
|
-
shutdown(): Promise<void>;
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* Type definitions for domain objects
|
|
41
|
-
*/
|
|
42
|
-
export interface DomainEvent {
|
|
43
|
-
type: string;
|
|
44
|
-
payload: unknown;
|
|
45
|
-
timestamp: Date;
|
|
46
|
-
correlationId?: string;
|
|
47
|
-
}
|
|
48
|
-
export type EventHandler = (event: DomainEvent) => Promise<void>;
|
|
49
|
-
export interface TaskDefinition {
|
|
50
|
-
name: string;
|
|
51
|
-
type: string;
|
|
52
|
-
payload: unknown;
|
|
53
|
-
priority?: number;
|
|
54
|
-
}
|
|
55
|
-
export interface Task {
|
|
56
|
-
id: string;
|
|
57
|
-
name: string;
|
|
58
|
-
type: string;
|
|
59
|
-
status: TaskStatus;
|
|
60
|
-
payload: unknown;
|
|
61
|
-
createdAt: Date;
|
|
62
|
-
}
|
|
63
|
-
export type TaskStatus = 'pending' | 'running' | 'completed' | 'failed' | 'cancelled';
|
|
64
|
-
export interface TaskResult {
|
|
65
|
-
taskId: string;
|
|
66
|
-
success: boolean;
|
|
67
|
-
output?: unknown;
|
|
68
|
-
error?: Error;
|
|
69
|
-
duration: number;
|
|
70
|
-
}
|
|
71
|
-
export interface AgentConfig {
|
|
72
|
-
type: string;
|
|
73
|
-
name: string;
|
|
74
|
-
capabilities: string[];
|
|
75
|
-
}
|
|
76
|
-
export interface Agent {
|
|
77
|
-
id: string;
|
|
78
|
-
type: string;
|
|
79
|
-
name: string;
|
|
80
|
-
status: 'idle' | 'busy' | 'terminated';
|
|
81
|
-
}
|
|
82
|
-
export interface MemoryMetadata {
|
|
83
|
-
ttl?: number;
|
|
84
|
-
tags?: string[];
|
|
85
|
-
embedding?: number[];
|
|
86
|
-
}
|
|
87
|
-
export interface VectorQuery {
|
|
88
|
-
embedding: number[];
|
|
89
|
-
topK: number;
|
|
90
|
-
threshold?: number;
|
|
91
|
-
}
|
|
92
|
-
export interface SearchResult {
|
|
93
|
-
key: string;
|
|
94
|
-
value: unknown;
|
|
95
|
-
score: number;
|
|
96
|
-
}
|
|
97
|
-
export interface ExecuteOptions {
|
|
98
|
-
timeout?: number;
|
|
99
|
-
cwd?: string;
|
|
100
|
-
shell?: boolean;
|
|
101
|
-
}
|
|
102
|
-
export interface ExecuteResult {
|
|
103
|
-
stdout: string;
|
|
104
|
-
stderr: string;
|
|
105
|
-
exitCode: number;
|
|
106
|
-
}
|
|
107
|
-
export interface SwarmConfig {
|
|
108
|
-
topology: 'hierarchical' | 'mesh' | 'adaptive';
|
|
109
|
-
maxAgents: number;
|
|
110
|
-
}
|
|
111
|
-
export interface CoordinationResult {
|
|
112
|
-
success: boolean;
|
|
113
|
-
results: TaskResult[];
|
|
114
|
-
duration: number;
|
|
115
|
-
}
|
|
116
|
-
/**
|
|
117
|
-
* Test application builder with full dependency injection
|
|
118
|
-
*
|
|
119
|
-
* @example
|
|
120
|
-
* const app = createTestApplication()
|
|
121
|
-
* .withMockEventBus()
|
|
122
|
-
* .withMockTaskManager()
|
|
123
|
-
* .build();
|
|
124
|
-
*
|
|
125
|
-
* await app.services.taskManager.create(task);
|
|
126
|
-
* expect(app.mocks.eventBus.publish).toHaveBeenCalled();
|
|
127
|
-
*/
|
|
128
|
-
export declare function createTestApplication(): TestApplicationBuilder;
|
|
129
|
-
/**
|
|
130
|
-
* Test application structure with mocked services
|
|
131
|
-
*/
|
|
132
|
-
export interface TestApplication {
|
|
133
|
-
services: {
|
|
134
|
-
eventBus: IEventBus;
|
|
135
|
-
taskManager: ITaskManager;
|
|
136
|
-
agentLifecycle: IAgentLifecycle;
|
|
137
|
-
memoryService: IMemoryService;
|
|
138
|
-
securityService: ISecurityService;
|
|
139
|
-
swarmCoordinator: ISwarmCoordinator;
|
|
140
|
-
};
|
|
141
|
-
mocks: {
|
|
142
|
-
eventBus: MockedInterface<IEventBus>;
|
|
143
|
-
taskManager: MockedInterface<ITaskManager>;
|
|
144
|
-
agentLifecycle: MockedInterface<IAgentLifecycle>;
|
|
145
|
-
memoryService: MockedInterface<IMemoryService>;
|
|
146
|
-
securityService: MockedInterface<ISecurityService>;
|
|
147
|
-
swarmCoordinator: MockedInterface<ISwarmCoordinator>;
|
|
148
|
-
};
|
|
149
|
-
}
|
|
150
|
-
/**
|
|
151
|
-
* Builder class for constructing test applications
|
|
152
|
-
*/
|
|
153
|
-
declare class TestApplicationBuilder {
|
|
154
|
-
private eventBus;
|
|
155
|
-
private taskManager;
|
|
156
|
-
private agentLifecycle;
|
|
157
|
-
private memoryService;
|
|
158
|
-
private securityService;
|
|
159
|
-
private swarmCoordinator;
|
|
160
|
-
/**
|
|
161
|
-
* Configure mock event bus with default behavior
|
|
162
|
-
*/
|
|
163
|
-
withMockEventBus(configure?: (mock: MockedInterface<IEventBus>) => void): this;
|
|
164
|
-
/**
|
|
165
|
-
* Configure mock task manager with default behavior
|
|
166
|
-
*/
|
|
167
|
-
withMockTaskManager(configure?: (mock: MockedInterface<ITaskManager>) => void): this;
|
|
168
|
-
/**
|
|
169
|
-
* Configure mock agent lifecycle with default behavior
|
|
170
|
-
*/
|
|
171
|
-
withMockAgentLifecycle(configure?: (mock: MockedInterface<IAgentLifecycle>) => void): this;
|
|
172
|
-
/**
|
|
173
|
-
* Configure mock memory service with default behavior
|
|
174
|
-
*/
|
|
175
|
-
withMockMemoryService(configure?: (mock: MockedInterface<IMemoryService>) => void): this;
|
|
176
|
-
/**
|
|
177
|
-
* Configure mock security service with default behavior
|
|
178
|
-
*/
|
|
179
|
-
withMockSecurityService(configure?: (mock: MockedInterface<ISecurityService>) => void): this;
|
|
180
|
-
/**
|
|
181
|
-
* Configure mock swarm coordinator with default behavior
|
|
182
|
-
*/
|
|
183
|
-
withMockSwarmCoordinator(configure?: (mock: MockedInterface<ISwarmCoordinator>) => void): this;
|
|
184
|
-
/**
|
|
185
|
-
* Build the test application with all configured mocks
|
|
186
|
-
*/
|
|
187
|
-
build(): TestApplication;
|
|
188
|
-
}
|
|
189
|
-
export {};
|
|
190
|
-
//# sourceMappingURL=test-application.d.ts.map
|
|
@@ -1,138 +0,0 @@
|
|
|
1
|
-
import { createMock } from './create-mock.js';
|
|
2
|
-
/**
|
|
3
|
-
* Test application builder with full dependency injection
|
|
4
|
-
*
|
|
5
|
-
* @example
|
|
6
|
-
* const app = createTestApplication()
|
|
7
|
-
* .withMockEventBus()
|
|
8
|
-
* .withMockTaskManager()
|
|
9
|
-
* .build();
|
|
10
|
-
*
|
|
11
|
-
* await app.services.taskManager.create(task);
|
|
12
|
-
* expect(app.mocks.eventBus.publish).toHaveBeenCalled();
|
|
13
|
-
*/
|
|
14
|
-
export function createTestApplication() {
|
|
15
|
-
return new TestApplicationBuilder();
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* Builder class for constructing test applications
|
|
19
|
-
*/
|
|
20
|
-
class TestApplicationBuilder {
|
|
21
|
-
eventBus = createMock();
|
|
22
|
-
taskManager = createMock();
|
|
23
|
-
agentLifecycle = createMock();
|
|
24
|
-
memoryService = createMock();
|
|
25
|
-
securityService = createMock();
|
|
26
|
-
swarmCoordinator = createMock();
|
|
27
|
-
/**
|
|
28
|
-
* Configure mock event bus with default behavior
|
|
29
|
-
*/
|
|
30
|
-
withMockEventBus(configure) {
|
|
31
|
-
this.eventBus = createMock();
|
|
32
|
-
this.eventBus.publish.mockResolvedValue(undefined);
|
|
33
|
-
configure?.(this.eventBus);
|
|
34
|
-
return this;
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* Configure mock task manager with default behavior
|
|
38
|
-
*/
|
|
39
|
-
withMockTaskManager(configure) {
|
|
40
|
-
this.taskManager = createMock();
|
|
41
|
-
this.taskManager.create.mockImplementation(async (def) => ({
|
|
42
|
-
id: `task-${Date.now()}`,
|
|
43
|
-
name: def.name,
|
|
44
|
-
type: def.type,
|
|
45
|
-
status: 'pending',
|
|
46
|
-
payload: def.payload,
|
|
47
|
-
createdAt: new Date(),
|
|
48
|
-
}));
|
|
49
|
-
this.taskManager.execute.mockResolvedValue({
|
|
50
|
-
taskId: 'test-task',
|
|
51
|
-
success: true,
|
|
52
|
-
duration: 100,
|
|
53
|
-
});
|
|
54
|
-
configure?.(this.taskManager);
|
|
55
|
-
return this;
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* Configure mock agent lifecycle with default behavior
|
|
59
|
-
*/
|
|
60
|
-
withMockAgentLifecycle(configure) {
|
|
61
|
-
this.agentLifecycle = createMock();
|
|
62
|
-
this.agentLifecycle.spawn.mockImplementation(async (config) => ({
|
|
63
|
-
id: `agent-${Date.now()}`,
|
|
64
|
-
type: config.type,
|
|
65
|
-
name: config.name,
|
|
66
|
-
status: 'idle',
|
|
67
|
-
}));
|
|
68
|
-
this.agentLifecycle.listAgents.mockResolvedValue([]);
|
|
69
|
-
configure?.(this.agentLifecycle);
|
|
70
|
-
return this;
|
|
71
|
-
}
|
|
72
|
-
/**
|
|
73
|
-
* Configure mock memory service with default behavior
|
|
74
|
-
*/
|
|
75
|
-
withMockMemoryService(configure) {
|
|
76
|
-
this.memoryService = createMock();
|
|
77
|
-
this.memoryService.store.mockResolvedValue(undefined);
|
|
78
|
-
this.memoryService.retrieve.mockResolvedValue(null);
|
|
79
|
-
this.memoryService.search.mockResolvedValue([]);
|
|
80
|
-
configure?.(this.memoryService);
|
|
81
|
-
return this;
|
|
82
|
-
}
|
|
83
|
-
/**
|
|
84
|
-
* Configure mock security service with default behavior
|
|
85
|
-
*/
|
|
86
|
-
withMockSecurityService(configure) {
|
|
87
|
-
this.securityService = createMock();
|
|
88
|
-
this.securityService.validatePath.mockReturnValue(true);
|
|
89
|
-
this.securityService.hashPassword.mockResolvedValue('hashed');
|
|
90
|
-
this.securityService.verifyPassword.mockResolvedValue(true);
|
|
91
|
-
this.securityService.executeSecurely.mockResolvedValue({
|
|
92
|
-
stdout: '',
|
|
93
|
-
stderr: '',
|
|
94
|
-
exitCode: 0,
|
|
95
|
-
});
|
|
96
|
-
configure?.(this.securityService);
|
|
97
|
-
return this;
|
|
98
|
-
}
|
|
99
|
-
/**
|
|
100
|
-
* Configure mock swarm coordinator with default behavior
|
|
101
|
-
*/
|
|
102
|
-
withMockSwarmCoordinator(configure) {
|
|
103
|
-
this.swarmCoordinator = createMock();
|
|
104
|
-
this.swarmCoordinator.initialize.mockResolvedValue(undefined);
|
|
105
|
-
this.swarmCoordinator.coordinate.mockResolvedValue({
|
|
106
|
-
success: true,
|
|
107
|
-
results: [],
|
|
108
|
-
duration: 0,
|
|
109
|
-
});
|
|
110
|
-
this.swarmCoordinator.shutdown.mockResolvedValue(undefined);
|
|
111
|
-
configure?.(this.swarmCoordinator);
|
|
112
|
-
return this;
|
|
113
|
-
}
|
|
114
|
-
/**
|
|
115
|
-
* Build the test application with all configured mocks
|
|
116
|
-
*/
|
|
117
|
-
build() {
|
|
118
|
-
return {
|
|
119
|
-
services: {
|
|
120
|
-
eventBus: this.eventBus,
|
|
121
|
-
taskManager: this.taskManager,
|
|
122
|
-
agentLifecycle: this.agentLifecycle,
|
|
123
|
-
memoryService: this.memoryService,
|
|
124
|
-
securityService: this.securityService,
|
|
125
|
-
swarmCoordinator: this.swarmCoordinator,
|
|
126
|
-
},
|
|
127
|
-
mocks: {
|
|
128
|
-
eventBus: this.eventBus,
|
|
129
|
-
taskManager: this.taskManager,
|
|
130
|
-
agentLifecycle: this.agentLifecycle,
|
|
131
|
-
memoryService: this.memoryService,
|
|
132
|
-
securityService: this.securityService,
|
|
133
|
-
swarmCoordinator: this.swarmCoordinator,
|
|
134
|
-
},
|
|
135
|
-
};
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
//# sourceMappingURL=test-application.js.map
|