@camstack/addon-export-google 0.1.123 → 0.1.124

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.
@@ -859,7 +859,7 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
859
859
  return EventCategory;
860
860
  }({});
861
861
  //#endregion
862
- //#region ../types/dist/device-type-BOWLtoOt.mjs
862
+ //#region ../types/dist/device-type-D1fH5kaC.mjs
863
863
  /**
864
864
  import { errMsg } from '@camstack/types'
865
865
  * Extract a human-readable message from an unknown error value.
@@ -1048,6 +1048,9 @@ var DeviceFeature = /* @__PURE__ */ function(DeviceFeature) {
1048
1048
  DeviceFeature["CoverPositionable"] = "cover-positionable";
1049
1049
  /** Cover exposes slat-tilt control. Gates the tilt slider UI. */
1050
1050
  DeviceFeature["CoverTilt"] = "cover-tilt";
1051
+ /** Cover has a real stop: `stop` halts the travel in place. Gates the stop
1052
+ * control in exporters; a provider whose `stop` is a no-op never declares it. */
1053
+ DeviceFeature["CoverStoppable"] = "cover-stoppable";
1051
1054
  /** Valve exposes intermediate position control (0..100). Gates the
1052
1055
  * position slider / drag surface UI. */
1053
1056
  DeviceFeature["ValvePositionable"] = "valve-positionable";
@@ -1087,6 +1090,12 @@ var DeviceFeature = /* @__PURE__ */ function(DeviceFeature) {
1087
1090
  DeviceFeature["MediaPlayerPrevious"] = "media-player-previous";
1088
1091
  /** Media player exposes stop distinct from pause. */
1089
1092
  DeviceFeature["MediaPlayerStop"] = "media-player-stop";
1093
+ /** Media player exposes volume up / down in steps (an infrared TV has no level). */
1094
+ DeviceFeature["MediaPlayerVolumeStep"] = "media-player-volume-step";
1095
+ /** Media player exposes channel up / down in steps. */
1096
+ DeviceFeature["MediaPlayerChannelStep"] = "media-player-channel-step";
1097
+ /** Media player exposes power on / off. */
1098
+ DeviceFeature["MediaPlayerPower"] = "media-player-power";
1090
1099
  /** Alarm panel requires a PIN code on arm/disarm. */
1091
1100
  DeviceFeature["AlarmPinRequired"] = "alarm-pin-required";
1092
1101
  /** Presence device carries GPS coordinates (lat/lng/accuracy) in
@@ -5913,7 +5922,7 @@ var ZodIssueCode = {
5913
5922
  var ZodFirstPartyTypeKind;
5914
5923
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
5915
5924
  //#endregion
5916
- //#region ../types/dist/sleep-CdJHPm-k.mjs
5925
+ //#region ../types/dist/sleep-BkzQdpzF.mjs
5917
5926
  /**
5918
5927
  * The audio chunk plane's byte format, and the ONE expansion from a coded
5919
5928
  * window to float samples (D455).
@@ -5992,6 +6001,22 @@ function buildAlawTable() {
5992
6001
  }
5993
6002
  buildUlawTable();
5994
6003
  buildAlawTable();
6004
+ /**
6005
+ * An addon whose own migrations did not apply refuses to initialise (D987). The error is typed
6006
+ * so a runner hosting several addons can tell "this addon is blocked" from a crash and keep its
6007
+ * co-located siblings running. Recognised by NAME and shape, never `instanceof`: a forked addon
6008
+ * bundles its own copy of this module, so the class the runner sees is not the one that threw.
6009
+ */
6010
+ var MIGRATIONS_BLOCKED_ERROR_NAME = "AddonMigrationsBlockedError";
6011
+ var AddonMigrationsBlockedError = class extends Error {
6012
+ /** The ledger ids that did not apply and block the owner. */
6013
+ migrationIds;
6014
+ constructor(migrationIds) {
6015
+ super(`migration(s) ${migrationIds.join(", ")} did not apply and block this addon — fix or retry them (migrations.retry), then restart it`);
6016
+ this.name = MIGRATIONS_BLOCKED_ERROR_NAME;
6017
+ this.migrationIds = migrationIds;
6018
+ }
6019
+ };
5995
6020
  /** Is this field's stored value a credential? */
5996
6021
  function isSecretConfigField(field) {
5997
6022
  if (field.type === "password") return true;
@@ -7645,7 +7670,7 @@ var BaseAddon = class {
7645
7670
  startMigration: (input) => api.startMigration.mutate(input),
7646
7671
  finishMigration: (input) => api.finishMigration.mutate(input)
7647
7672
  }, migrations, this.ctx.logger);
7648
- if (report.blockOwner.length > 0) throw new Error(`migration(s) ${report.blockOwner.join(", ")} did not apply and block this addon — fix or retry them (migrations.retry), then restart it`);
7673
+ if (report.blockOwner.length > 0) throw new AddonMigrationsBlockedError(report.blockOwner);
7649
7674
  return report;
7650
7675
  }
7651
7676
  /**
@@ -7985,6 +8010,10 @@ var BaseAddon = class {
7985
8010
  const stored = keychain ? await this.readAddonStoreWithRetry() : {};
7986
8011
  const patch = {};
7987
8012
  for (const key of keys) {
8013
+ if (tree.get(key)?.kind === "array") {
8014
+ patch[key] = [];
8015
+ continue;
8016
+ }
7988
8017
  const keychainStored = tree.has(key) || collectSecretMarkerRefs(stored[key]).length > 0;
7989
8018
  patch[key] = keychain && keychainStored ? SECRET_CLEAR : "";
7990
8019
  }
@@ -9381,6 +9410,7 @@ var CAP_NAMES = Object.freeze([
9381
9410
  "backup",
9382
9411
  "battery",
9383
9412
  "binary",
9413
+ "board-key-source",
9384
9414
  "brightness",
9385
9415
  "broker",
9386
9416
  "button",
@@ -9502,6 +9532,7 @@ var CAP_NAMES = Object.freeze([
9502
9532
  "privacy-mask",
9503
9533
  "ptz",
9504
9534
  "ptz-autotrack",
9535
+ "pump-cycle",
9505
9536
  "reboot",
9506
9537
  "record-entries",
9507
9538
  "recording",
@@ -10794,18 +10825,6 @@ Object.freeze({
10794
10825
  "path": "pumpRunning",
10795
10826
  "valueType": "boolean"
10796
10827
  },
10797
- {
10798
- "path": "pumpIntervalEnabled",
10799
- "valueType": "boolean"
10800
- },
10801
- {
10802
- "path": "pumpOnTime",
10803
- "valueType": "number"
10804
- },
10805
- {
10806
- "path": "pumpOffTime",
10807
- "valueType": "number"
10808
- },
10809
10828
  {
10810
10829
  "path": "lastDrink",
10811
10830
  "valueType": "number"
@@ -10929,6 +10948,20 @@ Object.freeze({
10929
10948
  "valueType": "number"
10930
10949
  }
10931
10950
  ],
10951
+ "pump-cycle": [
10952
+ {
10953
+ "path": "enabled",
10954
+ "valueType": "boolean"
10955
+ },
10956
+ {
10957
+ "path": "onTime",
10958
+ "valueType": "number"
10959
+ },
10960
+ {
10961
+ "path": "offTime",
10962
+ "valueType": "number"
10963
+ }
10964
+ ],
10932
10965
  "recording-archive": [
10933
10966
  {
10934
10967
  "path": "deviceId",
@@ -11378,7 +11411,7 @@ object({
11378
11411
  params: record(string(), union([string(), number()])).optional()
11379
11412
  });
11380
11413
  //#endregion
11381
- //#region ../types/dist/composition-BDUoQsw9.mjs
11414
+ //#region ../types/dist/composition-CRNwcFYY.mjs
11382
11415
  /**
11383
11416
  * The ffmpeg build every CamStack node downloads, per platform and arch.
11384
11417
  *
@@ -12141,38 +12174,6 @@ function validateExpressionSource(src) {
12141
12174
  return null;
12142
12175
  }
12143
12176
  /**
12144
- * One power reading becomes a washer, dryer or dishwasher (D944 helper).
12145
- *
12146
- * Standby of the control board is under 5 W; a motor or a heater is far
12147
- * above that, so 5 W is the line. A door lock or a short pump spike is not
12148
- * a cycle, so running starts only after 30 s above the line.
12149
- *
12150
- * A wash, dry or dishwasher pause (soak, heat-wait, heater off between
12151
- * bursts) lasts several minutes. Ending the cycle on the first dip would
12152
- * report "finished" in the middle of the program, so the stop dwell is
12153
- * 10 minutes on every type. The number is stored per type so one machine
12154
- * can move later without moving the others.
12155
- */
12156
- var APPLIANCE_TEMPLATE_ID = "appliance";
12157
- var APPLIANCE_KINDS = [
12158
- "washer",
12159
- "dryer",
12160
- "dishwasher"
12161
- ];
12162
- DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher;
12163
- /**
12164
- * A dumb plug-in stove or heater, built from a smart plug (a `Heater`).
12165
- *
12166
- * The plug is the actuator: `switch.setState` is a FORWARD to the plug's own
12167
- * (D967), so the heater switches exactly as the plug does. Running is the
12168
- * plug being on; when a power reading is also named, running is the draw
12169
- * staying above the line instead (a plug left on with the stove's own
12170
- * thermostat open is not heating). 50 W is far above any standby and below
12171
- * the smallest radiator.
12172
- */
12173
- var HEATER_TEMPLATE_ID = "heater";
12174
- DeviceType.Heater;
12175
- /**
12176
12177
  * Statistics and integrals over a history read (D944).
12177
12178
  *
12178
12179
  * Pure: the same points always give the same answer, so a restart recomputes
@@ -12316,34 +12317,6 @@ var HelperSpecSchema = discriminatedUnion("kind", [
12316
12317
  /** Actuator groups only. Readings leave this unset. */
12317
12318
  active: ActiveCriterionSchema.optional()
12318
12319
  }),
