@camstack/server 1.2.802 → 1.2.804

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 (92) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/api/trpc/generated-cap-routers.js +18 -0
  3. package/package.json +7 -10
  4. package/system/dist/{agent-https-CzMpclQr.js → agent-https-BFvIRgIa.js} +1 -1
  5. package/system/dist/{agent-https-CfPGbJ21.mjs → agent-https-Bp70et-W.mjs} +1 -1
  6. package/system/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.js +1 -1
  7. package/system/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.mjs +1 -1
  8. package/system/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.js +1 -1
  9. package/system/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.mjs +1 -1
  10. package/system/dist/builtins/alerts/alerts.addon.js +1 -1
  11. package/system/dist/builtins/alerts/alerts.addon.mjs +1 -1
  12. package/system/dist/builtins/autotrack/index.js +1 -1
  13. package/system/dist/builtins/autotrack/index.mjs +1 -1
  14. package/system/dist/builtins/backup-orchestrator/backup-orchestrator.addon.js +2 -2
  15. package/system/dist/builtins/backup-orchestrator/backup-orchestrator.addon.mjs +2 -2
  16. package/system/dist/builtins/calendars/calendars.addon.js +1 -1
  17. package/system/dist/builtins/calendars/calendars.addon.mjs +1 -1
  18. package/system/dist/builtins/camera-grid/index.js +1 -1
  19. package/system/dist/builtins/camera-grid/index.mjs +1 -1
  20. package/system/dist/builtins/composer/composed-device.d.ts +5 -0
  21. package/system/dist/builtins/composer/composer.addon.js +42 -6
  22. package/system/dist/builtins/composer/composer.addon.mjs +42 -6
  23. package/system/dist/builtins/composer/composer.d.ts +13 -0
  24. package/system/dist/builtins/console-logging/index.js +1 -1
  25. package/system/dist/builtins/console-logging/index.mjs +1 -1
  26. package/system/dist/builtins/core-blocks/core-blocks.addon.js +65 -6
  27. package/system/dist/builtins/core-blocks/core-blocks.addon.mjs +65 -6
  28. package/system/dist/builtins/core-blocks/timed-run/timed-run-service.d.ts +17 -0
  29. package/system/dist/builtins/core-blocks/timed-run/timed-run-wiring.d.ts +6 -0
  30. package/system/dist/builtins/device-history/device-history.addon.js +2 -2
  31. package/system/dist/builtins/device-history/device-history.addon.mjs +2 -2
  32. package/system/dist/builtins/device-manager/device-config-contribution.d.ts +1 -0
  33. package/system/dist/builtins/device-manager/device-manager.addon.js +47 -2
  34. package/system/dist/builtins/device-manager/device-manager.addon.mjs +47 -2
  35. package/system/dist/builtins/device-manager/timed-run-config-schema.d.ts +18 -0
  36. package/system/dist/builtins/hub-forwarder/index.js +1 -1
  37. package/system/dist/builtins/hub-forwarder/index.mjs +1 -1
  38. package/system/dist/builtins/keychain/index.js +4 -4
  39. package/system/dist/builtins/keychain/index.mjs +4 -4
  40. package/system/dist/builtins/liveness-monitor/liveness-monitor.addon.js +1 -1
  41. package/system/dist/builtins/liveness-monitor/liveness-monitor.addon.mjs +1 -1
  42. package/system/dist/builtins/local-auth/local-auth.addon.js +2 -2
  43. package/system/dist/builtins/local-auth/local-auth.addon.mjs +2 -2
  44. package/system/dist/builtins/local-network/local-network.addon.js +2 -2
  45. package/system/dist/builtins/local-network/local-network.addon.mjs +2 -2
  46. package/system/dist/builtins/loki-logging/index.js +1 -1
  47. package/system/dist/builtins/loki-logging/index.mjs +1 -1
  48. package/system/dist/builtins/native-metrics/native-metrics.addon.js +1 -1
  49. package/system/dist/builtins/native-metrics/native-metrics.addon.mjs +1 -1
  50. package/system/dist/builtins/platform-probe/index.js +1 -1
  51. package/system/dist/builtins/platform-probe/index.mjs +1 -1
  52. package/system/dist/builtins/record-entries/index.js +1 -1
  53. package/system/dist/builtins/record-entries/index.mjs +1 -1
  54. package/system/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.js +1 -1
  55. package/system/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.mjs +1 -1
  56. package/system/dist/builtins/snapshot/index.js +1 -1
  57. package/system/dist/builtins/snapshot/index.mjs +1 -1
  58. package/system/dist/builtins/sqlite-storage/filesystem-storage.addon.js +1 -1
  59. package/system/dist/builtins/sqlite-storage/filesystem-storage.addon.mjs +1 -1
  60. package/system/dist/builtins/sqlite-storage/index.js +1 -1
  61. package/system/dist/builtins/sqlite-storage/index.mjs +1 -1
  62. package/system/dist/builtins/sqlite-storage/sqlite-settings.addon.js +3 -3
  63. package/system/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +3 -3
  64. package/system/dist/builtins/storage-orchestrator/storage-orchestrator.addon.js +1 -1
  65. package/system/dist/builtins/storage-orchestrator/storage-orchestrator.addon.mjs +1 -1
  66. package/system/dist/builtins/system-config/system-config.addon.js +3 -3
  67. package/system/dist/builtins/system-config/system-config.addon.mjs +3 -3
  68. package/system/dist/builtins/winston-logging/index.js +1 -1
  69. package/system/dist/builtins/winston-logging/index.mjs +1 -1
  70. package/system/dist/{capture-engine-CJxojquW.mjs → capture-engine-CQBSd3V1.mjs} +1 -1
  71. package/system/dist/{capture-engine-Us8Ocffb.js → capture-engine-Sh4zAKR0.js} +1 -1
  72. package/system/dist/{composition-sources-DcsjjTIu.mjs → composition-sources-BxSmsp0_.mjs} +1 -1
  73. package/system/dist/{composition-sources-D2z7D7bY.js → composition-sources-rAsv2tZD.js} +1 -1
  74. package/system/dist/{constants-BOMAH5bO.js → constants-BCQCUHl9.js} +1 -1
  75. package/system/dist/{constants-DVqHyOzQ.mjs → constants-BfgfqUFH.mjs} +1 -1
  76. package/system/dist/{device-ca-NlhUUsex.js → device-ca-BgCwLzMX.js} +1 -1
  77. package/system/dist/{device-ca-zAWpen18.mjs → device-ca-D7JZLEAn.mjs} +1 -1
  78. package/system/dist/{dist-BccX5DOW.js → dist-BpIvMLVc.js} +595 -374
  79. package/system/dist/{dist-DYrP8WdD.mjs → dist-Bvw9utDk.mjs} +572 -375
  80. package/system/dist/file-host-worker.js +1 -1
  81. package/system/dist/file-host-worker.mjs +1 -1
  82. package/system/dist/{hub-mdns-ciao-DpRlDWJY.js → hub-mdns-ciao-DZwGhLx-.js} +2 -2
  83. package/system/dist/{hub-mdns-ciao-BleXDm2r.mjs → hub-mdns-ciao-qefBaLZn.mjs} +2 -2
  84. package/system/dist/index.js +16 -10
  85. package/system/dist/index.mjs +16 -10
  86. package/system/dist/{legacy-integration-rows-door-BUyPyv8f.mjs → legacy-integration-rows-door-DCfOpaG3.mjs} +1 -1
  87. package/system/dist/{legacy-integration-rows-door-D2ZrX431.js → legacy-integration-rows-door-gqcsQX0L.js} +1 -1
  88. package/system/dist/{restore-archive-B1PE_1S2.mjs → restore-archive-BS6gi0i-.mjs} +1 -1
  89. package/system/dist/{restore-archive-DMUCmY3H.js → restore-archive-BtgtMV29.js} +1 -1
  90. package/system/dist/{wal-maintenance-CmNAtKgj.js → wal-maintenance-CyyJs8fh.js} +0 -0
  91. package/system/dist/{wal-maintenance-Ce71BVDk.mjs → wal-maintenance-DBCFpkyy.mjs} +0 -0
  92. package/system/package.json +1 -1
@@ -803,7 +803,7 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
803
803
  return EventCategory;
804
804
  }({});
805
805
  //#endregion
