@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.
@@ -8052,6 +8052,10 @@ var CAP_VOCABULARY = {
8052
8052
  it: "Commuta {device}"
8053
8053
  },
8054
8054
  icon: "toggle-right",
8055
+ sideEffects: [{
8056
+ field: "on",
8057
+ negate: true
8058
+ }],
8055
8059
  offeredWhen: {
8056
8060
  method: "getOptions",
8057
8061
  field: "supportsSetState"
@@ -9166,7 +9170,15 @@ var CAP_VOCABULARY = {
9166
9170
  effect: {
9167
9171
  field: "state",
9168
9172
  value: "locked"
9169
- }
9173
+ },
9174
+ hold: { effects: [{
9175
+ field: "state",
9176
+ value: "locking",
9177
+ when: {
9178
+ field: "state",
9179
+ notIn: ["locked"]
9180
+ }
9181
+ }] }
9170
9182
  },
9171
9183
  {
9172
9184
  id: "lock.unlock",
@@ -9195,7 +9207,15 @@ var CAP_VOCABULARY = {
9195
9207
  effect: {
9196
9208
  field: "state",
9197
9209
  value: "unlocked"
9198
- }
9210
+ },
9211
+ hold: { effects: [{
9212
+ field: "state",
9213
+ value: "unlocking",
9214
+ when: {
9215
+ field: "state",
9216
+ notIn: ["unlocked"]
9217
+ }
9218
+ }] }
9199
9219
  },
9200
9220
  {
9201
9221
  id: "lock.open",
@@ -9509,6 +9529,14 @@ var CAP_VOCABULARY = {
9509
9529
  step: .5,
9510
9530
  unit: "°C"
9511
9531
  }
9532
+ }],
9533
+ effect: {
9534
+ field: "targetLow",
9535
+ fromArg: "targetLow"
9536
+ },
9537
+ sideEffects: [{
9538
+ field: "targetHigh",
9539
+ fromArg: "targetHigh"
9512
9540
  }]
9513
9541
  },
9514
9542
  {
@@ -9565,7 +9593,11 @@ var CAP_VOCABULARY = {
9565
9593
  from: "status",
9566
9594
  field: "availableFanModes"
9567
9595
  }
9568
- }]
9596
+ }],
9597
+ effect: {
9598
+ field: "fanMode",
9599
+ fromArg: "fanMode"
9600
+ }
9569
9601
  },
9570
9602
  {
9571
9603
  id: "climate.preset",
@@ -9590,7 +9622,11 @@ var CAP_VOCABULARY = {
9590
9622
  from: "status",
9591
9623
  field: "availablePresets"
9592
9624
  }
9593
- }]
9625
+ }],
9626
+ effect: {
9627
+ field: "preset",
9628
+ fromArg: "preset"
9629
+ }
9594
9630
  },
9595
9631
  {
9596
9632
  id: "climate.swingVerticalOn",
@@ -9823,7 +9859,15 @@ var CAP_VOCABULARY = {
9823
9859
  effect: {
9824
9860
  field: "speed",
9825
9861
  value: 100
9826
- }
9862
+ },
9863
+ sideEffects: [{
9864
+ field: "preset",
9865
+ value: "",
9866
+ when: {
9867
+ field: "preset",
9868
+ notIn: [""]
9869
+ }
9870
+ }]
9827
9871
  },
9828
9872
  {
9829
9873
  id: "fan.speed",
@@ -9854,7 +9898,15 @@ var CAP_VOCABULARY = {
9854
9898
  effect: {
9855
9899
  field: "speed",
9856
9900
  fromArg: "speed"
9857
- }
9901
+ },
9902
+ sideEffects: [{
9903
+ field: "preset",
9904
+ value: "",
9905
+ when: {
9906
+ field: "preset",
9907
+ notIn: [""]
9908
+ }
9909
+ }]
9858
9910
  },
9859
9911
  {
9860
9912
  id: "fan.preset",
@@ -9879,7 +9931,11 @@ var CAP_VOCABULARY = {
9879
9931
  from: "status",
9880
9932
  field: "availablePresets"
9881
9933
  }
9882
- }]
9934
+ }],
9935
+ effect: {
9936
+ field: "preset",
9937
+ fromArg: "preset"
9938
+ }
9883
9939
  },
9884
9940
  {
9885
9941
  id: "fan.forward",
@@ -10424,7 +10480,15 @@ var CAP_VOCABULARY = {
10424
10480
  effect: {
10425
10481
  field: "state",
10426
10482
  value: "disarmed"
10427
- }
10483
+ },
10484
+ hold: { effects: [{
10485
+ field: "state",
10486
+ value: "disarming",
10487
+ when: {
10488
+ field: "state",
10489
+ notIn: ["disarmed"]
10490
+ }
10491
+ }] }
10428
10492
  },
10429
10493
  {
10430
10494
  id: "alarm.arm.home",
@@ -10454,7 +10518,15 @@ var CAP_VOCABULARY = {
10454
10518
  effect: {
10455
10519
  field: "state",
10456
10520
  value: "armed_home"
10457
- }
10521
+ },
10522
+ hold: { effects: [{
10523
+ field: "state",
10524
+ value: "arming",
10525
+ when: {
10526
+ field: "state",
10527
+ notIn: ["armed_home"]
10528
+ }
10529
+ }] }
10458
10530
  },
10459
10531
  {
10460
10532
  id: "alarm.arm.away",
@@ -10484,7 +10556,15 @@ var CAP_VOCABULARY = {
10484
10556
  effect: {
10485
10557
  field: "state",
10486
10558
  value: "armed_away"
10487
- }
10559
+ },
10560
+ hold: { effects: [{
10561
+ field: "state",
10562
+ value: "arming",
10563
+ when: {
10564
+ field: "state",
10565
+ notIn: ["armed_away"]
10566
+ }
10567
+ }] }
10488
10568
  },
10489
10569
  {
10490
10570
  id: "alarm.arm.night",
@@ -10514,7 +10594,15 @@ var CAP_VOCABULARY = {
10514
10594
  effect: {
10515
10595
  field: "state",
10516
10596
  value: "armed_night"
10517
- }
10597
+ },
10598
+ hold: { effects: [{
10599
+ field: "state",
10600
+ value: "arming",
10601
+ when: {
10602
+ field: "state",
10603
+ notIn: ["armed_night"]
10604
+ }
10605
+ }] }
10518
10606
  },
