@camstack/types 0.1.14 → 0.1.16

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 (467) hide show
  1. package/dist/addon/base-addon.d.ts +262 -0
  2. package/dist/addon/base-addon.d.ts.map +1 -0
  3. package/dist/auth-records-BDg37fy9.mjs +8297 -0
  4. package/dist/auth-records-BDg37fy9.mjs.map +1 -0
  5. package/dist/auth-records-D5ZNaUos.js +8296 -0
  6. package/dist/auth-records-D5ZNaUos.js.map +1 -0
  7. package/dist/capabilities/accessories.cap.d.ts +42 -0
  8. package/dist/capabilities/accessories.cap.d.ts.map +1 -0
  9. package/dist/capabilities/addon-pages-source.cap.d.ts +41 -0
  10. package/dist/capabilities/addon-pages-source.cap.d.ts.map +1 -0
  11. package/dist/capabilities/addon-pages.cap.d.ts +36 -0
  12. package/dist/capabilities/addon-pages.cap.d.ts.map +1 -0
  13. package/dist/capabilities/addon-routes.cap.d.ts +22 -0
  14. package/dist/capabilities/addon-routes.cap.d.ts.map +1 -0
  15. package/dist/capabilities/addon-settings.cap.d.ts +170 -0
  16. package/dist/capabilities/addon-settings.cap.d.ts.map +1 -0
  17. package/dist/capabilities/addon-widgets-source.cap.d.ts +103 -0
  18. package/dist/capabilities/addon-widgets-source.cap.d.ts.map +1 -0
  19. package/dist/capabilities/addon-widgets.cap.d.ts +98 -0
  20. package/dist/capabilities/addon-widgets.cap.d.ts.map +1 -0
  21. package/dist/capabilities/addons.cap.d.ts +356 -0
  22. package/dist/capabilities/addons.cap.d.ts.map +1 -0
  23. package/dist/capabilities/admin-ui.cap.d.ts +14 -0
  24. package/dist/capabilities/admin-ui.cap.d.ts.map +1 -0
  25. package/dist/capabilities/advanced-notifier.cap.d.ts +60 -0
  26. package/dist/capabilities/advanced-notifier.cap.d.ts.map +1 -0
  27. package/dist/capabilities/alerts.cap.d.ts +164 -0
  28. package/dist/capabilities/alerts.cap.d.ts.map +1 -0
  29. package/dist/capabilities/audio-analysis.cap.d.ts +46 -0
  30. package/dist/capabilities/audio-analysis.cap.d.ts.map +1 -0
  31. package/dist/capabilities/audio-analyzer.cap.d.ts +148 -0
  32. package/dist/capabilities/audio-analyzer.cap.d.ts.map +1 -0
  33. package/dist/capabilities/audio-codec.cap.d.ts +202 -0
  34. package/dist/capabilities/audio-codec.cap.d.ts.map +1 -0
  35. package/dist/capabilities/audio-metrics.cap.d.ts +174 -0
  36. package/dist/capabilities/audio-metrics.cap.d.ts.map +1 -0
  37. package/dist/capabilities/auth-provider.cap.d.ts +49 -0
  38. package/dist/capabilities/auth-provider.cap.d.ts.map +1 -0
  39. package/dist/capabilities/authentication.cap.d.ts +83 -0
  40. package/dist/capabilities/authentication.cap.d.ts.map +1 -0
  41. package/dist/capabilities/backup.cap.d.ts +269 -0
  42. package/dist/capabilities/backup.cap.d.ts.map +1 -0
  43. package/dist/capabilities/battery.cap.d.ts +85 -0
  44. package/dist/capabilities/battery.cap.d.ts.map +1 -0
  45. package/dist/capabilities/brightness.cap.d.ts +64 -0
  46. package/dist/capabilities/brightness.cap.d.ts.map +1 -0
  47. package/dist/capabilities/camera-credentials.cap.d.ts +102 -0
  48. package/dist/capabilities/camera-credentials.cap.d.ts.map +1 -0
  49. package/dist/capabilities/camera-streams.cap.d.ts +214 -0
  50. package/dist/capabilities/camera-streams.cap.d.ts.map +1 -0
  51. package/dist/capabilities/capability-definition.d.ts +474 -0
  52. package/dist/capabilities/capability-definition.d.ts.map +1 -0
  53. package/dist/capabilities/custom-actions.d.ts +47 -0
  54. package/dist/capabilities/custom-actions.d.ts.map +1 -0
  55. package/dist/capabilities/decoder.cap.d.ts +173 -0
  56. package/dist/capabilities/decoder.cap.d.ts.map +1 -0
  57. package/dist/capabilities/detection-pipeline.cap.d.ts +34 -0
  58. package/dist/capabilities/detection-pipeline.cap.d.ts.map +1 -0
  59. package/dist/capabilities/device-discovery.cap.d.ts +247 -0
  60. package/dist/capabilities/device-discovery.cap.d.ts.map +1 -0
  61. package/dist/capabilities/device-manager.cap.d.ts +709 -0
  62. package/dist/capabilities/device-manager.cap.d.ts.map +1 -0
  63. package/dist/capabilities/device-ops.cap.d.ts +87 -0
  64. package/dist/capabilities/device-ops.cap.d.ts.map +1 -0
  65. package/dist/capabilities/device-provider.cap.d.ts +151 -0
  66. package/dist/capabilities/device-provider.cap.d.ts.map +1 -0
  67. package/dist/capabilities/device-state.cap.d.ts +97 -0
  68. package/dist/capabilities/device-state.cap.d.ts.map +1 -0
  69. package/dist/capabilities/device-status.cap.d.ts +54 -0
  70. package/dist/capabilities/device-status.cap.d.ts.map +1 -0
  71. package/dist/capabilities/doorbell.cap.d.ts +62 -0
  72. package/dist/capabilities/doorbell.cap.d.ts.map +1 -0
  73. package/dist/capabilities/embedding-encoder.cap.d.ts +41 -0
  74. package/dist/capabilities/embedding-encoder.cap.d.ts.map +1 -0
  75. package/dist/capabilities/events.cap.d.ts +48 -0
  76. package/dist/capabilities/events.cap.d.ts.map +1 -0
  77. package/dist/capabilities/feature-probe.cap.d.ts +79 -0
  78. package/dist/capabilities/feature-probe.cap.d.ts.map +1 -0
  79. package/dist/capabilities/index.d.ts +191 -0
  80. package/dist/capabilities/index.d.ts.map +1 -0
  81. package/dist/capabilities/integrations.cap.d.ts +182 -0
  82. package/dist/capabilities/integrations.cap.d.ts.map +1 -0
  83. package/dist/capabilities/intercom.cap.d.ts +108 -0
  84. package/dist/capabilities/intercom.cap.d.ts.map +1 -0
  85. package/dist/capabilities/local-network.cap.d.ts +216 -0
  86. package/dist/capabilities/local-network.cap.d.ts.map +1 -0
  87. package/dist/capabilities/log-destination.cap.d.ts +70 -0
  88. package/dist/capabilities/log-destination.cap.d.ts.map +1 -0
  89. package/dist/capabilities/mesh-network.cap.d.ts +160 -0
  90. package/dist/capabilities/mesh-network.cap.d.ts.map +1 -0
  91. package/dist/capabilities/mesh-orchestrator.cap.d.ts +96 -0
  92. package/dist/capabilities/mesh-orchestrator.cap.d.ts.map +1 -0
  93. package/dist/capabilities/metrics-provider.cap.d.ts +522 -0
  94. package/dist/capabilities/metrics-provider.cap.d.ts.map +1 -0
  95. package/dist/capabilities/motion-detection.cap.d.ts +107 -0
  96. package/dist/capabilities/motion-detection.cap.d.ts.map +1 -0
  97. package/dist/capabilities/motion-trigger.cap.d.ts +78 -0
  98. package/dist/capabilities/motion-trigger.cap.d.ts.map +1 -0
  99. package/dist/capabilities/motion.cap.d.ts +122 -0
  100. package/dist/capabilities/motion.cap.d.ts.map +1 -0
  101. package/dist/capabilities/native-object-detection.cap.d.ts +127 -0
  102. package/dist/capabilities/native-object-detection.cap.d.ts.map +1 -0
  103. package/dist/capabilities/network-access.cap.d.ts +67 -0
  104. package/dist/capabilities/network-access.cap.d.ts.map +1 -0
  105. package/dist/capabilities/network-quality.cap.d.ts +95 -0
  106. package/dist/capabilities/network-quality.cap.d.ts.map +1 -0
  107. package/dist/capabilities/nodes.cap.d.ts +200 -0
  108. package/dist/capabilities/nodes.cap.d.ts.map +1 -0
  109. package/dist/capabilities/notification-output.cap.d.ts +44 -0
  110. package/dist/capabilities/notification-output.cap.d.ts.map +1 -0
  111. package/dist/capabilities/osd.cap.d.ts +236 -0
  112. package/dist/capabilities/osd.cap.d.ts.map +1 -0
  113. package/dist/capabilities/pipeline-analytics.cap.d.ts +501 -0
  114. package/dist/capabilities/pipeline-analytics.cap.d.ts.map +1 -0
  115. package/dist/capabilities/pipeline-executor.cap.d.ts +922 -0
  116. package/dist/capabilities/pipeline-executor.cap.d.ts.map +1 -0
  117. package/dist/capabilities/pipeline-orchestrator.cap.d.ts +793 -0
  118. package/dist/capabilities/pipeline-orchestrator.cap.d.ts.map +1 -0
  119. package/dist/capabilities/pipeline-runner.cap.d.ts +393 -0
  120. package/dist/capabilities/pipeline-runner.cap.d.ts.map +1 -0
  121. package/dist/capabilities/platform-probe.cap.d.ts +168 -0
  122. package/dist/capabilities/platform-probe.cap.d.ts.map +1 -0
  123. package/dist/capabilities/ptz-autotrack.cap.d.ts +188 -0
  124. package/dist/capabilities/ptz-autotrack.cap.d.ts.map +1 -0
  125. package/dist/capabilities/ptz.cap.d.ts +80 -0
  126. package/dist/capabilities/ptz.cap.d.ts.map +1 -0
  127. package/dist/capabilities/reboot.cap.d.ts +32 -0
  128. package/dist/capabilities/reboot.cap.d.ts.map +1 -0
  129. package/dist/capabilities/recording-engine.cap.d.ts +477 -0
  130. package/dist/capabilities/recording-engine.cap.d.ts.map +1 -0
  131. package/dist/capabilities/recording.cap.d.ts +43 -0
  132. package/dist/capabilities/recording.cap.d.ts.map +1 -0
  133. package/dist/capabilities/remote-access.cap.d.ts +103 -0
  134. package/dist/capabilities/remote-access.cap.d.ts.map +1 -0
  135. package/dist/capabilities/restreamer.cap.d.ts +51 -0
  136. package/dist/capabilities/restreamer.cap.d.ts.map +1 -0
  137. package/dist/capabilities/schemas/detection-shared.d.ts +63 -0
  138. package/dist/capabilities/schemas/detection-shared.d.ts.map +1 -0
  139. package/dist/capabilities/schemas/orchestrator-metrics.d.ts +44 -0
  140. package/dist/capabilities/schemas/orchestrator-metrics.d.ts.map +1 -0
  141. package/dist/capabilities/schemas/streaming-shared.d.ts +177 -0
  142. package/dist/capabilities/schemas/streaming-shared.d.ts.map +1 -0
  143. package/dist/capabilities/schemas/zone-rule.d.ts +74 -0
  144. package/dist/capabilities/schemas/zone-rule.d.ts.map +1 -0
  145. package/dist/capabilities/settings-store.cap.d.ts +198 -0
  146. package/dist/capabilities/settings-store.cap.d.ts.map +1 -0
  147. package/dist/capabilities/snapshot-provider.cap.d.ts +40 -0
  148. package/dist/capabilities/snapshot-provider.cap.d.ts.map +1 -0
  149. package/dist/capabilities/snapshot.cap.d.ts +78 -0
  150. package/dist/capabilities/snapshot.cap.d.ts.map +1 -0
  151. package/dist/capabilities/storage-provider.cap.d.ts +432 -0
  152. package/dist/capabilities/storage-provider.cap.d.ts.map +1 -0
  153. package/dist/capabilities/storage.cap.d.ts +367 -0
  154. package/dist/capabilities/storage.cap.d.ts.map +1 -0
  155. package/dist/capabilities/stream-broker.cap.d.ts +416 -0
  156. package/dist/capabilities/stream-broker.cap.d.ts.map +1 -0
  157. package/dist/capabilities/streaming-engine.cap.d.ts +58 -0
  158. package/dist/capabilities/streaming-engine.cap.d.ts.map +1 -0
  159. package/dist/capabilities/switch.cap.d.ts +66 -0
  160. package/dist/capabilities/switch.cap.d.ts.map +1 -0
  161. package/dist/capabilities/system.cap.d.ts +86 -0
  162. package/dist/capabilities/system.cap.d.ts.map +1 -0
  163. package/dist/capabilities/toast.cap.d.ts +56 -0
  164. package/dist/capabilities/toast.cap.d.ts.map +1 -0
  165. package/dist/capabilities/turn-orchestrator.cap.d.ts +74 -0
  166. package/dist/capabilities/turn-orchestrator.cap.d.ts.map +1 -0
  167. package/dist/capabilities/turn-provider.cap.d.ts +43 -0
  168. package/dist/capabilities/turn-provider.cap.d.ts.map +1 -0
  169. package/dist/capabilities/user-management.cap.d.ts +378 -0
  170. package/dist/capabilities/user-management.cap.d.ts.map +1 -0
  171. package/dist/capabilities/webrtc-session.cap.d.ts +181 -0
  172. package/dist/capabilities/webrtc-session.cap.d.ts.map +1 -0
  173. package/dist/capabilities/webrtc.cap.d.ts +72 -0
  174. package/dist/capabilities/webrtc.cap.d.ts.map +1 -0
  175. package/dist/capabilities/zone-analytics.cap.d.ts +213 -0
  176. package/dist/capabilities/zone-analytics.cap.d.ts.map +1 -0
  177. package/dist/capabilities/zone-rules.cap.d.ts +129 -0
  178. package/dist/capabilities/zone-rules.cap.d.ts.map +1 -0
  179. package/dist/capabilities/zones.cap.d.ts +151 -0
  180. package/dist/capabilities/zones.cap.d.ts.map +1 -0
  181. package/dist/catalogs/audio-classmap.d.ts +16 -0
  182. package/dist/catalogs/audio-classmap.d.ts.map +1 -0
  183. package/dist/catalogs/coco-classmap.d.ts.map +1 -1
  184. package/dist/constants.d.ts +50 -0
  185. package/dist/constants.d.ts.map +1 -1
  186. package/dist/deps/binary-downloader.d.ts +41 -0
  187. package/dist/deps/binary-downloader.d.ts.map +1 -0
  188. package/dist/deps/ffmpeg-downloader.d.ts +13 -0
  189. package/dist/deps/ffmpeg-downloader.d.ts.map +1 -0
  190. package/dist/deps/index.d.ts +4 -0
  191. package/dist/deps/index.d.ts.map +1 -0
  192. package/dist/deps/python-downloader.d.ts +34 -0
  193. package/dist/deps/python-downloader.d.ts.map +1 -0
  194. package/dist/device/accessory.d.ts +62 -0
  195. package/dist/device/accessory.d.ts.map +1 -0
  196. package/dist/device/base-device-provider.d.ts +178 -0
  197. package/dist/device/base-device-provider.d.ts.map +1 -0
  198. package/dist/device/base-device.d.ts +287 -0
  199. package/dist/device/base-device.d.ts.map +1 -0
  200. package/dist/device/camera-device.d.ts +49 -0
  201. package/dist/device/camera-device.d.ts.map +1 -0
  202. package/dist/device/device-binding.d.ts +23 -0
  203. package/dist/device/device-binding.d.ts.map +1 -0
  204. package/dist/device/device-config.d.ts +65 -0
  205. package/dist/device/device-config.d.ts.map +1 -0
  206. package/dist/device/device-context.d.ts +256 -0
  207. package/dist/device/device-context.d.ts.map +1 -0
  208. package/dist/device/device-management.d.ts +118 -0
  209. package/dist/device/device-management.d.ts.map +1 -0
  210. package/dist/device/device-profile.d.ts +161 -0
  211. package/dist/device/device-profile.d.ts.map +1 -0
  212. package/dist/device/device-runtime-state.d.ts +124 -0
  213. package/dist/device/device-runtime-state.d.ts.map +1 -0
  214. package/dist/device/device-state-handle.d.ts +161 -0
  215. package/dist/device/device-state-handle.d.ts.map +1 -0
  216. package/dist/device/device-type.d.ts +68 -0
  217. package/dist/device/device-type.d.ts.map +1 -0
  218. package/dist/device/device.d.ts +87 -0
  219. package/dist/device/device.d.ts.map +1 -0
  220. package/dist/device/features.d.ts +29 -0
  221. package/dist/device/features.d.ts.map +1 -0
  222. package/dist/device/index.d.ts +20 -0
  223. package/dist/device/index.d.ts.map +1 -0
  224. package/dist/device/runtime-state-helpers.d.ts +69 -0
  225. package/dist/device/runtime-state-helpers.d.ts.map +1 -0
  226. package/dist/device/system-mirror.d.ts +318 -0
  227. package/dist/device/system-mirror.d.ts.map +1 -0
  228. package/dist/device/zod-to-config-ui.d.ts +23 -0
  229. package/dist/device/zod-to-config-ui.d.ts.map +1 -0
  230. package/dist/disposer-chain.d.ts +32 -0
  231. package/dist/disposer-chain.d.ts.map +1 -0
  232. package/dist/enums/event-category.d.ts +361 -0
  233. package/dist/enums/event-category.d.ts.map +1 -0
  234. package/dist/enums/event-source-type.d.ts +8 -0
  235. package/dist/enums/event-source-type.d.ts.map +1 -0
  236. package/dist/enums/index.d.ts +3 -0
  237. package/dist/enums/index.d.ts.map +1 -0
  238. package/dist/generated/addon-api.d.ts +14604 -3217
  239. package/dist/generated/addon-api.d.ts.map +1 -1
  240. package/dist/generated/cap-status-types.d.ts +51 -0
  241. package/dist/generated/cap-status-types.d.ts.map +1 -0
  242. package/dist/generated/capability-router-map.d.ts +278 -0
  243. package/dist/generated/capability-router-map.d.ts.map +1 -0
  244. package/dist/generated/device-local-state.d.ts +82 -0
  245. package/dist/generated/device-local-state.d.ts.map +1 -0
  246. package/dist/generated/device-proxy.d.ts +146 -0
  247. package/dist/generated/device-proxy.d.ts.map +1 -0
  248. package/dist/generated/system-proxy.d.ts +92 -0
  249. package/dist/generated/system-proxy.d.ts.map +1 -0
  250. package/dist/helpers/bind-addon-actions.d.ts +19 -0
  251. package/dist/helpers/bind-addon-actions.d.ts.map +1 -0
  252. package/dist/index.d.ts +91 -22
  253. package/dist/index.d.ts.map +1 -1
  254. package/dist/index.js +4843 -477
  255. package/dist/index.js.map +1 -1
  256. package/dist/index.mjs +4832 -415
  257. package/dist/index.mjs.map +1 -1
  258. package/dist/interfaces/addon.d.ts +760 -132
  259. package/dist/interfaces/addon.d.ts.map +1 -1
  260. package/dist/interfaces/advanced-notifier.d.ts +3 -2
  261. package/dist/interfaces/advanced-notifier.d.ts.map +1 -1
  262. package/dist/interfaces/agent-protocol.d.ts +17 -173
  263. package/dist/interfaces/agent-protocol.d.ts.map +1 -1
  264. package/dist/interfaces/agent.d.ts +61 -0
  265. package/dist/interfaces/agent.d.ts.map +1 -1
  266. package/dist/interfaces/alerts.d.ts +14 -0
  267. package/dist/interfaces/alerts.d.ts.map +1 -0
  268. package/dist/interfaces/analysis-persistence.d.ts +37 -19
  269. package/dist/interfaces/analysis-persistence.d.ts.map +1 -1
  270. package/dist/interfaces/analysis.d.ts +33 -4
  271. package/dist/interfaces/analysis.d.ts.map +1 -1
  272. package/dist/interfaces/api-responses.d.ts +124 -0
  273. package/dist/interfaces/api-responses.d.ts.map +1 -0
  274. package/dist/interfaces/api-shared.d.ts +5 -79
  275. package/dist/interfaces/api-shared.d.ts.map +1 -1
  276. package/dist/interfaces/audio-analyzer.d.ts +49 -0
  277. package/dist/interfaces/audio-analyzer.d.ts.map +1 -0
  278. package/dist/interfaces/audio-codec.d.ts +123 -0
  279. package/dist/interfaces/audio-codec.d.ts.map +1 -0
  280. package/dist/interfaces/audio-inference-engine.d.ts +19 -0
  281. package/dist/interfaces/audio-inference-engine.d.ts.map +1 -0
  282. package/dist/interfaces/auth-provider.d.ts.map +1 -1
  283. package/dist/interfaces/auth.d.ts +4 -25
  284. package/dist/interfaces/auth.d.ts.map +1 -1
  285. package/dist/interfaces/camera-pipeline.d.ts +7 -20
  286. package/dist/interfaces/camera-pipeline.d.ts.map +1 -1
  287. package/dist/interfaces/capability.d.ts +171 -24
  288. package/dist/interfaces/capability.d.ts.map +1 -1
  289. package/dist/interfaces/config-ui.d.ts +746 -24
  290. package/dist/interfaces/config-ui.d.ts.map +1 -1
  291. package/dist/interfaces/context.d.ts +9 -4
  292. package/dist/interfaces/context.d.ts.map +1 -1
  293. package/dist/interfaces/decoder.d.ts +38 -3
  294. package/dist/interfaces/decoder.d.ts.map +1 -1
  295. package/dist/interfaces/detection-addon.d.ts +6 -6
  296. package/dist/interfaces/detection-addon.d.ts.map +1 -1
  297. package/dist/interfaces/device-capabilities/camera.d.ts +95 -18
  298. package/dist/interfaces/device-capabilities/camera.d.ts.map +1 -1
  299. package/dist/interfaces/device-capabilities/index.d.ts +0 -13
  300. package/dist/interfaces/device-capabilities/index.d.ts.map +1 -1
  301. package/dist/interfaces/device-provider.d.ts +18 -16
  302. package/dist/interfaces/device-provider.d.ts.map +1 -1
  303. package/dist/interfaces/device.d.ts +4 -21
  304. package/dist/interfaces/device.d.ts.map +1 -1
  305. package/dist/interfaces/embedding-encoder.d.ts +19 -0
  306. package/dist/interfaces/embedding-encoder.d.ts.map +1 -0
  307. package/dist/interfaces/engine-slots.d.ts +10 -0
  308. package/dist/interfaces/engine-slots.d.ts.map +1 -0
  309. package/dist/interfaces/event-bus.d.ts +710 -26
  310. package/dist/interfaces/event-bus.d.ts.map +1 -1
  311. package/dist/interfaces/inference-capabilities.d.ts +0 -17
  312. package/dist/interfaces/inference-capabilities.d.ts.map +1 -1
  313. package/dist/interfaces/inference-engine.d.ts +30 -10
  314. package/dist/interfaces/inference-engine.d.ts.map +1 -1
  315. package/dist/interfaces/integration-registry.d.ts +20 -20
  316. package/dist/interfaces/integration-registry.d.ts.map +1 -1
  317. package/dist/interfaces/kernel-abstractions.d.ts +83 -0
  318. package/dist/interfaces/kernel-abstractions.d.ts.map +1 -0
  319. package/dist/interfaces/logging.d.ts +89 -8
  320. package/dist/interfaces/logging.d.ts.map +1 -1
  321. package/dist/interfaces/metrics-provider.d.ts +17 -0
  322. package/dist/interfaces/metrics-provider.d.ts.map +1 -0
  323. package/dist/interfaces/network-quality.d.ts +4 -4
  324. package/dist/interfaces/network.d.ts +0 -16
  325. package/dist/interfaces/network.d.ts.map +1 -1
  326. package/dist/interfaces/notification.d.ts +1 -1
  327. package/dist/interfaces/pipeline-executor-capability.d.ts +200 -0
  328. package/dist/interfaces/pipeline-executor-capability.d.ts.map +1 -0
  329. package/dist/interfaces/pipeline-orchestrator-capability.d.ts +165 -0
  330. package/dist/interfaces/pipeline-orchestrator-capability.d.ts.map +1 -0
  331. package/dist/interfaces/pipeline-runner-capability.d.ts +147 -0
  332. package/dist/interfaces/pipeline-runner-capability.d.ts.map +1 -0
  333. package/dist/interfaces/pipeline-runner.d.ts +18 -2
  334. package/dist/interfaces/pipeline-runner.d.ts.map +1 -1
  335. package/dist/interfaces/platform.d.ts +1 -1
  336. package/dist/interfaces/platform.d.ts.map +1 -1
  337. package/dist/interfaces/queryable.d.ts +26 -0
  338. package/dist/interfaces/queryable.d.ts.map +1 -0
  339. package/dist/interfaces/raw-tensor-engine.d.ts +16 -0
  340. package/dist/interfaces/raw-tensor-engine.d.ts.map +1 -0
  341. package/dist/interfaces/readiness.d.ts +101 -0
  342. package/dist/interfaces/readiness.d.ts.map +1 -0
  343. package/dist/interfaces/repl.d.ts +1 -1
  344. package/dist/interfaces/restreamer.d.ts +3 -3
  345. package/dist/interfaces/scoped-token.d.ts +1 -21
  346. package/dist/interfaces/scoped-token.d.ts.map +1 -1
  347. package/dist/interfaces/server-analysis.d.ts +30 -87
  348. package/dist/interfaces/server-analysis.d.ts.map +1 -1
  349. package/dist/interfaces/storage-location.d.ts +120 -0
  350. package/dist/interfaces/storage-location.d.ts.map +1 -0
  351. package/dist/interfaces/storage.d.ts +124 -50
  352. package/dist/interfaces/storage.d.ts.map +1 -1
  353. package/dist/interfaces/stream-broker.d.ts +285 -17
  354. package/dist/interfaces/stream-broker.d.ts.map +1 -1
  355. package/dist/interfaces/webrtc-provider.d.ts +24 -0
  356. package/dist/interfaces/webrtc-provider.d.ts.map +1 -1
  357. package/dist/node.d.ts +6 -0
  358. package/dist/node.d.ts.map +1 -0
  359. package/dist/node.js +481 -0
  360. package/dist/node.js.map +1 -0
  361. package/dist/node.mjs +443 -0
  362. package/dist/node.mjs.map +1 -0
  363. package/dist/readiness/index.d.ts +3 -0
  364. package/dist/readiness/index.d.ts.map +1 -0
  365. package/dist/readiness/readiness-registry.d.ts +183 -0
  366. package/dist/readiness/readiness-registry.d.ts.map +1 -0
  367. package/dist/schemas/auth-records.d.ts +81 -0
  368. package/dist/schemas/auth-records.d.ts.map +1 -0
  369. package/dist/storage/filesystem-storage-provider.d.ts +37 -0
  370. package/dist/storage/filesystem-storage-provider.d.ts.map +1 -0
  371. package/dist/types/agent-pipeline-settings.d.ts +94 -0
  372. package/dist/types/agent-pipeline-settings.d.ts.map +1 -0
  373. package/dist/types/camera-pipeline.d.ts +58 -0
  374. package/dist/types/camera-pipeline.d.ts.map +1 -0
  375. package/dist/types/detection.d.ts +195 -38
  376. package/dist/types/detection.d.ts.map +1 -1
  377. package/dist/types/device-type.d.ts +4 -0
  378. package/dist/types/device-type.d.ts.map +1 -1
  379. package/dist/types/engine-output.d.ts +24 -0
  380. package/dist/types/engine-output.d.ts.map +1 -0
  381. package/dist/types/io.d.ts +57 -3
  382. package/dist/types/io.d.ts.map +1 -1
  383. package/dist/types/models.d.ts +3 -1
  384. package/dist/types/models.d.ts.map +1 -1
  385. package/dist/types/pipeline-schema.d.ts +15 -72
  386. package/dist/types/pipeline-schema.d.ts.map +1 -1
  387. package/dist/types/pipeline-step.d.ts +201 -0
  388. package/dist/types/pipeline-step.d.ts.map +1 -0
  389. package/dist/types/pipeline.d.ts +24 -1
  390. package/dist/types/pipeline.d.ts.map +1 -1
  391. package/dist/utils/element-config-store.d.ts +29 -0
  392. package/dist/utils/element-config-store.d.ts.map +1 -0
  393. package/dist/utils/err-msg.d.ts +7 -0
  394. package/dist/utils/err-msg.d.ts.map +1 -0
  395. package/dist/utils/json-safe.d.ts +33 -0
  396. package/dist/utils/json-safe.d.ts.map +1 -0
  397. package/dist/utils/mask-url.d.ts +10 -0
  398. package/dist/utils/mask-url.d.ts.map +1 -0
  399. package/dist/utils/ring-buffer.d.ts +16 -0
  400. package/dist/utils/ring-buffer.d.ts.map +1 -0
  401. package/dist/utils/run-inference-step.d.ts +26 -0
  402. package/dist/utils/run-inference-step.d.ts.map +1 -0
  403. package/dist/utils/runtime-mapping.d.ts +88 -0
  404. package/dist/utils/runtime-mapping.d.ts.map +1 -0
  405. package/dist/utils/zone-rule-eval.d.ts +47 -0
  406. package/dist/utils/zone-rule-eval.d.ts.map +1 -0
  407. package/package.json +11 -2
  408. package/dist/__tests__/addon-capability-provider.test.d.ts +0 -2
  409. package/dist/__tests__/addon-capability-provider.test.d.ts.map +0 -1
  410. package/dist/__tests__/addon-declaration.test.d.ts +0 -2
  411. package/dist/__tests__/addon-declaration.test.d.ts.map +0 -1
  412. package/dist/__tests__/capability.test.d.ts +0 -2
  413. package/dist/__tests__/capability.test.d.ts.map +0 -1
  414. package/dist/interfaces/addon-i18n.d.ts +0 -41
  415. package/dist/interfaces/addon-i18n.d.ts.map +0 -1
  416. package/dist/interfaces/classifier.d.ts +0 -8
  417. package/dist/interfaces/classifier.d.ts.map +0 -1
  418. package/dist/interfaces/cropper.d.ts +0 -8
  419. package/dist/interfaces/cropper.d.ts.map +0 -1
  420. package/dist/interfaces/detector.d.ts +0 -8
  421. package/dist/interfaces/detector.d.ts.map +0 -1
  422. package/dist/interfaces/device-capabilities/accessory.d.ts +0 -14
  423. package/dist/interfaces/device-capabilities/accessory.d.ts.map +0 -1
  424. package/dist/interfaces/device-capabilities/audio-detector.d.ts +0 -12
  425. package/dist/interfaces/device-capabilities/audio-detector.d.ts.map +0 -1
  426. package/dist/interfaces/device-capabilities/doorbell.d.ts +0 -10
  427. package/dist/interfaces/device-capabilities/doorbell.d.ts.map +0 -1
  428. package/dist/interfaces/device-capabilities/events.d.ts +0 -47
  429. package/dist/interfaces/device-capabilities/events.d.ts.map +0 -1
  430. package/dist/interfaces/device-capabilities/motion-sensor.d.ts +0 -7
  431. package/dist/interfaces/device-capabilities/motion-sensor.d.ts.map +0 -1
  432. package/dist/interfaces/device-capabilities/native-detection.d.ts +0 -14
  433. package/dist/interfaces/device-capabilities/native-detection.d.ts.map +0 -1
  434. package/dist/interfaces/device-capabilities/object-detector.d.ts +0 -59
  435. package/dist/interfaces/device-capabilities/object-detector.d.ts.map +0 -1
  436. package/dist/interfaces/device-capabilities/pan-tilt-zoom.d.ts +0 -29
  437. package/dist/interfaces/device-capabilities/pan-tilt-zoom.d.ts.map +0 -1
  438. package/dist/interfaces/device-capabilities/recording.d.ts +0 -18
  439. package/dist/interfaces/device-capabilities/recording.d.ts.map +0 -1
  440. package/dist/interfaces/device-capabilities/siren.d.ts +0 -8
  441. package/dist/interfaces/device-capabilities/siren.d.ts.map +0 -1
  442. package/dist/interfaces/device-capabilities/status-light.d.ts +0 -7
  443. package/dist/interfaces/device-capabilities/status-light.d.ts.map +0 -1
  444. package/dist/interfaces/device-capabilities/switch.d.ts +0 -8
  445. package/dist/interfaces/device-capabilities/switch.d.ts.map +0 -1
  446. package/dist/interfaces/device-capabilities/two-way-audio.d.ts +0 -8
  447. package/dist/interfaces/device-capabilities/two-way-audio.d.ts.map +0 -1
  448. package/dist/interfaces/device-capability.d.ts +0 -14
  449. package/dist/interfaces/device-capability.d.ts.map +0 -1
  450. package/dist/interfaces/model-catalog.d.ts +0 -25
  451. package/dist/interfaces/model-catalog.d.ts.map +0 -1
  452. package/dist/interfaces/refiner.d.ts +0 -8
  453. package/dist/interfaces/refiner.d.ts.map +0 -1
  454. package/dist/interfaces/repositories.d.ts +0 -20
  455. package/dist/interfaces/repositories.d.ts.map +0 -1
  456. package/dist/interfaces/scene-intelligence.d.ts +0 -21
  457. package/dist/interfaces/scene-intelligence.d.ts.map +0 -1
  458. package/dist/interfaces/storage-backend.d.ts +0 -27
  459. package/dist/interfaces/storage-backend.d.ts.map +0 -1
  460. package/dist/interfaces/worker-protocol.d.ts +0 -110
  461. package/dist/interfaces/worker-protocol.d.ts.map +0 -1
  462. package/dist/schemas/system-settings-schemas.d.ts +0 -27
  463. package/dist/schemas/system-settings-schemas.d.ts.map +0 -1
  464. package/dist/types/benchmark.d.ts +0 -112
  465. package/dist/types/benchmark.d.ts.map +0 -1
  466. package/dist/types/zones.d.ts +0 -48
  467. package/dist/types/zones.d.ts.map +0 -1
