@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.mjs CHANGED
@@ -101490,7 +101490,7 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
101490
101490
  return EventCategory;
101491
101491
  }({});
101492
101492
  //#endregion
101493
- //#region ../types/dist/composed-stable-id-jnvhwGoH.mjs
101493
+ //#region ../types/dist/composed-stable-id-DFNyOFzz.mjs
101494
101494
  /**
101495
101495
  import { errMsg } from '@camstack/types'
101496
101496
  * Extract a human-readable message from an unknown error value.
@@ -101503,6 +101503,7 @@ function errMsg$3(err) {
101503
101503
  }
101504
101504
  var DeviceType = /* @__PURE__ */ function(DeviceType) {
101505
101505
  DeviceType["Camera"] = "camera";
101506
+ /** Legacy stored value, read only by the hub-to-integration migrations; no live device carries it. */
101506
101507
  DeviceType["Hub"] = "hub";
101507
101508
  DeviceType["Light"] = "light";
101508
101509
  DeviceType["Siren"] = "siren";
@@ -106714,7 +106715,7 @@ var ZodIssueCode = {
106714
106715
  var ZodFirstPartyTypeKind;
106715
106716
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
106716
106717
  //#endregion
106717
- //#region ../types/dist/sleep-Dz1P6--1.mjs
106718
+ //#region ../types/dist/sleep-D_NpiLFP.mjs
106718
106719
  /**
106719
106720
  * The audio chunk plane's byte format, and the ONE expansion from a coded
106720
106721
  * window to float samples (D455).
@@ -114616,10 +114617,6 @@ var CAMERA_CAP_VOCABULARY = {
114616
114617
  scope: "device",
114617
114618
  noun: t("Admin link", "Link di amministrazione")
114618
114619
  },
114619
- "device-discovery": {
114620
- scope: "device",
114621
- noun: t("Discovery", "Rilevamento dispositivi")
114622
- },
114623
114620
  "device-extension": {
114624
114621
  scope: "device",
114625
114622
  noun: t("Device extension", "Estensione del dispositivo")
@@ -115791,6 +115788,7 @@ var SYSTEM_CAP_VOCABULARY = {
115791
115788
  backup: system("system backups — run and restored from the Backups page"),
115792
115789
  broker: system("message-broker connections — configured, not actuated"),
115793
115790
  "calendar-source": system(INTERNAL),
115791
+ "cluster-update": system(CLUSTER),
115794
115792
  calendars: system("calendars feed schedules and conditions, not device actions"),
115795
115793
  composer: system("device composition — an authoring tool, not an action"),
115796
115794
  "core-blocks": system(INTERNAL),
@@ -116092,6 +116090,7 @@ var CAP_NAMES = Object.freeze([
116092
116090
  "camera-streams",
116093
116091
  "carbon-monoxide",
116094
116092
  "climate-control",
116093
+ "cluster-update",
116095
116094
  "color",
116096
116095
  "composer",
116097
116096
  "connectivity",
@@ -116109,7 +116108,6 @@ var CAP_NAMES = Object.freeze([
116109
116108
  "device-admin-link",
116110
116109
  "device-adoption",
116111
116110
  "device-credentials",
116112
- "device-discovery",
116113
116111
  "device-export",
116114
116112
  "device-extension",
116115
116113
  "device-history",
@@ -116731,13 +116729,6 @@ Object.freeze({
116731
116729
  "valueType": "string"
116732
116730
  }
116733
116731
  ],
116734
- "device-discovery": [{
116735
- "path": "lastDiscoveryAt",
116736
- "valueType": "number"
116737
- }, {
116738
- "path": "lastError",
116739
- "valueType": "string"
116740
- }],
116741
116732
  "device-export": [
116742
116733
  {
116743
116734
  "path": "linkState",
@@ -118213,7 +118204,7 @@ function sleep(ms) {
118213
118204
  return new Promise((resolve) => setTimeout(resolve, Math.max(0, ms)));
118214
118205
  }
118215
118206
  //#endregion
118216
- //#region ../types/dist/implemented-methods-OitwyO1Y.mjs
118207
+ //#region ../types/dist/implemented-methods-M5aguGon.mjs
118217
118208
  /**
118218
118209
  * The ffmpeg build every CamStack node downloads, per platform and arch.
118219
118210
  *
@@ -145551,6 +145542,62 @@ var WeekdayKeySchema = _enum([
145551
145542
  "sat",
145552
145543
  "sun"
145553
145544
  ]);
145545
+ /**
145546
+ * Hold semantics — "for N seconds" on a leaf of the `when` tree (#498).
145547
+ *
145548
+ * ONE primitive, `for: { ms, mode, tolerance? }`, shared by `device-becomes`,
145549
+ * `device-is` and `expression`:
145550
+ *
145551
+ * - `held`: the condition stays true for `ms`;
145552
+ * - `stable`: the value does not move by more than `tolerance` (absolute, in
145553
+ * the field's base unit) for `ms` while the condition holds.
145554
+ *
145555
+ * {@link HoldCore} is the pure state machine (an input observation → a reading).
145556
+ * {@link HoldTracker} keys cores by a leaf path for the STATE leaves the tree
145557
+ * evaluator judges. {@link BecomesWatch} wraps a core with a timer for the
145558
+ * `device-becomes` EVENT leaf: the deadline is armed when the hold starts and
145559
+ * cancelled when it breaks, and the leaf fires ONCE per episode.
145560
+ *
145561
+ * Hold state is memory only. A hold that is already running when the watcher
145562
+ * first looks (a restart) is INHERITED: nobody knows when it began, so it never
145563
+ * fires for that episode and a state leaf reads it as unknown until the window
145564
+ * has elapsed from the moment the watcher started (D49: not-known is not false).
145565
+ */
145566
+ var HOLD_MAX_MS = 864e5;
145567
+ var HoldModeSchema = _enum(["held", "stable"]);
145568
+ var HoldSpecSchema = object({
145569
+ /** How long the condition (or the value) must hold. */
145570
+ ms: number$1().int().min(1).max(HOLD_MAX_MS),
145571
+ mode: HoldModeSchema,
145572
+ /** `stable` only: the largest move of the value that still counts as unchanged (absolute, base unit). */
145573
+ tolerance: number$1().min(0).optional()
145574
+ });
145575
+ /** What a trace says about a hold. */
145576
+ var HoldTraceSchema = object({
145577
+ phase: _enum([
145578
+ "pending",
145579
+ "cancelled",
145580
+ "fired",
145581
+ "reseeded"
145582
+ ]),
145583
+ ms: number$1().int(),
145584
+ mode: HoldModeSchema,
145585
+ /** When the hold started (ms epoch). */
145586
+ since: number$1().optional(),
145587
+ /** When it completes (ms epoch), for a pending hold. */
145588
+ deadline: number$1().optional()
145589
+ });
145590
+ /** The operators a `device-becomes` leaf may carry: a threshold or a range. */
145591
+ var BecomesOperatorSchema = _enum([
145592
+ "eq",
145593
+ "ne",
145594
+ "gt",
145595
+ "gte",
145596
+ "lt",
145597
+ "lte",
145598
+ "between",
145599
+ "outside"
145600
+ ]);
145554
145601
  /** How a state leaf compares a device field to a value. Derived from the
145555
145602
  * field's `kind` in `deviceManager.getWireableFields`, never hand-maintained. */
145556
145603
  var AutomationConditionOperatorSchema = _enum([
@@ -145574,18 +145621,52 @@ var DeviceBecomesLeafSchema = object({
145574
145621
  deviceId: number$1().int().nonnegative(),
145575
145622
  cap: string().min(1),
145576
145623
  fieldPath: string().min(1),
145577
- /** Fire when the field takes this value. Omit to fire on any change. */
145624
+ /** Fire when the field takes this value. Omit (with no `operator`) to fire on any change. */
145578
145625
  becomes: union([
145579
145626
  string(),
145580
145627
  number$1(),
145581
145628
  boolean()
145582
145629
  ]).optional(),
145583
- /** Only on a CHANGE of value, not on every re-report. */
145630
+ /**
145631
+ * A threshold or a range instead of an equality: "crosses above 3000", "enters
145632
+ * 18..24". The leaf fires on the TRANSITION into the predicate, never on a re-report.
145633
+ * `value` is in the field's base unit; `between` / `outside` take `[low, high]`.
145634
+ */
145635
+ operator: BecomesOperatorSchema.optional(),
145636
+ value: union([
145637
+ number$1(),
145638
+ string(),
145639
+ boolean(),
145640
+ array(number$1()).length(2)
145641
+ ]).optional(),
145642
+ /**
145643
+ * Hold: the transition (or, with no predicate, the new value) must stay for
145644
+ * `for.ms` before the leaf fires, ONCE per episode. See `hold.ts`.
145645
+ */
145646
+ for: HoldSpecSchema.optional(),
145647
+ /** @deprecated every leaf fires on a transition now; read as always on. */
145584
145648
  edge: boolean().optional(),
145585
- /** The new value must hold this long before it counts. */
145586
- forMs: number$1().int().min(0).max(864e5).optional(),
145649
+ /** @deprecated legacy `held` window — read through `holdOf` as `for: { ms, mode: 'held' }`. */
145650
+ forMs: number$1().int().min(0).max(HOLD_MAX_MS).optional(),
145587
145651
  /** Collapse a burst into one occurrence. */
145588
145652
  debounceMs: number$1().int().min(0).max(6e5).optional()
145653
+ }).superRefine((leaf, ctx) => {
145654
+ if (leaf.becomes !== void 0 && leaf.operator !== void 0) ctx.addIssue({
145655
+ code: "custom",
145656
+ message: "a leaf names `becomes` or `operator`, not both",
145657
+ path: ["operator"]
145658
+ });
145659
+ if (leaf.operator !== void 0 && leaf.value === void 0) ctx.addIssue({
145660
+ code: "custom",
145661
+ message: "an operator needs the value to compare to",
145662
+ path: ["value"]
145663
+ });
145664
+ const range = leaf.operator === "between" || leaf.operator === "outside";
145665
+ if (leaf.operator !== void 0 && range !== Array.isArray(leaf.value)) ctx.addIssue({
145666
+ code: "custom",
145667
+ message: range ? "a range takes [low, high]" : "only a range takes [low, high]",
145668
+ path: ["value"]
145669
+ });
145589
145670
  });
145590
145671
  var DeviceEventLeafSchema = object({
145591
145672
  kind: literal("device-event"),
@@ -145650,7 +145731,9 @@ var DeviceIsLeafSchema = object({
145650
145731
  QuantityValueSchema
145651
145732
  ]),
145652
145733
  /** The unit the person picked for `value` (display only; `value` is in the base unit). */
145653
- unit: string().min(1).optional()
145734
+ unit: string().min(1).optional(),
145735
+ /** The comparison must hold (`held`) or the value stay put (`stable`) this long. */
145736
+ for: HoldSpecSchema.optional()
145654
145737
  });
145655
145738
  /**
145656
145739
  * True when the camera currently has a PARKED object matching `subjects` in at
@@ -145673,7 +145756,9 @@ var StationaryPresentLeafSchema = object({
145673
145756
  var ExpressionLeafSchema = object({
145674
145757
  kind: literal("expression"),
145675
145758
  expr: string().min(1).max(MAX_EXPRESSION_SOURCE_LENGTH),
145676
- bindings: record(string().regex(EXPRESSION_IDENTIFIER_RE), ExpressionBindingSourceSchema)
145759
+ bindings: record(string().regex(EXPRESSION_IDENTIFIER_RE), ExpressionBindingSourceSchema),
145760
+ /** The expression must stay true this long. An expression has no single value, so only `held`. */
145761
+ for: HoldSpecSchema.optional()
145677
145762
  }).superRefine((src, ctx) => {
145678
145763
  const err = validateExpressionSource(src);
145679
145764
  if (err !== null) ctx.addIssue({
@@ -145681,6 +145766,11 @@ var ExpressionLeafSchema = object({
145681
145766
  message: err,
145682
145767
  path: ["expr"]
145683
145768
  });
145769
+ if (src.for?.mode === "stable") ctx.addIssue({
145770
+ code: "custom",
145771
+ message: "an expression is held, not stable: it has no single value to keep still",
145772
+ path: ["for", "mode"]
145773
+ });
145684
145774
  });
145685
145775
  var AutomationWhenSchema = lazy(() => discriminatedUnion("kind", [
145686
145776
  object({
@@ -146440,7 +146530,9 @@ var AutomationTriggerTraceSchema = object({
146440
146530
  /** Why an event was rejected ("class person not in [dog]") or what fired. */
146441
146531
  reason: string(),
146442
146532
  /** deviceId, className, trackId, score … — only what the trigger exposes. */
146443
- vars: record(string(), TraceValueSchema)
146533
+ vars: record(string(), TraceValueSchema),
146534
+ /** A hold (`for`) this occurrence went through: pending, cancelled, fired or re-seeded. */
146535
+ hold: HoldTraceSchema.optional()
146444
146536
  });
146445
146537
  var AutomationConditionTraceNodeSchema = object({
146446
146538
  /** `when` for the root, `when.<i>` for its i-th child, … (`conditions…` on an old trace). */
@@ -146786,7 +146878,7 @@ object({
146786
146878
  * is irrelevant; the array is treated as a set by consumers. */
146787
146879
  hiddenChildIds: array(number$1()).readonly()
146788
146880
  });
146789
- 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({
146881
+ DeviceType.Camera, DeviceType.Switch, DeviceType.Light, DeviceType.Sensor, DeviceType.Thermostat, DeviceType.Cover, DeviceType.Lock, DeviceType.Fan, DeviceType.MediaPlayer, DeviceType.AlarmPanel, DeviceType.Generic, method(object({
146790
146882
  deviceId: number$1().int().nonnegative(),
146791
146883
  childDeviceId: number$1().int().nonnegative(),
146792
146884
  hidden: boolean()
@@ -150957,6 +151049,140 @@ var climateControlCapability = {
150957
151049
  } }
150958
151050
  };
150959
151051
  /**
151052
+ * cluster-update — the ONE flow that brings the whole cluster to a release
151053
+ * (planning#493). Hub-provided (`server-provided`), hub-only: the hub runs
151054
+ * the sequence itself, so the admin UI, the MCP and the CLI all start the same
151055
+ * job and read the same report instead of each driving their own loop.
151056
+ *
151057
+ * 1. backup (`backup.trigger`) — skipped only when the caller says so
151058
+ * 2. the hub's server closure (`applyServerUpdate`); the hub restarts and the
151059
+ * job RESUMES on the new boot, verified against the hub's running version
151060
+ * 3. every online agent behind the target, one at a time, verified: runs the
151061
+ * target, settled, online, and its capabilities registered (D848) — an
151062
+ * agent that comes back capless is a FAILED step, never a done one
151063
+ * 4. every stale addon on the hub (`addons.updatePackage`); agents follow by
151064
+ * reconciliation, which is verified, never pushed
151065
+ *
151066
+ * The job stops on the first failed step with a typed reason (D877). Its state
151067
+ * is durable on the hub and read by RPC (`getClusterUpdateJob`) — events are
151068
+ * telemetry and never carry it (D8, D11).
151069
+ */
151070
+ /** The steps, in the order they run. */
151071
+ var ClusterUpdateStepKindSchema = _enum([
151072
+ "backup",
151073
+ "hub-server",
151074
+ "agent-server",
151075
+ "addons"
151076
+ ]);
151077
+ /**
151078
+ * - `pending` — not reached yet.
151079
+ * - `running` — in progress (for `hub-server`: possibly across the restart).
151080
+ * - `ok` — done AND verified.
151081
+ * - `failed` — did not land; `reason` + `detail` say why. Stops the job.
151082
+ * - `skipped` — not run: nothing to do, opted out, the node is offline, or a
151083
+ * step before it failed. `detail` says which.
151084
+ */
151085
+ var ClusterUpdateStepStatusSchema = _enum([
151086
+ "pending",
151087
+ "running",
151088
+ "ok",
151089
+ "failed",
151090
+ "skipped"
151091
+ ]);
151092
+ /**
151093
+ * Why a step (and with it the job) failed. Stable, greppable; `detail` carries
151094
+ * the prose.
151095
+ */
151096
+ var ClusterUpdateFailureReasonSchema = _enum([
151097
+ "backup-unavailable",
151098
+ "backup-failed",
151099
+ "server-refused",
151100
+ "server-not-on-target",
151101
+ "node-capless",
151102
+ "status-unreadable",
151103
+ "addon-update-failed",
151104
+ "addons-not-converged",
151105
+ "interrupted"
151106
+ ]);
151107
+ var ClusterUpdateStepSchema = object({
151108
+ kind: ClusterUpdateStepKindSchema,
151109
+ /** The node the step acts on; absent for `backup` and `addons`. */
151110
+ nodeId: string().optional(),
151111
+ status: ClusterUpdateStepStatusSchema,
151112
+ /** One line for the operator: what happened, or why not. */
151113
+ detail: string(),
151114
+ reason: ClusterUpdateFailureReasonSchema.optional(),
151115
+ /** `hub-server` / `agent-server`: the version the node ran before. */
151116
+ fromVersion: string().nullable().optional(),
151117
+ /** `addons`: the packages this step updates, `name from -> to`. */
151118
+ packages: array(string()).readonly().optional(),
151119
+ startedAt: number$1().optional(),
151120
+ finishedAt: number$1().optional()
151121
+ });
151122
+ var ClusterUpdateJobStateSchema = _enum([
151123
+ "running",
151124
+ "succeeded",
151125
+ "failed"
151126
+ ]);
151127
+ var ClusterUpdateJobSchema = object({
151128
+ id: string(),
151129
+ state: ClusterUpdateJobStateSchema,
151130
+ /** The server version every node is brought to. */
151131
+ targetVersion: string(),
151132
+ /** Who started it (the user name, or `system`). */
151133
+ requestedBy: string(),
151134
+ startedAt: number$1(),
151135
+ finishedAt: number$1().optional(),
151136
+ /** Every step, in run order; later steps stay `pending` while it runs. */
151137
+ steps: array(ClusterUpdateStepSchema).readonly(),
151138
+ /** On `failed`: the step that stopped it (`nodeId` or the step kind). */
151139
+ stoppedAt: string().optional(),
151140
+ reason: ClusterUpdateFailureReasonSchema.optional(),
151141
+ /** Agents offline when the plan was read: never touched. */
151142
+ skippedOffline: array(string()).readonly()
151143
+ });
151144
+ var ClusterUpdateOptionsSchema = object({
151145
+ /** Explicit server target; omitted = the hub's latest registry check. */
151146
+ version: string().optional(),
151147
+ /** Update the addons too (default true). */
151148
+ addons: boolean().optional(),
151149
+ /**
151150
+ * Back up before touching anything (default true). `false` is an explicit
151151
+ * operator opt-out; a missing backup provider is otherwise a failure.
151152
+ */
151153
+ backup: boolean().optional()
151154
+ });
151155
+ /** Why a plan cannot start. */
151156
+ var ClusterUpdateBlockerSchema = _enum([
151157
+ "no-target",
151158
+ "node-busy",
151159
+ "job-running",
151160
+ "nothing-to-do",
151161
+ "status-unreadable"
151162
+ ]);
151163
+ var ClusterUpdatePlanSchema = object({
151164
+ /** `null` when no target could be resolved (`blocker: 'no-target'`). */
151165
+ targetVersion: string().nullable(),
151166
+ /** The steps the job WOULD run, all `pending` (or `skipped` with a reason). */
151167
+ steps: array(ClusterUpdateStepSchema).readonly(),
151168
+ skippedOffline: array(string()).readonly(),
151169
+ /** `null` = the plan can start. */
151170
+ blocker: ClusterUpdateBlockerSchema.nullable(),
151171
+ /** Prose for `blocker`. */
151172
+ blockerDetail: string().nullable()
151173
+ });
151174
+ var StartClusterUpdateResultSchema = object({
151175
+ accepted: boolean(),
151176
+ /** The job to follow with `getClusterUpdateJob`; `null` when refused. */
151177
+ jobId: string().nullable(),
151178
+ blocker: ClusterUpdateBlockerSchema.nullable(),
151179
+ message: string()
151180
+ });
151181
+ method(ClusterUpdateOptionsSchema, ClusterUpdatePlanSchema, { auth: "admin" }), method(ClusterUpdateOptionsSchema, StartClusterUpdateResultSchema, {
151182
+ kind: "mutation",
151183
+ auth: "admin"
151184
+ }), method(object({ jobId: string().optional() }), ClusterUpdateJobSchema.nullable(), { auth: "admin" });
151185
+ /**
150960
151186
  * Color-light cap. Coexists with `switch` (on/off) and `brightness`
150961
151187
  * (level) on the same device — `switch` toggles the bulb, `brightness`
150962
151188
  * sets the dim level, this cap sets the chromaticity.
@@ -152287,7 +152513,7 @@ var mediaPlayerCapability = {
152287
152513
  isMuted: { kind: "boolean" }
152288
152514
  } }
152289
152515
  };
152290
- 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;
152516
+ 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;
152291
152517
  var NUMBER = {
152292
152518
  kind: "fixed",
152293
152519
  result: ["number"]
@@ -153780,27 +154006,35 @@ var deviceAdminLinkCapability = {
153780
154006
  getAdminLink: method(object({ deviceId: number$1().int().nonnegative() }), DeviceAdminLinkSchema.nullable(), { auth: "admin" }) }
153781
154007
  };
153782
154008
  /**
153783
- * device-discovery — device-scoped capability for parents that host /
153784
- * enumerate child devices (Reolink Hub / NVR, ONVIF gateway, future
153785
- * integrations). The parent advertises a list of discoverable children,
153786
- * and the operator promotes a subset to real devices via `adoptDevice`.
153787
- * Child lifecycle (kernel device create/remove, parent reference) is
153788
- * owned by the framework so a single shared `<DiscoveryPanel />` can
153789
- * drive any integration.
153790
- *
153791
- * Boundaries:
153792
- * - The cap exposes ENUMERATION + ADOPT/RELEASE only. The protocol
153793
- * used to discover children (CGI poll, mDNS, push from hub, ...)
153794
- * is the integration's business; results land in `runtimeState`
153795
- * so the panel can render without a fresh round-trip.
153796
- * - `childNativeId` is integration-defined and must be stable across
153797
- * reboots so re-discovery doesn't duplicate adopted children.
153798
- * - `adoptDevice` returns the new `deviceId` so the UI can navigate
153799
- * directly to the freshly-created child's settings page.
153800
- */
153801
- /**
153802
- * Status enum for a discovered device. Mirrors the Reolink simpleEvent
153803
- * lifecycle (`online` / `sleeping` / `offline`) — generic enough for
154009
+ * `device-adoption` — generic discovery + adoption surface,
154010
+ * system-scoped collection (one provider per integration addon), routed
154011
+ * by explicit `{ addonId }` on direct `deviceAdoption.*` calls — the same
154012
+ * pin model as `connection-test`. The admin UI keeps using
154013
+ * `deviceManager.adoption*` (which already threads `addonId`). The de-HA-ified
154014
+ * successor to `ha-discovery`:
154015
+ * keyed by `integrationId` (the addon resolves integrationId → broker
154016
+ * internally) rather than a connection-specific `brokerId`, and it
154017
+ * OWNS the shared `DiscoveredChildDevice` candidate type
154018
+ * (declared below) so a single shared adoption modal renders any integration's
154019
+ * candidate tree.
154020
+ *
154021
+ * UI flow (Integrations page → integration detail):
154022
+ * 1. `listCandidates({integrationId, page, pageSize, filter})` →
154023
+ * paginated candidate list, each row collapsed.
154024
+ * 2. User expands a row → `getCandidate({integrationId,
154025
+ * childNativeId})` returns the single candidate (with its nested
154026
+ * `children`) for the accordion render.
154027
+ * 3. User clicks "Adopt" on one or more candidates →
154028
+ * `adopt({integrationId, childNativeIds, perCandidate?})`
154029
+ * materialises one parent CamStack device per candidate plus its
154030
+ * accessory children. `perCandidate[childNativeId]` carries an
154031
+ * optional display-name override + a `hiddenChildIds` pre-hide set
154032
+ * (the parent's `accessories.hiddenChildIds` gates UI visibility).
154033
+ * 4. User clicks "Release" → `release({integrationId, camDeviceId})`
154034
+ * removes the parent + every child from the kernel registry.
154035
+ */
154036
+ /**
154037
+ * Status enum for a discovered device. Generic enough for
153804
154038
  * battery cams, awake cams, and unreachable cams alike.
153805
154039
  */
153806
154040
  var DiscoveredChildStatusSchema = _enum([
@@ -153817,12 +154051,12 @@ var DiscoveredChildDeviceSchema = lazy(() => object({
153817
154051
  /** DeviceType the child should be created with on adopt. */
153818
154052
  type: _enum(DeviceType),
153819
154053
  status: DiscoveredChildStatusSchema,
153820
- /** Free-form integration-specific metadata surfaced in the panel. */
154054
+ /** Free-form integration-specific metadata surfaced in the adoption modal. */
153821
154055
  metadata: object({
153822
154056
  model: string().optional(),
153823
154057
  serialNumber: string().optional(),
153824
154058
  uid: string().optional(),
153825
- /** Reolink: 0-based channel index inside the parent NVR/Hub. */
154059
+ /** Reolink: 0-based channel index inside the parent NVR. */
153826
154060
  rtspChannel: number$1().int().nonnegative().optional(),
153827
154061
  isBattery: boolean().optional(),
153828
154062
  isDoorbell: boolean().optional(),
@@ -153838,137 +154072,24 @@ var DiscoveredChildDeviceSchema = lazy(() => object({
153838
154072
  }).default({}),
153839
154073
  /**
153840
154074
  * `true` when the framework already created a child device for this
153841
- * `childNativeId` under the current parent. The panel uses it to
154075
+ * `childNativeId` under the current parent. The adoption modal uses it to
153842
154076
  * gate the Add/Remove button and surface the existing `deviceId`.
153843
154077
  */
153844
154078
  alreadyAdopted: boolean(),
153845
154079
  /** When `alreadyAdopted=true`, the framework-assigned child device id. */
153846
154080
  adoptedDeviceId: number$1().int().nonnegative().nullable(),
153847
- /** Capability names the candidate advertises — integrations populate, Hubs omit. */
154081
+ /** Capability names the candidate advertises — integrations populate, flat enumerations omit. */
153848
154082
  capabilities: array(string()).readonly().optional(),
153849
- /** Feature flags the candidate advertises — integrations populate, Hubs omit. */
154083
+ /** Feature flags the candidate advertises — integrations populate, flat enumerations omit. */
153850
154084
  features: array(string()).readonly().optional(),
153851
154085
  /** Upstream-system identity + rendering hints for the candidate. */
153852
154086
  sourceInfo: SourceInfoSchema.optional(),
153853
- /** Nested entity-children for accordion preview — integrations populate, Hubs omit. */
154087
+ /** Nested entity-children for accordion preview — integrations populate, flat enumerations omit. */
153854
154088
  children: array(DiscoveredChildDeviceSchema).readonly().optional(),
153855
154089
  /** `childNativeId` of the gateway candidate in the same list this device sits behind. */
153856
154090
  parentStableId: string().optional()
153857
154091
  }));
153858
154092
  /**
153859
- * Status block — populated by the integration after each
153860
- * `refreshDiscovery` (or push-driven update). The runtime-state slice
153861
- * is what the panel reads via the per-device proxy; `getStatus`
153862
- * returns the same payload via the codegen'd auto-injection.
153863
- */
153864
- var DeviceDiscoveryStatusSchema = object({
153865
- discovered: array(DiscoveredChildDeviceSchema),
153866
- /** Wall-clock ms of the last successful enumeration. */
153867
- lastDiscoveryAt: number$1().int().nonnegative().nullable(),
153868
- /** Last error surfaced from the source (rendered as a banner). */
153869
- lastError: string().nullable()
153870
- });
153871
- var deviceDiscoveryCapability = {
153872
- name: "device-discovery",
153873
- scope: "device",
153874
- deviceNative: true,
153875
- mode: "singleton",
153876
- deviceTypes: [DeviceType.Hub],
153877
- status: {
153878
- schema: DeviceDiscoveryStatusSchema,
153879
- kind: "poll"
153880
- },
153881
- runtimeState: DeviceDiscoveryStatusSchema.extend({ lastFetchedAt: number$1().int().nonnegative() }),
153882
- /**
153883
- * Runtime-state durability: **session** — 5.7 KB of scan output on the largest device, fully re-derivable by re-scanning.
153884
- *
153885
- * See `RuntimeStateDurability`. Enforced by
153886
- * `scripts/check-runtime-state-durability.ts`.
153887
- */
153888
- durability: "session",
153889
- /**
153890
- * History (D850): none — inventory.
153891
- */
153892
- history: "none",
153893
- methods: {
153894
- /**
153895
- * Snapshot of the current `discovered` list. Returns the
153896
- * runtime-state cache — call `refreshDiscovery` first if a
153897
- * fresh round-trip to the source is required.
153898
- */
153899
- listDiscovered: method(object({ deviceId: number$1().int().nonnegative() }), array(DiscoveredChildDeviceSchema).readonly()),
153900
- /**
153901
- * Force the integration to re-enumerate and update the
153902
- * runtime-state slice. Returns the freshly-enumerated list (also
153903
- * available via `listDiscovered` post-call).
153904
- */
153905
- refreshDiscovery: method(object({ deviceId: number$1().int().nonnegative() }), array(DiscoveredChildDeviceSchema).readonly(), {
153906
- kind: "mutation",
153907
- auth: "admin"
153908
- }),
153909
- /**
153910
- * Promote a discovered entry to a real child device. The framework
153911
- * creates the child via `kernel.devices.create()` with
153912
- * `parentDeviceId = parent.id` and seeds the child's config from
153913
- * `childInitialConfig` (driver-defined; usually carries channel +
153914
- * uid + parent reference). Returns the kernel-assigned numeric id.
153915
- */
153916
- adoptDevice: method(object({
153917
- deviceId: number$1().int().nonnegative(),
153918
- childNativeId: string(),
153919
- /** Optional override for the child's display name. */
153920
- name: string().optional()
153921
- }), object({
153922
- deviceId: number$1().int().nonnegative(),
153923
- stableId: string()
153924
- }), {
153925
- kind: "mutation",
153926
- auth: "admin"
153927
- }),
153928
- /**
153929
- * Inverse of `adoptDevice`: removes the child device from the
153930
- * kernel registry. The discovered entry remains in the
153931
- * enumeration (status updates resume) so the operator can re-adopt
153932
- * it later without a fresh refresh.
153933
- */
153934
- releaseDevice: method(object({
153935
- deviceId: number$1().int().nonnegative(),
153936
- childDeviceId: number$1().int().nonnegative()
153937
- }), _void(), {
153938
- kind: "mutation",
153939
- auth: "admin"
153940
- })
153941
- }
153942
- };
153943
- /**
153944
- * `device-adoption` — generic discovery + adoption surface,
153945
- * system-scoped collection (one provider per integration addon), routed
153946
- * by explicit `{ addonId }` on direct `deviceAdoption.*` calls — the same
153947
- * pin model as `connection-test`. The admin UI keeps using
153948
- * `deviceManager.adoption*` (which already threads `addonId`). The de-HA-ified
153949
- * successor to `ha-discovery`:
153950
- * keyed by `integrationId` (the addon resolves integrationId → broker
153951
- * internally) rather than a connection-specific `brokerId`, and it
153952
- * REUSES the shared `DiscoveredChildDevice` candidate type from
153953
- * `device-discovery.cap.ts` so a single shared adoption panel renders
153954
- * any integration's candidate tree.
153955
- *
153956
- * UI flow (Integrations page → integration detail):
153957
- * 1. `listCandidates({integrationId, page, pageSize, filter})` →
153958
- * paginated candidate list, each row collapsed.
153959
- * 2. User expands a row → `getCandidate({integrationId,
153960
- * childNativeId})` returns the single candidate (with its nested
153961
- * `children`) for the accordion render.
153962
- * 3. User clicks "Adopt" on one or more candidates →
153963
- * `adopt({integrationId, childNativeIds, perCandidate?})`
153964
- * materialises one parent CamStack device per candidate plus its
153965
- * accessory children. `perCandidate[childNativeId]` carries an
153966
- * optional display-name override + a `hiddenChildIds` pre-hide set
153967
- * (the parent's `accessories.hiddenChildIds` gates UI visibility).
153968
- * 4. User clicks "Release" → `release({integrationId, camDeviceId})`
153969
- * removes the parent + every child from the kernel registry.
153970
- */
153971
- /**
153972
154093
  * Provider-declared discovery *granularity* filter (the keystone of the
153973
154094
  * single-entity-import design). A provider advertises which discovery
153974
154095
  * granularities it supports via `listCandidateFilters`; the operator picks
@@ -154429,6 +154550,90 @@ var SiteZoneSchema = object({
154429
154550
  * the ones that most want grouping. */
154430
154551
  locationKeys: array(string())
154431
154552
  });
154553
+ var DeviceSearchRequiresSchema = object({
154554
+ /** Capability names the field wants a value of. */
154555
+ caps: array(string()).readonly(),
154556
+ /** `any` (default): a device with one of them is compatible. `all`: it must hold every one. */
154557
+ mode: _enum(["any", "all"]).optional()
154558
+ });
154559
+ var DeviceSearchFiltersSchema = object({
154560
+ locations: array(string()).readonly().optional(),
154561
+ integrationIds: array(string()).readonly().optional(),
154562
+ types: array(string()).readonly().optional()
154563
+ });
154564
+ var DeviceSearchInputSchema = object({
154565
+ /** Matches name, location, type, integration (id and label) and id. Case-insensitive. */
154566
+ text: string().optional(),
154567
+ requires: DeviceSearchRequiresSchema.optional(),
154568
+ filters: DeviceSearchFiltersSchema.optional(),
154569
+ /** List the devices that do not provide the required cap too (greyed, not pickable). */
154570
+ includeIncompatible: boolean().optional(),
154571
+ /** The device the field belongs to: its location drives `suggested`. */
154572
+ contextDeviceId: number$1().optional(),
154573
+ /**
154574
+ * Resolve exactly these devices, regardless of every filter, so a picked
154575
+ * value can be rendered. When given, `items` is these devices in the order
154576
+ * asked (no paging, `nextCursor` null) and the ones that do not exist are
154577
+ * listed in `missingIds`.
154578
+ */
154579
+ ids: array(number$1()).readonly().optional(),
154580
+ cursor: string().nullable().optional(),
154581
+ limit: number$1().int().min(1).max(200).optional()
154582
+ });
154583
+ var DeviceValueOptionSchema = object({
154584
+ cap: string(),
154585
+ /** Status-schema field path inside the cap (same paths as `getWireableFields`). */
154586
+ path: string(),
154587
+ label: string(),
154588
+ /** The current value as text; `null` when it is unknown or the read FAILED — never `0`. */
154589
+ reading: string().nullable(),
154590
+ unit: string().nullable().optional(),
154591
+ /** The field's measured quantity, when the cap declares one, so a client can format the reading. */
154592
+ quantity: ReadingQuantitySchema.optional()
154593
+ });
154594
+ var DeviceSearchItemSchema = object({
154595
+ id: number$1(),
154596
+ name: string(),
154597
+ type: _enum(DeviceType),
154598
+ location: string().nullable(),
154599
+ integrationId: string().nullable(),
154600
+ integrationLabel: string().nullable(),
154601
+ online: boolean().nullable(),
154602
+ disabled: boolean(),
154603
+ compatible: boolean(),
154604
+ /** Only the required caps' fields; empty when nothing was required or the device is incompatible. */
154605
+ values: array(DeviceValueOptionSchema).readonly()
154606
+ });
154607
+ var DeviceSearchFacetValueSchema = object({
154608
+ value: string(),
154609
+ count: number$1()
154610
+ });
154611
+ var DeviceSearchFacetIntegrationSchema = object({
154612
+ id: string(),
154613
+ label: string(),
154614
+ count: number$1()
154615
+ });
154616
+ var DeviceSearchFacetsSchema = object({
154617
+ locations: array(DeviceSearchFacetValueSchema).readonly(),
154618
+ integrations: array(DeviceSearchFacetIntegrationSchema).readonly(),
154619
+ types: array(DeviceSearchFacetValueSchema).readonly()
154620
+ });
154621
+ var DeviceSearchResultSchema = object({
154622
+ items: array(DeviceSearchItemSchema).readonly(),
154623
+ nextCursor: string().nullable(),
154624
+ /** Devices listed by this query across all pages (filters + text applied; incompatible counted only when `includeIncompatible`). */
154625
+ total: number$1(),
154626
+ /** Compatible devices after filters + text. */
154627
+ compatibleTotal: number$1(),
154628
+ /** Every device the caller's fleet holds, before anything is applied. */
154629
+ fleetTotal: number$1(),
154630
+ /** Incompatible devices after filters + text — the K of "show the K that don't". */
154631
+ hiddenIncompatible: number$1(),
154632
+ facets: DeviceSearchFacetsSchema,
154633
+ /** Same location as `contextDeviceId`; first page only. */
154634
+ suggested: array(DeviceSearchItemSchema).readonly(),
154635
+ missingIds: array(number$1()).readonly()
154636
+ });
154432
154637
  var ProviderStatusSchema = object({
154433
154638
  connected: boolean(),
154434
154639
  deviceCount: number$1(),
@@ -154914,6 +155119,9 @@ var DeviceInfoSchema = object({
154914
155119
  * named accordion sections (with optional intra-section order). See
154915
155120
  * `DeviceMeta.childLayout`. Absent ⇒ no layout declared. */
154916
155121
  childLayout: array(ChildLayoutEntrySchema).readonly().optional(),
155122
+ /** The children a container stands for, most preferred first, by accessory
155123
+ * `childKey`. Provider-declared. See `DeviceMeta.primaryChildPreference`. */
155124
+ primaryChildPreference: array(string()).readonly().optional(),
154917
155125
  /** Operator-authored per-device display override. See `DeviceMeta.display`. */
154918
155126
  display: DeviceDisplayOverrideSchema.optional()
154919
155127
  });
@@ -155062,6 +155270,9 @@ var DeviceMetaSchema = object({
155062
155270
  * accordion sections (with optional intra-section order). See
155063
155271
  * `DeviceMeta.childLayout`. Absent ⇒ no layout declared. */
155064
155272
  childLayout: array(ChildLayoutEntrySchema).readonly().optional(),
155273
+ /** The children a container stands for, most preferred first, by accessory
155274
+ * `childKey`. Provider-declared. See `DeviceMeta.primaryChildPreference`. */
155275
+ primaryChildPreference: array(string()).readonly().optional(),
155065
155276
  /** Semantic role string (`DeviceRole`) — propagated from the spawn pre-seed.
155066
155277
  * Optional: only present for accessory children that carry a known role. */
155067
155278
  role: string().nullable().optional(),
@@ -155277,6 +155488,12 @@ method(object({
155277
155488
  }), _void(), {
155278
155489
  kind: "mutation",
155279
155490
  auth: "admin"
155491
+ }), method(object({
155492
+ deviceId: number$1(),
155493
+ primaryChildPreference: array(string()).readonly()
155494
+ }), _void(), {
155495
+ kind: "mutation",
155496
+ auth: "admin"
155280
155497
  }), method(object({
155281
155498
  deviceId: number$1(),
155282
155499
  display: DeviceDisplayOverrideSchema.nullable()
@@ -155414,7 +155631,7 @@ method(object({
155414
155631
  * it answers today and the caller filters as it already does.
155415
155632
  */
155416
155633
  deviceIds: array(number$1()).optional()
155417
- }), 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({
155634
+ }), 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({
155418
155635
  mode: LinkedDevicesModeSchema,
155419
155636
  devices: array(LinkedDeviceSchema)
155420
155637
  }), { 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({
@@ -159087,13 +159304,11 @@ var HeroConfirmSchema = _enum([
159087
159304
  "press"
159088
159305
  ]);
159089
159306
  var HeroActionSchema = object({
159090
- /** Unique within the model; the `gated` list and the specs name it. */
159091
159307
  id: string(),
159092
159308
  label: HeroTextSchema,
159093
159309
  icon: IconKeySchema,
159094
159310
  call: HeroCallSchema,
159095
159311
  emphasis: _enum(["primary", "normal"]),
159096
- /** Ask before running it. */
159097
159312
  confirm: HeroConfirmSchema.nullable()
159098
159313
  });
159099
159314
  var HeroControlSchema = discriminatedUnion("kind", [
@@ -159144,6 +159359,8 @@ var HeroPillSchema = object({
159144
159359
  });
159145
159360
  var HeroRowSchema = object({
159146
159361
  id: HeroRowIdSchema,
159362
+ /** `scene`: the row's action and slider controls are drawn on the scene. Absent: an ordinary row. */
159363
+ placement: _enum(["row", "scene"]).optional(),
159147
159364
  /** The row's own name when the kind's label would not tell rows of one kind apart (a circuit's label). */
159148
159365
  label: HeroTextSchema.optional(),
159149
159366
  /** A group header drawn above the row when it differs from the previous row's ("System"). */
@@ -159174,9 +159391,16 @@ var HeroBadgeSchema = object({
159174
159391
  value: number$1().nullable(),
159175
159392
  label: HeroTextSchema
159176
159393
  });
159177
- var HeroRemoteSlotSchema = object({
159178
- /** Saved commands; `null` = not known yet (the button still shows). */
159179
- commands: number$1().int().nullable() });
159394
+ var HeroRemoteSlotSchema = object({
159395
+ /** Saved commands; `null` = not known yet (the button still shows). */
159396
+ commands: number$1().int().nullable(),
159397
+ /**
159398
+ * The control a list row draws as the "open the remote" icon. Recognised by its id
159399
+ * ({@link REMOTE_OPEN_ACTION_ID}); it changes no state, so a client opens the remote
159400
+ * instead of running `call`. Absent on a model from an older server.
159401
+ */
159402
+ open: HeroActionSchema.optional()
159403
+ });
159180
159404
  var HeroConsumablesSlotSchema = object({
159181
159405
  items: array(object({
159182
159406
  key: string(),
@@ -159344,6 +159568,8 @@ var HeroModelSchema = object({
159344
159568
  * the FIRST row that has any (a later row's control is never promoted). When
159345
159569
  * the model lists that part in `gated`, the row has no inline control: the
159346
159570
  * projection never falls through to another control the caller could use.
159571
+ * - a climate or thermostat row's primary is its `climate.mode` control (no power
159572
+ * toggle: "off" is a mode); when the model gates it the rule above applies as before;
159347
159573
  * - a timed run, when the model carries the slot, sits beside that primary:
159348
159574
  * Run while idle, Stop while armed. Gating the slot hides the control.
159349
159575
  * - the status line is the head (what plays, else the state) plus at most
@@ -159351,6 +159577,13 @@ var HeroModelSchema = object({
159351
159577
  * time left on an armed timed run;
159352
159578
  * - the trailing fact is the first of power, battery, consumables.
159353
159579
  *
159580
+ * - `extras` are the further inline controls of the types that carry more than one
159581
+ * ({@link ROW_EXTRAS_BY_TYPE}): climate setpoint, a robot's return to base,
159582
+ * a player's volume and remote. Each is a control the model already has, named by id,
159583
+ * in that order and at most {@link ROW_EXTRAS_MAX}; one the model lacks, or lists in
159584
+ * `gated`, is absent, and the one `primary` already is never repeats. Empty = the
159585
+ * row of an older server: `primary` alone.
159586
+ *
159354
159587
  * `projectDeviceRow` is pure and computes nothing: it selects from a
159355
159588
  * {@link HeroModel}. A row that needed a value the hero lacks would mean the
159356
159589
  * model is missing it, so the fix goes in the model.
@@ -159382,8 +159615,16 @@ var HeroRowModelSchema = object({
159382
159615
  * while armed. `null` when there is no slot, or the caller may not act.
159383
159616
  */
159384
159617
  timedRun: HeroRowTimedRunSchema.nullable(),
159618
+ /**
159619
+ * The further inline controls after `primary`, in order (see the header). The remote
159620
+ * is an `action` with id `remote.open`: the client opens the remote, it does not run
159621
+ * the call. Absent or empty = `primary` alone.
159622
+ */
159623
+ extras: array(HeroControlSchema).max(2).optional(),
159385
159624
  trailing: HeroFactSchema.nullable()
159386
159625
  });
159626
+ DeviceType.Climate, DeviceType.Thermostat;
159627
+ DeviceType.Climate, DeviceType.Thermostat, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.MediaPlayer;
159387
159628
  /**
159388
159629
  * hero-layout — what a device's hero says (D1023). Read-only: the FIXED
159389
159630
  * layouts live in `@camstack/types` and nothing here stores or edits one.
@@ -170974,13 +171215,23 @@ var NcRuleTargetSchema = object({
170974
171215
  */
170975
171216
  params: record(string(), unknown()).optional()
170976
171217
  });
171218
+ /** Which picture kind one target receives (#487). */
171219
+ var NcTargetAttachmentSchema = _enum([
171220
+ "none",
171221
+ "image",
171222
+ "clip",
171223
+ "gif"
171224
+ ]);
170977
171225
  var NcTargetOverrideSchema = object({
170978
171226
  template: object({
170979
171227
  title: string().max(500).optional(),
170980
171228
  body: string().max(2e3).optional()
170981
171229
  }).optional(),
170982
171230
  schedule: NcScheduleSchema.optional(),
170983
- priority: number$1().int().min(1).max(5).optional()
171231
+ priority: number$1().int().min(1).max(5).optional(),
171232
+ attachment: NcTargetAttachmentSchema.optional(),
171233
+ /** `false` = no buttons for this target; `true` is the same as absent. */
171234
+ actions: boolean().optional()
170984
171235
  });
170985
171236
  /** Per-target settings keyed by target id (#487). */
170986
171237
  var NcTargetOverridesSchema = record(string(), NcTargetOverrideSchema);
@@ -173217,9 +173468,13 @@ var petFeederCapability = {
173217
173468
  */
173218
173469
  durability: "session",
173219
173470
  /**
173220
- * History (D850): recorded series.
173471
+ * History (D850): recorded series. `feeding` / `eating` are the meals the
173472
+ * device hero's "Meals" button names — change-only booleans, so a dispense
173473
+ * or a pet at the bowl is one span on the history.
173221
173474
  */
173222
173475
  history: { fields: {
173476
+ feeding: { kind: "boolean" },
173477
+ eating: { kind: "boolean" },
173223
173478
  foodLevel: { kind: "gauge" },
173224
173479
  bowlFood: { kind: "gauge" },
173225
173480
  food1: { kind: "gauge" },
@@ -175012,7 +175267,6 @@ var PowerSourceStateSchema = object({
175012
175267
  });
175013
175268
  var POWER_SOURCE_DEVICE_TYPES = [
175014
175269
  DeviceType.Gateway,
175015
- DeviceType.Hub,
175016
175270
  DeviceType.Camera,
175017
175271
  DeviceType.Sensor,
175018
175272
  DeviceType.MediaPlayer,
@@ -175064,18 +175318,18 @@ var powerSourceCapability = {
175064
175318
  mode: "singleton",
175065
175319
  deviceTypes: POWER_SOURCE_DEVICE_TYPES,
175066
175320
  methods: {
175067
- getStatus: systemMethod(deviceInput$1, PowerSourceInfoSchema, { auth: "admin" }),
175321
+ getStatus: systemMethod(deviceInput$1, PowerSourceInfoSchema, { auth: "protected" }),
175068
175322
  powerOn: systemMethod(deviceInput$1, PowerSourceActionResultSchema, {
175069
175323
  kind: "mutation",
175070
- auth: "admin"
175324
+ auth: "protected"
175071
175325
  }),
175072
175326
  powerOff: systemMethod(deviceInput$1, PowerSourceActionResultSchema, {
175073
175327
  kind: "mutation",
175074
- auth: "admin"
175328
+ auth: "protected"
175075
175329
  }),
175076
175330
  forceRestart: systemMethod(deviceInput$1, PowerSourceActionResultSchema, {
175077
175331
  kind: "mutation",
175078
- auth: "admin"
175332
+ auth: "protected"
175079
175333
  })
175080
175334
  },
175081
175335
  runtimeState: PowerSourceStateSchema,
@@ -185821,7 +186075,6 @@ var DEVICE_LOCAL_STATE_CAPS = {
185821
186075
  control: controlCapability,
185822
186076
  cover: coverCapability,
185823
186077
  dayNight: dayNightCapability,
185824
- deviceDiscovery: deviceDiscoveryCapability,
185825
186078
  deviceStatus: deviceStatusCapability,
185826
186079
  dishwasher: dishwasherCapability,
185827
186080
  doNotDisturb: doNotDisturbCapability,
@@ -191000,6 +191253,27 @@ Object.freeze({
191000
191253
  access: "create",
191001
191254
  role: "viewer"
191002
191255
  },
191256
+ "clusterUpdate.getClusterUpdateJob": {
191257
+ capName: "cluster-update",
191258
+ capScope: "system",
191259
+ addonId: null,
191260
+ access: "view",
191261
+ role: "admin"
191262
+ },
191263
+ "clusterUpdate.previewClusterUpdate": {
191264
+ capName: "cluster-update",
191265
+ capScope: "system",
191266
+ addonId: null,
191267
+ access: "view",
191268
+ role: "admin"
191269
+ },
191270
+ "clusterUpdate.startClusterUpdate": {
191271
+ capName: "cluster-update",
191272
+ capScope: "system",
191273
+ addonId: null,
191274
+ access: "create",
191275
+ role: "admin"
191276
+ },
191003
191277
  "color.getStatus": {
191004
191278
  capName: "color",
191005
191279
  capScope: "device",
@@ -191602,41 +191876,6 @@ Object.freeze({
191602
191876
  access: "create",
191603
191877
  role: "admin"
191604
191878
  },
191605
- "deviceDiscovery.adoptDevice": {
191606
- capName: "device-discovery",
191607
- capScope: "device",
191608
- addonId: null,
191609
- access: "create",
191610
- role: "admin"
191611
- },
191612
- "deviceDiscovery.getStatus": {
191613
- capName: "device-discovery",
191614
- capScope: "device",
191615
- addonId: null,
191616
- access: "view",
191617
- role: "viewer"
191618
- },
191619
- "deviceDiscovery.listDiscovered": {
191620
- capName: "device-discovery",
191621
- capScope: "device",
191622
- addonId: null,
191623
- access: "view",
191624
- role: "viewer"
191625
- },
191626
- "deviceDiscovery.refreshDiscovery": {
191627
- capName: "device-discovery",
191628
- capScope: "device",
191629
- addonId: null,
191630
- access: "create",
191631
- role: "admin"
191632
- },
191633
- "deviceDiscovery.releaseDevice": {
191634
- capName: "device-discovery",
191635
- capScope: "device",
191636
- addonId: null,
191637
- access: "create",
191638
- role: "admin"
191639
- },
191640
191879
  "deviceExport.applyDeviceSettingsPatch": {
191641
191880
  capName: "device-export",
191642
191881
  capScope: "system",
@@ -192372,6 +192611,13 @@ Object.freeze({
192372
192611
  access: "create",
192373
192612
  role: "admin"
192374
192613
  },
192614
+ "deviceManager.search": {
192615
+ capName: "device-manager",
192616
+ capScope: "system",
192617
+ addonId: null,
192618
+ access: "view",
192619
+ role: "viewer"
192620
+ },
192375
192621
  "deviceManager.setAlias": {
192376
192622
  capName: "device-manager",
192377
192623
  capScope: "system",
@@ -192463,6 +192709,13 @@ Object.freeze({
192463
192709
  access: "create",
192464
192710
  role: "admin"
192465
192711
  },
192712
+ "deviceManager.setPrimaryChildPreference": {
192713
+ capName: "device-manager",
192714
+ capScope: "system",
192715
+ addonId: null,
192716
+ access: "create",
192717
+ role: "admin"
192718
+ },
192466
192719
  "deviceManager.setRole": {
192467
192720
  capName: "device-manager",
192468
192721
  capScope: "system",
@@ -197102,28 +197355,28 @@ Object.freeze({
197102
197355
  capScope: "device",
197103
197356
  addonId: null,
197104
197357
  access: "create",
197105
- role: "admin"
197358
+ role: "viewer"
197106
197359
  },
197107
197360
  "powerSource.getStatus": {
197108
197361
  capName: "power-source",
197109
197362
  capScope: "device",
197110
197363
  addonId: null,
197111
197364
  access: "view",
197112
- role: "admin"
197365
+ role: "viewer"
197113
197366
  },
197114
197367
  "powerSource.powerOff": {
197115
197368
  capName: "power-source",
197116
197369
  capScope: "device",
197117
197370
  addonId: null,
197118
197371
  access: "create",
197119
- role: "admin"
197372
+ role: "viewer"
197120
197373
  },
197121
197374
  "powerSource.powerOn": {
197122
197375
  capName: "power-source",
197123
197376
  capScope: "device",
197124
197377
  addonId: null,
197125
197378
  access: "create",
197126
- role: "admin"
197379
+ role: "viewer"
197127
197380
  },
197128
197381
  "presence.getStatus": {
197129
197382
  capName: "presence",
@@ -200832,35 +201085,6 @@ Object.freeze({
200832
201085
  form: "single",
200833
201086
  optional: false
200834
201087
  }],
200835
- "deviceDiscovery.adoptDevice": [{
200836
- name: "deviceId",
200837
- form: "single",
200838
- optional: false
200839
- }],
200840
- "deviceDiscovery.getStatus": [{
200841
- name: "deviceId",
200842
- form: "single",
200843
- optional: false
200844
- }],
200845
- "deviceDiscovery.listDiscovered": [{
200846
- name: "deviceId",
200847
- form: "single",
200848
- optional: false
200849
- }],
200850
- "deviceDiscovery.refreshDiscovery": [{
200851
- name: "deviceId",
200852
- form: "single",
200853
- optional: false
200854
- }],
200855
- "deviceDiscovery.releaseDevice": [{
200856
- name: "childDeviceId",
200857
- form: "single",
200858
- optional: false
200859
- }, {
200860
- name: "deviceId",
200861
- form: "single",
200862
- optional: false
200863
- }],
200864
201088
  "deviceExport.applyDeviceSettingsPatch": [{
200865
201089
  name: "deviceId",
200866
201090
  form: "single",
@@ -201139,6 +201363,11 @@ Object.freeze({
201139
201363
  form: "single",
201140
201364
  optional: false
201141
201365
  }],
201366
+ "deviceManager.setPrimaryChildPreference": [{
201367
+ name: "deviceId",
201368
+ form: "single",
201369
+ optional: false
201370
+ }],
201142
201371
  "deviceManager.setRole": [{
201143
201372
  name: "deviceId",
201144
201373
  form: "single",
@@ -204607,7 +204836,9 @@ var TimelapseRuleInputSchema = object({
204607
204836
  /** Classes the notification counts — see {@link ReportClassesField}. */
204608
204837
  reportClasses: ReportClassesField.optional(),
204609
204838
  /** Canonical notification priority ordinal (1..5); per-target overridable. */
204610
- priority: PriorityField.default(3)
204839
+ priority: PriorityField.default(3),
204840
+ /** Per-target settings keyed by target id (D1032) — absent = every target follows the rule. */
204841
+ targetOverrides: NcTargetOverridesSchema.optional()
204611
204842
  });
204612
204843
  object({
204613
204844
  name: NameField.optional(),
@@ -204623,7 +204854,9 @@ object({
204623
204854
  previewText: PreviewTextField.optional(),
204624
204855
  previewMode: PreviewModeField.optional(),
204625
204856
  reportClasses: ReportClassesField.optional(),
204626
- priority: PriorityField.optional()
204857
+ priority: PriorityField.optional(),
204858
+ /** Per-target settings keyed by target id (D1032) — absent = every target follows the rule. */
204859
+ targetOverrides: NcTargetOverridesSchema.optional()
204627
204860
  });
204628
204861
  TimelapseRuleInputSchema.extend({
204629
204862
  id: string(),
@@ -212981,6 +213214,19 @@ var HUB_DISCOVERY_REFRESH_TIMEOUT_MS = 8e3;
212981
213214
  var HUB_CHILD_SLEEP_RECONCILE_MS = 6e4;
212982
213215
  var HUB_RECONNECT_BASE_MS = 2e3;
212983
213216
  var HUB_RECONNECT_MAX_MS = 3e4;
213217
+ /**
213218
+ * Threshold for marking an adopted child offline when missing from consecutive refreshes.
213219
+ * 10 minutes covers ~3 default refresh cycles + transient firmware latency without
213220
+ * false-flagging battery cams that take a few cycles to wake into the list.
213221
+ */
213222
+ var HUB_MISSING_OFFLINE_MS = 10 * 6e4;
213223
+ /**
213224
+ * Longer grace for a child flagged asleep that drops off a non-empty hub list. A sleeping battery
213225
+ * camera may vanish from the summary for hours, but `battery.sleeping` is a persisted slice: a
213226
+ * camera that died or was unplugged while flagged asleep must still go offline eventually.
213227
+ * Measured from the last time the hub actually LISTED the child.
213228
+ */
213229
+ var SLEEPING_MISSING_OFFLINE_MS = 360 * 6e4;
212984
213230
  var UNROUTED_LOG_THROTTLE_MS = 6e4;
212985
213231
  /**
212986
213232
  * ONE Reolink NVR / Home Hub: a single Baichuan control + event socket fronting N channels,
@@ -213013,6 +213259,10 @@ var ReolinkHubSession = class {
213013
213259
  #refreshInFlight = null;
213014
213260
  /** Wall-clock ms of the last refresh that listed each child (by device id). */
213015
213261
  #childLastSeenAt = /* @__PURE__ */ new Map();
213262
+ /** The empty-list warning fired and the list has not been non-empty since. */
213263
+ #emptyListWarned = false;
213264
+ /** Children THIS session marked offline for being missing from the list (the only ones it may restore). */
213265
+ #offlineByMissing = /* @__PURE__ */ new Set();
213016
213266
  /** Channels the last good refresh listed but nobody adopted: their pushes are expected drops. */
213017
213267
  #knownUnadoptedChannels = /* @__PURE__ */ new Set();
213018
213268
  #unroutedLoggedAt = /* @__PURE__ */ new Map();
@@ -213311,13 +213561,25 @@ var ReolinkHubSession = class {
213311
213561
  */
213312
213562
  reconcileChildOnline(channels) {
213313
213563
  const now = this.#now();
213564
+ const cameras = this.#deps.children().filter((c) => c.channel !== void 0 && c.type === DeviceType.Camera);
213565
+ if (channels.length === 0 && cameras.length > 0) {
213566
+ if (!this.#emptyListWarned) {
213567
+ this.#emptyListWarned = true;
213568
+ this.#logger.warn("Reolink hub: channel list came back empty with adopted children — online state left unchanged", {
213569
+ tags: { integrationId: this.integrationId },
213570
+ meta: { adopted: cameras.length }
213571
+ });
213572
+ }
213573
+ return;
213574
+ }
213575
+ if (channels.length > 0) this.#emptyListWarned = false;
213314
213576
  const listed = new Set(channels.map((c) => c.channel));
213315
- for (const child of this.#deps.children()) {
213577
+ for (const child of cameras) {
213316
213578
  const ch = child.channel;
213317
213579
  if (ch === void 0) continue;
213318
- if (child.type !== DeviceType.Camera) continue;
213319
213580
  if (listed.has(ch)) {
213320
213581
  this.#childLastSeenAt.set(child.id, now);
213582
+ this.#offlineByMissing.delete(child.id);
213321
213583
  if (!child.online) {
213322
213584
  child.markOnline(true);
213323
213585
  this.#logger.info("Reolink hub: adopted child back online", {
@@ -213330,10 +213592,28 @@ var ReolinkHubSession = class {
213330
213592
  }
213331
213593
  continue;
213332
213594
  }
213333
- const lastSeen = this.#childLastSeenAt.get(child.id) ?? 0;
213334
- const missingMs = lastSeen > 0 ? now - lastSeen : Number.POSITIVE_INFINITY;
213335
- if (missingMs >= 6e5 && child.online) {
213595
+ let lastSeen = this.#childLastSeenAt.get(child.id);
213596
+ if (lastSeen === void 0) {
213597
+ lastSeen = now;
213598
+ this.#childLastSeenAt.set(child.id, now);
213599
+ }
213600
+ if (child.sleeping && !child.online && this.#offlineByMissing.has(child.id) && now - lastSeen < 216e5) {
213601
+ this.#offlineByMissing.delete(child.id);
213602
+ child.markOnline(true);
213603
+ this.#logger.info("Reolink hub: sleeping child restored to online", {
213604
+ tags: {
213605
+ deviceId: child.id,
213606
+ deviceName: child.name
213607
+ },
213608
+ meta: { channel: ch }
213609
+ });
213610
+ continue;
213611
+ }
213612
+ const graceMs = child.sleeping ? SLEEPING_MISSING_OFFLINE_MS : HUB_MISSING_OFFLINE_MS;
213613
+ const missingMs = now - lastSeen;
213614
+ if (missingMs >= graceMs && child.online) {
213336
213615
  child.markOnline(false);
213616
+ this.#offlineByMissing.add(child.id);
213337
213617
  this.#logger.warn("Reolink hub: adopted child marked offline (missing from the hub list)", {
213338
213618
  tags: {
213339
213619
  deviceId: child.id,
@@ -217455,6 +217735,9 @@ var ReolinkCamera = class ReolinkCamera extends BaseDevice {
217455
217735
  get online() {
217456
217736
  return camera.online;
217457
217737
  },
217738
+ get sleeping() {
217739
+ return camera.sleeping;
217740
+ },
217458
217741
  get debugGeneral() {
217459
217742
  return camera.config.get("debugGeneral") === true;
217460
217743
  },