10519
10607
  {
10520
10608
  id: "alarm.arm.vacation",
@@ -10544,7 +10632,15 @@ var CAP_VOCABULARY = {
10544
10632
  effect: {
10545
10633
  field: "state",
10546
10634
  value: "armed_vacation"
10547
- }
10635
+ },
10636
+ hold: { effects: [{
10637
+ field: "state",
10638
+ value: "arming",
10639
+ when: {
10640
+ field: "state",
10641
+ notIn: ["armed_vacation"]
10642
+ }
10643
+ }] }
10548
10644
  },
10549
10645
  {
10550
10646
  id: "alarm.arm.custom_bypass",
@@ -10574,7 +10670,15 @@ var CAP_VOCABULARY = {
10574
10670
  effect: {
10575
10671
  field: "state",
10576
10672
  value: "armed_custom_bypass"
10577
- }
10673
+ },
10674
+ hold: { effects: [{
10675
+ field: "state",
10676
+ value: "arming",
10677
+ when: {
10678
+ field: "state",
10679
+ notIn: ["armed_custom_bypass"]
10680
+ }
10681
+ }] }
10578
10682
  }
10579
10683
  ],
10580
10684
  state: [{
@@ -11716,7 +11820,14 @@ var CAP_VOCABULARY = {
11716
11820
  quantity: "mass"
11717
11821
  },
11718
11822
  optional: true
11719
- }]
11823
+ }],
11824
+ hold: {
11825
+ effects: [{
11826
+ field: "feeding",
11827
+ value: true
11828
+ }],
11829
+ holdMs: 1e4
11830
+ }
11720
11831
  },
11721
11832
  {
11722
11833
  id: "petFeeder.feedHoppers",
@@ -11760,7 +11871,14 @@ var CAP_VOCABULARY = {
11760
11871
  quantity: "mass"
11761
11872
  },
11762
11873
  optional: true
11763
- }]
11874
+ }],
11875
+ hold: {
11876
+ effects: [{
11877
+ field: "feeding",
11878
+ value: true
11879
+ }],
11880
+ holdMs: 1e4
11881
+ }
11764
11882
  },
11765
11883
  {
11766
11884
  id: "petFeeder.cancelFeed",
@@ -11851,7 +11969,11 @@ var CAP_VOCABULARY = {
11851
11969
  it: "Attiva il blocco bambini di {device}"
11852
11970
  },
11853
11971
  icon: "lock",
11854
- args: { on: true }
11972
+ args: { on: true },
11973
+ effect: {
11974
+ field: "childLock",
11975
+ value: true
11976
+ }
11855
11977
  },
11856
11978
  {
11857
11979
  id: "petFeeder.childLockOff",
@@ -11865,7 +11987,11 @@ var CAP_VOCABULARY = {
11865
11987
  it: "Disattiva il blocco bambini di {device}"
11866
11988
  },
11867
11989
  icon: "lock-open",
11868
- args: { on: false }
11990
+ args: { on: false },
11991
+ effect: {
11992
+ field: "childLock",
11993
+ value: false
11994
+ }
11869
11995
  },
11870
11996
  {
11871
11997
  id: "petFeeder.lightOn",
@@ -11879,7 +12005,11 @@ var CAP_VOCABULARY = {
11879
12005
  it: "Accendi la spia di {device}"
11880
12006
  },
11881
12007
  icon: "lightbulb",
11882
- args: { on: true }
12008
+ args: { on: true },
12009
+ effect: {
12010
+ field: "indicatorLight",
12011
+ value: true
12012
+ }
11883
12013
  },
11884
12014
  {
11885
12015
  id: "petFeeder.lightOff",
@@ -11893,7 +12023,11 @@ var CAP_VOCABULARY = {
11893
12023
  it: "Spegni la spia di {device}"
11894
12024
  },
11895
12025
  icon: "lightbulb-off",
11896
- args: { on: false }
12026
+ args: { on: false },
12027
+ effect: {
12028
+ field: "indicatorLight",
12029
+ value: false
12030
+ }
11897
12031
  },
11898
12032
  {
11899
12033
  id: "petFeeder.feedSoundOn",
@@ -11907,7 +12041,11 @@ var CAP_VOCABULARY = {
11907
12041
  it: "Attiva il suono di erogazione di {device}"
11908
12042
  },
11909
12043
  icon: "volume-2",
11910
- args: { on: true }
12044
+ args: { on: true },
12045
+ effect: {
12046
+ field: "feedSound",
12047
+ value: true
12048
+ }
11911
12049
  },
11912
12050
  {
11913
12051
  id: "petFeeder.feedSoundOff",
@@ -11921,7 +12059,11 @@ var CAP_VOCABULARY = {
11921
12059
  it: "Disattiva il suono di erogazione di {device}"
11922
12060
  },
11923
12061
  icon: "volume-x",
11924
- args: { on: false }
12062
+ args: { on: false },
12063
+ effect: {
12064
+ field: "feedSound",
12065
+ value: false
12066
+ }
11925
12067
  },
11926
12068
  {
11927
12069
  id: "petFeeder.volume",
@@ -11946,7 +12088,11 @@ var CAP_VOCABULARY = {
11946
12088
  min: 0,
11947
12089
  step: 1
11948
12090
  }
11949
- }]
12091
+ }],
12092
+ effect: {
12093
+ field: "volume",
12094
+ fromArg: "level"
12095
+ }
11950
12096
  }
11951
12097
  ],
11952
12098
  state: [
@@ -12018,7 +12164,11 @@ var CAP_VOCABULARY = {
12018
12164
  it: "Avvia la pompa di {device}"
12019
12165
  },
12020
12166
  icon: "play",
12021
- args: { on: true }
12167
+ args: { on: true },
12168
+ effect: {
12169
+ field: "pumpRunning",
12170
+ value: true
12171
+ }
12022
12172
  }, {
12023
12173
  id: "petFountain.pumpOff",
12024
12174
  method: "setPump",
@@ -12031,7 +12181,11 @@ var CAP_VOCABULARY = {
12031
12181
  it: "Ferma la pompa di {device}"
12032
12182
  },
12033
12183
  icon: "square",
12034
- args: { on: false }
12184
+ args: { on: false },
12185
+ effect: {
12186
+ field: "pumpRunning",
12187
+ value: false
12188
+ }
12035
12189
  }],
