@camstack/server 1.2.942 → 1.2.944

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 (158) 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-routers.js +83 -0
  7. package/dist/auth/native-return.js +9 -3
  8. package/dist/auth/sso-routes.js +5 -1
  9. package/dist/core/addon/instance-lifecycle.js +4 -1
  10. package/dist/core/auth/handoff-code.service.js +35 -1
  11. package/dist/server-root/index.js +313 -70
  12. package/package.json +22 -26
  13. package/system/dist/{action-index-B1fgpQBt.mjs → action-index-DpYmsOKh.mjs} +1 -1
  14. package/system/dist/{action-index-B_cLRwXJ.js → action-index-Dz9rd1qa.js} +1 -1
  15. package/system/dist/{addon-settings.cap-CZ4MC7ha.mjs → addon-settings.cap-CHpmuaQG.mjs} +1 -1
  16. package/system/dist/{addon-settings.cap-DrLdMFIe.js → addon-settings.cap-nZVHPo3X.js} +1 -1
  17. package/system/dist/{alert-episode-Be--PngO.mjs → alert-episode-D-1VUUkZ.mjs} +1 -1
  18. package/system/dist/{alert-episode-Bqktmt-i.js → alert-episode-DaQ3prSe.js} +1 -1
  19. package/system/dist/{base-addon-CRsXtYFG.js → base-addon-BG7p06Hb.js} +136 -15
  20. package/system/dist/{base-addon-BcS6r1cT.mjs → base-addon-BcVoYZbC.mjs} +136 -15
  21. package/system/dist/{base-device-DAdWzDOl.js → base-device-DeSNiwZ4.js} +4 -4
  22. package/system/dist/{base-device-DJXF5eDN.mjs → base-device-w_MD0Bf4.mjs} +4 -4
  23. package/system/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.js +1 -1
  24. package/system/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.mjs +1 -1
  25. package/system/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.js +1 -1
  26. package/system/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.mjs +1 -1
  27. package/system/dist/builtins/alerts/alerts.addon.js +3 -3
  28. package/system/dist/builtins/alerts/alerts.addon.mjs +3 -3
  29. package/system/dist/builtins/autotrack/index.js +1 -1
  30. package/system/dist/builtins/autotrack/index.mjs +1 -1
  31. package/system/dist/builtins/backup-orchestrator/backup-orchestrator.addon.js +1 -1
  32. package/system/dist/builtins/backup-orchestrator/backup-orchestrator.addon.mjs +1 -1
  33. package/system/dist/builtins/calendars/calendars.addon.js +1 -1
  34. package/system/dist/builtins/calendars/calendars.addon.mjs +1 -1
  35. package/system/dist/builtins/camera-grid/index.js +3 -3
  36. package/system/dist/builtins/camera-grid/index.mjs +3 -3
  37. package/system/dist/builtins/composer/composer.addon.js +7 -7
  38. package/system/dist/builtins/composer/composer.addon.mjs +7 -7
  39. package/system/dist/builtins/console-logging/index.js +1 -1
  40. package/system/dist/builtins/console-logging/index.mjs +1 -1
  41. package/system/dist/builtins/core-blocks/actions-store.d.ts +2 -0
  42. package/system/dist/builtins/core-blocks/block-supervisor.d.ts +16 -4
  43. package/system/dist/builtins/core-blocks/core-block-store.d.ts +2 -0
  44. package/system/dist/builtins/core-blocks/core-blocks.addon.js +1018 -323
  45. package/system/dist/builtins/core-blocks/core-blocks.addon.mjs +986 -291
  46. package/system/dist/builtins/core-blocks/migrations/index.d.ts +5 -2
  47. package/system/dist/builtins/core-blocks/migrations/tag-ids.d.ts +42 -0
  48. package/system/dist/builtins/core-blocks/migrations/tags-as-records.d.ts +47 -0
  49. package/system/dist/builtins/core-blocks/record-kinds.d.ts +12 -1
  50. package/system/dist/builtins/core-blocks/runs-api.d.ts +3 -1
  51. package/system/dist/builtins/core-blocks/runs-ledger.d.ts +3 -1
  52. package/system/dist/builtins/core-blocks/scheduler/scheduler-store.d.ts +2 -0
  53. package/system/dist/builtins/core-blocks/tags-service.d.ts +52 -27
  54. package/system/dist/builtins/core-blocks/tags-wiring.d.ts +2 -0
  55. package/system/dist/builtins/core-notifier/core-notifier.addon.js +76 -67
  56. package/system/dist/builtins/core-notifier/core-notifier.addon.mjs +76 -67
  57. package/system/dist/builtins/device-history/device-history.addon.js +4 -4
  58. package/system/dist/builtins/device-history/device-history.addon.mjs +4 -4
  59. package/system/dist/builtins/device-manager/device-config-secrets.d.ts +14 -0
  60. package/system/dist/builtins/device-manager/device-manager.addon.js +1655 -764
  61. package/system/dist/builtins/device-manager/device-manager.addon.mjs +1641 -750
  62. package/system/dist/builtins/device-manager/device-meta-actions.d.ts +13 -136
  63. package/system/dist/builtins/device-manager/device-meta-types.d.ts +5 -1
  64. package/system/dist/builtins/device-manager/device-provider-context.d.ts +9 -0
  65. package/system/dist/builtins/device-manager/device-row-store.d.ts +21 -4
  66. package/system/dist/builtins/device-manager/device-search.d.ts +6 -0
  67. package/system/dist/builtins/device-manager/location-alignment.d.ts +9 -2
  68. package/system/dist/builtins/device-manager/migrate-device.d.ts +7 -2
  69. package/system/dist/builtins/device-manager/migrate-hardware-state.d.ts +132 -1
  70. package/system/dist/builtins/device-manager/migrations/device-tag-ids.d.ts +25 -0
  71. package/system/dist/builtins/device-manager/migrations/index.d.ts +16 -0
  72. package/system/dist/builtins/device-manager/migrations/orphan-children.d.ts +33 -0
  73. package/system/dist/builtins/device-manager/migrations/ports.d.ts +17 -0
  74. package/system/dist/builtins/device-manager/migrations/rooms-as-records.d.ts +52 -0
  75. package/system/dist/builtins/device-manager/record-kinds.d.ts +3 -1
  76. package/system/dist/builtins/device-manager/removal-cleanup.d.ts +7 -0
  77. package/system/dist/builtins/device-manager/room-actions.d.ts +27 -0
  78. package/system/dist/builtins/device-manager/room-store.d.ts +19 -0
  79. package/system/dist/builtins/device-manager/tag-names.d.ts +32 -0
  80. package/system/dist/builtins/device-manager/wireable-enum-catalog.d.ts +18 -0
  81. package/system/dist/builtins/hub-forwarder/index.js +1 -1
  82. package/system/dist/builtins/hub-forwarder/index.mjs +1 -1
  83. package/system/dist/builtins/keychain/index.js +2 -2
  84. package/system/dist/builtins/keychain/index.mjs +2 -2
  85. package/system/dist/builtins/liveness-monitor/liveness-monitor.addon.js +1 -1
  86. package/system/dist/builtins/liveness-monitor/liveness-monitor.addon.mjs +1 -1
  87. package/system/dist/builtins/local-auth/local-auth.addon.js +1 -1
  88. package/system/dist/builtins/local-auth/local-auth.addon.mjs +1 -1
  89. package/system/dist/builtins/local-network/local-network.addon.js +2 -2
  90. package/system/dist/builtins/local-network/local-network.addon.mjs +2 -2
  91. package/system/dist/builtins/loki-logging/index.js +2 -2
  92. package/system/dist/builtins/loki-logging/index.mjs +2 -2
  93. package/system/dist/builtins/native-metrics/native-metrics.addon.js +1 -1
  94. package/system/dist/builtins/native-metrics/native-metrics.addon.mjs +1 -1
  95. package/system/dist/builtins/platform-probe/index.js +1 -1
  96. package/system/dist/builtins/platform-probe/index.mjs +1 -1
  97. package/system/dist/builtins/record-entries/index.js +1 -1
  98. package/system/dist/builtins/record-entries/index.mjs +1 -1
  99. package/system/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.js +1 -1
  100. package/system/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.mjs +1 -1
  101. package/system/dist/builtins/snapshot/index.js +1 -1
  102. package/system/dist/builtins/snapshot/index.mjs +1 -1
  103. package/system/dist/builtins/sqlite-storage/filesystem-storage.addon.js +1 -1
  104. package/system/dist/builtins/sqlite-storage/filesystem-storage.addon.mjs +1 -1
  105. package/system/dist/builtins/sqlite-storage/index.js +1 -1
  106. package/system/dist/builtins/sqlite-storage/index.mjs +1 -1
  107. package/system/dist/builtins/sqlite-storage/migrations/migration-engine.d.ts +3 -1
  108. package/system/dist/builtins/sqlite-storage/migrations/migrations-provider.d.ts +1 -0
  109. package/system/dist/builtins/sqlite-storage/sqlite-settings.addon.js +15 -10
  110. package/system/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +15 -10
  111. package/system/dist/builtins/storage-orchestrator/storage-orchestrator.addon.js +1 -1
  112. package/system/dist/builtins/storage-orchestrator/storage-orchestrator.addon.mjs +1 -1
  113. package/system/dist/builtins/system-config/system-config.addon.js +1 -1
  114. package/system/dist/builtins/system-config/system-config.addon.mjs +1 -1
  115. package/system/dist/builtins/winston-logging/index.js +2 -2
  116. package/system/dist/builtins/winston-logging/index.mjs +2 -2
  117. package/system/dist/{command-catalog-C29hVOOg.js → command-catalog-CI0tu1Nt.js} +1 -1
  118. package/system/dist/{command-catalog-xAeqxbZk.mjs → command-catalog-zwlIA3T5.mjs} +1 -1
  119. package/system/dist/{composition-sources-C327LGFn.mjs → composition-sources-CXxXfh1z.mjs} +1 -1
  120. package/system/dist/{composition-sources-Do5qM6EB.js → composition-sources-DNgSItK-.js} +1 -1
  121. package/system/dist/{core-blocks.cap-CdTGUKtr.js → core-blocks.cap-BHEok4VO.js} +125 -373
  122. package/system/dist/{core-blocks.cap-DLkEfV5b.mjs → core-blocks.cap-CPgZRcpj.mjs} +109 -327
  123. package/system/dist/{device-manager.cap-DJs8izI6.js → device-manager.cap-B9qVf7ag.js} +163 -22
  124. package/system/dist/{device-manager.cap-eYrj1Ezp.mjs → device-manager.cap-CV4KGp3e.mjs} +134 -17
  125. package/system/dist/{error.cap-CU1FB6uE.mjs → error.cap-B8l7L8e4.mjs} +7 -1
  126. package/system/dist/{error.cap-BuKbL3Ac.js → error.cap-BqlvgBJd.js} +7 -1
  127. package/system/dist/file-host-worker.js +1 -1
  128. package/system/dist/file-host-worker.mjs +1 -1
  129. package/system/dist/index.js +7 -7
  130. package/system/dist/index.mjs +6 -6
  131. package/system/dist/{legacy-integration-rows-door-CdqYAj-o.js → legacy-integration-rows-door-BK8eoGlF.js} +1 -1
  132. package/system/dist/{legacy-integration-rows-door-LSgpClpX.mjs → legacy-integration-rows-door-CwzC5XNk.mjs} +1 -1
  133. package/system/dist/{migration-DGAc6ywR.mjs → migration-BvbfW9g-.mjs} +6 -0
  134. package/system/dist/{migration-BOQlFZCN.js → migration-CHPdAdNh.js} +6 -0
  135. package/system/dist/{prefix-walk-BFnw8NBu.js → named-entity-store-DFwLij9c.js} +244 -90
  136. package/system/dist/{prefix-walk-Mtij0NNT.mjs → named-entity-store-DOnyyFFf.mjs} +195 -89
  137. package/system/dist/{notification-rules.cap-BUIuYPlQ.mjs → notification-rules.cap-ClvK6QT1.mjs} +10 -5
  138. package/system/dist/{notification-rules.cap-BJKUjizS.js → notification-rules.cap-uSLoe2pA.js} +10 -5
  139. package/system/dist/{notification-targets-DMW7xgR2.js → notification-targets-ChqpBbtR.js} +2 -2
  140. package/system/dist/{notification-targets-4bGYH5J7.mjs → notification-targets-DUA6-F2t.mjs} +2 -2
  141. package/system/dist/{device-row-store-CTocYKqC.mjs → record-kinds-BD2xv4Pd.mjs} +222 -93
  142. package/system/dist/{device-row-store-C0P2H18h.js → record-kinds-BV8Gcpsx.js} +246 -93
  143. package/system/dist/records/named-entity-store.d.ts +60 -0
  144. package/system/dist/{rename-composition-block-Cdh-dRmY.mjs → rename-composition-block-C3QQ9UUE.mjs} +134 -33
  145. package/system/dist/{rename-composition-block-D9Uc1AF7.js → rename-composition-block-Cx3X8QSm.js} +134 -33
  146. package/system/dist/{retention-source.cap-C6Hy0hlM.js → retention-source.cap-A-TMhU5O.js} +1 -1
  147. package/system/dist/{retention-source.cap-550kkyp5.mjs → retention-source.cap-Ct07pM30.mjs} +1 -1
  148. package/system/dist/{storage-admin.cap-Ci4QbL6P.mjs → storage-admin.cap-C54s9_B9.mjs} +8 -2
  149. package/system/dist/{storage-admin.cap-DqW1ol4j.js → storage-admin.cap-DSPHi7ut.js} +8 -2
  150. package/system/dist/{stream-catalog.cap-CjEQFknc.js → stream-catalog.cap-7WPsugOy.js} +1 -1
  151. package/system/dist/{stream-catalog.cap-DVniDdRD.mjs → stream-catalog.cap-CzwRDaqT.mjs} +1 -1
  152. package/system/dist/{tag-BxLazvVb.js → tag-BLraBqvp.js} +12 -0
  153. package/system/dist/{tag-uZBAq6ox.mjs → tag-DU8pm9Bi.mjs} +7 -1
  154. package/system/dist/time-window-B6UhCArd.js +679 -0
  155. package/system/dist/time-window-BnUBULgu.mjs +578 -0
  156. package/system/dist/{wal-maintenance-BgYiAy5b.js → wal-maintenance-CkPfVApC.js} +0 -0
  157. package/system/dist/{wal-maintenance-Bey5ChBb.mjs → wal-maintenance-u84_1sVl.mjs} +0 -0
  158. package/system/package.json +1 -1
