@camstack/core 0.1.15 → 0.1.17

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 (382) hide show
  1. package/dist/addon/addon-api-factory.d.ts +36 -0
  2. package/dist/addon/addon-api-factory.d.ts.map +1 -0
  3. package/dist/addon-routes/addon-route-registry.d.ts +38 -0
  4. package/dist/addon-routes/addon-route-registry.d.ts.map +1 -0
  5. package/dist/auth/api-key-manager.d.ts +27 -0
  6. package/dist/auth/api-key-manager.d.ts.map +1 -0
  7. package/dist/auth/auth-manager.d.ts +47 -0
  8. package/dist/auth/auth-manager.d.ts.map +1 -0
  9. package/dist/auth/parse-record.d.ts +19 -0
  10. package/dist/auth/parse-record.d.ts.map +1 -0
  11. package/dist/auth/scoped-token-manager.d.ts +18 -0
  12. package/dist/auth/scoped-token-manager.d.ts.map +1 -0
  13. package/dist/auth/user-manager.d.ts +34 -0
  14. package/dist/auth/user-manager.d.ts.map +1 -0
  15. package/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.d.ts +54 -0
  16. package/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.d.ts.map +1 -0
  17. package/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.js +223 -217
  18. package/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.js.map +1 -1
  19. package/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.mjs +216 -7
  20. package/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.mjs.map +1 -1
  21. package/dist/builtins/addon-pages-aggregator/index.d.ts +2 -0
  22. package/dist/builtins/addon-pages-aggregator/index.d.ts.map +1 -0
  23. package/dist/builtins/addon-pages-aggregator/index.js +6 -221
  24. package/dist/builtins/addon-pages-aggregator/index.mjs +2 -9
  25. package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.d.ts +33 -0
  26. package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.d.ts.map +1 -0
  27. package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.js +199 -197
  28. package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.js.map +1 -1
  29. package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.mjs +192 -7
  30. package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.mjs.map +1 -1
  31. package/dist/builtins/addon-widgets-aggregator/index.d.ts +2 -0
  32. package/dist/builtins/addon-widgets-aggregator/index.d.ts.map +1 -0
  33. package/dist/builtins/addon-widgets-aggregator/index.js +6 -201
  34. package/dist/builtins/addon-widgets-aggregator/index.mjs +2 -9
  35. package/dist/builtins/alerts/alerts.addon.d.ts +82 -0
  36. package/dist/builtins/alerts/alerts.addon.d.ts.map +1 -0
  37. package/dist/builtins/alerts/alerts.addon.js +590 -430
  38. package/dist/builtins/alerts/alerts.addon.js.map +1 -1
  39. package/dist/builtins/alerts/alerts.addon.mjs +595 -7
  40. package/dist/builtins/alerts/alerts.addon.mjs.map +1 -1
  41. package/dist/builtins/alerts/index.d.ts +2 -0
  42. package/dist/builtins/alerts/index.d.ts.map +1 -0
  43. package/dist/builtins/alerts/index.js +3 -443
  44. package/dist/builtins/alerts/index.mjs +2 -8
  45. package/dist/builtins/auth-orchestrator/auth-orchestrator.addon.d.ts +8 -0
  46. package/dist/builtins/auth-orchestrator/auth-orchestrator.addon.d.ts.map +1 -0
  47. package/dist/builtins/auth-orchestrator/auth-orchestrator.addon.js +56 -0
  48. package/dist/builtins/auth-orchestrator/auth-orchestrator.addon.js.map +1 -0
  49. package/dist/builtins/auth-orchestrator/auth-orchestrator.addon.mjs +50 -0
  50. package/dist/builtins/auth-orchestrator/auth-orchestrator.addon.mjs.map +1 -0
  51. package/dist/builtins/auth-orchestrator/index.d.ts +2 -0
  52. package/dist/builtins/auth-orchestrator/index.d.ts.map +1 -0
  53. package/dist/builtins/auth-orchestrator/index.js +7 -0
  54. package/dist/builtins/auth-orchestrator/index.mjs +2 -0
  55. package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.d.ts +148 -0
  56. package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.d.ts.map +1 -0
  57. package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.js +7639 -0
  58. package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.js.map +1 -0
  59. package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.mjs +7627 -0
  60. package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.mjs.map +1 -0
  61. package/dist/builtins/backup-orchestrator/cron-helpers.d.ts +24 -0
  62. package/dist/builtins/backup-orchestrator/cron-helpers.d.ts.map +1 -0
  63. package/dist/builtins/backup-orchestrator/destination-policy.d.ts +73 -0
  64. package/dist/builtins/backup-orchestrator/destination-policy.d.ts.map +1 -0
  65. package/dist/builtins/backup-orchestrator/download-helpers.d.ts +13 -0
  66. package/dist/builtins/backup-orchestrator/download-helpers.d.ts.map +1 -0
  67. package/dist/builtins/backup-orchestrator/index.d.ts +3 -0
  68. package/dist/builtins/backup-orchestrator/index.d.ts.map +1 -0
  69. package/dist/builtins/backup-orchestrator/index.js +7 -0
  70. package/dist/builtins/backup-orchestrator/index.mjs +2 -0
  71. package/dist/builtins/backup-orchestrator/manifest-store.d.ts +78 -0
  72. package/dist/builtins/backup-orchestrator/manifest-store.d.ts.map +1 -0
  73. package/dist/builtins/console-logging/console-destination.d.ts +14 -0
  74. package/dist/builtins/console-logging/console-destination.d.ts.map +1 -0
  75. package/dist/builtins/console-logging/console-logging.addon.d.ts +26 -0
  76. package/dist/builtins/console-logging/console-logging.addon.d.ts.map +1 -0
  77. package/dist/builtins/console-logging/index.d.ts +4 -0
  78. package/dist/builtins/console-logging/index.d.ts.map +1 -0
  79. package/dist/builtins/console-logging/index.js +99 -235
  80. package/dist/builtins/console-logging/index.js.map +1 -1
  81. package/dist/builtins/console-logging/index.mjs +95 -9
  82. package/dist/builtins/console-logging/index.mjs.map +1 -1
  83. package/dist/builtins/device-manager/device-event-propagator.d.ts +27 -0
  84. package/dist/builtins/device-manager/device-event-propagator.d.ts.map +1 -0
  85. package/dist/builtins/device-manager/device-manager.addon.d.ts +259 -0
  86. package/dist/builtins/device-manager/device-manager.addon.d.ts.map +1 -0
  87. package/dist/builtins/device-manager/device-manager.addon.js +2125 -2127
  88. package/dist/builtins/device-manager/device-manager.addon.js.map +1 -1
  89. package/dist/builtins/device-manager/device-manager.addon.mjs +2145 -7
  90. package/dist/builtins/device-manager/device-manager.addon.mjs.map +1 -1
  91. package/dist/builtins/device-manager/index.d.ts +3 -0
  92. package/dist/builtins/device-manager/index.d.ts.map +1 -0
  93. package/dist/builtins/device-manager/index.js +6 -2156
  94. package/dist/builtins/device-manager/index.mjs +2 -10
  95. package/dist/builtins/hub-forwarder/hub-forwarder-destination.d.ts +45 -0
  96. package/dist/builtins/hub-forwarder/hub-forwarder-destination.d.ts.map +1 -0
  97. package/dist/builtins/hub-forwarder/hub-forwarder.addon.d.ts +16 -0
  98. package/dist/builtins/hub-forwarder/hub-forwarder.addon.d.ts.map +1 -0
  99. package/dist/builtins/hub-forwarder/index.d.ts +4 -0
  100. package/dist/builtins/hub-forwarder/index.d.ts.map +1 -0
  101. package/dist/builtins/hub-forwarder/index.js +150 -291
  102. package/dist/builtins/hub-forwarder/index.js.map +1 -1
  103. package/dist/builtins/hub-forwarder/index.mjs +145 -9
  104. package/dist/builtins/hub-forwarder/index.mjs.map +1 -1
  105. package/dist/builtins/local-auth/auth-schema.d.ts +12 -0
  106. package/dist/builtins/local-auth/auth-schema.d.ts.map +1 -0
  107. package/dist/builtins/local-auth/index.d.ts +2 -0
  108. package/dist/builtins/local-auth/index.d.ts.map +1 -0
  109. package/dist/builtins/local-auth/index.js +3 -623
  110. package/dist/builtins/local-auth/index.mjs +2 -8
  111. package/dist/builtins/local-auth/local-auth.addon.d.ts +17 -0
  112. package/dist/builtins/local-auth/local-auth.addon.d.ts.map +1 -0
  113. package/dist/builtins/local-auth/local-auth.addon.js +6861 -589
  114. package/dist/builtins/local-auth/local-auth.addon.js.map +1 -1
  115. package/dist/builtins/local-auth/local-auth.addon.mjs +6883 -7
  116. package/dist/builtins/local-auth/local-auth.addon.mjs.map +1 -1
  117. package/dist/builtins/local-network/index.d.ts +3 -0
  118. package/dist/builtins/local-network/index.d.ts.map +1 -0
  119. package/dist/builtins/local-network/index.js +9 -0
  120. package/dist/builtins/local-network/index.mjs +2 -0
  121. package/dist/builtins/local-network/local-network.addon.d.ts +110 -0
  122. package/dist/builtins/local-network/local-network.addon.d.ts.map +1 -0
  123. package/dist/builtins/local-network/local-network.addon.js +399 -0
  124. package/dist/builtins/local-network/local-network.addon.js.map +1 -0
  125. package/dist/builtins/local-network/local-network.addon.mjs +387 -0
  126. package/dist/builtins/local-network/local-network.addon.mjs.map +1 -0
  127. package/dist/builtins/mesh-orchestrator/index.d.ts +2 -0
  128. package/dist/builtins/mesh-orchestrator/index.d.ts.map +1 -0
  129. package/dist/builtins/mesh-orchestrator/index.js +7 -0
  130. package/dist/builtins/mesh-orchestrator/index.mjs +2 -0
  131. package/dist/builtins/mesh-orchestrator/mesh-orchestrator.addon.d.ts +9 -0
  132. package/dist/builtins/mesh-orchestrator/mesh-orchestrator.addon.d.ts.map +1 -0
  133. package/dist/builtins/mesh-orchestrator/mesh-orchestrator.addon.js +83 -0
  134. package/dist/builtins/mesh-orchestrator/mesh-orchestrator.addon.js.map +1 -0
  135. package/dist/builtins/mesh-orchestrator/mesh-orchestrator.addon.mjs +77 -0
  136. package/dist/builtins/mesh-orchestrator/mesh-orchestrator.addon.mjs.map +1 -0
  137. package/dist/builtins/native-metrics/index.d.ts +3 -0
  138. package/dist/builtins/native-metrics/index.d.ts.map +1 -0
  139. package/dist/builtins/native-metrics/native-metrics-provider.d.ts +49 -0
  140. package/dist/builtins/native-metrics/native-metrics-provider.d.ts.map +1 -0
  141. package/dist/builtins/native-metrics/native-metrics.addon.d.ts +74 -0
  142. package/dist/builtins/native-metrics/native-metrics.addon.d.ts.map +1 -0
  143. package/dist/builtins/native-metrics/native-metrics.addon.js +887 -861
  144. package/dist/builtins/native-metrics/native-metrics.addon.js.map +1 -1
  145. package/dist/builtins/native-metrics/native-metrics.addon.mjs +914 -5
  146. package/dist/builtins/native-metrics/native-metrics.addon.mjs.map +1 -1
  147. package/dist/builtins/platform-probe/index.d.ts +12 -0
  148. package/dist/builtins/platform-probe/index.d.ts.map +1 -0
  149. package/dist/builtins/platform-probe/index.js +539 -0
  150. package/dist/builtins/platform-probe/index.js.map +1 -0
  151. package/dist/builtins/platform-probe/index.mjs +530 -0
  152. package/dist/builtins/platform-probe/index.mjs.map +1 -0
  153. package/dist/builtins/platform-probe/inference-config-resolver.d.ts +30 -0
  154. package/dist/builtins/platform-probe/inference-config-resolver.d.ts.map +1 -0
  155. package/dist/builtins/platform-probe/platform-scorer.d.ts +22 -0
  156. package/dist/builtins/platform-probe/platform-scorer.d.ts.map +1 -0
  157. package/dist/builtins/remote-access-orchestrator/index.d.ts +2 -0
  158. package/dist/builtins/remote-access-orchestrator/index.d.ts.map +1 -0
  159. package/dist/builtins/remote-access-orchestrator/index.js +7 -0
  160. package/dist/builtins/remote-access-orchestrator/index.mjs +2 -0
  161. package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.d.ts +9 -0
  162. package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.d.ts.map +1 -0
  163. package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.js +72 -0
  164. package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.js.map +1 -0
  165. package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.mjs +66 -0
  166. package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.mjs.map +1 -0
  167. package/dist/builtins/snapshot/index.d.ts +3 -0
  168. package/dist/builtins/snapshot/index.d.ts.map +1 -0
  169. package/dist/builtins/snapshot/index.js +481 -491
  170. package/dist/builtins/snapshot/index.js.map +1 -1
  171. package/dist/builtins/snapshot/index.mjs +475 -464
  172. package/dist/builtins/snapshot/index.mjs.map +1 -1
  173. package/dist/builtins/snapshot/snapshot.addon.d.ts +121 -0
  174. package/dist/builtins/snapshot/snapshot.addon.d.ts.map +1 -0
  175. package/dist/builtins/sqlite-storage/config-store.d.ts +9 -0
  176. package/dist/builtins/sqlite-storage/config-store.d.ts.map +1 -0
  177. package/dist/builtins/sqlite-storage/device-store.d.ts +24 -0
  178. package/dist/builtins/sqlite-storage/device-store.d.ts.map +1 -0
  179. package/dist/builtins/sqlite-storage/filesystem-storage-provider.d.ts +87 -0
  180. package/dist/builtins/sqlite-storage/filesystem-storage-provider.d.ts.map +1 -0
  181. package/dist/builtins/sqlite-storage/filesystem-storage.addon.d.ts +32 -0
  182. package/dist/builtins/sqlite-storage/filesystem-storage.addon.d.ts.map +1 -0
  183. package/dist/builtins/sqlite-storage/filesystem-storage.addon.js +312 -56
  184. package/dist/builtins/sqlite-storage/filesystem-storage.addon.js.map +1 -1
  185. package/dist/builtins/sqlite-storage/filesystem-storage.addon.mjs +305 -7
  186. package/dist/builtins/sqlite-storage/filesystem-storage.addon.mjs.map +1 -1
  187. package/dist/builtins/sqlite-storage/index.d.ts +12 -0
  188. package/dist/builtins/sqlite-storage/index.d.ts.map +1 -0
  189. package/dist/builtins/sqlite-storage/index.js +229 -1001
  190. package/dist/builtins/sqlite-storage/index.js.map +1 -1
  191. package/dist/builtins/sqlite-storage/index.mjs +268 -26
  192. package/dist/builtins/sqlite-storage/index.mjs.map +1 -1
  193. package/dist/builtins/sqlite-storage/integration-registry.d.ts +28 -0
  194. package/dist/builtins/sqlite-storage/integration-registry.d.ts.map +1 -0
  195. package/dist/builtins/sqlite-storage/settings-store.d.ts +40 -0
  196. package/dist/builtins/sqlite-storage/settings-store.d.ts.map +1 -0
  197. package/dist/builtins/sqlite-storage/sql-schema.d.ts +33 -0
  198. package/dist/builtins/sqlite-storage/sql-schema.d.ts.map +1 -0
  199. package/dist/builtins/sqlite-storage/sqlite-settings-backend.d.ts +94 -0
  200. package/dist/builtins/sqlite-storage/sqlite-settings-backend.d.ts.map +1 -0
  201. package/dist/builtins/sqlite-storage/sqlite-settings.addon.d.ts +15 -0
  202. package/dist/builtins/sqlite-storage/sqlite-settings.addon.d.ts.map +1 -0
  203. package/dist/builtins/sqlite-storage/sqlite-settings.addon.js +586 -653
  204. package/dist/builtins/sqlite-storage/sqlite-settings.addon.js.map +1 -1
  205. package/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +582 -7
  206. package/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs.map +1 -1
  207. package/dist/builtins/storage-orchestrator/index.d.ts +7 -0
  208. package/dist/builtins/storage-orchestrator/index.d.ts.map +1 -0
  209. package/dist/builtins/storage-orchestrator/index.js +9 -0
  210. package/dist/builtins/storage-orchestrator/index.mjs +2 -0
  211. package/dist/builtins/storage-orchestrator/location-store.d.ts +50 -0
  212. package/dist/builtins/storage-orchestrator/location-store.d.ts.map +1 -0
  213. package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.d.ts +60 -0
  214. package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.d.ts.map +1 -0
  215. package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.js +755 -0
  216. package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.js.map +1 -0
  217. package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.mjs +746 -0
  218. package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.mjs.map +1 -0
  219. package/dist/builtins/storage-orchestrator/storage-orchestrator.service.d.ts +121 -0
  220. package/dist/builtins/storage-orchestrator/storage-orchestrator.service.d.ts.map +1 -0
  221. package/dist/builtins/system-backup/system-backup.service.d.ts +138 -0
  222. package/dist/builtins/system-backup/system-backup.service.d.ts.map +1 -0
  223. package/dist/builtins/system-config/index.d.ts +2 -0
  224. package/dist/builtins/system-config/index.d.ts.map +1 -0
  225. package/dist/builtins/system-config/index.js +6 -188
  226. package/dist/builtins/system-config/index.mjs +2 -10
  227. package/dist/builtins/system-config/system-config.addon.d.ts +11 -0
  228. package/dist/builtins/system-config/system-config.addon.d.ts.map +1 -0
  229. package/dist/builtins/system-config/system-config.addon.js +227 -180
  230. package/dist/builtins/system-config/system-config.addon.js.map +1 -1
  231. package/dist/builtins/system-config/system-config.addon.mjs +226 -7
  232. package/dist/builtins/system-config/system-config.addon.mjs.map +1 -1
  233. package/dist/builtins/turn-orchestrator/index.d.ts +2 -0
  234. package/dist/builtins/turn-orchestrator/index.d.ts.map +1 -0
  235. package/dist/builtins/turn-orchestrator/index.js +7 -0
  236. package/dist/builtins/turn-orchestrator/index.mjs +2 -0
  237. package/dist/builtins/turn-orchestrator/turn-orchestrator.addon.d.ts +10 -0
  238. package/dist/builtins/turn-orchestrator/turn-orchestrator.addon.d.ts.map +1 -0
  239. package/dist/builtins/turn-orchestrator/turn-orchestrator.addon.js +78 -0
  240. package/dist/builtins/turn-orchestrator/turn-orchestrator.addon.js.map +1 -0
  241. package/dist/builtins/turn-orchestrator/turn-orchestrator.addon.mjs +72 -0
  242. package/dist/builtins/turn-orchestrator/turn-orchestrator.addon.mjs.map +1 -0
  243. package/dist/builtins/winston-logging/index.d.ts +4 -0
  244. package/dist/builtins/winston-logging/index.d.ts.map +1 -0
  245. package/dist/builtins/winston-logging/index.js +153 -300
  246. package/dist/builtins/winston-logging/index.js.map +1 -1
  247. package/dist/builtins/winston-logging/index.mjs +144 -9
  248. package/dist/builtins/winston-logging/index.mjs.map +1 -1
  249. package/dist/builtins/winston-logging/winston-destination.d.ts +22 -0
  250. package/dist/builtins/winston-logging/winston-destination.d.ts.map +1 -0
  251. package/dist/builtins/winston-logging/winston-logging.addon.d.ts +20 -0
  252. package/dist/builtins/winston-logging/winston-logging.addon.d.ts.map +1 -0
  253. package/dist/chunk-C13QxCFV.js +50 -0
  254. package/dist/chunk-hT5z_Zn9.mjs +35 -0
  255. package/dist/download/model-download-service.d.ts +42 -0
  256. package/dist/download/model-download-service.d.ts.map +1 -0
  257. package/dist/download/model-downloader.d.ts +32 -0
  258. package/dist/download/model-downloader.d.ts.map +1 -0
  259. package/dist/events/event-bus.d.ts +11 -0
  260. package/dist/events/event-bus.d.ts.map +1 -0
  261. package/dist/events/system-event-bus.d.ts +15 -0
  262. package/dist/events/system-event-bus.d.ts.map +1 -0
  263. package/dist/feature/feature-manager.d.ts +12 -0
  264. package/dist/feature/feature-manager.d.ts.map +1 -0
  265. package/dist/formatter-C-5An4Bl.mjs +164 -0
  266. package/dist/formatter-C-5An4Bl.mjs.map +1 -0
  267. package/dist/formatter-Dr_6NNZc.js +169 -0
  268. package/dist/formatter-Dr_6NNZc.js.map +1 -0
  269. package/dist/index.d.ts +76 -1696
  270. package/dist/index.d.ts.map +1 -0
  271. package/dist/index.js +7780 -8035
  272. package/dist/index.js.map +1 -1
  273. package/dist/index.mjs +7707 -2148
  274. package/dist/index.mjs.map +1 -1
  275. package/dist/lifecycle/lifecycle-state-machine.d.ts +29 -0
  276. package/dist/lifecycle/lifecycle-state-machine.d.ts.map +1 -0
  277. package/dist/logging/formatter.d.ts +31 -0
  278. package/dist/logging/formatter.d.ts.map +1 -0
  279. package/dist/logging/log-manager.d.ts +52 -0
  280. package/dist/logging/log-manager.d.ts.map +1 -0
  281. package/dist/logging/log-ring-buffer.d.ts +48 -0
  282. package/dist/logging/log-ring-buffer.d.ts.map +1 -0
  283. package/dist/logging/scoped-logger.d.ts +18 -0
  284. package/dist/logging/scoped-logger.d.ts.map +1 -0
  285. package/dist/network/network-quality.d.ts +12 -0
  286. package/dist/network/network-quality.d.ts.map +1 -0
  287. package/dist/notification/notification-service.d.ts +38 -0
  288. package/dist/notification/notification-service.d.ts.map +1 -0
  289. package/dist/notification/toast-service.d.ts +23 -0
  290. package/dist/notification/toast-service.d.ts.map +1 -0
  291. package/dist/pipeline/engine-manager-resolver.d.ts +16 -0
  292. package/dist/pipeline/engine-manager-resolver.d.ts.map +1 -0
  293. package/dist/pipeline/pipeline-runner.d.ts +9 -0
  294. package/dist/pipeline/pipeline-runner.d.ts.map +1 -0
  295. package/dist/pipeline/pipeline-validator.d.ts +14 -0
  296. package/dist/pipeline/pipeline-validator.d.ts.map +1 -0
  297. package/dist/process/resource-monitor.d.ts +12 -0
  298. package/dist/process/resource-monitor.d.ts.map +1 -0
  299. package/dist/python/python-env-manager.d.ts +13 -0
  300. package/dist/python/python-env-manager.d.ts.map +1 -0
  301. package/dist/repl/interfaces.d.ts +32 -0
  302. package/dist/repl/interfaces.d.ts.map +1 -0
  303. package/dist/repl/repl-engine.d.ts +9 -0
  304. package/dist/repl/repl-engine.d.ts.map +1 -0
  305. package/dist/resource-monitor-CmuWlmap.js +76 -0
  306. package/dist/resource-monitor-CmuWlmap.js.map +1 -0
  307. package/dist/resource-monitor-DcQdKGYU.mjs +59 -0
  308. package/dist/resource-monitor-DcQdKGYU.mjs.map +1 -0
  309. package/dist/storage/fs-storage-backend.d.ts +41 -0
  310. package/dist/storage/fs-storage-backend.d.ts.map +1 -0
  311. package/dist/storage/storage-location-manager.d.ts +24 -0
  312. package/dist/storage/storage-location-manager.d.ts.map +1 -0
  313. package/dist/storage/storage-manager.d.ts +77 -0
  314. package/dist/storage/storage-manager.d.ts.map +1 -0
  315. package/dist/tls/cert-manager.d.ts +27 -0
  316. package/dist/tls/cert-manager.d.ts.map +1 -0
  317. package/dist/tls/index.d.ts +2 -0
  318. package/dist/tls/index.d.ts.map +1 -0
  319. package/package.json +119 -23
  320. package/dist/builtins/addon-pages-aggregator/index.js.map +0 -1
  321. package/dist/builtins/addon-pages-aggregator/index.mjs.map +0 -1
  322. package/dist/builtins/addon-widgets-aggregator/index.js.map +0 -1
  323. package/dist/builtins/addon-widgets-aggregator/index.mjs.map +0 -1
  324. package/dist/builtins/alerts/index.js.map +0 -1
  325. package/dist/builtins/alerts/index.mjs.map +0 -1
  326. package/dist/builtins/device-manager/index.js.map +0 -1
  327. package/dist/builtins/device-manager/index.mjs.map +0 -1
  328. package/dist/builtins/local-auth/index.js.map +0 -1
  329. package/dist/builtins/local-auth/index.mjs.map +0 -1
  330. package/dist/builtins/local-backup/index.js +0 -173
  331. package/dist/builtins/local-backup/index.js.map +0 -1
  332. package/dist/builtins/local-backup/index.mjs +0 -10
  333. package/dist/builtins/local-backup/index.mjs.map +0 -1
  334. package/dist/builtins/system-config/index.js.map +0 -1
  335. package/dist/builtins/system-config/index.mjs.map +0 -1
  336. package/dist/chunk-2CIYKDRN.mjs +0 -1
  337. package/dist/chunk-2CIYKDRN.mjs.map +0 -1
  338. package/dist/chunk-2F76X6NL.mjs +0 -136
  339. package/dist/chunk-2F76X6NL.mjs.map +0 -1
  340. package/dist/chunk-2QUFBZ7M.mjs +0 -1
  341. package/dist/chunk-2QUFBZ7M.mjs.map +0 -1
  342. package/dist/chunk-3BK2Y7GY.mjs +0 -593
  343. package/dist/chunk-3BK2Y7GY.mjs.map +0 -1
  344. package/dist/chunk-4OOHFJHT.mjs +0 -421
  345. package/dist/chunk-4OOHFJHT.mjs.map +0 -1
  346. package/dist/chunk-4XHB7IHT.mjs +0 -809
  347. package/dist/chunk-4XHB7IHT.mjs.map +0 -1
  348. package/dist/chunk-6M2HSSTQ.mjs +0 -98
  349. package/dist/chunk-6M2HSSTQ.mjs.map +0 -1
  350. package/dist/chunk-7FI7SQS7.mjs +0 -135
  351. package/dist/chunk-7FI7SQS7.mjs.map +0 -1
  352. package/dist/chunk-ED57RCQE.mjs +0 -171
  353. package/dist/chunk-ED57RCQE.mjs.map +0 -1
  354. package/dist/chunk-FZN56HGQ.mjs +0 -626
  355. package/dist/chunk-FZN56HGQ.mjs.map +0 -1
  356. package/dist/chunk-GL4OOB25.mjs +0 -51
  357. package/dist/chunk-GL4OOB25.mjs.map +0 -1
  358. package/dist/chunk-KDG2NTDB.mjs +0 -137
  359. package/dist/chunk-KDG2NTDB.mjs.map +0 -1
  360. package/dist/chunk-NRBQWBDM.mjs +0 -191
  361. package/dist/chunk-NRBQWBDM.mjs.map +0 -1
  362. package/dist/chunk-O4V246GG.mjs +0 -2137
  363. package/dist/chunk-O4V246GG.mjs.map +0 -1
  364. package/dist/chunk-QT57H266.mjs +0 -163
  365. package/dist/chunk-QT57H266.mjs.map +0 -1
  366. package/dist/chunk-QX4RH25I.mjs +0 -141
  367. package/dist/chunk-QX4RH25I.mjs.map +0 -1
  368. package/dist/chunk-TB562PZX.mjs +0 -86
  369. package/dist/chunk-TB562PZX.mjs.map +0 -1
  370. package/dist/chunk-TDYPZXK5.mjs +0 -1
  371. package/dist/chunk-TDYPZXK5.mjs.map +0 -1
  372. package/dist/chunk-UJI4LN5P.mjs +0 -36
  373. package/dist/chunk-UJI4LN5P.mjs.map +0 -1
  374. package/dist/chunk-W6RTHQGP.mjs +0 -1
  375. package/dist/chunk-W6RTHQGP.mjs.map +0 -1
  376. package/dist/chunk-ZELBCPDC.mjs +0 -369
  377. package/dist/chunk-ZELBCPDC.mjs.map +0 -1
  378. package/dist/index.d.mts +0 -1696
  379. package/dist/resource-monitor-UZUGPIAU.mjs +0 -9
  380. package/dist/resource-monitor-UZUGPIAU.mjs.map +0 -1
  381. package/dist/storage-location-manager-HFNB3PCS.mjs +0 -7
  382. package/dist/storage-location-manager-HFNB3PCS.mjs.map +0 -1