12036
12190
  state: [{
12037
12191
  kind: "boolean",
@@ -12083,7 +12237,11 @@ var CAP_VOCABULARY = {
12083
12237
  it: "Fai lavorare la pompa di {device} a ciclo acceso/spento"
12084
12238
  },
12085
12239
  icon: "timer",
12086
- args: { on: true }
12240
+ args: { on: true },
12241
+ effect: {
12242
+ field: "enabled",
12243
+ value: true
12244
+ }
12087
12245
  },
12088
12246
  {
12089
12247
  id: "pumpCycle.off",
@@ -12097,7 +12255,11 @@ var CAP_VOCABULARY = {
12097
12255
  it: "Fai lavorare la pompa di {device} in continuo"
12098
12256
  },
12099
12257
  icon: "timer-off",
12100
- args: { on: false }
12258
+ args: { on: false },
12259
+ effect: {
12260
+ field: "enabled",
12261
+ value: false
12262
+ }
12101
12263
  },
12102
12264
  {
12103
12265
  id: "pumpCycle.onMinutes",
@@ -12123,7 +12285,12 @@ var CAP_VOCABULARY = {
12123
12285
  step: 1,
12124
12286
  unit: "min"
12125
12287
  }
12126
- }]
12288
+ }],
12289
+ effect: {
12290
+ field: "onTime",
12291
+ fromArg: "minutes",
12292
+ scale: 60
12293
+ }
12127
12294
  },
12128
12295
  {
12129
12296
  id: "pumpCycle.offMinutes",
@@ -12149,7 +12316,12 @@ var CAP_VOCABULARY = {
12149
12316
  step: 1,
12150
12317
  unit: "min"
12151
12318
  }
12152
- }]
12319
+ }],
12320
+ effect: {
12321
+ field: "offTime",
12322
+ fromArg: "minutes",
12323
+ scale: 60
12324
+ }
12153
12325
  }
12154
12326
  ],
12155
12327
  state: [{
@@ -12266,7 +12438,11 @@ var CAP_VOCABULARY = {
12266
12438
  en: "Play on {device}",
12267
12439
  it: "Avvia la riproduzione su {device}"
12268
12440
  },
12269
- icon: "play"
12441
+ icon: "play",
12442
+ effect: {
12443
+ field: "state",
12444
+ value: "playing"
12445
+ }
12270
12446
  },
12271
12447
  {
12272
12448
  id: "media.pause",
@@ -12279,7 +12455,11 @@ var CAP_VOCABULARY = {
12279
12455
  en: "Pause {device}",
12280
12456
  it: "Metti in pausa {device}"
12281
12457
  },
12282
- icon: "pause"
12458
+ icon: "pause",
12459
+ effect: {
12460
+ field: "state",
12461
+ value: "paused"
12462
+ }
12283
12463
  },
12284
12464
  {
12285
12465
  id: "media.stop",
@@ -12345,7 +12525,11 @@ var CAP_VOCABULARY = {
12345
12525
  step: 1,
12346
12526
  unit: "%"
12347
12527
  }
12348
- }]
12528
+ }],
12529
+ effect: {
12530
+ field: "volumeLevel",
12531
+ fromArg: "volumeLevel"
12532
+ }
12349
12533
  },
12350
12534
  {
12351
12535
  id: "media.mute",
@@ -12359,7 +12543,11 @@ var CAP_VOCABULARY = {
12359
12543
  it: "Silenzia {device}"
12360
12544
  },
12361
12545
  icon: "volume-x",
12362
- args: { muted: true }
12546
+ args: { muted: true },
12547
+ effect: {
12548
+ field: "isMuted",
12549
+ value: true
12550
+ }
12363
12551
  },
12364
12552
  {
12365
12553
  id: "media.unmute",
@@ -12373,7 +12561,11 @@ var CAP_VOCABULARY = {
12373
12561
  it: "Riattiva l’audio di {device}"
12374
12562
  },
12375
12563
  icon: "volume-2",
12376
- args: { muted: false }
12564
+ args: { muted: false },
12565
+ effect: {
12566
+ field: "isMuted",
12567
+ value: false
12568
+ }
12377
12569
  },
12378
12570
  {
12379
12571
  id: "media.shuffleOn",
@@ -12387,7 +12579,11 @@ var CAP_VOCABULARY = {
12387
12579
  it: "Attiva la riproduzione casuale su {device}"
12388
12580
  },
12389
12581
  icon: "shuffle",
12390
- args: { shuffle: true }
12582
+ args: { shuffle: true },
12583
+ effect: {
12584
+ field: "shuffle",
12585
+ value: true
12586
+ }
12391
12587
  },
12392
12588
  {
12393
12589
  id: "media.shuffleOff",
@@ -12401,7 +12597,11 @@ var CAP_VOCABULARY = {
12401
12597
  it: "Disattiva la riproduzione casuale su {device}"
12402
12598
  },
12403
12599
  icon: "shuffle",
12404
- args: { shuffle: false }
12600
+ args: { shuffle: false },
12601
+ effect: {
12602
+ field: "shuffle",
12603
+ value: false
12604
+ }
12405
12605
  },
12406
12606
  {
12407
12607
  id: "media.repeat",
@@ -12447,7 +12647,11 @@ var CAP_VOCABULARY = {
12447
12647
  }
12448
12648
  ]
12449
12649
  }
12450
- }]
12650
+ }],
12651
+ effect: {
12652
+ field: "repeat",
12653
+ fromArg: "repeat"
12654
+ }
12451
12655
  },
12452
12656
  {
12453
12657
  id: "media.source",
@@ -12472,7 +12676,11 @@ var CAP_VOCABULARY = {
12472
12676
  from: "status",
12473
12677
  field: "availableSources"
12474
12678
  }
12475
- }]
12679
+ }],
12680
+ effect: {
12681
+ field: "source",
12682
+ fromArg: "source"
12683
+ }
12476
12684
  },
