@camstack/server 1.2.943 → 1.2.945

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 (170) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/closure-pins.json +350 -0
  3. package/dist/api/core/auth-sessions.procedures.js +18 -0
  4. package/dist/api/core/auth.router.js +19 -6
  5. package/dist/api/server-upload.js +17 -1
  6. package/dist/api/trpc/generated-cap-mounts.js +18 -1
  7. package/dist/api/trpc/generated-cap-routers.js +2662 -2542
  8. package/dist/auth/native-return.js +9 -3
  9. package/dist/auth/sso-routes.js +5 -1
  10. package/dist/core/addon/instance-lifecycle.js +4 -1
  11. package/dist/core/auth/handoff-code.service.js +35 -1
  12. package/dist/server-root/index.js +313 -70
  13. package/package.json +15 -11
  14. package/system/assets/apps-aggregator/icon.svg +5 -0
  15. package/system/dist/{action-index-B_cLRwXJ.js → action-index-Bcnb-jyg.js} +9 -1
  16. package/system/dist/{action-index-B1fgpQBt.mjs → action-index-DwPHO2nz.mjs} +9 -1
  17. package/system/dist/{addon-settings.cap-CZ4MC7ha.mjs → addon-settings.cap-CHpmuaQG.mjs} +1 -1
  18. package/system/dist/{addon-settings.cap-DrLdMFIe.js → addon-settings.cap-nZVHPo3X.js} +1 -1
  19. package/system/dist/{alert-episode-Be--PngO.mjs → alert-episode-D-1VUUkZ.mjs} +1 -1
  20. package/system/dist/{alert-episode-Bqktmt-i.js → alert-episode-DaQ3prSe.js} +1 -1
  21. package/system/dist/apps.cap-Bqb9NpYx.mjs +130 -0
  22. package/system/dist/apps.cap-CLjgnuUe.js +141 -0
  23. package/system/dist/{base-addon-CRsXtYFG.js → base-addon-BG7p06Hb.js} +136 -15
  24. package/system/dist/{base-addon-BcS6r1cT.mjs → base-addon-BcVoYZbC.mjs} +136 -15
  25. package/system/dist/{base-device-DAdWzDOl.js → base-device-DeSNiwZ4.js} +4 -4
  26. package/system/dist/{base-device-DJXF5eDN.mjs → base-device-w_MD0Bf4.mjs} +4 -4
  27. package/system/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.js +1 -1
  28. package/system/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.mjs +1 -1
  29. package/system/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.js +1 -1
  30. package/system/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.mjs +1 -1
  31. package/system/dist/builtins/alerts/alerts.addon.js +3 -3
  32. package/system/dist/builtins/alerts/alerts.addon.mjs +3 -3
  33. package/system/dist/builtins/apps-aggregator/aggregate-apps.d.ts +24 -0
  34. package/system/dist/builtins/apps-aggregator/apps-aggregator.addon.d.ts +16 -0
  35. package/system/dist/builtins/apps-aggregator/apps-aggregator.addon.js +109 -0
  36. package/system/dist/builtins/apps-aggregator/apps-aggregator.addon.mjs +103 -0
  37. package/system/dist/builtins/apps-aggregator/index.d.ts +1 -0
  38. package/system/dist/builtins/apps-aggregator/index.js +8 -0
  39. package/system/dist/builtins/apps-aggregator/index.mjs +2 -0
  40. package/system/dist/builtins/autotrack/index.js +1 -1
  41. package/system/dist/builtins/autotrack/index.mjs +1 -1
  42. package/system/dist/builtins/backup-orchestrator/backup-orchestrator.addon.js +1 -1
  43. package/system/dist/builtins/backup-orchestrator/backup-orchestrator.addon.mjs +1 -1
  44. package/system/dist/builtins/calendars/calendars.addon.js +1 -1
  45. package/system/dist/builtins/calendars/calendars.addon.mjs +1 -1
  46. package/system/dist/builtins/camera-grid/index.js +3 -3
  47. package/system/dist/builtins/camera-grid/index.mjs +3 -3
  48. package/system/dist/builtins/composer/composer.addon.js +7 -7
  49. package/system/dist/builtins/composer/composer.addon.mjs +7 -7
  50. package/system/dist/builtins/console-logging/index.js +1 -1
  51. package/system/dist/builtins/console-logging/index.mjs +1 -1
  52. package/system/dist/builtins/core-blocks/actions-store.d.ts +2 -0
  53. package/system/dist/builtins/core-blocks/block-supervisor.d.ts +16 -4
  54. package/system/dist/builtins/core-blocks/core-block-store.d.ts +2 -0
  55. package/system/dist/builtins/core-blocks/core-blocks.addon.js +1018 -323
  56. package/system/dist/builtins/core-blocks/core-blocks.addon.mjs +986 -291
  57. package/system/dist/builtins/core-blocks/migrations/index.d.ts +5 -2
  58. package/system/dist/builtins/core-blocks/migrations/tag-ids.d.ts +42 -0
  59. package/system/dist/builtins/core-blocks/migrations/tags-as-records.d.ts +47 -0
  60. package/system/dist/builtins/core-blocks/record-kinds.d.ts +12 -1
  61. package/system/dist/builtins/core-blocks/runs-api.d.ts +3 -1
  62. package/system/dist/builtins/core-blocks/runs-ledger.d.ts +3 -1
  63. package/system/dist/builtins/core-blocks/scheduler/scheduler-store.d.ts +2 -0
  64. package/system/dist/builtins/core-blocks/tags-service.d.ts +52 -27
  65. package/system/dist/builtins/core-blocks/tags-wiring.d.ts +2 -0
  66. package/system/dist/builtins/core-notifier/core-notifier.addon.js +76 -67
  67. package/system/dist/builtins/core-notifier/core-notifier.addon.mjs +76 -67
  68. package/system/dist/builtins/device-history/device-history.addon.js +4 -4
  69. package/system/dist/builtins/device-history/device-history.addon.mjs +4 -4
  70. package/system/dist/builtins/device-manager/device-manager.addon.js +1618 -755
  71. package/system/dist/builtins/device-manager/device-manager.addon.mjs +1604 -741
  72. package/system/dist/builtins/device-manager/device-meta-actions.d.ts +13 -136
  73. package/system/dist/builtins/device-manager/device-meta-types.d.ts +5 -1
  74. package/system/dist/builtins/device-manager/device-provider-context.d.ts +9 -0
  75. package/system/dist/builtins/device-manager/device-row-store.d.ts +21 -4
  76. package/system/dist/builtins/device-manager/device-search.d.ts +6 -0
  77. package/system/dist/builtins/device-manager/location-alignment.d.ts +9 -2
  78. package/system/dist/builtins/device-manager/migrate-device.d.ts +7 -2
  79. package/system/dist/builtins/device-manager/migrate-hardware-state.d.ts +132 -1
  80. package/system/dist/builtins/device-manager/migrations/device-tag-ids.d.ts +25 -0
  81. package/system/dist/builtins/device-manager/migrations/index.d.ts +16 -0
  82. package/system/dist/builtins/device-manager/migrations/orphan-children.d.ts +33 -0
  83. package/system/dist/builtins/device-manager/migrations/ports.d.ts +17 -0
  84. package/system/dist/builtins/device-manager/migrations/rooms-as-records.d.ts +52 -0
  85. package/system/dist/builtins/device-manager/record-kinds.d.ts +3 -1
  86. package/system/dist/builtins/device-manager/removal-cleanup.d.ts +7 -0
  87. package/system/dist/builtins/device-manager/room-actions.d.ts +27 -0
  88. package/system/dist/builtins/device-manager/room-store.d.ts +19 -0
  89. package/system/dist/builtins/device-manager/tag-names.d.ts +32 -0
  90. package/system/dist/builtins/device-manager/wireable-enum-catalog.d.ts +18 -0
  91. package/system/dist/builtins/hub-forwarder/index.js +1 -1
  92. package/system/dist/builtins/hub-forwarder/index.mjs +1 -1
  93. package/system/dist/builtins/keychain/index.js +3 -3
  94. package/system/dist/builtins/keychain/index.mjs +3 -3
  95. package/system/dist/builtins/liveness-monitor/liveness-monitor.addon.js +1 -1
  96. package/system/dist/builtins/liveness-monitor/liveness-monitor.addon.mjs +1 -1
  97. package/system/dist/builtins/local-auth/local-auth.addon.js +1 -1
  98. package/system/dist/builtins/local-auth/local-auth.addon.mjs +1 -1
  99. package/system/dist/builtins/local-network/local-network.addon.js +2 -2
  100. package/system/dist/builtins/local-network/local-network.addon.mjs +2 -2
  101. package/system/dist/builtins/loki-logging/index.js +2 -2
  102. package/system/dist/builtins/loki-logging/index.mjs +2 -2
  103. package/system/dist/builtins/native-metrics/native-metrics.addon.js +1 -1
  104. package/system/dist/builtins/native-metrics/native-metrics.addon.mjs +1 -1
  105. package/system/dist/builtins/platform-probe/index.js +1 -1
  106. package/system/dist/builtins/platform-probe/index.mjs +1 -1
  107. package/system/dist/builtins/record-entries/index.js +1 -1
  108. package/system/dist/builtins/record-entries/index.mjs +1 -1
  109. package/system/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.js +1 -1
  110. package/system/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.mjs +1 -1
  111. package/system/dist/builtins/snapshot/index.js +1 -1
  112. package/system/dist/builtins/snapshot/index.mjs +1 -1
  113. package/system/dist/builtins/sqlite-storage/filesystem-storage.addon.js +1 -1
  114. package/system/dist/builtins/sqlite-storage/filesystem-storage.addon.mjs +1 -1
  115. package/system/dist/builtins/sqlite-storage/index.js +1 -1
  116. package/system/dist/builtins/sqlite-storage/index.mjs +1 -1
  117. package/system/dist/builtins/sqlite-storage/migrations/migration-engine.d.ts +3 -1
  118. package/system/dist/builtins/sqlite-storage/migrations/migrations-provider.d.ts +1 -0
  119. package/system/dist/builtins/sqlite-storage/sqlite-settings.addon.js +15 -10
  120. package/system/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +15 -10
  121. package/system/dist/builtins/storage-orchestrator/storage-orchestrator.addon.js +1 -1
  122. package/system/dist/builtins/storage-orchestrator/storage-orchestrator.addon.mjs +1 -1
  123. package/system/dist/builtins/system-config/system-config.addon.js +2 -2
  124. package/system/dist/builtins/system-config/system-config.addon.mjs +2 -2
  125. package/system/dist/builtins/winston-logging/index.js +2 -2
  126. package/system/dist/builtins/winston-logging/index.mjs +2 -2
  127. package/system/dist/{command-catalog-C29hVOOg.js → command-catalog-A_ONlLfF.js} +1 -1
  128. package/system/dist/{command-catalog-xAeqxbZk.mjs → command-catalog-CZDlLhxO.mjs} +1 -1
  129. package/system/dist/{composition-sources-Do5qM6EB.js → composition-sources-D1nPv7dJ.js} +1 -1
  130. package/system/dist/{composition-sources-C327LGFn.mjs → composition-sources-DubMf_ii.mjs} +1 -1
  131. package/system/dist/{core-blocks.cap-CdTGUKtr.js → core-blocks.cap-DEYCvF9J.js} +125 -373
  132. package/system/dist/{core-blocks.cap-DLkEfV5b.mjs → core-blocks.cap-sW5HLDlB.mjs} +109 -327
  133. package/system/dist/{device-manager.cap-DJs8izI6.js → device-manager.cap-B9qVf7ag.js} +163 -22
  134. package/system/dist/{device-manager.cap-eYrj1Ezp.mjs → device-manager.cap-CV4KGp3e.mjs} +134 -17
  135. package/system/dist/{error.cap-CU1FB6uE.mjs → error.cap-B8l7L8e4.mjs} +7 -1
  136. package/system/dist/{error.cap-BuKbL3Ac.js → error.cap-BqlvgBJd.js} +7 -1
  137. package/system/dist/file-host-worker.js +1 -1
  138. package/system/dist/file-host-worker.mjs +1 -1
  139. package/system/dist/index.js +8 -8
  140. package/system/dist/index.mjs +7 -7
  141. package/system/dist/{legacy-integration-rows-door-CdqYAj-o.js → legacy-integration-rows-door-BK8eoGlF.js} +1 -1
  142. package/system/dist/{legacy-integration-rows-door-LSgpClpX.mjs → legacy-integration-rows-door-CwzC5XNk.mjs} +1 -1
  143. package/system/dist/{migration-DGAc6ywR.mjs → migration-BvbfW9g-.mjs} +6 -0
  144. package/system/dist/{migration-BOQlFZCN.js → migration-CHPdAdNh.js} +6 -0
  145. package/system/dist/{prefix-walk-Mtij0NNT.mjs → named-entity-store-Cq2oVrN5.mjs} +195 -89
  146. package/system/dist/{prefix-walk-BFnw8NBu.js → named-entity-store-O_hi1y_o.js} +244 -90
  147. package/system/dist/{notification-rules.cap-BUIuYPlQ.mjs → notification-rules.cap-ClvK6QT1.mjs} +10 -5
  148. package/system/dist/{notification-rules.cap-BJKUjizS.js → notification-rules.cap-uSLoe2pA.js} +10 -5
  149. package/system/dist/{notification-targets-DMW7xgR2.js → notification-targets-ChqpBbtR.js} +2 -2
  150. package/system/dist/{notification-targets-4bGYH5J7.mjs → notification-targets-DUA6-F2t.mjs} +2 -2
  151. package/system/dist/{device-row-store-CTocYKqC.mjs → record-kinds-BD2xv4Pd.mjs} +222 -93
  152. package/system/dist/{device-row-store-C0P2H18h.js → record-kinds-BV8Gcpsx.js} +246 -93
  153. package/system/dist/records/named-entity-store.d.ts +60 -0
  154. package/system/dist/{rename-composition-block-D9Uc1AF7.js → rename-composition-block-C60O0P16.js} +137 -33
  155. package/system/dist/{rename-composition-block-Cdh-dRmY.mjs → rename-composition-block-DcX3vkwS.mjs} +137 -33
  156. package/system/dist/{retention-source.cap-C6Hy0hlM.js → retention-source.cap-A-TMhU5O.js} +1 -1
  157. package/system/dist/{retention-source.cap-550kkyp5.mjs → retention-source.cap-Ct07pM30.mjs} +1 -1
  158. package/system/dist/{storage-admin.cap-Ci4QbL6P.mjs → storage-admin.cap-C54s9_B9.mjs} +8 -2
  159. package/system/dist/{storage-admin.cap-DqW1ol4j.js → storage-admin.cap-DSPHi7ut.js} +8 -2
  160. package/system/dist/{stream-catalog.cap-CjEQFknc.js → stream-catalog.cap-7WPsugOy.js} +1 -1
  161. package/system/dist/{stream-catalog.cap-DVniDdRD.mjs → stream-catalog.cap-CzwRDaqT.mjs} +1 -1
  162. package/system/dist/{tag-BxLazvVb.js → tag-BLraBqvp.js} +12 -0
  163. package/system/dist/{tag-uZBAq6ox.mjs → tag-DU8pm9Bi.mjs} +7 -1
  164. package/system/dist/time-window-B6UhCArd.js +679 -0
  165. package/system/dist/time-window-BnUBULgu.mjs +578 -0
  166. package/system/dist/{wal-maintenance-BgYiAy5b.js → wal-maintenance-CkPfVApC.js} +0 -0
  167. package/system/dist/{wal-maintenance-Bey5ChBb.mjs → wal-maintenance-u84_1sVl.mjs} +0 -0
  168. package/system/package.json +16 -1
  169. /package/system/dist/{constants-Ba3FTIHl.js → constants-Ba3FTIHl2.js} +0 -0
  170. /package/system/dist/{constants-DB4piTD5.mjs → constants-DB4piTD52.mjs} +0 -0
