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,334 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Integration Regression Suite
|
|
3
|
-
*
|
|
4
|
-
* Validates critical integration paths work correctly.
|
|
5
|
-
*
|
|
6
|
-
* @module v3/testing/regression/integration-regression
|
|
7
|
-
*/
|
|
8
|
-
/**
|
|
9
|
-
* Integration Regression Suite
|
|
10
|
-
*
|
|
11
|
-
* Runs critical integration tests to catch regressions.
|
|
12
|
-
*/
|
|
13
|
-
export class IntegrationRegressionSuite {
|
|
14
|
-
tests = [];
|
|
15
|
-
constructor() {
|
|
16
|
-
this.registerDefaultTests();
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* Run all integration tests
|
|
20
|
-
*/
|
|
21
|
-
async runAll() {
|
|
22
|
-
const results = [];
|
|
23
|
-
for (const test of this.tests) {
|
|
24
|
-
const result = await this.runTest(test);
|
|
25
|
-
results.push(result);
|
|
26
|
-
}
|
|
27
|
-
return results;
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* Run tests by category
|
|
31
|
-
*/
|
|
32
|
-
async runCategory(category) {
|
|
33
|
-
const results = [];
|
|
34
|
-
const categoryTests = this.tests.filter((t) => t.category === category);
|
|
35
|
-
for (const test of categoryTests) {
|
|
36
|
-
const result = await this.runTest(test);
|
|
37
|
-
results.push(result);
|
|
38
|
-
}
|
|
39
|
-
return results;
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* Run critical tests only
|
|
43
|
-
*/
|
|
44
|
-
async runCritical() {
|
|
45
|
-
const results = [];
|
|
46
|
-
const criticalTests = this.tests.filter((t) => t.critical);
|
|
47
|
-
for (const test of criticalTests) {
|
|
48
|
-
const result = await this.runTest(test);
|
|
49
|
-
results.push(result);
|
|
50
|
-
}
|
|
51
|
-
return results;
|
|
52
|
-
}
|
|
53
|
-
/**
|
|
54
|
-
* Run a single test
|
|
55
|
-
*/
|
|
56
|
-
async runTest(test) {
|
|
57
|
-
const startTime = Date.now();
|
|
58
|
-
try {
|
|
59
|
-
const timeoutPromise = new Promise((_, reject) => {
|
|
60
|
-
setTimeout(() => reject(new Error('Test timeout')), test.timeout);
|
|
61
|
-
});
|
|
62
|
-
const passed = await Promise.race([test.run(), timeoutPromise]);
|
|
63
|
-
return {
|
|
64
|
-
name: test.name,
|
|
65
|
-
category: test.category,
|
|
66
|
-
passed,
|
|
67
|
-
duration: Date.now() - startTime,
|
|
68
|
-
};
|
|
69
|
-
}
|
|
70
|
-
catch (error) {
|
|
71
|
-
return {
|
|
72
|
-
name: test.name,
|
|
73
|
-
category: test.category,
|
|
74
|
-
passed: false,
|
|
75
|
-
duration: Date.now() - startTime,
|
|
76
|
-
error: error instanceof Error ? error.message : String(error),
|
|
77
|
-
};
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
/**
|
|
81
|
-
* Register default integration tests
|
|
82
|
-
*/
|
|
83
|
-
registerDefaultTests() {
|
|
84
|
-
// Memory integration tests
|
|
85
|
-
this.tests.push({
|
|
86
|
-
name: 'memory-store-retrieve',
|
|
87
|
-
description: 'Store and retrieve a memory entry',
|
|
88
|
-
category: 'memory',
|
|
89
|
-
critical: true,
|
|
90
|
-
timeout: 5000,
|
|
91
|
-
run: async () => {
|
|
92
|
-
const { UnifiedMemoryService, HybridBackend } = await import('@swarmdo/memory');
|
|
93
|
-
// Create in-memory backend
|
|
94
|
-
const backend = new HybridBackend({
|
|
95
|
-
sqlite: { databasePath: ':memory:', walMode: false, optimize: true, defaultNamespace: 'test', maxEntries: 1000 },
|
|
96
|
-
agentdb: { dbPath: ':memory:' },
|
|
97
|
-
});
|
|
98
|
-
await backend.initialize();
|
|
99
|
-
const memory = new UnifiedMemoryService(backend);
|
|
100
|
-
await memory.initialize();
|
|
101
|
-
// Store entry
|
|
102
|
-
const stored = await memory.storeEntry({
|
|
103
|
-
key: 'test-key',
|
|
104
|
-
namespace: 'test',
|
|
105
|
-
content: 'Integration test content',
|
|
106
|
-
metadata: { test: true },
|
|
107
|
-
});
|
|
108
|
-
// Retrieve entry
|
|
109
|
-
const retrieved = await memory.get(stored.id);
|
|
110
|
-
await memory.shutdown();
|
|
111
|
-
return retrieved !== null && retrieved.content === 'Integration test content';
|
|
112
|
-
},
|
|
113
|
-
});
|
|
114
|
-
this.tests.push({
|
|
115
|
-
name: 'memory-search',
|
|
116
|
-
description: 'Search memory entries',
|
|
117
|
-
category: 'memory',
|
|
118
|
-
critical: true,
|
|
119
|
-
timeout: 10000,
|
|
120
|
-
run: async () => {
|
|
121
|
-
const { HybridBackend, UnifiedMemoryService } = await import('@swarmdo/memory');
|
|
122
|
-
const backend = new HybridBackend({
|
|
123
|
-
sqlite: { databasePath: ':memory:', walMode: false, optimize: true, defaultNamespace: 'test', maxEntries: 1000 },
|
|
124
|
-
agentdb: { dbPath: ':memory:' },
|
|
125
|
-
});
|
|
126
|
-
await backend.initialize();
|
|
127
|
-
const memory = new UnifiedMemoryService(backend);
|
|
128
|
-
await memory.initialize();
|
|
129
|
-
// Store entries
|
|
130
|
-
await memory.storeEntry({
|
|
131
|
-
key: 'js-entry',
|
|
132
|
-
namespace: 'test',
|
|
133
|
-
content: 'JavaScript is a programming language',
|
|
134
|
-
metadata: { topic: 'js' },
|
|
135
|
-
});
|
|
136
|
-
await memory.storeEntry({
|
|
137
|
-
key: 'python-entry',
|
|
138
|
-
namespace: 'test',
|
|
139
|
-
content: 'Python is used for data science',
|
|
140
|
-
metadata: { topic: 'python' },
|
|
141
|
-
});
|
|
142
|
-
// Search using a mock embedding vector (384 dimensions)
|
|
143
|
-
const mockEmbedding = new Float32Array(384).fill(0.1);
|
|
144
|
-
const results = await memory.search(mockEmbedding, { k: 10 });
|
|
145
|
-
await memory.shutdown();
|
|
146
|
-
return results.length >= 0; // Should work even if no semantic matches
|
|
147
|
-
},
|
|
148
|
-
});
|
|
149
|
-
// Event bus tests
|
|
150
|
-
this.tests.push({
|
|
151
|
-
name: 'event-bus-publish-subscribe',
|
|
152
|
-
description: 'Publish and subscribe to events',
|
|
153
|
-
category: 'events',
|
|
154
|
-
critical: true,
|
|
155
|
-
timeout: 5000,
|
|
156
|
-
run: async () => {
|
|
157
|
-
const { EventBus, createAgentSpawnedEvent } = await import('@swarmdo/shared');
|
|
158
|
-
const eventBus = new EventBus();
|
|
159
|
-
let received = false;
|
|
160
|
-
// Use a valid event type from the V3 system
|
|
161
|
-
eventBus.subscribe('agent:spawned', (event) => {
|
|
162
|
-
if (event.type === 'agent:spawned') {
|
|
163
|
-
received = true;
|
|
164
|
-
}
|
|
165
|
-
});
|
|
166
|
-
// Emit a properly formatted SwarmEvent
|
|
167
|
-
const event = createAgentSpawnedEvent('test-agent', 'worker', 'default', ['test']);
|
|
168
|
-
await eventBus.emit(event);
|
|
169
|
-
// Small delay for async processing
|
|
170
|
-
await new Promise((resolve) => setTimeout(resolve, 100));
|
|
171
|
-
return received;
|
|
172
|
-
},
|
|
173
|
-
});
|
|
174
|
-
this.tests.push({
|
|
175
|
-
name: 'event-bus-multiple-handlers',
|
|
176
|
-
description: 'Multiple handlers for same event',
|
|
177
|
-
category: 'events',
|
|
178
|
-
critical: false,
|
|
179
|
-
timeout: 5000,
|
|
180
|
-
run: async () => {
|
|
181
|
-
const { EventBus, createAgentSpawnedEvent } = await import('@swarmdo/shared');
|
|
182
|
-
const eventBus = new EventBus();
|
|
183
|
-
let count = 0;
|
|
184
|
-
eventBus.subscribe('agent:spawned', () => { count++; });
|
|
185
|
-
eventBus.subscribe('agent:spawned', () => { count++; });
|
|
186
|
-
eventBus.subscribe('agent:spawned', () => { count++; });
|
|
187
|
-
const event = createAgentSpawnedEvent('test-agent', 'worker', 'default', ['test']);
|
|
188
|
-
await eventBus.emit(event);
|
|
189
|
-
await new Promise((resolve) => setTimeout(resolve, 100));
|
|
190
|
-
return count === 3;
|
|
191
|
-
},
|
|
192
|
-
});
|
|
193
|
-
// Swarm tests
|
|
194
|
-
this.tests.push({
|
|
195
|
-
name: 'swarm-coordinator-init',
|
|
196
|
-
description: 'Initialize swarm coordinator',
|
|
197
|
-
category: 'swarm',
|
|
198
|
-
critical: true,
|
|
199
|
-
timeout: 10000,
|
|
200
|
-
run: async () => {
|
|
201
|
-
try {
|
|
202
|
-
const { UnifiedSwarmCoordinator } = await import('@swarmdo/swarm');
|
|
203
|
-
const coordinator = new UnifiedSwarmCoordinator({
|
|
204
|
-
topology: { type: 'hierarchical', maxAgents: 10 },
|
|
205
|
-
maxAgents: 10,
|
|
206
|
-
});
|
|
207
|
-
await coordinator.initialize();
|
|
208
|
-
const status = coordinator.getStatus();
|
|
209
|
-
await coordinator.shutdown();
|
|
210
|
-
// Check status has expected properties - includes running, initializing, paused, etc.
|
|
211
|
-
return status.status !== undefined;
|
|
212
|
-
}
|
|
213
|
-
catch (error) {
|
|
214
|
-
// Swarm may not be fully implemented yet
|
|
215
|
-
console.warn('Swarm coordinator test skipped:', error);
|
|
216
|
-
return true;
|
|
217
|
-
}
|
|
218
|
-
},
|
|
219
|
-
});
|
|
220
|
-
// Hooks tests
|
|
221
|
-
this.tests.push({
|
|
222
|
-
name: 'hooks-registry',
|
|
223
|
-
description: 'Register hooks',
|
|
224
|
-
category: 'hooks',
|
|
225
|
-
critical: true,
|
|
226
|
-
timeout: 5000,
|
|
227
|
-
run: async () => {
|
|
228
|
-
try {
|
|
229
|
-
const { HookRegistry, HookPriority } = await import('@swarmdo/shared');
|
|
230
|
-
const registry = new HookRegistry();
|
|
231
|
-
// Register a hook
|
|
232
|
-
const hookId = registry.register('pre-edit', async () => {
|
|
233
|
-
return { success: true };
|
|
234
|
-
}, HookPriority.Normal);
|
|
235
|
-
// Verify hook was registered
|
|
236
|
-
const hook = registry.getHook(hookId);
|
|
237
|
-
const handlers = registry.getHandlers('pre-edit');
|
|
238
|
-
return hook !== undefined && handlers.length > 0;
|
|
239
|
-
}
|
|
240
|
-
catch (error) {
|
|
241
|
-
// Hooks may not be fully implemented yet
|
|
242
|
-
console.warn('Hooks test skipped:', error);
|
|
243
|
-
return true;
|
|
244
|
-
}
|
|
245
|
-
},
|
|
246
|
-
});
|
|
247
|
-
// MCP tests
|
|
248
|
-
this.tests.push({
|
|
249
|
-
name: 'mcp-types-available',
|
|
250
|
-
description: 'MCP types are available',
|
|
251
|
-
category: 'mcp',
|
|
252
|
-
critical: true,
|
|
253
|
-
timeout: 5000,
|
|
254
|
-
run: async () => {
|
|
255
|
-
try {
|
|
256
|
-
// MCP types and utilities should be available from shared
|
|
257
|
-
const shared = await import('@swarmdo/shared');
|
|
258
|
-
// Verify key exports exist
|
|
259
|
-
return (typeof shared.EventBus === 'function' &&
|
|
260
|
-
typeof shared.generateSecureId === 'function');
|
|
261
|
-
}
|
|
262
|
-
catch (error) {
|
|
263
|
-
// MCP may use different export
|
|
264
|
-
console.warn('MCP test skipped:', error);
|
|
265
|
-
return true;
|
|
266
|
-
}
|
|
267
|
-
},
|
|
268
|
-
});
|
|
269
|
-
// Module import tests
|
|
270
|
-
this.tests.push({
|
|
271
|
-
name: 'shared-module-import',
|
|
272
|
-
description: 'Shared module imports correctly',
|
|
273
|
-
category: 'mcp',
|
|
274
|
-
critical: true,
|
|
275
|
-
timeout: 5000,
|
|
276
|
-
run: async () => {
|
|
277
|
-
try {
|
|
278
|
-
const shared = await import('@swarmdo/shared');
|
|
279
|
-
return (typeof shared.EventBus === 'function' &&
|
|
280
|
-
typeof shared.generateSecureId === 'function');
|
|
281
|
-
}
|
|
282
|
-
catch {
|
|
283
|
-
return false;
|
|
284
|
-
}
|
|
285
|
-
},
|
|
286
|
-
});
|
|
287
|
-
this.tests.push({
|
|
288
|
-
name: 'memory-module-import',
|
|
289
|
-
description: 'Memory module imports correctly',
|
|
290
|
-
category: 'memory',
|
|
291
|
-
critical: true,
|
|
292
|
-
timeout: 5000,
|
|
293
|
-
run: async () => {
|
|
294
|
-
try {
|
|
295
|
-
const memory = await import('@swarmdo/memory');
|
|
296
|
-
return (typeof memory.UnifiedMemoryService === 'function' ||
|
|
297
|
-
typeof memory.HybridBackend === 'function');
|
|
298
|
-
}
|
|
299
|
-
catch {
|
|
300
|
-
return false;
|
|
301
|
-
}
|
|
302
|
-
},
|
|
303
|
-
});
|
|
304
|
-
this.tests.push({
|
|
305
|
-
name: 'swarm-module-import',
|
|
306
|
-
description: 'Swarm module imports correctly',
|
|
307
|
-
category: 'swarm',
|
|
308
|
-
critical: true,
|
|
309
|
-
timeout: 5000,
|
|
310
|
-
run: async () => {
|
|
311
|
-
try {
|
|
312
|
-
const swarm = await import('@swarmdo/swarm');
|
|
313
|
-
return typeof swarm.UnifiedSwarmCoordinator === 'function';
|
|
314
|
-
}
|
|
315
|
-
catch {
|
|
316
|
-
return false;
|
|
317
|
-
}
|
|
318
|
-
},
|
|
319
|
-
});
|
|
320
|
-
}
|
|
321
|
-
/**
|
|
322
|
-
* Add a custom test
|
|
323
|
-
*/
|
|
324
|
-
addTest(test) {
|
|
325
|
-
this.tests.push(test);
|
|
326
|
-
}
|
|
327
|
-
/**
|
|
328
|
-
* Get all registered tests
|
|
329
|
-
*/
|
|
330
|
-
getTests() {
|
|
331
|
-
return [...this.tests];
|
|
332
|
-
}
|
|
333
|
-
}
|
|
334
|
-
//# sourceMappingURL=integration-regression.js.map
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Performance Baseline System
|
|
3
|
-
*
|
|
4
|
-
* Captures and compares performance metrics to detect regressions.
|
|
5
|
-
*
|
|
6
|
-
* @module v3/testing/regression/performance-baseline
|
|
7
|
-
*/
|
|
8
|
-
/**
|
|
9
|
-
* Baseline metric definition
|
|
10
|
-
*/
|
|
11
|
-
export interface BaselineMetric {
|
|
12
|
-
name: string;
|
|
13
|
-
value: number;
|
|
14
|
-
unit: string;
|
|
15
|
-
category: 'latency' | 'throughput' | 'memory' | 'cpu' | 'startup';
|
|
16
|
-
timestamp: number;
|
|
17
|
-
metadata?: Record<string, unknown>;
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* Baseline comparison result
|
|
21
|
-
*/
|
|
22
|
-
export interface BaselineComparison {
|
|
23
|
-
metric: string;
|
|
24
|
-
baseline: number;
|
|
25
|
-
current: number;
|
|
26
|
-
unit: string;
|
|
27
|
-
degradation: number;
|
|
28
|
-
regression: boolean;
|
|
29
|
-
improvement: boolean;
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* Baseline configuration
|
|
33
|
-
*/
|
|
34
|
-
export interface BaselineConfig {
|
|
35
|
-
baselinePath: string;
|
|
36
|
-
performanceThreshold: number;
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* Stored baseline data
|
|
40
|
-
*/
|
|
41
|
-
interface BaselineData {
|
|
42
|
-
version: string;
|
|
43
|
-
capturedAt: number;
|
|
44
|
-
metrics: BaselineMetric[];
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* Performance Baseline Manager
|
|
48
|
-
*
|
|
49
|
-
* Manages performance baselines for regression detection.
|
|
50
|
-
*/
|
|
51
|
-
export declare class PerformanceBaseline {
|
|
52
|
-
private readonly baselinePath;
|
|
53
|
-
private readonly threshold;
|
|
54
|
-
private cachedBaseline;
|
|
55
|
-
constructor(config: BaselineConfig);
|
|
56
|
-
/**
|
|
57
|
-
* Capture current performance as baseline
|
|
58
|
-
*/
|
|
59
|
-
captureBaseline(): Promise<BaselineData>;
|
|
60
|
-
/**
|
|
61
|
-
* Compare current performance against baseline
|
|
62
|
-
*/
|
|
63
|
-
compare(): Promise<BaselineComparison[]>;
|
|
64
|
-
/**
|
|
65
|
-
* Measure current performance metrics
|
|
66
|
-
*/
|
|
67
|
-
private measureCurrentPerformance;
|
|
68
|
-
/**
|
|
69
|
-
* Simulate startup to measure initialization time
|
|
70
|
-
*/
|
|
71
|
-
private simulateStartup;
|
|
72
|
-
/**
|
|
73
|
-
* Measure operation latency
|
|
74
|
-
*/
|
|
75
|
-
private measureLatency;
|
|
76
|
-
/**
|
|
77
|
-
* Measure throughput
|
|
78
|
-
*/
|
|
79
|
-
private measureThroughput;
|
|
80
|
-
/**
|
|
81
|
-
* Benchmark event bus operations
|
|
82
|
-
*/
|
|
83
|
-
private benchmarkEventBus;
|
|
84
|
-
/**
|
|
85
|
-
* Benchmark memory operations
|
|
86
|
-
*/
|
|
87
|
-
private benchmarkMemoryOps;
|
|
88
|
-
/**
|
|
89
|
-
* Benchmark event throughput
|
|
90
|
-
*/
|
|
91
|
-
private benchmarkEventThroughput;
|
|
92
|
-
/**
|
|
93
|
-
* Benchmark memory throughput
|
|
94
|
-
*/
|
|
95
|
-
private benchmarkMemoryThroughput;
|
|
96
|
-
/**
|
|
97
|
-
* Load baseline from file
|
|
98
|
-
*/
|
|
99
|
-
private loadBaseline;
|
|
100
|
-
/**
|
|
101
|
-
* Save baseline to file
|
|
102
|
-
*/
|
|
103
|
-
private saveBaseline;
|
|
104
|
-
}
|
|
105
|
-
export {};
|
|
106
|
-
//# sourceMappingURL=performance-baseline.d.ts.map
|
|
@@ -1,268 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Performance Baseline System
|
|
3
|
-
*
|
|
4
|
-
* Captures and compares performance metrics to detect regressions.
|
|
5
|
-
*
|
|
6
|
-
* @module v3/testing/regression/performance-baseline
|
|
7
|
-
*/
|
|
8
|
-
import { readFile, writeFile, mkdir } from 'fs/promises';
|
|
9
|
-
import { join, dirname } from 'path';
|
|
10
|
-
/**
|
|
11
|
-
* Performance Baseline Manager
|
|
12
|
-
*
|
|
13
|
-
* Manages performance baselines for regression detection.
|
|
14
|
-
*/
|
|
15
|
-
export class PerformanceBaseline {
|
|
16
|
-
baselinePath;
|
|
17
|
-
threshold;
|
|
18
|
-
cachedBaseline = null;
|
|
19
|
-
constructor(config) {
|
|
20
|
-
this.baselinePath = join(config.baselinePath, 'performance.json');
|
|
21
|
-
this.threshold = config.performanceThreshold;
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Capture current performance as baseline
|
|
25
|
-
*/
|
|
26
|
-
async captureBaseline() {
|
|
27
|
-
const metrics = await this.measureCurrentPerformance();
|
|
28
|
-
const baseline = {
|
|
29
|
-
version: '1.0.0',
|
|
30
|
-
capturedAt: Date.now(),
|
|
31
|
-
metrics,
|
|
32
|
-
};
|
|
33
|
-
await this.saveBaseline(baseline);
|
|
34
|
-
this.cachedBaseline = baseline;
|
|
35
|
-
return baseline;
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* Compare current performance against baseline
|
|
39
|
-
*/
|
|
40
|
-
async compare() {
|
|
41
|
-
const baseline = await this.loadBaseline();
|
|
42
|
-
if (!baseline) {
|
|
43
|
-
console.warn('No baseline found. Capturing initial baseline...');
|
|
44
|
-
await this.captureBaseline();
|
|
45
|
-
return [];
|
|
46
|
-
}
|
|
47
|
-
const currentMetrics = await this.measureCurrentPerformance();
|
|
48
|
-
const comparisons = [];
|
|
49
|
-
for (const current of currentMetrics) {
|
|
50
|
-
const baselineMetric = baseline.metrics.find((m) => m.name === current.name);
|
|
51
|
-
if (!baselineMetric)
|
|
52
|
-
continue;
|
|
53
|
-
const isHigherBetter = current.category === 'throughput';
|
|
54
|
-
const diff = current.value - baselineMetric.value;
|
|
55
|
-
const percentChange = (diff / baselineMetric.value) * 100;
|
|
56
|
-
// For latency/memory, higher is worse. For throughput, lower is worse.
|
|
57
|
-
const degradation = isHigherBetter ? -percentChange : percentChange;
|
|
58
|
-
comparisons.push({
|
|
59
|
-
metric: current.name,
|
|
60
|
-
baseline: baselineMetric.value,
|
|
61
|
-
current: current.value,
|
|
62
|
-
unit: current.unit,
|
|
63
|
-
degradation,
|
|
64
|
-
regression: degradation > this.threshold,
|
|
65
|
-
improvement: degradation < -this.threshold,
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
return comparisons;
|
|
69
|
-
}
|
|
70
|
-
/**
|
|
71
|
-
* Measure current performance metrics
|
|
72
|
-
*/
|
|
73
|
-
async measureCurrentPerformance() {
|
|
74
|
-
const metrics = [];
|
|
75
|
-
const timestamp = Date.now();
|
|
76
|
-
// Memory metrics
|
|
77
|
-
const memUsage = process.memoryUsage();
|
|
78
|
-
metrics.push({
|
|
79
|
-
name: 'heap_used',
|
|
80
|
-
value: memUsage.heapUsed / 1024 / 1024,
|
|
81
|
-
unit: 'MB',
|
|
82
|
-
category: 'memory',
|
|
83
|
-
timestamp,
|
|
84
|
-
});
|
|
85
|
-
metrics.push({
|
|
86
|
-
name: 'heap_total',
|
|
87
|
-
value: memUsage.heapTotal / 1024 / 1024,
|
|
88
|
-
unit: 'MB',
|
|
89
|
-
category: 'memory',
|
|
90
|
-
timestamp,
|
|
91
|
-
});
|
|
92
|
-
metrics.push({
|
|
93
|
-
name: 'rss',
|
|
94
|
-
value: memUsage.rss / 1024 / 1024,
|
|
95
|
-
unit: 'MB',
|
|
96
|
-
category: 'memory',
|
|
97
|
-
timestamp,
|
|
98
|
-
});
|
|
99
|
-
// Startup time simulation
|
|
100
|
-
const startupStart = performance.now();
|
|
101
|
-
await this.simulateStartup();
|
|
102
|
-
const startupTime = performance.now() - startupStart;
|
|
103
|
-
metrics.push({
|
|
104
|
-
name: 'startup_time',
|
|
105
|
-
value: startupTime,
|
|
106
|
-
unit: 'ms',
|
|
107
|
-
category: 'startup',
|
|
108
|
-
timestamp,
|
|
109
|
-
});
|
|
110
|
-
// Latency benchmarks
|
|
111
|
-
const latencyMetrics = await this.measureLatency();
|
|
112
|
-
metrics.push(...latencyMetrics);
|
|
113
|
-
// Throughput benchmarks
|
|
114
|
-
const throughputMetrics = await this.measureThroughput();
|
|
115
|
-
metrics.push(...throughputMetrics);
|
|
116
|
-
return metrics;
|
|
117
|
-
}
|
|
118
|
-
/**
|
|
119
|
-
* Simulate startup to measure initialization time
|
|
120
|
-
*/
|
|
121
|
-
async simulateStartup() {
|
|
122
|
-
// Import key modules to simulate startup
|
|
123
|
-
await import('@swarmdo/shared');
|
|
124
|
-
await import('@swarmdo/memory');
|
|
125
|
-
}
|
|
126
|
-
/**
|
|
127
|
-
* Measure operation latency
|
|
128
|
-
*/
|
|
129
|
-
async measureLatency() {
|
|
130
|
-
const metrics = [];
|
|
131
|
-
const timestamp = Date.now();
|
|
132
|
-
// Event bus latency
|
|
133
|
-
const eventLatency = await this.benchmarkEventBus();
|
|
134
|
-
metrics.push({
|
|
135
|
-
name: 'event_bus_latency',
|
|
136
|
-
value: eventLatency,
|
|
137
|
-
unit: 'μs',
|
|
138
|
-
category: 'latency',
|
|
139
|
-
timestamp,
|
|
140
|
-
});
|
|
141
|
-
// Memory operation latency
|
|
142
|
-
const memLatency = await this.benchmarkMemoryOps();
|
|
143
|
-
metrics.push({
|
|
144
|
-
name: 'memory_op_latency',
|
|
145
|
-
value: memLatency,
|
|
146
|
-
unit: 'μs',
|
|
147
|
-
category: 'latency',
|
|
148
|
-
timestamp,
|
|
149
|
-
});
|
|
150
|
-
return metrics;
|
|
151
|
-
}
|
|
152
|
-
/**
|
|
153
|
-
* Measure throughput
|
|
154
|
-
*/
|
|
155
|
-
async measureThroughput() {
|
|
156
|
-
const metrics = [];
|
|
157
|
-
const timestamp = Date.now();
|
|
158
|
-
// Events per second
|
|
159
|
-
const eventsPerSec = await this.benchmarkEventThroughput();
|
|
160
|
-
metrics.push({
|
|
161
|
-
name: 'events_per_second',
|
|
162
|
-
value: eventsPerSec,
|
|
163
|
-
unit: 'ops/sec',
|
|
164
|
-
category: 'throughput',
|
|
165
|
-
timestamp,
|
|
166
|
-
});
|
|
167
|
-
// Memory operations per second
|
|
168
|
-
const memOpsPerSec = await this.benchmarkMemoryThroughput();
|
|
169
|
-
metrics.push({
|
|
170
|
-
name: 'memory_ops_per_second',
|
|
171
|
-
value: memOpsPerSec,
|
|
172
|
-
unit: 'ops/sec',
|
|
173
|
-
category: 'throughput',
|
|
174
|
-
timestamp,
|
|
175
|
-
});
|
|
176
|
-
return metrics;
|
|
177
|
-
}
|
|
178
|
-
/**
|
|
179
|
-
* Benchmark event bus operations
|
|
180
|
-
*/
|
|
181
|
-
async benchmarkEventBus() {
|
|
182
|
-
const { EventBus, createAgentSpawnedEvent } = await import('@swarmdo/shared');
|
|
183
|
-
const eventBus = new EventBus();
|
|
184
|
-
const iterations = 1000;
|
|
185
|
-
const start = performance.now();
|
|
186
|
-
for (let i = 0; i < iterations; i++) {
|
|
187
|
-
const event = createAgentSpawnedEvent(`bench-${i}`, 'worker', 'default', ['test']);
|
|
188
|
-
await eventBus.emit(event);
|
|
189
|
-
}
|
|
190
|
-
const elapsed = performance.now() - start;
|
|
191
|
-
return (elapsed / iterations) * 1000; // Convert to microseconds
|
|
192
|
-
}
|
|
193
|
-
/**
|
|
194
|
-
* Benchmark memory operations
|
|
195
|
-
*/
|
|
196
|
-
async benchmarkMemoryOps() {
|
|
197
|
-
// Simulate memory operations with a simple Map
|
|
198
|
-
const map = new Map();
|
|
199
|
-
const iterations = 10000;
|
|
200
|
-
const start = performance.now();
|
|
201
|
-
for (let i = 0; i < iterations; i++) {
|
|
202
|
-
map.set(`key-${i}`, { data: `value-${i}`, timestamp: Date.now() });
|
|
203
|
-
}
|
|
204
|
-
for (let i = 0; i < iterations; i++) {
|
|
205
|
-
map.get(`key-${i}`);
|
|
206
|
-
}
|
|
207
|
-
const elapsed = performance.now() - start;
|
|
208
|
-
return (elapsed / (iterations * 2)) * 1000; // Convert to microseconds
|
|
209
|
-
}
|
|
210
|
-
/**
|
|
211
|
-
* Benchmark event throughput
|
|
212
|
-
*/
|
|
213
|
-
async benchmarkEventThroughput() {
|
|
214
|
-
const { EventBus } = await import('@swarmdo/shared');
|
|
215
|
-
const eventBus = new EventBus();
|
|
216
|
-
let count = 0;
|
|
217
|
-
eventBus.subscribe('agent:spawned', () => { count++; });
|
|
218
|
-
const { createAgentSpawnedEvent } = await import('@swarmdo/shared');
|
|
219
|
-
const duration = 1000; // 1 second
|
|
220
|
-
const start = Date.now();
|
|
221
|
-
while (Date.now() - start < duration) {
|
|
222
|
-
const event = createAgentSpawnedEvent('bench-agent', 'worker', 'default', ['test']);
|
|
223
|
-
await eventBus.emit(event);
|
|
224
|
-
}
|
|
225
|
-
return count;
|
|
226
|
-
}
|
|
227
|
-
/**
|
|
228
|
-
* Benchmark memory throughput
|
|
229
|
-
*/
|
|
230
|
-
async benchmarkMemoryThroughput() {
|
|
231
|
-
const map = new Map();
|
|
232
|
-
let count = 0;
|
|
233
|
-
const duration = 1000; // 1 second
|
|
234
|
-
const start = Date.now();
|
|
235
|
-
while (Date.now() - start < duration) {
|
|
236
|
-
const key = `key-${count}`;
|
|
237
|
-
map.set(key, { data: count, timestamp: Date.now() });
|
|
238
|
-
map.get(key);
|
|
239
|
-
map.delete(key);
|
|
240
|
-
count++;
|
|
241
|
-
}
|
|
242
|
-
return count;
|
|
243
|
-
}
|
|
244
|
-
/**
|
|
245
|
-
* Load baseline from file
|
|
246
|
-
*/
|
|
247
|
-
async loadBaseline() {
|
|
248
|
-
if (this.cachedBaseline) {
|
|
249
|
-
return this.cachedBaseline;
|
|
250
|
-
}
|
|
251
|
-
try {
|
|
252
|
-
const content = await readFile(this.baselinePath, 'utf-8');
|
|
253
|
-
this.cachedBaseline = JSON.parse(content);
|
|
254
|
-
return this.cachedBaseline;
|
|
255
|
-
}
|
|
256
|
-
catch {
|
|
257
|
-
return null;
|
|
258
|
-
}
|
|
259
|
-
}
|
|
260
|
-
/**
|
|
261
|
-
* Save baseline to file
|
|
262
|
-
*/
|
|
263
|
-
async saveBaseline(baseline) {
|
|
264
|
-
await mkdir(dirname(this.baselinePath), { recursive: true });
|
|
265
|
-
await writeFile(this.baselinePath, JSON.stringify(baseline, null, 2));
|
|
266
|
-
}
|
|
267
|
-
}
|
|
268
|
-
//# sourceMappingURL=performance-baseline.js.map
|