@@ -0,0 +1,124 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * Per-device runtime state — cap-keyed. Mutable signals discovered
4
+ * after boot live here, separate from `DeviceConfig` (operator
5
+ * intent) and from `deviceCache` (immutable autodetect / abilities).
6
+ *
7
+ * Shape: `Record<capName, capStateSlice>`. Each slice's schema is
8
+ * declared by the capability itself (`CapabilityDefinition.runtimeState`)
9
+ * so that any provider implementing the cap inherits the same shape —
10
+ * the BatteryStatus shape a Reolink cam emits is the same a Frigate or
11
+ * ONVIF cam emits, no driver-specific re-declaration.
12
+ *
13
+ * Schemas are registered DYNAMICALLY as the device's caps are
14
+ * installed (see `BaseDevice.registerNativeCap`). A slice without a
15
+ * registered schema is rejected on write — the cap must be wired
16
+ * first. Reads return `undefined` for unknown slices.
17
+ *
18
+ * Persistence: only registered slices round-trip to disk. The kernel
19
+ * layer debounces writes; explicit `flush()` awaits in-flight saves
20
+ * (used by the shutdown hook).
21
+ */
22
+ export interface IDeviceRuntimeState {
23
+ /**
24
+ * Read the slice for `capName`. Three overloads, picked by
25
+ * argument shape:
26
+ *
27
+ * 1. Pass a known cap-name literal (`'battery'`, `'motion'`, …)
28
+ * → return type is auto-inferred from
29
+ * `CapNameToRuntimeStateMap` (codegen output). No generic
30
+ * argument, no `as`-cast.
31
+ * 2. Pass a cap-name with an explicit generic
32
+ * (`getCapState<MyShape>('custom-cap')`) → return that
33
+ * shape. Used for caps the codegen doesn't see (test-only,
34
+ * addon-private).
35
+ * 3. Pass a cap-name with no generic (default `Record<string,
36
+ * unknown>`) → permissive untyped fallback.
37
+ *
38
+ * Returns `undefined` if no slice has been written yet.
39
+ */
40
+ getCapState<K extends keyof import('../generated/device-local-state.js').CapNameToRuntimeStateMap>(capName: K): Readonly<import('../generated/device-local-state.js').CapNameToRuntimeStateMap[K]> | undefined;
41
+ getCapState<T extends Record<string, unknown> = Record<string, unknown>>(capName: string): Readonly<T> | undefined;
42
+ /** Read a single key inside a slice. Convenience for the common
43
+ * case of reading a primitive (`battery.percentage`). */
44
+ getCapField(capName: string, key: string): unknown;
45
+ /**
46
+ * Replace the slice for `capName`. The schema bound to `capName`
47
+ * (via `installCapSchema`) validates `value`; throws on mismatch.
48
+ * Listeners fire synchronously after the write applies.
49
+ */
50
+ setCapState(capName: string, value: Record<string, unknown>): void;
51
+ /**
52
+ * Shallow-merge `partial` into the current slice for `capName`.
53
+ * Re-validates the merged result against the cap's schema.
54
+ */
55
+ patchCapState(capName: string, partial: Record<string, unknown>): void;
56
+ /** Subscribe to ALL state changes. Receives the cap names whose
57
+ * slices changed and the full snapshot. */
58
+ subscribe(cb: (changedCaps: ReadonlyArray<string>, snapshot: Snapshot) => void): () => void;
59
+ /** Subscribe to a single cap's slice changes. Fires only when that
60
+ * cap's slice is touched; ignores writes against other caps. */
61
+ subscribeCap<T extends Record<string, unknown> = Record<string, unknown>>(capName: string, cb: (slice: Readonly<T> | undefined) => void): () => void;
62
+ /** Frozen snapshot of every cap's slice. Cap names without a
63
+ * written slice are omitted (sparse). */
64
+ snapshot(): Snapshot;
65
+ /** Flush any pending debounced disk writes. */
66
+ flush(): Promise<void>;
67
+ /**
68
+ * Register a cap's runtime-state schema. Called by the kernel
69
+ * when `ctx.registerNativeCap(cap, …)` runs and `cap.runtimeState`
70
+ * is defined. Idempotent — repeat installs with the same schema
71
+ * are no-ops; mismatched schemas throw to surface a config bug.
72
+ *
73
+ * Lazily validates any existing in-memory slice for `capName` so
74
+ * a slice loaded from disk before the cap was wired is checked
75
+ * the moment the cap shows up.
76
+ */
77
+ installCapSchema(capName: string, schema: z.ZodObject<z.core.$ZodLooseShape>): void;
78
+ }
79
+ export type Snapshot = Readonly<Record<string, Readonly<Record<string, unknown>>>>;
80
+ /**
81
+ * Concrete implementation. Routes every successful write through
82
+ * `writer(capName, slice)` — the kernel hooks this up to
83
+ * `device-state.setCapSlice`, the canonical cross-layer write
84
+ * entrypoint, which handles disk persistence (debounced on the hub)
85
+ * and mirror updates.
86
+ *
87
+ * Schema validation runs in-process before the writer is called —
88
+ * the round-trip should never carry an invalid slice. `flush()`
89
+ * awaits any in-flight writer promises so shutdown is lossless.
90
+ *
91
+ * `initial` is the persisted blob loaded at boot. Slices for caps
92
+ * whose schema hasn't been installed yet are kept in-memory verbatim
93
+ * and validated when the cap registers later.
94
+ */
95
+ export declare class DeviceRuntimeState implements IDeviceRuntimeState {
96
+ private readonly writer;
97
+ /** In-flight writer promises tracked so `flush()` can await them. */
98
+ private readonly pendingWrites;
99
+ /** Per-cap committed slice — after schema validation when known. */
100
+ private slices;
101
+ /** Per-cap registered schema (set by `installCapSchema`). */
102
+ private readonly schemas;
103
+ private readonly listeners;
104
+ private readonly capListeners;
105
+ private constructor();
106
+ static fromInitial(initial: Record<string, unknown>, writer: (capName: string, slice: Record<string, unknown>) => Promise<void>): DeviceRuntimeState;
107
+ installCapSchema(capName: string, schema: z.ZodObject<z.core.$ZodLooseShape>): void;
108
+ getCapState<T extends Record<string, unknown> = Record<string, unknown>>(capName: string): Readonly<T> | undefined;
109
+ getCapField(capName: string, key: string): unknown;
110
+ setCapState(capName: string, value: Record<string, unknown>): void;
111
+ patchCapState(capName: string, partial: Record<string, unknown>): void;
112
+ /**
113
+ * Internal worker. `merge` controls whether `value` replaces or
114
+ * shallow-merges into the existing slice. Schema validation runs
115
+ * on the FINAL composed object regardless.
116
+ */
117
+ private applyCapWrite;
118
+ private fireListeners;
119
+ subscribe(cb: (changed: ReadonlyArray<string>, snap: Snapshot) => void): () => void;
120
+ subscribeCap<T extends Record<string, unknown> = Record<string, unknown>>(capName: string, cb: (slice: Readonly<T> | undefined) => void): () => void;
121
+ snapshot(): Snapshot;
122
+ flush(): Promise<void>;
123
+ }
124
+ //# sourceMappingURL=device-runtime-state.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"device-runtime-state.d.ts","sourceRoot":"","sources":["../../src/device/device-runtime-state.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,WAAW,mBAAmB;IAClC;;;;;;;;;;;;;;;;OAgBG;IACH,WAAW,CAAC,CAAC,SAAS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,OAAO;IAIlD,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IAIlE,aAAa,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IAItE;;;;OAIG;IACH,OAAO,CAAC,aAAa;IAkCrB,OAAO,CAAC,aAAa;IAerB,SAAS,CAAC,EAAE,EAAE,CAAC,OAAO,EAAE,aAAa,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,QAAQ,KAAK,IAAI,GAAG,MAAM,IAAI;IAKnF,YAAY,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACtE,OAAO,EAAE,MAAM,EACf,EAAE,EAAE,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,GAAG,SAAS,KAAK,IAAI,GAC3C,MAAM,IAAI;IAkBb,QAAQ,IAAI,QAAQ;IAMd,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;CAQ7B"}
@@ -0,0 +1,161 @@
1
+ /**
2
+ * Reactive read handle for one cap-keyed slice of a device's
3
+ * runtime state. Returned by `createDeviceProxy(...).state[capName]`.
4
+ *
5
+ * Three pieces:
6
+ * - `value`: last-known slice. `undefined` until something has
7
+ * populated it (an active subscription, an explicit `refresh()`,
8
+ * or — in the case of the SystemManager mirror source — a
9
+ * warm-boot `getAllSnapshots` payload). Read sync.
10
+ * - `refresh()`: one-shot pull from the underlying source. For
11
+ * the lazy tRPC source this is `deviceState.getCapSlice`; for
12
+ * the SystemManager mirror it's a no-op (the mirror is push-only).
13
+ * - `subscribe(cb)`: hooks into the source's notification channel,
14
+ * filtered by `(deviceId, capName)`. Refcounted — the underlying
15
+ * subscription closes when the last caller unsubscribes.
16
+ *
17
+ * Cross-environment: the same API works in browser (admin-ui via the
18
+ * tRPC client) and on the server (in-process AddonApi). The transport
19
+ * is whatever the supplied source exposes.
20
+ */
21
+ export interface SliceHandle<T> {
22
+ /** Latest cached slice. Reflects the most recent `refresh()` or
23
+ * push event. `undefined` if neither has happened. */
24
+ readonly value: T | undefined;
25
+ /** Force a re-fetch from the hub mirror. Updates `value` + notifies
26
+ * every active subscriber. No-op for the SystemManager mirror
27
+ * source (it's already push-driven). */
28
+ refresh(): Promise<void>;
29
+ /** Subscribe to slice changes. Returns the unsubscribe fn.
30
+ * Auto-fires the callback once with the current value (or
31
+ * `undefined`) so the caller sees a snapshot immediately. */
32
+ subscribe(cb: (slice: T | undefined) => void): () => void;
33
+ /**
34
+ * Replace the slice on the hub. Routes through
35
+ * `device-state.setCapSlice` — the canonical cross-layer write
36
+ * entrypoint. The local mirror updates via the `onChanged` event
37
+ * (round-trip), so callers should treat the write as eventually
38
+ * consistent and read the new value via `subscribe` rather than
39
+ * synchronously after `await`.
40
+ */
41
+ set(slice: T): Promise<void>;
42
+ /**
43
+ * Shallow-merge `partial` into the current slice on the hub.
44
+ * Implemented as read-modify-write client-side: pulls `value`
45
+ * (or refreshes), merges, calls `set()`. Single-writer
46
+ * conventions on each cap make atomic-merge semantics
47
+ * unnecessary — concurrent patches on the same slice from
48
+ * different processes are undefined and should be avoided.
49
+ */
50
+ patch(partial: Partial<T>): Promise<void>;
51
+ }
52
+ /**
53
+ * Minimal tRPC API surface used by the lazy source. Both `AddonApi`
54
+ * (server) and the tRPC client proxy (browser) satisfy it structurally
55
+ * — we don't import either to avoid pulling them in from a leaf type
56
+ * module.
57
+ */
58
+ export interface SliceHandleApi {
59
+ readonly deviceState: {
60
+ readonly getCapSlice: {
61
+ query(input: {
62
+ deviceId: number;
63
+ capName: string;
64
+ }): Promise<Record<string, unknown> | null>;
65
+ };
66
+ readonly setCapSlice: {
67
+ mutate(input: {
68
+ deviceId: number;
69
+ capName: string;
70
+ slice: Record<string, unknown>;
71
+ }): Promise<void>;
72
+ };
73
+ };
74
+ readonly live?: {
75
+ readonly onEvent: {
76
+ subscribe(input: {
77
+ category: string;
78
+ }, opts: {
79
+ onData: (evt: {
80
+ data: unknown;
81
+ }) => void;
82
+ onError?: (err: unknown) => void;
83
+ }): {
84
+ unsubscribe: () => void;
85
+ };
86
+ };
87
+ };
88
+ }
89
+ /**
90
+ * Pluggable state-source contract. `createSliceHandle` is now a thin
91
+ * adapter over this interface — every implementation produces an
92
+ * identical `SliceHandle<T>` shape. Two impls today:
93
+ *
94
+ * - `createLazyTrpcSource(api)`: per-handle local cache, refresh
95
+ * via `deviceState.getCapSlice`, subscribe via `live.onEvent`.
96
+ * Default behavior, used by `createDeviceProxy(api, binding)`
97
+ * when no source is passed.
98
+ * - `createMirrorSource(mirror, listeners)`: reads from a shared
99
+ * `Map<deviceId, Map<capName, slice>>` populated by a
100
+ * `SystemManager` warm-boot. Refresh is a no-op; subscribe
101
+ * registers in a shared listener set that the SystemManager
102
+ * fans out to on every push event.
103
+ *
104
+ * Both produce the same `SliceHandle<T>` API; consumers don't see
105
+ * which source is behind the handle.
106
+ */
107
+ export interface SliceHandleSource {
108
+ /** Sync read of the last-known slice for `(deviceId, capName)`. */
109
+ read(deviceId: number, capName: string): unknown | undefined;
110
+ /** Force a re-fetch (where applicable). No-op when the source is
111
+ * push-only (e.g. the SystemManager mirror). */
112
+ refresh(deviceId: number, capName: string): Promise<void>;
113
+ /** Register a listener for slice changes. Returns the unsubscribe
114
+ * fn. Implementations should fan out the latest cached slice to
115
+ * the callback synchronously when seeding is desired (the handle
116
+ * always seeds via a separate `cb(read(...))` call). */
117
+ watch(deviceId: number, capName: string, cb: (slice: unknown | undefined) => void): () => void;
118
+ /** Write the slice for `(deviceId, capName)` to the hub via the
119
+ * canonical `device-state.setCapSlice` entrypoint. Throws if the
120
+ * source has no write transport (e.g. a mirror source built
121
+ * without an api reference). */
122
+ write(deviceId: number, capName: string, slice: Record<string, unknown>): Promise<void>;
123
+ }
124
+ /**
125
+ * Lazy tRPC source — the default behavior. Maintains a per-key local
126
+ * cache (`{deviceId}:{capName}` → last slice), one shared
127
+ * `live.onEvent` bridge that fans out into the listener map, and
128
+ * `refresh` round-trips through `deviceState.getCapSlice`.
129
+ *
130
+ * The bridge is opened on first `watch()` and closed when the last
131
+ * watcher unsubscribes — keeps idle handles cheap.
132
+ */
133
+ export declare function createLazyTrpcSource(api: SliceHandleApi): SliceHandleSource;
134
+ /**
135
+ * Mirror source — reads from a shared map populated by a
136
+ * `SystemManager` warm-boot + push event handler. Refresh is a no-op
137
+ * (the SystemManager owns the update loop). `watch()` registers in a
138
+ * shared listener set — the SystemManager calls these from its single
139
+ * `device.state-changed` subscription.
140
+ *
141
+ * The mirror map and listener map are passed in by reference so the
142
+ * SystemManager can mutate both as events arrive.
143
+ */
144
+ export declare function createMirrorSource(mirror: ReadonlyMap<number, ReadonlyMap<string, unknown>>, listeners: Map<string, Set<(slice: unknown | undefined) => void>>, api?: SliceHandleApi): SliceHandleSource;
145
+ /**
146
+ * Build a `SliceHandle<T>` bound to `(deviceId, capName)`. Caller
147
+ * provides the type parameter — codegen passes
148
+ * `InferRuntimeState<typeof <cap>>` so consumers see the cap's typed
149
+ * shape:
150
+ *
151
+ * const dev = createDeviceProxy(api, binding)
152
+ * dev.state.battery.value // BatteryStatus | undefined
153
+ * dev.state.battery.value?.percentage
154
+ *
155
+ * Two-arg form (deprecated path, kept for spec compatibility):
156
+ * passes the api directly, builds a per-handle lazy source. New
157
+ * code should pre-build a single source and reuse it across handles
158
+ * via the explicit `source` form.
159
+ */
160
+ export declare function createSliceHandle<T>(source: SliceHandleSource | SliceHandleApi, deviceId: number, capName: string): SliceHandle<T>;
161
+ //# sourceMappingURL=device-state-handle.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"device-state-handle.d.ts","sourceRoot":"","sources":["../../src/device/device-state-handle.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,WAAW,WAAW,CAAC,CAAC;IAC5B;2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M,EAAE,iBAAiB,GAAG,cAAc,EAC1C,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,MAAM,GACd,WAAW,CAAC,CAAC,CAAC,CAwChB"}
@@ -0,0 +1,68 @@
1
+ export declare enum DeviceType {
2
+ Camera = "camera",
3
+ Hub = "hub",
4
+ Light = "light",
5
+ Siren = "siren",
6
+ Switch = "switch",
7
+ Sensor = "sensor",
8
+ Thermostat = "thermostat",
9
+ Button = "button",
10
+ Generic = "generic"
11
+ }
12
+ export declare enum DeviceFeature {
13
+ BatteryOperated = "battery-operated",
14
+ Rebootable = "rebootable",
15
+ NativeSnapshot = "native-snapshot",
16
+ DoorbellButton = "doorbell-button",
17
+ TwoWayAudio = "two-way-audio",
18
+ PanTiltZoom = "pan-tilt-zoom",
19
+ /**
20
+ * Camera supports the on-firmware autotrack subsystem (subject-
21
+ * following). Distinct from `PanTiltZoom` because not every PTZ
22
+ * camera ships autotrack — the admin UI uses this flag to gate
23
+ * the autotrack toggle / settings card without re-deriving from
24
+ * the cap registry. Mirrors `ptz-autotrack` cap registration:
25
+ * driver sets this feature when probe confirms the firmware
26
+ * surface, and registers the cap in the same code path.
27
+ */
28
+ PtzAutotrack = "ptz-autotrack",
29
+ /**
30
+ * Accessory exposes a "trigger on motion" toggle — the parent camera's
31
+ * motion detection automatically activates this device. Mirrors
32
+ * `motion-trigger` cap registration: drivers set this feature in the
33
+ * same code path that calls `ctx.registerNativeCap(motionTriggerCapability, ...)`.
34
+ *
35
+ * Used by admin UI (gate the in-hero `MotionTriggerToggle` against a
36
+ * fast scalar without binding fetch), notifier rules, and `listAll`
37
+ * filters that want "all devices with on-motion behaviour".
38
+ */
39
+ MotionTrigger = "motion-trigger"
40
+ }
41
+ export declare enum ChargingStatus {
42
+ ChargingDC = "charging-dc",
43
+ ChargingSolar = "charging-solar",
44
+ NotCharging = "not-charging"
45
+ }
46
+ /**
47
+ * Semantic role a device plays within its parent. Populated by driver
48
+ * addons when creating accessory devices (Reolink siren/floodlight/
49
+ * PIR/chime/autotrack/doorbell, ONVIF relay outputs, …). Used by the
50
+ * admin UI to pick icons, labels, and widgets — a `Switch` with
51
+ * `role: Floodlight` renders as a bulb with a brightness slider,
52
+ * whereas a `Switch` with `role: Siren` renders as a klaxon.
53
+ *
54
+ * Undefined for top-level devices (cameras, NVRs, hubs). Persisted in
55
+ * sqlite as a nullable TEXT column — old rows keep working unchanged.
56
+ */
57
+ export declare enum DeviceRole {
58
+ Siren = "siren",
59
+ Floodlight = "floodlight",
60
+ Spotlight = "spotlight",
61
+ PirSensor = "pir-sensor",
62
+ Chime = "chime",
63
+ Autotrack = "autotrack",
64
+ Nightvision = "nightvision",
65
+ PrivacyMask = "privacy-mask",
66
+ Doorbell = "doorbell"
67
+ }
68
+ //# sourceMappingURL=device-type.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"device-type.d.ts","sourceRoot":"","sources":["../../src/device/device-type.ts"],"names":[],"mappings":"AAAA,oBAAY,UAAU;IACpB,MAAM,WAAW;IACjB,GAAG,QAAQ;IACX,KAAK,UAAU;IACf,KAAK,UAAU;IACf,MAAM,WAAW;IACjB,MAAM,WAAW;IACjB,UAAU,eAAe;IACzB,MAAM,WAAW;IACjB,OAAO,YAAY;CACpB;AAED,oBAAY,aAAa;IACvB,eAAe,qBAAqB;IACpC,UAAU,eAAe;IACzB,cAAc,oBAAoB;IAClC,cAAc,oBAAoB;IAClC,WAAW,kBAAkB;IAC7B,WAAW,kBAAkB;IAC7B;;;;;;;;OAQG;IACH,YAAY,kBAAkB;IAC9B;;;;;;;;;OASG;IACH,aAAa,mBAAmB;CACjC;AAED,oBAAY,cAAc;IACxB,UAAU,gBAAgB;IAC1B,aAAa,mBAAmB;IAChC,WAAW,iBAAiB;CAC7B;AAED;;;;;;;;;;GAUG;AACH,oBAAY,UAAU;IAEpB,KAAK,UAAiB;IACtB,UAAU,eAAiB;IAC3B,SAAS,cAAiB;IAC1B,SAAS,eAAkB;IAC3B,KAAK,UAAiB;IACtB,SAAS,cAAiB;IAC1B,WAAW,gBAAiB;IAC5B,WAAW,iBAAkB;IAG7B,QAAQ,aAAiB;CAC1B"}
@@ -0,0 +1,87 @@
1
+ import type { z } from 'zod';
2
+ import type { DeviceType, DeviceFeature, DeviceRole } from './device-type.js';
3
+ import type { DeviceConfig } from './device-config.js';
4
+ import type { DeviceContext } from './device-context.js';
5
+ import type { ConfigUISchemaWithValues } from '../interfaces/config-ui.js';
6
+ export interface IDevice {
7
+ /** Progressive, system-wide unique numeric id. Assigned by the hub's
8
+ * `device-manager` at `allocateDeviceId` time, injected through
9
+ * `DeviceContext.id` and read verbatim by `BaseDevice`. Distinct from
10
+ * `stableId`, which is unique per owning addon. Non-nullable — every
11
+ * live IDevice has one (the hub allocates before the device is
12
+ * constructed). Persists across removals: ids are never reissued. */
13
+ readonly id: number;
14
+ readonly stableId: string;
15
+ readonly type: DeviceType;
16
+ readonly name: string;
17
+ /**
18
+ * Operator-organisational location label (room / area / zone).
19
+ * `null` when unset. Free-text — providers don't interpret it; the
20
+ * UI groups devices by this for filters like "show me all cameras
21
+ * in Kitchen". Mutated via `kernel.devices.setLocation(id, value)`.
22
+ */
23
+ readonly location: string | null;
24
+ /**
25
+ * Soft-disabled flag. When `true`, the device class is still
26
+ * instantiated and visible in the UI (so the operator can flip
27
+ * back on without re-adding) but lifecycle hooks (publishToBroker,
28
+ * alarm-stream subscribe, …) MUST be gated by the driver to skip
29
+ * work. The `BaseDevice` exposes the flag; it doesn't mutate cap
30
+ * behaviour automatically — drivers consult `this.disabled` at
31
+ * the top of their lifecycle methods. Mutated via
32
+ * `kernel.devices.setDisabled(id, value)`.
33
+ */
34
+ readonly disabled: boolean;
35
+ /** Numeric id of this device's parent, or null when standalone. The
36
+ * hub resolves the parent's `stableId` to its numeric id at
37
+ * registration time so child devices reference parents by numeric id
38
+ * internally — `stableId` stays at the external boundary. */
39
+ readonly parentDeviceId: number | null;
40
+ /**
41
+ * Optional semantic role this device plays within its parent.
42
+ * Driver addons set this when they create accessory devices (siren,
43
+ * floodlight, PIR, chime, doorbell). The admin UI uses it to pick
44
+ * icons, labels, and widgets. Undefined for top-level devices.
45
+ */
46
+ readonly role?: DeviceRole;
47
+ /**
48
+ * Device liveness flag. On `BaseDevice` this is a getter+setter pair
49
+ * proxying through the `device-status` runtime-state slice — both
50
+ * `device.online` reads and `device.online = true` writes route
51
+ * through the cap-keyed slice. `markOnline()` is the explicit
52
+ * method form for callers that prefer the imperative shape.
53
+ */
54
+ online: boolean;
55
+ readonly features: readonly DeviceFeature[];
56
+ readonly config: DeviceConfig<z.ZodObject<z.core.$ZodLooseShape>>;
57
+ readonly ctx: DeviceContext;
58
+ removeDevice(): Promise<void>;
59
+ /**
60
+ * Set the device's online flag. Called by `BaseDeviceProvider` after
61
+ * aggregating per-profile stream-broker health (or by drivers that have
62
+ * provider-side liveness signals). Mutates the `online` field; the
63
+ * field is `readonly` to consumers but writable through this method.
64
+ */
65
+ markOnline(online: boolean): void;
66
+ /**
67
+ * Device-authored settings UI. Returns the fully-hydrated schema (fields
68
+ * carry their current values inline) rendered by the admin UI under the
69
+ * device-details Config tab. Drivers with no settings to expose return
70
+ * `{ sections: [] }` — the aggregator drops empty contributions.
71
+ *
72
+ * This is the SINGLE source of truth for device settings UI. There is no
73
+ * auto-generation fallback: if a driver wants its config editable, it
74
+ * declares the shape here. `BaseDevice` provides the empty default so
75
+ * drivers opt in when they have something to show.
76
+ */
77
+ getSettingsUISchema(): ConfigUISchemaWithValues;
78
+ /**
79
+ * Write a flat patch coming from the UI (keyed by the `ConfigField.key`
80
+ * the driver emitted in `getSettingsUISchema`) back into storage.
81
+ * Drivers whose UI shape differs from the storage shape reshape the
82
+ * patch here before `config.setAll`. `BaseDevice` defaults to a direct
83
+ * `config.setAll(patch)` so drivers opt in only when they need reshape.
84
+ */
85
+ applySettingsPatch(patch: Record<string, unknown>): Promise<void>;
86
+ }
87
+ //# sourceMappingURL=device.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,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IAAI,CAAA;IAEjC;;;;;;;;;;OAUG;IACH,mBAAmB,IAAI,wBAAwB,CAAA;IAE/C;;;;;;OAMG;IACH,kBAAkB,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;CAClE"}
@@ -0,0 +1,29 @@
1
+ import type { ChargingStatus } from './device-type.js';
2
+ export interface IBatteryOperated {
3
+ readonly batteryLevel: number;
4
+ readonly sleeping: boolean;
5
+ readonly chargingStatus: ChargingStatus;
6
+ }
7
+ export interface IRebootable {
8
+ reboot(): Promise<void>;
9
+ }
10
+ export interface INativeSnapshot {
11
+ getSnapshot(): Promise<Buffer>;
12
+ }
13
+ export interface IDoorbellButton {
14
+ /** Subscribe to doorbell press events. Returns unsubscribe function. */
15
+ onDoorbellPressed(callback: (timestamp: number) => void): () => void;
16
+ }
17
+ export interface ITwoWayAudio {
18
+ /** Start two-way audio session */
19
+ startAudio(): Promise<void>;
20
+ /** Stop two-way audio session */
21
+ stopAudio(): Promise<void>;
22
+ }
23
+ export interface IPanTiltZoom {
24
+ pan(direction: 'left' | 'right', speed?: number): Promise<void>;
25
+ tilt(direction: 'up' | 'down', speed?: number): Promise<void>;
26
+ zoom(direction: 'in' | 'out', speed?: number): Promise<void>;
27
+ stop(): Promise<void>;
28
+ }
29
+ //# sourceMappingURL=features.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"features.d.ts","sourceRoot":"","sources":["../../src/device/features.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAEtD,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAA;IAC7B,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAA;IAC1B,QAAQ,CAAC,cAAc,EAAE,cAAc,CAAA;CACxC;AAED,MAAM,WAAW,WAAW;IAC1B,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC,CAAA;CACxB;AAED,MAAM,WAAW,eAAe;IAC9B,WAAW,IAAI,OAAO,CAAC,MAAM,CAAC,CAAA;CAC/B;AAED,MAAM,WAAW,eAAe;IAC9B,wEAAwE;IACxE,iBAAiB,CAAC,QAAQ,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,GAAG,MAAM,IAAI,CAAA;CACrE;AAED,MAAM,WAAW,YAAY;IAC3B,kCAAkC;IAClC,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC,CAAA;IAC3B,iCAAiC;IACjC,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC,CAAA;CAC3B;AAED,MAAM,WAAW,YAAY;IAC3B,GAAG,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IAC/D,IAAI,CAAC,SAAS,EAAE,IAAI,GAAG,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IAC7D,IAAI,CAAC,SAAS,EAAE,IAAI,GAAG,KAAK,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IAC5D,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAAA;CACtB"}
@@ -0,0 +1,20 @@
1
+ export { DeviceType, DeviceFeature, ChargingStatus, DeviceRole } from './device-type.js';
2
+ export { AccessoryKind, ACCESSORY_LABEL, accessoryStableId, type AccessoryKindValue, } from './accessory.js';
3
+ export type { IBatteryOperated, IRebootable, INativeSnapshot, IDoorbellButton, ITwoWayAudio, IPanTiltZoom } from './features.js';
4
+ export { DeviceConfig } from './device-config.js';
5
+ export type { DeviceContext, DeviceManagerApi, DeviceConstructor, IDeviceRegistryReader, IDeviceRegistry } from './device-context.js';
6
+ export { BaseDevice } from './base-device.js';
7
+ export type { AccessoryChildSpec } from './base-device.js';
8
+ export { BaseDeviceProvider, toDeviceSummary } from './base-device-provider.js';
9
+ export type { DiscoveryCandidate, DeviceSummary, ProviderStatus, FieldProbeResult } from './base-device-provider.js';
10
+ export type { IDevice } from './device.js';
11
+ export { DEVICE_PROFILES, BATTERY_DEVICE_PROFILE, deviceMatchesProfile, resolveDeviceProfile, } from './device-profile.js';
12
+ export type { DeviceProfile, DeviceProfileMatch, DeviceProfileDefaults, PipelinePhaseMode, } from './device-profile.js';
13
+ export type { ICameraDevice, StreamSourceEntry } from './camera-device.js';
14
+ export type { DeviceManualCreation, DeviceDiscovery, DiscoveredDevice, SavedDevice, DeviceMeta, InitialDeviceMeta, CreateDeviceSpec } from './device-management.js';
15
+ export { zodEntriesToConfigUI } from './zod-to-config-ui.js';
16
+ export type { DeviceConfigEntry } from './zod-to-config-ui.js';
17
+ export { createRuntimeStateBridge } from './runtime-state-helpers.js';
18
+ export type { RuntimeStateBridge } from './runtime-state-helpers.js';
19
+ export type { IDeviceRuntimeState, Snapshot as RuntimeStateSnapshot } from './device-runtime-state.js';
20
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/device/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AACxF,OAAO,EACL,aAAa,EAAE,eAAe,EAAE,iBAAiB,EACjD,KAAK,kBAAkB,GACxB,MAAM,gBAAgB,CAAA;AACvB,YAAY,EAAE,gBAAgB,EAAE,WAAW,EAAE,eAAe,EAAE,eAAe,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAChI,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AACjD,YAAY,EAAE,aAAa,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAA;AACrI,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAC7C,YAAY,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAA;AAC1D,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAA;AAC/E,YAAY,EAAE,kBAAkB,EAAE,aAAa,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAA;AACpH,YAAY,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAC1C,OAAO,EACL,eAAe,EAAE,sBAAsB,EAAE,oBAAoB,EAAE,oBAAoB,GACpF,MAAM,qBAAqB,CAAA;AAC5B,YAAY,EACV,aAAa,EAAE,kBAAkB,EAAE,qBAAqB,EACxD,iBAAiB,GAClB,MAAM,qBAAqB,CAAA;AAC5B,YAAY,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAA;AAC1E,YAAY,EAAE,oBAAoB,EAAE,eAAe,EAAE,gBAAgB,EAAE,WAAW,EAAE,UAAU,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAA;AACnK,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAA;AAC5D,YAAY,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAA;AAC9D,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAA;AACrE,YAAY,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAA;AACpE,YAAY,EAAE,mBAAmB,EAAE,QAAQ,IAAI,oBAAoB,EAAE,MAAM,2BAA2B,CAAA"}
@@ -0,0 +1,69 @@
1
+ import type { z } from 'zod';
2
+ import type { CapabilityDefinition } from '../capabilities/capability-definition.js';
3
+ import type { IDeviceRuntimeState } from './device-runtime-state.js';
4
+ /**
5
+ * Bridge a cap's `runtimeState` slice to its read-side methods.
6
+ *
7
+ * Pattern: provider keeps the camera fetch / write path, but delegates
8
+ * stale-check + slice read + cold-start fallback to this helper. Cuts
9
+ * the boilerplate that every provider would otherwise repeat across
10
+ * `getStatus`, `getSettings`, and any other read-side cap method.
11
+ *
12
+ * Convention: the cap's `runtimeState` schema must include a numeric
13
+ * `lastFetchedAt` field (ms epoch) so the helper can drive the
14
+ * stale-check. The field is stripped from the value returned by
15
+ * `getStatus` so the cap's status schema (which doesn't carry it)
16
+ * still parses cleanly.
17
+ *
18
+ * Usage in a provider:
19
+ * ```ts
20
+ * const bridge = createRuntimeStateBridge({
21
+ * runtimeState: this.runtimeState,
22
+ * cap: ptzAutotrackCapability,
23
+ * ownDeviceId: this.id,
24
+ * refresh: () => this.refreshAutotrackFromCamera(),
25
+ * staleMs: 10_000,
26
+ * empty: () => emptyAutotrackStatus(),
27
+ * })
28
+ *
29
+ * const provider: InferNativeProvider<typeof ptzAutotrackCapability> = {
30
+ * getStatus: bridge.getStatus,
31
+ * getSettings: async ({ deviceId }) => {
32
+ * if (deviceId !== this.id) return null
33
+ * await bridge.ensureFresh()
34
+ * return this.runtimeState.getCapState<...>(...)?.currentSettings ?? null
35
+ * },
36
+ * setEnabled: async (...) => { ... ; await this.refreshAutotrackFromCamera() },
37
+ * setSettings: async (...) => { ... ; await this.refreshAutotrackFromCamera() },
38
+ * }
39
+ * ```
40
+ *
41
+ * Single-flight (collapsing concurrent `refresh()` invocations) lives
42
+ * INSIDE `refresh` — the camera client owns its own promise slot. This
43
+ * helper stays thin so a single provider can host multiple cap-bridged
44
+ * readers without fighting over a shared promise.
45
+ */
46
+ export interface RuntimeStateBridge<TStatus> {
47
+ /** Run a stale-check; if the slice is missing or older than
48
+ * `staleMs`, await `refresh()`. Idempotent within the freshness
49
+ * window — back-to-back calls touch zero camera I/O. */
50
+ readonly ensureFresh: () => Promise<void>;
51
+ /** Drop-in `getStatus` provider method. Includes the cross-device
52
+ * guard + freshness check + status projection from the slice. */
53
+ readonly getStatus: (input: {
54
+ readonly deviceId: number;
55
+ }) => Promise<TStatus>;
56
+ }
57
+ export declare function createRuntimeStateBridge<TCap extends CapabilityDefinition & {
58
+ status: {
59
+ schema: z.ZodType;
60
+ };
61
+ }>(params: {
62
+ readonly runtimeState: IDeviceRuntimeState;
63
+ readonly cap: TCap;
64
+ readonly ownDeviceId: number;
65
+ readonly refresh: () => Promise<void>;
66
+ readonly staleMs: number;
67
+ readonly empty: () => z.infer<TCap['status']['schema']>;
68
+ }): RuntimeStateBridge<z.infer<TCap['status']['schema']>>;
69
+ //# sourceMappingURL=runtime-state-helpers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime-state-helpers.d.ts","sourceRoot":"","sources":["../../src/device/runtime-state-helpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAC5B,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,0CAA0C,CAAA;AACpF,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAA;AAIpE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AACH,MAAM,WAAW,kBAAkB,CAAC,OAAO;IACzC;;6DAEyD;IACzD,QAAQ,CAAC,WAAW,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;IACzC;sEACkE;IAClE,QAAQ,CAAC,SAAS,EAAE,CAAC,KAAK,EAAE;QAAE,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,KAAK,OAAO,CAAC,OAAO,CAAC,CAAA;CAC/E;AAED,wBAAgB,wBAAwB,CACtC,IAAI,SAAS,oBAAoB,GAAG;IAAE,MAAM,EAAE;QAAE,MAAM,EAAE,CAAC,CAAC,OAAO,CAAA;KAAE,CAAA;CAAE,EACrE,MAAM,EAAE;IACR,QAAQ,CAAC,YAAY,EAAE,mBAAmB,CAAA;IAC1C,QAAQ,CAAC,GAAG,EAAE,IAAI,CAAA;IAClB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAA;IAC5B,QAAQ,CAAC,OAAO,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;I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