@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,549 @@
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/integrations.cap.mjs
5
+ /**
6
+ * integrations — system-scoped singleton capability for integration
7
+ * (provider-instance) lifecycle. Integrations are typically per-addon
8
+ * data records that pin a device-provider addon to a concrete config
9
+ * (Reolink credentials, ONVIF endpoint, etc.).
10
+ *
11
+ * Implementation lives in the server's `AddonRegistryService`
12
+ * (specifically `getIntegrationRegistry()`). The provider is registered
13
+ * from `trpc.router.ts` against that service plus the event bus and
14
+ * logger — no addon owns this end-to-end.
15
+ *
16
+ * Phase E of the API consolidation: previously a hand-written core
17
+ * router. Cap conversion lets `useIntegrationsList`,
18
+ * `useIntegrationsTestConnection` and
19
+ * friends flow through the same codegen pipeline as every other cap.
20
+ */
21
+ var IntegrationWithStateSchema = /* @__PURE__ */ zod.z.object({
22
+ id: /* @__PURE__ */ zod.z.string(),
23
+ addonId: /* @__PURE__ */ zod.z.string(),
24
+ name: /* @__PURE__ */ zod.z.string(),
25
+ /** THE switch of the instance: the hub registry row is its only stored copy (D1066). */
26
+ enabled: /* @__PURE__ */ zod.z.boolean(),
27
+ info: /* @__PURE__ */ zod.z.record(/* @__PURE__ */ zod.z.string(), /* @__PURE__ */ zod.z.unknown()).readonly(),
28
+ /** The discovery candidate this integration was set up from (D984). */
29
+ originStableId: /* @__PURE__ */ zod.z.string().optional(),
30
+ createdAt: /* @__PURE__ */ zod.z.number(),
31
+ updatedAt: /* @__PURE__ */ zod.z.number(),
32
+ processState: /* @__PURE__ */ zod.z.string()
33
+ });
34
+ var IntegrationLiteSchema = /* @__PURE__ */ zod.z.object({
35
+ id: /* @__PURE__ */ zod.z.string(),
36
+ addonId: /* @__PURE__ */ zod.z.string(),
37
+ name: /* @__PURE__ */ zod.z.string(),
38
+ /** THE switch of the instance: the hub registry row is its only stored copy (D1066). */
39
+ enabled: /* @__PURE__ */ zod.z.boolean(),
40
+ info: /* @__PURE__ */ zod.z.record(/* @__PURE__ */ zod.z.string(), /* @__PURE__ */ zod.z.unknown()).readonly(),
41
+ /** The discovery candidate this integration was set up from (D984). */
42
+ originStableId: /* @__PURE__ */ zod.z.string().optional(),
43
+ createdAt: /* @__PURE__ */ zod.z.number(),
44
+ updatedAt: /* @__PURE__ */ zod.z.number()
45
+ });
46
+ var AvailableIntegrationTypeSchema = /* @__PURE__ */ zod.z.object({
47
+ addonId: /* @__PURE__ */ zod.z.string(),
48
+ name: /* @__PURE__ */ zod.z.string(),
49
+ /**
50
+ * Product name a new integration is prefilled from (`<label> - Home`).
51
+ * Absent: the client uses `name`. Set when the catalog title is not the
52
+ * product (Bosch SHC, MQTT).
53
+ */
54
+ providerLabel: /* @__PURE__ */ zod.z.string().optional(),
55
+ description: /* @__PURE__ */ zod.z.string(),
56
+ iconUrl: /* @__PURE__ */ zod.z.string().nullable(),
57
+ color: /* @__PURE__ */ zod.z.string(),
58
+ instanceMode: /* @__PURE__ */ zod.z.string(),
59
+ /**
60
+ * Integration wizard `mode` (LOCKED MODEL): `standalone` (create
61
+ * immediately then add devices, no config step/button), `account` (config
62
+ * step), or `broker` (broker step). Derived server-side by
63
+ * `getAvailableTypes` when the addon manifest omits an explicit `mode`.
64
+ */
65
+ mode: /* @__PURE__ */ zod.z.enum([
66
+ "standalone",
67
+ "account",
68
+ "broker"
69
+ ]),
70
+ discoveryMode: /* @__PURE__ */ zod.z.string(),
71
+ /**
72
+ * Which integration-marker cap the addon declared, so the wizard can
73
+ * branch on CAP — never on addon name. `device-adoption` integrations
74
+ * (Home Assistant, …) route through the broker step (Approach A);
75
+ * `device-provider` integrations (Reolink/ONVIF) keep the
76
+ * legacy config → discovery flow.
77
+ */
78
+ kind: /* @__PURE__ */ zod.z.enum(["device-adoption", "device-provider"]),
79
+ /**
80
+ * For `device-adoption` addons: the broker kind to create/link
81
+ * (e.g. `home-assistant`), declared in the addon manifest. `null` for
82
+ * `device-provider` addons, which carry no broker.
83
+ */
84
+ brokerKind: /* @__PURE__ */ zod.z.string().nullable(),
85
+ /** True when the integration's source system exposes locations the adoption
86
+ * flow can import (e.g. HA areas). Drives the adopt modal's "import
87
+ * locations" checkbox. Provider-declared in the addon manifest. */
88
+ supportsLocationImport: /* @__PURE__ */ zod.z.boolean(),
89
+ /**
90
+ * True when this integration's instances declare a Test (`integration-instances.describe().canTest`,
91
+ * D1016). An integration that cannot be tested must say so up front rather than offering a
92
+ * button that always answers the same nonsense.
93
+ */
94
+ canTest: /* @__PURE__ */ zod.z.boolean(),
95
+ existingInstances: /* @__PURE__ */ zod.z.array(/* @__PURE__ */ zod.z.object({
96
+ id: /* @__PURE__ */ zod.z.string(),
97
+ name: /* @__PURE__ */ zod.z.string()
98
+ })),
99
+ canAdd: /* @__PURE__ */ zod.z.boolean()
100
+ });
101
+ /**
102
+ * Why a test could not be answered as a plain boolean.
103
+ *
104
+ * `success` alone collapsed four different situations into one red box, and the
105
+ * one that mattered most — "nobody ever asked the remote anything" — looked
106
+ * exactly like "the remote said no". The status is the discriminator:
107
+ *
108
+ * - `validated` — a provider-declared test ran and the remote ACCEPTED.
109
+ * - `rejected` — a provider-declared test ran and the remote REFUSED.
110
+ * The only status that blocks `integrationInstances.createInstance`.
111
+ * - `inconclusive` — a test IS declared but could not complete (timeout,
112
+ * DNS, 5xx). Nothing was observed; not a failure.
113
+ * - `unsupported` — this integration declares NO test. Nothing was
114
+ * observed either; not a failure, and not a pass.
115
+ *
116
+ * `unsupported` and `inconclusive` both carry `success: false` so an older
117
+ * client can never read them as a green tick, and both carry an `error` string
118
+ * that SAYS the test did not run rather than inventing a failure.
119
+ */
120
+ var TestConnectionStatusEnum = /* @__PURE__ */ zod.z.enum([
121
+ "validated",
122
+ "rejected",
123
+ "inconclusive",
124
+ "unsupported"
125
+ ]);
126
+ var TestConnectionResultSchema = /* @__PURE__ */ zod.z.object({
127
+ /** True ONLY for `validated`. Never true for a test that did not run. */
128
+ success: /* @__PURE__ */ zod.z.boolean(),
129
+ error: /* @__PURE__ */ zod.z.string().optional(),
130
+ /** Optional for wire back-compat with clients built before the tri-state;
131
+ * the server always sets it. */
132
+ status: /* @__PURE__ */ TestConnectionStatusEnum.optional(),
133
+ /** Addon id whose declared test answered — `null` when none did. Lets the UI
134
+ * attribute a result instead of blaming "the integration". */
135
+ testedBy: /* @__PURE__ */ zod.z.string().nullable().optional(),
136
+ latencyMs: /* @__PURE__ */ zod.z.number().nonnegative().optional(),
137
+ /** Human detail from a `validated` result ("3 devices on this account"). */
138
+ detail: /* @__PURE__ */ zod.z.string().optional()
139
+ });
140
+ var UpdateIntegrationInputSchema = /* @__PURE__ */ zod.z.object({
141
+ id: /* @__PURE__ */ zod.z.string(),
142
+ name: /* @__PURE__ */ zod.z.string().optional(),
143
+ /**
144
+ * Honoured ONLY for a fixed builtin (`info.fixed`), whose switch is the hub's own registry flag
145
+ * and works while its addon is down. Any other row is refused (a typed `BAD_REQUEST`): its
146
+ * switch is `integration-instances.setInstanceEnabled`.
147
+ */
148
+ enabled: /* @__PURE__ */ zod.z.boolean().optional(),
149
+ info: /* @__PURE__ */ zod.z.record(/* @__PURE__ */ zod.z.string(), /* @__PURE__ */ zod.z.unknown()).optional()
150
+ });
151
+ var DeleteIntegrationResultSchema = /* @__PURE__ */ zod.z.object({
152
+ success: /* @__PURE__ */ zod.z.boolean(),
153
+ deletedId: /* @__PURE__ */ zod.z.string()
154
+ });
155
+ var integrationsCapability = {
156
+ name: "integrations",
157
+ scope: "system",
158
+ mode: "singleton",
159
+ methods: {
160
+ list: /* @__PURE__ */ require_capability_definition.method(/* @__PURE__ */ zod.z.void(), /* @__PURE__ */ zod.z.array(IntegrationWithStateSchema)),
161
+ get: /* @__PURE__ */ require_capability_definition.method(/* @__PURE__ */ zod.z.object({ id: /* @__PURE__ */ zod.z.string() }), IntegrationWithStateSchema),
162
+ /** The devices-role row of an addon; a services instance row never answers for its addon. */
163
+ getByAddonId: /* @__PURE__ */ require_capability_definition.method(/* @__PURE__ */ zod.z.object({ addonId: /* @__PURE__ */ zod.z.string() }), /* @__PURE__ */ IntegrationLiteSchema.nullable()),
164
+ /**
165
+ * Every registry row of one addon, services instances included: the addon reads its own switches
166
+ * with it at boot (D1066). A pure registry read; the Integrations list (`list`) hides the rows of
167
+ * a services instance, this does not.
168
+ */
169
+ listByAddon: /* @__PURE__ */ require_capability_definition.method(/* @__PURE__ */ zod.z.object({ addonId: /* @__PURE__ */ zod.z.string() }), /* @__PURE__ */ zod.z.array(IntegrationLiteSchema)),
170
+ /**
171
+ * The one-time move of an addon's switches into the registry (D1066): for each instance record
172
+ * the addon holds, an absent row is created as a services row under the addon-minted id, and a
173
+ * row that disagrees with a STATED body switch is corrected (a body that states nothing never
174
+ * moves an existing row). A row
175
+ * that belongs to another addon is left alone and returned in `conflicts` (the caller keeps its
176
+ * own copy of that state), and an addon naming another addon's id is refused FORBIDDEN.
177
+ * Idempotent: a rerun changes nothing. It never notifies the addon.
178
+ */
179
+ adoptInstanceRows: /* @__PURE__ */ require_capability_definition.method(/* @__PURE__ */ zod.z.object({
180
+ addonId: /* @__PURE__ */ zod.z.string(),
181
+ rows: /* @__PURE__ */ zod.z.array(/* @__PURE__ */ zod.z.object({
182
+ id: /* @__PURE__ */ zod.z.string().min(1),
183
+ name: /* @__PURE__ */ zod.z.string(),
184
+ enabled: /* @__PURE__ */ zod.z.boolean(),
185
+ /** True when the record body STATED the switch: only then does it override an existing row. */
186
+ stated: /* @__PURE__ */ zod.z.boolean()
187
+ }))
188
+ }), /* @__PURE__ */ zod.z.object({
189
+ created: /* @__PURE__ */ zod.z.number().int(),
190
+ updated: /* @__PURE__ */ zod.z.number().int(),
191
+ /** Rows whose id belongs to ANOTHER addon: left untouched, so the caller keeps its own copy. */
192
+ conflicts: /* @__PURE__ */ zod.z.array(/* @__PURE__ */ zod.z.object({
193
+ id: /* @__PURE__ */ zod.z.string(),
194
+ ownerAddonId: /* @__PURE__ */ zod.z.string()
195
+ }))
196
+ }), {
197
+ kind: "mutation",
198
+ auth: "admin"
199
+ }),
200
+ update: /* @__PURE__ */ require_capability_definition.method(UpdateIntegrationInputSchema, IntegrationLiteSchema, {
201
+ kind: "mutation",
202
+ auth: "admin"
203
+ }),
204
+ /**
205
+ * Delete an integration from the hub side: its devices, its registry row and its record, and
206
+ * announce it. It works while the addon that owns the instance is down (installed but
207
+ * crashed), where `integration-instances.deleteInstance` has no provider to route to; with the
208
+ * provider up the record is removed through it as well. A fixed builtin and an instance a link
209
+ * names are refused first.
210
+ */
211
+ delete: /* @__PURE__ */ require_capability_definition.method(/* @__PURE__ */ zod.z.object({ id: /* @__PURE__ */ zod.z.string() }), DeleteIntegrationResultSchema, {
212
+ kind: "mutation",
213
+ auth: "admin"
214
+ }),
215
+ getAvailableTypes: /* @__PURE__ */ require_capability_definition.method(/* @__PURE__ */ zod.z.void(), /* @__PURE__ */ zod.z.array(AvailableIntegrationTypeSchema), { auth: "admin" })
216
+ },
217
+ /** BIG PLAN 2: declarative mount hint — read by `@camstack/server/system` `buildCapRouters`. */
218
+ mount: { kind: "server-provided" },
219
+ vocabulary: { notOperatorFacing: require_system_reasons.NOT_A_DEVICE.ADDON_ADMIN }
220
+ };
221
+ //#endregion
222
+ //#region ../types/dist/esm/capabilities/integration-instances.cap.mjs
223
+ /**
224
+ * `integration-instances` - the connection of an addon that holds ONE or SEVERAL
225
+ * (an account, a relay, a destination) as typed records (D985, D986). The addon's
226
+ * own function page reads and writes them (Logging for Loki); the Integrations
227
+ * page lists only the integrations that bring devices (D996).
228
+ *
229
+ * A collection of providers: each addon that holds connections registers one and a
230
+ * caller reaches a provider with the pinned `addonId`.
231
+ *
232
+ * Identity: the instance id is immutable and opaque to the caller. A record the
233
+ * Loki migration made keeps the `integrations` registry id it was created under
234
+ * (`int_NNNN`); a single instance made by its function page takes the addon id.
235
+ * `name` is the editable label.
236
+ *
237
+ * Secrets: every field the instance kind marks `.meta({ secret: true })` reaches
238
+ * the form as a `SecretFieldView`, never text (D789). A patch value omitted, `''`
239
+ * or the redaction token KEEPS the stored secret; `{ $secretClear: true }`
240
+ * clears it.
241
+ *
242
+ * Who may call (epic #440): every method but `describe` and `instanceFormSchema` is open to any
243
+ * session (`caller: 'scoped'`) and default-denies. An admin passes everywhere. A non-admin passes
244
+ * only on a call pinned to one addon whose `describe().userScoped` is true, and that provider
245
+ * filters every row on the `caller` the router injected (a notification target is somebody's
246
+ * phone: a user sees and changes only their own). An addon that says nothing keeps the admin door.
247
+ */
248
+ var ConfigSchemaPassthrough = /* @__PURE__ */ zod.z.custom();
249
+ var IntegrationInstanceIdSchema = /* @__PURE__ */ zod.z.string().min(1);
250
+ var IntegrationInstanceModeSchema = /* @__PURE__ */ zod.z.enum(["single", "multiple"]);
251
+ /**
252
+ * What the addon's instances ARE for the Integrations page (planning#416). `devices`: each
253
+ * instance is an integration that brings devices (its record body owns the on/off switch);
254
+ * `services`: a connection configured from the addon's own function page, never listed on
255
+ * Integrations.
256
+ * It is the same vocabulary as the manifest's `integrationRole`, which stays as an override.
257
+ */
258
+ var IntegrationInstanceRoleSchema = /* @__PURE__ */ zod.z.enum(["devices", "services"]);
259
+ /**
260
+ * One kind of instance a provider can create (an adapter, an account type). The sign-in and
261
+ * connect fields follow the `broker` contract (`broker.cap.ts`): `signIn.basePath` is a
262
+ * hub-relative route set speaking the sign-in contract, `connectPath` / `disconnectPath` open an
263
+ * interactive account link (popup) and may carry `{{brokerId}}`, which the UI replaces with the
264
+ * instance id.
265
+ */
266
+ var IntegrationInstanceKindSchema = /* @__PURE__ */ zod.z.object({
267
+ /** Stable id of the kind, sent back as `createInstance.kind`. */
268
+ id: /* @__PURE__ */ zod.z.string().min(1),
269
+ label: /* @__PURE__ */ zod.z.string().min(1),
270
+ /**
271
+ * The function capability this kind is configured for (`broker`, `smtp-provider`,
272
+ * `device-provider`, ...). A page section is the kinds whose `functionCap` it names (D1013); a
273
+ * provider with more than one section must name it on every kind.
274
+ */
275
+ functionCap: /* @__PURE__ */ zod.z.string().min(1),
276
+ /**
277
+ * For `functionCap: 'broker'`: the registry kind of the broker an instance of this kind is
278
+ * (`matter`, `home-assistant`, ...). A caller that needs a broker of one kind (a link field)
279
+ * finds the instances whose kind names it; absent takes the kind `id`.
280
+ */
281
+ brokerKind: /* @__PURE__ */ zod.z.string().min(1).optional(),
282
+ /**
283
+ * Other function caps an instance of this kind also serves (a Google account sends mail, so it
284
+ * serves `smtp-provider` beside being a `broker`). A link to one of these caps lists and accepts
285
+ * the instance; a page section stays the kinds whose `functionCap` it names. Absent means none.
286
+ */
287
+ alsoServes: /* @__PURE__ */ zod.z.array(/* @__PURE__ */ zod.z.string().min(1)).optional(),
288
+ /**
289
+ * The kind's own icon (a brand mark), hub-relative or a `data:` URI. Absent: the client shows
290
+ * the provider addon's icon.
291
+ */
292
+ iconUrl: /* @__PURE__ */ zod.z.string().min(1).optional(),
293
+ /** The media type `iconUrl` serves (`image/svg+xml`, `image/png`); the URL carries no extension. */
294
+ iconMediaType: /* @__PURE__ */ zod.z.string().min(1).optional(),
295
+ /** What instances of this kind are for the Integrations page; absent takes the provider's `role`. */
296
+ role: /* @__PURE__ */ IntegrationInstanceRoleSchema.optional(),
297
+ /** `testInstance` really probes the remote for this kind; absent takes the provider's `canTest`. */
298
+ canTest: /* @__PURE__ */ zod.z.boolean().optional(),
299
+ /** `false`: Add never offers this kind (the system creates its one instance, e.g. a default integration). Absent = creatable. */
300
+ creatable: /* @__PURE__ */ zod.z.boolean().optional(),
301
+ /** The kind signs in through a server-held interactive session. */
302
+ signIn: /* @__PURE__ */ zod.z.object({
303
+ basePath: /* @__PURE__ */ zod.z.string().min(1),
304
+ methods: /* @__PURE__ */ zod.z.array(/* @__PURE__ */ zod.z.enum(["device-code", "proxy"])).optional()
305
+ }).optional(),
306
+ /** Relative hub path to start an interactive account link of an instance of this kind. */
307
+ connectPath: /* @__PURE__ */ zod.z.string().min(1).optional(),
308
+ /** Relative hub path to disconnect that account. */
309
+ disconnectPath: /* @__PURE__ */ zod.z.string().min(1).optional(),
310
+ /**
311
+ * Parts of the edit dialog the flat form cannot draw (a node picker, a model source), named by a
312
+ * GENERIC widget id the client maps to a component; a client that knows none of them shows none.
313
+ * `connection` widgets write connection values, `model` widgets own the model choice.
314
+ */
315
+ widgets: /* @__PURE__ */ zod.z.array(/* @__PURE__ */ zod.z.object({
316
+ id: /* @__PURE__ */ zod.z.string().min(1),
317
+ placement: /* @__PURE__ */ zod.z.enum(["connection", "model"])
318
+ })).optional()
319
+ });
320
+ /**
321
+ * How devices of an instance are found. `none`: the operator adds them by hand; `lan`: the addon
322
+ * scans the network before any instance exists (the wizard offers the candidates); `account`: the
323
+ * devices appear after the instance signs in. `scopedToInstance`: a discovery run belongs to ONE
324
+ * instance and its candidates are claimed by it.
325
+ */
326
+ var IntegrationInstanceDiscoverySchema = /* @__PURE__ */ zod.z.object({
327
+ mode: /* @__PURE__ */ zod.z.enum([
328
+ "none",
329
+ "lan",
330
+ "account"
331
+ ]),
332
+ scopedToInstance: /* @__PURE__ */ zod.z.boolean()
333
+ });
334
+ /**
335
+ * One link a kind of this provider declares (D1013 rule 5): the body `field` of an instance of
336
+ * `kind` holds the id of an instance of the function cap `to.cap` (of kind `to.kind`, when set).
337
+ * The hub indexes these so the target's delete is refused while a link names it.
338
+ */
339
+ var IntegrationInstanceLinkSchema = /* @__PURE__ */ zod.z.object({
340
+ kind: /* @__PURE__ */ zod.z.string().min(1),
341
+ field: /* @__PURE__ */ zod.z.string().min(1),
342
+ to: /* @__PURE__ */ zod.z.object({
343
+ cap: /* @__PURE__ */ zod.z.string().min(1),
344
+ kind: /* @__PURE__ */ zod.z.string().min(1).optional()
345
+ })
346
+ });
347
+ var IntegrationInstanceDescriptionSchema = /* @__PURE__ */ zod.z.object({
348
+ /** What the instances are for the Integrations page; see {@link IntegrationInstanceRoleSchema}. */
349
+ role: IntegrationInstanceRoleSchema,
350
+ /** How the devices of an instance are found; absent means `{ mode: 'none' }`. */
351
+ discovery: /* @__PURE__ */ IntegrationInstanceDiscoverySchema.optional(),
352
+ /** `single`: at most one instance can exist (Loki). `multiple`: an account each. */
353
+ instanceMode: IntegrationInstanceModeSchema,
354
+ /** What the instance is, for the UI (`destination`, `relay`, `account`). */
355
+ kind: /* @__PURE__ */ zod.z.string(),
356
+ /** True when `testInstance` really probes the remote. */
357
+ canTest: /* @__PURE__ */ zod.z.boolean(),
358
+ /**
359
+ * The kinds an instance can be of (D1013 rule 1), each naming its `functionCap`. One entry:
360
+ * nothing to choose; more than one: the Add flow asks which first and sends it as
361
+ * `createInstance.kind`. Never empty: every instance belongs to exactly one kind.
362
+ */
363
+ kinds: /* @__PURE__ */ zod.z.array(IntegrationInstanceKindSchema).min(1),
364
+ /**
365
+ * The provider accepts `createInstance.id` for an id that once existed (an adopted id, because
366
+ * devices carry it). The UI then offers "restore under its old id" on Add. Absent means no.
367
+ */
368
+ allowRestoreId: /* @__PURE__ */ zod.z.boolean().optional(),
369
+ /**
370
+ * `createInstance` without an `id` works: the provider mints it. Absent means the caller must
371
+ * send an id (the UI then mints an opaque one).
372
+ */
373
+ mintsId: /* @__PURE__ */ zod.z.boolean().optional(),
374
+ /** The links to other instances the provider's kinds declare; absent means none. */
375
+ links: /* @__PURE__ */ zod.z.array(IntegrationInstanceLinkSchema).optional(),
376
+ /**
377
+ * The rows belong to individual users (a notification target is somebody's phone). The router
378
+ * then opens `listInstances`, `getInstance`, `createInstance`, `updateInstance`,
379
+ * `setInstanceEnabled`, `deleteInstance` and `testInstance` to a NON-admin session on a call
380
+ * pinned to this addon, and hands the provider the `caller` so it keeps a user to their own rows.
381
+ * Absent means admin only, as it always was.
382
+ */
383
+ userScoped: /* @__PURE__ */ zod.z.boolean().optional()
384
+ });
385
+ var IntegrationInstanceStatusSchema = /* @__PURE__ */ zod.z.object({
386
+ state: /* @__PURE__ */ zod.z.enum([
387
+ "ok",
388
+ "off",
389
+ "error",
390
+ "unknown"
391
+ ]),
392
+ detail: /* @__PURE__ */ zod.z.string().optional(),
393
+ /** A short human word for the state ("Signed in", "Token expired"); shown instead of `state`. */
394
+ label: /* @__PURE__ */ zod.z.string().optional()
395
+ });
396
+ /**
397
+ * What "Add device" inside ONE instance offers, decided per instance by its provider. `scan`: the
398
+ * LAN scan finds devices this instance holds; `children`: only the instance's own children, via
399
+ * adoption (a scan would offer other hosts, which are new integrations); `none`: manual add only.
400
+ */
401
+ var IntegrationInstanceAddDeviceSchema = /* @__PURE__ */ zod.z.enum([
402
+ "scan",
403
+ "children",
404
+ "none"
405
+ ]);
406
+ var IntegrationInstanceSchema = /* @__PURE__ */ zod.z.object({
407
+ id: IntegrationInstanceIdSchema,
408
+ name: /* @__PURE__ */ zod.z.string(),
409
+ /** The addon's own rule (an URL is present, a client id is present...). */
410
+ configured: /* @__PURE__ */ zod.z.boolean(),
411
+ /**
412
+ * The instance's own on/off switch (D996), derived from the record body (`enabled !== false`,
413
+ * so a row written before the field existed is on). The same for every role, `devices` included:
414
+ * the body is the one store, `setInstanceEnabled` the one writer (epic #440, step 3).
415
+ */
416
+ enabled: /* @__PURE__ */ zod.z.boolean().optional(),
417
+ /** The kind of this instance: exactly one of `describe().kinds[].id` (D1013 rule 2). */
418
+ kind: /* @__PURE__ */ zod.z.string().min(1),
419
+ /** Values for the instance form; a secret is a `SecretFieldView`, never text. */
420
+ formValues: /* @__PURE__ */ zod.z.record(/* @__PURE__ */ zod.z.string(), /* @__PURE__ */ zod.z.unknown()),
421
+ status: /* @__PURE__ */ IntegrationInstanceStatusSchema.optional(),
422
+ /** Epoch ms of the last probe of the remote that produced `status`; absent when never checked. */
423
+ lastCheckedAt: /* @__PURE__ */ zod.z.number().optional(),
424
+ /** What "Add device" inside this instance offers; see {@link IntegrationInstanceAddDeviceSchema}. Absent means the caller derives it from `describe().discovery` with `defaultAddDeviceMode` (lan → scan, account → children, else none). */
425
+ addDevice: /* @__PURE__ */ IntegrationInstanceAddDeviceSchema.optional()
426
+ });
427
+ var IntegrationInstancePatchSchema = /* @__PURE__ */ zod.z.object({
428
+ id: IntegrationInstanceIdSchema,
429
+ name: /* @__PURE__ */ zod.z.string().min(1).optional(),
430
+ /** Omitted / '' / redaction token keeps a secret; `{ $secretClear: true }` clears it. */
431
+ values: /* @__PURE__ */ zod.z.record(/* @__PURE__ */ zod.z.string(), /* @__PURE__ */ zod.z.unknown())
432
+ });
433
+ var integrationInstancesCapability = {
434
+ name: "integration-instances",
435
+ scope: "system",
436
+ mode: "collection",
437
+ methods: {
438
+ describe: /* @__PURE__ */ require_capability_definition.method(/* @__PURE__ */ zod.z.void(), IntegrationInstanceDescriptionSchema, { auth: "admin" }),
439
+ /** The form; `id: null` is the create form. */
440
+ instanceFormSchema: /* @__PURE__ */ require_capability_definition.method(/* @__PURE__ */ zod.z.object({
441
+ id: /* @__PURE__ */ IntegrationInstanceIdSchema.nullable(),
442
+ /** The kind of the create form (`id: null`) of a provider with several. */
443
+ kind: /* @__PURE__ */ zod.z.string().min(1).optional(),
444
+ /** The wizard mode of the integration type (`getAvailableTypes`); a form may differ per mode. */
445
+ mode: /* @__PURE__ */ zod.z.enum([
446
+ "standalone",
447
+ "account",
448
+ "broker"
449
+ ]).optional(),
450
+ /** The discovery candidate the wizard was seeded from (`stableId`), if any. */
451
+ candidateStableId: /* @__PURE__ */ zod.z.string().min(1).optional()
452
+ }), ConfigSchemaPassthrough, { auth: "admin" }),
453
+ listInstances: /* @__PURE__ */ require_capability_definition.method(/* @__PURE__ */ zod.z.looseObject({}), /* @__PURE__ */ zod.z.array(IntegrationInstanceSchema).readonly(), {
454
+ auth: "protected",
455
+ caller: "scoped"
456
+ }),
457
+ getInstance: /* @__PURE__ */ require_capability_definition.method(/* @__PURE__ */ zod.z.object({ id: IntegrationInstanceIdSchema }), /* @__PURE__ */ IntegrationInstanceSchema.nullable(), {
458
+ auth: "protected",
459
+ caller: "scoped"
460
+ }),
461
+ /**
462
+ * Insert the typed record. With `id` it is stored under that id (a duplicate id is refused);
463
+ * without one the PROVIDER mints it and answers it. `kind` picks one of `describe().kinds`.
464
+ *
465
+ * An instance of a kind that brings devices (`role: 'devices'`) is an integration: the HUB mints
466
+ * the id (the `integrations` registry id, which its devices carry), refuses the create when
467
+ * `testInstance` rejects the values (D1016; a kind with no test passes and says so), writes the
468
+ * registry row and the record, and removes both when either step fails. An `id` is accepted
469
+ * only when it names an existing registry row of the addon.
470
+ */
471
+ createInstance: /* @__PURE__ */ require_capability_definition.method(/* @__PURE__ */ zod.z.object({
472
+ id: /* @__PURE__ */ IntegrationInstanceIdSchema.optional(),
473
+ name: /* @__PURE__ */ zod.z.string().min(1),
474
+ kind: /* @__PURE__ */ zod.z.string().min(1).optional(),
475
+ /** Form values written with the record (a link picked in the create dialog). */
476
+ values: /* @__PURE__ */ zod.z.record(/* @__PURE__ */ zod.z.string(), /* @__PURE__ */ zod.z.unknown()).optional(),
477
+ /**
478
+ * The discovery candidate (`stableId`) the instance is set up from. Kept on the integration
479
+ * registry row of an instance that brings devices, so discovery stops offering a candidate
480
+ * that already has its integration (D984). Ignored by an instance with no registry row.
481
+ */
482
+ originStableId: /* @__PURE__ */ zod.z.string().min(1).optional(),
483
+ /**
484
+ * The seed variant: the HUB or an addon states the integration it owns (a fixed builtin's
485
+ * row, a migration's row), not an operator creating one. It brings the registry `info`
486
+ * (`{ fixed: true }`), makes the row whatever the kind's role, and is accepted only from a
487
+ * caller the transport stamped as the addon itself (`callerAddonId`): an admin session
488
+ * cannot send it, and the wizard never does. `values` are the settings it is seeded with.
489
+ */
490
+ seed: /* @__PURE__ */ zod.z.object({ info: /* @__PURE__ */ zod.z.record(/* @__PURE__ */ zod.z.string(), /* @__PURE__ */ zod.z.unknown()) }).optional()
491
+ }), /* @__PURE__ */ zod.z.object({ id: /* @__PURE__ */ zod.z.string() }), {
492
+ kind: "mutation",
493
+ auth: "protected",
494
+ caller: "scoped"
495
+ }),
496
+ updateInstance: /* @__PURE__ */ require_capability_definition.method(IntegrationInstancePatchSchema, /* @__PURE__ */ zod.z.object({ ok: /* @__PURE__ */ zod.z.literal(true) }), {
497
+ kind: "mutation",
498
+ auth: "protected",
499
+ caller: "scoped"
500
+ }),
501
+ /**
502
+ * Switch ONE instance on or off, for every role; a missing record is created from the addon's
503
+ * initial body. A row control, not a form field: `updateInstance.values` is the
504
+ * form patch (D62, D996). An off instance keeps its record and secrets and does no work.
505
+ */
506
+ setInstanceEnabled: /* @__PURE__ */ require_capability_definition.method(/* @__PURE__ */ zod.z.object({
507
+ id: IntegrationInstanceIdSchema,
508
+ enabled: /* @__PURE__ */ zod.z.boolean()
509
+ }), /* @__PURE__ */ zod.z.object({ ok: /* @__PURE__ */ zod.z.literal(true) }), {
510
+ kind: "mutation",
511
+ auth: "protected",
512
+ caller: "scoped"
513
+ }),
514
+ /**
515
+ * Delete the record and its keychain refs together. For an instance that brings devices the hub
516
+ * also removes the integration's devices (their tombstones, D865), the registry row, and emits
517
+ * `IntegrationDeleted`; a fixed builtin and an instance a link names are refused first.
518
+ */
519
+ deleteInstance: /* @__PURE__ */ require_capability_definition.method(/* @__PURE__ */ zod.z.object({ id: IntegrationInstanceIdSchema }), /* @__PURE__ */ zod.z.object({ ok: /* @__PURE__ */ zod.z.literal(true) }), {
520
+ kind: "mutation",
521
+ auth: "protected",
522
+ caller: "scoped"
523
+ }),
524
+ testInstance: /* @__PURE__ */ require_capability_definition.optionalMethod(/* @__PURE__ */ zod.z.object({
525
+ id: /* @__PURE__ */ IntegrationInstanceIdSchema.nullable(),
526
+ values: /* @__PURE__ */ zod.z.record(/* @__PURE__ */ zod.z.string(), /* @__PURE__ */ zod.z.unknown()),
527
+ /** The kind to test when `id` is null and the provider has several. */
528
+ kind: /* @__PURE__ */ zod.z.string().min(1).optional()
529
+ }), TestConnectionResultSchema, {
530
+ kind: "mutation",
531
+ auth: "protected",
532
+ caller: "scoped"
533
+ })
534
+ },
535
+ vocabulary: { notOperatorFacing: require_system_reasons.NOT_A_DEVICE.INTERNAL }
536
+ };
537
+ //#endregion
538
+ Object.defineProperty(exports, "integrationInstancesCapability", {
539
+ enumerable: true,
540
+ get: function() {
541
+ return integrationInstancesCapability;
542
+ }
543
+ });
544
+ Object.defineProperty(exports, "integrationsCapability", {
545
+ enumerable: true,
546
+ get: function() {
547
+ return integrationsCapability;
548
+ }
549
+ });