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.
Files changed (215) hide show
  1. package/.claude/helpers/statusline.cjs +7 -7
  2. package/README.md +9 -6
  3. package/package.json +5 -3
  4. package/v3/@swarmdo/cli/dist/src/commands/compact.d.ts +16 -0
  5. package/v3/@swarmdo/cli/dist/src/commands/compact.js +106 -0
  6. package/v3/@swarmdo/cli/dist/src/commands/hooks.js +26 -24
  7. package/v3/@swarmdo/cli/dist/src/commands/index.js +10 -3
  8. package/v3/@swarmdo/cli/dist/src/commands/integrations.d.ts +14 -0
  9. package/v3/@swarmdo/cli/dist/src/commands/integrations.js +158 -0
  10. package/v3/@swarmdo/cli/dist/src/commands/memory.js +50 -1
  11. package/v3/@swarmdo/cli/dist/src/commands/providers.js +3 -0
  12. package/v3/@swarmdo/cli/dist/src/commands/release.d.ts +15 -0
  13. package/v3/@swarmdo/cli/dist/src/commands/release.js +241 -0
  14. package/v3/@swarmdo/cli/dist/src/commands/security.js +14 -0
  15. package/v3/@swarmdo/cli/dist/src/commands/transcript.js +82 -1
  16. package/v3/@swarmdo/cli/dist/src/commands/usage.js +80 -1
  17. package/v3/@swarmdo/cli/dist/src/compact/compact.d.ts +60 -0
  18. package/v3/@swarmdo/cli/dist/src/compact/compact.js +170 -0
  19. package/v3/@swarmdo/cli/dist/src/config-lint/lint.js +11 -1
  20. package/v3/@swarmdo/cli/dist/src/index.js +4 -2
  21. package/v3/@swarmdo/cli/dist/src/init/statusline-generator.js +6 -6
  22. package/v3/@swarmdo/cli/dist/src/integrations/integrations.d.ts +54 -0
  23. package/v3/@swarmdo/cli/dist/src/integrations/integrations.js +162 -0
  24. package/v3/@swarmdo/cli/dist/src/mcp-tools/agent-execute-core.js +25 -3
  25. package/v3/@swarmdo/cli/dist/src/mcp-tools/agentdb-tools.js +8 -8
  26. package/v3/@swarmdo/cli/dist/src/memory/graph-edge-writer.d.ts +12 -0
  27. package/v3/@swarmdo/cli/dist/src/memory/graph-edge-writer.js +32 -1
  28. package/v3/@swarmdo/cli/dist/src/memory-vault/watch.d.ts +32 -0
  29. package/v3/@swarmdo/cli/dist/src/memory-vault/watch.js +66 -0
  30. package/v3/@swarmdo/cli/dist/src/providers/openrouter-config.d.ts +91 -0
  31. package/v3/@swarmdo/cli/dist/src/providers/openrouter-config.js +186 -0
  32. package/v3/@swarmdo/cli/dist/src/release/release.d.ts +72 -0
  33. package/v3/@swarmdo/cli/dist/src/release/release.js +86 -0
  34. package/v3/@swarmdo/cli/dist/src/resilience/backoff.d.ts +23 -0
  35. package/v3/@swarmdo/cli/dist/src/resilience/backoff.js +30 -0
  36. package/v3/@swarmdo/cli/dist/src/swarmvector/model-router.js +14 -0
  37. package/v3/@swarmdo/cli/dist/src/transcript/search.d.ts +39 -0
  38. package/v3/@swarmdo/cli/dist/src/transcript/search.js +67 -0
  39. package/v3/@swarmdo/cli/dist/src/usage/diff.d.ts +69 -0
  40. package/v3/@swarmdo/cli/dist/src/usage/diff.js +112 -0
  41. package/v3/@swarmdo/cli/package.json +4 -4
  42. package/v3/@swarmdo/cli-core/dist/src/index.js +1 -1
  43. package/v3/@swarmdo/codex/dist/cli.js +0 -0
  44. package/v3/@swarmdo/hooks/dist/cli/guidance-cli.js +0 -0
  45. package/v3/@swarmdo/hooks/dist/statusline/index.d.ts +3 -3
  46. package/v3/@swarmdo/hooks/dist/statusline/index.js +3 -3
  47. package/v3/@swarmdo/integration/dist/__tests__/agentic-flow-agent.test.js +4 -1
  48. package/v3/@swarmdo/neural/dist/flash-attention.d.ts +1 -1
  49. package/v3/@swarmdo/neural/dist/flash-attention.js +1 -1
  50. package/v3/@swarmdo/plugin-agent-federation/dist/plugin.js +1 -1
  51. package/v3/@swarmdo/plugin-agent-federation/dist/transport/midstream-aware-loader.js +2 -2
  52. package/v3/@swarmdo/providers/dist/swarmvector-provider.d.ts +1 -1
  53. package/v3/@swarmdo/providers/dist/swarmvector-provider.js +1 -1
  54. package/v3/@swarmdo/security/dist/input-validator.d.ts +6 -6
  55. package/v3/@swarmdo/shared/dist/hooks/safety/git-commit.js +1 -1
  56. package/v3/@swarmdo/shared/dist/mcp/transport/http.js +8 -1
  57. package/v3/vendor/agentdb/package.json +0 -1
  58. package/v3/vendor/agentic-flow/package.json +0 -1
  59. package/.claude/scheduled_tasks.lock +0 -1
  60. package/.claude/skills/sdo-caveman-compress/scripts/__pycache__/__init__.cpython-314.pyc +0 -0
  61. package/.claude/skills/sdo-caveman-compress/scripts/__pycache__/__main__.cpython-314.pyc +0 -0
  62. package/.claude/skills/sdo-caveman-compress/scripts/__pycache__/cli.cpython-314.pyc +0 -0
  63. package/.claude/skills/sdo-caveman-compress/scripts/__pycache__/compress.cpython-314.pyc +0 -0
  64. package/.claude/skills/sdo-caveman-compress/scripts/__pycache__/detect.cpython-314.pyc +0 -0
  65. package/.claude/skills/sdo-caveman-compress/scripts/__pycache__/validate.cpython-314.pyc +0 -0
  66. package/v3/@swarmdo/plugin-iot-cognitum/dist/application/index.d.ts +0 -2
  67. package/v3/@swarmdo/plugin-iot-cognitum/dist/application/index.js +0 -2
  68. package/v3/@swarmdo/plugin-iot-cognitum/dist/application/iot-coordinator.d.ts +0 -138
  69. package/v3/@swarmdo/plugin-iot-cognitum/dist/application/iot-coordinator.js +0 -418
  70. package/v3/@swarmdo/plugin-iot-cognitum/dist/bin.d.ts +0 -15
  71. package/v3/@swarmdo/plugin-iot-cognitum/dist/bin.js +0 -240
  72. package/v3/@swarmdo/plugin-iot-cognitum/dist/cli-commands.d.ts +0 -7
  73. package/v3/@swarmdo/plugin-iot-cognitum/dist/cli-commands.js +0 -508
  74. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/entities/device-agent.d.ts +0 -54
  75. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/entities/device-agent.js +0 -2
  76. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/entities/device-fleet.d.ts +0 -46
  77. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/entities/device-fleet.js +0 -2
  78. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/entities/device-trust-level.d.ts +0 -18
  79. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/entities/device-trust-level.js +0 -28
  80. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/entities/index.d.ts +0 -5
  81. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/entities/index.js +0 -2
  82. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/entities/telemetry.d.ts +0 -35
  83. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/entities/telemetry.js +0 -2
  84. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/repositories/device-repository.d.ts +0 -11
  85. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/repositories/device-repository.js +0 -2
  86. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/repositories/fleet-repository.d.ts +0 -9
  87. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/repositories/fleet-repository.js +0 -2
  88. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/repositories/index.d.ts +0 -5
  89. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/repositories/index.js +0 -2
  90. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/repositories/telemetry-repository.d.ts +0 -12
  91. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/repositories/telemetry-repository.js +0 -2
  92. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/repositories/trust-history-repository.d.ts +0 -19
  93. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/repositories/trust-history-repository.js +0 -2
  94. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/anomaly-detection-service.d.ts +0 -44
  95. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/anomaly-detection-service.js +0 -117
  96. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/device-lifecycle-service.d.ts +0 -70
  97. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/device-lifecycle-service.js +0 -194
  98. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/firmware-orchestration-service.d.ts +0 -69
  99. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/firmware-orchestration-service.js +0 -139
  100. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/fleet-topology-service.d.ts +0 -34
  101. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/fleet-topology-service.js +0 -101
  102. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/index.d.ts +0 -10
  103. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/index.js +0 -10
  104. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/mesh-service.d.ts +0 -64
  105. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/mesh-service.js +0 -70
  106. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/sona-integration-service.d.ts +0 -44
  107. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/sona-integration-service.js +0 -79
  108. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/telemetry-ingestion-service.d.ts +0 -37
  109. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/telemetry-ingestion-service.js +0 -39
  110. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/telemetry-service.d.ts +0 -67
  111. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/telemetry-service.js +0 -58
  112. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/witness-verification-service.d.ts +0 -45
  113. package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/witness-verification-service.js +0 -63
  114. package/v3/@swarmdo/plugin-iot-cognitum/dist/index.d.ts +0 -26
  115. package/v3/@swarmdo/plugin-iot-cognitum/dist/index.js +0 -17
  116. package/v3/@swarmdo/plugin-iot-cognitum/dist/infrastructure/agentdb-telemetry-repository.d.ts +0 -51
  117. package/v3/@swarmdo/plugin-iot-cognitum/dist/infrastructure/agentdb-telemetry-repository.js +0 -110
  118. package/v3/@swarmdo/plugin-iot-cognitum/dist/infrastructure/in-memory-device-repository.d.ts +0 -13
  119. package/v3/@swarmdo/plugin-iot-cognitum/dist/infrastructure/in-memory-device-repository.js +0 -25
  120. package/v3/@swarmdo/plugin-iot-cognitum/dist/infrastructure/in-memory-fleet-repository.d.ts +0 -11
  121. package/v3/@swarmdo/plugin-iot-cognitum/dist/infrastructure/in-memory-fleet-repository.js +0 -19
  122. package/v3/@swarmdo/plugin-iot-cognitum/dist/infrastructure/in-memory-trust-history-repository.d.ts +0 -11
  123. package/v3/@swarmdo/plugin-iot-cognitum/dist/infrastructure/in-memory-trust-history-repository.js +0 -27
  124. package/v3/@swarmdo/plugin-iot-cognitum/dist/infrastructure/index.d.ts +0 -6
  125. package/v3/@swarmdo/plugin-iot-cognitum/dist/infrastructure/index.js +0 -6
  126. package/v3/@swarmdo/plugin-iot-cognitum/dist/infrastructure/seed-client-factory.d.ts +0 -41
  127. package/v3/@swarmdo/plugin-iot-cognitum/dist/infrastructure/seed-client-factory.js +0 -64
  128. package/v3/@swarmdo/plugin-iot-cognitum/dist/mcp-tools.d.ts +0 -8
  129. package/v3/@swarmdo/plugin-iot-cognitum/dist/mcp-tools.js +0 -703
  130. package/v3/@swarmdo/plugin-iot-cognitum/dist/plugin.d.ts +0 -23
  131. package/v3/@swarmdo/plugin-iot-cognitum/dist/plugin.js +0 -239
  132. package/v3/@swarmdo/plugin-iot-cognitum/dist/workers/anomaly-scan-worker.d.ts +0 -17
  133. package/v3/@swarmdo/plugin-iot-cognitum/dist/workers/anomaly-scan-worker.js +0 -42
  134. package/v3/@swarmdo/plugin-iot-cognitum/dist/workers/firmware-watch-worker.d.ts +0 -18
  135. package/v3/@swarmdo/plugin-iot-cognitum/dist/workers/firmware-watch-worker.js +0 -45
  136. package/v3/@swarmdo/plugin-iot-cognitum/dist/workers/health-probe-worker.d.ts +0 -19
  137. package/v3/@swarmdo/plugin-iot-cognitum/dist/workers/health-probe-worker.js +0 -50
  138. package/v3/@swarmdo/plugin-iot-cognitum/dist/workers/mesh-sync-worker.d.ts +0 -19
  139. package/v3/@swarmdo/plugin-iot-cognitum/dist/workers/mesh-sync-worker.js +0 -47
  140. package/v3/@swarmdo/plugin-iot-cognitum/dist/workers/telemetry-ingest-worker.d.ts +0 -17
  141. package/v3/@swarmdo/plugin-iot-cognitum/dist/workers/telemetry-ingest-worker.js +0 -40
  142. package/v3/@swarmdo/plugin-iot-cognitum/dist/workers/witness-audit-worker.d.ts +0 -18
  143. package/v3/@swarmdo/plugin-iot-cognitum/dist/workers/witness-audit-worker.js +0 -51
  144. package/v3/@swarmdo/testing/dist/fixtures/agent-fixtures.d.ts +0 -214
  145. package/v3/@swarmdo/testing/dist/fixtures/agent-fixtures.js +0 -595
  146. package/v3/@swarmdo/testing/dist/fixtures/agents.d.ts +0 -76
  147. package/v3/@swarmdo/testing/dist/fixtures/agents.js +0 -158
  148. package/v3/@swarmdo/testing/dist/fixtures/configurations.d.ts +0 -157
  149. package/v3/@swarmdo/testing/dist/fixtures/configurations.js +0 -337
  150. package/v3/@swarmdo/testing/dist/fixtures/index.d.ts +0 -10
  151. package/v3/@swarmdo/testing/dist/fixtures/index.js +0 -17
  152. package/v3/@swarmdo/testing/dist/fixtures/mcp-fixtures.d.ts +0 -329
  153. package/v3/@swarmdo/testing/dist/fixtures/mcp-fixtures.js +0 -714
  154. package/v3/@swarmdo/testing/dist/fixtures/memory-entries.d.ts +0 -159
  155. package/v3/@swarmdo/testing/dist/fixtures/memory-entries.js +0 -262
  156. package/v3/@swarmdo/testing/dist/fixtures/memory-fixtures.d.ts +0 -290
  157. package/v3/@swarmdo/testing/dist/fixtures/memory-fixtures.js +0 -547
  158. package/v3/@swarmdo/testing/dist/fixtures/swarm-fixtures.d.ts +0 -289
  159. package/v3/@swarmdo/testing/dist/fixtures/swarm-fixtures.js +0 -534
  160. package/v3/@swarmdo/testing/dist/fixtures/tasks.d.ts +0 -106
  161. package/v3/@swarmdo/testing/dist/fixtures/tasks.js +0 -229
  162. package/v3/@swarmdo/testing/dist/helpers/assertion-helpers.d.ts +0 -213
  163. package/v3/@swarmdo/testing/dist/helpers/assertion-helpers.js +0 -435
  164. package/v3/@swarmdo/testing/dist/helpers/assertions.d.ts +0 -135
  165. package/v3/@swarmdo/testing/dist/helpers/assertions.js +0 -217
  166. package/v3/@swarmdo/testing/dist/helpers/create-mock.d.ts +0 -96
  167. package/v3/@swarmdo/testing/dist/helpers/create-mock.js +0 -164
  168. package/v3/@swarmdo/testing/dist/helpers/index.d.ts +0 -14
  169. package/v3/@swarmdo/testing/dist/helpers/index.js +0 -22
  170. package/v3/@swarmdo/testing/dist/helpers/mock-factory.d.ts +0 -323
  171. package/v3/@swarmdo/testing/dist/helpers/mock-factory.js +0 -350
  172. package/v3/@swarmdo/testing/dist/helpers/setup-teardown.d.ts +0 -271
  173. package/v3/@swarmdo/testing/dist/helpers/setup-teardown.js +0 -446
  174. package/v3/@swarmdo/testing/dist/helpers/swarm-instance.d.ts +0 -142
  175. package/v3/@swarmdo/testing/dist/helpers/swarm-instance.js +0 -205
  176. package/v3/@swarmdo/testing/dist/helpers/test-application.d.ts +0 -190
  177. package/v3/@swarmdo/testing/dist/helpers/test-application.js +0 -138
  178. package/v3/@swarmdo/testing/dist/helpers/test-utils.d.ts +0 -274
  179. package/v3/@swarmdo/testing/dist/helpers/test-utils.js +0 -456
  180. package/v3/@swarmdo/testing/dist/index.d.ts +0 -42
  181. package/v3/@swarmdo/testing/dist/index.js +0 -66
  182. package/v3/@swarmdo/testing/dist/mocks/index.d.ts +0 -8
  183. package/v3/@swarmdo/testing/dist/mocks/index.js +0 -10
  184. package/v3/@swarmdo/testing/dist/mocks/mock-mcp-client.d.ts +0 -206
  185. package/v3/@swarmdo/testing/dist/mocks/mock-mcp-client.js +0 -575
  186. package/v3/@swarmdo/testing/dist/mocks/mock-services.d.ts +0 -287
  187. package/v3/@swarmdo/testing/dist/mocks/mock-services.js +0 -563
  188. package/v3/@swarmdo/testing/dist/regression/api-contract.d.ts +0 -109
  189. package/v3/@swarmdo/testing/dist/regression/api-contract.js +0 -374
  190. package/v3/@swarmdo/testing/dist/regression/index.d.ts +0 -18
  191. package/v3/@swarmdo/testing/dist/regression/index.js +0 -18
  192. package/v3/@swarmdo/testing/dist/regression/integration-regression.d.ts +0 -67
  193. package/v3/@swarmdo/testing/dist/regression/integration-regression.js +0 -334
  194. package/v3/@swarmdo/testing/dist/regression/performance-baseline.d.ts +0 -106
  195. package/v3/@swarmdo/testing/dist/regression/performance-baseline.js +0 -268
  196. package/v3/@swarmdo/testing/dist/regression/regression-runner.d.ts +0 -124
  197. package/v3/@swarmdo/testing/dist/regression/regression-runner.js +0 -227
  198. package/v3/@swarmdo/testing/dist/regression/security-regression.d.ts +0 -73
  199. package/v3/@swarmdo/testing/dist/regression/security-regression.js +0 -258
  200. package/v3/@swarmdo/testing/dist/setup.d.ts +0 -43
  201. package/v3/@swarmdo/testing/dist/setup.js +0 -91
  202. package/v3/@swarmdo/testing/dist/v2-compat/api-compat.test.d.ts +0 -10
  203. package/v3/@swarmdo/testing/dist/v2-compat/api-compat.test.js +0 -433
  204. package/v3/@swarmdo/testing/dist/v2-compat/cli-compat.test.d.ts +0 -10
  205. package/v3/@swarmdo/testing/dist/v2-compat/cli-compat.test.js +0 -352
  206. package/v3/@swarmdo/testing/dist/v2-compat/compatibility-validator.d.ts +0 -206
  207. package/v3/@swarmdo/testing/dist/v2-compat/compatibility-validator.js +0 -839
  208. package/v3/@swarmdo/testing/dist/v2-compat/hooks-compat.test.d.ts +0 -10
  209. package/v3/@swarmdo/testing/dist/v2-compat/hooks-compat.test.js +0 -428
  210. package/v3/@swarmdo/testing/dist/v2-compat/index.d.ts +0 -38
  211. package/v3/@swarmdo/testing/dist/v2-compat/index.js +0 -41
  212. package/v3/@swarmdo/testing/dist/v2-compat/mcp-compat.test.d.ts +0 -10
  213. package/v3/@swarmdo/testing/dist/v2-compat/mcp-compat.test.js +0 -419
  214. package/v3/@swarmdo/testing/dist/v2-compat/report-generator.d.ts +0 -34
  215. package/v3/@swarmdo/testing/dist/v2-compat/report-generator.js +0 -372
