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,43 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* V3 Swarmdo Test Setup
|
|
3
|
-
*
|
|
4
|
-
* London School TDD Global Configuration
|
|
5
|
-
* - Initializes mock infrastructure
|
|
6
|
-
* - Sets up global test utilities
|
|
7
|
-
* - Configures behavior verification helpers
|
|
8
|
-
*/
|
|
9
|
-
import { vi } from 'vitest';
|
|
10
|
-
export { vi, expect } from 'vitest';
|
|
11
|
-
export { createMock, createDeepMock, createSpyMock } from './helpers/create-mock.js';
|
|
12
|
-
export { createTestApplication } from './helpers/test-application.js';
|
|
13
|
-
export { createSwarmTestInstance } from './helpers/swarm-instance.js';
|
|
14
|
-
interface CustomMatchers<R = unknown> {
|
|
15
|
-
toHaveBeenCalledWithInteraction(expected: unknown[]): R;
|
|
16
|
-
toHaveBeenCalledBefore(other: ReturnType<typeof vi.fn>): R;
|
|
17
|
-
toHaveInteractionCount(expected: number): R;
|
|
18
|
-
toHaveBeenCalledWithPattern(pattern: Record<string, unknown>): R;
|
|
19
|
-
toHaveEventType(eventType: string): R;
|
|
20
|
-
toMeetV3PerformanceTargets(): R;
|
|
21
|
-
toBeValidTransition(from: string, allowedTransitions: Record<string, string[]>): R;
|
|
22
|
-
}
|
|
23
|
-
declare module 'vitest' {
|
|
24
|
-
interface Assertion<T> extends CustomMatchers<T> {
|
|
25
|
-
}
|
|
26
|
-
interface AsymmetricMatchersContaining extends CustomMatchers {
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* Test configuration constants
|
|
31
|
-
*/
|
|
32
|
-
export declare const TEST_CONFIG: {
|
|
33
|
-
readonly SECURITY_COVERAGE_TARGET: 0.95;
|
|
34
|
-
readonly FLASH_ATTENTION_SPEEDUP_MIN: 2.49;
|
|
35
|
-
readonly FLASH_ATTENTION_SPEEDUP_MAX: 7.47;
|
|
36
|
-
readonly AGENTDB_SEARCH_IMPROVEMENT_MIN: 150;
|
|
37
|
-
readonly AGENTDB_SEARCH_IMPROVEMENT_MAX: 12500;
|
|
38
|
-
readonly MEMORY_REDUCTION_TARGET: 0.5;
|
|
39
|
-
readonly ASYNC_TIMEOUT: 5000;
|
|
40
|
-
readonly INTEGRATION_TIMEOUT: 10000;
|
|
41
|
-
readonly ACCEPTANCE_TIMEOUT: 30000;
|
|
42
|
-
};
|
|
43
|
-
//# sourceMappingURL=setup.d.ts.map
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* V3 Swarmdo Test Setup
|
|
3
|
-
*
|
|
4
|
-
* London School TDD Global Configuration
|
|
5
|
-
* - Initializes mock infrastructure
|
|
6
|
-
* - Sets up global test utilities
|
|
7
|
-
* - Configures behavior verification helpers
|
|
8
|
-
*/
|
|
9
|
-
import { vi, beforeEach, afterEach, expect } from 'vitest';
|
|
10
|
-
// Re-export commonly used testing utilities
|
|
11
|
-
export { vi, expect } from 'vitest';
|
|
12
|
-
export { createMock, createDeepMock, createSpyMock } from './helpers/create-mock.js';
|
|
13
|
-
export { createTestApplication } from './helpers/test-application.js';
|
|
14
|
-
export { createSwarmTestInstance } from './helpers/swarm-instance.js';
|
|
15
|
-
// Custom matchers for London School testing
|
|
16
|
-
expect.extend({
|
|
17
|
-
/**
|
|
18
|
-
* Verify a mock was called with specific interaction pattern
|
|
19
|
-
*/
|
|
20
|
-
toHaveBeenCalledWithInteraction(received, expected) {
|
|
21
|
-
const pass = received.mock.calls.some((call) => JSON.stringify(call) === JSON.stringify(expected));
|
|
22
|
-
return {
|
|
23
|
-
pass,
|
|
24
|
-
message: () => pass
|
|
25
|
-
? `Expected mock not to have been called with ${JSON.stringify(expected)}`
|
|
26
|
-
: `Expected mock to have been called with ${JSON.stringify(expected)}, but was called with ${JSON.stringify(received.mock.calls)}`,
|
|
27
|
-
};
|
|
28
|
-
},
|
|
29
|
-
/**
|
|
30
|
-
* Verify mock call order for behavior testing
|
|
31
|
-
*/
|
|
32
|
-
toHaveBeenCalledBefore(received, other) {
|
|
33
|
-
const receivedCalls = received.mock.invocationCallOrder;
|
|
34
|
-
const otherCalls = other.mock.invocationCallOrder;
|
|
35
|
-
if (receivedCalls.length === 0 || otherCalls.length === 0) {
|
|
36
|
-
return {
|
|
37
|
-
pass: false,
|
|
38
|
-
message: () => 'Expected both mocks to have been called',
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
const pass = Math.min(...receivedCalls) < Math.min(...otherCalls);
|
|
42
|
-
return {
|
|
43
|
-
pass,
|
|
44
|
-
message: () => pass
|
|
45
|
-
? `Expected first mock not to have been called before second mock`
|
|
46
|
-
: `Expected first mock to have been called before second mock`,
|
|
47
|
-
};
|
|
48
|
-
},
|
|
49
|
-
/**
|
|
50
|
-
* Verify interaction count for behavior verification
|
|
51
|
-
*/
|
|
52
|
-
toHaveInteractionCount(received, expected) {
|
|
53
|
-
const actual = received.mock.calls.length;
|
|
54
|
-
const pass = actual === expected;
|
|
55
|
-
return {
|
|
56
|
-
pass,
|
|
57
|
-
message: () => pass
|
|
58
|
-
? `Expected mock not to have ${expected} interactions`
|
|
59
|
-
: `Expected mock to have ${expected} interactions, but had ${actual}`,
|
|
60
|
-
};
|
|
61
|
-
},
|
|
62
|
-
});
|
|
63
|
-
// Global setup - runs once before all tests
|
|
64
|
-
beforeEach(() => {
|
|
65
|
-
// Reset all mocks before each test (London School principle)
|
|
66
|
-
vi.clearAllMocks();
|
|
67
|
-
// Reset any timers
|
|
68
|
-
vi.useRealTimers();
|
|
69
|
-
});
|
|
70
|
-
afterEach(() => {
|
|
71
|
-
// Verify no unhandled mock calls (strict verification)
|
|
72
|
-
vi.restoreAllMocks();
|
|
73
|
-
});
|
|
74
|
-
/**
|
|
75
|
-
* Test configuration constants
|
|
76
|
-
*/
|
|
77
|
-
export const TEST_CONFIG = {
|
|
78
|
-
// Security test thresholds
|
|
79
|
-
SECURITY_COVERAGE_TARGET: 0.95,
|
|
80
|
-
// Performance test thresholds
|
|
81
|
-
FLASH_ATTENTION_SPEEDUP_MIN: 2.49,
|
|
82
|
-
FLASH_ATTENTION_SPEEDUP_MAX: 7.47,
|
|
83
|
-
AGENTDB_SEARCH_IMPROVEMENT_MIN: 150,
|
|
84
|
-
AGENTDB_SEARCH_IMPROVEMENT_MAX: 12500,
|
|
85
|
-
MEMORY_REDUCTION_TARGET: 0.50,
|
|
86
|
-
// Timeouts
|
|
87
|
-
ASYNC_TIMEOUT: 5000,
|
|
88
|
-
INTEGRATION_TIMEOUT: 10000,
|
|
89
|
-
ACCEPTANCE_TIMEOUT: 30000,
|
|
90
|
-
};
|
|
91
|
-
//# sourceMappingURL=setup.js.map
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* V2 API Compatibility Tests
|
|
3
|
-
*
|
|
4
|
-
* Tests that V2 import paths work via aliases and class interfaces match.
|
|
5
|
-
* Verifies method signatures and type compatibility.
|
|
6
|
-
*
|
|
7
|
-
* @module v3/testing/v2-compat/api-compat.test
|
|
8
|
-
*/
|
|
9
|
-
export {};
|
|
10
|
-
//# sourceMappingURL=api-compat.test.d.ts.map
|
|
@@ -1,433 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* V2 API Compatibility Tests
|
|
3
|
-
*
|
|
4
|
-
* Tests that V2 import paths work via aliases and class interfaces match.
|
|
5
|
-
* Verifies method signatures and type compatibility.
|
|
6
|
-
*
|
|
7
|
-
* @module v3/testing/v2-compat/api-compat.test
|
|
8
|
-
*/
|
|
9
|
-
import { describe, it, expect, beforeEach, afterEach, vi } from 'vitest';
|
|
10
|
-
import { V2CompatibilityValidator, V2_API_INTERFACES, } from './compatibility-validator.js';
|
|
11
|
-
/**
|
|
12
|
-
* V3 class implementations mapping
|
|
13
|
-
*/
|
|
14
|
-
const V3_CLASSES = {
|
|
15
|
-
'UnifiedSwarmCoordinator': {
|
|
16
|
-
name: 'UnifiedSwarmCoordinator',
|
|
17
|
-
v3Name: 'UnifiedSwarmCoordinator',
|
|
18
|
-
methods: [
|
|
19
|
-
{ name: 'initialize', signature: '(config?: SwarmConfig): Promise<void>', compatible: true },
|
|
20
|
-
{ name: 'spawn', signature: '(agentType: string, config?: AgentConfig): Promise<Agent>', v2Signature: '(type: string, config?: AgentConfig): Promise<Agent>', compatible: true },
|
|
21
|
-
{ name: 'addAgent', signature: '(agent: Agent): Promise<void>', compatible: true },
|
|
22
|
-
{ name: 'removeAgent', signature: '(agentId: string): Promise<void>', compatible: true },
|
|
23
|
-
{ name: 'broadcast', signature: '(message: Message): Promise<void>', compatible: true },
|
|
24
|
-
{ name: 'consensus', signature: '(proposal: Proposal): Promise<ConsensusResult>', compatible: true },
|
|
25
|
-
{ name: 'getStatus', signature: '(): Promise<SwarmStatus>', compatible: true },
|
|
26
|
-
{ name: 'shutdown', signature: '(): Promise<void>', compatible: true },
|
|
27
|
-
{ name: 'init', signature: '(topology: string): Promise<void>', compatible: true },
|
|
28
|
-
],
|
|
29
|
-
staticMethods: [],
|
|
30
|
-
properties: [
|
|
31
|
-
{ name: 'topology', type: 'string', readonly: true },
|
|
32
|
-
{ name: 'agentCount', type: 'number', readonly: true },
|
|
33
|
-
{ name: 'status', type: 'SwarmStatus', readonly: true },
|
|
34
|
-
],
|
|
35
|
-
},
|
|
36
|
-
'UnifiedMemoryService': {
|
|
37
|
-
name: 'UnifiedMemoryService',
|
|
38
|
-
v3Name: 'UnifiedMemoryService',
|
|
39
|
-
methods: [
|
|
40
|
-
{ name: 'store', signature: '(entry: MemoryEntry): Promise<string>', compatible: true },
|
|
41
|
-
{ name: 'search', signature: '(query: string, options?: SearchOptions): Promise<MemoryEntry[]>', v2Signature: '(search: string): Promise<MemoryEntry[]>', compatible: true },
|
|
42
|
-
{ name: 'query', signature: '(search: string): Promise<MemoryEntry[]>', compatible: true },
|
|
43
|
-
{ name: 'delete', signature: '(id: string): Promise<boolean>', compatible: true },
|
|
44
|
-
{ name: 'clear', signature: '(): Promise<void>', compatible: true },
|
|
45
|
-
{ name: 'getStats', signature: '(): Promise<MemoryStats>', compatible: true },
|
|
46
|
-
],
|
|
47
|
-
staticMethods: [],
|
|
48
|
-
properties: [
|
|
49
|
-
{ name: 'backend', type: 'string', readonly: true },
|
|
50
|
-
{ name: 'stats', type: 'MemoryStats', readonly: true },
|
|
51
|
-
],
|
|
52
|
-
},
|
|
53
|
-
'AgentLifecycleService': {
|
|
54
|
-
name: 'AgentLifecycleService',
|
|
55
|
-
v3Name: 'AgentLifecycleService',
|
|
56
|
-
methods: [
|
|
57
|
-
{ name: 'spawn', signature: '(config: AgentConfig): Promise<Agent>', compatible: true },
|
|
58
|
-
{ name: 'terminate', signature: '(id: string): Promise<void>', compatible: true },
|
|
59
|
-
{ name: 'list', signature: '(): Promise<Agent[]>', compatible: true },
|
|
60
|
-
{ name: 'getInfo', signature: '(id: string): Promise<AgentInfo>', compatible: true },
|
|
61
|
-
{ name: 'getStatus', signature: '(id: string): Promise<AgentStatus>', compatible: true },
|
|
62
|
-
],
|
|
63
|
-
staticMethods: [],
|
|
64
|
-
properties: [
|
|
65
|
-
{ name: 'agents', type: 'Map<string, Agent>', readonly: true },
|
|
66
|
-
],
|
|
67
|
-
},
|
|
68
|
-
'TaskExecutionService': {
|
|
69
|
-
name: 'TaskExecutionService',
|
|
70
|
-
v3Name: 'TaskExecutionService',
|
|
71
|
-
methods: [
|
|
72
|
-
{ name: 'create', signature: '(definition: TaskDefinition): Promise<Task>', compatible: true },
|
|
73
|
-
{ name: 'assign', signature: '(taskId: string, agentId: string): Promise<void>', compatible: true },
|
|
74
|
-
{ name: 'complete', signature: '(taskId: string, result?: TaskResult): Promise<void>', v2Signature: '(taskId: string, result?: any): Promise<void>', compatible: true },
|
|
75
|
-
{ name: 'getStatus', signature: '(taskId: string): Promise<TaskStatus>', compatible: true },
|
|
76
|
-
],
|
|
77
|
-
staticMethods: [],
|
|
78
|
-
properties: [
|
|
79
|
-
{ name: 'tasks', type: 'Map<string, Task>', readonly: true },
|
|
80
|
-
],
|
|
81
|
-
},
|
|
82
|
-
};
|
|
83
|
-
/**
|
|
84
|
-
* V2 to V3 import alias mapping
|
|
85
|
-
*/
|
|
86
|
-
const IMPORT_ALIASES = {
|
|
87
|
-
'swarmdo/hive-mind': '@swarmdo/swarm',
|
|
88
|
-
'swarmdo/swarm': '@swarmdo/swarm',
|
|
89
|
-
'swarmdo/memory': '@swarmdo/memory',
|
|
90
|
-
'swarmdo/agents': '@swarmdo/agent-lifecycle',
|
|
91
|
-
'swarmdo/tasks': '@swarmdo/task-execution',
|
|
92
|
-
'swarmdo/hooks': '@swarmdo/hooks',
|
|
93
|
-
'swarmdo/config': '@swarmdo/config',
|
|
94
|
-
'swarmdo': '@swarmdo/core',
|
|
95
|
-
};
|
|
96
|
-
/**
|
|
97
|
-
* V2 to V3 class name mapping
|
|
98
|
-
*/
|
|
99
|
-
const CLASS_ALIASES = {
|
|
100
|
-
'HiveMind': 'UnifiedSwarmCoordinator',
|
|
101
|
-
'SwarmCoordinator': 'UnifiedSwarmCoordinator',
|
|
102
|
-
'MemoryManager': 'UnifiedMemoryService',
|
|
103
|
-
'AgentManager': 'AgentLifecycleService',
|
|
104
|
-
'TaskOrchestrator': 'TaskExecutionService',
|
|
105
|
-
};
|
|
106
|
-
/**
|
|
107
|
-
* Create mock module registry
|
|
108
|
-
*/
|
|
109
|
-
function createMockModuleRegistry() {
|
|
110
|
-
return {
|
|
111
|
-
getClass: vi.fn().mockImplementation((name) => {
|
|
112
|
-
const v3Name = CLASS_ALIASES[name] || name;
|
|
113
|
-
return V3_CLASSES[v3Name] || null;
|
|
114
|
-
}),
|
|
115
|
-
getClasses: vi.fn().mockReturnValue(Object.keys(V3_CLASSES)),
|
|
116
|
-
resolveImport: vi.fn().mockImplementation((path) => {
|
|
117
|
-
return IMPORT_ALIASES[path] || null;
|
|
118
|
-
}),
|
|
119
|
-
getMethodSignature: vi.fn().mockImplementation((className, methodName) => {
|
|
120
|
-
const v3Name = CLASS_ALIASES[className] || className;
|
|
121
|
-
const classInfo = V3_CLASSES[v3Name];
|
|
122
|
-
if (!classInfo)
|
|
123
|
-
return null;
|
|
124
|
-
const method = classInfo.methods.find(m => m.name === methodName);
|
|
125
|
-
return method?.signature || null;
|
|
126
|
-
}),
|
|
127
|
-
checkTypeCompatibility: vi.fn().mockImplementation((v2Type, v3Type) => {
|
|
128
|
-
// Simplified type compatibility check
|
|
129
|
-
if (v2Type === v3Type)
|
|
130
|
-
return true;
|
|
131
|
-
if (v2Type === 'any')
|
|
132
|
-
return true;
|
|
133
|
-
if (v3Type.includes(v2Type))
|
|
134
|
-
return true;
|
|
135
|
-
return false;
|
|
136
|
-
}),
|
|
137
|
-
};
|
|
138
|
-
}
|
|
139
|
-
describe('V2 API Compatibility', () => {
|
|
140
|
-
let validator;
|
|
141
|
-
let mockRegistry;
|
|
142
|
-
beforeEach(() => {
|
|
143
|
-
mockRegistry = createMockModuleRegistry();
|
|
144
|
-
validator = new V2CompatibilityValidator({
|
|
145
|
-
verbose: false,
|
|
146
|
-
});
|
|
147
|
-
});
|
|
148
|
-
afterEach(() => {
|
|
149
|
-
vi.clearAllMocks();
|
|
150
|
-
});
|
|
151
|
-
describe('Import Path Aliases', () => {
|
|
152
|
-
it.each(Object.entries(IMPORT_ALIASES))('should resolve V2 import "%s" to V3 "%s"', (v2Path, v3Path) => {
|
|
153
|
-
const resolved = mockRegistry.resolveImport(v2Path);
|
|
154
|
-
expect(resolved).toBe(v3Path);
|
|
155
|
-
});
|
|
156
|
-
it('should resolve swarmdo/hive-mind to @swarmdo/swarm', () => {
|
|
157
|
-
const resolved = mockRegistry.resolveImport('swarmdo/hive-mind');
|
|
158
|
-
expect(resolved).toBe('@swarmdo/swarm');
|
|
159
|
-
});
|
|
160
|
-
it('should resolve swarmdo/memory to @swarmdo/memory', () => {
|
|
161
|
-
const resolved = mockRegistry.resolveImport('swarmdo/memory');
|
|
162
|
-
expect(resolved).toBe('@swarmdo/memory');
|
|
163
|
-
});
|
|
164
|
-
it('should return null for unknown import paths', () => {
|
|
165
|
-
const resolved = mockRegistry.resolveImport('unknown-package');
|
|
166
|
-
expect(resolved).toBeNull();
|
|
167
|
-
});
|
|
168
|
-
});
|
|
169
|
-
describe('Class Name Aliases', () => {
|
|
170
|
-
it.each(Object.entries(CLASS_ALIASES))('should map V2 class "%s" to V3 "%s"', (v2Name, v3Name) => {
|
|
171
|
-
const classInfo = mockRegistry.getClass(v2Name);
|
|
172
|
-
expect(classInfo).not.toBeNull();
|
|
173
|
-
expect(classInfo?.v3Name).toBe(v3Name);
|
|
174
|
-
});
|
|
175
|
-
it('should get HiveMind as UnifiedSwarmCoordinator', () => {
|
|
176
|
-
const classInfo = mockRegistry.getClass('HiveMind');
|
|
177
|
-
expect(classInfo).not.toBeNull();
|
|
178
|
-
expect(classInfo?.name).toBe('UnifiedSwarmCoordinator');
|
|
179
|
-
});
|
|
180
|
-
it('should get MemoryManager as UnifiedMemoryService', () => {
|
|
181
|
-
const classInfo = mockRegistry.getClass('MemoryManager');
|
|
182
|
-
expect(classInfo).not.toBeNull();
|
|
183
|
-
expect(classInfo?.name).toBe('UnifiedMemoryService');
|
|
184
|
-
});
|
|
185
|
-
});
|
|
186
|
-
describe('HiveMind Interface', () => {
|
|
187
|
-
const hiveMindInterface = V2_API_INTERFACES.find(i => i.name === 'HiveMind');
|
|
188
|
-
it('should have all HiveMind methods available', () => {
|
|
189
|
-
const classInfo = mockRegistry.getClass('HiveMind');
|
|
190
|
-
expect(classInfo).not.toBeNull();
|
|
191
|
-
for (const method of hiveMindInterface.methods) {
|
|
192
|
-
const hasMethod = classInfo.methods.some(m => m.name === method.name);
|
|
193
|
-
expect(hasMethod).toBe(true);
|
|
194
|
-
}
|
|
195
|
-
});
|
|
196
|
-
it('should have compatible initialize signature', () => {
|
|
197
|
-
const signature = mockRegistry.getMethodSignature('HiveMind', 'initialize');
|
|
198
|
-
expect(signature).toContain('Promise<void>');
|
|
199
|
-
});
|
|
200
|
-
it('should have compatible spawn signature', () => {
|
|
201
|
-
const signature = mockRegistry.getMethodSignature('HiveMind', 'spawn');
|
|
202
|
-
expect(signature).toContain('Promise<Agent>');
|
|
203
|
-
});
|
|
204
|
-
it('should have compatible getStatus signature', () => {
|
|
205
|
-
const signature = mockRegistry.getMethodSignature('HiveMind', 'getStatus');
|
|
206
|
-
expect(signature).toContain('Promise');
|
|
207
|
-
});
|
|
208
|
-
it('should have compatible shutdown signature', () => {
|
|
209
|
-
const signature = mockRegistry.getMethodSignature('HiveMind', 'shutdown');
|
|
210
|
-
expect(signature).toContain('Promise<void>');
|
|
211
|
-
});
|
|
212
|
-
});
|
|
213
|
-
describe('SwarmCoordinator Interface', () => {
|
|
214
|
-
const swarmInterface = V2_API_INTERFACES.find(i => i.name === 'SwarmCoordinator');
|
|
215
|
-
it('should have all SwarmCoordinator methods available', () => {
|
|
216
|
-
const classInfo = mockRegistry.getClass('SwarmCoordinator');
|
|
217
|
-
expect(classInfo).not.toBeNull();
|
|
218
|
-
for (const method of swarmInterface.methods) {
|
|
219
|
-
const hasMethod = classInfo.methods.some(m => m.name === method.name);
|
|
220
|
-
expect(hasMethod).toBe(true);
|
|
221
|
-
}
|
|
222
|
-
});
|
|
223
|
-
it('should have compatible init signature', () => {
|
|
224
|
-
const signature = mockRegistry.getMethodSignature('SwarmCoordinator', 'init');
|
|
225
|
-
expect(signature).toContain('topology');
|
|
226
|
-
expect(signature).toContain('Promise<void>');
|
|
227
|
-
});
|
|
228
|
-
it('should have compatible addAgent signature', () => {
|
|
229
|
-
const signature = mockRegistry.getMethodSignature('SwarmCoordinator', 'addAgent');
|
|
230
|
-
expect(signature).toContain('Agent');
|
|
231
|
-
expect(signature).toContain('Promise<void>');
|
|
232
|
-
});
|
|
233
|
-
it('should have compatible broadcast signature', () => {
|
|
234
|
-
const signature = mockRegistry.getMethodSignature('SwarmCoordinator', 'broadcast');
|
|
235
|
-
expect(signature).toContain('Message');
|
|
236
|
-
});
|
|
237
|
-
it('should have compatible consensus signature', () => {
|
|
238
|
-
const signature = mockRegistry.getMethodSignature('SwarmCoordinator', 'consensus');
|
|
239
|
-
expect(signature).toContain('Proposal');
|
|
240
|
-
expect(signature).toContain('ConsensusResult');
|
|
241
|
-
});
|
|
242
|
-
});
|
|
243
|
-
describe('MemoryManager Interface', () => {
|
|
244
|
-
const memoryInterface = V2_API_INTERFACES.find(i => i.name === 'MemoryManager');
|
|
245
|
-
it('should have all MemoryManager methods available', () => {
|
|
246
|
-
const classInfo = mockRegistry.getClass('MemoryManager');
|
|
247
|
-
expect(classInfo).not.toBeNull();
|
|
248
|
-
for (const method of memoryInterface.methods) {
|
|
249
|
-
const hasMethod = classInfo.methods.some(m => m.name === method.name || (method.name === 'query' && m.name === 'search'));
|
|
250
|
-
expect(hasMethod).toBe(true);
|
|
251
|
-
}
|
|
252
|
-
});
|
|
253
|
-
it('should have compatible store signature', () => {
|
|
254
|
-
const signature = mockRegistry.getMethodSignature('MemoryManager', 'store');
|
|
255
|
-
expect(signature).toContain('MemoryEntry');
|
|
256
|
-
expect(signature).toContain('Promise<string>');
|
|
257
|
-
});
|
|
258
|
-
it('should have query aliased to search', () => {
|
|
259
|
-
const classInfo = mockRegistry.getClass('MemoryManager');
|
|
260
|
-
const hasQuery = classInfo.methods.some(m => m.name === 'query');
|
|
261
|
-
const hasSearch = classInfo.methods.some(m => m.name === 'search');
|
|
262
|
-
expect(hasQuery || hasSearch).toBe(true);
|
|
263
|
-
});
|
|
264
|
-
it('should have compatible delete signature', () => {
|
|
265
|
-
const signature = mockRegistry.getMethodSignature('MemoryManager', 'delete');
|
|
266
|
-
expect(signature).toContain('Promise<boolean>');
|
|
267
|
-
});
|
|
268
|
-
it('should have compatible getStats signature', () => {
|
|
269
|
-
const signature = mockRegistry.getMethodSignature('MemoryManager', 'getStats');
|
|
270
|
-
expect(signature).toContain('MemoryStats');
|
|
271
|
-
});
|
|
272
|
-
});
|
|
273
|
-
describe('AgentManager Interface', () => {
|
|
274
|
-
const agentInterface = V2_API_INTERFACES.find(i => i.name === 'AgentManager');
|
|
275
|
-
it('should have all AgentManager methods available', () => {
|
|
276
|
-
const classInfo = mockRegistry.getClass('AgentManager');
|
|
277
|
-
expect(classInfo).not.toBeNull();
|
|
278
|
-
for (const method of agentInterface.methods) {
|
|
279
|
-
const hasMethod = classInfo.methods.some(m => m.name === method.name);
|
|
280
|
-
expect(hasMethod).toBe(true);
|
|
281
|
-
}
|
|
282
|
-
});
|
|
283
|
-
it('should have compatible spawn signature', () => {
|
|
284
|
-
const signature = mockRegistry.getMethodSignature('AgentManager', 'spawn');
|
|
285
|
-
expect(signature).toContain('AgentConfig');
|
|
286
|
-
expect(signature).toContain('Promise<Agent>');
|
|
287
|
-
});
|
|
288
|
-
it('should have compatible terminate signature', () => {
|
|
289
|
-
const signature = mockRegistry.getMethodSignature('AgentManager', 'terminate');
|
|
290
|
-
expect(signature).toContain('Promise<void>');
|
|
291
|
-
});
|
|
292
|
-
it('should have compatible list signature', () => {
|
|
293
|
-
const signature = mockRegistry.getMethodSignature('AgentManager', 'list');
|
|
294
|
-
expect(signature).toContain('Promise<Agent[]>');
|
|
295
|
-
});
|
|
296
|
-
it('should have compatible getInfo signature', () => {
|
|
297
|
-
const signature = mockRegistry.getMethodSignature('AgentManager', 'getInfo');
|
|
298
|
-
expect(signature).toContain('AgentInfo');
|
|
299
|
-
});
|
|
300
|
-
});
|
|
301
|
-
describe('TaskOrchestrator Interface', () => {
|
|
302
|
-
const taskInterface = V2_API_INTERFACES.find(i => i.name === 'TaskOrchestrator');
|
|
303
|
-
it('should have all TaskOrchestrator methods available', () => {
|
|
304
|
-
const classInfo = mockRegistry.getClass('TaskOrchestrator');
|
|
305
|
-
expect(classInfo).not.toBeNull();
|
|
306
|
-
for (const method of taskInterface.methods) {
|
|
307
|
-
const hasMethod = classInfo.methods.some(m => m.name === method.name);
|
|
308
|
-
expect(hasMethod).toBe(true);
|
|
309
|
-
}
|
|
310
|
-
});
|
|
311
|
-
it('should have compatible create signature', () => {
|
|
312
|
-
const signature = mockRegistry.getMethodSignature('TaskOrchestrator', 'create');
|
|
313
|
-
expect(signature).toContain('TaskDefinition');
|
|
314
|
-
expect(signature).toContain('Promise<Task>');
|
|
315
|
-
});
|
|
316
|
-
it('should have compatible assign signature', () => {
|
|
317
|
-
const signature = mockRegistry.getMethodSignature('TaskOrchestrator', 'assign');
|
|
318
|
-
expect(signature).toContain('taskId');
|
|
319
|
-
expect(signature).toContain('agentId');
|
|
320
|
-
});
|
|
321
|
-
it('should have compatible complete signature', () => {
|
|
322
|
-
const signature = mockRegistry.getMethodSignature('TaskOrchestrator', 'complete');
|
|
323
|
-
expect(signature).toContain('taskId');
|
|
324
|
-
expect(signature).toContain('Promise<void>');
|
|
325
|
-
});
|
|
326
|
-
it('should have compatible getStatus signature', () => {
|
|
327
|
-
const signature = mockRegistry.getMethodSignature('TaskOrchestrator', 'getStatus');
|
|
328
|
-
expect(signature).toContain('TaskStatus');
|
|
329
|
-
});
|
|
330
|
-
});
|
|
331
|
-
describe('Type Compatibility', () => {
|
|
332
|
-
it('should accept any type as compatible', () => {
|
|
333
|
-
const compatible = mockRegistry.checkTypeCompatibility('any', 'string');
|
|
334
|
-
expect(compatible).toBe(true);
|
|
335
|
-
});
|
|
336
|
-
it('should accept same types as compatible', () => {
|
|
337
|
-
const compatible = mockRegistry.checkTypeCompatibility('string', 'string');
|
|
338
|
-
expect(compatible).toBe(true);
|
|
339
|
-
});
|
|
340
|
-
it('should accept subtype compatibility', () => {
|
|
341
|
-
const compatible = mockRegistry.checkTypeCompatibility('Agent', 'Agent | null');
|
|
342
|
-
expect(compatible).toBe(true);
|
|
343
|
-
});
|
|
344
|
-
});
|
|
345
|
-
describe('Full API Validation', () => {
|
|
346
|
-
it('should pass full API validation', async () => {
|
|
347
|
-
const result = await validator.validateAPI();
|
|
348
|
-
expect(result.category).toBe('api');
|
|
349
|
-
expect(result.totalChecks).toBeGreaterThan(0);
|
|
350
|
-
expect(result.passedChecks).toBeGreaterThan(0);
|
|
351
|
-
});
|
|
352
|
-
it('should detect all V2 API interfaces', async () => {
|
|
353
|
-
const result = await validator.validateAPI();
|
|
354
|
-
const classChecks = result.checks.filter(c => c.name.startsWith('API Class:'));
|
|
355
|
-
expect(classChecks.length).toBeGreaterThanOrEqual(V2_API_INTERFACES.length);
|
|
356
|
-
});
|
|
357
|
-
it('should verify method signatures', async () => {
|
|
358
|
-
const result = await validator.validateAPI();
|
|
359
|
-
const methodChecks = result.checks.filter(c => c.name.includes('Method:'));
|
|
360
|
-
expect(methodChecks.length).toBeGreaterThan(0);
|
|
361
|
-
});
|
|
362
|
-
it('should provide migration paths', async () => {
|
|
363
|
-
const result = await validator.validateAPI();
|
|
364
|
-
const withMigration = result.checks.filter(c => c.migrationPath);
|
|
365
|
-
expect(withMigration.length).toBeGreaterThan(0);
|
|
366
|
-
});
|
|
367
|
-
it('should report minimal breaking changes', async () => {
|
|
368
|
-
const result = await validator.validateAPI();
|
|
369
|
-
// Most interfaces should be compatible
|
|
370
|
-
expect(result.breakingChanges).toBeLessThan(result.totalChecks * 0.2);
|
|
371
|
-
});
|
|
372
|
-
});
|
|
373
|
-
describe('Backward Compatible Usage Patterns', () => {
|
|
374
|
-
it('should support V2 HiveMind instantiation pattern', () => {
|
|
375
|
-
// V2 pattern: const hive = new HiveMind(config);
|
|
376
|
-
// V3 equivalent: const hive = new UnifiedSwarmCoordinator(config);
|
|
377
|
-
const classInfo = mockRegistry.getClass('HiveMind');
|
|
378
|
-
expect(classInfo).not.toBeNull();
|
|
379
|
-
expect(classInfo?.methods.some(m => m.name === 'initialize')).toBe(true);
|
|
380
|
-
});
|
|
381
|
-
it('should support V2 MemoryManager query pattern', () => {
|
|
382
|
-
// V2 pattern: const results = await memory.query('search term');
|
|
383
|
-
// V3 equivalent: const results = await memory.search('search term');
|
|
384
|
-
const classInfo = mockRegistry.getClass('MemoryManager');
|
|
385
|
-
const hasQueryOrSearch = classInfo?.methods.some(m => m.name === 'query' || m.name === 'search');
|
|
386
|
-
expect(hasQueryOrSearch).toBe(true);
|
|
387
|
-
});
|
|
388
|
-
it('should support V2 agent spawn pattern', () => {
|
|
389
|
-
// V2 pattern: const agent = await manager.spawn({ type: 'coder' });
|
|
390
|
-
// V3 equivalent: const agent = await lifecycle.spawn({ agentType: 'coder' });
|
|
391
|
-
const classInfo = mockRegistry.getClass('AgentManager');
|
|
392
|
-
expect(classInfo?.methods.some(m => m.name === 'spawn')).toBe(true);
|
|
393
|
-
});
|
|
394
|
-
});
|
|
395
|
-
});
|
|
396
|
-
describe('API Coverage', () => {
|
|
397
|
-
it('should define all core V2 API interfaces', () => {
|
|
398
|
-
const coreInterfaces = ['HiveMind', 'SwarmCoordinator', 'MemoryManager', 'AgentManager', 'TaskOrchestrator'];
|
|
399
|
-
for (const name of coreInterfaces) {
|
|
400
|
-
const iface = V2_API_INTERFACES.find(i => i.name === name);
|
|
401
|
-
expect(iface).toBeDefined();
|
|
402
|
-
}
|
|
403
|
-
});
|
|
404
|
-
it('should have V3 equivalents for all interfaces', () => {
|
|
405
|
-
for (const iface of V2_API_INTERFACES) {
|
|
406
|
-
expect(iface.v3Equivalent).toBeDefined();
|
|
407
|
-
expect(iface.v3Equivalent).not.toBe('');
|
|
408
|
-
}
|
|
409
|
-
});
|
|
410
|
-
it('should define methods for all interfaces', () => {
|
|
411
|
-
for (const iface of V2_API_INTERFACES) {
|
|
412
|
-
expect(iface.methods.length).toBeGreaterThan(0);
|
|
413
|
-
}
|
|
414
|
-
});
|
|
415
|
-
it('should define method signatures correctly', () => {
|
|
416
|
-
for (const iface of V2_API_INTERFACES) {
|
|
417
|
-
for (const method of iface.methods) {
|
|
418
|
-
expect(method.name).toBeDefined();
|
|
419
|
-
expect(method.signature).toBeDefined();
|
|
420
|
-
expect(method.signature).toContain(':');
|
|
421
|
-
}
|
|
422
|
-
}
|
|
423
|
-
});
|
|
424
|
-
it('should cover common method patterns', () => {
|
|
425
|
-
const allMethods = V2_API_INTERFACES.flatMap(i => i.methods.map(m => m.name));
|
|
426
|
-
expect(allMethods).toContain('initialize');
|
|
427
|
-
expect(allMethods).toContain('spawn');
|
|
428
|
-
expect(allMethods).toContain('store');
|
|
429
|
-
expect(allMethods).toContain('create');
|
|
430
|
-
expect(allMethods).toContain('getStatus');
|
|
431
|
-
});
|
|
432
|
-
});
|
|
433
|
-
//# sourceMappingURL=api-compat.test.js.map
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* V2 CLI Compatibility Tests
|
|
3
|
-
*
|
|
4
|
-
* Tests all 25 V2 CLI commands work via compatibility layer or native V3 equivalents.
|
|
5
|
-
* Verifies flag compatibility and output format compatibility.
|
|
6
|
-
*
|
|
7
|
-
* @module v3/testing/v2-compat/cli-compat.test
|
|
8
|
-
*/
|
|
9
|
-
export {};
|
|
10
|
-
//# sourceMappingURL=cli-compat.test.d.ts.map
|