@camstack/types 1.2.590 → 1.2.592

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.
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_sleep = require("./sleep-BA_SIc0O.js");
2
+ const require_sleep = require("./sleep-D2Ny6tvi.js");
3
3
  const require_event_category = require("./event-category-BKxXXxnV.js");
4
4
  const require_composed_stable_id = require("./composed-stable-id-BdeYe5dD.js");
5
5
  const require_implemented_methods = require("./implemented-methods-BarLh7tc.js");
@@ -37418,7 +37418,7 @@ ${hasTime ? ` /** Read the site into memory. A failed read keeps the previous v
37418
37418
  ` : ""} // ── the condition mirror (D49): memory only at fire time ──
37419
37419
  async function refreshMirror(): Promise<void> {
37420
37420
  const report = await mirror.refresh({
37421
- fetchSlice: (deviceId, cap) => ctx.api.deviceState.getCapSlice.query({ deviceId, capName: cap }),
37421
+ fetchSlice: (deviceId, cap) => ctx.api.deviceState.getCapSlice.query({ deviceId, capName: cap, confirmed: true }),
37422
37422
  fetchStableIds: async () => {
37423
37423
  const all = await ctx.api.deviceManager.listAll.query({})
37424
37424
  return stableIdMapOf(all)
@@ -37432,7 +37432,7 @@ ${hasTime ? ` /** Read the site into memory. A failed read keeps the previous v
37432
37432
 
37433
37433
  function mirrorFetchers() {
37434
37434
  return {
37435
- fetchSlice: (deviceId: number, cap: string) => ctx.api.deviceState.getCapSlice.query({ deviceId, capName: cap }),
37435
+ fetchSlice: (deviceId: number, cap: string) => ctx.api.deviceState.getCapSlice.query({ deviceId, capName: cap, confirmed: true }),
37436
37436
  fetchStableIds: async () => {
37437
37437
  const all = await ctx.api.deviceManager.listAll.query({})
37438
37438
  return stableIdMapOf(all)
@@ -37501,7 +37501,7 @@ ${hasTime ? ` // a time-is leaf changes sides at a boundary with no device ev
37501
37501
  cap: string,
37502
37502
  ): Promise<{ readonly ok: true; readonly slice: unknown } | { readonly ok: false }> {
37503
37503
  try {
37504
- const slice = await ctx.api.deviceState.getCapSlice.query({ deviceId, capName: cap })
37504
+ const slice = await ctx.api.deviceState.getCapSlice.query({ deviceId, capName: cap, confirmed: true })
37505
37505
  return { ok: true, slice }
37506
37506
  } catch (err: unknown) {
37507
37507
  ctx.logger.debug('device state read failed — the leaf keeps what it knew', {
@@ -37888,8 +37888,10 @@ ${hasTime ? " await refreshSite()\n" : ""} await refreshMirror()
37888
37888
  const deviceId = data['deviceId']
37889
37889
  const capName = data['capName']
37890
37890
  if (typeof deviceId === 'number' && typeof capName === 'string') {
37891
- mirror.apply(deviceId, capName, data['slice'])
37892
- guardMirror.apply(deviceId, capName, data['slice'])
37891
+ // what the device reported: a held command is never a condition (D1061)
37892
+ const slice = data['confirmed'] ?? data['slice']
37893
+ mirror.apply(deviceId, capName, slice)
37894
+ guardMirror.apply(deviceId, capName, slice)
37893
37895
  feedHolds()
37894
37896
  evaluateStateTree()
37895
37897
  }
@@ -41689,6 +41691,14 @@ var alarmPanelCapability = {
41689
41691
  field: "state",
41690
41692
  value: "disarmed"
41691
41693
  },
41694
+ hold: { effects: [{
41695
+ field: "state",
41696
+ value: "disarming",
41697
+ when: {
41698
+ field: "state",
41699
+ notIn: ["disarmed"]
41700
+ }
41701
+ }] },
41692
41702
  openArgs: [{
41693
41703
  key: "code",
41694
41704
  label: require_sleep.t("PIN code", "Codice PIN"),
@@ -41719,6 +41729,14 @@ var alarmPanelCapability = {
41719
41729
  field: "state",
41720
41730
  value: "armed_home"
41721
41731
  },
41732
+ hold: { effects: [{
41733
+ field: "state",
41734
+ value: "arming",
41735
+ when: {
41736
+ field: "state",
41737
+ notIn: ["armed_home"]
41738
+ }
41739
+ }] },
41722
41740
  args: { mode: "home" },
41723
41741
  openArgs: [{
41724
41742
  key: "code",
@@ -41739,6 +41757,14 @@ var alarmPanelCapability = {
41739
41757
  field: "state",
41740
41758
  value: "armed_away"
41741
41759
  },
41760
+ hold: { effects: [{
41761
+ field: "state",
41762
+ value: "arming",
41763
+ when: {
41764
+ field: "state",
41765
+ notIn: ["armed_away"]
41766
+ }
41767
+ }] },
41742
41768
  args: { mode: "away" },
41743
41769
  openArgs: [{
41744
41770
  key: "code",
@@ -41759,6 +41785,14 @@ var alarmPanelCapability = {
41759
41785
  field: "state",
41760
41786
  value: "armed_night"
41761
41787
  },
41788
+ hold: { effects: [{
41789
+ field: "state",
41790
+ value: "arming",
41791
+ when: {
41792
+ field: "state",
41793
+ notIn: ["armed_night"]
41794
+ }
41795
+ }] },
41762
41796
  args: { mode: "night" },
41763
41797
  openArgs: [{
41764
41798
  key: "code",
@@ -41779,6 +41813,14 @@ var alarmPanelCapability = {
41779
41813
  field: "state",
41780
41814
  value: "armed_vacation"
41781
41815
  },
41816
+ hold: { effects: [{
41817
+ field: "state",
41818
+ value: "arming",
41819
+ when: {
41820
+ field: "state",
41821
+ notIn: ["armed_vacation"]
41822
+ }
41823
+ }] },
41782
41824
  args: { mode: "vacation" },
41783
41825
  openArgs: [{
41784
41826
  key: "code",
@@ -41799,6 +41841,14 @@ var alarmPanelCapability = {
41799
41841
  field: "state",
41800
41842
  value: "armed_custom_bypass"
41801
41843
  },
41844
+ hold: { effects: [{
41845
+ field: "state",
41846
+ value: "arming",
41847
+ when: {
41848
+ field: "state",
41849
+ notIn: ["armed_custom_bypass"]
41850
+ }
41851
+ }] },
41802
41852
  args: { mode: "custom_bypass" },
41803
41853
  openArgs: [{
41804
41854
  key: "code",
@@ -42689,6 +42739,10 @@ var automationControlCapability = {
42689
42739
  auth: "admin",
42690
42740
  actions: [{
42691
42741
  id: "haAutomation.enable",
42742
+ effect: {
42743
+ field: "enabled",
42744
+ value: true
42745
+ },
42692
42746
  label: require_sleep.t("Enable automation", "Abilita l’automazione"),
42693
42747
  phrase: require_sleep.t("Enable {device}", "Abilita {device}"),
42694
42748
  icon: "toggle-right"
@@ -42699,6 +42753,10 @@ var automationControlCapability = {
42699
42753
  auth: "admin",
42700
42754
  actions: [{
42701
42755
  id: "haAutomation.disable",
42756
+ effect: {
42757
+ field: "enabled",
42758
+ value: false
42759
+ },
42702
42760
  label: require_sleep.t("Disable automation", "Disabilita l’automazione"),
42703
42761
  phrase: require_sleep.t("Disable {device}", "Disabilita {device}"),
42704
42762
  icon: "toggle-left"
@@ -46231,6 +46289,14 @@ var climateControlCapability = {
46231
46289
  label: require_sleep.t("Set temperature range", "Imposta l’intervallo di temperatura"),
46232
46290
  phrase: require_sleep.t("Keep {device} between {targetLow} and {targetHigh}", "Mantieni {device} tra {targetLow} e {targetHigh}"),
46233
46291
  icon: "thermometer",
46292
+ effect: {
46293
+ field: "targetLow",
46294
+ fromArg: "targetLow"
46295
+ },
46296
+ sideEffects: [{
46297
+ field: "targetHigh",
46298
+ fromArg: "targetHigh"
46299
+ }],
46234
46300
  openArgs: [{
46235
46301
  key: "targetLow",
46236
46302
  label: require_sleep.t("Lowest", "Minima"),
@@ -46289,6 +46355,10 @@ var climateControlCapability = {
46289
46355
  label: require_sleep.t("Set fan mode", "Imposta la ventilazione"),
46290
46356
  phrase: require_sleep.t("Set the fan of {device} to {fanMode}", "Imposta la ventilazione di {device} su {fanMode}"),
46291
46357
  icon: "fan",
46358
+ effect: {
46359
+ field: "fanMode",
46360
+ fromArg: "fanMode"
46361
+ },
46292
46362
  openArgs: [{
46293
46363
  key: "fanMode",
46294
46364
  label: require_sleep.t("Fan mode", "Ventilazione"),
@@ -46311,6 +46381,10 @@ var climateControlCapability = {
46311
46381
  label: require_sleep.t("Set preset", "Imposta il preset"),
46312
46382
  phrase: require_sleep.t("Set {device} to preset {preset}", "Imposta {device} sul preset {preset}"),
46313
46383
  icon: "list",
46384
+ effect: {
46385
+ field: "preset",
46386
+ fromArg: "preset"
46387
+ },
46314
46388
  openArgs: [{
46315
46389
  key: "preset",
46316
46390
  label: require_sleep.t("Preset", "Preset"),
@@ -48627,6 +48701,10 @@ var mediaPlayerCapability = {
48627
48701
  auth: "protected",
48628
48702
  actions: [{
48629
48703
  id: "media.play",
48704
+ effect: {
48705
+ field: "state",
48706
+ value: "playing"
48707
+ },
48630
48708
  label: require_sleep.t("Play", "Riproduci"),
48631
48709
  phrase: require_sleep.t("Play on {device}", "Avvia la riproduzione su {device}"),
48632
48710
  icon: "play"
@@ -48637,6 +48715,10 @@ var mediaPlayerCapability = {
48637
48715
  auth: "protected",
48638
48716
  actions: [{
48639
48717
  id: "media.pause",
48718
+ effect: {
48719
+ field: "state",
48720
+ value: "paused"
48721
+ },
48640
48722
  label: require_sleep.t("Pause media", "Metti in pausa"),
48641
48723
  phrase: require_sleep.t("Pause {device}", "Metti in pausa {device}"),
48642
48724
  icon: "pause"
@@ -48680,6 +48762,10 @@ var mediaPlayerCapability = {
48680
48762
  auth: "protected",
48681
48763
  actions: [{
48682
48764
  id: "media.volume",
48765
+ effect: {
48766
+ field: "volumeLevel",
48767
+ fromArg: "volumeLevel"
48768
+ },
48683
48769
  label: require_sleep.t("Set volume", "Imposta il volume"),
48684
48770
  phrase: require_sleep.t("Set the volume of {device} to {volumeLevel}", "Imposta il volume di {device} al {volumeLevel}"),
48685
48771
  icon: "volume-2",
@@ -48704,12 +48790,20 @@ var mediaPlayerCapability = {
48704
48790
  auth: "protected",
48705
48791
  actions: [{
48706
48792
  id: "media.mute",
48793
+ effect: {
48794
+ field: "isMuted",
48795
+ value: true
48796
+ },
48707
48797
  label: require_sleep.t("Mute", "Silenzia"),
48708
48798
  phrase: require_sleep.t("Mute {device}", "Silenzia {device}"),
48709
48799
  icon: "volume-x",
48710
48800
  args: { muted: true }
48711
48801
  }, {
48712
48802
  id: "media.unmute",
48803
+ effect: {
48804
+ field: "isMuted",
48805
+ value: false
48806
+ },
48713
48807
  label: require_sleep.t("Unmute", "Riattiva l’audio"),
48714
48808
  phrase: require_sleep.t("Unmute {device}", "Riattiva l’audio di {device}"),
48715
48809
  icon: "volume-2",
@@ -48724,12 +48818,20 @@ var mediaPlayerCapability = {
48724
48818
  auth: "protected",
48725
48819
  actions: [{
48726
48820
  id: "media.shuffleOn",
48821
+ effect: {
48822
+ field: "shuffle",
48823
+ value: true
48824
+ },
48727
48825
  label: require_sleep.t("Shuffle on", "Riproduzione casuale attiva"),
48728
48826
  phrase: require_sleep.t("Turn on shuffle on {device}", "Attiva la riproduzione casuale su {device}"),
48729
48827
  icon: "shuffle",
48730
48828
  args: { shuffle: true }
48731
48829
  }, {
48732
48830
  id: "media.shuffleOff",
48831
+ effect: {
48832
+ field: "shuffle",
48833
+ value: false
48834
+ },
48733
48835
  label: require_sleep.t("Shuffle off", "Riproduzione casuale spenta"),
48734
48836
  phrase: require_sleep.t("Turn off shuffle on {device}", "Disattiva la riproduzione casuale su {device}"),
48735
48837
  icon: "shuffle",
@@ -48744,6 +48846,10 @@ var mediaPlayerCapability = {
48744
48846
  auth: "protected",
48745
48847
  actions: [{
48746
48848
  id: "media.repeat",
48849
+ effect: {
48850
+ field: "repeat",
48851
+ fromArg: "repeat"
48852
+ },
48747
48853
  label: require_sleep.t("Set repeat", "Imposta la ripetizione"),
48748
48854
  phrase: require_sleep.t("Set repeat on {device} to {repeat}", "Imposta la ripetizione di {device} su {repeat}"),
48749
48855
  icon: "repeat",
@@ -48778,6 +48884,10 @@ var mediaPlayerCapability = {
48778
48884
  auth: "protected",
48779
48885
  actions: [{
48780
48886
  id: "media.source",
48887
+ effect: {
48888
+ field: "source",
48889
+ fromArg: "source"
48890
+ },
48781
48891
  label: require_sleep.t("Select source", "Scegli la sorgente"),
48782
48892
  phrase: require_sleep.t("Switch {device} to {source}", "Passa {device} alla sorgente {source}"),
48783
48893
  icon: "cast",
@@ -59950,7 +60060,9 @@ var deviceStateCapability = {
59950
60060
  */
59951
60061
  getCapSlice: require_sleep.method(zod.z.object({
59952
60062
  deviceId: zod.z.number(),
59953
- capName: zod.z.string()
60063
+ capName: zod.z.string(),
60064
+ /** The slice the device CONFIRMED, without a held command (D1061) — history and automations. */
60065
+ confirmed: zod.z.boolean().optional()
59954
60066
  }), zod.z.record(zod.z.string(), zod.z.unknown()).nullable()),
59955
60067
  /**
59956
60068
  * Whole-system snapshot — every device's full state in one
@@ -59959,7 +60071,9 @@ var deviceStateCapability = {
59959
60071
  * `sm.getDeviceById(id).state.<cap>.value` is sync. Empty inner
59960
60072
  * record for devices that haven't emitted any slice yet.
59961
60073
  */
59962
- getAllSnapshots: require_sleep.method(zod.z.object({}), zod.z.record(zod.z.string(), zod.z.record(zod.z.string(), zod.z.record(zod.z.string(), zod.z.unknown())))),
60074
+ getAllSnapshots: require_sleep.method(zod.z.object({
60075
+ /** The slices the devices CONFIRMED, without held commands (D1061). */
60076
+ confirmed: zod.z.boolean().optional() }), zod.z.record(zod.z.string(), zod.z.record(zod.z.string(), zod.z.record(zod.z.string(), zod.z.unknown())))),
59963
60077
  /**
59964
60078
  * Canonical cross-layer WRITE for one cap-keyed slice. Used by
59965
60079
  * everyone who needs to publish runtime state for a device:
@@ -63041,7 +63155,15 @@ var fanControlCapability = {
63041
63155
  field: "speed",
63042
63156
  value: 100
63043
63157
  },
63044
- args: { speed: 100 }
63158
+ args: { speed: 100 },
63159
+ sideEffects: [{
63160
+ field: "preset",
63161
+ value: "",
63162
+ when: {
63163
+ field: "preset",
63164
+ notIn: [""]
63165
+ }
63166
+ }]
63045
63167
  },
63046
63168
  {
63047
63169
  id: "fan.speed",
@@ -63052,6 +63174,14 @@ var fanControlCapability = {
63052
63174
  field: "speed",
63053
63175
  fromArg: "speed"
63054
63176
  },
63177
+ sideEffects: [{
63178
+ field: "preset",
63179
+ value: "",
63180
+ when: {
63181
+ field: "preset",
63182
+ notIn: [""]
63183
+ }
63184
+ }],
63055
63185
  openArgs: [{
63056
63186
  key: "speed",
63057
63187
  label: require_sleep.t("Speed", "Velocità"),
@@ -63077,6 +63207,10 @@ var fanControlCapability = {
63077
63207
  label: require_sleep.t("Set preset", "Imposta il preset"),
63078
63208
  phrase: require_sleep.t("Set {device} to preset {preset}", "Imposta {device} sul preset {preset}"),
63079
63209
  icon: "list",
63210
+ effect: {
63211
+ field: "preset",
63212
+ fromArg: "preset"
63213
+ },
63080
63214
  openArgs: [{
63081
63215
  key: "preset",
63082
63216
  label: require_sleep.t("Preset", "Preset"),
@@ -70031,6 +70165,14 @@ var lockControlCapability = {
70031
70165
  field: "state",
70032
70166
  value: "locked"
70033
70167
  },
70168
+ hold: { effects: [{
70169
+ field: "state",
70170
+ value: "locking",
70171
+ when: {
70172
+ field: "state",
70173
+ notIn: ["locked"]
70174
+ }
70175
+ }] },
70034
70176
  openArgs: [{
70035
70177
  key: "code",
70036
70178
  label: require_sleep.t("PIN code", "Codice PIN"),
@@ -70064,6 +70206,14 @@ var lockControlCapability = {
70064
70206
  field: "state",
70065
70207
  value: "unlocked"
70066
70208
  },
70209
+ hold: { effects: [{
70210
+ field: "state",
70211
+ value: "unlocking",
70212
+ when: {
70213
+ field: "state",
70214
+ notIn: ["unlocked"]
70215
+ }
70216
+ }] },
70067
70217
  openArgs: [{
70068
70218
  key: "code",
70069
70219
  label: require_sleep.t("PIN code", "Codice PIN"),
@@ -76115,6 +76265,16 @@ var pipelineAnalyticsCapability = {
76115
76265
  //#endregion
76116
76266
  //#region src/capabilities/pipeline-executor.cap.ts
76117
76267
  /**
76268
+ * A rectangle as a fraction of a frame, `[0, 1]` on both axes — the wire shape
76269
+ * of `NormalizedRect` (which is derived from it).
76270
+ */
76271
+ var NormalizedRectSchema = zod.z.object({
76272
+ x: zod.z.number(),
76273
+ y: zod.z.number(),
76274
+ w: zod.z.number(),
76275
+ h: zod.z.number()
76276
+ });
76277
+ /**
76118
76278
  * A root model's boxes standing in for one crop-kind step's own inference
76119
76279
  * (D730) — see `runPipeline.suppliedRoot`.
76120
76280
  */
@@ -76621,7 +76781,16 @@ var pipelineExecutorCapability = {
76621
76781
  * reader) run on them through their own crop policy. Boxes are in the
76622
76782
  * PIXELS of the image this call carries. Absent ⇒ the root step runs.
76623
76783
  */
76624
- suppliedRoot: SuppliedRootOutputSchema.optional()
76784
+ suppliedRoot: SuppliedRootOutputSchema.optional(),
76785
+ /**
76786
+ * The motion analyzer's merged subjects (D394) for this camera, fresh,
76787
+ * normalised to the frame (0..1). Feeds the motion-guided root crop
76788
+ * (D1060): the executor picks per frame whether the object-detection
76789
+ * root runs on the full frame or on a crop around them. Honoured only
76790
+ * on the live `frame` plane with a `frameRef`. Absent or empty ⇒ no
76791
+ * motion known ⇒ full frame.
76792
+ */
76793
+ motionRegions: zod.z.array(NormalizedRectSchema).optional()
76625
76794
  }), require_sleep.PipelineRunResultBridge, { kind: "mutation" }),
76626
76795
  /**
76627
76796
  * Batched run — N raw frames packed into one cap call. The provider
@@ -85489,6 +85658,16 @@ var osdManagerCapability = {
85489
85658
  vocabulary: { notOperatorFacing: require_sleep.NOT_A_DEVICE.PIPELINE }
85490
85659
  };
85491
85660
  //#endregion
85661
+ //#region src/device/cap-vocabulary/hold-limits.ts
85662
+ /**
85663
+ * Hold limits a cap's vocabulary may declare on an action (D1061).
85664
+ *
85665
+ * A one-shot command (feed, run a script) has no lasting state to confirm; it
85666
+ * holds its in-progress flag just long enough that a second tap, before the
85667
+ * device reports, is seen as "already running" and refused.
85668
+ */
85669
+ var ONE_SHOT_HOLD_MS = 1e4;
85670
+ //#endregion
85492
85671
  //#region src/capabilities/pet-feeder.cap.ts
85493
85672
  /**
85494
85673
  * PetKit pet-feeder cap. Models the control + telemetry surface of a
@@ -85640,6 +85819,13 @@ var petFeederCapability = {
85640
85819
  label: require_sleep.t("Feed", "Dai da mangiare"),
85641
85820
  phrase: require_sleep.t("Dispense {grams} from {device}", "Eroga {grams} da {device}"),
85642
85821
  icon: "paw-print",
85822
+ hold: {
85823
+ effects: [{
85824
+ field: "feeding",
85825
+ value: true
85826
+ }],
85827
+ holdMs: ONE_SHOT_HOLD_MS
85828
+ },
85643
85829
  openArgs: [{
85644
85830
  key: "grams",
85645
85831
  label: require_sleep.t("Grams", "Grammi"),
@@ -85658,6 +85844,13 @@ var petFeederCapability = {
85658
85844
  label: require_sleep.t("Feed from both hoppers", "Eroga da entrambi i serbatoi"),
85659
85845
  phrase: require_sleep.t("Dispense {hopper1} and {hopper2} from {device}", "Eroga {hopper1} e {hopper2} da {device}"),
85660
85846
  icon: "paw-print",
85847
+ hold: {
85848
+ effects: [{
85849
+ field: "feeding",
85850
+ value: true
85851
+ }],
85852
+ holdMs: ONE_SHOT_HOLD_MS
85853
+ },
85661
85854
  openArgs: [{
85662
85855
  key: "hopper1",
85663
85856
  label: require_sleep.t("Hopper 1", "Serbatoio 1"),
@@ -85763,12 +85956,20 @@ var petFeederCapability = {
85763
85956
  auth: "protected",
85764
85957
  actions: [{
85765
85958
  id: "petFeeder.childLockOn",
85959
+ effect: {
85960
+ field: "childLock",
85961
+ value: true
85962
+ },
85766
85963
  label: require_sleep.t("Child lock on", "Blocco bambini attivo"),
85767
85964
  phrase: require_sleep.t("Turn on the child lock of {device}", "Attiva il blocco bambini di {device}"),
85768
85965
  icon: "lock",
85769
85966
  args: { on: true }
85770
85967
  }, {
85771
85968
  id: "petFeeder.childLockOff",
85969
+ effect: {
85970
+ field: "childLock",
85971
+ value: false
85972
+ },
85772
85973
  label: require_sleep.t("Child lock off", "Blocco bambini spento"),
85773
85974
  phrase: require_sleep.t("Turn off the child lock of {device}", "Disattiva il blocco bambini di {device}"),
85774
85975
  icon: "lock-open",
@@ -85784,12 +85985,20 @@ var petFeederCapability = {
85784
85985
  auth: "protected",
85785
85986
  actions: [{
85786
85987
  id: "petFeeder.lightOn",
85988
+ effect: {
85989
+ field: "indicatorLight",
85990
+ value: true
85991
+ },
85787
85992
  label: require_sleep.t("Indicator light on", "Spia accesa"),
85788
85993
  phrase: require_sleep.t("Turn on the indicator light of {device}", "Accendi la spia di {device}"),
85789
85994
  icon: "lightbulb",
85790
85995
  args: { on: true }
85791
85996
  }, {
85792
85997
  id: "petFeeder.lightOff",
85998
+ effect: {
85999
+ field: "indicatorLight",
86000
+ value: false
86001
+ },
85793
86002
  label: require_sleep.t("Indicator light off", "Spia spenta"),
85794
86003
  phrase: require_sleep.t("Turn off the indicator light of {device}", "Spegni la spia di {device}"),
85795
86004
  icon: "lightbulb-off",
@@ -85805,12 +86014,20 @@ var petFeederCapability = {
85805
86014
  auth: "protected",
85806
86015
  actions: [{
85807
86016
  id: "petFeeder.feedSoundOn",
86017
+ effect: {
86018
+ field: "feedSound",
86019
+ value: true
86020
+ },
85808
86021
  label: require_sleep.t("Feeding sound on", "Suono di erogazione attivo"),
85809
86022
  phrase: require_sleep.t("Turn on the feeding sound of {device}", "Attiva il suono di erogazione di {device}"),
85810
86023
  icon: "volume-2",
85811
86024
  args: { on: true }
85812
86025
  }, {
85813
86026
  id: "petFeeder.feedSoundOff",
86027
+ effect: {
86028
+ field: "feedSound",
86029
+ value: false
86030
+ },
85814
86031
  label: require_sleep.t("Feeding sound off", "Suono di erogazione spento"),
85815
86032
  phrase: require_sleep.t("Turn off the feeding sound of {device}", "Disattiva il suono di erogazione di {device}"),
85816
86033
  icon: "volume-x",
@@ -85826,6 +86043,10 @@ var petFeederCapability = {
85826
86043
  auth: "protected",
85827
86044
  actions: [{
85828
86045
  id: "petFeeder.volume",
86046
+ effect: {
86047
+ field: "volume",
86048
+ fromArg: "level"
86049
+ },
85829
86050
  label: require_sleep.t("Set volume", "Imposta il volume"),
85830
86051
  phrase: require_sleep.t("Set the volume of {device} to {level}", "Imposta il volume di {device} a {level}"),
85831
86052
  icon: "volume-2",
@@ -85994,12 +86215,20 @@ setPump: require_sleep.method(zod.z.object({
85994
86215
  auth: "protected",
85995
86216
  actions: [{
85996
86217
  id: "petFountain.pumpOn",
86218
+ effect: {
86219
+ field: "pumpRunning",
86220
+ value: true
86221
+ },
85997
86222
  label: require_sleep.t("Pump on", "Pompa accesa"),
85998
86223
  phrase: require_sleep.t("Start the pump of {device}", "Avvia la pompa di {device}"),
85999
86224
  icon: "play",
86000
86225
  args: { on: true }
86001
86226
  }, {
86002
86227
  id: "petFountain.pumpOff",
86228
+ effect: {
86229
+ field: "pumpRunning",
86230
+ value: false
86231
+ },
86003
86232
  label: require_sleep.t("Pump off", "Pompa spenta"),
86004
86233
  phrase: require_sleep.t("Stop the pump of {device}", "Ferma la pompa di {device}"),
86005
86234
  icon: "square",
@@ -90300,12 +90529,20 @@ var pumpCycleCapability = {
90300
90529
  auth: "protected",
90301
90530
  actions: [{
90302
90531
  id: "pumpCycle.on",
90532
+ effect: {
90533
+ field: "enabled",
90534
+ value: true
90535
+ },
90303
90536
  label: require_sleep.t("Pump cycle on", "Ciclo pompa attivo"),
90304
90537
  phrase: require_sleep.t("Run the pump of {device} on its on/off cycle", "Fai lavorare la pompa di {device} a ciclo acceso/spento"),
90305
90538
  icon: "timer",
90306
90539
  args: { on: true }
90307
90540
  }, {
90308
90541
  id: "pumpCycle.off",
90542
+ effect: {
90543
+ field: "enabled",
90544
+ value: false
90545
+ },
90309
90546
  label: require_sleep.t("Pump cycle off", "Ciclo pompa spento"),
90310
90547
  phrase: require_sleep.t("Run the pump of {device} continuously", "Fai lavorare la pompa di {device} in continuo"),
90311
90548
  icon: "timer-off",
@@ -90324,6 +90561,11 @@ var pumpCycleCapability = {
90324
90561
  label: require_sleep.t("Set pump run time", "Imposta il tempo di lavoro della pompa"),
90325
90562
  phrase: require_sleep.t("Set the pump of {device} to run {minutes} minutes per cycle", "Imposta la pompa di {device} a lavorare {minutes} minuti per ciclo"),
90326
90563
  icon: "timer",
90564
+ effect: {
90565
+ field: "onTime",
90566
+ fromArg: "minutes",
90567
+ scale: 60
90568
+ },
90327
90569
  openArgs: [{
90328
90570
  key: "minutes",
90329
90571
  label: require_sleep.t("Minutes", "Minuti"),
@@ -90348,6 +90590,11 @@ var pumpCycleCapability = {
90348
90590
  label: require_sleep.t("Set pump rest time", "Imposta il tempo di riposo della pompa"),
90349
90591
  phrase: require_sleep.t("Set the pump of {device} to rest {minutes} minutes per cycle", "Imposta la pompa di {device} a riposare {minutes} minuti per ciclo"),
90350
90592
  icon: "timer-off",
90593
+ effect: {
90594
+ field: "offTime",
90595
+ fromArg: "minutes",
90596
+ scale: 60
90597
+ },
90351
90598
  openArgs: [{
90352
90599
  key: "minutes",
90353
90600
  label: require_sleep.t("Minutes", "Minuti"),
@@ -95311,7 +95558,14 @@ var scriptRunnerCapability = {
95311
95558
  id: "script.run",
95312
95559
  label: require_sleep.t("Run script", "Esegui lo script"),
95313
95560
  phrase: require_sleep.t("Run {device}", "Esegui {device}"),
95314
- icon: "scroll-text"
95561
+ icon: "scroll-text",
95562
+ hold: {
95563
+ effects: [{
95564
+ field: "isRunning",
95565
+ value: true
95566
+ }],
95567
+ holdMs: ONE_SHOT_HOLD_MS
95568
+ }
95315
95569
  }]
95316
95570
  }),
95317
95571
  /** Cancel a running script. Provider rejects when the script
@@ -95321,6 +95575,10 @@ var scriptRunnerCapability = {
95321
95575
  auth: "admin",
95322
95576
  actions: [{
95323
95577
  id: "script.stop",
95578
+ effect: {
95579
+ field: "isRunning",
95580
+ value: false
95581
+ },
95324
95582
  label: require_sleep.t("Stop script", "Ferma lo script"),
95325
95583
  phrase: require_sleep.t("Stop {device}", "Ferma {device}"),
95326
95584
  icon: "square"
@@ -97873,6 +98131,10 @@ var switchCapability = {
97873
98131
  auth: "protected",
97874
98132
  actions: [{
97875
98133
  id: "switch.toggle",
98134
+ sideEffects: [{
98135
+ field: "on",
98136
+ negate: true
98137
+ }],
97876
98138
  label: require_sleep.t("Toggle", "Commuta"),
97877
98139
  phrase: require_sleep.t("Toggle {device}", "Commuta {device}"),
97878
98140
  icon: "toggle-right",
@@ -150774,6 +151036,45 @@ function searchRank(rawQuery, fields) {
150774
151036
  return matchRank(label, keywords, (fields.identifiers ?? []).map(normalizeSearchText).filter((identifier) => identifier.length > 0), query) ?? fuzzyMatchRank(label, query) ?? bestFuzzy(keywords, query);
150775
151037
  }
150776
151038
  //#endregion
151039
+ //#region src/device/command-hold.ts
151040
+ /**
151041
+ * How long a command is held when nothing says otherwise. Equal to the
151042
+ * transition correlator's match window (D1022), so a hold that reverts and a
151043
+ * command recorded `unconfirmed` are the same event.
151044
+ */
151045
+ var DEFAULT_COMMAND_HOLD_MS = 3e4;
151046
+ /** The longest hold a provider may ask for: a value the device never confirms is not shown for long. */
151047
+ var MAX_COMMAND_HOLD_MS = 12e4;
151048
+ function clampHoldMs(ms) {
151049
+ if (ms === void 0 || !Number.isFinite(ms)) return DEFAULT_COMMAND_HOLD_MS;
151050
+ return Math.min(MAX_COMMAND_HOLD_MS, Math.max(1, Math.round(ms)));
151051
+ }
151052
+ function resolveList(list, args, current, shown, into) {
151053
+ for (const entry of list) {
151054
+ if (!require_sleep.effectConditionHolds(entry.when, current)) continue;
151055
+ const resolved = require_sleep.resolveSideEffect(entry, args, shown);
151056
+ if (resolved !== null && !into.some((e) => e.field === resolved.field)) into.push(resolved);
151057
+ }
151058
+ }
151059
+ /**
151060
+ * What to hold for `cap.method(args)` given the cap's slice when it arrived
151061
+ * (`current`, as the device reported it; `shown`, with the held values over
151062
+ * it — what a `negate` flips) and the provider's option for the method.
151063
+ * `null` = hold nothing (`never`, or a command that leads to no state).
151064
+ */
151065
+ function resolveCommandHold(cap, method, args, current, option, shown = current) {
151066
+ if (option?.hold === "never") return null;
151067
+ const effects = [];
151068
+ if (option?.effects !== void 0) resolveList(option.effects, args, current, shown, effects);
151069
+ else effects.push(...require_sleep.commandEffects(cap, method, args, current, shown));
151070
+ if (option?.extraEffects !== void 0) resolveList(option.extraEffects, args, current, shown, effects);
151071
+ if (effects.length === 0) return null;
151072
+ return {
151073
+ effects,
151074
+ holdMs: clampHoldMs(option?.holdMs ?? require_sleep.commandHoldMs(cap, method, args))
151075
+ };
151076
+ }
151077
+ //#endregion
150777
151078
  exports.ACCESSORY_LABEL = ACCESSORY_LABEL;
150778
151079
  exports.ACCESS_ROLES = ACCESS_ROLES;
150779
151080
  exports.ACTION_RUN_MAX_MS = ACTION_RUN_MAX_MS;
@@ -151309,6 +151610,7 @@ exports.DEFAULT_CAMERA_SENSOR_MODE = DEFAULT_CAMERA_SENSOR_MODE;
151309
151610
  exports.DEFAULT_CATALOG_LANG = DEFAULT_CATALOG_LANG;
151310
151611
  exports.DEFAULT_CLUSTER_STEP_MODELS = DEFAULT_CLUSTER_STEP_MODELS;
151311
151612
  exports.DEFAULT_CLUSTER_STEP_SETTINGS = DEFAULT_CLUSTER_STEP_SETTINGS;
151613
+ exports.DEFAULT_COMMAND_HOLD_MS = DEFAULT_COMMAND_HOLD_MS;
151312
151614
  exports.DEFAULT_CORE_BLOCK_ENTRY = DEFAULT_CORE_BLOCK_ENTRY;
151313
151615
  exports.DEFAULT_DECODER_HWACCEL_CONFIG = DEFAULT_DECODER_HWACCEL_CONFIG;
151314
151616
  exports.DEFAULT_DETAIL_CROP_CONVENTION = DEFAULT_DETAIL_CROP_CONVENTION;
@@ -152057,6 +152359,7 @@ exports.MAX_BIRTH_LATENCY_PROXY_MS = MAX_BIRTH_LATENCY_PROXY_MS;
152057
152359
  exports.MAX_CAMERA_SENSORS = MAX_CAMERA_SENSORS;
152058
152360
  exports.MAX_CLIP_EVENT_IDS = MAX_CLIP_EVENT_IDS;
152059
152361
  exports.MAX_CLIP_LABELS = MAX_CLIP_LABELS;
152362
+ exports.MAX_COMMAND_HOLD_MS = MAX_COMMAND_HOLD_MS;
152060
152363
  exports.MAX_COMPONENT_BUTTONS = MAX_COMPONENT_BUTTONS;
152061
152364
  exports.MAX_COMPOSITION_CODE_LENGTH = require_implemented_methods.MAX_COMPOSITION_CODE_LENGTH;
152062
152365
  exports.MAX_COMPOSITION_FEATURES = require_implemented_methods.MAX_COMPOSITION_FEATURES;
@@ -152485,6 +152788,7 @@ exports.NodeHttpsStateSchema = NodeHttpsStateSchema;
152485
152788
  exports.NodeRecommendationSchema = NodeRecommendationSchema;
152486
152789
  exports.NodeRemovedInputSchema = NodeRemovedInputSchema;
152487
152790
  exports.NodeRemovedResultSchema = NodeRemovedResultSchema;
152791
+ exports.NormalizedRectSchema = NormalizedRectSchema;
152488
152792
  exports.NotificationActionIconSchema = NotificationActionIconSchema;
152489
152793
  exports.NotificationActionSchema = NotificationActionSchema;
152490
152794
  exports.NotificationFieldSchema = NotificationFieldSchema;
@@ -152496,6 +152800,7 @@ exports.NumericSensorStatusSchema = NumericSensorStatusSchema;
152496
152800
  exports.OAUTH_LANDING_PATH = OAUTH_LANDING_PATH;
152497
152801
  exports.OAUTH_LANDING_REASONS = OAUTH_LANDING_REASONS;
152498
152802
  exports.OBJECT_DETECTION_STEP_ID = OBJECT_DETECTION_STEP_ID;
152803
+ exports.ONE_SHOT_HOLD_MS = ONE_SHOT_HOLD_MS;
152499
152804
  exports.OPERATOR_WRITTEN_STALE_MS = OPERATOR_WRITTEN_STALE_MS;
152500
152805
  exports.OPS_LOG_DEFAULT_LIMIT = OPS_LOG_DEFAULT_LIMIT;
152501
152806
  exports.OPS_LOG_RING_DEFAULT_MAX = OPS_LOG_RING_DEFAULT_MAX;
@@ -153709,6 +154014,8 @@ exports.collectZodSecretPaths = require_sleep.collectZodSecretPaths;
153709
154014
  exports.colorCapability = colorCapability;
153710
154015
  exports.colorForKind = colorForKind;
153711
154016
  exports.commandEffect = require_sleep.commandEffect;
154017
+ exports.commandEffects = require_sleep.commandEffects;
154018
+ exports.commandHoldMs = require_sleep.commandHoldMs;
153712
154019
  exports.commandMethodProblems = commandMethodProblems;
153713
154020
  exports.commandOrigin = require_sleep.commandOrigin;
153714
154021
  exports.commandStepMeta = commandStepMeta;
@@ -153915,6 +154222,7 @@ exports.dominantClipLabels = dominantClipLabels;
153915
154222
  exports.doorbellCapability = doorbellCapability;
153916
154223
  exports.droppedConditionsForKind = droppedConditionsForKind;
153917
154224
  exports.edgetpuDelegateDevice = edgetpuDelegateDevice;
154225
+ exports.effectConditionHolds = require_sleep.effectConditionHolds;
153918
154226
  exports.effectiveStepSettings = effectiveStepSettings;
153919
154227
  exports.egressTranscodeSharingKey = egressTranscodeSharingKey;
153920
154228
  exports.egressTransportFromRequest = egressTransportFromRequest;
@@ -154650,6 +154958,7 @@ exports.resolveBucketMs = resolveBucketMs;
154650
154958
  exports.resolveCapMount = require_sleep.resolveCapMount;
154651
154959
  exports.resolveClipSearchMinScore = resolveClipSearchMinScore;
154652
154960
  exports.resolveClusterStepModelId = resolveClusterStepModelId;
154961
+ exports.resolveCommandHold = resolveCommandHold;
154653
154962
  exports.resolveContainerPrimaryChild = resolveContainerPrimaryChild;
154654
154963
  exports.resolveCoreBlockEntry = resolveCoreBlockEntry;
154655
154964
  exports.resolveCoreBlockFiles = resolveCoreBlockFiles;
@@ -154691,6 +155000,7 @@ exports.resolveSecretMarkers = require_sleep.resolveSecretMarkers;
154691
155000
  exports.resolveSecretViewsIn = require_sleep.resolveSecretViewsIn;
154692
155001
  exports.resolveSelectStep = resolveSelectStep;
154693
155002
  exports.resolveServerName = resolveServerName;
155003
+ exports.resolveSideEffect = require_sleep.resolveSideEffect;
154694
155004
  exports.resolveSirenPlays = resolveSirenPlays;
154695
155005
  exports.resolveSirenSeconds = resolveSirenSeconds;
154696
155006
  exports.resolveStepArgs = resolveStepArgs;