12319
- object({
12320
- kind: literal("appliance"),
12321
- templateId: literal(APPLIANCE_TEMPLATE_ID),
12322
- appliance: _enum(APPLIANCE_KINDS),
12323
- thresholdWatts: number().positive(),
12324
- startDwellMs: number().int().nonnegative(),
12325
- stopDwellMs: number().int().nonnegative(),
12326
- member: HelperMemberSchema,
12327
- /**
12328
- * The plug that powers the appliance (`switch.on`). Optional: when set, the
12329
- * composition carries a `power-source` feature, so the hub can cut and restore
12330
- * that plug (power-source link of a NEW-target composition).
12331
- */
12332
- powerSwitch: HelperMemberSchema.optional(),
12333
- /** How long a forced restart keeps the plug off; the cap's default when unset. */
12334
- offSeconds: number().optional()
12335
- }),
12336
- object({
12337
- kind: literal("heater"),
12338
- templateId: literal(HEATER_TEMPLATE_ID),
12339
- /** The plug, read and commanded at `switch.on`. */
12340
- plug: HelperMemberSchema,
12341
- /** The plug's power reading, when it has one: running is then the draw, not the switch. */
12342
- meter: HelperMemberSchema.optional(),
12343
- thresholdWatts: number().positive(),
12344
- startDwellMs: number().int().nonnegative(),
12345
- stopDwellMs: number().int().nonnegative()
12346
- }),
12347
12320
  object({
12348
12321
  kind: literal("statistic"),
12349
12322
  stat: _enum(STATISTIC_STATS),
@@ -12515,7 +12488,14 @@ var CompositionForwardCommandSchema = object({
12515
12488
  method: string().min(1),
12516
12489
  args: record(string().min(1), CompositionForwardArgSchema).optional()
12517
12490
  });
12518
- var CompositionCommandTargetSchema = discriminatedUnion("kind", [CompositionForwardCommandSchema, CompositionCodeSourceSchema]);
12491
+ var CompositionCommandTargetSchema = discriminatedUnion("kind", [
12492
+ CompositionForwardCommandSchema,
12493
+ CompositionCodeSourceSchema,
12494
+ object({
12495
+ kind: literal("extension"),
12496
+ target: literal("remote")
12497
+ })
12498
+ ]);
12519
12499
  /** An item key inside an item-array cap (`consumables.items[<key>]`). */
12520
12500
  var COMPOSITION_ITEM_KEY_RE = /^[a-z0-9][a-z0-9-]{0,47}$/;
12521
12501
  /**
@@ -12560,7 +12540,7 @@ var CompositionSchema = object({
12560
12540
  kind: literal("existing"),
12561
12541
  device: CompositionSourceRefSchema
12562
12542
  })]),
12563
- features: array(CompositionFeatureSchema).min(1).max(16),
12543
+ features: array(CompositionFeatureSchema).min(0).max(16),
12564
12544
  /**
12565
12545
  * Present when the block is a helper template. Absent on a free
12566
12546
  * composition (the room example, device 4603). The editor reads this,
@@ -12592,6 +12572,73 @@ var NodeColorIdSchema = _enum([
12592
12572
  "node-g",
12593
12573
  "node-h"
12594
12574
  ]);
12575
+ //#endregion
12576
+ //#region ../types/dist/index.mjs
12577
+ var SMTP_INBOUND_DEFAULT_PORT = 2525;
12578
+ var SMTP_INBOUND_DEFAULT_DOMAIN = "camstack.local";
12579
+ var SMTP_INBOUND_DEFAULT_MAX_MESSAGE_BYTES = 25 * 1024 * 1024;
12580
+ /** The text excerpt a message carries on the bus. */
12581
+ var SMTP_INBOUND_TEXT_MAX_CHARS = 4096;
12582
+ var PortSchema = number().int().min(1).max(65535);
12583
+ /** A recipient local-part: what stands before the `@`. */
12584
+ var SmtpRecipientSchema = string().min(1).max(64).regex(/^[A-Za-z0-9._+-]+$/);
12585
+ object({
12586
+ port: PortSchema.default(SMTP_INBOUND_DEFAULT_PORT),
12587
+ bindHost: string().min(1).default("0.0.0.0"),
12588
+ domain: string().min(1).default(SMTP_INBOUND_DEFAULT_DOMAIN),
12589
+ requireAuth: boolean().default(true),
12590
+ username: string().default(""),
12591
+ password: string().default("").meta({ secret: true }),
12592
+ starttls: boolean().default(false),
12593
+ maxMessageBytes: number().int().positive().default(SMTP_INBOUND_DEFAULT_MAX_MESSAGE_BYTES)
12594
+ });
12595
+ object({
12596
+ host: string().min(1).nullable(),
12597
+ hostReason: string().nullable(),
12598
+ port: PortSchema,
12599
+ domain: string().min(1),
12600
+ requireAuth: boolean(),
12601
+ username: string(),
12602
+ password: string(),
12603
+ starttls: boolean()
12604
+ });
12605
+ object({
12606
+ recipients: array(SmtpRecipientSchema).min(1),
12607
+ /**
12608
+ * Who is subscribing. A second `subscribe` with the same id REPLACES that subscriber's
12609
+ * recipients (the way a consumer that restarted, or lost a device, declares its set again);
12610
+ * a recipient held by another subscriber is refused with `smtp-inbound/recipient-claimed`.
12611
+ * Absent, the subscriber is anonymous and unique.
12612
+ */
12613
+ subscriberId: string().min(1).max(64).optional()
12614
+ });
12615
+ var SmtpInboundAttachmentSchema = object({
12616
+ filename: string(),
12617
+ contentType: string(),
12618
+ bytes: number().int().nonnegative()
12619
+ });
12620
+ /** The payload of one `broker.message` (the key is the recipient local-part). */
12621
+ var SmtpInboundMessageSchema = object({
12622
+ /** Monotonic per mailbox; a gap tells a consumer it missed an event. */
12623
+ seq: number().int().positive(),
12624
+ messageId: string(),
12625
+ receivedAt: number().int().nonnegative(),
12626
+ from: string(),
12627
+ to: string(),
12628
+ subject: string(),
12629
+ text: string().max(SMTP_INBOUND_TEXT_MAX_CHARS),
12630
+ attachments: array(SmtpInboundAttachmentSchema)
12631
+ });
12632
+ object({
12633
+ /** The newest seq issued so far (0 before any mail). */
12634
+ lastSeq: number().int().nonnegative(),
12635
+ /** The oldest seq still retained; messages below it are gone. */
12636
+ oldestSeq: number().int().nonnegative(),
12637
+ messages: array(object({
12638
+ key: string(),
12639
+ message: SmtpInboundMessageSchema
12640
+ }))
12641
+ });
12595
12642
  new Set([
12596
12643
  "track",
12597
12644
  "face",
@@ -18998,24 +19045,52 @@ var APPLIANCE_CAP_VOCABULARY = {
18998
19045
  args: { on: false }
18999
19046
  },
19000
19047
  {
19001
- id: "petFountain.intervalOn",
19002
- method: "setPumpInterval",
19048
+ id: "petFountain.resetDailyConsumption",
19049
+ method: "resetDailyConsumption",
19050
+ label: t("Clear daily consumption", "Azzera il consumo giornaliero"),
19051
+ phrase: t("Clear the daily water consumption of {device}", "Azzera il consumo giornaliero di acqua di {device}"),
19052
+ icon: "rotate-ccw"
19053
+ }
19054
+ ],
19055
+ state: [{
19056
+ kind: "boolean",
19057
+ field: "empty",
19058
+ label: t("Tank empty", "Serbatoio vuoto"),
19059
+ whenTrue: t("When the tank of {device} is empty", "Quando il serbatoio di {device} è vuoto"),
19060
+ whenFalse: t("When the tank of {device} is refilled", "Quando il serbatoio di {device} viene riempito"),
19061
+ icon: "droplet"
19062
+ }, {
19063
+ kind: "numeric",
19064
+ field: "waterLevel",
19065
+ quantity: t("the water level", "il livello dell’acqua"),
19066
+ label: t("Water level", "Livello dell’acqua"),
19067
+ unit: "%",
19068
+ icon: "droplets"
19069
+ }]
19070
+ },
19071
+ "pump-cycle": {
19072
+ scope: "device",
19073
+ noun: t("Pump cycle", "Ciclo della pompa"),
19074
+ actions: [
19075
+ {
19076
+ id: "pumpCycle.on",
19077
+ method: "setEnabled",
19003
19078
  label: t("Pump cycle on", "Ciclo pompa attivo"),
19004
19079
  phrase: t("Run the pump of {device} on its on/off cycle", "Fai lavorare la pompa di {device} a ciclo acceso/spento"),
19005
19080
  icon: "timer",
19006
19081
  args: { on: true }
19007
19082
  },
19008
19083
  {
19009
- id: "petFountain.intervalOff",
19010
- method: "setPumpInterval",
19084
+ id: "pumpCycle.off",
19085
+ method: "setEnabled",
19011
19086
  label: t("Pump cycle off", "Ciclo pompa spento"),
19012
19087
  phrase: t("Run the pump of {device} continuously", "Fai lavorare la pompa di {device} in continuo"),
19013
19088
  icon: "timer-off",
19014
19089
  args: { on: false }
19015
19090
  },
19016
19091
  {
19017
- id: "petFountain.pumpOnMinutes",
19018
- method: "setPumpOnMinutes",
19092
+ id: "pumpCycle.onMinutes",
19093
+ method: "setOnMinutes",
19019
19094
  label: t("Set pump run time", "Imposta il tempo di lavoro della pompa"),
19020
19095
  phrase: t("Set the pump of {device} to run {minutes} minutes per cycle", "Imposta la pompa di {device} a lavorare {minutes} minuti per ciclo"),
19021
19096
  icon: "timer",
@@ -19031,8 +19106,8 @@ var APPLIANCE_CAP_VOCABULARY = {
19031
19106
  }]
19032
19107
  },
19033
19108
  {
19034
- id: "petFountain.pumpOffMinutes",
19035
- method: "setPumpOffMinutes",
19109
+ id: "pumpCycle.offMinutes",
19110
+ method: "setOffMinutes",
19036
19111
  label: t("Set pump rest time", "Imposta il tempo di riposo della pompa"),
19037
19112
  phrase: t("Set the pump of {device} to rest {minutes} minutes per cycle", "Imposta la pompa di {device} a riposare {minutes} minuti per ciclo"),
19038
19113
  icon: "timer-off",
@@ -19046,35 +19121,63 @@ var APPLIANCE_CAP_VOCABULARY = {
19046
19121
  unit: "min"
19047
19122
  }
19048
19123
  }]
19049
- },
19050
- {
19051
- id: "petFountain.resetDailyConsumption",
19052
- method: "resetDailyConsumption",
19053
- label: t("Clear daily consumption", "Azzera il consumo giornaliero"),
19054
- phrase: t("Clear the daily water consumption of {device}", "Azzera il consumo giornaliero di acqua di {device}"),
19055
- icon: "rotate-ccw"
19056
19124
  }
19057
19125
  ],
19058
19126
  state: [{
19059
19127
  kind: "boolean",
19060
- field: "empty",
19061
- label: t("Tank empty", "Serbatoio vuoto"),
19062
- whenTrue: t("When the tank of {device} is empty", "Quando il serbatoio di {device} è vuoto"),
19063
- whenFalse: t("When the tank of {device} is refilled", "Quando il serbatoio di {device} viene riempito"),
19064
- icon: "droplet"
19065
- }, {
19066
- kind: "numeric",
19067
- field: "waterLevel",
19068
- quantity: t("the water level", "il livello dell’acqua"),
19069
- label: t("Water level", "Livello dell’acqua"),
19070
- unit: "%",
19071
- icon: "droplets"
19128
+ field: "enabled",
19129
+ label: t("Pump cycle", "Ciclo pompa"),
19130
+ whenTrue: t("When {device} starts running its pump on a cycle", "Quando {device} inizia a far lavorare la pompa a ciclo"),
19131
+ whenFalse: t("When {device} runs its pump continuously", "Quando {device} fa lavorare la pompa in continuo"),
19132
+ icon: "timer"
19072
19133
  }]
19073
19134
  },