@@ -1,18 +1,66 @@
1
- const require_base_addon = require("./base-addon-CRsXtYFG.js");
1
+ const require_base_addon = require("./base-addon-BG7p06Hb.js");
2
2
  const require_scoped_settings = require("./scoped-settings-CylSSq_8.js");
3
3
  const require_capability_definition = require("./capability-definition-BEVd01Xj.js");
4
4
  const require_system_reasons = require("./system-reasons-Be_k1W8g.js");
5
5
  const require_quantity = require("./quantity-lY1KiTSZ.js");
6
- const require_tag = require("./tag-BxLazvVb.js");
6
+ const require_tag = require("./tag-BLraBqvp.js");
7
7
  const require_device_type = require("./device-type-Cnc0NiSX.js");
8
8
  const require_device_kind = require("./device-kind-FMhJg8uC.js");
9
- const require_action_index = require("./action-index-B_cLRwXJ.js");
10
- const require_addon_settings_cap = require("./addon-settings.cap-DrLdMFIe.js");
9
+ const require_action_index = require("./action-index-Dz9rd1qa.js");
10
+ const require_addon_settings_cap = require("./addon-settings.cap-nZVHPo3X.js");
11
11
  const require_compile = require("./compile-SpeAhaZ6.js");
12
+ const require_time_window = require("./time-window-B6UhCArd.js");
12
13
  const require_source_info = require("./source-info-DtWf4k2j.js");
