@camstack/server 1.2.927 → 1.2.929

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 (235) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/package.json +11 -14
  3. package/system/dist/addon-id-CVg1_r5E.mjs +39 -0
  4. package/system/dist/addon-id-Di0lNJ89.js +50 -0
  5. package/system/dist/addon-pages.cap-Df9FQwN1.js +49 -0
  6. package/system/dist/addon-pages.cap-DksUlE8j.mjs +44 -0
  7. package/system/dist/addon-settings.cap-3-TIIMq_.mjs +592 -0
  8. package/system/dist/addon-settings.cap-DAiE0Nb0.js +651 -0
  9. package/system/dist/addon-widgets.cap-C4jxflbF.js +200 -0
  10. package/system/dist/addon-widgets.cap-D9m48X78.mjs +183 -0
  11. package/system/dist/base-addon-DD5dIfcZ.js +4624 -0
  12. package/system/dist/base-addon-Md14i7pe.mjs +4505 -0
  13. package/system/dist/base-device-2sL1DMm1.js +1103 -0
  14. package/system/dist/base-device-IuM1AwXZ.mjs +1098 -0
  15. package/system/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.js +8 -6
  16. package/system/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.mjs +3 -1
  17. package/system/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.js +8 -6
  18. package/system/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.mjs +3 -1
  19. package/system/dist/builtins/alerts/alerts.addon.js +113 -56
  20. package/system/dist/builtins/alerts/alerts.addon.mjs +58 -1
  21. package/system/dist/builtins/autotrack/index.js +21 -17
  22. package/system/dist/builtins/autotrack/index.mjs +5 -1
  23. package/system/dist/builtins/backup-orchestrator/backup-orchestrator.addon.js +14 -11
  24. package/system/dist/builtins/backup-orchestrator/backup-orchestrator.addon.mjs +5 -2
  25. package/system/dist/builtins/calendars/calendars.addon.js +8 -6
  26. package/system/dist/builtins/calendars/calendars.addon.mjs +3 -1
  27. package/system/dist/builtins/camera-grid/index.js +615 -58
  28. package/system/dist/builtins/camera-grid/index.mjs +558 -1
  29. package/system/dist/builtins/composer/composer.addon.js +788 -209
  30. package/system/dist/builtins/composer/composer.addon.mjs +583 -4
  31. package/system/dist/builtins/console-logging/index.js +4 -3
  32. package/system/dist/builtins/console-logging/index.mjs +2 -1
  33. package/system/dist/builtins/core-blocks/core-blocks.addon.js +7887 -381
  34. package/system/dist/builtins/core-blocks/core-blocks.addon.mjs +7511 -5
  35. package/system/dist/builtins/core-notifier/core-notifier.addon.js +731 -21
  36. package/system/dist/builtins/core-notifier/core-notifier.addon.mjs +711 -1
  37. package/system/dist/builtins/device-history/device-history.addon.js +110 -31
  38. package/system/dist/builtins/device-history/device-history.addon.mjs +81 -2
  39. package/system/dist/builtins/device-manager/device-manager.addon.js +12806 -227
  40. package/system/dist/builtins/device-manager/device-manager.addon.mjs +12583 -5
  41. package/system/dist/builtins/hub-forwarder/index.js +4 -3
  42. package/system/dist/builtins/hub-forwarder/index.mjs +2 -1
  43. package/system/dist/builtins/keychain/index.js +31 -28
  44. package/system/dist/builtins/keychain/index.mjs +7 -4
  45. package/system/dist/builtins/liveness-monitor/liveness-monitor.addon.js +15 -12
  46. package/system/dist/builtins/liveness-monitor/liveness-monitor.addon.mjs +4 -1
  47. package/system/dist/builtins/local-auth/local-auth.addon.js +140 -39
  48. package/system/dist/builtins/local-auth/local-auth.addon.mjs +103 -3
  49. package/system/dist/builtins/local-network/local-network.addon.js +43 -39
  50. package/system/dist/builtins/local-network/local-network.addon.mjs +7 -3
  51. package/system/dist/builtins/loki-logging/index.js +23 -17
  52. package/system/dist/builtins/loki-logging/index.mjs +7 -1
  53. package/system/dist/builtins/native-metrics/native-metrics.addon.js +156 -15
  54. package/system/dist/builtins/native-metrics/native-metrics.addon.mjs +142 -1
  55. package/system/dist/builtins/platform-probe/index.js +25 -23
  56. package/system/dist/builtins/platform-probe/index.mjs +4 -2
  57. package/system/dist/builtins/record-entries/index.js +9 -7
  58. package/system/dist/builtins/record-entries/index.mjs +3 -1
  59. package/system/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.js +4 -4
  60. package/system/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.mjs +1 -1
  61. package/system/dist/builtins/snapshot/index.js +97 -44
  62. package/system/dist/builtins/snapshot/index.mjs +54 -1
  63. package/system/dist/builtins/sqlite-storage/filesystem-storage.addon.js +5 -4
  64. package/system/dist/builtins/sqlite-storage/filesystem-storage.addon.mjs +2 -1
  65. package/system/dist/builtins/sqlite-storage/index.js +1 -1
  66. package/system/dist/builtins/sqlite-storage/index.mjs +1 -1
  67. package/system/dist/builtins/sqlite-storage/sqlite-settings.addon.js +87 -61
  68. package/system/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +29 -3
  69. package/system/dist/builtins/storage-orchestrator/storage-orchestrator.addon.js +81 -72
  70. package/system/dist/builtins/storage-orchestrator/storage-orchestrator.addon.mjs +10 -1
  71. package/system/dist/builtins/system-config/system-config.addon.js +17 -14
  72. package/system/dist/builtins/system-config/system-config.addon.mjs +6 -3
  73. package/system/dist/builtins/winston-logging/index.js +7 -5
  74. package/system/dist/builtins/winston-logging/index.mjs +3 -1
  75. package/system/dist/calendars.cap-CaFlShS9.js +155 -0
  76. package/system/dist/calendars.cap-_C4eD4fi.mjs +138 -0
  77. package/system/dist/camstack-error-DJ-TUAi1.js +23 -0
  78. package/system/dist/camstack-error-viZYfcj9.mjs +18 -0
  79. package/system/dist/cap-call-context-Bd76CbOW.js +95 -0
  80. package/system/dist/cap-call-context-DNwdgGSQ.mjs +78 -0
  81. package/system/dist/capability-definition-C2rJdVeX.mjs +177 -0
  82. package/system/dist/capability-definition-HCmTem8c.js +242 -0
  83. package/system/dist/{capture-engine-BcuwOSXv.js → capture-engine-DZ0LIUqA.js} +5 -4
  84. package/system/dist/{capture-engine-Bz7eXFjT.mjs → capture-engine-DiwbjoWp.mjs} +2 -1
  85. package/system/dist/command-origin-claim-Cief660O.js +35 -0
  86. package/system/dist/command-origin-claim-D1Wy7Qld.mjs +24 -0
  87. package/system/dist/composition-sources-Caqv7O7z.mjs +391 -0
  88. package/system/dist/composition-sources-CgnHjm8Q.js +408 -0
  89. package/system/dist/{constants-D2etJ02O.js → constants-Ba3FTIHl.js} +1 -1
  90. package/system/dist/constants-C860Y6U4.js +26 -0
  91. package/system/dist/{constants-BcUTQd1M.mjs → constants-DB4piTD5.mjs} +1 -1
  92. package/system/dist/constants-DCLpoF4L.mjs +21 -0
  93. package/system/dist/coral-accelerators-7o8hqvcN.js +564 -0
  94. package/system/dist/coral-accelerators-BKcXP59c.mjs +521 -0
  95. package/system/dist/core-blocks.cap-C6iKAZ-x.mjs +17986 -0
  96. package/system/dist/core-blocks.cap-LEMqVwxO.js +18705 -0
  97. package/system/dist/custom-actions-BFUSalC9.mjs +25 -0
  98. package/system/dist/custom-actions-D92NRi2c.js +36 -0
  99. package/system/dist/database-snapshot.cap-DF38e-0P.js +162 -0
  100. package/system/dist/database-snapshot.cap-dhrc9xnY.mjs +133 -0
  101. package/system/dist/declared-device-BWphj9WE.js +303 -0
  102. package/system/dist/declared-device-CKERA1Hi.mjs +286 -0
  103. package/system/dist/{device-ca-ExMN3xW3.mjs → device-ca-BLM6fccc.mjs} +2 -1
  104. package/system/dist/{device-ca-CU8zh9Pi.js → device-ca-C5kJE6mL.js} +7 -6
  105. package/system/dist/device-certificate-Cddm4Idn.mjs +91 -0
  106. package/system/dist/device-certificate-CguVACQO.js +162 -0
  107. package/system/dist/device-identifiers-BQg9EQi1.js +600 -0
  108. package/system/dist/device-identifiers-iSuQCKmK.mjs +529 -0
  109. package/system/dist/device-kind-BJ2pfsjw.mjs +78 -0
  110. package/system/dist/device-kind-CsSiv_YF.js +101 -0
  111. package/system/dist/device-manager.cap-2abwVLCM.js +2874 -0
  112. package/system/dist/device-manager.cap-CFZSPfUh.mjs +2749 -0
  113. package/system/dist/device-provider.cap-3Uvk6f5-.mjs +331 -0
  114. package/system/dist/device-provider.cap-D7TV2kVH.js +366 -0
  115. package/system/dist/{device-row-store-CeW_GWh9.mjs → device-row-store-YF3jtmkk.mjs} +4 -1
  116. package/system/dist/{device-row-store-BMIR-n3m.js → device-row-store-doTfMOqn.js} +12 -9
  117. package/system/dist/device-transitions.cap-B5w5PYU_.js +860 -0
  118. package/system/dist/device-transitions.cap-DojcwEuX.mjs +819 -0
  119. package/system/dist/device-type-CbQsnFdC.js +477 -0
  120. package/system/dist/device-type-DgEvK3ch.mjs +454 -0
  121. package/system/dist/entry-kind-D9MuVJCK.mjs +44 -0
  122. package/system/dist/entry-kind-cq90c--V.js +55 -0
  123. package/system/dist/error.cap-CSM_SRfR.mjs +3423 -0
  124. package/system/dist/error.cap-DBhgPeWK.js +3848 -0
  125. package/system/dist/file-host-worker.js +1 -1
  126. package/system/dist/file-host-worker.mjs +1 -1
  127. package/system/dist/history-catalog-BKRarIL_.js +831 -0
  128. package/system/dist/history-catalog-BwTeQ4Mr.mjs +802 -0
  129. package/system/dist/{hub-identity-Csxx2Q8k.js → hub-identity-BMdR3Mw9.js} +2 -2
  130. package/system/dist/{hub-identity-BBXzP6Ve.mjs → hub-identity-DjMN9Ac2.mjs} +1 -1
  131. package/system/dist/{hub-mdns-ciao-By5577HM.js → hub-mdns-ciao--0v1TKME.js} +5 -5
  132. package/system/dist/{hub-mdns-ciao-DG17NbGU.mjs → hub-mdns-ciao-DBrtHOcc.mjs} +2 -2
  133. package/system/dist/index.js +763 -151
  134. package/system/dist/index.mjs +624 -12
  135. package/system/dist/integration-instances.cap-Cl9O-k4h.mjs +538 -0
  136. package/system/dist/integration-instances.cap-dJIxg2_s.js +549 -0
  137. package/system/dist/keychain-admin.cap-Db_oFX4H.js +425 -0
  138. package/system/dist/keychain-admin.cap-GtM7gVGG.mjs +396 -0
  139. package/system/dist/l10n-Bu6aUvSY.mjs +10 -0
  140. package/system/dist/l10n-CGMvp7NF.js +15 -0
  141. package/system/dist/labels-DX5S8deC.js +81 -0
  142. package/system/dist/labels-DsBcU7md.mjs +64 -0
  143. package/system/dist/{legacy-integration-rows-door-CVwOo5aq.js → legacy-integration-rows-door-B1nzxxr5.js} +2 -2
  144. package/system/dist/{legacy-integration-rows-door-D9tQOUzh.mjs → legacy-integration-rows-door-nTvo_6jQ.mjs} +1 -1
  145. package/system/dist/log-destination.cap-CxZzAVaR.mjs +143 -0
  146. package/system/dist/log-destination.cap-DELPJkZ0.js +148 -0
  147. package/system/dist/low-power-sleep.cap-7lfVU41N.js +103 -0
  148. package/system/dist/low-power-sleep.cap-tGPmaZ_V.mjs +92 -0
  149. package/system/dist/mask-shape-Ci8Co9w0.mjs +57 -0
  150. package/system/dist/mask-shape-CmPA2fst.js +92 -0
  151. package/system/dist/metrics-provider.cap-BNmcHDkQ.mjs +405 -0
  152. package/system/dist/metrics-provider.cap-BcmQUt6l.js +410 -0
  153. package/system/dist/migration-BMjgkyG2.js +380 -0
  154. package/system/dist/migration-DRJAtdy7.mjs +321 -0
  155. package/system/dist/network-access.cap-B5TWLDCC.js +1099 -0
  156. package/system/dist/network-access.cap-BJnGbE6n.mjs +1004 -0
  157. package/system/dist/notification-rules.cap-B__YBgnG.js +3422 -0
  158. package/system/dist/notification-rules.cap-D9ArZlwx.mjs +3357 -0
  159. package/system/dist/ops-log-CB4pIdqi.mjs +64 -0
  160. package/system/dist/ops-log-pxt9176Z.js +81 -0
  161. package/system/dist/pinned-binary-BOhOSNff.js +28 -0
  162. package/system/dist/pinned-binary-CrIRAi4G.mjs +23 -0
  163. package/system/dist/platform-probe.cap-1WrMhWHx.js +250 -0
  164. package/system/dist/platform-probe.cap-BFeqFLtQ.mjs +233 -0
  165. package/system/dist/prefix-walk-B4b2-9aK.mjs +790 -0
  166. package/system/dist/prefix-walk-DC0ljmbB.js +843 -0
  167. package/system/dist/ptz-autotrack.cap-BW7w0zHD.js +229 -0
  168. package/system/dist/ptz-autotrack.cap-DT2GypXw.mjs +224 -0
  169. package/system/dist/quantity-D3g5SxsZ.mjs +114 -0
  170. package/system/dist/quantity-lY1KiTSZ.js +143 -0
  171. package/system/dist/raw-secret-migration-DxuBFtvi.js +50 -0
  172. package/system/dist/raw-secret-migration-iv88mLoc.mjs +39 -0
  173. package/system/dist/record-entries.cap-sMUhTvTU.mjs +75 -0
  174. package/system/dist/record-entries.cap-ti1C046R.js +80 -0
  175. package/system/dist/record-kind-DoBfYHCs.js +203 -0
  176. package/system/dist/record-kind-ub6NXqfh.mjs +162 -0
  177. package/system/dist/recording-archive.cap-7OrIn9e5.mjs +1299 -0
  178. package/system/dist/recording-archive.cap-D7bo-QSM.js +1328 -0
  179. package/system/dist/records.cap-ClcWV64i.js +329 -0
  180. package/system/dist/records.cap-CwLT2ByG.mjs +294 -0
  181. package/system/dist/relocate-CdVQAk-w.js +804 -0
  182. package/system/dist/relocate-CoZZTui1.mjs +661 -0
  183. package/system/dist/rename-composition-block-7WIICIDq.mjs +33525 -0
  184. package/system/dist/rename-composition-block-CcWLwVhG.js +34692 -0
  185. package/system/dist/{restore-archive-kwtBd00M.mjs → restore-archive-CjAyKpgX.mjs} +3 -1
  186. package/system/dist/{restore-archive-CIFvqOze.js → restore-archive-CkTkv3Ss.js} +6 -4
  187. package/system/dist/scoped-settings-CylSSq_8.js +955 -0
  188. package/system/dist/scoped-settings-DVWUIP7Z.mjs +650 -0
  189. package/system/dist/server-name-BIhLuHvX.mjs +35 -0
  190. package/system/dist/server-name-OALNvpqC.js +52 -0
  191. package/system/dist/settings-store.cap-Ci4F2zul.mjs +569 -0
  192. package/system/dist/settings-store.cap-wlJhCspr.js +640 -0
  193. package/system/dist/snapshot.cap-3suPdBHV.js +250 -0
  194. package/system/dist/snapshot.cap-Bs8Oyaqh.mjs +245 -0
  195. package/system/dist/source-info-DGB7SdB_.mjs +190 -0
  196. package/system/dist/source-info-DtWf4k2j.js +225 -0
  197. package/system/dist/storage-admin.cap-BSv1NjKJ.mjs +883 -0
  198. package/system/dist/storage-admin.cap-he0OqvVM.js +906 -0
  199. package/system/dist/storage-location-CBT8GCD6.mjs +163 -0
  200. package/system/dist/storage-location-CTweDMZf.js +198 -0
  201. package/system/dist/storage-location-mode-B21UVRRX.mjs +167 -0
  202. package/system/dist/storage-location-mode-CS4sMzo-.js +232 -0
  203. package/system/dist/storage-migration.cap-CyyATY_p.js +330 -0
  204. package/system/dist/storage-migration.cap-D7QqGobp.mjs +313 -0
  205. package/system/dist/storage-occupancy.cap-2rmnS58Z.js +622 -0
  206. package/system/dist/storage-occupancy.cap-CqBztTl9.mjs +611 -0
  207. package/system/dist/storage-provider.cap-Bw0CfxVc.js +213 -0
  208. package/system/dist/storage-provider.cap-CMeck2w4.mjs +202 -0
  209. package/system/dist/stream-catalog.cap-Bp7SkgIf.mjs +6560 -0
  210. package/system/dist/stream-catalog.cap-D3uwePiA.js +6763 -0
  211. package/system/dist/streaming-shared-B8cXatuU.mjs +431 -0
  212. package/system/dist/streaming-shared-DQwFZOSi.js +526 -0
  213. package/system/dist/system-reasons-Be_k1W8g.js +25 -0
  214. package/system/dist/system-reasons-CYj4qwyS.mjs +20 -0
  215. package/system/dist/tag-BxLazvVb.js +2138 -0
  216. package/system/dist/tag-uZBAq6ox.mjs +2073 -0
  217. package/system/dist/user-management.cap-B9QDu8NE.js +825 -0
  218. package/system/dist/user-management.cap-DBIi77sB.mjs +766 -0
  219. package/system/dist/vector-store.cap-DnyfrYDn.js +330 -0
  220. package/system/dist/vector-store.cap-h2GHWQ1t.mjs +319 -0
  221. package/system/dist/{wal-maintenance-CTrCPzds.mjs → wal-maintenance-BG01rOn9.mjs} +0 -0
  222. package/system/dist/{wal-maintenance-dq7T3quB.js → wal-maintenance-DyrebYKF.js} +0 -0
  223. package/system/dist/zod-secret-DS7mj1bk.js +78 -0
  224. package/system/dist/zod-secret-zY4nM61M.mjs +73 -0
  225. package/system/package.json +1 -1
  226. package/system/dist/composition-sources-BI614LJx.mjs +0 -141
  227. package/system/dist/composition-sources-v_kkb8A9.js +0 -152
  228. package/system/dist/coral-accelerators-BSVsBVzt.js +0 -250
  229. package/system/dist/coral-accelerators-DBlgWB8k.mjs +0 -231
  230. package/system/dist/dist-BCHMSqzc.mjs +0 -143467
  231. package/system/dist/dist-BZfvhfS1.js +0 -146970
  232. package/system/dist/prefix-walk-DAOBSyH1.mjs +0 -88
  233. package/system/dist/prefix-walk-Dv6MLZlM.js +0 -99
  234. package/system/dist/rename-composition-block-C9HuBrKS.js +0 -112
  235. package/system/dist/rename-composition-block-DtaYmYAR.mjs +0 -101