@@ -1,138 +0,0 @@
1
- import type { WitnessChain, CustodyEpoch } from '@cognitum-one/sdk/seed';
2
- import type { StoreQueryResult, IngestResult, StoreHealthStatus } from '../domain/services/telemetry-service.js';
3
- import type { MeshTopology } from '../domain/services/mesh-service.js';
4
- import type { TelemetryBaseline, AnomalyDetectionConfig } from '../domain/services/anomaly-detection-service.js';
5
- import type { CreateFleetOptions, FleetSummary } from '../domain/services/fleet-topology-service.js';
6
- import type { FirmwareRollout } from '../domain/services/firmware-orchestration-service.js';
7
- import type { WitnessVerificationResult } from '../domain/services/witness-verification-service.js';
8
- import type { SONAClient } from '../domain/services/sona-integration-service.js';
9
- import type { TelemetryRepository } from '../domain/repositories/telemetry-repository.js';
10
- import type { DeviceAgent, DeviceTrustLevel, TelemetryReading, AnomalyDetection, DeviceFleet, FleetTopology, FirmwarePolicy } from '../domain/entities/index.js';
11
- import type { DeviceRepository, TrustHistoryRepository, FleetRepository } from '../domain/repositories/index.js';
12
- export interface IoTCoordinatorConfig {
13
- /** Fleet ID assigned to newly registered devices. */
14
- defaultFleetId: string;
15
- /** IEC 62443 security zone assigned to newly registered devices. */
16
- defaultZoneId: string;
17
- /** TLS defaults forwarded to the underlying SeedClientFactory. */
18
- defaultTls?: {
19
- insecure?: boolean;
20
- ca?: string;
21
- };
22
- /** Active health-probe interval (ms) for each SeedClient. */
23
- healthInterval?: number;
24
- /** Optional device persistence repository. */
25
- deviceRepository?: DeviceRepository;
26
- /** Optional trust history repository. */
27
- trustHistoryRepository?: TrustHistoryRepository;
28
- /** Anomaly detection configuration. */
29
- anomalyDetection?: Partial<AnomalyDetectionConfig>;
30
- /** Optional fleet persistence repository. */
31
- fleetRepository?: FleetRepository;
32
- /** Optional SONA neural learning client. */
33
- sonaClient?: SONAClient;
34
- /** Optional HNSW-indexed telemetry repository. */
35
- telemetryRepository?: TelemetryRepository;
36
- }
37
- export interface IoTCoordinatorCallbacks {
38
- onDeviceRegistered?: (device: DeviceAgent) => void;
39
- onTrustChange?: (deviceId: string, oldLevel: DeviceTrustLevel, newLevel: DeviceTrustLevel) => void;
40
- }
41
- /**
42
- * Application-layer coordinator that wires domain services to the
43
- * Cognitum Seed SDK transport. Every public method resolves a
44
- * {@link SeedClient} from the internal registry and delegates to the
45
- * appropriate domain service.
46
- */
47
- export declare class IoTCoordinator {
48
- private readonly factory;
49
- private readonly devices;
50
- private readonly lifecycle;
51
- private readonly telemetry;
52
- private readonly mesh;
53
- private readonly anomalyDetection;
54
- private readonly ingestion;
55
- private readonly fleet;
56
- private readonly firmware;
57
- private readonly witnessVerification;
58
- private readonly sona;
59
- private readonly telemetryRepo?;
60
- private readonly config;
61
- private readonly deviceRepo?;
62
- private readonly trustRepo?;
63
- constructor(config: IoTCoordinatorConfig, callbacks?: IoTCoordinatorCallbacks);
64
- /**
65
- * Register a Seed device by its HTTP endpoint. Creates a
66
- * {@link SeedClient}, fetches status and identity from the real
67
- * hardware, and returns a fully populated {@link DeviceAgent}.
68
- */
69
- registerDevice(endpoint: string, pairingToken?: string): Promise<DeviceAgent>;
70
- /**
71
- * Refresh a device's state from the real hardware and recalculate
72
- * its trust score.
73
- */
74
- getDeviceStatus(deviceId: string): Promise<DeviceAgent>;
75
- /** Pair a registered device, promoting its trust level. */
76
- pairDevice(deviceId: string, clientName: string): Promise<DeviceAgent>;
77
- /** Unpair a registered device, demoting its trust level. */
78
- unpairDevice(deviceId: string): Promise<DeviceAgent>;
79
- /** Run a k-NN query against a device's on-board vector store. */
80
- queryDeviceVectors(deviceId: string, vector: number[], k: number): Promise<StoreQueryResult>;
81
- /** Ingest raw vectors into a device's vector store. */
82
- ingestDeviceTelemetry(deviceId: string, vectors: Array<{
83
- values: number[];
84
- metadata?: Record<string, unknown>;
85
- }>): Promise<IngestResult>;
86
- /** Retrieve vector store health metrics for a device. */
87
- getDeviceStoreStatus(deviceId: string): Promise<StoreHealthStatus>;
88
- /** Get the aggregated mesh topology snapshot for a device. */
89
- getDeviceMeshTopology(deviceId: string): Promise<MeshTopology>;
90
- /** Retrieve the full witness chain from a device. */
91
- getDeviceWitnessChain(deviceId: string): Promise<WitnessChain>;
92
- /** Retrieve the current custody epoch from a device. */
93
- getDeviceCustodyEpoch(deviceId: string): Promise<CustodyEpoch>;
94
- /** Verify witness chain integrity for a device. */
95
- verifyWitnessChain(deviceId: string): Promise<WitnessVerificationResult>;
96
- /** Detect anomalies in a batch of telemetry readings for a device. */
97
- detectAnomalies(deviceId: string, readings: TelemetryReading[]): {
98
- anomalies: AnomalyDetection[];
99
- total: number;
100
- anomalous: number;
101
- };
102
- /** Compute a telemetry baseline for a device from readings. */
103
- computeBaseline(deviceId: string, readings: TelemetryReading[]): TelemetryBaseline;
104
- /** Get the current baseline for a device, if computed. */
105
- getBaseline(deviceId: string): TelemetryBaseline | undefined;
106
- createFirmwareRollout(fleetId: string, firmwareVersion: string): Promise<FirmwareRollout>;
107
- advanceFirmwareRollout(rolloutId: string): Promise<FirmwareRollout>;
108
- rollbackFirmwareRollout(rolloutId: string): FirmwareRollout;
109
- getFirmwareRollout(rolloutId: string): FirmwareRollout;
110
- listFirmwareRollouts(fleetId?: string): FirmwareRollout[];
111
- createFleet(options: CreateFleetOptions): Promise<DeviceFleet>;
112
- getFleet(fleetId: string): Promise<DeviceFleet>;
113
- listFleets(): Promise<FleetSummary[]>;
114
- addDeviceToFleet(fleetId: string, deviceId: string): Promise<DeviceFleet>;
115
- removeDeviceFromFleet(fleetId: string, deviceId: string): Promise<DeviceFleet>;
116
- updateFleetTopology(fleetId: string, topology: FleetTopology): Promise<DeviceFleet>;
117
- updateFleetFirmwarePolicy(fleetId: string, policy: Partial<FirmwarePolicy>): Promise<DeviceFleet>;
118
- deleteFleet(fleetId: string): Promise<void>;
119
- /** List all registered device agents. */
120
- listDevices(): DeviceAgent[];
121
- /** Remove a device from the coordinator and close its SDK client. */
122
- removeDevice(deviceId: string): Promise<void>;
123
- /** Shut down all SDK clients and clear internal state. */
124
- shutdown(): Promise<void>;
125
- /** Health snapshot of the coordinator. */
126
- getStatus(): {
127
- healthy: boolean;
128
- deviceCount: number;
129
- devices: DeviceAgent[];
130
- };
131
- /**
132
- * Resolve a SeedClient by device ID (or temporary endpoint key).
133
- * Throws when the device has not been registered.
134
- */
135
- private resolveClient;
136
- private requireEntry;
137
- }
138
- //# sourceMappingURL=iot-coordinator.d.ts.map
@@ -1,418 +0,0 @@
1
- import { SeedClientFactory } from '../infrastructure/seed-client-factory.js';
2
- import { DeviceLifecycleService } from '../domain/services/device-lifecycle-service.js';
3
- import { TelemetryService } from '../domain/services/telemetry-service.js';
4
- import { MeshService } from '../domain/services/mesh-service.js';
5
- import { AnomalyDetectionService } from '../domain/services/anomaly-detection-service.js';
6
- import { TelemetryIngestionService } from '../domain/services/telemetry-ingestion-service.js';
7
- import { FleetTopologyService } from '../domain/services/fleet-topology-service.js';
8
- import { InMemoryFleetRepository } from '../infrastructure/in-memory-fleet-repository.js';
9
- import { FirmwareOrchestrationService } from '../domain/services/firmware-orchestration-service.js';
10
- import { WitnessVerificationService } from '../domain/services/witness-verification-service.js';
11
- import { SONAIntegrationService } from '../domain/services/sona-integration-service.js';
12
- // ---------------------------------------------------------------------------
13
- // Coordinator
14
- // ---------------------------------------------------------------------------
15
- /**
16
- * Application-layer coordinator that wires domain services to the
17
- * Cognitum Seed SDK transport. Every public method resolves a
18
- * {@link SeedClient} from the internal registry and delegates to the
19
- * appropriate domain service.
20
- */
21
- export class IoTCoordinator {
22
- factory;
23
- devices = new Map();
24
- lifecycle;
25
- telemetry;
26
- mesh;
27
- anomalyDetection;
28
- ingestion;
29
- fleet;
30
- firmware;
31
- witnessVerification;
32
- sona;
33
- telemetryRepo;
34
- config;
35
- deviceRepo;
36
- trustRepo;
37
- constructor(config, callbacks) {
38
- this.config = config;
39
- this.deviceRepo = config.deviceRepository;
40
- this.trustRepo = config.trustHistoryRepository;
41
- this.factory = new SeedClientFactory({
42
- defaultTls: config.defaultTls,
43
- healthInterval: config.healthInterval,
44
- });
45
- // -----------------------------------------------------------------------
46
- // Wire domain-service deps to real SDK calls via this.devices
47
- // -----------------------------------------------------------------------
48
- this.lifecycle = new DeviceLifecycleService({
49
- getStatus: async (deviceId) => {
50
- const client = this.resolveClient(deviceId);
51
- return client.status();
52
- },
53
- getIdentity: async (deviceId) => {
54
- const client = this.resolveClient(deviceId);
55
- return client.identity();
56
- },
57
- getPairStatus: async (deviceId) => {
58
- const client = this.resolveClient(deviceId);
59
- return client.pair.status();
60
- },
61
- getWitnessChain: async (deviceId) => {
62
- const client = this.resolveClient(deviceId);
63
- const chain = await client.witness.chain();
64
- return {
65
- depth: chain.length ?? chain.entries?.length ?? 0,
66
- epoch: chain.entries?.[0]?.epoch ?? 0,
67
- head_hash: chain.head ?? '',
68
- };
69
- },
70
- getCustodyEpoch: async (deviceId) => {
71
- const client = this.resolveClient(deviceId);
72
- return client.custody.epoch();
73
- },
74
- pairDevice: async (deviceId, clientName) => {
75
- const client = this.resolveClient(deviceId);
76
- const resp = await client.pair.create({ clientName });
77
- return { paired: true, token: resp.token.reveal() };
78
- },
79
- unpairDevice: async (deviceId, clientName) => {
80
- const client = this.resolveClient(deviceId);
81
- await client.pair.delete(clientName ?? 'swarmdo');
82
- },
83
- onDeviceRegistered: callbacks?.onDeviceRegistered,
84
- onTrustChange: callbacks?.onTrustChange,
85
- });
86
- this.telemetry = new TelemetryService({
87
- queryVectors: async (deviceId, vector, k) => {
88
- const client = this.resolveClient(deviceId);
89
- return client.store.query({ vector, k });
90
- },
91
- ingestVectors: async (deviceId, vectors) => {
92
- const client = this.resolveClient(deviceId);
93
- return client.store.ingest({ vectors });
94
- },
95
- getStoreStatus: async (deviceId) => {
96
- const client = this.resolveClient(deviceId);
97
- return client.store.status();
98
- },
99
- });
100
- this.mesh = new MeshService({
101
- getMeshStatus: async (deviceId) => {
102
- const client = this.resolveClient(deviceId);
103
- return client.mesh.status();
104
- },
105
- getPeers: async (deviceId) => {
106
- const client = this.resolveClient(deviceId);
107
- return client.mesh.peers();
108
- },
109
- getSwarmStatus: async (deviceId) => {
110
- const client = this.resolveClient(deviceId);
111
- return client.mesh.swarmStatus();
112
- },
113
- getClusterHealth: async (deviceId) => {
114
- const client = this.resolveClient(deviceId);
115
- return client.mesh.clusterHealth();
116
- },
117
- });
118
- this.anomalyDetection = new AnomalyDetectionService(config.anomalyDetection);
119
- this.ingestion = new TelemetryIngestionService({
120
- queryDeviceStore: async (deviceId, vector, k) => {
121
- const client = this.resolveClient(deviceId);
122
- const result = await client.store.query({ vector, k });
123
- return result.results;
124
- },
125
- getStoreStatus: async (deviceId) => {
126
- const client = this.resolveClient(deviceId);
127
- return client.store.status();
128
- },
129
- }, this.anomalyDetection);
130
- this.fleet = new FleetTopologyService(config.fleetRepository ?? new InMemoryFleetRepository());
131
- this.firmware = new FirmwareOrchestrationService({
132
- getDeviceFirmwareVersion: async (deviceId) => {
133
- const entry = this.requireEntry(deviceId);
134
- return entry.agent.firmwareVersion;
135
- },
136
- deployFirmware: async (_deviceId, _version) => {
137
- // OTA deployment requires Cognitum Cloud API (not available via local Seed SDK).
138
- // Stub returns success; real implementation will use cloud control plane.
139
- return { success: true };
140
- },
141
- getDeviceAnomalyScore: async (deviceId) => {
142
- const entry = this.requireEntry(deviceId);
143
- return 1 - entry.agent.trustScore.overall;
144
- },
145
- });
146
- this.witnessVerification = new WitnessVerificationService({
147
- getWitnessChain: async (deviceId) => {
148
- const client = this.resolveClient(deviceId);
149
- return client.witness.chain();
150
- },
151
- });
152
- this.sona = new SONAIntegrationService(config.sonaClient ?? null);
153
- this.telemetryRepo = config.telemetryRepository;
154
- }
155
- // -------------------------------------------------------------------------
156
- // Device lifecycle
157
- // -------------------------------------------------------------------------
158
- /**
159
- * Register a Seed device by its HTTP endpoint. Creates a
160
- * {@link SeedClient}, fetches status and identity from the real
161
- * hardware, and returns a fully populated {@link DeviceAgent}.
162
- */
163
- async registerDevice(endpoint, pairingToken) {
164
- const client = await this.factory.createClient(endpoint, pairingToken);
165
- // The lifecycle service makes two SDK calls during registration:
166
- // getStatus(endpoint) -> returns the real device_id, then
167
- // getIdentity(device_id) -> looked up by the device_id key.
168
- // We need the client reachable under BOTH keys before lifecycle runs,
169
- // so pre-fetch the device_id and register the client under both.
170
- const initialStatus = await client.status();
171
- const initialDeviceId = initialStatus.device_id;
172
- this.devices.set(endpoint, { agent: {}, client });
173
- this.devices.set(initialDeviceId, { agent: {}, client });
174
- let agent;
175
- try {
176
- agent = await this.lifecycle.registerDevice(endpoint, this.config.defaultFleetId, this.config.defaultZoneId);
177
- }
178
- catch (err) {
179
- this.devices.delete(endpoint);
180
- this.devices.delete(initialDeviceId);
181
- throw err;
182
- }
183
- // Promote: drop the temporary endpoint key and keep the device_id key
184
- // (with the real agent attached).
185
- this.devices.delete(endpoint);
186
- this.devices.set(agent.deviceId, { agent, client });
187
- await this.deviceRepo?.save(agent);
188
- return agent;
189
- }
190
- /**
191
- * Refresh a device's state from the real hardware and recalculate
192
- * its trust score.
193
- */
194
- async getDeviceStatus(deviceId) {
195
- const entry = this.requireEntry(deviceId);
196
- const oldLevel = entry.agent.trustLevel;
197
- const refreshed = await this.lifecycle.refreshDeviceState(entry.agent);
198
- entry.agent = refreshed;
199
- await this.deviceRepo?.save(refreshed);
200
- if (oldLevel !== refreshed.trustLevel) {
201
- await this.trustRepo?.append({
202
- deviceId, timestamp: new Date(),
203
- oldLevel, newLevel: refreshed.trustLevel,
204
- score: refreshed.trustScore, trigger: 'refresh',
205
- });
206
- }
207
- return refreshed;
208
- }
209
- /** Pair a registered device, promoting its trust level. */
210
- async pairDevice(deviceId, clientName) {
211
- const entry = this.requireEntry(deviceId);
212
- const oldLevel = entry.agent.trustLevel;
213
- const updated = await this.lifecycle.pairDevice(entry.agent, clientName);
214
- entry.agent = updated;
215
- await this.deviceRepo?.save(updated);
216
- if (oldLevel !== updated.trustLevel) {
217
- await this.trustRepo?.append({
218
- deviceId, timestamp: new Date(),
219
- oldLevel, newLevel: updated.trustLevel,
220
- score: updated.trustScore, trigger: 'pair',
221
- });
222
- }
223
- return updated;
224
- }
225
- /** Unpair a registered device, demoting its trust level. */
226
- async unpairDevice(deviceId) {
227
- const entry = this.requireEntry(deviceId);
228
- const oldLevel = entry.agent.trustLevel;
229
- const updated = await this.lifecycle.unpairDevice(entry.agent);
230
- entry.agent = updated;
231
- await this.deviceRepo?.save(updated);
232
- if (oldLevel !== updated.trustLevel) {
233
- await this.trustRepo?.append({
234
- deviceId, timestamp: new Date(),
235
- oldLevel, newLevel: updated.trustLevel,
236
- score: updated.trustScore, trigger: 'unpair',
237
- });
238
- }
239
- return updated;
240
- }
241
- // -------------------------------------------------------------------------
242
- // Telemetry / vector store
243
- // -------------------------------------------------------------------------
244
- /** Run a k-NN query against a device's on-board vector store. */
245
- async queryDeviceVectors(deviceId, vector, k) {
246
- return this.telemetry.queryDevice(deviceId, vector, k);
247
- }
248
- /** Ingest raw vectors into a device's vector store. */
249
- async ingestDeviceTelemetry(deviceId, vectors) {
250
- const client = this.resolveClient(deviceId);
251
- const result = await client.store.ingest({ vectors });
252
- return {
253
- deviceId,
254
- ingested: result.ingested,
255
- epoch: result.epoch,
256
- };
257
- }
258
- /** Retrieve vector store health metrics for a device. */
259
- async getDeviceStoreStatus(deviceId) {
260
- return this.telemetry.getStoreHealth(deviceId);
261
- }
262
- // -------------------------------------------------------------------------
263
- // Mesh
264
- // -------------------------------------------------------------------------
265
- /** Get the aggregated mesh topology snapshot for a device. */
266
- async getDeviceMeshTopology(deviceId) {
267
- return this.mesh.getTopology(deviceId);
268
- }
269
- // -------------------------------------------------------------------------
270
- // Witness / custody — direct SDK pass-through
271
- // -------------------------------------------------------------------------
272
- /** Retrieve the full witness chain from a device. */
273
- async getDeviceWitnessChain(deviceId) {
274
- const client = this.resolveClient(deviceId);
275
- return client.witness.chain();
276
- }
277
- /** Retrieve the current custody epoch from a device. */
278
- async getDeviceCustodyEpoch(deviceId) {
279
- const client = this.resolveClient(deviceId);
280
- return client.custody.epoch();
281
- }
282
- /** Verify witness chain integrity for a device. */
283
- async verifyWitnessChain(deviceId) {
284
- this.requireEntry(deviceId);
285
- return this.witnessVerification.verifyChain(deviceId);
286
- }
287
- // -------------------------------------------------------------------------
288
- // Anomaly detection
289
- // -------------------------------------------------------------------------
290
- /** Detect anomalies in a batch of telemetry readings for a device. */
291
- detectAnomalies(deviceId, readings) {
292
- const result = this.ingestion.processBatch(deviceId, readings);
293
- if (result.anomalies.length > 0) {
294
- const baseline = this.ingestion.getBaseline(deviceId);
295
- for (const anomaly of result.anomalies) {
296
- void this.sona.learnAnomalyPattern(anomaly, baseline);
297
- }
298
- void this.sona.recordTelemetryTrajectory(deviceId, readings, result.anomalies);
299
- }
300
- if (this.telemetryRepo) {
301
- void this.telemetryRepo.storeBatch(readings);
302
- for (const anomaly of result.anomalies) {
303
- void this.telemetryRepo.storeAnomaly(anomaly);
304
- }
305
- }
306
- return {
307
- anomalies: result.anomalies,
308
- total: result.readingsProcessed,
309
- anomalous: result.anomaliesDetected,
310
- };
311
- }
312
- /** Compute a telemetry baseline for a device from readings. */
313
- computeBaseline(deviceId, readings) {
314
- const oldBaseline = this.ingestion.getBaseline(deviceId);
315
- const newBaseline = this.ingestion.refreshBaseline(deviceId, readings);
316
- void this.sona.learnBaselineShift(deviceId, oldBaseline, newBaseline);
317
- return newBaseline;
318
- }
319
- /** Get the current baseline for a device, if computed. */
320
- getBaseline(deviceId) {
321
- return this.ingestion.getBaseline(deviceId);
322
- }
323
- // -------------------------------------------------------------------------
324
- // Firmware orchestration
325
- // -------------------------------------------------------------------------
326
- async createFirmwareRollout(fleetId, firmwareVersion) {
327
- const fleet = await this.fleet.getFleet(fleetId);
328
- return this.firmware.createRollout(fleetId, firmwareVersion, fleet.deviceIds, fleet.firmwarePolicy);
329
- }
330
- async advanceFirmwareRollout(rolloutId) {
331
- return this.firmware.advanceRollout(rolloutId);
332
- }
333
- rollbackFirmwareRollout(rolloutId) {
334
- return this.firmware.rollbackRollout(rolloutId);
335
- }
336
- getFirmwareRollout(rolloutId) {
337
- return this.firmware.getRollout(rolloutId);
338
- }
339
- listFirmwareRollouts(fleetId) {
340
- return this.firmware.listRollouts(fleetId);
341
- }
342
- // -------------------------------------------------------------------------
343
- // Fleet management
344
- // -------------------------------------------------------------------------
345
- async createFleet(options) {
346
- return this.fleet.createFleet(options);
347
- }
348
- async getFleet(fleetId) {
349
- return this.fleet.getFleet(fleetId);
350
- }
351
- async listFleets() {
352
- return this.fleet.listFleets();
353
- }
354
- async addDeviceToFleet(fleetId, deviceId) {
355
- this.requireEntry(deviceId);
356
- return this.fleet.addDeviceToFleet(fleetId, deviceId);
357
- }
358
- async removeDeviceFromFleet(fleetId, deviceId) {
359
- return this.fleet.removeDeviceFromFleet(fleetId, deviceId);
360
- }
361
- async updateFleetTopology(fleetId, topology) {
362
- return this.fleet.updateTopology(fleetId, topology);
363
- }
364
- async updateFleetFirmwarePolicy(fleetId, policy) {
365
- return this.fleet.updateFirmwarePolicy(fleetId, policy);
366
- }
367
- async deleteFleet(fleetId) {
368
- return this.fleet.deleteFleet(fleetId);
369
- }
370
- // -------------------------------------------------------------------------
371
- // Inventory
372
- // -------------------------------------------------------------------------
373
- /** List all registered device agents. */
374
- listDevices() {
375
- return Array.from(this.devices.values()).map((e) => e.agent);
376
- }
377
- /** Remove a device from the coordinator and close its SDK client. */
378
- async removeDevice(deviceId) {
379
- const entry = this.devices.get(deviceId);
380
- if (!entry)
381
- return;
382
- await entry.client.close();
383
- this.devices.delete(deviceId);
384
- await this.deviceRepo?.delete(deviceId);
385
- await this.trustRepo?.deleteByDevice(deviceId);
386
- }
387
- /** Shut down all SDK clients and clear internal state. */
388
- async shutdown() {
389
- await this.factory.closeAll();
390
- this.devices.clear();
391
- }
392
- /** Health snapshot of the coordinator. */
393
- getStatus() {
394
- return {
395
- healthy: this.devices.size >= 0,
396
- deviceCount: this.devices.size,
397
- devices: this.listDevices(),
398
- };
399
- }
400
- // -------------------------------------------------------------------------
401
- // Internals
402
- // -------------------------------------------------------------------------
403
- /**
404
- * Resolve a SeedClient by device ID (or temporary endpoint key).
405
- * Throws when the device has not been registered.
406
- */
407
- resolveClient(deviceId) {
408
- return this.requireEntry(deviceId).client;
409
- }
410
- requireEntry(deviceId) {
411
- const entry = this.devices.get(deviceId);
412
- if (!entry) {
413
- throw new Error(`Device ${deviceId} not registered with coordinator`);
414
- }
415
- return entry;
416
- }
417
- }
418
- //# sourceMappingURL=iot-coordinator.js.map
@@ -1,15 +0,0 @@
1
- #!/usr/bin/env node
2
- /**
3
- * Standalone CLI shim for @swarmdo/plugin-iot-cognitum.
4
- * Maps `cognitum-iot <subcommand> [args]` -> CLICommandDefinition handlers.
5
- *
6
- * Endpoint defaults:
7
- * - http://169.254.42.1 (USB-C link-local, no auth — read-only paths)
8
- * - https://169.254.42.1:8443 (LAN/HTTPS + bearer — full access including writes)
9
- *
10
- * Auth: COGNITUM_SEED_TOKEN is read from process.env (loaded from .env in CWD
11
- * if present) and passed to register as the pairing/bearer token. When set,
12
- * the default endpoint switches to the HTTPS LAN address.
13
- */
14
- export {};
15
- //# sourceMappingURL=bin.d.ts.map