@camstack/server 1.2.812 → 1.2.813

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 (95) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/api/core/cap-providers.js +50 -343
  3. package/dist/api/trpc/generated-cap-routers.js +9 -0
  4. package/dist/core/addon/addon-registry.service.js +31 -1
  5. package/dist/core/addon/addon-settings-provider.js +7 -1
  6. package/dist/core/addon/instance-lifecycle.js +454 -0
  7. package/dist/core/addon/instance-links.service.js +22 -14
  8. package/dist/core/moleculer/moleculer.service.js +15 -1
  9. package/package.json +11 -10
  10. package/system/dist/{agent-https-a3mE4PW4.js → agent-https-D9QbrCJe.js} +1 -1
  11. package/system/dist/{agent-https-CyEBY3RB.mjs → agent-https-D9rppK7L.mjs} +1 -1
  12. package/system/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.js +1 -1
  13. package/system/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.mjs +1 -1
  14. package/system/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.js +1 -1
  15. package/system/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.mjs +1 -1
  16. package/system/dist/builtins/alerts/alerts.addon.js +1 -1
  17. package/system/dist/builtins/alerts/alerts.addon.mjs +1 -1
  18. package/system/dist/builtins/autotrack/index.js +1 -1
  19. package/system/dist/builtins/autotrack/index.mjs +1 -1
  20. package/system/dist/builtins/backup-orchestrator/backup-orchestrator.addon.js +2 -2
  21. package/system/dist/builtins/backup-orchestrator/backup-orchestrator.addon.mjs +2 -2
  22. package/system/dist/builtins/calendars/calendars.addon.js +1 -1
  23. package/system/dist/builtins/calendars/calendars.addon.mjs +1 -1
  24. package/system/dist/builtins/camera-grid/index.js +1 -1
  25. package/system/dist/builtins/camera-grid/index.mjs +1 -1
  26. package/system/dist/builtins/composer/composer.addon.js +3 -3
  27. package/system/dist/builtins/composer/composer.addon.mjs +3 -3
  28. package/system/dist/builtins/console-logging/index.js +1 -1
  29. package/system/dist/builtins/console-logging/index.mjs +1 -1
  30. package/system/dist/builtins/core-blocks/blocks-instances.d.ts +22 -0
  31. package/system/dist/builtins/core-blocks/core-blocks.addon.d.ts +2 -0
  32. package/system/dist/builtins/core-blocks/core-blocks.addon.js +87 -4
  33. package/system/dist/builtins/core-blocks/core-blocks.addon.mjs +77 -4
  34. package/system/dist/builtins/core-blocks/hero-layout-service.d.ts +7 -0
  35. package/system/dist/builtins/device-history/device-history.addon.js +2 -2
  36. package/system/dist/builtins/device-history/device-history.addon.mjs +2 -2
  37. package/system/dist/builtins/device-manager/device-manager.addon.js +1 -1
  38. package/system/dist/builtins/device-manager/device-manager.addon.mjs +1 -1
  39. package/system/dist/builtins/hub-forwarder/index.js +1 -1
  40. package/system/dist/builtins/hub-forwarder/index.mjs +1 -1
  41. package/system/dist/builtins/keychain/index.js +4 -4
  42. package/system/dist/builtins/keychain/index.mjs +4 -4
  43. package/system/dist/builtins/liveness-monitor/liveness-monitor.addon.js +1 -1
  44. package/system/dist/builtins/liveness-monitor/liveness-monitor.addon.mjs +1 -1
  45. package/system/dist/builtins/local-auth/local-auth.addon.js +2 -2
  46. package/system/dist/builtins/local-auth/local-auth.addon.mjs +2 -2
  47. package/system/dist/builtins/local-network/local-network.addon.js +2 -2
  48. package/system/dist/builtins/local-network/local-network.addon.mjs +2 -2
  49. package/system/dist/builtins/loki-logging/index.js +1 -1
  50. package/system/dist/builtins/loki-logging/index.mjs +1 -1
  51. package/system/dist/builtins/native-metrics/native-metrics.addon.js +1 -1
  52. package/system/dist/builtins/native-metrics/native-metrics.addon.mjs +1 -1
  53. package/system/dist/builtins/platform-probe/index.js +1 -1
  54. package/system/dist/builtins/platform-probe/index.mjs +1 -1
  55. package/system/dist/builtins/record-entries/index.js +1 -1
  56. package/system/dist/builtins/record-entries/index.mjs +1 -1
  57. package/system/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.js +1 -1
  58. package/system/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.mjs +1 -1
  59. package/system/dist/builtins/snapshot/index.js +1 -1
  60. package/system/dist/builtins/snapshot/index.mjs +1 -1
  61. package/system/dist/builtins/sqlite-storage/filesystem-storage.addon.js +1 -1
  62. package/system/dist/builtins/sqlite-storage/filesystem-storage.addon.mjs +1 -1
  63. package/system/dist/builtins/sqlite-storage/index.js +1 -1
  64. package/system/dist/builtins/sqlite-storage/index.mjs +1 -1
  65. package/system/dist/builtins/sqlite-storage/sqlite-settings.addon.js +3 -3
  66. package/system/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +3 -3
  67. package/system/dist/builtins/storage-orchestrator/storage-orchestrator.addon.js +1 -1
  68. package/system/dist/builtins/storage-orchestrator/storage-orchestrator.addon.mjs +1 -1
  69. package/system/dist/builtins/system-config/system-config.addon.js +3 -3
  70. package/system/dist/builtins/system-config/system-config.addon.mjs +284 -284
  71. package/system/dist/builtins/winston-logging/index.js +1 -1
  72. package/system/dist/builtins/winston-logging/index.mjs +1 -1
  73. package/system/dist/{capture-engine-ByF-6AFH.mjs → capture-engine-BI6Z09IS.mjs} +1 -1
  74. package/system/dist/{capture-engine-BO9mSlY-.js → capture-engine-Ba49uIhh.js} +1 -1
  75. package/system/dist/{composition-sources-AziMFo7T.mjs → composition-sources-BYhi_QpF.mjs} +1 -1
  76. package/system/dist/{composition-sources-BMJUPUh2.js → composition-sources-zbe-WMDR.js} +1 -1
  77. package/system/dist/{constants-CjRlgRlu.js → constants-Cz0UABmc.js} +1 -1
  78. package/system/dist/{constants-CTikgsC_.mjs → constants-ZS2PeV26.mjs} +1 -1
  79. package/system/dist/{device-ca-CNRlFqFC.mjs → device-ca-B0vxd075.mjs} +1 -1
  80. package/system/dist/{device-ca-Dxl6kVcJ.js → device-ca-BR52z--E.js} +1 -1
  81. package/system/dist/{dist-CkJnelZr.js → dist-Cjomt5bM.js} +526 -25
  82. package/system/dist/{dist-BPq13Y8j.mjs → dist-fY4FYIt2.mjs} +509 -26
  83. package/system/dist/file-host-worker.js +1 -1
  84. package/system/dist/file-host-worker.mjs +1 -1
  85. package/system/dist/{hub-mdns-ciao-Cx6yJBl9.js → hub-mdns-ciao-BIyx3H2u.js} +2 -2
  86. package/system/dist/{hub-mdns-ciao-CrjItezp.mjs → hub-mdns-ciao-CYUWFhn7.mjs} +2 -2
  87. package/system/dist/index.js +8 -8
  88. package/system/dist/index.mjs +8 -8
  89. package/system/dist/{legacy-integration-rows-door-CKM-LxvL.js → legacy-integration-rows-door-CoUG5oxu.js} +1 -1
  90. package/system/dist/{legacy-integration-rows-door-Dxcqwc-w.mjs → legacy-integration-rows-door-is18rCsc.mjs} +1 -1
  91. package/system/dist/{restore-archive-r3zTdLKr.mjs → restore-archive-Ce8tTRv4.mjs} +82 -82
  92. package/system/dist/{restore-archive-BQWOdGAB.js → restore-archive-ScKSg4cI.js} +1 -1
  93. package/system/dist/{wal-maintenance-zJ4-ORo6.mjs → wal-maintenance-gY_QtcBe.mjs} +0 -0
  94. package/system/dist/{wal-maintenance-CiCgL4Hp.js → wal-maintenance-oyAWwOGI.js} +0 -0
  95. package/system/package.json +5 -1