13
14
  const require_l10n = require("./l10n-CGMvp7NF.js");
14
15
  const require_raw_secret_migration = require("./raw-secret-migration-DxuBFtvi.js");
15
16
  let zod = require("zod");
17
+ //#region ../types/dist/esm/automation/on-for.mjs
18
+ /**
19
+ * "On for N" — a command step that turns a device on and takes it back off
20
+ * after a while (D1086 amendment, D1092).
21
+ *
22
+ * A `command` step carries `onFor: { seconds }`. The step does not wait: it
23
+ * hands the device to {@link OnForHolds}, which lives in the block OUTSIDE any
24
+ * run, so the run mode, a restart of the run and the end of the run do not
25
+ * touch the timer.
26
+ *
27
+ * The rules:
28
+ * - the device is read at the event. Off: it is turned on and a hold is
29
+ * taken. On, with no hold: nothing is sent and nothing is taken — what was
30
+ * on before stays on after;
31
+ * - a new event while a hold runs moves its deadline (and turns the device
32
+ * back on if it went off meanwhile);
33
+ * - at the deadline the device is turned off, only because the hold is ours;
34
+ * - a report that the device went off ends the hold: the operator switched it;
35
+ * - a state that cannot be read changes nothing (D49).
36
+ *
37
+ * The holds are persisted through `persist` (the hub's runs ledger row of the
38
+ * block) with their deadline — BEFORE the device is turned on, and rolled back
39
+ * when the send fails — and given back to {@link OnForHolds.restore} when
40
+ * the block starts: a deadline that passed while the block was down is honoured
41
+ * at once.
42
+ */
43
+ /** The longest a device is held on: one day. */
44
+ var ON_FOR_MAX_SECONDS = 86400;
45
+ var OnForSpecSchema = /* @__PURE__ */ zod.z.object({ seconds: /* @__PURE__ */ zod.z.number().int().min(1).max(ON_FOR_MAX_SECONDS) });
46
+ /** One device this block turned on and owes an off. */
47
+ var OnForHoldSchema = /* @__PURE__ */ zod.z.object({
48
+ deviceId: /* @__PURE__ */ zod.z.number().int().nonnegative(),
49
+ cap: /* @__PURE__ */ zod.z.string().min(1),
50
+ /** When the device is turned off (ms epoch). */
51
+ deadline: /* @__PURE__ */ zod.z.number()
52
+ });
53
+ var OnForHoldsSchema = /* @__PURE__ */ zod.z.array(OnForHoldSchema).max(64);
54
+ var ON_FOR_ACTIONS = { "switch.on": {
55
+ cap: "switch",
56
+ fieldPath: "on",
57
+ offActionId: "switch.off"
58
+ } };
59
+ /** The way back of an `on` action, or null when the action cannot be held. */
60
+ function onForActionOf(actionId) {
61
+ return ON_FOR_ACTIONS[actionId] ?? null;
62
+ }
63
+ //#endregion
16
64
  //#region ../types/dist/esm/automation/action-target.mjs
17
65
  /**
18
66
  * WHO an action step acts on (D983) — one target shape for every place that
@@ -247,293 +295,6 @@ var ExpressionBindingSourceSchema = /* @__PURE__ */ zod.z.union([
247
295
  ExpressionGlobalBindingSchema
248
296
  ]);
249
297
  //#endregion
