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,508 +0,0 @@
|
|
|
1
|
-
import { getDeviceTrustLabel } from './domain/entities/device-trust-level.js';
|
|
2
|
-
function requireCoordinator(get) {
|
|
3
|
-
const c = get();
|
|
4
|
-
if (!c)
|
|
5
|
-
throw new Error('IoT Cognitum not initialized. Run "iot register" first.');
|
|
6
|
-
return c;
|
|
7
|
-
}
|
|
8
|
-
function parseVector(raw) {
|
|
9
|
-
const parsed = JSON.parse(raw);
|
|
10
|
-
if (!Array.isArray(parsed) || !parsed.every((n) => typeof n === 'number')) {
|
|
11
|
-
throw new Error(`--vector must be a JSON array of numbers, got: ${raw}`);
|
|
12
|
-
}
|
|
13
|
-
return parsed;
|
|
14
|
-
}
|
|
15
|
-
export function createCliCommands(getCoordinator, _getContext) {
|
|
16
|
-
return [
|
|
17
|
-
{
|
|
18
|
-
name: 'iot init',
|
|
19
|
-
description: 'Initialize IoT Cognitum plugin configuration',
|
|
20
|
-
options: [
|
|
21
|
-
{ name: 'fleet-id', description: 'Default fleet identifier', type: 'string', default: 'default' },
|
|
22
|
-
{ name: 'zone-id', description: 'Default IEC 62443 security zone', type: 'string', default: 'zone-0' },
|
|
23
|
-
{ name: 'insecure', description: 'Allow TLS-insecure connections', type: 'boolean', default: true },
|
|
24
|
-
],
|
|
25
|
-
handler: async (args) => {
|
|
26
|
-
const fleetId = args['fleet-id'] ?? 'default';
|
|
27
|
-
const zoneId = args['zone-id'] ?? 'zone-0';
|
|
28
|
-
const insecure = args['insecure'] !== false;
|
|
29
|
-
console.log('IoT Cognitum Plugin Configuration');
|
|
30
|
-
console.log('-'.repeat(40));
|
|
31
|
-
console.log(` Fleet ID: ${fleetId}`);
|
|
32
|
-
console.log(` Zone ID: ${zoneId}`);
|
|
33
|
-
console.log(` TLS Insecure: ${insecure}`);
|
|
34
|
-
console.log('');
|
|
35
|
-
console.log('Plugin ready. Use "iot register -e <endpoint>" to add a device.');
|
|
36
|
-
},
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
name: 'iot register',
|
|
40
|
-
description: 'Register a Cognitum Seed device by endpoint',
|
|
41
|
-
options: [
|
|
42
|
-
{ name: 'endpoint', short: 'e', description: 'Device HTTP endpoint', type: 'string', required: true },
|
|
43
|
-
{ name: 'token', short: 't', description: 'Pairing token for mutual auth', type: 'string' },
|
|
44
|
-
],
|
|
45
|
-
handler: async (args) => {
|
|
46
|
-
const coordinator = requireCoordinator(getCoordinator);
|
|
47
|
-
const device = await coordinator.registerDevice(args['endpoint'], args['token']);
|
|
48
|
-
console.log(`Device registered: ${device.deviceId}`);
|
|
49
|
-
console.log(` Endpoint: ${device.endpoint}`);
|
|
50
|
-
console.log(` Trust: ${getDeviceTrustLabel(device.trustLevel)}`);
|
|
51
|
-
console.log(` Firmware: ${device.firmwareVersion}`);
|
|
52
|
-
},
|
|
53
|
-
},
|
|
54
|
-
{
|
|
55
|
-
name: 'iot status',
|
|
56
|
-
description: 'Get device status and trust score',
|
|
57
|
-
arguments: [{ name: 'device-id', description: 'Device identifier', required: true }],
|
|
58
|
-
options: [
|
|
59
|
-
{ name: 'format', short: 'f', description: 'Output format (table, json)', type: 'string', default: 'table' },
|
|
60
|
-
],
|
|
61
|
-
handler: async (args) => {
|
|
62
|
-
const coordinator = requireCoordinator(getCoordinator);
|
|
63
|
-
const device = await coordinator.getDeviceStatus(args._[0]);
|
|
64
|
-
const format = args['format'];
|
|
65
|
-
if (format === 'json') {
|
|
66
|
-
console.log(JSON.stringify(device, null, 2));
|
|
67
|
-
}
|
|
68
|
-
else {
|
|
69
|
-
console.log(`Device: ${device.deviceId}`);
|
|
70
|
-
console.log(`Status: ${device.status}`);
|
|
71
|
-
console.log(`Trust: ${getDeviceTrustLabel(device.trustLevel)} (score: ${device.trustScore.overall.toFixed(3)})`);
|
|
72
|
-
console.log(`Firmware: ${device.firmwareVersion}`);
|
|
73
|
-
console.log(`Endpoint: ${device.endpoint}`);
|
|
74
|
-
console.log(`Epoch: ${device.epoch}`);
|
|
75
|
-
console.log(`Vectors: ${device.vectorStoreStats.totalVectors}`);
|
|
76
|
-
}
|
|
77
|
-
},
|
|
78
|
-
},
|
|
79
|
-
{
|
|
80
|
-
name: 'iot list',
|
|
81
|
-
description: 'List all registered devices',
|
|
82
|
-
options: [
|
|
83
|
-
{ name: 'format', short: 'f', description: 'Output format (table, json)', type: 'string', default: 'table' },
|
|
84
|
-
],
|
|
85
|
-
handler: async (args) => {
|
|
86
|
-
const coordinator = requireCoordinator(getCoordinator);
|
|
87
|
-
const devices = coordinator.listDevices();
|
|
88
|
-
const format = args['format'];
|
|
89
|
-
if (format === 'json') {
|
|
90
|
-
console.log(JSON.stringify(devices, null, 2));
|
|
91
|
-
}
|
|
92
|
-
else {
|
|
93
|
-
console.log('Device ID | Status | Trust');
|
|
94
|
-
console.log('-'.repeat(60));
|
|
95
|
-
for (const d of devices) {
|
|
96
|
-
console.log(`${d.deviceId.padEnd(33)}| ${d.status.padEnd(10)}| ${getDeviceTrustLabel(d.trustLevel)}`);
|
|
97
|
-
}
|
|
98
|
-
console.log(`\nTotal: ${devices.length} device(s)`);
|
|
99
|
-
}
|
|
100
|
-
},
|
|
101
|
-
},
|
|
102
|
-
{
|
|
103
|
-
name: 'iot remove',
|
|
104
|
-
description: 'Remove a registered device',
|
|
105
|
-
arguments: [{ name: 'device-id', description: 'Device identifier to remove', required: true }],
|
|
106
|
-
handler: async (args) => {
|
|
107
|
-
const coordinator = requireCoordinator(getCoordinator);
|
|
108
|
-
await coordinator.removeDevice(args._[0]);
|
|
109
|
-
console.log(`Device ${args._[0]} removed.`);
|
|
110
|
-
},
|
|
111
|
-
},
|
|
112
|
-
{
|
|
113
|
-
name: 'iot pair',
|
|
114
|
-
description: 'Pair with a registered device to establish mutual trust',
|
|
115
|
-
options: [
|
|
116
|
-
{ name: 'device-id', short: 'd', description: 'Device identifier', type: 'string', required: true },
|
|
117
|
-
{ name: 'name', short: 'n', description: 'Client name for pairing', type: 'string', default: 'swarmdo' },
|
|
118
|
-
],
|
|
119
|
-
handler: async (args) => {
|
|
120
|
-
const coordinator = requireCoordinator(getCoordinator);
|
|
121
|
-
const device = await coordinator.pairDevice(args['device-id'], args['name'] ?? 'swarmdo');
|
|
122
|
-
console.log(`Paired with device: ${device.deviceId}`);
|
|
123
|
-
console.log(` Trust: ${getDeviceTrustLabel(device.trustLevel)}`);
|
|
124
|
-
console.log(` Score: ${device.trustScore.overall.toFixed(3)}`);
|
|
125
|
-
},
|
|
126
|
-
},
|
|
127
|
-
{
|
|
128
|
-
name: 'iot unpair',
|
|
129
|
-
description: 'Unpair from a registered device',
|
|
130
|
-
arguments: [{ name: 'device-id', description: 'Device identifier', required: true }],
|
|
131
|
-
handler: async (args) => {
|
|
132
|
-
const coordinator = requireCoordinator(getCoordinator);
|
|
133
|
-
const device = await coordinator.unpairDevice(args._[0]);
|
|
134
|
-
console.log(`Unpaired device: ${device.deviceId}`);
|
|
135
|
-
console.log(` Trust: ${getDeviceTrustLabel(device.trustLevel)}`);
|
|
136
|
-
},
|
|
137
|
-
},
|
|
138
|
-
{
|
|
139
|
-
name: 'iot query',
|
|
140
|
-
description: 'Query device vector store with a k-NN search',
|
|
141
|
-
options: [
|
|
142
|
-
{ name: 'device-id', short: 'd', description: 'Device identifier', type: 'string', required: true },
|
|
143
|
-
{ name: 'k', short: 'k', description: 'Number of nearest neighbours', type: 'number', default: 5 },
|
|
144
|
-
{ name: 'vector', short: 'v', description: 'JSON array of numbers, e.g. "[0.1,0.2,...]"', type: 'string' },
|
|
145
|
-
],
|
|
146
|
-
handler: async (args) => {
|
|
147
|
-
const coordinator = requireCoordinator(getCoordinator);
|
|
148
|
-
const k = Number(args['k'] ?? 5);
|
|
149
|
-
const raw = args['vector'];
|
|
150
|
-
const vector = raw ? parseVector(raw) : [];
|
|
151
|
-
const result = await coordinator.queryDeviceVectors(args['device-id'], vector, k);
|
|
152
|
-
console.log(JSON.stringify(result, null, 2));
|
|
153
|
-
},
|
|
154
|
-
},
|
|
155
|
-
{
|
|
156
|
-
name: 'iot ingest',
|
|
157
|
-
description: 'Ingest vectors into device store. Pass --vector "[..]" or pipe a JSON array on stdin.',
|
|
158
|
-
options: [
|
|
159
|
-
{ name: 'device-id', short: 'd', description: 'Device identifier', type: 'string', required: true },
|
|
160
|
-
{ name: 'vector', short: 'v', description: 'Single JSON-array vector to ingest', type: 'string' },
|
|
161
|
-
{ name: 'metadata', short: 'm', description: 'JSON metadata object for the vector', type: 'string' },
|
|
162
|
-
],
|
|
163
|
-
handler: async (args) => {
|
|
164
|
-
const coordinator = requireCoordinator(getCoordinator);
|
|
165
|
-
const raw = args['vector'];
|
|
166
|
-
const metaRaw = args['metadata'];
|
|
167
|
-
let vectors = [];
|
|
168
|
-
if (raw) {
|
|
169
|
-
const v = parseVector(raw);
|
|
170
|
-
const meta = metaRaw ? JSON.parse(metaRaw) : undefined;
|
|
171
|
-
vectors = [{ values: v, ...(meta ? { metadata: meta } : {}) }];
|
|
172
|
-
}
|
|
173
|
-
else if (!process.stdin.isTTY) {
|
|
174
|
-
// Stdin path: expect a JSON array of {values, metadata?} or raw number[][]
|
|
175
|
-
const chunks = [];
|
|
176
|
-
for await (const chunk of process.stdin)
|
|
177
|
-
chunks.push(chunk);
|
|
178
|
-
const text = Buffer.concat(chunks).toString('utf8').trim();
|
|
179
|
-
if (text) {
|
|
180
|
-
const parsed = JSON.parse(text);
|
|
181
|
-
if (Array.isArray(parsed)) {
|
|
182
|
-
vectors = parsed.map((entry) => {
|
|
183
|
-
if (Array.isArray(entry))
|
|
184
|
-
return { values: entry };
|
|
185
|
-
return entry;
|
|
186
|
-
});
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
if (vectors.length === 0) {
|
|
191
|
-
throw new Error('No vectors to ingest. Pass --vector "[..]" or pipe a JSON array on stdin.');
|
|
192
|
-
}
|
|
193
|
-
const result = await coordinator.ingestDeviceTelemetry(args['device-id'], vectors);
|
|
194
|
-
console.log(`Ingested ${result.ingested} vector(s) for device ${result.deviceId}`);
|
|
195
|
-
},
|
|
196
|
-
},
|
|
197
|
-
{
|
|
198
|
-
name: 'iot mesh',
|
|
199
|
-
description: 'Show mesh network topology for a device',
|
|
200
|
-
arguments: [{ name: 'device-id', description: 'Device identifier', required: true }],
|
|
201
|
-
handler: async (args) => {
|
|
202
|
-
const coordinator = requireCoordinator(getCoordinator);
|
|
203
|
-
const topology = await coordinator.getDeviceMeshTopology(args._[0]);
|
|
204
|
-
console.log(`Device: ${topology.deviceId}`);
|
|
205
|
-
console.log(`AP Active: ${topology.apActive}`);
|
|
206
|
-
console.log(`Auto Mesh: ${topology.autoMesh}`);
|
|
207
|
-
console.log(`Cluster: ${topology.clusterEnabled}`);
|
|
208
|
-
console.log(`Peers: ${topology.peerCount}`);
|
|
209
|
-
if (topology.peers.length > 0) {
|
|
210
|
-
for (const p of topology.peers) {
|
|
211
|
-
console.log(` - ${p.deviceId} ${p.address ? `(${p.address})` : ''}`);
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
},
|
|
215
|
-
},
|
|
216
|
-
{
|
|
217
|
-
name: 'iot witness',
|
|
218
|
-
description: 'Show witness chain provenance for a device',
|
|
219
|
-
arguments: [{ name: 'device-id', description: 'Device identifier', required: true }],
|
|
220
|
-
handler: async (args) => {
|
|
221
|
-
const coordinator = requireCoordinator(getCoordinator);
|
|
222
|
-
const chain = await coordinator.getDeviceWitnessChain(args._[0]);
|
|
223
|
-
console.log(`Length: ${chain.length ?? chain.entries?.length ?? 0}`);
|
|
224
|
-
console.log(`Head: ${chain.head || '(empty)'}`);
|
|
225
|
-
if (chain.entries && chain.entries.length > 0) {
|
|
226
|
-
console.log(`Entries: ${chain.entries.length}`);
|
|
227
|
-
console.log(` Latest epoch: ${chain.entries[0]?.epoch ?? 'n/a'}`);
|
|
228
|
-
}
|
|
229
|
-
},
|
|
230
|
-
},
|
|
231
|
-
{
|
|
232
|
-
name: 'iot fleet',
|
|
233
|
-
description: 'Show fleet overview of all registered devices',
|
|
234
|
-
options: [
|
|
235
|
-
{ name: 'format', short: 'f', description: 'Output format (table, json)', type: 'string', default: 'table' },
|
|
236
|
-
],
|
|
237
|
-
handler: async (args) => {
|
|
238
|
-
const coordinator = requireCoordinator(getCoordinator);
|
|
239
|
-
const status = coordinator.getStatus();
|
|
240
|
-
const format = args['format'];
|
|
241
|
-
if (format === 'json') {
|
|
242
|
-
console.log(JSON.stringify(status, null, 2));
|
|
243
|
-
}
|
|
244
|
-
else {
|
|
245
|
-
console.log(`Healthy: ${status.healthy}`);
|
|
246
|
-
console.log(`Devices: ${status.deviceCount}`);
|
|
247
|
-
for (const d of status.devices) {
|
|
248
|
-
console.log(` - ${d.deviceId} (${d.status})`);
|
|
249
|
-
}
|
|
250
|
-
}
|
|
251
|
-
},
|
|
252
|
-
},
|
|
253
|
-
// -- Firmware orchestration (Phase 3) ---------------------------------------
|
|
254
|
-
{
|
|
255
|
-
name: 'iot firmware deploy',
|
|
256
|
-
description: 'Create and start a firmware rollout for a fleet',
|
|
257
|
-
options: [
|
|
258
|
-
{ name: 'fleet-id', short: 'i', description: 'Fleet identifier', type: 'string', required: true },
|
|
259
|
-
{ name: 'version', short: 'v', description: 'Target firmware version', type: 'string', required: true },
|
|
260
|
-
],
|
|
261
|
-
handler: async (args) => {
|
|
262
|
-
const coordinator = requireCoordinator(getCoordinator);
|
|
263
|
-
const rollout = await coordinator.createFirmwareRollout(args['fleet-id'], args['version']);
|
|
264
|
-
console.log(`Rollout created: ${rollout.rolloutId}`);
|
|
265
|
-
console.log(` Fleet: ${rollout.fleetId}`);
|
|
266
|
-
console.log(` Version: ${rollout.firmwareVersion}`);
|
|
267
|
-
console.log(` Stage: ${rollout.stage}`);
|
|
268
|
-
console.log(` Targets: ${rollout.targetDeviceIds.length} device(s)`);
|
|
269
|
-
console.log(` Canaries: ${rollout.canaryDeviceIds.length} device(s)`);
|
|
270
|
-
},
|
|
271
|
-
},
|
|
272
|
-
{
|
|
273
|
-
name: 'iot firmware advance',
|
|
274
|
-
description: 'Advance a firmware rollout to the next stage',
|
|
275
|
-
arguments: [{ name: 'rollout-id', description: 'Rollout identifier', required: true }],
|
|
276
|
-
handler: async (args) => {
|
|
277
|
-
const coordinator = requireCoordinator(getCoordinator);
|
|
278
|
-
const rollout = await coordinator.advanceFirmwareRollout(args._[0]);
|
|
279
|
-
console.log(`Rollout ${rollout.rolloutId}: ${rollout.stage}`);
|
|
280
|
-
console.log(` Completed: ${rollout.completedDeviceIds.length}/${rollout.targetDeviceIds.length}`);
|
|
281
|
-
console.log(` Failed: ${rollout.failedDeviceIds.length}`);
|
|
282
|
-
},
|
|
283
|
-
},
|
|
284
|
-
{
|
|
285
|
-
name: 'iot firmware rollback',
|
|
286
|
-
description: 'Force rollback a firmware rollout',
|
|
287
|
-
arguments: [{ name: 'rollout-id', description: 'Rollout identifier', required: true }],
|
|
288
|
-
handler: async (args) => {
|
|
289
|
-
const coordinator = requireCoordinator(getCoordinator);
|
|
290
|
-
const rollout = coordinator.rollbackFirmwareRollout(args._[0]);
|
|
291
|
-
console.log(`Rollout ${rollout.rolloutId} rolled back.`);
|
|
292
|
-
},
|
|
293
|
-
},
|
|
294
|
-
{
|
|
295
|
-
name: 'iot firmware status',
|
|
296
|
-
description: 'Show firmware rollout status',
|
|
297
|
-
arguments: [{ name: 'rollout-id', description: 'Rollout identifier', required: true }],
|
|
298
|
-
options: [
|
|
299
|
-
{ name: 'format', short: 'f', description: 'Output format (table, json)', type: 'string', default: 'table' },
|
|
300
|
-
],
|
|
301
|
-
handler: async (args) => {
|
|
302
|
-
const coordinator = requireCoordinator(getCoordinator);
|
|
303
|
-
const rollout = coordinator.getFirmwareRollout(args._[0]);
|
|
304
|
-
const format = args['format'];
|
|
305
|
-
if (format === 'json') {
|
|
306
|
-
console.log(JSON.stringify(rollout, null, 2));
|
|
307
|
-
}
|
|
308
|
-
else {
|
|
309
|
-
console.log(`Rollout: ${rollout.rolloutId}`);
|
|
310
|
-
console.log(`Fleet: ${rollout.fleetId}`);
|
|
311
|
-
console.log(`Version: ${rollout.firmwareVersion}`);
|
|
312
|
-
console.log(`Stage: ${rollout.stage}`);
|
|
313
|
-
console.log(`Completed: ${rollout.completedDeviceIds.length}/${rollout.targetDeviceIds.length}`);
|
|
314
|
-
console.log(`Failed: ${rollout.failedDeviceIds.length}`);
|
|
315
|
-
console.log(`Threshold: ${rollout.anomalyThreshold}`);
|
|
316
|
-
}
|
|
317
|
-
},
|
|
318
|
-
},
|
|
319
|
-
{
|
|
320
|
-
name: 'iot firmware list',
|
|
321
|
-
description: 'List firmware rollouts',
|
|
322
|
-
options: [
|
|
323
|
-
{ name: 'fleet-id', short: 'i', description: 'Filter by fleet', type: 'string' },
|
|
324
|
-
{ name: 'format', short: 'f', description: 'Output format (table, json)', type: 'string', default: 'table' },
|
|
325
|
-
],
|
|
326
|
-
handler: async (args) => {
|
|
327
|
-
const coordinator = requireCoordinator(getCoordinator);
|
|
328
|
-
const rollouts = coordinator.listFirmwareRollouts(args['fleet-id']);
|
|
329
|
-
const format = args['format'];
|
|
330
|
-
if (format === 'json') {
|
|
331
|
-
console.log(JSON.stringify(rollouts, null, 2));
|
|
332
|
-
}
|
|
333
|
-
else {
|
|
334
|
-
console.log('Rollout ID | Fleet | Version | Stage');
|
|
335
|
-
console.log('-'.repeat(80));
|
|
336
|
-
for (const r of rollouts) {
|
|
337
|
-
console.log(`${r.rolloutId.padEnd(37)}| ${r.fleetId.padEnd(13)}| ${r.firmwareVersion.padEnd(9)}| ${r.stage}`);
|
|
338
|
-
}
|
|
339
|
-
console.log(`\nTotal: ${rollouts.length} rollout(s)`);
|
|
340
|
-
}
|
|
341
|
-
},
|
|
342
|
-
},
|
|
343
|
-
// -- Fleet management (Phase 3) --------------------------------------------
|
|
344
|
-
{
|
|
345
|
-
name: 'iot fleet create',
|
|
346
|
-
description: 'Create a new device fleet',
|
|
347
|
-
options: [
|
|
348
|
-
{ name: 'fleet-id', short: 'i', description: 'Fleet identifier', type: 'string', required: true },
|
|
349
|
-
{ name: 'name', short: 'n', description: 'Fleet display name', type: 'string', required: true },
|
|
350
|
-
{ name: 'zone-id', short: 'z', description: 'IEC 62443 security zone', type: 'string', default: 'zone-0' },
|
|
351
|
-
{ name: 'topology', short: 't', description: 'Fleet topology (star, mesh, hierarchical, ring)', type: 'string', default: 'star' },
|
|
352
|
-
],
|
|
353
|
-
handler: async (args) => {
|
|
354
|
-
const coordinator = requireCoordinator(getCoordinator);
|
|
355
|
-
const fleet = await coordinator.createFleet({
|
|
356
|
-
fleetId: args['fleet-id'],
|
|
357
|
-
name: args['name'],
|
|
358
|
-
zoneId: args['zone-id'] ?? 'zone-0',
|
|
359
|
-
topology: args['topology'],
|
|
360
|
-
});
|
|
361
|
-
console.log(`Fleet created: ${fleet.fleetId}`);
|
|
362
|
-
console.log(` Name: ${fleet.name}`);
|
|
363
|
-
console.log(` Zone: ${fleet.zoneId}`);
|
|
364
|
-
console.log(` Topology: ${fleet.topology}`);
|
|
365
|
-
console.log(` Devices: ${fleet.deviceIds.length}`);
|
|
366
|
-
},
|
|
367
|
-
},
|
|
368
|
-
{
|
|
369
|
-
name: 'iot fleet list',
|
|
370
|
-
description: 'List all device fleets',
|
|
371
|
-
options: [
|
|
372
|
-
{ name: 'format', short: 'f', description: 'Output format (table, json)', type: 'string', default: 'table' },
|
|
373
|
-
],
|
|
374
|
-
handler: async (args) => {
|
|
375
|
-
const coordinator = requireCoordinator(getCoordinator);
|
|
376
|
-
const fleets = await coordinator.listFleets();
|
|
377
|
-
const format = args['format'];
|
|
378
|
-
if (format === 'json') {
|
|
379
|
-
console.log(JSON.stringify(fleets, null, 2));
|
|
380
|
-
}
|
|
381
|
-
else {
|
|
382
|
-
console.log('Fleet ID | Name | Devices | Topology');
|
|
383
|
-
console.log('-'.repeat(75));
|
|
384
|
-
for (const f of fleets) {
|
|
385
|
-
console.log(`${f.fleetId.padEnd(25)}| ${f.name.padEnd(21)}| ${String(f.deviceCount).padEnd(8)}| ${f.topology}`);
|
|
386
|
-
}
|
|
387
|
-
console.log(`\nTotal: ${fleets.length} fleet(s)`);
|
|
388
|
-
}
|
|
389
|
-
},
|
|
390
|
-
},
|
|
391
|
-
{
|
|
392
|
-
name: 'iot fleet add',
|
|
393
|
-
description: 'Add a device to a fleet',
|
|
394
|
-
options: [
|
|
395
|
-
{ name: 'fleet-id', short: 'i', description: 'Fleet identifier', type: 'string', required: true },
|
|
396
|
-
{ name: 'device-id', short: 'd', description: 'Device identifier', type: 'string', required: true },
|
|
397
|
-
],
|
|
398
|
-
handler: async (args) => {
|
|
399
|
-
const coordinator = requireCoordinator(getCoordinator);
|
|
400
|
-
const fleet = await coordinator.addDeviceToFleet(args['fleet-id'], args['device-id']);
|
|
401
|
-
console.log(`Device ${args['device-id']} added to fleet ${fleet.fleetId} (${fleet.deviceIds.length} device(s))`);
|
|
402
|
-
},
|
|
403
|
-
},
|
|
404
|
-
{
|
|
405
|
-
name: 'iot fleet remove',
|
|
406
|
-
description: 'Remove a device from a fleet',
|
|
407
|
-
options: [
|
|
408
|
-
{ name: 'fleet-id', short: 'i', description: 'Fleet identifier', type: 'string', required: true },
|
|
409
|
-
{ name: 'device-id', short: 'd', description: 'Device identifier', type: 'string', required: true },
|
|
410
|
-
],
|
|
411
|
-
handler: async (args) => {
|
|
412
|
-
const coordinator = requireCoordinator(getCoordinator);
|
|
413
|
-
const fleet = await coordinator.removeDeviceFromFleet(args['fleet-id'], args['device-id']);
|
|
414
|
-
console.log(`Device ${args['device-id']} removed from fleet ${fleet.fleetId} (${fleet.deviceIds.length} device(s))`);
|
|
415
|
-
},
|
|
416
|
-
},
|
|
417
|
-
{
|
|
418
|
-
name: 'iot fleet delete',
|
|
419
|
-
description: 'Delete a fleet',
|
|
420
|
-
arguments: [{ name: 'fleet-id', description: 'Fleet identifier to delete', required: true }],
|
|
421
|
-
handler: async (args) => {
|
|
422
|
-
const coordinator = requireCoordinator(getCoordinator);
|
|
423
|
-
await coordinator.deleteFleet(args._[0]);
|
|
424
|
-
console.log(`Fleet ${args._[0]} deleted.`);
|
|
425
|
-
},
|
|
426
|
-
},
|
|
427
|
-
// -- Telemetry anomaly detection (Phase 2) --------------------------------
|
|
428
|
-
{
|
|
429
|
-
name: 'iot anomalies',
|
|
430
|
-
description: 'Show detected anomalies for a device',
|
|
431
|
-
arguments: [{ name: 'device-id', description: 'Device identifier', required: true }],
|
|
432
|
-
options: [
|
|
433
|
-
{ name: 'format', short: 'f', description: 'Output format (table, json)', type: 'string', default: 'table' },
|
|
434
|
-
],
|
|
435
|
-
handler: async (args) => {
|
|
436
|
-
const coordinator = requireCoordinator(getCoordinator);
|
|
437
|
-
const deviceId = args._[0];
|
|
438
|
-
const format = args['format'];
|
|
439
|
-
const baseline = coordinator.getBaseline(deviceId);
|
|
440
|
-
if (!baseline) {
|
|
441
|
-
console.log(`No baseline computed for device ${deviceId}. Run "iot baseline ${deviceId} --compute" first.`);
|
|
442
|
-
return;
|
|
443
|
-
}
|
|
444
|
-
console.log(`Baseline for device ${deviceId}:`);
|
|
445
|
-
if (format === 'json') {
|
|
446
|
-
console.log(JSON.stringify(baseline, null, 2));
|
|
447
|
-
}
|
|
448
|
-
else {
|
|
449
|
-
console.log(` Dimensions: ${baseline.meanVector.length}`);
|
|
450
|
-
console.log(` Samples: ${baseline.sampleCount}`);
|
|
451
|
-
console.log(` Computed: ${baseline.computedAt.toISOString()}`);
|
|
452
|
-
}
|
|
453
|
-
},
|
|
454
|
-
},
|
|
455
|
-
{
|
|
456
|
-
name: 'iot baseline',
|
|
457
|
-
description: 'Compute or show telemetry baseline for a device',
|
|
458
|
-
arguments: [{ name: 'device-id', description: 'Device identifier', required: true }],
|
|
459
|
-
options: [
|
|
460
|
-
{ name: 'compute', short: 'c', description: 'Recompute baseline from recent readings', type: 'boolean' },
|
|
461
|
-
],
|
|
462
|
-
handler: async (args) => {
|
|
463
|
-
const coordinator = requireCoordinator(getCoordinator);
|
|
464
|
-
const deviceId = args._[0];
|
|
465
|
-
const compute = args['compute'];
|
|
466
|
-
if (compute) {
|
|
467
|
-
console.log(`Computing baseline for device ${deviceId}...`);
|
|
468
|
-
console.log('Note: requires telemetry readings to be ingested first.');
|
|
469
|
-
console.log('Use "iot ingest -d <device-id>" to provide readings, then rerun with --compute.');
|
|
470
|
-
return;
|
|
471
|
-
}
|
|
472
|
-
const baseline = coordinator.getBaseline(deviceId);
|
|
473
|
-
if (!baseline) {
|
|
474
|
-
console.log(`No baseline for device ${deviceId}. Use --compute to build from telemetry.`);
|
|
475
|
-
return;
|
|
476
|
-
}
|
|
477
|
-
console.log(`Baseline for device ${deviceId}:`);
|
|
478
|
-
console.log(` Dimensions: ${baseline.meanVector.length}`);
|
|
479
|
-
console.log(` Samples: ${baseline.sampleCount}`);
|
|
480
|
-
console.log(` Computed: ${baseline.computedAt.toISOString()}`);
|
|
481
|
-
},
|
|
482
|
-
},
|
|
483
|
-
{
|
|
484
|
-
name: 'iot witness verify',
|
|
485
|
-
description: 'Verify witness chain integrity for a device',
|
|
486
|
-
arguments: [{ name: 'device-id', description: 'Device identifier', required: true }],
|
|
487
|
-
options: [],
|
|
488
|
-
handler: async (args) => {
|
|
489
|
-
const coordinator = requireCoordinator(getCoordinator);
|
|
490
|
-
const deviceId = args._[0];
|
|
491
|
-
const result = await coordinator.verifyWitnessChain(deviceId);
|
|
492
|
-
console.log(`Witness chain verification for ${deviceId}:`);
|
|
493
|
-
console.log(` Chain length: ${result.chainLength}`);
|
|
494
|
-
console.log(` Verified: ${result.verified ? 'YES' : 'NO'}`);
|
|
495
|
-
console.log(` Head epoch: ${result.headEpoch}`);
|
|
496
|
-
console.log(` Head hash: ${result.headHash || '(none)'}`);
|
|
497
|
-
console.log(` Integrity score: ${result.integrityScore.toFixed(3)}`);
|
|
498
|
-
if (result.gaps.length > 0) {
|
|
499
|
-
console.log(` Gaps (${result.gaps.length}):`);
|
|
500
|
-
for (const gap of result.gaps) {
|
|
501
|
-
console.log(` epoch ${gap.fromEpoch} → ${gap.toEpoch} (${gap.missingCount} missing)`);
|
|
502
|
-
}
|
|
503
|
-
}
|
|
504
|
-
},
|
|
505
|
-
},
|
|
506
|
-
];
|
|
507
|
-
}
|
|
508
|
-
//# sourceMappingURL=cli-commands.js.map
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import type { DeviceTrustLevel } from './device-trust-level.js';
|
|
2
|
-
export type DeviceStatus = 'online' | 'offline' | 'updating' | 'quarantined' | 'decommissioned';
|
|
3
|
-
export type DeviceCapability = 'vector-store' | 'ota-update' | 'mesh-routing' | 'witness-chain' | 'sensor-telemetry' | 'edge-compute' | 'mcp-server';
|
|
4
|
-
export interface DeviceTrustScore {
|
|
5
|
-
/** Composite trust score, 0.0 - 1.0. */
|
|
6
|
-
overall: number;
|
|
7
|
-
components: {
|
|
8
|
-
/** Auth / pairing success rate. */
|
|
9
|
-
pairingIntegrity: number;
|
|
10
|
-
/** 1.0 if running latest firmware; decays with version lag. */
|
|
11
|
-
firmwareCurrency: number;
|
|
12
|
-
/** Uptime ratio over a rolling window. */
|
|
13
|
-
uptimeStability: number;
|
|
14
|
-
/** Witness chain length / expected length. */
|
|
15
|
-
witnessIntegrity: number;
|
|
16
|
-
/** 1.0 minus anomaly rate. */
|
|
17
|
-
anomalyHistory: number;
|
|
18
|
-
/** Active peer count / expected peers. */
|
|
19
|
-
meshParticipation: number;
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
export interface VectorStoreStats {
|
|
23
|
-
totalVectors: number;
|
|
24
|
-
deletedVectors: number;
|
|
25
|
-
dimension: number;
|
|
26
|
-
fileSizeBytes: number;
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* Core entity: a Cognitum Seed device modelled as a Swarmdo agent.
|
|
30
|
-
*/
|
|
31
|
-
export interface DeviceAgent {
|
|
32
|
-
/** Unique device identifier from SeedIdentity.device_id. */
|
|
33
|
-
deviceId: string;
|
|
34
|
-
/** Ed25519 public key (hex-encoded). */
|
|
35
|
-
publicKey: string;
|
|
36
|
-
firmwareVersion: string;
|
|
37
|
-
trustLevel: DeviceTrustLevel;
|
|
38
|
-
trustScore: DeviceTrustScore;
|
|
39
|
-
fleetId: string;
|
|
40
|
-
/** IEC 62443 security zone identifier. */
|
|
41
|
-
zoneId: string;
|
|
42
|
-
status: DeviceStatus;
|
|
43
|
-
lastSeen: Date;
|
|
44
|
-
/** Firmware epoch counter. */
|
|
45
|
-
epoch: number;
|
|
46
|
-
capabilities: DeviceCapability[];
|
|
47
|
-
/** Device IDs of active mesh peers. */
|
|
48
|
-
meshPeers: string[];
|
|
49
|
-
vectorStoreStats: VectorStoreStats;
|
|
50
|
-
/** HTTP endpoint, e.g. "http://169.254.42.1". */
|
|
51
|
-
endpoint: string;
|
|
52
|
-
metadata: Record<string, unknown>;
|
|
53
|
-
}
|
|
54
|
-
//# sourceMappingURL=device-agent.d.ts.map
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
export type FleetTopology = 'star' | 'mesh' | 'hierarchical' | 'ring';
|
|
2
|
-
export type DeploymentStrategy = 'canary' | 'rolling' | 'blue-green' | 'all-at-once';
|
|
3
|
-
export interface FirmwarePolicy {
|
|
4
|
-
channel: string;
|
|
5
|
-
autoUpdate: boolean;
|
|
6
|
-
approvalRequired: boolean;
|
|
7
|
-
canaryPercentage: number;
|
|
8
|
-
canaryDurationMinutes: number;
|
|
9
|
-
rollbackOnAnomalyThreshold: number;
|
|
10
|
-
maintenanceWindow?: {
|
|
11
|
-
start: string;
|
|
12
|
-
end: string;
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
export interface TelemetryPolicy {
|
|
16
|
-
ingestionIntervalSeconds: number;
|
|
17
|
-
retentionDays: number;
|
|
18
|
-
anomalyDetectionEnabled: boolean;
|
|
19
|
-
anomalyThreshold: number;
|
|
20
|
-
vectorDimension: number;
|
|
21
|
-
}
|
|
22
|
-
export interface HealthThresholds {
|
|
23
|
-
maxOfflineMinutes: number;
|
|
24
|
-
minUptimeRatio: number;
|
|
25
|
-
maxConsecutiveAnomalies: number;
|
|
26
|
-
minFirmwareCurrency: number;
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* Fleet grouping for Cognitum Seed devices.
|
|
30
|
-
* A fleet shares firmware policy, telemetry policy, and health thresholds.
|
|
31
|
-
*/
|
|
32
|
-
export interface DeviceFleet {
|
|
33
|
-
fleetId: string;
|
|
34
|
-
name: string;
|
|
35
|
-
description: string;
|
|
36
|
-
/** IEC 62443 security zone for the fleet. */
|
|
37
|
-
zoneId: string;
|
|
38
|
-
deviceIds: string[];
|
|
39
|
-
firmwarePolicy: FirmwarePolicy;
|
|
40
|
-
telemetryPolicy: TelemetryPolicy;
|
|
41
|
-
healthThresholds: HealthThresholds;
|
|
42
|
-
topology: FleetTopology;
|
|
43
|
-
createdAt: Date;
|
|
44
|
-
updatedAt: Date;
|
|
45
|
-
}
|
|
46
|
-
//# sourceMappingURL=device-fleet.d.ts.map
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* IoT-adapted trust levels for Cognitum Seed devices.
|
|
3
|
-
* Mirrors Swarmdo agent trust but adds hardware-specific stages.
|
|
4
|
-
*/
|
|
5
|
-
export declare enum DeviceTrustLevel {
|
|
6
|
-
/** Seen on the network but not paired. */
|
|
7
|
-
UNKNOWN = 0,
|
|
8
|
-
/** Paired, identity verified via Ed25519. */
|
|
9
|
-
REGISTERED = 1,
|
|
10
|
-
/** Firmware verified, policies applied, security zone assigned. */
|
|
11
|
-
PROVISIONED = 2,
|
|
12
|
-
/** Extended uptime, clean witness chain, anomaly-free history. */
|
|
13
|
-
CERTIFIED = 3,
|
|
14
|
-
/** Fleet-level attestation across multiple devices. */
|
|
15
|
-
FLEET_TRUSTED = 4
|
|
16
|
-
}
|
|
17
|
-
export declare function getDeviceTrustLabel(level: DeviceTrustLevel): string;
|
|
18
|
-
//# sourceMappingURL=device-trust-level.d.ts.map
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* IoT-adapted trust levels for Cognitum Seed devices.
|
|
3
|
-
* Mirrors Swarmdo agent trust but adds hardware-specific stages.
|
|
4
|
-
*/
|
|
5
|
-
export var DeviceTrustLevel;
|
|
6
|
-
(function (DeviceTrustLevel) {
|
|
7
|
-
/** Seen on the network but not paired. */
|
|
8
|
-
DeviceTrustLevel[DeviceTrustLevel["UNKNOWN"] = 0] = "UNKNOWN";
|
|
9
|
-
/** Paired, identity verified via Ed25519. */
|
|
10
|
-
DeviceTrustLevel[DeviceTrustLevel["REGISTERED"] = 1] = "REGISTERED";
|
|
11
|
-
/** Firmware verified, policies applied, security zone assigned. */
|
|
12
|
-
DeviceTrustLevel[DeviceTrustLevel["PROVISIONED"] = 2] = "PROVISIONED";
|
|
13
|
-
/** Extended uptime, clean witness chain, anomaly-free history. */
|
|
14
|
-
DeviceTrustLevel[DeviceTrustLevel["CERTIFIED"] = 3] = "CERTIFIED";
|
|
15
|
-
/** Fleet-level attestation across multiple devices. */
|
|
16
|
-
DeviceTrustLevel[DeviceTrustLevel["FLEET_TRUSTED"] = 4] = "FLEET_TRUSTED";
|
|
17
|
-
})(DeviceTrustLevel || (DeviceTrustLevel = {}));
|
|
18
|
-
const LABELS = {
|
|
19
|
-
[DeviceTrustLevel.UNKNOWN]: 'unknown',
|
|
20
|
-
[DeviceTrustLevel.REGISTERED]: 'registered',
|
|
21
|
-
[DeviceTrustLevel.PROVISIONED]: 'provisioned',
|
|
22
|
-
[DeviceTrustLevel.CERTIFIED]: 'certified',
|
|
23
|
-
[DeviceTrustLevel.FLEET_TRUSTED]: 'fleet-trusted',
|
|
24
|
-
};
|
|
25
|
-
export function getDeviceTrustLabel(level) {
|
|
26
|
-
return LABELS[level] ?? 'unknown';
|
|
27
|
-
}
|
|
28
|
-
//# sourceMappingURL=device-trust-level.js.map
|