@@ -5475,6 +5475,21 @@ function defineRecordKinds(specs) {
5475
5475
  return out;
5476
5476
  }
5477
5477
  /**
5478
+ * Entry kinds (D881): every list of user-created entries (notification
5479
+ * targets, brokers, LLM profiles) is ONE record kind with an id, a name and a
5480
+ * kind-specific body, and the admin UI lists/adds/edits/deletes all of them
5481
+ * through the `record-entries` capability with password fields derived from
5482
+ * the schema (`.meta({ secret: true })`).
5483
+ */
5484
+ /** The body of a plain entry: a name and the fields the kind adds. */
5485
+ function entryBody(shape) {
5486
+ return zod.z.object({
5487
+ name: zod.z.string().min(1),
5488
+ enabled: zod.z.boolean().optional(),
5489
+ ...shape
5490
+ });
5491
+ }
5492
+ /**
5478
5493
  * Declare one entry kind. An entry is configuration: never trimmed by the
5479
5494
  * engine, never aged, belonging to no device.
5480
5495
  */
@@ -62977,6 +62992,168 @@ var StateLookSchema = zod.z.object({
62977
62992
  background: HeroBackgroundTokenSchema,
62978
62993
  animation: HeroAnimationSchema
62979
62994
  });
62995
+ var HeroSceneIdSchema = zod.z.enum([
62996
+ "ac",
62997
+ "thermostat",
62998
+ "heater",
62999
+ "fan",
63000
+ "washer",
63001
+ "dryer",
63002
+ "dishwasher",
63003
+ "pet-fountain",
63004
+ "pet-feeder",
63005
+ "vacuum",
63006
+ "lawn-mower",
63007
+ "tv",
63008
+ "speaker",
63009
+ "camera",
63010
+ "light",
63011
+ "cover",
63012
+ "lock",
63013
+ "alarm",
63014
+ "siren",
63015
+ "sensor-sparkline",
63016
+ "contact",
63017
+ "presence",
63018
+ "weather",
63019
+ "plug",
63020
+ "button",
63021
+ "update",
63022
+ "control-dial",
63023
+ "event-stream",
63024
+ "gateway",
63025
+ "generic"
63026
+ ]);
63027
+ var HeroSceneModeSchema = zod.z.enum([
63028
+ "cool",
63029
+ "heat",
63030
+ "dry",
63031
+ "fan",
63032
+ "auto",
63033
+ "playing",
63034
+ "paused",
63035
+ "open",
63036
+ "closed"
63037
+ ]);
63038
+ /** The scene as the model carries it. `null` = the device did not say (never a guess). */
63039
+ var HeroSceneSchema = zod.z.object({
63040
+ id: HeroSceneIdSchema,
63041
+ mode: HeroSceneModeSchema.nullable(),
63042
+ /** 0..1: volume, cover position, cycle progress. */
63043
+ level: zod.z.number().min(0).max(1).nullable()
63044
+ });
63045
+ var HERO_SCENE_BY_TYPE = {
63046
+ [DeviceType.Camera]: "camera",
63047
+ [DeviceType.Hub]: "gateway",
63048
+ [DeviceType.Light]: "light",
63049
+ [DeviceType.Siren]: "siren",
63050
+ [DeviceType.Switch]: "plug",
63051
+ [DeviceType.Sensor]: "sensor-sparkline",
63052
+ [DeviceType.Thermostat]: "thermostat",
63053
+ [DeviceType.Climate]: "ac",
63054
+ [DeviceType.Button]: "button",
63055
+ [DeviceType.EventEmitter]: "event-stream",
63056
+ [DeviceType.Update]: "update",
63057
+ [DeviceType.Generic]: "generic",
63058
+ [DeviceType.Notifier]: "event-stream",
63059
+ [DeviceType.Script]: "event-stream",
63060
+ [DeviceType.Automation]: "event-stream",
63061
+ [DeviceType.Lock]: "lock",
63062
+ [DeviceType.Cover]: "cover",
63063
+ [DeviceType.Valve]: "control-dial",
63064
+ [DeviceType.Humidifier]: "control-dial",
63065
+ [DeviceType.WaterHeater]: "heater",
63066
+ [DeviceType.Fan]: "fan",
63067
+ [DeviceType.MediaPlayer]: "tv",
63068
+ [DeviceType.AlarmPanel]: "alarm",
63069
+ [DeviceType.Control]: "control-dial",
63070
+ [DeviceType.Presence]: "presence",
63071
+ [DeviceType.Weather]: "weather",
63072
+ [DeviceType.Vacuum]: "vacuum",
63073
+ [DeviceType.LawnMower]: "lawn-mower",
63074
+ [DeviceType.Container]: "generic",
63075
+ [DeviceType.Image]: "camera",
63076
+ [DeviceType.PetFeeder]: "pet-feeder",
63077
+ [DeviceType.PetFountain]: "pet-fountain",
63078
+ [DeviceType.Dishwasher]: "dishwasher",
63079
+ [DeviceType.Washer]: "washer",
63080
+ [DeviceType.Heater]: "heater",
63081
+ [DeviceType.Dryer]: "dryer",
63082
+ [DeviceType.Gateway]: "gateway"
63083
+ };
63084
+ /** `inherit` = the type's scene. A role only refines a type. */
63085
+ var HERO_SCENE_BY_ROLE = {
63086
+ [DeviceRole.Siren]: "siren",
63087
+ [DeviceRole.Floodlight]: "light",
63088
+ [DeviceRole.Spotlight]: "light",
63089
+ [DeviceRole.PirSensor]: "presence",
63090
+ [DeviceRole.Chime]: "speaker",
63091
+ [DeviceRole.Autotrack]: "inherit",
63092
+ [DeviceRole.Nightvision]: "inherit",
63093
+ [DeviceRole.PrivacyMask]: "inherit",
63094
+ [DeviceRole.Doorbell]: "inherit",
63095
+ [DeviceRole.CoverBlind]: "inherit",
63096
+ [DeviceRole.CoverShutter]: "inherit",
63097
+ [DeviceRole.CoverAwning]: "inherit",
63098
+ [DeviceRole.CoverCurtain]: "inherit",
63099
+ [DeviceRole.CoverGarage]: "inherit",
63100
+ [DeviceRole.CoverGate]: "inherit",
63101
+ [DeviceRole.CoverDoor]: "inherit",
63102
+ [DeviceRole.CoverWindow]: "inherit",
63103
+ [DeviceRole.BinaryHelper]: "inherit",
63104
+ [DeviceRole.Outlet]: "plug",
63105
+ [DeviceRole.MotionSensor]: "presence",
63106
+ [DeviceRole.ContactSensor]: "contact",
63107
+ [DeviceRole.LeakSensor]: "inherit",
63108
+ [DeviceRole.SmokeSensor]: "alarm",
63109
+ [DeviceRole.COSensor]: "alarm",
63110
+ [DeviceRole.GasSensor]: "alarm",
63111
+ [DeviceRole.TamperSensor]: "inherit",
63112
+ [DeviceRole.VibrationSensor]: "inherit",
63113
+ [DeviceRole.ConnectivitySensor]: "inherit",
63114
+ [DeviceRole.SoundSensor]: "inherit",
63115
+ [DeviceRole.BinarySensor]: "inherit",
63116
+ [DeviceRole.TemperatureSensor]: "sensor-sparkline",
63117
+ [DeviceRole.HumiditySensor]: "sensor-sparkline",
63118
+ [DeviceRole.AmbientLightSensor]: "inherit",
63119
+ [DeviceRole.PressureSensor]: "weather",
63120
+ [DeviceRole.WindSensor]: "weather",
63121
+ [DeviceRole.RainSensor]: "weather",
63122
+ [DeviceRole.UvSensor]: "weather",
63123
+ [DeviceRole.SolarRadiationSensor]: "weather",
63124
+ [DeviceRole.SoilMoistureSensor]: "inherit",
63125
+ [DeviceRole.PowerSensor]: "plug",
63126
+ [DeviceRole.EnergySensor]: "plug",
63127
+ [DeviceRole.VoltageSensor]: "plug",
63128
+ [DeviceRole.CurrentSensor]: "plug",
63129
+ [DeviceRole.AirQualitySensor]: "inherit",
63130
+ [DeviceRole.BatterySensor]: "inherit",
63131
+ [DeviceRole.NumericSensor]: "inherit",
63132
+ [DeviceRole.EnumSensor]: "inherit",
63133
+ [DeviceRole.DateTimeSensor]: "inherit",
63134
+ [DeviceRole.GenericSensor]: "inherit",
63135
+ [DeviceRole.NumericControl]: "control-dial",
63136
+ [DeviceRole.SelectControl]: "control-dial",
63137
+ [DeviceRole.TextControl]: "inherit",
63138
+ [DeviceRole.DateTimeControl]: "inherit",
63139
+ [DeviceRole.MobilePushNotifier]: "inherit",
63140
+ [DeviceRole.MessagingNotifier]: "inherit",
63141
+ [DeviceRole.EmailNotifier]: "inherit",
63142
+ [DeviceRole.GenericNotifier]: "inherit",
63143
+ [DeviceRole.IrTransmitter]: "inherit"
63144
+ };
63145
+ function isDeviceType$2(type) {
63146
+ return Object.values(DeviceType).includes(type);
63147
+ }
63148
+ function isDeviceRole$1(role) {
63149
+ return Object.values(DeviceRole).includes(role);
63150
+ }
63151
+ /** The scene id of a (role, type) pair. Role beats type; a type this build does not know gets the terminal. */
63152
+ function resolveHeroSceneId(role, type) {
63153
+ const byRole = role !== null && isDeviceRole$1(role) ? HERO_SCENE_BY_ROLE[role] : void 0;
63154
+ if (byRole !== void 0 && byRole !== "inherit") return byRole;
63155
+ return isDeviceType$2(type) ? HERO_SCENE_BY_TYPE[type] : "generic";
63156
+ }
62980
63157
  /** A string in both languages, as the cap vocabulary writes it (D920): no `t()` in the model. */
