@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,804 @@
1
+ let zod = require("zod");
2
+ //#region ../types/dist/esm/interfaces/relocate.mjs
3
+ /**
4
+ * Entity-relocation job state (storage entity-routing spec, Phase 4).
5
+ *
6
+ * One shape shared by the recorder and pipeline-analytics internal movers.
7
+ * The public admin surface is `storage-migration`; child jobs remain in RAM
8
+ * because copy-if-absent, verify, delete and index/row repoint are resumable.
9
+ * Each completed/failed run also lands one durable ops-log row on its owning
10
+ * addon surface.
11
+ */
12
+ /**
13
+ * `queued` exists because the recorder mover is SINGLE-FLIGHT and an operator
14
+ * rebalance enqueues one job per (camera, profile). Refusing the second job —
15
+ * what the engine did before — turned a fifteen-camera rebalance into fifteen
16
+ * manual retries. Queued jobs run FIFO; a queued job that is cancelled never
17
+ * runs at all.
18
+ */
19
+ var RelocateJobStateSchema = /* @__PURE__ */ zod.z.enum([
20
+ "queued",
21
+ "running",
22
+ "done",
23
+ "failed",
24
+ "cancelled"
25
+ ]);
26
+ var RelocateJobSchema = /* @__PURE__ */ zod.z.object({
27
+ jobId: /* @__PURE__ */ zod.z.string(),
28
+ state: RelocateJobStateSchema,
29
+ /** Source location — for media relocation this is informational ('*': rows
30
+ * move from wherever they are to the target). */
31
+ fromLocationId: /* @__PURE__ */ zod.z.string(),
32
+ toLocationId: /* @__PURE__ */ zod.z.string(),
33
+ /** Scoped device, or null = every device. */
34
+ deviceId: /* @__PURE__ */ zod.z.number().nullable(),
35
+ /** What the job moves (owner-addon specific: segments or media). */
36
+ entities: /* @__PURE__ */ zod.z.array(/* @__PURE__ */ zod.z.string()),
37
+ filesMoved: /* @__PURE__ */ zod.z.number().int(),
38
+ bytesMoved: /* @__PURE__ */ zod.z.number().int(),
39
+ /** Total files discovered up front; null while (or when) unknown. */
40
+ filesTotal: /* @__PURE__ */ zod.z.number().int().nullable(),
41
+ /**
42
+ * Rows this run CORRECTED while moving them — a durable mutation the move
43
+ * made that nobody asked for, so it is reported where the operator reads the
44
+ * job rather than only in a log line.
45
+ *
46
+ * A footage segment records its byte count in its own NAME, and the durable
47
+ * hour row derives its aggregates from those names. A file that does not
48
+ * match its name therefore makes the ledger's sums — and with them quota and
49
+ * pressure eviction — wrong by the difference, and only a rename can fix it.
50
+ * On 2026-08-30 one such row also stalled a 110 749-file drain permanently.
51
+ *
52
+ * Absent on lanes where the question has no meaning: a media blob's size is
53
+ * in its row, not in its name, so `MediaRelocateEngine` never reconciles one.
54
+ */
55
+ rowsReconciled: /* @__PURE__ */ zod.z.number().int().nonnegative().optional(),
56
+ /**
57
+ * Rows this run FORGOT because the file they name is not on disk.
58
+ *
59
+ * The mover derived the path from the row's own fields and `stat`ed it; an
60
+ * ENOENT there is a per-path confirmation that the segment is gone (D296),
61
+ * and the durable row is dropped through the same channel eviction uses. It
62
+ * is reported for the same reason `rowsReconciled` is: this is a durable
63
+ * mutation nobody asked for, and a migration that quietly erases hour rows is
64
+ * the same failure as one that quietly skips them (D295).
65
+ *
66
+ * The production drain of 2026-08-30 would have reported 11 074 here — the
67
+ * ledger claimed 5.65 GB of footage that no longer existed.
68
+ */
69
+ rowsForgotten: /* @__PURE__ */ zod.z.number().int().nonnegative().optional(),
70
+ startedAt: /* @__PURE__ */ zod.z.number(),
71
+ finishedAt: /* @__PURE__ */ zod.z.number().nullable(),
72
+ error: /* @__PURE__ */ zod.z.string().nullable()
73
+ });
74
+ /** Profile-derived footage selection used only by the migration coordinator:
75
+ * `recordings` owns high+mid; `recordingsLow` owns low. */
76
+ var RelocateFootageClassSchema = /* @__PURE__ */ zod.z.enum(["recordings", "recordingsLow"]);
77
+ var RelocateFootageInputSchema = /* @__PURE__ */ zod.z.object({
78
+ fromLocationId: /* @__PURE__ */ zod.z.string(),
79
+ toLocationId: /* @__PURE__ */ zod.z.string(),
80
+ entities: /* @__PURE__ */ zod.z.array(/* @__PURE__ */ zod.z.enum(["segments"])).optional(),
81
+ /** Limits relocation to the logical profile class. Omit only for the
82
+ * pre-orchestration compatibility path. */
83
+ footageClass: /* @__PURE__ */ RelocateFootageClassSchema.optional(),
84
+ /** Scope the move to ONE camera. Absent = every camera on the source, which
85
+ * is what a whole-disk drain means. The rebalance path always sets it: its
86
+ * unit is a (camera, profile) pile, not a disk. */
87
+ deviceId: /* @__PURE__ */ zod.z.number().int().optional(),
88
+ /** Scope the move to specific segment profiles (`high` / `mid` / `low`).
89
+ * Finer than `footageClass`, which cannot separate high from mid — and the
90
+ * placement plan assigns those two independently, so a rebalance that could
91
+ * only say "recordings" would move footage the plan never asked to move. */
92
+ profiles: /* @__PURE__ */ zod.z.array(/* @__PURE__ */ zod.z.string()).optional(),
93
+ /** Copy throttle in MB/s (default 40) — the drain is a background chore,
94
+ * never allowed to starve live writers. */
95
+ throttleMbps: /* @__PURE__ */ zod.z.number().min(1).max(1e3).optional(),
96
+ /** Move only segments whose startMs is >= this. Absent = the whole source
97
+ * pile. Used when a full drain is too expensive and the operator only
98
+ * wants the recent window on the new disk. */
99
+ sinceMs: /* @__PURE__ */ zod.z.number().int().optional()
100
+ });
101
+ /** Internal, lease-scoped participant operation. It is intentionally separate
102
+ * from persistent recording settings: a migration never changes
103
+ * `RecordingConfig.enabled` or camera wrapper bindings. */
104
+ var StorageMigrationLeaseInputSchema = /* @__PURE__ */ zod.z.object({ leaseId: /* @__PURE__ */ zod.z.string().min(1) });
105
+ var StorageMigrationFootageMoveInputSchema = /* @__PURE__ */ RelocateFootageInputSchema.extend({ leaseId: /* @__PURE__ */ zod.z.string().min(1) });
106
+ /**
107
+ * What a `relocateMedia` pass DOES. One engine, three passes — never a second
108
+ * mover (the engine already walks both collections with a timestamp cursor and
109
+ * already has a stamp-without-copy path).
110
+ *
111
+ * - `move` — the default and the historical behaviour: event-media and
112
+ * retrain blobs move to `toLocationId` and their rows are
113
+ * stamped. The enrolled gallery is skipped (D197).
114
+ * - `seal` — ROWS ONLY, no bytes. Every row whose `locationId` is NULL is
115
+ * stamped with `toLocationId`. `toLocationId` here is the id the
116
+ * bytes ALREADY sit on — today's `eventMedia` default — because
117
+ * a NULL row means "wherever `eventMedia` points *now*", and the
118
+ * instant a repoint moves that pointer the row reads from the
119
+ * new disk while its bytes are on the old one.
120
+ * - `gallery` — the inverse selection of `move`: ONLY the retention-exempt
121
+ * (enrolled-gallery) rows, which `move` deliberately skips.
122
+ * `galleryMedia` is `cardinality: 'single'`, so this pass can
123
+ * never run beside a live second location: it is stop-the-world
124
+ * by construction, which is acceptable only because the gallery
125
+ * is a few KB per enrolled sample.
126
+ */
127
+ var MediaRelocateModeSchema = /* @__PURE__ */ zod.z.enum([
128
+ "move",
129
+ "seal",
130
+ "gallery"
131
+ ]);
132
+ var RelocateMediaInputSchema = /* @__PURE__ */ zod.z.object({
133
+ toLocationId: /* @__PURE__ */ zod.z.string(),
134
+ /**
135
+ * Restrict the pass to rows currently on this location. Omitted / `'*'` =
136
+ * every row that is not already on `toLocationId` (the historical
137
+ * behaviour). A named source is what a from→to migration needs: without it
138
+ * "move events off disk 2" also emptied disk 1.
139
+ */
140
+ fromLocationId: /* @__PURE__ */ zod.z.string().optional(),
141
+ throttleMbps: /* @__PURE__ */ zod.z.number().min(1).max(1e3).optional(),
142
+ /** Omitted = `move`, the pre-existing behaviour. */
143
+ mode: /* @__PURE__ */ MediaRelocateModeSchema.optional()
144
+ });
145
+ /**
146
+ * The unstamped population of ONE collection — split, because the gate and the
147
+ * operator ask two different questions and only one of them has to be cheap.
148
+ *
149
+ * `present` is the GATE: "is there at least one row that would be orphaned by a
150
+ * repoint". It is a single indexed seek to the first matching row, so it stays
151
+ * answerable on a saturated disk and answers in O(log n) precisely in the state
152
+ * that matters — after a seal, when the population is empty.
153
+ *
154
+ * `rows` is the NUMBER, for the refusal message and the operator's sense of
155
+ * scale. It is a second, indexed `COUNT(*)`, and `null` means **not
156
+ * measurable** — never zero. `{ present: true, rows: null }` is a legitimate
157
+ * and useful answer: "there are some, and this read could not say how many"
158
+ * still refuses the cutover, which is the whole job.
159
+ */
160
+ var UnstampedRowsSchema = /* @__PURE__ */ zod.z.object({
161
+ present: /* @__PURE__ */ zod.z.boolean(),
162
+ rows: /* @__PURE__ */ zod.z.number().int().nonnegative().nullable()
163
+ });
164
+ /**
165
+ * How many rows still carry NO `locationId` — the population a repoint would
166
+ * silently re-aim at a disk that does not hold their bytes.
167
+ *
168
+ * **`null` = the count could not be taken**, and it is NOT permission to cut
169
+ * over. The gate opens on a measured absence and on nothing else; an unread
170
+ * collection and an empty one are different facts, and this repo has already
171
+ * paid for conflating them (`RelocateResidueSchema`, D295).
172
+ */
173
+ var UnstampedEventMediaCountSchema = /* @__PURE__ */ zod.z.object({
174
+ media: UnstampedRowsSchema,
175
+ retrainFrames: UnstampedRowsSchema,
176
+ /** True when EITHER collection holds one. The refusal reads this. */
177
+ anyPresent: /* @__PURE__ */ zod.z.boolean(),
178
+ /** Sum across both, or `null` when either lane could not be counted. */
179
+ total: /* @__PURE__ */ zod.z.number().int().nonnegative().nullable()
180
+ }).nullable();
181
+ /**
182
+ * Where the stored event media sits, per storage location: how many media rows
183
+ * and how many bytes carry each location id, how many carry none (legacy,
184
+ * resolved to the default `eventMedia` location), and how many name a location
185
+ * that was not asked about (a deleted or never-listed one).
186
+ *
187
+ * One covering-index aggregate per asked location plus the NULL one, and one
188
+ * unfiltered total that scans the covering index: O(rows), not a walk of the
189
+ * rows themselves. `unlisted` is total minus the ASKED locations minus NULL, so
190
+ * it is a deleted location only when every location id was asked.
191
+ * `null` is "could not be measured", never zero.
192
+ */
193
+ var MediaLocationCensusInputSchema = /* @__PURE__ */ zod.z.object({ locationIds: /* @__PURE__ */ zod.z.array(/* @__PURE__ */ zod.z.string().min(1)).max(50).readonly() });
194
+ var MediaLocationCensusRowSchema = /* @__PURE__ */ zod.z.object({
195
+ locationId: /* @__PURE__ */ zod.z.string(),
196
+ rows: /* @__PURE__ */ zod.z.number().int().nonnegative(),
197
+ bytes: /* @__PURE__ */ zod.z.number().nonnegative()
198
+ });
199
+ var MediaLocationCensusSchema = /* @__PURE__ */ zod.z.object({
200
+ locations: /* @__PURE__ */ zod.z.array(MediaLocationCensusRowSchema).readonly(),
201
+ unstamped: /* @__PURE__ */ zod.z.object({
202
+ rows: /* @__PURE__ */ zod.z.number().int().nonnegative(),
203
+ bytes: /* @__PURE__ */ zod.z.number().nonnegative()
204
+ }),
205
+ /** Rows stamped with a location id that was not in the asked list. */
206
+ unlisted: /* @__PURE__ */ zod.z.object({
207
+ rows: /* @__PURE__ */ zod.z.number().int().nonnegative(),
208
+ bytes: /* @__PURE__ */ zod.z.number().nonnegative()
209
+ }),
210
+ total: /* @__PURE__ */ zod.z.object({
211
+ rows: /* @__PURE__ */ zod.z.number().int().nonnegative(),
212
+ bytes: /* @__PURE__ */ zod.z.number().nonnegative()
213
+ })
214
+ });
215
+ var StorageMigrationMediaMoveInputSchema = /* @__PURE__ */ RelocateMediaInputSchema.extend({ leaseId: /* @__PURE__ */ zod.z.string().min(1) });
216
+ /** The independently selectable logical storage classes — every class
217
+ * `storage.listLocationDeclarations` reports, so an operator never meets a
218
+ * Zod enum error where they should meet an explanation.
219
+ *
220
+ * `recordings` encompasses the high and mid segment profiles; `recordingsLow`
221
+ * is low segments; `eventMedia` is post-analysis blobs; `galleryMedia` is the
222
+ * enrolled gallery; `backups` is the system backup archive. The last two have
223
+ * their own rules — see {@link StorageMigrationFindingCodeSchema}. */
224
+ var StorageMigrationClassSchema = /* @__PURE__ */ zod.z.enum([
225
+ "recordings",
226
+ "recordingsLow",
227
+ "eventMedia",
228
+ "backups",
229
+ "galleryMedia"
230
+ ]);
231
+ /** A destination is always an existing, fully-qualified location id. The
232
+ * migration API intentionally never changes a source location's `basePath`:
233
+ * callers create a new `<type>:<slug>` location, then select it here. */
234
+ var StorageMigrationDestinationsSchema = /* @__PURE__ */ zod.z.object({
235
+ recordings: /* @__PURE__ */ zod.z.string().min(1).optional(),
236
+ recordingsLow: /* @__PURE__ */ zod.z.string().min(1).optional(),
237
+ eventMedia: /* @__PURE__ */ zod.z.string().min(1).optional(),
238
+ backups: /* @__PURE__ */ zod.z.string().min(1).optional(),
239
+ galleryMedia: /* @__PURE__ */ zod.z.string().min(1).optional()
240
+ }).refine((value) => Object.keys(value).length > 0, { message: "select at least one storage class" });
241
+ /**
242
+ * Optional named source per class. Omitted = the class's current default
243
+ * (the historical behaviour). A named source that is NOT the default is a
244
+ * drain of that disk: bytes move, the default stays, and the source is
245
+ * disabled when the move finishes.
246
+ */
247
+ var StorageMigrationSourcesSchema = /* @__PURE__ */ zod.z.object({
248
+ recordings: /* @__PURE__ */ zod.z.string().min(1).optional(),
249
+ recordingsLow: /* @__PURE__ */ zod.z.string().min(1).optional(),
250
+ eventMedia: /* @__PURE__ */ zod.z.string().min(1).optional(),
251
+ backups: /* @__PURE__ */ zod.z.string().min(1).optional(),
252
+ galleryMedia: /* @__PURE__ */ zod.z.string().min(1).optional()
253
+ }).optional();
254
+ /**
255
+ * How a migration sequences the cutover against the byte move.
256
+ *
257
+ * - `blocking` — the historical order: pause, move every byte, repoint,
258
+ * resume. Recording is stopped for the whole move. Right
259
+ * for a small or a cold class, and the only legal mode for
260
+ * a `cardinality: 'single'` class.
261
+ * - `nonBlocking` — repoint FIRST, drain behind: seal, pause, repoint,
262
+ * refresh, resume, then move the past with everything
263
+ * running. The pause is three bounded instants (a detach +
264
+ * attach round, a write-gate drain, a lease) instead of one
265
+ * bounded by bytes. 1.09 TB at 7–14 MB/s is thirty hours of
266
+ * stopped recording under `blocking`; the same move is
267
+ * seconds of stopped recording under `nonBlocking`.
268
+ *
269
+ * The mode is on the JOB, not only on the input, because `status` is where an
270
+ * operator finds out which one is running.
271
+ */
272
+ var StorageMigrationModeSchema = /* @__PURE__ */ zod.z.enum(["blocking", "nonBlocking"]);
273
+ /** Shared input for planning and starting an orchestrated storage migration. */
274
+ var StorageMigrationInputSchema = /* @__PURE__ */ zod.z.object({
275
+ destinations: StorageMigrationDestinationsSchema,
276
+ /** Omitted = each class's current default. */
277
+ sources: StorageMigrationSourcesSchema,
278
+ throttleMbps: /* @__PURE__ */ zod.z.number().min(1).max(1e3).optional(),
279
+ /** Omitted = `blocking`, which stays the default. */
280
+ mode: /* @__PURE__ */ StorageMigrationModeSchema.optional()
281
+ });
282
+ /**
283
+ * The durable coordinator state machine.
284
+ *
285
+ * `blocking`:
286
+ * planning → pausing → moving → verifying → repointing → refreshing → resuming → done
287
+ *
288
+ * `nonBlocking`:
289
+ * planning → sealing → pausing → repointing → refreshing → resuming → draining → verifying → done
290
+ *
291
+ * Same phases, different order plus two new ones — not a second mover.
292
+ * `sealing` closes the `eventMedia` NULL-row hole BEFORE anything is paused;
293
+ * `draining` runs the same movers UNLEASED, after every writer is back up.
294
+ * `repointing` is still the only phase that changes a default location.
295
+ */
296
+ var StorageMigrationPhaseSchema = /* @__PURE__ */ zod.z.enum([
297
+ "planning",
298
+ "sealing",
299
+ "pausing",
300
+ "moving",
301
+ "draining",
302
+ "verifying",
303
+ "repointing",
304
+ "refreshing",
305
+ "resuming",
306
+ "done",
307
+ "failed",
308
+ "cancelled"
309
+ ]);
310
+ var StorageMigrationParticipantSchema = /* @__PURE__ */ zod.z.enum([
311
+ "pipeline",
312
+ "recorder",
313
+ "analytics"
314
+ ]);
315
+ /**
316
+ * The mover's own numbers, folded onto the coordinator's durable move record.
317
+ *
318
+ * The long half of a non-blocking migration is `draining`, and it is measured
319
+ * in hours: 136 885 files at ~4 MB/s is about five of them. Before this shape
320
+ * existed the only place those numbers appeared was a Loki line, so an operator
321
+ * watching the Admin UI saw `phase: draining` and nothing else for a whole
322
+ * afternoon.
323
+ *
324
+ * It is POLLED, never pushed. Events are telemetry and may be dropped
325
+ * (D8/D11), and a dropped progress event is indistinguishable from a stalled
326
+ * mover — which is the exact failure this is meant to end. The coordinator's
327
+ * `waitForMoves` already fetches the whole {@link RelocateJob} on every tick to
328
+ * read `state`; folding the counters costs no extra read and makes the durable
329
+ * record say afterwards how far a move actually got.
330
+ *
331
+ * `filesTotal` is `null` for "no honest denominator" and is never zero-filled:
332
+ * a windowed footage job (`sinceMs`) and a node with no ledger both genuinely
333
+ * cannot say M, and a 0 there would render as "100 % done".
334
+ */
335
+ var StorageMigrationMoveProgressSchema = /* @__PURE__ */ zod.z.object({
336
+ filesMoved: /* @__PURE__ */ zod.z.number().int().nonnegative(),
337
+ /** The archive census — the **M** of "N of M" (D295). `null` = unknowable. */
338
+ filesTotal: /* @__PURE__ */ zod.z.number().int().nonnegative().nullable(),
339
+ bytesMoved: /* @__PURE__ */ zod.z.number().int().nonnegative(),
340
+ /** Rows the mover corrected while moving them — see `RelocateJob`. Absent on
341
+ * a lane that cannot reconcile. A migration that silently rewrote durable
342
+ * rows would be the same failure as one that silently skipped them. */
343
+ rowsReconciled: /* @__PURE__ */ zod.z.number().int().nonnegative().optional(),
344
+ /** The MOVER's start, not the migration's: a drain restarted after an addon
345
+ * crash gets a new mover, and a rate computed from the migration's start
346
+ * would silently average in the time nothing was running. */
347
+ startedAt: /* @__PURE__ */ zod.z.number(),
348
+ /** When the coordinator last read these numbers. Paired with `startedAt` it
349
+ * is the only honest rate: both clocks are the hub's, so a UI never has to
350
+ * subtract its own. */
351
+ observedAt: /* @__PURE__ */ zod.z.number()
352
+ });
353
+ var StorageMigrationMoveSchema = /* @__PURE__ */ zod.z.object({
354
+ storageClass: StorageMigrationClassSchema,
355
+ fromLocationId: /* @__PURE__ */ zod.z.string(),
356
+ toLocationId: /* @__PURE__ */ zod.z.string(),
357
+ /**
358
+ * True when `from` was NOT the class default at plan time. The move still
359
+ * copies bytes, but the default is left alone and the source is disabled
360
+ * once the copy verifies. Absent on jobs planned before this field existed
361
+ * — those jobs always repointed, which is `false`.
362
+ */
363
+ freezeSource: /* @__PURE__ */ zod.z.boolean().optional(),
364
+ moverJobId: /* @__PURE__ */ zod.z.string().nullable(),
365
+ state: /* @__PURE__ */ RelocateJobStateSchema.nullable(),
366
+ error: /* @__PURE__ */ zod.z.string().nullable(),
367
+ /** Last observed mover counters; `null` until the mover has been polled once. */
368
+ progress: /* @__PURE__ */ StorageMigrationMoveProgressSchema.nullable()
369
+ });
370
+ var StorageMigrationJobSchema = /* @__PURE__ */ zod.z.object({
371
+ jobId: /* @__PURE__ */ zod.z.string(),
372
+ phase: StorageMigrationPhaseSchema,
373
+ /** Which order this job is running. `status` is the only place an operator
374
+ * can tell a seconds-long cutover from a thirty-hour one. */
375
+ mode: StorageMigrationModeSchema,
376
+ destinations: StorageMigrationDestinationsSchema,
377
+ sources: StorageMigrationSourcesSchema,
378
+ throttleMbps: /* @__PURE__ */ zod.z.number(),
379
+ moves: /* @__PURE__ */ zod.z.array(StorageMigrationMoveSchema),
380
+ pauseLeaseId: /* @__PURE__ */ zod.z.string().nullable(),
381
+ pausedParticipants: /* @__PURE__ */ zod.z.array(StorageMigrationParticipantSchema),
382
+ repointed: /* @__PURE__ */ zod.z.boolean(),
383
+ cancelRequested: /* @__PURE__ */ zod.z.boolean(),
384
+ startedAt: /* @__PURE__ */ zod.z.number(),
385
+ updatedAt: /* @__PURE__ */ zod.z.number(),
386
+ finishedAt: /* @__PURE__ */ zod.z.number().nullable(),
387
+ error: /* @__PURE__ */ zod.z.string().nullable()
388
+ });
389
+ /**
390
+ * What the planner NOTICED but did not refuse.
391
+ *
392
+ * A refusal throws — the operator cannot miss it. A finding is the other half:
393
+ * something true about this plan that changes what the operator should expect,
394
+ * surfaced where they read it rather than in a document they will not open.
395
+ *
396
+ * - `sharesDeviceWithSource` — the destination realpath's to the same place as
397
+ * the source. The move will be a row re-stamp, not a byte move, and it buys
398
+ * no redundancy. NOTE: this is PATH identity, not `st_dev` — two distinct
399
+ * directories on one filesystem are NOT detected. See
400
+ * `deviceIdentityUnknown`.
401
+ * - `deviceIdentityUnknown` — a location carries a `nodeId` other than this
402
+ * one (or has no `basePath`), so its realpath cannot be taken here and the
403
+ * same-device question was not answered at all. Stated rather than assumed
404
+ * clear: a check that silently never fires is worse than no check.
405
+ * - `unstampedEventMediaRows` — how many `eventMedia`/retrain rows still carry
406
+ * no `locationId`. Non-zero refuses a `nonBlocking` cutover.
407
+ * - `blockingOnly` — this class is `cardinality: 'single'`, so it can never
408
+ * span two locations and can only ever be moved stop-the-world.
409
+ * - `noMover` — the class is selectable and planned, but no addon owns a mover
410
+ * for it. The migration cannot move its bytes.
411
+ */
412
+ var StorageMigrationFindingCodeSchema = /* @__PURE__ */ zod.z.enum([
413
+ "sharesDeviceWithSource",
414
+ "deviceIdentityUnknown",
415
+ "unstampedEventMediaRows",
416
+ "blockingOnly",
417
+ "noMover"
418
+ ]);
419
+ var StorageMigrationFindingSchema = /* @__PURE__ */ zod.z.object({
420
+ code: StorageMigrationFindingCodeSchema,
421
+ storageClass: StorageMigrationClassSchema,
422
+ /** Human-readable, already carrying the ids and counts. */
423
+ message: /* @__PURE__ */ zod.z.string()
424
+ });
425
+ var StorageMigrationPlanSchema = /* @__PURE__ */ zod.z.object({
426
+ destinations: StorageMigrationDestinationsSchema,
427
+ sources: StorageMigrationSourcesSchema,
428
+ /** The mode this plan was built for. A plan is only valid for its mode: the
429
+ * `eventMedia` seal gate and the single-cardinality refusal both depend on
430
+ * it. */
431
+ mode: StorageMigrationModeSchema,
432
+ moves: /* @__PURE__ */ zod.z.array(/* @__PURE__ */ zod.z.object({
433
+ storageClass: StorageMigrationClassSchema,
434
+ fromLocationId: /* @__PURE__ */ zod.z.string(),
435
+ toLocationId: /* @__PURE__ */ zod.z.string(),
436
+ freezeSource: /* @__PURE__ */ zod.z.boolean().optional()
437
+ })),
438
+ findings: /* @__PURE__ */ zod.z.array(StorageMigrationFindingSchema)
439
+ });
440
+ /**
441
+ * Which single-flight engine owns a class of work.
442
+ *
443
+ * Shared rather than re-declared per consumer: the coordinator lanes its moves
444
+ * by it, and `storageMigration.movers` labels a mover with it so an operator
445
+ * can see *which* engine is busy when a drain refuses to start beside another.
446
+ */
447
+ var StorageMigrationLaneSchema = /* @__PURE__ */ zod.z.enum(["footage", "media"]);
448
+ /**
449
+ * A mover as it exists RIGHT NOW, whether or not a migration job owns it.
450
+ *
451
+ * The coordinator's job record is the state of record for a migration, and its
452
+ * moves carry {@link StorageMigrationMoveProgress}. But the movers are usable
453
+ * standalone — `recording.relocateFootage` and `pipelineAnalytics.relocateMedia`
454
+ * are both operator-callable, and on 2026-08-29 a five-hour drain was armed that
455
+ * way because no supported UI path existed. A mover armed like that has no job
456
+ * to fold progress into, so it has to be readable on its own or it is invisible.
457
+ *
458
+ * `migrationJobId` is what tells the two apart: `null` means nothing here
459
+ * orchestrated it.
460
+ */
461
+ var StorageMigrationMoverSchema = /* @__PURE__ */ zod.z.object({
462
+ lane: StorageMigrationLaneSchema,
463
+ job: RelocateJobSchema,
464
+ /** The coordinator job that armed this mover, or `null` for a mover armed
465
+ * directly against the owning addon. */
466
+ migrationJobId: /* @__PURE__ */ zod.z.string().nullable(),
467
+ /** When the hub read these counters. Stamped here so a rate is `bytesMoved`
468
+ * over (`observedAt` − `job.startedAt`) with BOTH ends on the hub's clock —
469
+ * a browser subtracting its own `Date.now()` from a server `startedAt` is a
470
+ * rate made of two different clocks. */
471
+ observedAt: /* @__PURE__ */ zod.z.number()
472
+ });
473
+ /**
474
+ * What a SOURCE still holds for one storage class — the number that makes a
475
+ * "drain remaining" action honest rather than hopeful.
476
+ *
477
+ * It comes from the archive (`SegmentHourLedger.census` for footage, the media
478
+ * engine's own selection count for media), never from the resident index: a
479
+ * drain sized off `RecordingIndex` is what reported `done` over 80.3 GB it had
480
+ * never been told about (D295).
481
+ *
482
+ * `items`/`bytes` are `null` for "the archive could not be asked", which is
483
+ * deliberately NOT zero: a drain is still offered for an unknown residue,
484
+ * because refusing on an unanswerable read would hide exactly the case an
485
+ * operator needs to act on.
486
+ */
487
+ var StorageMigrationResidueSchema = /* @__PURE__ */ zod.z.object({
488
+ storageClass: StorageMigrationClassSchema,
489
+ /** The location still holding the data. `'*'` for the media lane, whose rows
490
+ * move from wherever they are rather than from one named source. */
491
+ fromLocationId: /* @__PURE__ */ zod.z.string(),
492
+ /** Where a drain would move it — the class's CURRENT default. */
493
+ toLocationId: /* @__PURE__ */ zod.z.string(),
494
+ /** Segments (footage lane) or rows (media lane) still on the source. */
495
+ items: /* @__PURE__ */ zod.z.number().int().nonnegative().nullable(),
496
+ /** Bytes on the source; `null` when the lane counts rows rather than bytes. */
497
+ bytes: /* @__PURE__ */ zod.z.number().int().nonnegative().nullable()
498
+ });
499
+ /**
500
+ * Run the DRAIN half and nothing else.
501
+ *
502
+ * A migration that reached `done` has already repointed, so `start` correctly
503
+ * refuses its destination ("already the default") — there is nothing left to
504
+ * repoint. But the drain can fail, be cancelled, be interrupted by a restart,
505
+ * or finish against a work list that was a tenth of the archive (D295), and
506
+ * before this there was no supported way to run only that half: the only way
507
+ * through was calling `recording.relocateFootage` by hand over admin tRPC.
508
+ *
509
+ * `drain` NEVER calls `setDefaultLocations`. That is what keeps `start`'s
510
+ * refusal meaningful: the two verbs are disjoint, so nothing here can silently
511
+ * re-repoint a class that is already migrated.
512
+ */
513
+ var StorageMigrationDrainInputSchema = /* @__PURE__ */ zod.z.object({
514
+ /** The classes to drain. Each must appear in `storageMigration.residue`, so
515
+ * a class whose source is already empty is refused rather than started. */
516
+ classes: /* @__PURE__ */ zod.z.array(StorageMigrationClassSchema).min(1),
517
+ throttleMbps: /* @__PURE__ */ zod.z.number().min(1).max(1e3).optional()
518
+ });
519
+ /** What a footage source still holds, asked of the durable hour ledger. */
520
+ var RelocateResidueInputSchema = /* @__PURE__ */ zod.z.object({
521
+ fromLocationId: /* @__PURE__ */ zod.z.string().min(1),
522
+ /** Narrow to one logical class; omit for every profile on the location. */
523
+ footageClass: /* @__PURE__ */ RelocateFootageClassSchema.optional()
524
+ });
525
+ /** `null` = the archive could not answer (no ledger on this node, or the
526
+ * aggregate failed). Never conflated with an empty source. */
527
+ var RelocateResidueSchema = /* @__PURE__ */ zod.z.object({
528
+ segments: /* @__PURE__ */ zod.z.number().int().nonnegative(),
529
+ bytes: /* @__PURE__ */ zod.z.number().int().nonnegative()
530
+ }).nullable();
531
+ /**
532
+ * Ask one location whether its durable hour rows describe the disk — the walk
533
+ * (D319).
534
+ *
535
+ * `apply` DEFAULTS TO FALSE and that default is the product: the operator's
536
+ * missing tool is the question, and the dry run is how they sanity-check the
537
+ * destructive run before authorising it.
538
+ */
539
+ var LedgerWalkInputSchema = /* @__PURE__ */ zod.z.object({
540
+ locationId: /* @__PURE__ */ zod.z.string().min(1),
541
+ /** Forget the confirmed-absent rows, rather than only counting them. */
542
+ apply: /* @__PURE__ */ zod.z.boolean().optional(),
543
+ /** Narrow to one camera. */
544
+ deviceId: /* @__PURE__ */ zod.z.number().int().positive().optional(),
545
+ /** Narrow to these recording profiles; empty/absent = every profile. */
546
+ profiles: /* @__PURE__ */ zod.z.array(/* @__PURE__ */ zod.z.string().min(1)).optional()
547
+ });
548
+ /** Why a whole walk did nothing. Every one leaves the ledger untouched. */
549
+ var LedgerWalkRefusalSchema = /* @__PURE__ */ zod.z.enum([
550
+ "location-unknown",
551
+ "source-writable",
552
+ "no-ledger",
553
+ "archive-unreadable",
554
+ "anchor-absent",
555
+ "anchor-unreadable",
556
+ "anchor-moved"
557
+ ]);
558
+ /** Every skip reason, always present, always a number — so a reason that never
559
+ * fired reports as zero rather than absent and the report shape is constant
560
+ * between passes. Spelled out rather than `z.record` for exactly that. */
561
+ var LedgerWalkSkipCountsSchema = /* @__PURE__ */ zod.z.object({
562
+ "live-tail": /* @__PURE__ */ zod.z.number().int().nonnegative(),
563
+ "listing-error": /* @__PURE__ */ zod.z.number().int().nonnegative(),
564
+ "path-mismatch": /* @__PURE__ */ zod.z.number().int().nonnegative(),
565
+ "durable-refused": /* @__PURE__ */ zod.z.number().int().nonnegative()
566
+ });
567
+ /** One camera's share of a walk, so a report names cameras and not rows. */
568
+ var LedgerWalkDeviceReportSchema = /* @__PURE__ */ zod.z.object({
569
+ deviceId: /* @__PURE__ */ zod.z.number().int(),
570
+ hoursWalked: /* @__PURE__ */ zod.z.number().int().nonnegative(),
571
+ hoursMissing: /* @__PURE__ */ zod.z.number().int().nonnegative(),
572
+ ghostSegments: /* @__PURE__ */ zod.z.number().int().nonnegative(),
573
+ ghostBytes: /* @__PURE__ */ zod.z.number().int().nonnegative(),
574
+ forgottenSegments: /* @__PURE__ */ zod.z.number().int().nonnegative(),
575
+ orphanFiles: /* @__PURE__ */ zod.z.number().int().nonnegative()
576
+ });
577
+ /**
578
+ * What one walk claimed, listed, found and (only when armed) forgot.
579
+ *
580
+ * `archiveSegments` is the **M** and `segmentsClaimed` the **N** (D295), so a
581
+ * walk that saw a fraction of the location is visible in its own report rather
582
+ * than in the absence of one.
583
+ */
584
+ var LedgerWalkReportSchema = /* @__PURE__ */ zod.z.object({
585
+ locationId: /* @__PURE__ */ zod.z.string(),
586
+ applied: /* @__PURE__ */ zod.z.boolean(),
587
+ refused: /* @__PURE__ */ LedgerWalkRefusalSchema.nullable(),
588
+ archiveSegments: /* @__PURE__ */ zod.z.number().int().nonnegative().nullable(),
589
+ archiveBytes: /* @__PURE__ */ zod.z.number().int().nonnegative().nullable(),
590
+ hoursClaimed: /* @__PURE__ */ zod.z.number().int().nonnegative(),
591
+ hoursWalked: /* @__PURE__ */ zod.z.number().int().nonnegative(),
592
+ hoursMissing: /* @__PURE__ */ zod.z.number().int().nonnegative(),
593
+ /** `readdir` calls issued — the cost, stated in the unit that is paid. */
594
+ listings: /* @__PURE__ */ zod.z.number().int().nonnegative(),
595
+ segmentsClaimed: /* @__PURE__ */ zod.z.number().int().nonnegative(),
596
+ ghostSegments: /* @__PURE__ */ zod.z.number().int().nonnegative(),
597
+ ghostBytes: /* @__PURE__ */ zod.z.number().int().nonnegative(),
598
+ ghostHoursWhole: /* @__PURE__ */ zod.z.number().int().nonnegative(),
599
+ forgottenSegments: /* @__PURE__ */ zod.z.number().int().nonnegative(),
600
+ forgottenBytes: /* @__PURE__ */ zod.z.number().int().nonnegative(),
601
+ /** Files under a claimed hour that no durable row names. Never deleted. */
602
+ orphanFiles: /* @__PURE__ */ zod.z.number().int().nonnegative(),
603
+ orphanSample: /* @__PURE__ */ zod.z.array(/* @__PURE__ */ zod.z.string()).readonly(),
604
+ hoursSkipped: /* @__PURE__ */ zod.z.number().int().nonnegative(),
605
+ skippedByReason: LedgerWalkSkipCountsSchema,
606
+ /** The walk stopped at its per-pass hour bound with claims unwalked. */
607
+ bounded: /* @__PURE__ */ zod.z.boolean(),
608
+ byDevice: /* @__PURE__ */ zod.z.array(LedgerWalkDeviceReportSchema).readonly()
609
+ });
610
+ /** How many rows a media pass would still act on against a given target — the
611
+ * media lane's denominator AND its residue, from ONE derivation so the two can
612
+ * never disagree. `null` = the count could not be taken. */
613
+ var RelocatableMediaCountSchema = /* @__PURE__ */ zod.z.object({ rows: /* @__PURE__ */ zod.z.number().int().nonnegative() }).nullable();
614
+ var RelocatableMediaCountInputSchema = /* @__PURE__ */ zod.z.object({
615
+ toLocationId: /* @__PURE__ */ zod.z.string().min(1),
616
+ /** Restrict the count to one source; omitted / `'*'` = every non-target row. */
617
+ fromLocationId: /* @__PURE__ */ zod.z.string().optional(),
618
+ /** Omitted = `move`. */
619
+ mode: /* @__PURE__ */ MediaRelocateModeSchema.optional()
620
+ });
621
+ /**
622
+ * Operator cleanup of leftover analytics rows, optional debug media, and
623
+ * ghost ledger entries on frozen footage locations.
624
+ *
625
+ * A pass is tens of minutes on a standing backlog. The hub method RETURNS
626
+ * `{ jobId }` immediately; progress is `cleanupStatus`. Awaiting the work
627
+ * is how `addons.custom` hit the 60 s UDS deadline while reclaim continued
628
+ * with no operator-visible status.
629
+ */
630
+ var StorageCleanupPhaseSchema = /* @__PURE__ */ zod.z.enum([
631
+ "orphans",
632
+ "debug-media",
633
+ "ghost-ledger",
634
+ "done",
635
+ "failed",
636
+ "cancelled"
637
+ ]);
638
+ var StorageCleanupInputSchema = /* @__PURE__ */ zod.z.object({
639
+ /** Also walk motion stills / track filmstrips. Off by default. */
640
+ includeDebugMedia: /* @__PURE__ */ zod.z.boolean().optional() });
641
+ var StorageCleanupJobSchema = /* @__PURE__ */ zod.z.object({
642
+ jobId: /* @__PURE__ */ zod.z.string(),
643
+ phase: StorageCleanupPhaseSchema,
644
+ includeDebugMedia: /* @__PURE__ */ zod.z.boolean(),
645
+ orphansReclaimed: /* @__PURE__ */ zod.z.number().int().nonnegative(),
646
+ orphanBytesReclaimed: /* @__PURE__ */ zod.z.number().int().nonnegative(),
647
+ debugMediaReclaimed: /* @__PURE__ */ zod.z.number().int().nonnegative(),
648
+ debugMediaBytesReclaimed: /* @__PURE__ */ zod.z.number().int().nonnegative(),
649
+ ghostsForgotten: /* @__PURE__ */ zod.z.number().int().nonnegative(),
650
+ ghostBytesForgotten: /* @__PURE__ */ zod.z.number().int().nonnegative(),
651
+ /** Short operator-facing line: current collection, pass, or location. */
652
+ detail: /* @__PURE__ */ zod.z.string().nullable(),
653
+ cancelRequested: /* @__PURE__ */ zod.z.boolean(),
654
+ startedAt: /* @__PURE__ */ zod.z.number(),
655
+ updatedAt: /* @__PURE__ */ zod.z.number(),
656
+ finishedAt: /* @__PURE__ */ zod.z.number().nullable(),
657
+ error: /* @__PURE__ */ zod.z.string().nullable()
658
+ });
659
+ var StorageCleanupStatusInputSchema = /* @__PURE__ */ zod.z.object({ jobId: /* @__PURE__ */ zod.z.string().optional() });
660
+ //#endregion
661
+ Object.defineProperty(exports, "LedgerWalkInputSchema", {
662
+ enumerable: true,
663
+ get: function() {
664
+ return LedgerWalkInputSchema;
665
+ }
666
+ });
667
+ Object.defineProperty(exports, "LedgerWalkReportSchema", {
668
+ enumerable: true,
669
+ get: function() {
670
+ return LedgerWalkReportSchema;
671
+ }
672
+ });
673
+ Object.defineProperty(exports, "MediaLocationCensusInputSchema", {
674
+ enumerable: true,
675
+ get: function() {
676
+ return MediaLocationCensusInputSchema;
677
+ }
678
+ });
679
+ Object.defineProperty(exports, "MediaLocationCensusSchema", {
680
+ enumerable: true,
681
+ get: function() {
682
+ return MediaLocationCensusSchema;
683
+ }
684
+ });
685
+ Object.defineProperty(exports, "RelocatableMediaCountInputSchema", {
686
+ enumerable: true,
687
+ get: function() {
688
+ return RelocatableMediaCountInputSchema;
689
+ }
690
+ });
691
+ Object.defineProperty(exports, "RelocatableMediaCountSchema", {
692
+ enumerable: true,
693
+ get: function() {
694
+ return RelocatableMediaCountSchema;
695
+ }
696
+ });
697
+ Object.defineProperty(exports, "RelocateFootageInputSchema", {
698
+ enumerable: true,
699
+ get: function() {
700
+ return RelocateFootageInputSchema;
701
+ }
702
+ });
703
+ Object.defineProperty(exports, "RelocateJobSchema", {
704
+ enumerable: true,
705
+ get: function() {
706
+ return RelocateJobSchema;
707
+ }
708
+ });
709
+ Object.defineProperty(exports, "RelocateMediaInputSchema", {
710
+ enumerable: true,
711
+ get: function() {
712
+ return RelocateMediaInputSchema;
713
+ }
714
+ });
715
+ Object.defineProperty(exports, "RelocateResidueInputSchema", {
716
+ enumerable: true,
717
+ get: function() {
718
+ return RelocateResidueInputSchema;
719
+ }
720
+ });
721
+ Object.defineProperty(exports, "RelocateResidueSchema", {
722
+ enumerable: true,
723
+ get: function() {
724
+ return RelocateResidueSchema;
725
+ }
726
+ });
727
+ Object.defineProperty(exports, "StorageCleanupInputSchema", {
728
+ enumerable: true,
729
+ get: function() {
730
+ return StorageCleanupInputSchema;
731
+ }
732
+ });
733
+ Object.defineProperty(exports, "StorageCleanupJobSchema", {
734
+ enumerable: true,
735
+ get: function() {
736
+ return StorageCleanupJobSchema;
737
+ }
738
+ });
739
+ Object.defineProperty(exports, "StorageCleanupStatusInputSchema", {
740
+ enumerable: true,
741
+ get: function() {
742
+ return StorageCleanupStatusInputSchema;
743
+ }
744
+ });
745
+ Object.defineProperty(exports, "StorageMigrationDrainInputSchema", {
746
+ enumerable: true,
747
+ get: function() {
748
+ return StorageMigrationDrainInputSchema;
749
+ }
750
+ });
751
+ Object.defineProperty(exports, "StorageMigrationFootageMoveInputSchema", {
752
+ enumerable: true,
753
+ get: function() {
754
+ return StorageMigrationFootageMoveInputSchema;
755
+ }
756
+ });
757
+ Object.defineProperty(exports, "StorageMigrationInputSchema", {
758
+ enumerable: true,
759
+ get: function() {
760
+ return StorageMigrationInputSchema;
761
+ }
762
+ });
763
+ Object.defineProperty(exports, "StorageMigrationJobSchema", {
764
+ enumerable: true,
765
+ get: function() {
766
+ return StorageMigrationJobSchema;
767
+ }
768
+ });
769
+ Object.defineProperty(exports, "StorageMigrationLeaseInputSchema", {
770
+ enumerable: true,
771
+ get: function() {
772
+ return StorageMigrationLeaseInputSchema;
773
+ }
774
+ });
775
+ Object.defineProperty(exports, "StorageMigrationMediaMoveInputSchema", {
776
+ enumerable: true,
777
+ get: function() {
778
+ return StorageMigrationMediaMoveInputSchema;
779
+ }
780
+ });
781
+ Object.defineProperty(exports, "StorageMigrationMoverSchema", {
782
+ enumerable: true,
783
+ get: function() {
784
+ return StorageMigrationMoverSchema;
785
+ }
786
+ });
787
+ Object.defineProperty(exports, "StorageMigrationPlanSchema", {
788
+ enumerable: true,
789
+ get: function() {
790
+ return StorageMigrationPlanSchema;
791
+ }
792
+ });
793
+ Object.defineProperty(exports, "StorageMigrationResidueSchema", {
794
+ enumerable: true,
795
+ get: function() {
796
+ return StorageMigrationResidueSchema;
797
+ }
798
+ });
799
+ Object.defineProperty(exports, "UnstampedEventMediaCountSchema", {
800
+ enumerable: true,
801
+ get: function() {
802
+ return UnstampedEventMediaCountSchema;
803
+ }
804
+ });