@@ -1,12 +1,12 @@
1
1
  const require_streaming_shared = require("./streaming-shared-DQwFZOSi.js");
2
- const require_stream_catalog_cap = require("./stream-catalog.cap-CjEQFknc.js");
3
- const require_base_addon = require("./base-addon-CRsXtYFG.js");
2
+ const require_stream_catalog_cap = require("./stream-catalog.cap-7WPsugOy.js");
3
+ const require_base_addon = require("./base-addon-BG7p06Hb.js");
4
4
  const require_scoped_settings = require("./scoped-settings-CylSSq_8.js");
5
5
  const require_capability_definition = require("./capability-definition-BEVd01Xj.js");
6
- const require_notification_rules_cap = require("./notification-rules.cap-BJKUjizS.js");
7
- const require_device_manager_cap = require("./device-manager.cap-DJs8izI6.js");
6
+ const require_notification_rules_cap = require("./notification-rules.cap-uSLoe2pA.js");
7
+ const require_device_manager_cap = require("./device-manager.cap-B9qVf7ag.js");
8
8
  const require_device_identifiers = require("./device-identifiers-BQg9EQi1.js");
9
- const require_retention_source_cap = require("./retention-source.cap-C6Hy0hlM.js");
9
+ const require_retention_source_cap = require("./retention-source.cap-A-TMhU5O.js");
10
10
  const require_system_reasons = require("./system-reasons-Be_k1W8g.js");