250
- //#region ../types/dist/esm/time/solar.mjs
251
- /**
252
- * Where the sun is, from a latitude and a longitude — the one solar
253
- * calculation in the repo. Compact NOAA sunrise equation (accurate to about a
254
- * minute away from the poles), so no astronomy dependency is needed.
255
- *
256
- * Two consumers read it: the scene-condition resolver (day / night / dawn /
257
- * dusk of a camera) and a schedule's sun time (`time-spec.ts`).
258
- */
259
- var DEG = Math.PI / 180;
260
- /** The sun's upper limb on the horizon, refraction included: sunrise and sunset. */
261
- var SUNRISE_ALTITUDE_DEG = -.833;
262
- /** Julian day number for a JS Date (UTC). */
263
- function toJulian(date) {
264
- return date.getTime() / 864e5 + 2440587.5;
265
- }
266
- /** Julian day → epoch ms (UTC). */
267
- function fromJulian(j) {
268
- return (j - 2440587.5) * 864e5;
269
- }
270
- /**
271
- * When the sun crosses `altitudeDeg` on the day `date` falls in at this place.
272
- * Pass an instant near local midday of the civil day you mean: the day is
273
- * chosen from the instant, and midday is the one that never straddles two.
274
- *
275
- * `null` when the sun never crosses that altitude that day (polar day or polar
276
- * night, or — for a twilight altitude — a summer night that never gets dark
277
- * enough). The caller decides what that means; nothing here guesses.
278
- */
279
- function sunCrossings(lat, lng, date, altitudeDeg) {
280
- const jDate = toJulian(date);
281
- const jStar = Math.round(jDate - 2451545 + 8e-4) - lng / 360;
282
- const m = (357.5291 + .98560028 * jStar) % 360;
283
- const mRad = m * DEG;
284
- const lambda = (m + (1.9148 * Math.sin(mRad) + .02 * Math.sin(2 * mRad) + 3e-4 * Math.sin(3 * mRad)) + 180 + 102.9372) % 360 * DEG;
285
- const jTransit = 2451545 + jStar + .0053 * Math.sin(mRad) - .0069 * Math.sin(2 * lambda);
286
- const declination = Math.asin(Math.sin(lambda) * Math.sin(23.44 * DEG));
287
- const latRad = lat * DEG;
288
- const cosOmega = (Math.sin(altitudeDeg * DEG) - Math.sin(latRad) * Math.sin(declination)) / (Math.cos(latRad) * Math.cos(declination));
289
- if (cosOmega > 1 || cosOmega < -1) return null;
290
- const omega = Math.acos(cosOmega) / DEG;
291
- return {
292
- rise: fromJulian(jTransit - omega / 360),
293
- set: fromJulian(jTransit + omega / 360)
294
- };
295
- }
296
- //#endregion
297
- //#region ../types/dist/esm/time/time-spec.mjs
298
- /**
299
- * WHEN something happens, as data (D983) — the one time vocabulary of the
300
- * scheduler and of an automation's schedule leaf. Three shapes, no cron:
301
- *
302
- * - `clock` — a wall-clock time every day (`07:30`), read in the site's zone;
303
- * - `sun` — a sun event (`sunrise`, `sunset`, `dawn`, `dusk`) plus or minus
304
- * up to twelve hours, from the site's coordinates;
305
- * - `date` — one local date and time (`2026-12-24T18:00`), once.
306
- *
307
- * A site is a place and its IANA zone ({@link TimeSite}). Every function here
308
- * is pure: the zone arithmetic uses `Intl`, no date library.
309
- *
310
- * Wall-clock honesty across a DST change: a local time that does not exist
311
- * (02:30 on the spring-forward day) happens at the first minute that does
312
- * (03:00); one that happens twice (02:30 on the fall-back day) happens at its
313
- * FIRST occurrence.
314
- */
315
- var SunEventSchema = /* @__PURE__ */ zod.z.enum([
316
- "sunrise",
317
- "sunset",
318
- "dawn",
319
- "dusk"
320
- ]);
321
- var LOCAL_DATE = /^\d{4}-\d{2}-\d{2}$/;
322
- var LOCAL_DATE_TIME = /^(\d{4}-\d{2}-\d{2})T([01]\d|2[0-3]):([0-5]\d)$/;
323
- var TimeSpecSchema = /* @__PURE__ */ zod.z.discriminatedUnion("kind", [
324
- /* @__PURE__ */ zod.z.object({
325
- kind: /* @__PURE__ */ zod.z.literal("clock"),
326
- hh: /* @__PURE__ */ zod.z.number().int().min(0).max(23),
327
- mm: /* @__PURE__ */ zod.z.number().int().min(0).max(59)
328
- }),
329
- /* @__PURE__ */ zod.z.object({
330
- kind: /* @__PURE__ */ zod.z.literal("sun"),
331
- event: SunEventSchema,
332
- /** Minutes after the event (negative: before). */
333
- offsetMin: /* @__PURE__ */ zod.z.number().int().min(-720).max(720)
334
- }),
335
- /* @__PURE__ */ zod.z.object({
336
- kind: /* @__PURE__ */ zod.z.literal("date"),
337
- /** `YYYY-MM-DDTHH:mm`, site-local. */
338
- local: /* @__PURE__ */ zod.z.string().regex(LOCAL_DATE_TIME, "expected YYYY-MM-DDTHH:mm")
339
- })
340
- ]);
341
- /** A day of the week as a schedule names it. */
342
- var WeekdayKeySchema = /* @__PURE__ */ zod.z.enum([
343
- "mon",
344
- "tue",
345
- "wed",
346
- "thu",
347
- "fri",
348
- "sat",
349
- "sun"
350
- ]);
351
- var WEEKDAY_BY_INDEX = [
352
- "sun",
353
- "mon",
354
- "tue",
355
- "wed",
356
- "thu",
357
- "fri",
358
- "sat"
359
- ];
360
- var MINUTE_MS = 6e4;
361
- var DAY_MS = 864e5;
362
- var formatters = /* @__PURE__ */ new Map();
363
- function formatterFor(timeZone) {
364
- const cached = formatters.get(timeZone);
365
- if (cached !== void 0) return cached;
366
- const created = new Intl.DateTimeFormat("en-US", {
367
- timeZone,
368
- hourCycle: "h23",
369
- year: "numeric",
370
- month: "2-digit",
371
- day: "2-digit",
372
- hour: "2-digit",
373
- minute: "2-digit",
374
- second: "2-digit"
375
- });
376
- formatters.set(timeZone, created);
377
- return created;
378
- }
379
- function wallClockOf(epochMs, timeZone) {
380
- const out = {};
381
- for (const part of formatterFor(timeZone).formatToParts(new Date(epochMs))) if (part.type !== "literal") out[part.type] = Number(part.value);
382
- return {
383
- year: out["year"] ?? 0,
384
- month: out["month"] ?? 0,
385
- day: out["day"] ?? 0,
386
- hour: out["hour"] ?? 0,
387
- minute: out["minute"] ?? 0,
388
- second: out["second"] ?? 0
389
- };
390
- }
391
- /** The zone's offset from UTC at an instant, in ms (positive east of Greenwich). */
392
- function offsetMs(epochMs, timeZone) {
393
- const w = wallClockOf(epochMs, timeZone);
394
- return Date.UTC(w.year, w.month - 1, w.day, w.hour, w.minute, w.second) - Math.floor(epochMs / 1e3) * 1e3;
395
- }
396
- /** Is `timeZone` a zone this runtime knows? */
397
- function isKnownTimeZone(timeZone) {
398
- try {
399
- formatterFor(timeZone);
400
- return true;
401
- } catch {
402
- return false;
403
- }
404
- }
405
- /** `YYYY-MM-DD` of an instant, read in the zone. */
406
- function localDateOf(epochMs, timeZone) {
407
- const w = wallClockOf(epochMs, timeZone);
408
- return `${String(w.year).padStart(4, "0")}-${String(w.month).padStart(2, "0")}-${String(w.day).padStart(2, "0")}`;
409
- }
410
- function parseLocalDate(localDate) {
411
- if (!LOCAL_DATE.test(localDate)) throw new Error(`not a local date (YYYY-MM-DD): ${localDate}`);
412
- const [y, m, d] = localDate.split("-").map(Number);
413
- return {
414
- y: y ?? 0,
415
- m: m ?? 1,
416
- d: d ?? 1
417
- };
418
- }
419
- /** The weekday of a `YYYY-MM-DD` civil date (zone-independent). */
420
- function weekdayOfLocalDate(localDate) {
421
- const { y, m, d } = parseLocalDate(localDate);
422
- return WEEKDAY_BY_INDEX[new Date(Date.UTC(y, m - 1, d)).getUTCDay()] ?? "sun";
423
- }
424
- function addDays(localDate, days) {
425
- const { y, m, d } = parseLocalDate(localDate);
426
- return new Date(Date.UTC(y, m - 1, d + days)).toISOString().slice(0, 10);
427
- }
428
- /**
429
- * The instant a wall-clock time happens in a zone. A time that does not exist
430
- * happens at the first minute that does; one that happens twice, at its first
431
- * occurrence.
432
- */
433
- function wallToEpoch(localDate, hh, mm, timeZone) {
434
- const { y, m, d } = parseLocalDate(localDate);
435
- const wall = Date.UTC(y, m - 1, d, hh, mm);
436
- const before = offsetMs(wall - DAY_MS, timeZone);
437
- const after = offsetMs(wall + DAY_MS, timeZone);
438
- const valid = [wall - before, wall - after].filter((c) => c + offsetMs(c, timeZone) === wall);
439
- if (valid.length > 0) return Math.min(...valid);
440
- let lo = wall - DAY_MS;
441
- let hi = wall + DAY_MS;
442
- while (hi - lo > MINUTE_MS) {
443
- const mid = Math.floor((lo + hi) / 2 / MINUTE_MS) * MINUTE_MS;
444
- if (offsetMs(mid, timeZone) === before) lo = mid;
445
- else hi = mid;
446
- }
447
- return hi;
448
- }
449
- function sunEventAltitude(event) {
450
- return event === "sunrise" || event === "sunset" ? SUNRISE_ALTITUDE_DEG : -6;
451
- }
452
- /**
453
- * The moment `spec` happens on the site-local date `localDate` (`YYYY-MM-DD`).
454
- * See {@link Occurrence} for what `null` means.
455
- */
456
- function occurrenceOn(spec, localDate, site) {
457
- switch (spec.kind) {
458
- case "clock": return wallToEpoch(localDate, spec.hh, spec.mm, site.timeZone);
459
- case "date": {
460
- const match = LOCAL_DATE_TIME.exec(spec.local);
461
- if (match === null || match[1] !== localDate) return null;
462
- return wallToEpoch(localDate, Number(match[2]), Number(match[3]), site.timeZone);
463
- }
464
- case "sun": {
465
- const midday = new Date(wallToEpoch(localDate, 12, 0, site.timeZone));
466
- const crossings = sunCrossings(site.lat, site.lon, midday, sunEventAltitude(spec.event));
467
- if (crossings === null) return null;
468
- return (spec.event === "sunrise" || spec.event === "dawn" ? crossings.rise : crossings.set) + spec.offsetMin * MINUTE_MS;
469
- }
470
- }
471
- }
472
- /**
473
- * The first moment strictly after `afterMs` at which `spec` happens, or `null`
474
- * when none does within {@link NEXT_OCCURRENCE_HORIZON_DAYS} (a `date` spec in
475
- * the past, a sun event that never happens, an empty `days` list).
476
- */
477
- function nextOccurrence(spec, afterMs, site, options = {}) {
478
- const days = options.days;
479
- if (days !== void 0 && days.length === 0) return null;
480
- if (spec.kind === "date") {
481
- const own = LOCAL_DATE_TIME.exec(spec.local)?.[1];
482
- if (own === void 0 || days !== void 0 && !days.includes(weekdayOfLocalDate(own))) return null;
483
- const at = occurrenceOn(spec, own, site);
484
- return at !== null && at > afterMs ? at : null;
485
- }
486
- const first = addDays(localDateOf(afterMs, site.timeZone), -1);
487
- for (let i = 0; i < 400; i += 1) {
488
- const localDate = addDays(first, i);
489
- if (days !== void 0 && !days.includes(weekdayOfLocalDate(localDate))) continue;
490
- const at = occurrenceOn(spec, localDate, site);
491
- if (at !== null && at > afterMs) return at;
492
- }
493
- return null;
494
- }
495
- /**
496
- * Can `spec` be scheduled at this site? A sun spec without a location is
497
- * REFUSED with its reason — never read as a guessed sunrise. A clock or date
498
- * spec needs only a zone, and `site` is `null` in that case when there is no
499
- * location (it is not needed to place them; use {@link siteFor} to read them).
500
- */
501
- function validateTimeSpecForSite(spec, reading) {
502
- if (!isKnownTimeZone(reading.timeZone)) return {
503
- ok: false,
504
- reason: "unknown-time-zone",
505
- message: `the site time zone "${reading.timeZone}" is not a known IANA zone`
506
- };
507
- const site = siteFor(reading);
508
- if (spec.kind === "sun" && site === null) return {
509
- ok: false,
510
- reason: "sun-needs-site-location",
511
- message: `a ${spec.event} time needs the site location, and none is set — set it in Settings, or use a clock time`
512
- };
513
- return {
514
- ok: true,
515
- site
516
- };
517
- }
518
- /** The site, when it has a location; a clock spec on a site without one uses {@link zoneOnlySite}. */
519
- function siteFor(reading) {
520
- if (reading.location === null) return null;
521
- return {
522
- lat: reading.location.latitude,
523
- lon: reading.location.longitude,
524
- timeZone: reading.timeZone
525
- };
526
- }
527
- /** A site that can place a clock or date spec but no sun event (coordinates are unused by those). */
528
- function zoneOnlySite(timeZone) {
529
- return {
530
- lat: 0,
531
- lon: 0,
532
- timeZone,
533
- zoneOnly: true
534
- };
535
- }
536
- //#endregion
537
298
  //#region ../types/dist/esm/device/schema-fields.mjs
