@camstack/addon-post-analysis 1.2.665 → 1.2.667

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (16) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/dist/{clip-model-registry-nn_STiGt.js → clip-model-registry-D7cqhFK3.js} +758 -486
  3. package/dist/{clip-model-registry-DZTzG2p4.mjs → clip-model-registry-DpzRS8q3.mjs} +758 -486
  4. package/dist/embedding-encoder/index.js +1 -1
  5. package/dist/embedding-encoder/index.mjs +1 -1
  6. package/dist/pipeline-analytics/_stub.js +2 -2
  7. package/dist/pipeline-analytics/{_virtual_mf-localSharedImportMap___mfe_internal__addon_pipeline_analytics_widgets-Hy74pMMo.mjs → _virtual_mf-localSharedImportMap___mfe_internal__addon_pipeline_analytics_widgets-DmTIEp0m.mjs} +2 -2
  8. package/dist/pipeline-analytics/_virtual_mf___mfe_internal__addon_pipeline_analytics_widgets__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-DAAkZRnK.mjs +26 -0
  9. package/dist/pipeline-analytics/_virtual_mf___mfe_internal__addon_pipeline_analytics_widgets__loadShare___mf_0_camstack_mf_1_ui_mf_2_library__loadShare__.js-znrgUrN1.mjs +26 -0
  10. package/dist/pipeline-analytics/{hostInit-BAYLsfoZ.mjs → hostInit-ODebWXu_.mjs} +2 -2
  11. package/dist/pipeline-analytics/index.js +563 -122
  12. package/dist/pipeline-analytics/index.mjs +563 -122
  13. package/dist/pipeline-analytics/remoteEntry.js +1 -1
  14. package/package.json +2 -2
  15. package/dist/pipeline-analytics/_virtual_mf___mfe_internal__addon_pipeline_analytics_widgets__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-BXTAZYaJ.mjs +0 -26
  16. package/dist/pipeline-analytics/_virtual_mf___mfe_internal__addon_pipeline_analytics_widgets__loadShare___mf_0_camstack_mf_1_ui_mf_2_library__loadShare__.js-Br6eWzp_.mjs +0 -26
@@ -785,7 +785,7 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
785
785
  return EventCategory;
786
786
  }({});
787
787
  //#endregion