11
11
  const require_settings_store_cap = require("./settings-store.cap-BhOIBtO4.js");
12
12
  const require_quantity = require("./quantity-lY1KiTSZ.js");
@@ -14,26 +14,27 @@ const require_labels = require("./labels-DX5S8deC.js");
14
14
  const require_recording_archive_cap = require("./recording-archive.cap-Wo-hEZhz.js");
15
15
  const require_relocate = require("./relocate-CdVQAk-w.js");
16
16
  const require_storage_migration_cap = require("./storage-migration.cap-CDOhpCQw.js");
17
- const require_tag = require("./tag-BxLazvVb.js");
17
+ const require_tag = require("./tag-BLraBqvp.js");
18
18
  const require_platform_probe_cap = require("./platform-probe.cap-C0N9CugQ.js");
19
19
  const require_user_management_cap = require("./user-management.cap-DV9Jfsj3.js");
20
20
  const require_device_type = require("./device-type-Cnc0NiSX.js");
21
21
  const require_device_certificate = require("./device-certificate-CguVACQO.js");
22
- const require_action_index = require("./action-index-B_cLRwXJ.js");
23
- const require_addon_settings_cap = require("./addon-settings.cap-DrLdMFIe.js");
24
- const require_core_blocks_cap = require("./core-blocks.cap-CdTGUKtr.js");
22
+ const require_core_blocks_cap = require("./core-blocks.cap-DEYCvF9J.js");
23
+ const require_action_index = require("./action-index-Bcnb-jyg.js");
24
+ const require_addon_settings_cap = require("./addon-settings.cap-nZVHPo3X.js");
25
25
  const require_compile = require("./compile-SpeAhaZ6.js");
