swarmdo 1.4.8 → 1.5.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 +3 -1
- package/package.json +5 -3
- package/v3/@swarmdo/cli/dist/src/commands/hooks.js +26 -24
- package/v3/@swarmdo/cli/dist/src/commands/index.js +4 -0
- 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 +224 -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/config-lint/lint.js +11 -1
- 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,23 +0,0 @@
|
|
|
1
|
-
import type { ClaudeFlowPlugin, PluginContext, MCPToolDefinition, CLICommandDefinition, AgentTypeDefinition } from '@swarmdo/shared/src/plugin-interface.js';
|
|
2
|
-
export declare class IoTCognitumPlugin implements ClaudeFlowPlugin {
|
|
3
|
-
readonly name = "@swarmdo/plugin-iot-cognitum";
|
|
4
|
-
readonly version = "1.0.0-alpha.1";
|
|
5
|
-
readonly description = "IoT Cognitum Seed device-agent bridge";
|
|
6
|
-
readonly author = "Swarmdo Team";
|
|
7
|
-
readonly dependencies: string[];
|
|
8
|
-
private coordinator;
|
|
9
|
-
private healthProbe;
|
|
10
|
-
private telemetryIngest;
|
|
11
|
-
private anomalyScan;
|
|
12
|
-
private meshSync;
|
|
13
|
-
private firmwareWatch;
|
|
14
|
-
private witnessAudit;
|
|
15
|
-
private context;
|
|
16
|
-
initialize(context: PluginContext): Promise<void>;
|
|
17
|
-
shutdown(): Promise<void>;
|
|
18
|
-
registerMCPTools(): MCPToolDefinition[];
|
|
19
|
-
registerCLICommands(): CLICommandDefinition[];
|
|
20
|
-
registerAgentTypes(): AgentTypeDefinition[];
|
|
21
|
-
healthCheck(): Promise<boolean>;
|
|
22
|
-
}
|
|
23
|
-
//# sourceMappingURL=plugin.d.ts.map
|
|
@@ -1,239 +0,0 @@
|
|
|
1
|
-
import { IoTCoordinator } from './application/iot-coordinator.js';
|
|
2
|
-
import { HealthProbeWorker } from './workers/health-probe-worker.js';
|
|
3
|
-
import { TelemetryIngestWorker } from './workers/telemetry-ingest-worker.js';
|
|
4
|
-
import { AnomalyScanWorker } from './workers/anomaly-scan-worker.js';
|
|
5
|
-
import { MeshSyncWorker } from './workers/mesh-sync-worker.js';
|
|
6
|
-
import { FirmwareWatchWorker } from './workers/firmware-watch-worker.js';
|
|
7
|
-
import { WitnessAuditWorker } from './workers/witness-audit-worker.js';
|
|
8
|
-
import { InMemoryDeviceRepository } from './infrastructure/in-memory-device-repository.js';
|
|
9
|
-
import { InMemoryTrustHistoryRepository } from './infrastructure/in-memory-trust-history-repository.js';
|
|
10
|
-
import { InMemoryFleetRepository } from './infrastructure/in-memory-fleet-repository.js';
|
|
11
|
-
import { createMcpTools } from './mcp-tools.js';
|
|
12
|
-
import { createCliCommands } from './cli-commands.js';
|
|
13
|
-
export class IoTCognitumPlugin {
|
|
14
|
-
name = '@swarmdo/plugin-iot-cognitum';
|
|
15
|
-
version = '1.0.0-alpha.1';
|
|
16
|
-
description = 'IoT Cognitum Seed device-agent bridge';
|
|
17
|
-
author = 'Swarmdo Team';
|
|
18
|
-
dependencies = ['@swarmdo/shared'];
|
|
19
|
-
coordinator = null;
|
|
20
|
-
healthProbe = null;
|
|
21
|
-
telemetryIngest = null;
|
|
22
|
-
anomalyScan = null;
|
|
23
|
-
meshSync = null;
|
|
24
|
-
firmwareWatch = null;
|
|
25
|
-
witnessAudit = null;
|
|
26
|
-
context = null;
|
|
27
|
-
async initialize(context) {
|
|
28
|
-
this.context = context;
|
|
29
|
-
const config = context.config;
|
|
30
|
-
const defaultFleetId = config['fleetId'] ?? 'default';
|
|
31
|
-
const defaultZoneId = config['zoneId'] ?? 'zone-0';
|
|
32
|
-
const insecure = config['tlsInsecure'] ?? true;
|
|
33
|
-
this.coordinator = new IoTCoordinator({
|
|
34
|
-
defaultFleetId,
|
|
35
|
-
defaultZoneId,
|
|
36
|
-
defaultTls: { insecure },
|
|
37
|
-
deviceRepository: new InMemoryDeviceRepository(),
|
|
38
|
-
trustHistoryRepository: new InMemoryTrustHistoryRepository(),
|
|
39
|
-
fleetRepository: new InMemoryFleetRepository(),
|
|
40
|
-
}, {
|
|
41
|
-
onDeviceRegistered: (device) => {
|
|
42
|
-
context.logger.info(`Device registered: ${device.deviceId} at ${device.endpoint}`);
|
|
43
|
-
context.eventBus.emit('iot:device-registered', device);
|
|
44
|
-
},
|
|
45
|
-
onTrustChange: (deviceId, oldLevel, newLevel) => {
|
|
46
|
-
context.logger.info(`Trust change for ${deviceId}: ${oldLevel} -> ${newLevel}`);
|
|
47
|
-
context.eventBus.emit('iot:trust-change', { deviceId, oldLevel, newLevel });
|
|
48
|
-
},
|
|
49
|
-
});
|
|
50
|
-
context.services.register('iot:coordinator', this.coordinator);
|
|
51
|
-
const healthIntervalMs = config['healthIntervalMs'] ?? 30_000;
|
|
52
|
-
this.healthProbe = new HealthProbeWorker(this.coordinator, {
|
|
53
|
-
intervalMs: healthIntervalMs,
|
|
54
|
-
onDeviceOffline: (deviceId) => {
|
|
55
|
-
context.logger.warn(`Device offline: ${deviceId}`);
|
|
56
|
-
context.eventBus.emit('iot:device-offline', { deviceId });
|
|
57
|
-
},
|
|
58
|
-
onDeviceOnline: (deviceId) => {
|
|
59
|
-
context.logger.info(`Device back online: ${deviceId}`);
|
|
60
|
-
context.eventBus.emit('iot:device-online', { deviceId });
|
|
61
|
-
},
|
|
62
|
-
});
|
|
63
|
-
this.healthProbe.start();
|
|
64
|
-
const telemetryIntervalMs = config['telemetryIntervalMs'] ?? 60_000;
|
|
65
|
-
this.telemetryIngest = new TelemetryIngestWorker(this.coordinator, {
|
|
66
|
-
intervalMs: telemetryIntervalMs,
|
|
67
|
-
onIngestionComplete: (deviceId, vectorCount) => {
|
|
68
|
-
context.logger.debug(`Telemetry ingest for ${deviceId}: ${vectorCount} vectors`);
|
|
69
|
-
},
|
|
70
|
-
onIngestionError: (deviceId, error) => {
|
|
71
|
-
context.logger.warn(`Telemetry ingest error for ${deviceId}: ${error.message}`);
|
|
72
|
-
},
|
|
73
|
-
});
|
|
74
|
-
this.telemetryIngest.start();
|
|
75
|
-
const anomalyScanIntervalMs = config['anomalyScanIntervalMs'] ?? 300_000;
|
|
76
|
-
this.anomalyScan = new AnomalyScanWorker(this.coordinator, {
|
|
77
|
-
intervalMs: anomalyScanIntervalMs,
|
|
78
|
-
onAnomalyDetected: (deviceId, score) => {
|
|
79
|
-
context.logger.warn(`Anomaly detected on ${deviceId}: trust score ${score.toFixed(3)}`);
|
|
80
|
-
context.eventBus.emit('iot:anomaly-detected', { deviceId, score });
|
|
81
|
-
},
|
|
82
|
-
onScanError: (deviceId, error) => {
|
|
83
|
-
context.logger.warn(`Anomaly scan error for ${deviceId}: ${error.message}`);
|
|
84
|
-
},
|
|
85
|
-
});
|
|
86
|
-
this.anomalyScan.start();
|
|
87
|
-
const meshSyncIntervalMs = config['meshSyncIntervalMs'] ?? 120_000;
|
|
88
|
-
this.meshSync = new MeshSyncWorker(this.coordinator, {
|
|
89
|
-
intervalMs: meshSyncIntervalMs,
|
|
90
|
-
onMeshPartition: (deviceId, peerCount) => {
|
|
91
|
-
context.logger.warn(`Mesh partition detected for ${deviceId}: ${peerCount} peers`);
|
|
92
|
-
context.eventBus.emit('iot:mesh-partition', { deviceId, peerCount });
|
|
93
|
-
},
|
|
94
|
-
onSyncError: (deviceId, error) => {
|
|
95
|
-
context.logger.warn(`Mesh sync error for ${deviceId}: ${error.message}`);
|
|
96
|
-
},
|
|
97
|
-
});
|
|
98
|
-
this.meshSync.start();
|
|
99
|
-
const firmwareWatchIntervalMs = config['firmwareWatchIntervalMs'] ?? 300_000;
|
|
100
|
-
this.firmwareWatch = new FirmwareWatchWorker(this.coordinator, {
|
|
101
|
-
intervalMs: firmwareWatchIntervalMs,
|
|
102
|
-
onVersionMismatch: (deviceId, expected, actual) => {
|
|
103
|
-
context.logger.warn(`Firmware mismatch on ${deviceId}: expected ${expected}, got ${actual}`);
|
|
104
|
-
context.eventBus.emit('iot:firmware-mismatch', { deviceId, expected, actual });
|
|
105
|
-
},
|
|
106
|
-
onWatchError: (deviceId, error) => {
|
|
107
|
-
context.logger.warn(`Firmware watch error for ${deviceId}: ${error.message}`);
|
|
108
|
-
},
|
|
109
|
-
});
|
|
110
|
-
this.firmwareWatch.start();
|
|
111
|
-
const witnessAuditIntervalMs = config['witnessAuditIntervalMs'] ?? 600_000;
|
|
112
|
-
this.witnessAudit = new WitnessAuditWorker(this.coordinator, {
|
|
113
|
-
intervalMs: witnessAuditIntervalMs,
|
|
114
|
-
onGapDetected: (deviceId, fromEpoch, toEpoch) => {
|
|
115
|
-
context.logger.warn(`Witness chain gap on ${deviceId}: epoch ${fromEpoch} → ${toEpoch}`);
|
|
116
|
-
context.eventBus.emit('iot:witness-gap', { deviceId, fromEpoch, toEpoch });
|
|
117
|
-
},
|
|
118
|
-
onAuditError: (deviceId, error) => {
|
|
119
|
-
context.logger.warn(`Witness audit error for ${deviceId}: ${error.message}`);
|
|
120
|
-
},
|
|
121
|
-
});
|
|
122
|
-
this.witnessAudit.start();
|
|
123
|
-
context.logger.info('IoT Cognitum plugin initialized');
|
|
124
|
-
}
|
|
125
|
-
async shutdown() {
|
|
126
|
-
if (this.witnessAudit) {
|
|
127
|
-
this.witnessAudit.stop();
|
|
128
|
-
this.witnessAudit = null;
|
|
129
|
-
}
|
|
130
|
-
if (this.firmwareWatch) {
|
|
131
|
-
this.firmwareWatch.stop();
|
|
132
|
-
this.firmwareWatch = null;
|
|
133
|
-
}
|
|
134
|
-
if (this.meshSync) {
|
|
135
|
-
this.meshSync.stop();
|
|
136
|
-
this.meshSync = null;
|
|
137
|
-
}
|
|
138
|
-
if (this.anomalyScan) {
|
|
139
|
-
this.anomalyScan.stop();
|
|
140
|
-
this.anomalyScan = null;
|
|
141
|
-
}
|
|
142
|
-
if (this.telemetryIngest) {
|
|
143
|
-
this.telemetryIngest.stop();
|
|
144
|
-
this.telemetryIngest = null;
|
|
145
|
-
}
|
|
146
|
-
if (this.healthProbe) {
|
|
147
|
-
this.healthProbe.stop();
|
|
148
|
-
this.healthProbe = null;
|
|
149
|
-
}
|
|
150
|
-
if (this.coordinator) {
|
|
151
|
-
await this.coordinator.shutdown();
|
|
152
|
-
this.coordinator = null;
|
|
153
|
-
}
|
|
154
|
-
this.context?.logger.info('IoT Cognitum plugin shut down');
|
|
155
|
-
this.context = null;
|
|
156
|
-
}
|
|
157
|
-
registerMCPTools() {
|
|
158
|
-
return createMcpTools(() => this.coordinator, () => this.context);
|
|
159
|
-
}
|
|
160
|
-
registerCLICommands() {
|
|
161
|
-
return createCliCommands(() => this.coordinator, () => this.context);
|
|
162
|
-
}
|
|
163
|
-
registerAgentTypes() {
|
|
164
|
-
return [
|
|
165
|
-
{
|
|
166
|
-
type: 'device-coordinator',
|
|
167
|
-
name: 'Device Coordinator',
|
|
168
|
-
description: 'Manages Cognitum Seed device fleet as Swarmdo agent swarm members',
|
|
169
|
-
defaultConfig: {
|
|
170
|
-
id: '',
|
|
171
|
-
name: 'device-coordinator',
|
|
172
|
-
type: 'coordinator',
|
|
173
|
-
capabilities: ['iot:discover', 'iot:register', 'iot:monitor', 'iot:deploy'],
|
|
174
|
-
maxConcurrentTasks: 10,
|
|
175
|
-
priority: 85,
|
|
176
|
-
timeout: 300_000,
|
|
177
|
-
metadata: { pluginSource: '@swarmdo/plugin-iot-cognitum' },
|
|
178
|
-
},
|
|
179
|
-
requiredCapabilities: ['iot:discover', 'iot:register'],
|
|
180
|
-
metadata: { trustAware: true, meshAware: true },
|
|
181
|
-
},
|
|
182
|
-
{
|
|
183
|
-
type: 'telemetry-analyzer',
|
|
184
|
-
name: 'Telemetry Analyzer',
|
|
185
|
-
description: 'Analyzes Cognitum Seed device telemetry for anomalies and drift patterns',
|
|
186
|
-
defaultConfig: {
|
|
187
|
-
id: '',
|
|
188
|
-
name: 'telemetry-analyzer',
|
|
189
|
-
type: 'analyzer',
|
|
190
|
-
capabilities: ['iot:telemetry', 'iot:anomaly-detect', 'iot:baseline'],
|
|
191
|
-
maxConcurrentTasks: 5,
|
|
192
|
-
priority: 75,
|
|
193
|
-
timeout: 120_000,
|
|
194
|
-
metadata: { pluginSource: '@swarmdo/plugin-iot-cognitum' },
|
|
195
|
-
},
|
|
196
|
-
requiredCapabilities: ['iot:telemetry'],
|
|
197
|
-
metadata: { anomalyAware: true, baselineAware: true },
|
|
198
|
-
},
|
|
199
|
-
{
|
|
200
|
-
type: 'fleet-manager',
|
|
201
|
-
name: 'Fleet Manager',
|
|
202
|
-
description: 'Manages device fleets, firmware rollouts, and fleet-wide policies',
|
|
203
|
-
defaultConfig: {
|
|
204
|
-
id: '',
|
|
205
|
-
name: 'fleet-manager',
|
|
206
|
-
type: 'coordinator',
|
|
207
|
-
capabilities: ['iot:fleet-create', 'iot:fleet-manage', 'iot:firmware-deploy', 'iot:firmware-rollback'],
|
|
208
|
-
maxConcurrentTasks: 8,
|
|
209
|
-
priority: 90,
|
|
210
|
-
timeout: 600_000,
|
|
211
|
-
metadata: { pluginSource: '@swarmdo/plugin-iot-cognitum' },
|
|
212
|
-
},
|
|
213
|
-
requiredCapabilities: ['iot:fleet-create', 'iot:fleet-manage'],
|
|
214
|
-
metadata: { firmwareAware: true, rolloutAware: true },
|
|
215
|
-
},
|
|
216
|
-
{
|
|
217
|
-
type: 'witness-auditor',
|
|
218
|
-
name: 'Witness Chain Auditor',
|
|
219
|
-
description: 'Verifies Ed25519 witness chain integrity and detects provenance gaps',
|
|
220
|
-
defaultConfig: {
|
|
221
|
-
id: '',
|
|
222
|
-
name: 'witness-auditor',
|
|
223
|
-
type: 'auditor',
|
|
224
|
-
capabilities: ['iot:witness-verify', 'iot:witness-audit', 'iot:custody-check'],
|
|
225
|
-
maxConcurrentTasks: 3,
|
|
226
|
-
priority: 70,
|
|
227
|
-
timeout: 180_000,
|
|
228
|
-
metadata: { pluginSource: '@swarmdo/plugin-iot-cognitum' },
|
|
229
|
-
},
|
|
230
|
-
requiredCapabilities: ['iot:witness-verify'],
|
|
231
|
-
metadata: { cryptoAware: true, auditAware: true },
|
|
232
|
-
},
|
|
233
|
-
];
|
|
234
|
-
}
|
|
235
|
-
async healthCheck() {
|
|
236
|
-
return this.coordinator !== null;
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
//# sourceMappingURL=plugin.js.map
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import type { IoTCoordinator } from '../application/iot-coordinator.js';
|
|
2
|
-
export interface AnomalyScanConfig {
|
|
3
|
-
intervalMs: number;
|
|
4
|
-
onAnomalyDetected?: (deviceId: string, score: number) => void;
|
|
5
|
-
onScanError?: (deviceId: string, error: Error) => void;
|
|
6
|
-
}
|
|
7
|
-
export declare class AnomalyScanWorker {
|
|
8
|
-
private timer;
|
|
9
|
-
private readonly coordinator;
|
|
10
|
-
private readonly config;
|
|
11
|
-
constructor(coordinator: IoTCoordinator, config?: Partial<AnomalyScanConfig>);
|
|
12
|
-
start(): void;
|
|
13
|
-
stop(): void;
|
|
14
|
-
scan(): Promise<void>;
|
|
15
|
-
isRunning(): boolean;
|
|
16
|
-
}
|
|
17
|
-
//# sourceMappingURL=anomaly-scan-worker.d.ts.map
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
export class AnomalyScanWorker {
|
|
2
|
-
timer = null;
|
|
3
|
-
coordinator;
|
|
4
|
-
config;
|
|
5
|
-
constructor(coordinator, config = {}) {
|
|
6
|
-
this.coordinator = coordinator;
|
|
7
|
-
this.config = {
|
|
8
|
-
intervalMs: config.intervalMs ?? 300_000,
|
|
9
|
-
onAnomalyDetected: config.onAnomalyDetected,
|
|
10
|
-
onScanError: config.onScanError,
|
|
11
|
-
};
|
|
12
|
-
}
|
|
13
|
-
start() {
|
|
14
|
-
if (this.timer)
|
|
15
|
-
return;
|
|
16
|
-
this.timer = setInterval(() => void this.scan(), this.config.intervalMs);
|
|
17
|
-
}
|
|
18
|
-
stop() {
|
|
19
|
-
if (this.timer) {
|
|
20
|
-
clearInterval(this.timer);
|
|
21
|
-
this.timer = null;
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
async scan() {
|
|
25
|
-
const devices = this.coordinator.listDevices();
|
|
26
|
-
for (const device of devices) {
|
|
27
|
-
try {
|
|
28
|
-
const refreshed = await this.coordinator.getDeviceStatus(device.deviceId);
|
|
29
|
-
if (refreshed.trustScore.overall < 0.5) {
|
|
30
|
-
this.config.onAnomalyDetected?.(device.deviceId, refreshed.trustScore.overall);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
catch (err) {
|
|
34
|
-
this.config.onScanError?.(device.deviceId, err);
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
isRunning() {
|
|
39
|
-
return this.timer !== null;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
//# sourceMappingURL=anomaly-scan-worker.js.map
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import type { IoTCoordinator } from '../application/iot-coordinator.js';
|
|
2
|
-
export interface FirmwareWatchConfig {
|
|
3
|
-
intervalMs: number;
|
|
4
|
-
onVersionMismatch?: (deviceId: string, expected: string, actual: string) => void;
|
|
5
|
-
onWatchError?: (deviceId: string, error: Error) => void;
|
|
6
|
-
}
|
|
7
|
-
export declare class FirmwareWatchWorker {
|
|
8
|
-
private timer;
|
|
9
|
-
private readonly coordinator;
|
|
10
|
-
private readonly config;
|
|
11
|
-
private readonly knownVersions;
|
|
12
|
-
constructor(coordinator: IoTCoordinator, config?: Partial<FirmwareWatchConfig>);
|
|
13
|
-
start(): void;
|
|
14
|
-
stop(): void;
|
|
15
|
-
watch(): Promise<void>;
|
|
16
|
-
isRunning(): boolean;
|
|
17
|
-
}
|
|
18
|
-
//# sourceMappingURL=firmware-watch-worker.d.ts.map
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
export class FirmwareWatchWorker {
|
|
2
|
-
timer = null;
|
|
3
|
-
coordinator;
|
|
4
|
-
config;
|
|
5
|
-
knownVersions = new Map();
|
|
6
|
-
constructor(coordinator, config = {}) {
|
|
7
|
-
this.coordinator = coordinator;
|
|
8
|
-
this.config = {
|
|
9
|
-
intervalMs: config.intervalMs ?? 300_000,
|
|
10
|
-
onVersionMismatch: config.onVersionMismatch,
|
|
11
|
-
onWatchError: config.onWatchError,
|
|
12
|
-
};
|
|
13
|
-
}
|
|
14
|
-
start() {
|
|
15
|
-
if (this.timer)
|
|
16
|
-
return;
|
|
17
|
-
this.timer = setInterval(() => void this.watch(), this.config.intervalMs);
|
|
18
|
-
}
|
|
19
|
-
stop() {
|
|
20
|
-
if (this.timer) {
|
|
21
|
-
clearInterval(this.timer);
|
|
22
|
-
this.timer = null;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
async watch() {
|
|
26
|
-
const devices = this.coordinator.listDevices();
|
|
27
|
-
for (const device of devices) {
|
|
28
|
-
try {
|
|
29
|
-
const refreshed = await this.coordinator.getDeviceStatus(device.deviceId);
|
|
30
|
-
const knownVersion = this.knownVersions.get(device.deviceId);
|
|
31
|
-
if (knownVersion && knownVersion !== refreshed.firmwareVersion) {
|
|
32
|
-
this.config.onVersionMismatch?.(device.deviceId, knownVersion, refreshed.firmwareVersion);
|
|
33
|
-
}
|
|
34
|
-
this.knownVersions.set(device.deviceId, refreshed.firmwareVersion);
|
|
35
|
-
}
|
|
36
|
-
catch (err) {
|
|
37
|
-
this.config.onWatchError?.(device.deviceId, err);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
isRunning() {
|
|
42
|
-
return this.timer !== null;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
//# sourceMappingURL=firmware-watch-worker.js.map
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import type { IoTCoordinator } from '../application/iot-coordinator.js';
|
|
2
|
-
export interface HealthProbeConfig {
|
|
3
|
-
intervalMs: number;
|
|
4
|
-
onDeviceOffline?: (deviceId: string) => void;
|
|
5
|
-
onDeviceOnline?: (deviceId: string) => void;
|
|
6
|
-
onProbeError?: (deviceId: string, error: Error) => void;
|
|
7
|
-
}
|
|
8
|
-
export declare class HealthProbeWorker {
|
|
9
|
-
private timer;
|
|
10
|
-
private readonly coordinator;
|
|
11
|
-
private readonly config;
|
|
12
|
-
private readonly lastKnownStatus;
|
|
13
|
-
constructor(coordinator: IoTCoordinator, config?: Partial<HealthProbeConfig>);
|
|
14
|
-
start(): void;
|
|
15
|
-
stop(): void;
|
|
16
|
-
probe(): Promise<void>;
|
|
17
|
-
isRunning(): boolean;
|
|
18
|
-
}
|
|
19
|
-
//# sourceMappingURL=health-probe-worker.d.ts.map
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
export class HealthProbeWorker {
|
|
2
|
-
timer = null;
|
|
3
|
-
coordinator;
|
|
4
|
-
config;
|
|
5
|
-
lastKnownStatus = new Map();
|
|
6
|
-
constructor(coordinator, config = {}) {
|
|
7
|
-
this.coordinator = coordinator;
|
|
8
|
-
this.config = {
|
|
9
|
-
intervalMs: config.intervalMs ?? 30_000,
|
|
10
|
-
onDeviceOffline: config.onDeviceOffline,
|
|
11
|
-
onDeviceOnline: config.onDeviceOnline,
|
|
12
|
-
onProbeError: config.onProbeError,
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
start() {
|
|
16
|
-
if (this.timer)
|
|
17
|
-
return;
|
|
18
|
-
this.timer = setInterval(() => void this.probe(), this.config.intervalMs);
|
|
19
|
-
}
|
|
20
|
-
stop() {
|
|
21
|
-
if (this.timer) {
|
|
22
|
-
clearInterval(this.timer);
|
|
23
|
-
this.timer = null;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
async probe() {
|
|
27
|
-
const devices = this.coordinator.listDevices();
|
|
28
|
-
for (const device of devices) {
|
|
29
|
-
const prevStatus = this.lastKnownStatus.get(device.deviceId);
|
|
30
|
-
try {
|
|
31
|
-
await this.coordinator.getDeviceStatus(device.deviceId);
|
|
32
|
-
this.lastKnownStatus.set(device.deviceId, 'online');
|
|
33
|
-
if (prevStatus === 'offline') {
|
|
34
|
-
this.config.onDeviceOnline?.(device.deviceId);
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
catch (err) {
|
|
38
|
-
this.lastKnownStatus.set(device.deviceId, 'offline');
|
|
39
|
-
if (prevStatus !== 'offline') {
|
|
40
|
-
this.config.onDeviceOffline?.(device.deviceId);
|
|
41
|
-
}
|
|
42
|
-
this.config.onProbeError?.(device.deviceId, err);
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
isRunning() {
|
|
47
|
-
return this.timer !== null;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
//# sourceMappingURL=health-probe-worker.js.map
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import type { IoTCoordinator } from '../application/iot-coordinator.js';
|
|
2
|
-
export interface MeshSyncConfig {
|
|
3
|
-
intervalMs: number;
|
|
4
|
-
onMeshPartition?: (deviceId: string, peerCount: number) => void;
|
|
5
|
-
onSyncComplete?: (deviceId: string, peerCount: number) => void;
|
|
6
|
-
onSyncError?: (deviceId: string, error: Error) => void;
|
|
7
|
-
}
|
|
8
|
-
export declare class MeshSyncWorker {
|
|
9
|
-
private timer;
|
|
10
|
-
private readonly coordinator;
|
|
11
|
-
private readonly config;
|
|
12
|
-
private readonly lastPeerCounts;
|
|
13
|
-
constructor(coordinator: IoTCoordinator, config?: Partial<MeshSyncConfig>);
|
|
14
|
-
start(): void;
|
|
15
|
-
stop(): void;
|
|
16
|
-
sync(): Promise<void>;
|
|
17
|
-
isRunning(): boolean;
|
|
18
|
-
}
|
|
19
|
-
//# sourceMappingURL=mesh-sync-worker.d.ts.map
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
export class MeshSyncWorker {
|
|
2
|
-
timer = null;
|
|
3
|
-
coordinator;
|
|
4
|
-
config;
|
|
5
|
-
lastPeerCounts = new Map();
|
|
6
|
-
constructor(coordinator, config = {}) {
|
|
7
|
-
this.coordinator = coordinator;
|
|
8
|
-
this.config = {
|
|
9
|
-
intervalMs: config.intervalMs ?? 120_000,
|
|
10
|
-
onMeshPartition: config.onMeshPartition,
|
|
11
|
-
onSyncComplete: config.onSyncComplete,
|
|
12
|
-
onSyncError: config.onSyncError,
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
start() {
|
|
16
|
-
if (this.timer)
|
|
17
|
-
return;
|
|
18
|
-
this.timer = setInterval(() => void this.sync(), this.config.intervalMs);
|
|
19
|
-
}
|
|
20
|
-
stop() {
|
|
21
|
-
if (this.timer) {
|
|
22
|
-
clearInterval(this.timer);
|
|
23
|
-
this.timer = null;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
async sync() {
|
|
27
|
-
const devices = this.coordinator.listDevices();
|
|
28
|
-
for (const device of devices) {
|
|
29
|
-
try {
|
|
30
|
-
const topology = await this.coordinator.getDeviceMeshTopology(device.deviceId);
|
|
31
|
-
const prevCount = this.lastPeerCounts.get(device.deviceId) ?? topology.peerCount;
|
|
32
|
-
if (topology.peerCount === 0 && prevCount > 0) {
|
|
33
|
-
this.config.onMeshPartition?.(device.deviceId, topology.peerCount);
|
|
34
|
-
}
|
|
35
|
-
this.lastPeerCounts.set(device.deviceId, topology.peerCount);
|
|
36
|
-
this.config.onSyncComplete?.(device.deviceId, topology.peerCount);
|
|
37
|
-
}
|
|
38
|
-
catch (err) {
|
|
39
|
-
this.config.onSyncError?.(device.deviceId, err);
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
isRunning() {
|
|
44
|
-
return this.timer !== null;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
//# sourceMappingURL=mesh-sync-worker.js.map
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import type { IoTCoordinator } from '../application/iot-coordinator.js';
|
|
2
|
-
export interface TelemetryIngestConfig {
|
|
3
|
-
intervalMs: number;
|
|
4
|
-
onIngestionComplete?: (deviceId: string, vectorCount: number) => void;
|
|
5
|
-
onIngestionError?: (deviceId: string, error: Error) => void;
|
|
6
|
-
}
|
|
7
|
-
export declare class TelemetryIngestWorker {
|
|
8
|
-
private timer;
|
|
9
|
-
private readonly coordinator;
|
|
10
|
-
private readonly config;
|
|
11
|
-
constructor(coordinator: IoTCoordinator, config?: Partial<TelemetryIngestConfig>);
|
|
12
|
-
start(): void;
|
|
13
|
-
stop(): void;
|
|
14
|
-
ingest(): Promise<void>;
|
|
15
|
-
isRunning(): boolean;
|
|
16
|
-
}
|
|
17
|
-
//# sourceMappingURL=telemetry-ingest-worker.d.ts.map
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
export class TelemetryIngestWorker {
|
|
2
|
-
timer = null;
|
|
3
|
-
coordinator;
|
|
4
|
-
config;
|
|
5
|
-
constructor(coordinator, config = {}) {
|
|
6
|
-
this.coordinator = coordinator;
|
|
7
|
-
this.config = {
|
|
8
|
-
intervalMs: config.intervalMs ?? 60_000,
|
|
9
|
-
onIngestionComplete: config.onIngestionComplete,
|
|
10
|
-
onIngestionError: config.onIngestionError,
|
|
11
|
-
};
|
|
12
|
-
}
|
|
13
|
-
start() {
|
|
14
|
-
if (this.timer)
|
|
15
|
-
return;
|
|
16
|
-
this.timer = setInterval(() => void this.ingest(), this.config.intervalMs);
|
|
17
|
-
}
|
|
18
|
-
stop() {
|
|
19
|
-
if (this.timer) {
|
|
20
|
-
clearInterval(this.timer);
|
|
21
|
-
this.timer = null;
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
async ingest() {
|
|
25
|
-
const devices = this.coordinator.listDevices();
|
|
26
|
-
for (const device of devices) {
|
|
27
|
-
try {
|
|
28
|
-
const storeStatus = await this.coordinator.getDeviceStoreStatus(device.deviceId);
|
|
29
|
-
this.config.onIngestionComplete?.(device.deviceId, storeStatus.totalVectors);
|
|
30
|
-
}
|
|
31
|
-
catch (err) {
|
|
32
|
-
this.config.onIngestionError?.(device.deviceId, err);
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
isRunning() {
|
|
37
|
-
return this.timer !== null;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
//# sourceMappingURL=telemetry-ingest-worker.js.map
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import type { IoTCoordinator } from '../application/iot-coordinator.js';
|
|
2
|
-
export interface WitnessAuditConfig {
|
|
3
|
-
intervalMs: number;
|
|
4
|
-
onGapDetected?: (deviceId: string, fromEpoch: number, toEpoch: number) => void;
|
|
5
|
-
onAuditComplete?: (deviceId: string, chainLength: number) => void;
|
|
6
|
-
onAuditError?: (deviceId: string, error: Error) => void;
|
|
7
|
-
}
|
|
8
|
-
export declare class WitnessAuditWorker {
|
|
9
|
-
private timer;
|
|
10
|
-
private readonly coordinator;
|
|
11
|
-
private readonly config;
|
|
12
|
-
constructor(coordinator: IoTCoordinator, config?: Partial<WitnessAuditConfig>);
|
|
13
|
-
start(): void;
|
|
14
|
-
stop(): void;
|
|
15
|
-
audit(): Promise<void>;
|
|
16
|
-
isRunning(): boolean;
|
|
17
|
-
}
|
|
18
|
-
//# sourceMappingURL=witness-audit-worker.d.ts.map
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
export class WitnessAuditWorker {
|
|
2
|
-
timer = null;
|
|
3
|
-
coordinator;
|
|
4
|
-
config;
|
|
5
|
-
constructor(coordinator, config = {}) {
|
|
6
|
-
this.coordinator = coordinator;
|
|
7
|
-
this.config = {
|
|
8
|
-
intervalMs: config.intervalMs ?? 600_000,
|
|
9
|
-
onGapDetected: config.onGapDetected,
|
|
10
|
-
onAuditComplete: config.onAuditComplete,
|
|
11
|
-
onAuditError: config.onAuditError,
|
|
12
|
-
};
|
|
13
|
-
}
|
|
14
|
-
start() {
|
|
15
|
-
if (this.timer)
|
|
16
|
-
return;
|
|
17
|
-
this.timer = setInterval(() => void this.audit(), this.config.intervalMs);
|
|
18
|
-
}
|
|
19
|
-
stop() {
|
|
20
|
-
if (this.timer) {
|
|
21
|
-
clearInterval(this.timer);
|
|
22
|
-
this.timer = null;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
async audit() {
|
|
26
|
-
const devices = this.coordinator.listDevices();
|
|
27
|
-
for (const device of devices) {
|
|
28
|
-
try {
|
|
29
|
-
const chain = await this.coordinator.getDeviceWitnessChain(device.deviceId);
|
|
30
|
-
const entries = chain.entries ?? [];
|
|
31
|
-
const sorted = [...entries].sort((a, b) => a.epoch - b.epoch);
|
|
32
|
-
for (let i = 1; i < sorted.length; i++) {
|
|
33
|
-
const expected = sorted[i - 1].epoch + 1;
|
|
34
|
-
const actual = sorted[i].epoch;
|
|
35
|
-
if (actual > expected) {
|
|
36
|
-
this.config.onGapDetected?.(device.deviceId, sorted[i - 1].epoch, actual);
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
const chainLength = chain.length ?? entries.length ?? 0;
|
|
40
|
-
this.config.onAuditComplete?.(device.deviceId, chainLength);
|
|
41
|
-
}
|
|
42
|
-
catch (err) {
|
|
43
|
-
this.config.onAuditError?.(device.deviceId, err);
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
isRunning() {
|
|
48
|
-
return this.timer !== null;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
//# sourceMappingURL=witness-audit-worker.js.map
|