@camstack/server 1.2.928 → 1.2.930

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 (241) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/package.json +10 -10
  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-utils.mjs +1 -1
  10. package/system/dist/addon-widgets.cap-C4jxflbF.js +200 -0
  11. package/system/dist/addon-widgets.cap-D9m48X78.mjs +183 -0
  12. package/system/dist/base-addon-DD5dIfcZ.js +4624 -0
  13. package/system/dist/base-addon-Md14i7pe.mjs +4505 -0
  14. package/system/dist/base-device-2sL1DMm1.js +1103 -0
  15. package/system/dist/base-device-IuM1AwXZ.mjs +1098 -0
  16. package/system/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.js +8 -6
  17. package/system/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.mjs +6 -4
  18. package/system/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.js +8 -6
  19. package/system/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.mjs +7 -5
  20. package/system/dist/builtins/alerts/alerts.addon.js +113 -56
  21. package/system/dist/builtins/alerts/alerts.addon.mjs +60 -3
  22. package/system/dist/builtins/autotrack/index.js +21 -17
  23. package/system/dist/builtins/autotrack/index.mjs +5 -1
  24. package/system/dist/builtins/backup-orchestrator/backup-orchestrator.addon.js +14 -11
  25. package/system/dist/builtins/backup-orchestrator/backup-orchestrator.addon.mjs +8 -5
  26. package/system/dist/builtins/calendars/calendars.addon.js +8 -6
  27. package/system/dist/builtins/calendars/calendars.addon.mjs +3 -1
  28. package/system/dist/builtins/camera-grid/index.js +615 -58
  29. package/system/dist/builtins/camera-grid/index.mjs +558 -1
  30. package/system/dist/builtins/composer/composer.addon.js +788 -209
  31. package/system/dist/builtins/composer/composer.addon.mjs +583 -4
  32. package/system/dist/builtins/console-logging/index.js +4 -3
  33. package/system/dist/builtins/console-logging/index.mjs +2 -1
  34. package/system/dist/builtins/core-blocks/actions-service.d.ts +18 -1
  35. package/system/dist/builtins/core-blocks/core-blocks.addon.js +8670 -386
  36. package/system/dist/builtins/core-blocks/core-blocks.addon.mjs +8294 -11
  37. package/system/dist/builtins/core-blocks/tcp-connect.d.ts +3 -0
  38. package/system/dist/builtins/core-notifier/core-notifier.addon.js +250 -21
  39. package/system/dist/builtins/core-notifier/core-notifier.addon.mjs +230 -1
  40. package/system/dist/builtins/device-history/device-history.addon.js +110 -31
  41. package/system/dist/builtins/device-history/device-history.addon.mjs +81 -2
  42. package/system/dist/builtins/device-manager/device-manager.addon.js +12806 -227
  43. package/system/dist/builtins/device-manager/device-manager.addon.mjs +12583 -5
  44. package/system/dist/builtins/hub-forwarder/index.js +4 -3
  45. package/system/dist/builtins/hub-forwarder/index.mjs +2 -1
  46. package/system/dist/builtins/keychain/index.js +31 -28
  47. package/system/dist/builtins/keychain/index.mjs +7 -4
  48. package/system/dist/builtins/liveness-monitor/liveness-monitor.addon.js +15 -12
  49. package/system/dist/builtins/liveness-monitor/liveness-monitor.addon.mjs +4 -1
  50. package/system/dist/builtins/local-auth/local-auth.addon.js +140 -39
  51. package/system/dist/builtins/local-auth/local-auth.addon.mjs +106 -6
  52. package/system/dist/builtins/local-network/local-network.addon.js +43 -39
  53. package/system/dist/builtins/local-network/local-network.addon.mjs +7 -3
  54. package/system/dist/builtins/loki-logging/index.js +23 -17
  55. package/system/dist/builtins/loki-logging/index.mjs +7 -1
  56. package/system/dist/builtins/native-metrics/native-metrics.addon.js +156 -15
  57. package/system/dist/builtins/native-metrics/native-metrics.addon.mjs +151 -10
  58. package/system/dist/builtins/platform-probe/index.js +25 -23
  59. package/system/dist/builtins/platform-probe/index.mjs +12 -10
  60. package/system/dist/builtins/record-entries/index.js +9 -7
  61. package/system/dist/builtins/record-entries/index.mjs +3 -1
  62. package/system/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.js +4 -4
  63. package/system/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.mjs +1 -1
  64. package/system/dist/builtins/snapshot/index.js +97 -44
  65. package/system/dist/builtins/snapshot/index.mjs +54 -1
  66. package/system/dist/builtins/sqlite-storage/filesystem-storage.addon.js +5 -4
  67. package/system/dist/builtins/sqlite-storage/filesystem-storage.addon.mjs +21 -20
  68. package/system/dist/builtins/sqlite-storage/index.js +1 -1
  69. package/system/dist/builtins/sqlite-storage/index.mjs +1 -1
  70. package/system/dist/builtins/sqlite-storage/sqlite-settings.addon.js +87 -61
  71. package/system/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +29 -3
  72. package/system/dist/builtins/storage-orchestrator/storage-orchestrator.addon.js +81 -72
  73. package/system/dist/builtins/storage-orchestrator/storage-orchestrator.addon.mjs +10 -1
  74. package/system/dist/builtins/system-config/system-config.addon.js +17 -14
  75. package/system/dist/builtins/system-config/system-config.addon.mjs +118 -115
  76. package/system/dist/builtins/winston-logging/index.js +7 -5
  77. package/system/dist/builtins/winston-logging/index.mjs +3 -1
  78. package/system/dist/calendars.cap-CaFlShS9.js +155 -0
  79. package/system/dist/calendars.cap-_C4eD4fi.mjs +138 -0
  80. package/system/dist/camstack-error-DJ-TUAi1.js +23 -0
  81. package/system/dist/camstack-error-viZYfcj9.mjs +18 -0
  82. package/system/dist/cap-call-context-Bd76CbOW.js +95 -0
  83. package/system/dist/cap-call-context-DNwdgGSQ.mjs +78 -0
  84. package/system/dist/capability-definition-C2rJdVeX.mjs +177 -0
  85. package/system/dist/capability-definition-HCmTem8c.js +242 -0
  86. package/system/dist/{capture-engine-BcuwOSXv.js → capture-engine-DZ0LIUqA.js} +5 -4
  87. package/system/dist/{capture-engine-Bz7eXFjT.mjs → capture-engine-DiwbjoWp.mjs} +2 -1
  88. package/system/dist/command-origin-claim-Cief660O.js +35 -0
  89. package/system/dist/command-origin-claim-D1Wy7Qld.mjs +24 -0
  90. package/system/dist/composition-sources-BEUWn2s_.mjs +391 -0
  91. package/system/dist/composition-sources-acfR4hDq.js +408 -0
  92. package/system/dist/{constants-D2etJ02O.js → constants-Ba3FTIHl.js} +1 -1
  93. package/system/dist/constants-C860Y6U4.js +26 -0
  94. package/system/dist/{constants-BcUTQd1M.mjs → constants-DB4piTD5.mjs} +1 -1
  95. package/system/dist/constants-DCLpoF4L.mjs +21 -0
  96. package/system/dist/coral-accelerators-7o8hqvcN.js +564 -0
  97. package/system/dist/coral-accelerators-BKcXP59c.mjs +521 -0
  98. package/system/dist/core-blocks.cap-BMeMCBrx.js +18733 -0
  99. package/system/dist/core-blocks.cap-BRPsLAij.mjs +18008 -0
  100. package/system/dist/{custom-action-registry-N7flBDwT.mjs → custom-action-registry-B9zFBNVa.mjs} +37 -37
  101. package/system/dist/custom-actions-BFUSalC9.mjs +25 -0
  102. package/system/dist/custom-actions-D92NRi2c.js +36 -0
  103. package/system/dist/database-snapshot.cap-DF38e-0P.js +162 -0
  104. package/system/dist/database-snapshot.cap-dhrc9xnY.mjs +133 -0
  105. package/system/dist/declared-device-BWphj9WE.js +303 -0
  106. package/system/dist/declared-device-CKERA1Hi.mjs +286 -0
  107. package/system/dist/{device-ca-ExMN3xW3.mjs → device-ca-BLM6fccc.mjs} +2 -1
  108. package/system/dist/{device-ca-CU8zh9Pi.js → device-ca-C5kJE6mL.js} +7 -6
  109. package/system/dist/device-certificate-Cddm4Idn.mjs +91 -0
  110. package/system/dist/device-certificate-CguVACQO.js +162 -0
  111. package/system/dist/device-identifiers-BQg9EQi1.js +600 -0
  112. package/system/dist/device-identifiers-iSuQCKmK.mjs +529 -0
  113. package/system/dist/device-kind-BJ2pfsjw.mjs +78 -0
  114. package/system/dist/device-kind-CsSiv_YF.js +101 -0
  115. package/system/dist/device-manager.cap-2abwVLCM.js +2874 -0
  116. package/system/dist/device-manager.cap-CFZSPfUh.mjs +2749 -0
  117. package/system/dist/device-provider.cap-3Uvk6f5-.mjs +331 -0
  118. package/system/dist/device-provider.cap-D7TV2kVH.js +366 -0
  119. package/system/dist/{device-row-store-CeW_GWh9.mjs → device-row-store-YF3jtmkk.mjs} +4 -1
  120. package/system/dist/{device-row-store-BMIR-n3m.js → device-row-store-doTfMOqn.js} +12 -9
  121. package/system/dist/device-transitions.cap-B5w5PYU_.js +860 -0
  122. package/system/dist/device-transitions.cap-DojcwEuX.mjs +819 -0
  123. package/system/dist/device-type-CbQsnFdC.js +477 -0
  124. package/system/dist/device-type-DgEvK3ch.mjs +454 -0
  125. package/system/dist/entry-kind-D9MuVJCK.mjs +44 -0
  126. package/system/dist/entry-kind-cq90c--V.js +55 -0
  127. package/system/dist/error.cap-CSM_SRfR.mjs +3423 -0
  128. package/system/dist/error.cap-DBhgPeWK.js +3848 -0
  129. package/system/dist/file-host-worker.js +1 -1
  130. package/system/dist/file-host-worker.mjs +1 -1
  131. package/system/dist/history-catalog-BKRarIL_.js +831 -0
  132. package/system/dist/history-catalog-BwTeQ4Mr.mjs +802 -0
  133. package/system/dist/{hub-identity-Csxx2Q8k.js → hub-identity-BMdR3Mw9.js} +2 -2
  134. package/system/dist/{hub-identity-CYC1820R.mjs → hub-identity-DjMN9Ac2.mjs} +10 -10
  135. package/system/dist/{hub-mdns-ciao-By5577HM.js → hub-mdns-ciao--0v1TKME.js} +5 -5
  136. package/system/dist/{hub-mdns-ciao-CCDxM5qz.mjs → hub-mdns-ciao-DBrtHOcc.mjs} +2 -2
  137. package/system/dist/index.js +763 -151
  138. package/system/dist/index.mjs +832 -220
  139. package/system/dist/integration-instances.cap-Cl9O-k4h.mjs +538 -0
  140. package/system/dist/integration-instances.cap-dJIxg2_s.js +549 -0
  141. package/system/dist/keychain-admin.cap-Db_oFX4H.js +425 -0
  142. package/system/dist/keychain-admin.cap-GtM7gVGG.mjs +396 -0
  143. package/system/dist/l10n-Bu6aUvSY.mjs +10 -0
  144. package/system/dist/l10n-CGMvp7NF.js +15 -0
  145. package/system/dist/labels-DX5S8deC.js +81 -0
  146. package/system/dist/labels-DsBcU7md.mjs +64 -0
  147. package/system/dist/{legacy-integration-rows-door-CVwOo5aq.js → legacy-integration-rows-door-B1nzxxr5.js} +2 -2
  148. package/system/dist/{legacy-integration-rows-door-D9tQOUzh.mjs → legacy-integration-rows-door-nTvo_6jQ.mjs} +1 -1
  149. package/system/dist/log-destination.cap-CxZzAVaR.mjs +143 -0
  150. package/system/dist/log-destination.cap-DELPJkZ0.js +148 -0
  151. package/system/dist/low-power-sleep.cap-7lfVU41N.js +103 -0
  152. package/system/dist/low-power-sleep.cap-tGPmaZ_V.mjs +92 -0
  153. package/system/dist/mask-shape-Ci8Co9w0.mjs +57 -0
  154. package/system/dist/mask-shape-CmPA2fst.js +92 -0
  155. package/system/dist/metrics-provider.cap-BNmcHDkQ.mjs +405 -0
  156. package/system/dist/metrics-provider.cap-BcmQUt6l.js +410 -0
  157. package/system/dist/migration-BMjgkyG2.js +380 -0
  158. package/system/dist/migration-DRJAtdy7.mjs +321 -0
  159. package/system/dist/network-access.cap-B5TWLDCC.js +1099 -0
  160. package/system/dist/network-access.cap-BJnGbE6n.mjs +1004 -0
  161. package/system/dist/notification-rules.cap-BDh0LDhV.js +3428 -0
  162. package/system/dist/notification-rules.cap-DUmiMBQB.mjs +3357 -0
  163. package/system/dist/notification-targets-CRH-9Dy5.js +509 -0
  164. package/system/dist/notification-targets-DaNE-pIt.mjs +486 -0
  165. package/system/dist/ops-log-CB4pIdqi.mjs +64 -0
  166. package/system/dist/ops-log-pxt9176Z.js +81 -0
  167. package/system/dist/pinned-binary-BOhOSNff.js +28 -0
  168. package/system/dist/pinned-binary-CrIRAi4G.mjs +23 -0
  169. package/system/dist/platform-probe.cap-1WrMhWHx.js +250 -0
  170. package/system/dist/platform-probe.cap-BFeqFLtQ.mjs +233 -0
  171. package/system/dist/prefix-walk-BkMxoXpL.js +843 -0
  172. package/system/dist/prefix-walk-ifwg_ukx.mjs +790 -0
  173. package/system/dist/ptz-autotrack.cap-BW7w0zHD.js +229 -0
  174. package/system/dist/ptz-autotrack.cap-DT2GypXw.mjs +224 -0
  175. package/system/dist/quantity-D3g5SxsZ.mjs +114 -0
  176. package/system/dist/quantity-lY1KiTSZ.js +143 -0
  177. package/system/dist/raw-secret-migration-DxuBFtvi.js +50 -0
  178. package/system/dist/raw-secret-migration-iv88mLoc.mjs +39 -0
  179. package/system/dist/record-entries.cap-sMUhTvTU.mjs +75 -0
  180. package/system/dist/record-entries.cap-ti1C046R.js +80 -0
  181. package/system/dist/record-kind-DoBfYHCs.js +203 -0
  182. package/system/dist/record-kind-ub6NXqfh.mjs +162 -0
  183. package/system/dist/recording-archive.cap-7OrIn9e5.mjs +1299 -0
  184. package/system/dist/recording-archive.cap-D7bo-QSM.js +1328 -0
  185. package/system/dist/records.cap-ClcWV64i.js +329 -0
  186. package/system/dist/records.cap-CwLT2ByG.mjs +294 -0
  187. package/system/dist/relocate-CdVQAk-w.js +804 -0
  188. package/system/dist/relocate-CoZZTui1.mjs +661 -0
  189. package/system/dist/rename-composition-block-BJsL58Ih.js +34798 -0
  190. package/system/dist/rename-composition-block-OAtErZgq.mjs +33631 -0
  191. package/system/dist/{restore-archive-BJfyu0sG.mjs → restore-archive-CjAyKpgX.mjs} +96 -94
  192. package/system/dist/{restore-archive-CIFvqOze.js → restore-archive-CkTkv3Ss.js} +6 -4
  193. package/system/dist/scoped-settings-CylSSq_8.js +955 -0
  194. package/system/dist/scoped-settings-DVWUIP7Z.mjs +650 -0
  195. package/system/dist/server-name-BIhLuHvX.mjs +35 -0
  196. package/system/dist/server-name-OALNvpqC.js +52 -0
  197. package/system/dist/settings-store.cap-Ci4F2zul.mjs +569 -0
  198. package/system/dist/settings-store.cap-wlJhCspr.js +640 -0
  199. package/system/dist/snapshot.cap-3suPdBHV.js +250 -0
  200. package/system/dist/snapshot.cap-Bs8Oyaqh.mjs +245 -0
  201. package/system/dist/source-info-DGB7SdB_.mjs +190 -0
  202. package/system/dist/source-info-DtWf4k2j.js +225 -0
  203. package/system/dist/storage-admin.cap-BSv1NjKJ.mjs +883 -0
  204. package/system/dist/storage-admin.cap-he0OqvVM.js +906 -0
  205. package/system/dist/storage-location-CBT8GCD6.mjs +163 -0
  206. package/system/dist/storage-location-CTweDMZf.js +198 -0
  207. package/system/dist/storage-location-mode-B21UVRRX.mjs +167 -0
  208. package/system/dist/storage-location-mode-CS4sMzo-.js +232 -0
  209. package/system/dist/storage-migration.cap-CyyATY_p.js +330 -0
  210. package/system/dist/storage-migration.cap-D7QqGobp.mjs +313 -0
  211. package/system/dist/storage-occupancy.cap-2rmnS58Z.js +622 -0
  212. package/system/dist/storage-occupancy.cap-CqBztTl9.mjs +611 -0
  213. package/system/dist/storage-provider.cap-Bw0CfxVc.js +213 -0
  214. package/system/dist/storage-provider.cap-CMeck2w4.mjs +202 -0
  215. package/system/dist/stream-catalog.cap-Bp7SkgIf.mjs +6560 -0
  216. package/system/dist/stream-catalog.cap-D3uwePiA.js +6763 -0
  217. package/system/dist/streaming-shared-B8cXatuU.mjs +431 -0
  218. package/system/dist/streaming-shared-DQwFZOSi.js +526 -0
  219. package/system/dist/system-reasons-Be_k1W8g.js +25 -0
  220. package/system/dist/system-reasons-CYj4qwyS.mjs +20 -0
  221. package/system/dist/tag-BxLazvVb.js +2138 -0
  222. package/system/dist/tag-uZBAq6ox.mjs +2073 -0
  223. package/system/dist/user-management.cap-B9QDu8NE.js +825 -0
  224. package/system/dist/user-management.cap-DBIi77sB.mjs +766 -0
  225. package/system/dist/vector-store.cap-DnyfrYDn.js +330 -0
  226. package/system/dist/vector-store.cap-h2GHWQ1t.mjs +319 -0
  227. package/system/dist/{wal-maintenance-CTrCPzds.mjs → wal-maintenance-BG01rOn9.mjs} +0 -0
  228. package/system/dist/{wal-maintenance-dq7T3quB.js → wal-maintenance-DyrebYKF.js} +0 -0
  229. package/system/dist/zod-secret-DS7mj1bk.js +78 -0
  230. package/system/dist/zod-secret-zY4nM61M.mjs +73 -0
  231. package/system/package.json +1 -1
  232. package/system/dist/composition-sources-BI614LJx.mjs +0 -141
  233. package/system/dist/composition-sources-v_kkb8A9.js +0 -152
  234. package/system/dist/coral-accelerators-BSVsBVzt.js +0 -250
  235. package/system/dist/coral-accelerators-BW3OcrLD.mjs +0 -231
  236. package/system/dist/dist-BCHMSqzc.mjs +0 -143467
  237. package/system/dist/dist-BZfvhfS1.js +0 -146970
  238. package/system/dist/prefix-walk-DAOBSyH1.mjs +0 -88
  239. package/system/dist/prefix-walk-Dv6MLZlM.js +0 -99
  240. package/system/dist/rename-composition-block-C9HuBrKS.js +0 -112
  241. package/system/dist/rename-composition-block-DtaYmYAR.mjs +0 -101