26
26
  const require_source_info = require("./source-info-DtWf4k2j.js");
27
27
  const require_l10n = require("./l10n-CGMvp7NF.js");
28
28
  const require_addon_pages_cap = require("./addon-pages.cap-B3gHFDYW.js");
29
29
  const require_addon_widgets_cap = require("./addon-widgets.cap-DuCe2VRj.js");
30
+ const require_apps_cap = require("./apps.cap-CLjgnuUe.js");
30
31
  const require_database_snapshot_cap = require("./database-snapshot.cap-BNS5c60M.js");
31
32
  const require_storage_occupancy_cap = require("./storage-occupancy.cap-B-Z8f8TZ.js");
32
33
  const require_calendars_cap = require("./calendars.cap-CGeOtL7Q.js");
33
34
  const require_history_catalog = require("./history-catalog-CiTMP3-E.js");
34
- const require_storage_admin_cap = require("./storage-admin.cap-DqW1ol4j.js");
35
+ const require_storage_admin_cap = require("./storage-admin.cap-DSPHi7ut.js");
35
36
  const require_device_provider_cap = require("./device-provider.cap-CNlYBQ5D.js");
36
- const require_error_cap = require("./error.cap-BuKbL3Ac.js");
37
+ const require_error_cap = require("./error.cap-BqlvgBJd.js");
37
38
  const require_storage_provider_cap = require("./storage-provider.cap-B3Hm_BGM.js");
