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,703 +0,0 @@
|
|
|
1
|
-
function textResult(text, isError = false) {
|
|
2
|
-
return { content: [{ type: 'text', text }], isError };
|
|
3
|
-
}
|
|
4
|
-
export function createMcpTools(getCoordinator, _getContext) {
|
|
5
|
-
function requireCoordinator() {
|
|
6
|
-
const c = getCoordinator();
|
|
7
|
-
if (!c)
|
|
8
|
-
throw new Error('IoT Cognitum not initialized');
|
|
9
|
-
return c;
|
|
10
|
-
}
|
|
11
|
-
return [
|
|
12
|
-
// -- Device lifecycle ----------------------------------------------------
|
|
13
|
-
{
|
|
14
|
-
name: 'iot_device_register',
|
|
15
|
-
description: 'Register a Cognitum Seed device by endpoint',
|
|
16
|
-
pluginName: '@swarmdo/plugin-iot-cognitum',
|
|
17
|
-
version: '1.0.0-alpha.1',
|
|
18
|
-
inputSchema: {
|
|
19
|
-
type: 'object',
|
|
20
|
-
properties: {
|
|
21
|
-
endpoint: { type: 'string', description: 'Device HTTP endpoint (e.g. http://169.254.42.1)' },
|
|
22
|
-
pairingToken: { type: 'string', description: 'Optional pairing token for mutual auth' },
|
|
23
|
-
},
|
|
24
|
-
required: ['endpoint'],
|
|
25
|
-
},
|
|
26
|
-
handler: async (params) => {
|
|
27
|
-
try {
|
|
28
|
-
const coordinator = requireCoordinator();
|
|
29
|
-
const device = await coordinator.registerDevice(params['endpoint'], params['pairingToken']);
|
|
30
|
-
return textResult(JSON.stringify(device, null, 2));
|
|
31
|
-
}
|
|
32
|
-
catch (err) {
|
|
33
|
-
return textResult(`Registration failed: ${err.message}`, true);
|
|
34
|
-
}
|
|
35
|
-
},
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
name: 'iot_device_status',
|
|
39
|
-
description: 'Get device status and trust score',
|
|
40
|
-
pluginName: '@swarmdo/plugin-iot-cognitum',
|
|
41
|
-
version: '1.0.0-alpha.1',
|
|
42
|
-
inputSchema: {
|
|
43
|
-
type: 'object',
|
|
44
|
-
properties: {
|
|
45
|
-
deviceId: { type: 'string', description: 'Device identifier' },
|
|
46
|
-
},
|
|
47
|
-
required: ['deviceId'],
|
|
48
|
-
},
|
|
49
|
-
handler: async (params) => {
|
|
50
|
-
try {
|
|
51
|
-
const coordinator = requireCoordinator();
|
|
52
|
-
const status = await coordinator.getDeviceStatus(params['deviceId']);
|
|
53
|
-
return textResult(JSON.stringify(status, null, 2));
|
|
54
|
-
}
|
|
55
|
-
catch (err) {
|
|
56
|
-
return textResult(`Status failed: ${err.message}`, true);
|
|
57
|
-
}
|
|
58
|
-
},
|
|
59
|
-
},
|
|
60
|
-
{
|
|
61
|
-
name: 'iot_device_list',
|
|
62
|
-
description: 'List all registered devices',
|
|
63
|
-
pluginName: '@swarmdo/plugin-iot-cognitum',
|
|
64
|
-
version: '1.0.0-alpha.1',
|
|
65
|
-
inputSchema: {
|
|
66
|
-
type: 'object',
|
|
67
|
-
properties: {},
|
|
68
|
-
},
|
|
69
|
-
handler: async () => {
|
|
70
|
-
try {
|
|
71
|
-
const coordinator = requireCoordinator();
|
|
72
|
-
const devices = coordinator.listDevices();
|
|
73
|
-
return textResult(JSON.stringify(devices, null, 2));
|
|
74
|
-
}
|
|
75
|
-
catch (err) {
|
|
76
|
-
return textResult(`List failed: ${err.message}`, true);
|
|
77
|
-
}
|
|
78
|
-
},
|
|
79
|
-
},
|
|
80
|
-
{
|
|
81
|
-
name: 'iot_device_remove',
|
|
82
|
-
description: 'Remove a registered device',
|
|
83
|
-
pluginName: '@swarmdo/plugin-iot-cognitum',
|
|
84
|
-
version: '1.0.0-alpha.1',
|
|
85
|
-
inputSchema: {
|
|
86
|
-
type: 'object',
|
|
87
|
-
properties: {
|
|
88
|
-
deviceId: { type: 'string', description: 'Device identifier to remove' },
|
|
89
|
-
},
|
|
90
|
-
required: ['deviceId'],
|
|
91
|
-
},
|
|
92
|
-
handler: async (params) => {
|
|
93
|
-
try {
|
|
94
|
-
const coordinator = requireCoordinator();
|
|
95
|
-
await coordinator.removeDevice(params['deviceId']);
|
|
96
|
-
return textResult(`Device ${params['deviceId']} removed`);
|
|
97
|
-
}
|
|
98
|
-
catch (err) {
|
|
99
|
-
return textResult(`Remove failed: ${err.message}`, true);
|
|
100
|
-
}
|
|
101
|
-
},
|
|
102
|
-
},
|
|
103
|
-
{
|
|
104
|
-
name: 'iot_device_pair',
|
|
105
|
-
description: 'Pair with a registered device to establish mutual trust',
|
|
106
|
-
pluginName: '@swarmdo/plugin-iot-cognitum',
|
|
107
|
-
version: '1.0.0-alpha.1',
|
|
108
|
-
inputSchema: {
|
|
109
|
-
type: 'object',
|
|
110
|
-
properties: {
|
|
111
|
-
deviceId: { type: 'string', description: 'Device identifier' },
|
|
112
|
-
clientName: { type: 'string', description: 'Client name for the pairing session' },
|
|
113
|
-
},
|
|
114
|
-
required: ['deviceId', 'clientName'],
|
|
115
|
-
},
|
|
116
|
-
handler: async (params) => {
|
|
117
|
-
try {
|
|
118
|
-
const coordinator = requireCoordinator();
|
|
119
|
-
const device = await coordinator.pairDevice(params['deviceId'], params['clientName']);
|
|
120
|
-
return textResult(JSON.stringify(device, null, 2));
|
|
121
|
-
}
|
|
122
|
-
catch (err) {
|
|
123
|
-
return textResult(`Pairing failed: ${err.message}`, true);
|
|
124
|
-
}
|
|
125
|
-
},
|
|
126
|
-
},
|
|
127
|
-
{
|
|
128
|
-
name: 'iot_device_unpair',
|
|
129
|
-
description: 'Unpair from a registered device',
|
|
130
|
-
pluginName: '@swarmdo/plugin-iot-cognitum',
|
|
131
|
-
version: '1.0.0-alpha.1',
|
|
132
|
-
inputSchema: {
|
|
133
|
-
type: 'object',
|
|
134
|
-
properties: {
|
|
135
|
-
deviceId: { type: 'string', description: 'Device identifier' },
|
|
136
|
-
},
|
|
137
|
-
required: ['deviceId'],
|
|
138
|
-
},
|
|
139
|
-
handler: async (params) => {
|
|
140
|
-
try {
|
|
141
|
-
const coordinator = requireCoordinator();
|
|
142
|
-
const device = await coordinator.unpairDevice(params['deviceId']);
|
|
143
|
-
return textResult(JSON.stringify(device, null, 2));
|
|
144
|
-
}
|
|
145
|
-
catch (err) {
|
|
146
|
-
return textResult(`Unpair failed: ${err.message}`, true);
|
|
147
|
-
}
|
|
148
|
-
},
|
|
149
|
-
},
|
|
150
|
-
// -- Vector store --------------------------------------------------------
|
|
151
|
-
{
|
|
152
|
-
name: 'iot_store_query',
|
|
153
|
-
description: 'Query device vector store',
|
|
154
|
-
pluginName: '@swarmdo/plugin-iot-cognitum',
|
|
155
|
-
version: '1.0.0-alpha.1',
|
|
156
|
-
inputSchema: {
|
|
157
|
-
type: 'object',
|
|
158
|
-
properties: {
|
|
159
|
-
deviceId: { type: 'string', description: 'Device identifier' },
|
|
160
|
-
vector: { type: 'array', description: 'Query vector', items: { type: 'number' } },
|
|
161
|
-
k: { type: 'number', description: 'Number of nearest neighbours to return' },
|
|
162
|
-
},
|
|
163
|
-
required: ['deviceId', 'vector', 'k'],
|
|
164
|
-
},
|
|
165
|
-
handler: async (params) => {
|
|
166
|
-
try {
|
|
167
|
-
const coordinator = requireCoordinator();
|
|
168
|
-
const result = await coordinator.queryDeviceVectors(params['deviceId'], params['vector'], params['k']);
|
|
169
|
-
return textResult(JSON.stringify(result, null, 2));
|
|
170
|
-
}
|
|
171
|
-
catch (err) {
|
|
172
|
-
return textResult(`Query failed: ${err.message}`, true);
|
|
173
|
-
}
|
|
174
|
-
},
|
|
175
|
-
},
|
|
176
|
-
{
|
|
177
|
-
name: 'iot_store_ingest',
|
|
178
|
-
description: 'Ingest vectors into device store',
|
|
179
|
-
pluginName: '@swarmdo/plugin-iot-cognitum',
|
|
180
|
-
version: '1.0.0-alpha.1',
|
|
181
|
-
inputSchema: {
|
|
182
|
-
type: 'object',
|
|
183
|
-
properties: {
|
|
184
|
-
deviceId: { type: 'string', description: 'Device identifier' },
|
|
185
|
-
vectors: {
|
|
186
|
-
type: 'array',
|
|
187
|
-
description: 'Array of vectors with optional metadata',
|
|
188
|
-
items: {
|
|
189
|
-
type: 'object',
|
|
190
|
-
properties: {
|
|
191
|
-
values: { type: 'array', description: 'Vector values', items: { type: 'number' } },
|
|
192
|
-
metadata: { type: 'object', description: 'Optional metadata' },
|
|
193
|
-
},
|
|
194
|
-
required: ['values'],
|
|
195
|
-
},
|
|
196
|
-
},
|
|
197
|
-
},
|
|
198
|
-
required: ['deviceId', 'vectors'],
|
|
199
|
-
},
|
|
200
|
-
handler: async (params) => {
|
|
201
|
-
try {
|
|
202
|
-
const coordinator = requireCoordinator();
|
|
203
|
-
const result = await coordinator.ingestDeviceTelemetry(params['deviceId'], params['vectors']);
|
|
204
|
-
return textResult(JSON.stringify(result, null, 2));
|
|
205
|
-
}
|
|
206
|
-
catch (err) {
|
|
207
|
-
return textResult(`Ingest failed: ${err.message}`, true);
|
|
208
|
-
}
|
|
209
|
-
},
|
|
210
|
-
},
|
|
211
|
-
{
|
|
212
|
-
name: 'iot_store_status',
|
|
213
|
-
description: 'Get vector store health',
|
|
214
|
-
pluginName: '@swarmdo/plugin-iot-cognitum',
|
|
215
|
-
version: '1.0.0-alpha.1',
|
|
216
|
-
inputSchema: {
|
|
217
|
-
type: 'object',
|
|
218
|
-
properties: {
|
|
219
|
-
deviceId: { type: 'string', description: 'Device identifier' },
|
|
220
|
-
},
|
|
221
|
-
required: ['deviceId'],
|
|
222
|
-
},
|
|
223
|
-
handler: async (params) => {
|
|
224
|
-
try {
|
|
225
|
-
const coordinator = requireCoordinator();
|
|
226
|
-
const health = await coordinator.getDeviceStoreStatus(params['deviceId']);
|
|
227
|
-
return textResult(JSON.stringify(health, null, 2));
|
|
228
|
-
}
|
|
229
|
-
catch (err) {
|
|
230
|
-
return textResult(`Store status failed: ${err.message}`, true);
|
|
231
|
-
}
|
|
232
|
-
},
|
|
233
|
-
},
|
|
234
|
-
// -- Mesh / witness / custody --------------------------------------------
|
|
235
|
-
{
|
|
236
|
-
name: 'iot_mesh_topology',
|
|
237
|
-
description: 'Get mesh network topology',
|
|
238
|
-
pluginName: '@swarmdo/plugin-iot-cognitum',
|
|
239
|
-
version: '1.0.0-alpha.1',
|
|
240
|
-
inputSchema: {
|
|
241
|
-
type: 'object',
|
|
242
|
-
properties: {
|
|
243
|
-
deviceId: { type: 'string', description: 'Device identifier' },
|
|
244
|
-
},
|
|
245
|
-
required: ['deviceId'],
|
|
246
|
-
},
|
|
247
|
-
handler: async (params) => {
|
|
248
|
-
try {
|
|
249
|
-
const coordinator = requireCoordinator();
|
|
250
|
-
const topology = await coordinator.getDeviceMeshTopology(params['deviceId']);
|
|
251
|
-
return textResult(JSON.stringify(topology, null, 2));
|
|
252
|
-
}
|
|
253
|
-
catch (err) {
|
|
254
|
-
return textResult(`Mesh topology failed: ${err.message}`, true);
|
|
255
|
-
}
|
|
256
|
-
},
|
|
257
|
-
},
|
|
258
|
-
{
|
|
259
|
-
name: 'iot_witness_chain',
|
|
260
|
-
description: 'Get witness chain provenance',
|
|
261
|
-
pluginName: '@swarmdo/plugin-iot-cognitum',
|
|
262
|
-
version: '1.0.0-alpha.1',
|
|
263
|
-
inputSchema: {
|
|
264
|
-
type: 'object',
|
|
265
|
-
properties: {
|
|
266
|
-
deviceId: { type: 'string', description: 'Device identifier' },
|
|
267
|
-
},
|
|
268
|
-
required: ['deviceId'],
|
|
269
|
-
},
|
|
270
|
-
handler: async (params) => {
|
|
271
|
-
try {
|
|
272
|
-
const coordinator = requireCoordinator();
|
|
273
|
-
const chain = await coordinator.getDeviceWitnessChain(params['deviceId']);
|
|
274
|
-
return textResult(JSON.stringify(chain, null, 2));
|
|
275
|
-
}
|
|
276
|
-
catch (err) {
|
|
277
|
-
return textResult(`Witness chain failed: ${err.message}`, true);
|
|
278
|
-
}
|
|
279
|
-
},
|
|
280
|
-
},
|
|
281
|
-
{
|
|
282
|
-
name: 'iot_custody_epoch',
|
|
283
|
-
description: 'Get custody epoch',
|
|
284
|
-
pluginName: '@swarmdo/plugin-iot-cognitum',
|
|
285
|
-
version: '1.0.0-alpha.1',
|
|
286
|
-
inputSchema: {
|
|
287
|
-
type: 'object',
|
|
288
|
-
properties: {
|
|
289
|
-
deviceId: { type: 'string', description: 'Device identifier' },
|
|
290
|
-
},
|
|
291
|
-
required: ['deviceId'],
|
|
292
|
-
},
|
|
293
|
-
handler: async (params) => {
|
|
294
|
-
try {
|
|
295
|
-
const coordinator = requireCoordinator();
|
|
296
|
-
const epoch = await coordinator.getDeviceCustodyEpoch(params['deviceId']);
|
|
297
|
-
return textResult(JSON.stringify(epoch, null, 2));
|
|
298
|
-
}
|
|
299
|
-
catch (err) {
|
|
300
|
-
return textResult(`Custody epoch failed: ${err.message}`, true);
|
|
301
|
-
}
|
|
302
|
-
},
|
|
303
|
-
},
|
|
304
|
-
// -- Fleet ---------------------------------------------------------------
|
|
305
|
-
{
|
|
306
|
-
name: 'iot_fleet_status',
|
|
307
|
-
description: 'Get fleet overview',
|
|
308
|
-
pluginName: '@swarmdo/plugin-iot-cognitum',
|
|
309
|
-
version: '1.0.0-alpha.1',
|
|
310
|
-
inputSchema: {
|
|
311
|
-
type: 'object',
|
|
312
|
-
properties: {},
|
|
313
|
-
},
|
|
314
|
-
handler: async () => {
|
|
315
|
-
try {
|
|
316
|
-
const coordinator = requireCoordinator();
|
|
317
|
-
const status = coordinator.getStatus();
|
|
318
|
-
return textResult(JSON.stringify(status, null, 2));
|
|
319
|
-
}
|
|
320
|
-
catch (err) {
|
|
321
|
-
return textResult(`Fleet status failed: ${err.message}`, true);
|
|
322
|
-
}
|
|
323
|
-
},
|
|
324
|
-
},
|
|
325
|
-
// -- Firmware orchestration (Phase 3) ---------------------------------------
|
|
326
|
-
{
|
|
327
|
-
name: 'iot_firmware_rollout_create',
|
|
328
|
-
description: 'Create a firmware rollout for a fleet',
|
|
329
|
-
pluginName: '@swarmdo/plugin-iot-cognitum',
|
|
330
|
-
version: '1.0.0-alpha.1',
|
|
331
|
-
inputSchema: {
|
|
332
|
-
type: 'object',
|
|
333
|
-
properties: {
|
|
334
|
-
fleetId: { type: 'string', description: 'Fleet identifier' },
|
|
335
|
-
firmwareVersion: { type: 'string', description: 'Target firmware version' },
|
|
336
|
-
},
|
|
337
|
-
required: ['fleetId', 'firmwareVersion'],
|
|
338
|
-
},
|
|
339
|
-
handler: async (params) => {
|
|
340
|
-
try {
|
|
341
|
-
const coordinator = requireCoordinator();
|
|
342
|
-
const rollout = await coordinator.createFirmwareRollout(params['fleetId'], params['firmwareVersion']);
|
|
343
|
-
return textResult(JSON.stringify(rollout, null, 2));
|
|
344
|
-
}
|
|
345
|
-
catch (err) {
|
|
346
|
-
return textResult(`Rollout create failed: ${err.message}`, true);
|
|
347
|
-
}
|
|
348
|
-
},
|
|
349
|
-
},
|
|
350
|
-
{
|
|
351
|
-
name: 'iot_firmware_rollout_advance',
|
|
352
|
-
description: 'Advance a firmware rollout to next stage',
|
|
353
|
-
pluginName: '@swarmdo/plugin-iot-cognitum',
|
|
354
|
-
version: '1.0.0-alpha.1',
|
|
355
|
-
inputSchema: {
|
|
356
|
-
type: 'object',
|
|
357
|
-
properties: {
|
|
358
|
-
rolloutId: { type: 'string', description: 'Rollout identifier' },
|
|
359
|
-
},
|
|
360
|
-
required: ['rolloutId'],
|
|
361
|
-
},
|
|
362
|
-
handler: async (params) => {
|
|
363
|
-
try {
|
|
364
|
-
const coordinator = requireCoordinator();
|
|
365
|
-
const rollout = await coordinator.advanceFirmwareRollout(params['rolloutId']);
|
|
366
|
-
return textResult(JSON.stringify(rollout, null, 2));
|
|
367
|
-
}
|
|
368
|
-
catch (err) {
|
|
369
|
-
return textResult(`Rollout advance failed: ${err.message}`, true);
|
|
370
|
-
}
|
|
371
|
-
},
|
|
372
|
-
},
|
|
373
|
-
{
|
|
374
|
-
name: 'iot_firmware_rollout_rollback',
|
|
375
|
-
description: 'Force rollback a firmware rollout',
|
|
376
|
-
pluginName: '@swarmdo/plugin-iot-cognitum',
|
|
377
|
-
version: '1.0.0-alpha.1',
|
|
378
|
-
inputSchema: {
|
|
379
|
-
type: 'object',
|
|
380
|
-
properties: {
|
|
381
|
-
rolloutId: { type: 'string', description: 'Rollout identifier' },
|
|
382
|
-
},
|
|
383
|
-
required: ['rolloutId'],
|
|
384
|
-
},
|
|
385
|
-
handler: async (params) => {
|
|
386
|
-
try {
|
|
387
|
-
const coordinator = requireCoordinator();
|
|
388
|
-
const rollout = coordinator.rollbackFirmwareRollout(params['rolloutId']);
|
|
389
|
-
return textResult(JSON.stringify(rollout, null, 2));
|
|
390
|
-
}
|
|
391
|
-
catch (err) {
|
|
392
|
-
return textResult(`Rollout rollback failed: ${err.message}`, true);
|
|
393
|
-
}
|
|
394
|
-
},
|
|
395
|
-
},
|
|
396
|
-
{
|
|
397
|
-
name: 'iot_firmware_rollout_status',
|
|
398
|
-
description: 'Get firmware rollout status',
|
|
399
|
-
pluginName: '@swarmdo/plugin-iot-cognitum',
|
|
400
|
-
version: '1.0.0-alpha.1',
|
|
401
|
-
inputSchema: {
|
|
402
|
-
type: 'object',
|
|
403
|
-
properties: {
|
|
404
|
-
rolloutId: { type: 'string', description: 'Rollout identifier' },
|
|
405
|
-
},
|
|
406
|
-
required: ['rolloutId'],
|
|
407
|
-
},
|
|
408
|
-
handler: async (params) => {
|
|
409
|
-
try {
|
|
410
|
-
const coordinator = requireCoordinator();
|
|
411
|
-
const rollout = coordinator.getFirmwareRollout(params['rolloutId']);
|
|
412
|
-
return textResult(JSON.stringify(rollout, null, 2));
|
|
413
|
-
}
|
|
414
|
-
catch (err) {
|
|
415
|
-
return textResult(`Rollout status failed: ${err.message}`, true);
|
|
416
|
-
}
|
|
417
|
-
},
|
|
418
|
-
},
|
|
419
|
-
{
|
|
420
|
-
name: 'iot_firmware_rollout_list',
|
|
421
|
-
description: 'List firmware rollouts',
|
|
422
|
-
pluginName: '@swarmdo/plugin-iot-cognitum',
|
|
423
|
-
version: '1.0.0-alpha.1',
|
|
424
|
-
inputSchema: {
|
|
425
|
-
type: 'object',
|
|
426
|
-
properties: {
|
|
427
|
-
fleetId: { type: 'string', description: 'Optional fleet filter' },
|
|
428
|
-
},
|
|
429
|
-
},
|
|
430
|
-
handler: async (params) => {
|
|
431
|
-
try {
|
|
432
|
-
const coordinator = requireCoordinator();
|
|
433
|
-
const rollouts = coordinator.listFirmwareRollouts(params['fleetId']);
|
|
434
|
-
return textResult(JSON.stringify(rollouts, null, 2));
|
|
435
|
-
}
|
|
436
|
-
catch (err) {
|
|
437
|
-
return textResult(`Rollout list failed: ${err.message}`, true);
|
|
438
|
-
}
|
|
439
|
-
},
|
|
440
|
-
},
|
|
441
|
-
// -- Fleet management (Phase 3) --------------------------------------------
|
|
442
|
-
{
|
|
443
|
-
name: 'iot_fleet_create',
|
|
444
|
-
description: 'Create a new device fleet',
|
|
445
|
-
pluginName: '@swarmdo/plugin-iot-cognitum',
|
|
446
|
-
version: '1.0.0-alpha.1',
|
|
447
|
-
inputSchema: {
|
|
448
|
-
type: 'object',
|
|
449
|
-
properties: {
|
|
450
|
-
fleetId: { type: 'string', description: 'Fleet identifier' },
|
|
451
|
-
name: { type: 'string', description: 'Fleet display name' },
|
|
452
|
-
zoneId: { type: 'string', description: 'IEC 62443 security zone' },
|
|
453
|
-
topology: { type: 'string', enum: ['star', 'mesh', 'hierarchical', 'ring'], description: 'Fleet topology' },
|
|
454
|
-
description: { type: 'string', description: 'Fleet description' },
|
|
455
|
-
},
|
|
456
|
-
required: ['fleetId', 'name', 'zoneId'],
|
|
457
|
-
},
|
|
458
|
-
handler: async (params) => {
|
|
459
|
-
try {
|
|
460
|
-
const coordinator = requireCoordinator();
|
|
461
|
-
const fleet = await coordinator.createFleet({
|
|
462
|
-
fleetId: params['fleetId'],
|
|
463
|
-
name: params['name'],
|
|
464
|
-
zoneId: params['zoneId'],
|
|
465
|
-
topology: params['topology'],
|
|
466
|
-
description: params['description'],
|
|
467
|
-
});
|
|
468
|
-
return textResult(JSON.stringify(fleet, null, 2));
|
|
469
|
-
}
|
|
470
|
-
catch (err) {
|
|
471
|
-
return textResult(`Fleet create failed: ${err.message}`, true);
|
|
472
|
-
}
|
|
473
|
-
},
|
|
474
|
-
},
|
|
475
|
-
{
|
|
476
|
-
name: 'iot_fleet_get',
|
|
477
|
-
description: 'Get fleet details',
|
|
478
|
-
pluginName: '@swarmdo/plugin-iot-cognitum',
|
|
479
|
-
version: '1.0.0-alpha.1',
|
|
480
|
-
inputSchema: {
|
|
481
|
-
type: 'object',
|
|
482
|
-
properties: {
|
|
483
|
-
fleetId: { type: 'string', description: 'Fleet identifier' },
|
|
484
|
-
},
|
|
485
|
-
required: ['fleetId'],
|
|
486
|
-
},
|
|
487
|
-
handler: async (params) => {
|
|
488
|
-
try {
|
|
489
|
-
const coordinator = requireCoordinator();
|
|
490
|
-
const fleet = await coordinator.getFleet(params['fleetId']);
|
|
491
|
-
return textResult(JSON.stringify(fleet, null, 2));
|
|
492
|
-
}
|
|
493
|
-
catch (err) {
|
|
494
|
-
return textResult(`Fleet get failed: ${err.message}`, true);
|
|
495
|
-
}
|
|
496
|
-
},
|
|
497
|
-
},
|
|
498
|
-
{
|
|
499
|
-
name: 'iot_fleet_list',
|
|
500
|
-
description: 'List all fleets',
|
|
501
|
-
pluginName: '@swarmdo/plugin-iot-cognitum',
|
|
502
|
-
version: '1.0.0-alpha.1',
|
|
503
|
-
inputSchema: {
|
|
504
|
-
type: 'object',
|
|
505
|
-
properties: {},
|
|
506
|
-
},
|
|
507
|
-
handler: async () => {
|
|
508
|
-
try {
|
|
509
|
-
const coordinator = requireCoordinator();
|
|
510
|
-
const fleets = await coordinator.listFleets();
|
|
511
|
-
return textResult(JSON.stringify(fleets, null, 2));
|
|
512
|
-
}
|
|
513
|
-
catch (err) {
|
|
514
|
-
return textResult(`Fleet list failed: ${err.message}`, true);
|
|
515
|
-
}
|
|
516
|
-
},
|
|
517
|
-
},
|
|
518
|
-
{
|
|
519
|
-
name: 'iot_fleet_add_device',
|
|
520
|
-
description: 'Add a registered device to a fleet',
|
|
521
|
-
pluginName: '@swarmdo/plugin-iot-cognitum',
|
|
522
|
-
version: '1.0.0-alpha.1',
|
|
523
|
-
inputSchema: {
|
|
524
|
-
type: 'object',
|
|
525
|
-
properties: {
|
|
526
|
-
fleetId: { type: 'string', description: 'Fleet identifier' },
|
|
527
|
-
deviceId: { type: 'string', description: 'Device identifier' },
|
|
528
|
-
},
|
|
529
|
-
required: ['fleetId', 'deviceId'],
|
|
530
|
-
},
|
|
531
|
-
handler: async (params) => {
|
|
532
|
-
try {
|
|
533
|
-
const coordinator = requireCoordinator();
|
|
534
|
-
const fleet = await coordinator.addDeviceToFleet(params['fleetId'], params['deviceId']);
|
|
535
|
-
return textResult(JSON.stringify(fleet, null, 2));
|
|
536
|
-
}
|
|
537
|
-
catch (err) {
|
|
538
|
-
return textResult(`Fleet add device failed: ${err.message}`, true);
|
|
539
|
-
}
|
|
540
|
-
},
|
|
541
|
-
},
|
|
542
|
-
{
|
|
543
|
-
name: 'iot_fleet_remove_device',
|
|
544
|
-
description: 'Remove a device from a fleet',
|
|
545
|
-
pluginName: '@swarmdo/plugin-iot-cognitum',
|
|
546
|
-
version: '1.0.0-alpha.1',
|
|
547
|
-
inputSchema: {
|
|
548
|
-
type: 'object',
|
|
549
|
-
properties: {
|
|
550
|
-
fleetId: { type: 'string', description: 'Fleet identifier' },
|
|
551
|
-
deviceId: { type: 'string', description: 'Device identifier' },
|
|
552
|
-
},
|
|
553
|
-
required: ['fleetId', 'deviceId'],
|
|
554
|
-
},
|
|
555
|
-
handler: async (params) => {
|
|
556
|
-
try {
|
|
557
|
-
const coordinator = requireCoordinator();
|
|
558
|
-
const fleet = await coordinator.removeDeviceFromFleet(params['fleetId'], params['deviceId']);
|
|
559
|
-
return textResult(JSON.stringify(fleet, null, 2));
|
|
560
|
-
}
|
|
561
|
-
catch (err) {
|
|
562
|
-
return textResult(`Fleet remove device failed: ${err.message}`, true);
|
|
563
|
-
}
|
|
564
|
-
},
|
|
565
|
-
},
|
|
566
|
-
{
|
|
567
|
-
name: 'iot_fleet_delete',
|
|
568
|
-
description: 'Delete a fleet',
|
|
569
|
-
pluginName: '@swarmdo/plugin-iot-cognitum',
|
|
570
|
-
version: '1.0.0-alpha.1',
|
|
571
|
-
inputSchema: {
|
|
572
|
-
type: 'object',
|
|
573
|
-
properties: {
|
|
574
|
-
fleetId: { type: 'string', description: 'Fleet identifier' },
|
|
575
|
-
},
|
|
576
|
-
required: ['fleetId'],
|
|
577
|
-
},
|
|
578
|
-
handler: async (params) => {
|
|
579
|
-
try {
|
|
580
|
-
const coordinator = requireCoordinator();
|
|
581
|
-
await coordinator.deleteFleet(params['fleetId']);
|
|
582
|
-
return textResult(`Fleet ${params['fleetId']} deleted`);
|
|
583
|
-
}
|
|
584
|
-
catch (err) {
|
|
585
|
-
return textResult(`Fleet delete failed: ${err.message}`, true);
|
|
586
|
-
}
|
|
587
|
-
},
|
|
588
|
-
},
|
|
589
|
-
// -- Telemetry anomaly detection (Phase 2) --------------------------------
|
|
590
|
-
{
|
|
591
|
-
name: 'iot_telemetry_anomalies',
|
|
592
|
-
description: 'Detect anomalies in device telemetry readings',
|
|
593
|
-
pluginName: '@swarmdo/plugin-iot-cognitum',
|
|
594
|
-
version: '1.0.0-alpha.1',
|
|
595
|
-
inputSchema: {
|
|
596
|
-
type: 'object',
|
|
597
|
-
properties: {
|
|
598
|
-
deviceId: { type: 'string', description: 'Device identifier' },
|
|
599
|
-
readings: {
|
|
600
|
-
type: 'array',
|
|
601
|
-
description: 'Telemetry readings to analyze',
|
|
602
|
-
items: {
|
|
603
|
-
type: 'object',
|
|
604
|
-
properties: {
|
|
605
|
-
readingId: { type: 'string' },
|
|
606
|
-
vector: { type: 'array', items: { type: 'number' } },
|
|
607
|
-
rawMetrics: { type: 'object' },
|
|
608
|
-
},
|
|
609
|
-
required: ['readingId', 'vector'],
|
|
610
|
-
},
|
|
611
|
-
},
|
|
612
|
-
},
|
|
613
|
-
required: ['deviceId', 'readings'],
|
|
614
|
-
},
|
|
615
|
-
handler: async (params) => {
|
|
616
|
-
try {
|
|
617
|
-
const coordinator = requireCoordinator();
|
|
618
|
-
const deviceId = params['deviceId'];
|
|
619
|
-
const rawReadings = params['readings'];
|
|
620
|
-
const readings = rawReadings.map((r) => ({
|
|
621
|
-
readingId: r.readingId,
|
|
622
|
-
deviceId,
|
|
623
|
-
fleetId: '',
|
|
624
|
-
timestamp: new Date(),
|
|
625
|
-
vector: r.vector,
|
|
626
|
-
rawMetrics: r.rawMetrics ?? {},
|
|
627
|
-
anomalyScore: 0,
|
|
628
|
-
metadata: {},
|
|
629
|
-
}));
|
|
630
|
-
const result = coordinator.detectAnomalies(deviceId, readings);
|
|
631
|
-
return textResult(JSON.stringify(result, null, 2));
|
|
632
|
-
}
|
|
633
|
-
catch (err) {
|
|
634
|
-
return textResult(`Anomaly detection failed: ${err.message}`, true);
|
|
635
|
-
}
|
|
636
|
-
},
|
|
637
|
-
},
|
|
638
|
-
{
|
|
639
|
-
name: 'iot_telemetry_baseline',
|
|
640
|
-
description: 'Compute or retrieve telemetry baseline for a device',
|
|
641
|
-
pluginName: '@swarmdo/plugin-iot-cognitum',
|
|
642
|
-
version: '1.0.0-alpha.1',
|
|
643
|
-
inputSchema: {
|
|
644
|
-
type: 'object',
|
|
645
|
-
properties: {
|
|
646
|
-
deviceId: { type: 'string', description: 'Device identifier' },
|
|
647
|
-
action: {
|
|
648
|
-
type: 'string',
|
|
649
|
-
enum: ['compute', 'get'],
|
|
650
|
-
description: 'Compute new baseline or get existing',
|
|
651
|
-
},
|
|
652
|
-
},
|
|
653
|
-
required: ['deviceId'],
|
|
654
|
-
},
|
|
655
|
-
handler: async (params) => {
|
|
656
|
-
try {
|
|
657
|
-
const coordinator = requireCoordinator();
|
|
658
|
-
const deviceId = params['deviceId'];
|
|
659
|
-
const action = params['action'] ?? 'get';
|
|
660
|
-
if (action === 'get') {
|
|
661
|
-
const baseline = coordinator.getBaseline(deviceId);
|
|
662
|
-
if (!baseline) {
|
|
663
|
-
return textResult(JSON.stringify({ deviceId, status: 'no-baseline' }));
|
|
664
|
-
}
|
|
665
|
-
return textResult(JSON.stringify(baseline, null, 2));
|
|
666
|
-
}
|
|
667
|
-
return textResult(JSON.stringify({
|
|
668
|
-
deviceId,
|
|
669
|
-
status: 'compute-requires-readings',
|
|
670
|
-
hint: 'Use iot_telemetry_anomalies with readings to build baseline first',
|
|
671
|
-
}));
|
|
672
|
-
}
|
|
673
|
-
catch (err) {
|
|
674
|
-
return textResult(`Baseline failed: ${err.message}`, true);
|
|
675
|
-
}
|
|
676
|
-
},
|
|
677
|
-
},
|
|
678
|
-
{
|
|
679
|
-
name: 'iot_witness_verify',
|
|
680
|
-
description: 'Verify witness chain integrity for a device — detects epoch gaps and hash chain breaks',
|
|
681
|
-
pluginName: '@swarmdo/plugin-iot-cognitum',
|
|
682
|
-
version: '1.0.0-alpha.1',
|
|
683
|
-
inputSchema: {
|
|
684
|
-
type: 'object',
|
|
685
|
-
properties: {
|
|
686
|
-
deviceId: { type: 'string', description: 'Device identifier' },
|
|
687
|
-
},
|
|
688
|
-
required: ['deviceId'],
|
|
689
|
-
},
|
|
690
|
-
handler: async (params) => {
|
|
691
|
-
try {
|
|
692
|
-
const coordinator = requireCoordinator();
|
|
693
|
-
const result = await coordinator.verifyWitnessChain(params['deviceId']);
|
|
694
|
-
return textResult(JSON.stringify(result, null, 2));
|
|
695
|
-
}
|
|
696
|
-
catch (err) {
|
|
697
|
-
return textResult(`Witness verification failed: ${err.message}`, true);
|
|
698
|
-
}
|
|
699
|
-
},
|
|
700
|
-
},
|
|
701
|
-
];
|
|
702
|
-
}
|
|
703
|
-
//# sourceMappingURL=mcp-tools.js.map
|