@camstack/server 1.2.802 → 1.2.803

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 (90) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/api/trpc/generated-cap-routers.js +18 -0
  3. package/package.json +9 -10
  4. package/system/dist/{agent-https-CfPGbJ21.mjs → agent-https-BRfJO9ZR.mjs} +1 -1
  5. package/system/dist/{agent-https-CzMpclQr.js → agent-https-DtYiXPGm.js} +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/composer.addon.js +6 -5
  21. package/system/dist/builtins/composer/composer.addon.mjs +6 -5
  22. package/system/dist/builtins/console-logging/index.js +1 -1
  23. package/system/dist/builtins/console-logging/index.mjs +1 -1
  24. package/system/dist/builtins/core-blocks/core-blocks.addon.js +65 -6
  25. package/system/dist/builtins/core-blocks/core-blocks.addon.mjs +65 -6
  26. package/system/dist/builtins/core-blocks/timed-run/timed-run-service.d.ts +17 -0
  27. package/system/dist/builtins/core-blocks/timed-run/timed-run-wiring.d.ts +6 -0
  28. package/system/dist/builtins/device-history/device-history.addon.js +2 -2
  29. package/system/dist/builtins/device-history/device-history.addon.mjs +2 -2
  30. package/system/dist/builtins/device-manager/device-config-contribution.d.ts +1 -0
  31. package/system/dist/builtins/device-manager/device-manager.addon.js +47 -2
  32. package/system/dist/builtins/device-manager/device-manager.addon.mjs +47 -2
  33. package/system/dist/builtins/device-manager/timed-run-config-schema.d.ts +18 -0
  34. package/system/dist/builtins/hub-forwarder/index.js +1 -1
  35. package/system/dist/builtins/hub-forwarder/index.mjs +1 -1
  36. package/system/dist/builtins/keychain/index.js +4 -4
  37. package/system/dist/builtins/keychain/index.mjs +4 -4
  38. package/system/dist/builtins/liveness-monitor/liveness-monitor.addon.js +1 -1
  39. package/system/dist/builtins/liveness-monitor/liveness-monitor.addon.mjs +1 -1
  40. package/system/dist/builtins/local-auth/local-auth.addon.js +2 -2
  41. package/system/dist/builtins/local-auth/local-auth.addon.mjs +2 -2
  42. package/system/dist/builtins/local-network/local-network.addon.js +2 -2
  43. package/system/dist/builtins/local-network/local-network.addon.mjs +2 -2
  44. package/system/dist/builtins/loki-logging/index.js +1 -1
  45. package/system/dist/builtins/loki-logging/index.mjs +1 -1
  46. package/system/dist/builtins/native-metrics/native-metrics.addon.js +1 -1
  47. package/system/dist/builtins/native-metrics/native-metrics.addon.mjs +1 -1
  48. package/system/dist/builtins/platform-probe/index.js +1 -1
  49. package/system/dist/builtins/platform-probe/index.mjs +1 -1
  50. package/system/dist/builtins/record-entries/index.js +1 -1
  51. package/system/dist/builtins/record-entries/index.mjs +1 -1
  52. package/system/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.js +1 -1
  53. package/system/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.mjs +1 -1
  54. package/system/dist/builtins/snapshot/index.js +1 -1
  55. package/system/dist/builtins/snapshot/index.mjs +1 -1
  56. package/system/dist/builtins/sqlite-storage/filesystem-storage.addon.js +1 -1
  57. package/system/dist/builtins/sqlite-storage/filesystem-storage.addon.mjs +1 -1
  58. package/system/dist/builtins/sqlite-storage/index.js +1 -1
  59. package/system/dist/builtins/sqlite-storage/index.mjs +1 -1
  60. package/system/dist/builtins/sqlite-storage/sqlite-settings.addon.js +3 -3
  61. package/system/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +3 -3
  62. package/system/dist/builtins/storage-orchestrator/storage-orchestrator.addon.js +1 -1
  63. package/system/dist/builtins/storage-orchestrator/storage-orchestrator.addon.mjs +1 -1
  64. package/system/dist/builtins/system-config/system-config.addon.js +3 -3
  65. package/system/dist/builtins/system-config/system-config.addon.mjs +284 -284
  66. package/system/dist/builtins/winston-logging/index.js +1 -1
  67. package/system/dist/builtins/winston-logging/index.mjs +1 -1
  68. package/system/dist/{capture-engine-CJxojquW.mjs → capture-engine-BFgeAHa9.mjs} +1 -1
  69. package/system/dist/{capture-engine-Us8Ocffb.js → capture-engine-BQ08XTnZ.js} +1 -1
  70. package/system/dist/{composition-sources-D2z7D7bY.js → composition-sources-DNHNUvTr.js} +1 -1
  71. package/system/dist/{composition-sources-DcsjjTIu.mjs → composition-sources-DkOfzgpS.mjs} +1 -1
  72. package/system/dist/{constants-BOMAH5bO.js → constants-D5CG3Gvc.js} +1 -1
  73. package/system/dist/{constants-DVqHyOzQ.mjs → constants-GCrIKhD_.mjs} +1 -1
  74. package/system/dist/{device-ca-NlhUUsex.js → device-ca-DgZeLVC1.js} +1 -1
  75. package/system/dist/{device-ca-zAWpen18.mjs → device-ca-Dk2sx_18.mjs} +1 -1
  76. package/system/dist/{dist-BccX5DOW.js → dist-D5nGm8Sd.js} +571 -372
  77. package/system/dist/{dist-DYrP8WdD.mjs → dist-ze-qVU7x.mjs} +554 -373
  78. package/system/dist/file-host-worker.js +1 -1
  79. package/system/dist/file-host-worker.mjs +1 -1
  80. package/system/dist/{hub-mdns-ciao-DpRlDWJY.js → hub-mdns-ciao-D4g9qsNL.js} +2 -2
  81. package/system/dist/{hub-mdns-ciao-BleXDm2r.mjs → hub-mdns-ciao-DD2QP3w5.mjs} +2 -2
  82. package/system/dist/index.js +16 -10
  83. package/system/dist/index.mjs +16 -10
  84. package/system/dist/{legacy-integration-rows-door-BUyPyv8f.mjs → legacy-integration-rows-door-BvEFQrAa.mjs} +1 -1
  85. package/system/dist/{legacy-integration-rows-door-D2ZrX431.js → legacy-integration-rows-door-MRr8Ncb_.js} +1 -1
  86. package/system/dist/{restore-archive-B1PE_1S2.mjs → restore-archive-DBc5sNQS.mjs} +82 -82
  87. package/system/dist/{restore-archive-DMUCmY3H.js → restore-archive-aG7OlQNo.js} +1 -1
  88. package/system/dist/{wal-maintenance-CmNAtKgj.js → wal-maintenance-C-ddHy-q.js} +0 -0
  89. package/system/dist/{wal-maintenance-Ce71BVDk.mjs → wal-maintenance-vQHsOLGg.mjs} +0 -0
  90. package/system/package.json +1 -1