@@ -0,0 +1,250 @@
1
+ const require_capability_definition = require("./capability-definition-HCmTem8c.js");
2
+ const require_device_type = require("./device-type-CbQsnFdC.js");
3
+ const require_l10n = require("./l10n-CGMvp7NF.js");
4
+ let zod = require("zod");
5
+ //#region ../types/dist/esm/capabilities/snapshot.cap.mjs
6
+ /**
7
+ * A single device snapshot returned as base64 JPEG/PNG.
8
+ *
9
+ * The `SnapshotAddon` wrapper returns this shape whether the frame came from
10
+ * the device-native provider (onboard capture) or from the stream-broker
11
+ * prebuffer fallback.
12
+ */
13
+ var SnapshotImageSchema = /* @__PURE__ */ zod.z.object({
14
+ base64: /* @__PURE__ */ zod.z.string(),
15
+ contentType: /* @__PURE__ */ zod.z.string()
16
+ });
17
+ /**
18
+ * snapshot — device-scoped capability for camera image capture.
19
+ *
20
+ * Two kinds of providers coexist behind this cap name:
21
+ *
22
+ * - **Native** providers (kind:'native'): registered per-device by
23
+ * device-driver addons (RtspCamera, OnvifCamera, …) via
24
+ * `DeviceContext.registerNativeCap`. Each knows how to fetch a frame
25
+ * straight from the camera (HTTP snapshot URL, ONVIF action, etc.).
26
+ *
27
+ * - **Wrapper** providers (kind:'wrapper'): register as a system
28
+ * provider (SnapshotAddon in `@camstack/server/system/builtins/snapshot`). The
29
+ * wrapper owns the cache and invokes the native via
30
+ * `ctx.getNativeProvider(snapshotCapability, deviceId)` on miss.
31
+ *
32
+ * Device-scoped routing: callers use `ctx.fetchDevice(id).snapshot.*`;
33
+ * the DeviceProxy auto-injects `deviceId` + `nodeId` and dispatches to
34
+ * the provider currently active for that device (wrapper wins when
35
+ * activated via `setWrapperActive`, otherwise the native).
36
+ */
37
+ /**
38
+ * Live readable snapshot state — diagnostic info that a consumer can
39
+ * pull to know when the last image was captured, how stale the cache
40
+ * is, and which stream was used. Distinct from `getSnapshot` which
41
+ * returns the JPEG itself.
42
+ */
43
+ var SnapshotStatusSchema = /* @__PURE__ */ zod.z.object({
44
+ /** Ms epoch of the last successful capture. Null if none yet. */
45
+ lastCapturedAt: /* @__PURE__ */ zod.z.number().nullable(),
46
+ /** Age of the cached image in ms. Null if no cache. */
47
+ cacheAgeMs: /* @__PURE__ */ zod.z.number().nullable(),
48
+ /** Size in bytes of the last captured image. Null if no capture. */
49
+ lastBytes: /* @__PURE__ */ zod.z.number().nullable(),
50
+ /** Stream id used for the last capture ('high'|'mid'|'low' or custom). Null if via HTTP endpoint. */
51
+ lastStreamId: /* @__PURE__ */ zod.z.string().nullable()
52
+ });
53
+ var snapshotCapability = {
54
+ name: "snapshot",
55
+ scope: "device",
56
+ deviceNative: true,
57
+ mode: "singleton",
58
+ kind: "wrapper",
59
+ defaultActive: true,
60
+ deviceTypes: [require_device_type.DeviceType.Camera],
61
+ exposesDeviceSettings: true,
62
+ methods: {
63
+ getSnapshot: /* @__PURE__ */ require_capability_definition.method(/* @__PURE__ */ zod.z.object({
64
+ deviceId: /* @__PURE__ */ zod.z.number(),
65
+ streamId: /* @__PURE__ */ zod.z.string().optional(),
66
+ /**
67
+ * Bypass the cache freshness check and fetch directly from the
68
+ * native (or stream-broker fallback). Triggered by the UI's
69
+ * "refresh" button so an operator can force a fresh frame
70
+ * even when the cache is well within the device's
71
+ * `snapshotMaxAgeS` window.
72
+ *
73
+ * **`force` is a demand with a named principal, not a freshness
74
+ * preference** — an operator button, the scheduled refresh (D847), or a
75
+ * notification rule that left the camera's wake allowed (D998). On a
76
+ * battery camera it is the one thing that walks past the wrapper's
77
+ * sleep gate and wakes the camera, so a poller, a thumbnail or a
78
+ * prestream must NEVER set it. Every such caller
79
+ * gets the cached frame, which on a sleeping battery camera is the
80
+ * correct answer: stale but honest beats woken.
81
+ */
82
+ force: /* @__PURE__ */ zod.z.boolean().optional()
83
+ }), /* @__PURE__ */ SnapshotImageSchema.nullable()),
84
+ invalidateCache: /* @__PURE__ */ require_capability_definition.method(/* @__PURE__ */ zod.z.object({ deviceId: /* @__PURE__ */ zod.z.number() }), /* @__PURE__ */ zod.z.void(), {
85
+ kind: "mutation",
86
+ auth: "admin"
87
+ }),
88
+ /**
89
+ * Cache-only batch overview — answers from the wrapper's in-memory cache in
90
+ * O(n) and NEVER triggers a capture. Lets a grid skip requesting images for
91
+ * devices that never produced a frame, and gives it an ETag per device for
92
+ * conditional (304-able) image fetches. `lastCapturedAt`/`cacheAgeMs`/`etag`
93
+ * are null for a device with no cached frame.
94
+ */
95
+ getSnapshotOverview: /* @__PURE__ */ require_capability_definition.systemMethod(/* @__PURE__ */ zod.z.object({ deviceIds: /* @__PURE__ */ zod.z.array(/* @__PURE__ */ zod.z.number()).min(1).max(200) }), /* @__PURE__ */ zod.z.array(/* @__PURE__ */ zod.z.object({
96
+ deviceId: /* @__PURE__ */ zod.z.number(),
97
+ lastCapturedAt: /* @__PURE__ */ zod.z.number().nullable(),
98
+ cacheAgeMs: /* @__PURE__ */ zod.z.number().nullable(),
99
+ etag: /* @__PURE__ */ zod.z.string().nullable()
100
+ }))),
101
+ /**
102
+ * The full decision chain for ONE device, for the viewer's debug readout —
103
+ * the answer to "why does this tile show what it shows" in a single poll:
104
+ * the battery slice the state was derived from, the resolved state + its
105
+ * reason, the cached frame's identity/age, whether a wake window is open,
106
+ * and whether a fresh capture is in flight. Cache-only and capture-free:
107
+ * a debug read must never wake a battery camera.
108
+ */
109
+ getDebugState: /* @__PURE__ */ require_capability_definition.systemMethod(/* @__PURE__ */ zod.z.object({ deviceId: /* @__PURE__ */ zod.z.number() }), /* @__PURE__ */ zod.z.object({
110
+ /** The battery slice as read, or null when the device has none. */
111
+ battery: /* @__PURE__ */ zod.z.object({
112
+ sleeping: /* @__PURE__ */ zod.z.boolean(),
113
+ lastUpdated: /* @__PURE__ */ zod.z.number(),
114
+ lastContactAt: /* @__PURE__ */ zod.z.number().optional()
115
+ }).nullable(),
116
+ /** The resolved snapshot state (what the overlay decision used). */
117
+ state: /* @__PURE__ */ zod.z.object({
118
+ isBattery: /* @__PURE__ */ zod.z.boolean(),
119
+ reason: /* @__PURE__ */ zod.z.enum([
120
+ "disabled",
121
+ "offline",
122
+ "sleeping",
123
+ "unreachable",
124
+ "waking"
125
+ ]).nullable()
126
+ }),
127
+ /** The cached frame behind the next paint. */
128
+ frame: /* @__PURE__ */ zod.z.object({
129
+ capturedAt: /* @__PURE__ */ zod.z.number().nullable(),
130
+ ageMs: /* @__PURE__ */ zod.z.number().nullable()
131
+ }),
132
+ /** A wake window is currently open (the Waking overlay's source). */
133
+ waking: /* @__PURE__ */ zod.z.boolean()
134
+ })),
135
+ /**
136
+ * Signed, expiring links to a CLIENT-SIZED frame — and the demand signal
137
+ * that makes those frames current.
138
+ *
139
+ * ## The problem it replaces
140
+ *
141
+ * `getSnapshotOverview` is cache-only by contract: it answers from whatever
142
+ * the wrapper happens to hold and never captures. Under D93 the client
143
+ * versions its image URL on that answer, and an image REQUEST was the only
144
+ * demand signal. Both of those are satisfiable by the client's own image
145
+ * cache — `expo-image` is URL-keyed and never revalidates — so a URL painted
146
+ * in a previous session comes off disk with no network, no demand, and no
147
+ * capture. Measured on the live hub: reopening after two minutes idle
148
+ * painted 15 of 16 tiles at **168 s old** with zero HTTP requests, and the
149
+ * fleet only recovered because a later poll happened to observe a different
150
+ * identity.
151
+ *
152
+ * ## The two properties that fix it
153
+ *
154
+ * **It is an RPC, so no client cache can answer it.** The demand signal
155
+ * always reaches the wrapper. This method therefore CAPTURES, where
156
+ * `getSnapshotOverview` must never (D93) — the distinction is not "one is
157
+ * newer" but that the overview poll is app-wide (a capturing overview would
158
+ * dial every camera on the install) while this is called by a rendered
159
+ * surface naming the tiles it is actually painting, at the width it is
160
+ * painting them.
161
+ *
162
+ * Since 2026-08-11 this is the ONLY thing that refreshes a snapshot: the
163
+ * server-side keep-warm loop was removed (operator directive — on-demand,
164
+ * always), so a camera nobody is looking at costs nothing at all.
165
+ *
166
+ * **It waits, briefly and boundedly, for the capture it triggered.** The
167
+ * returned `capturedAt` is the frame the link will serve, not the frame the
168
+ * cache held when the client asked, so a first paint is honest and current
169
+ * instead of a generation behind. A device that does not settle inside the
170
+ * bound still gets a link and its real (older) `capturedAt` — the next poll
171
+ * carries it forward.
172
+ *
173
+ * `force` is never set on behalf of a client here. A sleeping battery camera
174
+ * is reported with `sleeping: true` and the last frame it produced, however
175
+ * old; the wrapper's existing sleep gate owns that decision and this method
176
+ * adds no second one.
177
+ */
178
+ getSnapshotLinks: /* @__PURE__ */ require_capability_definition.systemMethod(/* @__PURE__ */ zod.z.object({
179
+ /** The tiles a surface is actually rendering. One entry per (device,
180
+ * width) the caller will paint — the width is snapped to the server's
181
+ * ladder and becomes part of the link's SIGNED identity. */
182
+ targets: /* @__PURE__ */ zod.z.array(/* @__PURE__ */ zod.z.object({
183
+ deviceId: /* @__PURE__ */ zod.z.number(),
184
+ /** Target width in px. Omit for the frame as captured — correct
185
+ * for a full-bleed surface, wrong (and expensive) for a grid. */
186
+ width: /* @__PURE__ */ zod.z.number().int().positive().optional()
187
+ })).min(1).max(200) }), /* @__PURE__ */ zod.z.array(/* @__PURE__ */ zod.z.object({
188
+ deviceId: /* @__PURE__ */ zod.z.number(),
189
+ /** Root-relative signed path, or null when the link plane is not
190
+ * served (no data-plane facility). Present even for a device that has
191
+ * never captured — the request is what triggers the first one (D94). */
192
+ url: /* @__PURE__ */ zod.z.string().nullable(),
193
+ /** Epoch ms of the frame this link serves. Null = never captured.
194
+ * THE honest age: the tRPC path carried none before this. */
195
+ capturedAt: /* @__PURE__ */ zod.z.number().nullable(),
196
+ /** Age of that frame at the moment the answer was built. */
197
+ ageMs: /* @__PURE__ */ zod.z.number().nullable(),
198
+ /** Epoch ms after which `url` stops verifying. */
199
+ expiresAt: /* @__PURE__ */ zod.z.number().nullable(),
200
+ /** Ladder rung the bytes are at; null = the frame as captured. */
201
+ width: /* @__PURE__ */ zod.z.number().nullable(),
202
+ /** The device has never produced a frame. An empty state, not a
203
+ * failure — and never a reason to withhold the link (D94). */
204
+ neverCaptured: /* @__PURE__ */ zod.z.boolean(),
205
+ /** A sleeping battery camera: the frame is deliberately stale and will
206
+ * NOT refresh in the background. A surface should say so rather than
207
+ * present it as current. */
208
+ sleeping: /* @__PURE__ */ zod.z.boolean(),
209
+ /** Current device state rendered over the cached frame. State images
210
+ * remain authoritative even when their photographic background is
211
+ * old; null means the link must carry a current camera frame.
212
+ *
213
+ * **This is the ONLY source a surface may derive an inactive tile
214
+ * from.** A client that reads a device's `online`/`disabled` flags and
215
+ * draws its own verdict will disagree with the pixels it is painting
216
+ * — the frame comes from here, and so must the sentence over it
217
+ * (D190). Pair with `ageMs` for the age of the photograph behind the
218
+ * state. */
219
+ stateReason: /* @__PURE__ */ zod.z.enum([
220
+ "disabled",
221
+ "offline",
222
+ "sleeping",
223
+ "unreachable",
224
+ "waking"
225
+ ]).nullable(),
226
+ /** A battery camera (whatever its current state). An AWAKE battery
227
+ * camera is deliberately NOT recaptured on the poll cadence — every
228
+ * capture is a camera hit that would keep it out of sleep — so its
229
+ * cached frame legitimately ages past the currency ceiling while
230
+ * nothing is streaming. A surface must keep painting it (a fresh
231
+ * frame is captured at each wake), not blank to "unavailable". */
232
+ battery: /* @__PURE__ */ zod.z.boolean()
233
+ })))
234
+ },
235
+ status: {
236
+ schema: SnapshotStatusSchema,
237
+ kind: "poll"
238
+ },
239
+ vocabulary: {
240
+ noun: /* @__PURE__ */ require_l10n.t("Snapshot", "Istantanea"),
241
+ order: 3290
242
+ }
243
+ };
244
+ //#endregion
245
+ Object.defineProperty(exports, "snapshotCapability", {
246
+ enumerable: true,
247
+ get: function() {
248
+ return snapshotCapability;
249
+ }
250
+ });
@@ -0,0 +1,245 @@
1
+ import { c as method, d as systemMethod } from "./capability-definition-C2rJdVeX.mjs";
2
+ import { r as DeviceType } from "./device-type-DgEvK3ch.mjs";
3
+ import { t } from "./l10n-Bu6aUvSY.mjs";
4
+ import { z } from "zod";
5
+ //#region ../types/dist/esm/capabilities/snapshot.cap.mjs
6
+ /**
7
+ * A single device snapshot returned as base64 JPEG/PNG.
8
+ *
9
+ * The `SnapshotAddon` wrapper returns this shape whether the frame came from
10
+ * the device-native provider (onboard capture) or from the stream-broker
11
+ * prebuffer fallback.
12
+ */
13
+ var SnapshotImageSchema = /* @__PURE__ */ z.object({
14
+ base64: /* @__PURE__ */ z.string(),
15
+ contentType: /* @__PURE__ */ z.string()
16
+ });
17
+ /**
18
+ * snapshot — device-scoped capability for camera image capture.
19
+ *
20
+ * Two kinds of providers coexist behind this cap name:
21
+ *
22
+ * - **Native** providers (kind:'native'): registered per-device by
23
+ * device-driver addons (RtspCamera, OnvifCamera, …) via
24
+ * `DeviceContext.registerNativeCap`. Each knows how to fetch a frame
25
+ * straight from the camera (HTTP snapshot URL, ONVIF action, etc.).
26
+ *
27
+ * - **Wrapper** providers (kind:'wrapper'): register as a system
28
+ * provider (SnapshotAddon in `@camstack/server/system/builtins/snapshot`). The
29
+ * wrapper owns the cache and invokes the native via
30
+ * `ctx.getNativeProvider(snapshotCapability, deviceId)` on miss.
31
+ *
32
+ * Device-scoped routing: callers use `ctx.fetchDevice(id).snapshot.*`;
33
+ * the DeviceProxy auto-injects `deviceId` + `nodeId` and dispatches to
34
+ * the provider currently active for that device (wrapper wins when
35
+ * activated via `setWrapperActive`, otherwise the native).
36
+ */
37
+ /**
38
+ * Live readable snapshot state — diagnostic info that a consumer can
39
+ * pull to know when the last image was captured, how stale the cache
40
+ * is, and which stream was used. Distinct from `getSnapshot` which
41
+ * returns the JPEG itself.
42
+ */
43
+ var SnapshotStatusSchema = /* @__PURE__ */ z.object({
44
+ /** Ms epoch of the last successful capture. Null if none yet. */
45
+ lastCapturedAt: /* @__PURE__ */ z.number().nullable(),
46
+ /** Age of the cached image in ms. Null if no cache. */
47
+ cacheAgeMs: /* @__PURE__ */ z.number().nullable(),
48
+ /** Size in bytes of the last captured image. Null if no capture. */
49
+ lastBytes: /* @__PURE__ */ z.number().nullable(),
50
+ /** Stream id used for the last capture ('high'|'mid'|'low' or custom). Null if via HTTP endpoint. */
51
+ lastStreamId: /* @__PURE__ */ z.string().nullable()
52
+ });
53
+ var snapshotCapability = {
54
+ name: "snapshot",
55
+ scope: "device",
56
+ deviceNative: true,
57
+ mode: "singleton",
58
+ kind: "wrapper",
59
+ defaultActive: true,
60
+ deviceTypes: [DeviceType.Camera],
61
+ exposesDeviceSettings: true,
62
+ methods: {
63
+ getSnapshot: /* @__PURE__ */ method(/* @__PURE__ */ z.object({
64
+ deviceId: /* @__PURE__ */ z.number(),
65
+ streamId: /* @__PURE__ */ z.string().optional(),
66
+ /**
67
+ * Bypass the cache freshness check and fetch directly from the
68
+ * native (or stream-broker fallback). Triggered by the UI's
69
+ * "refresh" button so an operator can force a fresh frame
70
+ * even when the cache is well within the device's
71
+ * `snapshotMaxAgeS` window.
72
+ *
73
+ * **`force` is a demand with a named principal, not a freshness
74
+ * preference** — an operator button, the scheduled refresh (D847), or a
75
+ * notification rule that left the camera's wake allowed (D998). On a
76
+ * battery camera it is the one thing that walks past the wrapper's
77
+ * sleep gate and wakes the camera, so a poller, a thumbnail or a
78
+ * prestream must NEVER set it. Every such caller
79
+ * gets the cached frame, which on a sleeping battery camera is the
80
+ * correct answer: stale but honest beats woken.
81
+ */
82
+ force: /* @__PURE__ */ z.boolean().optional()
83
+ }), /* @__PURE__ */ SnapshotImageSchema.nullable()),
84
+ invalidateCache: /* @__PURE__ */ method(/* @__PURE__ */ z.object({ deviceId: /* @__PURE__ */ z.number() }), /* @__PURE__ */ z.void(), {
85
+ kind: "mutation",
86
+ auth: "admin"
87
+ }),
88
+ /**
89
+ * Cache-only batch overview — answers from the wrapper's in-memory cache in
90
+ * O(n) and NEVER triggers a capture. Lets a grid skip requesting images for
91
+ * devices that never produced a frame, and gives it an ETag per device for
92
+ * conditional (304-able) image fetches. `lastCapturedAt`/`cacheAgeMs`/`etag`
93
+ * are null for a device with no cached frame.
94
+ */
95
+ getSnapshotOverview: /* @__PURE__ */ systemMethod(/* @__PURE__ */ z.object({ deviceIds: /* @__PURE__ */ z.array(/* @__PURE__ */ z.number()).min(1).max(200) }), /* @__PURE__ */ z.array(/* @__PURE__ */ z.object({
96
+ deviceId: /* @__PURE__ */ z.number(),
97
+ lastCapturedAt: /* @__PURE__ */ z.number().nullable(),
98
+ cacheAgeMs: /* @__PURE__ */ z.number().nullable(),
99
+ etag: /* @__PURE__ */ z.string().nullable()
100
+ }))),
101
+ /**
102
+ * The full decision chain for ONE device, for the viewer's debug readout —
103
+ * the answer to "why does this tile show what it shows" in a single poll:
104
+ * the battery slice the state was derived from, the resolved state + its
105
+ * reason, the cached frame's identity/age, whether a wake window is open,
106
+ * and whether a fresh capture is in flight. Cache-only and capture-free:
107
+ * a debug read must never wake a battery camera.
108
+ */
109
+ getDebugState: /* @__PURE__ */ systemMethod(/* @__PURE__ */ z.object({ deviceId: /* @__PURE__ */ z.number() }), /* @__PURE__ */ z.object({
110
+ /** The battery slice as read, or null when the device has none. */
111
+ battery: /* @__PURE__ */ z.object({
112
+ sleeping: /* @__PURE__ */ z.boolean(),
113
+ lastUpdated: /* @__PURE__ */ z.number(),
114
+ lastContactAt: /* @__PURE__ */ z.number().optional()
115
+ }).nullable(),
116
+ /** The resolved snapshot state (what the overlay decision used). */
117
+ state: /* @__PURE__ */ z.object({
118
+ isBattery: /* @__PURE__ */ z.boolean(),
119
+ reason: /* @__PURE__ */ z.enum([
120
+ "disabled",
121
+ "offline",
122
+ "sleeping",
123
+ "unreachable",
124
+ "waking"
125
+ ]).nullable()
126
+ }),
127
+ /** The cached frame behind the next paint. */
128
+ frame: /* @__PURE__ */ z.object({
129
+ capturedAt: /* @__PURE__ */ z.number().nullable(),
130
+ ageMs: /* @__PURE__ */ z.number().nullable()
131
+ }),
132
+ /** A wake window is currently open (the Waking overlay's source). */
133
+ waking: /* @__PURE__ */ z.boolean()
134
+ })),
135
+ /**
136
+ * Signed, expiring links to a CLIENT-SIZED frame — and the demand signal
137
+ * that makes those frames current.
138
+ *
139
+ * ## The problem it replaces
140
+ *
141
+ * `getSnapshotOverview` is cache-only by contract: it answers from whatever
142
+ * the wrapper happens to hold and never captures. Under D93 the client
143
+ * versions its image URL on that answer, and an image REQUEST was the only
144
+ * demand signal. Both of those are satisfiable by the client's own image
145
+ * cache — `expo-image` is URL-keyed and never revalidates — so a URL painted
146
+ * in a previous session comes off disk with no network, no demand, and no
147
+ * capture. Measured on the live hub: reopening after two minutes idle
148
+ * painted 15 of 16 tiles at **168 s old** with zero HTTP requests, and the
149
+ * fleet only recovered because a later poll happened to observe a different
150
+ * identity.
151
+ *
152
+ * ## The two properties that fix it
153
+ *
154
+ * **It is an RPC, so no client cache can answer it.** The demand signal
155
+ * always reaches the wrapper. This method therefore CAPTURES, where
156
+ * `getSnapshotOverview` must never (D93) — the distinction is not "one is
157
+ * newer" but that the overview poll is app-wide (a capturing overview would
158
+ * dial every camera on the install) while this is called by a rendered
159
+ * surface naming the tiles it is actually painting, at the width it is
160
+ * painting them.
161
+ *
162
+ * Since 2026-08-11 this is the ONLY thing that refreshes a snapshot: the
163
+ * server-side keep-warm loop was removed (operator directive — on-demand,
164
+ * always), so a camera nobody is looking at costs nothing at all.
165
+ *
166
+ * **It waits, briefly and boundedly, for the capture it triggered.** The
167
+ * returned `capturedAt` is the frame the link will serve, not the frame the
168
+ * cache held when the client asked, so a first paint is honest and current
169
+ * instead of a generation behind. A device that does not settle inside the
170
+ * bound still gets a link and its real (older) `capturedAt` — the next poll
171
+ * carries it forward.
172
+ *
173
+ * `force` is never set on behalf of a client here. A sleeping battery camera
174
+ * is reported with `sleeping: true` and the last frame it produced, however
175
+ * old; the wrapper's existing sleep gate owns that decision and this method
176
+ * adds no second one.
177
+ */
178
+ getSnapshotLinks: /* @__PURE__ */ systemMethod(/* @__PURE__ */ z.object({
179
+ /** The tiles a surface is actually rendering. One entry per (device,
180
+ * width) the caller will paint — the width is snapped to the server's
181
+ * ladder and becomes part of the link's SIGNED identity. */
182
+ targets: /* @__PURE__ */ z.array(/* @__PURE__ */ z.object({
183
+ deviceId: /* @__PURE__ */ z.number(),
184
+ /** Target width in px. Omit for the frame as captured — correct
185
+ * for a full-bleed surface, wrong (and expensive) for a grid. */
186
+ width: /* @__PURE__ */ z.number().int().positive().optional()
187
+ })).min(1).max(200) }), /* @__PURE__ */ z.array(/* @__PURE__ */ z.object({
188
+ deviceId: /* @__PURE__ */ z.number(),
189
+ /** Root-relative signed path, or null when the link plane is not
190
+ * served (no data-plane facility). Present even for a device that has
191
+ * never captured — the request is what triggers the first one (D94). */
192
+ url: /* @__PURE__ */ z.string().nullable(),
193
+ /** Epoch ms of the frame this link serves. Null = never captured.
194
+ * THE honest age: the tRPC path carried none before this. */
195
+ capturedAt: /* @__PURE__ */ z.number().nullable(),
196
+ /** Age of that frame at the moment the answer was built. */
197
+ ageMs: /* @__PURE__ */ z.number().nullable(),
198
+ /** Epoch ms after which `url` stops verifying. */
199
+ expiresAt: /* @__PURE__ */ z.number().nullable(),
200
+ /** Ladder rung the bytes are at; null = the frame as captured. */
201
+ width: /* @__PURE__ */ z.number().nullable(),
202
+ /** The device has never produced a frame. An empty state, not a
203
+ * failure — and never a reason to withhold the link (D94). */
204
+ neverCaptured: /* @__PURE__ */ z.boolean(),
205
+ /** A sleeping battery camera: the frame is deliberately stale and will
206
+ * NOT refresh in the background. A surface should say so rather than
207
+ * present it as current. */
208
+ sleeping: /* @__PURE__ */ z.boolean(),
209
+ /** Current device state rendered over the cached frame. State images
210
+ * remain authoritative even when their photographic background is
211
+ * old; null means the link must carry a current camera frame.
212
+ *
213
+ * **This is the ONLY source a surface may derive an inactive tile
214
+ * from.** A client that reads a device's `online`/`disabled` flags and
215
+ * draws its own verdict will disagree with the pixels it is painting
216
+ * — the frame comes from here, and so must the sentence over it
217
+ * (D190). Pair with `ageMs` for the age of the photograph behind the
218
+ * state. */
219
+ stateReason: /* @__PURE__ */ z.enum([
220
+ "disabled",
221
+ "offline",
222
+ "sleeping",
223
+ "unreachable",
224
+ "waking"
225
+ ]).nullable(),
226
+ /** A battery camera (whatever its current state). An AWAKE battery
227
+ * camera is deliberately NOT recaptured on the poll cadence — every
228
+ * capture is a camera hit that would keep it out of sleep — so its
229
+ * cached frame legitimately ages past the currency ceiling while
230
+ * nothing is streaming. A surface must keep painting it (a fresh
231
+ * frame is captured at each wake), not blank to "unavailable". */
232
+ battery: /* @__PURE__ */ z.boolean()
233
+ })))
234
+ },
235
+ status: {
236
+ schema: SnapshotStatusSchema,
237
+ kind: "poll"
238
+ },
239
+ vocabulary: {
240
+ noun: /* @__PURE__ */ t("Snapshot", "Istantanea"),
241
+ order: 3290
242
+ }
243
+ };
244
+ //#endregion
245
+ export { snapshotCapability as t };