806
- //#region ../types/dist/device-type-D1fH5kaC.mjs
806
+ //#region ../types/dist/device-type-DxCT0krO.mjs
807
807
  /**
808
808
  import { errMsg } from '@camstack/types'
809
809
  * Extract a human-readable message from an unknown error value.
@@ -965,6 +965,13 @@ var DeviceFeature = /* @__PURE__ */ function(DeviceFeature) {
965
965
  * filters that want "all devices with on-motion behaviour".
966
966
  */
967
967
  DeviceFeature["MotionTrigger"] = "motion-trigger";
968
+ /**
969
+ * Device can be run for a chosen time and then stopped. Mirrors the
970
+ * `timed-run` wrapper cap — the cap is bound by the core-blocks addon, not by
971
+ * a driver, so the flag is derived from the device's bindings
972
+ * (`featuresOfBoundCaps`). Gates the quick-run control in the viewer.
973
+ */
974
+ DeviceFeature["TimedRun"] = "timed-run";
968
975
  /** Light supports rgb-triplet color via `color` cap. */
969
976
  DeviceFeature["LightColorRgb"] = "light-color-rgb";
970
977
  /** Light supports HSV color via `color` cap. */
@@ -1076,6 +1083,15 @@ var DeviceFeature = /* @__PURE__ */ function(DeviceFeature) {
1076
1083
  return DeviceFeature;
1077
1084
  }({});
1078
1085
  /**
1086
+ * The features a device carries because a capability is bound on it: a bound cap
1087
+ * whose name IS a `DeviceFeature` value. One rule for a device whose cap set
1088
+ * is not decided by one driver (a composed device, a wrapper cap) — a feature
1089
+ * is never listed twice, once as a cap and once as a table of names.
1090
+ */
1091
+ function featuresOfBoundCaps(capNames) {
1092
+ return Object.values(DeviceFeature).filter((feature) => capNames.includes(feature));
1093
+ }
1094
+ /**
1079
1095
  * Semantic role a device plays within its parent. Populated by driver
1080
1096
  * addons when creating accessory devices (Reolink siren/floodlight/
1081
1097
  * PIR/chime/autotrack/doorbell, ONVIF relay outputs, …). Used by the
@@ -1188,7 +1204,7 @@ var DeviceRole = /* @__PURE__ */ function(DeviceRole) {
1188
1204
  return DeviceRole;
1189
1205
  }({});
1190
1206
  //#endregion
1191
- //#region ../types/dist/sleep-B_dgCAyx.mjs
1207
+ //#region ../types/dist/sleep-BPebgzeJ.mjs
1192
1208
  /**
1193
1209
  * The audio chunk plane's byte format, and the ONE expansion from a coded
1194
1210
  * window to float samples (D455).
@@ -8779,13 +8795,25 @@ Object.freeze({
8779
8795
  "path": "temperature",
8780
8796
  "valueType": "number"
8781
8797
  }],
8782
- "timed-run": [{
8783
- "path": "activeUntil",
8784
- "valueType": "number"
8785
- }, {
8786
- "path": "requestedBy",
8787
- "valueType": "string"
8788
- }],
8798
+ "timed-run": [
8799
+ {
8800
+ "path": "activeUntil",
8801
+ "valueType": "number"
8802
+ },
8803
+ {
8804
+ "path": "requestedBy",
8805
+ "valueType": "string"
8806
+ },
8807
+ {
8808
+ "path": "quickRun.duration",
8809
+ "valueType": "number"
8810
+ },
8811
+ {
8812
+ "path": "quickRun.unit",
8813
+ "valueType": "enum",
8814
+ "enumValues": ["s", "min"]
8815
+ }
8816
+ ],
8789
8817
  "update": [
8790
8818
  {
8791
8819
  "path": "currentVersion",
@@ -9118,7 +9146,7 @@ function sleep(ms) {
9118
9146
  return new Promise((resolve) => setTimeout(resolve, Math.max(0, ms)));
9119
9147
  }
9120
9148
  //#endregion
9121
- //#region ../types/dist/composition-BmBHuDTQ.mjs
9149
+ //#region ../types/dist/composition-Bx0JvKUU.mjs
9122
9150
  var AUDIO_ENCODER_BY_CODEC = {
9123
9151
  opus: "libopus",
9124
9152
  aac: "aac",
@@ -54952,8 +54980,9 @@ function planComposition(composition, lookupCap, target) {
54952
54980
  }, lookupCap, servedCommands));
54953
54981
  }
54954
54982
  const result = planFeature(feature, index, featureTarget, lookupCap, servedCommands);
54955
- return compositionFeatureEnabled(feature) ? result : {
54956
- problems: result.problems,
54983
+ if (compositionFeatureEnabled(feature)) return result;
54984
+ return {
54985
+ problems: Object.keys(feature.fields).length === 0 ? result.problems.filter((p) => p.code !== "missing-field") : result.problems,
54957
54986
  fields: [],
54958
54987
  features: [],
54959
54988
  events: []
@@ -85734,93 +85763,27 @@ var RunningFlipEventDataSchema = z.object({
85734
85763
  phase: z.string().nullable()
85735
85764
  });
85736
85765
  var RUNNING_DEVICE_TYPES = Object.values(DeviceType);
85737
- /** Generic Customize target for the running boolean (D936). */
85738
- var runningCustomize = {
85739
- version: 1,
85740
- overridable: [{
85741
- path: "running",
85742
- by: "running"
85743
- }],
85744
- targets: [{
85745
- id: "running",
85746
- cardinality: "scalar",
85747
- vocabulary: {
85748
- cap: "running-state",
85749
- stateField: "running"
85750
- },
85751
- deviceTypes: [
85752
- DeviceType.Washer,
85753
- DeviceType.Dryer,
85754
- DeviceType.Dishwasher,
85755
- DeviceType.Vacuum,
85756
- DeviceType.LawnMower,
85757
- DeviceType.MediaPlayer,
85758
- DeviceType.WaterHeater,
85759
- DeviceType.Humidifier,
85760
- DeviceType.Fan,
85761
- DeviceType.Climate,
85762
- DeviceType.Thermostat,
85763
- DeviceType.PetFeeder,
85764
- DeviceType.Heater
85765
- ],
85766
- apply: "add",
85767
- path: "running",
85768
- sources: [
85769
- {
85770
- kind: "switch",
85771
- transforms: [{ kind: "identity" }]
85772
- },
85773
- {
85774
- kind: "binary",
85775
- transforms: [{ kind: "identity" }, { kind: "invert" }]
85776
- },
85777
- {
85778
- kind: "numeric",
85779
- requiredUnit: "W",
85780
- transforms: [{
85781
- kind: "threshold",
85782
- comparisons: ["gte", "lte"],
85783
- comparison: "gte",
85784
- defaultThreshold: 5,
85785
- defaultStartDwellMs: RUNNING_POWER_START_DELAY_MS,
85786
- defaultStopDwellMs: RUNNING_POWER_STOP_DELAY_MS,
85787
- thresholdUnit: "W"
85788
- }]
85789
- }
85790
- ],
85791
- companions: [
85792
- {
85793
- kind: "constant",
85794
- path: "source",
85795
- value: "assigned",
85796
- when: "always"
85797
- },
85798
- {
85799
- kind: "constant",
85800
- path: "phase",
85801
- value: null,
85802
- when: "add"
85803
- },
85804
- {
85805
- kind: "clock",
85806
- path: "lastFetchedAt",
85807
- when: "always"
85808
- },
85809
- {
85810
- kind: "transition-time",
85811
- path: "since",
85812
- sourceChangedAt: "prefer"
85813
- }
85814
- ],
85815
- sourceReport: {
85816
- status: "assignment-status",
85817
- runtimeField: "source",
85818
- nativeValue: "native",
85819
- assignedValue: "assigned"
85820
- },
85821
- advancedExpression: true
85822
- }]
85823
- };
85766
+ /**
85767
+ * Customize offers "running" only where a job makes sense (D933): a cycle,
85768
+ * a clean, a mow, playback, or another appliance that is on and working.
85769
+ * The cap itself stays on every type — a camera can still report running
85770
+ * natively; it just has no card.
85771
+ */
85772
+ var RUNNING_CUSTOMIZE_DEVICE_TYPES = [
85773
+ DeviceType.Washer,
85774
+ DeviceType.Dryer,
85775
+ DeviceType.Dishwasher,
85776
+ DeviceType.Vacuum,
85777
+ DeviceType.LawnMower,
85778
+ DeviceType.MediaPlayer,
85779
+ DeviceType.WaterHeater,
85780
+ DeviceType.Humidifier,
85781
+ DeviceType.Fan,
85782
+ DeviceType.Climate,
85783
+ DeviceType.Thermostat,
85784
+ DeviceType.PetFeeder,
85785
+ DeviceType.Heater
85786
+ ];
85824
85787
  var runningStateCapability = {
85825
85788
  name: "running-state",
85826
85789
  scope: "device",
@@ -85840,7 +85803,78 @@ var runningStateCapability = {
85840
85803
  durability: "restored",
85841
85804
  history: { fields: { running: { kind: "boolean" } } },
85842
85805
  volatileStateFields: ["lastFetchedAt"],
85843
- customize: runningCustomize
85806
+ customize: {
85807
+ version: 1,
85808
+ overridable: [{
85809
+ path: "running",
85810
+ by: "running"
85811
+ }],
85812
+ targets: [{
85813
+ id: "running",
85814
+ cardinality: "scalar",
85815
+ vocabulary: {
85816
+ cap: "running-state",
85817
+ stateField: "running"
85818
+ },
85819
+ deviceTypes: RUNNING_CUSTOMIZE_DEVICE_TYPES,
85820
+ apply: "add",
85821
+ path: "running",
85822
+ sources: [
85823
+ {
85824
+ kind: "switch",
85825
+ transforms: [{ kind: "identity" }]
85826
+ },
85827
+ {
85828
+ kind: "binary",
85829
+ transforms: [{ kind: "identity" }, { kind: "invert" }]
85830
+ },
85831
+ {
85832
+ kind: "numeric",
85833
+ requiredUnit: "W",
85834
+ transforms: [{
85835
+ kind: "threshold",
85836
+ comparisons: ["gte", "lte"],
85837
+ comparison: "gte",
85838
+ defaultThreshold: 5,
85839
+ defaultStartDwellMs: RUNNING_POWER_START_DELAY_MS,
85840
+ defaultStopDwellMs: RUNNING_POWER_STOP_DELAY_MS,
85841
+ thresholdUnit: "W"
85842
+ }]
85843
+ }
85844
+ ],
85845
+ companions: [
85846
+ {
85847
+ kind: "constant",
85848
+ path: "source",
85849
+ value: "assigned",
85850
+ when: "always"
85851
+ },
85852
+ {
85853
+ kind: "constant",
85854
+ path: "phase",
85855
+ value: null,
85856
+ when: "add"
85857
+ },
85858
+ {
85859
+ kind: "clock",
85860
+ path: "lastFetchedAt",
85861
+ when: "always"
85862
+ },
85863
+ {
85864
+ kind: "transition-time",
85865
+ path: "since",
85866
+ sourceChangedAt: "prefer"
85867
+ }
85868
+ ],
85869
+ sourceReport: {
85870
+ status: "assignment-status",
85871
+ runtimeField: "source",
85872
+ nativeValue: "native",
85873
+ assignedValue: "assigned"
85874
+ },
85875
+ advancedExpression: true
85876
+ }]
85877
+ }
85844
85878
  };
85845
85879
  /**
85846
85880
  * scene-monitor — device-scoped reference-region state cap. An operator marks
@@ -89511,12 +89545,14 @@ var TIMED_RUN_LIMITS = {
89511
89545
  [DeviceType.Heater]: {
89512
89546
  actuator: "switch",
89513
89547
  maxSeconds: 10800,
89514
- unit: "min"
89548
+ unit: "min",
89549
+ quickRunDefault: 30
89515
89550
  },
89516
89551
  [DeviceType.PetFountain]: {
89517
89552
  actuator: "pet-fountain",
89518
89553
  maxSeconds: 300,
89519
- unit: "s"
89554
+ unit: "s",
89555
+ quickRunDefault: 60
89520
89556
  }
89521
89557
  };
89522
89558
  var TIMED_RUN_DEVICE_TYPES = [DeviceType.Heater, DeviceType.PetFountain];
@@ -89527,6 +89563,27 @@ function timedRunLimitOf(deviceType) {
89527
89563
  function timedRunSeconds(duration, unit) {
89528
89564
  return unit === "min" ? duration * 60 : duration;
89529
89565
  }
89566
+ /** The longest run of a limit, in the unit the operator thinks of it in. */
89567
+ function timedRunMaxIn(limit) {
89568
+ return limit.unit === "min" ? Math.floor(limit.maxSeconds / 60) : limit.maxSeconds;
89569
+ }
89570
+ /** One duration, as the one-tap run asks for it. */
89571
+ var TimedRunQuickRunSchema = z.object({
89572
+ duration: z.number().positive().finite(),
89573
+ unit: TimedRunUnitSchema
89574
+ });
89575
+ /**
89576
+ * The one-tap run of a device: the duration the operator stored for it, else the
89577
+ * type's default, never above the type's maximum. A stored value that is not a
89578
+ * usable number is the default (a hand-edited row never breaks the button).
89579
+ */
89580
+ function timedRunQuickRun(limit, stored) {
89581
+ const max = timedRunMaxIn(limit);
89582
+ return {
89583
+ duration: Math.min((stored !== null && Number.isFinite(stored) && stored > 0 ? stored : null) ?? limit.quickRunDefault, max),
89584
+ unit: limit.unit
89585
+ };
89586
+ }
89530
89587
  /** Why a request was not carried out. Typed, so a caller can say it in words. */
89531
89588
  var TimedRunRefusalSchema = z.enum([
89532
89589
  "unsupported-device",
@@ -89547,8 +89604,23 @@ var TimedRunStatusSchema = z.object({
89547
89604
  activeUntil: z.number().nullable(),
89548
89605
  /** Who asked for the run (a user id or an addon id); `null` when nothing is armed or it did not say. */
89549
89606
  requestedBy: z.string().nullable(),
89607
+ /**
89608
+ * The one-tap run of THIS device: what a "Run" button on any surface starts. `null` when
89609
+ * the device is gone or its type has no timed run; a status from before this field
89610
+ * existed has none, and a surface falls back to the type's default.
89611
+ */
89612
+ quickRun: TimedRunQuickRunSchema.nullable(),
89550
89613
  lastFetchedAt: z.number()
89551
89614
  });
89615
+ /** What the settings form needs: the unit, the bounds and the type's default. */
89616
+ var TimedRunOptionsSchema = z.object({
89617
+ unit: TimedRunUnitSchema,
89618
+ /** The longest run, in `unit`. */
89619
+ maxDuration: z.number(),
89620
+ defaultDuration: z.number()
89621
+ });
89622
+ /** The one-tap run duration, in the type's unit; `null` returns to the type's default. */
89623
+ var TimedRunSettingsPatchSchema = z.object({ quickRunDuration: z.number().positive().finite().nullable().optional() });
89552
89624
  var timedRunCapability = {
89553
89625
  name: "timed-run",
89554
89626
  scope: "device",
@@ -89556,7 +89628,24 @@ var timedRunCapability = {
89556
89628
  kind: "wrapper",
89557
89629
  defaultActive: true,
89558
89630
  deviceTypes: TIMED_RUN_DEVICE_TYPES,
89631
+ deviceConfig: { ui: {
89632
+ kind: "derived-form",
89633
+ builderId: "timed-run",
89634
+ tab: "general"
89635
+ } },
89559
89636
  methods: {
89637
+ getOptions: method(z.object({ deviceId: z.number().int() }), TimedRunOptionsSchema),
89638
+ /**
89639
+ * The one-tap run of this device. A duration above the type's maximum is
89640
+ * REFUSED (thrown), like `runFor`: the maximum is a safety bound.
89641
+ */
89642
+ setSettings: method(z.object({
89643
+ deviceId: z.number().int(),
89644
+ settings: TimedRunSettingsPatchSchema
89645
+ }), z.void(), {
89646
+ kind: "mutation",
89647
+ auth: "admin"
89648
+ }),
89560
89649
  /**
89561
89650
  * Turn the device on and arm its off. A run already armed is replaced (the
89562
89651
  * new deadline wins). Refuses with a typed reason above the type's maximum.
@@ -94133,255 +94222,6 @@ function evaluateAggregate(input) {
94133
94222
  counts
94134
94223
  };
94135
94224
  }
94136
- /**
94137
- * One composed field, evaluated from what its sources say NOW (D659).
94138
- *
94139
- * Pure. The composer calls it on every source change, and the slice-5 editor
94140
- * will call it for its live preview, so both see the same answer.
94141
- *
94142
- * The rules (spec §2):
94143
- * - a source that is offline or unreadable keeps its last value and is marked
94144
- * STALE; the field is stale and keeps computing (D49);
94145
- * - a source that is GONE makes the field UNAVAILABLE, `fatal`, and never a
94146
- * plausible number (D393);
94147
- * - a source that is unavailable but NOT gone (e.g. a cap unregistered at
94148
- * runtime, R7b) makes the field UNAVAILABLE, non-fatal, `value: null`: it
94149
- * may come back on its own, no block failure is raised for it;
94150
- * - an expression that fails on a value makes the field unavailable for that
94151
- * value, and NOT fatal: the next value may compute.
94152
- *
94153
- * `confirmed` (D663, D49): whether a NON-fatal unavailability is an ANSWER — a
94154
- * cap the provider unregistered and a re-read agreed, a field the source
94155
- * reported without, an expression that failed on a value — or only the
94156
- * absence of one (a failed read, a first or empty read, a source not tracked
94157
- * yet). Only a confirmed unavailability may hand a `release`-mode field back
94158
- * to the native provider; an unconfirmed one holds it on its last value.
94159
- * Absent means NOT confirmed. Fatal is always confirmed.
94160
- *
94161
- * When an expression has more than one unavailable binding, a FATAL one always
94162
- * wins the outcome, regardless of position: every binding is scanned before
94163
- * the field is judged, so an earlier non-fatal binding (e.g. a cap that is
94164
- * momentarily unregistered) can never hide a later fatal one (a deleted
94165
- * source) behind an early return.
94166
- */
94167
- function describeRead(read) {
94168
- return `${compositionSourceKey(read.source)} ${read.cap}.${read.fieldPath}`;
94169
- }
94170
- function isConfirmed(reading) {
94171
- return reading.fatal || reading.confirmed === true;
94172
- }
94173
- function fromReading(reading, read) {
94174
- if (reading.state === "unavailable") return {
94175
- state: "unavailable",
94176
- value: null,
94177
- reason: `${describeRead(read)}: ${reading.reason}`,
94178
- fatal: reading.fatal,
94179
- confirmed: isConfirmed(reading)
94180
- };
94181
- return {
94182
- state: reading.state,
94183
- value: reading.value,
94184
- reason: reading.state === "stale" ? `${describeRead(read)}: ${reading.reason}` : null,
94185
- deadline: null
94186
- };
94187
- }
94188
- function expressionOutcome(source, read, now, stateful) {
94189
- const values = {};
94190
- const staleReasons = [];
94191
- let fatalUnavailable = null;
94192
- let nonFatalUnavailable = null;
94193
- for (const [name, binding] of Object.entries(source.bindings)) {
94194
- if (binding.kind === "literal") {
94195
- values[name] = binding.value;
94196
- continue;
94197
- }
94198
- const reading = read(binding);
94199
- if (reading.state === "unavailable") {
94200
- const outcome = {
94201
- state: "unavailable",
94202
- value: null,
94203
- reason: `binding \`${name}\` (${describeRead(binding)}): ${reading.reason}`,
94204
- fatal: reading.fatal,
94205
- confirmed: isConfirmed(reading)
94206
- };
94207
- if (reading.fatal) {
94208
- fatalUnavailable = outcome;
94209
- break;
94210
- }
94211
- if (nonFatalUnavailable === null || outcome.confirmed && !nonFatalUnavailable.confirmed) nonFatalUnavailable = outcome;
94212
- continue;
94213
- }
94214
- values[name] = reading.value;
94215
- if (reading.state === "fresh" && reading.transition !== void 0 && stateful !== void 0) stateful.expressionMemory.dwellTransition = reading.transition;
94216
- if (reading.state === "stale") staleReasons.push(`\`${name}\`: ${reading.reason}`);
94217
- }
94218
- const unavailable = fatalUnavailable ?? nonFatalUnavailable;
94219
- if (unavailable !== null) {
94220
- if (stateful !== void 0 && stateful.currentOutput !== void 0 && expressionContainsBuiltinCall(source.expr, "count")) return {
94221
- state: "stale",
94222
- value: evaluateCount(null, {
94223
- kind: "count",
94224
- highWater: null,
94225
- primed: false
94226
- }, stateful.currentOutput),
94227
- reason: `${unavailable.reason}; holding the last accumulator value`,
94228
- deadline: null
94229
- };
94230
- return unavailable;
94231
- }
94232
- const deadlines = [];
94233
- const hooks = {
94234
- noteDeadline: (at) => deadlines.push(at),
94235
- ...stateful?.timerDriven === true ? { timerDriven: true } : {},
94236
- convert: (value, from, to) => tryConvertUnit(value, normalizeUnit(from) ?? from, normalizeUnit(to) ?? to) ?? null
94237
- };
94238
- const result = evaluateExpressionSource(source.expr, values, now, {
94239
- hooks,
94240
- ...stateful === void 0 ? {} : { invokeStateful: (invocation) => evaluateStatefulExpressionCall(stateful.callPathPrefix === void 0 ? invocation : {
94241
- ...invocation,
94242
- path: `${stateful.callPathPrefix}@${invocation.path}`
94243
- }, stateful.expressionMemory, {
94244
- currentOutput: stateful.currentOutput,
94245
- startedAtMs: stateful.startedAtMs,
94246
- nowMs: now
94247
- }, hooks) }
94248
- });
94249
- const transition = stateful?.expressionMemory.dwellTransition ?? null;
94250
- if (stateful !== void 0) stateful.expressionMemory.dwellTransition = null;
94251
- if (!result.ok) return {
94252
- state: "unavailable",
94253
- value: null,
94254
- reason: `the expression failed: ${result.error}`,
94255
- fatal: false,
94256
- confirmed: true,
94257
- expressionFailed: true
94258
- };
94259
- return {
94260
- state: staleReasons.length > 0 ? "stale" : "fresh",
94261
- value: result.value,
94262
- reason: staleReasons.length > 0 ? staleReasons.join("; ") : null,
94263
- deadline: deadlines.length > 0 ? Math.min(...deadlines) : null,
94264
- ...transition === null ? {} : { transition }
94265
- };
94266
- }
94267
- function aggregateRead(reading) {
94268
- if (reading.state === "unavailable") return {
94269
- state: "unavailable",
94270
- fatal: reading.fatal,
94271
- reason: reading.reason
94272
- };
94273
- return {
94274
- state: reading.state,
94275
- value: reading.value,
94276
- ...reading.state === "stale" ? { reason: reading.reason } : {}
94277
- };
94278
- }
94279
- function aggregateField(source, read) {
94280
- const outcome = evaluateAggregate({
94281
- reducer: source.reducer,
94282
- ...source.activeWhen === void 0 ? {} : { activeWhen: source.activeWhen },
94283
- members: source.reads.map((item) => aggregateRead(read(item))),
94284
- publish: source.publish,
94285
- empty: source.empty
94286
- });
94287
- if (outcome.kind === "value") return {
94288
- state: "fresh",
94289
- value: outcome.value,
94290
- reason: null,
94291
- deadline: null
94292
- };
94293
- return {
94294
- state: "unavailable",
94295
- value: null,
94296
- reason: outcome.reason,
94297
- fatal: outcome.fatal,
94298
- confirmed: true
94299
- };
94300
- }
94301
- function evaluateCompositionField(input) {
94302
- const { source } = input;
94303
- switch (source.kind) {
94304
- case "from": return fromReading(input.read(source), source);
94305
- case "expression": return expressionOutcome(source, input.read, input.now, input.stateful);
94306
- case "aggregate": return aggregateField(source, input.read);
94307
- case "series": return {
94308
- state: "unavailable",
94309
- value: null,
94310
- reason: "a series field is written from device history",
94311
- fatal: false,
94312
- confirmed: false
94313
- };
94314
- case "code": return {
94315
- state: "unavailable",
94316
- value: null,
94317
- reason: "code fields are not runnable in the composer — they arrive in slice 4",
94318
- fatal: true,
94319
- confirmed: true
94320
- };
94321
- }
94322
- }
94323
- function lockDoorLinkOfComposition(composition) {
94324
- if (composition === null || composition.target.kind !== "existing") return null;
94325
- const feature = composition.features.find((f) => f.cap === "lock-control");
94326
- if (feature === void 0 || feature.kind !== "fields") return null;
94327
- const state = feature.fields["state"];
94328
- if (state === void 0 || state.kind !== "expression") return null;
94329
- const x = state.bindings["x"];
94330
- if (x === void 0 || x.kind !== "from") return null;
94331
- return {
94332
- lock: composition.target.device,
94333
- sensor: x.source
94334
- };
94335
- }
94336
- /**
94337
- * Which smart switch powers a device (the `power-source` Customize extension):
94338
- * the source its stored `power-source.switchOn` field reads, and the off time of
94339
- * a forced restart stored beside it. Read from the STORED composition, never kept
94340
- * as a second copy (D676). Shared by the hub (which acts on the switch) and the
94341
- * admin UI (which shows it).
94342
- */
94343
- /**
94344
- * The stored off time, or the default when none is stored. A stored number out
94345
- * of range is CLAMPED to the bounds (a hand-written value never refuses the
94346
- * link, it just cannot cut power for an absurd time); a non-integer is rounded.
94347
- */
94348
- function normalizeOffSeconds(value) {
94349
- if (typeof value !== "number" || !Number.isFinite(value)) return 10;
94350
- return Math.min(120, Math.max(3, Math.round(value)));
94351
- }
94352
- /** The constant a stored `offSeconds` field carries, or undefined when it is not a literal number. */
94353
- function storedOffSeconds(composition) {
94354
- const feature = composition.features.find((f) => f.cap === "power-source");
94355
- if (feature === void 0 || feature.kind !== "fields") return void 0;
94356
- const field = feature.fields["offSeconds"];
94357
- if (field === void 0 || field.kind !== "expression") return void 0;
94358
- const n = Number(field.expr);
94359
- return field.expr.trim() === "" || !Number.isFinite(n) ? void 0 : n;
94360
- }
94361
- /**
94362
- * The link a composition stores. An `existing` target names its own device; a
94363
- * `new` target (a composed device) is the composer's own device, so the caller
94364
- * passes the block id and a new-target composition without one has no link.
94365
- */
94366
- function powerSourceLinkOfComposition(composition, blockId) {
94367
- if (composition === null) return null;
94368
- let device;
94369
- if (composition.target.kind === "existing") device = composition.target.device;
94370
- else if (blockId !== void 0) device = composedDeviceRef(blockId);
94371
- else return null;
94372
- const feature = composition.features.find((f) => f.cap === "power-source");
94373
- if (feature === void 0 || feature.kind !== "fields" || feature.enabled === false) return null;
94374
- const field = feature.fields["switchOn"];
94375
- if (field === void 0) return null;
94376
- const read = fieldReads(field).find((r) => r.cap === "switch");
94377
- if (read === void 0) return null;
94378
- return {
94379
- device,
94380
- switch: read.source,
94381
- offSeconds: normalizeOffSeconds(storedOffSeconds(composition))
94382
- };
94383
- }
94384
- SOURCE_CAPS.filter((cap) => cap !== "switch" && cap !== "motion");
94385
94225
  function fromRead(source, cap, fieldPath) {
94386
94226
  return {
94387
94227
  kind: "from",
@@ -94400,17 +94240,16 @@ function expression(expr, bindings) {
94400
94240
  function literal(expr) {
94401
94241
  return expression(expr, {});
94402
94242
  }
94403
- String.raw`rose\(active(\d+), changed(\d+), (\d+(?:\.\d+)?)\)`;
94404
- var catalog$4 = CAP_CUSTOMIZE_CATALOG;
94243
+ var catalog$5 = CAP_CUSTOMIZE_CATALOG;
94405
94244
  function compileScalarOverride(input) {
94406
- const target = catalogTarget$3(input.draft.cap, input.draft.targetId);
94407
- if (target === null || target.cardinality !== "scalar" || target.path === void 0) return fail$1("target");
94408
- if (input.draft.transform.kind === "enum-map") return fail$1("enum");
94245
+ const target = catalogTarget$4(input.draft.cap, input.draft.targetId);
94246
+ if (target === null || target.cardinality !== "scalar" || target.path === void 0) return fail$2("target");
94247
+ if (input.draft.transform.kind === "enum-map") return fail$2("enum");
94409
94248
  const source = sourceSpec$1(target, input.sourceValueKind, input.draft.source.cap);
94410
- if (source === null) return fail$1("source-kind");
94411
- if (source.requiredUnit !== void 0 && input.sourceUnit !== source.requiredUnit) return fail$1("unit");
94249
+ if (source === null) return fail$2("source-kind");
94250
+ if (source.requiredUnit !== void 0 && input.sourceUnit !== source.requiredUnit) return fail$2("unit");
94412
94251
  const allowed = input.draft.transform.kind === "number" ? "identity" : input.draft.transform.kind;
94413
- if (!source.transformKinds.includes(allowed)) return fail$1("transform");
94252
+ if (!source.transformKinds.includes(allowed)) return fail$2("transform");
94414
94253
  if (target.override !== void 0) return compileOverride(input, target.path, target.override);
94415
94254
  const value = compileValue$1(input);
94416
94255
  if (!value.ok) return value;
@@ -94431,7 +94270,7 @@ function compileScalarOverride(input) {
94431
94270
  * companion — the native slice keeps its own clock.
94432
94271
  */
94433
94272
  function compileOverride(input, path, rule) {
94434
- if (input.sourceValueKind !== "boolean" || input.draft.transform.kind !== "identity") return fail$1("source-kind");
94273
+ if (input.sourceValueKind !== "boolean" || input.draft.transform.kind !== "identity") return fail$2("source-kind");
94435
94274
  const read = fromRead(refOf$1(input.draft), input.draft.source.cap, input.draft.source.fieldPath);
94436
94275
  const field = expression(overrideExpr(rule.whenSourceTrue, rule.unlessNative), {
94437
94276
  x: read,
@@ -94446,14 +94285,14 @@ function compileOverride(input, path, rule) {
94446
94285
  }
94447
94286
  };
94448
94287
  }
94449
- function fail$1(reason) {
94288
+ function fail$2(reason) {
94450
94289
  return {
94451
94290
  ok: false,
94452
94291
  reason
94453
94292
  };
94454
94293
  }
94455
- function catalogTarget$3(cap, targetId) {
94456
- const entry = catalog$4[cap];
94294
+ function catalogTarget$4(cap, targetId) {
94295
+ const entry = catalog$5[cap];
94457
94296
  if (entry === void 0) return null;
94458
94297
  return entry.targets.find((target) => target.id === targetId) ?? null;
94459
94298
  }
@@ -94474,7 +94313,7 @@ function compileValue$1(input) {
94474
94313
  value: identityValue(read, input.sourceValueKind)
94475
94314
  };
94476
94315
  if (transform.kind === "invert") {
94477
- if (input.sourceValueKind !== "boolean") return fail$1("source-kind");
94316
+ if (input.sourceValueKind !== "boolean") return fail$2("source-kind");
94478
94317
  return {
94479
94318
  ok: true,
94480
94319
  value: expression("!x", { x: read })
@@ -94482,7 +94321,7 @@ function compileValue$1(input) {
94482
94321
  }
94483
94322
  if (transform.kind === "threshold") return thresholdValue(transform, read, transform.minSamples ?? evidenceSamples(input));
94484
94323
  if (transform.kind === "linear") return linearValue$1(transform, read, input.sourceValueKind);
94485
- return fail$1("transform");
94324
+ return fail$2("transform");
94486
94325
  }
94487
94326
  function identityValue(read, valueKind) {
94488
94327
  if (valueKind === "string") return expression("number(x)", { x: read });
@@ -94504,10 +94343,10 @@ function defaultThresholdSamples(cap, targetId, sourceCap) {
94504
94343
  }
94505
94344
  function thresholdValue(transform, read, minSamples) {
94506
94345
  const threshold = unsignedToken(transform.threshold);
94507
- if (threshold === null) return fail$1("threshold");
94346
+ if (threshold === null) return fail$2("threshold");
94508
94347
  const start = unsignedToken(transform.startDwellMs);
94509
94348
  const stop = unsignedToken(transform.stopDwellMs);
94510
- if (start === null || stop === null) return fail$1("dwell");
94349
+ if (start === null || stop === null) return fail$2("dwell");
94511
94350
  return {
94512
94351
  ok: true,
94513
94352
  value: expression(dwellExpr(transform.comparison, threshold, start, stop, minSamples), { x: read })
@@ -94516,7 +94355,7 @@ function thresholdValue(transform, read, minSamples) {
94516
94355
  function linearValue$1(transform, read, valueKind) {
94517
94356
  const scale = signedToken(transform.scale);
94518
94357
  const offset = signedToken(transform.offset);
94519
- if (scale === null || offset === null) return fail$1("scale");
94358
+ if (scale === null || offset === null) return fail$2("scale");
94520
94359
  const clamps = clampTokens$1(transform.clampMin, transform.clampMax);
94521
94360
  if (!clamps.ok) return clamps;
94522
94361
  return {
@@ -94532,10 +94371,10 @@ function clampTokens$1(clampMin, clampMax) {
94532
94371
  max: null
94533
94372
  }
94534
94373
  };
94535
- if (clampMin === void 0 || clampMax === void 0) return fail$1("clamp");
94374
+ if (clampMin === void 0 || clampMax === void 0) return fail$2("clamp");
94536
94375
  const min = signedToken(clampMin);
94537
94376
  const max = signedToken(clampMax);
94538
- if (min === null || max === null || clampMin > clampMax) return fail$1("clamp");
94377
+ if (min === null || max === null || clampMin > clampMax) return fail$2("clamp");
94539
94378
  return {
94540
94379
  ok: true,
94541
94380
  value: {
@@ -94545,7 +94384,7 @@ function clampTokens$1(clampMin, clampMax) {
94545
94384
  };
94546
94385
  }
94547
94386
  function compileCompanions$1(input, target, value) {
94548
- if (target.path === void 0) return fail$1("target");
94387
+ if (target.path === void 0) return fail$2("target");
94549
94388
  const path = target.path;
94550
94389
  return (target.companions ?? []).filter((companion) => companionIncluded$1(companion, input.apply)).reduce((acc, companion) => {
94551
94390
  if (!acc.ok) return acc;
@@ -94573,7 +94412,7 @@ function companionIncluded$1(companion, apply) {
94573
94412
  function companionField(input, path, companion, value) {
94574
94413
  if (companion.kind === "constant") {
94575
94414
  const expr = constantExpr(companion.value);
94576
- if (expr === null) return fail$1("scale");
94415
+ if (expr === null) return fail$2("scale");
94577
94416
  return {
94578
94417
  ok: true,
94579
94418
  value: literal(expr)
@@ -94591,7 +94430,7 @@ function transitionField(input, path, sourceChangedAt, value) {
94591
94430
  value: fromRead(refOf$1(input.draft), input.draft.source.cap, input.changedAtField)
94592
94431
  };
94593
94432
  if (input.apply === "replace") return stampOfValue(value);
94594
- if (!isIdentifier(path)) return fail$1("transform");
94433
+ if (!isIdentifier(path)) return fail$2("transform");
94595
94434
  const bindings = { [path]: fromRead(input.device, input.draft.cap, path) };
94596
94435
  return {
94597
94436
  ok: true,
@@ -94607,7 +94446,7 @@ function stampOfValue(value) {
94607
94446
  ok: true,
94608
94447
  value: expression("latchedAt(x)", { x: value })
94609
94448
  };
94610
- return fail$1("transform");
94449
+ return fail$2("transform");
94611
94450
  }
94612
94451
  function refOf$1(draft) {
94613
94452
  return {
@@ -94615,6 +94454,340 @@ function refOf$1(draft) {
94615
94454
  stableId: draft.source.stableId
94616
94455
  };
94617
94456
  }
94457
+ /**
94458
+ * Switch on = device on (D933, amended): a device with an ACTUATOR switch - its
94459
+ * own `switch`, the one that turns its function on - runs while that switch is on.
94460
+ * A SUPPLY switch (`power-source.switchOn`, an appliance on a plug) is never a
94461
+ * running source: the appliance keeps its power while it is idle.
94462
+ *
94463
+ * The default is derived from STRUCTURE (an actuator switch is present and no
94464
+ * supply relation is), computed at plan time and never written into the stored
94465
+ * composition: a stored composition is never rewritten silently, and an
94466
+ * authored `running` field always wins. The operator turns the default on and
94467
+ * off in the Customize running row ("Follow the device's switch").
94468
+ */
94469
+ var RUNNING_CAP = "running-state";
94470
+ var SWITCH_CAP = "switch";
94471
+ var ON_FIELD = "on";
94472
+ var CHANGED_AT_FIELD = "lastChangedAt";
94473
+ function fieldsFeatureOf(composition, cap) {
94474
+ const feature = composition.features.find((f) => f.cap === cap);
94475
+ return feature !== void 0 && feature.kind === "fields" ? feature : null;
94476
+ }
94477
+ /** The device switch the composed `switch.on` reads, when it is one plain `from` of a switch. */
94478
+ function actuatorSwitchRead(composition) {
94479
+ const feature = fieldsFeatureOf(composition, SWITCH_CAP);
94480
+ if (feature === null || !compositionFeatureEnabled(feature)) return null;
94481
+ const field = feature.fields[ON_FIELD];
94482
+ if (field === void 0 || field.kind !== "from" || field.cap !== SWITCH_CAP) return null;
94483
+ return {
94484
+ source: field.source,
94485
+ cap: field.cap,
94486
+ fieldPath: field.fieldPath
94487
+ };
94488
+ }
94489
+ function hasSupplyRelation(composition) {
94490
+ const feature = fieldsFeatureOf(composition, "power-source");
94491
+ return feature !== null && compositionFeatureEnabled(feature) && feature.fields["switchOn"] !== void 0;
94492
+ }
94493
+ /** Anything stored for running - a rule, or the opt-out - is the operator's, and the default stays out of it. */
94494
+ function hasAuthoredRunning(composition) {
94495
+ return fieldsFeatureOf(composition, RUNNING_CAP) !== null;
94496
+ }
94497
+ /** A NEW device of a type that offers "running", with an actuator switch and no supply relation. */
94498
+ function actuatorSwitchDrivesRunning(composition) {
94499
+ const target = composition.target;
94500
+ if (target.kind !== "new") return false;
94501
+ if (!RUNNING_CUSTOMIZE_DEVICE_TYPES.some((type) => type === target.type)) return false;
94502
+ return actuatorSwitchRead(composition) !== null && !hasSupplyRelation(composition);
94503
+ }
94504
+ /** The `running-state` feature that reads the actuator switch: the one the scalar compiler stores. */
94505
+ function followSwitchRunningFeature(composition, host) {
94506
+ const read = actuatorSwitchRead(composition);
94507
+ if (read === null) return null;
94508
+ const compiled = compileScalarOverride({
94509
+ draft: {
94510
+ kind: "scalar",
94511
+ cap: RUNNING_CAP,
94512
+ targetId: "running",
94513
+ source: {
94514
+ ...read.source,
94515
+ cap: read.cap,
94516
+ fieldPath: read.fieldPath
94517
+ },
94518
+ transform: { kind: "identity" }
94519
+ },
94520
+ device: host,
94521
+ apply: "add",
94522
+ sourceValueKind: "boolean",
94523
+ changedAtField: CHANGED_AT_FIELD,
94524
+ sourceUnit: null
94525
+ });
94526
+ return compiled.ok ? compiled.value : null;
94527
+ }
94528
+ /**
94529
+ * The composition the composer PLANS: the stored one, plus the derived running
94530
+ * field when nothing is authored for it. The input is never changed; with nothing
94531
+ * to add it is returned as it is.
94532
+ */
94533
+ function withDefaultRunning(composition, blockId) {
94534
+ if (hasAuthoredRunning(composition) || !actuatorSwitchDrivesRunning(composition)) return composition;
94535
+ const feature = followSwitchRunningFeature(composition, composedDeviceRef(blockId));
94536
+ return feature === null ? composition : {
94537
+ ...composition,
94538
+ features: [...composition.features, feature]
94539
+ };
94540
+ }
94541
+ /**
94542
+ * One composed field, evaluated from what its sources say NOW (D659).
94543
+ *
94544
+ * Pure. The composer calls it on every source change, and the slice-5 editor
94545
+ * will call it for its live preview, so both see the same answer.
94546
+ *
94547
+ * The rules (spec §2):
94548
+ * - a source that is offline or unreadable keeps its last value and is marked
94549
+ * STALE; the field is stale and keeps computing (D49);
94550
+ * - a source that is GONE makes the field UNAVAILABLE, `fatal`, and never a
94551
+ * plausible number (D393);
94552
+ * - a source that is unavailable but NOT gone (e.g. a cap unregistered at
94553
+ * runtime, R7b) makes the field UNAVAILABLE, non-fatal, `value: null`: it
94554
+ * may come back on its own, no block failure is raised for it;
94555
+ * - an expression that fails on a value makes the field unavailable for that
94556
+ * value, and NOT fatal: the next value may compute.
94557
+ *
94558
+ * `confirmed` (D663, D49): whether a NON-fatal unavailability is an ANSWER — a
94559
+ * cap the provider unregistered and a re-read agreed, a field the source
94560
+ * reported without, an expression that failed on a value — or only the
94561
+ * absence of one (a failed read, a first or empty read, a source not tracked
94562
+ * yet). Only a confirmed unavailability may hand a `release`-mode field back
94563
+ * to the native provider; an unconfirmed one holds it on its last value.
94564
+ * Absent means NOT confirmed. Fatal is always confirmed.
94565
+ *
94566
+ * When an expression has more than one unavailable binding, a FATAL one always
94567
+ * wins the outcome, regardless of position: every binding is scanned before
94568
+ * the field is judged, so an earlier non-fatal binding (e.g. a cap that is
94569
+ * momentarily unregistered) can never hide a later fatal one (a deleted
94570
+ * source) behind an early return.
94571
+ */
94572
+ function describeRead(read) {
94573
+ return `${compositionSourceKey(read.source)} ${read.cap}.${read.fieldPath}`;
94574
+ }
94575
+ function isConfirmed(reading) {
94576
+ return reading.fatal || reading.confirmed === true;
94577
+ }
94578
+ function fromReading(reading, read) {
94579
+ if (reading.state === "unavailable") return {
94580
+ state: "unavailable",
94581
+ value: null,
94582
+ reason: `${describeRead(read)}: ${reading.reason}`,
94583
+ fatal: reading.fatal,
94584
+ confirmed: isConfirmed(reading)
94585
+ };
94586
+ return {
94587
+ state: reading.state,
94588
+ value: reading.value,
94589
+ reason: reading.state === "stale" ? `${describeRead(read)}: ${reading.reason}` : null,
94590
+ deadline: null
94591
+ };
94592
+ }
94593
+ function expressionOutcome(source, read, now, stateful) {
94594
+ const values = {};
94595
+ const staleReasons = [];
94596
+ let fatalUnavailable = null;
94597
+ let nonFatalUnavailable = null;
94598
+ for (const [name, binding] of Object.entries(source.bindings)) {
94599
+ if (binding.kind === "literal") {
94600
+ values[name] = binding.value;
94601
+ continue;
94602
+ }
94603
+ const reading = read(binding);
94604
+ if (reading.state === "unavailable") {
94605
+ const outcome = {
94606
+ state: "unavailable",
94607
+ value: null,
94608
+ reason: `binding \`${name}\` (${describeRead(binding)}): ${reading.reason}`,
94609
+ fatal: reading.fatal,
94610
+ confirmed: isConfirmed(reading)
94611
+ };
94612
+ if (reading.fatal) {
94613
+ fatalUnavailable = outcome;
94614
+ break;
94615
+ }
94616
+ if (nonFatalUnavailable === null || outcome.confirmed && !nonFatalUnavailable.confirmed) nonFatalUnavailable = outcome;
94617
+ continue;
94618
+ }
94619
+ values[name] = reading.value;
94620
+ if (reading.state === "fresh" && reading.transition !== void 0 && stateful !== void 0) stateful.expressionMemory.dwellTransition = reading.transition;
94621
+ if (reading.state === "stale") staleReasons.push(`\`${name}\`: ${reading.reason}`);
94622
+ }
94623
+ const unavailable = fatalUnavailable ?? nonFatalUnavailable;
94624
+ if (unavailable !== null) {
94625
+ if (stateful !== void 0 && stateful.currentOutput !== void 0 && expressionContainsBuiltinCall(source.expr, "count")) return {
94626
+ state: "stale",
94627
+ value: evaluateCount(null, {
94628
+ kind: "count",
94629
+ highWater: null,
94630
+ primed: false
94631
+ }, stateful.currentOutput),
94632
+ reason: `${unavailable.reason}; holding the last accumulator value`,
94633
+ deadline: null
94634
+ };
94635
+ return unavailable;
94636
+ }
94637
+ const deadlines = [];
94638
+ const hooks = {
94639
+ noteDeadline: (at) => deadlines.push(at),
94640
+ ...stateful?.timerDriven === true ? { timerDriven: true } : {},
94641
+ convert: (value, from, to) => tryConvertUnit(value, normalizeUnit(from) ?? from, normalizeUnit(to) ?? to) ?? null
94642
+ };
94643
+ const result = evaluateExpressionSource(source.expr, values, now, {
94644
+ hooks,
94645
+ ...stateful === void 0 ? {} : { invokeStateful: (invocation) => evaluateStatefulExpressionCall(stateful.callPathPrefix === void 0 ? invocation : {
94646
+ ...invocation,
94647
+ path: `${stateful.callPathPrefix}@${invocation.path}`
94648
+ }, stateful.expressionMemory, {
94649
+ currentOutput: stateful.currentOutput,
94650
+ startedAtMs: stateful.startedAtMs,
94651
+ nowMs: now
94652
+ }, hooks) }
94653
+ });
94654
+ const transition = stateful?.expressionMemory.dwellTransition ?? null;
94655
+ if (stateful !== void 0) stateful.expressionMemory.dwellTransition = null;
94656
+ if (!result.ok) return {
94657
+ state: "unavailable",
94658
+ value: null,
94659
+ reason: `the expression failed: ${result.error}`,
94660
+ fatal: false,
94661
+ confirmed: true,
94662
+ expressionFailed: true
94663
+ };
94664
+ return {
94665
+ state: staleReasons.length > 0 ? "stale" : "fresh",
94666
+ value: result.value,
94667
+ reason: staleReasons.length > 0 ? staleReasons.join("; ") : null,
94668
+ deadline: deadlines.length > 0 ? Math.min(...deadlines) : null,
94669
+ ...transition === null ? {} : { transition }
94670
+ };
94671
+ }
94672
+ function aggregateRead(reading) {
94673
+ if (reading.state === "unavailable") return {
94674
+ state: "unavailable",
94675
+ fatal: reading.fatal,
94676
+ reason: reading.reason
94677
+ };
94678
+ return {
94679
+ state: reading.state,
94680
+ value: reading.value,
94681
+ ...reading.state === "stale" ? { reason: reading.reason } : {}
94682
+ };
94683
+ }
94684
+ function aggregateField(source, read) {
94685
+ const outcome = evaluateAggregate({
94686
+ reducer: source.reducer,
94687
+ ...source.activeWhen === void 0 ? {} : { activeWhen: source.activeWhen },
94688
+ members: source.reads.map((item) => aggregateRead(read(item))),
94689
+ publish: source.publish,
94690
+ empty: source.empty
94691
+ });
94692
+ if (outcome.kind === "value") return {
94693
+ state: "fresh",
94694
+ value: outcome.value,
94695
+ reason: null,
94696
+ deadline: null
94697
+ };
94698
+ return {
94699
+ state: "unavailable",
94700
+ value: null,
94701
+ reason: outcome.reason,
94702
+ fatal: outcome.fatal,
94703
+ confirmed: true
94704
+ };
94705
+ }
94706
+ function evaluateCompositionField(input) {
94707
+ const { source } = input;
94708
+ switch (source.kind) {
94709
+ case "from": return fromReading(input.read(source), source);
94710
+ case "expression": return expressionOutcome(source, input.read, input.now, input.stateful);
94711
+ case "aggregate": return aggregateField(source, input.read);
94712
+ case "series": return {
94713
+ state: "unavailable",
94714
+ value: null,
94715
+ reason: "a series field is written from device history",
94716
+ fatal: false,
94717
+ confirmed: false
94718
+ };
94719
+ case "code": return {
94720
+ state: "unavailable",
94721
+ value: null,
94722
+ reason: "code fields are not runnable in the composer — they arrive in slice 4",
94723
+ fatal: true,
94724
+ confirmed: true
94725
+ };
94726
+ }
94727
+ }
94728
+ function lockDoorLinkOfComposition(composition) {
94729
+ if (composition === null || composition.target.kind !== "existing") return null;
94730
+ const feature = composition.features.find((f) => f.cap === "lock-control");
94731
+ if (feature === void 0 || feature.kind !== "fields") return null;
94732
+ const state = feature.fields["state"];
94733
+ if (state === void 0 || state.kind !== "expression") return null;
94734
+ const x = state.bindings["x"];
94735
+ if (x === void 0 || x.kind !== "from") return null;
94736
+ return {
94737
+ lock: composition.target.device,
94738
+ sensor: x.source
94739
+ };
94740
+ }
94741
+ /**
94742
+ * Which smart switch powers a device (the `power-source` Customize extension):
94743
+ * the source its stored `power-source.switchOn` field reads, and the off time of
94744
+ * a forced restart stored beside it. Read from the STORED composition, never kept
94745
+ * as a second copy (D676). Shared by the hub (which acts on the switch) and the
94746
+ * admin UI (which shows it).
94747
+ */
94748
+ /**
94749
+ * The stored off time, or the default when none is stored. A stored number out
94750
+ * of range is CLAMPED to the bounds (a hand-written value never refuses the
94751
+ * link, it just cannot cut power for an absurd time); a non-integer is rounded.
94752
+ */
94753
+ function normalizeOffSeconds(value) {
94754
+ if (typeof value !== "number" || !Number.isFinite(value)) return 10;
94755
+ return Math.min(120, Math.max(3, Math.round(value)));
94756
+ }
94757
+ /** The constant a stored `offSeconds` field carries, or undefined when it is not a literal number. */
94758
+ function storedOffSeconds(composition) {
94759
+ const feature = composition.features.find((f) => f.cap === "power-source");
94760
+ if (feature === void 0 || feature.kind !== "fields") return void 0;
94761
+ const field = feature.fields["offSeconds"];
94762
+ if (field === void 0 || field.kind !== "expression") return void 0;
94763
+ const n = Number(field.expr);
94764
+ return field.expr.trim() === "" || !Number.isFinite(n) ? void 0 : n;
94765
+ }
94766
+ /**
94767
+ * The link a composition stores. An `existing` target names its own device; a
94768
+ * `new` target (a composed device) is the composer's own device, so the caller
94769
+ * passes the block id and a new-target composition without one has no link.
94770
+ */
94771
+ function powerSourceLinkOfComposition(composition, blockId) {
94772
+ if (composition === null) return null;
94773
+ let device;
94774
+ if (composition.target.kind === "existing") device = composition.target.device;
94775
+ else if (blockId !== void 0) device = composedDeviceRef(blockId);
94776
+ else return null;
94777
+ const feature = composition.features.find((f) => f.cap === "power-source");
94778
+ if (feature === void 0 || feature.kind !== "fields" || feature.enabled === false) return null;
94779
+ const field = feature.fields["switchOn"];
94780
+ if (field === void 0) return null;
94781
+ const read = fieldReads(field).find((r) => r.cap === "switch");
94782
+ if (read === void 0) return null;
94783
+ return {
94784
+ device,
94785
+ switch: read.source,
94786
+ offSeconds: normalizeOffSeconds(storedOffSeconds(composition))
94787
+ };
94788
+ }
94789
+ SOURCE_CAPS.filter((cap) => cap !== "switch" && cap !== "motion");
94790
+ String.raw`rose\(active(\d+), changed(\d+), (\d+(?:\.\d+)?)\)`;
94618
94791
  DeviceRole.BinarySensor, DeviceRole.MotionSensor;
94619
94792
  new Set(CAP_NAMES);
94620
94793
  function isUnfilledRequiredProblem(problem) {
@@ -105420,6 +105593,13 @@ var METHOD_ACCESS_MAP = Object.freeze({
105420
105593
  access: "create",
105421
105594
  role: "viewer"
105422
105595
  },
105596
+ "timedRun.getOptions": {
105597
+ capName: "timed-run",
105598
+ capScope: "device",
105599
+ addonId: null,
105600
+ access: "view",
105601
+ role: "viewer"
105602
+ },
105423
105603
  "timedRun.getStatus": {
105424
105604
  capName: "timed-run",
105425
105605
  capScope: "device",
@@ -105434,6 +105614,13 @@ var METHOD_ACCESS_MAP = Object.freeze({
105434
105614
  access: "create",
105435
105615
  role: "viewer"
105436
105616
  },
105617
+ "timedRun.setSettings": {
105618
+ capName: "timed-run",
105619
+ capScope: "device",
105620
+ addonId: null,
105621
+ access: "create",
105622
+ role: "admin"
105623
+ },
105437
105624
  "toast.onToast": {
105438
105625
  capName: "toast",
105439
105626
  capScope: "system",
@@ -109201,6 +109388,11 @@ Object.freeze({
109201
109388
  form: "single",
109202
109389
  optional: false
109203
109390
  }],
109391
+ "timedRun.getOptions": [{
109392
+ name: "deviceId",
109393
+ form: "single",
109394
+ optional: false
109395
+ }],
109204
109396
  "timedRun.getStatus": [{
109205
109397
  name: "deviceId",
109206
109398
  form: "single",
@@ -109211,6 +109403,11 @@ Object.freeze({
109211
109403
  form: "single",
109212
109404
  optional: false
109213
109405
  }],
109406
+ "timedRun.setSettings": [{
109407
+ name: "deviceId",
109408
+ form: "single",
109409
+ optional: false
109410
+ }],
109214
109411
  "update.getStatus": [{
109215
109412
  name: "deviceId",
109216
109413
  form: "single",
@@ -111613,4 +111810,4 @@ z.object({
111613
111810
  commands: z.record(z.string(), z.unknown())
111614
111811
  });
111615
111812
  //#endregion
111616
- export { EMPTY_AUTOMATION_STATE as $, vectorDimFromBase64 as $a, recordEntriesCapability as $i, coreBlocksCapability as $n, RECORD_BATCH_MAX as $o, isObjectInput as $r, isSecretMarker as $s, ServerNameSchema as $t, ControlStatusSchema as A, siteZoneKey as Aa, normalizeCoreBlockWrite as Ai, buildDeviceEnrollmentLink as An, isForwardInputRef as Ao, fanControlCapability as Ar, collectZodSecretPaths as As, PET_FOUNTAIN_WATER_KEY as At, DEVICE_ENROLLMENT_TTL_MS as B, supportedRuntimes as Ba, petFountainCapability as Bi, climateControlCapability as Bn, BaseAddon as Bo, groupTemplate as Br, formatSecretScope as Bs, RECORDING_SOURCE_CAMSTACK_ADDON as Bt, CORE_BLOCKS_ADDON_ID as C, scoreRuntimes as Ca, userError as Cc, migrationsCapability as Ci, authProviderCapability as Cn, createStatefulExpressionMemory as Co, enumerateSchemaFields as Cr, asString$1 as Cs, MIGRATION_API_V1_METHODS as Ct, CatalogFileSchema as D, sharedColorModes as Da, DeviceType as Dc, nextOccurrence as Di, brightnessCapability as Dn, helperMembers as Do, expandContainer as Dr, collectSecretConfigKeys as Ds, MigrationLedgerEntrySchema as Dt, CalendarPreferencesSchema as E, sharedActuatorMethods as Ea, DeviceRole as Ec, motionCapability as Ei, batteryCapability as En, evaluateStatistic as Eo, evictionPolicyOfLocation as Er, buildSecretRef as Es, MediaPlayerStatusSchema as Et, DATABASE_SNAPSHOT_TIMEOUT_MS as F, storageMigrationCapability as Fa, occurrenceOn as Fi, canonicalIconKey as Fn, planResetTier as Fo, foldSnapshotByFunction as Fr, defineEntryKind as Fs, PowerSourceInfoSchema as Ft, DEVICE_SAN_USER_PREFIX as G, timedRunLimitOf as Ga, powerSourceCapability as Gi, composerCapability as Gn, DEVICE_STATUS_METHOD as Go, isAlertEpisodeSeverity as Gr, isDebugChannelName as Gs, RemoteConfigSchema as Gt, DEVICE_ID_FIELD as H, switchStateOfMode as Ha, pickAppLinkHub as Hi, colorCapability as Hn, CALLER_STAMPED_CAPABILITIES as Ho, internalActionId as Hr, historyItemFieldPath as Hs, ROOT_BUCKET_KEY as Ht, DATA_STORE_DATABASES as I, storageOccupancyCapability as Ia, orderMigrations as Ii, capUnitResolver as In, planStatisticTier as Io, formatDeviceRevoker as Ir, defineRecordKinds as Is, PreferenceDeviceIdSchema as It, DeclaredDevices as J, userManagementCapability as Ja, problemsBlockSave as Ji, consumablesCapability as Jn, ForeignSecretMarkerError as Jo, isCollectionArrayMethod as Jr, isInstanceEnabled as Js, STORAGE_LOCATION_MODES as Jt, DEVICE_TOMBSTONE_RETENTION_MS as K, timedRunSeconds as Ka, powerSourceLinkOfComposition as Ki, compositionFieldKey as Kn, DeclarationRefusedError as Ko, isAppLinkBase as Kr, isDeviceConfigCap as Ks, RunningStateStatusSchema as Kt, DAY_NAMES as L, storageProviderCapability as La, parseAcceleratorFactsJson as Li, catalogueIssues as Ln, statisticCadenceMs as Lo, formatMinutes as Lr, emitDownForOwnedCaps as Ls, PreferenceNamespaceSchema as Lt, CredentialTokenClaimsSchema as M, splitTranslationRef as Ma, normalizeUnit as Mi, buildStreamParamsConfigSchema as Mn, nextLocalMidnight as Mo, fanPresetsCapability as Mr, customAction as Ms, PROPOSAL_MIN_SPAN_MS as Mt, DATABASE_SNAPSHOT_PARTIAL_SUFFIX as N, storageAdminCapability as Na, objectInputDeclaresAddonId as Ni, calendarsCapability as Nn, openReset as No, featureForwards as Nr, defineAddonMigrations as Ns, PackageRequiresSchema as Nt, ConditionMirror as O, shortHostname as Oa, errMsg as Oc, normalizeActionUnits as Oi, buildActionSteps as On, historyRetentionFromSettings as Oo, expressionContainsBuiltinCall as Or, collectSecretLeaves as Os, MigrationMetaSchema as Ot, DATABASE_SNAPSHOT_SUFFIX as P, storageCapability as Pa, objectInputDeclaresRequiredDeviceId as Pi, cameraGridLayoutCapability as Pn, openStatistic as Po, filesystemBrowseCapability as Pr, defineCustomActions as Ps, PetFountainStatusSchema as Pt, DiscoveryProposalBodySchema as Q, valveCapability as Qa, ptzAutotrackCapability as Qi, coreBlockSourceKind as Qn, PlaintextSecretError as Qo, isLocationEnabled as Qr, isSecretFieldView as Qs, ScopedTokenSchema as Qt, DEFAULT_HOLD_OVERRIDE as R, streamCatalogCapability as Ra, parseColorInput as Ri, checkRoleAddress as Rn, toExpressionValue as Ro, gbToBytes as Rr, emitReadiness as Rs, PreferenceValueSchema as Rt, COMPOSER_RUNNER_ID as S, scopesAllowDeviceCap as Sa, transformSecretWrite as Sc, metricsProviderCapability as Si, armRemovalReconcile as Sn, compositionSourceKey as So, enumerateItemArrayFields as Sr, asNumber as Ss, METHOD_ACCESS_MAP as St, CREDENTIAL_TOKEN_AUDIENCE as T, sharedActuatorFeatures as Ta, DeviceFeature as Tc, modeMayWrite as Ti, bareAddonId as Tn, evaluateDerivative as To, evaluateWhenTree as Tr, assertValidDeclaration as Ts, MOTION_CLOSE_AFTER_MS as Tt, DEVICE_NONCE_TTL_MS as U, templateCapability as Ua, planComposition as Ui, compareVersions as Un, DATAPLANE_SECRET_HEADER as Uo, interpolate as Ur, historyUnitFor as Us, RecordingStatusSchema as Ut, DEVICE_HISTORY_ENERGY_KEY as V, switchCapability as Va, petFountainWaterItem as Vi, collectWhenMirrorSources as Vn, BatchTooLargeError as Vo, integrationInstancesCapability as Vr, getDebugInterest as Vs, REMOTE_MEDIA_COMMANDS as Vt, DEVICE_SAN_CREDENTIAL_PREFIX as W, timedRunCapability as Wa, platformProbeCapability as Wi, compileScalarOverride as Wn, DEVICE_SETTINGS_CONTRIBUTION_METHODS as Wo, isAlertEpisodeOpen as Wr, hydrateSchema as Ws, RemoteAssumedStateSchema as Wt, DeviceStatusSchema as X, validateCustomAddress as Xa, processTimeZoneOr as Xi, coreBlockComposition as Xn, InvalidRecordError as Xo, isDefaultAppConnectionEndpoint as Xr, isReadingQuantity as Xs, SchedulerError as Xt, DeviceRunSchema as Y, validateComposition as Ya, procedureAuthKey as Yi, coreBlockAddonId as Yn, HISTORY_DEFAULT_MIN_INTERVAL_MS as Yo, isCredentialTokenPayload as Yr, isKeychainStoredField as Ys, STREAM_PROFILE_META as Yt, DeviceTombstoneSchema as Z, validateSchedulerInput as Za, proposeRunningThreshold as Zi, coreBlockIdFromAddonId as Zn, NoCallerError as Zo, isInternalActionId as Zr, isSecretClear as Zs, SchedulerSchema as Zt, CAMERA_SWITCH_ORDER as _, runFanOut as _a, secretTreeFromSchema as _c, mayWriteToLocation as _i, addonWidgetsCapability as _n, composedDeviceRef as _o, deviceRemovalHookCapability as _r, TransactRefusedError as _s, KEYCHAIN_RESET_TRIGGER_ACTOR as _t, AGENT_MDNS_SERVICE_TYPE as a, resolveActionVariables as aa, nodePin as ac, legacyAutoLinkIds as ai, SwitchStatusSchema as an, zoneOnlySite as ao, databaseSnapshotCapability as ar, REMOVE_LEAF as as, FanDirectionSchema as at, CATALOG_LANGS as b, schedulersCapability as ba, toNodeId as bc, memoizePinnedFfmpeg as bi, alertsCapability as bn, compositionItemFieldPath as bo, deviceStatusCapability as br, WELL_KNOWN_TAB_MAP as bs, LOG_LEVEL_RANK as bt, ActionError as c, resolveCoreBlockEntry as ca, parseJsonObject as cc, localDateOf as ci, UNATTRIBUTED_BUCKET_KEY as cn, DAY_MS as co, decodeVectorBase64 as cr, ReadinessTimeoutError as cs, FieldClaimSchema as ct, ActionVariableSchema as d, resolveLocationMode as da, readinessKey as dc, lockControlCapability as di, actionSourceCapability as dn, HISTORY_SLOW_MS as do, describeComposableCaps as dr, RecordNotFoundError as ds, HISTORY_ITEM_CATALOG as dt, recordsCapability as ea, isSecretMarkerLike as ec, isSameAddonId as ei, SsoBridgeClaimsSchema as en, vectorIndexDimConflictError as eo, coverCapability as er, RECORD_BATCH_MAX_BYTES as es, EMPTY_REMOTE_ASSUMED_STATE as et, AlertSchema as f, resolveMethodAuth as fa, recordSecretRef as fc, lockDoorLinkOfComposition as fi, actionWaitTotalMs as fn, HOUR_MS as fo, describeUnmet as fr, RecordTooLargeError as fs, HUB_MDNS_SERVICE_TYPE as ft, BatteryStatusSchema as g, resolveStepArgs as ga, secretTreeFromPaths as gc, mayReadLocation as gi, addonSettingsCapability as gn, cloneStatefulExpressionMemory as go, deviceManagerCapability as gr, StoredRecordKindDeclarationSchema as gs, INTERNAL_ACTION_PREFIX as gt, BaseDevice as h, resolveRunnerId as ha, scopeKey as hc, looseSchema as hi, addonPagesCapability as hn, buildFfmpegArgs as ho, deviceHistoryCapability as hr, SECRET_CLEAR as hs, IDLE_ACTION_STATUS as ht, ACTUATOR_TEMPLATE_IDS as i, replacedFieldKeys as ia, nodeIdOfScopedKey as ic, keychainCapability as ii, StorageMigrationJobSchema as in, withLocationMode as io, dataStoreProviderCapability as ir, REDACTED_SECRET as is, FanControlStatusSchema as it, CoreBlockSchema as j, snapshotCapability as ja, normalizeStepTargets as ji, buildDeviceSignatureMessage as jn, isHistoryHelper as jo, fanOutTargets as jr, createEvent as js, PREFERENCES_MAX_VALUE_BYTES as jt, ConsumableItemSchema as k, siteFor as ka, EventCategory as kc, normalizeCapStep as ki, buildCapabilityLookup as kn, integrateReading as ko, extractNestedAddonId as kr, collectSecretMarkerRefs as ks, NetworkTunnelStartedDataSchema as kt, ActionStepSchema as l, resolveCoreBlockFiles as la, parseJsonUnknown as lc, localNetworkCapability as li, UserRecordSchema as ln, DEFAULT_HISTORY_RETENTION as lo, defineExtensionSlotProvider as lr, RecordIntegrationInstances as ls, GroupCommandResultSchema as lt, BUILTIN_REMOTE_COMPONENTS as m, resolveNotificationTapAddress as ma, resolveSecretMarkers as mc, logLevelAtMost as mi, addonIdOfActionId as mn, MINUTE_MS as mo, deviceExtensionCapability as mr, RevConflictError as ms, HvacModeSchema as mt, ACTION_TARGET_INVALIDATION_EVENTS as n, remoteCapability as na, makeSecretMarker as nc, kebabToCamel as ni, StorageLocationModeSchema as nn, vocabActionIdFor as no, customKeyOfRole as nr, RECORD_SECRET_COLLECTION_PREFIX as ns, FAN_CAPTURE_FIELDS as nt, AGENT_MDNS_TXT_KEYS as o, resolveAppConnections as oa, normalizeNodeId as oc, legacyModeOf as oi, TemplateKindSchema as on, COMPOSER_ADDON_ID as oo, declarationOwnerNodeId as or, RUNTIME_DEFAULTS as os, FanPresetSchema as ot, AutomationStateDocSchema as p, resolveMutate as pa, resolveCapMount as pc, logDestinationCapability as pi, actionsCapability as pn, HelperMemberSchema as po, deviceCredentialsCapability as pr, RecordUniqueViolationError as ps, HUB_MDNS_TXT_KEYS as pt, DataStoreDatabaseSchema as q, unmetRequirements as qa, preconditionOf as qi, compositionSourceRefs as qn, FilterRequiredError as qo, isArrayOutputSchema as qr, isEvent as qs, STORAGE_ACCESS_FALLBACK as qt, ACTUATOR_METHODS as r, remoteLayoutComponentsCapability as ra, mapSecretLeaves as rc, keychainAdminCapability as ri, StorageLocationTypeSchema as rn, weekdayOfLocalDate as ro, customRole as rr, RECORD_SWEEP_INTERVAL_MS as rs, FIRST_LEVEL_MACRO_CLASSES as rt, ALL_CAPABILITY_DEFINITIONS as s, resolveBucketMs as sa, normalizeSecretOwner as sc, lifecycleJobSchema as si, TokenScopeSchema as sn, CompositionSchema as so, declaredSeriesKind as sr, ReadinessRegistry as ss, FieldClaimModeSchema as st, ACTION_RUN_MAX_MS as t, reducePoints as ta, isSecretRefOwnedBy as tc, isVoidInput as ti, StorageCleanupJobSchema as tn, vectorStoreCapability as to, createDeviceExtensionProvider as tr, RECORD_DELETE_BATCH as ts, EMPTY_REMOTE_CONFIG as tt, ActionTargetResolver as u, resolveHubAddressRoles as ua, parseSecretRef as uc, locationIconKey as ui, actionEffect as un, HISTORY_FAST_MS as uo, deriveBatteryPresence as ur, RecordKindDeclarationSchema as us, HISTORY_CATALOG as ut, CAMSTACK_APP_LINK_ORIGIN as v, runSteps as va, secretViewsOf as vc, mediaPlayerCapability as vi, alertEpisodeId as vn, composedDeviceStableId as vo, deviceRunsCapability as vr, UnindexedFilterError as vs, KeychainAuditEntrySchema as vt, CORE_BLOCK_ADDON_PREFIX as w, settingsStoreCapability as wa, withoutCallerStamp as wc, modeForSwitch as wi, backupCapability as wn, disarmRoseMemory as wo, evaluateCompositionField as wr, assertTransactScope as ws, MINUTES_PER_DAY as wt, COMPOSED_ITEM_FIXED_FIELDS as x, scopesAllowAddon as xa, toSecretFieldView as xc, methodRefusal as xi, appendTrace as xn, compositionSliceKey as xo, enumerateInferenceDevices as xr, asJsonObject as xs, LegacyStorageLocationDefaultSchema as xt, CAP_NAMES_WITH_STATUS as y, runtimeStatePolicyFor as ya, sleep as yc, mediaPlayerFeaturesOfRoles as yi, alertEpisodePayload as yn, compositionFeatureEnabled as yo, deviceStateCapability as yr, UnknownRecordKindError as ys, KeychainResetRecordSchema as yt, DERIVED_CAMERA_SILENCED_CAP_NAMES as z, streamQualityLabel as za, parseStreamParamsFormPatch as zi, checkTemplatePayload as zn, wattMillisecondsToKwh as zo, groupCommandsCapability as zr, expandCapMethods as zs, QuantityUnitError as zt };
111813
+ export { EMPTY_AUTOMATION_STATE as $, validateSchedulerInput as $a, recordEntriesCapability as $i, coreBlocksCapability as $n, InvalidRecordError as $o, isObjectInput as $r, isReadingQuantity as $s, ServerNameSchema as $t, ControlStatusSchema as A, siteZoneKey as Aa, DeviceType as Ac, normalizeCoreBlockWrite as Ai, buildDeviceEnrollmentLink as An, helperMembers as Ao, fanControlCapability as Ar, collectSecretConfigKeys as As, PET_FOUNTAIN_WATER_KEY as At, DEVICE_ENROLLMENT_TTL_MS as B, supportedRuntimes as Ba, petFountainCapability as Bi, climateControlCapability as Bn, statisticCadenceMs as Bo, groupTemplate as Br, emitDownForOwnedCaps as Bs, RECORDING_SOURCE_CAMSTACK_ADDON as Bt, CORE_BLOCKS_ADDON_ID as C, scoreRuntimes as Ca, toNodeId as Cc, migrationsCapability as Ci, authProviderCapability as Cn, compositionItemFieldPath as Co, enumerateSchemaFields as Cr, WELL_KNOWN_TAB_MAP as Cs, MIGRATION_API_V1_METHODS as Ct, CatalogFileSchema as D, sharedColorModes as Da, withoutCallerStamp as Dc, nextOccurrence as Di, brightnessCapability as Dn, disarmRoseMemory as Do, expandContainer as Dr, assertTransactScope as Ds, MigrationLedgerEntrySchema as Dt, CalendarPreferencesSchema as E, sharedActuatorMethods as Ea, userError as Ec, motionCapability as Ei, batteryCapability as En, createStatefulExpressionMemory as Eo, evictionPolicyOfLocation as Er, asString$1 as Es, MediaPlayerStatusSchema as Et, DATABASE_SNAPSHOT_TIMEOUT_MS as F, storageMigrationCapability as Fa, occurrenceOn as Fi, canonicalIconKey as Fn, nextLocalMidnight as Fo, foldSnapshotByFunction as Fr, customAction as Fs, PowerSourceInfoSchema as Ft, DEVICE_SAN_USER_PREFIX as G, timedRunLimitOf as Ga, powerSourceCapability as Gi, composerCapability as Gn, CALLER_STAMPED_CAPABILITIES as Go, isAlertEpisodeSeverity as Gr, historyItemFieldPath as Gs, RemoteConfigSchema as Gt, DEVICE_ID_FIELD as H, switchStateOfMode as Ha, pickAppLinkHub as Hi, colorCapability as Hn, wattMillisecondsToKwh as Ho, internalActionId as Hr, expandCapMethods as Hs, ROOT_BUCKET_KEY as Ht, DATA_STORE_DATABASES as I, storageOccupancyCapability as Ia, orderMigrations as Ii, capUnitResolver as In, openReset as Io, formatDeviceRevoker as Ir, defineAddonMigrations as Is, PreferenceDeviceIdSchema as It, DeclaredDevices as J, timedRunSeconds as Ja, problemsBlockSave as Ji, consumablesCapability as Jn, DEVICE_STATUS_METHOD as Jo, isCollectionArrayMethod as Jr, isDebugChannelName as Js, STORAGE_LOCATION_MODES as Jt, DEVICE_TOMBSTONE_RETENTION_MS as K, timedRunMaxIn as Ka, powerSourceLinkOfComposition as Ki, compositionFieldKey as Kn, DATAPLANE_SECRET_HEADER as Ko, isAppLinkBase as Kr, historyUnitFor as Ks, RunningStateStatusSchema as Kt, DAY_NAMES as L, storageProviderCapability as La, parseAcceleratorFactsJson as Li, catalogueIssues as Ln, openStatistic as Lo, formatMinutes as Lr, defineCustomActions as Ls, PreferenceNamespaceSchema as Lt, CredentialTokenClaimsSchema as M, splitTranslationRef as Ma, featuresOfBoundCaps as Mc, normalizeUnit as Mi, buildStreamParamsConfigSchema as Mn, integrateReading as Mo, fanPresetsCapability as Mr, collectSecretMarkerRefs as Ms, PROPOSAL_MIN_SPAN_MS as Mt, DATABASE_SNAPSHOT_PARTIAL_SUFFIX as N, storageAdminCapability as Na, EventCategory as Nc, objectInputDeclaresAddonId as Ni, calendarsCapability as Nn, isForwardInputRef as No, featureForwards as Nr, collectZodSecretPaths as Ns, PackageRequiresSchema as Nt, ConditionMirror as O, shortHostname as Oa, DeviceFeature as Oc, normalizeActionUnits as Oi, buildActionSteps as On, evaluateDerivative as Oo, expressionContainsBuiltinCall as Or, assertValidDeclaration as Os, MigrationMetaSchema as Ot, DATABASE_SNAPSHOT_SUFFIX as P, storageCapability as Pa, objectInputDeclaresRequiredDeviceId as Pi, cameraGridLayoutCapability as Pn, isHistoryHelper as Po, filesystemBrowseCapability as Pr, createEvent as Ps, PetFountainStatusSchema as Pt, DiscoveryProposalBodySchema as Q, validateCustomAddress as Qa, ptzAutotrackCapability as Qi, coreBlockSourceKind as Qn, HISTORY_DEFAULT_MIN_INTERVAL_MS as Qo, isLocationEnabled as Qr, isKeychainStoredField as Qs, ScopedTokenSchema as Qt, DEFAULT_HOLD_OVERRIDE as R, streamCatalogCapability as Ra, parseColorInput as Ri, checkRoleAddress as Rn, planResetTier as Ro, gbToBytes as Rr, defineEntryKind as Rs, PreferenceValueSchema as Rt, COMPOSER_RUNNER_ID as S, scopesAllowDeviceCap as Sa, sleep as Sc, metricsProviderCapability as Si, armRemovalReconcile as Sn, compositionFeatureEnabled as So, enumerateItemArrayFields as Sr, UnknownRecordKindError as Ss, METHOD_ACCESS_MAP as St, CREDENTIAL_TOKEN_AUDIENCE as T, sharedActuatorFeatures as Ta, transformSecretWrite as Tc, modeMayWrite as Ti, bareAddonId as Tn, compositionSourceKey as To, evaluateWhenTree as Tr, asNumber as Ts, MOTION_CLOSE_AFTER_MS as Tt, DEVICE_NONCE_TTL_MS as U, templateCapability as Ua, planComposition as Ui, compareVersions as Un, BaseAddon as Uo, interpolate as Ur, formatSecretScope as Us, RecordingStatusSchema as Ut, DEVICE_HISTORY_ENERGY_KEY as V, switchCapability as Va, petFountainWaterItem as Vi, collectWhenMirrorSources as Vn, toExpressionValue as Vo, integrationInstancesCapability as Vr, emitReadiness as Vs, REMOTE_MEDIA_COMMANDS as Vt, DEVICE_SAN_CREDENTIAL_PREFIX as W, timedRunCapability as Wa, platformProbeCapability as Wi, compileScalarOverride as Wn, BatchTooLargeError as Wo, isAlertEpisodeOpen as Wr, getDebugInterest as Ws, RemoteAssumedStateSchema as Wt, DeviceStatusSchema as X, userManagementCapability as Xa, processTimeZoneOr as Xi, coreBlockComposition as Xn, FilterRequiredError as Xo, isDefaultAppConnectionEndpoint as Xr, isEvent as Xs, SchedulerError as Xt, DeviceRunSchema as Y, unmetRequirements as Ya, procedureAuthKey as Yi, coreBlockAddonId as Yn, DeclarationRefusedError as Yo, isCredentialTokenPayload as Yr, isDeviceConfigCap as Ys, STREAM_PROFILE_META as Yt, DeviceTombstoneSchema as Z, validateComposition as Za, proposeRunningThreshold as Zi, coreBlockIdFromAddonId as Zn, ForeignSecretMarkerError as Zo, isInternalActionId as Zr, isInstanceEnabled as Zs, SchedulerSchema as Zt, CAMERA_SWITCH_ORDER as _, runFanOut as _a, resolveSecretMarkers as _c, mayWriteToLocation as _i, addonWidgetsCapability as _n, MINUTE_MS as _o, deviceRemovalHookCapability as _r, RevConflictError as _s, KEYCHAIN_RESET_TRIGGER_ACTOR as _t, AGENT_MDNS_SERVICE_TYPE as a, resolveActionVariables as aa, makeSecretMarker as ac, legacyAutoLinkIds as ai, SwitchStatusSchema as an, weekdayOfLocalDate as ao, databaseSnapshotCapability as ar, RECORD_SECRET_COLLECTION_PREFIX as as, FanDirectionSchema as at, CATALOG_LANGS as b, schedulersCapability as ba, secretTreeFromSchema as bc, memoizePinnedFfmpeg as bi, alertsCapability as bn, composedDeviceRef as bo, deviceStatusCapability as br, TransactRefusedError as bs, LOG_LEVEL_RANK as bt, ActionError as c, resolveCoreBlockEntry as ca, nodePin as cc, localDateOf as ci, UNATTRIBUTED_BUCKET_KEY as cn, zoneOnlySite as co, decodeVectorBase64 as cr, REMOVE_LEAF as cs, FieldClaimSchema as ct, ActionVariableSchema as d, resolveLocationMode as da, parseJsonObject as dc, lockControlCapability as di, actionSourceCapability as dn, DAY_MS as do, describeComposableCaps as dr, ReadinessTimeoutError as ds, HISTORY_ITEM_CATALOG as dt, recordsCapability as ea, isSecretClear as ec, isSameAddonId as ei, SsoBridgeClaimsSchema as en, valveCapability as eo, coverCapability as er, NoCallerError as es, EMPTY_REMOTE_ASSUMED_STATE as et, AlertSchema as f, resolveMethodAuth as fa, parseJsonUnknown as fc, lockDoorLinkOfComposition as fi, actionWaitTotalMs as fn, DEFAULT_HISTORY_RETENTION as fo, describeUnmet as fr, RecordIntegrationInstances as fs, HUB_MDNS_SERVICE_TYPE as ft, BatteryStatusSchema as g, resolveStepArgs as ga, resolveCapMount as gc, mayReadLocation as gi, addonSettingsCapability as gn, HelperMemberSchema as go, deviceManagerCapability as gr, RecordUniqueViolationError as gs, INTERNAL_ACTION_PREFIX as gt, BaseDevice as h, resolveRunnerId as ha, recordSecretRef as hc, looseSchema as hi, addonPagesCapability as hn, HOUR_MS as ho, deviceHistoryCapability as hr, RecordTooLargeError as hs, IDLE_ACTION_STATUS as ht, ACTUATOR_TEMPLATE_IDS as i, replacedFieldKeys as ia, isSecretRefOwnedBy as ic, keychainCapability as ii, StorageMigrationJobSchema as in, vocabActionIdFor as io, dataStoreProviderCapability as ir, RECORD_DELETE_BATCH as is, FanControlStatusSchema as it, CoreBlockSchema as j, snapshotCapability as ja, errMsg as jc, normalizeStepTargets as ji, buildDeviceSignatureMessage as jn, historyRetentionFromSettings as jo, fanOutTargets as jr, collectSecretLeaves as js, PREFERENCES_MAX_VALUE_BYTES as jt, ConsumableItemSchema as k, siteFor as ka, DeviceRole as kc, normalizeCapStep as ki, buildCapabilityLookup as kn, evaluateStatistic as ko, extractNestedAddonId as kr, buildSecretRef as ks, NetworkTunnelStartedDataSchema as kt, ActionStepSchema as l, resolveCoreBlockFiles as la, normalizeNodeId as lc, localNetworkCapability as li, UserRecordSchema as ln, COMPOSER_ADDON_ID as lo, defineExtensionSlotProvider as lr, RUNTIME_DEFAULTS as ls, GroupCommandResultSchema as lt, BUILTIN_REMOTE_COMPONENTS as m, resolveNotificationTapAddress as ma, readinessKey as mc, logLevelAtMost as mi, addonIdOfActionId as mn, HISTORY_SLOW_MS as mo, deviceExtensionCapability as mr, RecordNotFoundError as ms, HvacModeSchema as mt, ACTION_TARGET_INVALIDATION_EVENTS as n, remoteCapability as na, isSecretMarker as nc, kebabToCamel as ni, StorageLocationModeSchema as nn, vectorIndexDimConflictError as no, customKeyOfRole as nr, RECORD_BATCH_MAX as ns, FAN_CAPTURE_FIELDS as nt, AGENT_MDNS_TXT_KEYS as o, resolveAppConnections as oa, mapSecretLeaves as oc, legacyModeOf as oi, TemplateKindSchema as on, withDefaultRunning as oo, declarationOwnerNodeId as or, RECORD_SWEEP_INTERVAL_MS as os, FanPresetSchema as ot, AutomationStateDocSchema as p, resolveMutate as pa, parseSecretRef as pc, logDestinationCapability as pi, actionsCapability as pn, HISTORY_FAST_MS as po, deviceCredentialsCapability as pr, RecordKindDeclarationSchema as ps, HUB_MDNS_TXT_KEYS as pt, DataStoreDatabaseSchema as q, timedRunQuickRun as qa, preconditionOf as qi, compositionSourceRefs as qn, DEVICE_SETTINGS_CONTRIBUTION_METHODS as qo, isArrayOutputSchema as qr, hydrateSchema as qs, STORAGE_ACCESS_FALLBACK as qt, ACTUATOR_METHODS as r, remoteLayoutComponentsCapability as ra, isSecretMarkerLike as rc, keychainAdminCapability as ri, StorageLocationTypeSchema as rn, vectorStoreCapability as ro, customRole as rr, RECORD_BATCH_MAX_BYTES as rs, FIRST_LEVEL_MACRO_CLASSES as rt, ALL_CAPABILITY_DEFINITIONS as s, resolveBucketMs as sa, nodeIdOfScopedKey as sc, lifecycleJobSchema as si, TokenScopeSchema as sn, withLocationMode as so, declaredSeriesKind as sr, REDACTED_SECRET as ss, FieldClaimModeSchema as st, ACTION_RUN_MAX_MS as t, reducePoints as ta, isSecretFieldView as tc, isVoidInput as ti, StorageCleanupJobSchema as tn, vectorDimFromBase64 as to, createDeviceExtensionProvider as tr, PlaintextSecretError as ts, EMPTY_REMOTE_CONFIG as tt, ActionTargetResolver as u, resolveHubAddressRoles as ua, normalizeSecretOwner as uc, locationIconKey as ui, actionEffect as un, CompositionSchema as uo, deriveBatteryPresence as ur, ReadinessRegistry as us, HISTORY_CATALOG as ut, CAMSTACK_APP_LINK_ORIGIN as v, runSteps as va, scopeKey as vc, mediaPlayerCapability as vi, alertEpisodeId as vn, buildFfmpegArgs as vo, deviceRunsCapability as vr, SECRET_CLEAR as vs, KeychainAuditEntrySchema as vt, CORE_BLOCK_ADDON_PREFIX as w, settingsStoreCapability as wa, toSecretFieldView as wc, modeForSwitch as wi, backupCapability as wn, compositionSliceKey as wo, evaluateCompositionField as wr, asJsonObject as ws, MINUTES_PER_DAY as wt, COMPOSED_ITEM_FIXED_FIELDS as x, scopesAllowAddon as xa, secretViewsOf as xc, methodRefusal as xi, appendTrace as xn, composedDeviceStableId as xo, enumerateInferenceDevices as xr, UnindexedFilterError as xs, LegacyStorageLocationDefaultSchema as xt, CAP_NAMES_WITH_STATUS as y, runtimeStatePolicyFor as ya, secretTreeFromPaths as yc, mediaPlayerFeaturesOfRoles as yi, alertEpisodePayload as yn, cloneStatefulExpressionMemory as yo, deviceStateCapability as yr, StoredRecordKindDeclarationSchema as ys, KeychainResetRecordSchema as yt, DERIVED_CAMERA_SILENCED_CAP_NAMES as z, streamQualityLabel as za, parseStreamParamsFormPatch as zi, checkTemplatePayload as zn, planStatisticTier as zo, groupCommandsCapability as zr, defineRecordKinds as zs, QuantityUnitError as zt };