788
- //#region ../types/dist/device-type-CfHw_quR.mjs
788
+ //#region ../types/dist/device-type-D1fH5kaC.mjs
789
789
  /**
790
790
  import { errMsg } from '@camstack/types'
791
791
  * Extract a human-readable message from an unknown error value.
@@ -1016,6 +1016,12 @@ var DeviceFeature = /* @__PURE__ */ function(DeviceFeature) {
1016
1016
  DeviceFeature["MediaPlayerPrevious"] = "media-player-previous";
1017
1017
  /** Media player exposes stop distinct from pause. */
1018
1018
  DeviceFeature["MediaPlayerStop"] = "media-player-stop";
1019
+ /** Media player exposes volume up / down in steps (an infrared TV has no level). */
1020
+ DeviceFeature["MediaPlayerVolumeStep"] = "media-player-volume-step";
1021
+ /** Media player exposes channel up / down in steps. */
1022
+ DeviceFeature["MediaPlayerChannelStep"] = "media-player-channel-step";
1023
+ /** Media player exposes power on / off. */
1024
+ DeviceFeature["MediaPlayerPower"] = "media-player-power";
1019
1025
  /** Alarm panel requires a PIN code on arm/disarm. */
1020
1026
  DeviceFeature["AlarmPinRequired"] = "alarm-pin-required";
1021
1027
  /** Presence device carries GPS coordinates (lat/lng/accuracy) in
@@ -6032,7 +6038,7 @@ var ZodIssueCode = {
6032
6038
  var ZodFirstPartyTypeKind;
6033
6039
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
6034
6040
  //#endregion
6035
- //#region ../types/dist/sleep-hmSP-eJt.mjs
6041
+ //#region ../types/dist/sleep-hK-Dss3z.mjs
6036
6042
  /**
6037
6043
  * The audio chunk plane's byte format, and the ONE expansion from a coded
6038
6044
  * window to float samples (D455).
@@ -6111,6 +6117,22 @@ function buildAlawTable() {
6111
6117
  }
6112
6118
  buildUlawTable();
6113
6119
  buildAlawTable();
6120
+ /**
6121
+ * An addon whose own migrations did not apply refuses to initialise (D987). The error is typed
6122
+ * so a runner hosting several addons can tell "this addon is blocked" from a crash and keep its
6123
+ * co-located siblings running. Recognised by NAME and shape, never `instanceof`: a forked addon
6124
+ * bundles its own copy of this module, so the class the runner sees is not the one that threw.
6125
+ */
6126
+ var MIGRATIONS_BLOCKED_ERROR_NAME = "AddonMigrationsBlockedError";
6127
+ var AddonMigrationsBlockedError = class extends Error {
6128
+ /** The ledger ids that did not apply and block the owner. */
6129
+ migrationIds;
6130
+ constructor(migrationIds) {
6131
+ super(`migration(s) ${migrationIds.join(", ")} did not apply and block this addon — fix or retry them (migrations.retry), then restart it`);
6132
+ this.name = MIGRATIONS_BLOCKED_ERROR_NAME;
6133
+ this.migrationIds = migrationIds;
6134
+ }
6135
+ };
6114
6136
  /** Is this field's stored value a credential? */
6115
6137
  function isSecretConfigField(field) {
6116
6138
  if (field.type === "password") return true;
@@ -7764,7 +7786,7 @@ var BaseAddon = class {
7764
7786
  startMigration: (input) => api.startMigration.mutate(input),
7765
7787
  finishMigration: (input) => api.finishMigration.mutate(input)
7766
7788
  }, migrations, this.ctx.logger);
7767
- 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`);
7789
+ if (report.blockOwner.length > 0) throw new AddonMigrationsBlockedError(report.blockOwner);
7768
7790
  return report;
7769
7791
  }
7770
7792
  /**
@@ -8104,6 +8126,10 @@ var BaseAddon = class {
8104
8126
  const stored = keychain ? await this.readAddonStoreWithRetry() : {};
8105
8127
  const patch = {};
8106
8128
  for (const key of keys) {
8129
+ if (tree.get(key)?.kind === "array") {
8130
+ patch[key] = [];
8131
+ continue;
8132
+ }
8107
8133
  const keychainStored = tree.has(key) || collectSecretMarkerRefs(stored[key]).length > 0;
8108
8134
  patch[key] = keychain && keychainStored ? SECRET_CLEAR : "";
8109
8135
  }
@@ -11952,7 +11978,7 @@ function sleep(ms) {
11952
11978
  return new Promise((resolve) => setTimeout(resolve, Math.max(0, ms)));
11953
11979
  }
11954
11980
  //#endregion
11955
- //#region ../types/dist/composition-Dh3RfMx5.mjs
11981
+ //#region ../types/dist/composition-BSGHhcr8.mjs
11956
11982
  /**
11957
11983
  * Deterministic SHA-256 hash of an arbitrary serialisable value. The
11958
11984
  * canonical form sorts object keys alphabetically at every depth so two
@@ -12875,38 +12901,6 @@ function validateExpressionSource(src) {
12875
12901
  return null;
12876
12902
  }
12877
12903
  /**
12878
- * One power reading becomes a washer, dryer or dishwasher (D944 helper).
12879
- *
12880
- * Standby of the control board is under 5 W; a motor or a heater is far
12881
- * above that, so 5 W is the line. A door lock or a short pump spike is not
12882
- * a cycle, so running starts only after 30 s above the line.
12883
- *
12884
- * A wash, dry or dishwasher pause (soak, heat-wait, heater off between
12885
- * bursts) lasts several minutes. Ending the cycle on the first dip would
12886
- * report "finished" in the middle of the program, so the stop dwell is
12887
- * 10 minutes on every type. The number is stored per type so one machine
12888
- * can move later without moving the others.
12889
- */
12890
- var APPLIANCE_TEMPLATE_ID = "appliance";
12891
- var APPLIANCE_KINDS = [
12892
- "washer",
12893
- "dryer",
12894
- "dishwasher"
12895
- ];
12896
- DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher;
12897
- /**
12898
- * A dumb plug-in stove or heater, built from a smart plug (a `Heater`).
12899
- *
12900
- * The plug is the actuator: `switch.setState` is a FORWARD to the plug's own
12901
- * (D967), so the heater switches exactly as the plug does. Running is the
12902
- * plug being on; when a power reading is also named, running is the draw
12903
- * staying above the line instead (a plug left on with the stove's own
12904
- * thermostat open is not heating). 50 W is far above any standby and below
12905
- * the smallest radiator.
12906
- */
12907
- var HEATER_TEMPLATE_ID = "heater";
12908
- DeviceType.Heater;
12909
- /**
12910
12904
  * Statistics and integrals over a history read (D944).
12911
12905
  *
12912
12906
  * Pure: the same points always give the same answer, so a restart recomputes
@@ -13050,34 +13044,6 @@ var HelperSpecSchema = discriminatedUnion("kind", [
13050
13044
  /** Actuator groups only. Readings leave this unset. */
13051
13045
  active: ActiveCriterionSchema.optional()
13052
13046
  }),
13053
- object({
13054
- kind: literal("appliance"),
13055
- templateId: literal(APPLIANCE_TEMPLATE_ID),
13056
- appliance: _enum(APPLIANCE_KINDS),
13057
- thresholdWatts: number().positive(),
13058
- startDwellMs: number().int().nonnegative(),
13059
- stopDwellMs: number().int().nonnegative(),
13060
- member: HelperMemberSchema,
13061
- /**
13062
- * The plug that powers the appliance (`switch.on`). Optional: when set, the
13063
- * composition carries a `power-source` feature, so the hub can cut and restore
13064
- * that plug (power-source link of a NEW-target composition).
13065
- */
13066
- powerSwitch: HelperMemberSchema.optional(),
13067
- /** How long a forced restart keeps the plug off; the cap's default when unset. */
13068
- offSeconds: number().optional()
13069
- }),
13070
- object({
13071
- kind: literal("heater"),
13072
- templateId: literal(HEATER_TEMPLATE_ID),
13073
- /** The plug, read and commanded at `switch.on`. */
13074
- plug: HelperMemberSchema,
13075
- /** The plug's power reading, when it has one: running is then the draw, not the switch. */
13076
- meter: HelperMemberSchema.optional(),
13077
- thresholdWatts: number().positive(),
13078
- startDwellMs: number().int().nonnegative(),
13079
- stopDwellMs: number().int().nonnegative()
13080
- }),
13081
13047
  object({
13082
13048
  kind: literal("statistic"),
13083
13049
  stat: _enum(STATISTIC_STATS),
@@ -13249,7 +13215,14 @@ var CompositionForwardCommandSchema = object({
13249
13215
  method: string().min(1),
13250
13216
  args: record(string().min(1), CompositionForwardArgSchema).optional()
13251
13217
  });
13252
- var CompositionCommandTargetSchema = discriminatedUnion("kind", [CompositionForwardCommandSchema, CompositionCodeSourceSchema]);
13218
+ var CompositionCommandTargetSchema = discriminatedUnion("kind", [
13219
+ CompositionForwardCommandSchema,
13220
+ CompositionCodeSourceSchema,
13221
+ object({
13222
+ kind: literal("extension"),
13223
+ target: literal("remote")
13224
+ })
13225
+ ]);
13253
13226
  /** An item key inside an item-array cap (`consumables.items[<key>]`). */
13254
13227
  var COMPOSITION_ITEM_KEY_RE = /^[a-z0-9][a-z0-9-]{0,47}$/;
13255
13228
  /**
@@ -13294,7 +13267,7 @@ var CompositionSchema = object({
13294
13267
  kind: literal("existing"),
13295
13268
  device: CompositionSourceRefSchema
13296
13269
  })]),
13297
- features: array(CompositionFeatureSchema).min(1).max(16),
13270
+ features: array(CompositionFeatureSchema).min(0).max(16),
13298
13271
  /**
13299
13272
  * Present when the block is a helper template. Absent on a free
13300
13273
  * composition (the room example, device 4603). The editor reads this,
@@ -20516,6 +20489,48 @@ var APPLIANCE_CAP_VOCABULARY = {
20516
20489
  scope: "device",
20517
20490
  noun: t("Media player", "Lettore multimediale"),
20518
20491
  actions: [
20492
+ {
20493
+ id: "media.turnOn",
20494
+ method: "turnOn",
20495
+ label: t("Turn on", "Accendi"),
20496
+ phrase: t("Turn on {device}", "Accendi {device}"),
20497
+ icon: "power"
20498
+ },
20499
+ {
20500
+ id: "media.turnOff",
20501
+ method: "turnOff",
20502
+ label: t("Turn off", "Spegni"),
20503
+ phrase: t("Turn off {device}", "Spegni {device}"),
20504
+ icon: "power"
20505
+ },
20506
+ {
20507
+ id: "media.volumeUp",
20508
+ method: "volumeUp",
20509
+ label: t("Volume up", "Alza il volume"),
20510
+ phrase: t("Raise the volume of {device}", "Alza il volume di {device}"),
20511
+ icon: "volume-2"
20512
+ },
20513
+ {
20514
+ id: "media.volumeDown",
20515
+ method: "volumeDown",
20516
+ label: t("Volume down", "Abbassa il volume"),
20517
+ phrase: t("Lower the volume of {device}", "Abbassa il volume di {device}"),
20518
+ icon: "volume-2"
20519
+ },
20520
+ {
20521
+ id: "media.channelUp",
20522
+ method: "channelUp",
20523
+ label: t("Channel up", "Canale successivo"),
20524
+ phrase: t("Go to the next channel on {device}", "Passa al canale successivo su {device}"),
20525
+ icon: "skip-forward"
20526
+ },
20527
+ {
20528
+ id: "media.channelDown",
20529
+ method: "channelDown",
20530
+ label: t("Channel down", "Canale precedente"),
20531
+ phrase: t("Go to the previous channel on {device}", "Torna al canale precedente su {device}"),
20532
+ icon: "skip-back"
20533
+ },
20519
20534
  {
20520
20535
  id: "media.play",
20521
20536
  method: "play",
@@ -50318,6 +50333,244 @@ var controlCapability = {
50318
50333
  */
50319
50334
  history: "none"
50320
50335
  };
50336
+ /**
50337
+ * Media-player cap. Models HA `media_player.*` (Sonos, Chromecast,
50338
+ * Apple TV, Spotify, Roku, generic OTT receivers, …) on
50339
+ * `DeviceType.MediaPlayer`. Disjoint from the camera streaming
50340
+ * surface — those use `DeviceType.Camera` + the broker pipeline.
50341
+ *
50342
+ * The cap declares a wide method surface; not every backend supports
50343
+ * every method. Drivers signal sub-capability via the
50344
+ * `DeviceFeature.MediaPlayerXxx` flags (paired one-to-one with the
50345
+ * corresponding method) so the UI gates buttons without a slice
50346
+ * fetch — same pattern as `PanTiltZoom` for cameras.
50347
+ */
50348
+ var MediaPlayerStateSchema = _enum([
50349
+ "off",
50350
+ "on",
50351
+ "idle",
50352
+ "playing",
50353
+ "paused",
50354
+ "buffering",
50355
+ "standby"
50356
+ ]);
50357
+ var MediaPlayerRepeatSchema = _enum([
50358
+ "off",
50359
+ "all",
50360
+ "one"
50361
+ ]);
50362
+ var MediaInfoSchema = object({
50363
+ /** Free-form media kind (`music`, `tvshow`, `movie`, `app`, `channel`,
50364
+ * `podcast`, …). */
50365
+ type: string(),
50366
+ /** Human-readable title. */
50367
+ title: string(),
50368
+ /** Optional artist / channel / station label. */
50369
+ artist: string().optional(),
50370
+ /** Optional album / season / show name. */
50371
+ album: string().optional(),
50372
+ /** Optional cover-art / thumbnail URL. */
50373
+ imageUrl: string().optional()
50374
+ });
50375
+ /**
50376
+ * Where `state`, `volumeLevel`, `isMuted` and `source` come from. `reported`:
50377
+ * the device said so. `assumed`: the driver has no feedback (infrared) and
50378
+ * tracks what it last SENT; it moves only after a send was accepted, and a
50379
+ * human at the real remote makes it wrong. A UI shows an assumed value as a
50380
+ * guess, never as a reading.
50381
+ */
50382
+ var MediaPlayerStateSourceSchema = _enum(["reported", "assumed"]);
50383
+ /** The fields of a media-player status a driver can only guess. */
50384
+ var MediaPlayerAssumedFieldSchema = _enum([
50385
+ "state",
50386
+ "volumeLevel",
50387
+ "isMuted",
50388
+ "source"
50389
+ ]);
50390
+ var MediaPlayerStatusSchema = object({
50391
+ /** Playback lifecycle state. */
50392
+ state: MediaPlayerStateSchema,
50393
+ /**
50394
+ * Whether the state fields are readings or the driver's own bookkeeping.
50395
+ * A slice written before this field existed parses as `reported`.
50396
+ */
50397
+ stateSource: MediaPlayerStateSourceSchema.default("reported"),
50398
+ /**
50399
+ * Which fields are the driver's own guess. `stateSource` is `assumed` when
50400
+ * this is not empty; a field not listed here is a reading even then (power
50401
+ * from a running-state source, mute guessed from the last send).
50402
+ */
50403
+ assumedFields: array(MediaPlayerAssumedFieldSchema).default([]),
50404
+ /** Volume as 0..100 inclusive. Null when the device has no volume
50405
+ * surface. Pair with `DeviceFeature.MediaPlayerVolume`. */
50406
+ volumeLevel: number().min(0).max(100).nullable().meta(readingMeta("percentage")),
50407
+ /** Mute toggle distinct from volume=0. Null when no mute surface.
50408
+ * Pair with `DeviceFeature.MediaPlayerMute`. */
50409
+ isMuted: boolean().nullable(),
50410
+ /** Active source / input. Empty when no source surface. */
50411
+ source: string(),
50412
+ /** Selectable sources. Empty when no source surface.
50413
+ * Pair with `DeviceFeature.MediaPlayerSelectSource`. */
50414
+ availableSources: array(string()),
50415
+ /** Currently-playing media info. Null when nothing is playing. */
50416
+ currentMedia: MediaInfoSchema.nullable(),
50417
+ /** Current playback position in ms. Null when not seekable or
50418
+ * nothing is playing. Pair with `DeviceFeature.MediaPlayerSeek`. */
50419
+ position: number().int().nonnegative().nullable().meta(readingMeta("duration-ms")),
50420
+ /** Total duration of the current media in ms. Null when unknown
50421
+ * (live stream) or nothing is playing. */
50422
+ duration: number().int().nonnegative().nullable().meta(readingMeta("duration-ms")),
50423
+ /** Shuffle toggle. Null when no shuffle surface.
50424
+ * Pair with `DeviceFeature.MediaPlayerShuffle`. */
50425
+ shuffle: boolean().nullable(),
50426
+ /** Repeat mode. Null when no repeat surface.
50427
+ * Pair with `DeviceFeature.MediaPlayerRepeat`. */
50428
+ repeat: MediaPlayerRepeatSchema.nullable(),
50429
+ /** Ms epoch when the slice was last updated. */
50430
+ lastChangedAt: number()
50431
+ });
50432
+ var stepInput = object({
50433
+ deviceId: number().int().nonnegative(),
50434
+ /** How many presses: the caller's count (Alexa `volumeSteps`, `channelCount`). */
50435
+ steps: number().int().min(1).max(50).default(1)
50436
+ });
50437
+ var deviceOnly = object({ deviceId: number().int().nonnegative() });
50438
+ var mediaPlayerCapability = {
50439
+ name: "media-player",
50440
+ scope: "device",
50441
+ deviceNative: true,
50442
+ mode: "singleton",
50443
+ deviceTypes: [DeviceType.MediaPlayer],
50444
+ methods: {
50445
+ turnOn: method(deviceOnly, _void(), {
50446
+ kind: "mutation",
50447
+ auth: "protected"
50448
+ }),
50449
+ turnOff: method(deviceOnly, _void(), {
50450
+ kind: "mutation",
50451
+ auth: "protected"
50452
+ }),
50453
+ volumeUp: method(stepInput, _void(), {
50454
+ kind: "mutation",
50455
+ auth: "protected"
50456
+ }),
50457
+ volumeDown: method(stepInput, _void(), {
50458
+ kind: "mutation",
50459
+ auth: "protected"
50460
+ }),
50461
+ channelUp: method(stepInput, _void(), {
50462
+ kind: "mutation",
50463
+ auth: "protected"
50464
+ }),
50465
+ channelDown: method(stepInput, _void(), {
50466
+ kind: "mutation",
50467
+ auth: "protected"
50468
+ }),
50469
+ play: method(object({ deviceId: number().int().nonnegative() }), _void(), {
50470
+ kind: "mutation",
50471
+ auth: "protected"
50472
+ }),
50473
+ pause: method(object({ deviceId: number().int().nonnegative() }), _void(), {
50474
+ kind: "mutation",
50475
+ auth: "protected"
50476
+ }),
50477
+ stop: method(object({ deviceId: number().int().nonnegative() }), _void(), {
50478
+ kind: "mutation",
50479
+ auth: "protected"
50480
+ }),
50481
+ next: method(object({ deviceId: number().int().nonnegative() }), _void(), {
50482
+ kind: "mutation",
50483
+ auth: "protected"
50484
+ }),
50485
+ previous: method(object({ deviceId: number().int().nonnegative() }), _void(), {
50486
+ kind: "mutation",
50487
+ auth: "protected"
50488
+ }),
50489
+ seek: method(object({
50490
+ deviceId: number().int().nonnegative(),
50491
+ position: number().int().nonnegative()
50492
+ }), _void(), {
50493
+ kind: "mutation",
50494
+ auth: "protected"
50495
+ }),
50496
+ setVolume: method(object({
50497
+ deviceId: number().int().nonnegative(),
50498
+ volumeLevel: number().min(0).max(100)
50499
+ }), _void(), {
50500
+ kind: "mutation",
50501
+ auth: "protected"
50502
+ }),
50503
+ setMute: method(object({
50504
+ deviceId: number().int().nonnegative(),
50505
+ muted: boolean()
50506
+ }), _void(), {
50507
+ kind: "mutation",
50508
+ auth: "protected"
50509
+ }),
50510
+ setShuffle: method(object({
50511
+ deviceId: number().int().nonnegative(),
50512
+ shuffle: boolean()
50513
+ }), _void(), {
50514
+ kind: "mutation",
50515
+ auth: "protected"
50516
+ }),
50517
+ setRepeat: method(object({
50518
+ deviceId: number().int().nonnegative(),
50519
+ repeat: MediaPlayerRepeatSchema
50520
+ }), _void(), {
50521
+ kind: "mutation",
50522
+ auth: "protected"
50523
+ }),
50524
+ selectSource: method(object({
50525
+ deviceId: number().int().nonnegative(),
50526
+ source: string().min(1)
50527
+ }), _void(), {
50528
+ kind: "mutation",
50529
+ auth: "protected"
50530
+ }),
50531
+ playMedia: method(object({
50532
+ deviceId: number().int().nonnegative(),
50533
+ /** Media identifier / URL. */
50534
+ mediaId: string().min(1),
50535
+ /** Media kind (`music`, `tvshow`, `movie`, `app`, …) — provider
50536
+ * passes it through to the upstream service. */
50537
+ mediaType: string().min(1)
50538
+ }), _void(), {
50539
+ kind: "mutation",
50540
+ auth: "protected"
50541
+ })
50542
+ },
50543
+ status: {
50544
+ schema: MediaPlayerStatusSchema,
50545
+ kind: "push"
50546
+ },
50547
+ /**
50548
+ * Runtime-state slice — mirrored by the kernel. UI players read the
50549
+ * full slice for live now-playing, volume, and progress updates
50550
+ * without polling.
50551
+ */
50552
+ runtimeState: MediaPlayerStatusSchema,
50553
+ /**
50554
+ * Runtime-state durability: **session** — a restored transport position describes a playback that stopped when the hub did.
50555
+ *
50556
+ * See `RuntimeStateDurability`. Enforced by
50557
+ * `scripts/check-runtime-state-durability.ts`.
50558
+ */
50559
+ durability: "session",
50560
+ /**
50561
+ * History (D850): volume (a level an operator or an automation sets; the
50562
+ * default 10 s floor folds a slider drag into its end value) and mute.
50563
+ * `position` is not recorded: it moves continuously while playing.
50564
+ */
50565
+ history: { fields: {
50566
+ volumeLevel: {
50567
+ kind: "gauge",
50568
+ unit: "%",
50569
+ deadband: 1
50570
+ },
50571
+ isMuted: { kind: "boolean" }
50572
+ } }
50573
+ };
50321
50574
  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;
50322
50575
  var NUMBER = {
50323
50576
  kind: "fixed",
@@ -50765,117 +51018,6 @@ function actuator(input) {
50765
51018
  };
50766
51019
  }
50767
51020
  new Map(GROUP_TEMPLATES.map((template) => [template.id, template]));
50768
- var PowerSourceRefusalReasonSchema = _enum([
50769
- "no-power-source",
50770
- "switch-missing",
50771
- "switch-offline",
50772
- "switch-unknown",
50773
- "restart-in-progress",
50774
- "switch-call-failed"
50775
- ]);
50776
- var PowerSourceActionResultSchema = discriminatedUnion("accepted", [object({ accepted: literal(true) }), object({
50777
- accepted: literal(false),
50778
- reason: PowerSourceRefusalReasonSchema,
50779
- /** One line for the operator, naming the switch. */
50780
- message: string()
50781
- })]);
50782
- var PowerSourceInfoSchema = object({
50783
- /** False when the device has no power source linked; the rest is then empty. */
50784
- linked: boolean(),
50785
- switchDeviceId: number().nullable(),
50786
- switchName: string().nullable(),
50787
- /** The switch's on/off state, or null when it is unknown. Never false for unknown (D393). */
50788
- switchOn: boolean().nullable(),
50789
- switchOnline: boolean().nullable(),
50790
- restartInProgress: boolean(),
50791
- offSeconds: number().int()
50792
- });
50793
- /** The composed slice: the switch state the link mirrors, plus the stored off time. */
50794
- var PowerSourceStateSchema = object({
50795
- /** Null while the switch has not reported: unknown is never `false` (D393). */
50796
- switchOn: boolean().nullable(),
50797
- offSeconds: number().int(),
50798
- lastFetchedAt: number()
50799
- });
50800
- var POWER_SOURCE_DEVICE_TYPES = [
50801
- DeviceType.Gateway,
50802
- DeviceType.Hub,
50803
- DeviceType.Camera,
50804
- DeviceType.Sensor,
50805
- DeviceType.MediaPlayer,
50806
- DeviceType.Vacuum,
50807
- DeviceType.Generic,
50808
- DeviceType.Washer,
50809
- DeviceType.Dryer,
50810
- DeviceType.Dishwasher,
50811
- DeviceType.PetFountain,
50812
- DeviceType.Fan,
50813
- DeviceType.Humidifier,
50814
- DeviceType.Climate,
50815
- DeviceType.WaterHeater
50816
- ];
50817
- var powerSourceCustomize = {
50818
- version: 1,
50819
- targets: [{
50820
- id: "switch",
50821
- cardinality: "scalar",
50822
- vocabulary: {
50823
- cap: "power-source",
50824
- stateField: "switchOn"
50825
- },
50826
- deviceTypes: POWER_SOURCE_DEVICE_TYPES,
50827
- apply: "add",
50828
- path: "switchOn",
50829
- sources: [{
50830
- kind: "switch",
50831
- transforms: [{ kind: "identity" }]
50832
- }],
50833
- companions: [{
50834
- kind: "constant",
50835
- path: "offSeconds",
50836
- value: 10,
50837
- when: "add"
50838
- }, {
50839
- kind: "clock",
50840
- path: "lastFetchedAt",
50841
- when: "always"
50842
- }],
50843
- sourceReport: { status: "assignment-status" }
50844
- }]
50845
- };
50846
- var deviceInput$2 = object({ deviceId: number().int().nonnegative() });
50847
- var powerSourceCapability = {
50848
- name: "power-source",
50849
- scope: "device",
50850
- mode: "singleton",
50851
- deviceTypes: POWER_SOURCE_DEVICE_TYPES,
50852
- methods: {
50853
- getStatus: systemMethod(deviceInput$2, PowerSourceInfoSchema, { auth: "admin" }),
50854
- powerOn: systemMethod(deviceInput$2, PowerSourceActionResultSchema, {
50855
- kind: "mutation",
50856
- auth: "admin"
50857
- }),
50858
- powerOff: systemMethod(deviceInput$2, PowerSourceActionResultSchema, {
50859
- kind: "mutation",
50860
- auth: "admin"
50861
- }),
50862
- forceRestart: systemMethod(deviceInput$2, PowerSourceActionResultSchema, {
50863
- kind: "mutation",
50864
- auth: "admin"
50865
- })
50866
- },
50867
- runtimeState: PowerSourceStateSchema,
50868
- customize: powerSourceCustomize,
50869
- /**
50870
- * Runtime-state durability: **session** — mirrored from the linked switch on
50871
- * its next report; a restored value would outlive the reading it names.
50872
- *
50873
- * See `RuntimeStateDurability`. Enforced by
50874
- * `scripts/check-runtime-state-durability.ts`.
50875
- */
50876
- durability: "session",
50877
- history: "none"
50878
- };
50879
51021
  DeviceFeature.LightColorRgb, DeviceFeature.LightColorHsv, DeviceFeature.LightColorMired;
50880
51022
  DeviceType.Camera;
50881
51023
  `${COMPOSED_DEVICE_STABLE_ID_PREFIX}`;
@@ -50903,6 +51045,165 @@ var ComposableCapabilitiesSchema = object({ caps: array(object({
50903
51045
  }).optional()
50904
51046
  })) });
50905
51047
  /**
51048
+ * A saved Customize assignment (D936). The schema is the type: callers use
51049
+ * `z.infer`, they do not restate the shape.
51050
+ */
51051
+ var OverrideSourceSchema = object({
51052
+ addonId: string().min(1),
51053
+ stableId: string().min(1),
51054
+ cap: string().min(1),
51055
+ fieldPath: string().min(1)
51056
+ });
51057
+ var IdentityTransformDraftSchema = object({ kind: literal("identity") });
51058
+ var InvertTransformDraftSchema = object({ kind: literal("invert") });
51059
+ var ThresholdTransformDraftSchema = object({
51060
+ kind: literal("threshold"),
51061
+ comparison: _enum(["gte", "lte"]),
51062
+ threshold: number(),
51063
+ startDwellMs: number().nonnegative(),
51064
+ stopDwellMs: number().nonnegative()
51065
+ });
51066
+ var CustomizeTransformDraftSchema = discriminatedUnion("kind", [
51067
+ IdentityTransformDraftSchema,
51068
+ InvertTransformDraftSchema,
51069
+ ThresholdTransformDraftSchema,
51070
+ object({
51071
+ kind: literal("linear"),
51072
+ scale: number(),
51073
+ offset: number(),
51074
+ clampMin: number().optional(),
51075
+ clampMax: number().optional()
51076
+ }),
51077
+ object({
51078
+ kind: literal("enum-map"),
51079
+ mapping: record(string(), string().nullable())
51080
+ }),
51081
+ object({ kind: literal("number") })
51082
+ ]);
51083
+ var ScalarOverrideDraftSchema = object({
51084
+ kind: literal("scalar"),
51085
+ cap: string().min(1),
51086
+ targetId: string().min(1),
51087
+ source: OverrideSourceSchema,
51088
+ transform: CustomizeTransformDraftSchema
51089
+ });
51090
+ var KeyedArrayOverrideDraftSchema = object({
51091
+ kind: literal("keyedArray"),
51092
+ cap: string().min(1),
51093
+ targetId: string().min(1),
51094
+ key: string().min(1),
51095
+ label: string().min(1),
51096
+ fieldPath: string().min(1),
51097
+ source: OverrideSourceSchema,
51098
+ transform: CustomizeTransformDraftSchema
51099
+ });
51100
+ var PulseOverrideDraftSchema = object({
51101
+ kind: literal("pulse"),
51102
+ cap: string().min(1),
51103
+ targetId: string().min(1),
51104
+ enabled: boolean(),
51105
+ debounceMs: number().nonnegative(),
51106
+ edges: array(_enum([
51107
+ "rising",
51108
+ "button",
51109
+ "native-event"
51110
+ ])).min(1).optional(),
51111
+ sources: array(OverrideSourceSchema).min(1)
51112
+ });
51113
+ var SpanSourceDraftSchema = OverrideSourceSchema.extend({ mode: _enum([
51114
+ "in-addition",
51115
+ "confirm",
51116
+ "replace"
51117
+ ]).optional() });
51118
+ discriminatedUnion("kind", [
51119
+ ScalarOverrideDraftSchema,
51120
+ KeyedArrayOverrideDraftSchema,
51121
+ PulseOverrideDraftSchema,
51122
+ object({
51123
+ kind: literal("span"),
51124
+ cap: string().min(1),
51125
+ targetId: string().min(1),
51126
+ timeoutMs: number().nonnegative(),
51127
+ cooldownMs: number().nonnegative().optional(),
51128
+ sources: array(SpanSourceDraftSchema)
51129
+ })
51130
+ ]);
51131
+ object({
51132
+ targetId: string().min(1),
51133
+ configured: boolean(),
51134
+ source: _enum(["native", "assigned"]),
51135
+ state: _enum([
51136
+ "active",
51137
+ "stale",
51138
+ "released",
51139
+ "unavailable"
51140
+ ]),
51141
+ reason: string().nullable()
51142
+ });
51143
+ /**
51144
+ * What a running-threshold proposal says (planning#405). The schema is the
51145
+ * type: the algorithm, the capability method and the UI all read `z.infer`.
51146
+ *
51147
+ * A proposal is read-only advice: it carries the numbers it was derived from
51148
+ * (`evidence`) so the operator can judge it, and an `insufficient` answer names
51149
+ * WHY with a typed reason and the catalog defaults, never an invented number.
51150
+ */
51151
+ var RunningProposalTierSchema = _enum(["raw", "5m"]);
51152
+ var RunningProposalConfidenceSchema = _enum([
51153
+ "high",
51154
+ "medium",
51155
+ "low"
51156
+ ]);
51157
+ var RunningProposalInsufficientReasonSchema = _enum([
51158
+ "no-history",
51159
+ "span-too-short",
51160
+ "truncated",
51161
+ "no-idle-floor",
51162
+ "no-runs",
51163
+ "no-separation"
51164
+ ]);
51165
+ var RunningProposalReplaySchema = object({
51166
+ /** Intervals the real dwell expression held true over the window. */
51167
+ intervals: number().int().nonnegative(),
51168
+ /** Intervals outside every run, or a second interval inside one. */
51169
+ extra: number().int().nonnegative(),
51170
+ /** Runs without an interval of their own (none, or merged into a neighbour). */
51171
+ missed: number().int().nonnegative()
51172
+ });
51173
+ var RunningProposalEvidenceSchema = object({
51174
+ tier: RunningProposalTierSchema,
51175
+ spanMs: number().nonnegative(),
51176
+ from: number(),
51177
+ to: number(),
51178
+ points: number().int().nonnegative(),
51179
+ runsFound: number().int().nonnegative(),
51180
+ pausesFound: number().int().nonnegative(),
51181
+ longestPauseMs: number().nonnegative(),
51182
+ idleFloorW: number(),
51183
+ noiseCeilingW: number(),
51184
+ plateauW: number(),
51185
+ replay: RunningProposalReplaySchema
51186
+ });
51187
+ var RunningProposalInsufficientEvidenceSchema = object({
51188
+ spanMs: number().nonnegative(),
51189
+ points: number().int().nonnegative(),
51190
+ runsFound: number().int().nonnegative()
51191
+ });
51192
+ var RunningThresholdProposalSchema = discriminatedUnion("state", [object({
51193
+ state: literal("proposal"),
51194
+ transform: ThresholdTransformDraftSchema,
51195
+ evidence: RunningProposalEvidenceSchema,
51196
+ confidence: RunningProposalConfidenceSchema,
51197
+ /** Why the confidence is not higher; empty when nothing held it back. */
51198
+ notes: array(string())
51199
+ }), object({
51200
+ state: literal("insufficient"),
51201
+ reason: RunningProposalInsufficientReasonSchema,
51202
+ evidence: RunningProposalInsufficientEvidenceSchema,
51203
+ /** The catalog defaults, offered as what stands when nothing better is known. */
51204
+ fallback: ThresholdTransformDraftSchema
51205
+ })]);
51206
+ /**
50906
51207
  * The report of a one-shot "move this owner's plaintext secrets into the
50907
51208
  * keychain" run (D878). COUNTS only - never a value, never a ref.
50908
51209
  *
@@ -51199,6 +51500,14 @@ method(object({}), object({ blocks: array(CoreBlockSchema) }), { auth: "admin" }
51199
51500
  kind: "mutation",
51200
51501
  auth: "admin",
51201
51502
  access: "view"
51503
+ }), method(object({
51504
+ deviceId: number().int(),
51505
+ cap: string().min(1),
51506
+ fieldPath: string().min(1),
51507
+ deviceType: _enum(DeviceType).optional()
51508
+ }), RunningThresholdProposalSchema, {
51509
+ auth: "admin",
51510
+ access: "view"
51202
51511
  }), method(object({
51203
51512
  blockId: string().min(1),
51204
51513
  trace: AutomationRunTraceSchema.optional(),
@@ -55896,15 +56205,15 @@ var FanPresetCaptureResultSchema = object({
55896
56205
  items: array(FanCaptureItemSchema),
55897
56206
  omitted: array(FanCaptureOmissionSchema)
55898
56207
  });
55899
- var deviceInput$1 = object({ deviceId: number().int().nonnegative() });
56208
+ var deviceInput$2 = object({ deviceId: number().int().nonnegative() });
55900
56209
  DeviceType.Fan;
55901
- method(deviceInput$1, array(FanPresetSchema), { auth: "protected" }), method(deviceInput$1.extend({ presets: array(FanPresetSchema).max(12) }), FanPresetsSetResultSchema, {
56210
+ method(deviceInput$2, array(FanPresetSchema), { auth: "protected" }), method(deviceInput$2.extend({ presets: array(FanPresetSchema).max(12) }), FanPresetsSetResultSchema, {
55902
56211
  kind: "mutation",
55903
56212
  auth: "admin"
55904
- }), method(deviceInput$1.extend({ presetId: string().min(1) }), FanPresetApplyResultSchema, {
56213
+ }), method(deviceInput$2.extend({ presetId: string().min(1) }), FanPresetApplyResultSchema, {
55905
56214
  kind: "mutation",
55906
56215
  auth: "protected"
55907
- }), method(deviceInput$1.extend({
56216
+ }), method(deviceInput$2.extend({
55908
56217
  fields: array(FanCaptureFieldSchema).optional(),
55909
56218
  steps: array(ActionStepSchema).max(20).default([])
55910
56219
  }), FanPresetCaptureResultSchema, { auth: "protected" });
@@ -59198,214 +59507,6 @@ var LoginMethodContributionSchema = discriminatedUnion("kind", [
59198
59507
  ]);
59199
59508
  method(_void(), array(LoginMethodContributionSchema).readonly());
59200
59509
  /**
59201
- * Media-player cap. Models HA `media_player.*` (Sonos, Chromecast,
59202
- * Apple TV, Spotify, Roku, generic OTT receivers, …) on
59203
- * `DeviceType.MediaPlayer`. Disjoint from the camera streaming
59204
- * surface — those use `DeviceType.Camera` + the broker pipeline.
59205
- *
59206
- * The cap declares a wide method surface; not every backend supports
59207
- * every method. Drivers signal sub-capability via the
59208
- * `DeviceFeature.MediaPlayerXxx` flags (paired one-to-one with the
59209
- * corresponding method) so the UI gates buttons without a slice
59210
- * fetch — same pattern as `PanTiltZoom` for cameras.
59211
- */
59212
- var MediaPlayerStateSchema = _enum([
59213
- "off",
59214
- "on",
59215
- "idle",
59216
- "playing",
59217
- "paused",
59218
- "buffering",
59219
- "standby"
59220
- ]);
59221
- var MediaPlayerRepeatSchema = _enum([
59222
- "off",
59223
- "all",
59224
- "one"
59225
- ]);
59226
- var MediaInfoSchema = object({
59227
- /** Free-form media kind (`music`, `tvshow`, `movie`, `app`, `channel`,
59228
- * `podcast`, …). */
59229
- type: string(),
59230
- /** Human-readable title. */
59231
- title: string(),
59232
- /** Optional artist / channel / station label. */
59233
- artist: string().optional(),
59234
- /** Optional album / season / show name. */
59235
- album: string().optional(),
59236
- /** Optional cover-art / thumbnail URL. */
59237
- imageUrl: string().optional()
59238
- });
59239
- /**
59240
- * Where `state`, `volumeLevel`, `isMuted` and `source` come from. `reported`:
59241
- * the device said so. `assumed`: the driver has no feedback (infrared) and
59242
- * tracks what it last SENT; it moves only after a send was accepted, and a
59243
- * human at the real remote makes it wrong. A UI shows an assumed value as a
59244
- * guess, never as a reading.
59245
- */
59246
- var MediaPlayerStateSourceSchema = _enum(["reported", "assumed"]);
59247
- /** The fields of a media-player status a driver can only guess. */
59248
- var MediaPlayerAssumedFieldSchema = _enum([
59249
- "state",
59250
- "volumeLevel",
59251
- "isMuted",
59252
- "source"
59253
- ]);
59254
- var MediaPlayerStatusSchema = object({
59255
- /** Playback lifecycle state. */
59256
- state: MediaPlayerStateSchema,
59257
- /**
59258
- * Whether the state fields are readings or the driver's own bookkeeping.
59259
- * A slice written before this field existed parses as `reported`.
59260
- */
59261
- stateSource: MediaPlayerStateSourceSchema.default("reported"),
59262
- /**
59263
- * Which fields are the driver's own guess. `stateSource` is `assumed` when
59264
- * this is not empty; a field not listed here is a reading even then (power
59265
- * from a running-state source, mute guessed from the last send).
59266
- */
59267
- assumedFields: array(MediaPlayerAssumedFieldSchema).default([]),
59268
- /** Volume as 0..100 inclusive. Null when the device has no volume
59269
- * surface. Pair with `DeviceFeature.MediaPlayerVolume`. */
59270
- volumeLevel: number().min(0).max(100).nullable().meta(readingMeta("percentage")),
59271
- /** Mute toggle distinct from volume=0. Null when no mute surface.
59272
- * Pair with `DeviceFeature.MediaPlayerMute`. */
59273
- isMuted: boolean().nullable(),
59274
- /** Active source / input. Empty when no source surface. */
59275
- source: string(),
59276
- /** Selectable sources. Empty when no source surface.
59277
- * Pair with `DeviceFeature.MediaPlayerSelectSource`. */
59278
- availableSources: array(string()),
59279
- /** Currently-playing media info. Null when nothing is playing. */
59280
- currentMedia: MediaInfoSchema.nullable(),
59281
- /** Current playback position in ms. Null when not seekable or
59282
- * nothing is playing. Pair with `DeviceFeature.MediaPlayerSeek`. */
59283
- position: number().int().nonnegative().nullable().meta(readingMeta("duration-ms")),
59284
- /** Total duration of the current media in ms. Null when unknown
59285
- * (live stream) or nothing is playing. */
59286
- duration: number().int().nonnegative().nullable().meta(readingMeta("duration-ms")),
59287
- /** Shuffle toggle. Null when no shuffle surface.
59288
- * Pair with `DeviceFeature.MediaPlayerShuffle`. */
59289
- shuffle: boolean().nullable(),
59290
- /** Repeat mode. Null when no repeat surface.
59291
- * Pair with `DeviceFeature.MediaPlayerRepeat`. */
59292
- repeat: MediaPlayerRepeatSchema.nullable(),
59293
- /** Ms epoch when the slice was last updated. */
59294
- lastChangedAt: number()
59295
- });
59296
- var mediaPlayerCapability = {
59297
- name: "media-player",
59298
- scope: "device",
59299
- deviceNative: true,
59300
- mode: "singleton",
59301
- deviceTypes: [DeviceType.MediaPlayer],
59302
- methods: {
59303
- play: method(object({ deviceId: number().int().nonnegative() }), _void(), {
59304
- kind: "mutation",
59305
- auth: "protected"
59306
- }),
59307
- pause: method(object({ deviceId: number().int().nonnegative() }), _void(), {
59308
- kind: "mutation",
59309
- auth: "protected"
59310
- }),
59311
- stop: method(object({ deviceId: number().int().nonnegative() }), _void(), {
59312
- kind: "mutation",
59313
- auth: "protected"
59314
- }),
59315
- next: method(object({ deviceId: number().int().nonnegative() }), _void(), {
59316
- kind: "mutation",
59317
- auth: "protected"
59318
- }),
59319
- previous: method(object({ deviceId: number().int().nonnegative() }), _void(), {
59320
- kind: "mutation",
59321
- auth: "protected"
59322
- }),
59323
- seek: method(object({
59324
- deviceId: number().int().nonnegative(),
59325
- position: number().int().nonnegative()
59326
- }), _void(), {
59327
- kind: "mutation",
59328
- auth: "protected"
59329
- }),
59330
- setVolume: method(object({
59331
- deviceId: number().int().nonnegative(),
59332
- volumeLevel: number().min(0).max(100)
59333
- }), _void(), {
59334
- kind: "mutation",
59335
- auth: "protected"
59336
- }),
59337
- setMute: method(object({
59338
- deviceId: number().int().nonnegative(),
59339
- muted: boolean()
59340
- }), _void(), {
59341
- kind: "mutation",
59342
- auth: "protected"
59343
- }),
59344
- setShuffle: method(object({
59345
- deviceId: number().int().nonnegative(),
59346
- shuffle: boolean()
59347
- }), _void(), {
59348
- kind: "mutation",
59349
- auth: "protected"
59350
- }),
59351
- setRepeat: method(object({
59352
- deviceId: number().int().nonnegative(),
59353
- repeat: MediaPlayerRepeatSchema
59354
- }), _void(), {
59355
- kind: "mutation",
59356
- auth: "protected"
59357
- }),
59358
- selectSource: method(object({
59359
- deviceId: number().int().nonnegative(),
59360
- source: string().min(1)
59361
- }), _void(), {
59362
- kind: "mutation",
59363
- auth: "protected"
59364
- }),
59365
- playMedia: method(object({
59366
- deviceId: number().int().nonnegative(),
59367
- /** Media identifier / URL. */
59368
- mediaId: string().min(1),
59369
- /** Media kind (`music`, `tvshow`, `movie`, `app`, …) — provider
59370
- * passes it through to the upstream service. */
59371
- mediaType: string().min(1)
59372
- }), _void(), {
59373
- kind: "mutation",
59374
- auth: "protected"
59375
- })
59376
- },
59377
- status: {
59378
- schema: MediaPlayerStatusSchema,
59379
- kind: "push"
59380
- },
59381
- /**
59382
- * Runtime-state slice — mirrored by the kernel. UI players read the
59383
- * full slice for live now-playing, volume, and progress updates
59384
- * without polling.
59385
- */
59386
- runtimeState: MediaPlayerStatusSchema,
59387
- /**
59388
- * Runtime-state durability: **session** — a restored transport position describes a playback that stopped when the hub did.
59389
- *
59390
- * See `RuntimeStateDurability`. Enforced by
59391
- * `scripts/check-runtime-state-durability.ts`.
59392
- */
59393
- durability: "session",
59394
- /**
59395
- * History (D850): volume (a level an operator or an automation sets; the
59396
- * default 10 s floor folds a slider drag into its end value) and mute.
59397
- * `position` is not recorded: it moves continuously while playing.
59398
- */
59399
- history: { fields: {
59400
- volumeLevel: {
59401
- kind: "gauge",
59402
- unit: "%",
59403
- deadband: 1
59404
- },
59405
- isMuted: { kind: "boolean" }
59406
- } }
59407
- };
59408
- /**
59409
59510
  * mesh-network — collection cap for mesh-VPN providers.
59410
59511
  *
59411
59512
  * Different shape from `network-access` (public tunnels):
@@ -73489,6 +73590,14 @@ var powerMeterCapability = {
73489
73590
  deviceNative: true,
73490
73591
  mode: "singleton",
73491
73592
  deviceTypes: POWER_METER_DEVICE_TYPES,
73593
+ deviceConfig: { ui: {
73594
+ kind: "widget",
73595
+ widgetId: "host/power-meter-line",
73596
+ tab: "power",
73597
+ placement: "hero",
73598
+ label: "Power",
73599
+ order: 4
73600
+ } },
73492
73601
  methods: {},
73493
73602
  status: {
73494
73603
  schema: PowerMeterStatusSchema,
@@ -73548,6 +73657,117 @@ var powerMeterCapability = {
73548
73657
  volatileStateFields: ["lastFetchedAt"],
73549
73658
  customize: powerMeterCustomize
73550
73659
  };
73660
+ var PowerSourceRefusalReasonSchema = _enum([
73661
+ "no-power-source",
73662
+ "switch-missing",
73663
+ "switch-offline",
73664
+ "switch-unknown",
73665
+ "restart-in-progress",
73666
+ "switch-call-failed"
73667
+ ]);
73668
+ var PowerSourceActionResultSchema = discriminatedUnion("accepted", [object({ accepted: literal(true) }), object({
73669
+ accepted: literal(false),
73670
+ reason: PowerSourceRefusalReasonSchema,
73671
+ /** One line for the operator, naming the switch. */
73672
+ message: string()
73673
+ })]);
73674
+ var PowerSourceInfoSchema = object({
73675
+ /** False when the device has no power source linked; the rest is then empty. */
73676
+ linked: boolean(),
73677
+ switchDeviceId: number().nullable(),
73678
+ switchName: string().nullable(),
73679
+ /** The switch's on/off state, or null when it is unknown. Never false for unknown (D393). */
73680
+ switchOn: boolean().nullable(),
73681
+ switchOnline: boolean().nullable(),
73682
+ restartInProgress: boolean(),
73683
+ offSeconds: number().int()
73684
+ });
73685
+ /** The composed slice: the switch state the link mirrors, plus the stored off time. */
73686
+ var PowerSourceStateSchema = object({
73687
+ /** Null while the switch has not reported: unknown is never `false` (D393). */
73688
+ switchOn: boolean().nullable(),
73689
+ offSeconds: number().int(),
73690
+ lastFetchedAt: number()
73691
+ });
73692
+ var POWER_SOURCE_DEVICE_TYPES = [
73693
+ DeviceType.Gateway,
73694
+ DeviceType.Hub,
73695
+ DeviceType.Camera,
73696
+ DeviceType.Sensor,
73697
+ DeviceType.MediaPlayer,
73698
+ DeviceType.Vacuum,
73699
+ DeviceType.Generic,
73700
+ DeviceType.Washer,
73701
+ DeviceType.Dryer,
73702
+ DeviceType.Dishwasher,
73703
+ DeviceType.PetFountain,
73704
+ DeviceType.Fan,
73705
+ DeviceType.Humidifier,
73706
+ DeviceType.Climate,
73707
+ DeviceType.WaterHeater
73708
+ ];
73709
+ var powerSourceCustomize = {
73710
+ version: 1,
73711
+ targets: [{
73712
+ id: "switch",
73713
+ cardinality: "scalar",
73714
+ vocabulary: {
73715
+ cap: "power-source",
73716
+ stateField: "switchOn"
73717
+ },
73718
+ deviceTypes: POWER_SOURCE_DEVICE_TYPES,
73719
+ apply: "add",
73720
+ path: "switchOn",
73721
+ sources: [{
73722
+ kind: "switch",
73723
+ transforms: [{ kind: "identity" }]
73724
+ }],
73725
+ companions: [{
73726
+ kind: "constant",
73727
+ path: "offSeconds",
73728
+ value: 10,
73729
+ when: "add"
73730
+ }, {
73731
+ kind: "clock",
73732
+ path: "lastFetchedAt",
73733
+ when: "always"
73734
+ }],
73735
+ sourceReport: { status: "assignment-status" }
73736
+ }]
73737
+ };
73738
+ var deviceInput$1 = object({ deviceId: number().int().nonnegative() });
73739
+ var powerSourceCapability = {
73740
+ name: "power-source",
73741
+ scope: "device",
73742
+ mode: "singleton",
73743
+ deviceTypes: POWER_SOURCE_DEVICE_TYPES,
73744
+ methods: {
73745
+ getStatus: systemMethod(deviceInput$1, PowerSourceInfoSchema, { auth: "admin" }),
73746
+ powerOn: systemMethod(deviceInput$1, PowerSourceActionResultSchema, {
73747
+ kind: "mutation",
73748
+ auth: "admin"
73749
+ }),
73750
+ powerOff: systemMethod(deviceInput$1, PowerSourceActionResultSchema, {
73751
+ kind: "mutation",
73752
+ auth: "admin"
73753
+ }),
73754
+ forceRestart: systemMethod(deviceInput$1, PowerSourceActionResultSchema, {
73755
+ kind: "mutation",
73756
+ auth: "admin"
73757
+ })
73758
+ },
73759
+ runtimeState: PowerSourceStateSchema,
73760
+ customize: powerSourceCustomize,
73761
+ /**
73762
+ * Runtime-state durability: **session** — mirrored from the linked switch on
73763
+ * its next report; a restored value would outlive the reading it names.
73764
+ *
73765
+ * See `RuntimeStateDurability`. Enforced by
73766
+ * `scripts/check-runtime-state-durability.ts`.
73767
+ */
73768
+ durability: "session",
73769
+ history: "none"
73770
+ };
73551
73771
  /**
73552
73772
  * Presence cap. Models HA `person.*` and `device_tracker.*` entities
73553
73773
  * on `DeviceType.Presence`. Read-only — no setters: presence is
@@ -77082,7 +77302,13 @@ var RemoteMediaCommandSchema = _enum([
77082
77302
  "next",
77083
77303
  "previous",
77084
77304
  "setMute",
77085
- "selectSource"
77305
+ "selectSource",
77306
+ "turnOn",
77307
+ "turnOff",
77308
+ "volumeUp",
77309
+ "volumeDown",
77310
+ "channelUp",
77311
+ "channelDown"
77086
77312
  ]);
77087
77313
  /** A send result, or `not-routed`: the role is not bound, so the native cap answers. */
77088
77314
  var RemoteMediaCommandResultSchema = discriminatedUnion("status", [...RemoteSendResultSchema.options, object({ status: literal("not-routed") })]);
@@ -77103,7 +77329,7 @@ method(deviceInput, RemoteConfigSchema, { auth: "admin" }), method(deviceInput.e
77103
77329
  }), RemoteSendResultSchema, {
77104
77330
  kind: "mutation",
77105
77331
  auth: "protected"
77106
- }), method(deviceInput.extend({
77332
+ }), method(deviceInput, MediaPlayerStatusSchema.nullable(), { auth: "protected" }), method(deviceInput.extend({
77107
77333
  command: RemoteMediaCommandSchema,
77108
77334
  muted: boolean().optional(),
77109
77335
  source: string().optional(),
@@ -79387,7 +79613,11 @@ listSignals: method(_void(), array(StreamSignalSchema).readonly()) }
79387
79613
  * `getSettingsUISchema()` surface.
79388
79614
  */
79389
79615
  var SwitchStatusSchema = object({
79390
- on: boolean().meta({ label: "On" }),
79616
+ /**
79617
+ * `null` = the device has never reported its state (a measurement that
79618
+ * has not happened is unknown, never `false`).
79619
+ */
79620
+ on: boolean().nullable().meta({ label: "On" }),
79391
79621
  /** Ms epoch of the last state change. Useful for UI "X minutes ago". */
79392
79622
  lastChangedAt: number()
79393
79623
  });
@@ -79412,7 +79642,7 @@ var switchCapability = {
79412
79642
  }) },
79413
79643
  events: { onStateChanged: { data: object({
79414
79644
  deviceId: number(),
79415
- on: boolean(),
79645
+ on: boolean().nullable(),
79416
79646
  lastChangedAt: number()
79417
79647
  }) } },
79418
79648
  status: {
@@ -83015,6 +83245,7 @@ function buildEventKindDescriptor(kind, source) {
83015
83245
  }
83016
83246
  };
83017
83247
  }
83248
+ DeviceFeature.MediaPlayerPower, DeviceFeature.MediaPlayerVolumeStep, DeviceFeature.MediaPlayerChannelStep, DeviceFeature.MediaPlayerMute, DeviceFeature.MediaPlayerStop, DeviceFeature.MediaPlayerNext, DeviceFeature.MediaPlayerPrevious;
83018
83249
  var btn = (idSuffix, row, col, init) => ({
83019
83250
  idSuffix,
83020
83251
  row,
@@ -83141,6 +83372,34 @@ discriminatedUnion("kind", [object({
83141
83372
  kind: literal("pronto"),
83142
83373
  code: string()
83143
83374
  })]);
83375
+ /**
83376
+ * Propose a running threshold from a device's own power history (planning#405).
83377
+ *
83378
+ * Pure and deterministic: the same series gives the same answer. The series is
83379
+ * a HELD-VALUE step series — a point's value stands until the next point — which
83380
+ * is how device-history stores a gauge, so "time at a level" is exact, not a
83381
+ * count of samples.
83382
+ *
83383
+ * 1. idle floor F = time-weighted median; noise ceiling N = highest value seen
83384
+ * near F. A device that is not near one level most of the time has no floor.
83385
+ * 2. coarse activity = above max(2N, N + 5 W); consecutive stretches are episodes.
83386
+ * 3. gaps between episodes split in two by the largest log-scale jump (>= 3x):
83387
+ * the short ones are pauses INSIDE a run (a soak), the long ones separate runs.
83388
+ * 4. T = geometric mean of N and the plateau's 10th percentile, snapped to a
83389
+ * grid a person would type; stop dwell covers the longest pause; start dwell
83390
+ * covers the longest standby blip above T.
83391
+ * 5. the numbers are proved by REPLAY through the real `dwell` evaluation: each
83392
+ * run must hold exactly one true interval and nothing may flap outside.
83393
+ */
83394
+ var SECOND_MS = 1e3;
83395
+ var MINUTE_MS$1 = 60 * SECOND_MS;
83396
+ 24 * (60 * MINUTE_MS$1);
83397
+ 10 * MINUTE_MS$1;
83398
+ 30 * SECOND_MS;
83399
+ 60 * SECOND_MS;
83400
+ 20 * MINUTE_MS$1;
83401
+ 10 * SECOND_MS;
83402
+ 10 * SECOND_MS;
83144
83403
  DeviceFeature.FanSpeed, DeviceFeature.FanPreset, DeviceFeature.FanDirection, DeviceFeature.FanOscillating, DeviceFeature.CoverStoppable, DeviceFeature.CoverPositionable, DeviceFeature.CoverTilt, DeviceFeature.ValvePositionable, DeviceFeature.MediaPlayerVolume, DeviceFeature.ClimateFanMode;
83145
83404
  SOURCE_CAPS.filter((cap) => cap !== "switch" && cap !== "motion");
83146
83405
  String.raw`rose\(active(\d+), changed(\d+), (\d+(?:\.\d+)?)\)`;
@@ -85805,6 +86064,13 @@ Object.freeze({
85805
86064
  access: "create",
85806
86065
  role: "admin"
85807
86066
  },
86067
+ "coreBlocks.proposeRunningThreshold": {
86068
+ capName: "core-blocks",
86069
+ capScope: "system",
86070
+ addonId: null,
86071
+ access: "view",
86072
+ role: "admin"
86073
+ },
85808
86074
  "coreBlocks.reportAutomationRun": {
85809
86075
  capName: "core-blocks",
85810
86076
  capScope: "system",
@@ -88752,6 +89018,20 @@ Object.freeze({
88752
89018
  access: "view",
88753
89019
  role: "admin"
88754
89020
  },
89021
+ "mediaPlayer.channelDown": {
89022
+ capName: "media-player",
89023
+ capScope: "device",
89024
+ addonId: null,
89025
+ access: "create",
89026
+ role: "viewer"
89027
+ },
89028
+ "mediaPlayer.channelUp": {
89029
+ capName: "media-player",
89030
+ capScope: "device",
89031
+ addonId: null,
89032
+ access: "create",
89033
+ role: "viewer"
89034
+ },
88755
89035
  "mediaPlayer.getStatus": {
88756
89036
  capName: "media-player",
88757
89037
  capScope: "device",
@@ -88843,6 +89123,34 @@ Object.freeze({
88843
89123
  access: "create",
88844
89124
  role: "viewer"
88845
89125
  },
89126
+ "mediaPlayer.turnOff": {
89127
+ capName: "media-player",
89128
+ capScope: "device",
89129
+ addonId: null,
89130
+ access: "create",
89131
+ role: "viewer"
89132
+ },
89133
+ "mediaPlayer.turnOn": {
89134
+ capName: "media-player",
89135
+ capScope: "device",
89136
+ addonId: null,
89137
+ access: "create",
89138
+ role: "viewer"
89139
+ },
89140
+ "mediaPlayer.volumeDown": {
89141
+ capName: "media-player",
89142
+ capScope: "device",
89143
+ addonId: null,
89144
+ access: "create",
89145
+ role: "viewer"
89146
+ },
89147
+ "mediaPlayer.volumeUp": {
89148
+ capName: "media-player",
89149
+ capScope: "device",
89150
+ addonId: null,
89151
+ access: "create",
89152
+ role: "viewer"
89153
+ },
88846
89154
  "meshNetwork.getStatus": {
88847
89155
  capName: "mesh-network",
88848
89156
  capScope: "system",
@@ -92399,6 +92707,13 @@ Object.freeze({
92399
92707
  access: "create",
92400
92708
  role: "admin"
92401
92709
  },
92710
+ "remote.getAssumedStatus": {
92711
+ capName: "remote",
92712
+ capScope: "system",
92713
+ addonId: null,
92714
+ access: "view",
92715
+ role: "admin"
92716
+ },
92402
92717
  "remote.getConfig": {
92403
92718
  capName: "remote",
92404
92719
  capScope: "system",
@@ -95214,6 +95529,11 @@ Object.freeze({
95214
95529
  form: "single",
95215
95530
  optional: false
95216
95531
  }],
95532
+ "coreBlocks.proposeRunningThreshold": [{
95533
+ name: "deviceId",
95534
+ form: "single",
95535
+ optional: false
95536
+ }],
95217
95537
  "cover.close": [{
95218
95538
  name: "deviceId",
95219
95539
  form: "single",
@@ -96065,6 +96385,16 @@ Object.freeze({
96065
96385
  form: "single",
96066
96386
  optional: true
96067
96387
  }],
96388
+ "mediaPlayer.channelDown": [{
96389
+ name: "deviceId",
96390
+ form: "single",
96391
+ optional: false
96392
+ }],
96393
+ "mediaPlayer.channelUp": [{
96394
+ name: "deviceId",
96395
+ form: "single",
96396
+ optional: false
96397
+ }],
96068
96398
  "mediaPlayer.getStatus": [{
96069
96399
  name: "deviceId",
96070
96400
  form: "single",
@@ -96130,6 +96460,26 @@ Object.freeze({
96130
96460
  form: "single",
96131
96461
  optional: false
96132
96462
  }],
96463
+ "mediaPlayer.turnOff": [{
96464
+ name: "deviceId",
96465
+ form: "single",
96466
+ optional: false
96467
+ }],
96468
+ "mediaPlayer.turnOn": [{
96469
+ name: "deviceId",
96470
+ form: "single",
96471
+ optional: false
96472
+ }],
96473
+ "mediaPlayer.volumeDown": [{
96474
+ name: "deviceId",
96475
+ form: "single",
96476
+ optional: false
96477
+ }],
96478
+ "mediaPlayer.volumeUp": [{
96479
+ name: "deviceId",
96480
+ form: "single",
96481
+ optional: false
96482
+ }],
96133
96483
  "meter.getStatus": [{
96134
96484
  name: "deviceId",
96135
96485
  form: "single",
@@ -97295,6 +97645,11 @@ Object.freeze({
97295
97645
  form: "single",
97296
97646
  optional: true
97297
97647
  }],
97648
+ "remote.getAssumedStatus": [{
97649
+ name: "deviceId",
97650
+ form: "single",
97651
+ optional: false
97652
+ }],
97298
97653
  "remote.getConfig": [{
97299
97654
  name: "deviceId",
97300
97655
  form: "single",
@@ -97939,99 +98294,6 @@ var BucketAccumulator = class {
97939
98294
  return n;
97940
98295
  }
97941
98296
  };
97942
- /**
97943
- * A saved Customize assignment (D936). The schema is the type: callers use
97944
- * `z.infer`, they do not restate the shape.
97945
- */
97946
- var OverrideSourceSchema = object({
97947
- addonId: string().min(1),
97948
- stableId: string().min(1),
97949
- cap: string().min(1),
97950
- fieldPath: string().min(1)
97951
- });
97952
- var CustomizeTransformDraftSchema = discriminatedUnion("kind", [
97953
- object({ kind: literal("identity") }),
97954
- object({ kind: literal("invert") }),
97955
- object({
97956
- kind: literal("threshold"),
97957
- comparison: _enum(["gte", "lte"]),
97958
- threshold: number(),
97959
- startDwellMs: number().nonnegative(),
97960
- stopDwellMs: number().nonnegative()
97961
- }),
97962
- object({
97963
- kind: literal("linear"),
97964
- scale: number(),
97965
- offset: number(),
97966
- clampMin: number().optional(),
97967
- clampMax: number().optional()
97968
- }),
97969
- object({
97970
- kind: literal("enum-map"),
97971
- mapping: record(string(), string().nullable())
97972
- }),
97973
- object({ kind: literal("number") })
97974
- ]);
97975
- var ScalarOverrideDraftSchema = object({
97976
- kind: literal("scalar"),
97977
- cap: string().min(1),
97978
- targetId: string().min(1),
97979
- source: OverrideSourceSchema,
97980
- transform: CustomizeTransformDraftSchema
97981
- });
97982
- var KeyedArrayOverrideDraftSchema = object({
97983
- kind: literal("keyedArray"),
97984
- cap: string().min(1),
97985
- targetId: string().min(1),
97986
- key: string().min(1),
97987
- label: string().min(1),
97988
- fieldPath: string().min(1),
97989
- source: OverrideSourceSchema,
97990
- transform: CustomizeTransformDraftSchema
97991
- });
97992
- var PulseOverrideDraftSchema = object({
97993
- kind: literal("pulse"),
97994
- cap: string().min(1),
97995
- targetId: string().min(1),
97996
- enabled: boolean(),
97997
- debounceMs: number().nonnegative(),
97998
- edges: array(_enum([
97999
- "rising",
98000
- "button",
98001
- "native-event"
98002
- ])).min(1).optional(),
98003
- sources: array(OverrideSourceSchema).min(1)
98004
- });
98005
- var SpanSourceDraftSchema = OverrideSourceSchema.extend({ mode: _enum([
98006
- "in-addition",
98007
- "confirm",
98008
- "replace"
98009
- ]).optional() });
98010
- discriminatedUnion("kind", [
98011
- ScalarOverrideDraftSchema,
98012
- KeyedArrayOverrideDraftSchema,
98013
- PulseOverrideDraftSchema,
98014
- object({
98015
- kind: literal("span"),
98016
- cap: string().min(1),
98017
- targetId: string().min(1),
98018
- timeoutMs: number().nonnegative(),
98019
- cooldownMs: number().nonnegative().optional(),
98020
- sources: array(SpanSourceDraftSchema)
98021
- })
98022
- ]);
98023
- object({
98024
- targetId: string().min(1),
98025
- configured: boolean(),
98026
- source: _enum(["native", "assigned"]),
98027
- state: _enum([
98028
- "active",
98029
- "stale",
98030
- "released",
98031
- "unavailable"
98032
- ]),
98033
- reason: string().nullable()
98034
- });
98035
98297
  var G711_SCALE_CORRECTION_DB = {
98036
98298
  PCMU: 20 * Math.log10(4),
98037
98299
  PCMA: 20 * Math.log10(8)
@@ -100363,6 +100625,16 @@ var NC_TEMPLATE_VARS = [
100363
100625
  kinds: ["system"],
100364
100626
  systemEventKinds: [...COMBINED_ALARM]
100365
100627
  },
100628
+ {
100629
+ name: "changes",
100630
+ label: "Intrusion changes",
100631
+ example: "Laundry lock unlocked, Back door open",
100632
+ group: "system",
100633
+ families: ["rule"],
100634
+ fields: [...RULE_TEXT],
100635
+ kinds: ["system"],
100636
+ systemEventKinds: [...COMBINED_ALARM]
100637
+ },
100366
100638
  {
100367
100639
  name: "deviceId",
100368
100640
  label: "Device id",