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,67 +0,0 @@
|
|
|
1
|
-
import type { TelemetryReading } from '../entities/index.js';
|
|
2
|
-
export interface TelemetryServiceDeps {
|
|
3
|
-
queryVectors: (deviceId: string, vector: number[], k: number) => Promise<{
|
|
4
|
-
results: Array<{
|
|
5
|
-
id: number | string;
|
|
6
|
-
distance: number;
|
|
7
|
-
metadata?: Record<string, unknown>;
|
|
8
|
-
}>;
|
|
9
|
-
query_ms?: number;
|
|
10
|
-
}>;
|
|
11
|
-
ingestVectors: (deviceId: string, vectors: Array<{
|
|
12
|
-
values: number[];
|
|
13
|
-
metadata?: Record<string, unknown>;
|
|
14
|
-
}>) => Promise<{
|
|
15
|
-
ingested: number;
|
|
16
|
-
epoch?: number;
|
|
17
|
-
}>;
|
|
18
|
-
getStoreStatus: (deviceId: string) => Promise<{
|
|
19
|
-
total_vectors: number;
|
|
20
|
-
deleted_vectors: number;
|
|
21
|
-
dimension: number;
|
|
22
|
-
file_size_bytes?: number;
|
|
23
|
-
epoch?: number;
|
|
24
|
-
}>;
|
|
25
|
-
}
|
|
26
|
-
export interface StoreQueryResult {
|
|
27
|
-
deviceId: string;
|
|
28
|
-
matches: Array<{
|
|
29
|
-
id: number | string;
|
|
30
|
-
distance: number;
|
|
31
|
-
metadata?: Record<string, unknown>;
|
|
32
|
-
}>;
|
|
33
|
-
queryMs: number;
|
|
34
|
-
}
|
|
35
|
-
export interface IngestResult {
|
|
36
|
-
deviceId: string;
|
|
37
|
-
ingested: number;
|
|
38
|
-
epoch?: number;
|
|
39
|
-
}
|
|
40
|
-
export interface StoreHealthStatus {
|
|
41
|
-
deviceId: string;
|
|
42
|
-
totalVectors: number;
|
|
43
|
-
deletedVectors: number;
|
|
44
|
-
dimension: number;
|
|
45
|
-
fileSizeBytes: number;
|
|
46
|
-
/** Ratio of live vectors to total (1.0 = no tombstones). */
|
|
47
|
-
liveRatio: number;
|
|
48
|
-
epoch?: number;
|
|
49
|
-
}
|
|
50
|
-
export declare class TelemetryService {
|
|
51
|
-
private readonly deps;
|
|
52
|
-
constructor(deps: TelemetryServiceDeps);
|
|
53
|
-
/**
|
|
54
|
-
* Run a k-NN query against a device's vector store.
|
|
55
|
-
*/
|
|
56
|
-
queryDevice(deviceId: string, vector: number[], k: number): Promise<StoreQueryResult>;
|
|
57
|
-
/**
|
|
58
|
-
* Convert telemetry readings to vectors and ingest them into the device
|
|
59
|
-
* vector store.
|
|
60
|
-
*/
|
|
61
|
-
ingestTelemetry(deviceId: string, readings: TelemetryReading[]): Promise<IngestResult>;
|
|
62
|
-
/**
|
|
63
|
-
* Retrieve vector store health metrics for a device.
|
|
64
|
-
*/
|
|
65
|
-
getStoreHealth(deviceId: string): Promise<StoreHealthStatus>;
|
|
66
|
-
}
|
|
67
|
-
//# sourceMappingURL=telemetry-service.d.ts.map
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
// ---------------------------------------------------------------------------
|
|
2
|
-
// Service
|
|
3
|
-
// ---------------------------------------------------------------------------
|
|
4
|
-
export class TelemetryService {
|
|
5
|
-
deps;
|
|
6
|
-
constructor(deps) {
|
|
7
|
-
this.deps = deps;
|
|
8
|
-
}
|
|
9
|
-
/**
|
|
10
|
-
* Run a k-NN query against a device's vector store.
|
|
11
|
-
*/
|
|
12
|
-
async queryDevice(deviceId, vector, k) {
|
|
13
|
-
const raw = await this.deps.queryVectors(deviceId, vector, k);
|
|
14
|
-
return {
|
|
15
|
-
deviceId,
|
|
16
|
-
matches: raw.results,
|
|
17
|
-
queryMs: raw.query_ms ?? 0,
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Convert telemetry readings to vectors and ingest them into the device
|
|
22
|
-
* vector store.
|
|
23
|
-
*/
|
|
24
|
-
async ingestTelemetry(deviceId, readings) {
|
|
25
|
-
const vectors = readings.map((r) => ({
|
|
26
|
-
values: r.vector,
|
|
27
|
-
metadata: {
|
|
28
|
-
readingId: r.readingId,
|
|
29
|
-
timestamp: r.timestamp.toISOString(),
|
|
30
|
-
anomalyScore: r.anomalyScore,
|
|
31
|
-
...r.metadata,
|
|
32
|
-
},
|
|
33
|
-
}));
|
|
34
|
-
const result = await this.deps.ingestVectors(deviceId, vectors);
|
|
35
|
-
return {
|
|
36
|
-
deviceId,
|
|
37
|
-
ingested: result.ingested,
|
|
38
|
-
epoch: result.epoch,
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* Retrieve vector store health metrics for a device.
|
|
43
|
-
*/
|
|
44
|
-
async getStoreHealth(deviceId) {
|
|
45
|
-
const raw = await this.deps.getStoreStatus(deviceId);
|
|
46
|
-
const live = raw.total_vectors - raw.deleted_vectors;
|
|
47
|
-
return {
|
|
48
|
-
deviceId,
|
|
49
|
-
totalVectors: raw.total_vectors,
|
|
50
|
-
deletedVectors: raw.deleted_vectors,
|
|
51
|
-
dimension: raw.dimension,
|
|
52
|
-
fileSizeBytes: raw.file_size_bytes ?? 0,
|
|
53
|
-
liveRatio: raw.total_vectors > 0 ? live / raw.total_vectors : 1.0,
|
|
54
|
-
epoch: raw.epoch,
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
//# sourceMappingURL=telemetry-service.js.map
|
package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/witness-verification-service.d.ts
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
export interface WitnessEntry {
|
|
2
|
-
epoch: number;
|
|
3
|
-
action?: string;
|
|
4
|
-
signature?: string;
|
|
5
|
-
timestamp?: string;
|
|
6
|
-
hash?: string;
|
|
7
|
-
previous_hash?: string;
|
|
8
|
-
}
|
|
9
|
-
export interface WitnessGap {
|
|
10
|
-
deviceId: string;
|
|
11
|
-
fromEpoch: number;
|
|
12
|
-
toEpoch: number;
|
|
13
|
-
missingCount: number;
|
|
14
|
-
}
|
|
15
|
-
export interface WitnessVerificationResult {
|
|
16
|
-
deviceId: string;
|
|
17
|
-
chainLength: number;
|
|
18
|
-
verified: boolean;
|
|
19
|
-
gaps: WitnessGap[];
|
|
20
|
-
headEpoch: number;
|
|
21
|
-
headHash: string;
|
|
22
|
-
integrityScore: number;
|
|
23
|
-
}
|
|
24
|
-
export interface WitnessVerificationDeps {
|
|
25
|
-
getWitnessChain: (deviceId: string) => Promise<{
|
|
26
|
-
length?: number;
|
|
27
|
-
head?: string;
|
|
28
|
-
entries?: Array<{
|
|
29
|
-
epoch: number;
|
|
30
|
-
action?: string;
|
|
31
|
-
signature?: string;
|
|
32
|
-
timestamp?: string;
|
|
33
|
-
hash?: string;
|
|
34
|
-
previous_hash?: string;
|
|
35
|
-
}>;
|
|
36
|
-
}>;
|
|
37
|
-
}
|
|
38
|
-
export declare class WitnessVerificationService {
|
|
39
|
-
private readonly deps;
|
|
40
|
-
constructor(deps: WitnessVerificationDeps);
|
|
41
|
-
verifyChain(deviceId: string): Promise<WitnessVerificationResult>;
|
|
42
|
-
private detectGaps;
|
|
43
|
-
private verifyHashChain;
|
|
44
|
-
}
|
|
45
|
-
//# sourceMappingURL=witness-verification-service.d.ts.map
|
package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/witness-verification-service.js
DELETED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
export class WitnessVerificationService {
|
|
2
|
-
deps;
|
|
3
|
-
constructor(deps) {
|
|
4
|
-
this.deps = deps;
|
|
5
|
-
}
|
|
6
|
-
async verifyChain(deviceId) {
|
|
7
|
-
const chain = await this.deps.getWitnessChain(deviceId);
|
|
8
|
-
const entries = chain.entries ?? [];
|
|
9
|
-
const chainLength = chain.length ?? entries.length ?? 0;
|
|
10
|
-
if (entries.length === 0) {
|
|
11
|
-
return {
|
|
12
|
-
deviceId,
|
|
13
|
-
chainLength,
|
|
14
|
-
verified: true,
|
|
15
|
-
gaps: [],
|
|
16
|
-
headEpoch: 0,
|
|
17
|
-
headHash: chain.head ?? '',
|
|
18
|
-
integrityScore: chainLength > 0 ? 0.5 : 1.0,
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
const sorted = [...entries].sort((a, b) => a.epoch - b.epoch);
|
|
22
|
-
const gaps = this.detectGaps(deviceId, sorted);
|
|
23
|
-
const hashValid = this.verifyHashChain(sorted);
|
|
24
|
-
const gapRatio = gaps.length > 0
|
|
25
|
-
? gaps.reduce((sum, g) => sum + g.missingCount, 0) / chainLength
|
|
26
|
-
: 0;
|
|
27
|
-
const integrityScore = Math.max(0, 1 - gapRatio) * (hashValid ? 1 : 0.5);
|
|
28
|
-
return {
|
|
29
|
-
deviceId,
|
|
30
|
-
chainLength,
|
|
31
|
-
verified: gaps.length === 0 && hashValid,
|
|
32
|
-
gaps,
|
|
33
|
-
headEpoch: sorted[sorted.length - 1].epoch,
|
|
34
|
-
headHash: chain.head ?? sorted[sorted.length - 1].hash ?? '',
|
|
35
|
-
integrityScore,
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
detectGaps(deviceId, sorted) {
|
|
39
|
-
const gaps = [];
|
|
40
|
-
for (let i = 1; i < sorted.length; i++) {
|
|
41
|
-
const expected = sorted[i - 1].epoch + 1;
|
|
42
|
-
const actual = sorted[i].epoch;
|
|
43
|
-
if (actual > expected) {
|
|
44
|
-
gaps.push({
|
|
45
|
-
deviceId,
|
|
46
|
-
fromEpoch: sorted[i - 1].epoch,
|
|
47
|
-
toEpoch: actual,
|
|
48
|
-
missingCount: actual - expected,
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
return gaps;
|
|
53
|
-
}
|
|
54
|
-
verifyHashChain(sorted) {
|
|
55
|
-
for (let i = 1; i < sorted.length; i++) {
|
|
56
|
-
if (sorted[i].previous_hash && sorted[i - 1].hash && sorted[i].previous_hash !== sorted[i - 1].hash) {
|
|
57
|
-
return false;
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
return true;
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
//# sourceMappingURL=witness-verification-service.js.map
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
export { IoTCognitumPlugin } from './plugin.js';
|
|
2
|
-
export { IoTCoordinator } from './application/iot-coordinator.js';
|
|
3
|
-
export type { IoTCoordinatorConfig, IoTCoordinatorCallbacks } from './application/iot-coordinator.js';
|
|
4
|
-
export { SeedClientFactory } from './infrastructure/seed-client-factory.js';
|
|
5
|
-
export type { SeedClientFactoryConfig } from './infrastructure/seed-client-factory.js';
|
|
6
|
-
export { HealthProbeWorker } from './workers/health-probe-worker.js';
|
|
7
|
-
export type { HealthProbeConfig } from './workers/health-probe-worker.js';
|
|
8
|
-
export { TelemetryIngestWorker } from './workers/telemetry-ingest-worker.js';
|
|
9
|
-
export type { TelemetryIngestConfig } from './workers/telemetry-ingest-worker.js';
|
|
10
|
-
export { AnomalyScanWorker } from './workers/anomaly-scan-worker.js';
|
|
11
|
-
export type { AnomalyScanConfig } from './workers/anomaly-scan-worker.js';
|
|
12
|
-
export { MeshSyncWorker } from './workers/mesh-sync-worker.js';
|
|
13
|
-
export type { MeshSyncConfig } from './workers/mesh-sync-worker.js';
|
|
14
|
-
export { FirmwareWatchWorker } from './workers/firmware-watch-worker.js';
|
|
15
|
-
export type { FirmwareWatchConfig } from './workers/firmware-watch-worker.js';
|
|
16
|
-
export { WitnessAuditWorker } from './workers/witness-audit-worker.js';
|
|
17
|
-
export type { WitnessAuditConfig } from './workers/witness-audit-worker.js';
|
|
18
|
-
export * from './domain/entities/index.js';
|
|
19
|
-
export * from './domain/services/index.js';
|
|
20
|
-
export * from './domain/repositories/index.js';
|
|
21
|
-
export { InMemoryDeviceRepository } from './infrastructure/in-memory-device-repository.js';
|
|
22
|
-
export { InMemoryTrustHistoryRepository } from './infrastructure/in-memory-trust-history-repository.js';
|
|
23
|
-
export { InMemoryFleetRepository } from './infrastructure/in-memory-fleet-repository.js';
|
|
24
|
-
export { AgentDBTelemetryRepository } from './infrastructure/agentdb-telemetry-repository.js';
|
|
25
|
-
export type { AgentDBTelemetryConfig, AgentDBClient } from './infrastructure/agentdb-telemetry-repository.js';
|
|
26
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
export { IoTCognitumPlugin } from './plugin.js';
|
|
2
|
-
export { IoTCoordinator } from './application/iot-coordinator.js';
|
|
3
|
-
export { SeedClientFactory } from './infrastructure/seed-client-factory.js';
|
|
4
|
-
export { HealthProbeWorker } from './workers/health-probe-worker.js';
|
|
5
|
-
export { TelemetryIngestWorker } from './workers/telemetry-ingest-worker.js';
|
|
6
|
-
export { AnomalyScanWorker } from './workers/anomaly-scan-worker.js';
|
|
7
|
-
export { MeshSyncWorker } from './workers/mesh-sync-worker.js';
|
|
8
|
-
export { FirmwareWatchWorker } from './workers/firmware-watch-worker.js';
|
|
9
|
-
export { WitnessAuditWorker } from './workers/witness-audit-worker.js';
|
|
10
|
-
export * from './domain/entities/index.js';
|
|
11
|
-
export * from './domain/services/index.js';
|
|
12
|
-
export * from './domain/repositories/index.js';
|
|
13
|
-
export { InMemoryDeviceRepository } from './infrastructure/in-memory-device-repository.js';
|
|
14
|
-
export { InMemoryTrustHistoryRepository } from './infrastructure/in-memory-trust-history-repository.js';
|
|
15
|
-
export { InMemoryFleetRepository } from './infrastructure/in-memory-fleet-repository.js';
|
|
16
|
-
export { AgentDBTelemetryRepository } from './infrastructure/agentdb-telemetry-repository.js';
|
|
17
|
-
//# sourceMappingURL=index.js.map
|
package/v3/@swarmdo/plugin-iot-cognitum/dist/infrastructure/agentdb-telemetry-repository.d.ts
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import type { TelemetryReading, AnomalyDetection } from '../domain/entities/telemetry.js';
|
|
2
|
-
import type { TelemetryRepository } from '../domain/repositories/telemetry-repository.js';
|
|
3
|
-
export interface AgentDBTelemetryConfig {
|
|
4
|
-
namespace: string;
|
|
5
|
-
hnswM?: number;
|
|
6
|
-
hnswEfConstruction?: number;
|
|
7
|
-
hnswEfSearch?: number;
|
|
8
|
-
}
|
|
9
|
-
export interface AgentDBClient {
|
|
10
|
-
store(key: string, value: string, options?: {
|
|
11
|
-
namespace?: string;
|
|
12
|
-
tags?: string[];
|
|
13
|
-
}): Promise<void>;
|
|
14
|
-
search(query: string, options?: {
|
|
15
|
-
namespace?: string;
|
|
16
|
-
limit?: number;
|
|
17
|
-
}): Promise<Array<{
|
|
18
|
-
key: string;
|
|
19
|
-
value: string;
|
|
20
|
-
score: number;
|
|
21
|
-
}>>;
|
|
22
|
-
list(options?: {
|
|
23
|
-
namespace?: string;
|
|
24
|
-
limit?: number;
|
|
25
|
-
}): Promise<Array<{
|
|
26
|
-
key: string;
|
|
27
|
-
value: string;
|
|
28
|
-
}>>;
|
|
29
|
-
retrieve(key: string, options?: {
|
|
30
|
-
namespace?: string;
|
|
31
|
-
}): Promise<string | null>;
|
|
32
|
-
delete(key: string, options?: {
|
|
33
|
-
namespace?: string;
|
|
34
|
-
}): Promise<boolean>;
|
|
35
|
-
}
|
|
36
|
-
export declare class AgentDBTelemetryRepository implements TelemetryRepository {
|
|
37
|
-
private readonly config;
|
|
38
|
-
private readonly client;
|
|
39
|
-
constructor(client: AgentDBClient, config?: Partial<AgentDBTelemetryConfig>);
|
|
40
|
-
store(reading: TelemetryReading): Promise<void>;
|
|
41
|
-
storeBatch(readings: TelemetryReading[]): Promise<number>;
|
|
42
|
-
findByDevice(deviceId: string, limit?: number): Promise<TelemetryReading[]>;
|
|
43
|
-
searchSimilar(vector: number[], k: number, deviceId?: string): Promise<TelemetryReading[]>;
|
|
44
|
-
storeAnomaly(anomaly: AnomalyDetection): Promise<void>;
|
|
45
|
-
findAnomalies(deviceId: string, limit?: number): Promise<AnomalyDetection[]>;
|
|
46
|
-
count(deviceId?: string): Promise<number>;
|
|
47
|
-
deleteByDevice(deviceId: string): Promise<number>;
|
|
48
|
-
private serializeReading;
|
|
49
|
-
private deserializeReading;
|
|
50
|
-
}
|
|
51
|
-
//# sourceMappingURL=agentdb-telemetry-repository.d.ts.map
|
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
export class AgentDBTelemetryRepository {
|
|
2
|
-
config;
|
|
3
|
-
client;
|
|
4
|
-
constructor(client, config) {
|
|
5
|
-
this.client = client;
|
|
6
|
-
this.config = {
|
|
7
|
-
namespace: config?.namespace ?? 'iot-telemetry',
|
|
8
|
-
hnswM: config?.hnswM ?? 16,
|
|
9
|
-
hnswEfConstruction: config?.hnswEfConstruction ?? 200,
|
|
10
|
-
hnswEfSearch: config?.hnswEfSearch ?? 50,
|
|
11
|
-
};
|
|
12
|
-
}
|
|
13
|
-
async store(reading) {
|
|
14
|
-
const key = `reading:${reading.deviceId}:${reading.readingId}`;
|
|
15
|
-
await this.client.store(key, JSON.stringify(this.serializeReading(reading)), {
|
|
16
|
-
namespace: this.config.namespace,
|
|
17
|
-
tags: [`device:${reading.deviceId}`, `fleet:${reading.fleetId}`],
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
async storeBatch(readings) {
|
|
21
|
-
let stored = 0;
|
|
22
|
-
for (const reading of readings) {
|
|
23
|
-
await this.store(reading);
|
|
24
|
-
stored++;
|
|
25
|
-
}
|
|
26
|
-
return stored;
|
|
27
|
-
}
|
|
28
|
-
async findByDevice(deviceId, limit = 100) {
|
|
29
|
-
const results = await this.client.search(`device:${deviceId}`, {
|
|
30
|
-
namespace: this.config.namespace,
|
|
31
|
-
limit,
|
|
32
|
-
});
|
|
33
|
-
return results
|
|
34
|
-
.map((r) => this.deserializeReading(r.value))
|
|
35
|
-
.filter((r) => r !== null);
|
|
36
|
-
}
|
|
37
|
-
async searchSimilar(vector, k, deviceId) {
|
|
38
|
-
const query = deviceId
|
|
39
|
-
? `vector:${vector.slice(0, 4).join(',')} device:${deviceId}`
|
|
40
|
-
: `vector:${vector.slice(0, 4).join(',')}`;
|
|
41
|
-
const results = await this.client.search(query, {
|
|
42
|
-
namespace: this.config.namespace,
|
|
43
|
-
limit: k,
|
|
44
|
-
});
|
|
45
|
-
return results
|
|
46
|
-
.map((r) => this.deserializeReading(r.value))
|
|
47
|
-
.filter((r) => r !== null);
|
|
48
|
-
}
|
|
49
|
-
async storeAnomaly(anomaly) {
|
|
50
|
-
const key = `anomaly:${anomaly.deviceId}:${anomaly.readingId}`;
|
|
51
|
-
await this.client.store(key, JSON.stringify(anomaly), {
|
|
52
|
-
namespace: `${this.config.namespace}-anomalies`,
|
|
53
|
-
tags: [`device:${anomaly.deviceId}`, `type:${anomaly.type}`, `action:${anomaly.suggestedAction}`],
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
async findAnomalies(deviceId, limit = 50) {
|
|
57
|
-
const results = await this.client.search(`device:${deviceId}`, {
|
|
58
|
-
namespace: `${this.config.namespace}-anomalies`,
|
|
59
|
-
limit,
|
|
60
|
-
});
|
|
61
|
-
return results
|
|
62
|
-
.map((r) => {
|
|
63
|
-
try {
|
|
64
|
-
return JSON.parse(r.value);
|
|
65
|
-
}
|
|
66
|
-
catch {
|
|
67
|
-
return null;
|
|
68
|
-
}
|
|
69
|
-
})
|
|
70
|
-
.filter((a) => a !== null);
|
|
71
|
-
}
|
|
72
|
-
async count(deviceId) {
|
|
73
|
-
const query = deviceId ? `device:${deviceId}` : '*';
|
|
74
|
-
const results = await this.client.search(query, {
|
|
75
|
-
namespace: this.config.namespace,
|
|
76
|
-
limit: 10000,
|
|
77
|
-
});
|
|
78
|
-
return results.length;
|
|
79
|
-
}
|
|
80
|
-
async deleteByDevice(deviceId) {
|
|
81
|
-
const readings = await this.findByDevice(deviceId, 10000);
|
|
82
|
-
let deleted = 0;
|
|
83
|
-
for (const reading of readings) {
|
|
84
|
-
const key = `reading:${reading.deviceId}:${reading.readingId}`;
|
|
85
|
-
const ok = await this.client.delete(key, { namespace: this.config.namespace });
|
|
86
|
-
if (ok)
|
|
87
|
-
deleted++;
|
|
88
|
-
}
|
|
89
|
-
return deleted;
|
|
90
|
-
}
|
|
91
|
-
serializeReading(reading) {
|
|
92
|
-
return {
|
|
93
|
-
...reading,
|
|
94
|
-
timestamp: reading.timestamp.toISOString(),
|
|
95
|
-
};
|
|
96
|
-
}
|
|
97
|
-
deserializeReading(raw) {
|
|
98
|
-
try {
|
|
99
|
-
const parsed = JSON.parse(raw);
|
|
100
|
-
return {
|
|
101
|
-
...parsed,
|
|
102
|
-
timestamp: new Date(parsed['timestamp']),
|
|
103
|
-
};
|
|
104
|
-
}
|
|
105
|
-
catch {
|
|
106
|
-
return null;
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
//# sourceMappingURL=agentdb-telemetry-repository.js.map
|
package/v3/@swarmdo/plugin-iot-cognitum/dist/infrastructure/in-memory-device-repository.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { DeviceAgent } from '../domain/entities/index.js';
|
|
2
|
-
import type { DeviceRepository } from '../domain/repositories/index.js';
|
|
3
|
-
export declare class InMemoryDeviceRepository implements DeviceRepository {
|
|
4
|
-
private readonly devices;
|
|
5
|
-
save(device: DeviceAgent): Promise<void>;
|
|
6
|
-
findById(deviceId: string): Promise<DeviceAgent | null>;
|
|
7
|
-
findByFleet(fleetId: string): Promise<DeviceAgent[]>;
|
|
8
|
-
findByZone(zoneId: string): Promise<DeviceAgent[]>;
|
|
9
|
-
findAll(): Promise<DeviceAgent[]>;
|
|
10
|
-
delete(deviceId: string): Promise<boolean>;
|
|
11
|
-
count(): Promise<number>;
|
|
12
|
-
}
|
|
13
|
-
//# sourceMappingURL=in-memory-device-repository.d.ts.map
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
export class InMemoryDeviceRepository {
|
|
2
|
-
devices = new Map();
|
|
3
|
-
async save(device) {
|
|
4
|
-
this.devices.set(device.deviceId, device);
|
|
5
|
-
}
|
|
6
|
-
async findById(deviceId) {
|
|
7
|
-
return this.devices.get(deviceId) ?? null;
|
|
8
|
-
}
|
|
9
|
-
async findByFleet(fleetId) {
|
|
10
|
-
return [...this.devices.values()].filter((d) => d.fleetId === fleetId);
|
|
11
|
-
}
|
|
12
|
-
async findByZone(zoneId) {
|
|
13
|
-
return [...this.devices.values()].filter((d) => d.zoneId === zoneId);
|
|
14
|
-
}
|
|
15
|
-
async findAll() {
|
|
16
|
-
return [...this.devices.values()];
|
|
17
|
-
}
|
|
18
|
-
async delete(deviceId) {
|
|
19
|
-
return this.devices.delete(deviceId);
|
|
20
|
-
}
|
|
21
|
-
async count() {
|
|
22
|
-
return this.devices.size;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
//# sourceMappingURL=in-memory-device-repository.js.map
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { DeviceFleet } from '../domain/entities/index.js';
|
|
2
|
-
import type { FleetRepository } from '../domain/repositories/index.js';
|
|
3
|
-
export declare class InMemoryFleetRepository implements FleetRepository {
|
|
4
|
-
private readonly fleets;
|
|
5
|
-
save(fleet: DeviceFleet): Promise<void>;
|
|
6
|
-
findById(fleetId: string): Promise<DeviceFleet | undefined>;
|
|
7
|
-
findAll(): Promise<DeviceFleet[]>;
|
|
8
|
-
delete(fleetId: string): Promise<boolean>;
|
|
9
|
-
count(): Promise<number>;
|
|
10
|
-
}
|
|
11
|
-
//# sourceMappingURL=in-memory-fleet-repository.d.ts.map
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
export class InMemoryFleetRepository {
|
|
2
|
-
fleets = new Map();
|
|
3
|
-
async save(fleet) {
|
|
4
|
-
this.fleets.set(fleet.fleetId, { ...fleet, updatedAt: new Date() });
|
|
5
|
-
}
|
|
6
|
-
async findById(fleetId) {
|
|
7
|
-
return this.fleets.get(fleetId);
|
|
8
|
-
}
|
|
9
|
-
async findAll() {
|
|
10
|
-
return Array.from(this.fleets.values());
|
|
11
|
-
}
|
|
12
|
-
async delete(fleetId) {
|
|
13
|
-
return this.fleets.delete(fleetId);
|
|
14
|
-
}
|
|
15
|
-
async count() {
|
|
16
|
-
return this.fleets.size;
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
//# sourceMappingURL=in-memory-fleet-repository.js.map
|
package/v3/@swarmdo/plugin-iot-cognitum/dist/infrastructure/in-memory-trust-history-repository.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { DeviceTrustLevel } from '../domain/entities/index.js';
|
|
2
|
-
import type { TrustHistoryEntry, TrustHistoryRepository } from '../domain/repositories/index.js';
|
|
3
|
-
export declare class InMemoryTrustHistoryRepository implements TrustHistoryRepository {
|
|
4
|
-
private readonly entries;
|
|
5
|
-
append(entry: TrustHistoryEntry): Promise<void>;
|
|
6
|
-
findByDevice(deviceId: string, limit?: number): Promise<TrustHistoryEntry[]>;
|
|
7
|
-
findByLevel(level: DeviceTrustLevel): Promise<TrustHistoryEntry[]>;
|
|
8
|
-
deleteByDevice(deviceId: string): Promise<number>;
|
|
9
|
-
count(): Promise<number>;
|
|
10
|
-
}
|
|
11
|
-
//# sourceMappingURL=in-memory-trust-history-repository.d.ts.map
|
package/v3/@swarmdo/plugin-iot-cognitum/dist/infrastructure/in-memory-trust-history-repository.js
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
export class InMemoryTrustHistoryRepository {
|
|
2
|
-
entries = [];
|
|
3
|
-
async append(entry) {
|
|
4
|
-
this.entries.push(entry);
|
|
5
|
-
}
|
|
6
|
-
async findByDevice(deviceId, limit) {
|
|
7
|
-
const matches = this.entries.filter((e) => e.deviceId === deviceId);
|
|
8
|
-
return limit !== undefined ? matches.slice(-limit) : matches;
|
|
9
|
-
}
|
|
10
|
-
async findByLevel(level) {
|
|
11
|
-
return this.entries.filter((e) => e.newLevel === level);
|
|
12
|
-
}
|
|
13
|
-
async deleteByDevice(deviceId) {
|
|
14
|
-
let removed = 0;
|
|
15
|
-
for (let i = this.entries.length - 1; i >= 0; i--) {
|
|
16
|
-
if (this.entries[i].deviceId === deviceId) {
|
|
17
|
-
this.entries.splice(i, 1);
|
|
18
|
-
removed++;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
return removed;
|
|
22
|
-
}
|
|
23
|
-
async count() {
|
|
24
|
-
return this.entries.length;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
//# sourceMappingURL=in-memory-trust-history-repository.js.map
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
export { SeedClientFactory, type SeedClientFactoryConfig, } from './seed-client-factory.js';
|
|
2
|
-
export { InMemoryDeviceRepository } from './in-memory-device-repository.js';
|
|
3
|
-
export { InMemoryTrustHistoryRepository } from './in-memory-trust-history-repository.js';
|
|
4
|
-
export { InMemoryFleetRepository } from './in-memory-fleet-repository.js';
|
|
5
|
-
export { AgentDBTelemetryRepository, type AgentDBTelemetryConfig, type AgentDBClient, } from './agentdb-telemetry-repository.js';
|
|
6
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
export { SeedClientFactory, } from './seed-client-factory.js';
|
|
2
|
-
export { InMemoryDeviceRepository } from './in-memory-device-repository.js';
|
|
3
|
-
export { InMemoryTrustHistoryRepository } from './in-memory-trust-history-repository.js';
|
|
4
|
-
export { InMemoryFleetRepository } from './in-memory-fleet-repository.js';
|
|
5
|
-
export { AgentDBTelemetryRepository, } from './agentdb-telemetry-repository.js';
|
|
6
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { SeedClient } from '@cognitum-one/sdk/seed';
|
|
2
|
-
export interface SeedClientFactoryConfig {
|
|
3
|
-
/** TLS defaults applied to every client unless overridden per-call. */
|
|
4
|
-
defaultTls?: {
|
|
5
|
-
insecure?: boolean;
|
|
6
|
-
ca?: string;
|
|
7
|
-
};
|
|
8
|
-
/** Timeout defaults (ms). */
|
|
9
|
-
defaultTimeouts?: {
|
|
10
|
-
connect?: number;
|
|
11
|
-
read?: number;
|
|
12
|
-
total?: number;
|
|
13
|
-
};
|
|
14
|
-
/** Max retry attempts beyond the first. Default 2. */
|
|
15
|
-
defaultRetries?: number;
|
|
16
|
-
/** Active health-probe interval (ms). Disabled when undefined. */
|
|
17
|
-
healthInterval?: number;
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* Creates and manages {@link SeedClient} instances. This is the ONLY file
|
|
21
|
-
* that imports from `@cognitum-one/sdk/seed` directly — all other layers
|
|
22
|
-
* receive a `SeedClient` via dependency injection.
|
|
23
|
-
*/
|
|
24
|
-
export declare class SeedClientFactory {
|
|
25
|
-
private readonly config;
|
|
26
|
-
/** Keyed by the first endpoint string. */
|
|
27
|
-
private readonly clients;
|
|
28
|
-
constructor(config?: SeedClientFactoryConfig);
|
|
29
|
-
/**
|
|
30
|
-
* Build a {@link SeedClient} for `endpoint` (single URL or multi-peer
|
|
31
|
-
* array) with an optional pairing token. The client is cached by its
|
|
32
|
-
* first endpoint so subsequent calls with the same key return the same
|
|
33
|
-
* instance.
|
|
34
|
-
*/
|
|
35
|
-
createClient(endpoint: string | string[], pairingToken?: string): Promise<SeedClient>;
|
|
36
|
-
/** Retrieve a previously created client by its primary endpoint. */
|
|
37
|
-
getClient(endpoint: string): SeedClient | undefined;
|
|
38
|
-
/** Close every managed client and clear the internal map. */
|
|
39
|
-
closeAll(): Promise<void>;
|
|
40
|
-
}
|
|
41
|
-
//# sourceMappingURL=seed-client-factory.d.ts.map
|