@@ -1188,7 +1188,7 @@ var DeviceRole = /* @__PURE__ */ function(DeviceRole) {
1188
1188
  return DeviceRole;
1189
1189
  }({});
1190
1190
  //#endregion
1191
- //#region ../types/dist/sleep-B_dgCAyx.mjs
1191
+ //#region ../types/dist/sleep-D4UJY10i.mjs
1192
1192
  /**
1193
1193
  * The audio chunk plane's byte format, and the ONE expansion from a coded
1194
1194
  * window to float samples (D455).
@@ -8779,13 +8779,25 @@ Object.freeze({
8779
8779
  "path": "temperature",
8780
8780
  "valueType": "number"
8781
8781
  }],
8782
- "timed-run": [{
8783
- "path": "activeUntil",
8784
- "valueType": "number"
8785
- }, {
8786
- "path": "requestedBy",
8787
- "valueType": "string"
8788
- }],
8782
+ "timed-run": [
8783
+ {
8784
+ "path": "activeUntil",
8785
+ "valueType": "number"
8786
+ },
8787
+ {
8788
+ "path": "requestedBy",
8789
+ "valueType": "string"
8790
+ },
8791
+ {
8792
+ "path": "quickRun.duration",
8793
+ "valueType": "number"
8794
+ },
8795
+ {
8796
+ "path": "quickRun.unit",
8797
+ "valueType": "enum",
8798
+ "enumValues": ["s", "min"]
8799
+ }
8800
+ ],
8789
8801
  "update": [
8790
8802
  {
8791
8803
  "path": "currentVersion",
@@ -54952,8 +54964,9 @@ function planComposition(composition, lookupCap, target) {
54952
54964
  }, lookupCap, servedCommands));
54953
54965
  }
54954
54966
  const result = planFeature(feature, index, featureTarget, lookupCap, servedCommands);
54955
- return compositionFeatureEnabled(feature) ? result : {
54956
- problems: result.problems,
54967
+ if (compositionFeatureEnabled(feature)) return result;
54968
+ return {
54969
+ problems: Object.keys(feature.fields).length === 0 ? result.problems.filter((p) => p.code !== "missing-field") : result.problems,
54957
54970
  fields: [],
54958
54971
  features: [],
54959
54972
  events: []
@@ -85734,93 +85747,27 @@ var RunningFlipEventDataSchema = z.object({
85734
85747
  phase: z.string().nullable()
85735
85748
  });
85736
85749
  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
- };
85750
+ /**
85751
+ * Customize offers "running" only where a job makes sense (D933): a cycle,
85752
+ * a clean, a mow, playback, or another appliance that is on and working.
85753
+ * The cap itself stays on every type — a camera can still report running
85754
+ * natively; it just has no card.
85755
+ */
85756
+ var RUNNING_CUSTOMIZE_DEVICE_TYPES = [
85757
+ DeviceType.Washer,
85758
+ DeviceType.Dryer,
85759
+ DeviceType.Dishwasher,
85760
+ DeviceType.Vacuum,
85761
+ DeviceType.LawnMower,
85762
+ DeviceType.MediaPlayer,
85763
+ DeviceType.WaterHeater,
85764
+ DeviceType.Humidifier,
85765
+ DeviceType.Fan,
85766
+ DeviceType.Climate,
85767
+ DeviceType.Thermostat,
85768
+ DeviceType.PetFeeder,
85769
+ DeviceType.Heater
85770
+ ];
85824
85771
  var runningStateCapability = {
85825
85772
  name: "running-state",
85826
85773
  scope: "device",
@@ -85840,7 +85787,78 @@ var runningStateCapability = {
85840
85787
  durability: "restored",
85841
85788
  history: { fields: { running: { kind: "boolean" } } },
85842
85789
  volatileStateFields: ["lastFetchedAt"],
85843
- customize: runningCustomize
85790
+ customize: {
85791
+ version: 1,
85792
+ overridable: [{
85793
+ path: "running",
85794
+ by: "running"
85795
+ }],
85796
+ targets: [{
85797
+ id: "running",
85798
+ cardinality: "scalar",
85799
+ vocabulary: {
85800
+ cap: "running-state",
85801
+ stateField: "running"
85802
+ },
85803
+ deviceTypes: RUNNING_CUSTOMIZE_DEVICE_TYPES,
85804
+ apply: "add",
85805
+ path: "running",
85806
+ sources: [
85807
+ {
85808
+ kind: "switch",
85809
+ transforms: [{ kind: "identity" }]
85810
+ },
85811
+ {
85812
+ kind: "binary",
85813
+ transforms: [{ kind: "identity" }, { kind: "invert" }]
85814
+ },
85815
+ {
85816
+ kind: "numeric",
85817
+ requiredUnit: "W",
85818
+ transforms: [{
85819
+ kind: "threshold",
85820
+ comparisons: ["gte", "lte"],
85821
+ comparison: "gte",
85822
+ defaultThreshold: 5,
85823
+ defaultStartDwellMs: RUNNING_POWER_START_DELAY_MS,
85824
+ defaultStopDwellMs: RUNNING_POWER_STOP_DELAY_MS,
85825
+ thresholdUnit: "W"
85826
+ }]
85827
+ }
85828
+ ],
85829
+ companions: [
85830
+ {
85831
+ kind: "constant",
85832
+ path: "source",
85833
+ value: "assigned",
85834
+ when: "always"
85835
+ },
85836
+ {
85837
+ kind: "constant",
85838
+ path: "phase",
85839
+ value: null,
85840
+ when: "add"
85841
+ },
85842
+ {
85843
+ kind: "clock",
85844
+ path: "lastFetchedAt",
85845
+ when: "always"
85846
+ },
85847
+ {
85848
+ kind: "transition-time",
85849
+ path: "since",
85850
+ sourceChangedAt: "prefer"
85851
+ }
85852
+ ],
85853
+ sourceReport: {
85854
+ status: "assignment-status",
85855
+ runtimeField: "source",
85856
+ nativeValue: "native",
85857
+ assignedValue: "assigned"
85858
+ },
85859
+ advancedExpression: true
85860
+ }]
85861
+ }
85844
85862
  };
85845
85863
  /**
85846
85864
  * scene-monitor — device-scoped reference-region state cap. An operator marks
@@ -89511,12 +89529,14 @@ var TIMED_RUN_LIMITS = {
89511
89529
  [DeviceType.Heater]: {
89512
89530
  actuator: "switch",
89513
89531
  maxSeconds: 10800,
89514
- unit: "min"
89532
+ unit: "min",
89533
+ quickRunDefault: 30
89515
89534
  },
89516
89535
  [DeviceType.PetFountain]: {
89517
89536
  actuator: "pet-fountain",
89518
89537
  maxSeconds: 300,
89519
- unit: "s"
89538
+ unit: "s",
89539
+ quickRunDefault: 60
89520
89540
  }
89521
89541
  };
89522
89542
  var TIMED_RUN_DEVICE_TYPES = [DeviceType.Heater, DeviceType.PetFountain];
@@ -89527,6 +89547,27 @@ function timedRunLimitOf(deviceType) {
89527
89547
  function timedRunSeconds(duration, unit) {
89528
89548
  return unit === "min" ? duration * 60 : duration;
89529
89549
  }
89550
+ /** The longest run of a limit, in the unit the operator thinks of it in. */
89551
+ function timedRunMaxIn(limit) {
89552
+ return limit.unit === "min" ? Math.floor(limit.maxSeconds / 60) : limit.maxSeconds;
89553
+ }
89554
+ /** One duration, as the one-tap run asks for it. */
89555
+ var TimedRunQuickRunSchema = z.object({
89556
+ duration: z.number().positive().finite(),
89557
+ unit: TimedRunUnitSchema
89558
+ });
89559
+ /**
89560
+ * The one-tap run of a device: the duration the operator stored for it, else the
89561
+ * type's default, never above the type's maximum. A stored value that is not a
89562
+ * usable number is the default (a hand-edited row never breaks the button).
89563
+ */
89564
+ function timedRunQuickRun(limit, stored) {
89565
+ const max = timedRunMaxIn(limit);
89566
+ return {
89567
+ duration: Math.min((stored !== null && Number.isFinite(stored) && stored > 0 ? stored : null) ?? limit.quickRunDefault, max),
89568
+ unit: limit.unit
89569
+ };
89570
+ }
89530
89571
  /** Why a request was not carried out. Typed, so a caller can say it in words. */
89531
89572
  var TimedRunRefusalSchema = z.enum([
89532
89573
  "unsupported-device",
@@ -89547,8 +89588,23 @@ var TimedRunStatusSchema = z.object({
89547
89588
  activeUntil: z.number().nullable(),
89548
89589
  /** Who asked for the run (a user id or an addon id); `null` when nothing is armed or it did not say. */
89549
89590
  requestedBy: z.string().nullable(),
89591
+ /**
89592
+ * The one-tap run of THIS device: what a "Run" button on any surface starts. `null` when
89593
+ * the device is gone or its type has no timed run; a status from before this field
89594
+ * existed has none, and a surface falls back to the type's default.
89595
+ */
89596
+ quickRun: TimedRunQuickRunSchema.nullable(),
89550
89597
  lastFetchedAt: z.number()
89551
89598
  });
89599
+ /** What the settings form needs: the unit, the bounds and the type's default. */
89600
+ var TimedRunOptionsSchema = z.object({
89601
+ unit: TimedRunUnitSchema,
89602
+ /** The longest run, in `unit`. */
89603
+ maxDuration: z.number(),
89604
+ defaultDuration: z.number()
89605
+ });
89606
+ /** The one-tap run duration, in the type's unit; `null` returns to the type's default. */
89607
+ var TimedRunSettingsPatchSchema = z.object({ quickRunDuration: z.number().positive().finite().nullable().optional() });
89552
89608
  var timedRunCapability = {
89553
89609
  name: "timed-run",
89554
89610
  scope: "device",
@@ -89556,7 +89612,24 @@ var timedRunCapability = {
89556
89612
  kind: "wrapper",
89557
89613
  defaultActive: true,
89558
89614
  deviceTypes: TIMED_RUN_DEVICE_TYPES,
89615
+ deviceConfig: { ui: {
89616
+ kind: "derived-form",
89617
+ builderId: "timed-run",
89618
+ tab: "general"
89619
+ } },
89559
89620
  methods: {
89621
+ getOptions: method(z.object({ deviceId: z.number().int() }), TimedRunOptionsSchema),
89622
+ /**
89623
+ * The one-tap run of this device. A duration above the type's maximum is
89624
+ * REFUSED (thrown), like `runFor`: the maximum is a safety bound.
89625
+ */
89626
+ setSettings: method(z.object({
89627
+ deviceId: z.number().int(),
89628
+ settings: TimedRunSettingsPatchSchema
89629
+ }), z.void(), {
89630
+ kind: "mutation",
89631
+ auth: "admin"
89632
+ }),
89560
89633
  /**
89561
89634
  * Turn the device on and arm its off. A run already armed is replaced (the
89562
89635
  * new deadline wins). Refuses with a typed reason above the type's maximum.
@@ -94133,255 +94206,6 @@ function evaluateAggregate(input) {
94133
94206
  counts
94134
94207
  };
94135
94208
  }
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
94209
  function fromRead(source, cap, fieldPath) {
94386
94210
  return {
94387
94211
  kind: "from",
@@ -94400,17 +94224,16 @@ function expression(expr, bindings) {
94400
94224
  function literal(expr) {
94401
94225
  return expression(expr, {});
94402
94226
  }
94403
- String.raw`rose\(active(\d+), changed(\d+), (\d+(?:\.\d+)?)\)`;
94404
- var catalog$4 = CAP_CUSTOMIZE_CATALOG;
94227
+ var catalog$5 = CAP_CUSTOMIZE_CATALOG;
94405
94228
  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");
94229
+ const target = catalogTarget$4(input.draft.cap, input.draft.targetId);
94230
+ if (target === null || target.cardinality !== "scalar" || target.path === void 0) return fail$2("target");
94231
+ if (input.draft.transform.kind === "enum-map") return fail$2("enum");
94409
94232
  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");
94233
+ if (source === null) return fail$2("source-kind");
94234
+ if (source.requiredUnit !== void 0 && input.sourceUnit !== source.requiredUnit) return fail$2("unit");
94412
94235
  const allowed = input.draft.transform.kind === "number" ? "identity" : input.draft.transform.kind;
94413
- if (!source.transformKinds.includes(allowed)) return fail$1("transform");
94236
+ if (!source.transformKinds.includes(allowed)) return fail$2("transform");
94414
94237
  if (target.override !== void 0) return compileOverride(input, target.path, target.override);
94415
94238
  const value = compileValue$1(input);
94416
94239
  if (!value.ok) return value;
@@ -94431,7 +94254,7 @@ function compileScalarOverride(input) {
94431
94254
  * companion — the native slice keeps its own clock.
94432
94255
  */
94433
94256
  function compileOverride(input, path, rule) {
94434
- if (input.sourceValueKind !== "boolean" || input.draft.transform.kind !== "identity") return fail$1("source-kind");
94257
+ if (input.sourceValueKind !== "boolean" || input.draft.transform.kind !== "identity") return fail$2("source-kind");
94435
94258
  const read = fromRead(refOf$1(input.draft), input.draft.source.cap, input.draft.source.fieldPath);
94436
94259
  const field = expression(overrideExpr(rule.whenSourceTrue, rule.unlessNative), {
94437
94260
  x: read,
@@ -94446,14 +94269,14 @@ function compileOverride(input, path, rule) {
94446
94269
  }
94447
94270
  };
94448
94271
  }
94449
- function fail$1(reason) {
94272
+ function fail$2(reason) {
94450
94273
  return {
94451
94274
  ok: false,
94452
94275
  reason
94453
94276
  };
94454
94277
  }
94455
- function catalogTarget$3(cap, targetId) {
94456
- const entry = catalog$4[cap];
94278
+ function catalogTarget$4(cap, targetId) {
94279
+ const entry = catalog$5[cap];
94457
94280
  if (entry === void 0) return null;
94458
94281
  return entry.targets.find((target) => target.id === targetId) ?? null;
94459
94282
  }
@@ -94474,7 +94297,7 @@ function compileValue$1(input) {
94474
94297
  value: identityValue(read, input.sourceValueKind)
94475
94298
  };
94476
94299
  if (transform.kind === "invert") {
94477
- if (input.sourceValueKind !== "boolean") return fail$1("source-kind");
94300
+ if (input.sourceValueKind !== "boolean") return fail$2("source-kind");
94478
94301
  return {
94479
94302
  ok: true,
94480
94303
  value: expression("!x", { x: read })
@@ -94482,7 +94305,7 @@ function compileValue$1(input) {
94482
94305
  }
94483
94306
  if (transform.kind === "threshold") return thresholdValue(transform, read, transform.minSamples ?? evidenceSamples(input));
94484
94307
  if (transform.kind === "linear") return linearValue$1(transform, read, input.sourceValueKind);
94485
- return fail$1("transform");
94308
+ return fail$2("transform");
94486
94309
  }
94487
94310
  function identityValue(read, valueKind) {
94488
94311
  if (valueKind === "string") return expression("number(x)", { x: read });
@@ -94504,10 +94327,10 @@ function defaultThresholdSamples(cap, targetId, sourceCap) {
94504
94327
  }
94505
94328
  function thresholdValue(transform, read, minSamples) {
94506
94329
  const threshold = unsignedToken(transform.threshold);
94507
- if (threshold === null) return fail$1("threshold");
94330
+ if (threshold === null) return fail$2("threshold");
94508
94331
  const start = unsignedToken(transform.startDwellMs);
94509
94332
  const stop = unsignedToken(transform.stopDwellMs);
94510
- if (start === null || stop === null) return fail$1("dwell");
94333
+ if (start === null || stop === null) return fail$2("dwell");
94511
94334
  return {
94512
94335
  ok: true,
94513
94336
  value: expression(dwellExpr(transform.comparison, threshold, start, stop, minSamples), { x: read })
@@ -94516,7 +94339,7 @@ function thresholdValue(transform, read, minSamples) {
94516
94339
  function linearValue$1(transform, read, valueKind) {
94517
94340
  const scale = signedToken(transform.scale);
94518
94341
  const offset = signedToken(transform.offset);
94519
- if (scale === null || offset === null) return fail$1("scale");
94342
+ if (scale === null || offset === null) return fail$2("scale");
94520
94343
  const clamps = clampTokens$1(transform.clampMin, transform.clampMax);
94521
94344
  if (!clamps.ok) return clamps;
94522
94345
  return {
@@ -94532,10 +94355,10 @@ function clampTokens$1(clampMin, clampMax) {
94532
94355
  max: null
94533
94356
  }
94534
94357
  };
94535
- if (clampMin === void 0 || clampMax === void 0) return fail$1("clamp");
94358
+ if (clampMin === void 0 || clampMax === void 0) return fail$2("clamp");
94536
94359
  const min = signedToken(clampMin);
94537
94360
  const max = signedToken(clampMax);
94538
- if (min === null || max === null || clampMin > clampMax) return fail$1("clamp");
94361
+ if (min === null || max === null || clampMin > clampMax) return fail$2("clamp");
94539
94362
  return {
94540
94363
  ok: true,
94541
94364
  value: {
@@ -94545,7 +94368,7 @@ function clampTokens$1(clampMin, clampMax) {
94545
94368
  };
94546
94369
  }
94547
94370
  function compileCompanions$1(input, target, value) {
94548
- if (target.path === void 0) return fail$1("target");
94371
+ if (target.path === void 0) return fail$2("target");
94549
94372
  const path = target.path;
94550
94373
  return (target.companions ?? []).filter((companion) => companionIncluded$1(companion, input.apply)).reduce((acc, companion) => {
94551
94374
  if (!acc.ok) return acc;
@@ -94573,7 +94396,7 @@ function companionIncluded$1(companion, apply) {
94573
94396
  function companionField(input, path, companion, value) {
94574
94397
  if (companion.kind === "constant") {
94575
94398
  const expr = constantExpr(companion.value);
94576
- if (expr === null) return fail$1("scale");
94399
+ if (expr === null) return fail$2("scale");
94577
94400
  return {
94578
94401
  ok: true,
94579
94402
  value: literal(expr)
@@ -94591,7 +94414,7 @@ function transitionField(input, path, sourceChangedAt, value) {
94591
94414
  value: fromRead(refOf$1(input.draft), input.draft.source.cap, input.changedAtField)
94592
94415
  };
94593
94416
  if (input.apply === "replace") return stampOfValue(value);
94594
- if (!isIdentifier(path)) return fail$1("transform");
94417
+ if (!isIdentifier(path)) return fail$2("transform");
94595
94418
  const bindings = { [path]: fromRead(input.device, input.draft.cap, path) };
94596
94419
  return {
94597
94420
  ok: true,
@@ -94607,7 +94430,7 @@ function stampOfValue(value) {
94607
94430
  ok: true,
94608
94431
  value: expression("latchedAt(x)", { x: value })
94609
94432
  };
94610
- return fail$1("transform");
94433
+ return fail$2("transform");
94611
94434
  }
94612
94435
  function refOf$1(draft) {
94613
94436
  return {
@@ -94615,6 +94438,340 @@ function refOf$1(draft) {
94615
94438
  stableId: draft.source.stableId
94616
94439
  };
94617
94440
  }
94441
+ /**
94442
+ * Switch on = device on (D933, amended): a device with an ACTUATOR switch - its
94443
+ * own `switch`, the one that turns its function on - runs while that switch is on.
94444
+ * A SUPPLY switch (`power-source.switchOn`, an appliance on a plug) is never a
94445
+ * running source: the appliance keeps its power while it is idle.
94446
+ *
94447
+ * The default is derived from STRUCTURE (an actuator switch is present and no
94448
+ * supply relation is), computed at plan time and never written into the stored
94449
+ * composition: a stored composition is never rewritten silently, and an
94450
+ * authored `running` field always wins. The operator turns the default on and
94451
+ * off in the Customize running row ("Follow the device's switch").
94452
+ */
94453
+ var RUNNING_CAP = "running-state";
94454
+ var SWITCH_CAP = "switch";
94455
+ var ON_FIELD = "on";
94456
+ var CHANGED_AT_FIELD = "lastChangedAt";
94457
+ function fieldsFeatureOf(composition, cap) {
94458
+ const feature = composition.features.find((f) => f.cap === cap);
94459
+ return feature !== void 0 && feature.kind === "fields" ? feature : null;
94460
+ }
94461
+ /** The device switch the composed `switch.on` reads, when it is one plain `from` of a switch. */
94462
+ function actuatorSwitchRead(composition) {
94463
+ const feature = fieldsFeatureOf(composition, SWITCH_CAP);
94464
+ if (feature === null || !compositionFeatureEnabled(feature)) return null;
94465
+ const field = feature.fields[ON_FIELD];
94466
+ if (field === void 0 || field.kind !== "from" || field.cap !== SWITCH_CAP) return null;
94467
+ return {
94468
+ source: field.source,
94469
+ cap: field.cap,
94470
+ fieldPath: field.fieldPath
94471
+ };
94472
+ }
94473
+ function hasSupplyRelation(composition) {
94474
+ const feature = fieldsFeatureOf(composition, "power-source");
94475
+ return feature !== null && compositionFeatureEnabled(feature) && feature.fields["switchOn"] !== void 0;
94476
+ }
94477
+ /** Anything stored for running - a rule, or the opt-out - is the operator's, and the default stays out of it. */
94478
+ function hasAuthoredRunning(composition) {
94479
+ return fieldsFeatureOf(composition, RUNNING_CAP) !== null;
94480
+ }
94481
+ /** A NEW device of a type that offers "running", with an actuator switch and no supply relation. */
94482
+ function actuatorSwitchDrivesRunning(composition) {
94483
+ const target = composition.target;
94484
+ if (target.kind !== "new") return false;
94485
+ if (!RUNNING_CUSTOMIZE_DEVICE_TYPES.some((type) => type === target.type)) return false;
94486
+ return actuatorSwitchRead(composition) !== null && !hasSupplyRelation(composition);
94487
+ }
94488
+ /** The `running-state` feature that reads the actuator switch: the one the scalar compiler stores. */
94489
+ function followSwitchRunningFeature(composition, host) {
94490
+ const read = actuatorSwitchRead(composition);
94491
+ if (read === null) return null;
94492
+ const compiled = compileScalarOverride({
94493
+ draft: {
94494
+ kind: "scalar",
94495
+ cap: RUNNING_CAP,
94496
+ targetId: "running",
94497
+ source: {
94498
+ ...read.source,
94499
+ cap: read.cap,
94500
+ fieldPath: read.fieldPath
94501
+ },
94502
+ transform: { kind: "identity" }
94503
+ },
94504
+ device: host,
94505
+ apply: "add",
94506
+ sourceValueKind: "boolean",
94507
+ changedAtField: CHANGED_AT_FIELD,
94508
+ sourceUnit: null
94509
+ });
94510
+ return compiled.ok ? compiled.value : null;
94511
+ }
94512
+ /**
94513
+ * The composition the composer PLANS: the stored one, plus the derived running
94514
+ * field when nothing is authored for it. The input is never changed; with nothing
94515
+ * to add it is returned as it is.
94516
+ */
94517
+ function withDefaultRunning(composition, blockId) {
94518
+ if (hasAuthoredRunning(composition) || !actuatorSwitchDrivesRunning(composition)) return composition;
94519
+ const feature = followSwitchRunningFeature(composition, composedDeviceRef(blockId));
94520
+ return feature === null ? composition : {
94521
+ ...composition,
94522
+ features: [...composition.features, feature]
94523
+ };
94524
+ }
94525
+ /**
94526
+ * One composed field, evaluated from what its sources say NOW (D659).
94527
+ *
94528
+ * Pure. The composer calls it on every source change, and the slice-5 editor
94529
+ * will call it for its live preview, so both see the same answer.
94530
+ *
94531
+ * The rules (spec §2):
94532
+ * - a source that is offline or unreadable keeps its last value and is marked
94533
+ * STALE; the field is stale and keeps computing (D49);
94534
+ * - a source that is GONE makes the field UNAVAILABLE, `fatal`, and never a
94535
+ * plausible number (D393);
94536
+ * - a source that is unavailable but NOT gone (e.g. a cap unregistered at
94537
+ * runtime, R7b) makes the field UNAVAILABLE, non-fatal, `value: null`: it
94538
+ * may come back on its own, no block failure is raised for it;
94539
+ * - an expression that fails on a value makes the field unavailable for that
94540
+ * value, and NOT fatal: the next value may compute.
94541
+ *
94542
+ * `confirmed` (D663, D49): whether a NON-fatal unavailability is an ANSWER — a
94543
+ * cap the provider unregistered and a re-read agreed, a field the source
94544
+ * reported without, an expression that failed on a value — or only the
94545
+ * absence of one (a failed read, a first or empty read, a source not tracked
94546
+ * yet). Only a confirmed unavailability may hand a `release`-mode field back
94547
+ * to the native provider; an unconfirmed one holds it on its last value.
94548
+ * Absent means NOT confirmed. Fatal is always confirmed.
94549
+ *
94550
+ * When an expression has more than one unavailable binding, a FATAL one always
94551
+ * wins the outcome, regardless of position: every binding is scanned before
94552
+ * the field is judged, so an earlier non-fatal binding (e.g. a cap that is
94553
+ * momentarily unregistered) can never hide a later fatal one (a deleted
94554
+ * source) behind an early return.
94555
+ */
94556
+ function describeRead(read) {
94557
+ return `${compositionSourceKey(read.source)} ${read.cap}.${read.fieldPath}`;
94558
+ }
94559
+ function isConfirmed(reading) {
94560
+ return reading.fatal || reading.confirmed === true;
94561
+ }
94562
+ function fromReading(reading, read) {
94563
+ if (reading.state === "unavailable") return {
94564
+ state: "unavailable",
94565
+ value: null,
94566
+ reason: `${describeRead(read)}: ${reading.reason}`,
94567
+ fatal: reading.fatal,
94568
+ confirmed: isConfirmed(reading)
94569
+ };
94570
+ return {
94571
+ state: reading.state,
94572
+ value: reading.value,
94573
+ reason: reading.state === "stale" ? `${describeRead(read)}: ${reading.reason}` : null,
94574
+ deadline: null
94575
+ };
94576
+ }
94577
+ function expressionOutcome(source, read, now, stateful) {
94578
+ const values = {};
94579
+ const staleReasons = [];
94580
+ let fatalUnavailable = null;
94581
+ let nonFatalUnavailable = null;
94582
+ for (const [name, binding] of Object.entries(source.bindings)) {
94583
+ if (binding.kind === "literal") {
94584
+ values[name] = binding.value;
94585
+ continue;
94586
+ }
94587
+ const reading = read(binding);
94588
+ if (reading.state === "unavailable") {
94589
+ const outcome = {
94590
+ state: "unavailable",
94591
+ value: null,
94592
+ reason: `binding \`${name}\` (${describeRead(binding)}): ${reading.reason}`,
94593
+ fatal: reading.fatal,
94594
+ confirmed: isConfirmed(reading)
94595
+ };
94596
+ if (reading.fatal) {
94597
+ fatalUnavailable = outcome;
94598
+ break;
94599
+ }
94600
+ if (nonFatalUnavailable === null || outcome.confirmed && !nonFatalUnavailable.confirmed) nonFatalUnavailable = outcome;
94601
+ continue;
94602
+ }
94603
+ values[name] = reading.value;
94604
+ if (reading.state === "fresh" && reading.transition !== void 0 && stateful !== void 0) stateful.expressionMemory.dwellTransition = reading.transition;
94605
+ if (reading.state === "stale") staleReasons.push(`\`${name}\`: ${reading.reason}`);
94606
+ }
94607
+ const unavailable = fatalUnavailable ?? nonFatalUnavailable;
94608
+ if (unavailable !== null) {
94609
+ if (stateful !== void 0 && stateful.currentOutput !== void 0 && expressionContainsBuiltinCall(source.expr, "count")) return {
94610
+ state: "stale",
94611
+ value: evaluateCount(null, {
94612
+ kind: "count",
94613
+ highWater: null,
94614
+ primed: false
94615
+ }, stateful.currentOutput),
94616
+ reason: `${unavailable.reason}; holding the last accumulator value`,
94617
+ deadline: null
94618
+ };
94619
+ return unavailable;
94620
+ }
94621
+ const deadlines = [];
94622
+ const hooks = {
94623
+ noteDeadline: (at) => deadlines.push(at),
94624
+ ...stateful?.timerDriven === true ? { timerDriven: true } : {},
94625
+ convert: (value, from, to) => tryConvertUnit(value, normalizeUnit(from) ?? from, normalizeUnit(to) ?? to) ?? null
94626
+ };
94627
+ const result = evaluateExpressionSource(source.expr, values, now, {
94628
+ hooks,
94629
+ ...stateful === void 0 ? {} : { invokeStateful: (invocation) => evaluateStatefulExpressionCall(stateful.callPathPrefix === void 0 ? invocation : {
94630
+ ...invocation,
94631
+ path: `${stateful.callPathPrefix}@${invocation.path}`
94632
+ }, stateful.expressionMemory, {
94633
+ currentOutput: stateful.currentOutput,
94634
+ startedAtMs: stateful.startedAtMs,
94635
+ nowMs: now
94636
+ }, hooks) }
94637
+ });
94638
+ const transition = stateful?.expressionMemory.dwellTransition ?? null;
94639
+ if (stateful !== void 0) stateful.expressionMemory.dwellTransition = null;
94640
+ if (!result.ok) return {
94641
+ state: "unavailable",
94642
+ value: null,
94643
+ reason: `the expression failed: ${result.error}`,
94644
+ fatal: false,
94645
+ confirmed: true,
94646
+ expressionFailed: true
94647
+ };
94648
+ return {
94649
+ state: staleReasons.length > 0 ? "stale" : "fresh",
94650
+ value: result.value,
94651
+ reason: staleReasons.length > 0 ? staleReasons.join("; ") : null,
94652
+ deadline: deadlines.length > 0 ? Math.min(...deadlines) : null,
94653
+ ...transition === null ? {} : { transition }
94654
+ };
94655
+ }
94656
+ function aggregateRead(reading) {
94657
+ if (reading.state === "unavailable") return {
94658
+ state: "unavailable",
94659
+ fatal: reading.fatal,
94660
+ reason: reading.reason
94661
+ };
94662
+ return {
94663
+ state: reading.state,
94664
+ value: reading.value,
94665
+ ...reading.state === "stale" ? { reason: reading.reason } : {}
94666
+ };
94667
+ }
94668
+ function aggregateField(source, read) {
94669
+ const outcome = evaluateAggregate({
94670
+ reducer: source.reducer,
94671
+ ...source.activeWhen === void 0 ? {} : { activeWhen: source.activeWhen },
94672
+ members: source.reads.map((item) => aggregateRead(read(item))),
94673
+ publish: source.publish,
94674
+ empty: source.empty
94675
+ });
94676
+ if (outcome.kind === "value") return {
94677
+ state: "fresh",
94678
+ value: outcome.value,
94679
+ reason: null,
94680
+ deadline: null
94681
+ };
94682
+ return {
94683
+ state: "unavailable",
94684
+ value: null,
94685
+ reason: outcome.reason,
94686
+ fatal: outcome.fatal,
94687
+ confirmed: true
94688
+ };
94689
+ }
94690
+ function evaluateCompositionField(input) {
94691
+ const { source } = input;
94692
+ switch (source.kind) {
94693
+ case "from": return fromReading(input.read(source), source);
94694
+ case "expression": return expressionOutcome(source, input.read, input.now, input.stateful);
94695
+ case "aggregate": return aggregateField(source, input.read);
94696
+ case "series": return {
94697
+ state: "unavailable",
94698
+ value: null,
94699
+ reason: "a series field is written from device history",
94700
+ fatal: false,
94701
+ confirmed: false
94702
+ };
94703
+ case "code": return {
94704
+ state: "unavailable",
94705
+ value: null,
94706
+ reason: "code fields are not runnable in the composer — they arrive in slice 4",
94707
+ fatal: true,
94708
+ confirmed: true
94709
+ };
94710
+ }
94711
+ }
94712
+ function lockDoorLinkOfComposition(composition) {
94713
+ if (composition === null || composition.target.kind !== "existing") return null;
94714
+ const feature = composition.features.find((f) => f.cap === "lock-control");
94715
+ if (feature === void 0 || feature.kind !== "fields") return null;
94716
+ const state = feature.fields["state"];
94717
+ if (state === void 0 || state.kind !== "expression") return null;
94718
+ const x = state.bindings["x"];
94719
+ if (x === void 0 || x.kind !== "from") return null;
94720
+ return {
94721
+ lock: composition.target.device,
94722
+ sensor: x.source
94723
+ };
94724
+ }
94725
+ /**
94726
+ * Which smart switch powers a device (the `power-source` Customize extension):
94727
+ * the source its stored `power-source.switchOn` field reads, and the off time of
94728
+ * a forced restart stored beside it. Read from the STORED composition, never kept
94729
+ * as a second copy (D676). Shared by the hub (which acts on the switch) and the
94730
+ * admin UI (which shows it).
94731
+ */
94732
+ /**
94733
+ * The stored off time, or the default when none is stored. A stored number out
94734
+ * of range is CLAMPED to the bounds (a hand-written value never refuses the
94735
+ * link, it just cannot cut power for an absurd time); a non-integer is rounded.
94736
+ */
94737
+ function normalizeOffSeconds(value) {
94738
+ if (typeof value !== "number" || !Number.isFinite(value)) return 10;
94739
+ return Math.min(120, Math.max(3, Math.round(value)));
94740
+ }
94741
+ /** The constant a stored `offSeconds` field carries, or undefined when it is not a literal number. */
94742
+ function storedOffSeconds(composition) {
94743
+ const feature = composition.features.find((f) => f.cap === "power-source");
94744
+ if (feature === void 0 || feature.kind !== "fields") return void 0;
94745
+ const field = feature.fields["offSeconds"];
94746
+ if (field === void 0 || field.kind !== "expression") return void 0;
94747
+ const n = Number(field.expr);
94748
+ return field.expr.trim() === "" || !Number.isFinite(n) ? void 0 : n;
94749
+ }
94750
+ /**
94751
+ * The link a composition stores. An `existing` target names its own device; a
94752
+ * `new` target (a composed device) is the composer's own device, so the caller
94753
+ * passes the block id and a new-target composition without one has no link.
94754
+ */
94755
+ function powerSourceLinkOfComposition(composition, blockId) {
94756
+ if (composition === null) return null;
94757
+ let device;
94758
+ if (composition.target.kind === "existing") device = composition.target.device;
94759
+ else if (blockId !== void 0) device = composedDeviceRef(blockId);
94760
+ else return null;
94761
+ const feature = composition.features.find((f) => f.cap === "power-source");
94762
+ if (feature === void 0 || feature.kind !== "fields" || feature.enabled === false) return null;
94763
+ const field = feature.fields["switchOn"];
94764
+ if (field === void 0) return null;
94765
+ const read = fieldReads(field).find((r) => r.cap === "switch");
94766
+ if (read === void 0) return null;
94767
+ return {
94768
+ device,
94769
+ switch: read.source,
94770
+ offSeconds: normalizeOffSeconds(storedOffSeconds(composition))
94771
+ };
94772
+ }
94773
+ SOURCE_CAPS.filter((cap) => cap !== "switch" && cap !== "motion");
94774
+ String.raw`rose\(active(\d+), changed(\d+), (\d+(?:\.\d+)?)\)`;
94618
94775
  DeviceRole.BinarySensor, DeviceRole.MotionSensor;
94619
94776
  new Set(CAP_NAMES);
94620
94777
  function isUnfilledRequiredProblem(problem) {
@@ -105420,6 +105577,13 @@ var METHOD_ACCESS_MAP = Object.freeze({
105420
105577
  access: "create",
105421
105578
  role: "viewer"
105422
105579
  },
105580
+ "timedRun.getOptions": {
105581
+ capName: "timed-run",
105582
+ capScope: "device",
105583
+ addonId: null,
105584
+ access: "view",
105585
+ role: "viewer"
105586
+ },
105423
105587
  "timedRun.getStatus": {
105424
105588
  capName: "timed-run",
105425
105589
  capScope: "device",
@@ -105434,6 +105598,13 @@ var METHOD_ACCESS_MAP = Object.freeze({
105434
105598
  access: "create",
105435
105599
  role: "viewer"
105436
105600
  },
105601
+ "timedRun.setSettings": {
105602
+ capName: "timed-run",
105603
+ capScope: "device",
105604
+ addonId: null,
105605
+ access: "create",
105606
+ role: "admin"
105607
+ },
105437
105608
  "toast.onToast": {
105438
105609
  capName: "toast",
105439
105610
  capScope: "system",
@@ -109201,6 +109372,11 @@ Object.freeze({
109201
109372
  form: "single",
109202
109373
  optional: false
109203
109374
  }],
109375
+ "timedRun.getOptions": [{
109376
+ name: "deviceId",
109377
+ form: "single",
109378
+ optional: false
109379
+ }],
109204
109380
  "timedRun.getStatus": [{
109205
109381
  name: "deviceId",
109206
109382
  form: "single",
@@ -109211,6 +109387,11 @@ Object.freeze({
109211
109387
  form: "single",
109212
109388
  optional: false
109213
109389
  }],
109390
+ "timedRun.setSettings": [{
109391
+ name: "deviceId",
109392
+ form: "single",
109393
+ optional: false
109394
+ }],
109214
109395
  "update.getStatus": [{
109215
109396
  name: "deviceId",
109216
109397
  form: "single",
@@ -111613,4 +111794,4 @@ z.object({
111613
111794
  commands: z.record(z.string(), z.unknown())
111614
111795
  });
111615
111796
  //#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 };
111797
+ 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, EventCategory 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, 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 };