@camstack/server 1.2.851 → 1.2.852

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 (89) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/package.json +16 -9
  3. package/system/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.js +1 -1
  4. package/system/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.mjs +1 -1
  5. package/system/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.js +1 -1
  6. package/system/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.mjs +1 -1
  7. package/system/dist/builtins/alerts/alerts.addon.js +1 -1
  8. package/system/dist/builtins/alerts/alerts.addon.mjs +1 -1
  9. package/system/dist/builtins/autotrack/index.js +1 -1
  10. package/system/dist/builtins/autotrack/index.mjs +1 -1
  11. package/system/dist/builtins/backup-orchestrator/backup-orchestrator.addon.js +2 -2
  12. package/system/dist/builtins/backup-orchestrator/backup-orchestrator.addon.mjs +2 -2
  13. package/system/dist/builtins/calendars/calendars.addon.js +1 -1
  14. package/system/dist/builtins/calendars/calendars.addon.mjs +1 -1
  15. package/system/dist/builtins/camera-grid/index.js +1 -1
  16. package/system/dist/builtins/camera-grid/index.mjs +1 -1
  17. package/system/dist/builtins/composer/composer.addon.js +4 -4
  18. package/system/dist/builtins/composer/composer.addon.mjs +4 -4
  19. package/system/dist/builtins/console-logging/index.js +1 -1
  20. package/system/dist/builtins/console-logging/index.mjs +1 -1
  21. package/system/dist/builtins/core-blocks/composition-sources.d.ts +2 -0
  22. package/system/dist/builtins/core-blocks/core-blocks.addon.js +15 -5
  23. package/system/dist/builtins/core-blocks/core-blocks.addon.mjs +15 -5
  24. package/system/dist/builtins/device-history/device-history.addon.js +2 -2
  25. package/system/dist/builtins/device-history/device-history.addon.mjs +2 -2
  26. package/system/dist/builtins/device-manager/device-manager.addon.js +2 -2
  27. package/system/dist/builtins/device-manager/device-manager.addon.mjs +2 -2
  28. package/system/dist/builtins/hub-forwarder/index.js +1 -1
  29. package/system/dist/builtins/hub-forwarder/index.mjs +1 -1
  30. package/system/dist/builtins/keychain/index.js +4 -4
  31. package/system/dist/builtins/keychain/index.mjs +4 -4
  32. package/system/dist/builtins/liveness-monitor/liveness-monitor.addon.js +1 -1
  33. package/system/dist/builtins/liveness-monitor/liveness-monitor.addon.mjs +1 -1
  34. package/system/dist/builtins/local-auth/local-auth.addon.js +2 -2
  35. package/system/dist/builtins/local-auth/local-auth.addon.mjs +2 -2
  36. package/system/dist/builtins/local-network/local-network.addon.js +3 -3
  37. package/system/dist/builtins/local-network/local-network.addon.mjs +3 -3
  38. package/system/dist/builtins/loki-logging/index.js +1 -1
  39. package/system/dist/builtins/loki-logging/index.mjs +1 -1
  40. package/system/dist/builtins/native-metrics/native-metrics.addon.js +1 -1
  41. package/system/dist/builtins/native-metrics/native-metrics.addon.mjs +1 -1
  42. package/system/dist/builtins/platform-probe/index.js +1 -1
  43. package/system/dist/builtins/platform-probe/index.mjs +1 -1
  44. package/system/dist/builtins/record-entries/index.js +1 -1
  45. package/system/dist/builtins/record-entries/index.mjs +1 -1
  46. package/system/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.js +1 -1
  47. package/system/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.mjs +1 -1
  48. package/system/dist/builtins/snapshot/index.js +1 -1
  49. package/system/dist/builtins/snapshot/index.mjs +1 -1
  50. package/system/dist/builtins/sqlite-storage/filesystem-storage.addon.js +1 -1
  51. package/system/dist/builtins/sqlite-storage/filesystem-storage.addon.mjs +1 -1
  52. package/system/dist/builtins/sqlite-storage/index.js +1 -1
  53. package/system/dist/builtins/sqlite-storage/index.mjs +1 -1
  54. package/system/dist/builtins/sqlite-storage/sqlite-settings.addon.js +3 -3
  55. package/system/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +3 -3
  56. package/system/dist/builtins/storage-orchestrator/storage-orchestrator.addon.js +1 -1
  57. package/system/dist/builtins/storage-orchestrator/storage-orchestrator.addon.mjs +1 -1
  58. package/system/dist/builtins/system-config/system-config.addon.js +12 -3
  59. package/system/dist/builtins/system-config/system-config.addon.mjs +12 -3
  60. package/system/dist/builtins/winston-logging/index.js +1 -1
  61. package/system/dist/builtins/winston-logging/index.mjs +1 -1
  62. package/system/dist/{capture-engine-Bshtl7Kd.mjs → capture-engine-DIFdnnDL.mjs} +1 -1
  63. package/system/dist/{capture-engine-BM9nGdvv.js → capture-engine-TBNa5CV-.js} +1 -1
  64. package/system/dist/{composition-sources-63HlIklt.js → composition-sources-Bi2EZImz.js} +2 -1
  65. package/system/dist/{composition-sources-CYpKKHtf.mjs → composition-sources-D0UJa_AU.mjs} +2 -1
  66. package/system/dist/{constants-lHbp6u7t.js → constants-Duw2_YIV.js} +1 -1
  67. package/system/dist/{constants-15k32igK.mjs → constants-JM88FVOx.mjs} +1 -1
  68. package/system/dist/{device-ca-BmKBCV_4.mjs → device-ca-B_xUPRFF.mjs} +1 -1
  69. package/system/dist/{device-ca-aB_rFHhZ.js → device-ca-BlweXw6w.js} +1 -1
  70. package/system/dist/{dist-DY7OGObz.mjs → dist-C2KTaXHT.mjs} +254 -135
  71. package/system/dist/{dist-DNDhIlAe.js → dist-CEgTDFFA.js} +265 -134
  72. package/system/dist/file-host-worker.js +1 -1
  73. package/system/dist/file-host-worker.mjs +1 -1
  74. package/system/dist/{hub-identity-BMz4OOYu.mjs → hub-identity-DCS1EU6B.mjs} +1 -1
  75. package/system/dist/{hub-identity-dcbGnvVX.js → hub-identity-DOfYNOCc.js} +1 -1
  76. package/system/dist/{hub-mdns-ciao-BOecE4tm.mjs → hub-mdns-ciao-BjB-iim0.mjs} +2 -2
  77. package/system/dist/{hub-mdns-ciao-Y7YjcHQ4.js → hub-mdns-ciao-Dzug_qHK.js} +2 -2
  78. package/system/dist/index.js +8 -8
  79. package/system/dist/index.mjs +8 -8
  80. package/system/dist/kernel/moleculer/mesh-mtls/tls-tcp-transporter.d.ts +5 -0
  81. package/system/dist/{legacy-integration-rows-door-87W9dzLF.mjs → legacy-integration-rows-door--f2MPFmB.mjs} +1 -1
  82. package/system/dist/{legacy-integration-rows-door-BQKarbeM.js → legacy-integration-rows-door-BEBSqcfe.js} +1 -1
  83. package/system/dist/{rename-composition-block-p_8C4nY4.js → rename-composition-block-DjiX4Eq4.js} +1 -1
  84. package/system/dist/{rename-composition-block-DOzzdV9v.mjs → rename-composition-block-GL_gHhlg.mjs} +1 -1
  85. package/system/dist/{restore-archive-TpUr6_kg.mjs → restore-archive-DXFheF5h.mjs} +1 -1
  86. package/system/dist/{restore-archive-Bc-Xm8TB.js → restore-archive-kiReCKLQ.js} +1 -1
  87. package/system/dist/{wal-maintenance-CE7-afh9.mjs → wal-maintenance-SwjZc-98.mjs} +0 -0
  88. package/system/dist/{wal-maintenance-auHpWNP7.js → wal-maintenance-uYxKYhvI.js} +0 -0
  89. package/system/package.json +1 -1