package/dist/index.d.mts DELETED
@@ -1,1696 +0,0 @@
1
- import { FilesystemStorageProvider } from '@camstack/types/node';
2
- export { FilesystemStorageProvider, PYTHON_VERSION, PlatformInfo, buildBinaryPath, downloadBinary, ensureBinary, ensureFfmpeg, ensurePython, findInPath, getFfmpegDownloadUrl, getPlatformInfo, getPythonDownloadUrl, installPythonPackages, installPythonRequirements } from '@camstack/types/node';
3
- import * as _camstack_types from '@camstack/types';
4
- import { ModelCatalogEntry, ModelFormat, ModelDownloadOptions, ModelDownloadResult, IAddonModelManager, IPythonEnvironment, PythonProbeResult, PythonEnvReady, PipelineConfig, ValidationResult, IAddonResolver, FrameInput, PipelineResult, IEngineManager, IAddonCaller, INetworkQualityTracker, ClientNetworkStats, DeviceNetworkStats, ReplResult, BaseAddon, ProviderRegistration, ISettingsBackend, SettingsGetInput, SettingsSetInput, SettingsQueryInput, SettingsRecord, SettingsInsertInput, SettingsUpdateInput, SettingsDeleteInput, SettingsCountInput, SettingsIsEmptyInput, CollectionColumn, CollectionIndex, TableSchema, TableQueryOptions, ILogDestination as ILogDestination$1, LogEntry, LogFilter, IScopedLogger, IClusterBroker, IEventBus, BackupManifest, Alert, SystemResourceSnapshot, DiskSpaceInfo, MetricsGpuInfo, PidResourceStats, MemoryInfo, ConfigUISchemaWithValues, DeviceBindingEntry, FeatureManifest, FeatureFlag, SystemEvent, EventFilter, LogTags, LogExtras, IStorageProvider as IStorageProvider$1, SettingsStoreClient, TokenScope, ScopedToken, TokenPayload, UserRole, ApiKeyRecord, UserRecord, ICapabilityRegistry, INotificationOutput, Notification, Toast, IAddonRouteProvider, IAddonHttpRoute, IIntegrationRegistry, CreateIntegrationInput, Integration, CreateDeviceInput, PersistedDevice } from '@camstack/types';
5
- export { ApiKeyRecord, BackupManifest, ClientNetworkStats, DeviceNetworkStats, EventFilter, EventSource, FeatureFlag, FeatureManifest, INetworkQualityTracker, IScopedLogger, LogEntry, LogFilter, LogLevel, ReplResult, StreamNetworkStats, SystemEvent, TokenPayload, UserRecord, UserRole, ValidationIssue, ValidationResult } from '@camstack/types';
6
- import { ChildProcess } from 'node:child_process';
7
- import Database from 'better-sqlite3';
8
-
9
- type EventCallback<T = unknown> = (data: T) => void;
10
- declare class EventBus {
11
- private listeners;
12
- on<T = unknown>(event: string, callback: EventCallback<T>): () => void;
13
- emit<T = unknown>(event: string, data: T): void;
14
- once<T = unknown>(event: string, callback: EventCallback<T>): () => void;
15
- removeAllListeners(event?: string): void;
16
- listenerCount(event: string): number;
17
- }
18
-
19
- /**
20
- * Download a single file from a URL to a destination path.
21
- * Uses native fetch() (Node 22+) which handles redirects natively.
22
- * Streams to disk with optional progress callback.
23
- * Returns the destination path. Skips download if file already exists.
24
- */
25
- declare function downloadFile(url: string, destPath: string, onProgress?: (downloaded: number, total: number) => void): Promise<string>;
26
- /**
27
- * Fetch JSON from a URL using native fetch().
28
- */
29
- declare function fetchJson(url: string): Promise<unknown>;
30
- /**
31
- * Download a model with fallback URLs and optional SHA256 verification.
32
- * Legacy API preserved for backward compatibility -- delegates to downloadFile().
33
- */
34
- declare function downloadModel(options: ModelDownloadOptions): Promise<ModelDownloadResult>;
35
- /** Progress callback: (downloadedBytes, totalBytes | undefined) */
36
- type DownloadProgressCallback = (downloaded: number, total: number | undefined) => void;
37
- /**
38
- * Resolve a `ModelCatalogEntry` against `modelsDir`: download model file
39
- * (or directory bundle) + extra files (labels JSON, charset dict, …),
40
- * skip if already on disk. Returns the local model path.
41
- */
42
- declare function ensureModel(modelsDir: string, entry: ModelCatalogEntry, format: ModelFormat, onProgress?: DownloadProgressCallback): Promise<string>;
43
- /** Compute the on-disk path for a given model + format, even when not yet downloaded. */
44
- declare function getModelFilePath(modelsDir: string, entry: ModelCatalogEntry, format: ModelFormat): string | null;
45
- /** True iff the model file (or `Manifest.json` for directory bundles) exists and is non-empty. */
46
- declare function isModelDownloaded(modelsDir: string, entry: ModelCatalogEntry, format: ModelFormat): boolean;
47
- /** Remove the on-disk model file/directory. Returns true if something was deleted. */
48
- declare function deleteModelFromDisk(modelsDir: string, entry: ModelCatalogEntry, format: ModelFormat): boolean;
49
-
50
- /**
51
- * Unified model download service.
52
- *
53
- * Handles downloading model files and extra files (labels, dicts) from a
54
- * catalog of ModelCatalogEntry items. Supports single-file models and
55
- * directory bundles (e.g., .mlpackage for CoreML).
56
- *
57
- * Addons use this via `context.models.ensure(modelId, format)`.
58
- */
59
- declare class ModelDownloadService implements IAddonModelManager {
60
- private readonly modelsDir;
61
- private readonly onProgress?;
62
- private readonly catalog;
63
- constructor(modelsDir: string, catalog: readonly ModelCatalogEntry[], onProgress?: ((modelId: string, downloaded: number, total: number) => void) | undefined);
64
- /**
65
- * Ensure a model (and its extra files) is downloaded.
66
- * Returns the local filesystem path to the model file/directory.
67
- */
68
- ensure(modelId: string, format?: ModelFormat): Promise<string>;
69
- /**
70
- * Ensure extra files for a model are downloaded.
71
- * Returns the local paths of all extra files.
72
- */
73
- ensureExtraFiles(modelId: string): Promise<readonly string[]>;
74
- /** Absolute path to the shared models directory. */
75
- getModelsDir(): string;
76
- /** Check if a model file is already present on disk. */
77
- isDownloaded(modelId: string, format?: ModelFormat): boolean;
78
- /** Get the catalog entry for a model by ID. */
79
- getEntry(modelId: string): ModelCatalogEntry | undefined;
80
- private pickDefaultFormat;
81
- private modelFilePath;
82
- /**
83
- * Download a directory bundle (e.g., .mlpackage) from HuggingFace.
84
- * ATOMIC: downloads to temp dir, renames only on complete success.
85
- */
86
- private downloadDirectory;
87
- /** Recursively list all files in a HuggingFace directory via API. */
88
- private listHfFiles;
89
- }
90
-
91
- declare class PythonEnvManager implements IPythonEnvironment {
92
- private venvPath;
93
- private cachedProbe;
94
- constructor(dataDir: string);
95
- probe(): Promise<PythonProbeResult>;
96
- ensure(options: {
97
- packages: readonly string[];
98
- }): Promise<PythonEnvReady>;
99
- spawn(script: string, args: readonly string[]): ChildProcess;
100
- }
101
-
102
- /**
103
- * Check if a pipeline step is available in the system.
104
- * Implementations should check the capability registry for `pipeline-step:{stepId}`.
105
- */
106
- type StepExistsFn = (stepId: string) => boolean;
107
- declare class PipelineValidator {
108
- private readonly stepExists;
109
- constructor(stepExists: StepExistsFn);
110
- validate(config: PipelineConfig): ValidationResult;
111
- private validateNode;
112
- }
113
-
114
- declare class PipelineRunner {
115
- private readonly addonResolver;
116
- constructor(addonResolver: IAddonResolver);
117
- run(frame: FrameInput, config: PipelineConfig): Promise<PipelineResult>;
118
- private executeNode;
119
- private executeChildren;
120
- }
121
-
122
- /**
123
- * Adapter that wraps an IEngineManager + addonConfigs as an IAddonResolver.
124
- *
125
- * Used for backwards compatibility — the in-process AddonEngineManager
126
- * still uses the old getOrCreateEngine(addonId, globalConfig, override) API.
127
- * This adapter bridges it to the new resolve(addonId, config) interface.
128
- */
129
- declare class EngineManagerResolver implements IAddonResolver {
130
- private readonly engineManager;
131
- private readonly addonConfigs;
132
- constructor(engineManager: IEngineManager, addonConfigs: Map<string, Record<string, unknown>>);
133
- resolve(addonId: string, config: Record<string, unknown>): Promise<IAddonCaller>;
134
- shutdownAll(): Promise<void>;
135
- }
136
-
137
- interface PidStats {
138
- cpu: number;
139
- memory: number;
140
- }
141
- /**
142
- * Get CPU% and memory RSS for one or more PIDs.
143
- * Returns a map of pid → stats. Missing/dead PIDs are silently omitted.
144
- */
145
- declare function getPidStats(pids: number | readonly number[]): Promise<ReadonlyMap<number, PidStats>>;
146
- /** Get CPU% and memory RSS for a single PID. Returns null if dead. */
147
- declare function getSinglePidStats(pid: number): Promise<PidStats | null>;
148
-
149
- declare class NetworkQualityTracker implements INetworkQualityTracker {
150
- private readonly devices;
151
- private static readonly MAX_SAMPLES;
152
- reportStreamStats(deviceId: number, streamId: string, bitrateKbps: number, packetLoss?: number): void;
153
- reportClientStats(deviceId: number, stats: Omit<ClientNetworkStats, 'lastUpdated'>): void;
154
- getDeviceStats(deviceId: number): DeviceNetworkStats | null;
155
- getAllStats(): readonly DeviceNetworkStats[];
156
- private getOrCreateDevice;
157
- }
158
-
159
- interface ReplScope {
160
- readonly type: 'system' | 'provider' | 'device' | 'addon';
161
- readonly providerId?: string;
162
- readonly deviceId?: number;
163
- readonly addonId?: string;
164
- }
165
- interface ReplSessionContext {
166
- readonly scope: ReplScope;
167
- /** Pre-populated variables available in the REPL session */
168
- readonly variables: Record<string, unknown>;
169
- }
170
-
171
- interface IReplEngine {
172
- execute(code: string, context: ReplSessionContext): Promise<ReplResult>;
173
- getCompletions(partial: string, context: ReplSessionContext): Promise<string[]>;
174
- }
175
- /**
176
- * Context provider that the server kernel implements.
177
- * The REPL engine calls this to build the sandbox for each scope type.
178
- *
179
- * Methods may return a Promise so the kernel can warm up async
180
- * resources (e.g. `SystemManager.init()`) before exposing them — the
181
- * engine awaits each before evaluating user code.
182
- */
183
- interface IReplContextProvider {
184
- getSystemSandbox(): Record<string, unknown> | Promise<Record<string, unknown>>;
185
- getDeviceSandbox(deviceId: number): Record<string, unknown> | Promise<Record<string, unknown>>;
186
- getProviderSandbox(providerId: string): Record<string, unknown> | Promise<Record<string, unknown>>;
187
- getAddonSandbox(addonId: string): Record<string, unknown> | Promise<Record<string, unknown>>;
188
- }
189
-
190
- declare class ReplEngine implements IReplEngine {
191
- private readonly contextProvider;
192
- constructor(contextProvider: IReplContextProvider);
193
- execute(code: string, context: ReplSessionContext): Promise<ReplResult>;
194
- getCompletions(partial: string, context: ReplSessionContext): Promise<string[]>;
195
- private buildSandbox;
196
- }
197
-
198
- interface FilesystemStorageConfig {
199
- readonly rootPath: string;
200
- }
201
- /**
202
- * Filesystem Storage addon — provides local disk storage for all location types.
203
- * Capability: 'storage' (collection)
204
- */
205
- declare class FilesystemStorageAddon extends BaseAddon<FilesystemStorageConfig> {
206
- private provider;
207
- constructor();
208
- protected onInitialize(): Promise<ProviderRegistration[]>;
209
- protected onShutdown(): Promise<void>;
210
- getProvider(): FilesystemStorageProvider | null;
211
- }
212
-
213
- /**
214
- * SQLite implementation of ISettingsBackend.
215
- *
216
- * Every collection is structured: declared at boot (canonical KV
217
- * collections) or via `declareCollection` (typed schemas like
218
- * `pipeline-analytics:tracks`). The legacy auto-create-on-first-access
219
- * path was removed — see commit history for the migration. Operations
220
- * on undeclared collections throw at runtime so callers fail fast.
221
- *
222
- * WAL mode for concurrent reads.
223
- */
224
- declare class SqliteSettingsBackend implements ISettingsBackend {
225
- private readonly dbPath;
226
- private db;
227
- private readonly structuredTables;
228
- /** Map from scoped collection name → set of column names (non-id) that
229
- * the structured schema owns. Routes set/get/insert/update/query to
230
- * typed columns. Every collection MUST be declared here before use. */
231
- private readonly declaredCollections;
232
- private readonly runtimeDefaults;
233
- /**
234
- * Canonical key/value collections — declared with a `(id TEXT PK,
235
- * data TEXT NOT NULL)` schema at boot so existing JSON-blob rows
236
- * keep working through the structured path. Generates SQL identical
237
- * to the previous legacy path; only the routing is unified.
238
- */
239
- private static readonly CANONICAL_KV_COLLECTIONS;
240
- constructor(dbPath: string, runtimeDefaults?: Record<string, unknown>);
241
- initialize(): Promise<void>;
242
- private requireDeclared;
243
- shutdown(): Promise<void>;
244
- get({ namespace, collection, key }: SettingsGetInput): Promise<unknown>;
245
- set({ namespace, collection, key, value }: SettingsSetInput): Promise<void>;
246
- query<T extends object = Record<string, unknown>>({ namespace, collection, filter }: SettingsQueryInput): Promise<readonly SettingsRecord<T>[]>;
247
- insert<T extends object = Record<string, unknown>>({ namespace, collection, record }: SettingsInsertInput<T>): Promise<void>;
248
- update({ namespace, collection, id, data }: SettingsUpdateInput): Promise<void>;
249
- delete({ namespace, collection, key }: SettingsDeleteInput): Promise<void>;
250
- count({ namespace, collection, filter }: SettingsCountInput): Promise<number>;
251
- isEmpty({ namespace, collection }: SettingsIsEmptyInput): Promise<boolean>;
252
- private queryDeclared;
253
- /** Get a system setting by dot-notation key */
254
- getSystem(key: string): unknown;
255
- /** Set a system setting */
256
- setSystem(key: string, value: unknown): void;
257
- /** Get all system settings as flat key-value */
258
- getAllSystem(): Record<string, unknown>;
259
- /** Get all settings for an addon */
260
- getAllAddon(addonId: string): Record<string, unknown>;
261
- /** Bulk-set all settings for an addon */
262
- setAllAddon(addonId: string, config: Record<string, unknown>): void;
263
- /** Get all settings for a provider */
264
- getAllProvider(providerId: string): Record<string, unknown>;
265
- /** Set a provider setting */
266
- setProvider(providerId: string, key: string, value: unknown): void;
267
- /** Get all settings for a device */
268
- getAllDevice(deviceId: string): Record<string, unknown>;
269
- /** Set a device setting */
270
- setDevice(deviceId: string, key: string, value: unknown): void;
271
- getAddonDevice(addonId: string, deviceId: string): Record<string, unknown>;
272
- setAddonDevice(addonId: string, deviceId: string, values: Record<string, unknown>): void;
273
- clearAddonDevice(addonId: string, deviceId: string): void;
274
- /** Seed system-settings with runtime defaults (first boot) */
275
- private seedDefaults;
276
- /**
277
- * Expose the raw better-sqlite3 Database instance for components that
278
- * need direct SQL access (e.g. DeviceStore, ConfigStore).
279
- * Returns null if the backend has not been initialized yet.
280
- */
281
- getDatabase(): Database.Database | null;
282
- private getDb;
283
- private getAllScoped;
284
- private setScopedKey;
285
- private scopedName;
286
- declareCollection(input: {
287
- namespace?: string;
288
- collection: string;
289
- columns: readonly CollectionColumn[];
290
- indexes?: readonly CollectionIndex[];
291
- }): Promise<void>;
292
- /** Serialise per-column values for SQL binding: objects → JSON, booleans → 0/1. */
293
- private serializeColumnValue;
294
- ensureTable(table: string, schema: TableSchema): Promise<void>;
295
- tableInsert(table: string, row: Record<string, unknown>): Promise<void>;
296
- tableUpdate(table: string, filter: Record<string, unknown>, updates: Record<string, unknown>): Promise<number>;
297
- tableDelete(table: string, filter: Record<string, unknown>): Promise<number>;
298
- tableQuery(table: string, options?: TableQueryOptions): Promise<readonly Record<string, unknown>[]>;
299
- tableGet(table: string, filter: Record<string, unknown>): Promise<Record<string, unknown> | null>;
300
- tableCount(table: string, filter?: Record<string, unknown>): Promise<number>;
301
- private buildWhere;
302
- }
303
-
304
- /**
305
- * SQLite Settings addon — provides persistent settings storage.
306
- * Capability: 'settings-store' (singleton)
307
- */
308
- declare class SqliteSettingsAddon extends BaseAddon {
309
- private backend;
310
- constructor();
311
- protected onInitialize(): Promise<ProviderRegistration[]>;
312
- protected onShutdown(): Promise<void>;
313
- getBackend(): SqliteSettingsBackend | null;
314
- }
315
-
316
- /**
317
- * Thin wrapper over better-sqlite3 that manages the four settings tables:
318
- * system_settings, addon_settings, provider_settings, device_settings.
319
- *
320
- * All values are stored as JSON text and deserialized on read.
321
- */
322
- declare class SettingsStore {
323
- private readonly db;
324
- constructor(dbPath: string);
325
- getSystem(key: string): unknown;
326
- setSystem(key: string, value: unknown): void;
327
- getAllSystem(): Record<string, unknown>;
328
- getAddon(addonId: string, key: string): unknown;
329
- setAddon(addonId: string, key: string, value: unknown): void;
330
- getAllAddon(addonId: string): Record<string, unknown>;
331
- /** Bulk-replace all keys for an addon (within a transaction). */
332
- setAllAddon(addonId: string, config: Record<string, unknown>): void;
333
- getProvider(providerId: string, key: string): unknown;
334
- setProvider(providerId: string, key: string, value: unknown): void;
335
- getAllProvider(providerId: string): Record<string, unknown>;
336
- getDevice(deviceId: string, key: string): unknown;
337
- setDevice(deviceId: string, key: string, value: unknown): void;
338
- getAllDevice(deviceId: string): Record<string, unknown>;
339
- getAddonDevice(addonId: string, deviceId: string): Record<string, unknown>;
340
- /**
341
- * Bulk-replace all per-device overrides for (addonId, deviceId) in a
342
- * single transaction. Empty input clears the override set — caller
343
- * should use `clearAddonDevice` for explicit resets.
344
- */
345
- setAddonDevice(addonId: string, deviceId: string, values: Record<string, unknown>): void;
346
- clearAddonDevice(addonId: string, deviceId: string): void;
347
- /** Close the SQLite connection (call on shutdown). */
348
- close(): void;
349
- /** Check if system_settings is empty (used for first-boot seeding). */
350
- isSystemSettingsEmpty(): boolean;
351
- /** Seed system_settings with RUNTIME_DEFAULTS (only on first boot). */
352
- seedDefaults(): void;
353
- private initTables;
354
- }
355
-
356
- /** Core table DDL statements -- executed on first boot */
357
- declare const CORE_TABLE_DDL: readonly string[];
358
- /** Addon table schema declaration */
359
- interface AddonTableSchema {
360
- readonly name: string;
361
- readonly columns: ReadonlyArray<{
362
- readonly name: string;
363
- readonly type: 'TEXT' | 'INTEGER' | 'REAL' | 'JSON';
364
- readonly primaryKey?: boolean;
365
- readonly notNull?: boolean;
366
- }>;
367
- readonly indexes?: ReadonlyArray<{
368
- readonly name: string;
369
- readonly columns: readonly string[];
370
- readonly unique?: boolean;
371
- }>;
372
- }
373
- /** Generate CREATE TABLE DDL from addon schema */
374
- declare function addonTableToDdl(schema: AddonTableSchema): string[];
375
-
376
- interface DeviceRow {
377
- readonly stableId: string;
378
- readonly type: string;
379
- readonly name: string;
380
- readonly parentStableId: string | null;
381
- readonly enabled: boolean;
382
- }
383
- interface InsertInput {
384
- readonly stableId: string;
385
- readonly type: string;
386
- readonly name: string;
387
- readonly parentStableId: string | null;
388
- }
389
- declare class DeviceStore {
390
- private readonly db;
391
- constructor(db: Database.Database);
392
- insert(addonId: string, device: InsertInput): void;
393
- listByAddon(addonId: string): readonly DeviceRow[];
394
- listChildren(addonId: string, parentStableId: string): readonly DeviceRow[];
395
- remove(addonId: string, stableId: string): void;
396
- }
397
-
398
- declare class ConfigStore {
399
- private readonly db;
400
- constructor(db: Database.Database);
401
- save(addonId: string, stableId: string | null, data: Record<string, unknown>): void;
402
- load(addonId: string, stableId: string | null): Record<string, unknown>;
403
- remove(addonId: string, stableId: string | null): void;
404
- }
405
-
406
- interface WinstonConfig$1 {
407
- readonly level: string;
408
- readonly retentionDays: number;
409
- /** Resolved absolute path to the logs directory (replaces the old dataPath field). */
410
- readonly logsDir: string;
411
- }
412
- /**
413
- * Rotated-file log destination. Console output goes through the shared
414
- * `formatLogLine` so every console sink (Winston, ConsoleDestination,
415
- * HubForwarderDestination) emits identical lines. File output keeps a
416
- * structured JSON shape so log tooling can query tags/meta.
417
- */
418
- declare class WinstonDestination implements ILogDestination$1 {
419
- private logger;
420
- initialize(config?: WinstonConfig$1): Promise<void>;
421
- write(entry: LogEntry): void;
422
- query(_filter: LogFilter): Promise<readonly LogEntry[]>;
423
- shutdown(): Promise<void>;
424
- }
425
-
426
- interface WinstonConfig {
427
- readonly level: string;
428
- readonly retentionDays: number;
429
- }
430
- /**
431
- * Winston logging addon — rotated log files + console output.
432
- * Settings appear under Cluster → NodeDetail → Settings.
433
- */
434
- declare class WinstonLoggingAddon extends BaseAddon<WinstonConfig> {
435
- private destination;
436
- constructor();
437
- protected onInitialize(): Promise<ProviderRegistration[]>;
438
- protected onShutdown(): Promise<void>;
439
- getDestination(): WinstonDestination;
440
- protected globalSettingsSchema(): _camstack_types.ConfigUISchema;
441
- }
442
-
443
- /**
444
- * Zero-dependency log destination that writes every entry to stdout /
445
- * stderr via the shared `formatLogLine` formatter. Same surface as
446
- * `WinstonDestination` (full `ILogDestination` contract) but without
447
- * the rotating-file transport — ideal fallback when the Winston addon
448
- * is disabled or unavailable (e.g. bare-bones agents, tests).
449
- */
450
-
451
- interface ConsoleConfig$1 {
452
- /** Minimum log level to emit. Entries below this level are dropped. */
453
- readonly level?: 'debug' | 'info' | 'warn' | 'error';
454
- }
455
- declare class ConsoleDestination implements ILogDestination$1 {
456
- private minLevel;
457
- initialize(config?: ConsoleConfig$1): Promise<void>;
458
- write(entry: LogEntry): void;
459
- query(_filter: LogFilter): Promise<readonly LogEntry[]>;
460
- shutdown(): Promise<void>;
461
- }
462
-
463
- interface ConsoleConfig {
464
- readonly level: 'debug' | 'info' | 'warn' | 'error';
465
- }
466
- /**
467
- * Console logging addon — zero-dependency stdout/stderr sink that
468
- * produces the same canonical line format as the Winston built-in.
469
- * Registers as a `log-destination` capability provider so the shared
470
- * LogManager fans every entry to both sinks when both are active.
471
- *
472
- * Settings live under Cluster → NodeDetail → Settings alongside the
473
- * Winston addon. Disable one without disabling the other — the
474
- * LogManager keeps working as long as at least one destination is
475
- * registered.
476
- */
477
- declare class ConsoleLoggingAddon extends BaseAddon<ConsoleConfig> {
478
- private destination;
479
- constructor();
480
- protected onInitialize(): Promise<ProviderRegistration[]>;
481
- protected onShutdown(): Promise<void>;
482
- getDestination(): ConsoleDestination;
483
- protected globalSettingsSchema(): _camstack_types.ConfigUISchema;
484
- }
485
-
486
- /**
487
- * Log destination for agent mode.
488
- *
489
- * - Writes to console ONLY when hub is not yet reachable (cold-start
490
- * fallback). Forked-worker agents share stdout with their parent
491
- * hub, so logging to local console AND forwarding to hub's
492
- * `log-receiver` would print the entry twice on the hub terminal.
493
- * Once the hub is discovered, local console output stops and the
494
- * hub's own ConsoleDestination owns the render.
495
- * - When a Moleculer broker is connected and the hub node is reachable,
496
- * forwards every log entry to the hub via `log-receiver.ingest`.
497
- * - Entries written before the hub is reachable are buffered internally
498
- * (ring-buffered to `DEFAULT_OUTBOUND_BUFFER_SIZE`) and flushed on connect,
499
- * so boot-time logs still reach the hub without any external replay trigger.
500
- */
501
- declare class HubForwarderDestination implements ILogDestination$1 {
502
- private broker;
503
- private hubConnected;
504
- private readonly outboundBuffer;
505
- private statusLogger;
506
- initialize(): Promise<void>;
507
- /**
508
- * Provide a logger for the destination's own status messages
509
- * (discovery, disconnect, reconnect). Routed through the agent's
510
- * LogManager but never through this same destination — the owning
511
- * addon must hand in a logger that does NOT route back here, or
512
- * status writes will recurse.
513
- */
514
- setStatusLogger(logger: IScopedLogger): void;
515
- private status;
516
- /**
517
- * Attach the Moleculer broker so hub forwarding can start.
518
- * Called by the owning addon from `onInitialize(ctx)` with
519
- * `ctx.kernel.cluster?.broker`.
520
- */
521
- connectBroker(broker: IClusterBroker): void;
522
- write(entry: LogEntry): void;
523
- query(_filter: LogFilter): Promise<readonly LogEntry[]>;
524
- shutdown(): Promise<void>;
525
- private bufferOutbound;
526
- private flushOutbound;
527
- private forward;
528
- }
529
-
530
- /**
531
- * Agent-only addon that provides the `log-destination` capability.
532
- * Writes all logs to the console and forwards to the hub via Moleculer when
533
- * reachable. The broker is read from `ctx.kernel.cluster?.broker`; outbound
534
- * log replay on hub-connect is handled internally by the destination.
535
- */
536
- declare class HubForwarderAddon extends BaseAddon {
537
- private destination;
538
- constructor();
539
- protected onInitialize(): Promise<ProviderRegistration[]>;
540
- getDestination(): HubForwarderDestination | null;
541
- protected onShutdown(): Promise<void>;
542
- }
543
-
544
- interface BackupConfig {
545
- readonly backupDir: string;
546
- readonly retentionCount: number;
547
- }
548
- declare class LocalBackupService {
549
- private readonly config;
550
- private readonly logger;
551
- private readonly eventBus;
552
- private manifests;
553
- constructor(config: BackupConfig, logger: IScopedLogger, eventBus: IEventBus);
554
- /** Create a backup of specified locations */
555
- backup(options?: {
556
- locations?: string[];
557
- label?: string;
558
- }): Promise<BackupManifest>;
559
- /** Restore from a backup */
560
- restore(backupId: string): Promise<void>;
561
- /** List all backups sorted by timestamp descending */
562
- list(): readonly BackupManifest[];
563
- /** Delete a specific backup */
564
- delete(backupId: string): Promise<void>;
565
- private pruneOldBackups;
566
- }
567
-
568
- interface LocalBackupAddonConfig {
569
- readonly retentionCount: number;
570
- }
571
- /**
572
- * Local backup addon — snapshot-based backup/restore of camstack data.
573
- * Settings appear under Cluster → NodeDetail → Settings.
574
- */
575
- declare class LocalBackupAddon extends BaseAddon<LocalBackupAddonConfig> {
576
- private service;
577
- constructor();
578
- protected onInitialize(): Promise<ProviderRegistration[]>;
579
- protected onShutdown(): Promise<void>;
580
- getService(): LocalBackupService;
581
- protected globalSettingsSchema(): _camstack_types.ConfigUISchema;
582
- }
583
-
584
- interface NativeMetricsConfig {
585
- readonly samplingIntervalMs: number;
586
- }
587
- /**
588
- * Native metrics — CPU, memory, disk usage sampling.
589
- * Settings appear under Cluster → NodeDetail → Settings.
590
- */
591
- declare class NativeMetricsAddon extends BaseAddon<NativeMetricsConfig> {
592
- private provider;
593
- private startedAtMs;
594
- private snapshotTimer;
595
- /**
596
- * Snapshot-equality cache for the resources + processes emit.
597
- * Stores the coarsened JSON and timestamp; a tick where the
598
- * coarsened payload matches the cache (and the heartbeat hasn't
599
- * elapsed) is skipped.
600
- */
601
- private lastResourcesEmit;
602
- private lastProcessesEmit;
603
- constructor();
604
- protected onInitialize(): Promise<ProviderRegistration[]>;
605
- protected onShutdown(): Promise<void>;
606
- /**
607
- * Emit one `metrics.node-resources-snapshot` + one
608
- * `metrics.node-processes-snapshot` for this node. UI consumers
609
- * subscribe and read state directly from the payload.
610
- */
611
- private emitMetricsSnapshots;
612
- protected onConfigChanged(): Promise<void>;
613
- private listWorkerInstances;
614
- private listAddonInstances;
615
- private getAddonStats;
616
- /**
617
- * Walk the OS process table and classify each camstack-shaped process.
618
- *
619
- * Classification (ancestry-driven, NOT pattern-driven):
620
- * - root — the current node's own pid (`process.pid`).
621
- * - managed — pid is registered in the kernel's `$process.list`
622
- * (forked addon worker spawned by this hub).
623
- * - system — ancestry walk crosses a SUPERVISOR_BOUNDARY_RE match
624
- * (tsx-watch launcher, agent CLI, concurrently, vite,
625
- * npm exec wrapper). The process belongs to the dev
626
- * tree even if not in `$process.list`. NEVER killable.
627
- * - ghost — ancestry walk reaches `ppid=1` without crossing any
628
- * supervisor boundary AND the parent isn't visible in
629
- * `ps`. A truly orphaned camstack-shaped process. The
630
- * ONLY classification that's eligible for kill.
631
- *
632
- * Old pattern-only ghost detection produced false positives: every
633
- * monorepo-path process matched CAMSTACK_CMD_RE, ancestry walk
634
- * stopping at ppid=hub returned false-positive ghosts whenever a
635
- * concurrently sibling sat above hub. Ancestry-driven classification
636
- * fixes that.
637
- */
638
- private listNodeProcesses;
639
- /**
640
- * Send SIGTERM / SIGKILL to a pid. Refuses pids that don't appear in
641
- * `listNodeProcesses()` to prevent arbitrary system kills — a dedicated
642
- * admin-path for resurrected zombies, not a generic shell replacement.
643
- *
644
- * `root`-classified pids (the running launcher / agent CLI / hub itself)
645
- * are also refused: killing them tears down the whole node and the
646
- * operator's intent is almost always to nuke a leaked child, not the
647
- * supervisor that keeps the rest alive. Process restart goes through
648
- * the dedicated `$process.restart` action, not this kill API.
649
- */
650
- private killProcess;
651
- /** Raw `ps` scan returning every pid + command + resource stats. */
652
- private runPs;
653
- protected globalSettingsSchema(): _camstack_types.ConfigUISchema;
654
- }
655
-
656
- interface AlertCenterConfig {
657
- readonly maxAlerts: number;
658
- readonly retentionDays: number;
659
- }
660
- /**
661
- * Alert Center addon — core builtin that persists alerts in a
662
- * structured SQLite table and serves them to the admin UI.
663
- *
664
- * Registers as an `alerts` collection provider and subscribes to
665
- * important EventBus categories to create/update alerts automatically.
666
- */
667
- declare class AlertCenterAddon extends BaseAddon<AlertCenterConfig> {
668
- private unsubscribers;
669
- constructor();
670
- /**
671
- * Per `(category, source.id)` counter used to rate-limit chatty
672
- * events. Entries are pruned lazily when they age out of
673
- * `RATE_LIMIT_WINDOW_MS`; see `shouldSuppressByRate()` below.
674
- */
675
- private readonly rateLimitCounters;
676
- protected onInitialize(): Promise<ProviderRegistration[]>;
677
- protected onShutdown(): Promise<void>;
678
- protected globalSettingsSchema(): _camstack_types.ConfigUISchema;
679
- listAlerts(filter?: {
680
- unreadOnly?: boolean;
681
- limit?: number;
682
- }): Promise<readonly Alert[]>;
683
- getUnreadCount(): Promise<number>;
684
- markRead(alertId: string): Promise<void>;
685
- markAllRead(): Promise<void>;
686
- dismiss(alertId: string): Promise<void>;
687
- private handleEvent;
688
- private handleModelDownload;
689
- /**
690
- * `[ALERT-CENTER-EVENTS]` — rate limit a `(category, source.id)`
691
- * tuple. Returns `true` when the caller should DROP this event
692
- * without persisting an alert, and `false` when the alert should
693
- * proceed normally.
694
- *
695
- * Heuristic: the first `RATE_LIMIT_MAX_PER_SOURCE` events within a
696
- * `RATE_LIMIT_WINDOW_MS` window go through. Once the threshold is
697
- * crossed, subsequent events are suppressed until the window rolls
698
- * over. When the threshold is first crossed, the suppression is
699
- * logged once so operators know why they're not seeing the follow-
700
- * up alerts; after the window rolls over the next event is
701
- * un-suppressed and starts a new window.
702
- */
703
- private shouldSuppressByRate;
704
- private buildMessage;
705
- private emitAlert;
706
- private updateAlert;
707
- /**
708
- * Read-merge-write: SettingsBackend.update() replaces the entire `data` blob,
709
- * so we must read the existing record, merge the patch, and write back.
710
- */
711
- private mergeUpdate;
712
- private persistAlert;
713
- private emitAlertCreatedEvent;
714
- private emitAlertUpdatedEvent;
715
- private enforceMaxAlerts;
716
- private enforceRetention;
717
- }
718
-
719
- interface SamplingDiagnostics {
720
- warn(message: string, meta?: Record<string, unknown>): void;
721
- }
722
- declare class NativeMetricsProvider {
723
- readonly id = "native";
724
- private cachedSnapshot;
725
- private samplingTimer;
726
- private macMemTimer;
727
- private prevCpu;
728
- private diagnostics;
729
- private consecutiveSampleErrors;
730
- constructor();
731
- /**
732
- * Optional diagnostics sink for sampling errors. The first failure and
733
- * every Nth failure thereafter are reported so a permanently-broken
734
- * collector doesn't spam logs but is still observable.
735
- */
736
- setDiagnostics(diag: SamplingDiagnostics): void;
737
- startSampling(intervalMs: number): void;
738
- private reportSampleError;
739
- stopSampling(): void;
740
- collectSnapshot(): Promise<SystemResourceSnapshot>;
741
- getCached(): Promise<SystemResourceSnapshot | null>;
742
- getCurrent(): Promise<{
743
- cpuPercent: number;
744
- memoryPercent: number;
745
- memoryUsedMB: number;
746
- memoryTotalMB: number;
747
- diskPercent?: number;
748
- temperature?: number;
749
- gpuPercent?: number;
750
- gpuMemoryPercent?: number;
751
- }>;
752
- getDiskSpace(input: {
753
- dirPath: string;
754
- }): Promise<DiskSpaceInfo>;
755
- getGpuInfo(): Promise<MetricsGpuInfo | null>;
756
- getCpuTemperature(): Promise<number | null>;
757
- getProcessStats(input: {
758
- pids: number[];
759
- }): Promise<PidResourceStats[]>;
760
- private sampleCpu;
761
- /** Cached macOS memory (set by sampleMacMemory timer). */
762
- _cachedMacMem: MemoryInfo | null;
763
- private getMemoryInfo;
764
- }
765
-
766
- declare class SystemConfigAddon extends BaseAddon {
767
- readonly id = "system-config";
768
- constructor();
769
- protected onInitialize(): Promise<void>;
770
- private buildGlobalSchema;
771
- getGlobalSettings(): Promise<ConfigUISchemaWithValues>;
772
- updateGlobalSettings(patch: Record<string, unknown>): Promise<void>;
773
- }
774
-
775
- /**
776
- * Local Auth Addon — owns user accounts, API keys, scoped tokens,
777
- * and local password authentication.
778
- *
779
- * Capabilities registered:
780
- * - `auth-provider` (collection) — local password authentication
781
- * - `user-management` (singleton) — user CRUD, API keys, scoped tokens
782
- *
783
- * Extension: an OIDC addon can register another `auth-provider` entry.
784
- * The server's login flow iterates the `auth-provider` collection.
785
- */
786
-
787
- interface LocalAuthConfig {
788
- jwtSecret?: string;
789
- adminUsername?: string;
790
- adminPassword?: string;
791
- }
792
- declare class LocalAuthAddon extends BaseAddon<LocalAuthConfig> {
793
- private authManager;
794
- private userManager;
795
- private apiKeyManager;
796
- private scopedTokenManager;
797
- constructor();
798
- protected onInitialize(): Promise<ProviderRegistration[]>;
799
- protected onShutdown(): Promise<void>;
800
- }
801
-
802
- /**
803
- * Wire shape matching `z.infer<typeof SettingsSchemaWithValuesSchema>` —
804
- * duplicated as a plain interface because importing the Zod schema across
805
- * package boundaries confuses `tsc` when the types package pins a
806
- * different `zod` minor than the core package. Keeping the shape local
807
- * keeps the addon decoupled from the schema's internal type encoding.
808
- */
809
- interface ContributionShape {
810
- tabs?: Array<{
811
- id: string;
812
- label: string;
813
- icon: string;
814
- order?: number;
815
- }>;
816
- sections: Array<{
817
- id: string;
818
- title: string;
819
- description?: string;
820
- style?: 'card' | 'accordion';
821
- defaultCollapsed?: boolean;
822
- columns?: 1 | 2 | 3 | 4;
823
- tab?: string;
824
- /** Where the section renders. Default 'settings' (Config tab); 'top-tab' hoists into the device-detail tab bar via DeviceDetail discovery. */
825
- location?: 'settings' | 'top-tab';
826
- order?: number;
827
- fields: unknown[];
828
- }>;
829
- }
830
-
831
- declare class DeviceManagerAddon extends BaseAddon {
832
- constructor();
833
- /** Shorthand for the kernel-injected capability registry. */
834
- private get capabilityRegistry();
835
- /**
836
- * Parent-chain event propagator. Started in `onInitialize` once the
837
- * hub's `deviceRegistry` is available; listens to every device-sourced
838
- * event and re-emits a copy on each ancestor scope with `via[]`
839
- * populated. Stopped in `onShutdown`.
840
- */
841
- private propagator;
842
- /**
843
- * Hub-side mirror of every device's cap-keyed runtime state.
844
- * Populated whenever any caller writes via `deviceState.setCapSlice`
845
- * (the canonical cross-layer write entrypoint) and on first load
846
- * via `loadRuntimeState`. Cross-process consumers reach the mirror
847
- * through the `deviceState` cap router; per-cap event subscribers
848
- * (e.g. `battery.onStatusChanged`) get the same data via
849
- * cap-specific events still emitted by the owning device.
850
- *
851
- * Key: deviceId. Value: per-cap slice map. Empty by default —
852
- * slices show up as `setCapSlice` calls trickle in.
853
- */
854
- private readonly stateMirror;
855
- /**
856
- * Per-device disk-write debouncer for runtime-state. `setCapSlice`
857
- * updates the in-memory mirror synchronously and emits the change
858
- * event immediately, but the disk write is coalesced — frequent
859
- * back-to-back writes (motion phase transitions, battery pushes,
860
- * etc.) collapse to one `writeDeviceRuntimeState` per
861
- * `RUNTIME_STATE_DEBOUNCE_MS` window. `flushRuntimeStateWrites`
862
- * awaits any in-flight write + scheduled flush so shutdown is
863
- * lossless.
864
- */
865
- private readonly runtimeStateDebounce;
866
- private static readonly RUNTIME_STATE_DEBOUNCE_MS;
867
- /**
868
- * Cross-process native-provider cache: deviceId (numeric) → capName → { addonId, nodeId }.
869
- * Kept in sync with `device.bindings-changed` events emitted by forked
870
- * workers. Union'd into `getBindings` so hub-side consumers see every
871
- * native cap regardless of which process owns the IDevice. No persistence
872
- * — entries re-register when the worker restarts. Purged on
873
- * `$node.disconnected` to avoid stale routing after a worker crash.
874
- */
875
- private remoteNativeCaps;
876
- /** Wait for a device-provider by addonId, returning null on timeout. */
877
- private waitDeviceProvider;
878
- /** Require a device-provider by addonId — throws if not found. */
879
- private requireDeviceProvider;
880
- private readBindingsStore;
881
- private writeBindingsStore;
882
- private resolveWrapperNodeId;
883
- /**
884
- * Active discovery of native caps registered on a worker node.
885
- * Called from the `$node.connected` handler to recover from lost
886
- * `DeviceBindingsChanged` broadcasts after worker restart.
887
- *
888
- * Iterates the broker's service registry, picks
889
- * `<addonId>.native-provider.<capName>` services owned by the
890
- * connected node, calls each service's `$listDeviceIds` action to
891
- * fetch the deviceIds the worker has registered that cap on, then
892
- * writes entries into `remoteNativeCaps`.
893
- *
894
- * Best-effort: per-service failures are logged and swallowed so a
895
- * single bad service doesn't abort the whole rebuild.
896
- */
897
- private discoverWorkerNativeCaps;
898
- getBindings(input: {
899
- deviceId: number;
900
- }): Promise<{
901
- deviceId: number;
902
- entries: DeviceBindingEntry[];
903
- }>;
904
- /**
905
- * Whole-fleet binding dump. Iterates every device known to the
906
- * deviceRegistry and reuses the per-device `getBindings` resolver
907
- * for each — same routing rules, single round-trip. Used by
908
- * `SystemManager.init()` for warm-boot.
909
- *
910
- * Bindings change rarely (wrapper toggle, device add/remove) so
911
- * clients invalidate via the existing
912
- * `capability.binding-changed` event rather than re-fetching this
913
- * payload periodically.
914
- */
915
- getAllBindings(): Promise<Array<{
916
- deviceId: number;
917
- entries: DeviceBindingEntry[];
918
- }>>;
919
- /**
920
- * Resolve a numeric deviceId to a stableId via persisted meta.
921
- * Used only by the device-identity section of the device-details
922
- * aggregator (see `buildBaseDeviceSection`) to surface the stableId as
923
- * a readonly display field. All runtime/registry lookups are keyed by
924
- * numeric deviceId; this helper is display-only.
925
- */
926
- private lookupPersistedStableId;
927
- getDeviceAggregate(deviceId: number, kind: 'settings' | 'live'): Promise<ContributionShape | null>;
928
- /**
929
- * Build the device-manager's own contribution to the aggregator — the
930
- * device identity (id, stableId, addonId, type, online) + the
931
- * driver-specific config exposed by the device class via
932
- * `zodEntriesToConfigUI`.
933
- *
934
- * Two paths, deliberately symmetric with `getSettingsSchema`:
935
- *
936
- * - Hub-local: device's IDevice instance lives in this process'
937
- * DeviceRegistry, we read config + schema directly by reference.
938
- * - Cross-process: device lives in a forked worker (RtspCamera on
939
- * provider-rtsp, ONVIF on provider-onvif, …). We ask the worker's
940
- * `device-ops.getSettingsSchema` native provider for a wire-
941
- * serializable ConfigUISchema and merge it in under the same
942
- * "Driver Config" section, so the UI sees the same shape regardless
943
- * of where the IDevice physically runs.
944
- *
945
- * Returns `null` only when the device genuinely doesn't exist anywhere
946
- * (no hub-local, no persisted ownership, no device-ops native). The
947
- * aggregator falls back to contributor sections only in that case.
948
- */
949
- private buildBaseDeviceSection;
950
- /**
951
- * Lookup the native owner for `device-ops` on `deviceId` — the native-cap
952
- * registry (hub-local and remote) is keyed by numeric id.
953
- */
954
- private resolveNativeDeviceOwner;
955
- /**
956
- * Aggregate `status` across every registered cap for a device.
957
- *
958
- * Walks the supplied cap list (or `CAP_NAMES_WITH_STATUS` when
959
- * omitted), looks up a native provider per cap via the capability
960
- * registry, calls `provider.getStatus({ deviceId })`, and validates
961
- * the return against the cap's own `status.schema`. Validation
962
- * failures log a warning and yield `null` for that cap so the
963
- * overall aggregate stays usable — a single misbehaving provider
964
- * must not blank out a device's entire status view.
965
- *
966
- * Returned shape is `Record<capName, unknown | null>`; the client-
967
- * side hook tightens this to `CapStatusTypeMap` via the generated
968
- * `cap-status-types.ts`.
969
- */
970
- private getDeviceStatusAggregate;
971
- /**
972
- * Return the driver-specific device-settings contribution. Hub-local
973
- * devices call `getSettingsUISchema()` directly; forked-worker devices
974
- * go through the `device-ops.getSettingsSchema` cap method on the
975
- * numeric-id-keyed native registry.
976
- */
977
- private resolveDriverConfigSchema;
978
- updateDeviceField(input: {
979
- deviceId: number;
980
- writerCapName: string;
981
- writerAddonId: string;
982
- key: string;
983
- value: unknown;
984
- }): Promise<{
985
- success: true;
986
- }>;
987
- /**
988
- * Batched counterpart of `updateDeviceField`. Groups changes by
989
- * `(writerCapName, writerAddonId)` so each contributor receives a
990
- * single `applyDeviceSettingsPatch` with all of its updates merged —
991
- * avoids N round-trips for simultaneous edits in the same save.
992
- *
993
- * Per-provider failures are captured in the `failures[]` output so the
994
- * admin UI can highlight which sections didn't persist; a failure on
995
- * one provider does NOT abort the others.
996
- */
997
- updateDeviceFieldsBatch(input: {
998
- deviceId: number;
999
- changes: ReadonlyArray<{
1000
- writerCapName: string;
1001
- writerAddonId: string;
1002
- key: string;
1003
- value: unknown;
1004
- }>;
1005
- }): Promise<{
1006
- success: true;
1007
- failures: {
1008
- writerCapName: string;
1009
- writerAddonId: string;
1010
- error: string;
1011
- }[];
1012
- }>;
1013
- /** Apply a single grouped patch to the appropriate provider. Mirrors
1014
- * `updateDeviceField` routing (special-case device-manager, else
1015
- * registry lookup). Used by `updateDeviceFieldsBatch`. */
1016
- private applyGroupPatch;
1017
- listWrappersForCap(input: {
1018
- capName: string;
1019
- }): Promise<string[]>;
1020
- listBindableCapsForDeviceType(input: {
1021
- deviceType: string;
1022
- }): Promise<Array<{
1023
- capName: string;
1024
- wrappers: string[];
1025
- }>>;
1026
- setWrapperActive(input: {
1027
- deviceId: number;
1028
- capName: string;
1029
- wrapperAddonId: string;
1030
- active: boolean;
1031
- }): Promise<void>;
1032
- protected onInitialize(): Promise<ProviderRegistration[] | void>;
1033
- /**
1034
- * Single-cap mirror update — diff against the current mirror,
1035
- * persist the new slice in-memory, emit `DeviceStateChanged` for
1036
- * this cap. No-op on identical writes (both same shape and same
1037
- * values). Called by `setCapSlice` provider.
1038
- */
1039
- private applySingleCapUpdate;
1040
- /**
1041
- * Debounced disk writer. Coalesces frequent writes (motion phase
1042
- * transitions, battery pushes) into one `writeDeviceRuntimeState`
1043
- * per `RUNTIME_STATE_DEBOUNCE_MS` window. Reads the per-device
1044
- * blob from the live mirror at flush time so the disk picture is
1045
- * always the latest state — no risk of writing a stale snapshot.
1046
- */
1047
- private scheduleRuntimeStateDiskWrite;
1048
- /**
1049
- * One-shot mirror seed used by `loadRuntimeState` at boot so the
1050
- * hub knows about every persisted slice without waiting for the
1051
- * first `setCapSlice` call. No events emitted — this is
1052
- * initial-state population, not a transition.
1053
- */
1054
- private seedMirror;
1055
- private snapshotForDevice;
1056
- private emitStateChanged;
1057
- protected onShutdown(): Promise<void>;
1058
- }
1059
-
1060
- type ElementState = 'stopped' | 'starting' | 'running' | 'stopping' | 'error' | 'disabled';
1061
- interface ElementStatus {
1062
- state: ElementState;
1063
- error?: string;
1064
- startedAt?: number;
1065
- stoppedAt?: number;
1066
- restartCount: number;
1067
- uptime: number;
1068
- }
1069
- declare class LifecycleStateMachine {
1070
- private readonly elementId;
1071
- private readonly elementType;
1072
- private readonly eventBus;
1073
- private readonly logger;
1074
- private _state;
1075
- private _error?;
1076
- private _startedAt?;
1077
- private _stoppedAt?;
1078
- private _restartCount;
1079
- private _hasStartedOnce;
1080
- constructor(elementId: string, elementType: 'provider' | 'device' | 'addon' | 'process', eventBus: IEventBus, logger: IScopedLogger);
1081
- get state(): ElementState;
1082
- getStatus(): ElementStatus;
1083
- transition(to: ElementState, error?: string): boolean;
1084
- incrementRestartCount(): void;
1085
- private isValidTransition;
1086
- }
1087
-
1088
- type FeatureConfigReader = {
1089
- readonly features: FeatureManifest;
1090
- };
1091
- declare class FeatureManager {
1092
- private readonly configReader;
1093
- constructor(configReader: FeatureConfigReader);
1094
- isEnabled(flag: FeatureFlag): boolean;
1095
- getManifest(): FeatureManifest;
1096
- }
1097
-
1098
- declare class SystemEventBus implements IEventBus {
1099
- private readonly ringBuffer;
1100
- private readonly subscribers;
1101
- constructor(bufferSize?: number);
1102
- emit(event: SystemEvent): void;
1103
- /**
1104
- * Subscribe to events matching a filter.
1105
- * When called with a typed category filter, the handler receives typed event data.
1106
- */
1107
- subscribe(filter: EventFilter, handler: (event: SystemEvent) => void): () => void;
1108
- getRecent(filter?: EventFilter, limit?: number): readonly SystemEvent[];
1109
- }
1110
-
1111
- declare class LogRingBuffer {
1112
- private readonly capacity;
1113
- private readonly buffer;
1114
- private head;
1115
- private count;
1116
- constructor(capacity?: number);
1117
- push(entry: LogEntry): void;
1118
- getAll(): LogEntry[];
1119
- query(filter: LogFilter): LogEntry[];
1120
- /**
1121
- * Drop entries that match `filter`. Returns the number of entries
1122
- * removed. Triggered by the UI's "Clear logs" button so the operator
1123
- * can wipe the historical buffer for a specific scope (per-device,
1124
- * per-addon, per-agent) — without it, closing and reopening the
1125
- * panel re-populates the cleared rows from the server's ring buffer.
1126
- *
1127
- * Filter semantics mirror `query` (same level / since / until / tags
1128
- * handling) — whatever you'd see listed by `query(filter)` is what
1129
- * gets removed.
1130
- */
1131
- clear(filter?: LogFilter): number;
1132
- }
1133
-
1134
- declare class ScopedLogger implements IScopedLogger {
1135
- private readonly scope;
1136
- private readonly writeFn;
1137
- private readonly tags?;
1138
- constructor(scope: string | undefined, writeFn: (entry: LogEntry) => void, tags?: LogTags | undefined);
1139
- debug(message: string, extras?: LogExtras): void;
1140
- info(message: string, extras?: LogExtras): void;
1141
- warn(message: string, extras?: LogExtras): void;
1142
- error(message: string, extras?: LogExtras): void;
1143
- child(childScope: string): IScopedLogger;
1144
- withTags(tags: LogTags): IScopedLogger;
1145
- private write;
1146
- private mergeTags;
1147
- }
1148
-
1149
- interface ILogDestination {
1150
- initialize(): Promise<void>;
1151
- shutdown(): Promise<void>;
1152
- write(entry: LogEntry): void;
1153
- query?(filter: LogFilter): Promise<readonly LogEntry[]>;
1154
- }
1155
- declare class LogManager {
1156
- private readonly ringBuffer;
1157
- private readonly destinations;
1158
- private readonly subscribers;
1159
- private deviceNameLookup;
1160
- constructor(bufferSize?: number);
1161
- /**
1162
- * Register a callback that resolves `deviceId → deviceName`. Called
1163
- * for every emitted entry that carries `tags.deviceId` but no
1164
- * explicit `tags.deviceName` — the LogManager injects the resolved
1165
- * name directly into the entry's tags BEFORE ring-buffer / destination
1166
- * write, so every destination (local console, file, remote forwarder,
1167
- * addon-bundled copies of core) sees the enriched shape regardless of
1168
- * which module instance the destination was built from.
1169
- */
1170
- setDeviceNameLookup(lookup: ((deviceId: number) => string | null) | null): void;
1171
- createLogger(scope?: string): IScopedLogger;
1172
- private enrichDeviceName;
1173
- /** Subscribe to live logs matching a filter. Returns an unsubscribe function. */
1174
- subscribe(filter: Partial<LogFilter>, callback: (entry: LogEntry) => void): () => void;
1175
- private matchesFilter;
1176
- /**
1177
- * Register a log destination.
1178
- *
1179
- * @param opts.replay If true (default), replay every entry currently in
1180
- * the ring buffer to the new destination before live
1181
- * traffic starts. Lets a destination added mid-boot
1182
- * still receive boot-time log entries.
1183
- */
1184
- addDestination(dest: ILogDestination, opts?: {
1185
- replay?: boolean;
1186
- }): void;
1187
- removeDestination(dest: ILogDestination): void;
1188
- query(filter: LogFilter): LogEntry[];
1189
- /**
1190
- * Drop ring-buffer entries matching `filter`. Returns the count
1191
- * removed. Backs the UI's "Clear logs" admin action so an operator
1192
- * can wipe the historical window for a scope (per-device, per-addon,
1193
- * agent-level) without restarting the server. External destinations
1194
- * (file, forwarder) are NOT touched — only the in-memory ring.
1195
- */
1196
- clear(filter?: LogFilter): number;
1197
- }
1198
-
1199
- /**
1200
- * Canonical single-line formatter for every `LogEntry` that reaches a
1201
- * console transport — hub-side `WinstonDestination` +
1202
- * `ConsoleDestination`, agent-side `HubForwarderDestination`. One
1203
- * definition so the three paths can't drift.
1204
- *
1205
- * Layout mirrors NestJS `ConsoleLogger` output:
1206
- *
1207
- * [Nest] 54994 - 04/20/2026, 12:45:53 AM LOG [InstanceLoader] TrpcModule dependencies initialized +0ms
1208
- *
1209
- * Mapping for camstack — cluster-aware:
1210
- * - `[Nest]` (brand bracket) → `[<agent>/<addonId>]` so operators see
1211
- * at a glance which node emitted the line
1212
- * (matches the cluster topology)
1213
- * - `54994` (pid) → `process.pid`
1214
- * - `<timestamp>` → `M/D/YYYY, H:MM:SS AM`
1215
- * - `LOG` / `WARN` / `ERROR` → `entry.level` upper-cased, colour per level
1216
- * - `[InstanceLoader]` (ctx) → `[<device>]` — shown only when a device
1217
- * tag is present; omitted otherwise
1218
- * - `<message>` → `entry.message`
1219
- * - trailing `+Nms` → we don't compute timing yet; omitted
1220
- *
1221
- * Rendered examples:
1222
- * [hub/winston-logging] 71184 - 04/20/2026, 12:45:53 AM INFO Winston logging initialized
1223
- * [hub/provider-rtsp] 71184 - 04/20/2026, 12:46:01 AM WARN [salone] probe failed {err="timeout"}
1224
- * [dev-agent-0/detection] 12345 - 04/20/2026, 12:47:15 AM ERROR [cortile] no detector {codec=av1}
1225
- */
1226
-
1227
- /** Options for `formatLogLine`. */
1228
- interface FormatLogLineOptions {
1229
- /**
1230
- * Emit ANSI colour codes. When omitted, falls back to the shell-env
1231
- * heuristic (`NO_COLOR`/`FORCE_COLOR`/`isTTY`). Destinations that
1232
- * always target a console (ConsoleDestination, HubForwarderDestination)
1233
- * pass `true`; file sinks (Winston JSON) pass `false` so logs on disk
1234
- * stay plain text regardless of the shell env.
1235
- *
1236
- * `NO_COLOR=1` in the environment still wins — consumer opt-in beats
1237
- * producer opt-in, matching the https://no-color.org/ convention.
1238
- */
1239
- readonly colorize?: boolean;
1240
- }
1241
- /**
1242
- * Render a `LogEntry` as one complete console line — no trailing newline.
1243
- * Caller appends `\n` (file sinks) or relies on `console.log` (stdout sink).
1244
- *
1245
- * PID column prefers `entry.tags.pid` when set (so forked-worker entries
1246
- * carry the worker's OS pid even when the hub renders them), falling back
1247
- * to the renderer's own `process.pid`.
1248
- *
1249
- * Colours (when enabled) follow the NestJS convention: the level token
1250
- * AND the message body share the level colour (green/yellow/red/gray for
1251
- * info/warn/error/debug). Brand, device context, scope and meta keep
1252
- * their fixed hues so the structural fields stay visually distinct from
1253
- * the message content.
1254
- */
1255
- declare function formatLogLine(entry: LogEntry, options?: FormatLogLineOptions): string;
1256
-
1257
- interface IStorageBackend {
1258
- /** Backend type identifier */
1259
- readonly type: string;
1260
- /** Base path of this backend */
1261
- readonly basePath: string;
1262
- /** Resolve a subpath to an absolute path */
1263
- resolve(subpath: string): string;
1264
- /**
1265
- * Check whether the backend is usable: either the base directory
1266
- * already exists and is writable, OR we can create it on first
1267
- * write (i.e. the nearest existing ancestor is writable).
1268
- */
1269
- isAvailable(): boolean;
1270
- /** No-op for lazy backends. Kept for API compatibility. */
1271
- initialize(): Promise<void>;
1272
- }
1273
- /**
1274
- * Filesystem storage backend — lazy by design.
1275
- *
1276
- * `initialize()` does NOT create the base directory eagerly. Instead,
1277
- * consumers that write via `FilesystemStorageProvider` (and other write
1278
- * helpers in storage-manager.ts) run `fs.mkdir(dirname(filePath), { recursive: true })`
1279
- * right before every `writeFile`, so the directory tree appears on demand.
1280
- *
1281
- * The previous behaviour eagerly mkdir'd every location declared in
1282
- * `StorageLocationManager.initializeDefaults()` — six directories (`db`,
1283
- * `media`, `recordings`, `models`, `cache`, `logs`) got created at boot
1284
- * even if the installation had no cameras, no recording addon, no
1285
- * analytics addon, etc. That meant every fresh install looked like it
1286
- * was producing data when it had nothing to write. Laziness fixes that:
1287
- * a directory only exists once an addon decides to put a file there.
1288
- */
1289
- declare class FsStorageBackend implements IStorageBackend {
1290
- readonly type = "local";
1291
- readonly basePath: string;
1292
- constructor(basePath: string);
1293
- resolve(subpath: string): string;
1294
- isAvailable(): boolean;
1295
- initialize(): Promise<void>;
1296
- }
1297
-
1298
- type StorageLocationName = 'data' | 'media' | 'recordings' | 'models' | 'cache' | 'logs';
1299
- declare class StorageLocationManager {
1300
- private readonly backends;
1301
- private readonly dataPath;
1302
- constructor(dataPath: string);
1303
- /** Initialize all locations with default paths */
1304
- initializeDefaults(): Promise<void>;
1305
- /** Override a specific location's backend path */
1306
- setLocationPath(name: StorageLocationName, basePath: string): Promise<void>;
1307
- /** Get the backend for a location */
1308
- getBackend(name: StorageLocationName): IStorageBackend;
1309
- /** Resolve a path within a location */
1310
- resolve(location: StorageLocationName, subpath: string): string;
1311
- /** Check if all locations are available */
1312
- getStatus(): Array<{
1313
- name: StorageLocationName;
1314
- available: boolean;
1315
- path: string;
1316
- }>;
1317
- /** All location names */
1318
- getLocationNames(): StorageLocationName[];
1319
- }
1320
-
1321
- interface IStorageProvider {
1322
- initialize(): Promise<void>;
1323
- shutdown(): Promise<void>;
1324
- getLocation(name: StorageLocationName): IStorageLocation;
1325
- export?(locationName: StorageLocationName): Promise<Buffer>;
1326
- import?(locationName: StorageLocationName, data: Buffer): Promise<void>;
1327
- }
1328
- interface QueryFilter {
1329
- where?: Record<string, unknown>;
1330
- whereIn?: Record<string, unknown[]>;
1331
- whereBetween?: Record<string, [unknown, unknown]>;
1332
- orderBy?: {
1333
- field: string;
1334
- direction: 'asc' | 'desc';
1335
- };
1336
- limit?: number;
1337
- offset?: number;
1338
- }
1339
- interface StorageRecord {
1340
- collection: string;
1341
- id: string;
1342
- data: Record<string, unknown>;
1343
- }
1344
- interface IStructuredStorage {
1345
- query(collection: string, filter?: QueryFilter): Promise<readonly StorageRecord[]>;
1346
- insert(record: StorageRecord): Promise<StorageRecord>;
1347
- update(collection: string, id: string, data: Record<string, unknown>): Promise<StorageRecord>;
1348
- delete(collection: string, id: string): Promise<void>;
1349
- count(collection: string, filter?: QueryFilter): Promise<number>;
1350
- }
1351
- interface IFileStorage {
1352
- readFile(path: string): Promise<Buffer>;
1353
- writeFile(path: string, data: Buffer): Promise<void>;
1354
- deleteFile(path: string): Promise<void>;
1355
- listFiles(prefix?: string): Promise<readonly string[]>;
1356
- getFileUrl(path: string): Promise<string>;
1357
- exists(path: string): Promise<boolean>;
1358
- }
1359
- interface IStorageLocation {
1360
- structured?: IStructuredStorage;
1361
- files?: IFileStorage;
1362
- }
1363
- /**
1364
- * StorageManager — bridge between legacy code (getLocation/getLocationPath)
1365
- * and the new capability-based storage system.
1366
- *
1367
- * Legacy consumers call getLocation('addon', namespace) to get structured + file storage.
1368
- * This manager builds the response from:
1369
- * - SettingsBackend (for structured queries) — provided by sqlite-settings addon
1370
- * - LocationManager (for file paths) — set during Phase 2 boot
1371
- */
1372
- declare class StorageManager {
1373
- private legacyProvider;
1374
- private locationManager;
1375
- private newStorageProvider;
1376
- private settingsBackend;
1377
- /** @deprecated Set by legacy capability consumer — use setNewStorageProvider instead */
1378
- setProvider(provider: IStorageProvider | IStorageProvider$1): void;
1379
- setNewStorageProvider(provider: IStorageProvider$1): void;
1380
- setSettingsBackend(backend: ISettingsBackend): void;
1381
- getSettingsBackend(): ISettingsBackend;
1382
- getProvider(): IStorageProvider;
1383
- setLocationManager(manager: StorageLocationManager): void;
1384
- getLocationManager(): StorageLocationManager;
1385
- initializeLocations(dataPath: string): Promise<void>;
1386
- getLocationPath(name: StorageLocationName): string;
1387
- /**
1388
- * Get a storage location with optional namespace scoping.
1389
- * Builds IStorageLocation from settingsBackend (structured) + locationManager (files).
1390
- */
1391
- getLocation(name: StorageLocationName | string, namespace?: string): IStorageLocation;
1392
- private createLegacyShim;
1393
- private createNamespacedLocation;
1394
- }
1395
-
1396
- /**
1397
- * Manages scoped API tokens with restricted addon/route/capability access.
1398
- */
1399
- declare class ScopedTokenManager {
1400
- private readonly store;
1401
- constructor(store: SettingsStoreClient);
1402
- create(userId: string, name: string, scopes: TokenScope[], expiresAt?: number): Promise<{
1403
- token: string;
1404
- record: ScopedToken;
1405
- }>;
1406
- validate(rawToken: string): Promise<ScopedToken | null>;
1407
- matchesScope(token: ScopedToken, addonId?: string, routePath?: string, capability?: string): boolean;
1408
- revoke(tokenId: string): Promise<void>;
1409
- listForUser(userId: string): Promise<ScopedToken[]>;
1410
- updateLastUsed(tokenId: string): Promise<void>;
1411
- }
1412
-
1413
- type AuthConfigReader = {
1414
- get<T>(path: string): T;
1415
- update(section: string, data: Record<string, unknown>): void;
1416
- };
1417
- declare class AuthManager {
1418
- private readonly config;
1419
- private readonly jwtSecret;
1420
- private scopedTokenManager;
1421
- private readonly logger;
1422
- constructor(config: AuthConfigReader, logger?: IScopedLogger);
1423
- signToken(payload: Omit<TokenPayload, 'iat' | 'exp'>): string;
1424
- verifyToken(token: string): TokenPayload;
1425
- hashPassword(password: string): Promise<string>;
1426
- comparePassword(password: string, hash: string): Promise<boolean>;
1427
- generateApiKey(): {
1428
- token: string;
1429
- hash: string;
1430
- prefix: string;
1431
- };
1432
- validateApiKey(token: string, storedHash: string): boolean;
1433
- /**
1434
- * Create a service token for agent/worker authentication.
1435
- * Used when forking workers or when agents register.
1436
- */
1437
- createServiceToken(opts: {
1438
- readonly agentId: string;
1439
- readonly role?: string;
1440
- readonly expiresIn?: string;
1441
- }): string;
1442
- /**
1443
- * Set the scoped token manager for the auth chain.
1444
- */
1445
- setScopedTokenManager(manager: ScopedTokenManager): void;
1446
- /**
1447
- * Validate a scoped token string.
1448
- * Returns the token record if valid, null otherwise.
1449
- */
1450
- validateScopedToken(rawToken: string): Promise<ScopedToken | null>;
1451
- /**
1452
- * Check whether a scoped token grants access to a given addon/route/capability.
1453
- */
1454
- matchesScopedTokenScope(token: ScopedToken, addonId?: string, routePath?: string, capability?: string): boolean;
1455
- }
1456
-
1457
- interface CreateApiKeyInput {
1458
- label: string;
1459
- role: UserRole;
1460
- allowedProviders?: string[] | '*';
1461
- allowedDevices?: Record<string, string[] | '*'>;
1462
- }
1463
- interface ApiKeyStorageAccess {
1464
- getStore(): SettingsStoreClient;
1465
- }
1466
- declare class ApiKeyManager {
1467
- private readonly storageAccess;
1468
- private readonly auth;
1469
- constructor(storageAccess: ApiKeyStorageAccess, auth: AuthManager);
1470
- private get store();
1471
- create(input: CreateApiKeyInput): Promise<{
1472
- record: ApiKeyRecord;
1473
- token: string;
1474
- }>;
1475
- validateToken(token: string): Promise<ApiKeyRecord | null>;
1476
- listAll(): Promise<Omit<ApiKeyRecord, 'tokenHash'>[]>;
1477
- revoke(id: string): Promise<void>;
1478
- findById(id: string): Promise<ApiKeyRecord | null>;
1479
- }
1480
-
1481
- interface CreateUserInput {
1482
- username: string;
1483
- password: string;
1484
- role: UserRole;
1485
- allowedProviders?: string[] | '*';
1486
- allowedDevices?: Record<string, string[] | '*'>;
1487
- }
1488
- type UpdatableUserFields = Partial<Pick<UserRecord, 'role' | 'allowedProviders' | 'allowedDevices'>>;
1489
- interface UserStorageAccess {
1490
- getStore(): SettingsStoreClient;
1491
- }
1492
- interface UserConfigReader {
1493
- get<T>(path: string): T;
1494
- }
1495
- declare class UserManager {
1496
- private readonly storageAccess;
1497
- private readonly auth;
1498
- private readonly config;
1499
- constructor(storageAccess: UserStorageAccess, auth: AuthManager, config: UserConfigReader);
1500
- private get store();
1501
- create(input: CreateUserInput): Promise<UserRecord>;
1502
- findByUsername(username: string): Promise<UserRecord | null>;
1503
- findById(id: string): Promise<UserRecord | null>;
1504
- validateCredentials(username: string, password: string): Promise<UserRecord | null>;
1505
- listAll(): Promise<Omit<UserRecord, 'passwordHash'>[]>;
1506
- update(id: string, data: UpdatableUserFields): Promise<void>;
1507
- delete(id: string): Promise<void>;
1508
- resetPassword(id: string, newPassword: string): Promise<void>;
1509
- ensureAdminExists(): Promise<void>;
1510
- }
1511
-
1512
- /**
1513
- * Central notification service that routes notifications to configured outputs.
1514
- * Framework-agnostic — dependencies injected via constructor.
1515
- *
1516
- * Outputs are resolved from the ICapabilityRegistry's 'notification-output'
1517
- * collection on each call (proxy pattern). Falls back to a local map
1518
- * when no registry is provided (backward compat).
1519
- */
1520
- declare class NotificationService {
1521
- private readonly logger;
1522
- private readonly localOutputs;
1523
- private readonly routing;
1524
- private readonly rateLimits;
1525
- private readonly lastSent;
1526
- private registry;
1527
- constructor(logger: IScopedLogger);
1528
- /** Set the registry for live output lookup. Called once during boot. */
1529
- setRegistry(registry: ICapabilityRegistry): void;
1530
- /** Resolve all outputs — prefers registry, falls back to local map */
1531
- private get outputs();
1532
- /** Register an output in the local fallback map (used when no registry is set). */
1533
- registerLocalOutput(output: INotificationOutput): void;
1534
- /** Remove an output from the local fallback map. */
1535
- unregisterLocalOutput(id: string): void;
1536
- setRouting(category: string, outputIds: string[]): void;
1537
- setRateLimit(category: string, minIntervalMs: number): void;
1538
- notify(notification: Notification): Promise<void>;
1539
- getOutputs(): ReadonlyArray<{
1540
- id: string;
1541
- name: string;
1542
- icon: string;
1543
- }>;
1544
- getRouting(): ReadonlyMap<string, string[]>;
1545
- getOutput(id: string): INotificationOutput | undefined;
1546
- }
1547
-
1548
- type Unsubscribe = () => void;
1549
- /**
1550
- * Service for broadcasting toast notifications to connected UI clients.
1551
- * Framework-agnostic — integrates with tRPC subscriptions via subscribe().
1552
- */
1553
- declare class ToastService {
1554
- private readonly listeners;
1555
- /**
1556
- * Subscribe to toast events for a specific user.
1557
- * Returns an unsubscribe function.
1558
- */
1559
- subscribe(connectionId: string, userId: string, callback: (toast: Toast) => void): Unsubscribe;
1560
- /**
1561
- * Broadcast a toast to all connected clients.
1562
- */
1563
- broadcast(toast: Toast): void;
1564
- /**
1565
- * Send a toast to a specific user's connections only.
1566
- */
1567
- sendToUser(userId: string, toast: Toast): void;
1568
- }
1569
-
1570
- interface RouteMatch {
1571
- readonly route: IAddonHttpRoute;
1572
- readonly addonId: string;
1573
- readonly params: Record<string, string>;
1574
- }
1575
- /**
1576
- * Registry for dynamic HTTP routes registered by addons.
1577
- * Framework-agnostic — the server HTTP layer queries this registry to dispatch requests.
1578
- */
1579
- declare class AddonRouteRegistry {
1580
- private readonly routes;
1581
- /**
1582
- * Register all routes from an addon's route provider.
1583
- */
1584
- registerRoutes(addonId: string, provider: IAddonRouteProvider): void;
1585
- /**
1586
- * Unregister all routes for an addon.
1587
- */
1588
- unregisterRoutes(addonId: string): void;
1589
- /**
1590
- * Match an incoming request method + path to a registered route.
1591
- * Supports simple path parameters (e.g., /items/:id).
1592
- */
1593
- matchRoute(method: string, path: string): RouteMatch | null;
1594
- /**
1595
- * List all registered routes across all addons.
1596
- */
1597
- listRoutes(): ReadonlyArray<{
1598
- addonId: string;
1599
- method: string;
1600
- path: string;
1601
- access: string;
1602
- description?: string;
1603
- }>;
1604
- }
1605
-
1606
- interface TlsCertPair {
1607
- readonly cert: Buffer;
1608
- readonly key: Buffer;
1609
- }
1610
- interface EnsureTlsResult {
1611
- readonly certPath: string;
1612
- readonly keyPath: string;
1613
- readonly generated: boolean;
1614
- }
1615
- interface CertOptions {
1616
- /** Common Name for the cert (default: 'camstack.local') */
1617
- readonly commonName?: string;
1618
- /** Validity in days (default: 825 — max for browsers) */
1619
- readonly validDays?: number;
1620
- /** Additional SANs (DNS names or IPs) */
1621
- readonly extraSans?: readonly string[];
1622
- }
1623
- /**
1624
- * Ensure a self-signed TLS certificate exists in the given directory.
1625
- * Generates one if missing. Returns paths to cert and key files.
1626
- */
1627
- declare function ensureTlsCert(dataDir: string, options?: CertOptions): Promise<EnsureTlsResult>;
1628
- /**
1629
- * Load TLS cert+key from files. Returns Buffers suitable for Node.js TLS options.
1630
- */
1631
- declare function loadTlsCert(certPath: string, keyPath: string): TlsCertPair;
1632
-
1633
- /**
1634
- * Factory for creating tRPC clients for addons.
1635
- *
1636
- * In-process only: `createDirectCaller()` uses tRPC's `createCallerFactory`
1637
- * to call procedures directly (zero network overhead) and wraps the raw
1638
- * caller in a proxy so it matches `CreateTRPCClient<AppRouter>` shape —
1639
- * addons use `context.api.namespace.method.query(input)` identically to
1640
- * the cross-process path.
1641
- *
1642
- * Cross-process calls (forked workers, remote agents) ride the Moleculer
1643
- * broker via `brokerTransportLink` in the kernel — not this factory.
1644
- */
1645
- interface DirectCallerOptions {
1646
- /** The tRPC router instance (from buildAppRouter) */
1647
- readonly router: unknown;
1648
- /** Context for the caller (user identity, etc.) */
1649
- readonly context: {
1650
- readonly user: {
1651
- readonly id: string;
1652
- readonly username: string;
1653
- readonly role: string;
1654
- };
1655
- };
1656
- }
1657
- declare class AddonApiFactory {
1658
- /**
1659
- * Create a direct caller -- calls tRPC procedures directly in-process.
1660
- * Zero network overhead. Used for in-process addons and dev mode.
1661
- *
1662
- * Returns `AddonApi` — the same tRPC client surface that broker-routed
1663
- * callers get. Callers treat it uniformly as `context.api` regardless
1664
- * of the underlying transport.
1665
- */
1666
- createDirectCaller(options: DirectCallerOptions): Promise<_camstack_types.AddonApi>;
1667
- }
1668
-
1669
- declare class IntegrationRegistry implements IIntegrationRegistry {
1670
- private readonly backend;
1671
- constructor(backend: ISettingsBackend);
1672
- initialize(): Promise<void>;
1673
- createIntegration(input: CreateIntegrationInput): Promise<Integration>;
1674
- getIntegration(id: string): Promise<Integration | null>;
1675
- getIntegrationByAddonId(addonId: string): Promise<Integration | null>;
1676
- listIntegrations(): Promise<readonly Integration[]>;
1677
- updateIntegration(id: string, updates: Partial<Pick<Integration, 'name' | 'enabled' | 'info'>>): Promise<Integration | null>;
1678
- deleteIntegration(id: string): Promise<boolean>;
1679
- getIntegrationSettings(integrationId: string): Promise<Record<string, unknown>>;
1680
- setIntegrationSetting(integrationId: string, key: string, value: unknown): Promise<void>;
1681
- setIntegrationSettings(integrationId: string, settings: Record<string, unknown>): Promise<void>;
1682
- createDevice(input: CreateDeviceInput): Promise<PersistedDevice>;
1683
- getDevice(id: string): Promise<PersistedDevice | null>;
1684
- getDeviceByStableId(stableId: string): Promise<PersistedDevice | null>;
1685
- listDevices(integrationId?: string): Promise<readonly PersistedDevice[]>;
1686
- listCameras(): Promise<readonly PersistedDevice[]>;
1687
- updateDevice(id: string, updates: Partial<Pick<PersistedDevice, 'name' | 'enabled' | 'info'>>): Promise<PersistedDevice | null>;
1688
- deleteDevice(id: string): Promise<boolean>;
1689
- getDeviceSettings(deviceId: string): Promise<Record<string, unknown>>;
1690
- setDeviceSetting(deviceId: string, key: string, value: unknown): Promise<void>;
1691
- setDeviceSettings(deviceId: string, settings: Record<string, unknown>): Promise<void>;
1692
- private mapIntegration;
1693
- private mapDevice;
1694
- }
1695
-
1696
- export { AddonApiFactory, AddonRouteRegistry, type AddonTableSchema, AlertCenterAddon, ApiKeyManager, type ApiKeyStorageAccess, type AuthConfigReader, AuthManager, type BackupConfig, CORE_TABLE_DDL, type CertOptions, ConfigStore, ConsoleDestination, ConsoleLoggingAddon, DeviceManagerAddon, type DeviceRow, DeviceStore, type DirectCallerOptions, type DownloadProgressCallback, type ElementState, type ElementStatus, EngineManagerResolver, type EnsureTlsResult, EventBus, type FeatureConfigReader, FeatureManager, FilesystemStorageAddon, FsStorageBackend, HubForwarderAddon, HubForwarderDestination, type IStorageProvider as ICoreStorageProvider, type IFileStorage, type ILogDestination, type IReplContextProvider, type IReplEngine, type IStorageBackend, type IStorageLocation, type IStructuredStorage, IntegrationRegistry, LifecycleStateMachine, LocalAuthAddon, LocalBackupAddon, LocalBackupService, LogManager, LogRingBuffer, ModelDownloadService, NativeMetricsAddon, NativeMetricsProvider, NetworkQualityTracker, NotificationService, type PidStats, PipelineRunner, PipelineValidator, PythonEnvManager, type QueryFilter, ReplEngine, type ReplScope, type ReplSessionContext, ScopedLogger, ScopedTokenManager, SettingsStore, SqliteSettingsAddon, SqliteSettingsBackend, StorageLocationManager, type StorageLocationName, StorageManager, type StorageRecord, SystemConfigAddon, SystemEventBus, type TlsCertPair, ToastService, type Unsubscribe, type UserConfigReader, UserManager, type UserStorageAccess, WinstonDestination, WinstonLoggingAddon, addonTableToDdl, deleteModelFromDisk, downloadFile, downloadModel, ensureModel, ensureTlsCert, fetchJson, formatLogLine, getModelFilePath, getPidStats, getSinglePidStats, isModelDownloaded, loadTlsCert };