12477
12685
  {
12478
12686
  id: "media.seek",
@@ -13012,7 +13220,14 @@ var CAP_VOCABULARY = {
13012
13220
  en: "Run {device}",
13013
13221
  it: "Esegui {device}"
13014
13222
  },
13015
- icon: "scroll-text"
13223
+ icon: "scroll-text",
13224
+ hold: {
13225
+ effects: [{
13226
+ field: "isRunning",
13227
+ value: true
13228
+ }],
13229
+ holdMs: 1e4
13230
+ }
13016
13231
  }, {
13017
13232
  id: "script.stop",
13018
13233
  method: "stop",
@@ -13024,7 +13239,11 @@ var CAP_VOCABULARY = {
13024
13239
  en: "Stop {device}",
13025
13240
  it: "Ferma {device}"
13026
13241
  },
13027
- icon: "square"
13242
+ icon: "square",
13243
+ effect: {
13244
+ field: "isRunning",
13245
+ value: false
13246
+ }
13028
13247
  }],
13029
13248
  state: [{
13030
13249
  kind: "boolean",
@@ -13062,7 +13281,11 @@ var CAP_VOCABULARY = {
13062
13281
  en: "Enable {device}",
13063
13282
  it: "Abilita {device}"
13064
13283
  },
13065
- icon: "toggle-right"
13284
+ icon: "toggle-right",
13285
+ effect: {
13286
+ field: "enabled",
13287
+ value: true
13288
+ }
13066
13289
  },
13067
13290
  {
13068
13291
  id: "haAutomation.disable",
@@ -13075,7 +13298,11 @@ var CAP_VOCABULARY = {
13075
13298
  en: "Disable {device}",
13076
13299
  it: "Disabilita {device}"
13077
13300
  },
13078
- icon: "toggle-left"
13301
+ icon: "toggle-left",
13302
+ effect: {
13303
+ field: "enabled",
13304
+ value: false
13305
+ }
13079
13306
  },
13080
13307
  {
13081
13308
  id: "haAutomation.trigger",
@@ -17466,7 +17693,12 @@ function actionEffect(actionId, args) {
17466
17693
  value: effect.value
17467
17694
  };
17468
17695
  const raw = args?.[effect.fromArg];
17469
- if (typeof raw === "string" || typeof raw === "number" || typeof raw === "boolean") return {
17696
+ if (typeof raw === "number") return {
17697
+ cap: found.cap,
17698
+ field: effect.field,
17699
+ value: raw * (effect.scale ?? 1)
17700
+ };
17701
+ if (typeof raw === "string" || typeof raw === "boolean") return {
17470
17702
  cap: found.cap,
17471
17703
  field: effect.field,
17472
17704
  value: raw
@@ -20674,7 +20906,10 @@ function buildAuditedFields() {
20674
20906
  set.add(field);
20675
20907
  byCap.set(cap, set);
20676
20908
  };
20677
- for (const { cap, action } of allVocabActions()) if (action.effect !== void 0) add(cap, action.effect.field);
20909
+ for (const { cap, action } of allVocabActions()) {
20910
+ if (action.effect !== void 0) add(cap, action.effect.field);
20911
+ for (const side of action.sideEffects ?? []) add(cap, side.field);
20912
+ }
20678
20913
  for (const [cap, entry] of Object.entries(CAP_VOCABULARY_BY_NAME)) {
20679
20914
  if (entry.scope !== "device") continue;
20680
20915
  for (const trigger of entry.state ?? []) if (trigger.kind === "boolean" || trigger.kind === "enum") add(cap, trigger.field);
@@ -20704,6 +20939,113 @@ function auditedFields(cap) {
20704
20939
  fieldsByCap ??= buildAuditedFields();
20705
20940
  return fieldsByCap.get(cap) ?? NO_FIELDS;
20706
20941
  }
20942
+ /** Does `slice` meet `when`? A field the slice lacks is in no list. */
20943
+ function effectConditionHolds(when, slice) {
20944
+ if (when === void 0) return true;
20945
+ const raw = slice?.[when.field];
20946
+ const value = typeof raw === "string" || typeof raw === "number" || typeof raw === "boolean" ? raw : void 0;
20947
+ if ("in" in when) return value !== void 0 && when.in.includes(value);
20948
+ return value === void 0 || !when.notIn.includes(value);
20949
+ }
20950
+ /** The step of the number open arg `key`, when the action offers one. */
20951
+ function stepOf(openArgs, key) {
20952
+ const offer = openArgs?.find((a) => a.key === key)?.offer;
20953
+ return offer?.kind === "number" && offer.step !== void 0 && offer.step > 0 ? offer.step : void 0;
20954
+ }
20955
+ /**
20956
+ * One side effect resolved against the args and the slice the command acts
20957
+ * on: `null` when the arg carrying its value is missing, or a `negate` names a
20958
+ * field the slice holds no boolean in. `openArgs` lends a copied number its
20959
+ * step as the tolerance.
20960
+ */
20961
+ function resolveSideEffect(side, args, shown, openArgs) {
20962
+ if ("value" in side) return {
20963
+ field: side.field,
20964
+ value: side.value
20965
+ };
20966
+ if ("negate" in side) {
20967
+ const raw = shown?.[side.field];
20968
+ return typeof raw === "boolean" ? {
20969
+ field: side.field,
20970
+ value: !raw
20971
+ } : null;
20972
+ }
20973
+ const raw = args?.[side.fromArg];
20974
+ if (typeof raw === "string" || typeof raw === "boolean") return {
20975
+ field: side.field,
20976
+ value: raw
20977
+ };
20978
+ if (typeof raw === "number") {
20979
+ const scale = side.scale ?? 1;
20980
+ const step = stepOf(openArgs, side.fromArg);
20981
+ return step === void 0 ? {
20982
+ field: side.field,
20983
+ value: raw * scale
20984
+ } : {
20985
+ field: side.field,
20986
+ value: raw * scale,
20987
+ tolerance: step * scale
20988
+ };
20989
+ }
20990
+ return null;
20991
+ }
20992
+ /**
20993
+ * The hold limit the vocabulary declares for `cap.method(args)` (its action's
20994
+ * `hold.holdMs`), or `undefined` for the default.
20995
+ */
20996
+ function commandHoldMs(cap, method, args) {
20997
+ return holdFor(cap, method, args)?.holdMs;
20998
+ }
20999
+ /**
21000
+ * The hold the vocabulary declares for `cap.method(args)`: the matched
21001
+ * action's, or — when several actions share the method and the args cannot
21002
+ * tell them apart (`petFeeder.feed` / `feedHoppers`) — the one they all
21003
+ * declare alike. Different holds on such actions resolve to none.
21004
+ */
21005
+ function holdFor(cap, method, args) {
21006
+ const actionId = vocabActionIdFor(cap, method, args);
21007
+ if (actionId !== void 0) return findVocabAction(actionId)?.action.hold;
21008
+ const holds = allVocabActions().filter(({ cap: c, action }) => c === cap && action.method === method).map(({ action }) => action.hold);
21009
+ const first = holds[0];
21010
+ if (first === void 0) return void 0;
21011
+ const key = JSON.stringify(first);
21012
+ return holds.every((h) => JSON.stringify(h) === key) ? first : void 0;
21013
+ }
21014
+ /**
21015
+ * EVERY state the command `cap.method(args)` leads to (D1061): its `effect`
21016
+ * first, then each side effect whose condition holds on `current` (the cap's
21017
+ * slice the device reported when the command arrived). Empty when it leads to
21018
+ * none. One field is named once — the first entry for it wins. A `negate`
21019
+ * side effect flips what `shown` (the slice the person saw, held values
21020
+ * included) holds, so a second toggle before the first is confirmed undoes it.
21021
+ * An action that declares `hold.effects` is held as THOSE instead (a lock
21022
+ * holds `locking`, not `locked`).
21023
+ */
21024
+ function commandEffects(cap, method, args, current, shown = current) {
21025
+ const out = [];
21026
+ const hold = holdFor(cap, method, args);
21027
+ if (hold?.effects !== void 0) {
21028
+ for (const entry of hold.effects) {
21029
+ if (!effectConditionHolds(entry.when, current)) continue;
21030
+ const resolved = resolveSideEffect(entry, args, shown);
21031
+ if (resolved !== null && !out.some((e) => e.field === resolved.field)) out.push(resolved);
21032
+ }
21033
+ return out;
21034
+ }
21035
+ const actionId = vocabActionIdFor(cap, method, args);
21036
+ if (actionId === void 0) return [];
21037
+ const action = findVocabAction(actionId)?.action;
21038
+ if (action?.effect !== void 0) {
21039
+ const primary = resolveSideEffect(action.effect, args, shown, action.openArgs);
21040
+ if (primary !== null) out.push(primary);
21041
+ }
21042
+ for (const side of action?.sideEffects ?? []) {
21043
+ if (!effectConditionHolds(side.when, current)) continue;
21044
+ const resolved = resolveSideEffect(side, args, shown, action?.openArgs);
21045
+ if (resolved !== null && !out.some((e) => e.field === resolved.field)) out.push(resolved);
21046
+ }
21047
+ return out;
21048
+ }
20707
21049
  //#endregion
20708
21050
  //#region src/device/device-state-handle.ts
20709
21051
  var DEVICE_STATE_EVENT_CATEGORY = "device.state-changed";
@@ -22439,4 +22781,4 @@ function sleepCancellable(ms, signal) {
22439
22781
  });
22440
22782
  }
22441
22783
  //#endregion
22442
- export { PipelineStepInputSchema as $, recordsOverMigrationApi as $i, StoredRecordKindDeclarationSchema as $n, REMOVE_LEAF as $r, parseProfileBrokerId as $t, CAP_ADVANCE_FIELDS as A, omitTransientConfig as Aa, linksOfKind as Ai, clearKnownSecrets as An, normalizeAddonInitResult as Ar, createDebugEmitter as At, describeCustomActions as B, RecordNotFoundError as Bi, PeerBytesTicketSchema as Bn, SCOPED_SETTINGS_SCOPES as Br, CamStreamResolutionSchema as Bt, auditedFields as C, makeSecretMarker as Ca, buildSecretRef as Ci, makeInMemoryRecords as Cn, FORBIDDEN_MESSAGE_PREFIX as Cr, DEBUG_CHANNEL_PREFIX as Ct, HF_BASE_URL as D, collectSecretConfigKeys as Da, normalizeSecretOwner as Di, REVALIDATE_AFTER_MS as Dn, BaseAddon as Dr, DebugInterest as Dt, DEFAULT_TOKEN_EXPIRY as E, collectKeychainStoredKeys as Ea, isSecretRef as Ei, resolveSecretViewsIn as En, userError as Er, DEBUG_WATCH_WINDOW_MS as Et, isCapMethodAbsent as F, audioChunkBytesPerSample as Fa, ForeignSecretMarkerError as Fi, shortSecretRefHash as Fn, KeychainWriteRefusedError as Fr, BrokerStatsSchema as Ft, nodePin as G, RevConflictError as Gi, defineEntryKind as Gn, createDurableState as Gr, ProfileSlotSchema as Gt, CAP_COMMAND_ORIGIN_CONTEXT_KEY as H, RecordTooLargeError as Hi, DATAPLANE_SECRET_HEADER as Hn, resolveDeviceSettings as Hr, DecodedAudioChunkSchema as Ht, CALLER_STAMPED_CAPABILITIES as I, expandAudioChunkToF32le as Ia, InvalidRecordError as Ii, PEER_BYTES_CHUNK_BYTES as In, collectSecretMarkerRefs as Ir, BrokerStatusSchema as It, toNodeId as J, UnknownRecordKindError as Ji, RecordFieldPathSchema as Jn, registrySwitchToBodyId as Jr, StreamSourceSchema as Jt, readCommandOrigin as K, TransactRefusedError as Ki, entryBody as Kn, moveRegistrySwitchToBody as Kr, ProfileSlotStatusSchema as Kt, withoutCallerStamp as L, isAudioChunkFormat as La, NoCallerError as Li, PEER_BYTES_MAX_OUTSTANDING as Ln, isSecretRefOwnedBy as Lr, CAM_PROFILE_ORDER as Lt, CAP_NAMES as M, AddonMigrationsBlockedError as Ma, BatchTooLargeError as Mi, knownSecretCount as Mn, parseSecretStatePath as Mr, isDebugChannelName as Mt, CAP_STATE_LEAVES as N, findMigrationsBlocked as Na, DeclarationRefusedError as Ni, registerKnownSecret as Nn, secretTreeFromPaths as Nr, AudioChunkFormatSchema as Nt, HF_REPO as O, isKeychainStoredField as Oa, parseSecretRef as Oi, createSecretsAccess as On, classifyStoreError as Or, DebugWatchTable as Ot, CAP_METHOD_NOT_IMPLEMENTED as P, AUDIO_CHUNK_FORMATS as Pa, FilterRequiredError as Pi, scrubKnownSecrets as Pn, secretTreeFromSchema as Pr, AudioStreamPickSchema as Pt, PipelineRunResultBridge as Q, integrationRowsApiOver as Qi, RecordRetentionSchema as Qn, secretViewsOf as Qr, makeSourceBrokerId as Qt, customAction as R, PlaintextSecretError as Ri, PEER_BYTES_STALL_MS as Rn, resolveSecretMarkers as Rr, CamProfileSchema as Rt, createSliceHandle as S, isSecretMarkerLike as Sa, arrayItemFieldPath as Si, ruleFireOfClaim as Sn, ErrorI18nPayloadSchema as Sr, scopeKey as St, isCommand as T, REDACTED_SECRET as Ta, globalSecretScope as Ti, assertTransactScope as Tn, readErrorI18n as Tr, DEBUG_WATCH_REARM_EVERY_MS as Tt, CAP_NODE_PIN_CONTEXT_KEY as U, RecordUniqueViolationError as Ui, SHARE_VIEW_KINDS as Un, resolvedValues as Ur, FrameHandleSchema as Ut, deviceCustomAction as V, RecordSecretUnavailableError as Vi, CALLER_USERNAME_HEADER as Vn, nodeIdOfScopedKey as Vr, CameraStreamSchema as Vt, commandOrigin as W, RecordsError as Wi, DisposerChain as Wn, normalizeNodeId as Wr, ProfileRtspEntrySchema as Wt, SWITCH_SETTABLE_GATE as X, recordsErrorFromMessage as Xi, RecordKindDeclarationSchema as Xn, RecordIntegrationInstances as Xr, SubscribeAudioChunksResultSchema as Xt, viewerUiCapability as Y, asRecordsError as Yi, RecordIndexSchema as Yn, registrySwitchToBodyMigration as Yr, SubscribeAudioChunksInputSchema as Yt, switchRefusesSetState as Z, defaultIntegrationDepsOver as Zi, RecordKindNameSchema as Zn, isInstanceEnabled as Zr, makeProfileBrokerId as Zt, invokeTrpcLeaf as _, SECRET_CLEAR as _a, RECORD_QUERY_MAX as _i, TransitionValueSchema as _n, optionalMethod as _r, MODEL_FORMATS as _t, asJsonArray as a, runAddonMigrations as aa, recordSecretRef as ai, baseUnitOf as an, isZodSecret as ar, AddonPageDeclarationSchema as at, createLazyTrpcSource as b, isSecretFieldView as ba, RECORD_SWEEP_INTERVAL_MS as bi, OnBehalfSourceSchema as bn, CamstackError as br, emitDownForOwnedCaps as bt, asString as c, isEvent as ca, RECORD_BATCH_MAX_BYTES as ci, isReadingQuantity as cn, DEVICE_STATUS_METHOD as cr, VocabActionError as ct, parseJsonUnknown as d, collectHydratedFieldEntries as da, RECORD_DEFAULT_MAX_DATA_BYTES as di, DeviceCommandSettledEventSchema as dn, PROVIDER_PIN_FIELD as dr, assertDeviceOffers as dt, rowsDepsOver as ea, collectSecretLeaves as ei, selectAssignedProfileSlots as en, assertValidDeclaration as er, MIGRATION_API_VERSION as et, hfModelUrl as f, collectHydratedFieldValues as fa, RECORD_DELETE_BATCH as fi, DeviceTransitionSchema as fn, event as fr, findVocabAction as ft, createDeviceProxy as g, resolveHydratedFieldValue as ga, RECORD_MAX_INDEX_FIELDS as gi, TransitionOutcomeSchema as gn, method as gr, CAP_VOCABULARY as gt, isDeviceScopedCap as h, hydrateSchema as ha, RECORD_MAX_INDEXES as hi, TransitionCommandSchema as hn, isDeviceConfigCap as hr, CAP_VOCABULARY_BY_NAME as ht, asBoolean as i, defineAddonMigrations as ia, recordSecretCollection as ii, ReadingQuantitySchema as in, collectZodSecretPaths as ir, adminUiCapability as it, CAP_METHOD_TIMEOUTS_MS as j, schemaDeclaresAnyField as ja, optionalLinkField as ji, forgetKnownSecret as jn, mergeSecretStatePaths as jr, getDebugInterest as jt, RUNTIME_DEFAULTS as k, isSecretConfigField as ka, linkField as ki, MIN_SCRUBBED_LENGTH as kn, migrationSet as kr, __resetDebugInterestForTests as kt, parseJsonArray as l, WELL_KNOWN_TABS as la, RECORD_CLASSES as li, readingMeta as ln, HISTORY_DEFAULT_MIN_INTERVAL_MS as lr, actionEffect as lt, DEVICE_SCOPED_CAPS as m, dehydrateSchema as ma, RECORD_MAX_DATA_BYTES as mi, TransitionActorSchema as mn, historyItemFieldPath as mr, vocabCall as mt, sleepCancellable as n, switchRecordsOverMigrationApi as na, parseSecretPath as ni, DISPLAY_PREFERENCES as nn, defineRecordKinds as nr, deviceOpsCapability as nt, asJsonObject as o, createEvent as oa, secretArrayPrefixes as oi, displayUnitFor as on, DEFAULT_RUNTIME_STATE_DURABILITY as or, addonPagesSourceCapability as ot, BOOT_RECOVERY_BACKOFF_MS as p, dehydrateConfigField as pa, RECORD_ID_MAX_LENGTH as pi, TransitionActorKindSchema as pn, expandCapMethods as pr, vocabActionIdFor as pt, readNodePin as q, UnindexedFilterError as qi, EntryDescriptorSchema as qn, registrySwitchPortsOver as qr, StreamSourceEntrySchema$1 as qt, maskUrlCredentials as r, AddonMigrationDefinitionError as ra, recordArrayItemPath as ri, QUANTITY_BASE as rn, SECRET_META as rr, DEVICE_CHILDREN_BATCH_MAX as rt, asNumber as s, emitReadiness as sa, RECORD_BATCH_MAX as si, historyUnitFor as sn, DEVICE_SETTINGS_CONTRIBUTION_METHODS as sr, t as st, sleep as t, secretsOverMigrationApi as ta, mapSecretLeaves as ti, DEFAULT_DISPLAY_PREFERENCE as tn, declarationsOf as tr, RawStateResultSchema as tt, parseJsonObject as u, WELL_KNOWN_TAB_MAP as ua, RECORD_DATABASES as ui, NOT_A_DEVICE as un, HISTORY_UNIT_LABELS as ur, allVocabActions as ut, addonSliceHandleApi as v, classifySecretWrite as va, RECORD_SECRET_COLLECTION_PREFIX as vi, CommandOriginClaimSchema as vn, resolveCapMount as vr, ReadinessRegistry as vt, commandEffect as w, toSecretFieldView as wa, formatSecretScope as wi, createRecordsAccess as wn, forbiddenError as wr, DEBUG_WATCH_HARD_CAP_MS as wt, createMirrorSource as x, isSecretMarker as xa, SECRET_REF_SCHEME as xi, RuleFireOriginSchema as xn, ErrorCodeSchema as xr, readinessKey as xt, createEventBusSliceSource as y, isSecretClear as ya, RECORD_SETTINGS_MAX_ROWS as yi, OnBehalfSchema as yn, systemMethod as yr, ReadinessTimeoutError as yt, defineCustomActions as z, RECORDS_ERROR_CODES as zi, PEER_BYTES_TICKET_TTL_MS as zn, transformSecretWrite as zr, CamStreamKindSchema as zt };
22784
+ export { viewerUiCapability as $, asRecordsError as $i, RecordIndexSchema as $n, registrySwitchToBodyMigration as $r, SubscribeAudioChunksInputSchema as $t, DEFAULT_TOKEN_EXPIRY as A, collectKeychainStoredKeys as Aa, isSecretRef as Ai, resolveSecretViewsIn as An, userError as Ar, DEBUG_WATCH_WINDOW_MS as At, CALLER_STAMPED_CAPABILITIES as B, expandAudioChunkToF32le as Ba, InvalidRecordError as Bi, PEER_BYTES_CHUNK_BYTES as Bn, collectSecretMarkerRefs as Br, BrokerStatusSchema as Bt, auditedFields as C, isSecretClear as Ca, RECORD_SETTINGS_MAX_ROWS as Ci, OnBehalfSchema as Cn, systemMethod as Cr, ReadinessTimeoutError as Ct, effectConditionHolds as D, makeSecretMarker as Da, buildSecretRef as Di, makeInMemoryRecords as Dn, FORBIDDEN_MESSAGE_PREFIX as Dr, DEBUG_CHANNEL_PREFIX as Dt, commandHoldMs as E, isSecretMarkerLike as Ea, arrayItemFieldPath as Ei, ruleFireOfClaim as En, ErrorI18nPayloadSchema as Er, scopeKey as Et, CAP_METHOD_TIMEOUTS_MS as F, schemaDeclaresAnyField as Fa, optionalLinkField as Fi, forgetKnownSecret as Fn, mergeSecretStatePaths as Fr, getDebugInterest as Ft, deviceCustomAction as G, RecordSecretUnavailableError as Gi, CALLER_USERNAME_HEADER as Gn, nodeIdOfScopedKey as Gr, CameraStreamSchema as Gt, customAction as H, PlaintextSecretError as Hi, PEER_BYTES_STALL_MS as Hn, resolveSecretMarkers as Hr, CamProfileSchema as Ht, CAP_NAMES as I, AddonMigrationsBlockedError as Ia, BatchTooLargeError as Ii, knownSecretCount as In, parseSecretStatePath as Ir, isDebugChannelName as It, commandOrigin as J, RecordsError as Ji, DisposerChain as Jn, normalizeNodeId as Jr, ProfileRtspEntrySchema as Jt, CAP_COMMAND_ORIGIN_CONTEXT_KEY as K, RecordTooLargeError as Ki, DATAPLANE_SECRET_HEADER as Kn, resolveDeviceSettings as Kr, DecodedAudioChunkSchema as Kt, CAP_STATE_LEAVES as L, findMigrationsBlocked as La, DeclarationRefusedError as Li, registerKnownSecret as Ln, secretTreeFromPaths as Lr, AudioChunkFormatSchema as Lt, HF_REPO as M, isKeychainStoredField as Ma, parseSecretRef as Mi, createSecretsAccess as Mn, classifyStoreError as Mr, DebugWatchTable as Mt, RUNTIME_DEFAULTS as N, isSecretConfigField as Na, linkField as Ni, MIN_SCRUBBED_LENGTH as Nn, migrationSet as Nr, __resetDebugInterestForTests as Nt, isCommand as O, toSecretFieldView as Oa, formatSecretScope as Oi, createRecordsAccess as On, forbiddenError as Or, DEBUG_WATCH_HARD_CAP_MS as Ot, CAP_ADVANCE_FIELDS as P, omitTransientConfig as Pa, linksOfKind as Pi, clearKnownSecrets as Pn, normalizeAddonInitResult as Pr, createDebugEmitter as Pt, toNodeId as Q, UnknownRecordKindError as Qi, RecordFieldPathSchema as Qn, registrySwitchToBodyId as Qr, StreamSourceSchema as Qt, CAP_METHOD_NOT_IMPLEMENTED as R, AUDIO_CHUNK_FORMATS as Ra, FilterRequiredError as Ri, scrubKnownSecrets as Rn, secretTreeFromSchema as Rr, AudioStreamPickSchema as Rt, createSliceHandle as S, classifySecretWrite as Sa, RECORD_SECRET_COLLECTION_PREFIX as Si, CommandOriginClaimSchema as Sn, resolveCapMount as Sr, ReadinessRegistry as St, commandEffects as T, isSecretMarker as Ta, SECRET_REF_SCHEME as Ti, RuleFireOriginSchema as Tn, ErrorCodeSchema as Tr, readinessKey as Tt, defineCustomActions as U, RECORDS_ERROR_CODES as Ui, PEER_BYTES_TICKET_TTL_MS as Un, transformSecretWrite as Ur, CamStreamKindSchema as Ut, withoutCallerStamp as V, isAudioChunkFormat as Va, NoCallerError as Vi, PEER_BYTES_MAX_OUTSTANDING as Vn, isSecretRefOwnedBy as Vr, CAM_PROFILE_ORDER as Vt, describeCustomActions as W, RecordNotFoundError as Wi, PeerBytesTicketSchema as Wn, SCOPED_SETTINGS_SCOPES as Wr, CamStreamResolutionSchema as Wt, readCommandOrigin as X, TransactRefusedError as Xi, entryBody as Xn, moveRegistrySwitchToBody as Xr, ProfileSlotStatusSchema as Xt, nodePin as Y, RevConflictError as Yi, defineEntryKind as Yn, createDurableState as Yr, ProfileSlotSchema as Yt, readNodePin as Z, UnindexedFilterError as Zi, EntryDescriptorSchema as Zn, registrySwitchPortsOver as Zr, StreamSourceEntrySchema$1 as Zt, invokeTrpcLeaf as _, dehydrateConfigField as _a, RECORD_ID_MAX_LENGTH as _i, TransitionActorKindSchema as _n, expandCapMethods as _r, vocabActionIdFor as _t, asJsonArray as a, secretsOverMigrationApi as aa, mapSecretLeaves as ai, DEFAULT_DISPLAY_PREFERENCE as an, declarationsOf as ar, RawStateResultSchema as at, createLazyTrpcSource as b, resolveHydratedFieldValue as ba, RECORD_MAX_INDEX_FIELDS as bi, TransitionOutcomeSchema as bn, method as br, CAP_VOCABULARY as bt, asString as c, defineAddonMigrations as ca, recordSecretCollection as ci, ReadingQuantitySchema as cn, collectZodSecretPaths as cr, adminUiCapability as ct, parseJsonUnknown as d, emitReadiness as da, RECORD_BATCH_MAX as di, historyUnitFor as dn, DEVICE_SETTINGS_CONTRIBUTION_METHODS as dr, t as dt, recordsErrorFromMessage as ea, RecordIntegrationInstances as ei, SubscribeAudioChunksResultSchema as en, RecordKindDeclarationSchema as er, SWITCH_SETTABLE_GATE as et, hfModelUrl as f, isEvent as fa, RECORD_BATCH_MAX_BYTES as fi, isReadingQuantity as fn, DEVICE_STATUS_METHOD as fr, VocabActionError as ft, createDeviceProxy as g, collectHydratedFieldValues as ga, RECORD_DELETE_BATCH as gi, DeviceTransitionSchema as gn, event as gr, findVocabAction as gt, isDeviceScopedCap as h, collectHydratedFieldEntries as ha, RECORD_DEFAULT_MAX_DATA_BYTES as hi, DeviceCommandSettledEventSchema as hn, PROVIDER_PIN_FIELD as hr, assertDeviceOffers as ht, asBoolean as i, rowsDepsOver as ia, collectSecretLeaves as ii, selectAssignedProfileSlots as in, assertValidDeclaration as ir, MIGRATION_API_VERSION as it, HF_BASE_URL as j, collectSecretConfigKeys as ja, normalizeSecretOwner as ji, REVALIDATE_AFTER_MS as jn, BaseAddon as jr, DebugInterest as jt, resolveSideEffect as k, REDACTED_SECRET as ka, globalSecretScope as ki, assertTransactScope as kn, readErrorI18n as kr, DEBUG_WATCH_REARM_EVERY_MS as kt, parseJsonArray as l, runAddonMigrations as la, recordSecretRef as li, baseUnitOf as ln, isZodSecret as lr, AddonPageDeclarationSchema as lt, DEVICE_SCOPED_CAPS as m, WELL_KNOWN_TAB_MAP as ma, RECORD_DATABASES as mi, NOT_A_DEVICE as mn, HISTORY_UNIT_LABELS as mr, allVocabActions as mt, sleepCancellable as n, integrationRowsApiOver as na, secretViewsOf as ni, makeSourceBrokerId as nn, RecordRetentionSchema as nr, PipelineRunResultBridge as nt, asJsonObject as o, switchRecordsOverMigrationApi as oa, parseSecretPath as oi, DISPLAY_PREFERENCES as on, defineRecordKinds as or, deviceOpsCapability as ot, BOOT_RECOVERY_BACKOFF_MS as p, WELL_KNOWN_TABS as pa, RECORD_CLASSES as pi, readingMeta as pn, HISTORY_DEFAULT_MIN_INTERVAL_MS as pr, actionEffect as pt, CAP_NODE_PIN_CONTEXT_KEY as q, RecordUniqueViolationError as qi, SHARE_VIEW_KINDS as qn, resolvedValues as qr, FrameHandleSchema as qt, maskUrlCredentials as r, recordsOverMigrationApi as ra, REMOVE_LEAF as ri, parseProfileBrokerId as rn, StoredRecordKindDeclarationSchema as rr, PipelineStepInputSchema as rt, asNumber as s, AddonMigrationDefinitionError as sa, recordArrayItemPath as si, QUANTITY_BASE as sn, SECRET_META as sr, DEVICE_CHILDREN_BATCH_MAX as st, sleep as t, defaultIntegrationDepsOver as ta, isInstanceEnabled as ti, makeProfileBrokerId as tn, RecordKindNameSchema as tr, switchRefusesSetState as tt, parseJsonObject as u, createEvent as ua, secretArrayPrefixes as ui, displayUnitFor as un, DEFAULT_RUNTIME_STATE_DURABILITY as ur, addonPagesSourceCapability as ut, addonSliceHandleApi as v, dehydrateSchema as va, RECORD_MAX_DATA_BYTES as vi, TransitionActorSchema as vn, historyItemFieldPath as vr, vocabCall as vt, commandEffect as w, isSecretFieldView as wa, RECORD_SWEEP_INTERVAL_MS as wi, OnBehalfSourceSchema as wn, CamstackError as wr, emitDownForOwnedCaps as wt, createMirrorSource as x, SECRET_CLEAR as xa, RECORD_QUERY_MAX as xi, TransitionValueSchema as xn, optionalMethod as xr, MODEL_FORMATS as xt, createEventBusSliceSource as y, hydrateSchema as ya, RECORD_MAX_INDEXES as yi, TransitionCommandSchema as yn, isDeviceConfigCap as yr, CAP_VOCABULARY_BY_NAME as yt, isCapMethodAbsent as z, audioChunkBytesPerSample as za, ForeignSecretMarkerError as zi, shortSecretRefHash as zn, KeychainWriteRefusedError as zr, BrokerStatsSchema as zt };