@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
@@ -3,13 +3,570 @@ Object.defineProperties(exports, {
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
5
  require("../../chunk-Cek0wNdY.js");
6
- const require_dist = require("../../dist-BZfvhfS1.js");
6
+ const require_stream_catalog_cap = require("../../stream-catalog.cap-D3uwePiA.js");
7
+ const require_base_addon = require("../../base-addon-DD5dIfcZ.js");
8
+ const require_scoped_settings = require("../../scoped-settings-CylSSq_8.js");
9
+ const require_pinned_binary = require("../../pinned-binary-BOhOSNff.js");
10
+ const require_device_identifiers = require("../../device-identifiers-BQg9EQi1.js");
11
+ const require_device_type = require("../../device-type-CbQsnFdC.js");
12
+ const require_error_cap = require("../../error.cap-DBhgPeWK.js");
13
+ const require_snapshot_cap = require("../../snapshot.cap-3suPdBHV.js");
14
+ const require_declared_device = require("../../declared-device-BWphj9WE.js");
15
+ const require_base_device = require("../../base-device-2sL1DMm1.js");
16
+ const require_addon_id = require("../../addon-id-Di0lNJ89.js");
7
17
  let zod = require("zod");
8
18
  let _camstack_types_node = require("@camstack/types/node");
9
19
  let node_fs = require("node:fs");
10
20
  let node_path = require("node:path");
11
21
  let node_child_process = require("node:child_process");
12
22
  let node_http = require("node:http");
23
+ //#region ../types/dist/esm/ffmpeg/invocation.mjs
24
+ var AUDIO_ENCODER_BY_CODEC = {
25
+ opus: "libopus",
26
+ aac: "aac",
27
+ pcmu: "pcm_mulaw",
28
+ pcma: "pcm_alaw"
29
+ };
30
+ /**
31
+ * Camera-microphone audio, per codec. Lives HERE rather than in
32
+ * `encode-defaults.ts` only to avoid an import cycle (`encode-defaults` depends
33
+ * on these types); it is re-exported from there, which is where to read it.
34
+ *
35
+ * Every source in this repo is a mono camera mic. The former broker preset
36
+ * encoded Opus at `channels: 2`, spending bitrate duplicating one channel —
37
+ * that is the value this consolidation changed.
38
+ */
39
+ var AUDIO_PRESETS = {
40
+ aac: {
41
+ kind: "encode",
42
+ codec: "aac",
43
+ bitrateKbps: 128,
44
+ sampleRateHz: 48e3,
45
+ channels: 1
46
+ },
47
+ opus: {
48
+ kind: "encode",
49
+ codec: "opus",
50
+ bitrateKbps: 64,
51
+ sampleRateHz: 48e3,
52
+ channels: 1
53
+ },
54
+ pcmu: {
55
+ kind: "encode",
56
+ codec: "pcmu",
57
+ sampleRateHz: 8e3,
58
+ channels: 1
59
+ }
60
+ };
61
+ /** `-hide_banner -loglevel <level>` — every ffmpeg site opens with this. */
62
+ function logBannerArgs(level) {
63
+ return [
64
+ "-hide_banner",
65
+ "-loglevel",
66
+ level
67
+ ];
68
+ }
69
+ /** `true` when the resolved value means "decode in software" (⇒ no `-hwaccel`). */
70
+ function isSoftwareDecode(decodeHwAccel) {
71
+ return !decodeHwAccel || decodeHwAccel === "none" || decodeHwAccel === "copy";
72
+ }
73
+ /**
74
+ * Every INPUT option, in order, terminated by `-i <url>`. Nothing may be
75
+ * appended to this list by a caller — that is the whole point of the function.
76
+ */
77
+ function buildInputArgs(input, decodeHwAccel) {
78
+ const args = [];
79
+ if (!isSoftwareDecode(decodeHwAccel)) args.push("-hwaccel", String(decodeHwAccel));
80
+ if (input.extraArgs?.length) args.push(...input.extraArgs);
81
+ if (input.decodeThreadCount !== void 0 && input.decodeThreadCount > 0) args.push("-threads", String(input.decodeThreadCount));
82
+ if (input.analyzeDurationUs !== void 0) args.push("-analyzeduration", String(input.analyzeDurationUs));
83
+ if (input.probeSizeBytes !== void 0) args.push("-probesize", String(input.probeSizeBytes));
84
+ if (input.lowDelay === true) args.push("-flags", "low_delay");
85
+ if (input.useWallclockTimestamps === true) args.push("-use_wallclock_as_timestamps", "1");
86
+ if (input.fflags?.length) for (const flag of input.fflags) args.push("-fflags", flag);
87
+ if (input.rtspTransport) args.push("-rtsp_transport", input.rtspTransport);
88
+ if (input.rawVideo !== void 0) {
89
+ const raw = input.rawVideo;
90
+ args.push("-f", "rawvideo", "-pix_fmt", raw.pixelFormat, "-video_size", `${String(raw.width)}x${String(raw.height)}`, "-framerate", String(raw.framerate));
91
+ }
92
+ args.push("-i", input.url);
93
+ return args;
94
+ }
95
+ /**
96
+ * Derive the output `-map` selectors. The three cases, in the order they are
97
+ * decided:
98
+ *
99
+ * 1. **A filter graph** — the picture is the graph's declared video pad, and
100
+ * the audio is its audio pad when it has one, otherwise input 0's mic. A
101
+ * graph's output is not addressable any other way.
102
+ * 2. **N inputs, no graph** — map input 0 EXPLICITLY. ffmpeg's own selection
103
+ * picks the "best" stream across ALL inputs, so the egress would silently
104
+ * become whichever camera happens to have the largest frame.
105
+ * 3. **One input, no graph** — no `-map`. Anything else would change the argv
106
+ * of every call site that exists today for no gain.
107
+ */
108
+ function resolveStreamMaps(selection) {
109
+ const graph = selection.filterGraph;
110
+ if (graph) return {
111
+ video: `[${graph.videoOutLabel}]`,
112
+ audio: graph.audioOutLabel ? `[${graph.audioOutLabel}]` : "0:a:0?"
113
+ };
114
+ if (selection.extraInputs?.length) return {
115
+ video: "0:v:0",
116
+ audio: "0:a:0?"
117
+ };
118
+ return {
119
+ video: null,
120
+ audio: null
121
+ };
122
+ }
123
+ /** The `-vf` filter args, or `[]` when a consumer `-vf` already claims the slot. */
124
+ function buildVideoFilterArgs(scale, outputArgs, filterGraph, hwUpload) {
125
+ if (filterGraph) {
126
+ if (scale) throw new Error("FfmpegInvocation: video.scale cannot be combined with a filter graph — scale inside the graph instead (the -vf would feed an output the graph already feeds)");
127
+ if (outputArgs.some((a) => a === "-vf")) throw new Error("FfmpegInvocation: outputArgs carries a -vf while a filter graph feeds the same output — fold the filter into the graph");
128
+ return [];
129
+ }
130
+ if (outputArgs.some((a) => a === "-vf")) return [];
131
+ if (!scale) return hwUpload.length > 0 ? ["-vf", hwUpload] : [];
132
+ const suffix = hwUpload.length > 0 ? `,${hwUpload}` : "";
133
+ if (scale.mode === "exact") return ["-vf", `scale=${scale.width}:${scale.height}${suffix}`];
134
+ return ["-vf", `scale='min(${scale.width},iw)':'min(${scale.height},ih)':force_original_aspect_ratio=decrease:force_divisible_by=2${suffix}`];
135
+ }
136
+ /**
137
+ * The upload filter a hardware encode needs, or `''`.
138
+ *
139
+ * Nothing is uploaded when the DECODE already left the frames on the GPU
140
+ * (`-hwaccel vaapi`): they are surfaces already, and uploading a surface is an
141
+ * error rather than a no-op.
142
+ */
143
+ function resolveHwUpload(device, decodeHwAccel) {
144
+ if (device === void 0) return "";
145
+ if (!isSoftwareDecode(decodeHwAccel)) return "";
146
+ return "format=nv12,hwupload";
147
+ }
148
+ /** Rate-control args for an encode plan. */
149
+ function buildRateControlArgs(video) {
150
+ const kbps = video.bitrateKbps;
151
+ if (kbps === void 0) return [];
152
+ const rc = video.rateControl ?? {
153
+ kind: "cap",
154
+ vbvSeconds: 2
155
+ };
156
+ const bufsize = Math.max(1, Math.round(kbps * rc.vbvSeconds));
157
+ return [
158
+ ...rc.kind === "cbr" ? ["-b:v", `${kbps}k`] : rc.targetFraction !== void 0 ? ["-b:v", `${Math.max(1, Math.round(kbps * rc.targetFraction))}k`] : [],
159
+ "-maxrate",
160
+ `${kbps}k`,
161
+ "-bufsize",
162
+ `${bufsize}k`
163
+ ];
164
+ }
165
+ /** The whole video block (`-vf` … `-c:v` … knobs), after `-i`. */
166
+ function buildVideoArgs(video, outputArgs, filterGraph, hwEncode) {
167
+ if (video.kind === "raw") {
168
+ if (filterGraph && video.filter !== void 0) throw new Error("FfmpegInvocation: video.filter cannot be combined with a filter graph — fold the filter into the graph");
169
+ return [
170
+ ...video.filter !== void 0 ? ["-vf", video.filter] : [],
171
+ "-c:v",
172
+ "rawvideo",
173
+ "-pix_fmt",
174
+ video.pixelFormat,
175
+ ...video.fps !== void 0 ? ["-r", String(video.fps)] : []
176
+ ];
177
+ }
178
+ if (video.kind === "copy") {
179
+ if (filterGraph) throw new Error("FfmpegInvocation: a filter graph produces a NEW picture, so video.kind must be `encode`");
180
+ return [
181
+ "-c:v",
182
+ "copy",
183
+ ...video.bitstreamFilter ? ["-bsf:v", video.bitstreamFilter] : []
184
+ ];
185
+ }
186
+ const hwUpload = hwEncode === void 0 ? "" : resolveHwUpload(hwEncode.device, hwEncode.decodeHwAccel);
187
+ if (hwEncode !== void 0 && filterGraph) throw new Error("FfmpegInvocation: a hardware encode fed by a filter graph must upload INSIDE the graph — hwEncodeDevice cannot be combined with filterGraph");
188
+ const args = [
189
+ ...buildVideoFilterArgs(video.scale, outputArgs, filterGraph, hwUpload),
190
+ "-c:v",
191
+ video.encoder
192
+ ];
193
+ if (video.preset !== void 0) args.push("-preset", video.preset);
194
+ if (video.tune !== void 0) args.push("-tune", video.tune);
195
+ if (video.singleSlicePerFrame === true && video.encoder === "libx264") args.push("-x264-params", "sliced-threads=0");
196
+ if (video.profile !== void 0) args.push("-profile:v", video.profile);
197
+ if (video.level !== void 0) args.push("-level", video.level);
198
+ if (video.pixelFormat !== void 0) args.push("-pix_fmt", video.pixelFormat);
199
+ if (video.fps !== void 0) args.push("-r", String(video.fps));
200
+ if (video.fpsMode !== void 0) args.push("-fps_mode", video.fpsMode);
201
+ if (video.gopFrames !== void 0) args.push("-g", String(video.gopFrames));
202
+ if (video.forceKeyFramesSeconds !== void 0) args.push("-force_key_frames", `expr:gte(t,n_forced*${video.forceKeyFramesSeconds})`);
203
+ if (video.bf !== void 0) args.push("-bf", String(video.bf));
204
+ args.push(...buildRateControlArgs(video));
205
+ if (video.bitstreamFilter !== void 0) args.push("-bsf:v", video.bitstreamFilter);
206
+ return args;
207
+ }
208
+ /** The whole audio block, after `-i`. */
209
+ function buildAudioArgs(audio) {
210
+ if (audio.kind === "none") return ["-an"];
211
+ if (audio.kind === "copy") return ["-c:a", "copy"];
212
+ const args = [];
213
+ if (audio.filter !== void 0) args.push("-af", audio.filter);
214
+ args.push("-c:a", AUDIO_ENCODER_BY_CODEC[audio.codec]);
215
+ if (audio.application !== void 0) args.push("-application", audio.application);
216
+ if (audio.frameDurationMs !== void 0) args.push("-frame_duration", String(audio.frameDurationMs));
217
+ if (audio.globalHeader === true) args.push("-flags", "+global_header");
218
+ if (audio.sampleRateHz !== void 0) args.push("-ar", String(audio.sampleRateHz));
219
+ if (audio.bitrateKbps !== void 0) args.push("-b:a", `${audio.bitrateKbps}k`);
220
+ if (audio.vbvBufferKbits !== void 0) args.push("-bufsize", `${audio.vbvBufferKbits}k`);
221
+ if (audio.channels !== void 0) args.push("-ac", String(audio.channels));
222
+ return args;
223
+ }
224
+ /** RTP output-leg args (`-payload_type`, `-ssrc`, `-sdp_file`, `-f rtp <url>`). */
225
+ function buildRtpOutputArgs(out) {
226
+ const args = [];
227
+ if (out.payloadType !== void 0) args.push("-payload_type", String(out.payloadType));
228
+ if (out.ssrc !== void 0) args.push("-ssrc", String(out.ssrc));
229
+ if (out.sdpFile !== void 0) args.push("-sdp_file", out.sdpFile);
230
+ args.push("-f", "rtp", out.url);
231
+ return args;
232
+ }
233
+ /** `true` when the sink is a raw elementary bytestream that cannot mux audio. */
234
+ function isElementaryVideoSink(sink) {
235
+ return sink.kind === "stdout" && (sink.container === "h264" || sink.container === "hevc");
236
+ }
237
+ /**
238
+ * The fragmented-MP4 muxer flags, in the order the recorder has proven them
239
+ * (`recorder/addon/ffmpeg-args.ts` passes the same `movflags` string through
240
+ * `-segment_format_options`, across every vendor in the fleet):
241
+ *
242
+ * - `frag_keyframe` — cut a fragment at each key frame, so every fragment
243
+ * opens on a sync sample. HKSV's whole requirement.
244
+ * - `empty_moov` — write `ftyp`+`moov` up front with no samples in it, which
245
+ * is what makes the head a standalone INITIALISATION segment.
246
+ * - `default_base_moof` — fragment offsets are self-relative, so a fragment is
247
+ * demuxable without the bytes that preceded it. D31's byte-range read path
248
+ * depends on exactly this property of the recorder's segments.
249
+ */
250
+ var FMP4_MOVFLAGS = "+frag_keyframe+empty_moov+default_base_moof";
251
+ /**
252
+ * The terminal sink args for every non-`rtp-outputs` sink. Exhaustive over the
253
+ * union so a new member cannot fall through to `['-f', container, 'pipe:1']`,
254
+ * which is what a plain `container` read would have done for `mp4` — a valid
255
+ * argv that writes a NON-fragmented, unseekable-to-a-pipe MP4 and produces one
256
+ * unusable byte stream.
257
+ */
258
+ function buildStdoutOrRtspSinkArgs(sink) {
259
+ if (sink.kind === "rtsp-listen") return [
260
+ "-f",
261
+ "rtsp",
262
+ "-rtsp_transport",
263
+ "tcp",
264
+ "-rtsp_flags",
265
+ "listen",
266
+ sink.url
267
+ ];
268
+ if (sink.kind === "rtp-outputs") return [];
269
+ return sink.container === "mp4" ? buildFmp4SinkArgs(sink) : [
270
+ "-f",
271
+ sink.container,
272
+ "pipe:1"
273
+ ];
274
+ }
275
+ /**
276
+ * How far BELOW the negotiated fragment length `-min_frag_duration` is set.
277
+ *
278
+ * `-min_frag_duration` refuses to cut before that much media has accumulated,
279
+ * and then waits for the next key frame. Set to exactly `fragmentMs`, the
280
+ * commonest camera configuration in existence — a key-frame grid EQUAL to the
281
+ * requested fragment length — lands the deadline on the same instant as the key
282
+ * frame, loses the race, and skips to the following one: **every fragment comes
283
+ * out at twice the requested length.**
284
+ *
285
+ * Measured on the live fleet 2026-08-07, camera 101, `-c:v copy` (D84):
286
+ *
287
+ * | slot | GOP | `-min_frag_duration` | median gap |
288
+ * | --- | --- | --- | --- |
289
+ * | 1280×720 | 40 f @ 10 fps = 4.0 s | 4000 ms | **7944 ms** |
290
+ * | 1280×720 | 40 f @ 10 fps = 4.0 s | 3600 ms | 3973 ms |
291
+ * | 3840×2160 | 100 f @ 25 fps = 4.0 s | 4000 ms | 8042 ms |
292
+ * | 3840×2160 | 100 f @ 25 fps = 4.0 s | 3600 ms | 3998 ms |
293
+ *
294
+ * A doubled fragment is not a cosmetic overshoot: HKSV requires every fragment
295
+ * to be no longer than the length the controller SELECTED, so the shipped-but-
296
+ * inert phase-1 sink would have violated the contract on its first real clip.
297
+ *
298
+ * 10 % is chosen against the two failures either side of it. Too small and
299
+ * ordinary jitter (measured spread 3953-4096 ms) re-loses the race; too large
300
+ * and a source with a key frame slightly EARLY than the grid gets cut there,
301
+ * yielding a short fragment for no reason.
302
+ */
303
+ var FMP4_MIN_FRAG_MARGIN = .9;
304
+ /** `-movflags … -min_frag_duration <us> -f mp4 pipe:1`. */
305
+ function buildFmp4SinkArgs(sink) {
306
+ return [
307
+ "-movflags",
308
+ FMP4_MOVFLAGS,
309
+ "-min_frag_duration",
310
+ String(Math.max(0, Math.round(sink.fragmentMs * FMP4_MIN_FRAG_MARGIN * 1e3))),
311
+ "-f",
312
+ "mp4",
313
+ "pipe:1"
314
+ ];
315
+ }
316
+ /**
317
+ * A second output mapping source audio to RTP-over-UDP. `0:a:0?` makes the
318
+ * audio optional so a source with no audio skips it instead of failing the
319
+ * whole invocation.
320
+ */
321
+ function buildAudioSidecarArgs(sidecar) {
322
+ return [
323
+ "-map",
324
+ "0:a:0?",
325
+ ...buildAudioArgs(sidecar.codec === "pcma" ? {
326
+ kind: "encode",
327
+ codec: "pcma",
328
+ sampleRateHz: 8e3,
329
+ channels: 1
330
+ } : AUDIO_PRESETS[sidecar.codec]),
331
+ ...buildRtpOutputArgs({
332
+ url: sidecar.rtpUrl,
333
+ sdpFile: sidecar.sdpFile
334
+ })
335
+ ];
336
+ }
337
+ /**
338
+ * Assemble the full ffmpeg argument list. Layout:
339
+ *
340
+ * -hide_banner -loglevel <level>
341
+ * [-hwaccel <backend|auto>] ─┐ INPUT options — strictly before -i.
342
+ * [<input.extraArgs>] │
343
+ * [-fflags <flag>…] │
344
+ * [-rtsp_transport tcp] │
345
+ * -i <url> ─┘ …repeated per extraInput
346
+ * [-filter_complex <graph>] ─ global, after the LAST -i
347
+ * [-map <video>] <video block> <threads> ─┐ OUTPUT options.
348
+ * [-map <audio>] <audio block> │
349
+ * <consumer outputArgs verbatim> │
350
+ * <sink> ─┘ terminal
351
+ *
352
+ * The `-map`s are DERIVED (see {@link resolveStreamMaps}), never constants:
353
+ * one input with no graph emits none at all, which is why the argv of every
354
+ * call site that predates the N-input extension is unchanged to the byte.
355
+ *
356
+ * {@link FfmpegInvocation.audioSidecar} is the one map that stays literal
357
+ * (`0:a:0?`): the sidecar is defined as the SOURCE's microphone on its own RTP
358
+ * output, not as whatever the main output happens to carry.
359
+ */
360
+ /** The hardware-encode context for this invocation, or `undefined`. */
361
+ function hwEncodeFor(inv) {
362
+ return inv.hwEncodeDevice === void 0 ? void 0 : {
363
+ device: inv.hwEncodeDevice,
364
+ decodeHwAccel: inv.decodeHwAccel
365
+ };
366
+ }
367
+ function buildFfmpegArgs(inv) {
368
+ const graph = inv.filterGraph ?? null;
369
+ const head = [
370
+ ...logBannerArgs(inv.logLevel),
371
+ ...inv.hwEncodeDevice !== void 0 ? ["-vaapi_device", inv.hwEncodeDevice.renderNode] : [],
372
+ ...buildInputArgs(inv.input, inv.decodeHwAccel),
373
+ ...(inv.extraInputs ?? []).flatMap((extra) => buildInputArgs(extra, inv.decodeHwAccel)),
374
+ ...graph ? ["-filter_complex", graph.graph] : []
375
+ ];
376
+ const threadArgs = [...inv.threadCount > 0 ? ["-threads", String(inv.threadCount)] : [], ...inv.filterThreadCount !== void 0 && inv.filterThreadCount > 0 ? ["-filter_threads", String(inv.filterThreadCount)] : []];
377
+ const maps = resolveStreamMaps(inv);
378
+ const videoMapArgs = maps.video ? ["-map", maps.video] : [];
379
+ const audioMapArgs = maps.audio ? ["-map", maps.audio] : [];
380
+ if (inv.sink.kind === "rtp-outputs") {
381
+ const videoLeg = inv.sink.video ? [
382
+ "-an",
383
+ "-map",
384
+ maps.video ?? "0:v:0",
385
+ ...buildVideoArgs(inv.video, inv.outputArgs, graph, hwEncodeFor(inv)),
386
+ ...threadArgs,
387
+ ...inv.outputArgs,
388
+ ...buildRtpOutputArgs(inv.sink.video)
389
+ ] : [];
390
+ const audioLeg = inv.sink.audio ? [
391
+ "-vn",
392
+ "-map",
393
+ maps.audio ?? "0:a:0?",
394
+ ...buildAudioArgs(inv.audio),
395
+ ...buildRtpOutputArgs(inv.sink.audio)
396
+ ] : [];
397
+ return [
398
+ ...head,
399
+ ...videoLeg,
400
+ ...audioLeg
401
+ ];
402
+ }
403
+ const mutedAudio = isElementaryVideoSink(inv.sink) || inv.audio.kind === "none";
404
+ const audioArgs = isElementaryVideoSink(inv.sink) ? ["-an"] : buildAudioArgs(inv.audio);
405
+ return [
406
+ ...head,
407
+ ...videoMapArgs,
408
+ ...buildVideoArgs(inv.video, inv.outputArgs, graph, hwEncodeFor(inv)),
409
+ ...threadArgs,
410
+ ...mutedAudio ? [] : audioMapArgs,
411
+ ...audioArgs,
412
+ ...inv.outputArgs,
413
+ ...buildStdoutOrRtspSinkArgs(inv.sink),
414
+ ...inv.audioSidecar ? buildAudioSidecarArgs(inv.audioSidecar) : []
415
+ ];
416
+ }
417
+ //#endregion
418
+ //#region ../types/dist/esm/composition/engine-hosted-blocks.mjs
419
+ function isSpecOfKind(spec, kind) {
420
+ return spec !== void 0 && spec.kind === kind;
421
+ }
422
+ /**
423
+ * The blocks of `kind` whose composer row exists. A block whose row the
424
+ * composer has not declared yet is left out: nothing can be hosted on it until
425
+ * its next apply, and the next pass picks it up.
426
+ */
427
+ function selectEngineHostedBlocks(kind, compositions, composerRows) {
428
+ if (compositions.state === "not-loaded") return {
429
+ kind: "untrusted",
430
+ reason: compositions.reason
431
+ };
432
+ const rowByStableId = new Map(composerRows.map((row) => [row.stableId, row]));
433
+ const blocks = [];
434
+ for (const view of compositions.views) {
435
+ const block = view.block;
436
+ const composition = block.source?.kind === "composition" ? block.source.composition : null;
437
+ if (composition === null) continue;
438
+ const spec = composition.helper;
439
+ if (!isSpecOfKind(spec, kind)) continue;
440
+ const stableId = `${require_error_cap.COMPOSED_DEVICE_STABLE_ID_PREFIX}${block.id}`;
441
+ const row = rowByStableId.get(stableId);
442
+ if (row === void 0) continue;
443
+ blocks.push({
444
+ blockId: block.id,
445
+ deviceId: row.id,
446
+ stableId,
447
+ name: block.name,
448
+ enabled: block.enabled,
449
+ updatedAt: block.updatedAt,
450
+ composition,
451
+ spec
452
+ });
453
+ }
454
+ return {
455
+ kind: "trusted",
456
+ blocks
457
+ };
458
+ }
459
+ var WITHDRAWAL_CONFIRMATIONS = 2;
460
+ /**
461
+ * D49 for an engine's hosted set: a block missing from ONE trusted read is
462
+ * kept; a second consecutive trusted read that agrees withdraws it. An
463
+ * untrusted read is never fed here, so it neither counts nor resets.
464
+ */
465
+ var HostedWithdrawalGate = class {
466
+ misses = /* @__PURE__ */ new Map();
467
+ /**
468
+ * `hosted`: what the engine serves now; `present`: what this trusted read
469
+ * names. Returns the ids to withdraw now, and the ids kept on a first miss.
470
+ */
471
+ judge(hosted, present) {
472
+ const withdraw = [];
473
+ const held = [];
474
+ const misses = /* @__PURE__ */ new Map();
475
+ for (const id of hosted) {
476
+ if (present.has(id)) continue;
477
+ const count = (this.misses.get(id) ?? 0) + 1;
478
+ if (count < WITHDRAWAL_CONFIRMATIONS) {
479
+ held.push(id);
480
+ misses.set(id, count);
481
+ } else withdraw.push(id);
482
+ }
483
+ this.misses = misses;
484
+ return {
485
+ withdraw,
486
+ held
487
+ };
488
+ }
489
+ };
490
+ /**
491
+ * Build `DeviceClass` on the composer's row `(stableId, id)`. The context is
492
+ * `loadContext` (D677: a caller that BUILDS a device hydrates its stored
493
+ * runtime state first); a kernel without it is refused by name rather than
494
+ * building on an empty state. The device is never `register`ed and its config
495
+ * never persisted: the row, its name and its lifetime are the composer's.
496
+ */
497
+ async function hostEngineDevice(devices, row, config, DeviceClass) {
498
+ if (devices.loadContext === void 0) throw new Error(`this kernel cannot build a device on a row it does not own (no loadContext) — device ${String(row.id)} is not hosted`);
499
+ const base = await devices.loadContext(row.stableId, row.id, null, config);
500
+ const registered = [];
501
+ const device = new DeviceClass({
502
+ ...base,
503
+ registerNativeCap: (cap, provider) => {
504
+ base.registerNativeCap(cap, provider);
505
+ registered.push(cap.name);
506
+ }
507
+ });
508
+ return {
509
+ device,
510
+ withdraw: async () => {
511
+ await device.removeDevice();
512
+ for (const capName of registered) base.unregisterNativeCap?.(capName);
513
+ }
514
+ };
515
+ }
516
+ /**
517
+ * Whether an engine may stop sweeping: only once a pass found no old row left.
518
+ * `none` is not done — a registry that has not answered the integration yet
519
+ * reads as null too, and the sweep is one indexed read per pass.
520
+ */
521
+ function legacySweepDone(sweep) {
522
+ return sweep.kind === "swept" && sweep.drained;
523
+ }
524
+ /**
525
+ * The legacy rows, one bounded batch at a time: only the rows under the old
526
+ * integration, ordered by id, at most `DECLARED_DEVICE_SWEEP_LIMIT` — a large
527
+ * leftover set drains over passes instead of being refused whole by the
528
+ * sweep's own bound.
529
+ */
530
+ function legacyEngineRowsIndex(rows, integrationId) {
531
+ return rows.filter((row) => row.integrationId === integrationId).toSorted((left, right) => left.id - right.id).slice(0, 32);
532
+ }
533
+ /**
534
+ * Remove every camera row an engine declared itself before its cameras were
535
+ * blocks, unconditionally, through the declared sweep (`removeDevice` →
536
+ * tombstone, D865). No integration means nothing was ever declared, and
537
+ * nothing is minted to find out. A failed read throws: the caller retries.
538
+ */
539
+ async function sweepLegacyEngineRows(ports, integrationName) {
540
+ const integration = await ports.getIntegration(ports.addonId);
541
+ if (integration === null) return { kind: "none" };
542
+ let found = 0;
543
+ return {
544
+ kind: "swept",
545
+ removed: (await new require_declared_device.DeclaredDevices({
546
+ logger: ports.logger,
547
+ addonId: ports.addonId,
548
+ devices: ports.devices,
549
+ localNodeId: ports.localNodeId,
550
+ getIntegration: async () => integration,
551
+ createIntegration: async () => {
552
+ throw new Error(`${ports.addonId}: the legacy sweep never mints an integration`);
553
+ },
554
+ updateIntegration: async () => void 0,
555
+ listOwnDevices: async () => {
556
+ const index = legacyEngineRowsIndex(await ports.listAddonRows(ports.addonId), integration.id);
557
+ found = index.length;
558
+ return index;
559
+ }
560
+ }).reconcile({
561
+ integrationName,
562
+ integrationId: integration.id,
563
+ placement: "hub",
564
+ devices: []
565
+ })).removed,
566
+ drained: found === 0
567
+ };
568
+ }
569
+ //#endregion
13
570
  //#region src/builtins/camera-grid/grid-device-settings.ts
14
571
  /** The widget id, registered in `ui-library`'s `HOST_WIDGETS`. */
15
572
  var GRID_LAYOUT_WIDGET_ID = "host/camera-grid-layout";
@@ -71,7 +628,7 @@ function buildGridLayoutNativeProvider(source) {
71
628
  saveLayout: async (patch) => source.saveLayout(patch),
72
629
  getDeviceSettingsContribution: async ({ deviceId }) => {
73
630
  const schema = buildGridDeviceSchema(source.isGrid(deviceId));
74
- return schema === null ? null : require_dist.hydrateSchema(schema, {});
631
+ return schema === null ? null : require_base_addon.hydrateSchema(schema, {});
75
632
  },
76
633
  getDeviceLiveContribution: async () => null,
77
634
  applyDeviceSettingsPatch: async () => ({ success: true })
@@ -116,11 +673,11 @@ function activeRuntime() {
116
673
  if (runtime === null) throw new Error("camera-grid: the addon runtime is not installed");
117
674
  return runtime;
118
675
  }
119
- var GridCameraDevice = class extends require_dist.BaseDevice {
120
- features = [require_dist.DeviceFeature.NativeSnapshot];
676
+ var GridCameraDevice = class extends require_base_device.BaseDevice {
677
+ features = [require_device_type.DeviceFeature.NativeSnapshot];
121
678
  constructor(ctx) {
122
679
  super(ctx, gridCameraSchema, { type: ctx.deviceMeta.type });
123
- this.ctx.registerNativeCap(require_dist.streamCatalogCapability, { getCatalog: async ({ deviceId }) => {
680
+ this.ctx.registerNativeCap(require_stream_catalog_cap.streamCatalogCapability, { getCatalog: async ({ deviceId }) => {
124
681
  if (deviceId !== this.id) return [];
125
682
  return this.catalog();
126
683
  } });
@@ -129,12 +686,12 @@ var GridCameraDevice = class extends require_dist.BaseDevice {
129
686
  isGrid: (deviceId) => activeRuntime().isGrid(deviceId),
130
687
  saveLayout: (patch) => activeRuntime().saveLayout(patch)
131
688
  });
132
- this.ctx.registerNativeCap(require_dist.cameraGridLayoutCapability, layoutProvider);
133
- this.ctx.registerNativeCap(require_dist.snapshotCapability, {
689
+ this.ctx.registerNativeCap(require_stream_catalog_cap.cameraGridLayoutCapability, layoutProvider);
690
+ this.ctx.registerNativeCap(require_snapshot_cap.snapshotCapability, {
134
691
  getSnapshot: async ({ deviceId }) => activeRuntime().getSnapshot(deviceId),
135
692
  invalidateCache: async () => {}
136
693
  });
137
- this.ctx.registerNativeCap(require_dist.motionCapability, {
694
+ this.ctx.registerNativeCap(require_stream_catalog_cap.motionCapability, {
138
695
  getStatus: async ({ deviceId }) => activeRuntime().motionStatus(deviceId),
139
696
  isDetected: async ({ deviceId }) => activeRuntime().motionStatus(deviceId).detected
140
697
  });
@@ -248,7 +805,7 @@ function gridSpecFromPatch(current, patch, refOf) {
248
805
  }
249
806
  /** The composition a grid spec compiles to — the shape a block of this kind stores. */
250
807
  function gridComposition(spec) {
251
- const compiled = require_dist.compileHelper(spec);
808
+ const compiled = require_error_cap.compileHelper(spec);
252
809
  if (!compiled.ok) throw new Error(`camera-grid: the grid spec does not compile — ${compiled.problems.map((p) => p.message).join("; ")}`);
253
810
  return compiled.composition;
254
811
  }
@@ -593,7 +1150,7 @@ var GridActivityForwarder = class {
593
1150
  timestamp: atMs,
594
1151
  source: "onboard"
595
1152
  };
596
- this.deps.eventBus.emit(require_dist.createEvent(require_dist.EventCategory.MotionOnMotionChanged, this.source(deviceId), payload));
1153
+ this.deps.eventBus.emit(require_base_addon.createEvent(require_base_addon.EventCategory.MotionOnMotionChanged, this.source(deviceId), payload));
597
1154
  this.deps.logger.debug("camera grid: motion forwarded", {
598
1155
  tags: { deviceId },
599
1156
  meta: { detected: state.detected }
@@ -617,7 +1174,7 @@ var GridActivityForwarder = class {
617
1174
  },
618
1175
  nodeId: "hub"
619
1176
  };
620
- this.deps.eventBus.emit(require_dist.createEvent(require_dist.EventCategory.PipelineAudioInferenceResult, this.source(deviceId), payload));
1177
+ this.deps.eventBus.emit(require_base_addon.createEvent(require_base_addon.EventCategory.PipelineAudioInferenceResult, this.source(deviceId), payload));
621
1178
  }
622
1179
  emitDetections(grid, sourceFrame, detections) {
623
1180
  const payload = {
@@ -632,7 +1189,7 @@ var GridActivityForwarder = class {
632
1189
  },
633
1190
  analysisResults: []
634
1191
  };
635
- this.deps.eventBus.emit(require_dist.createEvent(require_dist.EventCategory.DetectionResult, this.source(grid.deviceId), payload));
1192
+ this.deps.eventBus.emit(require_base_addon.createEvent(require_base_addon.EventCategory.DetectionResult, this.source(grid.deviceId), payload));
636
1193
  }
637
1194
  };
638
1195
  //#endregion
@@ -741,7 +1298,7 @@ var GridFrameSampler = class {
741
1298
  } catch (error) {
742
1299
  this.options.logger.debug("camera grid: the frame grab stdin refused to close", {
743
1300
  tags: { deviceId },
744
- meta: { error: require_dist.errMsg(error) }
1301
+ meta: { error: require_scoped_settings.errMsg(error) }
745
1302
  });
746
1303
  }
747
1304
  }
@@ -874,7 +1431,7 @@ var GridLastFrameFileStore = class {
874
1431
  } catch (error) {
875
1432
  this.logger.warn(`camera grid: the disk could not ${what}`, {
876
1433
  tags: { deviceId },
877
- meta: { error: require_dist.errMsg(error) }
1434
+ meta: { error: require_scoped_settings.errMsg(error) }
878
1435
  });
879
1436
  return fallback;
880
1437
  } finally {
@@ -1230,7 +1787,7 @@ var GridSnapshotSource = class {
1230
1787
  } catch (error) {
1231
1788
  this.deps.logger.warn("camera grid: could not sample a frame from the live composition", {
1232
1789
  tags: { deviceId },
1233
- meta: { error: require_dist.errMsg(error) }
1790
+ meta: { error: require_scoped_settings.errMsg(error) }
1234
1791
  });
1235
1792
  return null;
1236
1793
  }
@@ -1242,7 +1799,7 @@ var GridSnapshotSource = class {
1242
1799
  } catch (error) {
1243
1800
  this.deps.logger.warn("camera grid: the kept frame could not be read", {
1244
1801
  tags: { deviceId },
1245
- meta: { error: require_dist.errMsg(error) }
1802
+ meta: { error: require_scoped_settings.errMsg(error) }
1246
1803
  });
1247
1804
  return null;
1248
1805
  }
@@ -1253,7 +1810,7 @@ var GridSnapshotSource = class {
1253
1810
  } catch (error) {
1254
1811
  this.deps.logger.warn("camera grid: the composed frame could not be kept", {
1255
1812
  tags: { deviceId },
1256
- meta: { error: require_dist.errMsg(error) }
1813
+ meta: { error: require_scoped_settings.errMsg(error) }
1257
1814
  });
1258
1815
  }
1259
1816
  }
@@ -1410,7 +1967,7 @@ var GridStreamRelay = class {
1410
1967
  meta: {
1411
1968
  instanceId,
1412
1969
  profile,
1413
- error: require_dist.errMsg(error)
1970
+ error: require_scoped_settings.errMsg(error)
1414
1971
  }
1415
1972
  });
1416
1973
  if (!res.headersSent) res.writeHead(503, { "content-type": "text/plain" });
@@ -1783,7 +2340,7 @@ var GridStreamSession = class {
1783
2340
  tags: this.logTags,
1784
2341
  meta: {
1785
2342
  acquired: acquired.length,
1786
- error: require_dist.errMsg(error)
2343
+ error: require_scoped_settings.errMsg(error)
1787
2344
  }
1788
2345
  });
1789
2346
  await this.releaseAll(acquired);
@@ -1816,7 +2373,7 @@ var GridStreamSession = class {
1816
2373
  } catch (error) {
1817
2374
  this.options.deps.logger.error("camera grid: the composition failed to start", {
1818
2375
  tags: this.logTags,
1819
- meta: { error: require_dist.errMsg(error) }
2376
+ meta: { error: require_scoped_settings.errMsg(error) }
1820
2377
  });
1821
2378
  await this.releaseAll(acquired);
1822
2379
  throw error;
@@ -1852,7 +2409,7 @@ var GridStreamSession = class {
1852
2409
  } catch (error) {
1853
2410
  this.options.deps.logger.warn("camera grid: the composition did not stop cleanly", {
1854
2411
  tags: this.logTags,
1855
- meta: { error: require_dist.errMsg(error) }
2412
+ meta: { error: require_scoped_settings.errMsg(error) }
1856
2413
  });
1857
2414
  }
1858
2415
  await this.releaseAll(state.sources);
@@ -1869,7 +2426,7 @@ var GridStreamSession = class {
1869
2426
  tags: this.logTags,
1870
2427
  meta: {
1871
2428
  pipelineKey: source.pipelineKey,
1872
- error: require_dist.errMsg(error)
2429
+ error: require_scoped_settings.errMsg(error)
1873
2430
  }
1874
2431
  });
1875
2432
  }
@@ -1901,7 +2458,7 @@ var GridStreamSession = class {
1901
2458
  * its own, which is what a grid forwarding its sources' motion would have used
1902
2459
  * to write a duplicate motion episode per event.
1903
2460
  */
1904
- var GRID_SILENCED_CAP_NAMES = require_dist.DERIVED_CAMERA_SILENCED_CAP_NAMES;
2461
+ var GRID_SILENCED_CAP_NAMES = require_device_identifiers.DERIVED_CAMERA_SILENCED_CAP_NAMES;
1905
2462
  /**
1906
2463
  * Resolve the addon currently providing `capName` for this device, from the
1907
2464
  * device's OWN bindings. `listBindableCapsForDeviceType` answers for the device
@@ -1952,12 +2509,12 @@ async function silenceAnalysisFor(deps, deviceId) {
1952
2509
  }
1953
2510
  });
1954
2511
  } catch (err) {
1955
- failures.push(`${capName}: ${require_dist.errMsg(err)}`);
2512
+ failures.push(`${capName}: ${require_scoped_settings.errMsg(err)}`);
1956
2513
  deps.logger.error("camera grid: could NOT switch an analyzer off", {
1957
2514
  tags: { deviceId },
1958
2515
  meta: {
1959
2516
  capName,
1960
- error: require_dist.errMsg(err)
2517
+ error: require_scoped_settings.errMsg(err)
1961
2518
  }
1962
2519
  });
1963
2520
  }
@@ -2625,7 +3182,7 @@ async function resolveSeedNames(ctx, deviceIds) {
2625
3182
  tags: { deviceId: ctx.deviceId },
2626
3183
  meta: {
2627
3184
  sources: deviceIds.length,
2628
- error: require_dist.errMsg(error)
3185
+ error: require_scoped_settings.errMsg(error)
2629
3186
  }
2630
3187
  });
2631
3188
  settle(empty);
@@ -2647,7 +3204,7 @@ async function buildCanvasSeed(ctx, tilePlan) {
2647
3204
  ctx.logger.warn("camera grid: the canvas seed could not be drawn - starting black", {
2648
3205
  tags: { deviceId: ctx.deviceId },
2649
3206
  meta: {
2650
- error: require_dist.errMsg(error),
3207
+ error: require_scoped_settings.errMsg(error),
2651
3208
  tiles: tilePlan.tiles.length
2652
3209
  }
2653
3210
  });
@@ -2698,7 +3255,7 @@ async function startGridCompositorChild(ctx, plan, sources, onEnded) {
2698
3255
  };
2699
3256
  const encoder = new _camstack_types_node.FfmpegProcess({
2700
3257
  binaryPath: ctx.binaryPath,
2701
- buildArgs: () => require_dist.buildFfmpegArgs(gridCanvasEncoderInvocation({
3258
+ buildArgs: () => buildFfmpegArgs(gridCanvasEncoderInvocation({
2702
3259
  canvas: tilePlan.canvas,
2703
3260
  fps: plan.fps,
2704
3261
  encoder: plan.encoder,
@@ -2750,7 +3307,7 @@ async function startGridCompositorChild(ctx, plan, sources, onEnded) {
2750
3307
  if (url === void 0) throw new Error(`camera-grid: no acquired source for device ${String(tile.deviceId)}`);
2751
3308
  const decoder = new _camstack_types_node.FfmpegProcess({
2752
3309
  binaryPath: ctx.binaryPath,
2753
- buildArgs: () => require_dist.buildFfmpegArgs(gridTileDecoderInvocation({
3310
+ buildArgs: () => buildFfmpegArgs(gridTileDecoderInvocation({
2754
3311
  tile,
2755
3312
  url,
2756
3313
  fps: plan.fps
@@ -2847,14 +3404,14 @@ var GridSessionEntry = class {
2847
3404
  return this.session.isRunning();
2848
3405
  }
2849
3406
  };
2850
- var CameraGridAddon = class extends require_dist.BaseAddon {
3407
+ var CameraGridAddon = class extends require_base_addon.BaseAddon {
2851
3408
  relay = null;
2852
3409
  reconcileTimer = null;
2853
3410
  /** Keyed by session key — ONE composition per (grid, profile). */
2854
3411
  sessions = /* @__PURE__ */ new Map();
2855
3412
  /** The grids this engine hosts, by block id. */
2856
3413
  grids = /* @__PURE__ */ new Map();
2857
- withdrawalGate = new require_dist.HostedWithdrawalGate();
3414
+ withdrawalGate = new HostedWithdrawalGate();
2858
3415
  /** One pass at a time: a save and the timer must not host the same block twice. */
2859
3416
  passChain = Promise.resolve();
2860
3417
  /** True once a pass found no legacy `camera-grid` row left to remove. */
@@ -2877,14 +3434,14 @@ var CameraGridAddon = class extends require_dist.BaseAddon {
2877
3434
  * composition then refuses by name; there is no PATH default. */
2878
3435
  ffmpegBinaryPath = null;
2879
3436
  /** The node's pinned build, remembered only on success (D540). */
2880
- pinnedFfmpeg = require_dist.memoizePinnedFfmpeg(() => this.ctx.deps.ensureFfmpeg());
3437
+ pinnedFfmpeg = require_pinned_binary.memoizePinnedFfmpeg(() => this.ctx.deps.ensureFfmpeg());
2881
3438
  /** A resolution in flight, so a reconcile pass never starts a second. */
2882
3439
  ffmpegResolving = null;
2883
3440
  constructor() {
2884
3441
  super({ ...DEFAULTS });
2885
3442
  }
2886
3443
  async onInitialize() {
2887
- if (require_dist.declarationOwnerNodeId(this.ctx.kernel.localNodeId) === "hub") {
3444
+ if (require_declared_device.declarationOwnerNodeId(this.ctx.kernel.localNodeId) === "hub") {
2888
3445
  await this.resolveFfmpeg();
2889
3446
  const relay = new GridStreamRelay({
2890
3447
  logger: this.ctx.logger.child("relay"),
@@ -2904,7 +3461,7 @@ var CameraGridAddon = class extends require_dist.BaseAddon {
2904
3461
  this.activity = new GridActivityForwarder({
2905
3462
  eventBus: this.ctx.eventBus,
2906
3463
  logger: this.ctx.logger.child("activity"),
2907
- addonId: require_dist.bareAddonId(this.ctx.id),
3464
+ addonId: require_addon_id.bareAddonId(this.ctx.id),
2908
3465
  gridsForSource: (sourceDeviceId) => this.gridsForSource(sourceDeviceId),
2909
3466
  now: () => Date.now()
2910
3467
  });
@@ -2922,22 +3479,22 @@ var CameraGridAddon = class extends require_dist.BaseAddon {
2922
3479
  };
2923
3480
  return {
2924
3481
  ...state,
2925
- autoClearAfterMs: state.detected ? require_dist.MOTION_CLOSE_AFTER_MS : null
3482
+ autoClearAfterMs: state.detected ? require_stream_catalog_cap.MOTION_CLOSE_AFTER_MS : null
2926
3483
  };
2927
3484
  }
2928
3485
  });
2929
3486
  await this.reconcile().catch((error) => {
2930
- this.ctx.logger.warn("camera grid: initial reconciliation failed — will retry", { meta: { error: require_dist.errMsg(error) } });
3487
+ this.ctx.logger.warn("camera grid: initial reconciliation failed — will retry", { meta: { error: require_scoped_settings.errMsg(error) } });
2931
3488
  });
2932
3489
  this.reconcileTimer = setInterval(() => {
2933
3490
  this.reconcile().catch((error) => {
2934
- this.ctx.logger.warn("camera grid: reconciliation failed", { meta: { error: require_dist.errMsg(error) } });
3491
+ this.ctx.logger.warn("camera grid: reconciliation failed", { meta: { error: require_scoped_settings.errMsg(error) } });
2935
3492
  });
2936
3493
  }, RECONCILE_MS);
2937
3494
  this.reconcileTimer.unref?.();
2938
3495
  }
2939
3496
  return { providers: [{
2940
- capability: require_dist.cameraGridLayoutCapability,
3497
+ capability: require_stream_catalog_cap.cameraGridLayoutCapability,
2941
3498
  provider: buildGridLayoutNativeProvider({
2942
3499
  getLayout: (deviceId) => this.gridViewFor(deviceId),
2943
3500
  isGrid: (deviceId) => this.gridForDevice(deviceId) !== null,
@@ -2985,15 +3542,15 @@ var CameraGridAddon = class extends require_dist.BaseAddon {
2985
3542
  try {
2986
3543
  compositions = await this.ctx.api.coreBlocks.listCompositions.query({});
2987
3544
  composerRows = await this.ctx.api.deviceManager.listAll.query({
2988
- addonId: require_dist.COMPOSER_ADDON_ID,
3545
+ addonId: require_error_cap.COMPOSER_ADDON_ID,
2989
3546
  projection: "slim"
2990
3547
  });
2991
3548
  } catch (error) {
2992
- this.ctx.logger.warn("camera grid: the grid blocks could not be read - nothing changes", { meta: { error: require_dist.errMsg(error) } });
3549
+ this.ctx.logger.warn("camera grid: the grid blocks could not be read - nothing changes", { meta: { error: require_scoped_settings.errMsg(error) } });
2993
3550
  return;
2994
3551
  }
2995
- const grids = require_dist.selectEngineHostedBlocks("grid", compositions, composerRows);
2996
- const crops = require_dist.selectEngineHostedBlocks("crop", compositions, composerRows);
3552
+ const grids = selectEngineHostedBlocks("grid", compositions, composerRows);
3553
+ const crops = selectEngineHostedBlocks("crop", compositions, composerRows);
2997
3554
  if (grids.kind === "untrusted" || crops.kind === "untrusted") {
2998
3555
  this.ctx.logger.info("camera grid: the blocks are not loaded yet - nothing changes", { meta: { reason: grids.kind === "untrusted" ? grids.reason : "not loaded" } });
2999
3556
  return;
@@ -3028,7 +3585,7 @@ var CameraGridAddon = class extends require_dist.BaseAddon {
3028
3585
  }
3029
3586
  let hosted;
3030
3587
  try {
3031
- hosted = await require_dist.hostEngineDevice(this.ctx.kernel.devices, {
3588
+ hosted = await hostEngineDevice(this.ctx.kernel.devices, {
3032
3589
  id: block.deviceId,
3033
3590
  stableId: block.stableId
3034
3591
  }, { blockId: block.blockId }, GridCameraDevice);
@@ -3037,7 +3594,7 @@ var CameraGridAddon = class extends require_dist.BaseAddon {
3037
3594
  tags: { deviceId: block.deviceId },
3038
3595
  meta: {
3039
3596
  blockId: block.blockId,
3040
- error: require_dist.errMsg(error)
3597
+ error: require_scoped_settings.errMsg(error)
3041
3598
  }
3042
3599
  });
3043
3600
  return null;
@@ -3098,7 +3655,7 @@ var CameraGridAddon = class extends require_dist.BaseAddon {
3098
3655
  unreadAddons.add(addonId);
3099
3656
  this.ctx.logger.warn("camera grid: the sources of one addon could not be read", { meta: {
3100
3657
  addonId,
3101
- error: require_dist.errMsg(error)
3658
+ error: require_scoped_settings.errMsg(error)
3102
3659
  } });
3103
3660
  }
3104
3661
  return {
@@ -3132,7 +3689,7 @@ var CameraGridAddon = class extends require_dist.BaseAddon {
3132
3689
  tags: { deviceId },
3133
3690
  meta: {
3134
3691
  blockId,
3135
- error: require_dist.errMsg(error)
3692
+ error: require_scoped_settings.errMsg(error)
3136
3693
  }
3137
3694
  });
3138
3695
  }
@@ -3160,7 +3717,7 @@ var CameraGridAddon = class extends require_dist.BaseAddon {
3160
3717
  } catch (error) {
3161
3718
  this.ctx.logger.error("camera grid: a new grid could not be silenced", {
3162
3719
  tags: { deviceId },
3163
- meta: { error: require_dist.errMsg(error) }
3720
+ meta: { error: require_scoped_settings.errMsg(error) }
3164
3721
  });
3165
3722
  }
3166
3723
  }
@@ -3173,9 +3730,9 @@ var CameraGridAddon = class extends require_dist.BaseAddon {
3173
3730
  */
3174
3731
  async sweepLegacyCameras() {
3175
3732
  if (this.legacySwept) return;
3176
- const addonId = require_dist.bareAddonId(this.ctx.id);
3733
+ const addonId = require_addon_id.bareAddonId(this.ctx.id);
3177
3734
  try {
3178
- const sweep = await require_dist.sweepLegacyEngineRows({
3735
+ const sweep = await sweepLegacyEngineRows({
3179
3736
  logger: this.ctx.logger.child("legacy-sweep"),
3180
3737
  addonId,
3181
3738
  devices: this.ctx.kernel.devices,
@@ -3184,9 +3741,9 @@ var CameraGridAddon = class extends require_dist.BaseAddon {
3184
3741
  listAddonRows: (owner) => this.ctx.api.deviceManager.listAll.query({ addonId: owner })
3185
3742
  }, LEGACY_INTEGRATION_NAME);
3186
3743
  if (sweep.kind === "swept" && sweep.removed.length > 0) this.ctx.logger.info("camera grid: legacy grid cameras removed - recreate them as blocks", { meta: { removed: [...sweep.removed] } });
3187
- if (require_dist.legacySweepDone(sweep)) this.legacySwept = true;
3744
+ if (legacySweepDone(sweep)) this.legacySwept = true;
3188
3745
  } catch (error) {
3189
- this.ctx.logger.warn("camera grid: the legacy grid cameras could not be swept - retried", { meta: { error: require_dist.errMsg(error) } });
3746
+ this.ctx.logger.warn("camera grid: the legacy grid cameras could not be swept - retried", { meta: { error: require_scoped_settings.errMsg(error) } });
3190
3747
  }
3191
3748
  }
3192
3749
  /**
@@ -3203,19 +3760,19 @@ var CameraGridAddon = class extends require_dist.BaseAddon {
3203
3760
  * emitted something unexpected.
3204
3761
  */
3205
3762
  subscribeSourceActivity() {
3206
- this.subscribe({ category: require_dist.EventCategory.MotionOnMotionChanged }, (event) => {
3763
+ this.subscribe({ category: require_base_addon.EventCategory.MotionOnMotionChanged }, (event) => {
3207
3764
  const data = event.data;
3208
3765
  if (typeof data.deviceId !== "number" || typeof data.detected !== "boolean") return;
3209
3766
  const at = typeof data.timestamp === "number" ? data.timestamp : Date.now();
3210
3767
  this.activity?.onSourceMotion(data.deviceId, data.detected, at);
3211
3768
  });
3212
- this.subscribe({ category: require_dist.EventCategory.PipelineAudioInferenceResult }, (event) => {
3769
+ this.subscribe({ category: require_base_addon.EventCategory.PipelineAudioInferenceResult }, (event) => {
3213
3770
  const data = event.data;
3214
3771
  const dbfs = data.frame?.level?.dbfs;
3215
3772
  if (typeof data.deviceId !== "number" || typeof dbfs !== "number") return;
3216
3773
  this.activity?.onSourceAudio(data.deviceId, dbfs, Date.now());
3217
3774
  });
3218
- this.subscribe({ category: require_dist.EventCategory.DetectionResult }, (event) => {
3775
+ this.subscribe({ category: require_base_addon.EventCategory.DetectionResult }, (event) => {
3219
3776
  const frame = event.data.frame;
3220
3777
  if (frame === void 0 || frame.kind !== "frame") return;
3221
3778
  this.activity?.onSourceDetections(frame);
@@ -3263,7 +3820,7 @@ var CameraGridAddon = class extends require_dist.BaseAddon {
3263
3820
  slots = await this.ctx.api.streamBroker.listAllProfileSlots.query();
3264
3821
  } catch (error) {
3265
3822
  this.ctx.logger.warn("camera grid: could not read the broker profile slots - keeping the last answer", { meta: {
3266
- error: require_dist.errMsg(error),
3823
+ error: require_scoped_settings.errMsg(error),
3267
3824
  grids: grids.length
3268
3825
  } });
3269
3826
  return;
@@ -3561,7 +4118,7 @@ var CameraGridAddon = class extends require_dist.BaseAddon {
3561
4118
  const device = await this.ctx.api.deviceManager.getDevice.query({ deviceId }).catch((error) => {
3562
4119
  this.ctx.logger.warn("camera grid: the grid row could not be read for its name", {
3563
4120
  tags: { deviceId },
3564
- meta: { error: require_dist.errMsg(error) }
4121
+ meta: { error: require_scoped_settings.errMsg(error) }
3565
4122
  });
3566
4123
  return null;
3567
4124
  });
@@ -3667,7 +4224,7 @@ var CameraGridAddon = class extends require_dist.BaseAddon {
3667
4224
  logger: this.ctx.logger.child("snapshot")
3668
4225
  });
3669
4226
  }).catch((err) => {
3670
- this.ctx.logger.error("camera-grid: the pinned ffmpeg could not be resolved — compositions refuse until it is (D540)", { meta: { error: require_dist.errMsg(err) } });
4227
+ this.ctx.logger.error("camera-grid: the pinned ffmpeg could not be resolved — compositions refuse until it is (D540)", { meta: { error: require_scoped_settings.errMsg(err) } });
3671
4228
  }).finally(() => {
3672
4229
  this.ffmpegResolving = null;
3673
4230
  });
@@ -3908,7 +4465,7 @@ async function startGridChild(ctx, plan, sources, onEnded) {
3908
4465
  let stdout = null;
3909
4466
  const process = new _camstack_types_node.FfmpegProcess({
3910
4467
  binaryPath: ctx.binaryPath,
3911
- buildArgs: (decodeHwAccel) => require_dist.buildFfmpegArgs(invocation(decodeHwAccel)),
4468
+ buildArgs: (decodeHwAccel) => buildFfmpegArgs(invocation(decodeHwAccel)),
3912
4469
  decodeHwAccel: plan.decodeHwAccel,
3913
4470
  logger: ctx.logger,
3914
4471
  deviceId: ctx.deviceId,