@camstack/addon-export-alexa 1.2.191 → 1.2.192

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [1.2.192] - 2026-11-08
11
+
12
+ ### Changed
13
+
14
+ - Infrared-code remote sources are offered as Alexa input sources.
15
+
10
16
  ## [1.2.191] - 2026-11-08
11
17
 
12
18
  ### Changed
@@ -837,7 +837,7 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
837
837
  return EventCategory;
838
838
  }({});
839
839
  //#endregion
840
- //#region ../types/dist/device-type-DxCT0krO.mjs
840
+ //#region ../types/dist/device-type-CbDhVwFP.mjs
841
841
  /**
842
842
  import { errMsg } from '@camstack/types'
843
843
  * Extract a human-readable message from an unknown error value.
@@ -1006,6 +1006,13 @@ var DeviceFeature = /* @__PURE__ */ function(DeviceFeature) {
1006
1006
  * (`featuresOfBoundCaps`). Gates the quick-run control in the viewer.
1007
1007
  */
1008
1008
  DeviceFeature["TimedRun"] = "timed-run";
1009
+ /**
1010
+ * Device binds a plain `switch` cap. Derived from the bindings
1011
+ * (`featuresOfBoundCaps`) for a composed device, whose switch is bound by the
1012
+ * composition and not by a driver: an appliance (a heater behind a smart
1013
+ * plug) has no control of its own, so a surface reads this as its on/off.
1014
+ */
1015
+ DeviceFeature["Switch"] = "switch";
1009
1016
  /** Light supports rgb-triplet color via `color` cap. */
1010
1017
  DeviceFeature["LightColorRgb"] = "light-color-rgb";
1011
1018
  /** Light supports HSV color via `color` cap. */
@@ -6040,7 +6047,7 @@ var ZodIssueCode = {
6040
6047
  var ZodFirstPartyTypeKind;
6041
6048
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
6042
6049
  //#endregion
6043
- //#region ../types/dist/sleep-t7BftoJG.mjs
6050
+ //#region ../types/dist/sleep-CqvzKIq2.mjs
6044
6051
  /**
6045
6052
  * The audio chunk plane's byte format, and the ONE expansion from a coded
6046
6053
  * window to float samples (D455).
@@ -17193,7 +17200,7 @@ object({
17193
17200
  params: record(string(), union([string(), number()])).optional()
17194
17201
  });
17195
17202
  //#endregion
17196
- //#region ../types/dist/composition-Bx0JvKUU.mjs
17203
+ //#region ../types/dist/composition-CXCX78IR.mjs
17197
17204
  /**
17198
17205
  * The ffmpeg build every CamStack node downloads, per platform and arch.
17199
17206
  *
@@ -49156,6 +49163,90 @@ DeviceType.Control, method(object({
49156
49163
  kind: "mutation",
49157
49164
  auth: "protected"
49158
49165
  });
49166
+ var IrCodecError = class extends Error {
49167
+ code;
49168
+ constructor(code, message) {
49169
+ super(message);
49170
+ this.name = "IrCodecError";
49171
+ this.code = code;
49172
+ }
49173
+ };
49174
+ /**
49175
+ * A pulse train in signed microseconds: mark (+) first, then space (-), strictly
49176
+ * alternating, no zeros, 2..1024 entries.
49177
+ */
49178
+ var IrTimingsSchema = array(number().int()).min(2).max(1024).superRefine((timings, ctx) => {
49179
+ timings.forEach((value, index) => {
49180
+ const expectMark = index % 2 === 0;
49181
+ if (value === 0 || value > 0 !== expectMark) ctx.addIssue({
49182
+ code: "custom",
49183
+ message: `timing ${index} must be a non-zero ${expectMark ? "mark (positive)" : "space (negative)"}`,
49184
+ path: [index]
49185
+ });
49186
+ });
49187
+ });
49188
+ /** Per-command transmit options. Every key is optional; a transmitter applies what it can. */
49189
+ var TransmitSettingsSchema = object({
49190
+ carrierHz: number().int().positive().optional(),
49191
+ dutyCyclePercent: number().int().min(1).max(100).optional(),
49192
+ repeat: number().int().min(0).max(20).optional(),
49193
+ repeatDelayMs: number().int().min(0).optional()
49194
+ });
49195
+ /** One Pronto frequency-word unit, in microseconds, per unit of the word. */
49196
+ var PRONTO_CLOCK_US = .241246;
49197
+ var LEARNED_FORM = 0;
49198
+ /**
49199
+ * Decode a learned (0000 form) Pronto hex string. The intro burst is followed by
49200
+ * the repeat burst once; a different form is refused with `pronto-unsupported-form`.
49201
+ */
49202
+ function decodePronto(code) {
49203
+ const words = code.trim().split(/\s+/).filter((w) => w.length > 0);
49204
+ if (words.length < 4) throw new IrCodecError("pronto-malformed", `Pronto code needs at least 4 words, got ${words.length}`);
49205
+ const values = words.map((w) => /^[0-9a-fA-F]{1,4}$/.test(w) ? parseInt(w, 16) : NaN);
49206
+ if (values.some((v) => Number.isNaN(v))) throw new IrCodecError("pronto-malformed", "Pronto code must be 4-digit hexadecimal words");
49207
+ const [form, freqWord, introCount, repeatCount] = values;
49208
+ if (form === void 0 || freqWord === void 0 || introCount === void 0 || repeatCount === void 0) throw new IrCodecError("pronto-malformed", "Pronto header incomplete");
49209
+ if (form !== LEARNED_FORM) throw new IrCodecError("pronto-unsupported-form", `Pronto form ${words[0] ?? ""} is not supported, only the learned 0000 form`);
49210
+ if (freqWord === 0) throw new IrCodecError("pronto-malformed", "Pronto frequency word is zero");
49211
+ const pairs = introCount + repeatCount;
49212
+ if (pairs === 0 || values.length !== 4 + pairs * 2) throw new IrCodecError("pronto-malformed", `Pronto declares ${pairs} burst pairs but carries ${(values.length - 4) / 2} word pairs`);
49213
+ const unitUs = freqWord * PRONTO_CLOCK_US;
49214
+ const timings = values.slice(4).map((count, index) => {
49215
+ const us = Math.max(1, Math.round(count * unitUs));
49216
+ return index % 2 === 0 ? us : -us;
49217
+ });
49218
+ const checked = IrTimingsSchema.safeParse(timings);
49219
+ if (!checked.success) throw new IrCodecError("invalid-timings", `Pronto decoded to invalid timings: ${checked.error.message}`);
49220
+ return {
49221
+ timings: checked.data,
49222
+ carrierHz: Math.round(1e6 / unitUs)
49223
+ };
49224
+ }
49225
+ /** What a remote command stores: a raw pulse train, or a learned Pronto code. */
49226
+ var IrPayloadSchema = discriminatedUnion("kind", [object({
49227
+ kind: literal("raw"),
49228
+ timings: array(number().int()),
49229
+ settings: TransmitSettingsSchema.optional()
49230
+ }), object({
49231
+ kind: literal("pronto"),
49232
+ code: string()
49233
+ })]);
49234
+ /** Resolve a payload to what `ir-transmitter.send` takes. Throws `IrCodecError`. */
49235
+ function toTimings(payload) {
49236
+ if (payload.kind === "pronto") {
49237
+ const decoded = decodePronto(payload.code);
49238
+ return {
49239
+ timings: decoded.timings,
49240
+ settings: { carrierHz: decoded.carrierHz }
49241
+ };
49242
+ }
49243
+ const checked = IrTimingsSchema.safeParse(payload.timings);
49244
+ if (!checked.success) throw new IrCodecError("invalid-timings", checked.error.message);
49245
+ return {
49246
+ timings: checked.data,
49247
+ settings: payload.settings ?? {}
49248
+ };
49249
+ }
49159
49250
  /**
49160
49251
  * The role vocabulary of a remote (D963): what a button MEANS, independent of
49161
49252
  * how it is wired. A layout template places buttons by role; a device binds a
@@ -49243,11 +49334,18 @@ var RemoteRoleSchema = string().refine(isRemoteRole, { message: "a role is one o
49243
49334
  * a voice command or `playMedia` names.
49244
49335
  * - `sequence`: a name and explicit steps — bound roles pressed in order
49245
49336
  * (an input key, a menu macro such as `source, down, down, ok`).
49337
+ * - `ir`: a name and one infrared code of its own (raw timings or a Pronto
49338
+ * string), sent through a named transmitter (planning#464). It presses no
49339
+ * button: a source the remote's layout has no key for.
49246
49340
  *
49247
49341
  * The name and the number resolve to the SAME declared source. A number no
49248
49342
  * `digits` source declares is not a channel: it is refused, never guessed.
49249
49343
  */
49250
- var REMOTE_SOURCE_KINDS = ["digits", "sequence"];
49344
+ var REMOTE_SOURCE_KINDS = [
49345
+ "digits",
49346
+ "sequence",
49347
+ "ir"
49348
+ ];
49251
49349
  _enum(REMOTE_SOURCE_KINDS);
49252
49350
  var REMOTE_SOURCE_ID_RE = /^[a-z0-9][a-z0-9_-]{0,47}$/;
49253
49351
  var CHANNEL_NUMBER_RE = new RegExp(`^[0-9]{1,6}$`);
@@ -49257,19 +49355,50 @@ var sourceBase = {
49257
49355
  /** What the operator calls it, and what a voice command or a picker names. */
49258
49356
  name: string().trim().min(1).max(60)
49259
49357
  };
49260
- var RemoteSourceSchema = discriminatedUnion("kind", [object({
49261
- ...sourceBase,
49262
- kind: literal("digits"),
49263
- number: string().regex(CHANNEL_NUMBER_RE, { message: "up to 6 digits" })
49264
- }), object({
49265
- ...sourceBase,
49266
- kind: literal("sequence"),
49267
- steps: array(RemoteRoleSchema).min(1).max(16)
49268
- })]);
49358
+ var RemoteSourceSchema = discriminatedUnion("kind", [
49359
+ object({
49360
+ ...sourceBase,
49361
+ kind: literal("digits"),
49362
+ number: string().regex(CHANNEL_NUMBER_RE, { message: "up to 6 digits" })
49363
+ }),
49364
+ object({
49365
+ ...sourceBase,
49366
+ kind: literal("sequence"),
49367
+ steps: array(RemoteRoleSchema).min(1).max(16)
49368
+ }),
49369
+ object({
49370
+ ...sourceBase,
49371
+ kind: literal("ir"),
49372
+ /** The `ir-transmitter` device the code is sent through. */
49373
+ transmitterId: number().int().nonnegative(),
49374
+ /** The code itself; whether a transmitter could send it is `irSourceProblem`. */
49375
+ payload: IrPayloadSchema
49376
+ })
49377
+ ]);
49269
49378
  var REMOTE_STEP_DELAY_MAX_MS = 3e3;
49270
- /** The roles a source presses, in order. A `digits` number is its digit roles. */
49379
+ /**
49380
+ * The roles a source presses, in order. A `digits` number is its digit roles;
49381
+ * an `ir` source presses none — it carries its own code.
49382
+ */
49271
49383
  function remoteSourceSteps(source) {
49272
- return source.kind === "sequence" ? source.steps : Array.from(source.number, (digit) => `digit_${digit}`);
49384
+ switch (source.kind) {
49385
+ case "sequence": return source.steps;
49386
+ case "digits": return Array.from(source.number, (digit) => `digit_${digit}`);
49387
+ case "ir": return [];
49388
+ }
49389
+ }
49390
+ /**
49391
+ * Why an `ir` source's code could not be sent (the codec's own words), or null
49392
+ * when it resolves to a pulse train. The schema refuses on it; the editor shows it.
49393
+ */
49394
+ function irSourceProblem(source) {
49395
+ try {
49396
+ toTimings(source.payload);
49397
+ return null;
49398
+ } catch (err) {
49399
+ if (err instanceof IrCodecError) return err.message;
49400
+ throw err;
49401
+ }
49273
49402
  }
49274
49403
  /**
49275
49404
  * Media-player cap. Models HA `media_player.*` (Sonos, Chromecast,
@@ -54835,8 +54964,9 @@ DeviceType.Thermostat;
54835
54964
  *
54836
54965
  * "Heat for 30 minutes", "run the fountain pump for 2 minutes": the device has
54837
54966
  * no timer of its own, so the hub keeps one. `runFor` turns the device on and
54838
- * records a deadline; `cancel` (or the device being switched off by hand)
54839
- * forgets it; at the deadline the hub issues the off once.
54967
+ * records a deadline; `cancel` switches the device off and forgets the deadline,
54968
+ * and the device being switched off by hand just forgets it; at the deadline
54969
+ * the hub issues the off once.
54840
54970
  *
54841
54971
  * The deadline is DURABLE: it is a row in the records store, so a hub restart
54842
54972
  * neither loses a pending off nor leaves the device running past its time. At
@@ -54973,6 +55103,56 @@ var StateLookSchema = object({
54973
55103
  background: _enum(HERO_BACKGROUNDS),
54974
55104
  animation: HeroAnimationSchema
54975
55105
  });
55106
+ /** The scene as the model carries it. `null` = the device did not say (never a guess). */
55107
+ var HeroSceneSchema = object({
55108
+ id: _enum([
55109
+ "ac",
55110
+ "thermostat",
55111
+ "heater",
55112
+ "fan",
55113
+ "washer",
55114
+ "dryer",
55115
+ "dishwasher",
55116
+ "pet-fountain",
55117
+ "pet-feeder",
55118
+ "vacuum",
55119
+ "lawn-mower",
55120
+ "tv",
55121
+ "speaker",
55122
+ "camera",
55123
+ "light",
55124
+ "cover",
55125
+ "lock",
55126
+ "alarm",
55127
+ "siren",
55128
+ "sensor-sparkline",
55129
+ "contact",
55130
+ "presence",
55131
+ "weather",
55132
+ "plug",
55133
+ "button",
55134
+ "update",
55135
+ "control-dial",
55136
+ "event-stream",
55137
+ "gateway",
55138
+ "generic"
55139
+ ]),
55140
+ mode: _enum([
55141
+ "cool",
55142
+ "heat",
55143
+ "dry",
55144
+ "fan",
55145
+ "auto",
55146
+ "playing",
55147
+ "paused",
55148
+ "open",
55149
+ "closed"
55150
+ ]).nullable(),
55151
+ /** 0..1: volume, cover position, cycle progress. */
55152
+ level: number().min(0).max(1).nullable()
55153
+ });
55154
+ 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;
55155
+ DeviceRole.Siren, DeviceRole.Floodlight, DeviceRole.Spotlight, DeviceRole.PirSensor, DeviceRole.Chime, DeviceRole.Autotrack, DeviceRole.Nightvision, DeviceRole.PrivacyMask, DeviceRole.Doorbell, DeviceRole.CoverBlind, DeviceRole.CoverShutter, DeviceRole.CoverAwning, DeviceRole.CoverCurtain, DeviceRole.CoverGarage, DeviceRole.CoverGate, DeviceRole.CoverDoor, DeviceRole.CoverWindow, DeviceRole.BinaryHelper, DeviceRole.Outlet, DeviceRole.MotionSensor, DeviceRole.ContactSensor, DeviceRole.LeakSensor, DeviceRole.SmokeSensor, DeviceRole.COSensor, DeviceRole.GasSensor, DeviceRole.TamperSensor, DeviceRole.VibrationSensor, DeviceRole.ConnectivitySensor, DeviceRole.SoundSensor, DeviceRole.BinarySensor, DeviceRole.TemperatureSensor, DeviceRole.HumiditySensor, DeviceRole.AmbientLightSensor, DeviceRole.PressureSensor, DeviceRole.WindSensor, DeviceRole.RainSensor, DeviceRole.UvSensor, DeviceRole.SolarRadiationSensor, DeviceRole.SoilMoistureSensor, DeviceRole.PowerSensor, DeviceRole.EnergySensor, DeviceRole.VoltageSensor, DeviceRole.CurrentSensor, DeviceRole.AirQualitySensor, DeviceRole.BatterySensor, DeviceRole.NumericSensor, DeviceRole.EnumSensor, DeviceRole.DateTimeSensor, DeviceRole.GenericSensor, DeviceRole.NumericControl, DeviceRole.SelectControl, DeviceRole.TextControl, DeviceRole.DateTimeControl, DeviceRole.MobilePushNotifier, DeviceRole.MessagingNotifier, DeviceRole.EmailNotifier, DeviceRole.GenericNotifier, DeviceRole.IrTransmitter;
54976
55156
  /** A string in both languages, as the cap vocabulary writes it (D920): no `t()` in the model. */
54977
55157
  var HeroTextSchema = object({
54978
55158
  en: string(),
@@ -55124,6 +55304,32 @@ var HeroStateBackdropSchema = object({
55124
55304
  token: _enum(HERO_BACKGROUNDS),
55125
55305
  animation: _enum(HERO_ANIMATIONS)
55126
55306
  });
55307
+ var HeroFactSchema = object({
55308
+ id: _enum([
55309
+ "power",
55310
+ "energy",
55311
+ "battery",
55312
+ "link",
55313
+ "phase",
55314
+ "remaining",
55315
+ "volume",
55316
+ "source",
55317
+ "consumables"
55318
+ ]),
55319
+ icon: IconKeySchema.nullable(),
55320
+ text: HeroTextSchema,
55321
+ tone: HeroToneSchema
55322
+ });
55323
+ /** A labelled value beside the scene. */
55324
+ var HeroSideTileSchema = object({
55325
+ label: HeroTextSchema,
55326
+ value: HeroTextSchema,
55327
+ tone: HeroToneSchema.optional()
55328
+ });
55329
+ var HeroSideTilesSchema = object({
55330
+ left: array(HeroSideTileSchema).max(2),
55331
+ right: array(HeroSideTileSchema).max(2)
55332
+ });
55127
55333
  var HeroBackgroundSchema = discriminatedUnion("kind", [object({
55128
55334
  kind: literal("artwork"),
55129
55335
  url: string(),
@@ -55147,6 +55353,11 @@ var HeroModelSchema = object({
55147
55353
  stateAssumed: boolean(),
55148
55354
  look: StateLookSchema,
55149
55355
  background: HeroBackgroundSchema,
55356
+ /** Which animated picture the hero (and the list row) draws; its motion is `look.animation`. */
55357
+ scene: HeroSceneSchema,
55358
+ /** The top line's inline facts, in order; never wraps, so a client may cut the tail. */
55359
+ facts: array(HeroFactSchema),
55360
+ sideTiles: HeroSideTilesSchema,
55150
55361
  /** The status line under the main icon. */
55151
55362
  title: HeroTextSchema,
55152
55363
  badges: array(HeroBadgeSchema),
@@ -55162,6 +55373,42 @@ var HeroModelSchema = object({
55162
55373
  provenance: array(HeroProvenanceSchema)
55163
55374
  });
55164
55375
  /**
55376
+ * The ROW of a device in a list (D1023 P2): four fixed zones, all taken from
55377
+ * the hero model and nothing else.
55378
+ *
55379
+ * 1. mini-scene the same scene id as the hero, drawn 44x44 with the state look;
55380
+ * 2. name + ONE status line the facts joined by " · " by the client;
55381
+ * 3. the type's primary inline control;
55382
+ * 4. a trailing fact (power, else battery, else consumables).
55383
+ *
55384
+ * Selection rules, all taken from the model:
55385
+ * - ONE control is ever shown: the device's own power; else the FIRST control of
55386
+ * the FIRST row that has any (a later row's control is never promoted). When
55387
+ * the model lists that part in `gated`, the row has no inline control: the
55388
+ * projection never falls through to another control the caller could use.
55389
+ * - the status line is the head (what plays, else the state) plus at most
55390
+ * {@link ROW_STATUS_FACTS_MAX} facts, the trailing fact excluded;
55391
+ * - the trailing fact is the first of power, battery, consumables.
55392
+ *
55393
+ * `projectDeviceRow` is pure and computes nothing: it selects from a
55394
+ * {@link HeroModel}. A row that needed a value the hero lacks would mean the
55395
+ * model is missing it, so the fix goes in the model.
55396
+ */
55397
+ var HeroRowModelSchema = object({
55398
+ deviceId: number().int(),
55399
+ name: string(),
55400
+ type: string(),
55401
+ state: HeroStateSchema,
55402
+ stateAssumed: boolean(),
55403
+ look: StateLookSchema,
55404
+ scene: HeroSceneSchema,
55405
+ /** Joined by " · ": the state (or what is playing), then the facts. */
55406
+ statusLine: array(HeroTextSchema),
55407
+ /** `null` = the type has no inline control, or the caller may not act on it. */
55408
+ primary: HeroControlSchema.nullable(),
55409
+ trailing: HeroFactSchema.nullable()
55410
+ });
55411
+ /**
55165
55412
  * hero-layout — what a device's hero says (D1023). Read-only: the FIXED
55166
55413
  * layouts live in `@camstack/types` and nothing here stores or edits one.
55167
55414
  * `getHeroModel` builds the pure model from the device's bindings and its
@@ -55177,6 +55424,11 @@ var heroInput = object({
55177
55424
  */
55178
55425
  canActuate: boolean().optional()
55179
55426
  });
55427
+ var rowModelsInput = object({
55428
+ deviceIds: array(number().int().nonnegative()).max(500),
55429
+ /** As `canActuate` of `getHeroModel`; absent = may. */
55430
+ canActuate: boolean().optional()
55431
+ });
55180
55432
  var HeroLayoutRowsSchema = object({
55181
55433
  type: string(),
55182
55434
  rows: array(HeroRowIdSchema)
@@ -55184,6 +55436,9 @@ var HeroLayoutRowsSchema = object({
55184
55436
  method(heroInput, HeroModelSchema.nullable(), {
55185
55437
  auth: "protected",
55186
55438
  role: "viewer"
55439
+ }), method(rowModelsInput, array(HeroRowModelSchema.nullable()), {
55440
+ auth: "protected",
55441
+ role: "viewer"
55187
55442
  }), method(object({ deviceType: string() }), HeroLayoutRowsSchema, {
55188
55443
  auth: "protected",
55189
55444
  role: "viewer"
@@ -55722,20 +55977,40 @@ var integrationInstancesCapability = {
55722
55977
  instanceFormSchema: method(object({
55723
55978
  id: IntegrationInstanceIdSchema.nullable(),
55724
55979
  /** The kind of the create form (`id: null`) of a provider with several. */
55725
- kind: string().min(1).optional()
55980
+ kind: string().min(1).optional(),
55981
+ /** The wizard mode of the integration type (`getAvailableTypes`); a form may differ per mode. */
55982
+ mode: _enum([
55983
+ "standalone",
55984
+ "account",
55985
+ "broker"
55986
+ ]).optional(),
55987
+ /** The discovery candidate the wizard was seeded from (`stableId`), if any. */
55988
+ candidateStableId: string().min(1).optional()
55726
55989
  }), ConfigSchemaPassthrough$2, { auth: "admin" }),
55727
55990
  listInstances: method(_void(), array(IntegrationInstanceSchema).readonly(), { auth: "admin" }),
55728
55991
  getInstance: method(object({ id: IntegrationInstanceIdSchema }), IntegrationInstanceSchema.nullable(), { auth: "admin" }),
55729
55992
  /**
55730
55993
  * Insert the typed record. With `id` it is stored under that id (a duplicate id is refused);
55731
55994
  * without one the PROVIDER mints it and answers it. `kind` picks one of `describe().kinds`.
55995
+ *
55996
+ * An instance of a kind that brings devices (`role: 'devices'`) is an integration: the HUB mints
55997
+ * the id (the `integrations` registry id, which its devices carry), refuses the create when
55998
+ * `testInstance` rejects the values (D1016; a kind with no test passes and says so), writes the
55999
+ * registry row and the record, and removes both when either step fails. An `id` is accepted
56000
+ * only when it names an existing registry row of the addon.
55732
56001
  */
55733
56002
  createInstance: method(object({
55734
56003
  id: IntegrationInstanceIdSchema.optional(),
55735
56004
  name: string().min(1),
55736
56005
  kind: string().min(1).optional(),
55737
56006
  /** Form values written with the record (a link picked in the create dialog). */
55738
- values: record(string(), unknown()).optional()
56007
+ values: record(string(), unknown()).optional(),
56008
+ /**
56009
+ * The discovery candidate (`stableId`) the instance is set up from. Kept on the integration
56010
+ * registry row of an instance that brings devices, so discovery stops offering a candidate
56011
+ * that already has its integration (D984). Ignored by an instance with no registry row.
56012
+ */
56013
+ originStableId: string().min(1).optional()
55739
56014
  }), object({ id: string() }), {
55740
56015
  kind: "mutation",
55741
56016
  auth: "admin"
@@ -55756,7 +56031,11 @@ var integrationInstancesCapability = {
55756
56031
  kind: "mutation",
55757
56032
  auth: "admin"
55758
56033
  }),
55759
- /** Delete the record and its keychain refs together. */
56034
+ /**
56035
+ * Delete the record and its keychain refs together. For an instance that brings devices the hub
56036
+ * also removes the integration's devices (their tombstones, D865), the registry row, and emits
56037
+ * `IntegrationDeleted`; a fixed builtin and an instance a link names are refused first.
56038
+ */
55760
56039
  deleteInstance: method(object({ id: IntegrationInstanceIdSchema }), object({ ok: literal(true) }), {
55761
56040
  kind: "mutation",
55762
56041
  auth: "admin"
@@ -55874,27 +56153,6 @@ DeviceType.Camera, method(object({ deviceId: number() }), object({
55874
56153
  deviceId: number(),
55875
56154
  status: IntercomStatusSchema
55876
56155
  });
55877
- /**
55878
- * A pulse train in signed microseconds: mark (+) first, then space (-), strictly
55879
- * alternating, no zeros, 2..1024 entries.
55880
- */
55881
- var IrTimingsSchema = array(number().int()).min(2).max(1024).superRefine((timings, ctx) => {
55882
- timings.forEach((value, index) => {
55883
- const expectMark = index % 2 === 0;
55884
- if (value === 0 || value > 0 !== expectMark) ctx.addIssue({
55885
- code: "custom",
55886
- message: `timing ${index} must be a non-zero ${expectMark ? "mark (positive)" : "space (negative)"}`,
55887
- path: [index]
55888
- });
55889
- });
55890
- });
55891
- /** Per-command transmit options. Every key is optional; a transmitter applies what it can. */
55892
- var TransmitSettingsSchema = object({
55893
- carrierHz: number().int().positive().optional(),
55894
- dutyCyclePercent: number().int().min(1).max(100).optional(),
55895
- repeat: number().int().min(0).max(20).optional(),
55896
- repeatDelayMs: number().int().min(0).optional()
55897
- });
55898
56156
  /** The setting keys a transmitter may declare as settable (`getInfo.settable`). */
55899
56157
  var TransmitSettingKeySchema = _enum([
55900
56158
  "carrierHz",
@@ -72233,6 +72491,10 @@ function refineSources(config, ctx) {
72233
72491
  if (numbers.has(source.number)) fail(`channel ${source.number} is declared twice`, "number");
72234
72492
  numbers.add(source.number);
72235
72493
  }
72494
+ if (source.kind === "ir") {
72495
+ const problem = irSourceProblem(source);
72496
+ if (problem !== null) fail(problem, "payload");
72497
+ }
72236
72498
  for (const role of remoteSourceSteps(source)) if (isRemoteWidgetRole(role)) fail(`"${source.name}" presses ${role}, a layout widget, not a command`, "steps");
72237
72499
  else if (config.bindings[role] === void 0) fail(`"${source.name}" presses ${role}, which is not bound`, "steps");
72238
72500
  });
@@ -72254,6 +72516,14 @@ function refineSources(config, ctx) {
72254
72516
  }
72255
72517
  });
72256
72518
  }
72519
+ /** A stored source that was left out of a read, and why (the UI shows it). */
72520
+ var RemoteRefusedSourceSchema = object({
72521
+ /** Position in the stored list. */
72522
+ index: number().int().nonnegative(),
72523
+ id: string().nullable(),
72524
+ name: string().nullable(),
72525
+ reason: string()
72526
+ });
72257
72527
  var RemoteConfigSchema = object({
72258
72528
  layoutTemplateId: string().min(1).nullable(),
72259
72529
  /**
@@ -72271,7 +72541,13 @@ var RemoteConfigSchema = object({
72271
72541
  sources: array(RemoteSourceSchema).max(200).default([]),
72272
72542
  /** The pause between two steps of a source: the television's receiver, not a repeat. */
72273
72543
  stepDelayMs: number().int().min(100).max(REMOTE_STEP_DELAY_MAX_MS).default(500),
72274
- power: object({ mode: RemotePowerModeSchema })
72544
+ power: object({ mode: RemotePowerModeSchema }),
72545
+ /**
72546
+ * READ-ONLY: sources a stored configuration carries that no longer parse,
72547
+ * left out of `sources` with the reason (`readStoredRemoteConfig`). Never
72548
+ * stored: the store strips it on write.
72549
+ */
72550
+ refusedSources: array(RemoteRefusedSourceSchema).optional()
72275
72551
  }).superRefine((config, ctx) => {
72276
72552
  const roles = Object.keys(config.bindings);
72277
72553
  if (roles.length > 200) ctx.addIssue({
@@ -72312,6 +72588,11 @@ var RemoteConfigSchema = object({
72312
72588
  }
72313
72589
  refineSources(config, ctx);
72314
72590
  });
72591
+ looseObject({ sources: array(unknown()) });
72592
+ object({
72593
+ id: string(),
72594
+ name: string()
72595
+ }).partial();
72315
72596
  object({
72316
72597
  power: object({
72317
72598
  state: _enum(["on", "off"]),
@@ -77405,14 +77686,6 @@ btn("power", 0, 0, {
77405
77686
  3,
77406
77687
  4
77407
77688
  ].map((n) => btn(`app${n}`, 0, n - 1, { role: `custom:app_slot_${n}` })), btn("back", 0, 0, { role: "back" }), btn("home", 0, 1, { role: "home" }), btn("menu", 0, 2, { role: "menu" });
77408
- discriminatedUnion("kind", [object({
77409
- kind: literal("raw"),
77410
- timings: array(number().int()),
77411
- settings: TransmitSettingsSchema.optional()
77412
- }), object({
77413
- kind: literal("pronto"),
77414
- code: string()
77415
- })]);
77416
77689
  /**
77417
77690
  * Propose a running threshold from a device's own power history (planning#405).
77418
77691
  *
@@ -81227,6 +81500,13 @@ Object.freeze({
81227
81500
  access: "view",
81228
81501
  role: "viewer"
81229
81502
  },
81503
+ "heroLayout.getRowModels": {
81504
+ capName: "hero-layout",
81505
+ capScope: "system",
81506
+ addonId: null,
81507
+ access: "view",
81508
+ role: "viewer"
81509
+ },
81230
81510
  "humidifier.getStatus": {
81231
81511
  capName: "humidifier",
81232
81512
  capScope: "device",
@@ -89213,6 +89493,11 @@ Object.freeze({
89213
89493
  form: "single",
89214
89494
  optional: false
89215
89495
  }],
89496
+ "heroLayout.getRowModels": [{
89497
+ name: "deviceIds",
89498
+ form: "array",
89499
+ optional: false
89500
+ }],
89216
89501
  "humidifier.getStatus": [{
89217
89502
  name: "deviceId",
89218
89503
  form: "single",
@@ -95932,12 +96217,13 @@ function amazonInputOf(source) {
95932
96217
  }
95933
96218
  /**
95934
96219
  * The sources that are INPUTS. A player with its own sources offers them all; a
95935
- * remote's declared sources split by kind (a `digits` source is a channel).
96220
+ * remote's declared sources split by kind (a `digits` source is a channel; a
96221
+ * `sequence` and an `ir` source are inputs).
95936
96222
  */
95937
96223
  function inputSources(status) {
95938
96224
  const declared = status.declaredSources;
95939
96225
  if (declared === void 0) return status.availableSources;
95940
- return declared.filter((s) => s.kind === "sequence").map((s) => s.name);
96226
+ return declared.filter((s) => s.kind !== "digits").map((s) => s.name);
95941
96227
  }
95942
96228
  /** The inputs of a slice that Amazon has a name for, paired with the player's own name. */
95943
96229
  function inputPairs(status) {
@@ -808,7 +808,7 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
808
808
  return EventCategory;
809
809
  }({});
810
810
  //#endregion
811
- //#region ../types/dist/device-type-DxCT0krO.mjs
811
+ //#region ../types/dist/device-type-CbDhVwFP.mjs
812
812
  /**
813
813
  import { errMsg } from '@camstack/types'
814
814
  * Extract a human-readable message from an unknown error value.
@@ -977,6 +977,13 @@ var DeviceFeature = /* @__PURE__ */ function(DeviceFeature) {
977
977
  * (`featuresOfBoundCaps`). Gates the quick-run control in the viewer.
978
978
  */
979
979
  DeviceFeature["TimedRun"] = "timed-run";
980
+ /**
981
+ * Device binds a plain `switch` cap. Derived from the bindings
982
+ * (`featuresOfBoundCaps`) for a composed device, whose switch is bound by the
983
+ * composition and not by a driver: an appliance (a heater behind a smart
984
+ * plug) has no control of its own, so a surface reads this as its on/off.
985
+ */
986
+ DeviceFeature["Switch"] = "switch";
980
987
  /** Light supports rgb-triplet color via `color` cap. */
981
988
  DeviceFeature["LightColorRgb"] = "light-color-rgb";
982
989
  /** Light supports HSV color via `color` cap. */
@@ -6011,7 +6018,7 @@ var ZodIssueCode = {
6011
6018
  var ZodFirstPartyTypeKind;
6012
6019
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
6013
6020
  //#endregion
6014
- //#region ../types/dist/sleep-t7BftoJG.mjs
6021
+ //#region ../types/dist/sleep-CqvzKIq2.mjs
6015
6022
  /**
6016
6023
  * The audio chunk plane's byte format, and the ONE expansion from a coded
6017
6024
  * window to float samples (D455).
@@ -17164,7 +17171,7 @@ object({
17164
17171
  params: record(string(), union([string(), number()])).optional()
17165
17172
  });
17166
17173
  //#endregion
17167
- //#region ../types/dist/composition-Bx0JvKUU.mjs
17174
+ //#region ../types/dist/composition-CXCX78IR.mjs
17168
17175
  /**
17169
17176
  * The ffmpeg build every CamStack node downloads, per platform and arch.
17170
17177
  *
@@ -49127,6 +49134,90 @@ DeviceType.Control, method(object({
49127
49134
  kind: "mutation",
49128
49135
  auth: "protected"
49129
49136
  });
49137
+ var IrCodecError = class extends Error {
49138
+ code;
49139
+ constructor(code, message) {
49140
+ super(message);
49141
+ this.name = "IrCodecError";
49142
+ this.code = code;
49143
+ }
49144
+ };
49145
+ /**
49146
+ * A pulse train in signed microseconds: mark (+) first, then space (-), strictly
49147
+ * alternating, no zeros, 2..1024 entries.
49148
+ */
49149
+ var IrTimingsSchema = array(number().int()).min(2).max(1024).superRefine((timings, ctx) => {
49150
+ timings.forEach((value, index) => {
49151
+ const expectMark = index % 2 === 0;
49152
+ if (value === 0 || value > 0 !== expectMark) ctx.addIssue({
49153
+ code: "custom",
49154
+ message: `timing ${index} must be a non-zero ${expectMark ? "mark (positive)" : "space (negative)"}`,
49155
+ path: [index]
49156
+ });
49157
+ });
49158
+ });
49159
+ /** Per-command transmit options. Every key is optional; a transmitter applies what it can. */
49160
+ var TransmitSettingsSchema = object({
49161
+ carrierHz: number().int().positive().optional(),
49162
+ dutyCyclePercent: number().int().min(1).max(100).optional(),
49163
+ repeat: number().int().min(0).max(20).optional(),
49164
+ repeatDelayMs: number().int().min(0).optional()
49165
+ });
49166
+ /** One Pronto frequency-word unit, in microseconds, per unit of the word. */
49167
+ var PRONTO_CLOCK_US = .241246;
49168
+ var LEARNED_FORM = 0;
49169
+ /**
49170
+ * Decode a learned (0000 form) Pronto hex string. The intro burst is followed by
49171
+ * the repeat burst once; a different form is refused with `pronto-unsupported-form`.
49172
+ */
49173
+ function decodePronto(code) {
49174
+ const words = code.trim().split(/\s+/).filter((w) => w.length > 0);
49175
+ if (words.length < 4) throw new IrCodecError("pronto-malformed", `Pronto code needs at least 4 words, got ${words.length}`);
49176
+ const values = words.map((w) => /^[0-9a-fA-F]{1,4}$/.test(w) ? parseInt(w, 16) : NaN);
49177
+ if (values.some((v) => Number.isNaN(v))) throw new IrCodecError("pronto-malformed", "Pronto code must be 4-digit hexadecimal words");
49178
+ const [form, freqWord, introCount, repeatCount] = values;
49179
+ if (form === void 0 || freqWord === void 0 || introCount === void 0 || repeatCount === void 0) throw new IrCodecError("pronto-malformed", "Pronto header incomplete");
49180
+ if (form !== LEARNED_FORM) throw new IrCodecError("pronto-unsupported-form", `Pronto form ${words[0] ?? ""} is not supported, only the learned 0000 form`);
49181
+ if (freqWord === 0) throw new IrCodecError("pronto-malformed", "Pronto frequency word is zero");
49182
+ const pairs = introCount + repeatCount;
49183
+ if (pairs === 0 || values.length !== 4 + pairs * 2) throw new IrCodecError("pronto-malformed", `Pronto declares ${pairs} burst pairs but carries ${(values.length - 4) / 2} word pairs`);
49184
+ const unitUs = freqWord * PRONTO_CLOCK_US;
49185
+ const timings = values.slice(4).map((count, index) => {
49186
+ const us = Math.max(1, Math.round(count * unitUs));
49187
+ return index % 2 === 0 ? us : -us;
49188
+ });
49189
+ const checked = IrTimingsSchema.safeParse(timings);
49190
+ if (!checked.success) throw new IrCodecError("invalid-timings", `Pronto decoded to invalid timings: ${checked.error.message}`);
49191
+ return {
49192
+ timings: checked.data,
49193
+ carrierHz: Math.round(1e6 / unitUs)
49194
+ };
49195
+ }
49196
+ /** What a remote command stores: a raw pulse train, or a learned Pronto code. */
49197
+ var IrPayloadSchema = discriminatedUnion("kind", [object({
49198
+ kind: literal("raw"),
49199
+ timings: array(number().int()),
49200
+ settings: TransmitSettingsSchema.optional()
49201
+ }), object({
49202
+ kind: literal("pronto"),
49203
+ code: string()
49204
+ })]);
49205
+ /** Resolve a payload to what `ir-transmitter.send` takes. Throws `IrCodecError`. */
49206
+ function toTimings(payload) {
49207
+ if (payload.kind === "pronto") {
49208
+ const decoded = decodePronto(payload.code);
49209
+ return {
49210
+ timings: decoded.timings,
49211
+ settings: { carrierHz: decoded.carrierHz }
49212
+ };
49213
+ }
49214
+ const checked = IrTimingsSchema.safeParse(payload.timings);
49215
+ if (!checked.success) throw new IrCodecError("invalid-timings", checked.error.message);
49216
+ return {
49217
+ timings: checked.data,
49218
+ settings: payload.settings ?? {}
49219
+ };
49220
+ }
49130
49221
  /**
49131
49222
  * The role vocabulary of a remote (D963): what a button MEANS, independent of
49132
49223
  * how it is wired. A layout template places buttons by role; a device binds a
@@ -49214,11 +49305,18 @@ var RemoteRoleSchema = string().refine(isRemoteRole, { message: "a role is one o
49214
49305
  * a voice command or `playMedia` names.
49215
49306
  * - `sequence`: a name and explicit steps — bound roles pressed in order
49216
49307
  * (an input key, a menu macro such as `source, down, down, ok`).
49308
+ * - `ir`: a name and one infrared code of its own (raw timings or a Pronto
49309
+ * string), sent through a named transmitter (planning#464). It presses no
49310
+ * button: a source the remote's layout has no key for.
49217
49311
  *
49218
49312
  * The name and the number resolve to the SAME declared source. A number no
49219
49313
  * `digits` source declares is not a channel: it is refused, never guessed.
49220
49314
  */
49221
- var REMOTE_SOURCE_KINDS = ["digits", "sequence"];
49315
+ var REMOTE_SOURCE_KINDS = [
49316
+ "digits",
49317
+ "sequence",
49318
+ "ir"
49319
+ ];
49222
49320
  _enum(REMOTE_SOURCE_KINDS);
49223
49321
  var REMOTE_SOURCE_ID_RE = /^[a-z0-9][a-z0-9_-]{0,47}$/;
49224
49322
  var CHANNEL_NUMBER_RE = new RegExp(`^[0-9]{1,6}$`);
@@ -49228,19 +49326,50 @@ var sourceBase = {
49228
49326
  /** What the operator calls it, and what a voice command or a picker names. */
49229
49327
  name: string().trim().min(1).max(60)
49230
49328
  };
49231
- var RemoteSourceSchema = discriminatedUnion("kind", [object({
49232
- ...sourceBase,
49233
- kind: literal("digits"),
49234
- number: string().regex(CHANNEL_NUMBER_RE, { message: "up to 6 digits" })
49235
- }), object({
49236
- ...sourceBase,
49237
- kind: literal("sequence"),
49238
- steps: array(RemoteRoleSchema).min(1).max(16)
49239
- })]);
49329
+ var RemoteSourceSchema = discriminatedUnion("kind", [
49330
+ object({
49331
+ ...sourceBase,
49332
+ kind: literal("digits"),
49333
+ number: string().regex(CHANNEL_NUMBER_RE, { message: "up to 6 digits" })
49334
+ }),
49335
+ object({
49336
+ ...sourceBase,
49337
+ kind: literal("sequence"),
49338
+ steps: array(RemoteRoleSchema).min(1).max(16)
49339
+ }),
49340
+ object({
49341
+ ...sourceBase,
49342
+ kind: literal("ir"),
49343
+ /** The `ir-transmitter` device the code is sent through. */
49344
+ transmitterId: number().int().nonnegative(),
49345
+ /** The code itself; whether a transmitter could send it is `irSourceProblem`. */
49346
+ payload: IrPayloadSchema
49347
+ })
49348
+ ]);
49240
49349
  var REMOTE_STEP_DELAY_MAX_MS = 3e3;
49241
- /** The roles a source presses, in order. A `digits` number is its digit roles. */
49350
+ /**
49351
+ * The roles a source presses, in order. A `digits` number is its digit roles;
49352
+ * an `ir` source presses none — it carries its own code.
49353
+ */
49242
49354
  function remoteSourceSteps(source) {
49243
- return source.kind === "sequence" ? source.steps : Array.from(source.number, (digit) => `digit_${digit}`);
49355
+ switch (source.kind) {
49356
+ case "sequence": return source.steps;
49357
+ case "digits": return Array.from(source.number, (digit) => `digit_${digit}`);
49358
+ case "ir": return [];
49359
+ }
49360
+ }
49361
+ /**
49362
+ * Why an `ir` source's code could not be sent (the codec's own words), or null
49363
+ * when it resolves to a pulse train. The schema refuses on it; the editor shows it.
49364
+ */
49365
+ function irSourceProblem(source) {
49366
+ try {
49367
+ toTimings(source.payload);
49368
+ return null;
49369
+ } catch (err) {
49370
+ if (err instanceof IrCodecError) return err.message;
49371
+ throw err;
49372
+ }
49244
49373
  }
49245
49374
  /**
49246
49375
  * Media-player cap. Models HA `media_player.*` (Sonos, Chromecast,
@@ -54806,8 +54935,9 @@ DeviceType.Thermostat;
54806
54935
  *
54807
54936
  * "Heat for 30 minutes", "run the fountain pump for 2 minutes": the device has
54808
54937
  * no timer of its own, so the hub keeps one. `runFor` turns the device on and
54809
- * records a deadline; `cancel` (or the device being switched off by hand)
54810
- * forgets it; at the deadline the hub issues the off once.
54938
+ * records a deadline; `cancel` switches the device off and forgets the deadline,
54939
+ * and the device being switched off by hand just forgets it; at the deadline
54940
+ * the hub issues the off once.
54811
54941
  *
54812
54942
  * The deadline is DURABLE: it is a row in the records store, so a hub restart
54813
54943
  * neither loses a pending off nor leaves the device running past its time. At
@@ -54944,6 +55074,56 @@ var StateLookSchema = object({
54944
55074
  background: _enum(HERO_BACKGROUNDS),
54945
55075
  animation: HeroAnimationSchema
54946
55076
  });
55077
+ /** The scene as the model carries it. `null` = the device did not say (never a guess). */
55078
+ var HeroSceneSchema = object({
55079
+ id: _enum([
55080
+ "ac",
55081
+ "thermostat",
55082
+ "heater",
55083
+ "fan",
55084
+ "washer",
55085
+ "dryer",
55086
+ "dishwasher",
55087
+ "pet-fountain",
55088
+ "pet-feeder",
55089
+ "vacuum",
55090
+ "lawn-mower",
55091
+ "tv",
55092
+ "speaker",
55093
+ "camera",
55094
+ "light",
55095
+ "cover",
55096
+ "lock",
55097
+ "alarm",
55098
+ "siren",
55099
+ "sensor-sparkline",
55100
+ "contact",
55101
+ "presence",
55102
+ "weather",
55103
+ "plug",
55104
+ "button",
55105
+ "update",
55106
+ "control-dial",
55107
+ "event-stream",
55108
+ "gateway",
55109
+ "generic"
55110
+ ]),
55111
+ mode: _enum([
55112
+ "cool",
55113
+ "heat",
55114
+ "dry",
55115
+ "fan",
55116
+ "auto",
55117
+ "playing",
55118
+ "paused",
55119
+ "open",
55120
+ "closed"
55121
+ ]).nullable(),
55122
+ /** 0..1: volume, cover position, cycle progress. */
55123
+ level: number().min(0).max(1).nullable()
55124
+ });
55125
+ 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;
55126
+ DeviceRole.Siren, DeviceRole.Floodlight, DeviceRole.Spotlight, DeviceRole.PirSensor, DeviceRole.Chime, DeviceRole.Autotrack, DeviceRole.Nightvision, DeviceRole.PrivacyMask, DeviceRole.Doorbell, DeviceRole.CoverBlind, DeviceRole.CoverShutter, DeviceRole.CoverAwning, DeviceRole.CoverCurtain, DeviceRole.CoverGarage, DeviceRole.CoverGate, DeviceRole.CoverDoor, DeviceRole.CoverWindow, DeviceRole.BinaryHelper, DeviceRole.Outlet, DeviceRole.MotionSensor, DeviceRole.ContactSensor, DeviceRole.LeakSensor, DeviceRole.SmokeSensor, DeviceRole.COSensor, DeviceRole.GasSensor, DeviceRole.TamperSensor, DeviceRole.VibrationSensor, DeviceRole.ConnectivitySensor, DeviceRole.SoundSensor, DeviceRole.BinarySensor, DeviceRole.TemperatureSensor, DeviceRole.HumiditySensor, DeviceRole.AmbientLightSensor, DeviceRole.PressureSensor, DeviceRole.WindSensor, DeviceRole.RainSensor, DeviceRole.UvSensor, DeviceRole.SolarRadiationSensor, DeviceRole.SoilMoistureSensor, DeviceRole.PowerSensor, DeviceRole.EnergySensor, DeviceRole.VoltageSensor, DeviceRole.CurrentSensor, DeviceRole.AirQualitySensor, DeviceRole.BatterySensor, DeviceRole.NumericSensor, DeviceRole.EnumSensor, DeviceRole.DateTimeSensor, DeviceRole.GenericSensor, DeviceRole.NumericControl, DeviceRole.SelectControl, DeviceRole.TextControl, DeviceRole.DateTimeControl, DeviceRole.MobilePushNotifier, DeviceRole.MessagingNotifier, DeviceRole.EmailNotifier, DeviceRole.GenericNotifier, DeviceRole.IrTransmitter;
54947
55127
  /** A string in both languages, as the cap vocabulary writes it (D920): no `t()` in the model. */
54948
55128
  var HeroTextSchema = object({
54949
55129
  en: string(),
@@ -55095,6 +55275,32 @@ var HeroStateBackdropSchema = object({
55095
55275
  token: _enum(HERO_BACKGROUNDS),
55096
55276
  animation: _enum(HERO_ANIMATIONS)
55097
55277
  });
55278
+ var HeroFactSchema = object({
55279
+ id: _enum([
55280
+ "power",
55281
+ "energy",
55282
+ "battery",
55283
+ "link",
55284
+ "phase",
55285
+ "remaining",
55286
+ "volume",
55287
+ "source",
55288
+ "consumables"
55289
+ ]),
55290
+ icon: IconKeySchema.nullable(),
55291
+ text: HeroTextSchema,
55292
+ tone: HeroToneSchema
55293
+ });
55294
+ /** A labelled value beside the scene. */
55295
+ var HeroSideTileSchema = object({
55296
+ label: HeroTextSchema,
55297
+ value: HeroTextSchema,
55298
+ tone: HeroToneSchema.optional()
55299
+ });
55300
+ var HeroSideTilesSchema = object({
55301
+ left: array(HeroSideTileSchema).max(2),
55302
+ right: array(HeroSideTileSchema).max(2)
55303
+ });
55098
55304
  var HeroBackgroundSchema = discriminatedUnion("kind", [object({
55099
55305
  kind: literal("artwork"),
55100
55306
  url: string(),
@@ -55118,6 +55324,11 @@ var HeroModelSchema = object({
55118
55324
  stateAssumed: boolean(),
55119
55325
  look: StateLookSchema,
55120
55326
  background: HeroBackgroundSchema,
55327
+ /** Which animated picture the hero (and the list row) draws; its motion is `look.animation`. */
55328
+ scene: HeroSceneSchema,
55329
+ /** The top line's inline facts, in order; never wraps, so a client may cut the tail. */
55330
+ facts: array(HeroFactSchema),
55331
+ sideTiles: HeroSideTilesSchema,
55121
55332
  /** The status line under the main icon. */
55122
55333
  title: HeroTextSchema,
55123
55334
  badges: array(HeroBadgeSchema),
@@ -55133,6 +55344,42 @@ var HeroModelSchema = object({
55133
55344
  provenance: array(HeroProvenanceSchema)
55134
55345
  });
55135
55346
  /**
55347
+ * The ROW of a device in a list (D1023 P2): four fixed zones, all taken from
55348
+ * the hero model and nothing else.
55349
+ *
55350
+ * 1. mini-scene the same scene id as the hero, drawn 44x44 with the state look;
55351
+ * 2. name + ONE status line the facts joined by " · " by the client;
55352
+ * 3. the type's primary inline control;
55353
+ * 4. a trailing fact (power, else battery, else consumables).
55354
+ *
55355
+ * Selection rules, all taken from the model:
55356
+ * - ONE control is ever shown: the device's own power; else the FIRST control of
55357
+ * the FIRST row that has any (a later row's control is never promoted). When
55358
+ * the model lists that part in `gated`, the row has no inline control: the
55359
+ * projection never falls through to another control the caller could use.
55360
+ * - the status line is the head (what plays, else the state) plus at most
55361
+ * {@link ROW_STATUS_FACTS_MAX} facts, the trailing fact excluded;
55362
+ * - the trailing fact is the first of power, battery, consumables.
55363
+ *
55364
+ * `projectDeviceRow` is pure and computes nothing: it selects from a
55365
+ * {@link HeroModel}. A row that needed a value the hero lacks would mean the
55366
+ * model is missing it, so the fix goes in the model.
55367
+ */
55368
+ var HeroRowModelSchema = object({
55369
+ deviceId: number().int(),
55370
+ name: string(),
55371
+ type: string(),
55372
+ state: HeroStateSchema,
55373
+ stateAssumed: boolean(),
55374
+ look: StateLookSchema,
55375
+ scene: HeroSceneSchema,
55376
+ /** Joined by " · ": the state (or what is playing), then the facts. */
55377
+ statusLine: array(HeroTextSchema),
55378
+ /** `null` = the type has no inline control, or the caller may not act on it. */
55379
+ primary: HeroControlSchema.nullable(),
55380
+ trailing: HeroFactSchema.nullable()
55381
+ });
55382
+ /**
55136
55383
  * hero-layout — what a device's hero says (D1023). Read-only: the FIXED
55137
55384
  * layouts live in `@camstack/types` and nothing here stores or edits one.
55138
55385
  * `getHeroModel` builds the pure model from the device's bindings and its
@@ -55148,6 +55395,11 @@ var heroInput = object({
55148
55395
  */
55149
55396
  canActuate: boolean().optional()
55150
55397
  });
55398
+ var rowModelsInput = object({
55399
+ deviceIds: array(number().int().nonnegative()).max(500),
55400
+ /** As `canActuate` of `getHeroModel`; absent = may. */
55401
+ canActuate: boolean().optional()
55402
+ });
55151
55403
  var HeroLayoutRowsSchema = object({
55152
55404
  type: string(),
55153
55405
  rows: array(HeroRowIdSchema)
@@ -55155,6 +55407,9 @@ var HeroLayoutRowsSchema = object({
55155
55407
  method(heroInput, HeroModelSchema.nullable(), {
55156
55408
  auth: "protected",
55157
55409
  role: "viewer"
55410
+ }), method(rowModelsInput, array(HeroRowModelSchema.nullable()), {
55411
+ auth: "protected",
55412
+ role: "viewer"
55158
55413
  }), method(object({ deviceType: string() }), HeroLayoutRowsSchema, {
55159
55414
  auth: "protected",
55160
55415
  role: "viewer"
@@ -55693,20 +55948,40 @@ var integrationInstancesCapability = {
55693
55948
  instanceFormSchema: method(object({
55694
55949
  id: IntegrationInstanceIdSchema.nullable(),
55695
55950
  /** The kind of the create form (`id: null`) of a provider with several. */
55696
- kind: string().min(1).optional()
55951
+ kind: string().min(1).optional(),
55952
+ /** The wizard mode of the integration type (`getAvailableTypes`); a form may differ per mode. */
55953
+ mode: _enum([
55954
+ "standalone",
55955
+ "account",
55956
+ "broker"
55957
+ ]).optional(),
55958
+ /** The discovery candidate the wizard was seeded from (`stableId`), if any. */
55959
+ candidateStableId: string().min(1).optional()
55697
55960
  }), ConfigSchemaPassthrough$2, { auth: "admin" }),
55698
55961
  listInstances: method(_void(), array(IntegrationInstanceSchema).readonly(), { auth: "admin" }),
55699
55962
  getInstance: method(object({ id: IntegrationInstanceIdSchema }), IntegrationInstanceSchema.nullable(), { auth: "admin" }),
55700
55963
  /**
55701
55964
  * Insert the typed record. With `id` it is stored under that id (a duplicate id is refused);
55702
55965
  * without one the PROVIDER mints it and answers it. `kind` picks one of `describe().kinds`.
55966
+ *
55967
+ * An instance of a kind that brings devices (`role: 'devices'`) is an integration: the HUB mints
55968
+ * the id (the `integrations` registry id, which its devices carry), refuses the create when
55969
+ * `testInstance` rejects the values (D1016; a kind with no test passes and says so), writes the
55970
+ * registry row and the record, and removes both when either step fails. An `id` is accepted
55971
+ * only when it names an existing registry row of the addon.
55703
55972
  */
55704
55973
  createInstance: method(object({
55705
55974
  id: IntegrationInstanceIdSchema.optional(),
55706
55975
  name: string().min(1),
55707
55976
  kind: string().min(1).optional(),
55708
55977
  /** Form values written with the record (a link picked in the create dialog). */
55709
- values: record(string(), unknown()).optional()
55978
+ values: record(string(), unknown()).optional(),
55979
+ /**
55980
+ * The discovery candidate (`stableId`) the instance is set up from. Kept on the integration
55981
+ * registry row of an instance that brings devices, so discovery stops offering a candidate
55982
+ * that already has its integration (D984). Ignored by an instance with no registry row.
55983
+ */
55984
+ originStableId: string().min(1).optional()
55710
55985
  }), object({ id: string() }), {
55711
55986
  kind: "mutation",
55712
55987
  auth: "admin"
@@ -55727,7 +56002,11 @@ var integrationInstancesCapability = {
55727
56002
  kind: "mutation",
55728
56003
  auth: "admin"
55729
56004
  }),
55730
- /** Delete the record and its keychain refs together. */
56005
+ /**
56006
+ * Delete the record and its keychain refs together. For an instance that brings devices the hub
56007
+ * also removes the integration's devices (their tombstones, D865), the registry row, and emits
56008
+ * `IntegrationDeleted`; a fixed builtin and an instance a link names are refused first.
56009
+ */
55731
56010
  deleteInstance: method(object({ id: IntegrationInstanceIdSchema }), object({ ok: literal(true) }), {
55732
56011
  kind: "mutation",
55733
56012
  auth: "admin"
@@ -55845,27 +56124,6 @@ DeviceType.Camera, method(object({ deviceId: number() }), object({
55845
56124
  deviceId: number(),
55846
56125
  status: IntercomStatusSchema
55847
56126
  });
55848
- /**
55849
- * A pulse train in signed microseconds: mark (+) first, then space (-), strictly
55850
- * alternating, no zeros, 2..1024 entries.
55851
- */
55852
- var IrTimingsSchema = array(number().int()).min(2).max(1024).superRefine((timings, ctx) => {
55853
- timings.forEach((value, index) => {
55854
- const expectMark = index % 2 === 0;
55855
- if (value === 0 || value > 0 !== expectMark) ctx.addIssue({
55856
- code: "custom",
55857
- message: `timing ${index} must be a non-zero ${expectMark ? "mark (positive)" : "space (negative)"}`,
55858
- path: [index]
55859
- });
55860
- });
55861
- });
55862
- /** Per-command transmit options. Every key is optional; a transmitter applies what it can. */
55863
- var TransmitSettingsSchema = object({
55864
- carrierHz: number().int().positive().optional(),
55865
- dutyCyclePercent: number().int().min(1).max(100).optional(),
55866
- repeat: number().int().min(0).max(20).optional(),
55867
- repeatDelayMs: number().int().min(0).optional()
55868
- });
55869
56127
  /** The setting keys a transmitter may declare as settable (`getInfo.settable`). */
55870
56128
  var TransmitSettingKeySchema = _enum([
55871
56129
  "carrierHz",
@@ -72204,6 +72462,10 @@ function refineSources(config, ctx) {
72204
72462
  if (numbers.has(source.number)) fail(`channel ${source.number} is declared twice`, "number");
72205
72463
  numbers.add(source.number);
72206
72464
  }
72465
+ if (source.kind === "ir") {
72466
+ const problem = irSourceProblem(source);
72467
+ if (problem !== null) fail(problem, "payload");
72468
+ }
72207
72469
  for (const role of remoteSourceSteps(source)) if (isRemoteWidgetRole(role)) fail(`"${source.name}" presses ${role}, a layout widget, not a command`, "steps");
72208
72470
  else if (config.bindings[role] === void 0) fail(`"${source.name}" presses ${role}, which is not bound`, "steps");
72209
72471
  });
@@ -72225,6 +72487,14 @@ function refineSources(config, ctx) {
72225
72487
  }
72226
72488
  });
72227
72489
  }
72490
+ /** A stored source that was left out of a read, and why (the UI shows it). */
72491
+ var RemoteRefusedSourceSchema = object({
72492
+ /** Position in the stored list. */
72493
+ index: number().int().nonnegative(),
72494
+ id: string().nullable(),
72495
+ name: string().nullable(),
72496
+ reason: string()
72497
+ });
72228
72498
  var RemoteConfigSchema = object({
72229
72499
  layoutTemplateId: string().min(1).nullable(),
72230
72500
  /**
@@ -72242,7 +72512,13 @@ var RemoteConfigSchema = object({
72242
72512
  sources: array(RemoteSourceSchema).max(200).default([]),
72243
72513
  /** The pause between two steps of a source: the television's receiver, not a repeat. */
72244
72514
  stepDelayMs: number().int().min(100).max(REMOTE_STEP_DELAY_MAX_MS).default(500),
72245
- power: object({ mode: RemotePowerModeSchema })
72515
+ power: object({ mode: RemotePowerModeSchema }),
72516
+ /**
72517
+ * READ-ONLY: sources a stored configuration carries that no longer parse,
72518
+ * left out of `sources` with the reason (`readStoredRemoteConfig`). Never
72519
+ * stored: the store strips it on write.
72520
+ */
72521
+ refusedSources: array(RemoteRefusedSourceSchema).optional()
72246
72522
  }).superRefine((config, ctx) => {
72247
72523
  const roles = Object.keys(config.bindings);
72248
72524
  if (roles.length > 200) ctx.addIssue({
@@ -72283,6 +72559,11 @@ var RemoteConfigSchema = object({
72283
72559
  }
72284
72560
  refineSources(config, ctx);
72285
72561
  });
72562
+ looseObject({ sources: array(unknown()) });
72563
+ object({
72564
+ id: string(),
72565
+ name: string()
72566
+ }).partial();
72286
72567
  object({
72287
72568
  power: object({
72288
72569
  state: _enum(["on", "off"]),
@@ -77376,14 +77657,6 @@ btn("power", 0, 0, {
77376
77657
  3,
77377
77658
  4
77378
77659
  ].map((n) => btn(`app${n}`, 0, n - 1, { role: `custom:app_slot_${n}` })), btn("back", 0, 0, { role: "back" }), btn("home", 0, 1, { role: "home" }), btn("menu", 0, 2, { role: "menu" });
77379
- discriminatedUnion("kind", [object({
77380
- kind: literal("raw"),
77381
- timings: array(number().int()),
77382
- settings: TransmitSettingsSchema.optional()
77383
- }), object({
77384
- kind: literal("pronto"),
77385
- code: string()
77386
- })]);
77387
77660
  /**
77388
77661
  * Propose a running threshold from a device's own power history (planning#405).
77389
77662
  *
@@ -81198,6 +81471,13 @@ Object.freeze({
81198
81471
  access: "view",
81199
81472
  role: "viewer"
81200
81473
  },
81474
+ "heroLayout.getRowModels": {
81475
+ capName: "hero-layout",
81476
+ capScope: "system",
81477
+ addonId: null,
81478
+ access: "view",
81479
+ role: "viewer"
81480
+ },
81201
81481
  "humidifier.getStatus": {
81202
81482
  capName: "humidifier",
81203
81483
  capScope: "device",
@@ -89184,6 +89464,11 @@ Object.freeze({
89184
89464
  form: "single",
89185
89465
  optional: false
89186
89466
  }],
89467
+ "heroLayout.getRowModels": [{
89468
+ name: "deviceIds",
89469
+ form: "array",
89470
+ optional: false
89471
+ }],
89187
89472
  "humidifier.getStatus": [{
89188
89473
  name: "deviceId",
89189
89474
  form: "single",
@@ -95903,12 +96188,13 @@ function amazonInputOf(source) {
95903
96188
  }
95904
96189
  /**
95905
96190
  * The sources that are INPUTS. A player with its own sources offers them all; a
95906
- * remote's declared sources split by kind (a `digits` source is a channel).
96191
+ * remote's declared sources split by kind (a `digits` source is a channel; a
96192
+ * `sequence` and an `ir` source are inputs).
95907
96193
  */
95908
96194
  function inputSources(status) {
95909
96195
  const declared = status.declaredSources;
95910
96196
  if (declared === void 0) return status.availableSources;
95911
- return declared.filter((s) => s.kind === "sequence").map((s) => s.name);
96197
+ return declared.filter((s) => s.kind !== "digits").map((s) => s.name);
95912
96198
  }
95913
96199
  /** The inputs of a slice that Amazon has a name for, paired with the player's own name. */
95914
96200
  function inputPairs(status) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-export-alexa",
3
- "version": "1.2.191",
3
+ "version": "1.2.192",
4
4
  "description": "Alexa Smart Home Skill export — hub-side OAuth provider + directive handler. The companion AWS Lambda forwards Alexa directives to this addon's /addon/export-alexa/directive endpoint.",
5
5
  "keywords": [
6
6
  "camstack",
@@ -59,7 +59,7 @@
59
59
  }
60
60
  ],
61
61
  "requires": {
62
- "server": ">=1.2.811"
62
+ "server": ">=1.2.814"
63
63
  }
64
64
  },
65
65
  "files": [