@@ -0,0 +1,425 @@
1
+ const require_capability_definition = require("./capability-definition-HCmTem8c.js");
2
+ const require_system_reasons = require("./system-reasons-Be_k1W8g.js");
3
+ let zod = require("zod");
4
+ //#region ../types/dist/esm/capabilities/keychain.cap.mjs
5
+ /**
6
+ * `keychain` — the hub's encrypted store of secret values (D787).
7
+ *
8
+ * Settings blobs never hold a secret: they hold a marker
9
+ * `{"$secret":"secret://<owner>/<scope>/<fieldPath>","v":1}` and the value
10
+ * lives here, AES-256-GCM under a data key that a master key wraps. This cap
11
+ * is the OWNER's door to its own values: every method is owner-checked
12
+ * against the CALLER, never against anything the caller claims.
13
+ *
14
+ * Who the caller is: the transport stamps `callerAddonId` into the args of a
15
+ * call that crossed a process (the parent `LocalChildRegistry` from the UDS
16
+ * connection, the agent from its child's connection carried in
17
+ * `$hub-cap-fwd`'s envelope). A stamp always overwrites; a wire call with no
18
+ * stamp has its claim stripped. Only a hub in-process caller may state its own
19
+ * identity — `ctx.secrets` does that with the addon id closed over. This is
20
+ * identity against BUGS and misrouting, not against a malicious addon (every
21
+ * runner is the same OS user): see the threat model in
22
+ * `docs/design/2026-10-08-secrets-keychain.md`.
23
+ *
24
+ * `callerAddonId` is deliberately NOT in any input schema: the tRPC router
25
+ * parses the input, so a session can never supply it, and the internal mount
26
+ * floors every method to admin anyway (D240).
27
+ *
28
+ * Internal: addons reach it through `ctx.secrets`, never directly.
29
+ */
30
+ /** Why a value cannot be served right now. Never folded into "missing". */
31
+ var KeychainUnavailableReasonSchema = /* @__PURE__ */ zod.z.enum([
32
+ "key-missing",
33
+ "wrong-key",
34
+ "key-file-unreadable",
35
+ "store-unavailable",
36
+ "not-initialized",
37
+ "decrypt-failed"
38
+ ]);
39
+ var KeychainStateSchema = /* @__PURE__ */ zod.z.discriminatedUnion("state", [/* @__PURE__ */ zod.z.object({ state: /* @__PURE__ */ zod.z.literal("ready") }), /* @__PURE__ */ zod.z.object({
40
+ state: /* @__PURE__ */ zod.z.literal("locked"),
41
+ reason: KeychainUnavailableReasonSchema
42
+ })]);
43
+ var KeychainResolveEntrySchema = /* @__PURE__ */ zod.z.discriminatedUnion("kind", [
44
+ /* @__PURE__ */ zod.z.object({
45
+ kind: /* @__PURE__ */ zod.z.literal("value"),
46
+ value: /* @__PURE__ */ zod.z.string(),
47
+ version: /* @__PURE__ */ zod.z.number().int()
48
+ }),
49
+ /* @__PURE__ */ zod.z.object({ kind: /* @__PURE__ */ zod.z.literal("missing") }),
50
+ /* @__PURE__ */ zod.z.object({
51
+ kind: /* @__PURE__ */ zod.z.literal("unavailable"),
52
+ reason: KeychainUnavailableReasonSchema
53
+ }),
54
+ /* @__PURE__ */ zod.z.object({ kind: /* @__PURE__ */ zod.z.literal("forbidden") })
55
+ ]);
56
+ var KeychainResolveResultSchema = /* @__PURE__ */ zod.z.record(/* @__PURE__ */ zod.z.string(), KeychainResolveEntrySchema);
57
+ /** Metadata of one stored value — never the value. */
58
+ var KeychainSecretMetaSchema = /* @__PURE__ */ zod.z.object({
59
+ ref: /* @__PURE__ */ zod.z.string(),
60
+ owner: /* @__PURE__ */ zod.z.string(),
61
+ /** Formatted scope (`global`, `node/<id>`, `device/<id>`, …). */
62
+ scope: /* @__PURE__ */ zod.z.string(),
63
+ fieldPath: /* @__PURE__ */ zod.z.string(),
64
+ version: /* @__PURE__ */ zod.z.number().int(),
65
+ createdAt: /* @__PURE__ */ zod.z.number(),
66
+ updatedAt: /* @__PURE__ */ zod.z.number(),
67
+ /** `addon:<id>` | `user:<id>` | `system`. */
68
+ updatedBy: /* @__PURE__ */ zod.z.string(),
69
+ /** Coarse — written at most once an hour per ref. `null` = never read. */
70
+ lastReadAt: /* @__PURE__ */ zod.z.number().nullable()
71
+ });
72
+ var RefListSchema = /* @__PURE__ */ zod.z.array(/* @__PURE__ */ zod.z.string().min(1)).max(512);
73
+ var keychainCapability = {
74
+ name: "keychain",
75
+ scope: "system",
76
+ mode: "singleton",
77
+ internal: true,
78
+ methods: {
79
+ /** Store (or replace) the caller's value at `ref`. Refused while locked. */
80
+ put: /* @__PURE__ */ require_capability_definition.method(/* @__PURE__ */ zod.z.object({
81
+ ref: /* @__PURE__ */ zod.z.string().min(1),
82
+ value: /* @__PURE__ */ zod.z.string().min(1)
83
+ }), /* @__PURE__ */ zod.z.object({
84
+ ref: /* @__PURE__ */ zod.z.string(),
85
+ version: /* @__PURE__ */ zod.z.number().int()
86
+ }), {
87
+ kind: "mutation",
88
+ auth: "admin"
89
+ }),
90
+ /**
91
+ * Resolve the caller's refs in one round-trip. A locked keychain answers
92
+ * `unavailable` per ref — never `missing`, never an empty value.
93
+ */
94
+ resolve: /* @__PURE__ */ require_capability_definition.method(/* @__PURE__ */ zod.z.object({ refs: RefListSchema }), KeychainResolveResultSchema, { auth: "admin" }),
95
+ /** Remove the caller's refs. Unknown refs are ignored. */
96
+ delete: /* @__PURE__ */ require_capability_definition.method(/* @__PURE__ */ zod.z.object({ refs: RefListSchema }), /* @__PURE__ */ zod.z.object({ deleted: /* @__PURE__ */ zod.z.number().int() }), {
97
+ kind: "mutation",
98
+ auth: "admin"
99
+ }),
100
+ /**
101
+ * Delete every value scoped `device/<deviceId>`, whatever its owner (D864).
102
+ * Reserved to `device-manager`, on the device-removed path: a driver's
103
+ * device-scoped secret is not anybody's once the device is gone. Answers the
104
+ * refs removed (never values).
105
+ */
106
+ deleteDeviceScope: /* @__PURE__ */ require_capability_definition.method(/* @__PURE__ */ zod.z.object({ deviceId: /* @__PURE__ */ zod.z.number().int() }), /* @__PURE__ */ zod.z.object({ refs: /* @__PURE__ */ zod.z.array(/* @__PURE__ */ zod.z.string()).readonly() }), {
107
+ kind: "mutation",
108
+ auth: "admin"
109
+ }),
110
+ /**
111
+ * Release the values rows of a DROPPED record kind held, whatever the kind's
112
+ * owner (stale-data audit). Reserved to `sqlite-settings`, the engine that
113
+ * just deleted the rows: only refs scoped `row/records:<kind>/...` are
114
+ * accepted, and the audit names the operator it acted for. Answers a count.
115
+ */
116
+ releaseRecordRefs: /* @__PURE__ */ require_capability_definition.method(/* @__PURE__ */ zod.z.object({
117
+ refs: RefListSchema,
118
+ onBehalfOf: /* @__PURE__ */ zod.z.string().min(1)
119
+ }), /* @__PURE__ */ zod.z.object({ released: /* @__PURE__ */ zod.z.number().int() }), {
120
+ kind: "mutation",
121
+ auth: "admin"
122
+ }),
123
+ /** The caller's own refs, metadata only. */
124
+ listMeta: /* @__PURE__ */ require_capability_definition.method(/* @__PURE__ */ zod.z.object({}), /* @__PURE__ */ zod.z.array(KeychainSecretMetaSchema).readonly(), { auth: "admin" }),
125
+ /** Whether values can be served — the save path refuses a write while locked. */
126
+ getState: /* @__PURE__ */ require_capability_definition.method(/* @__PURE__ */ zod.z.object({}), KeychainStateSchema, { auth: "admin" })
127
+ },
128
+ vocabulary: { notOperatorFacing: require_system_reasons.NOT_A_DEVICE.IDENTITY }
129
+ };
130
+ //#endregion
131
+ //#region ../types/dist/esm/capabilities/keychain-admin.cap.mjs
132
+ /**
133
+ * `keychain-admin` — the operator's view of the keychain (System → Secrets).
134
+ *
135
+ * Every method is `admin`. Two methods hand out material, each audited and
136
+ * each named for exactly that: {@link keychainAdminCapability.methods.reveal}
137
+ * (one value, shown briefly by the UI) and `downloadRecoveryKey` (the master
138
+ * key itself, so the operator can keep a copy off the hub). Nothing else
139
+ * returns a value.
140
+ *
141
+ * The master key's LOCATION is a fixed path, never an env var (D788, D991):
142
+ * `/run/secrets/camstack-master-key` when that file exists, the OS keychain on
143
+ * a desktop hub, else
144
+ * `<dataDir>/.keychain/master.key` — which sits beside the database in every
145
+ * whole-volume backup, and the status says so.
146
+ */
147
+ /** Where the master key in use came from. */
148
+ var KeychainKeySourceKindSchema = /* @__PURE__ */ zod.z.enum([
149
+ "mounted-file",
150
+ "previous-mounted-file",
151
+ "platform",
152
+ "default-file"
153
+ ]);
154
+ var KeychainKeySourceSchema = /* @__PURE__ */ zod.z.object({
155
+ kind: KeychainKeySourceKindSchema,
156
+ /** File sources only — a path is not a secret. */
157
+ path: /* @__PURE__ */ zod.z.string().optional(),
158
+ /**
159
+ * True when a whole-volume backup of the data directory carries this key
160
+ * next to the database it protects (the default file). The page warns.
161
+ */
162
+ sharesBackupWithDatabase: /* @__PURE__ */ zod.z.boolean()
163
+ });
164
+ /**
165
+ * Who reset the keychain: an operator from System → Secrets (`user:<id>`), or
166
+ * the one-shot `<dataDir>/.keychain/RESET_KEYCHAIN` trigger file at boot
167
+ * (`trigger-file`) — the only way back into a hub whose master key is lost,
168
+ * because a locked keychain leaves no session that could reach the page (D797).
169
+ */
170
+ var KEYCHAIN_RESET_TRIGGER_ACTOR = "trigger-file";
171
+ /**
172
+ * One keychain reset, as the Secrets page reports it until the operator
173
+ * acknowledges it. Never a value: refs, counts and table names only.
174
+ */
175
+ var KeychainResetRecordSchema = /* @__PURE__ */ zod.z.object({
176
+ id: /* @__PURE__ */ zod.z.string(),
177
+ at: /* @__PURE__ */ zod.z.number(),
178
+ /** `user:<id>` or {@link KEYCHAIN_RESET_TRIGGER_ACTOR}. */
179
+ actor: /* @__PURE__ */ zod.z.string(),
180
+ /** Why the keychain was locked when it was reset; `null` when it was not locked. */
181
+ lockedReason: /* @__PURE__ */ zod.z.string().nullable(),
182
+ /** Values moved into the archive table (ciphertext under the lost key). */
183
+ archived: /* @__PURE__ */ zod.z.number().int(),
184
+ /** `keychain:secrets-orphaned-<ts>`, or `null` when nothing was stored. */
185
+ archivedCollection: /* @__PURE__ */ zod.z.string().nullable(),
186
+ /**
187
+ * `keychain:keys-orphaned-<ts>`: the wrapped data keys of the archive, kept
188
+ * so the archive can still be opened if the lost master key turns up.
189
+ */
190
+ archivedKeysCollection: /* @__PURE__ */ zod.z.string().nullable(),
191
+ /**
192
+ * `system-settings` keys whose marker the reset cleared — the cluster
193
+ * secret's: a marker left pointing at an archived value would refuse every
194
+ * agent forever (D797).
195
+ */
196
+ clearedSettingsKeys: /* @__PURE__ */ zod.z.array(/* @__PURE__ */ zod.z.string()).readonly(),
197
+ /** When an operator dismissed the notice on the Secrets page; `null` until then. */
198
+ acknowledgedAt: /* @__PURE__ */ zod.z.number().nullable()
199
+ });
200
+ var KeychainStatusSchema = /* @__PURE__ */ zod.z.object({
201
+ keychain: KeychainStateSchema,
202
+ /** The source of the master key in use; `null` while locked. */
203
+ keySource: /* @__PURE__ */ KeychainKeySourceSchema.nullable(),
204
+ /** The source configured to be primary — differs from `keySource` while a rotation is pending. */
205
+ configuredSource: KeychainKeySourceSchema,
206
+ /** Short fingerprint of the master key in use (`HMAC(KEK, label)`, 16 hex). */
207
+ fingerprint: /* @__PURE__ */ zod.z.string().nullable(),
208
+ activeKeyId: /* @__PURE__ */ zod.z.string().nullable(),
209
+ /**
210
+ * The keychain unlocked with a NON-primary source: the configured primary
211
+ * key is not the one that wraps the data key yet. `rotateMasterKey` moves it.
212
+ */
213
+ rotationPending: /* @__PURE__ */ zod.z.boolean(),
214
+ /** Wrapped copies of the data key under a previous master key, kept until purged. */
215
+ retiredWraps: /* @__PURE__ */ zod.z.number().int(),
216
+ recoveryKeyDownloadedAt: /* @__PURE__ */ zod.z.number().nullable(),
217
+ secretCount: /* @__PURE__ */ zod.z.number().int(),
218
+ /** The most recent reset, acknowledged or not; `null` when the keychain was never reset. */
219
+ lastReset: /* @__PURE__ */ KeychainResetRecordSchema.nullable()
220
+ });
221
+ /**
222
+ * Whether a stored value is still pointed at by its owner's settings.
223
+ * `unknown` is a first-class answer: a scope whose blob could not be read is
224
+ * never reported as an orphan (and never deleted as one).
225
+ */
226
+ var KeychainSecretUsageSchema = /* @__PURE__ */ zod.z.enum([
227
+ "in-use",
228
+ "orphan",
229
+ "unknown"
230
+ ]);
231
+ var KeychainAdminSecretSchema = /* @__PURE__ */ KeychainSecretMetaSchema.extend({ usage: KeychainSecretUsageSchema });
232
+ var KeychainAuditActionSchema = /* @__PURE__ */ zod.z.enum([
233
+ "put",
234
+ "delete",
235
+ "reveal",
236
+ "rotate-master-key",
237
+ "purge-retired-keys",
238
+ "download-recovery-key",
239
+ "delete-orphans",
240
+ "reset",
241
+ "acknowledge-reset",
242
+ "initialize"
243
+ ]);
244
+ var KeychainAuditEntrySchema = /* @__PURE__ */ zod.z.object({
245
+ id: /* @__PURE__ */ zod.z.string(),
246
+ at: /* @__PURE__ */ zod.z.number(),
247
+ action: KeychainAuditActionSchema,
248
+ /** `addon:<id>` | `user:<id>` | `system` | `trigger-file`. */
249
+ actor: /* @__PURE__ */ zod.z.string(),
250
+ ref: /* @__PURE__ */ zod.z.string().nullable(),
251
+ detail: /* @__PURE__ */ zod.z.string().nullable()
252
+ });
253
+ var KEYCHAIN_RESET_CONFIRMATION = "RESET KEYCHAIN";
254
+ /**
255
+ * Secrets the HUB itself holds (owner `system`) that no settings form shows:
256
+ * `jwt-signing-key` — the session signing key (D797). It is always "in use",
257
+ * never an orphan; it is generated on a fresh hub and replaced only through
258
+ * {@link keychainAdminCapability.methods.setSystemSecret}.
259
+ */
260
+ var SystemHeldSecretNameSchema = /* @__PURE__ */ zod.z.enum(["jwt-signing-key"]);
261
+ var keychainAdminCapability = {
262
+ name: "keychain-admin",
263
+ scope: "system",
264
+ mode: "singleton",
265
+ methods: {
266
+ status: /* @__PURE__ */ require_capability_definition.method(/* @__PURE__ */ zod.z.object({}), KeychainStatusSchema, { auth: "admin" }),
267
+ listSecrets: /* @__PURE__ */ require_capability_definition.method(/* @__PURE__ */ zod.z.object({}), /* @__PURE__ */ zod.z.array(KeychainAdminSecretSchema).readonly(), { auth: "admin" }),
268
+ listAudit: /* @__PURE__ */ require_capability_definition.method(/* @__PURE__ */ zod.z.object({ limit: /* @__PURE__ */ zod.z.number().int().min(1).max(500).optional() }), /* @__PURE__ */ zod.z.array(KeychainAuditEntrySchema).readonly(), { auth: "admin" }),
269
+ /**
270
+ * Show one value to the operator. Audited. The UI hides it again after a
271
+ * few seconds; nothing caches it.
272
+ */
273
+ reveal: /* @__PURE__ */ require_capability_definition.method(/* @__PURE__ */ zod.z.object({ ref: /* @__PURE__ */ zod.z.string().min(1) }), /* @__PURE__ */ zod.z.object({
274
+ value: /* @__PURE__ */ zod.z.string(),
275
+ version: /* @__PURE__ */ zod.z.number().int()
276
+ }), {
277
+ kind: "mutation",
278
+ auth: "admin",
279
+ caller: "required"
280
+ }),
281
+ /**
282
+ * Replace a system-held secret (no form edits it) with an operator-supplied
283
+ * value — e.g. importing the session signing key a pre-keychain hub kept in
284
+ * config.yaml, so the tokens it signed stay valid. Audited as the operator.
285
+ * Replacing the session signing key invalidates every token signed with the
286
+ * previous one.
287
+ */
288
+ setSystemSecret: /* @__PURE__ */ require_capability_definition.method(/* @__PURE__ */ zod.z.object({
289
+ name: SystemHeldSecretNameSchema,
290
+ value: /* @__PURE__ */ zod.z.string().min(16)
291
+ }), /* @__PURE__ */ zod.z.object({
292
+ ref: /* @__PURE__ */ zod.z.string(),
293
+ version: /* @__PURE__ */ zod.z.number().int()
294
+ }), {
295
+ kind: "mutation",
296
+ auth: "admin",
297
+ caller: "required"
298
+ }),
299
+ /**
300
+ * Store a value an operator tool carries over from a retired store at an
301
+ * addon's own ref (`secret://<owner>/<scope>/<path>`) and answer the ref -
302
+ * the D870 migration moves a camera's restream tokens this way, so they
303
+ * never sit in a settings row as plaintext. Audited as the operator; the
304
+ * caller then writes the MARKER of the ref where the value used to be.
305
+ */
306
+ importSecret: /* @__PURE__ */ require_capability_definition.method(/* @__PURE__ */ zod.z.object({
307
+ ref: /* @__PURE__ */ zod.z.string().min(1),
308
+ value: /* @__PURE__ */ zod.z.string().min(1)
309
+ }), /* @__PURE__ */ zod.z.object({
310
+ ref: /* @__PURE__ */ zod.z.string(),
311
+ version: /* @__PURE__ */ zod.z.number().int()
312
+ }), {
313
+ kind: "mutation",
314
+ auth: "admin",
315
+ caller: "required"
316
+ }),
317
+ /** Delete refs no owner points at any more. Re-checked here; `unknown` is kept. */
318
+ deleteOrphans: /* @__PURE__ */ require_capability_definition.method(/* @__PURE__ */ zod.z.object({ refs: /* @__PURE__ */ zod.z.array(/* @__PURE__ */ zod.z.string().min(1)).max(1e3) }), /* @__PURE__ */ zod.z.object({
319
+ deleted: /* @__PURE__ */ zod.z.array(/* @__PURE__ */ zod.z.string()).readonly(),
320
+ kept: /* @__PURE__ */ zod.z.array(/* @__PURE__ */ zod.z.object({
321
+ ref: /* @__PURE__ */ zod.z.string(),
322
+ usage: KeychainSecretUsageSchema
323
+ })).readonly()
324
+ }), {
325
+ kind: "mutation",
326
+ auth: "admin",
327
+ caller: "required"
328
+ }),
329
+ /**
330
+ * Wrap the data key under the configured primary master key.
331
+ *
332
+ * Pending rotation (the keychain unlocked with a previous source): re-wrap
333
+ * under the primary. Otherwise, with the default file as primary: generate
334
+ * a new master key, write it there, re-wrap. A file or OS-keychain primary
335
+ * that is already in use cannot be replaced from here — put the new key at
336
+ * the source, keep the old one at
337
+ * `/run/secrets/camstack-master-key.previous`, restart, and rotate. No value is re-encrypted either way; the previous wrap is kept
338
+ * (retired) until purged.
339
+ */
340
+ rotateMasterKey: /* @__PURE__ */ require_capability_definition.method(/* @__PURE__ */ zod.z.object({}), /* @__PURE__ */ zod.z.object({
341
+ fingerprint: /* @__PURE__ */ zod.z.string(),
342
+ keySource: KeychainKeySourceSchema
343
+ }), {
344
+ kind: "mutation",
345
+ auth: "admin",
346
+ caller: "required"
347
+ }),
348
+ purgeRetiredKeys: /* @__PURE__ */ require_capability_definition.method(/* @__PURE__ */ zod.z.object({}), /* @__PURE__ */ zod.z.object({ purged: /* @__PURE__ */ zod.z.number().int() }), {
349
+ kind: "mutation",
350
+ auth: "admin",
351
+ caller: "required"
352
+ }),
353
+ /** The master key, base64. Audited; marks the recovery copy as taken. */
354
+ downloadRecoveryKey: /* @__PURE__ */ require_capability_definition.method(/* @__PURE__ */ zod.z.object({}), /* @__PURE__ */ zod.z.object({
355
+ key: /* @__PURE__ */ zod.z.string(),
356
+ fingerprint: /* @__PURE__ */ zod.z.string(),
357
+ keySource: KeychainKeySourceSchema
358
+ }), {
359
+ kind: "mutation",
360
+ auth: "admin",
361
+ caller: "required"
362
+ }),
363
+ /**
364
+ * Lost-key recovery: archive every stored value into a
365
+ * `keychain:secrets-orphaned-<ts>` table and start over with a new data
366
+ * key. Every secret field then reads "not set". Requires the typed
367
+ * confirmation {@link KEYCHAIN_RESET_CONFIRMATION}.
368
+ */
369
+ resetKeychain: /* @__PURE__ */ require_capability_definition.method(/* @__PURE__ */ zod.z.object({ confirm: /* @__PURE__ */ zod.z.literal(KEYCHAIN_RESET_CONFIRMATION) }), /* @__PURE__ */ zod.z.object({
370
+ archivedCollection: /* @__PURE__ */ zod.z.string().nullable(),
371
+ archived: /* @__PURE__ */ zod.z.number().int()
372
+ }), {
373
+ kind: "mutation",
374
+ auth: "admin",
375
+ caller: "required"
376
+ }),
377
+ /**
378
+ * What the last reset left to re-enter: the archived refs (owner, scope,
379
+ * field — never a value) that hold no value again yet. Process-held refs
380
+ * the hub regenerates itself (the session signing key) are not listed.
381
+ */
382
+ resetReport: /* @__PURE__ */ require_capability_definition.method(/* @__PURE__ */ zod.z.object({}), /* @__PURE__ */ zod.z.object({
383
+ reset: /* @__PURE__ */ KeychainResetRecordSchema.nullable(),
384
+ pendingReentry: /* @__PURE__ */ zod.z.array(KeychainSecretMetaSchema).readonly()
385
+ }), { auth: "admin" }),
386
+ /** Dismiss the "keychain was reset" notice. Audited. */
387
+ acknowledgeReset: /* @__PURE__ */ require_capability_definition.method(/* @__PURE__ */ zod.z.object({}), /* @__PURE__ */ zod.z.object({ acknowledged: /* @__PURE__ */ zod.z.boolean() }), {
388
+ kind: "mutation",
389
+ auth: "admin",
390
+ caller: "required"
391
+ })
392
+ },
393
+ vocabulary: { notOperatorFacing: require_system_reasons.NOT_A_DEVICE.IDENTITY }
394
+ };
395
+ //#endregion
396
+ Object.defineProperty(exports, "KEYCHAIN_RESET_TRIGGER_ACTOR", {
397
+ enumerable: true,
398
+ get: function() {
399
+ return KEYCHAIN_RESET_TRIGGER_ACTOR;
400
+ }
401
+ });
402
+ Object.defineProperty(exports, "KeychainAuditEntrySchema", {
403
+ enumerable: true,
404
+ get: function() {
405
+ return KeychainAuditEntrySchema;
406
+ }
407
+ });
408
+ Object.defineProperty(exports, "KeychainResetRecordSchema", {
409
+ enumerable: true,
410
+ get: function() {
411
+ return KeychainResetRecordSchema;
412
+ }
413
+ });
414
+ Object.defineProperty(exports, "keychainAdminCapability", {
415
+ enumerable: true,
416
+ get: function() {
417
+ return keychainAdminCapability;
418
+ }
419
+ });
420
+ Object.defineProperty(exports, "keychainCapability", {
421
+ enumerable: true,
422
+ get: function() {
423
+ return keychainCapability;
424
+ }
425
+ });