@camstack/addon-provider-reolink 1.2.236 → 1.2.237

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/addon.js CHANGED
@@ -101498,7 +101498,7 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
101498
101498
  return EventCategory;
101499
101499
  }({});
101500
101500
  //#endregion
101501
- //#region ../types/dist/composed-stable-id-jnvhwGoH.mjs
101501
+ //#region ../types/dist/composed-stable-id-DFNyOFzz.mjs
101502
101502
  /**
101503
101503
  import { errMsg } from '@camstack/types'
101504
101504
  * Extract a human-readable message from an unknown error value.
@@ -101511,6 +101511,7 @@ function errMsg$3(err) {
101511
101511
  }
101512
101512
  var DeviceType = /* @__PURE__ */ function(DeviceType) {
101513
101513
  DeviceType["Camera"] = "camera";
101514
+ /** Legacy stored value, read only by the hub-to-integration migrations; no live device carries it. */
101514
101515
  DeviceType["Hub"] = "hub";
101515
101516
  DeviceType["Light"] = "light";
101516
101517
  DeviceType["Siren"] = "siren";
@@ -106722,7 +106723,7 @@ var ZodIssueCode = {
106722
106723
  var ZodFirstPartyTypeKind;
106723
106724
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
106724
106725
  //#endregion
106725
- //#region ../types/dist/sleep-Dz1P6--1.mjs
106726
+ //#region ../types/dist/sleep-D_NpiLFP.mjs
106726
106727
  /**
106727
106728
  * The audio chunk plane's byte format, and the ONE expansion from a coded
106728
106729
  * window to float samples (D455).
@@ -114624,10 +114625,6 @@ var CAMERA_CAP_VOCABULARY = {
114624
114625
  scope: "device",
114625
114626
  noun: t("Admin link", "Link di amministrazione")
114626
114627
  },
114627
- "device-discovery": {
114628
- scope: "device",
114629
- noun: t("Discovery", "Rilevamento dispositivi")
114630
- },
114631
114628
  "device-extension": {
114632
114629
  scope: "device",
114633
114630
  noun: t("Device extension", "Estensione del dispositivo")
@@ -115799,6 +115796,7 @@ var SYSTEM_CAP_VOCABULARY = {
115799
115796
  backup: system("system backups — run and restored from the Backups page"),
115800
115797
  broker: system("message-broker connections — configured, not actuated"),
115801
115798
  "calendar-source": system(INTERNAL),
115799
+ "cluster-update": system(CLUSTER),
115802
115800
  calendars: system("calendars feed schedules and conditions, not device actions"),
115803
115801
  composer: system("device composition — an authoring tool, not an action"),
115804
115802
  "core-blocks": system(INTERNAL),
@@ -116100,6 +116098,7 @@ var CAP_NAMES = Object.freeze([
116100
116098
  "camera-streams",
116101
116099
  "carbon-monoxide",
116102
116100
  "climate-control",
116101
+ "cluster-update",
116103
116102
  "color",
116104
116103
  "composer",
116105
116104
  "connectivity",
@@ -116117,7 +116116,6 @@ var CAP_NAMES = Object.freeze([
116117
116116
  "device-admin-link",
116118
116117
  "device-adoption",
116119
116118
  "device-credentials",
116120
- "device-discovery",
116121
116119
  "device-export",
116122
116120
  "device-extension",
116123
116121
  "device-history",
@@ -116739,13 +116737,6 @@ Object.freeze({
116739
116737
  "valueType": "string"
116740
116738
  }
116741
116739
  ],
116742
- "device-discovery": [{
116743
- "path": "lastDiscoveryAt",
116744
- "valueType": "number"
116745
- }, {
116746
- "path": "lastError",
116747
- "valueType": "string"
116748
- }],
116749
116740
  "device-export": [
116750
116741
  {
116751
116742
  "path": "linkState",
@@ -118221,7 +118212,7 @@ function sleep(ms) {
118221
118212
  return new Promise((resolve) => setTimeout(resolve, Math.max(0, ms)));
118222
118213
  }
118223
118214
  //#endregion
118224
- //#region ../types/dist/implemented-methods-OitwyO1Y.mjs
118215
+ //#region ../types/dist/implemented-methods-M5aguGon.mjs
118225
118216
  /**
118226
118217
  * The ffmpeg build every CamStack node downloads, per platform and arch.
118227
118218
  *
@@ -145559,6 +145550,62 @@ var WeekdayKeySchema = _enum([
145559
145550
  "sat",
145560
145551
  "sun"
145561
145552
  ]);
145553
+ /**
145554
+ * Hold semantics — "for N seconds" on a leaf of the `when` tree (#498).
145555
+ *
145556
+ * ONE primitive, `for: { ms, mode, tolerance? }`, shared by `device-becomes`,
145557
+ * `device-is` and `expression`:
145558
+ *
145559
+ * - `held`: the condition stays true for `ms`;
145560
+ * - `stable`: the value does not move by more than `tolerance` (absolute, in
145561
+ * the field's base unit) for `ms` while the condition holds.
145562
+ *
145563
+ * {@link HoldCore} is the pure state machine (an input observation → a reading).
145564
+ * {@link HoldTracker} keys cores by a leaf path for the STATE leaves the tree
145565
+ * evaluator judges. {@link BecomesWatch} wraps a core with a timer for the
145566
+ * `device-becomes` EVENT leaf: the deadline is armed when the hold starts and
145567
+ * cancelled when it breaks, and the leaf fires ONCE per episode.
145568
+ *
145569
+ * Hold state is memory only. A hold that is already running when the watcher
145570
+ * first looks (a restart) is INHERITED: nobody knows when it began, so it never
145571
+ * fires for that episode and a state leaf reads it as unknown until the window
145572
+ * has elapsed from the moment the watcher started (D49: not-known is not false).
145573
+ */
145574
+ var HOLD_MAX_MS = 864e5;
145575
+ var HoldModeSchema = _enum(["held", "stable"]);
145576
+ var HoldSpecSchema = object({
145577
+ /** How long the condition (or the value) must hold. */
145578
+ ms: number$1().int().min(1).max(HOLD_MAX_MS),
145579
+ mode: HoldModeSchema,
145580
+ /** `stable` only: the largest move of the value that still counts as unchanged (absolute, base unit). */
145581
+ tolerance: number$1().min(0).optional()
145582
+ });
145583
+ /** What a trace says about a hold. */
145584
+ var HoldTraceSchema = object({
145585
+ phase: _enum([
145586
+ "pending",
145587
+ "cancelled",
145588
+ "fired",
145589
+ "reseeded"
145590
+ ]),
145591
+ ms: number$1().int(),
145592
+ mode: HoldModeSchema,
145593
+ /** When the hold started (ms epoch). */
145594
+ since: number$1().optional(),
145595
+ /** When it completes (ms epoch), for a pending hold. */
145596
+ deadline: number$1().optional()
145597
+ });
145598
+ /** The operators a `device-becomes` leaf may carry: a threshold or a range. */
145599
+ var BecomesOperatorSchema = _enum([
145600
+ "eq",
145601
+ "ne",
145602
+ "gt",
145603
+ "gte",
145604
+ "lt",
145605
+ "lte",
145606
+ "between",
145607
+ "outside"
145608
+ ]);
145562
145609
  /** How a state leaf compares a device field to a value. Derived from the
145563
145610
  * field's `kind` in `deviceManager.getWireableFields`, never hand-maintained. */
145564
145611
  var AutomationConditionOperatorSchema = _enum([
@@ -145582,18 +145629,52 @@ var DeviceBecomesLeafSchema = object({
145582
145629
  deviceId: number$1().int().nonnegative(),
145583
145630
  cap: string().min(1),
145584
145631
  fieldPath: string().min(1),
145585
- /** Fire when the field takes this value. Omit to fire on any change. */
145632
+ /** Fire when the field takes this value. Omit (with no `operator`) to fire on any change. */
145586
145633
  becomes: union([
145587
145634
  string(),
145588
145635
  number$1(),
145589
145636
  boolean()
145590
145637
  ]).optional(),
145591
- /** Only on a CHANGE of value, not on every re-report. */
145638
+ /**
145639
+ * A threshold or a range instead of an equality: "crosses above 3000", "enters
145640
+ * 18..24". The leaf fires on the TRANSITION into the predicate, never on a re-report.
145641
+ * `value` is in the field's base unit; `between` / `outside` take `[low, high]`.
145642
+ */
145643
+ operator: BecomesOperatorSchema.optional(),
145644
+ value: union([
145645
+ number$1(),
145646
+ string(),
145647
+ boolean(),
145648
+ array(number$1()).length(2)
145649
+ ]).optional(),
145650
+ /**
145651
+ * Hold: the transition (or, with no predicate, the new value) must stay for
145652
+ * `for.ms` before the leaf fires, ONCE per episode. See `hold.ts`.
145653
+ */
145654
+ for: HoldSpecSchema.optional(),
145655
+ /** @deprecated every leaf fires on a transition now; read as always on. */
145592
145656
  edge: boolean().optional(),
145593
- /** The new value must hold this long before it counts. */
145594
- forMs: number$1().int().min(0).max(864e5).optional(),
145657
+ /** @deprecated legacy `held` window — read through `holdOf` as `for: { ms, mode: 'held' }`. */
145658
+ forMs: number$1().int().min(0).max(HOLD_MAX_MS).optional(),
145595
145659
  /** Collapse a burst into one occurrence. */
145596
145660
  debounceMs: number$1().int().min(0).max(6e5).optional()
145661
+ }).superRefine((leaf, ctx) => {
145662
+ if (leaf.becomes !== void 0 && leaf.operator !== void 0) ctx.addIssue({
145663
+ code: "custom",
145664
+ message: "a leaf names `becomes` or `operator`, not both",
145665
+ path: ["operator"]
145666
+ });
145667
+ if (leaf.operator !== void 0 && leaf.value === void 0) ctx.addIssue({
145668
+ code: "custom",
145669
+ message: "an operator needs the value to compare to",
145670
+ path: ["value"]
145671
+ });
145672
+ const range = leaf.operator === "between" || leaf.operator === "outside";
145673
+ if (leaf.operator !== void 0 && range !== Array.isArray(leaf.value)) ctx.addIssue({
145674
+ code: "custom",
145675
+ message: range ? "a range takes [low, high]" : "only a range takes [low, high]",
145676
+ path: ["value"]
145677
+ });
145597
145678
  });
145598
145679
  var DeviceEventLeafSchema = object({
145599
145680
  kind: literal("device-event"),
@@ -145658,7 +145739,9 @@ var DeviceIsLeafSchema = object({
145658
145739
  QuantityValueSchema
145659
145740
  ]),
145660
145741
  /** The unit the person picked for `value` (display only; `value` is in the base unit). */
145661
- unit: string().min(1).optional()
145742
+ unit: string().min(1).optional(),
145743
+ /** The comparison must hold (`held`) or the value stay put (`stable`) this long. */
145744
+ for: HoldSpecSchema.optional()
145662
145745
  });
145663
145746
  /**
145664
145747
  * True when the camera currently has a PARKED object matching `subjects` in at
@@ -145681,7 +145764,9 @@ var StationaryPresentLeafSchema = object({
145681
145764
  var ExpressionLeafSchema = object({
145682
145765
  kind: literal("expression"),
145683
145766
  expr: string().min(1).max(MAX_EXPRESSION_SOURCE_LENGTH),
145684
- bindings: record(string().regex(EXPRESSION_IDENTIFIER_RE), ExpressionBindingSourceSchema)
145767
+ bindings: record(string().regex(EXPRESSION_IDENTIFIER_RE), ExpressionBindingSourceSchema),
145768
+ /** The expression must stay true this long. An expression has no single value, so only `held`. */
145769
+ for: HoldSpecSchema.optional()
145685
145770
  }).superRefine((src, ctx) => {
145686
145771
  const err = validateExpressionSource(src);
145687
145772
  if (err !== null) ctx.addIssue({
@@ -145689,6 +145774,11 @@ var ExpressionLeafSchema = object({
145689
145774
  message: err,
145690
145775
  path: ["expr"]
145691
145776
  });
145777
+ if (src.for?.mode === "stable") ctx.addIssue({
145778
+ code: "custom",
145779
+ message: "an expression is held, not stable: it has no single value to keep still",
145780
+ path: ["for", "mode"]
145781
+ });
145692
145782
  });
145693
145783
  var AutomationWhenSchema = lazy(() => discriminatedUnion("kind", [
145694
145784
  object({
@@ -146448,7 +146538,9 @@ var AutomationTriggerTraceSchema = object({
146448
146538
  /** Why an event was rejected ("class person not in [dog]") or what fired. */
146449
146539
  reason: string(),
146450
146540
  /** deviceId, className, trackId, score … — only what the trigger exposes. */
146451
- vars: record(string(), TraceValueSchema)
146541
+ vars: record(string(), TraceValueSchema),
146542
+ /** A hold (`for`) this occurrence went through: pending, cancelled, fired or re-seeded. */
146543
+ hold: HoldTraceSchema.optional()
146452
146544
  });
146453
146545
  var AutomationConditionTraceNodeSchema = object({
146454
146546
  /** `when` for the root, `when.<i>` for its i-th child, … (`conditions…` on an old trace). */
@@ -146794,7 +146886,7 @@ object({
146794
146886
  * is irrelevant; the array is treated as a set by consumers. */
146795
146887
  hiddenChildIds: array(number$1()).readonly()
146796
146888
  });
146797
- DeviceType.Camera, DeviceType.Hub, DeviceType.Switch, DeviceType.Light, DeviceType.Sensor, DeviceType.Thermostat, DeviceType.Cover, DeviceType.Lock, DeviceType.Fan, DeviceType.MediaPlayer, DeviceType.AlarmPanel, DeviceType.Generic, method(object({
146889
+ DeviceType.Camera, DeviceType.Switch, DeviceType.Light, DeviceType.Sensor, DeviceType.Thermostat, DeviceType.Cover, DeviceType.Lock, DeviceType.Fan, DeviceType.MediaPlayer, DeviceType.AlarmPanel, DeviceType.Generic, method(object({
146798
146890
  deviceId: number$1().int().nonnegative(),
146799
146891
  childDeviceId: number$1().int().nonnegative(),
146800
146892
  hidden: boolean()
@@ -150965,6 +151057,140 @@ var climateControlCapability = {
150965
151057
  } }
150966
151058
  };
150967
151059
  /**
151060
+ * cluster-update — the ONE flow that brings the whole cluster to a release
151061
+ * (planning#493). Hub-provided (`server-provided`), hub-only: the hub runs
151062
+ * the sequence itself, so the admin UI, the MCP and the CLI all start the same
151063
+ * job and read the same report instead of each driving their own loop.
151064
+ *
151065
+ * 1. backup (`backup.trigger`) — skipped only when the caller says so
151066
+ * 2. the hub's server closure (`applyServerUpdate`); the hub restarts and the
151067
+ * job RESUMES on the new boot, verified against the hub's running version
151068
+ * 3. every online agent behind the target, one at a time, verified: runs the
151069
+ * target, settled, online, and its capabilities registered (D848) — an
151070
+ * agent that comes back capless is a FAILED step, never a done one
151071
+ * 4. every stale addon on the hub (`addons.updatePackage`); agents follow by
151072
+ * reconciliation, which is verified, never pushed
151073
+ *
151074
+ * The job stops on the first failed step with a typed reason (D877). Its state
151075
+ * is durable on the hub and read by RPC (`getClusterUpdateJob`) — events are
151076
+ * telemetry and never carry it (D8, D11).
151077
+ */
151078
+ /** The steps, in the order they run. */
151079
+ var ClusterUpdateStepKindSchema = _enum([
151080
+ "backup",
151081
+ "hub-server",
151082
+ "agent-server",
151083
+ "addons"
151084
+ ]);
151085
+ /**
151086
+ * - `pending` — not reached yet.
151087
+ * - `running` — in progress (for `hub-server`: possibly across the restart).
151088
+ * - `ok` — done AND verified.
151089
+ * - `failed` — did not land; `reason` + `detail` say why. Stops the job.
151090
+ * - `skipped` — not run: nothing to do, opted out, the node is offline, or a
151091
+ * step before it failed. `detail` says which.
151092
+ */
151093
+ var ClusterUpdateStepStatusSchema = _enum([
151094
+ "pending",
151095
+ "running",
151096
+ "ok",
151097
+ "failed",
151098
+ "skipped"
151099
+ ]);
151100
+ /**
151101
+ * Why a step (and with it the job) failed. Stable, greppable; `detail` carries
151102
+ * the prose.
151103
+ */
151104
+ var ClusterUpdateFailureReasonSchema = _enum([
151105
+ "backup-unavailable",
151106
+ "backup-failed",
151107
+ "server-refused",
151108
+ "server-not-on-target",
151109
+ "node-capless",
151110
+ "status-unreadable",
151111
+ "addon-update-failed",
151112
+ "addons-not-converged",
151113
+ "interrupted"
151114
+ ]);
151115
+ var ClusterUpdateStepSchema = object({
151116
+ kind: ClusterUpdateStepKindSchema,
151117
+ /** The node the step acts on; absent for `backup` and `addons`. */
151118
+ nodeId: string().optional(),
151119
+ status: ClusterUpdateStepStatusSchema,
151120
+ /** One line for the operator: what happened, or why not. */
151121
+ detail: string(),
151122
+ reason: ClusterUpdateFailureReasonSchema.optional(),
151123
+ /** `hub-server` / `agent-server`: the version the node ran before. */
151124
+ fromVersion: string().nullable().optional(),
151125
+ /** `addons`: the packages this step updates, `name from -> to`. */
151126
+ packages: array(string()).readonly().optional(),
151127
+ startedAt: number$1().optional(),
151128
+ finishedAt: number$1().optional()
151129
+ });
151130
+ var ClusterUpdateJobStateSchema = _enum([
151131
+ "running",
151132
+ "succeeded",
151133
+ "failed"
151134
+ ]);
151135
+ var ClusterUpdateJobSchema = object({
151136
+ id: string(),
151137
+ state: ClusterUpdateJobStateSchema,
151138
+ /** The server version every node is brought to. */
151139
+ targetVersion: string(),
151140
+ /** Who started it (the user name, or `system`). */
151141
+ requestedBy: string(),
151142
+ startedAt: number$1(),
151143
+ finishedAt: number$1().optional(),
151144
+ /** Every step, in run order; later steps stay `pending` while it runs. */
151145
+ steps: array(ClusterUpdateStepSchema).readonly(),
151146
+ /** On `failed`: the step that stopped it (`nodeId` or the step kind). */
151147
+ stoppedAt: string().optional(),
151148
+ reason: ClusterUpdateFailureReasonSchema.optional(),
151149
+ /** Agents offline when the plan was read: never touched. */
151150
+ skippedOffline: array(string()).readonly()
151151
+ });
151152
+ var ClusterUpdateOptionsSchema = object({
151153
+ /** Explicit server target; omitted = the hub's latest registry check. */
151154
+ version: string().optional(),
151155
+ /** Update the addons too (default true). */
151156
+ addons: boolean().optional(),
151157
+ /**
151158
+ * Back up before touching anything (default true). `false` is an explicit
151159
+ * operator opt-out; a missing backup provider is otherwise a failure.
151160
+ */
151161
+ backup: boolean().optional()
151162
+ });
151163
+ /** Why a plan cannot start. */
151164
+ var ClusterUpdateBlockerSchema = _enum([
151165
+ "no-target",
151166
+ "node-busy",
151167
+ "job-running",
151168
+ "nothing-to-do",
151169
+ "status-unreadable"
151170
+ ]);
151171
+ var ClusterUpdatePlanSchema = object({
151172
+ /** `null` when no target could be resolved (`blocker: 'no-target'`). */
151173
+ targetVersion: string().nullable(),
151174
+ /** The steps the job WOULD run, all `pending` (or `skipped` with a reason). */
151175
+ steps: array(ClusterUpdateStepSchema).readonly(),
151176
+ skippedOffline: array(string()).readonly(),
151177
+ /** `null` = the plan can start. */
151178
+ blocker: ClusterUpdateBlockerSchema.nullable(),
151179
+ /** Prose for `blocker`. */
151180
+ blockerDetail: string().nullable()
151181
+ });
151182
+ var StartClusterUpdateResultSchema = object({
151183
+ accepted: boolean(),
151184
+ /** The job to follow with `getClusterUpdateJob`; `null` when refused. */
151185
+ jobId: string().nullable(),
151186
+ blocker: ClusterUpdateBlockerSchema.nullable(),
151187
+ message: string()
151188
+ });
151189
+ method(ClusterUpdateOptionsSchema, ClusterUpdatePlanSchema, { auth: "admin" }), method(ClusterUpdateOptionsSchema, StartClusterUpdateResultSchema, {
151190
+ kind: "mutation",
151191
+ auth: "admin"
151192
+ }), method(object({ jobId: string().optional() }), ClusterUpdateJobSchema.nullable(), { auth: "admin" });
151193
+ /**
150968
151194
  * Color-light cap. Coexists with `switch` (on/off) and `brightness`
150969
151195
  * (level) on the same device — `switch` toggles the bulb, `brightness`
150970
151196
  * sets the dim level, this cap sets the chromaticity.
@@ -152295,7 +152521,7 @@ var mediaPlayerCapability = {
152295
152521
  isMuted: { kind: "boolean" }
152296
152522
  } }
152297
152523
  };
152298
- 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.HeatPump, 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, DeviceType.MediaPlayer;
152524
+ 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.HeatPump, 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.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, DeviceType.MediaPlayer;
152299
152525
  var NUMBER = {
152300
152526
  kind: "fixed",
152301
152527
  result: ["number"]
@@ -153788,27 +154014,35 @@ var deviceAdminLinkCapability = {
153788
154014
  getAdminLink: method(object({ deviceId: number$1().int().nonnegative() }), DeviceAdminLinkSchema.nullable(), { auth: "admin" }) }
153789
154015
  };
153790
154016
  /**
153791
- * device-discovery — device-scoped capability for parents that host /
153792
- * enumerate child devices (Reolink Hub / NVR, ONVIF gateway, future
153793
- * integrations). The parent advertises a list of discoverable children,
153794
- * and the operator promotes a subset to real devices via `adoptDevice`.
153795
- * Child lifecycle (kernel device create/remove, parent reference) is
153796
- * owned by the framework so a single shared `<DiscoveryPanel />` can
153797
- * drive any integration.
153798
- *
153799
- * Boundaries:
153800
- * - The cap exposes ENUMERATION + ADOPT/RELEASE only. The protocol
153801
- * used to discover children (CGI poll, mDNS, push from hub, ...)
153802
- * is the integration's business; results land in `runtimeState`
153803
- * so the panel can render without a fresh round-trip.
153804
- * - `childNativeId` is integration-defined and must be stable across
153805
- * reboots so re-discovery doesn't duplicate adopted children.
153806
- * - `adoptDevice` returns the new `deviceId` so the UI can navigate
153807
- * directly to the freshly-created child's settings page.
153808
- */
153809
- /**
153810
- * Status enum for a discovered device. Mirrors the Reolink simpleEvent
153811
- * lifecycle (`online` / `sleeping` / `offline`) — generic enough for
154017
+ * `device-adoption` — generic discovery + adoption surface,
154018
+ * system-scoped collection (one provider per integration addon), routed
154019
+ * by explicit `{ addonId }` on direct `deviceAdoption.*` calls — the same
154020
+ * pin model as `connection-test`. The admin UI keeps using
154021
+ * `deviceManager.adoption*` (which already threads `addonId`). The de-HA-ified
154022
+ * successor to `ha-discovery`:
154023
+ * keyed by `integrationId` (the addon resolves integrationId → broker
154024
+ * internally) rather than a connection-specific `brokerId`, and it
154025
+ * OWNS the shared `DiscoveredChildDevice` candidate type
154026
+ * (declared below) so a single shared adoption modal renders any integration's
154027
+ * candidate tree.
154028
+ *
154029
+ * UI flow (Integrations page → integration detail):
154030
+ * 1. `listCandidates({integrationId, page, pageSize, filter})` →
154031
+ * paginated candidate list, each row collapsed.
154032
+ * 2. User expands a row → `getCandidate({integrationId,
154033
+ * childNativeId})` returns the single candidate (with its nested
154034
+ * `children`) for the accordion render.
154035
+ * 3. User clicks "Adopt" on one or more candidates →
154036
+ * `adopt({integrationId, childNativeIds, perCandidate?})`
154037
+ * materialises one parent CamStack device per candidate plus its
154038
+ * accessory children. `perCandidate[childNativeId]` carries an
154039
+ * optional display-name override + a `hiddenChildIds` pre-hide set
154040
+ * (the parent's `accessories.hiddenChildIds` gates UI visibility).
154041
+ * 4. User clicks "Release" → `release({integrationId, camDeviceId})`
154042
+ * removes the parent + every child from the kernel registry.
154043
+ */
154044
+ /**
154045
+ * Status enum for a discovered device. Generic enough for
153812
154046
  * battery cams, awake cams, and unreachable cams alike.
153813
154047
  */
153814
154048
  var DiscoveredChildStatusSchema = _enum([
@@ -153825,12 +154059,12 @@ var DiscoveredChildDeviceSchema = lazy(() => object({
153825
154059
  /** DeviceType the child should be created with on adopt. */
153826
154060
  type: _enum(DeviceType),
153827
154061
  status: DiscoveredChildStatusSchema,
153828
- /** Free-form integration-specific metadata surfaced in the panel. */
154062
+ /** Free-form integration-specific metadata surfaced in the adoption modal. */
153829
154063
  metadata: object({
153830
154064
  model: string().optional(),
153831
154065
  serialNumber: string().optional(),
153832
154066
  uid: string().optional(),
153833
- /** Reolink: 0-based channel index inside the parent NVR/Hub. */
154067
+ /** Reolink: 0-based channel index inside the parent NVR. */
153834
154068
  rtspChannel: number$1().int().nonnegative().optional(),
153835
154069
  isBattery: boolean().optional(),
153836
154070
  isDoorbell: boolean().optional(),
@@ -153846,137 +154080,24 @@ var DiscoveredChildDeviceSchema = lazy(() => object({
153846
154080
  }).default({}),
153847
154081
  /**
153848
154082
  * `true` when the framework already created a child device for this
153849
- * `childNativeId` under the current parent. The panel uses it to
154083
+ * `childNativeId` under the current parent. The adoption modal uses it to
153850
154084
  * gate the Add/Remove button and surface the existing `deviceId`.
153851
154085
  */
153852
154086
  alreadyAdopted: boolean(),
153853
154087
  /** When `alreadyAdopted=true`, the framework-assigned child device id. */
153854
154088
  adoptedDeviceId: number$1().int().nonnegative().nullable(),
153855
- /** Capability names the candidate advertises — integrations populate, Hubs omit. */
154089
+ /** Capability names the candidate advertises — integrations populate, flat enumerations omit. */
153856
154090
  capabilities: array(string()).readonly().optional(),
153857
- /** Feature flags the candidate advertises — integrations populate, Hubs omit. */
154091
+ /** Feature flags the candidate advertises — integrations populate, flat enumerations omit. */
153858
154092
  features: array(string()).readonly().optional(),
153859
154093
  /** Upstream-system identity + rendering hints for the candidate. */
153860
154094
  sourceInfo: SourceInfoSchema.optional(),
153861
- /** Nested entity-children for accordion preview — integrations populate, Hubs omit. */
154095
+ /** Nested entity-children for accordion preview — integrations populate, flat enumerations omit. */
153862
154096
  children: array(DiscoveredChildDeviceSchema).readonly().optional(),
153863
154097
  /** `childNativeId` of the gateway candidate in the same list this device sits behind. */
153864
154098
  parentStableId: string().optional()
153865
154099
  }));
153866
154100
  /**
153867
- * Status block — populated by the integration after each
153868
- * `refreshDiscovery` (or push-driven update). The runtime-state slice
153869
- * is what the panel reads via the per-device proxy; `getStatus`
153870
- * returns the same payload via the codegen'd auto-injection.
153871
- */
153872
- var DeviceDiscoveryStatusSchema = object({
153873
- discovered: array(DiscoveredChildDeviceSchema),
153874
- /** Wall-clock ms of the last successful enumeration. */
153875
- lastDiscoveryAt: number$1().int().nonnegative().nullable(),
153876
- /** Last error surfaced from the source (rendered as a banner). */
153877
- lastError: string().nullable()
153878
- });
153879
- var deviceDiscoveryCapability = {
153880
- name: "device-discovery",
153881
- scope: "device",
153882
- deviceNative: true,
153883
- mode: "singleton",
153884
- deviceTypes: [DeviceType.Hub],
153885
- status: {
153886
- schema: DeviceDiscoveryStatusSchema,
153887
- kind: "poll"
153888
- },
153889
- runtimeState: DeviceDiscoveryStatusSchema.extend({ lastFetchedAt: number$1().int().nonnegative() }),
153890
- /**
153891
- * Runtime-state durability: **session** — 5.7 KB of scan output on the largest device, fully re-derivable by re-scanning.
153892
- *
153893
- * See `RuntimeStateDurability`. Enforced by
153894
- * `scripts/check-runtime-state-durability.ts`.
153895
- */
153896
- durability: "session",
153897
- /**
153898
- * History (D850): none — inventory.
153899
- */
153900
- history: "none",
153901
- methods: {
153902
- /**
153903
- * Snapshot of the current `discovered` list. Returns the
153904
- * runtime-state cache — call `refreshDiscovery` first if a
153905
- * fresh round-trip to the source is required.
153906
- */
153907
- listDiscovered: method(object({ deviceId: number$1().int().nonnegative() }), array(DiscoveredChildDeviceSchema).readonly()),
153908
- /**
153909
- * Force the integration to re-enumerate and update the
153910
- * runtime-state slice. Returns the freshly-enumerated list (also
153911
- * available via `listDiscovered` post-call).
153912
- */
153913
- refreshDiscovery: method(object({ deviceId: number$1().int().nonnegative() }), array(DiscoveredChildDeviceSchema).readonly(), {
153914
- kind: "mutation",
153915
- auth: "admin"
153916
- }),
153917
- /**
153918
- * Promote a discovered entry to a real child device. The framework
153919
- * creates the child via `kernel.devices.create()` with
153920
- * `parentDeviceId = parent.id` and seeds the child's config from
153921
- * `childInitialConfig` (driver-defined; usually carries channel +
153922
- * uid + parent reference). Returns the kernel-assigned numeric id.
153923
- */
153924
- adoptDevice: method(object({
153925
- deviceId: number$1().int().nonnegative(),
153926
- childNativeId: string(),
153927
- /** Optional override for the child's display name. */
153928
- name: string().optional()
153929
- }), object({
153930
- deviceId: number$1().int().nonnegative(),
153931
- stableId: string()
153932
- }), {
153933
- kind: "mutation",
153934
- auth: "admin"
153935
- }),
153936
- /**
153937
- * Inverse of `adoptDevice`: removes the child device from the
153938
- * kernel registry. The discovered entry remains in the
153939
- * enumeration (status updates resume) so the operator can re-adopt
153940
- * it later without a fresh refresh.
153941
- */
153942
- releaseDevice: method(object({
153943
- deviceId: number$1().int().nonnegative(),
153944
- childDeviceId: number$1().int().nonnegative()
153945
- }), _void(), {
153946
- kind: "mutation",
153947
- auth: "admin"
153948
- })
153949
- }
153950
- };
153951
- /**
153952
- * `device-adoption` — generic discovery + adoption surface,
153953
- * system-scoped collection (one provider per integration addon), routed
153954
- * by explicit `{ addonId }` on direct `deviceAdoption.*` calls — the same
153955
- * pin model as `connection-test`. The admin UI keeps using
153956
- * `deviceManager.adoption*` (which already threads `addonId`). The de-HA-ified
153957
- * successor to `ha-discovery`:
153958
- * keyed by `integrationId` (the addon resolves integrationId → broker
153959
- * internally) rather than a connection-specific `brokerId`, and it
153960
- * REUSES the shared `DiscoveredChildDevice` candidate type from
153961
- * `device-discovery.cap.ts` so a single shared adoption panel renders
153962
- * any integration's candidate tree.
153963
- *
153964
- * UI flow (Integrations page → integration detail):
153965
- * 1. `listCandidates({integrationId, page, pageSize, filter})` →
153966
- * paginated candidate list, each row collapsed.
153967
- * 2. User expands a row → `getCandidate({integrationId,
153968
- * childNativeId})` returns the single candidate (with its nested
153969
- * `children`) for the accordion render.
153970
- * 3. User clicks "Adopt" on one or more candidates →
153971
- * `adopt({integrationId, childNativeIds, perCandidate?})`
153972
- * materialises one parent CamStack device per candidate plus its
153973
- * accessory children. `perCandidate[childNativeId]` carries an
153974
- * optional display-name override + a `hiddenChildIds` pre-hide set
153975
- * (the parent's `accessories.hiddenChildIds` gates UI visibility).
153976
- * 4. User clicks "Release" → `release({integrationId, camDeviceId})`
153977
- * removes the parent + every child from the kernel registry.
153978
- */
153979
- /**
153980
154101
  * Provider-declared discovery *granularity* filter (the keystone of the
153981
154102
  * single-entity-import design). A provider advertises which discovery
153982
154103
  * granularities it supports via `listCandidateFilters`; the operator picks
@@ -154437,6 +154558,90 @@ var SiteZoneSchema = object({
154437
154558
  * the ones that most want grouping. */
154438
154559
  locationKeys: array(string())
154439
154560
  });
154561
+ var DeviceSearchRequiresSchema = object({
154562
+ /** Capability names the field wants a value of. */
154563
+ caps: array(string()).readonly(),
154564
+ /** `any` (default): a device with one of them is compatible. `all`: it must hold every one. */
154565
+ mode: _enum(["any", "all"]).optional()
154566
+ });
154567
+ var DeviceSearchFiltersSchema = object({
154568
+ locations: array(string()).readonly().optional(),
154569
+ integrationIds: array(string()).readonly().optional(),
154570
+ types: array(string()).readonly().optional()
154571
+ });
154572
+ var DeviceSearchInputSchema = object({
154573
+ /** Matches name, location, type, integration (id and label) and id. Case-insensitive. */
154574
+ text: string().optional(),
154575
+ requires: DeviceSearchRequiresSchema.optional(),
154576
+ filters: DeviceSearchFiltersSchema.optional(),
154577
+ /** List the devices that do not provide the required cap too (greyed, not pickable). */
154578
+ includeIncompatible: boolean().optional(),
154579
+ /** The device the field belongs to: its location drives `suggested`. */
154580
+ contextDeviceId: number$1().optional(),
154581
+ /**
154582
+ * Resolve exactly these devices, regardless of every filter, so a picked
154583
+ * value can be rendered. When given, `items` is these devices in the order
154584
+ * asked (no paging, `nextCursor` null) and the ones that do not exist are
154585
+ * listed in `missingIds`.
154586
+ */
154587
+ ids: array(number$1()).readonly().optional(),
154588
+ cursor: string().nullable().optional(),
154589
+ limit: number$1().int().min(1).max(200).optional()
154590
+ });
154591
+ var DeviceValueOptionSchema = object({
154592
+ cap: string(),
154593
+ /** Status-schema field path inside the cap (same paths as `getWireableFields`). */
154594
+ path: string(),
154595
+ label: string(),
154596
+ /** The current value as text; `null` when it is unknown or the read FAILED — never `0`. */
154597
+ reading: string().nullable(),
154598
+ unit: string().nullable().optional(),
154599
+ /** The field's measured quantity, when the cap declares one, so a client can format the reading. */
154600
+ quantity: ReadingQuantitySchema.optional()
154601
+ });
154602
+ var DeviceSearchItemSchema = object({
154603
+ id: number$1(),
154604
+ name: string(),
154605
+ type: _enum(DeviceType),
154606
+ location: string().nullable(),
154607
+ integrationId: string().nullable(),
154608
+ integrationLabel: string().nullable(),
154609
+ online: boolean().nullable(),
154610
+ disabled: boolean(),
154611
+ compatible: boolean(),
154612
+ /** Only the required caps' fields; empty when nothing was required or the device is incompatible. */
154613
+ values: array(DeviceValueOptionSchema).readonly()
154614
+ });
154615
+ var DeviceSearchFacetValueSchema = object({
154616
+ value: string(),
154617
+ count: number$1()
154618
+ });
154619
+ var DeviceSearchFacetIntegrationSchema = object({
154620
+ id: string(),
154621
+ label: string(),
154622
+ count: number$1()
154623
+ });
154624
+ var DeviceSearchFacetsSchema = object({
154625
+ locations: array(DeviceSearchFacetValueSchema).readonly(),
154626
+ integrations: array(DeviceSearchFacetIntegrationSchema).readonly(),
154627
+ types: array(DeviceSearchFacetValueSchema).readonly()
154628
+ });
154629
+ var DeviceSearchResultSchema = object({
154630
+ items: array(DeviceSearchItemSchema).readonly(),
154631
+ nextCursor: string().nullable(),
154632
+ /** Devices listed by this query across all pages (filters + text applied; incompatible counted only when `includeIncompatible`). */
154633
+ total: number$1(),
154634
+ /** Compatible devices after filters + text. */
154635
+ compatibleTotal: number$1(),
154636
+ /** Every device the caller's fleet holds, before anything is applied. */
154637
+ fleetTotal: number$1(),
154638
+ /** Incompatible devices after filters + text — the K of "show the K that don't". */
154639
+ hiddenIncompatible: number$1(),
154640
+ facets: DeviceSearchFacetsSchema,
154641
+ /** Same location as `contextDeviceId`; first page only. */
154642
+ suggested: array(DeviceSearchItemSchema).readonly(),
154643
+ missingIds: array(number$1()).readonly()
154644
+ });
154440
154645
  var ProviderStatusSchema = object({
154441
154646
  connected: boolean(),
154442
154647
  deviceCount: number$1(),
@@ -154922,6 +155127,9 @@ var DeviceInfoSchema = object({
154922
155127
  * named accordion sections (with optional intra-section order). See
154923
155128
  * `DeviceMeta.childLayout`. Absent ⇒ no layout declared. */
154924
155129
  childLayout: array(ChildLayoutEntrySchema).readonly().optional(),
155130
+ /** The children a container stands for, most preferred first, by accessory
155131
+ * `childKey`. Provider-declared. See `DeviceMeta.primaryChildPreference`. */
155132
+ primaryChildPreference: array(string()).readonly().optional(),
154925
155133
  /** Operator-authored per-device display override. See `DeviceMeta.display`. */
154926
155134
  display: DeviceDisplayOverrideSchema.optional()
154927
155135
  });
@@ -155070,6 +155278,9 @@ var DeviceMetaSchema = object({
155070
155278
  * accordion sections (with optional intra-section order). See
155071
155279
  * `DeviceMeta.childLayout`. Absent ⇒ no layout declared. */
155072
155280
  childLayout: array(ChildLayoutEntrySchema).readonly().optional(),
155281
+ /** The children a container stands for, most preferred first, by accessory
155282
+ * `childKey`. Provider-declared. See `DeviceMeta.primaryChildPreference`. */
155283
+ primaryChildPreference: array(string()).readonly().optional(),
155073
155284
  /** Semantic role string (`DeviceRole`) — propagated from the spawn pre-seed.
155074
155285
  * Optional: only present for accessory children that carry a known role. */
155075
155286
  role: string().nullable().optional(),
@@ -155285,6 +155496,12 @@ method(object({
155285
155496
  }), _void(), {
155286
155497
  kind: "mutation",
155287
155498
  auth: "admin"
155499
+ }), method(object({
155500
+ deviceId: number$1(),
155501
+ primaryChildPreference: array(string()).readonly()
155502
+ }), _void(), {
155503
+ kind: "mutation",
155504
+ auth: "admin"
155288
155505
  }), method(object({
155289
155506
  deviceId: number$1(),
155290
155507
  display: DeviceDisplayOverrideSchema.nullable()
@@ -155422,7 +155639,7 @@ method(object({
155422
155639
  * it answers today and the caller filters as it already does.
155423
155640
  */
155424
155641
  deviceIds: array(number$1()).optional()
155425
- }), array(DeviceInfoSchema), { role: "viewer" }), method(object({ deviceId: number$1() }), DeviceInfoSchema.nullable()), method(object({ parentDeviceId: number$1() }), array(DeviceInfoSchema), { role: "viewer" }), method(object({ parentDeviceIds: array(number$1()).max(256) }), record(string(), array(DeviceInfoSchema))), method(object({ deviceId: number$1() }), object({
155642
+ }), array(DeviceInfoSchema), { role: "viewer" }), method(DeviceSearchInputSchema, DeviceSearchResultSchema, { role: "viewer" }), method(object({ deviceId: number$1() }), DeviceInfoSchema.nullable()), method(object({ parentDeviceId: number$1() }), array(DeviceInfoSchema), { role: "viewer" }), method(object({ parentDeviceIds: array(number$1()).max(256) }), record(string(), array(DeviceInfoSchema))), method(object({ deviceId: number$1() }), object({
155426
155643
  mode: LinkedDevicesModeSchema,
155427
155644
  devices: array(LinkedDeviceSchema)
155428
155645
  }), { role: "viewer" }), method(object({ deviceIds: array(number$1()) }), array(LinkedDevicesForDeviceSchema), { role: "viewer" }), method(object({ deviceId: number$1() }), array(StreamSourceEntrySchema$1)), method(object({ deviceId: number$1() }), array(ConfigEntrySchema)), method(object({ deviceId: number$1() }), ConfigUISchemaOutput), method(object({
@@ -159095,13 +159312,11 @@ var HeroConfirmSchema = _enum([
159095
159312
  "press"
159096
159313
  ]);
159097
159314
  var HeroActionSchema = object({
159098
- /** Unique within the model; the `gated` list and the specs name it. */
159099
159315
  id: string(),
159100
159316
  label: HeroTextSchema,
159101
159317
  icon: IconKeySchema,
159102
159318
  call: HeroCallSchema,
159103
159319
  emphasis: _enum(["primary", "normal"]),
159104
- /** Ask before running it. */
159105
159320
  confirm: HeroConfirmSchema.nullable()
159106
159321
  });
159107
159322
  var HeroControlSchema = discriminatedUnion("kind", [
@@ -159152,6 +159367,8 @@ var HeroPillSchema = object({
159152
159367
  });
159153
159368
  var HeroRowSchema = object({
159154
159369
  id: HeroRowIdSchema,
159370
+ /** `scene`: the row's action and slider controls are drawn on the scene. Absent: an ordinary row. */
159371
+ placement: _enum(["row", "scene"]).optional(),
159155
159372
  /** The row's own name when the kind's label would not tell rows of one kind apart (a circuit's label). */
159156
159373
  label: HeroTextSchema.optional(),
159157
159374
  /** A group header drawn above the row when it differs from the previous row's ("System"). */
@@ -159182,9 +159399,16 @@ var HeroBadgeSchema = object({
159182
159399
  value: number$1().nullable(),
159183
159400
  label: HeroTextSchema
159184
159401
  });
159185
- var HeroRemoteSlotSchema = object({
159186
- /** Saved commands; `null` = not known yet (the button still shows). */
159187
- commands: number$1().int().nullable() });
159402
+ var HeroRemoteSlotSchema = object({
159403
+ /** Saved commands; `null` = not known yet (the button still shows). */
159404
+ commands: number$1().int().nullable(),
159405
+ /**
159406
+ * The control a list row draws as the "open the remote" icon. Recognised by its id
159407
+ * ({@link REMOTE_OPEN_ACTION_ID}); it changes no state, so a client opens the remote
159408
+ * instead of running `call`. Absent on a model from an older server.
159409
+ */
159410
+ open: HeroActionSchema.optional()
159411
+ });
159188
159412
  var HeroConsumablesSlotSchema = object({
159189
159413
  items: array(object({
159190
159414
  key: string(),
@@ -159352,6 +159576,8 @@ var HeroModelSchema = object({
159352
159576
  * the FIRST row that has any (a later row's control is never promoted). When
159353
159577
  * the model lists that part in `gated`, the row has no inline control: the
159354
159578
  * projection never falls through to another control the caller could use.
159579
+ * - a climate or thermostat row's primary is its `climate.mode` control (no power
159580
+ * toggle: "off" is a mode); when the model gates it the rule above applies as before;
159355
159581
  * - a timed run, when the model carries the slot, sits beside that primary:
159356
159582
  * Run while idle, Stop while armed. Gating the slot hides the control.
159357
159583
  * - the status line is the head (what plays, else the state) plus at most
@@ -159359,6 +159585,13 @@ var HeroModelSchema = object({
159359
159585
  * time left on an armed timed run;
159360
159586
  * - the trailing fact is the first of power, battery, consumables.
159361
159587
  *
159588
+ * - `extras` are the further inline controls of the types that carry more than one
159589
+ * ({@link ROW_EXTRAS_BY_TYPE}): climate setpoint, a robot's return to base,
159590
+ * a player's volume and remote. Each is a control the model already has, named by id,
159591
+ * in that order and at most {@link ROW_EXTRAS_MAX}; one the model lacks, or lists in
159592
+ * `gated`, is absent, and the one `primary` already is never repeats. Empty = the
159593
+ * row of an older server: `primary` alone.
159594
+ *
159362
159595
  * `projectDeviceRow` is pure and computes nothing: it selects from a
159363
159596
  * {@link HeroModel}. A row that needed a value the hero lacks would mean the
159364
159597
  * model is missing it, so the fix goes in the model.
@@ -159390,8 +159623,16 @@ var HeroRowModelSchema = object({
159390
159623
  * while armed. `null` when there is no slot, or the caller may not act.
159391
159624
  */
159392
159625
  timedRun: HeroRowTimedRunSchema.nullable(),
159626
+ /**
159627
+ * The further inline controls after `primary`, in order (see the header). The remote
159628
+ * is an `action` with id `remote.open`: the client opens the remote, it does not run
159629
+ * the call. Absent or empty = `primary` alone.
159630
+ */
159631
+ extras: array(HeroControlSchema).max(2).optional(),
159393
159632
  trailing: HeroFactSchema.nullable()
159394
159633
  });
159634
+ DeviceType.Climate, DeviceType.Thermostat;
159635
+ DeviceType.Climate, DeviceType.Thermostat, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.MediaPlayer;
159395
159636
  /**
159396
159637
  * hero-layout — what a device's hero says (D1023). Read-only: the FIXED
159397
159638
  * layouts live in `@camstack/types` and nothing here stores or edits one.
@@ -170982,13 +171223,23 @@ var NcRuleTargetSchema = object({
170982
171223
  */
170983
171224
  params: record(string(), unknown()).optional()
170984
171225
  });
171226
+ /** Which picture kind one target receives (#487). */
171227
+ var NcTargetAttachmentSchema = _enum([
171228
+ "none",
171229
+ "image",
171230
+ "clip",
171231
+ "gif"
171232
+ ]);
170985
171233
  var NcTargetOverrideSchema = object({
170986
171234
  template: object({
170987
171235
  title: string().max(500).optional(),
170988
171236
  body: string().max(2e3).optional()
170989
171237
  }).optional(),
170990
171238
  schedule: NcScheduleSchema.optional(),
170991
- priority: number$1().int().min(1).max(5).optional()
171239
+ priority: number$1().int().min(1).max(5).optional(),
171240
+ attachment: NcTargetAttachmentSchema.optional(),
171241
+ /** `false` = no buttons for this target; `true` is the same as absent. */
171242
+ actions: boolean().optional()
170992
171243
  });
170993
171244
  /** Per-target settings keyed by target id (#487). */
170994
171245
  var NcTargetOverridesSchema = record(string(), NcTargetOverrideSchema);
@@ -173225,9 +173476,13 @@ var petFeederCapability = {
173225
173476
  */
173226
173477
  durability: "session",
173227
173478
  /**
173228
- * History (D850): recorded series.
173479
+ * History (D850): recorded series. `feeding` / `eating` are the meals the
173480
+ * device hero's "Meals" button names — change-only booleans, so a dispense
173481
+ * or a pet at the bowl is one span on the history.
173229
173482
  */
173230
173483
  history: { fields: {
173484
+ feeding: { kind: "boolean" },
173485
+ eating: { kind: "boolean" },
173231
173486
  foodLevel: { kind: "gauge" },
173232
173487
  bowlFood: { kind: "gauge" },
173233
173488
  food1: { kind: "gauge" },
@@ -175020,7 +175275,6 @@ var PowerSourceStateSchema = object({
175020
175275
  });
175021
175276
  var POWER_SOURCE_DEVICE_TYPES = [
175022
175277
  DeviceType.Gateway,
175023
- DeviceType.Hub,
175024
175278
  DeviceType.Camera,
175025
175279
  DeviceType.Sensor,
175026
175280
  DeviceType.MediaPlayer,
@@ -175072,18 +175326,18 @@ var powerSourceCapability = {
175072
175326
  mode: "singleton",
175073
175327
  deviceTypes: POWER_SOURCE_DEVICE_TYPES,
175074
175328
  methods: {
175075
- getStatus: systemMethod(deviceInput$1, PowerSourceInfoSchema, { auth: "admin" }),
175329
+ getStatus: systemMethod(deviceInput$1, PowerSourceInfoSchema, { auth: "protected" }),
175076
175330
  powerOn: systemMethod(deviceInput$1, PowerSourceActionResultSchema, {
175077
175331
  kind: "mutation",
175078
- auth: "admin"
175332
+ auth: "protected"
175079
175333
  }),
175080
175334
  powerOff: systemMethod(deviceInput$1, PowerSourceActionResultSchema, {
175081
175335
  kind: "mutation",
175082
- auth: "admin"
175336
+ auth: "protected"
175083
175337
  }),
175084
175338
  forceRestart: systemMethod(deviceInput$1, PowerSourceActionResultSchema, {
175085
175339
  kind: "mutation",
175086
- auth: "admin"
175340
+ auth: "protected"
175087
175341
  })
175088
175342
  },
175089
175343
  runtimeState: PowerSourceStateSchema,
@@ -185829,7 +186083,6 @@ var DEVICE_LOCAL_STATE_CAPS = {
185829
186083
  control: controlCapability,
185830
186084
  cover: coverCapability,
185831
186085
  dayNight: dayNightCapability,
185832
- deviceDiscovery: deviceDiscoveryCapability,
185833
186086
  deviceStatus: deviceStatusCapability,
185834
186087
  dishwasher: dishwasherCapability,
185835
186088
  doNotDisturb: doNotDisturbCapability,
@@ -191008,6 +191261,27 @@ Object.freeze({
191008
191261
  access: "create",
191009
191262
  role: "viewer"
191010
191263
  },
191264
+ "clusterUpdate.getClusterUpdateJob": {
191265
+ capName: "cluster-update",
191266
+ capScope: "system",
191267
+ addonId: null,
191268
+ access: "view",
191269
+ role: "admin"
191270
+ },
191271
+ "clusterUpdate.previewClusterUpdate": {
191272
+ capName: "cluster-update",
191273
+ capScope: "system",
191274
+ addonId: null,
191275
+ access: "view",
191276
+ role: "admin"
191277
+ },
191278
+ "clusterUpdate.startClusterUpdate": {
191279
+ capName: "cluster-update",
191280
+ capScope: "system",
191281
+ addonId: null,
191282
+ access: "create",
191283
+ role: "admin"
191284
+ },
191011
191285
  "color.getStatus": {
191012
191286
  capName: "color",
191013
191287
  capScope: "device",
@@ -191610,41 +191884,6 @@ Object.freeze({
191610
191884
  access: "create",
191611
191885
  role: "admin"
191612
191886
  },
191613
- "deviceDiscovery.adoptDevice": {
191614
- capName: "device-discovery",
191615
- capScope: "device",
191616
- addonId: null,
191617
- access: "create",
191618
- role: "admin"
191619
- },
191620
- "deviceDiscovery.getStatus": {
191621
- capName: "device-discovery",
191622
- capScope: "device",
191623
- addonId: null,
191624
- access: "view",
191625
- role: "viewer"
191626
- },
191627
- "deviceDiscovery.listDiscovered": {
191628
- capName: "device-discovery",
191629
- capScope: "device",
191630
- addonId: null,
191631
- access: "view",
191632
- role: "viewer"
191633
- },
191634
- "deviceDiscovery.refreshDiscovery": {
191635
- capName: "device-discovery",
191636
- capScope: "device",
191637
- addonId: null,
191638
- access: "create",
191639
- role: "admin"
191640
- },
191641
- "deviceDiscovery.releaseDevice": {
191642
- capName: "device-discovery",
191643
- capScope: "device",
191644
- addonId: null,
191645
- access: "create",
191646
- role: "admin"
191647
- },
191648
191887
  "deviceExport.applyDeviceSettingsPatch": {
191649
191888
  capName: "device-export",
191650
191889
  capScope: "system",
@@ -192380,6 +192619,13 @@ Object.freeze({
192380
192619
  access: "create",
192381
192620
  role: "admin"
192382
192621
  },
192622
+ "deviceManager.search": {
192623
+ capName: "device-manager",
192624
+ capScope: "system",
192625
+ addonId: null,
192626
+ access: "view",
192627
+ role: "viewer"
192628
+ },
192383
192629
  "deviceManager.setAlias": {
192384
192630
  capName: "device-manager",
192385
192631
  capScope: "system",
@@ -192471,6 +192717,13 @@ Object.freeze({
192471
192717
  access: "create",
192472
192718
  role: "admin"
192473
192719
  },
192720
+ "deviceManager.setPrimaryChildPreference": {
192721
+ capName: "device-manager",
192722
+ capScope: "system",
192723
+ addonId: null,
192724
+ access: "create",
192725
+ role: "admin"
192726
+ },
192474
192727
  "deviceManager.setRole": {
192475
192728
  capName: "device-manager",
192476
192729
  capScope: "system",
@@ -197110,28 +197363,28 @@ Object.freeze({
197110
197363
  capScope: "device",
197111
197364
  addonId: null,
197112
197365
  access: "create",
197113
- role: "admin"
197366
+ role: "viewer"
197114
197367
  },
197115
197368
  "powerSource.getStatus": {
197116
197369
  capName: "power-source",
197117
197370
  capScope: "device",
197118
197371
  addonId: null,
197119
197372
  access: "view",
197120
- role: "admin"
197373
+ role: "viewer"
197121
197374
  },
197122
197375
  "powerSource.powerOff": {
197123
197376
  capName: "power-source",
197124
197377
  capScope: "device",
197125
197378
  addonId: null,
197126
197379
  access: "create",
197127
- role: "admin"
197380
+ role: "viewer"
197128
197381
  },
197129
197382
  "powerSource.powerOn": {
197130
197383
  capName: "power-source",
197131
197384
  capScope: "device",
197132
197385
  addonId: null,
197133
197386
  access: "create",
197134
- role: "admin"
197387
+ role: "viewer"
197135
197388
  },
197136
197389
  "presence.getStatus": {
197137
197390
  capName: "presence",
@@ -200840,35 +201093,6 @@ Object.freeze({
200840
201093
  form: "single",
200841
201094
  optional: false
200842
201095
  }],
200843
- "deviceDiscovery.adoptDevice": [{
200844
- name: "deviceId",
200845
- form: "single",
200846
- optional: false
200847
- }],
200848
- "deviceDiscovery.getStatus": [{
200849
- name: "deviceId",
200850
- form: "single",
200851
- optional: false
200852
- }],
200853
- "deviceDiscovery.listDiscovered": [{
200854
- name: "deviceId",
200855
- form: "single",
200856
- optional: false
200857
- }],
200858
- "deviceDiscovery.refreshDiscovery": [{
200859
- name: "deviceId",
200860
- form: "single",
200861
- optional: false
200862
- }],
200863
- "deviceDiscovery.releaseDevice": [{
200864
- name: "childDeviceId",
200865
- form: "single",
200866
- optional: false
200867
- }, {
200868
- name: "deviceId",
200869
- form: "single",
200870
- optional: false
200871
- }],
200872
201096
  "deviceExport.applyDeviceSettingsPatch": [{
200873
201097
  name: "deviceId",
200874
201098
  form: "single",
@@ -201147,6 +201371,11 @@ Object.freeze({
201147
201371
  form: "single",
201148
201372
  optional: false
201149
201373
  }],
201374
+ "deviceManager.setPrimaryChildPreference": [{
201375
+ name: "deviceId",
201376
+ form: "single",
201377
+ optional: false
201378
+ }],
201150
201379
  "deviceManager.setRole": [{
201151
201380
  name: "deviceId",
201152
201381
  form: "single",
@@ -204615,7 +204844,9 @@ var TimelapseRuleInputSchema = object({
204615
204844
  /** Classes the notification counts — see {@link ReportClassesField}. */
204616
204845
  reportClasses: ReportClassesField.optional(),
204617
204846
  /** Canonical notification priority ordinal (1..5); per-target overridable. */
204618
- priority: PriorityField.default(3)
204847
+ priority: PriorityField.default(3),
204848
+ /** Per-target settings keyed by target id (D1032) — absent = every target follows the rule. */
204849
+ targetOverrides: NcTargetOverridesSchema.optional()
204619
204850
  });
204620
204851
  object({
204621
204852
  name: NameField.optional(),
@@ -204631,7 +204862,9 @@ object({
204631
204862
  previewText: PreviewTextField.optional(),
204632
204863
  previewMode: PreviewModeField.optional(),
204633
204864
  reportClasses: ReportClassesField.optional(),
204634
- priority: PriorityField.optional()
204865
+ priority: PriorityField.optional(),
204866
+ /** Per-target settings keyed by target id (D1032) — absent = every target follows the rule. */
204867
+ targetOverrides: NcTargetOverridesSchema.optional()
204635
204868
  });
204636
204869
  TimelapseRuleInputSchema.extend({
204637
204870
  id: string(),
@@ -212989,6 +213222,19 @@ var HUB_DISCOVERY_REFRESH_TIMEOUT_MS = 8e3;
212989
213222
  var HUB_CHILD_SLEEP_RECONCILE_MS = 6e4;
212990
213223
  var HUB_RECONNECT_BASE_MS = 2e3;
212991
213224
  var HUB_RECONNECT_MAX_MS = 3e4;
213225
+ /**
213226
+ * Threshold for marking an adopted child offline when missing from consecutive refreshes.
213227
+ * 10 minutes covers ~3 default refresh cycles + transient firmware latency without
213228
+ * false-flagging battery cams that take a few cycles to wake into the list.
213229
+ */
213230
+ var HUB_MISSING_OFFLINE_MS = 10 * 6e4;
213231
+ /**
213232
+ * Longer grace for a child flagged asleep that drops off a non-empty hub list. A sleeping battery
213233
+ * camera may vanish from the summary for hours, but `battery.sleeping` is a persisted slice: a
213234
+ * camera that died or was unplugged while flagged asleep must still go offline eventually.
213235
+ * Measured from the last time the hub actually LISTED the child.
213236
+ */
213237
+ var SLEEPING_MISSING_OFFLINE_MS = 360 * 6e4;
212992
213238
  var UNROUTED_LOG_THROTTLE_MS = 6e4;
212993
213239
  /**
212994
213240
  * ONE Reolink NVR / Home Hub: a single Baichuan control + event socket fronting N channels,
@@ -213021,6 +213267,10 @@ var ReolinkHubSession = class {
213021
213267
  #refreshInFlight = null;
213022
213268
  /** Wall-clock ms of the last refresh that listed each child (by device id). */
213023
213269
  #childLastSeenAt = /* @__PURE__ */ new Map();
213270
+ /** The empty-list warning fired and the list has not been non-empty since. */
213271
+ #emptyListWarned = false;
213272
+ /** Children THIS session marked offline for being missing from the list (the only ones it may restore). */
213273
+ #offlineByMissing = /* @__PURE__ */ new Set();
213024
213274
  /** Channels the last good refresh listed but nobody adopted: their pushes are expected drops. */
213025
213275
  #knownUnadoptedChannels = /* @__PURE__ */ new Set();
213026
213276
  #unroutedLoggedAt = /* @__PURE__ */ new Map();
@@ -213319,13 +213569,25 @@ var ReolinkHubSession = class {
213319
213569
  */
213320
213570
  reconcileChildOnline(channels) {
213321
213571
  const now = this.#now();
213572
+ const cameras = this.#deps.children().filter((c) => c.channel !== void 0 && c.type === DeviceType.Camera);
213573
+ if (channels.length === 0 && cameras.length > 0) {
213574
+ if (!this.#emptyListWarned) {
213575
+ this.#emptyListWarned = true;
213576
+ this.#logger.warn("Reolink hub: channel list came back empty with adopted children — online state left unchanged", {
213577
+ tags: { integrationId: this.integrationId },
213578
+ meta: { adopted: cameras.length }
213579
+ });
213580
+ }
213581
+ return;
213582
+ }
213583
+ if (channels.length > 0) this.#emptyListWarned = false;
213322
213584
  const listed = new Set(channels.map((c) => c.channel));
213323
- for (const child of this.#deps.children()) {
213585
+ for (const child of cameras) {
213324
213586
  const ch = child.channel;
213325
213587
  if (ch === void 0) continue;
213326
- if (child.type !== DeviceType.Camera) continue;
213327
213588
  if (listed.has(ch)) {
213328
213589
  this.#childLastSeenAt.set(child.id, now);
213590
+ this.#offlineByMissing.delete(child.id);
213329
213591
  if (!child.online) {
213330
213592
  child.markOnline(true);
213331
213593
  this.#logger.info("Reolink hub: adopted child back online", {
@@ -213338,10 +213600,28 @@ var ReolinkHubSession = class {
213338
213600
  }
213339
213601
  continue;
213340
213602
  }
213341
- const lastSeen = this.#childLastSeenAt.get(child.id) ?? 0;
213342
- const missingMs = lastSeen > 0 ? now - lastSeen : Number.POSITIVE_INFINITY;
213343
- if (missingMs >= 6e5 && child.online) {
213603
+ let lastSeen = this.#childLastSeenAt.get(child.id);
213604
+ if (lastSeen === void 0) {
213605
+ lastSeen = now;
213606
+ this.#childLastSeenAt.set(child.id, now);
213607
+ }
213608
+ if (child.sleeping && !child.online && this.#offlineByMissing.has(child.id) && now - lastSeen < 216e5) {
213609
+ this.#offlineByMissing.delete(child.id);
213610
+ child.markOnline(true);
213611
+ this.#logger.info("Reolink hub: sleeping child restored to online", {
213612
+ tags: {
213613
+ deviceId: child.id,
213614
+ deviceName: child.name
213615
+ },
213616
+ meta: { channel: ch }
213617
+ });
213618
+ continue;
213619
+ }
213620
+ const graceMs = child.sleeping ? SLEEPING_MISSING_OFFLINE_MS : HUB_MISSING_OFFLINE_MS;
213621
+ const missingMs = now - lastSeen;
213622
+ if (missingMs >= graceMs && child.online) {
213344
213623
  child.markOnline(false);
213624
+ this.#offlineByMissing.add(child.id);
213345
213625
  this.#logger.warn("Reolink hub: adopted child marked offline (missing from the hub list)", {
213346
213626
  tags: {
213347
213627
  deviceId: child.id,
@@ -217463,6 +217743,9 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
217463
217743
  get online() {
217464
217744
  return camera.online;
217465
217745
  },
217746
+ get sleeping() {
217747
+ return camera.sleeping;
217748
+ },
217466
217749
  get debugGeneral() {
217467
217750
  return camera.config.get("debugGeneral") === true;
217468
217751
  },