62981
63158
  var HeroTextSchema = zod.z.object({
62982
63159
  en: zod.z.string(),
@@ -63129,6 +63306,32 @@ var HeroStateBackdropSchema = zod.z.object({
63129
63306
  token: zod.z.enum(HERO_BACKGROUNDS),
63130
63307
  animation: zod.z.enum(HERO_ANIMATIONS)
63131
63308
  });
63309
+ var HeroFactSchema = zod.z.object({
63310
+ id: zod.z.enum([
63311
+ "power",
63312
+ "energy",
63313
+ "battery",
63314
+ "link",
63315
+ "phase",
63316
+ "remaining",
63317
+ "volume",
63318
+ "source",
63319
+ "consumables"
63320
+ ]),
63321
+ icon: IconKeySchema.nullable(),
63322
+ text: HeroTextSchema,
63323
+ tone: HeroToneSchema
63324
+ });
63325
+ /** A labelled value beside the scene. */
63326
+ var HeroSideTileSchema = zod.z.object({
63327
+ label: HeroTextSchema,
63328
+ value: HeroTextSchema,
63329
+ tone: HeroToneSchema.optional()
63330
+ });
63331
+ var HeroSideTilesSchema = zod.z.object({
63332
+ left: zod.z.array(HeroSideTileSchema).max(2),
63333
+ right: zod.z.array(HeroSideTileSchema).max(2)
63334
+ });
63132
63335
  var HeroBackgroundSchema = zod.z.discriminatedUnion("kind", [zod.z.object({
63133
63336
  kind: zod.z.literal("artwork"),
63134
63337
  url: zod.z.string(),
@@ -63152,6 +63355,11 @@ var HeroModelSchema = zod.z.object({
63152
63355
  stateAssumed: zod.z.boolean(),
63153
63356
  look: StateLookSchema,
63154
63357
  background: HeroBackgroundSchema,
63358
+ /** Which animated picture the hero (and the list row) draws; its motion is `look.animation`. */
63359
+ scene: HeroSceneSchema,
63360
+ /** The top line's inline facts, in order; never wraps, so a client may cut the tail. */
63361
+ facts: zod.z.array(HeroFactSchema),
63362
+ sideTiles: HeroSideTilesSchema,
63155
63363
  /** The status line under the main icon. */
63156
63364
  title: HeroTextSchema,
63157
63365
  badges: zod.z.array(HeroBadgeSchema),
@@ -63167,6 +63375,93 @@ var HeroModelSchema = zod.z.object({
63167
63375
  provenance: zod.z.array(HeroProvenanceSchema)
63168
63376
  });
63169
63377
  /**
63378
+ * The ROW of a device in a list (D1023 P2): four fixed zones, all taken from
63379
+ * the hero model and nothing else.
63380
+ *
63381
+ * 1. mini-scene the same scene id as the hero, drawn 44x44 with the state look;
63382
+ * 2. name + ONE status line the facts joined by " · " by the client;
63383
+ * 3. the type's primary inline control;
63384
+ * 4. a trailing fact (power, else battery, else consumables).
63385
+ *
63386
+ * Selection rules, all taken from the model:
63387
+ * - ONE control is ever shown: the device's own power; else the FIRST control of
63388
+ * the FIRST row that has any (a later row's control is never promoted). When
63389
+ * the model lists that part in `gated`, the row has no inline control: the
63390
+ * projection never falls through to another control the caller could use.
63391
+ * - the status line is the head (what plays, else the state) plus at most
63392
+ * {@link ROW_STATUS_FACTS_MAX} facts, the trailing fact excluded;
63393
+ * - the trailing fact is the first of power, battery, consumables.
63394
+ *
63395
+ * `projectDeviceRow` is pure and computes nothing: it selects from a
63396
+ * {@link HeroModel}. A row that needed a value the hero lacks would mean the
63397
+ * model is missing it, so the fix goes in the model.
63398
+ */
63399
+ var HeroRowModelSchema = zod.z.object({
63400
+ deviceId: zod.z.number().int(),
63401
+ name: zod.z.string(),
63402
+ type: zod.z.string(),
63403
+ state: HeroStateSchema,
63404
+ stateAssumed: zod.z.boolean(),
63405
+ look: StateLookSchema,
63406
+ scene: HeroSceneSchema,
63407
+ /** Joined by " · ": the state (or what is playing), then the facts. */
63408
+ statusLine: zod.z.array(HeroTextSchema),
63409
+ /** `null` = the type has no inline control, or the caller may not act on it. */
63410
+ primary: HeroControlSchema.nullable(),
63411
+ trailing: HeroFactSchema.nullable()
63412
+ });
63413
+ /** The trailing fact, in order of preference. */
63414
+ var TRAILING_ORDER = [
63415
+ "power",
63416
+ "battery",
63417
+ "consumables"
63418
+ ];
63419
+ function trailingOf(facts) {
63420
+ for (const id of TRAILING_ORDER) {
63421
+ const found = facts.find((f) => f.id === id);
63422
+ if (found !== void 0) return found;
63423
+ }
63424
+ return null;
63425
+ }
63426
+ function primaryOf(model) {
63427
+ const power = model.ownPower;
63428
+ if (power !== null) {
63429
+ if (model.gated.includes("own-power")) return null;
63430
+ return {
63431
+ kind: "toggle",
63432
+ id: "own-power",
63433
+ label: power.turnOn.label,
63434
+ on: power.on,
63435
+ turnOn: power.turnOn,
63436
+ turnOff: power.turnOff
63437
+ };
63438
+ }
63439
+ for (const row of model.rows) {
63440
+ const control = row.controls[0];
63441
+ if (control === void 0) continue;
63442
+ return model.gated.includes(row.id) ? null : control;
63443
+ }
63444
+ return null;
63445
+ }
63446
+ function statusLineOf(model, trailing) {
63447
+ return [model.rows.find((r) => r.id === "now-playing")?.status ?? null ?? model.title, ...model.facts.filter((f) => f !== trailing).map((f) => f.text).slice(0, 3)];
63448
+ }
63449
+ function projectDeviceRow(model) {
63450
+ const trailing = trailingOf(model.facts);
63451
+ return {
63452
+ deviceId: model.deviceId,
63453
+ name: model.name,
63454
+ type: model.type,
63455
+ state: model.state,
63456
+ stateAssumed: model.stateAssumed,
63457
+ look: model.look,
63458
+ scene: model.scene,
63459
+ statusLine: statusLineOf(model, trailing),
63460
+ primary: primaryOf(model),
63461
+ trailing
63462
+ };
63463
+ }
63464
+ /**
63170
63465
  * hero-layout — what a device's hero says (D1023). Read-only: the FIXED
63171
63466
  * layouts live in `@camstack/types` and nothing here stores or edits one.
63172
63467
  * `getHeroModel` builds the pure model from the device's bindings and its
@@ -63182,6 +63477,11 @@ var heroInput = zod.z.object({
63182
63477
  */
63183
63478
  canActuate: zod.z.boolean().optional()
63184
63479
  });
63480
+ var rowModelsInput = zod.z.object({
63481
+ deviceIds: zod.z.array(zod.z.number().int().nonnegative()).max(500),
63482
+ /** As `canActuate` of `getHeroModel`; absent = may. */
63483
+ canActuate: zod.z.boolean().optional()
63484
+ });
63185
63485
  var HeroLayoutRowsSchema = zod.z.object({
63186
63486
  type: zod.z.string(),
63187
63487
  rows: zod.z.array(HeroRowIdSchema)
@@ -63196,6 +63496,16 @@ var heroLayoutCapability = {
63196
63496
  auth: "protected",
63197
63497
  role: "viewer"
63198
63498
  }),
63499
+ /**
63500
+ * The list rows of many devices in ONE call, projected from the same model as
63501
+ * the hero. One entry per requested id, in order. `null` has two meanings, both
63502
+ * "no row": the registry does not know the device, or reading it failed (the
63503
+ * provider logs that, tagged). It is never an empty row.
63504
+ */
63505
+ getRowModels: method(rowModelsInput, zod.z.array(HeroRowModelSchema.nullable()), {
63506
+ auth: "protected",
63507
+ role: "viewer"
63508
+ }),
63199
63509
  getLayout: method(zod.z.object({ deviceType: zod.z.string() }), HeroLayoutRowsSchema, {
63200
63510
  auth: "protected",
63201
63511
  role: "viewer"
@@ -63914,20 +64224,40 @@ var integrationInstancesCapability = {
63914
64224
  instanceFormSchema: method(zod.z.object({
63915
64225
  id: IntegrationInstanceIdSchema.nullable(),
63916
64226
  /** The kind of the create form (`id: null`) of a provider with several. */
63917
- kind: zod.z.string().min(1).optional()
64227
+ kind: zod.z.string().min(1).optional(),
64228
+ /** The wizard mode of the integration type (`getAvailableTypes`); a form may differ per mode. */
64229
+ mode: zod.z.enum([
64230
+ "standalone",
64231
+ "account",
64232
+ "broker"
64233
+ ]).optional(),
64234
+ /** The discovery candidate the wizard was seeded from (`stableId`), if any. */
64235
+ candidateStableId: zod.z.string().min(1).optional()
63918
64236
  }), ConfigSchemaPassthrough$2, { auth: "admin" }),
63919
64237
  listInstances: method(zod.z.void(), zod.z.array(IntegrationInstanceSchema).readonly(), { auth: "admin" }),
63920
64238
  getInstance: method(zod.z.object({ id: IntegrationInstanceIdSchema }), IntegrationInstanceSchema.nullable(), { auth: "admin" }),
63921
64239
  /**
63922
64240
  * Insert the typed record. With `id` it is stored under that id (a duplicate id is refused);
63923
64241
  * without one the PROVIDER mints it and answers it. `kind` picks one of `describe().kinds`.
64242
+ *
64243
+ * An instance of a kind that brings devices (`role: 'devices'`) is an integration: the HUB mints
64244
+ * the id (the `integrations` registry id, which its devices carry), refuses the create when
64245
+ * `testInstance` rejects the values (D1016; a kind with no test passes and says so), writes the
64246
+ * registry row and the record, and removes both when either step fails. An `id` is accepted
64247
+ * only when it names an existing registry row of the addon.
63924
64248
  */
63925
64249
  createInstance: method(zod.z.object({
63926
64250
  id: IntegrationInstanceIdSchema.optional(),
63927
64251
  name: zod.z.string().min(1),
63928
64252
  kind: zod.z.string().min(1).optional(),
63929
64253
  /** Form values written with the record (a link picked in the create dialog). */
63930
- values: zod.z.record(zod.z.string(), zod.z.unknown()).optional()
64254
+ values: zod.z.record(zod.z.string(), zod.z.unknown()).optional(),
64255
+ /**
64256
+ * The discovery candidate (`stableId`) the instance is set up from. Kept on the integration
64257
+ * registry row of an instance that brings devices, so discovery stops offering a candidate
64258
+ * that already has its integration (D984). Ignored by an instance with no registry row.
64259
+ */
64260
+ originStableId: zod.z.string().min(1).optional()
63931
64261
  }), zod.z.object({ id: zod.z.string() }), {
63932
64262
  kind: "mutation",
63933
64263
  auth: "admin"
@@ -63948,7 +64278,11 @@ var integrationInstancesCapability = {
63948
64278
  kind: "mutation",
63949
64279
  auth: "admin"
63950
64280
  }),
63951
- /** Delete the record and its keychain refs together. */
64281
+ /**
64282
+ * Delete the record and its keychain refs together. For an instance that brings devices the hub
64283
+ * also removes the integration's devices (their tombstones, D865), the registry row, and emits
64284
+ * `IntegrationDeleted`; a fixed builtin and an instance a link names are refused first.
64285
+ */
63952
64286
  deleteInstance: method(zod.z.object({ id: IntegrationInstanceIdSchema }), zod.z.object({ ok: zod.z.literal(true) }), {
63953
64287
  kind: "mutation",
63954
64288
  auth: "admin"
@@ -96682,6 +97016,21 @@ function legacyAutoLinkIds(params) {
96682
97016
  /** Marker written to a declared integration's `info`. */
96683
97017
  var DECLARED_INTEGRATION_FIXED_KEY = "fixed";
96684
97018
  /**
97019
+ * Give a declared integration its instance record, ONCE. The record is read first and left
97020
+ * exactly as it is when it exists (an operator's rename, a field the addon later adds): a seed
97021
+ * never overwrites. A read that fails throws and writes nothing (D49) — the next pass retries.
97022
+ * True when the record was written by this call.
97023
+ */
97024
+ async function seedInstanceOnce(instances, seed) {
97025
+ const existing = await instances.getInstance({ id: seed.id });
97026
+ if (existing !== null && existing !== void 0) return false;
97027
+ await instances.createInstance({
97028
+ id: seed.id,
97029
+ name: seed.name
97030
+ });
97031
+ return true;
97032
+ }
97033
+ /**
96685
97034
  * Strip the `<node>/<addon>` suffix a forked child carries.
96686
97035
  *
96687
97036
  * Comparing `ctx.kernel.localNodeId` raw skipped EVERY node — including the one
@@ -96729,7 +97078,13 @@ var DeclaredDevices = class {
96729
97078
  };
96730
97079
  }
96731
97080
  }
96732
- const integrationId = spec.integrationId ?? await this.ensureIntegration(spec.integrationName);
97081
+ let integrationId;
97082
+ if (spec.integrationId !== void 0) integrationId = spec.integrationId;
97083
+ else {
97084
+ const own = await this.ensureIntegration(spec.integrationName);
97085
+ integrationId = own.id;
97086
+ await this.seedInstance(own);
97087
+ }
96733
97088
  const index = await this.readIndex();
96734
97089
  const live = await this.readLiveByStableId();
96735
97090
  const outcomes = [];
@@ -96737,10 +97092,11 @@ var DeclaredDevices = class {
96737
97092
  const outcome = await this.applyDeclaration(declaration, integrationId, index, live);
96738
97093
  if (outcome !== null) outcomes.push(outcome);
96739
97094
  }
97095
+ const removed = await this.sweepWithdrawn(spec.devices, integrationId, index);
96740
97096
  return {
96741
97097
  integrationId,
96742
97098
  devices: outcomes,
96743
- removed: await this.sweepWithdrawn(spec.devices, integrationId, index),
97099
+ removed,
96744
97100
  owned: true
96745
97101
  };
96746
97102
  }
@@ -96764,7 +97120,10 @@ var DeclaredDevices = class {
96764
97120
  integrationId: created.id,
96765
97121
  name: integrationName
96766
97122
  } });
96767
- return created.id;
97123
+ return {
97124
+ id: created.id,
97125
+ name: integrationName
97126
+ };
96768
97127
  }
96769
97128
  if (existing.info?.["fixed"] !== true) {
96770
97129
  await this.ports.updateIntegration({
@@ -96773,7 +97132,26 @@ var DeclaredDevices = class {
96773
97132
  });
96774
97133
  this.ports.logger.info("re-asserted `fixed` on a declared integration", { meta: { integrationId: existing.id } });
96775
97134
  }
96776
- return existing.id;
97135
+ return {
97136
+ id: existing.id,
97137
+ name: existing.name ?? integrationName
97138
+ };
97139
+ }
97140
+ /** Seed the instance record of an integration this declarer owns; best-effort, retried next pass. */
97141
+ async seedInstance(integration) {
97142
+ const { seedInstance } = this.ports;
97143
+ if (seedInstance === void 0) return;
97144
+ try {
97145
+ await seedInstance({
97146
+ id: integration.id,
97147
+ name: integration.name
97148
+ });
97149
+ } catch (err) {
97150
+ this.ports.logger.warn("could not seed the instance record of a declared integration", {
97151
+ tags: { integrationId: integration.id },
97152
+ meta: { error: errMsg(err) }
97153
+ });
97154
+ }
96777
97155
  }
96778
97156
  async readIndex() {
96779
97157
  const rows = await this.ports.listOwnDevices();
@@ -97130,6 +97508,18 @@ function reading(source, state, assumed = false) {
97130
97508
  assumed
97131
97509
  };
97132
97510
  }
97511
+ function fact(id, icon, text, tone = "muted") {
97512
+ return {
97513
+ id,
97514
+ icon,
97515
+ text,
97516
+ tone
97517
+ };
97518
+ }
97519
+ function minutesLeft(seconds) {
97520
+ const m = Math.ceil(seconds / 60);
97521
+ return t(`${m} min left`, `${m} min rimanenti`);
97522
+ }
97133
97523
  function deviceTypeOf(type) {
97134
97524
  return Object.values(DeviceType).find((t) => t === type);
97135
97525
  }
@@ -97179,7 +97569,8 @@ var runningStateContribution = contribution("running-state", RunningStateStatusS
97179
97569
  detail
97180
97570
  }
97181
97571
  },
97182
- rows: [row]
97572
+ rows: [row],
97573
+ ...phase !== null && running === true ? { facts: [fact("phase", "activity", t(phase, phase), "primary")] } : {}
97183
97574
  };
97184
97575
  });
97185
97576
  var powerMeterContribution = contribution("power-meter", PowerMeterStatusSchema, (slice) => {
@@ -97200,14 +97591,29 @@ var powerMeterContribution = contribution("power-meter", PowerMeterStatusSchema,
97200
97591
  value: slice.current,
97201
97592
  unit: "A"
97202
97593
  });
97203
- return { consumption: {
97204
- priority: 2,
97205
- slot: {
97206
- kind: "power",
97207
- watts: slice.power,
97208
- detail
97594
+ const watts = Math.round(slice.power);
97595
+ const text = t(`${watts} W`, `${watts} W`);
97596
+ return {
97597
+ consumption: {
97598
+ priority: 2,
97599
+ slot: {
97600
+ kind: "power",
97601
+ watts: slice.power,
97602
+ detail
97603
+ }
97604
+ },
97605
+ facts: [fact("power", "zap", text, watts > 0 ? "primary" : "muted")],
97606
+ tiles: {
97607
+ right: [{
97608
+ label: t("Power", "Potenza"),
97609
+ value: text
97610
+ }],
97611
+ ...slice.energy === void 0 ? {} : { left: [{
97612
+ label: t("Energy", "Energia"),
97613
+ value: t(`${slice.energy} kWh`, `${slice.energy} kWh`)
97614
+ }] }
97209
97615
  }
97210
- } };
97616
+ };
97211
97617
  });
97212
97618
  function batteryTone(level) {
97213
97619
  if (level === null) return "muted";
@@ -97216,24 +97622,39 @@ function batteryTone(level) {
97216
97622
  }
97217
97623
  var batteryContribution = contribution("battery", BatteryStatusSchema, (slice) => {
97218
97624
  const level = slice?.level ?? null;
97219
- return { badges: [{
97625
+ const badge = {
97220
97626
  id: "battery",
97221
97627
  icon: "battery",
97222
97628
  tone: batteryTone(level),
97223
97629
  value: level,
97224
97630
  label: level === null ? t("Battery", "Batteria") : t(`Battery ${level}%`, `Batteria ${level}%`)
97225
- }] };
97631
+ };
97632
+ return {
97633
+ badges: [badge],
97634
+ ...level === null ? {} : {
97635
+ facts: [fact("battery", "battery", badge.label, badge.tone)],
97636
+ tiles: { left: [{
97637
+ label: t("Battery", "Batteria"),
97638
+ value: t(`${level}%`, `${level}%`),
97639
+ tone: badge.tone
97640
+ }] }
97641
+ }
97642
+ };
97226
97643
  });
97227
97644
  var networkLinkContribution = contribution("network-link", NetworkLinkStatusSchema, (slice) => {
97228
97645
  const signal = slice?.signal ?? null;
97229
97646
  const known = slice !== void 0 && slice.type !== "unknown";
97230
- return { badges: [{
97647
+ const badge = {
97231
97648
  id: "network-link",
97232
97649
  icon: "wifi",
97233
97650
  tone: !known ? "muted" : signal !== null && signal < 30 ? "warning" : "success",
97234
97651
  value: signal,
97235
97652
  label: known ? t(slice.type, slice.type) : t("Link unknown", "Collegamento sconosciuto")
97236
- }] };
97653
+ };
97654
+ return {
97655
+ badges: [badge],
97656
+ ...known ? { facts: [fact("link", "wifi", badge.label, badge.tone)] } : {}
97657
+ };
97237
97658
  });
97238
97659
  var contactContribution = contribution("contact", ContactStatusSchema, (slice) => {
97239
97660
  const row = {
@@ -97244,7 +97665,8 @@ var contactContribution = contribution("contact", ContactStatusSchema, (slice) =
97244
97665
  };
97245
97666
  return {
97246
97667
  reading: reading("contact", slice === void 0 ? "unknown" : slice.entryOpen ? "on" : "off"),
97247
- rows: [row]
97668
+ rows: [row],
97669
+ ...slice === void 0 ? {} : { scene: { mode: slice.entryOpen ? "open" : "closed" } }
97248
97670
  };
97249
97671
  });
97250
97672
  var motionTriggerContribution = contribution("motion-trigger", MotionTriggerStatusSchema, (slice) => {
@@ -97323,10 +97745,14 @@ var consumablesContribution = contribution("consumables", ConsumablesStatusSchem
97323
97745
  level: item.level,
97324
97746
  needsAttention: item.status !== null && ATTENTION_STATUSES.includes(item.status)
97325
97747
  }));
97326
- return { consumables: {
97327
- items,
97328
- attention: items.filter((i) => i.needsAttention).length
97329
- } };
97748
+ const attention = items.filter((i) => i.needsAttention).length;
97749
+ return {
97750
+ consumables: {
97751
+ items,
97752
+ attention
97753
+ },
97754
+ ...attention === 0 ? {} : { facts: [fact("consumables", null, t(`${attention} to check`, `${attention} da controllare`), "warning")] }
97755
+ };
97330
97756
  });
97331
97757
  var dishwasherContribution = contribution("dishwasher", DishwasherStatusSchema, (slice) => {
97332
97758
  const state = slice === void 0 || slice.state === "unavailable" ? "unknown" : slice.state === "running" ? "running" : slice.state === "error" ? "alert" : "idle";
@@ -97350,9 +97776,17 @@ var dishwasherContribution = contribution("dishwasher", DishwasherStatusSchema,
97350
97776
  turnOff: action("appliance-power.off", t("Standby", "Standby"), "power-off", "dishwasher", "setPower", { on: false })
97351
97777
  }]
97352
97778
  });
97779
+ const remaining = slice?.remaining ?? null;
97353
97780
  return {
97354
97781
  reading: reading("dishwasher", state),
97355
- rows
97782
+ rows,
97783
+ ...remaining === null ? {} : {
97784
+ facts: [fact("remaining", "timer", minutesLeft(remaining), "primary")],
97785
+ tiles: { right: [{
97786
+ label: t("Left", "Rimane"),
97787
+ value: minutesLeft(remaining)
97788
+ }] }
97789
+ }
97356
97790
  };
97357
97791
  });
97358
97792
  var has$1 = (ctx, f) => ctx.features.includes(f);
@@ -97460,8 +97894,23 @@ var HERO_CAP_CONTRIBUTIONS = [
97460
97894
  }] : []
97461
97895
  });
97462
97896
  }
97897
+ const volumeNow = view.volumeKnown ? slice?.volumeLevel ?? null : null;
97898
+ const sourceNow = view.source === null || view.source.current === "" ? null : view.source.current;
97899
+ const mode = view.running === "playing" ? "playing" : view.running === "paused" ? "paused" : null;
97900
+ const facts = [];
97901
+ if (sourceNow !== null) facts.push(fact("source", "radio", t(sourceNow, sourceNow)));
97902
+ if (volumeNow !== null) facts.push(fact("volume", "volume-2", t(`${volumeNow}%`, `${volumeNow}%`)));
97463
97903
  return {
97464
97904
  reading: mediaReading(view),
97905
+ facts,
97906
+ ...volumeNow === null ? {} : { tiles: { right: [{
97907
+ label: t("Volume", "Volume"),
97908
+ value: t(`${volumeNow}%`, `${volumeNow}%`)
97909
+ }] } },
97910
+ scene: {
97911
+ ...mode === null ? {} : { mode },
97912
+ ...volumeNow === null ? {} : { level: volumeNow / 100 }
97913
+ },
97465
97914
  ...view.canSwitchPower ? { ownPower: {
97466
97915
  source: "media-player",
97467
97916
  on: view.power === "unknown" ? null : view.power === "on",
@@ -97955,6 +98404,9 @@ function provenanceOf(cap, fragment) {
97955
98404
  if (fragment.powerSupply !== void 0) ids.push("power-supply");
97956
98405
  if (fragment.consumption !== void 0) ids.push("consumption");
97957
98406
  if (fragment.consumables !== void 0) ids.push("consumables");
98407
+ if (fragment.facts !== void 0 && fragment.facts.length > 0) ids.push("facts");
98408
+ if (fragment.tiles !== void 0) ids.push("side-tiles");
98409
+ if (fragment.scene !== void 0) ids.push("scene");
97958
98410
  if (fragment.remote !== void 0) ids.push("remote");
97959
98411
  for (const badge of fragment.badges ?? []) ids.push(badge.id);
97960
98412
  for (const row of fragment.rows ?? []) ids.push(row.id);
@@ -97971,6 +98423,17 @@ function consumptionOf(fragments) {
97971
98423
  }
97972
98424
  return best === null ? null : best.slot;
97973
98425
  }
98426
+ function tilesOf(fragments, side) {
98427
+ return fragments.flatMap((f) => f.tiles?.[side] ?? []).slice(0, 2);
98428
+ }
98429
+ function sceneOf(role, type, fragments) {
98430
+ const parts = fragments.flatMap((f) => f.scene === void 0 ? [] : [f.scene]);
98431
+ return {
98432
+ id: resolveHeroSceneId(role, type),
98433
+ mode: parts.find((p) => p.mode !== void 0)?.mode ?? null,
98434
+ level: parts.find((p) => p.level !== void 0)?.level ?? null
98435
+ };
98436
+ }
97974
98437
  function buildHeroModel(input) {
97975
98438
  const { device } = input;
97976
98439
  const ctx = {
@@ -98011,6 +98474,11 @@ function buildHeroModel(input) {
98011
98474
  const powerSupply = fragments.find((f) => f.powerSupply !== void 0)?.powerSupply ?? null;
98012
98475
  const remote = fragments.find((f) => f.remote !== void 0)?.remote ?? null;
98013
98476
  const badges = fragments.flatMap((f) => f.badges ?? []);
98477
+ const facts = fragments.flatMap((f) => f.facts ?? []);
98478
+ const sideTiles = {
98479
+ left: tilesOf(fragments, "left"),
98480
+ right: tilesOf(fragments, "right")
98481
+ };
98014
98482
  const gated = [];
98015
98483
  if (!input.access.canActuate) {
98016
98484
  if (ownPower !== null) gated.push("own-power");
@@ -98028,6 +98496,9 @@ function buildHeroModel(input) {
98028
98496
  stateAssumed: assumed,
98029
98497
  look,
98030
98498
  background,
98499
+ scene: sceneOf(device.role, device.type, fragments),
98500
+ facts,
98501
+ sideTiles,
98031
98502
  title: STATE_TEXT[state],
98032
98503
  badges,
98033
98504
  remote,
@@ -101556,6 +102027,13 @@ var METHOD_ACCESS_MAP = Object.freeze({
101556
102027
  access: "view",
101557
102028
  role: "viewer"
101558
102029
  },
102030
+ "heroLayout.getRowModels": {
102031
+ capName: "hero-layout",
102032
+ capScope: "system",
102033
+ addonId: null,
102034
+ access: "view",
102035
+ role: "viewer"
102036
+ },
101559
102037
  "humidifier.getStatus": {
101560
102038
  capName: "humidifier",
101561
102039
  capScope: "device",
@@ -109607,6 +110085,11 @@ Object.freeze({
109607
110085
  form: "single",
109608
110086
  optional: false
109609
110087
  }],
110088
+ "heroLayout.getRowModels": [{
110089
+ name: "deviceIds",
110090
+ form: "array",
110091
+ optional: false
110092
+ }],
109610
110093
  "humidifier.getStatus": [{
109611
110094
  name: "deviceId",
109612
110095
  form: "single",
@@ -115299,6 +115782,12 @@ Object.defineProperty(exports, "emitReadiness", {
115299
115782
  return emitReadiness;
115300
115783
  }
115301
115784
  });
115785
+ Object.defineProperty(exports, "entryBody", {
115786
+ enumerable: true,
115787
+ get: function() {
115788
+ return entryBody;
115789
+ }
115790
+ });
115302
115791
  Object.defineProperty(exports, "enumerateInferenceDevices", {
115303
115792
  enumerable: true,
115304
115793
  get: function() {
@@ -116067,6 +116556,12 @@ Object.defineProperty(exports, "processTimeZoneOr", {
116067
116556
  return processTimeZoneOr;
116068
116557
  }
116069
116558
  });
116559
+ Object.defineProperty(exports, "projectDeviceRow", {
116560
+ enumerable: true,
116561
+ get: function() {
116562
+ return projectDeviceRow;
116563
+ }
116564
+ });
116070
116565
  Object.defineProperty(exports, "proposeRunningThreshold", {
116071
116566
  enumerable: true,
116072
116567
  get: function() {
@@ -116295,6 +116790,12 @@ Object.defineProperty(exports, "secretViewsOf", {
116295
116790
  return secretViewsOf;
116296
116791
  }
116297
116792
  });
116793
+ Object.defineProperty(exports, "seedInstanceOnce", {
116794
+ enumerable: true,
116795
+ get: function() {
116796
+ return seedInstanceOnce;
116797
+ }
116798
+ });
116298
116799
  Object.defineProperty(exports, "settingsStoreCapability", {
116299
116800
  enumerable: true,
116300
116801
  get: function() {