19074
19135
  "media-player": {
19075
19136
  scope: "device",
19076
19137
  noun: t("Media player", "Lettore multimediale"),
19077
19138
  actions: [
19139
+ {
19140
+ id: "media.turnOn",
19141
+ method: "turnOn",
19142
+ label: t("Turn on", "Accendi"),
19143
+ phrase: t("Turn on {device}", "Accendi {device}"),
19144
+ icon: "power"
19145
+ },
19146
+ {
19147
+ id: "media.turnOff",
19148
+ method: "turnOff",
19149
+ label: t("Turn off", "Spegni"),
19150
+ phrase: t("Turn off {device}", "Spegni {device}"),
19151
+ icon: "power"
19152
+ },
19153
+ {
19154
+ id: "media.volumeUp",
19155
+ method: "volumeUp",
19156
+ label: t("Volume up", "Alza il volume"),
19157
+ phrase: t("Raise the volume of {device}", "Alza il volume di {device}"),
19158
+ icon: "volume-2"
19159
+ },
19160
+ {
19161
+ id: "media.volumeDown",
19162
+ method: "volumeDown",
19163
+ label: t("Volume down", "Abbassa il volume"),
19164
+ phrase: t("Lower the volume of {device}", "Abbassa il volume di {device}"),
19165
+ icon: "volume-2"
19166
+ },
19167
+ {
19168
+ id: "media.channelUp",
19169
+ method: "channelUp",
19170
+ label: t("Channel up", "Canale successivo"),
19171
+ phrase: t("Go to the next channel on {device}", "Passa al canale successivo su {device}"),
19172
+ icon: "skip-forward"
19173
+ },
19174
+ {
19175
+ id: "media.channelDown",
19176
+ method: "channelDown",
19177
+ label: t("Channel down", "Canale precedente"),
19178
+ phrase: t("Go to the previous channel on {device}", "Torna al canale precedente su {device}"),
19179
+ icon: "skip-back"
19180
+ },
19078
19181
  {
19079
19182
  id: "media.play",
19080
19183
  method: "play",
@@ -20961,6 +21064,7 @@ var SYSTEM_CAP_VOCABULARY = {
20961
21064
  "audio-analyzer": system(PIPELINE),
20962
21065
  "audio-codec": system(INTERNAL),
20963
21066
  "auth-provider": system(IDENTITY),
21067
+ "board-key-source": system(INTERNAL),
20964
21068
  backup: system("system backups — run and restored from the Backups page"),
20965
21069
  broker: system("message-broker connections — configured, not actuated"),
20966
21070
  "calendar-source": system(INTERNAL),
@@ -45507,6 +45611,49 @@ object({
45507
45611
  });
45508
45612
  DeviceType.Sensor;
45509
45613
  /**
45614
+ * Why a board key could not be read. Typed so a caller reports the cause and
45615
+ * never treats "could not read" as "has no key" (D49).
45616
+ */
45617
+ var BoardKeyFailureReasonSchema = _enum([
45618
+ "unknown-source",
45619
+ "not-admin",
45620
+ "no-builder",
45621
+ "no-ingress-url",
45622
+ "unreachable",
45623
+ "unknown-board",
45624
+ "no-encryption-key",
45625
+ "unreadable-config"
45626
+ ]);
45627
+ var BoardKeySourceSchema = object({
45628
+ sourceId: string(),
45629
+ name: string()
45630
+ });
45631
+ var BoardKeyBoardSchema = object({
45632
+ /** The builder's file name, e.g. `kitchen.yaml`: the handle `getBoardKey` takes. */
45633
+ configuration: string(),
45634
+ /** The node name the builder gives the board. */
45635
+ name: string(),
45636
+ /** The address the builder knows the board by, when it has one. */
45637
+ address: string().nullable()
45638
+ });
45639
+ var BoardKeyFailureSchema = object({
45640
+ ok: literal(false),
45641
+ reason: BoardKeyFailureReasonSchema,
45642
+ detail: string().optional()
45643
+ });
45644
+ var ListBoardsResultSchema = discriminatedUnion("ok", [object({
45645
+ ok: literal(true),
45646
+ boards: array(BoardKeyBoardSchema).readonly()
45647
+ }), BoardKeyFailureSchema]);
45648
+ var GetBoardKeyResultSchema = discriminatedUnion("ok", [object({
45649
+ ok: literal(true),
45650
+ key: string()
45651
+ }), BoardKeyFailureSchema]);
45652
+ method(_void(), array(BoardKeySourceSchema).readonly(), { auth: "admin" }), method(object({ sourceId: string().min(1) }), ListBoardsResultSchema, { auth: "admin" }), method(object({
45653
+ sourceId: string().min(1),
45654
+ configuration: string().min(1)
45655
+ }), GetBoardKeyResultSchema, { auth: "admin" });
45656
+ /**
45510
45657
  * Dimmable-light brightness control. Co-exists with `switch` on the
45511
45658
  * same device — the switch toggles on/off, this cap sets the level
45512
45659
  * applied when the light is on. Drivers map their per-vendor dim
@@ -47595,6 +47742,188 @@ DeviceType.Control, method(object({
47595
47742
  kind: "mutation",
47596
47743
  auth: "protected"
47597
47744
  });
47745
+ /**
47746
+ * Media-player cap. Models HA `media_player.*` (Sonos, Chromecast,
47747
+ * Apple TV, Spotify, Roku, generic OTT receivers, …) on
47748
+ * `DeviceType.MediaPlayer`. Disjoint from the camera streaming
47749
+ * surface — those use `DeviceType.Camera` + the broker pipeline.
47750
+ *
47751
+ * The cap declares a wide method surface; not every backend supports
47752
+ * every method. Drivers signal sub-capability via the
47753
+ * `DeviceFeature.MediaPlayerXxx` flags (paired one-to-one with the
47754
+ * corresponding method) so the UI gates buttons without a slice
47755
+ * fetch — same pattern as `PanTiltZoom` for cameras.
47756
+ */
47757
+ var MediaPlayerStateSchema = _enum([
47758
+ "off",
47759
+ "on",
47760
+ "idle",
47761
+ "playing",
47762
+ "paused",
47763
+ "buffering",
47764
+ "standby"
47765
+ ]);
47766
+ var MediaPlayerRepeatSchema = _enum([
47767
+ "off",
47768
+ "all",
47769
+ "one"
47770
+ ]);
47771
+ var MediaInfoSchema = object({
47772
+ /** Free-form media kind (`music`, `tvshow`, `movie`, `app`, `channel`,
47773
+ * `podcast`, …). */
47774
+ type: string(),
47775
+ /** Human-readable title. */
47776
+ title: string(),
47777
+ /** Optional artist / channel / station label. */
47778
+ artist: string().optional(),
47779
+ /** Optional album / season / show name. */
47780
+ album: string().optional(),
47781
+ /** Optional cover-art / thumbnail URL. */
47782
+ imageUrl: string().optional()
47783
+ });
47784
+ /**
47785
+ * Where `state`, `volumeLevel`, `isMuted` and `source` come from. `reported`:
47786
+ * the device said so. `assumed`: the driver has no feedback (infrared) and
47787
+ * tracks what it last SENT; it moves only after a send was accepted, and a
47788
+ * human at the real remote makes it wrong. A UI shows an assumed value as a
47789
+ * guess, never as a reading.
47790
+ */
47791
+ var MediaPlayerStateSourceSchema = _enum(["reported", "assumed"]);
47792
+ /** The fields of a media-player status a driver can only guess. */
47793
+ var MediaPlayerAssumedFieldSchema = _enum([
47794
+ "state",
47795
+ "volumeLevel",
47796
+ "isMuted",
47797
+ "source"
47798
+ ]);
47799
+ var MediaPlayerStatusSchema = object({
47800
+ /** Playback lifecycle state. */
47801
+ state: MediaPlayerStateSchema,
47802
+ /**
47803
+ * Whether the state fields are readings or the driver's own bookkeeping.
47804
+ * A slice written before this field existed parses as `reported`.
47805
+ */
47806
+ stateSource: MediaPlayerStateSourceSchema.default("reported"),
47807
+ /**
47808
+ * Which fields are the driver's own guess. `stateSource` is `assumed` when
47809
+ * this is not empty; a field not listed here is a reading even then (power
47810
+ * from a running-state source, mute guessed from the last send).
47811
+ */
47812
+ assumedFields: array(MediaPlayerAssumedFieldSchema).default([]),
47813
+ /** Volume as 0..100 inclusive. Null when the device has no volume
47814
+ * surface. Pair with `DeviceFeature.MediaPlayerVolume`. */
47815
+ volumeLevel: number().min(0).max(100).nullable().meta(readingMeta("percentage")),
47816
+ /** Mute toggle distinct from volume=0. Null when no mute surface.
47817
+ * Pair with `DeviceFeature.MediaPlayerMute`. */
47818
+ isMuted: boolean().nullable(),
47819
+ /** Active source / input. Empty when no source surface. */
47820
+ source: string(),
47821
+ /** Selectable sources. Empty when no source surface.
47822
+ * Pair with `DeviceFeature.MediaPlayerSelectSource`. */
47823
+ availableSources: array(string()),
47824
+ /** Currently-playing media info. Null when nothing is playing. */
47825
+ currentMedia: MediaInfoSchema.nullable(),
47826
+ /** Current playback position in ms. Null when not seekable or
47827
+ * nothing is playing. Pair with `DeviceFeature.MediaPlayerSeek`. */
47828
+ position: number().int().nonnegative().nullable().meta(readingMeta("duration-ms")),
47829
+ /** Total duration of the current media in ms. Null when unknown
47830
+ * (live stream) or nothing is playing. */
47831
+ duration: number().int().nonnegative().nullable().meta(readingMeta("duration-ms")),
47832
+ /** Shuffle toggle. Null when no shuffle surface.
47833
+ * Pair with `DeviceFeature.MediaPlayerShuffle`. */
47834
+ shuffle: boolean().nullable(),
47835
+ /** Repeat mode. Null when no repeat surface.
47836
+ * Pair with `DeviceFeature.MediaPlayerRepeat`. */
47837
+ repeat: MediaPlayerRepeatSchema.nullable(),
47838
+ /** Ms epoch when the slice was last updated. */
47839
+ lastChangedAt: number()
47840
+ });
47841
+ var stepInput = object({
47842
+ deviceId: number().int().nonnegative(),
47843
+ /** How many presses: the caller's count (Alexa `volumeSteps`, `channelCount`). */
47844
+ steps: number().int().min(1).max(50).default(1)
47845
+ });
47846
+ var deviceOnly = object({ deviceId: number().int().nonnegative() });
47847
+ DeviceType.MediaPlayer, method(deviceOnly, _void(), {
47848
+ kind: "mutation",
47849
+ auth: "protected"
47850
+ }), method(deviceOnly, _void(), {
47851
+ kind: "mutation",
47852
+ auth: "protected"
47853
+ }), method(stepInput, _void(), {
47854
+ kind: "mutation",
47855
+ auth: "protected"
47856
+ }), method(stepInput, _void(), {
47857
+ kind: "mutation",
47858
+ auth: "protected"
47859
+ }), method(stepInput, _void(), {
47860
+ kind: "mutation",
47861
+ auth: "protected"
47862
+ }), method(stepInput, _void(), {
47863
+ kind: "mutation",
47864
+ auth: "protected"
47865
+ }), method(object({ deviceId: number().int().nonnegative() }), _void(), {
47866
+ kind: "mutation",
47867
+ auth: "protected"
47868
+ }), method(object({ deviceId: number().int().nonnegative() }), _void(), {
47869
+ kind: "mutation",
47870
+ auth: "protected"
47871
+ }), method(object({ deviceId: number().int().nonnegative() }), _void(), {
47872
+ kind: "mutation",
47873
+ auth: "protected"
47874
+ }), method(object({ deviceId: number().int().nonnegative() }), _void(), {
47875
+ kind: "mutation",
47876
+ auth: "protected"
47877
+ }), method(object({ deviceId: number().int().nonnegative() }), _void(), {
47878
+ kind: "mutation",
47879
+ auth: "protected"
47880
+ }), method(object({
47881
+ deviceId: number().int().nonnegative(),
47882
+ position: number().int().nonnegative()
47883
+ }), _void(), {
47884
+ kind: "mutation",
47885
+ auth: "protected"
47886
+ }), method(object({
47887
+ deviceId: number().int().nonnegative(),
47888
+ volumeLevel: number().min(0).max(100)
47889
+ }), _void(), {
47890
+ kind: "mutation",
47891
+ auth: "protected"
47892
+ }), method(object({
47893
+ deviceId: number().int().nonnegative(),
47894
+ muted: boolean()
47895
+ }), _void(), {
47896
+ kind: "mutation",
47897
+ auth: "protected"
47898
+ }), method(object({
47899
+ deviceId: number().int().nonnegative(),
47900
+ shuffle: boolean()
47901
+ }), _void(), {
47902
+ kind: "mutation",
47903
+ auth: "protected"
47904
+ }), method(object({
47905
+ deviceId: number().int().nonnegative(),
47906
+ repeat: MediaPlayerRepeatSchema
47907
+ }), _void(), {
47908
+ kind: "mutation",
47909
+ auth: "protected"
47910
+ }), method(object({
47911
+ deviceId: number().int().nonnegative(),
47912
+ source: string().min(1)
47913
+ }), _void(), {
47914
+ kind: "mutation",
47915
+ auth: "protected"
47916
+ }), method(object({
47917
+ deviceId: number().int().nonnegative(),
47918
+ /** Media identifier / URL. */
47919
+ mediaId: string().min(1),
47920
+ /** Media kind (`music`, `tvshow`, `movie`, `app`, …) — provider
47921
+ * passes it through to the upstream service. */
47922
+ mediaType: string().min(1)
47923
+ }), _void(), {
47924
+ kind: "mutation",
47925
+ auth: "protected"
47926
+ });
47598
47927
  DeviceType.Camera, DeviceType.Sensor, DeviceType.Button, DeviceType.Switch, DeviceType.PetFeeder, DeviceType.Container, DeviceType.Thermostat, DeviceType.EventEmitter, DeviceType.Camera, DeviceType.Hub, DeviceType.Light, DeviceType.Siren, DeviceType.Switch, DeviceType.Sensor, DeviceType.Thermostat, DeviceType.Climate, DeviceType.Button, DeviceType.EventEmitter, DeviceType.Update, DeviceType.Generic, DeviceType.Notifier, DeviceType.Script, DeviceType.Automation, DeviceType.Lock, DeviceType.Cover, DeviceType.Valve, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.Fan, DeviceType.MediaPlayer, DeviceType.AlarmPanel, DeviceType.Control, DeviceType.Presence, DeviceType.Weather, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.Container, DeviceType.Image, DeviceType.PetFeeder, DeviceType.PetFountain, DeviceType.Dishwasher, DeviceType.Washer, DeviceType.Heater, DeviceType.Dryer, DeviceType.Gateway, DeviceType.Camera, DeviceType.Fan, DeviceType.Lock, DeviceType.Camera, DeviceType.Switch, DeviceType.Light, DeviceType.Fan, DeviceType.Climate, DeviceType.Thermostat, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.MediaPlayer, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.PetFeeder, DeviceType.Heater, DeviceType.Switch, DeviceType.Light, DeviceType.Fan, DeviceType.Climate, DeviceType.Thermostat, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.MediaPlayer, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.PetFeeder, DeviceType.Heater, DeviceType.Switch, DeviceType.Light, DeviceType.Fan, DeviceType.Climate, DeviceType.Thermostat, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.MediaPlayer, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.PetFeeder, DeviceType.Heater, DeviceType.Switch, DeviceType.Light, DeviceType.Fan, DeviceType.Climate, DeviceType.Thermostat, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.MediaPlayer, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.PetFeeder, DeviceType.Heater, DeviceType.Gateway, DeviceType.Hub, DeviceType.Camera, DeviceType.Sensor, DeviceType.MediaPlayer, DeviceType.Vacuum, DeviceType.Generic, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.PetFountain, DeviceType.Fan, DeviceType.Humidifier, DeviceType.Climate, DeviceType.WaterHeater, DeviceType.MediaPlayer, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.MediaPlayer, DeviceType.WaterHeater, DeviceType.Humidifier, DeviceType.Fan, DeviceType.Climate, DeviceType.Thermostat, DeviceType.PetFeeder, DeviceType.Heater;
47599
47928
  var NUMBER = {
47600
47929
  kind: "fixed",
@@ -48042,49 +48371,6 @@ function actuator(input) {
48042
48371
  };
48043
48372
  }
48044
48373
  new Map(GROUP_TEMPLATES.map((template) => [template.id, template]));
48045
- var PowerSourceRefusalReasonSchema = _enum([
48046
- "no-power-source",
48047
- "switch-missing",
48048
- "switch-offline",
48049
- "switch-unknown",
48050
- "restart-in-progress",
48051
- "switch-call-failed"
48052
- ]);
48053
- var PowerSourceActionResultSchema = discriminatedUnion("accepted", [object({ accepted: literal(true) }), object({
48054
- accepted: literal(false),
48055
- reason: PowerSourceRefusalReasonSchema,
48056
- /** One line for the operator, naming the switch. */
48057
- message: string()
48058
- })]);
48059
- var PowerSourceInfoSchema = object({
48060
- /** False when the device has no power source linked; the rest is then empty. */
48061
- linked: boolean(),
48062
- switchDeviceId: number().nullable(),
48063
- switchName: string().nullable(),
48064
- /** The switch's on/off state, or null when it is unknown. Never false for unknown (D393). */
48065
- switchOn: boolean().nullable(),
48066
- switchOnline: boolean().nullable(),
48067
- restartInProgress: boolean(),
48068
- offSeconds: number().int()
48069
- });
48070
- object({
48071
- /** Null while the switch has not reported: unknown is never `false` (D393). */
48072
- switchOn: boolean().nullable(),
48073
- offSeconds: number().int(),
48074
- lastFetchedAt: number()
48075
- });
48076
- DeviceType.Gateway, DeviceType.Hub, DeviceType.Camera, DeviceType.Sensor, DeviceType.MediaPlayer, DeviceType.Vacuum, DeviceType.Generic, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.PetFountain, DeviceType.Fan, DeviceType.Humidifier, DeviceType.Climate, DeviceType.WaterHeater;
48077
- var deviceInput$2 = object({ deviceId: number().int().nonnegative() });
48078
- systemMethod(deviceInput$2, PowerSourceInfoSchema, { auth: "admin" }), systemMethod(deviceInput$2, PowerSourceActionResultSchema, {
48079
- kind: "mutation",
48080
- auth: "admin"
48081
- }), systemMethod(deviceInput$2, PowerSourceActionResultSchema, {
48082
- kind: "mutation",
48083
- auth: "admin"
48084
- }), systemMethod(deviceInput$2, PowerSourceActionResultSchema, {
48085
- kind: "mutation",
48086
- auth: "admin"
48087
- });
48088
48374
  DeviceFeature.LightColorRgb, DeviceFeature.LightColorHsv, DeviceFeature.LightColorMired;
48089
48375
  DeviceType.Camera;
48090
48376
  `${COMPOSED_DEVICE_STABLE_ID_PREFIX}`;
@@ -48112,6 +48398,165 @@ var ComposableCapabilitiesSchema = object({ caps: array(object({
48112
48398
  }).optional()
48113
48399
  })) });
48114
48400
  /**
48401
+ * A saved Customize assignment (D936). The schema is the type: callers use
48402
+ * `z.infer`, they do not restate the shape.
48403
+ */
48404
+ var OverrideSourceSchema = object({
48405
+ addonId: string().min(1),
48406
+ stableId: string().min(1),
48407
+ cap: string().min(1),
48408
+ fieldPath: string().min(1)
48409
+ });
48410
+ var IdentityTransformDraftSchema = object({ kind: literal("identity") });
48411
+ var InvertTransformDraftSchema = object({ kind: literal("invert") });
48412
+ var ThresholdTransformDraftSchema = object({
48413
+ kind: literal("threshold"),
48414
+ comparison: _enum(["gte", "lte"]),
48415
+ threshold: number(),
48416
+ startDwellMs: number().nonnegative(),
48417
+ stopDwellMs: number().nonnegative()
48418
+ });
48419
+ var CustomizeTransformDraftSchema = discriminatedUnion("kind", [
48420
+ IdentityTransformDraftSchema,
48421
+ InvertTransformDraftSchema,
48422
+ ThresholdTransformDraftSchema,
48423
+ object({
48424
+ kind: literal("linear"),
48425
+ scale: number(),
48426
+ offset: number(),
48427
+ clampMin: number().optional(),
48428
+ clampMax: number().optional()
48429
+ }),
48430
+ object({
48431
+ kind: literal("enum-map"),
48432
+ mapping: record(string(), string().nullable())
48433
+ }),
48434
+ object({ kind: literal("number") })
48435
+ ]);
48436
+ var ScalarOverrideDraftSchema = object({
48437
+ kind: literal("scalar"),
48438
+ cap: string().min(1),
48439
+ targetId: string().min(1),
48440
+ source: OverrideSourceSchema,
48441
+ transform: CustomizeTransformDraftSchema
48442
+ });
48443
+ var KeyedArrayOverrideDraftSchema = object({
48444
+ kind: literal("keyedArray"),
48445
+ cap: string().min(1),
48446
+ targetId: string().min(1),
48447
+ key: string().min(1),
48448
+ label: string().min(1),
48449
+ fieldPath: string().min(1),
48450
+ source: OverrideSourceSchema,
48451
+ transform: CustomizeTransformDraftSchema
48452
+ });
48453
+ var PulseOverrideDraftSchema = object({
48454
+ kind: literal("pulse"),
48455
+ cap: string().min(1),
48456
+ targetId: string().min(1),
48457
+ enabled: boolean(),
48458
+ debounceMs: number().nonnegative(),
48459
+ edges: array(_enum([
48460
+ "rising",
48461
+ "button",
48462
+ "native-event"
48463
+ ])).min(1).optional(),
48464
+ sources: array(OverrideSourceSchema).min(1)
48465
+ });
48466
+ var SpanSourceDraftSchema = OverrideSourceSchema.extend({ mode: _enum([
48467
+ "in-addition",
48468
+ "confirm",
48469
+ "replace"
48470
+ ]).optional() });
48471
+ discriminatedUnion("kind", [
48472
+ ScalarOverrideDraftSchema,
48473
+ KeyedArrayOverrideDraftSchema,
48474
+ PulseOverrideDraftSchema,
48475
+ object({
48476
+ kind: literal("span"),
48477
+ cap: string().min(1),
48478
+ targetId: string().min(1),
48479
+ timeoutMs: number().nonnegative(),
48480
+ cooldownMs: number().nonnegative().optional(),
48481
+ sources: array(SpanSourceDraftSchema)
48482
+ })
48483
+ ]);
48484
+ object({
48485
+ targetId: string().min(1),
48486
+ configured: boolean(),
48487
+ source: _enum(["native", "assigned"]),
48488
+ state: _enum([
48489
+ "active",
48490
+ "stale",
48491
+ "released",
48492
+ "unavailable"
48493
+ ]),
48494
+ reason: string().nullable()
48495
+ });
48496
+ /**
48497
+ * What a running-threshold proposal says (planning#405). The schema is the
48498
+ * type: the algorithm, the capability method and the UI all read `z.infer`.
48499
+ *
48500
+ * A proposal is read-only advice: it carries the numbers it was derived from
48501
+ * (`evidence`) so the operator can judge it, and an `insufficient` answer names
48502
+ * WHY with a typed reason and the catalog defaults, never an invented number.
48503
+ */
48504
+ var RunningProposalTierSchema = _enum(["raw", "5m"]);
48505
+ var RunningProposalConfidenceSchema = _enum([
48506
+ "high",
48507
+ "medium",
48508
+ "low"
48509
+ ]);
48510
+ var RunningProposalInsufficientReasonSchema = _enum([
48511
+ "no-history",
48512
+ "span-too-short",
48513
+ "truncated",
48514
+ "no-idle-floor",
48515
+ "no-runs",
48516
+ "no-separation"
48517
+ ]);
48518
+ var RunningProposalReplaySchema = object({
48519
+ /** Intervals the real dwell expression held true over the window. */
48520
+ intervals: number().int().nonnegative(),
48521
+ /** Intervals outside every run, or a second interval inside one. */
48522
+ extra: number().int().nonnegative(),
48523
+ /** Runs without an interval of their own (none, or merged into a neighbour). */
48524
+ missed: number().int().nonnegative()
48525
+ });
48526
+ var RunningProposalEvidenceSchema = object({
48527
+ tier: RunningProposalTierSchema,
48528
+ spanMs: number().nonnegative(),
48529
+ from: number(),
48530
+ to: number(),
48531
+ points: number().int().nonnegative(),
48532
+ runsFound: number().int().nonnegative(),
48533
+ pausesFound: number().int().nonnegative(),
48534
+ longestPauseMs: number().nonnegative(),
48535
+ idleFloorW: number(),
48536
+ noiseCeilingW: number(),
48537
+ plateauW: number(),
48538
+ replay: RunningProposalReplaySchema
48539
+ });
48540
+ var RunningProposalInsufficientEvidenceSchema = object({
48541
+ spanMs: number().nonnegative(),
48542
+ points: number().int().nonnegative(),
48543
+ runsFound: number().int().nonnegative()
48544
+ });
48545
+ var RunningThresholdProposalSchema = discriminatedUnion("state", [object({
48546
+ state: literal("proposal"),
48547
+ transform: ThresholdTransformDraftSchema,
48548
+ evidence: RunningProposalEvidenceSchema,
48549
+ confidence: RunningProposalConfidenceSchema,
48550
+ /** Why the confidence is not higher; empty when nothing held it back. */
48551
+ notes: array(string())
48552
+ }), object({
48553
+ state: literal("insufficient"),
48554
+ reason: RunningProposalInsufficientReasonSchema,
48555
+ evidence: RunningProposalInsufficientEvidenceSchema,
48556
+ /** The catalog defaults, offered as what stands when nothing better is known. */
48557
+ fallback: ThresholdTransformDraftSchema
48558
+ })]);
48559
+ /**
48115
48560
  * The report of a one-shot "move this owner's plaintext secrets into the
48116
48561
  * keychain" run (D878). COUNTS only - never a value, never a ref.
48117
48562
  *
@@ -48401,6 +48846,14 @@ method(object({}), object({ blocks: array(CoreBlockSchema) }), { auth: "admin" }
48401
48846
  kind: "mutation",
48402
48847
  auth: "admin",
48403
48848
  access: "view"
48849
+ }), method(object({
48850
+ deviceId: number().int(),
48851
+ cap: string().min(1),
48852
+ fieldPath: string().min(1),
48853
+ deviceType: _enum(DeviceType).optional()
48854
+ }), RunningThresholdProposalSchema, {
48855
+ auth: "admin",
48856
+ access: "view"
48404
48857
  }), method(object({
48405
48858
  blockId: string().min(1),
48406
48859
  trace: AutomationRunTraceSchema.optional(),
@@ -49209,7 +49662,53 @@ method(object({
49209
49662
  * exposes only the COMMON surface: link state, supported device
49210
49663
  * kinds (so the UI can filter the device picker), and per-device
49211
49664
  * expose/unexpose.
49665
+ *
49666
+ * INSTANCES. One export addon can serve several independent targets (a
49667
+ * HomeKit bridge, a Home Assistant broker). `listInstances` names them.
49668
+ * `instanceId` on a READ is optional: absent = the whole addon (linked if any
49669
+ * enabled instance is, `exposedDeviceCount` = distinct devices, `setup` = the
49670
+ * default instance's); present = that instance; an id the provider does not
49671
+ * serve is refused with `ExportInstanceUnknownError` (`export-instance-unknown`),
49672
+ * never answered empty. `instanceId` on a WRITE is REQUIRED: a membership
49673
+ * change always names the target it changes. A single-instance provider
49674
+ * accepts an absent id on a read or its own id, and refuses any other.
49675
+ */
49676
+ /** Which instance of an export addon a call addresses. Absent on a read = the whole addon. */
49677
+ var InstanceIdSchema$1 = string().min(1);
49678
+ var InstancePinSchema = object({ instanceId: InstanceIdSchema$1.optional() });
49679
+ /** One independent export target of an addon. */
49680
+ var ExportInstanceSchema = object({
49681
+ instanceId: InstanceIdSchema$1,
49682
+ name: string(),
49683
+ enabled: boolean(),
49684
+ kind: string().optional()
49685
+ });
49686
+ var EXPORT_INSTANCE_UNKNOWN = "export-instance-unknown";
49687
+ /** The named failure of an `instanceId` the provider does not serve. The message starts with the code. */
49688
+ var ExportInstanceUnknownError = class extends Error {
49689
+ code = EXPORT_INSTANCE_UNKNOWN;
49690
+ instanceId;
49691
+ constructor(addon, instanceId) {
49692
+ super(`${EXPORT_INSTANCE_UNKNOWN}: ${addon} serves no instance "${instanceId}"`);
49693
+ this.name = "ExportInstanceUnknownError";
49694
+ this.instanceId = instanceId;
49695
+ }
49696
+ };
49697
+ /**
49698
+ * The instance a `getStatus` call names. The cap's `status` block injects a per-device
49699
+ * `getStatus({ deviceId })` beside the method's own `{ instanceId? }`, so the provider sees
49700
+ * both shapes; only the second names an instance (a per-device status read is addon-wide).
49212
49701
  */
49702
+ function statusInstanceOf(input) {
49703
+ return "instanceId" in input ? input.instanceId : void 0;
49704
+ }
49705
+ /**
49706
+ * A single-instance provider's check: an absent id or its own passes, any other throws
49707
+ * `ExportInstanceUnknownError`.
49708
+ */
49709
+ function assertOwnExportInstance(addon, own, instanceId) {
49710
+ if (instanceId !== void 0 && instanceId !== own) throw new ExportInstanceUnknownError(addon, instanceId);
49711
+ }
49213
49712
  var LinkStateSchema = _enum([
49214
49713
  "unlinked",
49215
49714
  "linked",
@@ -49260,10 +49759,14 @@ var ExposedDeviceSchema = object({
49260
49759
  capabilities: array(string()).optional()
49261
49760
  });
49262
49761
  var ExposeInputSchema = object({
49762
+ instanceId: InstanceIdSchema$1,
49263
49763
  deviceId: string(),
49264
49764
  capabilities: array(string()).optional()
49265
49765
  });
49266
- var UnexposeInputSchema = object({ deviceId: string() });
49766
+ var UnexposeInputSchema = object({
49767
+ instanceId: InstanceIdSchema$1,
49768
+ deviceId: string()
49769
+ });
49267
49770
  /**
49268
49771
  * What an exporter may expose besides devices (D968). An action and a
49269
49772
  * notification target are LIST ENTRIES, never devices (D954): they enter an
@@ -49292,8 +49795,14 @@ var ExposedEntitySchema = object({
49292
49795
  entity: ExportEntityRefSchema,
49293
49796
  exposedAs: string().optional()
49294
49797
  });
49295
- var ExposeEntityInputSchema = object({ entity: ExportEntityRefSchema });
49296
- var UnexposeEntityInputSchema = object({ entity: ExportEntityRefSchema });
49798
+ var ExposeEntityInputSchema = object({
49799
+ instanceId: InstanceIdSchema$1,
49800
+ entity: ExportEntityRefSchema
49801
+ });
49802
+ var UnexposeEntityInputSchema = object({
49803
+ instanceId: InstanceIdSchema$1,
49804
+ entity: ExportEntityRefSchema
49805
+ });
49297
49806
  var deviceExportCapability = {
49298
49807
  name: "device-export",
49299
49808
  scope: "system",
@@ -49313,9 +49822,10 @@ var deviceExportCapability = {
49313
49822
  */
49314
49823
  exposesDeviceSettings: true,
49315
49824
  methods: {
49316
- getStatus: method(_void(), DeviceExportStatusSchema),
49317
- listSupportedDeviceKinds: method(_void(), array(DeviceKindSchema)),
49318
- listExposedDevices: method(_void(), array(ExposedDeviceSchema)),
49825
+ getStatus: method(InstancePinSchema, DeviceExportStatusSchema),
49826
+ listInstances: method(_void(), array(ExportInstanceSchema)),
49827
+ listSupportedDeviceKinds: method(InstancePinSchema, array(DeviceKindSchema)),
49828
+ listExposedDevices: method(InstancePinSchema, array(ExposedDeviceSchema)),
49319
49829
  exposeDevice: method(ExposeInputSchema, _void(), {
49320
49830
  kind: "mutation",
49321
49831
  auth: "admin"
@@ -49325,7 +49835,7 @@ var deviceExportCapability = {
49325
49835
  auth: "admin"
49326
49836
  }),
49327
49837
  listSupportedEntityKinds: optionalMethod(_void(), array(ExportEntityKindSchema)),
49328
- listExposedEntities: optionalMethod(_void(), array(ExposedEntitySchema)),
49838
+ listExposedEntities: optionalMethod(InstancePinSchema, array(ExposedEntitySchema)),
49329
49839
  exposeEntity: optionalMethod(ExposeEntityInputSchema, _void(), {
49330
49840
  kind: "mutation",
49331
49841
  auth: "admin"
@@ -51209,7 +51719,7 @@ object({
51209
51719
  /** Ms epoch of the last value received from the appliance; 0 = never. */
51210
51720
  lastFetchedAt: number()
51211
51721
  });
51212
- var DeviceIdSchema$1 = number().int().nonnegative();
51722
+ var DeviceIdSchema$2 = number().int().nonnegative();
51213
51723
  /** A value a program option or setting can take. */
51214
51724
  var DishwasherValueSchema = union([
51215
51725
  boolean(),
@@ -51273,77 +51783,77 @@ var DishwasherOptionsSchema = object({
51273
51783
  options: array(DishwasherOptionDescriptorSchema)
51274
51784
  });
51275
51785
  DeviceType.Dishwasher, method(object({
51276
- deviceId: DeviceIdSchema$1,
51786
+ deviceId: DeviceIdSchema$2,
51277
51787
  program: string().min(1).optional(),
51278
51788
  options: record(string(), DishwasherValueSchema).optional()
51279
51789
  }), _void(), {
51280
51790
  kind: "mutation",
51281
51791
  auth: "protected"
51282
- }), method(object({ deviceId: DeviceIdSchema$1 }), _void(), {
51792
+ }), method(object({ deviceId: DeviceIdSchema$2 }), _void(), {
51283
51793
  kind: "mutation",
51284
51794
  auth: "protected"
51285
- }), method(object({ deviceId: DeviceIdSchema$1 }), _void(), {
51795
+ }), method(object({ deviceId: DeviceIdSchema$2 }), _void(), {
51286
51796
  kind: "mutation",
51287
51797
  auth: "protected"
51288
- }), method(object({ deviceId: DeviceIdSchema$1 }), _void(), {
51798
+ }), method(object({ deviceId: DeviceIdSchema$2 }), _void(), {
51289
51799
  kind: "mutation",
51290
51800
  auth: "protected"
51291
51801
  }), method(object({
51292
- deviceId: DeviceIdSchema$1,
51802
+ deviceId: DeviceIdSchema$2,
51293
51803
  program: string().min(1)
51294
51804
  }), _void(), {
51295
51805
  kind: "mutation",
51296
51806
  auth: "protected"
51297
51807
  }), method(object({
51298
- deviceId: DeviceIdSchema$1,
51808
+ deviceId: DeviceIdSchema$2,
51299
51809
  on: boolean()
51300
51810
  }), _void(), {
51301
51811
  kind: "mutation",
51302
51812
  auth: "protected"
51303
51813
  }), method(object({
51304
- deviceId: DeviceIdSchema$1,
51814
+ deviceId: DeviceIdSchema$2,
51305
51815
  on: boolean()
51306
51816
  }), _void(), {
51307
51817
  kind: "mutation",
51308
51818
  auth: "protected"
51309
51819
  }), method(object({
51310
- deviceId: DeviceIdSchema$1,
51820
+ deviceId: DeviceIdSchema$2,
51311
51821
  on: boolean()
51312
51822
  }), _void(), {
51313
51823
  kind: "mutation",
51314
51824
  auth: "protected"
51315
51825
  }), method(object({
51316
- deviceId: DeviceIdSchema$1,
51826
+ deviceId: DeviceIdSchema$2,
51317
51827
  on: boolean()
51318
51828
  }), _void(), {
51319
51829
  kind: "mutation",
51320
51830
  auth: "protected"
51321
51831
  }), method(object({
51322
- deviceId: DeviceIdSchema$1,
51832
+ deviceId: DeviceIdSchema$2,
51323
51833
  on: boolean()
51324
51834
  }), _void(), {
51325
51835
  kind: "mutation",
51326
51836
  auth: "protected"
51327
51837
  }), method(object({
51328
- deviceId: DeviceIdSchema$1,
51838
+ deviceId: DeviceIdSchema$2,
51329
51839
  on: boolean()
51330
51840
  }), _void(), {
51331
51841
  kind: "mutation",
51332
51842
  auth: "protected"
51333
51843
  }), method(object({
51334
- deviceId: DeviceIdSchema$1,
51844
+ deviceId: DeviceIdSchema$2,
51335
51845
  on: boolean()
51336
51846
  }), _void(), {
51337
51847
  kind: "mutation",
51338
51848
  auth: "protected"
51339
51849
  }), method(object({
51340
- deviceId: DeviceIdSchema$1,
51850
+ deviceId: DeviceIdSchema$2,
51341
51851
  key: string().min(1),
51342
51852
  value: DishwasherValueSchema
51343
51853
  }), _void(), {
51344
51854
  kind: "mutation",
51345
51855
  auth: "protected"
51346
- }), method(object({ deviceId: DeviceIdSchema$1 }), DishwasherOptionsSchema, { auth: "protected" });
51856
+ }), method(object({ deviceId: DeviceIdSchema$2 }), DishwasherOptionsSchema, { auth: "protected" });
51347
51857
  /**
51348
51858
  * Palette entry ids (D939). Audio is the one gradient; `audio-*` leaves are
51349
51859
  * not entries. `heatmapScrub` is a mark, not an event kind.
@@ -52530,15 +53040,15 @@ var FanPresetCaptureResultSchema = object({
52530
53040
  items: array(FanCaptureItemSchema),
52531
53041
  omitted: array(FanCaptureOmissionSchema)
52532
53042
  });
52533
- var deviceInput$1 = object({ deviceId: number().int().nonnegative() });
53043
+ var deviceInput$2 = object({ deviceId: number().int().nonnegative() });
52534
53044
  DeviceType.Fan;
52535
- method(deviceInput$1, array(FanPresetSchema), { auth: "protected" }), method(deviceInput$1.extend({ presets: array(FanPresetSchema).max(12) }), FanPresetsSetResultSchema, {
53045
+ method(deviceInput$2, array(FanPresetSchema), { auth: "protected" }), method(deviceInput$2.extend({ presets: array(FanPresetSchema).max(12) }), FanPresetsSetResultSchema, {
52536
53046
  kind: "mutation",
52537
53047
  auth: "admin"
52538
- }), method(deviceInput$1.extend({ presetId: string().min(1) }), FanPresetApplyResultSchema, {
53048
+ }), method(deviceInput$2.extend({ presetId: string().min(1) }), FanPresetApplyResultSchema, {
52539
53049
  kind: "mutation",
52540
53050
  auth: "protected"
52541
- }), method(deviceInput$1.extend({
53051
+ }), method(deviceInput$2.extend({
52542
53052
  fields: array(FanCaptureFieldSchema).optional(),
52543
53053
  steps: array(ActionStepSchema).max(20).default([])
52544
53054
  }), FanPresetCaptureResultSchema, { auth: "protected" });
@@ -52927,15 +53437,9 @@ var AvailableIntegrationTypeSchema = object({
52927
53437
  * branch on CAP — never on addon name. `device-adoption` integrations
52928
53438
  * (Home Assistant, …) route through the broker step (Approach A);
52929
53439
  * `device-provider` integrations (Reolink/ONVIF) keep the
52930
- * legacy config → discovery flow. `connection` is an addon that only holds a
52931
- * connection as typed records (`integration-instances`, D985): no devices,
52932
- * no discovery.
53440
+ * legacy config → discovery flow.
52933
53441
  */
52934
- kind: _enum([
52935
- "device-adoption",
52936
- "device-provider",
52937
- "connection"
52938
- ]),
53442
+ kind: _enum(["device-adoption", "device-provider"]),
52939
53443
  /**
52940
53444
  * For `device-adoption` addons: the broker kind to create/link
52941
53445
  * (e.g. `home-assistant`), declared in the addon manifest. `null` for
@@ -53049,18 +53553,17 @@ method(_void(), array(IntegrationWithStateSchema)), method(object({ id: string()
53049
53553
  });
53050
53554
  /**
53051
53555
  * `integration-instances` - the connection of an addon that holds ONE or SEVERAL
53052
- * (an account, a relay, a destination) as typed records, shown on the
53053
- * Integrations page like every other integration (D985, D986).
53556
+ * (an account, a relay, a destination) as typed records (D985, D986). The addon's
53557
+ * own function page reads and writes them (Logging for Loki); the Integrations
53558
+ * page lists only the integrations that bring devices (D996).
53054
53559
  *
53055
- * A collection of providers: each addon that holds connections registers one
53056
- * and the hub aggregator (`integrations.*`) reaches a provider with the pinned
53057
- * `addonId`. It is internal and has no route: the operator-facing surface is
53058
- * the `integrations` cap, which keeps ONE list.
53560
+ * A collection of providers: each addon that holds connections registers one and a
53561
+ * caller reaches a provider with the pinned `addonId`.
53059
53562
  *
53060
- * Identity: the instance id IS the `integrations` registry id (`int_NNNN`,
53061
- * immutable, already in the `/integrations/<id>` URL). A second operator-chosen
53062
- * slug would be a second authority over one identity (D224). `name` is the
53063
- * editable label.
53563
+ * Identity: the instance id is immutable and opaque to the caller. A record the
53564
+ * Loki migration made keeps the `integrations` registry id it was created under
53565
+ * (`int_NNNN`); a single instance made by its function page takes the addon id.
53566
+ * `name` is the editable label.
53064
53567
  *
53065
53568
  * Secrets: every field the instance kind marks `.meta({ secret: true })` reaches
53066
53569
  * the form as a `SecretFieldView`, never text (D789). A patch value omitted, `''`
@@ -53069,13 +53572,50 @@ method(_void(), array(IntegrationWithStateSchema)), method(object({ id: string()
53069
53572
  */
53070
53573
  var ConfigSchemaPassthrough$3 = custom();
53071
53574
  var IntegrationInstanceIdSchema = string().min(1);
53575
+ var IntegrationInstanceModeSchema = _enum(["single", "multiple"]);
53576
+ /**
53577
+ * One kind of instance a provider can create (an adapter, an account type). The sign-in and
53578
+ * connect fields follow the `broker` contract (`broker.cap.ts`): `signIn.basePath` is a
53579
+ * hub-relative route set speaking the sign-in contract, `connectPath` / `disconnectPath` open an
53580
+ * interactive account link (popup) and may carry `{{brokerId}}`, which the UI replaces with the
53581
+ * instance id.
53582
+ */
53583
+ var IntegrationInstanceKindSchema = object({
53584
+ /** Stable id of the kind, sent back as `createInstance.kind`. */
53585
+ id: string().min(1),
53586
+ label: string().min(1),
53587
+ /** The kind signs in through a server-held interactive session. */
53588
+ signIn: object({
53589
+ basePath: string().min(1),
53590
+ methods: array(_enum(["device-code", "proxy"])).optional()
53591
+ }).optional(),
53592
+ /** Relative hub path to start an interactive account link of an instance of this kind. */
53593
+ connectPath: string().min(1).optional(),
53594
+ /** Relative hub path to disconnect that account. */
53595
+ disconnectPath: string().min(1).optional()
53596
+ });
53072
53597
  var IntegrationInstanceDescriptionSchema = object({
53073
53598
  /** `single`: at most one instance can exist (Loki). `multiple`: an account each. */
53074
- instanceMode: _enum(["single", "multiple"]),
53599
+ instanceMode: IntegrationInstanceModeSchema,
53075
53600
  /** What the instance is, for the UI (`destination`, `relay`, `account`). */
53076
53601
  kind: string(),
53077
53602
  /** True when `testInstance` really probes the remote. */
53078
- canTest: boolean()
53603
+ canTest: boolean(),
53604
+ /**
53605
+ * The kinds an instance can be of. Absent or one entry: nothing to choose; more than one: the
53606
+ * Add flow asks which first and sends it as `createInstance.kind`.
53607
+ */
53608
+ kinds: array(IntegrationInstanceKindSchema).optional(),
53609
+ /**
53610
+ * The provider accepts `createInstance.id` for an id that once existed (an adopted id, because
53611
+ * devices carry it). The UI then offers "restore under its old id" on Add. Absent means no.
53612
+ */
53613
+ allowRestoreId: boolean().optional(),
53614
+ /**
53615
+ * `createInstance` without an `id` works: the provider mints it. Absent means the caller must
53616
+ * send an id (the UI then mints an opaque one).
53617
+ */
53618
+ mintsId: boolean().optional()
53079
53619
  });
53080
53620
  var IntegrationInstanceStatusSchema = object({
53081
53621
  state: _enum([
@@ -53084,16 +53624,27 @@ var IntegrationInstanceStatusSchema = object({
53084
53624
  "error",
53085
53625
  "unknown"
53086
53626
  ]),
53087
- detail: string().optional()
53627
+ detail: string().optional(),
53628
+ /** A short human word for the state ("Signed in", "Token expired"); shown instead of `state`. */
53629
+ label: string().optional()
53088
53630
  });
53089
53631
  var IntegrationInstanceSchema = object({
53090
53632
  id: IntegrationInstanceIdSchema,
53091
53633
  name: string(),
53092
53634
  /** The addon's own rule (an URL is present, a client id is present...). */
53093
53635
  configured: boolean(),
53636
+ /**
53637
+ * The instance's own on/off switch (D996): always present, derived from the record body
53638
+ * (`enabled !== false`, so a row written before the field existed is on).
53639
+ */
53640
+ enabled: boolean(),
53641
+ /** The kind of this instance (one of `describe().kinds[].id`), when the provider has kinds. */
53642
+ kind: string().optional(),
53094
53643
  /** Values for the instance form; a secret is a `SecretFieldView`, never text. */
53095
53644
  formValues: record(string(), unknown()),
53096
- status: IntegrationInstanceStatusSchema.optional()
53645
+ status: IntegrationInstanceStatusSchema.optional(),
53646
+ /** Epoch ms of the last probe of the remote that produced `status`; absent when never checked. */
53647
+ lastCheckedAt: number().optional()
53097
53648
  });
53098
53649
  var IntegrationInstancePatchSchema = object({
53099
53650
  id: IntegrationInstanceIdSchema,
@@ -53101,13 +53652,32 @@ var IntegrationInstancePatchSchema = object({
53101
53652
  /** Omitted / '' / redaction token keeps a secret; `{ $secretClear: true }` clears it. */
53102
53653
  values: record(string(), unknown())
53103
53654
  });
53104
- method(_void(), IntegrationInstanceDescriptionSchema), method(object({ id: IntegrationInstanceIdSchema.nullable() }), ConfigSchemaPassthrough$3), method(_void(), array(IntegrationInstanceSchema).readonly()), method(object({ id: IntegrationInstanceIdSchema }), IntegrationInstanceSchema.nullable()), method(object({
53655
+ method(_void(), IntegrationInstanceDescriptionSchema, { auth: "admin" }), method(object({ id: IntegrationInstanceIdSchema.nullable() }), ConfigSchemaPassthrough$3, { auth: "admin" }), method(_void(), array(IntegrationInstanceSchema).readonly(), { auth: "admin" }), method(object({ id: IntegrationInstanceIdSchema }), IntegrationInstanceSchema.nullable(), { auth: "admin" }), method(object({
53656
+ id: IntegrationInstanceIdSchema.optional(),
53657
+ name: string().min(1),
53658
+ kind: string().min(1).optional()
53659
+ }), object({ id: string() }), {
53660
+ kind: "mutation",
53661
+ auth: "admin"
53662
+ }), method(IntegrationInstancePatchSchema, object({ ok: literal(true) }), {
53663
+ kind: "mutation",
53664
+ auth: "admin"
53665
+ }), method(object({
53105
53666
  id: IntegrationInstanceIdSchema,
53106
- name: string().min(1)
53107
- }), object({ id: string() }), { kind: "mutation" }), method(IntegrationInstancePatchSchema, object({ ok: literal(true) }), { kind: "mutation" }), method(object({ id: IntegrationInstanceIdSchema }), object({ ok: literal(true) }), { kind: "mutation" }), optionalMethod(object({
53667
+ enabled: boolean()
53668
+ }), object({ ok: literal(true) }), {
53669
+ kind: "mutation",
53670
+ auth: "admin"
53671
+ }), method(object({ id: IntegrationInstanceIdSchema }), object({ ok: literal(true) }), {
53672
+ kind: "mutation",
53673
+ auth: "admin"
53674
+ }), optionalMethod(object({
53108
53675
  id: IntegrationInstanceIdSchema.nullable(),
53109
53676
  values: record(string(), unknown())
53110
- }), TestConnectionResultSchema$1, { kind: "mutation" });
53677
+ }), TestConnectionResultSchema$1, {
53678
+ kind: "mutation",
53679
+ auth: "admin"
53680
+ });
53111
53681
  /**
53112
53682
  * Two-way audio / talk-back cap. Clients open a WebRTC audio-only
53113
53683
  * session (server-initiated offer pattern, identical to the main
@@ -54906,6 +55476,11 @@ var LogEntrySchema = object({
54906
55476
  * flight, and not asking for the next slice ends the scan.
54907
55477
  */
54908
55478
  var LogReadQuerySchema = object({
55479
+ /**
55480
+ * Which destination INSTANCE answers (a destination addon may hold several records). Absent ⇒
55481
+ * the provider's first readable one, so a caller written before instances existed is unchanged.
55482
+ */
55483
+ instanceId: string().min(1).max(200).optional(),
54909
55484
  /** Correlates `cancelRead`. Caller-chosen, unique per in-flight read. */
54910
55485
  requestId: string().min(1).max(64).optional(),
54911
55486
  /** The device the line is about (`tags.deviceId`, numeric). */
@@ -54968,6 +55543,8 @@ var LogReadResultSchema = object({
54968
55543
  /** True when `cancelRead` ended this slice early. */
54969
55544
  cancelled: boolean().optional()
54970
55545
  });
55546
+ /** Names one destination instance; absent ⇒ the provider's first readable one. */
55547
+ var LogInstanceSelectorSchema = object({ instanceId: string().min(1).max(200).optional() });
54971
55548
  var LogReadCapabilitiesSchema = object({
54972
55549
  /** False ⇒ this destination only ships lines (console, forwarder, an unconfigured Loki). */
54973
55550
  readable: boolean(),
@@ -54986,7 +55563,7 @@ var LogReadCapabilitiesSchema = object({
54986
55563
  /** How far back the store reaches, when the provider knows (days). */
54987
55564
  retentionDays: number().nullable()
54988
55565
  });
54989
- method(LogEntrySchema, _void(), { kind: "mutation" }), optionalMethod(_void(), LogReadCapabilitiesSchema, { auth: "admin" }), optionalMethod(LogReadQuerySchema, LogReadResultSchema, { auth: "admin" }), optionalMethod(object({ requestId: string().min(1).max(64) }), object({ cancelled: boolean() }), {
55566
+ method(LogEntrySchema, _void(), { kind: "mutation" }), optionalMethod(LogInstanceSelectorSchema, LogReadCapabilitiesSchema, { auth: "admin" }), optionalMethod(LogReadQuerySchema, LogReadResultSchema, { auth: "admin" }), optionalMethod(object({ requestId: string().min(1).max(64) }), object({ cancelled: boolean() }), {
54990
55567
  kind: "mutation",
54991
55568
  auth: "admin"
54992
55569
  });
@@ -55090,164 +55667,6 @@ var LoginMethodContributionSchema = discriminatedUnion("kind", [
55090
55667
  ]);
55091
55668
  method(_void(), array(LoginMethodContributionSchema).readonly());
55092
55669
  /**
55093
- * Media-player cap. Models HA `media_player.*` (Sonos, Chromecast,
55094
- * Apple TV, Spotify, Roku, generic OTT receivers, …) on
55095
- * `DeviceType.MediaPlayer`. Disjoint from the camera streaming
55096
- * surface — those use `DeviceType.Camera` + the broker pipeline.
55097
- *
55098
- * The cap declares a wide method surface; not every backend supports
55099
- * every method. Drivers signal sub-capability via the
55100
- * `DeviceFeature.MediaPlayerXxx` flags (paired one-to-one with the
55101
- * corresponding method) so the UI gates buttons without a slice
55102
- * fetch — same pattern as `PanTiltZoom` for cameras.
55103
- */
55104
- var MediaPlayerStateSchema = _enum([
55105
- "off",
55106
- "on",
55107
- "idle",
55108
- "playing",
55109
- "paused",
55110
- "buffering",
55111
- "standby"
55112
- ]);
55113
- var MediaPlayerRepeatSchema = _enum([
55114
- "off",
55115
- "all",
55116
- "one"
55117
- ]);
55118
- var MediaInfoSchema = object({
55119
- /** Free-form media kind (`music`, `tvshow`, `movie`, `app`, `channel`,
55120
- * `podcast`, …). */
55121
- type: string(),
55122
- /** Human-readable title. */
55123
- title: string(),
55124
- /** Optional artist / channel / station label. */
55125
- artist: string().optional(),
55126
- /** Optional album / season / show name. */
55127
- album: string().optional(),
55128
- /** Optional cover-art / thumbnail URL. */
55129
- imageUrl: string().optional()
55130
- });
55131
- /**
55132
- * Where `state`, `volumeLevel`, `isMuted` and `source` come from. `reported`:
55133
- * the device said so. `assumed`: the driver has no feedback (infrared) and
55134
- * tracks what it last SENT; it moves only after a send was accepted, and a
55135
- * human at the real remote makes it wrong. A UI shows an assumed value as a
55136
- * guess, never as a reading.
55137
- */
55138
- var MediaPlayerStateSourceSchema = _enum(["reported", "assumed"]);
55139
- /** The fields of a media-player status a driver can only guess. */
55140
- var MediaPlayerAssumedFieldSchema = _enum([
55141
- "state",
55142
- "volumeLevel",
55143
- "isMuted",
55144
- "source"
55145
- ]);
55146
- object({
55147
- /** Playback lifecycle state. */
55148
- state: MediaPlayerStateSchema,
55149
- /**
55150
- * Whether the state fields are readings or the driver's own bookkeeping.
55151
- * A slice written before this field existed parses as `reported`.
55152
- */
55153
- stateSource: MediaPlayerStateSourceSchema.default("reported"),
55154
- /**
55155
- * Which fields are the driver's own guess. `stateSource` is `assumed` when
55156
- * this is not empty; a field not listed here is a reading even then (power
55157
- * from a running-state source, mute guessed from the last send).
55158
- */
55159
- assumedFields: array(MediaPlayerAssumedFieldSchema).default([]),
55160
- /** Volume as 0..100 inclusive. Null when the device has no volume
55161
- * surface. Pair with `DeviceFeature.MediaPlayerVolume`. */
55162
- volumeLevel: number().min(0).max(100).nullable().meta(readingMeta("percentage")),
55163
- /** Mute toggle distinct from volume=0. Null when no mute surface.
55164
- * Pair with `DeviceFeature.MediaPlayerMute`. */
55165
- isMuted: boolean().nullable(),
55166
- /** Active source / input. Empty when no source surface. */
55167
- source: string(),
55168
- /** Selectable sources. Empty when no source surface.
55169
- * Pair with `DeviceFeature.MediaPlayerSelectSource`. */
55170
- availableSources: array(string()),
55171
- /** Currently-playing media info. Null when nothing is playing. */
55172
- currentMedia: MediaInfoSchema.nullable(),
55173
- /** Current playback position in ms. Null when not seekable or
55174
- * nothing is playing. Pair with `DeviceFeature.MediaPlayerSeek`. */
55175
- position: number().int().nonnegative().nullable().meta(readingMeta("duration-ms")),
55176
- /** Total duration of the current media in ms. Null when unknown
55177
- * (live stream) or nothing is playing. */
55178
- duration: number().int().nonnegative().nullable().meta(readingMeta("duration-ms")),
55179
- /** Shuffle toggle. Null when no shuffle surface.
55180
- * Pair with `DeviceFeature.MediaPlayerShuffle`. */
55181
- shuffle: boolean().nullable(),
55182
- /** Repeat mode. Null when no repeat surface.
55183
- * Pair with `DeviceFeature.MediaPlayerRepeat`. */
55184
- repeat: MediaPlayerRepeatSchema.nullable(),
55185
- /** Ms epoch when the slice was last updated. */
55186
- lastChangedAt: number()
55187
- });
55188
- DeviceType.MediaPlayer, method(object({ deviceId: number().int().nonnegative() }), _void(), {
55189
- kind: "mutation",
55190
- auth: "protected"
55191
- }), method(object({ deviceId: number().int().nonnegative() }), _void(), {
55192
- kind: "mutation",
55193
- auth: "protected"
55194
- }), method(object({ deviceId: number().int().nonnegative() }), _void(), {
55195
- kind: "mutation",
55196
- auth: "protected"
55197
- }), method(object({ deviceId: number().int().nonnegative() }), _void(), {
55198
- kind: "mutation",
55199
- auth: "protected"
55200
- }), method(object({ deviceId: number().int().nonnegative() }), _void(), {
55201
- kind: "mutation",
55202
- auth: "protected"
55203
- }), method(object({
55204
- deviceId: number().int().nonnegative(),
55205
- position: number().int().nonnegative()
55206
- }), _void(), {
55207
- kind: "mutation",
55208
- auth: "protected"
55209
- }), method(object({
55210
- deviceId: number().int().nonnegative(),
55211
- volumeLevel: number().min(0).max(100)
55212
- }), _void(), {
55213
- kind: "mutation",
55214
- auth: "protected"
55215
- }), method(object({
55216
- deviceId: number().int().nonnegative(),
55217
- muted: boolean()
55218
- }), _void(), {
55219
- kind: "mutation",
55220
- auth: "protected"
55221
- }), method(object({
55222
- deviceId: number().int().nonnegative(),
55223
- shuffle: boolean()
55224
- }), _void(), {
55225
- kind: "mutation",
55226
- auth: "protected"
55227
- }), method(object({
55228
- deviceId: number().int().nonnegative(),
55229
- repeat: MediaPlayerRepeatSchema
55230
- }), _void(), {
55231
- kind: "mutation",
55232
- auth: "protected"
55233
- }), method(object({
55234
- deviceId: number().int().nonnegative(),
55235
- source: string().min(1)
55236
- }), _void(), {
55237
- kind: "mutation",
55238
- auth: "protected"
55239
- }), method(object({
55240
- deviceId: number().int().nonnegative(),
55241
- /** Media identifier / URL. */
55242
- mediaId: string().min(1),
55243
- /** Media kind (`music`, `tvshow`, `movie`, `app`, …) — provider
55244
- * passes it through to the upstream service. */
55245
- mediaType: string().min(1)
55246
- }), _void(), {
55247
- kind: "mutation",
55248
- auth: "protected"
55249
- });
55250
- /**
55251
55670
  * mesh-network — collection cap for mesh-VPN providers.
55252
55671
  *
55253
55672
  * Different shape from `network-access` (public tunnels):
@@ -63141,7 +63560,14 @@ var NcMediaPolicySchema = object({
63141
63560
  */
63142
63561
  profile: CamProfileSchema.optional(),
63143
63562
  /** See {@link NcLinkedCameraModeSchema}. */
63144
- linkedCameras: NcLinkedCameraModeSchema.optional()
63563
+ linkedCameras: NcLinkedCameraModeSchema.optional(),
63564
+ /**
63565
+ * Sensor rules only: may this rule wake a SLEEPING battery camera to take
63566
+ * the linked still it attaches (D998)? Absent means yes, an explicit `false`
63567
+ * opts out. Deliberately not a Zod default: a rule that never chose keeps
63568
+ * following the hub's. One bounded wake per event; nothing is attached later.
63569
+ */
63570
+ wakeSleepingCamera: boolean().optional()
63145
63571
  });
63146
63572
  /**
63147
63573
  * Cooldown GRANULARITY over the subject's class — how much a fired
@@ -63533,6 +63959,21 @@ var NcTemplateVarKindSchema = _enum([
63533
63959
  "sound",
63534
63960
  "system"
63535
63961
  ]);
63962
+ /**
63963
+ * The default title/body a rule of one SITUATION is delivered with when the
63964
+ * operator wrote no template — served so an editor can pre-fill it (and the
63965
+ * operator can rebuild it from placeholders) instead of starting from a blank
63966
+ * box that, once saved, silently replaces it. `id` names the situation inside
63967
+ * a rule `kind`: `appliance-cycle` is a `sensor` rule whose device is an
63968
+ * appliance finishing a cycle. Texts are raw templates (`{{var}}` intact), in
63969
+ * the hub's current language and with its overrides applied.
63970
+ */
63971
+ var NcTemplateDefaultSchema = object({
63972
+ id: _enum(["appliance-cycle"]),
63973
+ kind: NcRuleKindSchema,
63974
+ title: string(),
63975
+ body: string()
63976
+ });
63536
63977
  /** Which producer renders a template: an ordinary rule, a timelapse, a digest. */
63537
63978
  var NcTemplateFamilySchema = _enum([
63538
63979
  "rule",
@@ -64388,7 +64829,11 @@ method(object({}), object({ rules: array(NcRuleSchema) }), { auth: "admin" }), m
64388
64829
  }), method(object({}), object({
64389
64830
  catalog: array(NcConditionDescriptorSchema),
64390
64831
  taxonomy: NcTaxonomySchema.optional()
64391
- })), method(object({}), object({ vars: array(NcTemplateVarDescriptorSchema) })), method(NcTemplatePreviewInputSchema, NcTemplatePreviewSchema, {
64832
+ })), method(object({}), object({
64833
+ vars: array(NcTemplateVarDescriptorSchema),
64834
+ /** Per-situation default texts; absent on a hub that predates them. */
64835
+ defaults: array(NcTemplateDefaultSchema)
64836
+ })), method(NcTemplatePreviewInputSchema, NcTemplatePreviewSchema, {
64392
64837
  kind: "mutation",
64393
64838
  access: "view"
64394
64839
  }), method(object({ filter: NcHistoryFilterSchema.default({ limit: 100 }) }), object({ entries: array(NcHistoryEntrySchema) }), { auth: "admin" }), method(object({}), NcRuleLastRunsSchema, { auth: "admin" }), method(object({ artifactId: string().min(1) }), object({ url: string().nullable() }), { auth: "admin" }), method(object({}), object({ snoozes: array(NcSnoozeSchema) }), { caller: "required" }), method(object({ snooze: NcSnoozeInputSchema }), object({ snooze: NcSnoozeSchema }), {
@@ -65152,52 +65597,27 @@ object({
65152
65597
  empty: boolean().nullable(),
65153
65598
  /** True while the pump is running. Null while unknown. */
65154
65599
  pumpRunning: boolean().nullable(),
65155
- /** True when the pump works on an on/off duty cycle rather than continuously. */
65156
- pumpIntervalEnabled: boolean().nullable(),
65157
- /** How long the pump runs per cycle, in seconds. */
65158
- pumpOnTime: number().min(0).nullable().meta(readingMeta("duration")),
65159
- /** How long the pump rests per cycle, in seconds. */
65160
- pumpOffTime: number().min(0).nullable().meta(readingMeta("duration")),
65161
65600
  /** Water drunk in the last drink, in litres. */
65162
65601
  lastDrink: number().min(0).nullable().meta(readingMeta("volume")),
65163
65602
  /** Water drunk in the current hour, in litres. */
65164
65603
  currentHourDrink: number().min(0).nullable().meta(readingMeta("volume")),
65165
65604
  /** Water drunk over the last 24 hours (rolling), in litres. */
65166
65605
  last24hDrink: number().min(0).nullable().meta(readingMeta("volume")),
65167
- /** Water drunk since local midnight, in litres. */
65606
+ /** Water drunk since local midnight, in litres. Null when the fountain has no such sensor. */
65168
65607
  todayDrink: number().min(0).nullable().meta(readingMeta("volume")),
65169
65608
  /** Decoded fault message. Null means healthy; a non-null string is an active fault. */
65170
65609
  error: string().nullable(),
65171
65610
  /** Ms epoch when the slice was last refreshed. */
65172
65611
  lastFetchedAt: number()
65173
65612
  });
65174
- var DeviceIdSchema = number().int().nonnegative();
65175
- var MinutesSchema = number().int().min(0);
65613
+ var DeviceIdSchema$1 = number().int().nonnegative();
65176
65614
  DeviceType.PetFountain, method(object({
65177
- deviceId: DeviceIdSchema,
65178
- on: boolean()
65179
- }), _void(), {
65180
- kind: "mutation",
65181
- auth: "protected"
65182
- }), method(object({
65183
- deviceId: DeviceIdSchema,
65615
+ deviceId: DeviceIdSchema$1,
65184
65616
  on: boolean()
65185
65617
  }), _void(), {
65186
65618
  kind: "mutation",
65187
65619
  auth: "protected"
65188
- }), method(object({
65189
- deviceId: DeviceIdSchema,
65190
- minutes: MinutesSchema
65191
- }), _void(), {
65192
- kind: "mutation",
65193
- auth: "protected"
65194
- }), method(object({
65195
- deviceId: DeviceIdSchema,
65196
- minutes: MinutesSchema
65197
- }), _void(), {
65198
- kind: "mutation",
65199
- auth: "protected"
65200
- }), method(object({ deviceId: DeviceIdSchema }), _void(), {
65620
+ }), method(object({ deviceId: DeviceIdSchema$1 }), _void(), {
65201
65621
  kind: "mutation",
65202
65622
  auth: "protected"
65203
65623
  });
@@ -66731,6 +67151,49 @@ object({
66731
67151
  DeviceType.PetFeeder,
66732
67152
  DeviceType.Heater
66733
67153
  ].filter((type) => type !== DeviceType.Sensor);
67154
+ var PowerSourceRefusalReasonSchema = _enum([
67155
+ "no-power-source",
67156
+ "switch-missing",
67157
+ "switch-offline",
67158
+ "switch-unknown",
67159
+ "restart-in-progress",
67160
+ "switch-call-failed"
67161
+ ]);
67162
+ var PowerSourceActionResultSchema = discriminatedUnion("accepted", [object({ accepted: literal(true) }), object({
67163
+ accepted: literal(false),
67164
+ reason: PowerSourceRefusalReasonSchema,
67165
+ /** One line for the operator, naming the switch. */
67166
+ message: string()
67167
+ })]);
67168
+ var PowerSourceInfoSchema = object({
67169
+ /** False when the device has no power source linked; the rest is then empty. */
67170
+ linked: boolean(),
67171
+ switchDeviceId: number().nullable(),
67172
+ switchName: string().nullable(),
67173
+ /** The switch's on/off state, or null when it is unknown. Never false for unknown (D393). */
67174
+ switchOn: boolean().nullable(),
67175
+ switchOnline: boolean().nullable(),
67176
+ restartInProgress: boolean(),
67177
+ offSeconds: number().int()
67178
+ });
67179
+ object({
67180
+ /** Null while the switch has not reported: unknown is never `false` (D393). */
67181
+ switchOn: boolean().nullable(),
67182
+ offSeconds: number().int(),
67183
+ lastFetchedAt: number()
67184
+ });
67185
+ DeviceType.Gateway, DeviceType.Hub, DeviceType.Camera, DeviceType.Sensor, DeviceType.MediaPlayer, DeviceType.Vacuum, DeviceType.Generic, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.PetFountain, DeviceType.Fan, DeviceType.Humidifier, DeviceType.Climate, DeviceType.WaterHeater;
67186
+ var deviceInput$1 = object({ deviceId: number().int().nonnegative() });
67187
+ systemMethod(deviceInput$1, PowerSourceInfoSchema, { auth: "admin" }), systemMethod(deviceInput$1, PowerSourceActionResultSchema, {
67188
+ kind: "mutation",
67189
+ auth: "admin"
67190
+ }), systemMethod(deviceInput$1, PowerSourceActionResultSchema, {
67191
+ kind: "mutation",
67192
+ auth: "admin"
67193
+ }), systemMethod(deviceInput$1, PowerSourceActionResultSchema, {
67194
+ kind: "mutation",
67195
+ auth: "admin"
67196
+ });
66734
67197
  /**
66735
67198
  * Presence cap. Models HA `person.*` and `device_tracker.*` entities
66736
67199
  * on `DeviceType.Presence`. Read-only — no setters: presence is
@@ -67157,6 +67620,37 @@ DeviceType.Camera, method(object({ deviceId: number() }), PtzAutotrackStatusSche
67157
67620
  deviceId: number(),
67158
67621
  status: PtzAutotrackStatusSchema
67159
67622
  });
67623
+ object({
67624
+ /** True when the pump works on the on/off cycle, false when it runs continuously. Null while unknown. */
67625
+ enabled: boolean().nullable(),
67626
+ /** How long the pump runs per cycle, in seconds. Null while unknown. */
67627
+ onTime: number().min(0).nullable().meta(readingMeta("duration")),
67628
+ /** How long the pump rests per cycle, in seconds. Null while unknown. */
67629
+ offTime: number().min(0).nullable().meta(readingMeta("duration")),
67630
+ /** Ms epoch when the slice was last refreshed. */
67631
+ lastFetchedAt: number()
67632
+ });
67633
+ var DeviceIdSchema = number().int().nonnegative();
67634
+ var MinutesSchema = number().int().min(0);
67635
+ DeviceType.PetFountain, method(object({
67636
+ deviceId: DeviceIdSchema,
67637
+ on: boolean()
67638
+ }), _void(), {
67639
+ kind: "mutation",
67640
+ auth: "protected"
67641
+ }), method(object({
67642
+ deviceId: DeviceIdSchema,
67643
+ minutes: MinutesSchema
67644
+ }), _void(), {
67645
+ kind: "mutation",
67646
+ auth: "protected"
67647
+ }), method(object({
67648
+ deviceId: DeviceIdSchema,
67649
+ minutes: MinutesSchema
67650
+ }), _void(), {
67651
+ kind: "mutation",
67652
+ auth: "protected"
67653
+ });
67160
67654
  DeviceType.Camera, DeviceType.Sensor, DeviceType.Switch, DeviceType.Gateway, method(object({ deviceId: number().int().nonnegative() }), object({ success: literal(true) }), {
67161
67655
  kind: "mutation",
67162
67656
  auth: "admin"
@@ -69870,7 +70364,13 @@ var RemoteMediaCommandSchema = _enum([
69870
70364
  "next",
69871
70365
  "previous",
69872
70366
  "setMute",
69873
- "selectSource"
70367
+ "selectSource",
70368
+ "turnOn",
70369
+ "turnOff",
70370
+ "volumeUp",
70371
+ "volumeDown",
70372
+ "channelUp",
70373
+ "channelDown"
69874
70374
  ]);
69875
70375
  /** A send result, or `not-routed`: the role is not bound, so the native cap answers. */
69876
70376
  var RemoteMediaCommandResultSchema = discriminatedUnion("status", [...RemoteSendResultSchema.options, object({ status: literal("not-routed") })]);
@@ -69891,7 +70391,7 @@ method(deviceInput, RemoteConfigSchema, { auth: "admin" }), method(deviceInput.e
69891
70391
  }), RemoteSendResultSchema, {
69892
70392
  kind: "mutation",
69893
70393
  auth: "protected"
69894
- }), method(deviceInput.extend({
70394
+ }), method(deviceInput, MediaPlayerStatusSchema.nullable(), { auth: "protected" }), method(deviceInput.extend({
69895
70395
  command: RemoteMediaCommandSchema,
69896
70396
  muted: boolean().optional(),
69897
70397
  source: string().optional(),
@@ -70825,7 +71325,16 @@ DeviceType.Sensor;
70825
71325
  * future fields without breaking the existing call sites.
70826
71326
  */
70827
71327
  var EmailAddressSchema = email();
71328
+ /**
71329
+ * Which relay of a multi-relay provider answers (D996). Absent = the provider's first / default
71330
+ * relay, so a caller written before relays existed keeps working unchanged. A provider with one
71331
+ * fixed relay ignores it. This is the integration instance id (`int_NNNN`), NOT the addon id: the
71332
+ * collection pin `addonId` still picks the provider, `instanceId` picks the relay inside it.
71333
+ */
71334
+ var InstanceIdSchema = string().min(1).optional();
71335
+ var RelayPinSchema = object({ instanceId: InstanceIdSchema });
70828
71336
  var SendEmailInputSchema = object({
71337
+ instanceId: InstanceIdSchema,
70829
71338
  to: union([EmailAddressSchema, array(EmailAddressSchema).min(1)]),
70830
71339
  cc: array(EmailAddressSchema).optional(),
70831
71340
  bcc: array(EmailAddressSchema).optional(),
@@ -70861,11 +71370,11 @@ method(SendEmailInputSchema, SendEmailResultSchema, {
70861
71370
  kind: "mutation",
70862
71371
  auth: "admin",
70863
71372
  access: "create"
70864
- }), method(_void(), SmtpStatusSchema, {
71373
+ }), method(RelayPinSchema, SmtpStatusSchema, {
70865
71374
  kind: "mutation",
70866
71375
  auth: "admin",
70867
71376
  access: "view"
70868
- }), method(_void(), SmtpStatusSchema, { auth: "admin" });
71377
+ }), method(RelayPinSchema, SmtpStatusSchema, { auth: "admin" });
70869
71378
  /**
70870
71379
  * A single device snapshot returned as base64 JPEG/PNG.
70871
71380
  *
@@ -70897,10 +71406,12 @@ DeviceType.Camera, method(object({
70897
71406
  * even when the cache is well within the device's
70898
71407
  * `snapshotMaxAgeS` window.
70899
71408
  *
70900
- * **`force` is an OPERATOR signal, not a freshness preference.** On a
71409
+ * **`force` is a demand with a named principal, not a freshness
71410
+ * preference** — an operator button, the scheduled refresh (D847), or a
71411
+ * notification rule that left the camera's wake allowed (D998). On a
70901
71412
  * battery camera it is the one thing that walks past the wrapper's
70902
- * sleep gate and wakes the camera, so a background caller — a poller,
70903
- * an event handler, a thumbnail — must NEVER set it. Every such caller
71413
+ * sleep gate and wakes the camera, so a poller, a thumbnail or a
71414
+ * prestream must NEVER set it. Every such caller
70904
71415
  * gets the cached frame, which on a sleeping battery camera is the
70905
71416
  * correct answer: stale but honest beats woken.
70906
71417
  */
@@ -71715,7 +72226,11 @@ Object.values(DeviceType), method(_void(), array(StreamSignalSchema).readonly())
71715
72226
  * `getSettingsUISchema()` surface.
71716
72227
  */
71717
72228
  var SwitchStatusSchema = object({
71718
- on: boolean().meta({ label: "On" }),
72229
+ /**
72230
+ * `null` = the device has never reported its state (a measurement that
72231
+ * has not happened is unknown, never `false`).
72232
+ */
72233
+ on: boolean().nullable().meta({ label: "On" }),
71719
72234
  /** Ms epoch of the last state change. Useful for UI "X minutes ago". */
71720
72235
  lastChangedAt: number()
71721
72236
  });
@@ -71727,7 +72242,7 @@ DeviceType.Switch, DeviceType.Siren, DeviceType.Light, DeviceType.Fan, DeviceTyp
71727
72242
  auth: "protected"
71728
72243
  }), object({
71729
72244
  deviceId: number(),
71730
- on: boolean(),
72245
+ on: boolean().nullable(),
71731
72246
  lastChangedAt: number()
71732
72247
  });
71733
72248
  /** C0 controls, DEL and the C1 range: none of them belongs in a name. */
@@ -74739,6 +75254,26 @@ function buildDescriptor(capName, kind) {
74739
75254
  * contributes one entry per bound cap present in this map.
74740
75255
  */
74741
75256
  var EVENT_KIND_BY_CAP = Object.freeze(Object.fromEntries(Object.entries(CAP_TO_KIND).map(([capName, kind]) => [capName, buildDescriptor(capName, kind)])));
75257
+ /**
75258
+ * What a remote key is CALLED and what it LOOKS like, for every role (D963),
75259
+ * shared by the admin UI and the viewer. A role is data on the wire; each
75260
+ * client resolves its name from `label` (English and Italian side by side) and
75261
+ * its glyph from `icon`, a lucide id from the shared icon catalogue — the
75262
+ * server sends an id, a client maps it to its own icon set.
75263
+ *
75264
+ * `legend` is text printed on the key INSTEAD of a glyph (a digit has no
75265
+ * pictogram): a client that can draw text shows it, one that cannot falls back
75266
+ * to `icon`.
75267
+ */
75268
+ function digit(n) {
75269
+ return {
75270
+ label: t(n, n),
75271
+ icon: "hash",
75272
+ legend: n
75273
+ };
75274
+ }
75275
+ digit("0"), digit("1"), digit("2"), digit("3"), digit("4"), digit("5"), digit("6"), digit("7"), digit("8"), digit("9");
75276
+ DeviceFeature.MediaPlayerPower, DeviceFeature.MediaPlayerVolumeStep, DeviceFeature.MediaPlayerChannelStep, DeviceFeature.MediaPlayerMute, DeviceFeature.MediaPlayerStop, DeviceFeature.MediaPlayerNext, DeviceFeature.MediaPlayerPrevious;
74742
75277
  var btn = (idSuffix, row, col, init) => ({
74743
75278
  idSuffix,
74744
75279
  row,
@@ -74865,7 +75400,35 @@ discriminatedUnion("kind", [object({
74865
75400
  kind: literal("pronto"),
74866
75401
  code: string()
74867
75402
  })]);
74868
- DeviceFeature.FanSpeed, DeviceFeature.FanPreset, DeviceFeature.FanDirection, DeviceFeature.FanOscillating, DeviceFeature.CoverPositionable, DeviceFeature.CoverTilt, DeviceFeature.ValvePositionable, DeviceFeature.MediaPlayerVolume, DeviceFeature.ClimateFanMode;
75403
+ /**
75404
+ * Propose a running threshold from a device's own power history (planning#405).
75405
+ *
75406
+ * Pure and deterministic: the same series gives the same answer. The series is
75407
+ * a HELD-VALUE step series — a point's value stands until the next point — which
75408
+ * is how device-history stores a gauge, so "time at a level" is exact, not a
75409
+ * count of samples.
75410
+ *
75411
+ * 1. idle floor F = time-weighted median; noise ceiling N = highest value seen
75412
+ * near F. A device that is not near one level most of the time has no floor.
75413
+ * 2. coarse activity = above max(2N, N + 5 W); consecutive stretches are episodes.
75414
+ * 3. gaps between episodes split in two by the largest log-scale jump (>= 3x):
75415
+ * the short ones are pauses INSIDE a run (a soak), the long ones separate runs.
75416
+ * 4. T = geometric mean of N and the plateau's 10th percentile, snapped to a
75417
+ * grid a person would type; stop dwell covers the longest pause; start dwell
75418
+ * covers the longest standby blip above T.
75419
+ * 5. the numbers are proved by REPLAY through the real `dwell` evaluation: each
75420
+ * run must hold exactly one true interval and nothing may flap outside.
75421
+ */
75422
+ var SECOND_MS = 1e3;
75423
+ var MINUTE_MS$1 = 60 * SECOND_MS;
75424
+ 24 * (60 * MINUTE_MS$1);
75425
+ 10 * MINUTE_MS$1;
75426
+ 30 * SECOND_MS;
75427
+ 60 * SECOND_MS;
75428
+ 20 * MINUTE_MS$1;
75429
+ 10 * SECOND_MS;
75430
+ 10 * SECOND_MS;
75431
+ DeviceFeature.FanSpeed, DeviceFeature.FanPreset, DeviceFeature.FanDirection, DeviceFeature.FanOscillating, DeviceFeature.CoverStoppable, DeviceFeature.CoverPositionable, DeviceFeature.CoverTilt, DeviceFeature.ValvePositionable, DeviceFeature.MediaPlayerVolume, DeviceFeature.ClimateFanMode;
74869
75432
  SOURCE_CAPS.filter((cap) => cap !== "switch" && cap !== "motion");
74870
75433
  String.raw`rose\(active(\d+), changed(\d+), (\d+(?:\.\d+)?)\)`;
74871
75434
  DeviceRole.BinarySensor, DeviceRole.MotionSensor;
@@ -75846,6 +76409,27 @@ Object.freeze({
75846
76409
  access: "view",
75847
76410
  role: "viewer"
75848
76411
  },
76412
+ "boardKeySource.getBoardKey": {
76413
+ capName: "board-key-source",
76414
+ capScope: "system",
76415
+ addonId: null,
76416
+ access: "view",
76417
+ role: "admin"
76418
+ },
76419
+ "boardKeySource.listBoards": {
76420
+ capName: "board-key-source",
76421
+ capScope: "system",
76422
+ addonId: null,
76423
+ access: "view",
76424
+ role: "admin"
76425
+ },
76426
+ "boardKeySource.listSources": {
76427
+ capName: "board-key-source",
76428
+ capScope: "system",
76429
+ addonId: null,
76430
+ access: "view",
76431
+ role: "admin"
76432
+ },
75849
76433
  "brightness.getStatus": {
75850
76434
  capName: "brightness",
75851
76435
  capScope: "device",
@@ -76385,6 +76969,13 @@ Object.freeze({
76385
76969
  access: "create",
76386
76970
  role: "admin"
76387
76971
  },
76972
+ "coreBlocks.proposeRunningThreshold": {
76973
+ capName: "core-blocks",
76974
+ capScope: "system",
76975
+ addonId: null,
76976
+ access: "view",
76977
+ role: "admin"
76978
+ },
76388
76979
  "coreBlocks.reportAutomationRun": {
76389
76980
  capName: "core-blocks",
76390
76981
  capScope: "system",
@@ -76896,6 +77487,13 @@ Object.freeze({
76896
77487
  access: "view",
76897
77488
  role: "admin"
76898
77489
  },
77490
+ "deviceExport.listInstances": {
77491
+ capName: "device-export",
77492
+ capScope: "system",
77493
+ addonId: null,
77494
+ access: "view",
77495
+ role: "admin"
77496
+ },
76899
77497
  "deviceExport.listSupportedDeviceKinds": {
76900
77498
  capName: "device-export",
76901
77499
  capScope: "system",
@@ -78527,6 +79125,13 @@ Object.freeze({
78527
79125
  access: "view",
78528
79126
  role: "admin"
78529
79127
  },
79128
+ "integrationInstances.setInstanceEnabled": {
79129
+ capName: "integration-instances",
79130
+ capScope: "system",
79131
+ addonId: null,
79132
+ access: "create",
79133
+ role: "admin"
79134
+ },
78530
79135
  "integrationInstances.testInstance": {
78531
79136
  capName: "integration-instances",
78532
79137
  capScope: "system",
@@ -79325,6 +79930,20 @@ Object.freeze({
79325
79930
  access: "view",
79326
79931
  role: "admin"
79327
79932
  },
79933
+ "mediaPlayer.channelDown": {
79934
+ capName: "media-player",
79935
+ capScope: "device",
79936
+ addonId: null,
79937
+ access: "create",
79938
+ role: "viewer"
79939
+ },
79940
+ "mediaPlayer.channelUp": {
79941
+ capName: "media-player",
79942
+ capScope: "device",
79943
+ addonId: null,
79944
+ access: "create",
79945
+ role: "viewer"
79946
+ },
79328
79947
  "mediaPlayer.getStatus": {
79329
79948
  capName: "media-player",
79330
79949
  capScope: "device",
@@ -79416,6 +80035,34 @@ Object.freeze({
79416
80035
  access: "create",
79417
80036
  role: "viewer"
79418
80037
  },
80038
+ "mediaPlayer.turnOff": {
80039
+ capName: "media-player",
80040
+ capScope: "device",
80041
+ addonId: null,
80042
+ access: "create",
80043
+ role: "viewer"
80044
+ },
80045
+ "mediaPlayer.turnOn": {
80046
+ capName: "media-player",
80047
+ capScope: "device",
80048
+ addonId: null,
80049
+ access: "create",
80050
+ role: "viewer"
80051
+ },
80052
+ "mediaPlayer.volumeDown": {
80053
+ capName: "media-player",
80054
+ capScope: "device",
80055
+ addonId: null,
80056
+ access: "create",
80057
+ role: "viewer"
80058
+ },
80059
+ "mediaPlayer.volumeUp": {
80060
+ capName: "media-player",
80061
+ capScope: "device",
80062
+ addonId: null,
80063
+ access: "create",
80064
+ role: "viewer"
80065
+ },
79419
80066
  "meshNetwork.getStatus": {
79420
80067
  capName: "mesh-network",
79421
80068
  capScope: "system",
@@ -80662,27 +81309,6 @@ Object.freeze({
80662
81309
  access: "create",
80663
81310
  role: "viewer"
80664
81311
  },
80665
- "petFountain.setPumpInterval": {
80666
- capName: "pet-fountain",
80667
- capScope: "device",
80668
- addonId: null,
80669
- access: "create",
80670
- role: "viewer"
80671
- },
80672
- "petFountain.setPumpOffMinutes": {
80673
- capName: "pet-fountain",
80674
- capScope: "device",
80675
- addonId: null,
80676
- access: "create",
80677
- role: "viewer"
80678
- },
80679
- "petFountain.setPumpOnMinutes": {
80680
- capName: "pet-fountain",
80681
- capScope: "device",
80682
- addonId: null,
80683
- access: "create",
80684
- role: "viewer"
80685
- },
80686
81312
  "pipelineAnalytics.addRetrainFrameFromRecording": {
80687
81313
  capName: "pipeline-analytics",
80688
81314
  capScope: "device",
@@ -82461,6 +83087,34 @@ Object.freeze({
82461
83087
  access: "create",
82462
83088
  role: "admin"
82463
83089
  },
83090
+ "pumpCycle.getStatus": {
83091
+ capName: "pump-cycle",
83092
+ capScope: "device",
83093
+ addonId: null,
83094
+ access: "view",
83095
+ role: "viewer"
83096
+ },
83097
+ "pumpCycle.setEnabled": {
83098
+ capName: "pump-cycle",
83099
+ capScope: "device",
83100
+ addonId: null,
83101
+ access: "create",
83102
+ role: "viewer"
83103
+ },
83104
+ "pumpCycle.setOffMinutes": {
83105
+ capName: "pump-cycle",
83106
+ capScope: "device",
83107
+ addonId: null,
83108
+ access: "create",
83109
+ role: "viewer"
83110
+ },
83111
+ "pumpCycle.setOnMinutes": {
83112
+ capName: "pump-cycle",
83113
+ capScope: "device",
83114
+ addonId: null,
83115
+ access: "create",
83116
+ role: "viewer"
83117
+ },
82464
83118
  "reboot.reboot": {
82465
83119
  capName: "reboot",
82466
83120
  capScope: "device",
@@ -82965,6 +83619,13 @@ Object.freeze({
82965
83619
  access: "create",
82966
83620
  role: "admin"
82967
83621
  },
83622
+ "remote.getAssumedStatus": {
83623
+ capName: "remote",
83624
+ capScope: "system",
83625
+ addonId: null,
83626
+ access: "view",
83627
+ role: "admin"
83628
+ },
82968
83629
  "remote.getConfig": {
82969
83630
  capName: "remote",
82970
83631
  capScope: "system",
@@ -85805,6 +86466,11 @@ Object.freeze({
85805
86466
  form: "single",
85806
86467
  optional: false
85807
86468
  }],
86469
+ "coreBlocks.proposeRunningThreshold": [{
86470
+ name: "deviceId",
86471
+ form: "single",
86472
+ optional: false
86473
+ }],
85808
86474
  "cover.close": [{
85809
86475
  name: "deviceId",
85810
86476
  form: "single",
@@ -86656,6 +87322,16 @@ Object.freeze({
86656
87322
  form: "single",
86657
87323
  optional: true
86658
87324
  }],
87325
+ "mediaPlayer.channelDown": [{
87326
+ name: "deviceId",
87327
+ form: "single",
87328
+ optional: false
87329
+ }],
87330
+ "mediaPlayer.channelUp": [{
87331
+ name: "deviceId",
87332
+ form: "single",
87333
+ optional: false
87334
+ }],
86659
87335
  "mediaPlayer.getStatus": [{
86660
87336
  name: "deviceId",
86661
87337
  form: "single",
@@ -86721,6 +87397,26 @@ Object.freeze({
86721
87397
  form: "single",
86722
87398
  optional: false
86723
87399
  }],
87400
+ "mediaPlayer.turnOff": [{
87401
+ name: "deviceId",
87402
+ form: "single",
87403
+ optional: false
87404
+ }],
87405
+ "mediaPlayer.turnOn": [{
87406
+ name: "deviceId",
87407
+ form: "single",
87408
+ optional: false
87409
+ }],
87410
+ "mediaPlayer.volumeDown": [{
87411
+ name: "deviceId",
87412
+ form: "single",
87413
+ optional: false
87414
+ }],
87415
+ "mediaPlayer.volumeUp": [{
87416
+ name: "deviceId",
87417
+ form: "single",
87418
+ optional: false
87419
+ }],
86724
87420
  "meter.getStatus": [{
86725
87421
  name: "deviceId",
86726
87422
  form: "single",
@@ -87030,21 +87726,6 @@ Object.freeze({
87030
87726
  form: "single",
87031
87727
  optional: false
87032
87728
  }],
87033
- "petFountain.setPumpInterval": [{
87034
- name: "deviceId",
87035
- form: "single",
87036
- optional: false
87037
- }],
87038
- "petFountain.setPumpOffMinutes": [{
87039
- name: "deviceId",
87040
- form: "single",
87041
- optional: false
87042
- }],
87043
- "petFountain.setPumpOnMinutes": [{
87044
- name: "deviceId",
87045
- form: "single",
87046
- optional: false
87047
- }],
87048
87729
  "pipelineAnalytics.addRetrainFrameFromRecording": [{
87049
87730
  name: "deviceId",
87050
87731
  form: "single",
@@ -87680,6 +88361,26 @@ Object.freeze({
87680
88361
  form: "single",
87681
88362
  optional: false
87682
88363
  }],
88364
+ "pumpCycle.getStatus": [{
88365
+ name: "deviceId",
88366
+ form: "single",
88367
+ optional: false
88368
+ }],
88369
+ "pumpCycle.setEnabled": [{
88370
+ name: "deviceId",
88371
+ form: "single",
88372
+ optional: false
88373
+ }],
88374
+ "pumpCycle.setOffMinutes": [{
88375
+ name: "deviceId",
88376
+ form: "single",
88377
+ optional: false
88378
+ }],
88379
+ "pumpCycle.setOnMinutes": [{
88380
+ name: "deviceId",
88381
+ form: "single",
88382
+ optional: false
88383
+ }],
87683
88384
  "reboot.reboot": [{
87684
88385
  name: "deviceId",
87685
88386
  form: "single",
@@ -87881,6 +88582,11 @@ Object.freeze({
87881
88582
  form: "single",
87882
88583
  optional: true
87883
88584
  }],
88585
+ "remote.getAssumedStatus": [{
88586
+ name: "deviceId",
88587
+ form: "single",
88588
+ optional: false
88589
+ }],
87884
88590
  "remote.getConfig": [{
87885
88591
  name: "deviceId",
87886
88592
  form: "single",
@@ -88428,99 +89134,6 @@ Object.freeze({
88428
89134
  "network-access": "ingress",
88429
89135
  "smtp-provider": "email"
88430
89136
  });
88431
- /**
88432
- * A saved Customize assignment (D936). The schema is the type: callers use
88433
- * `z.infer`, they do not restate the shape.
88434
- */
88435
- var OverrideSourceSchema = object({
88436
- addonId: string().min(1),
88437
- stableId: string().min(1),
88438
- cap: string().min(1),
88439
- fieldPath: string().min(1)
88440
- });
88441
- var CustomizeTransformDraftSchema = discriminatedUnion("kind", [
88442
- object({ kind: literal("identity") }),
88443
- object({ kind: literal("invert") }),
88444
- object({
88445
- kind: literal("threshold"),
88446
- comparison: _enum(["gte", "lte"]),
88447
- threshold: number(),
88448
- startDwellMs: number().nonnegative(),
88449
- stopDwellMs: number().nonnegative()
88450
- }),
88451
- object({
88452
- kind: literal("linear"),
88453
- scale: number(),
88454
- offset: number(),
88455
- clampMin: number().optional(),
88456
- clampMax: number().optional()
88457
- }),
88458
- object({
88459
- kind: literal("enum-map"),
88460
- mapping: record(string(), string().nullable())
88461
- }),
88462
- object({ kind: literal("number") })
88463
- ]);
88464
- var ScalarOverrideDraftSchema = object({
88465
- kind: literal("scalar"),
88466
- cap: string().min(1),
88467
- targetId: string().min(1),
88468
- source: OverrideSourceSchema,
88469
- transform: CustomizeTransformDraftSchema
88470
- });
88471
- var KeyedArrayOverrideDraftSchema = object({
88472
- kind: literal("keyedArray"),
88473
- cap: string().min(1),
88474
- targetId: string().min(1),
88475
- key: string().min(1),
88476
- label: string().min(1),
88477
- fieldPath: string().min(1),
88478
- source: OverrideSourceSchema,
88479
- transform: CustomizeTransformDraftSchema
88480
- });
88481
- var PulseOverrideDraftSchema = object({
88482
- kind: literal("pulse"),
88483
- cap: string().min(1),
88484
- targetId: string().min(1),
88485
- enabled: boolean(),
88486
- debounceMs: number().nonnegative(),
88487
- edges: array(_enum([
88488
- "rising",
88489
- "button",
88490
- "native-event"
88491
- ])).min(1).optional(),
88492
- sources: array(OverrideSourceSchema).min(1)
88493
- });
88494
- var SpanSourceDraftSchema = OverrideSourceSchema.extend({ mode: _enum([
88495
- "in-addition",
88496
- "confirm",
88497
- "replace"
88498
- ]).optional() });
88499
- discriminatedUnion("kind", [
88500
- ScalarOverrideDraftSchema,
88501
- KeyedArrayOverrideDraftSchema,
88502
- PulseOverrideDraftSchema,
88503
- object({
88504
- kind: literal("span"),
88505
- cap: string().min(1),
88506
- targetId: string().min(1),
88507
- timeoutMs: number().nonnegative(),
88508
- cooldownMs: number().nonnegative().optional(),
88509
- sources: array(SpanSourceDraftSchema)
88510
- })
88511
- ]);
88512
- object({
88513
- targetId: string().min(1),
88514
- configured: boolean(),
88515
- source: _enum(["native", "assigned"]),
88516
- state: _enum([
88517
- "active",
88518
- "stale",
88519
- "released",
88520
- "unavailable"
88521
- ]),
88522
- reason: string().nullable()
88523
- });
88524
89137
  var G711_SCALE_CORRECTION_DB = {
88525
89138
  PCMU: 20 * Math.log10(4),
88526
89139
  PCMA: 20 * Math.log10(8)
@@ -89136,6 +89749,7 @@ var STATE_SUMMARY_VARS = [
89136
89749
  [...RULE_TEXT],
89137
89750
  ([...RULE_TEXT], [...DEVICE_EVENTS]),
89138
89751
  ([...RULE_TEXT], [...COMBINED_ALARM]),
89752
+ ([...RULE_TEXT], [...COMBINED_ALARM]),
89139
89753
  ([...RULE_TEXT], [...DEVICE_EVENTS]),
89140
89754
  ([...RULE_TEXT], [...BATTERY, ...CONSUMABLE]),
89141
89755
  ([...RULE_TEXT], [...CONSUMABLE]),
@@ -91028,30 +91642,55 @@ var ExportGoogleAddon = class extends BaseAddon {
91028
91642
  actionScenes.reconcile().catch((err) => {
91029
91643
  this.ctx.logger.warn("export-google: action scene reconcile at boot failed", { meta: { error: errMsg$1(err) } });
91030
91644
  });
91645
+ const ownInstance = (instanceId) => assertOwnExportInstance("export-google", ADDON_ID, instanceId);
91031
91646
  const deviceExportProvider = {
91032
- getStatus: async () => ({
91033
- linkState: this.config.linkedAccounts.length > 0 ? "linked" : "unlinked",
91034
- exposedDeviceCount: this.config.exposed.length,
91035
- setup: await this.buildSetupBlock()
91036
- }),
91037
- listSupportedDeviceKinds: async () => [...SUPPORTED_DEVICE_KINDS],
91038
- listExposedDevices: async () => this.config.exposed.map((entry) => ({ deviceId: String(entry.deviceId) })),
91039
- exposeDevice: async ({ deviceId }) => this.exposeDevice(deviceId),
91040
- unexposeDevice: async ({ deviceId }) => this.unexposeDevice(deviceId),
91647
+ getStatus: async (input) => {
91648
+ ownInstance(statusInstanceOf(input));
91649
+ return {
91650
+ linkState: this.config.linkedAccounts.length > 0 ? "linked" : "unlinked",
91651
+ exposedDeviceCount: this.config.exposed.length,
91652
+ setup: await this.buildSetupBlock()
91653
+ };
91654
+ },
91655
+ listInstances: async () => [{
91656
+ instanceId: ADDON_ID,
91657
+ name: "Google Home",
91658
+ enabled: true,
91659
+ kind: "google-home"
91660
+ }],
91661
+ listSupportedDeviceKinds: async ({ instanceId }) => {
91662
+ ownInstance(instanceId);
91663
+ return [...SUPPORTED_DEVICE_KINDS];
91664
+ },
91665
+ listExposedDevices: async ({ instanceId }) => {
91666
+ ownInstance(instanceId);
91667
+ return this.config.exposed.map((entry) => ({ deviceId: String(entry.deviceId) }));
91668
+ },
91669
+ exposeDevice: async ({ instanceId, deviceId }) => {
91670
+ ownInstance(instanceId);
91671
+ return this.exposeDevice(deviceId);
91672
+ },
91673
+ unexposeDevice: async ({ instanceId, deviceId }) => {
91674
+ ownInstance(instanceId);
91675
+ return this.unexposeDevice(deviceId);
91676
+ },
91041
91677
  listSupportedEntityKinds: async () => ["device", "action"],
91042
- listExposedEntities: async () => {
91678
+ listExposedEntities: async ({ instanceId }) => {
91679
+ ownInstance(instanceId);
91043
91680
  await actionScenes.reconcile();
91044
91681
  return [...this.config.exposed.map((entry) => ({ entity: {
91045
91682
  kind: "device",
91046
91683
  deviceId: String(entry.deviceId)
91047
91684
  } })), ...actionScenes.list()];
91048
91685
  },
91049
- exposeEntity: async ({ entity }) => {
91686
+ exposeEntity: async ({ instanceId, entity }) => {
91687
+ ownInstance(instanceId);
91050
91688
  if (entity.kind === "device") return this.exposeDevice(entity.deviceId);
91051
91689
  if (entity.kind === "action") return actionScenes.expose(entity.actionId);
91052
91690
  throw new Error("export-google: a notification target cannot be exported to Google Home");
91053
91691
  },
91054
- unexposeEntity: async ({ entity }) => {
91692
+ unexposeEntity: async ({ instanceId, entity }) => {
91693
+ ownInstance(instanceId);
91055
91694
  if (entity.kind === "device") return this.unexposeDevice(entity.deviceId);
91056
91695
  if (entity.kind === "action") return actionScenes.unexpose(entity.actionId);
91057
91696
  throw new Error("export-google: a notification target cannot be exported to Google Home");