swarmdo 1.4.8 → 1.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/helpers/statusline.cjs +7 -7
- package/README.md +9 -6
- package/package.json +5 -3
- package/v3/@swarmdo/cli/dist/src/commands/compact.d.ts +16 -0
- package/v3/@swarmdo/cli/dist/src/commands/compact.js +106 -0
- package/v3/@swarmdo/cli/dist/src/commands/hooks.js +26 -24
- package/v3/@swarmdo/cli/dist/src/commands/index.js +10 -3
- 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 +241 -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/compact/compact.d.ts +60 -0
- package/v3/@swarmdo/cli/dist/src/compact/compact.js +170 -0
- package/v3/@swarmdo/cli/dist/src/config-lint/lint.js +11 -1
- package/v3/@swarmdo/cli/dist/src/index.js +4 -2
- 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,563 +0,0 @@
|
|
|
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 { vi } from 'vitest';
|
|
8
|
-
/**
|
|
9
|
-
* Mock AgentDB - Vector database mock with HNSW simulation
|
|
10
|
-
*/
|
|
11
|
-
export class MockAgentDB {
|
|
12
|
-
vectors = new Map();
|
|
13
|
-
indexConfig = {
|
|
14
|
-
M: 16,
|
|
15
|
-
efConstruction: 200,
|
|
16
|
-
efSearch: 50,
|
|
17
|
-
dimensions: 384,
|
|
18
|
-
};
|
|
19
|
-
// Mock methods for verification
|
|
20
|
-
insert = vi.fn(async (id, embedding, metadata) => {
|
|
21
|
-
if (embedding.length !== this.indexConfig.dimensions) {
|
|
22
|
-
throw new Error(`Invalid embedding dimensions: expected ${this.indexConfig.dimensions}, got ${embedding.length}`);
|
|
23
|
-
}
|
|
24
|
-
this.vectors.set(id, { embedding, metadata: metadata ?? {} });
|
|
25
|
-
});
|
|
26
|
-
search = vi.fn(async (embedding, k, threshold) => {
|
|
27
|
-
const results = [];
|
|
28
|
-
for (const [id, data] of this.vectors) {
|
|
29
|
-
const score = this.cosineSimilarity(embedding, data.embedding);
|
|
30
|
-
if (threshold === undefined || score >= threshold) {
|
|
31
|
-
results.push({ id, score, metadata: data.metadata });
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
return results
|
|
35
|
-
.sort((a, b) => b.score - a.score)
|
|
36
|
-
.slice(0, k);
|
|
37
|
-
});
|
|
38
|
-
delete = vi.fn(async (id) => {
|
|
39
|
-
this.vectors.delete(id);
|
|
40
|
-
});
|
|
41
|
-
update = vi.fn(async (id, embedding, metadata) => {
|
|
42
|
-
const existing = this.vectors.get(id);
|
|
43
|
-
if (!existing) {
|
|
44
|
-
throw new Error(`Vector not found: ${id}`);
|
|
45
|
-
}
|
|
46
|
-
this.vectors.set(id, { embedding, metadata: metadata ?? existing.metadata });
|
|
47
|
-
});
|
|
48
|
-
getVector = vi.fn(async (id) => {
|
|
49
|
-
return this.vectors.get(id) ?? null;
|
|
50
|
-
});
|
|
51
|
-
getStats = vi.fn(() => ({
|
|
52
|
-
vectorCount: this.vectors.size,
|
|
53
|
-
indexSize: this.vectors.size * this.indexConfig.dimensions * 4, // 4 bytes per float
|
|
54
|
-
dimensions: this.indexConfig.dimensions,
|
|
55
|
-
M: this.indexConfig.M,
|
|
56
|
-
efConstruction: this.indexConfig.efConstruction,
|
|
57
|
-
}));
|
|
58
|
-
rebuildIndex = vi.fn(async () => {
|
|
59
|
-
// Simulate index rebuild
|
|
60
|
-
await new Promise(resolve => setTimeout(resolve, 10));
|
|
61
|
-
});
|
|
62
|
-
clear = vi.fn(() => {
|
|
63
|
-
this.vectors.clear();
|
|
64
|
-
});
|
|
65
|
-
cosineSimilarity(a, b) {
|
|
66
|
-
let dotProduct = 0;
|
|
67
|
-
let normA = 0;
|
|
68
|
-
let normB = 0;
|
|
69
|
-
for (let i = 0; i < a.length; i++) {
|
|
70
|
-
dotProduct += a[i] * b[i];
|
|
71
|
-
normA += a[i] * a[i];
|
|
72
|
-
normB += b[i] * b[i];
|
|
73
|
-
}
|
|
74
|
-
return dotProduct / (Math.sqrt(normA) * Math.sqrt(normB));
|
|
75
|
-
}
|
|
76
|
-
/**
|
|
77
|
-
* Configure the mock index
|
|
78
|
-
*/
|
|
79
|
-
configure(config) {
|
|
80
|
-
Object.assign(this.indexConfig, config);
|
|
81
|
-
}
|
|
82
|
-
/**
|
|
83
|
-
* Get all stored vectors (for testing)
|
|
84
|
-
*/
|
|
85
|
-
getAllVectors() {
|
|
86
|
-
return new Map(this.vectors);
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
/**
|
|
90
|
-
* Mock Unified Swarm Coordinator
|
|
91
|
-
*/
|
|
92
|
-
export class MockSwarmCoordinator {
|
|
93
|
-
agents = new Map();
|
|
94
|
-
state = {
|
|
95
|
-
id: `swarm-${Date.now()}`,
|
|
96
|
-
topology: 'hierarchical-mesh',
|
|
97
|
-
status: 'idle',
|
|
98
|
-
agentCount: 0,
|
|
99
|
-
activeAgentCount: 0,
|
|
100
|
-
leaderId: undefined,
|
|
101
|
-
createdAt: new Date(),
|
|
102
|
-
};
|
|
103
|
-
messageQueue = [];
|
|
104
|
-
taskQueue = [];
|
|
105
|
-
initialize = vi.fn(async (config) => {
|
|
106
|
-
this.state = {
|
|
107
|
-
...this.state,
|
|
108
|
-
topology: config.topology ?? 'hierarchical-mesh',
|
|
109
|
-
status: 'active',
|
|
110
|
-
};
|
|
111
|
-
return this.state;
|
|
112
|
-
});
|
|
113
|
-
shutdown = vi.fn(async (graceful = true) => {
|
|
114
|
-
if (graceful) {
|
|
115
|
-
// Complete pending tasks
|
|
116
|
-
await Promise.all(Array.from(this.agents.values()).map(agent => agent.terminate()));
|
|
117
|
-
}
|
|
118
|
-
this.state.status = 'shutdown';
|
|
119
|
-
this.agents.clear();
|
|
120
|
-
});
|
|
121
|
-
addAgent = vi.fn(async (config) => {
|
|
122
|
-
const id = `agent-${config.type}-${Date.now()}`;
|
|
123
|
-
const agent = new MockSwarmAgent(id, config);
|
|
124
|
-
this.agents.set(id, agent);
|
|
125
|
-
this.state.agentCount++;
|
|
126
|
-
this.state.activeAgentCount++;
|
|
127
|
-
if (config.type === 'queen-coordinator' && !this.state.leaderId) {
|
|
128
|
-
this.state.leaderId = id;
|
|
129
|
-
}
|
|
130
|
-
return agent;
|
|
131
|
-
});
|
|
132
|
-
removeAgent = vi.fn(async (agentId) => {
|
|
133
|
-
const agent = this.agents.get(agentId);
|
|
134
|
-
if (agent) {
|
|
135
|
-
await agent.terminate();
|
|
136
|
-
this.agents.delete(agentId);
|
|
137
|
-
this.state.agentCount--;
|
|
138
|
-
this.state.activeAgentCount--;
|
|
139
|
-
if (this.state.leaderId === agentId) {
|
|
140
|
-
this.electNewLeader();
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
});
|
|
144
|
-
coordinate = vi.fn(async (task) => {
|
|
145
|
-
this.taskQueue.push(task);
|
|
146
|
-
// Find suitable agents
|
|
147
|
-
const suitableAgents = Array.from(this.agents.values())
|
|
148
|
-
.filter(agent => agent.canHandle(task.type))
|
|
149
|
-
.sort((a, b) => b.priority - a.priority);
|
|
150
|
-
if (suitableAgents.length === 0) {
|
|
151
|
-
return {
|
|
152
|
-
success: false,
|
|
153
|
-
error: 'No suitable agents available',
|
|
154
|
-
taskId: task.id,
|
|
155
|
-
duration: 0,
|
|
156
|
-
};
|
|
157
|
-
}
|
|
158
|
-
const startTime = Date.now();
|
|
159
|
-
const results = [];
|
|
160
|
-
for (const agent of suitableAgents.slice(0, task.maxAgents ?? 1)) {
|
|
161
|
-
const result = await agent.execute(task);
|
|
162
|
-
results.push(result);
|
|
163
|
-
}
|
|
164
|
-
return {
|
|
165
|
-
success: results.every(r => r.success),
|
|
166
|
-
taskId: task.id,
|
|
167
|
-
duration: Date.now() - startTime,
|
|
168
|
-
results,
|
|
169
|
-
};
|
|
170
|
-
});
|
|
171
|
-
broadcast = vi.fn(async (message) => {
|
|
172
|
-
const fullMessage = {
|
|
173
|
-
...message,
|
|
174
|
-
id: `msg-${Date.now()}`,
|
|
175
|
-
timestamp: new Date(),
|
|
176
|
-
to: 'broadcast',
|
|
177
|
-
};
|
|
178
|
-
this.messageQueue.push(fullMessage);
|
|
179
|
-
for (const agent of this.agents.values()) {
|
|
180
|
-
await agent.receive(fullMessage);
|
|
181
|
-
}
|
|
182
|
-
});
|
|
183
|
-
sendMessage = vi.fn(async (message) => {
|
|
184
|
-
this.messageQueue.push(message);
|
|
185
|
-
if (message.to === 'broadcast') {
|
|
186
|
-
for (const agent of this.agents.values()) {
|
|
187
|
-
await agent.receive(message);
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
else {
|
|
191
|
-
const agent = this.agents.get(message.to);
|
|
192
|
-
if (agent) {
|
|
193
|
-
await agent.receive(message);
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
});
|
|
197
|
-
requestConsensus = vi.fn(async (request) => {
|
|
198
|
-
const voters = request.voters ?? Array.from(this.agents.keys());
|
|
199
|
-
const votes = new Map();
|
|
200
|
-
for (const voterId of voters) {
|
|
201
|
-
const agent = this.agents.get(voterId);
|
|
202
|
-
if (agent) {
|
|
203
|
-
// Simulate voting - random selection
|
|
204
|
-
const vote = request.options[Math.floor(Math.random() * request.options.length)];
|
|
205
|
-
votes.set(voterId, vote);
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
const voteCounts = new Map();
|
|
209
|
-
for (const vote of votes.values()) {
|
|
210
|
-
const key = JSON.stringify(vote);
|
|
211
|
-
voteCounts.set(key, (voteCounts.get(key) ?? 0) + 1);
|
|
212
|
-
}
|
|
213
|
-
const majority = Math.floor(voters.length / 2) + 1;
|
|
214
|
-
let decision = null;
|
|
215
|
-
let consensus = false;
|
|
216
|
-
for (const [key, count] of voteCounts) {
|
|
217
|
-
if (count >= majority) {
|
|
218
|
-
decision = JSON.parse(key);
|
|
219
|
-
consensus = true;
|
|
220
|
-
break;
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
return {
|
|
224
|
-
topic: request.topic,
|
|
225
|
-
decision,
|
|
226
|
-
votes,
|
|
227
|
-
consensus,
|
|
228
|
-
votingDuration: 100,
|
|
229
|
-
participatingAgents: Array.from(votes.keys()),
|
|
230
|
-
};
|
|
231
|
-
});
|
|
232
|
-
getState = vi.fn(() => ({ ...this.state }));
|
|
233
|
-
getAgent = vi.fn((id) => this.agents.get(id));
|
|
234
|
-
getAgents = vi.fn(() => Array.from(this.agents.values()));
|
|
235
|
-
getMessageQueue = vi.fn(() => [...this.messageQueue]);
|
|
236
|
-
getTaskQueue = vi.fn(() => [...this.taskQueue]);
|
|
237
|
-
electNewLeader() {
|
|
238
|
-
const candidates = Array.from(this.agents.values())
|
|
239
|
-
.filter(a => a.config.type === 'queen-coordinator')
|
|
240
|
-
.sort((a, b) => b.priority - a.priority);
|
|
241
|
-
this.state.leaderId = candidates[0]?.id;
|
|
242
|
-
}
|
|
243
|
-
reset() {
|
|
244
|
-
this.agents.clear();
|
|
245
|
-
this.messageQueue = [];
|
|
246
|
-
this.taskQueue = [];
|
|
247
|
-
this.state = {
|
|
248
|
-
id: `swarm-${Date.now()}`,
|
|
249
|
-
topology: 'hierarchical-mesh',
|
|
250
|
-
status: 'idle',
|
|
251
|
-
agentCount: 0,
|
|
252
|
-
activeAgentCount: 0,
|
|
253
|
-
leaderId: undefined,
|
|
254
|
-
createdAt: new Date(),
|
|
255
|
-
};
|
|
256
|
-
vi.clearAllMocks();
|
|
257
|
-
}
|
|
258
|
-
}
|
|
259
|
-
/**
|
|
260
|
-
* Mock Swarm Agent
|
|
261
|
-
*/
|
|
262
|
-
export class MockSwarmAgent {
|
|
263
|
-
id;
|
|
264
|
-
config;
|
|
265
|
-
status = 'idle';
|
|
266
|
-
priority;
|
|
267
|
-
messages = [];
|
|
268
|
-
taskResults = [];
|
|
269
|
-
execute = vi.fn();
|
|
270
|
-
receive = vi.fn();
|
|
271
|
-
send = vi.fn();
|
|
272
|
-
terminate = vi.fn();
|
|
273
|
-
constructor(id, config) {
|
|
274
|
-
this.id = id;
|
|
275
|
-
this.config = config;
|
|
276
|
-
this.priority = config.priority ?? 50;
|
|
277
|
-
this.execute.mockImplementation(async (task) => {
|
|
278
|
-
this.status = 'busy';
|
|
279
|
-
await new Promise(resolve => setTimeout(resolve, 10));
|
|
280
|
-
this.status = 'idle';
|
|
281
|
-
const result = {
|
|
282
|
-
taskId: task.id,
|
|
283
|
-
agentId: this.id,
|
|
284
|
-
success: true,
|
|
285
|
-
duration: Math.random() * 100 + 10,
|
|
286
|
-
};
|
|
287
|
-
this.taskResults.push(result);
|
|
288
|
-
return result;
|
|
289
|
-
});
|
|
290
|
-
this.receive.mockImplementation(async (message) => {
|
|
291
|
-
this.messages.push(message);
|
|
292
|
-
});
|
|
293
|
-
this.send.mockImplementation(async () => { });
|
|
294
|
-
this.terminate.mockImplementation(async () => {
|
|
295
|
-
this.status = 'terminated';
|
|
296
|
-
});
|
|
297
|
-
}
|
|
298
|
-
canHandle(taskType) {
|
|
299
|
-
const capabilities = agentCapabilities[this.config.type] ?? [];
|
|
300
|
-
return capabilities.some(cap => cap.includes(taskType) || taskType.includes(cap));
|
|
301
|
-
}
|
|
302
|
-
getMessages() {
|
|
303
|
-
return [...this.messages];
|
|
304
|
-
}
|
|
305
|
-
getTaskResults() {
|
|
306
|
-
return [...this.taskResults];
|
|
307
|
-
}
|
|
308
|
-
}
|
|
309
|
-
/**
|
|
310
|
-
* Mock Memory Service with caching
|
|
311
|
-
*/
|
|
312
|
-
export class MockMemoryService {
|
|
313
|
-
store = new Map();
|
|
314
|
-
cache = new Map();
|
|
315
|
-
cacheHits = 0;
|
|
316
|
-
cacheMisses = 0;
|
|
317
|
-
set = vi.fn(async (key, value, metadata) => {
|
|
318
|
-
const expiresAt = metadata?.ttl ? new Date(Date.now() + metadata.ttl) : undefined;
|
|
319
|
-
this.store.set(key, { value, metadata: metadata ?? { type: 'short-term', tags: [] }, expiresAt });
|
|
320
|
-
this.cache.delete(key); // Invalidate cache
|
|
321
|
-
});
|
|
322
|
-
get = vi.fn(async (key) => {
|
|
323
|
-
// Check cache first
|
|
324
|
-
const cached = this.cache.get(key);
|
|
325
|
-
if (cached) {
|
|
326
|
-
this.cacheHits++;
|
|
327
|
-
cached.accessCount++;
|
|
328
|
-
return cached.value;
|
|
329
|
-
}
|
|
330
|
-
this.cacheMisses++;
|
|
331
|
-
const entry = this.store.get(key);
|
|
332
|
-
if (!entry) {
|
|
333
|
-
return null;
|
|
334
|
-
}
|
|
335
|
-
// Check expiration
|
|
336
|
-
if (entry.expiresAt && entry.expiresAt < new Date()) {
|
|
337
|
-
this.store.delete(key);
|
|
338
|
-
return null;
|
|
339
|
-
}
|
|
340
|
-
// Add to cache
|
|
341
|
-
this.cache.set(key, { value: entry.value, accessCount: 1 });
|
|
342
|
-
return entry.value;
|
|
343
|
-
});
|
|
344
|
-
delete = vi.fn(async (key) => {
|
|
345
|
-
this.store.delete(key);
|
|
346
|
-
this.cache.delete(key);
|
|
347
|
-
});
|
|
348
|
-
search = vi.fn(async (query) => {
|
|
349
|
-
// Simulate vector search with filtering
|
|
350
|
-
const results = [];
|
|
351
|
-
for (const [key, entry] of this.store) {
|
|
352
|
-
if (query.filters) {
|
|
353
|
-
const matches = Object.entries(query.filters).every(([k, v]) => entry.metadata[k] === v);
|
|
354
|
-
if (!matches)
|
|
355
|
-
continue;
|
|
356
|
-
}
|
|
357
|
-
results.push({
|
|
358
|
-
key,
|
|
359
|
-
value: entry.value,
|
|
360
|
-
score: Math.random() * 0.3 + 0.7, // Random score 0.7-1.0
|
|
361
|
-
metadata: entry.metadata,
|
|
362
|
-
});
|
|
363
|
-
}
|
|
364
|
-
return results
|
|
365
|
-
.filter(r => !query.threshold || r.score >= query.threshold)
|
|
366
|
-
.sort((a, b) => b.score - a.score)
|
|
367
|
-
.slice(0, query.topK);
|
|
368
|
-
});
|
|
369
|
-
clear = vi.fn(async () => {
|
|
370
|
-
this.store.clear();
|
|
371
|
-
this.cache.clear();
|
|
372
|
-
});
|
|
373
|
-
getStats = vi.fn(() => ({
|
|
374
|
-
totalEntries: this.store.size,
|
|
375
|
-
cacheSize: this.cache.size,
|
|
376
|
-
cacheHitRate: this.cacheHits / (this.cacheHits + this.cacheMisses) || 0,
|
|
377
|
-
cacheHits: this.cacheHits,
|
|
378
|
-
cacheMisses: this.cacheMisses,
|
|
379
|
-
}));
|
|
380
|
-
prune = vi.fn(async () => {
|
|
381
|
-
const now = new Date();
|
|
382
|
-
let pruned = 0;
|
|
383
|
-
for (const [key, entry] of this.store) {
|
|
384
|
-
if (entry.expiresAt && entry.expiresAt < now) {
|
|
385
|
-
this.store.delete(key);
|
|
386
|
-
this.cache.delete(key);
|
|
387
|
-
pruned++;
|
|
388
|
-
}
|
|
389
|
-
}
|
|
390
|
-
return pruned;
|
|
391
|
-
});
|
|
392
|
-
reset() {
|
|
393
|
-
this.store.clear();
|
|
394
|
-
this.cache.clear();
|
|
395
|
-
this.cacheHits = 0;
|
|
396
|
-
this.cacheMisses = 0;
|
|
397
|
-
vi.clearAllMocks();
|
|
398
|
-
}
|
|
399
|
-
}
|
|
400
|
-
/**
|
|
401
|
-
* Mock Event Bus with history tracking
|
|
402
|
-
*/
|
|
403
|
-
export class MockEventBus {
|
|
404
|
-
subscribers = new Map();
|
|
405
|
-
history = [];
|
|
406
|
-
maxHistorySize = 1000;
|
|
407
|
-
publish = vi.fn(async (event) => {
|
|
408
|
-
this.history.push(event);
|
|
409
|
-
if (this.history.length > this.maxHistorySize) {
|
|
410
|
-
this.history.shift();
|
|
411
|
-
}
|
|
412
|
-
const handlers = this.subscribers.get(event.type) ?? new Set();
|
|
413
|
-
const wildcardHandlers = this.subscribers.get('*') ?? new Set();
|
|
414
|
-
const allHandlers = [...handlers, ...wildcardHandlers];
|
|
415
|
-
await Promise.all(allHandlers.map(handler => handler(event)));
|
|
416
|
-
});
|
|
417
|
-
subscribe = vi.fn((eventType, handler) => {
|
|
418
|
-
if (!this.subscribers.has(eventType)) {
|
|
419
|
-
this.subscribers.set(eventType, new Set());
|
|
420
|
-
}
|
|
421
|
-
this.subscribers.get(eventType).add(handler);
|
|
422
|
-
return () => this.unsubscribe(eventType, handler);
|
|
423
|
-
});
|
|
424
|
-
unsubscribe = vi.fn((eventType, handler) => {
|
|
425
|
-
this.subscribers.get(eventType)?.delete(handler);
|
|
426
|
-
});
|
|
427
|
-
getHistory(eventType) {
|
|
428
|
-
if (eventType) {
|
|
429
|
-
return this.history.filter(e => e.type === eventType);
|
|
430
|
-
}
|
|
431
|
-
return [...this.history];
|
|
432
|
-
}
|
|
433
|
-
getSubscriberCount(eventType) {
|
|
434
|
-
return this.subscribers.get(eventType)?.size ?? 0;
|
|
435
|
-
}
|
|
436
|
-
clear() {
|
|
437
|
-
this.history = [];
|
|
438
|
-
vi.clearAllMocks();
|
|
439
|
-
}
|
|
440
|
-
reset() {
|
|
441
|
-
this.subscribers.clear();
|
|
442
|
-
this.history = [];
|
|
443
|
-
vi.clearAllMocks();
|
|
444
|
-
}
|
|
445
|
-
}
|
|
446
|
-
/**
|
|
447
|
-
* Mock Security Service
|
|
448
|
-
*/
|
|
449
|
-
export class MockSecurityService {
|
|
450
|
-
blockedPaths = ['../', '~/', '/etc/', '/tmp/', '/var/', '/root/'];
|
|
451
|
-
allowedCommands = ['npm', 'npx', 'node', 'git'];
|
|
452
|
-
tokens = new Map();
|
|
453
|
-
validatePath = vi.fn((path) => {
|
|
454
|
-
return !this.blockedPaths.some(blocked => path.includes(blocked));
|
|
455
|
-
});
|
|
456
|
-
validateInput = vi.fn((input, options) => {
|
|
457
|
-
const errors = [];
|
|
458
|
-
if (options?.maxLength && input.length > options.maxLength) {
|
|
459
|
-
errors.push(`Input exceeds maximum length of ${options.maxLength}`);
|
|
460
|
-
}
|
|
461
|
-
if (options?.allowedChars && !options.allowedChars.test(input)) {
|
|
462
|
-
errors.push('Input contains disallowed characters');
|
|
463
|
-
}
|
|
464
|
-
return {
|
|
465
|
-
valid: errors.length === 0,
|
|
466
|
-
sanitized: options?.sanitize ? this.sanitize(input) : input,
|
|
467
|
-
errors: errors.length > 0 ? errors : undefined,
|
|
468
|
-
};
|
|
469
|
-
});
|
|
470
|
-
hashPassword = vi.fn(async (password) => {
|
|
471
|
-
// Simulate argon2 hash format
|
|
472
|
-
return `$argon2id$v=19$m=65536,t=3,p=4$${Buffer.from(password).toString('base64')}`;
|
|
473
|
-
});
|
|
474
|
-
verifyPassword = vi.fn(async (password, hash) => {
|
|
475
|
-
const parts = hash.split('$');
|
|
476
|
-
if (parts.length < 5)
|
|
477
|
-
return false;
|
|
478
|
-
return Buffer.from(parts[4], 'base64').toString() === password;
|
|
479
|
-
});
|
|
480
|
-
generateToken = vi.fn(async (payload, expiresIn = 3600000) => {
|
|
481
|
-
const token = `token_${Date.now()}_${Math.random().toString(36).slice(2)}`;
|
|
482
|
-
this.tokens.set(token, {
|
|
483
|
-
payload,
|
|
484
|
-
expiresAt: new Date(Date.now() + expiresIn),
|
|
485
|
-
});
|
|
486
|
-
return token;
|
|
487
|
-
});
|
|
488
|
-
verifyToken = vi.fn(async (token) => {
|
|
489
|
-
const entry = this.tokens.get(token);
|
|
490
|
-
if (!entry) {
|
|
491
|
-
throw new Error('Invalid token');
|
|
492
|
-
}
|
|
493
|
-
if (entry.expiresAt < new Date()) {
|
|
494
|
-
this.tokens.delete(token);
|
|
495
|
-
throw new Error('Token expired');
|
|
496
|
-
}
|
|
497
|
-
return entry.payload;
|
|
498
|
-
});
|
|
499
|
-
executeSecurely = vi.fn(async (command, options) => {
|
|
500
|
-
const [cmd] = command.split(' ');
|
|
501
|
-
if (!this.allowedCommands.includes(cmd)) {
|
|
502
|
-
throw new Error(`Command not allowed: ${cmd}`);
|
|
503
|
-
}
|
|
504
|
-
return {
|
|
505
|
-
stdout: '',
|
|
506
|
-
stderr: '',
|
|
507
|
-
exitCode: 0,
|
|
508
|
-
duration: Math.random() * 100,
|
|
509
|
-
};
|
|
510
|
-
});
|
|
511
|
-
sanitize(input) {
|
|
512
|
-
return input
|
|
513
|
-
.replace(/</g, '<')
|
|
514
|
-
.replace(/>/g, '>')
|
|
515
|
-
.replace(/"/g, '"')
|
|
516
|
-
.replace(/'/g, ''');
|
|
517
|
-
}
|
|
518
|
-
reset() {
|
|
519
|
-
this.tokens.clear();
|
|
520
|
-
vi.clearAllMocks();
|
|
521
|
-
}
|
|
522
|
-
}
|
|
523
|
-
// Agent capabilities mapping
|
|
524
|
-
const agentCapabilities = {
|
|
525
|
-
'queen-coordinator': ['orchestration', 'coordination', 'task-distribution'],
|
|
526
|
-
'security-architect': ['security', 'design', 'threat-modeling'],
|
|
527
|
-
'security-auditor': ['security', 'audit', 'vulnerability'],
|
|
528
|
-
'memory-specialist': ['memory', 'optimization', 'caching'],
|
|
529
|
-
'swarm-specialist': ['coordination', 'consensus', 'communication'],
|
|
530
|
-
'integration-architect': ['integration', 'api', 'compatibility'],
|
|
531
|
-
'performance-engineer': ['performance', 'optimization', 'benchmarking'],
|
|
532
|
-
'core-architect': ['architecture', 'design', 'domain'],
|
|
533
|
-
'test-architect': ['testing', 'tdd', 'quality'],
|
|
534
|
-
'project-coordinator': ['project', 'planning', 'scheduling'],
|
|
535
|
-
'coder': ['coding', 'implementation', 'debugging'],
|
|
536
|
-
'reviewer': ['review', 'quality', 'suggestions'],
|
|
537
|
-
'tester': ['testing', 'execution', 'coverage'],
|
|
538
|
-
'planner': ['planning', 'estimation', 'roadmap'],
|
|
539
|
-
'researcher': ['research', 'analysis', 'documentation'],
|
|
540
|
-
};
|
|
541
|
-
/**
|
|
542
|
-
* Create all mock services as a bundle
|
|
543
|
-
*/
|
|
544
|
-
export function createMockServices() {
|
|
545
|
-
return {
|
|
546
|
-
agentDB: new MockAgentDB(),
|
|
547
|
-
swarmCoordinator: new MockSwarmCoordinator(),
|
|
548
|
-
memoryService: new MockMemoryService(),
|
|
549
|
-
eventBus: new MockEventBus(),
|
|
550
|
-
securityService: new MockSecurityService(),
|
|
551
|
-
};
|
|
552
|
-
}
|
|
553
|
-
/**
|
|
554
|
-
* Reset all mock services
|
|
555
|
-
*/
|
|
556
|
-
export function resetMockServices(services) {
|
|
557
|
-
services.agentDB.clear();
|
|
558
|
-
services.swarmCoordinator.reset();
|
|
559
|
-
services.memoryService.reset();
|
|
560
|
-
services.eventBus.reset();
|
|
561
|
-
services.securityService.reset();
|
|
562
|
-
}
|
|
563
|
-
//# sourceMappingURL=mock-services.js.map
|
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* API Contract Validator
|
|
3
|
-
*
|
|
4
|
-
* Validates MCP tool interfaces to detect breaking changes.
|
|
5
|
-
*
|
|
6
|
-
* @module v3/testing/regression/api-contract
|
|
7
|
-
*/
|
|
8
|
-
/**
|
|
9
|
-
* Contract definition for a tool or endpoint
|
|
10
|
-
*/
|
|
11
|
-
export interface ContractDefinition {
|
|
12
|
-
name: string;
|
|
13
|
-
version: string;
|
|
14
|
-
description: string;
|
|
15
|
-
input: ParameterSchema;
|
|
16
|
-
output: ParameterSchema;
|
|
17
|
-
required: string[];
|
|
18
|
-
optional: string[];
|
|
19
|
-
errors: ErrorDefinition[];
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Parameter schema definition
|
|
23
|
-
*/
|
|
24
|
-
interface ParameterSchema {
|
|
25
|
-
type: string;
|
|
26
|
-
properties?: Record<string, PropertyDefinition>;
|
|
27
|
-
items?: PropertyDefinition;
|
|
28
|
-
required?: string[];
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* Property definition
|
|
32
|
-
*/
|
|
33
|
-
interface PropertyDefinition {
|
|
34
|
-
type: string;
|
|
35
|
-
description?: string;
|
|
36
|
-
enum?: string[];
|
|
37
|
-
default?: unknown;
|
|
38
|
-
properties?: Record<string, PropertyDefinition>;
|
|
39
|
-
items?: PropertyDefinition;
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* Error definition
|
|
43
|
-
*/
|
|
44
|
-
interface ErrorDefinition {
|
|
45
|
-
code: number;
|
|
46
|
-
message: string;
|
|
47
|
-
description: string;
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* Contract validation result
|
|
51
|
-
*/
|
|
52
|
-
export interface ContractValidation {
|
|
53
|
-
endpoint: string;
|
|
54
|
-
valid: boolean;
|
|
55
|
-
breaking: boolean;
|
|
56
|
-
message: string;
|
|
57
|
-
diffs: ContractDiff[];
|
|
58
|
-
}
|
|
59
|
-
/**
|
|
60
|
-
* Contract difference
|
|
61
|
-
*/
|
|
62
|
-
export interface ContractDiff {
|
|
63
|
-
type: 'added' | 'removed' | 'changed' | 'deprecated';
|
|
64
|
-
path: string;
|
|
65
|
-
description: string;
|
|
66
|
-
breaking: boolean;
|
|
67
|
-
oldValue?: unknown;
|
|
68
|
-
newValue?: unknown;
|
|
69
|
-
}
|
|
70
|
-
/**
|
|
71
|
-
* Stored contracts
|
|
72
|
-
*/
|
|
73
|
-
interface StoredContracts {
|
|
74
|
-
version: string;
|
|
75
|
-
capturedAt: number;
|
|
76
|
-
contracts: ContractDefinition[];
|
|
77
|
-
}
|
|
78
|
-
/**
|
|
79
|
-
* API Contract Validator
|
|
80
|
-
*
|
|
81
|
-
* Validates MCP tool contracts for breaking changes.
|
|
82
|
-
*/
|
|
83
|
-
export declare class APIContractValidator {
|
|
84
|
-
private readonly contractPath;
|
|
85
|
-
private cachedContracts;
|
|
86
|
-
constructor(basePath?: string);
|
|
87
|
-
/**
|
|
88
|
-
* Capture current contracts as baseline
|
|
89
|
-
*/
|
|
90
|
-
captureContracts(): Promise<StoredContracts>;
|
|
91
|
-
/**
|
|
92
|
-
* Validate all contracts against baseline
|
|
93
|
-
*/
|
|
94
|
-
validateAll(): Promise<ContractValidation[]>;
|
|
95
|
-
/**
|
|
96
|
-
* Compare two contracts for differences
|
|
97
|
-
*/
|
|
98
|
-
private compareContracts;
|
|
99
|
-
/**
|
|
100
|
-
* Load contracts from file
|
|
101
|
-
*/
|
|
102
|
-
private loadContracts;
|
|
103
|
-
/**
|
|
104
|
-
* Save contracts to file
|
|
105
|
-
*/
|
|
106
|
-
private saveContracts;
|
|
107
|
-
}
|
|
108
|
-
export {};
|
|
109
|
-
//# sourceMappingURL=api-contract.d.ts.map
|