38
39
  const require_integration_instances_cap = require("./integration-instances.cap-DSieF1w3.js");
39
40
  const require_keychain_admin_cap = require("./keychain-admin.cap-DcRCRWtu.js");
@@ -1074,7 +1075,12 @@ var eventEmitterCapability = {
1074
1075
  } },
1075
1076
  status: {
1076
1077
  schema: EventEmitterStatusSchema,
1077
- kind: "push"
1078
+ kind: "push",
1079
+ fieldEnums: { "lastEvent.eventType": {
1080
+ from: "status",
1081
+ listKey: "vocabulary",
1082
+ valueKey: "id"
1083
+ } }
1078
1084
  },
1079
1085
  runtimeState: EventEmitterStatusSchema,
1080
1086
  /**
@@ -1240,6 +1246,8 @@ var ActionEntrySchema = /* @__PURE__ */ zod.z.object({
1240
1246
  minDelaySec: /* @__PURE__ */ ActionMinDelaySecSchema.optional(),
1241
1247
  /** Internal only: operator tags (D1054). Absent = no tags. */
1242
1248
  tags: /* @__PURE__ */ require_tag.TagsFieldSchema.optional(),
1249
+ /** The tag ids (D1089); `tags` is kept beside them for one release. */
1250
+ tagIds: /* @__PURE__ */ require_tag.TagIdsFieldSchema.optional(),
1243
1251
  status: ActionStatusSchema
1244
1252
  }).superRefine((entry, ctx) => {
1245
1253
  if (entry.source === "internal") {
@@ -1272,7 +1280,9 @@ var ActionInputSchema$1 = /* @__PURE__ */ zod.z.object({
1272
1280
  steps: /* @__PURE__ */ zod.z.array(require_core_blocks_cap.ActionStepSchema).min(1).max(50),
1273
1281
  variables: /* @__PURE__ */ zod.z.array(ActionVariableSchema).max(20).optional(),
1274
1282
  minDelaySec: /* @__PURE__ */ ActionMinDelaySecSchema.optional(),
1275
- tags: /* @__PURE__ */ require_tag.TagsFieldSchema.optional()
1283
+ tags: /* @__PURE__ */ require_tag.TagsFieldSchema.optional(),
1284
+ /** The tag ids (D1089); `tags` is kept beside them for one release. */
1285
+ tagIds: /* @__PURE__ */ require_tag.TagIdsFieldSchema.optional()
1276
1286
  });
1277
1287
  /** Who started a run. Absent = the operator pressed it. */
1278
1288
  var ActionRunOriginSchema = /* @__PURE__ */ zod.z.object({
@@ -3894,6 +3904,16 @@ var BatteryStatusSchema = /* @__PURE__ */ zod.z.object({
3894
3904
  */
3895
3905
  lastFullRefreshAt: /* @__PURE__ */ zod.z.number().optional(),
3896
3906
  /**
3907
+ * The scheduled refresh's attempt bookkeeping for the window it last tried
3908
+ * (window index, attempts spent, ms epoch of the last attempt; `0` = none).
3909
+ * Persisted beside `lastFullRefreshAt` so a restart neither forgets a wake
3910
+ * the window already spent nor repeats it (#666). Written only by the
3911
+ * provider's refresh controller.
3912
+ */
3913
+ refreshAttemptWindow: /* @__PURE__ */ zod.z.number().optional(),
3914
+ refreshAttempts: /* @__PURE__ */ zod.z.number().optional(),
3915
+ refreshLastAttemptAt: /* @__PURE__ */ zod.z.number().optional(),
3916
+ /**
3897
3917
  * True when the source is a BINARY low-battery indicator (HA
3898
3918
  * `binary_sensor` device_class=battery / `LOW_BAT`) that has no real
3899
3919
  * charge level — `level` is then a coarse stand-in (100 = normal,
@@ -12424,6 +12444,44 @@ var heatingValveCapability = {
12424
12444
  }
12425
12445
  };
12426
12446
  //#endregion
12447
+ //#region ../types/dist/esm/device/switch-run-limits.mjs
12448
+ /**
12449
+ * How long a switch-like device may be kept on, by its type AND role: the ONE
12450
+ * table (D1033 timed run, D1092 "on for").
12451
+ *
12452
+ * The maximum is a safety bound, not a preference. A request above it is
12453
+ * refused where it is made (timed run, a saved "on for") and clamped where it
12454
+ * is armed, so nothing a stored value says can hold a device on longer.
12455
+ */
12456
+ var MINUTE = 60;
12457
+ /** A plug-in heater (switch + `switch-heater`): up to 3 h. */
12458
+ var SWITCH_RUN_HEATER_LIMIT = {
12459
+ maxSeconds: 180 * MINUTE,
12460
+ quickRunSeconds: 30 * MINUTE
12461
+ };
12462
+ /** A pet fountain's pump: up to 5 min. */
12463
+ var SWITCH_RUN_PET_FOUNTAIN_LIMIT = {
12464
+ maxSeconds: 300,
12465
+ quickRunSeconds: 60
12466
+ };
12467
+ /** A siren: up to 10 min, a one-tap run of 1 min. */
12468
+ var SWITCH_RUN_SIREN_LIMIT = {
12469
+ maxSeconds: 10 * MINUTE,
12470
+ quickRunSeconds: MINUTE
12471
+ };
12472
+ /** Every other switch: up to 24 h, a one-tap run of 15 min. */
12473
+ var SWITCH_RUN_DEFAULT_LIMIT = {
12474
+ maxSeconds: 1440 * MINUTE,
12475
+ quickRunSeconds: 15 * MINUTE
12476
+ };
12477
+ /** The limit of a device by type and role; the default when nothing narrower applies. */
12478
+ function switchRunLimitOf(deviceType, role) {
12479
+ if (deviceType === require_device_type.DeviceType.PetFountain) return SWITCH_RUN_PET_FOUNTAIN_LIMIT;
12480
+ if (role === require_device_type.DeviceRole.SwitchHeater) return SWITCH_RUN_HEATER_LIMIT;
12481
+ if (role === require_device_type.DeviceRole.Siren) return SWITCH_RUN_SIREN_LIMIT;
12482
+ return SWITCH_RUN_DEFAULT_LIMIT;
12483
+ }
12484
+ //#endregion
12427
12485
  //#region ../types/dist/esm/capabilities/timed-run.cap.mjs
12428
12486
  /**
12429
12487
  * timed-run - run a device for a chosen time, then stop it (D993).
@@ -12447,16 +12505,16 @@ var TimedRunUnitSchema = /* @__PURE__ */ zod.z.enum(["s", "min"]);
12447
12505
  /** A plug-in heater (switch + `switch-heater`): up to 3 h, in minutes. */
12448
12506
  var TIMED_RUN_HEATER_LIMIT = {
12449
12507
  actuator: "switch",
12450
- maxSeconds: 10800,
12508
+ maxSeconds: SWITCH_RUN_HEATER_LIMIT.maxSeconds,
12451
12509
  unit: "min",
12452
- quickRunDefault: 30
12510
+ quickRunDefault: SWITCH_RUN_HEATER_LIMIT.quickRunSeconds / 60
12453
12511
  };
12454
12512
  /** A pet fountain's pump: up to 5 min, in seconds. */
12455
12513
  var TIMED_RUN_PET_FOUNTAIN_LIMIT = {
12456
12514
  actuator: "pet-fountain",
12457
- maxSeconds: 300,
12515
+ maxSeconds: SWITCH_RUN_PET_FOUNTAIN_LIMIT.maxSeconds,
12458
12516
  unit: "s",
12459
- quickRunDefault: 60
12517
+ quickRunDefault: SWITCH_RUN_PET_FOUNTAIN_LIMIT.quickRunSeconds
12460
12518
  };
12461
12519
  /**
12462
12520
  * The device types `timed-run` may be offered on. A `switch` is narrowed by
@@ -12471,8 +12529,9 @@ var TIMED_RUN_DEVICE_ROLES = { [require_device_type.DeviceType.Switch]: [require
12471
12529
  * `null` - the device is not offered `timed-run`.
12472
12530
  */
12473
12531
  function timedRunLimitOf(deviceType, role) {
12474
- if (deviceType === require_device_type.DeviceType.PetFountain) return TIMED_RUN_PET_FOUNTAIN_LIMIT;
12475
- if (deviceType === require_device_type.DeviceType.Switch && role === require_device_type.DeviceRole.SwitchHeater) return TIMED_RUN_HEATER_LIMIT;
12532
+ const limit = switchRunLimitOf(deviceType, role);
12533
+ if (deviceType === require_device_type.DeviceType.PetFountain && limit === SWITCH_RUN_PET_FOUNTAIN_LIMIT) return TIMED_RUN_PET_FOUNTAIN_LIMIT;
12534
+ if (deviceType === require_device_type.DeviceType.Switch && role === require_device_type.DeviceRole.SwitchHeater && limit === SWITCH_RUN_HEATER_LIMIT) return TIMED_RUN_HEATER_LIMIT;
12476
12535
  return null;
12477
12536
  }
12478
12537
  var MS_PER_SECOND = 1e3;
@@ -29107,6 +29166,30 @@ var tagsCapability = {
29107
29166
  scope: "system",
29108
29167
  mode: "singleton",
29109
29168
  methods: {
29169
+ /** Create the tag named `name`, or return the one that has it (trimmed,
29170
+ * case-insensitive). A new tag gets a random id (D1089). */
29171
+ ensureTag: /* @__PURE__ */ require_capability_definition.method(/* @__PURE__ */ zod.z.object({ name: require_tag.TagNameSchema }), require_device_manager_cap.TagRecordSchema, {
29172
+ kind: "mutation",
29173
+ auth: "admin"
29174
+ }),
29175
+ /** Every tag record, sorted by `order` then name. */
29176
+ listTags: /* @__PURE__ */ require_capability_definition.method(/* @__PURE__ */ zod.z.object({}), /* @__PURE__ */ zod.z.array(require_device_manager_cap.TagRecordSchema), { auth: "protected" }),
29177
+ /** ONE write to ONE record: rename, restyle, describe. No owner is rewritten
29178
+ * and none has to be reachable. A rename onto another tag's name is refused
29179
+ * (`tag-name-taken`). */
29180
+ updateTag: /* @__PURE__ */ require_capability_definition.method(/* @__PURE__ */ zod.z.object({
29181
+ id: /* @__PURE__ */ zod.z.string().min(1),
29182
+ patch: require_device_manager_cap.TagPatchSchema
29183
+ }), require_device_manager_cap.TagRecordSchema, {
29184
+ kind: "mutation",
29185
+ auth: "admin"
29186
+ }),
29187
+ /** Delete a tag and clear it from every owner (the one fan-out that remains).
29188
+ * Refused while an owner cannot be read, naming it. */
29189
+ deleteTag: /* @__PURE__ */ require_capability_definition.method(/* @__PURE__ */ zod.z.object({ id: /* @__PURE__ */ zod.z.string().min(1) }), /* @__PURE__ */ zod.z.object({ updated: TagUsageCountsSchema }), {
29190
+ kind: "mutation",
29191
+ auth: "admin"
29192
+ }),
29110
29193
  /**
29111
29194
  * Every tag: styled or in use, with how many records of each kind carry it.
29112
29195
  * An unreachable owner degrades that kind's count to `null`; the call still
@@ -29339,6 +29422,11 @@ var TimeWindowInputSchema = /* @__PURE__ */ zod.z.object({
29339
29422
  kind: /* @__PURE__ */ zod.z.literal("time-window"),
29340
29423
  ...inputBase
29341
29424
  });
29425
+ /** A limit on the state of a device (a derived "is night"); only a `gate` binding reads it. */
29426
+ var DeviceStateInputSchema = /* @__PURE__ */ zod.z.object({
29427
+ kind: /* @__PURE__ */ zod.z.literal("device-state"),
29428
+ ...inputBase
29429
+ });
29342
29430
  /**
29343
29431
  * A list of automation elements, verbatim: `trigger` entries are event leaves
29344
29432
  * of a `when` tree (`device-fired`), `step` entries are steps of a branch
@@ -29362,7 +29450,8 @@ var TemplateScalarInputSchema = /* @__PURE__ */ zod.z.discriminatedUnion("kind",
29362
29450
  TextInputSchema,
29363
29451
  SelectInputSchema,
29364
29452
  BooleanInputSchema,
29365
- TimeWindowInputSchema
29453
+ TimeWindowInputSchema,
29454
+ DeviceStateInputSchema
29366
29455
  ]);
29367
29456
  var groupBase = {
29368
29457
  kind: /* @__PURE__ */ zod.z.literal("group"),
@@ -29448,10 +29537,10 @@ var TemplateRowsBindingSchema = /* @__PURE__ */ zod.z.object({
29448
29537
  item: /* @__PURE__ */ zod.z.unknown(),
29449
29538
  bindings: /* @__PURE__ */ zod.z.array(TemplateRowItemBindingSchema).max(40)
29450
29539
  });
29451
- /** Wraps the condition tree at `path` as `all[time-is, <tree>]` when the input has a value. */
29540
+ /** Wraps the condition tree at `path` as `all[time-is | device-is, <tree>]` when the input has a value. */
29452
29541
  var TemplateGateBindingSchema = /* @__PURE__ */ zod.z.object({
29453
29542
  kind: /* @__PURE__ */ zod.z.literal("gate"),
29454
- /** A top-level `time-window` input. */
29543
+ /** A top-level `time-window` or `device-state` input. */
29455
29544
  input: inputKey,
29456
29545
  path: TemplatePathSchema
29457
29546
  });
@@ -29478,7 +29567,7 @@ function levelProblems(inputs, path, inRow = false) {
29478
29567
  issues.push(...levelProblems(input.inputs, path, true));
29479
29568
  continue;
29480
29569
  }
29481
- if (input.kind === "time-window" && inRow) issues.push({
29570
+ if ((input.kind === "time-window" || input.kind === "device-state") && inRow) issues.push({
29482
29571
  message: `time window "${input.key}" limits the whole automation: it is not a row input`,
29483
29572
  path
29484
29573
  });
@@ -29570,9 +29659,9 @@ function bindingProblems(payload, ctx) {
29570
29659
  path: ["bindings", index]
29571
29660
  });
29572
29661
  }
29573
- if (binding.kind === "gate" !== (input.kind === "time-window")) ctx.addIssue({
29662
+ if (binding.kind === "gate" !== (input.kind === "time-window" || input.kind === "device-state")) ctx.addIssue({
29574
29663
  code: "custom",
29575
- message: `a gate reads a time window and a time window is bound with a gate: "${input.key}" is ${input.kind}`,
29664
+ message: `a gate reads a time window or a device state, and those are bound with a gate: "${input.key}" is ${input.kind}`,
29576
29665
  path: ["bindings", index]
29577
29666
  });
29578
29667
  if (binding.kind === "rows") {
@@ -29626,6 +29715,10 @@ function valueProblem(input, value) {
29626
29715
  const parsed = require_core_blocks_cap.TemplateTimeWindowValueSchema.safeParse(value);
29627
29716
  return parsed.success ? null : parsed.error.issues[0]?.message ?? "pick a time window";
29628
29717
  }
29718
+ case "device-state": {
29719
+ const parsed = require_core_blocks_cap.TemplateDeviceStateValueSchema.safeParse(value);
29720
+ return parsed.success ? null : parsed.error.issues[0]?.message ?? "pick a device state";
29721
+ }
29629
29722
  case "entries": return entriesProblem(input, value);
29630
29723
  }
29631
29724
  }
@@ -29792,14 +29885,17 @@ function writeValue(root, binding, input, value) {
29792
29885
  }
29793
29886
  }
29794
29887
  /** The tree at the path, under an `all` beside the window. */
29795
- function writeGate(root, binding, value) {
29796
- const window = require_core_blocks_cap.TemplateTimeWindowValueSchema.parse(value);
29888
+ function writeGate(root, binding, inputKind, value) {
29889
+ const leaf = inputKind === "device-state" ? {
29890
+ kind: "device-is",
29891
+ ...require_core_blocks_cap.TemplateDeviceStateValueSchema.parse(value)
29892
+ } : {
29893
+ kind: "time-is",
29894
+ ...require_core_blocks_cap.TemplateTimeWindowValueSchema.parse(value)
29895
+ };
29797
29896
  return setAt(root, binding.path, {
29798
29897
  kind: "all",
29799
- children: [{
29800
- kind: "time-is",
29801
- ...window
29802
- }, getAt(root, binding.path)]
29898
+ children: [leaf, getAt(root, binding.path)]
29803
29899
  });
29804
29900
  }
29805
29901
  /** The name a row is known by: `buttons-0`, and `buttons-0-events-1` for a nested row. */
@@ -29911,7 +30007,11 @@ function expandAutomationTemplate(payload, values) {
29911
30007
  if (list.success) body = appendAt(body, binding.path, list.data, input.key);
29912
30008
  continue;
29913
30009
  }
29914
- body = binding.kind === "gate" ? writeGate(body, binding, value) : writeValue(body, binding, input, value);
30010
+ if (binding.kind === "gate") {
30011
+ if (input.kind === "time-window" || input.kind === "device-state") body = writeGate(body, binding, input.kind, value);
30012
+ continue;
30013
+ }
30014
+ body = writeValue(body, binding, input, value);
29915
30015
  }
29916
30016
  } catch (error) {
29917
30017
  if (!(error instanceof PathError)) throw error;
@@ -30024,7 +30124,9 @@ var TemplateRecordSchema = /* @__PURE__ */ zod.z.object({
30024
30124
  /** Shipped with CamStack (`builtin:` ids): listed beside the operator's, never updated or deleted. */
30025
30125
  builtIn: /* @__PURE__ */ zod.z.literal(true).optional(),
30026
30126
  /** Operator tags (D1054). Absent = no tags. */
30027
- tags: /* @__PURE__ */ require_tag.TagsFieldSchema.optional()
30127
+ tags: /* @__PURE__ */ require_tag.TagsFieldSchema.optional(),
30128
+ /** The tag ids (D1089); `tags` is kept beside them for one release. */
30129
+ tagIds: /* @__PURE__ */ require_tag.TagIdsFieldSchema.optional()
30028
30130
  });
30029
30131
  var TemplateWriteResultSchema = /* @__PURE__ */ zod.z.discriminatedUnion("status", [/* @__PURE__ */ zod.z.object({
30030
30132
  status: /* @__PURE__ */ zod.z.literal("saved"),
@@ -34064,6 +34166,8 @@ var ALL_CAPABILITY_DEFINITIONS = [
34064
34166
  require_notification_rules_cap.alarmPanelCapability,
34065
34167
  require_compile.alertsCapability,
34066
34168
  ambientLightSensorCapability,
34169
+ require_apps_cap.appSourceCapability,
34170
+ require_apps_cap.appsCapability,
34067
34171
  audioAnalysisCapability,
34068
34172
  audioAnalyzerCapability,
34069
34173
  audioCodecCapability,