538
299
  /** Unwrap ZodNullable / ZodOptional / ZodDefault wrappers to reach the inner type.
539
300
  * Zod v4 exposes `.unwrap()` on all three wrapper classes. */
@@ -1186,8 +947,8 @@ var DeviceEventLeafSchema = /* @__PURE__ */ zod.z.object({
1186
947
  var ScheduleLeafSchema = /* @__PURE__ */ zod.z.object({
1187
948
  kind: /* @__PURE__ */ zod.z.literal("schedule"),
1188
949
  ...eventLeafId,
1189
- at: /* @__PURE__ */ TimeSpecSchema.optional(),
1190
- days: /* @__PURE__ */ zod.z.array(WeekdayKeySchema).min(1).max(7).optional(),
950
+ at: /* @__PURE__ */ require_time_window.TimeSpecSchema.optional(),
951
+ days: /* @__PURE__ */ zod.z.array(require_time_window.WeekdayKeySchema).min(1).max(7).optional(),
1191
952
  /** @deprecated legacy cron — new schedules use `at`. */
1192
953
  cron: /* @__PURE__ */ zod.z.string().min(1).max(120).optional()
1193
954
  }).refine((leaf) => leaf.at === void 0 !== (leaf.cron === void 0), { message: "a schedule names exactly one of `at` (a time spec) and `cron` (legacy)" }).refine((leaf) => leaf.days === void 0 || leaf.at !== void 0, { message: "`days` goes with `at`; a cron expression carries its own days" });
@@ -1292,39 +1053,19 @@ var StationaryPresentLeafSchema = /* @__PURE__ */ zod.z.object({
1292
1053
  minCount: /* @__PURE__ */ zod.z.number().int().positive().optional()
1293
1054
  });
1294
1055
  /**
1056
+ * What a `time-is` leaf holds beside its kind: the one window model of
1057
+ * `time/time-window.ts`. A template's time-window input stores exactly this.
1058
+ */
1059
+ var TimeIsWindowSchema = require_time_window.TimeWindowSchema;
1060
+ /**
1295
1061
  * True while the site-local clock is inside a daily window and/or on one of
1296
1062
  * the named days. `days` names the local day a window STARTS on, so
1297
1063
  * 22:00-06:00 on weekdays is still inside at 01:00 Saturday. A one-date spec
1298
1064
  * (`kind: 'date'`) is refused: only a clock time or a sun event makes a window
1299
1065
  * that repeats every day.
1066
+ * A `preset` (day or night) stands for a sun window and takes the place of `between`.
1300
1067
  */
1301
- var timeIsWindowShape = {
1302
- between: /* @__PURE__ */ zod.z.object({
1303
- from: TimeSpecSchema,
1304
- to: TimeSpecSchema
1305
- }).optional(),
1306
- days: /* @__PURE__ */ zod.z.array(WeekdayKeySchema).min(1).max(7).optional()
1307
- };
1308
- function timeIsWindowProblems(window, ctx) {
1309
- if (window.between === void 0 && window.days === void 0) ctx.addIssue({
1310
- code: "custom",
1311
- message: "a time-is leaf needs a between window, days, or both"
1312
- });
1313
- for (const end of ["from", "to"]) if (window.between?.[end].kind === "date") ctx.addIssue({
1314
- code: "custom",
1315
- message: "a one-date time cannot bound a daily window: use a clock time or a sun event",
1316
- path: ["between", end]
1317
- });
1318
- }
1319
- /**
1320
- * What a `time-is` leaf holds beside its kind, judged by the leaf's own rules.
1321
- * A template's time-window input stores exactly this.
1322
- */
1323
- var TimeIsWindowSchema = /* @__PURE__ */ (/* @__PURE__ */ zod.z.object(timeIsWindowShape)).superRefine(timeIsWindowProblems);
1324
- var TimeIsLeafSchema = /* @__PURE__ */ zod.z.object({
1325
- kind: /* @__PURE__ */ zod.z.literal("time-is"),
1326
- ...timeIsWindowShape
1327
- }).superRefine(timeIsWindowProblems);
1068
+ var TimeIsLeafSchema = /* @__PURE__ */ require_time_window.TimeWindowObjectSchema.extend({ kind: /* @__PURE__ */ zod.z.literal("time-is") }).superRefine(require_time_window.refineTimeWindow);
1328
1069
  /**
1329
1070
  * True for the run that one of the named event leaves started. It reads the
1330
1071
  * run, not a device: in the tree it is judged against the leaf that fired, in
@@ -1585,6 +1326,11 @@ var TemplateActionValueSchema = /* @__PURE__ */ zod.z.object({
1585
1326
  */
1586
1327
  var TemplateTimeWindowValueSchema = TimeIsWindowSchema;
1587
1328
  /**
1329
+ * A `device-state` input's value: what a `device-is` leaf holds beside its kind (one device field
1330
+ * compared to a value, now, optionally held). "No limit" is the input left without a value.
1331
+ */
1332
+ var TemplateDeviceStateValueSchema = /* @__PURE__ */ DeviceIsLeafSchema.omit({ kind: true });
1333
+ /**
1588
1334
  * An `entries` input's value: automation elements VERBATIM — event leaves of a
1589
1335
  * `when` tree, or steps of a branch. Judged with the automation's own schemas
1590
1336
  * (`valueProblem` in the template engine), so there is no second shape here.
@@ -1599,6 +1345,7 @@ var TemplateScalarValueSchema = /* @__PURE__ */ zod.z.union([
1599
1345
  /* @__PURE__ */ zod.z.array(/* @__PURE__ */ zod.z.number().int().nonnegative()),
1600
1346
  TemplateEventValueSchema,
1601
1347
  TemplateActionValueSchema,
1348
+ TemplateDeviceStateValueSchema,
1602
1349
  TemplateTimeWindowValueSchema,
1603
1350
  TemplateEntriesValueSchema
1604
1351
  ]);
@@ -1886,7 +1633,13 @@ var AutomationCommandStepBaseSchema = /* @__PURE__ */ zod.z.object({
1886
1633
  * value in the unit the method's input DECLARES (`paramMeta`); on a write an
1887
1634
  * arg may be a {@link QuantityValue}, which the save boundary converts.
1888
1635
  */
1889
- argUnits: /* @__PURE__ */ zod.z.record(/* @__PURE__ */ zod.z.string(), /* @__PURE__ */ zod.z.string().min(1)).optional()
1636
+ argUnits: /* @__PURE__ */ zod.z.record(/* @__PURE__ */ zod.z.string(), /* @__PURE__ */ zod.z.string().min(1)).optional(),
1637
+ /**
1638
+ * "On for N": the device is turned on only if it is off, and taken back off
1639
+ * after `seconds`; a new run restarts the time (`on-for.ts`). The step does
1640
+ * not wait. Only an action `on-for.ts` knows how to undo carries it.
1641
+ */
1642
+ onFor: /* @__PURE__ */ OnForSpecSchema.optional()
1890
1643
  });
1891
1644
  /** The vocabulary check every command step passes: the action exists. */
1892
1645
  function refineKnownAction(step, ctx) {
@@ -1895,6 +1648,11 @@ function refineKnownAction(step, ctx) {
1895
1648
  message: `"${step.actionId}" is not a vocabulary action id`,
1896
1649
  path: ["actionId"]
1897
1650
  });
1651
+ if (step.onFor !== void 0 && onForActionOf(step.actionId) === null) ctx.addIssue({
1652
+ code: "custom",
1653
+ message: `"${step.actionId}" cannot be held on for a time: only a turn-on action can`,
1654
+ path: ["onFor"]
1655
+ });
1898
1656
  }
1899
1657
  var AutomationCommandStepSchema = /* @__PURE__ */ AutomationCommandStepBaseSchema.superRefine(refineKnownAction);
1900
1658
  /**
@@ -1928,7 +1686,14 @@ var GuardedCommandStepSchema = /* @__PURE__ */ AutomationCommandStepBaseSchema.e
1928
1686
  * no place to nest a block, so it is not offered the rest of an Action's steps.
1929
1687
  * It is a subset of {@link ActionStep}: a runner built for the wide step runs it.
1930
1688
  */
1689
+ /** Why "on for a time" is refused outside an automation: the off has to outlive the run that turned it on. */
1690
+ var ON_FOR_NEEDS_AUTOMATION = "\"on for a time\" is kept by an automation, which turns the device off later — a list that runs once has nothing left to do that";
1931
1691
  var NarrowActionStepSchema = /* @__PURE__ */ zod.z.discriminatedUnion("kind", [GuardedWaitStepSchema, GuardedCommandStepSchema]).superRefine((step, ctx) => {
1692
+ if (step.kind === "command" && step.onFor !== void 0) ctx.addIssue({
1693
+ code: "custom",
1694
+ message: ON_FOR_NEEDS_AUTOMATION,
1695
+ path: ["onFor"]
1696
+ });
1932
1697
  if (step.if !== void 0 && hasTriggeredByLeaves(step.if)) ctx.addIssue({
1933
1698
  code: "custom",
1934
1699
  message: TRIGGERED_BY_NEEDS_AUTOMATION,
@@ -2249,6 +2014,11 @@ var AutomationActionSchema = /* @__PURE__ */ zod.z.discriminatedUnion("kind", [
2249
2014
  })
2250
2015
  ]);
2251
2016
  var ActionStepSchema = /* @__PURE__ */ AutomationActionSchema.refine((step) => step.kind !== "code", { message: "an action is interpreted, so it has no code step: a code step is bundled into the block of an automation" }).superRefine((step, ctx) => {
2017
+ if ([step, ...nestedStepsOf(step)].some((s) => s.kind === "command" && s.onFor !== void 0)) ctx.addIssue({
2018
+ code: "custom",
2019
+ message: ON_FOR_NEEDS_AUTOMATION,
2020
+ path: ["onFor"]
2021
+ });
2252
2022
  for (const condition of stepConditionsOf(step)) if (hasTriggeredByLeaves(condition.when)) ctx.addIssue({
2253
2023
  code: "custom",
2254
2024
  message: TRIGGERED_BY_NEEDS_AUTOMATION,
@@ -2392,9 +2162,11 @@ var WINDOW_ENDS = ["from", "to"];
2392
2162
  function whenSiteIssues(when, reading, rootPath = "when") {
2393
2163
  const issues = [];
2394
2164
  forEachLeaf(when, (leaf, path) => {
2395
- if (leaf.kind !== "time-is" || leaf.between === void 0) return;
2165
+ if (leaf.kind !== "time-is") return;
2166
+ const between = require_time_window.expandTimeWindowPreset(leaf).between;
2167
+ if (between === void 0) return;
2396
2168
  for (const end of WINDOW_ENDS) {
2397
- const checked = validateTimeSpecForSite(leaf.between[end], reading);
2169
+ const checked = require_time_window.validateTimeSpecForSite(between[end], reading);
2398
2170
  if (!checked.ok) issues.push({
2399
2171
  path: `${path}.between.${end}`,
2400
2172
  reason: checked.reason,
@@ -2447,7 +2219,7 @@ var SchedulerStateTreeSchema = /* @__PURE__ */ AutomationWhenSchema.superRefine(
2447
2219
  });
2448
2220
  });
2449
2221
  /** A point's moment: a clock time or a sun event. A one-shot date is not a position on a day. */
2450
- var SchedulerTimeSpecSchema = /* @__PURE__ */ TimeSpecSchema.refine((spec) => spec.kind !== "date", { message: "a scheduler point is a clock time or a sun event — a one-shot date has no place on a timeline" });
2222
+ var SchedulerTimeSpecSchema = /* @__PURE__ */ require_time_window.TimeSpecSchema.refine((spec) => spec.kind !== "date", { message: "a scheduler point is a clock time or a sun event — a one-shot date has no place on a timeline" });
2451
2223
  var SchedulerPointModeSchema = /* @__PURE__ */ zod.z.enum([
2452
2224
  "edge",
2453
2225
  "hold",
@@ -2484,7 +2256,7 @@ var SchedulerProfileSchema = /* @__PURE__ */ zod.z.object({
2484
2256
  name: /* @__PURE__ */ zod.z.string().min(1).max(120),
2485
2257
  enabled: /* @__PURE__ */ zod.z.boolean().default(true),
2486
2258
  activeWhen: /* @__PURE__ */ SchedulerStateTreeSchema.optional(),
2487
- days: /* @__PURE__ */ zod.z.array(WeekdayKeySchema).min(1).max(7),
2259
+ days: /* @__PURE__ */ zod.z.array(require_time_window.WeekdayKeySchema).min(1).max(7),
2488
2260
  points: /* @__PURE__ */ zod.z.array(SchedulerPointSchema).max(50)
2489
2261
  });
2490
2262
  /** What an operator writes. */
@@ -2497,7 +2269,9 @@ var SchedulerInputSchema = /* @__PURE__ */ zod.z.object({
2497
2269
  maxLateMs: /* @__PURE__ */ zod.z.number().int().min(1e3).max(24 * 36e5).default(DEFAULT_MAX_LATE_MS),
2498
2270
  profiles: /* @__PURE__ */ zod.z.array(SchedulerProfileSchema).max(20),
2499
2271
  /** Operator tags (D1054). Absent = no tags. */
2500
- tags: /* @__PURE__ */ require_tag.TagsFieldSchema.optional()
2272
+ tags: /* @__PURE__ */ require_tag.TagsFieldSchema.optional(),
2273
+ /** The tag ids (D1089); `tags` is kept beside them for one release. */
2274
+ tagIds: /* @__PURE__ */ require_tag.TagIdsFieldSchema.optional()
2501
2275
  });
2502
2276
  var SchedulerSchema = /* @__PURE__ */ SchedulerInputSchema.extend({
2503
2277
  id: /* @__PURE__ */ zod.z.string().min(1),
@@ -2551,7 +2325,7 @@ function validateSchedulerInput(input, reading) {
2551
2325
  message: `point id "${point.id}" is used twice`
2552
2326
  });
2553
2327
  ids.add(point.id);
2554
- const timing = validateTimeSpecForSite(point.at, reading);
2328
+ const timing = require_time_window.validateTimeSpecForSite(point.at, reading);
2555
2329
  if (!timing.ok) issues.push({
2556
2330
  path: `${base}.at`,
2557
2331
  message: timing.message
@@ -2918,7 +2692,9 @@ var AutomationRunTraceSchema = /* @__PURE__ */ zod.z.object({
2918
2692
  var AutomationStateDocSchema = /* @__PURE__ */ zod.z.object({
2919
2693
  version: /* @__PURE__ */ zod.z.literal(1),
2920
2694
  lastRunStartedAt: /* @__PURE__ */ zod.z.number().nullable(),
2921
- traces: /* @__PURE__ */ zod.z.array(AutomationRunTraceSchema)
2695
+ traces: /* @__PURE__ */ zod.z.array(AutomationRunTraceSchema),
2696
+ /** The devices the block turned on and still owes an off (`on-for.ts`). Absent = none. */
2697
+ onForHolds: /* @__PURE__ */ OnForHoldsSchema.optional()
2922
2698
  });
2923
2699
  /** The state of an owner that never reported. */
2924
2700
  var EMPTY_AUTOMATION_STATE = {
@@ -7988,7 +7764,9 @@ var CoreBlockInputFieldsSchema = /* @__PURE__ */ zod.z.object({
7988
7764
  */
7989
7765
  settingsSchema: /* @__PURE__ */ CoreBlockSettingsSchemaBridge.optional(),
7990
7766
  /** Operator tags (D1054), kept on the record. Absent = no tags. */
7991
- tags: /* @__PURE__ */ require_tag.TagsFieldSchema.optional()
7767
+ tags: /* @__PURE__ */ require_tag.TagsFieldSchema.optional(),
7768
+ /** The tag ids (D1089); `tags` is kept beside them for one release. */
7769
+ tagIds: /* @__PURE__ */ require_tag.TagIdsFieldSchema.optional()
7992
7770
  });
7993
7771
  /** Client-authored fields for create — requires `code` or `files[entry]`. */
7994
7772
  var CoreBlockInputSchema = /* @__PURE__ */ CoreBlockInputFieldsSchema.superRefine((val, ctx) => {
@@ -8088,6 +7866,8 @@ var CoreBlockSchema = /* @__PURE__ */ zod.z.object({
8088
7866
  settingsSchema: /* @__PURE__ */ CoreBlockSettingsSchemaBridge.optional(),
8089
7867
  /** Operator tags (D1054). Absent = no tags. */
8090
7868
  tags: /* @__PURE__ */ require_tag.TagsFieldSchema.optional(),
7869
+ /** The tag ids (D1089); `tags` is kept beside them for one release. */
7870
+ tagIds: /* @__PURE__ */ require_tag.TagIdsFieldSchema.optional(),
8091
7871
  id: /* @__PURE__ */ zod.z.string(),
8092
7872
  createdAt: /* @__PURE__ */ zod.z.number(),
8093
7873
  updatedAt: /* @__PURE__ */ zod.z.number(),
@@ -8417,13 +8197,15 @@ var coreBlocksCapability = {
8417
8197
  * An automation block reports one run (or one coalesced skip) to the hub's
8418
8198
  * `runs` ledger. Only the block itself may: the transport stamps
8419
8199
  * `callerAddonId`, and anything but `core-block-<blockId>` is refused.
8420
- * `keepTraces` bounds the ring; `runStartedAt` moves the cooldown stamp.
8200
+ * `keepTraces` bounds the ring; `runStartedAt` moves the cooldown stamp;
8201
+ * `onForHolds` replaces the devices the block holds on (`on-for.ts`).
8421
8202
  */
8422
8203
  reportAutomationRun: /* @__PURE__ */ require_capability_definition.method(/* @__PURE__ */ zod.z.object({
8423
8204
  blockId: /* @__PURE__ */ zod.z.string().min(1),
8424
8205
  trace: /* @__PURE__ */ AutomationRunTraceSchema.optional(),
8425
8206
  runStartedAt: /* @__PURE__ */ zod.z.number().optional(),
8426
- keepTraces: /* @__PURE__ */ zod.z.number().int().min(1).max(100).optional()
8207
+ keepTraces: /* @__PURE__ */ zod.z.number().int().min(1).max(100).optional(),
8208
+ onForHolds: /* @__PURE__ */ OnForHoldsSchema.optional()
8427
8209
  }), /* @__PURE__ */ zod.z.void(), {
8428
8210
  kind: "mutation",
8429
8211
  auth: "admin"
@@ -8607,6 +8389,12 @@ Object.defineProperty(exports, "MediaPlayerStatusSchema", {
8607
8389
  return MediaPlayerStatusSchema;
8608
8390
  }
8609
8391
  });
8392
+ Object.defineProperty(exports, "ON_FOR_MAX_SECONDS", {
8393
+ enumerable: true,
8394
+ get: function() {
8395
+ return ON_FOR_MAX_SECONDS;
8396
+ }
8397
+ });
8610
8398
  Object.defineProperty(exports, "PowerSourceInfoSchema", {
8611
8399
  enumerable: true,
8612
8400
  get: function() {
@@ -8691,6 +8479,12 @@ Object.defineProperty(exports, "TemplateActionValueSchema", {
8691
8479
  return TemplateActionValueSchema;
8692
8480
  }
8693
8481
  });
8482
+ Object.defineProperty(exports, "TemplateDeviceStateValueSchema", {
8483
+ enumerable: true,
8484
+ get: function() {
8485
+ return TemplateDeviceStateValueSchema;
8486
+ }
8487
+ });
8694
8488
  Object.defineProperty(exports, "TemplateEntriesValueSchema", {
8695
8489
  enumerable: true,
8696
8490
  get: function() {
@@ -8925,12 +8719,6 @@ Object.defineProperty(exports, "isEventLeaf", {
8925
8719
  return isEventLeaf;
8926
8720
  }
8927
8721
  });
8928
- Object.defineProperty(exports, "isKnownTimeZone", {
8929
- enumerable: true,
8930
- get: function() {
8931
- return isKnownTimeZone;
8932
- }
8933
- });
8934
8722
  Object.defineProperty(exports, "isQuantityValue", {
8935
8723
  enumerable: true,
8936
8724
  get: function() {
@@ -8955,12 +8743,6 @@ Object.defineProperty(exports, "isRemoteWidgetRole", {
8955
8743
  return isRemoteWidgetRole;
8956
8744
  }
8957
8745
  });
8958
- Object.defineProperty(exports, "localDateOf", {
8959
- enumerable: true,
8960
- get: function() {
8961
- return localDateOf;
8962
- }
8963
- });
8964
8746
  Object.defineProperty(exports, "mediaPlayerCapability", {
8965
8747
  enumerable: true,
8966
8748
  get: function() {
@@ -8973,24 +8755,12 @@ Object.defineProperty(exports, "nestedStepsOf", {
8973
8755
  return nestedStepsOf;
8974
8756
  }
8975
8757
  });
8976
- Object.defineProperty(exports, "nextOccurrence", {
8977
- enumerable: true,
8978
- get: function() {
8979
- return nextOccurrence;
8980
- }
8981
- });
8982
8758
  Object.defineProperty(exports, "normalizeCoreBlockWrite", {
8983
8759
  enumerable: true,
8984
8760
  get: function() {
8985
8761
  return normalizeCoreBlockWrite;
8986
8762
  }
8987
8763
  });
8988
- Object.defineProperty(exports, "occurrenceOn", {
8989
- enumerable: true,
8990
- get: function() {
8991
- return occurrenceOn;
8992
- }
8993
- });
8994
8764
  Object.defineProperty(exports, "paramMeta", {
8995
8765
  enumerable: true,
8996
8766
  get: function() {
@@ -9069,12 +8839,6 @@ Object.defineProperty(exports, "resolveRemoteSource", {
9069
8839
  return resolveRemoteSource;
9070
8840
  }
9071
8841
  });
9072
- Object.defineProperty(exports, "siteFor", {
9073
- enumerable: true,
9074
- get: function() {
9075
- return siteFor;
9076
- }
9077
- });
9078
8842
  Object.defineProperty(exports, "stepConditionsOf", {
9079
8843
  enumerable: true,
9080
8844
  get: function() {
@@ -9123,15 +8887,3 @@ Object.defineProperty(exports, "validateSchedulerInput", {
9123
8887
  return validateSchedulerInput;
9124
8888
  }
9125
8889
  });
9126
- Object.defineProperty(exports, "weekdayOfLocalDate", {
9127
- enumerable: true,
9128
- get: function() {
9129
- return weekdayOfLocalDate;
9130
- }
9131
- });
9132
- Object.defineProperty(exports, "zoneOnlySite", {
9133
- enumerable: true,
9134
- get: function() {
9135
- return zoneOnlySite;
9136
- }
9137
- });