@@ -812,7 +812,7 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
812
812
  return EventCategory;
813
813
  }({});
814
814
  //#endregion
815
- //#region ../types/dist/composed-stable-id-CPp3votu.mjs
815
+ //#region ../types/dist/composed-stable-id-iddnCQ51.mjs
816
816
  /**
817
817
  import { errMsg } from '@camstack/types'
818
818
  * Extract a human-readable message from an unknown error value.
@@ -1163,6 +1163,11 @@ var DeviceRole = /* @__PURE__ */ function(DeviceRole) {
1163
1163
  * with the switch's on/off only. Speed or oscillation appear only when the
1164
1164
  * device also has a fan cap (D1033). */
1165
1165
  DeviceRole["SwitchFan"] = "switch-fan";
1166
+ /** A relay driving an on/off-only lamp: drawn as a light (bulb and glow, no
1167
+ * slider), presented to the exports as a light with power only. Not a
1168
+ * `light` type: the provider owns the type, and a light implies brightness
1169
+ * or colour this relay lacks. */
1170
+ DeviceRole["SwitchLight"] = "switch-light";
1166
1171
  /** Air conditioner / split unit: cooling, fan speed, louvres. */
1167
1172
  DeviceRole["ClimateAc"] = "climate-ac";
1168
1173
  /** Room thermostat: a setpoint and a room temperature. The default. */
@@ -1252,7 +1257,7 @@ var DeviceRole = /* @__PURE__ */ function(DeviceRole) {
1252
1257
  */
1253
1258
  var COMPOSED_DEVICE_STABLE_ID_PREFIX = "composed-";
1254
1259
  //#endregion
1255
- //#region ../types/dist/sleep-DyIxjZZt.mjs
1260
+ //#region ../types/dist/sleep-BvVGLl30.mjs
1256
1261
  /**
1257
1262
  * The audio chunk plane's byte format, and the ONE expansion from a coded
1258
1263
  * window to float samples (D455).
@@ -6822,6 +6827,13 @@ var ACTUATOR_CAP_VOCABULARY = {
6822
6827
  },
6823
6828
  state: { on: { icon: "lightbulb" } }
6824
6829
  },
6830
+ [DeviceRole.SwitchLight]: {
6831
+ actions: {
6832
+ "switch.on": { icon: "lightbulb" },
6833
+ "switch.off": { icon: "lightbulb-off" }
6834
+ },
6835
+ state: { on: { icon: "lightbulb" } }
6836
+ },
6825
6837
  [DeviceRole.Chime]: { actions: {
6826
6838
  "switch.on": {
6827
6839
  label: t("Enable chime", "Attiva il campanello"),
@@ -13996,7 +14008,7 @@ function sleep(ms) {
13996
14008
  return new Promise((resolve) => setTimeout(resolve, Math.max(0, ms)));
13997
14009
  }
13998
14010
  //#endregion
13999
- //#region ../types/dist/implemented-methods-5YMDeE3f.mjs
14011
+ //#region ../types/dist/implemented-methods-CSTk6zYK.mjs
14000
14012
  var AUDIO_ENCODER_BY_CODEC = {
14001
14013
  opus: "libopus",
14002
14014
  aac: "aac",
@@ -14443,6 +14455,80 @@ function portable(target) {
14443
14455
  }
14444
14456
  portable("linux64"), portable("linuxarm64"), portable("macarm64"), portable("mac64"), `${BASE}${FFMPEG_RELEASE}`;
14445
14457
  /**
14458
+ * A device's KIND is its type plus its role (D1033): the type is the set of
14459
+ * controls it has, the role says which thing it is among the devices that
14460
+ * share those controls. A plug-in heater is a `switch` with role
14461
+ * `switch-heater`; an air conditioner and a radiator valve are both `climate`,
14462
+ * told apart by their `climate-*` role.
14463
+ */
14464
+ /**
14465
+ * Type values a persisted row may still carry after the type was retired, and
14466
+ * the type each one is read as. The row is rewritten by the next registration
14467
+ * of the device (its provider stamps the live type), so this is a read alias,
14468
+ * not a migration.
14469
+ *
14470
+ * `heater` is deliberately absent: the only heaters were composed devices the
14471
+ * operator deletes. Such a row stays an unknown type, which every reader
14472
+ * treats as a generic device.
14473
+ */
14474
+ var RETIRED_DEVICE_TYPES = { thermostat: DeviceType.Climate };
14475
+ /** The live type a stored `type` value stands for (itself unless retired). */
14476
+ function canonicalStoredDeviceType(stored) {
14477
+ return RETIRED_DEVICE_TYPES[stored] ?? stored;
14478
+ }
14479
+ zod.z.preprocess((value) => typeof value === "string" ? canonicalStoredDeviceType(value) : value, zod.z.enum(DeviceType));
14480
+ /** The `climate-*` roles, in the order the role picker lists them. */
14481
+ var CLIMATE_ROLES = [
14482
+ DeviceRole.ClimateThermostat,
14483
+ DeviceRole.ClimateAc,
14484
+ DeviceRole.ClimateRadiator,
14485
+ DeviceRole.ClimateFloor,
14486
+ DeviceRole.ClimateHeater,
14487
+ DeviceRole.ClimateHeatPumpCircuit
14488
+ ];
14489
+ function isClimateRole(role) {
14490
+ return CLIMATE_ROLES.some((candidate) => candidate === role);
14491
+ }
14492
+ /**
14493
+ * Which climate device this is. A climate device with no role, or a role that
14494
+ * is not a climate one, is a room thermostat: that is what most of them are,
14495
+ * and it is the presentation a thermostat had before the types were folded.
14496
+ */
14497
+ function climateRoleOf(role) {
14498
+ return role !== null && role !== void 0 && isClimateRole(role) ? role : DeviceRole.ClimateThermostat;
14499
+ }
14500
+ /** An air conditioner: exports present it as an AC unit, not a thermostat. */
14501
+ function isAirConditioner(type, role) {
14502
+ return type === DeviceType.Climate && climateRoleOf(role) === DeviceRole.ClimateAc;
14503
+ }
14504
+ /**
14505
+ * A relay driving an on/off-only lamp (a `switch` with role `switch-light`):
14506
+ * drawn and exported as a light, with the switch's power only. The one place
14507
+ * that reads the role for it — a consumer asks this, never the role string.
14508
+ */
14509
+ function isSwitchLight(type, role) {
14510
+ return type === DeviceType.Switch && role === DeviceRole.SwitchLight;
14511
+ }
14512
+ /**
14513
+ * Is a capability offered on a device of this type and role?
14514
+ *
14515
+ * Fails open where the old type-only gate did: no `deviceTypes` (or an empty
14516
+ * list) applies to every device, and an unknown type never filters (a failed
14517
+ * meta read must not destroy work, D49). A type the cap's `deviceRoles` names
14518
+ * is offered only to the roles listed there; an unknown role is NOT one of
14519
+ * them, so a `switch` whose role could not be read is not a heater.
14520
+ */
14521
+ function capAppliesToDeviceKind(gate, deviceType, role) {
14522
+ if (deviceType === void 0) return true;
14523
+ const types = gate?.deviceTypes;
14524
+ if (!types || types.length === 0) return true;
14525
+ const type = types.find((candidate) => candidate === deviceType);
14526
+ if (type === void 0) return false;
14527
+ const roles = gate?.deviceRoles?.[type];
14528
+ if (roles === void 0) return true;
14529
+ return role !== null && role !== void 0 && roles.some((candidate) => candidate === role);
14530
+ }
14531
+ /**
14446
14532
  * THE table "which boolean of this device type counts as HIGH", and the
14447
14533
  * pure evaluator of its EDGE.
14448
14534
  *
@@ -16596,6 +16682,41 @@ var CompositionNewTargetSchema = zod.z.object({
16596
16682
  type: zod.z.enum(DeviceType),
16597
16683
  role: zod.z.enum(DeviceRole).optional()
16598
16684
  });
16685
+ /**
16686
+ * A STORED block, read back: the `new` target of its composition may name a
16687
+ * device type D1033 retired (`thermostat`). {@link CompositionNewTargetSchema}
16688
+ * stays a strict enum on the wire, so the store rewrites the retired name to
16689
+ * its canonical type (`source.composition.target.type`) before it parses the
16690
+ * row. Anything else is returned untouched, for the schema to judge.
16691
+ */
16692
+ function canonicalStoredBlockTarget(block) {
16693
+ if (!isPlainObject(block)) return block;
16694
+ const source = Reflect.get(block, "source");
16695
+ if (!isPlainObject(source)) return block;
16696
+ const composition = Reflect.get(source, "composition");
16697
+ if (!isPlainObject(composition)) return block;
16698
+ const target = Reflect.get(composition, "target");
16699
+ if (!isPlainObject(target)) return block;
16700
+ const type = Reflect.get(target, "type");
16701
+ if (typeof type !== "string") return block;
16702
+ const canonical = {
16703
+ ...target,
16704
+ type: canonicalStoredDeviceType(type)
16705
+ };
16706
+ return {
16707
+ ...block,
16708
+ source: {
16709
+ ...source,
16710
+ composition: {
16711
+ ...composition,
16712
+ target: canonical
16713
+ }
16714
+ }
16715
+ };
16716
+ }
16717
+ function isPlainObject(value) {
16718
+ return value !== null && typeof value === "object" && !Array.isArray(value);
16719
+ }
16599
16720
  /** Customize an EXISTING device: each feature adds a capability or replaces fields of a native one (D663). */
16600
16721
  var CompositionExistingTargetSchema = zod.z.object({
16601
16722
  kind: zod.z.literal("existing"),
@@ -22167,7 +22288,7 @@ var DeviceTokenScopeSchema = zod.z.object({
22167
22288
  function migrateLegacyTokenScope(raw) {
22168
22289
  if (raw === null || typeof raw !== "object" || Array.isArray(raw)) return raw;
22169
22290
  if (Reflect.get(raw, "type") !== "device") return raw;
22170
- if (Reflect.get(raw, "selector") !== void 0) return raw;
22291
+ if (Reflect.get(raw, "selector") !== void 0) return canonicalSelectorTypes(raw);
22171
22292
  const targets = Reflect.get(raw, "targets");
22172
22293
  if (!Array.isArray(targets)) return raw;
22173
22294
  return {
@@ -22179,6 +22300,27 @@ function migrateLegacyTokenScope(raw) {
22179
22300
  access: Reflect.get(raw, "access")
22180
22301
  };
22181
22302
  }
22303
+ /**
22304
+ * A stored `types` selector may name a type D1033 retired (`thermostat`). The
22305
+ * grant is read back through this same preprocess, so the retired name is
22306
+ * rewritten to its canonical type here and {@link DeviceSelectorSchema} itself
22307
+ * stays a strict enum on the wire.
22308
+ */
22309
+ function canonicalSelectorTypes(raw) {
22310
+ const selector = Reflect.get(raw, "selector");
22311
+ if (selector === null || typeof selector !== "object") return raw;
22312
+ if (Reflect.get(selector, "kind") !== "types") return raw;
22313
+ const types = Reflect.get(selector, "types");
22314
+ if (!Array.isArray(types)) return raw;
22315
+ const canonical = types.map((t) => typeof t === "string" ? canonicalStoredDeviceType(t) : t);
22316
+ return {
22317
+ ...raw,
22318
+ selector: {
22319
+ ...selector,
22320
+ types: canonical
22321
+ }
22322
+ };
22323
+ }
22182
22324
  var TokenScopeSchema = zod.z.preprocess(migrateLegacyTokenScope, zod.z.discriminatedUnion("type", [
22183
22325
  zod.z.object({
22184
22326
  type: zod.z.literal("category"),
@@ -42546,6 +42688,36 @@ var ActionTargetSchema = zod.z.discriminatedUnion("kind", [
42546
42688
  name: zod.z.string().min(1)
42547
42689
  })
42548
42690
  ]);
42691
+ /**
42692
+ * A STORED list of steps, read back: a `domain` target may name a device type
42693
+ * D1033 retired (`thermostat`). The step schema stays a strict enum on the
42694
+ * wire, so the store rewrites the retired name to its canonical type before
42695
+ * it parses the row — on the step and on each step of its `else` list. Any
42696
+ * other value is returned untouched, for the schema to judge.
42697
+ */
42698
+ function canonicalStoredStepTargets(steps) {
42699
+ if (!Array.isArray(steps)) return steps;
42700
+ return steps.map(canonicalStoredStep);
42701
+ }
42702
+ function canonicalStoredStep(step) {
42703
+ if (step === null || typeof step !== "object" || Array.isArray(step)) return step;
42704
+ const target = Reflect.get(step, "target");
42705
+ const elseSteps = Reflect.get(step, "else");
42706
+ return {
42707
+ ...step,
42708
+ ...target === void 0 ? {} : { target: canonicalStoredTarget(target) },
42709
+ ...elseSteps === void 0 ? {} : { else: canonicalStoredStepTargets(elseSteps) }
42710
+ };
42711
+ }
42712
+ function canonicalStoredTarget(target) {
42713
+ if (target === null || typeof target !== "object" || Array.isArray(target)) return target;
42714
+ const deviceType = Reflect.get(target, "deviceType");
42715
+ if (typeof deviceType !== "string") return target;
42716
+ return {
42717
+ ...target,
42718
+ deviceType: canonicalStoredDeviceType(deviceType)
42719
+ };
42720
+ }
42549
42721
  /** The events after which a cached domain is stale. */
42550
42722
  var ACTION_TARGET_INVALIDATION_EVENTS = [
42551
42723
  EventCategory.DeviceRegistered,
@@ -56554,68 +56726,6 @@ var BY_ID = new Map(GROUP_TEMPLATES.map((template) => [template.id, template]));
56554
56726
  function groupTemplate(id) {
56555
56727
  return BY_ID.get(id) ?? null;
56556
56728
  }
56557
- var COLOR_MODE_FEATURES = [
56558
- DeviceFeature.LightColorRgb,
56559
- DeviceFeature.LightColorHsv,
56560
- DeviceFeature.LightColorMired
56561
- ];
56562
- /** `at-least-one` is any included member on; `all` is every included member on. */
56563
- function reducerForActive(active) {
56564
- return active === "all" ? "all" : "any";
56565
- }
56566
- /**
56567
- * Colour modes every member advertises. Offline does not remove a mode:
56568
- * the caller passes device features, not liveness. No members → no mode.
56569
- */
56570
- function sharedColorModes(memberFeatures) {
56571
- if (memberFeatures.length === 0) return [];
56572
- return COLOR_MODE_FEATURES.filter((mode) => memberFeatures.every((features) => features.includes(mode)));
56573
- }
56574
- /**
56575
- * One call per member that binds `cap`. Offline members stay in the list.
56576
- * A member without the cap is not called — the command cannot reach it.
56577
- */
56578
- function fanOutTargets(members, cap, method, args) {
56579
- return members.flatMap((member) => member.caps.includes(cap) ? [{
56580
- deviceId: member.deviceId,
56581
- cap,
56582
- method,
56583
- args: { ...args }
56584
- }] : []);
56585
- }
56586
- /**
56587
- * Run every call. A throw is that member's result; the other calls still run.
56588
- * At most {@link FAN_OUT_CONCURRENCY} are in flight.
56589
- */
56590
- async function runFanOut(calls, invoke) {
56591
- const results = [];
56592
- let next = 0;
56593
- const worker = async () => {
56594
- for (;;) {
56595
- const index = next;
56596
- next += 1;
56597
- const call = calls[index];
56598
- if (call === void 0) return;
56599
- try {
56600
- await invoke(call);
56601
- results[index] = {
56602
- deviceId: call.deviceId,
56603
- ok: true
56604
- };
56605
- } catch (err) {
56606
- const error = err instanceof Error ? err.message : String(err);
56607
- results[index] = {
56608
- deviceId: call.deviceId,
56609
- ok: false,
56610
- error
56611
- };
56612
- }
56613
- }
56614
- };
56615
- const width = Math.min(4, calls.length);
56616
- await Promise.all(Array.from({ length: width }, () => worker()));
56617
- return results;
56618
- }
56619
56729
  /**
56620
56730
  * Cap history catalog, projected from every `*.cap.ts` `history` block.
56621
56731
  * 44 caps with series (89 series), 36 caps answered `'none'`.
@@ -57100,6 +57210,74 @@ var HISTORY_ITEM_CATALOG = {
57100
57210
  function historyFieldsFor(capName) {
57101
57211
  return HISTORY_CATALOG[capName] ?? {};
57102
57212
  }
57213
+ /** `sourcePickAcceptsDevice` over a bare list of member types. */
57214
+ function memberKindAccepted(allowed, deviceType, role) {
57215
+ if (allowed.length === 0) return true;
57216
+ if (allowed.some((type) => type === deviceType)) return true;
57217
+ return isSwitchLight(deviceType, role) && allowed.includes(DeviceType.Light);
57218
+ }
57219
+ var COLOR_MODE_FEATURES = [
57220
+ DeviceFeature.LightColorRgb,
57221
+ DeviceFeature.LightColorHsv,
57222
+ DeviceFeature.LightColorMired
57223
+ ];
57224
+ /** `at-least-one` is any included member on; `all` is every included member on. */
57225
+ function reducerForActive(active) {
57226
+ return active === "all" ? "all" : "any";
57227
+ }
57228
+ /**
57229
+ * Colour modes every member advertises. Offline does not remove a mode:
57230
+ * the caller passes device features, not liveness. No members → no mode.
57231
+ */
57232
+ function sharedColorModes(memberFeatures) {
57233
+ if (memberFeatures.length === 0) return [];
57234
+ return COLOR_MODE_FEATURES.filter((mode) => memberFeatures.every((features) => features.includes(mode)));
57235
+ }
57236
+ /**
57237
+ * One call per member that binds `cap`. Offline members stay in the list.
57238
+ * A member without the cap is not called — the command cannot reach it.
57239
+ */
57240
+ function fanOutTargets(members, cap, method, args) {
57241
+ return members.flatMap((member) => member.caps.includes(cap) ? [{
57242
+ deviceId: member.deviceId,
57243
+ cap,
57244
+ method,
57245
+ args: { ...args }
57246
+ }] : []);
57247
+ }
57248
+ /**
57249
+ * Run every call. A throw is that member's result; the other calls still run.
57250
+ * At most {@link FAN_OUT_CONCURRENCY} are in flight.
57251
+ */
57252
+ async function runFanOut(calls, invoke) {
57253
+ const results = [];
57254
+ let next = 0;
57255
+ const worker = async () => {
57256
+ for (;;) {
57257
+ const index = next;
57258
+ next += 1;
57259
+ const call = calls[index];
57260
+ if (call === void 0) return;
57261
+ try {
57262
+ await invoke(call);
57263
+ results[index] = {
57264
+ deviceId: call.deviceId,
57265
+ ok: true
57266
+ };
57267
+ } catch (err) {
57268
+ const error = err instanceof Error ? err.message : String(err);
57269
+ results[index] = {
57270
+ deviceId: call.deviceId,
57271
+ ok: false,
57272
+ error
57273
+ };
57274
+ }
57275
+ }
57276
+ };
57277
+ const width = Math.min(4, calls.length);
57278
+ await Promise.all(Array.from({ length: width }, () => worker()));
57279
+ return results;
57280
+ }
57103
57281
  /**
57104
57282
  * Project a statistics or integral helper onto a new device (D944 §3).
57105
57283
  * The value field is `series`: the composer fills it from history.
@@ -57601,8 +57779,10 @@ function deviceTypeProblems(spec, facts) {
57601
57779
  const template = groupTemplate(spec.templateId);
57602
57780
  if (template === null) return [];
57603
57781
  return spec.members.flatMap((member, index) => {
57604
- const deviceType = facts.get(compositionSourceKey(member.source))?.deviceType;
57605
- if (deviceType === void 0 || template.memberDeviceTypes.includes(deviceType)) return [];
57782
+ const fact = facts.get(compositionSourceKey(member.source));
57783
+ const deviceType = fact?.deviceType;
57784
+ if (deviceType === void 0) return [];
57785
+ if (memberKindAccepted(template.memberDeviceTypes, deviceType, fact?.role)) return [];
57606
57786
  return [problem("member-constraint", `helper.members[${index}]`, `a ${template.id} group takes ${template.memberDeviceTypes.join(" or ")} devices; this member is a ${deviceType}`)];
57607
57787
  });
57608
57788
  }
@@ -58409,6 +58589,7 @@ function validateComposition(composition, ctx) {
58409
58589
  });
58410
58590
  const facts = new Map([...ctx.sources].flatMap(([key, source]) => source.kind === "found" ? [[key, {
58411
58591
  deviceType: source.deviceType,
58592
+ role: source.role,
58412
58593
  quantity: source.quantity
58413
58594
  }]] : []));
58414
58595
  const problems = [
@@ -66885,6 +67066,7 @@ var HERO_SCENE_BY_ROLE = {
66885
67066
  [DeviceRole.Outlet]: "plug",
66886
67067
  [DeviceRole.SwitchHeater]: "heater",
66887
67068
  [DeviceRole.SwitchFan]: "fan",
67069
+ [DeviceRole.SwitchLight]: "light",
66888
67070
  [DeviceRole.ClimateAc]: "ac",
66889
67071
  [DeviceRole.ClimateThermostat]: "inherit",
66890
67072
  [DeviceRole.ClimateFloor]: "inherit",
@@ -101358,71 +101540,6 @@ var DeclaredDevices = class {
101358
101540
  return removed;
101359
101541
  }
101360
101542
  };
101361
- /**
101362
- * A device's KIND is its type plus its role (D1033): the type is the set of
101363
- * controls it has, the role says which thing it is among the devices that
101364
- * share those controls. A plug-in heater is a `switch` with role
101365
- * `switch-heater`; an air conditioner and a radiator valve are both `climate`,
101366
- * told apart by their `climate-*` role.
101367
- */
101368
- /**
101369
- * Type values a persisted row may still carry after the type was retired, and
101370
- * the type each one is read as. The row is rewritten by the next registration
101371
- * of the device (its provider stamps the live type), so this is a read alias,
101372
- * not a migration.
101373
- *
101374
- * `heater` is deliberately absent: the only heaters were composed devices the
101375
- * operator deletes. Such a row stays an unknown type, which every reader
101376
- * treats as a generic device.
101377
- */
101378
- var RETIRED_DEVICE_TYPES = { thermostat: DeviceType.Climate };
101379
- /** The live type a stored `type` value stands for (itself unless retired). */
101380
- function canonicalStoredDeviceType(stored) {
101381
- return RETIRED_DEVICE_TYPES[stored] ?? stored;
101382
- }
101383
- /** The `climate-*` roles, in the order the role picker lists them. */
101384
- var CLIMATE_ROLES = [
101385
- DeviceRole.ClimateThermostat,
101386
- DeviceRole.ClimateAc,
101387
- DeviceRole.ClimateRadiator,
101388
- DeviceRole.ClimateFloor,
101389
- DeviceRole.ClimateHeater,
101390
- DeviceRole.ClimateHeatPumpCircuit
101391
- ];
101392
- function isClimateRole(role) {
101393
- return CLIMATE_ROLES.some((candidate) => candidate === role);
101394
- }
101395
- /**
101396
- * Which climate device this is. A climate device with no role, or a role that
101397
- * is not a climate one, is a room thermostat: that is what most of them are,
101398
- * and it is the presentation a thermostat had before the types were folded.
101399
- */
101400
- function climateRoleOf(role) {
101401
- return role !== null && role !== void 0 && isClimateRole(role) ? role : DeviceRole.ClimateThermostat;
101402
- }
101403
- /** An air conditioner: exports present it as an AC unit, not a thermostat. */
101404
- function isAirConditioner(type, role) {
101405
- return type === DeviceType.Climate && climateRoleOf(role) === DeviceRole.ClimateAc;
101406
- }
101407
- /**
101408
- * Is a capability offered on a device of this type and role?
101409
- *
101410
- * Fails open where the old type-only gate did: no `deviceTypes` (or an empty
101411
- * list) applies to every device, and an unknown type never filters (a failed
101412
- * meta read must not destroy work, D49). A type the cap's `deviceRoles` names
101413
- * is offered only to the roles listed there; an unknown role is NOT one of
101414
- * them, so a `switch` whose role could not be read is not a heater.
101415
- */
101416
- function capAppliesToDeviceKind(gate, deviceType, role) {
101417
- if (deviceType === void 0) return true;
101418
- const types = gate?.deviceTypes;
101419
- if (!types || types.length === 0) return true;
101420
- const type = types.find((candidate) => candidate === deviceType);
101421
- if (type === void 0) return false;
101422
- const roles = gate?.deviceRoles?.[type];
101423
- if (roles === void 0) return true;
101424
- return role !== null && role !== void 0 && roles.some((candidate) => candidate === role);
101425
- }
101426
101543
  DeviceType.Cover, DeviceType.Valve, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.HeatPump, DeviceType.Camera, DeviceType.Hub, DeviceType.Switch, DeviceType.Siren, DeviceType.Light, DeviceType.Fan, DeviceType.Sensor, DeviceType.Climate, DeviceType.Button, DeviceType.EventEmitter, DeviceType.Update, DeviceType.Generic, DeviceType.Notifier, DeviceType.Script, DeviceType.Automation, DeviceType.Lock, 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.Dryer, DeviceType.Gateway;
101427
101544
  new Set(Object.values(DeviceType));
101428
101545
  /** True when a value is a navigable node: a plain object OR a tRPC v11 client
@@ -104326,7 +104443,8 @@ function isDeviceType$1(type) {
104326
104443
  /** The layout of a type; a type this build does not know gets the default. */
104327
104444
  function resolveHeroLayout(type, role = null) {
104328
104445
  if (type === DeviceType.Switch && role === DeviceRole.SwitchHeater) return HEATER_LAYOUT;
104329
- return isDeviceType$1(type) ? HERO_LAYOUT_BY_TYPE[type] : HERO_LAYOUT_DEFAULT;
104446
+ const live = canonicalStoredDeviceType(type);
104447
+ return isDeviceType$1(live) ? HERO_LAYOUT_BY_TYPE[live] : HERO_LAYOUT_DEFAULT;
104330
104448
  }
104331
104449
  /**
104332
104450
  * Who looks like what (D1023). One look per {@link DeviceType}, refined by a
@@ -105066,6 +105184,7 @@ var HERO_LOOK_BY_ROLE = {
105066
105184
  [DeviceRole.Outlet]: "inherit",
105067
105185
  [DeviceRole.SwitchHeater]: HEATER_LOOK,
105068
105186
  [DeviceRole.SwitchFan]: FAN_LOOK,
105187
+ [DeviceRole.SwitchLight]: LIGHT_LOOK,
105069
105188
  [DeviceRole.ClimateAc]: "inherit",
105070
105189
  [DeviceRole.ClimateThermostat]: "inherit",
105071
105190
  [DeviceRole.ClimateFloor]: "inherit",
@@ -122667,12 +122786,24 @@ Object.defineProperty(exports, "canonicalIconKey", {
122667
122786
  return canonicalIconKey;
122668
122787
  }
122669
122788
  });
122789
+ Object.defineProperty(exports, "canonicalStoredBlockTarget", {
122790
+ enumerable: true,
122791
+ get: function() {
122792
+ return canonicalStoredBlockTarget;
122793
+ }
122794
+ });
122670
122795
  Object.defineProperty(exports, "canonicalStoredDeviceType", {
122671
122796
  enumerable: true,
122672
122797
  get: function() {
122673
122798
  return canonicalStoredDeviceType;
122674
122799
  }
122675
122800
  });
122801
+ Object.defineProperty(exports, "canonicalStoredStepTargets", {
122802
+ enumerable: true,
122803
+ get: function() {
122804
+ return canonicalStoredStepTargets;
122805
+ }
122806
+ });
122676
122807
  Object.defineProperty(exports, "capAppliesToDeviceKind", {
122677
122808
  enumerable: true,
122678
122809
  get: function() {
@@ -1,5 +1,5 @@
1
1
  require("./chunk-Cek0wNdY.js");
2
- const require_wal_maintenance = require("./wal-maintenance-auHpWNP7.js");
2
+ const require_wal_maintenance = require("./wal-maintenance-uYxKYhvI.js");
3
3
  let node_worker_threads = require("node:worker_threads");
4
4
  //#region src/builtins/sqlite-storage/file-host-worker.ts
5
5
  /**
@@ -1,4 +1,4 @@
1
- import { A as callRecords, C as isFileHostWorkerData, D as RecordsEngine, M as controlTargetOf, O as callControl, S as isFileHostRequest, a as WalMaintenance, b as collectTransferables, d as callMigrate, f as migrateTargetOf, j as callVector, k as callData, l as SqliteSettingsBackend, o as createVectorIndex, s as vectorProviderOf, u as HUB_MIGRATIONS, v as serializeError, w as trustInput } from "./wal-maintenance-CE7-afh9.mjs";
1
+ import { A as callRecords, C as isFileHostWorkerData, D as RecordsEngine, M as controlTargetOf, O as callControl, S as isFileHostRequest, a as WalMaintenance, b as collectTransferables, d as callMigrate, f as migrateTargetOf, j as callVector, k as callData, l as SqliteSettingsBackend, o as createVectorIndex, s as vectorProviderOf, u as HUB_MIGRATIONS, v as serializeError, w as trustInput } from "./wal-maintenance-SwjZc-98.mjs";
2
2
  import { parentPort, threadId, workerData } from "node:worker_threads";
3
3
  //#region src/builtins/sqlite-storage/file-host-worker.ts
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { wc as defineRecordKinds } from "./dist-DY7OGObz.mjs";
1
+ import { Ec as defineRecordKinds } from "./dist-C2KTaXHT.mjs";
2
2
  import { C as backdatedNotBefore, S as withUtcTimeEncoding, _ as NameConstraints, a as KeyUsageFlags, c as Pkcs10CertificateRequest, d as SubjectKeyIdentifierExtension, f as X509Certificate$1, g as GeneralSubtrees, h as GeneralSubtree, i as Extension, l as Pkcs10CertificateRequestGenerator, m as cryptoProvider, n as BasicConstraintsExtension, o as KeyUsagesExtension, p as X509CertificateGenerator, r as ExtendedKeyUsageExtension, s as PemConverter, t as AuthorityKeyIdentifierExtension, u as SubjectAlternativeNameExtension, v as GeneralName, x as AsnConvert } from "./x509.es-BRiJgOvu.mjs";
3
3
  import { z } from "zod";
4
4
  import { X509Certificate, createHash, createPrivateKey, randomBytes, webcrypto } from "node:crypto";
@@ -1,5 +1,5 @@
1
1
  const require_chunk = require("./chunk-Cek0wNdY.js");
2
- const require_dist = require("./dist-DNDhIlAe.js");
2
+ const require_dist = require("./dist-CEgTDFFA.js");
3
3
  const require_x509_es = require("./x509.es-WtnRNyYS.js");
4
4
  let zod = require("zod");
5
5
  let node_crypto = require("node:crypto");
@@ -1,7 +1,7 @@
1
1
  import { o as __toESM } from "./chunk-CNf5ZN-e.mjs";
2
- import { ml as userError } from "./dist-DY7OGObz.mjs";
2
+ import { gl as userError } from "./dist-C2KTaXHT.mjs";
3
3
  import { f as X509Certificate$1 } from "./x509.es-BRiJgOvu.mjs";
4
- import { A as evaluateExistingCert, C as localCaCommonName, F as isConstrainedCa, L as permitsIdentity, S as loadCa, b as generateCa, j as reasonRequiresNewCa, w as collectCertIdentity, x as issueLeaf, z as readNameConstraints } from "./hub-identity-BMz4OOYu.mjs";
4
+ import { A as evaluateExistingCert, C as localCaCommonName, F as isConstrainedCa, L as permitsIdentity, S as loadCa, b as generateCa, j as reasonRequiresNewCa, w as collectCertIdentity, x as issueLeaf, z as readNameConstraints } from "./hub-identity-DCS1EU6B.mjs";
5
5
  import { X509Certificate, createPrivateKey } from "node:crypto";
6
6
  import { writeOwnerOnlyFileSync } from "@camstack/types/node";
7
7
  import { copyFileSync, existsSync, mkdirSync, readFileSync, renameSync, rmSync, writeFileSync } from "node:fs";
@@ -1,7 +1,7 @@
1
1
  const require_chunk = require("./chunk-Cek0wNdY.js");
2
- const require_dist = require("./dist-DNDhIlAe.js");
2
+ const require_dist = require("./dist-CEgTDFFA.js");
3
3
  const require_x509_es = require("./x509.es-WtnRNyYS.js");
4
- const require_hub_identity = require("./hub-identity-dcbGnvVX.js");
4
+ const require_hub_identity = require("./hub-identity-DOfYNOCc.js");
5
5
  let node_crypto = require("node:crypto");
6
6
  let _camstack_types_node = require("@camstack/types/node");
7
7
  let node_fs = require("node:fs");
@@ -1,7 +1,7 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_chunk = require("./chunk-Cek0wNdY.js");
3
- const require_dist = require("./dist-DNDhIlAe.js");
4
- const require_device_ca = require("./device-ca-aB_rFHhZ.js");
3
+ const require_dist = require("./dist-CEgTDFFA.js");
4
+ const require_device_ca = require("./device-ca-BlweXw6w.js");
5
5
  const require_read_all_rows$1 = require("./read-all-rows-CVoO1ONM.js");
6
6
  const require_log_redactor = require("./log-redactor-BhIEMaG9.js");
7
7
  const require_builtins_alerts_alerts_addon = require("./builtins/alerts/alerts.addon.js");
@@ -28,22 +28,22 @@ const require_builtins_loki_logging_index = require("./builtins/loki-logging/ind
28
28
  const require_builtins_native_metrics_native_metrics_addon = require("./builtins/native-metrics/native-metrics.addon.js");
29
29
  const require_builtins_device_history_device_history_addon = require("./builtins/device-history/device-history.addon.js");
30
30
  const require_builtins_sqlite_storage_filesystem_storage_addon = require("./builtins/sqlite-storage/filesystem-storage.addon.js");
31
- const require_wal_maintenance = require("./wal-maintenance-auHpWNP7.js");
32
- const require_legacy_integration_rows_door = require("./legacy-integration-rows-door-BQKarbeM.js");
31
+ const require_wal_maintenance = require("./wal-maintenance-uYxKYhvI.js");
32
+ const require_legacy_integration_rows_door = require("./legacy-integration-rows-door-BEBSqcfe.js");
33
33
  const require_builtins_sqlite_storage_sqlite_settings_addon = require("./builtins/sqlite-storage/sqlite-settings.addon.js");
34
34
  const require_builtins_sqlite_storage_index = require("./builtins/sqlite-storage/index.js");
35
35
  const require_builtins_storage_orchestrator_storage_orchestrator_addon = require("./builtins/storage-orchestrator/storage-orchestrator.addon.js");
36
36
  require("./builtins/storage-orchestrator/index.js");
37
- const require_hub_identity = require("./hub-identity-dcbGnvVX.js");
38
- const require_constants = require("./constants-lHbp6u7t.js");
37
+ const require_hub_identity = require("./hub-identity-DOfYNOCc.js");
38
+ const require_constants = require("./constants-Duw2_YIV.js");
39
39
  const require_builtins_system_config_system_config_addon = require("./builtins/system-config/system-config.addon.js");
40
40
  require("./builtins/system-config/index.js");
41
41
  const require_builtins_winston_logging_index = require("./builtins/winston-logging/index.js");
42
42
  const require_custom_action_registry = require("./custom-action-registry-CmWpSeMS.js");
43
- const require_hub_mdns_ciao = require("./hub-mdns-ciao-Y7YjcHQ4.js");
43
+ const require_hub_mdns_ciao = require("./hub-mdns-ciao-Dzug_qHK.js");
44
44
  const require_platform_key_source = require("./platform-key-source-Di7HrlGR.js");
45
45
  const require_resource_monitor = require("./resource-monitor-mio9dSCT.js");
46
- const require_restore_archive = require("./restore-archive-Bc-Xm8TB.js");
46
+ const require_restore_archive = require("./restore-archive-kiReCKLQ.js");
47
47
  const require_coral_accelerators = require("./coral-accelerators-BSVsBVzt.js");
48
48
  let zod = require("zod");
49
49
  let node_crypto = require("node:crypto");