@sparkleideas/testing 3.0.0-alpha.10
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/README.md +547 -0
- package/__tests__/framework.test.ts +21 -0
- package/package.json +61 -0
- package/src/fixtures/agent-fixtures.ts +793 -0
- package/src/fixtures/agents.ts +212 -0
- package/src/fixtures/configurations.ts +491 -0
- package/src/fixtures/index.ts +21 -0
- package/src/fixtures/mcp-fixtures.ts +1030 -0
- package/src/fixtures/memory-entries.ts +328 -0
- package/src/fixtures/memory-fixtures.ts +750 -0
- package/src/fixtures/swarm-fixtures.ts +837 -0
- package/src/fixtures/tasks.ts +309 -0
- package/src/helpers/assertion-helpers.ts +616 -0
- package/src/helpers/assertions.ts +286 -0
- package/src/helpers/create-mock.ts +200 -0
- package/src/helpers/index.ts +182 -0
- package/src/helpers/mock-factory.ts +711 -0
- package/src/helpers/setup-teardown.ts +678 -0
- package/src/helpers/swarm-instance.ts +326 -0
- package/src/helpers/test-application.ts +310 -0
- package/src/helpers/test-utils.ts +670 -0
- package/src/index.ts +232 -0
- package/src/mocks/index.ts +29 -0
- package/src/mocks/mock-mcp-client.ts +723 -0
- package/src/mocks/mock-services.ts +793 -0
- package/src/regression/api-contract.ts +473 -0
- package/src/regression/index.ts +46 -0
- package/src/regression/integration-regression.ts +416 -0
- package/src/regression/performance-baseline.ts +356 -0
- package/src/regression/regression-runner.ts +339 -0
- package/src/regression/security-regression.ts +331 -0
- package/src/setup.ts +127 -0
- package/src/v2-compat/api-compat.test.ts +590 -0
- package/src/v2-compat/cli-compat.test.ts +484 -0
- package/src/v2-compat/compatibility-validator.ts +1072 -0
- package/src/v2-compat/hooks-compat.test.ts +602 -0
- package/src/v2-compat/index.ts +58 -0
- package/src/v2-compat/mcp-compat.test.ts +557 -0
- package/src/v2-compat/report-generator.ts +441 -0
- package/tmp.json +0 -0
- package/tsconfig.json +20 -0
- package/vitest.config.ts +12 -0
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* V3 Claude-Flow Agent Fixtures
|
|
3
|
+
*
|
|
4
|
+
* Test data for agent-related testing
|
|
5
|
+
* Following London School principle of explicit test data
|
|
6
|
+
*/
|
|
7
|
+
import type { V3AgentType } from '../helpers/swarm-instance.js';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Agent configuration fixtures
|
|
11
|
+
*/
|
|
12
|
+
export interface AgentConfig {
|
|
13
|
+
type: V3AgentType;
|
|
14
|
+
name: string;
|
|
15
|
+
capabilities: string[];
|
|
16
|
+
priority?: number;
|
|
17
|
+
metadata?: Record<string, unknown>;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Agent instance fixtures
|
|
22
|
+
*/
|
|
23
|
+
export interface AgentInstance {
|
|
24
|
+
id: string;
|
|
25
|
+
type: V3AgentType;
|
|
26
|
+
name: string;
|
|
27
|
+
status: 'idle' | 'busy' | 'terminated';
|
|
28
|
+
capabilities: string[];
|
|
29
|
+
createdAt: Date;
|
|
30
|
+
lastActiveAt?: Date;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Pre-defined agent configurations for testing
|
|
35
|
+
*/
|
|
36
|
+
export const agentConfigs: Record<string, AgentConfig> = {
|
|
37
|
+
queenCoordinator: {
|
|
38
|
+
type: 'queen-coordinator',
|
|
39
|
+
name: 'Queen Alpha',
|
|
40
|
+
capabilities: ['orchestration', 'task-distribution', 'agent-management'],
|
|
41
|
+
priority: 100,
|
|
42
|
+
metadata: { isLeader: true },
|
|
43
|
+
},
|
|
44
|
+
|
|
45
|
+
securityArchitect: {
|
|
46
|
+
type: 'security-architect',
|
|
47
|
+
name: 'Security Architect',
|
|
48
|
+
capabilities: ['security-design', 'threat-modeling', 'security-review'],
|
|
49
|
+
priority: 90,
|
|
50
|
+
metadata: { specialization: 'cve-prevention' },
|
|
51
|
+
},
|
|
52
|
+
|
|
53
|
+
securityAuditor: {
|
|
54
|
+
type: 'security-auditor',
|
|
55
|
+
name: 'Security Auditor',
|
|
56
|
+
capabilities: ['cve-detection', 'vulnerability-scanning', 'security-testing'],
|
|
57
|
+
priority: 90,
|
|
58
|
+
metadata: { specialization: 'penetration-testing' },
|
|
59
|
+
},
|
|
60
|
+
|
|
61
|
+
memorySpecialist: {
|
|
62
|
+
type: 'memory-specialist',
|
|
63
|
+
name: 'Memory Specialist',
|
|
64
|
+
capabilities: ['memory-optimization', 'agentdb-integration', 'caching'],
|
|
65
|
+
priority: 80,
|
|
66
|
+
metadata: { backend: 'agentdb' },
|
|
67
|
+
},
|
|
68
|
+
|
|
69
|
+
swarmSpecialist: {
|
|
70
|
+
type: 'swarm-specialist',
|
|
71
|
+
name: 'Swarm Specialist',
|
|
72
|
+
capabilities: ['coordination', 'consensus', 'communication'],
|
|
73
|
+
priority: 85,
|
|
74
|
+
metadata: { topology: 'hierarchical-mesh' },
|
|
75
|
+
},
|
|
76
|
+
|
|
77
|
+
coder: {
|
|
78
|
+
type: 'coder',
|
|
79
|
+
name: 'Coder Agent',
|
|
80
|
+
capabilities: ['coding', 'implementation', 'debugging'],
|
|
81
|
+
priority: 70,
|
|
82
|
+
},
|
|
83
|
+
|
|
84
|
+
tester: {
|
|
85
|
+
type: 'tester',
|
|
86
|
+
name: 'Tester Agent',
|
|
87
|
+
capabilities: ['testing', 'test-execution', 'coverage'],
|
|
88
|
+
priority: 70,
|
|
89
|
+
},
|
|
90
|
+
|
|
91
|
+
reviewer: {
|
|
92
|
+
type: 'reviewer',
|
|
93
|
+
name: 'Reviewer Agent',
|
|
94
|
+
capabilities: ['code-review', 'quality-check', 'suggestions'],
|
|
95
|
+
priority: 75,
|
|
96
|
+
},
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Pre-defined agent instances for testing
|
|
101
|
+
*/
|
|
102
|
+
export const agentInstances: Record<string, AgentInstance> = {
|
|
103
|
+
idleQueen: {
|
|
104
|
+
id: 'agent-queen-001',
|
|
105
|
+
type: 'queen-coordinator',
|
|
106
|
+
name: 'Queen Alpha',
|
|
107
|
+
status: 'idle',
|
|
108
|
+
capabilities: ['orchestration', 'task-distribution', 'agent-management'],
|
|
109
|
+
createdAt: new Date('2024-01-01T00:00:00Z'),
|
|
110
|
+
},
|
|
111
|
+
|
|
112
|
+
busySecurityArchitect: {
|
|
113
|
+
id: 'agent-security-001',
|
|
114
|
+
type: 'security-architect',
|
|
115
|
+
name: 'Security Architect',
|
|
116
|
+
status: 'busy',
|
|
117
|
+
capabilities: ['security-design', 'threat-modeling', 'security-review'],
|
|
118
|
+
createdAt: new Date('2024-01-01T00:00:00Z'),
|
|
119
|
+
lastActiveAt: new Date('2024-01-15T12:00:00Z'),
|
|
120
|
+
},
|
|
121
|
+
|
|
122
|
+
terminatedCoder: {
|
|
123
|
+
id: 'agent-coder-001',
|
|
124
|
+
type: 'coder',
|
|
125
|
+
name: 'Coder Agent',
|
|
126
|
+
status: 'terminated',
|
|
127
|
+
capabilities: ['coding', 'implementation', 'debugging'],
|
|
128
|
+
createdAt: new Date('2024-01-01T00:00:00Z'),
|
|
129
|
+
lastActiveAt: new Date('2024-01-10T08:00:00Z'),
|
|
130
|
+
},
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Factory function to create agent config with overrides
|
|
135
|
+
*/
|
|
136
|
+
export function createAgentConfig(
|
|
137
|
+
base: keyof typeof agentConfigs,
|
|
138
|
+
overrides?: Partial<AgentConfig>
|
|
139
|
+
): AgentConfig {
|
|
140
|
+
return {
|
|
141
|
+
...agentConfigs[base],
|
|
142
|
+
...overrides,
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* Factory function to create agent instance with overrides
|
|
148
|
+
*/
|
|
149
|
+
export function createAgentInstance(
|
|
150
|
+
base: keyof typeof agentInstances,
|
|
151
|
+
overrides?: Partial<AgentInstance>
|
|
152
|
+
): AgentInstance {
|
|
153
|
+
return {
|
|
154
|
+
...agentInstances[base],
|
|
155
|
+
...overrides,
|
|
156
|
+
id: overrides?.id ?? `agent-${Date.now()}-${Math.random().toString(36).slice(2, 7)}`,
|
|
157
|
+
createdAt: overrides?.createdAt ?? new Date(),
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* Create a full 15-agent swarm configuration
|
|
163
|
+
*/
|
|
164
|
+
export function create15AgentSwarmConfig(): AgentConfig[] {
|
|
165
|
+
return [
|
|
166
|
+
agentConfigs.queenCoordinator,
|
|
167
|
+
agentConfigs.securityArchitect,
|
|
168
|
+
agentConfigs.securityAuditor,
|
|
169
|
+
agentConfigs.memorySpecialist,
|
|
170
|
+
agentConfigs.swarmSpecialist,
|
|
171
|
+
createAgentConfig('coder', { name: 'Integration Architect', type: 'integration-architect' as V3AgentType }),
|
|
172
|
+
createAgentConfig('coder', { name: 'Performance Engineer', type: 'performance-engineer' as V3AgentType }),
|
|
173
|
+
createAgentConfig('coder', { name: 'Core Architect', type: 'core-architect' as V3AgentType }),
|
|
174
|
+
createAgentConfig('tester', { name: 'Test Architect', type: 'test-architect' as V3AgentType }),
|
|
175
|
+
createAgentConfig('coder', { name: 'Project Coordinator', type: 'project-coordinator' as V3AgentType }),
|
|
176
|
+
agentConfigs.coder,
|
|
177
|
+
agentConfigs.reviewer,
|
|
178
|
+
agentConfigs.tester,
|
|
179
|
+
createAgentConfig('coder', { name: 'Planner Agent', type: 'planner' as V3AgentType }),
|
|
180
|
+
createAgentConfig('coder', { name: 'Researcher Agent', type: 'researcher' as V3AgentType }),
|
|
181
|
+
];
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
/**
|
|
185
|
+
* Invalid agent configurations for error testing
|
|
186
|
+
*/
|
|
187
|
+
export const invalidAgentConfigs = {
|
|
188
|
+
emptyName: {
|
|
189
|
+
type: 'coder' as V3AgentType,
|
|
190
|
+
name: '',
|
|
191
|
+
capabilities: ['coding'],
|
|
192
|
+
},
|
|
193
|
+
|
|
194
|
+
noCapabilities: {
|
|
195
|
+
type: 'coder' as V3AgentType,
|
|
196
|
+
name: 'Invalid Agent',
|
|
197
|
+
capabilities: [],
|
|
198
|
+
},
|
|
199
|
+
|
|
200
|
+
invalidType: {
|
|
201
|
+
type: 'invalid-type' as V3AgentType,
|
|
202
|
+
name: 'Invalid Agent',
|
|
203
|
+
capabilities: ['something'],
|
|
204
|
+
},
|
|
205
|
+
|
|
206
|
+
negativePriority: {
|
|
207
|
+
type: 'coder' as V3AgentType,
|
|
208
|
+
name: 'Invalid Agent',
|
|
209
|
+
capabilities: ['coding'],
|
|
210
|
+
priority: -1,
|
|
211
|
+
},
|
|
212
|
+
};
|
|
@@ -0,0 +1,491 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* V3 Claude-Flow Configuration Fixtures
|
|
3
|
+
*
|
|
4
|
+
* Test data for configuration testing
|
|
5
|
+
* Following London School principle of explicit test data
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Security configuration interface
|
|
10
|
+
*/
|
|
11
|
+
export interface SecurityConfig {
|
|
12
|
+
validation: {
|
|
13
|
+
maxInputSize: number;
|
|
14
|
+
allowedChars: RegExp;
|
|
15
|
+
sanitizeHtml: boolean;
|
|
16
|
+
};
|
|
17
|
+
paths: {
|
|
18
|
+
allowedDirectories: string[];
|
|
19
|
+
blockedPatterns: string[];
|
|
20
|
+
maxPathLength: number;
|
|
21
|
+
};
|
|
22
|
+
execution: {
|
|
23
|
+
shell: boolean;
|
|
24
|
+
timeout: number;
|
|
25
|
+
allowedCommands: string[];
|
|
26
|
+
blockedCommands: string[];
|
|
27
|
+
};
|
|
28
|
+
hashing: {
|
|
29
|
+
algorithm: 'argon2' | 'bcrypt' | 'scrypt';
|
|
30
|
+
memoryCost?: number;
|
|
31
|
+
timeCost?: number;
|
|
32
|
+
parallelism?: number;
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Memory configuration interface
|
|
38
|
+
*/
|
|
39
|
+
export interface MemoryConfig {
|
|
40
|
+
backend: 'agentdb' | 'sqlite' | 'memory' | 'hybrid';
|
|
41
|
+
vectorDimensions: number;
|
|
42
|
+
hnswConfig: {
|
|
43
|
+
M: number;
|
|
44
|
+
efConstruction: number;
|
|
45
|
+
efSearch: number;
|
|
46
|
+
};
|
|
47
|
+
caching: {
|
|
48
|
+
enabled: boolean;
|
|
49
|
+
maxSize: number;
|
|
50
|
+
ttl: number;
|
|
51
|
+
};
|
|
52
|
+
quantization: {
|
|
53
|
+
enabled: boolean;
|
|
54
|
+
bits: 4 | 8;
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Swarm configuration interface
|
|
60
|
+
*/
|
|
61
|
+
export interface SwarmConfig {
|
|
62
|
+
topology: 'hierarchical' | 'mesh' | 'adaptive' | 'hierarchical-mesh';
|
|
63
|
+
maxAgents: number;
|
|
64
|
+
coordination: {
|
|
65
|
+
consensusProtocol: 'raft' | 'pbft' | 'gossip';
|
|
66
|
+
heartbeatInterval: number;
|
|
67
|
+
electionTimeout: number;
|
|
68
|
+
};
|
|
69
|
+
communication: {
|
|
70
|
+
protocol: 'quic' | 'tcp' | 'websocket';
|
|
71
|
+
maxMessageSize: number;
|
|
72
|
+
retryAttempts: number;
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* MCP configuration interface
|
|
78
|
+
*/
|
|
79
|
+
export interface MCPConfig {
|
|
80
|
+
server: {
|
|
81
|
+
port: number;
|
|
82
|
+
host: string;
|
|
83
|
+
protocol: 'http' | 'https' | 'stdio';
|
|
84
|
+
};
|
|
85
|
+
connection: {
|
|
86
|
+
poolSize: number;
|
|
87
|
+
timeout: number;
|
|
88
|
+
keepAlive: boolean;
|
|
89
|
+
};
|
|
90
|
+
tools: {
|
|
91
|
+
enabled: string[];
|
|
92
|
+
disabled: string[];
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Performance configuration interface
|
|
98
|
+
*/
|
|
99
|
+
export interface PerformanceConfig {
|
|
100
|
+
targets: {
|
|
101
|
+
flashAttentionSpeedup: [number, number]; // [min, max]
|
|
102
|
+
agentDBSearchImprovement: [number, number];
|
|
103
|
+
memoryReduction: number;
|
|
104
|
+
startupTime: number;
|
|
105
|
+
};
|
|
106
|
+
monitoring: {
|
|
107
|
+
enabled: boolean;
|
|
108
|
+
samplingRate: number;
|
|
109
|
+
metricsEndpoint?: string;
|
|
110
|
+
};
|
|
111
|
+
optimization: {
|
|
112
|
+
batchSize: number;
|
|
113
|
+
parallelism: number;
|
|
114
|
+
cacheStrategy: 'lru' | 'lfu' | 'arc';
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* Pre-defined security configurations for testing
|
|
120
|
+
*/
|
|
121
|
+
export const securityConfigs: Record<string, SecurityConfig> = {
|
|
122
|
+
strict: {
|
|
123
|
+
validation: {
|
|
124
|
+
maxInputSize: 10000,
|
|
125
|
+
allowedChars: /^[a-zA-Z0-9._\-\s]+$/,
|
|
126
|
+
sanitizeHtml: true,
|
|
127
|
+
},
|
|
128
|
+
paths: {
|
|
129
|
+
allowedDirectories: ['./v3/', './src/', './tests/'],
|
|
130
|
+
blockedPatterns: ['../', '~/', '/etc/', '/tmp/', '/var/'],
|
|
131
|
+
maxPathLength: 255,
|
|
132
|
+
},
|
|
133
|
+
execution: {
|
|
134
|
+
shell: false,
|
|
135
|
+
timeout: 30000,
|
|
136
|
+
allowedCommands: ['npm', 'npx', 'node', 'git'],
|
|
137
|
+
blockedCommands: ['rm', 'del', 'format', 'dd', 'chmod', 'chown'],
|
|
138
|
+
},
|
|
139
|
+
hashing: {
|
|
140
|
+
algorithm: 'argon2',
|
|
141
|
+
memoryCost: 65536,
|
|
142
|
+
timeCost: 3,
|
|
143
|
+
parallelism: 4,
|
|
144
|
+
},
|
|
145
|
+
},
|
|
146
|
+
|
|
147
|
+
development: {
|
|
148
|
+
validation: {
|
|
149
|
+
maxInputSize: 50000,
|
|
150
|
+
allowedChars: /^[\x20-\x7E\n\r\t]+$/,
|
|
151
|
+
sanitizeHtml: false,
|
|
152
|
+
},
|
|
153
|
+
paths: {
|
|
154
|
+
allowedDirectories: ['./', './node_modules/'],
|
|
155
|
+
blockedPatterns: ['../', '~/'],
|
|
156
|
+
maxPathLength: 512,
|
|
157
|
+
},
|
|
158
|
+
execution: {
|
|
159
|
+
shell: false, // Security: Always disable shell to prevent injection
|
|
160
|
+
timeout: 60000,
|
|
161
|
+
allowedCommands: ['npm', 'npx', 'node', 'git', 'yarn', 'pnpm'],
|
|
162
|
+
blockedCommands: ['rm', 'rmdir', 'del', 'format', 'dd', 'chmod', 'chown', 'sudo', 'su'],
|
|
163
|
+
},
|
|
164
|
+
hashing: {
|
|
165
|
+
algorithm: 'bcrypt',
|
|
166
|
+
},
|
|
167
|
+
},
|
|
168
|
+
|
|
169
|
+
production: {
|
|
170
|
+
validation: {
|
|
171
|
+
maxInputSize: 5000,
|
|
172
|
+
allowedChars: /^[a-zA-Z0-9._\-]+$/,
|
|
173
|
+
sanitizeHtml: true,
|
|
174
|
+
},
|
|
175
|
+
paths: {
|
|
176
|
+
allowedDirectories: ['/app/'],
|
|
177
|
+
blockedPatterns: ['../', '~/', '/etc/', '/tmp/', '/var/', '/root/'],
|
|
178
|
+
maxPathLength: 200,
|
|
179
|
+
},
|
|
180
|
+
execution: {
|
|
181
|
+
shell: false,
|
|
182
|
+
timeout: 15000,
|
|
183
|
+
allowedCommands: ['node'],
|
|
184
|
+
blockedCommands: ['rm', 'del', 'format', 'dd', 'chmod', 'chown', 'sudo'],
|
|
185
|
+
},
|
|
186
|
+
hashing: {
|
|
187
|
+
algorithm: 'argon2',
|
|
188
|
+
memoryCost: 131072,
|
|
189
|
+
timeCost: 4,
|
|
190
|
+
parallelism: 4,
|
|
191
|
+
},
|
|
192
|
+
},
|
|
193
|
+
};
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
* Pre-defined memory configurations for testing
|
|
197
|
+
*/
|
|
198
|
+
export const memoryConfigs: Record<string, MemoryConfig> = {
|
|
199
|
+
agentDB: {
|
|
200
|
+
backend: 'agentdb',
|
|
201
|
+
vectorDimensions: 384,
|
|
202
|
+
hnswConfig: {
|
|
203
|
+
M: 16,
|
|
204
|
+
efConstruction: 200,
|
|
205
|
+
efSearch: 50,
|
|
206
|
+
},
|
|
207
|
+
caching: {
|
|
208
|
+
enabled: true,
|
|
209
|
+
maxSize: 1000,
|
|
210
|
+
ttl: 3600000,
|
|
211
|
+
},
|
|
212
|
+
quantization: {
|
|
213
|
+
enabled: true,
|
|
214
|
+
bits: 8,
|
|
215
|
+
},
|
|
216
|
+
},
|
|
217
|
+
|
|
218
|
+
hybrid: {
|
|
219
|
+
backend: 'hybrid',
|
|
220
|
+
vectorDimensions: 384,
|
|
221
|
+
hnswConfig: {
|
|
222
|
+
M: 32,
|
|
223
|
+
efConstruction: 400,
|
|
224
|
+
efSearch: 100,
|
|
225
|
+
},
|
|
226
|
+
caching: {
|
|
227
|
+
enabled: true,
|
|
228
|
+
maxSize: 5000,
|
|
229
|
+
ttl: 7200000,
|
|
230
|
+
},
|
|
231
|
+
quantization: {
|
|
232
|
+
enabled: true,
|
|
233
|
+
bits: 4,
|
|
234
|
+
},
|
|
235
|
+
},
|
|
236
|
+
|
|
237
|
+
inMemory: {
|
|
238
|
+
backend: 'memory',
|
|
239
|
+
vectorDimensions: 384,
|
|
240
|
+
hnswConfig: {
|
|
241
|
+
M: 8,
|
|
242
|
+
efConstruction: 100,
|
|
243
|
+
efSearch: 25,
|
|
244
|
+
},
|
|
245
|
+
caching: {
|
|
246
|
+
enabled: false,
|
|
247
|
+
maxSize: 0,
|
|
248
|
+
ttl: 0,
|
|
249
|
+
},
|
|
250
|
+
quantization: {
|
|
251
|
+
enabled: false,
|
|
252
|
+
bits: 8,
|
|
253
|
+
},
|
|
254
|
+
},
|
|
255
|
+
};
|
|
256
|
+
|
|
257
|
+
/**
|
|
258
|
+
* Pre-defined swarm configurations for testing
|
|
259
|
+
*/
|
|
260
|
+
export const swarmConfigs: Record<string, SwarmConfig> = {
|
|
261
|
+
v3Default: {
|
|
262
|
+
topology: 'hierarchical-mesh',
|
|
263
|
+
maxAgents: 15,
|
|
264
|
+
coordination: {
|
|
265
|
+
consensusProtocol: 'raft',
|
|
266
|
+
heartbeatInterval: 1000,
|
|
267
|
+
electionTimeout: 5000,
|
|
268
|
+
},
|
|
269
|
+
communication: {
|
|
270
|
+
protocol: 'quic',
|
|
271
|
+
maxMessageSize: 1048576, // 1MB
|
|
272
|
+
retryAttempts: 3,
|
|
273
|
+
},
|
|
274
|
+
},
|
|
275
|
+
|
|
276
|
+
minimal: {
|
|
277
|
+
topology: 'mesh',
|
|
278
|
+
maxAgents: 5,
|
|
279
|
+
coordination: {
|
|
280
|
+
consensusProtocol: 'gossip',
|
|
281
|
+
heartbeatInterval: 2000,
|
|
282
|
+
electionTimeout: 10000,
|
|
283
|
+
},
|
|
284
|
+
communication: {
|
|
285
|
+
protocol: 'tcp',
|
|
286
|
+
maxMessageSize: 65536, // 64KB
|
|
287
|
+
retryAttempts: 5,
|
|
288
|
+
},
|
|
289
|
+
},
|
|
290
|
+
|
|
291
|
+
highPerformance: {
|
|
292
|
+
topology: 'adaptive',
|
|
293
|
+
maxAgents: 50,
|
|
294
|
+
coordination: {
|
|
295
|
+
consensusProtocol: 'pbft',
|
|
296
|
+
heartbeatInterval: 500,
|
|
297
|
+
electionTimeout: 3000,
|
|
298
|
+
},
|
|
299
|
+
communication: {
|
|
300
|
+
protocol: 'quic',
|
|
301
|
+
maxMessageSize: 4194304, // 4MB
|
|
302
|
+
retryAttempts: 2,
|
|
303
|
+
},
|
|
304
|
+
},
|
|
305
|
+
};
|
|
306
|
+
|
|
307
|
+
/**
|
|
308
|
+
* Pre-defined MCP configurations for testing
|
|
309
|
+
*/
|
|
310
|
+
export const mcpConfigs: Record<string, MCPConfig> = {
|
|
311
|
+
development: {
|
|
312
|
+
server: {
|
|
313
|
+
port: 3000,
|
|
314
|
+
host: 'localhost',
|
|
315
|
+
protocol: 'http',
|
|
316
|
+
},
|
|
317
|
+
connection: {
|
|
318
|
+
poolSize: 10,
|
|
319
|
+
timeout: 30000,
|
|
320
|
+
keepAlive: true,
|
|
321
|
+
},
|
|
322
|
+
tools: {
|
|
323
|
+
enabled: ['*'],
|
|
324
|
+
disabled: [],
|
|
325
|
+
},
|
|
326
|
+
},
|
|
327
|
+
|
|
328
|
+
production: {
|
|
329
|
+
server: {
|
|
330
|
+
port: 443,
|
|
331
|
+
host: '0.0.0.0',
|
|
332
|
+
protocol: 'https',
|
|
333
|
+
},
|
|
334
|
+
connection: {
|
|
335
|
+
poolSize: 100,
|
|
336
|
+
timeout: 15000,
|
|
337
|
+
keepAlive: true,
|
|
338
|
+
},
|
|
339
|
+
tools: {
|
|
340
|
+
enabled: ['swarm_init', 'agent_spawn', 'task_orchestrate', 'memory_usage'],
|
|
341
|
+
disabled: ['debug_*', 'test_*'],
|
|
342
|
+
},
|
|
343
|
+
},
|
|
344
|
+
|
|
345
|
+
stdio: {
|
|
346
|
+
server: {
|
|
347
|
+
port: 0,
|
|
348
|
+
host: '',
|
|
349
|
+
protocol: 'stdio',
|
|
350
|
+
},
|
|
351
|
+
connection: {
|
|
352
|
+
poolSize: 1,
|
|
353
|
+
timeout: 60000,
|
|
354
|
+
keepAlive: false,
|
|
355
|
+
},
|
|
356
|
+
tools: {
|
|
357
|
+
enabled: ['*'],
|
|
358
|
+
disabled: [],
|
|
359
|
+
},
|
|
360
|
+
},
|
|
361
|
+
};
|
|
362
|
+
|
|
363
|
+
/**
|
|
364
|
+
* Pre-defined performance configurations for testing
|
|
365
|
+
*/
|
|
366
|
+
export const performanceConfigs: Record<string, PerformanceConfig> = {
|
|
367
|
+
v3Targets: {
|
|
368
|
+
targets: {
|
|
369
|
+
flashAttentionSpeedup: [2.49, 7.47],
|
|
370
|
+
agentDBSearchImprovement: [150, 12500],
|
|
371
|
+
memoryReduction: 0.50,
|
|
372
|
+
startupTime: 500,
|
|
373
|
+
},
|
|
374
|
+
monitoring: {
|
|
375
|
+
enabled: true,
|
|
376
|
+
samplingRate: 0.1,
|
|
377
|
+
metricsEndpoint: '/metrics',
|
|
378
|
+
},
|
|
379
|
+
optimization: {
|
|
380
|
+
batchSize: 100,
|
|
381
|
+
parallelism: 4,
|
|
382
|
+
cacheStrategy: 'arc',
|
|
383
|
+
},
|
|
384
|
+
},
|
|
385
|
+
|
|
386
|
+
minimal: {
|
|
387
|
+
targets: {
|
|
388
|
+
flashAttentionSpeedup: [1.0, 2.0],
|
|
389
|
+
agentDBSearchImprovement: [10, 100],
|
|
390
|
+
memoryReduction: 0.25,
|
|
391
|
+
startupTime: 2000,
|
|
392
|
+
},
|
|
393
|
+
monitoring: {
|
|
394
|
+
enabled: false,
|
|
395
|
+
samplingRate: 0,
|
|
396
|
+
},
|
|
397
|
+
optimization: {
|
|
398
|
+
batchSize: 10,
|
|
399
|
+
parallelism: 1,
|
|
400
|
+
cacheStrategy: 'lru',
|
|
401
|
+
},
|
|
402
|
+
},
|
|
403
|
+
};
|
|
404
|
+
|
|
405
|
+
/**
|
|
406
|
+
* Factory functions to create configurations with overrides
|
|
407
|
+
*/
|
|
408
|
+
export function createSecurityConfig(
|
|
409
|
+
base: keyof typeof securityConfigs,
|
|
410
|
+
overrides?: Partial<SecurityConfig>
|
|
411
|
+
): SecurityConfig {
|
|
412
|
+
return mergeDeep(securityConfigs[base] as SecurityConfig & Record<string, unknown>, (overrides ?? {}) as Partial<SecurityConfig & Record<string, unknown>>);
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
export function createMemoryConfig(
|
|
416
|
+
base: keyof typeof memoryConfigs,
|
|
417
|
+
overrides?: Partial<MemoryConfig>
|
|
418
|
+
): MemoryConfig {
|
|
419
|
+
return mergeDeep(memoryConfigs[base] as MemoryConfig & Record<string, unknown>, (overrides ?? {}) as Partial<MemoryConfig & Record<string, unknown>>);
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
export function createSwarmConfigFromBase(
|
|
423
|
+
base: keyof typeof swarmConfigs,
|
|
424
|
+
overrides?: Partial<SwarmConfig>
|
|
425
|
+
): SwarmConfig {
|
|
426
|
+
return mergeDeep(swarmConfigs[base] as SwarmConfig & Record<string, unknown>, (overrides ?? {}) as Partial<SwarmConfig & Record<string, unknown>>);
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
export function createMCPConfig(
|
|
430
|
+
base: keyof typeof mcpConfigs,
|
|
431
|
+
overrides?: Partial<MCPConfig>
|
|
432
|
+
): MCPConfig {
|
|
433
|
+
return mergeDeep(mcpConfigs[base] as MCPConfig & Record<string, unknown>, (overrides ?? {}) as Partial<MCPConfig & Record<string, unknown>>);
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
export function createPerformanceConfig(
|
|
437
|
+
base: keyof typeof performanceConfigs,
|
|
438
|
+
overrides?: Partial<PerformanceConfig>
|
|
439
|
+
): PerformanceConfig {
|
|
440
|
+
return mergeDeep(performanceConfigs[base] as PerformanceConfig & Record<string, unknown>, (overrides ?? {}) as Partial<PerformanceConfig & Record<string, unknown>>);
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
/**
|
|
444
|
+
* Deep merge utility
|
|
445
|
+
*/
|
|
446
|
+
function mergeDeep<T extends Record<string, unknown>>(
|
|
447
|
+
target: T,
|
|
448
|
+
source: Partial<T>
|
|
449
|
+
): T {
|
|
450
|
+
const output = { ...target } as Record<string, unknown>;
|
|
451
|
+
|
|
452
|
+
for (const key of Object.keys(source)) {
|
|
453
|
+
const sourceValue = source[key as keyof T];
|
|
454
|
+
if (sourceValue && typeof sourceValue === 'object' && !Array.isArray(sourceValue)) {
|
|
455
|
+
output[key] = mergeDeep(
|
|
456
|
+
(target[key as keyof T] as Record<string, unknown>) ?? {},
|
|
457
|
+
sourceValue as Record<string, unknown>
|
|
458
|
+
);
|
|
459
|
+
} else {
|
|
460
|
+
output[key] = sourceValue;
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
return output as T;
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
/**
|
|
468
|
+
* Invalid configurations for error testing
|
|
469
|
+
*/
|
|
470
|
+
export const invalidConfigs = {
|
|
471
|
+
security: {
|
|
472
|
+
negativeMaxInputSize: createSecurityConfig('strict', {
|
|
473
|
+
validation: { maxInputSize: -1, allowedChars: /.*/, sanitizeHtml: true },
|
|
474
|
+
}),
|
|
475
|
+
emptyAllowedCommands: createSecurityConfig('strict', {
|
|
476
|
+
execution: { shell: false, timeout: 1000, allowedCommands: [], blockedCommands: [] },
|
|
477
|
+
}),
|
|
478
|
+
},
|
|
479
|
+
|
|
480
|
+
memory: {
|
|
481
|
+
zeroDimensions: createMemoryConfig('agentDB', { vectorDimensions: 0 }),
|
|
482
|
+
invalidQuantization: createMemoryConfig('agentDB', { quantization: { enabled: true, bits: 16 as 4 | 8 } }),
|
|
483
|
+
},
|
|
484
|
+
|
|
485
|
+
swarm: {
|
|
486
|
+
zeroAgents: createSwarmConfigFromBase('v3Default', { maxAgents: 0 }),
|
|
487
|
+
negativeHeartbeat: createSwarmConfigFromBase('v3Default', {
|
|
488
|
+
coordination: { consensusProtocol: 'raft', heartbeatInterval: -100, electionTimeout: 5000 },
|
|
489
|
+
}),
|
|
490
|
+
},
|
|
491
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* V3 Claude-Flow Test Fixtures Index
|
|
3
|
+
*
|
|
4
|
+
* Central export for all test fixtures
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
// Agent fixtures (comprehensive)
|
|
8
|
+
export * from './agent-fixtures.js';
|
|
9
|
+
|
|
10
|
+
// Memory fixtures (AgentDB, HNSW, ReasoningBank)
|
|
11
|
+
export * from './memory-fixtures.js';
|
|
12
|
+
|
|
13
|
+
// Swarm fixtures (topologies, coordination, consensus)
|
|
14
|
+
export * from './swarm-fixtures.js';
|
|
15
|
+
|
|
16
|
+
// MCP fixtures (tools, resources, prompts)
|
|
17
|
+
export * from './mcp-fixtures.js';
|
|
18
|
+
|
|
19
|
+
// Note: Legacy files (agents.js, tasks.js, memory-entries.js, configurations.js)
|
|
20
|
+
// are deprecated. Their contents have been merged into the comprehensive fixtures above.
|
|
21
|
+
// Import directly from the specific fixture files if needed.
|