@camstack/addon-provider-dreame 0.1.20 → 0.1.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/dist/addon.js +1250 -91
  2. package/dist/addon.mjs +1250 -91
  3. package/package.json +1 -1
package/dist/addon.js CHANGED
@@ -4680,7 +4680,7 @@ function preprocess(fn, schema) {
4680
4680
  });
4681
4681
  }
4682
4682
  //#endregion
4683
- //#region ../types/dist/sleep-MHm--th-.mjs
4683
+ //#region ../types/dist/sleep-BiDFW0E7.mjs
4684
4684
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
4685
4685
  EventCategory["SystemBoot"] = "system.boot";
4686
4686
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -5493,6 +5493,100 @@ function createDurableState(deps) {
5493
5493
  };
5494
5494
  }
5495
5495
  /**
5496
+ * Per-node scoping for the shared addon-settings blob.
5497
+ *
5498
+ * An addon's settings store is hub-central (the `addon-settings` cap is
5499
+ * hub-routed — the hub instance answers for every node), so fields whose
5500
+ * value is a NODE fact (decoder backend, engine pick, probed hardware
5501
+ * capabilities) persist under the node-scoped key `<key>@<nodeId>` inside
5502
+ * the single shared blob. The SCHEMA field key stays bare: the write path
5503
+ * ({@link scopePatch}) maps the bare field onto the target node's scoped
5504
+ * key; the read/hydrate path ({@link projectStore}) maps THIS node's value
5505
+ * back, so UI forms and `resolveConfig` only ever see the bare key.
5506
+ *
5507
+ * Fields opt in via the `perNode: true` schema marker on `ConfigFieldBase`
5508
+ * (`interfaces/config-ui.ts`); `BaseAddon` derives the key set from the
5509
+ * schema and routes reads/writes through these helpers.
5510
+ *
5511
+ * ## No bare-key fallback — deliberate
5512
+ *
5513
+ * {@link readNodeValue} reads the node-scoped key ONLY. A node with no
5514
+ * scoped key resolves to `undefined` so the field's schema `default` wins —
5515
+ * NEVER `store[base]` and never another node's value. A bare legacy key in
5516
+ * the store is invisible to every node, hub included, so one node's
5517
+ * selection can never leak onto another. (This generalizes the
5518
+ * `decoder-backend-keys.ts` semantics — the no-fallback variant — over an
5519
+ * arbitrary set of per-node field keys.)
5520
+ *
5521
+ * Pure functions only — no I/O, no imports beyond the language. This is a
5522
+ * LEAF module: import it via its deep path, never from the root barrel.
5523
+ */
5524
+ /**
5525
+ * Normalize a raw kernel node id to the bare node id used for scoping.
5526
+ * `localNodeId` can carry a `<node>/<addon>` suffix on forked child
5527
+ * processes; per-node settings are per-NODE, so strip the addon segment.
5528
+ * `undefined` / `null` / empty falls back to `'hub'`.
5529
+ */
5530
+ function normalizeNodeId(raw) {
5531
+ if (raw === void 0 || raw === null || raw === "") return "hub";
5532
+ const slashIdx = raw.indexOf("/");
5533
+ if (slashIdx < 0) return raw;
5534
+ const bare = raw.slice(0, slashIdx);
5535
+ return bare === "" ? "hub" : bare;
5536
+ }
5537
+ /** The node-scoped store key for a per-node field: `<base>@<nodeId>`. */
5538
+ function nodeScopedKey(base, nodeId) {
5539
+ return `${base}@${normalizeNodeId(nodeId)}`;
5540
+ }
5541
+ /**
5542
+ * Read a node's value for a per-node field from the raw shared store:
5543
+ * the node-scoped key when present, otherwise `undefined`.
5544
+ * Deliberately NO bare-key fallback (see module doc) — the caller lets the
5545
+ * schema `default` win on `undefined`.
5546
+ */
5547
+ function readNodeValue(store, base, nodeId) {
5548
+ return store[nodeScopedKey(base, nodeId)];
5549
+ }
5550
+ /**
5551
+ * Re-map a UI/settings patch so every bare perNode field persists under the
5552
+ * TARGET node's scoped key; all other keys pass through unchanged. Used on
5553
+ * the write path so a save for one node never clobbers another node's value
5554
+ * (and the bare key is never written). Returns a new object — the input
5555
+ * patch is not mutated.
5556
+ */
5557
+ function scopePatch(patch, perNodeKeys, nodeId) {
5558
+ const out = {};
5559
+ for (const [key, value] of Object.entries(patch)) out[perNodeKeys.has(key) ? nodeScopedKey(key, nodeId) : key] = value;
5560
+ return out;
5561
+ }
5562
+ /**
5563
+ * Project the raw shared store onto the bare schema keys for ONE node so a
5564
+ * UI schema (whose field keys are bare) hydrates from that node's own
5565
+ * values:
5566
+ *
5567
+ * - EVERY `@`-scoped key (any node's) is dropped from the pass-through.
5568
+ * - Every bare perNode key is dropped from the pass-through (a stray bare
5569
+ * legacy key must never hydrate any node — no bare fallback).
5570
+ * - THIS node's effective value ({@link readNodeValue}) is then laid onto
5571
+ * each bare perNode key; when the node has no scoped key the bare key is
5572
+ * left ABSENT so the field's schema `default` wins.
5573
+ *
5574
+ * Returns a new object — the input store is not mutated.
5575
+ */
5576
+ function projectStore(store, perNodeKeys, nodeId) {
5577
+ const out = {};
5578
+ for (const [key, value] of Object.entries(store)) {
5579
+ if (key.includes("@")) continue;
5580
+ if (perNodeKeys.has(key)) continue;
5581
+ out[key] = value;
5582
+ }
5583
+ for (const base of perNodeKeys) {
5584
+ const value = readNodeValue(store, base, nodeId);
5585
+ if (value !== void 0) out[base] = value;
5586
+ }
5587
+ return out;
5588
+ }
5589
+ /**
5496
5590
  * Base class for CamStack addons. Eliminates settings boilerplate:
5497
5591
  *
5498
5592
  * - Typed `config` property with automatic resolution from store + defaults
@@ -5660,23 +5754,63 @@ var BaseAddon = class {
5660
5754
  deviceSettingsSchema() {
5661
5755
  return null;
5662
5756
  }
5663
- async getGlobalSettings(overlay, cap, _nodeId) {
5757
+ async getGlobalSettings(overlay, cap, nodeId) {
5664
5758
  const schema = this.globalSettingsSchema(cap);
5665
5759
  if (!schema) return { sections: [] };
5666
- const raw = await this._ctx?.settings?.readAddonStore() ?? {};
5760
+ const projected = await this.resolveGlobalStore(nodeId, cap);
5667
5761
  return hydrateSchema(schema, overlay ? {
5668
- ...raw,
5762
+ ...projected,
5669
5763
  ...overlay
5670
- } : raw);
5764
+ } : projected);
5671
5765
  }
5672
- async updateGlobalSettings(patch, _nodeId) {
5673
- await this._ctx?.settings?.writeAddonStore(patch);
5766
+ /**
5767
+ * The raw addon store PROJECTED onto the target node's bare per-node keys:
5768
+ * every `perNode: true` field carries THAT node's scoped value on its bare
5769
+ * key (absent scoped key ⇒ key absent, so the schema `default` wins — no
5770
+ * bare fallback), all `@`-scoped and stray bare per-node keys are dropped.
5771
+ * A no-op passthrough when the schema declares no `perNode` field.
5772
+ *
5773
+ * This is the sanctioned way for a `getGlobalSettings` OVERRIDE that needs
5774
+ * the store for custom option logic (option narrowing, value snapping) to
5775
+ * read it per-node — never `ctx.settings.readAddonStore()` directly.
5776
+ * `nodeId` omitted ⇒ the local node (node-blind injection from ctx).
5777
+ */
5778
+ async resolveGlobalStore(nodeId, cap) {
5779
+ const raw = await this._ctx?.settings?.readAddonStore() ?? {};
5780
+ const keys = this.perNodeKeys(cap);
5781
+ const node = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
5782
+ return keys.size > 0 ? projectStore(raw, keys, node) : raw;
5783
+ }
5784
+ async updateGlobalSettings(patch, nodeId) {
5785
+ const keys = this.perNodeKeys();
5786
+ const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
5787
+ const target = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
5788
+ const barePatch = patch;
5789
+ const scoped = keys.size > 0 ? scopePatch(barePatch, keys, target) : barePatch;
5790
+ await this._ctx?.settings?.writeAddonStore(scoped);
5791
+ if (target !== localNode) return;
5674
5792
  await this.resolveConfig();
5675
5793
  await this.onConfigChanged();
5676
5794
  this.emitLifecycle(EventCategory.AddonUpdated, { level: "global" });
5677
5795
  this.maybeAutoRestart(patch, this.globalSettingsSchema());
5678
5796
  }
5679
5797
  /**
5798
+ * The set of field keys the global settings schema declares `perNode: true`
5799
+ * — derived once per `cap` argument and memoized (schemas are static
5800
+ * declarations). Empty set ⇒ every per-node code path is bypassed and the
5801
+ * settings API behaves exactly like the legacy node-agnostic one.
5802
+ */
5803
+ _perNodeKeysCache = /* @__PURE__ */ new Map();
5804
+ perNodeKeys(cap) {
5805
+ const cacheKey = cap ?? "";
5806
+ const cached = this._perNodeKeysCache.get(cacheKey);
5807
+ if (cached) return cached;
5808
+ const schema = this.globalSettingsSchema(cap);
5809
+ const keys = new Set(schema ? schema.sections.flatMap((section) => collectPerNodeFieldKeys(section.fields)) : []);
5810
+ this._perNodeKeysCache.set(cacheKey, keys);
5811
+ return keys;
5812
+ }
5813
+ /**
5680
5814
  * If any field in `patch` is marked `requiresRestart` in `schema`,
5681
5815
  * schedule an addon restart for the next tick. Deferred via
5682
5816
  * `setImmediate` so the tRPC mutation that triggered the write has
@@ -5829,12 +5963,19 @@ var BaseAddon = class {
5829
5963
  * The merge is shallow: each key in `defaults` is checked against the store.
5830
5964
  * Only keys present in defaults are read — the store can contain extra keys
5831
5965
  * (e.g. from older versions) without polluting the typed config.
5966
+ *
5967
+ * Keys the global settings schema declares `perNode: true` resolve from
5968
+ * THIS node's scoped key (`<key>@<localNode>`) via `readNodeValue` — never
5969
+ * from the bare key — so a per-node field resolves to this node's own
5970
+ * selection at boot (absent scoped key ⇒ the constructor default wins).
5832
5971
  */
5833
5972
  async resolveConfig() {
5834
5973
  const stored = await this.readAddonStoreWithRetry();
5974
+ const perNode = this.perNodeKeys();
5975
+ const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
5835
5976
  const resolved = { ...this.defaults };
5836
5977
  for (const key of Object.keys(this.defaults)) {
5837
- const storedValue = stored[key];
5978
+ const storedValue = perNode.has(key) ? readNodeValue(stored, key, localNode) : stored[key];
5838
5979
  if (storedValue !== void 0 && storedValue !== null) {
5839
5980
  const defaultType = typeof this.defaults[key];
5840
5981
  if (typeof storedValue === defaultType) resolved[key] = storedValue;
@@ -5918,6 +6059,27 @@ var BaseAddon = class {
5918
6059
  }
5919
6060
  };
5920
6061
  /**
6062
+ * Collect the keys of every field marked `perNode: true`, recursing into
6063
+ * layout containers (`group` fields and `sub-tabs` tabs) the same way
6064
+ * `hydrateSchema` does. Valueless structural fields (separator/info/…)
6065
+ * don't declare `perNode` and are excluded by the `in` narrowing.
6066
+ */
6067
+ function collectPerNodeFieldKeys(fields) {
6068
+ const collected = [];
6069
+ for (const field of fields) {
6070
+ if (field.type === "group") {
6071
+ collected.push(...collectPerNodeFieldKeys(field.fields));
6072
+ continue;
6073
+ }
6074
+ if (field.type === "sub-tabs") {
6075
+ for (const tab of field.tabs) collected.push(...collectPerNodeFieldKeys(tab.fields));
6076
+ continue;
6077
+ }
6078
+ if ("perNode" in field && field.perNode === true) collected.push(field.key);
6079
+ }
6080
+ return collected;
6081
+ }
6082
+ /**
5921
6083
  * Normalize an `ICamstackAddon.initialize()` return value into the
5922
6084
  * `AddonInitResult` envelope. Arrays are wrapped into `{ providers }`;
5923
6085
  * envelopes pass through; void stays void.
@@ -6325,6 +6487,13 @@ var DeviceType = /* @__PURE__ */ function(DeviceType) {
6325
6487
  /** Single still-image entity (HA `image.*`). Read-only display of an
6326
6488
  * `entity_picture` signed URL the browser loads directly. `image` cap. */
6327
6489
  DeviceType["Image"] = "image";
6490
+ /** Smart pet feeder — cloud-connected food dispenser with a bowl food
6491
+ * level, battery, desiccant life, feeding state and manual-feed /
6492
+ * call-pet / maintenance actions. Installed with the `pet-feeder` cap;
6493
+ * dual-hopper models (D4S/D4SH) expose per-hopper portions. Sources:
6494
+ * native PetKit (`nodepetkit` `FeederDevice`), reusable by other feeder
6495
+ * integrations sharing the same food/desiccant/hopper surface. */
6496
+ DeviceType["PetFeeder"] = "pet-feeder";
6328
6497
  return DeviceType;
6329
6498
  }({});
6330
6499
  var DeviceFeature = /* @__PURE__ */ function(DeviceFeature) {
@@ -7489,6 +7658,601 @@ var _macroLookup = /* @__PURE__ */ new Map();
7489
7658
  for (const [k, v] of Object.entries(YAMNET_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
7490
7659
  for (const [k, v] of Object.entries(APPLE_SA_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
7491
7660
  /**
7661
+ * Error types for the safe expression engine. Two distinct classes so callers
7662
+ * can tell a compile-time (grammar) failure from a runtime (evaluation)
7663
+ * failure — both are non-fatal to the host: read paths degrade to "skip link".
7664
+ */
7665
+ /** Thrown by the tokenizer / parser. Carries a 0-based source `position` when
7666
+ * the failure is anchored to a character (author-facing inline feedback). */
7667
+ var ExpressionParseError = class extends Error {
7668
+ position;
7669
+ constructor(message, position) {
7670
+ super(message);
7671
+ this.name = "ExpressionParseError";
7672
+ this.position = position;
7673
+ }
7674
+ };
7675
+ /** Thrown by the evaluator (unknown identifier, type mismatch, non-finite
7676
+ * result, unknown builtin, step-budget exceeded). */
7677
+ var ExpressionEvalError = class extends Error {
7678
+ constructor(message) {
7679
+ super(message);
7680
+ this.name = "ExpressionEvalError";
7681
+ }
7682
+ };
7683
+ /**
7684
+ * Resource-bound constants for the safe expression engine.
7685
+ *
7686
+ * Every bound is defense-in-depth: the grammar is non-Turing-complete (no
7687
+ * loops, recursion, lambdas or member access — see `ast.ts`), so evaluation is
7688
+ * O(nodeCount) by construction. These caps merely put a hard ceiling on the
7689
+ * work a single author-supplied expression can request, so a hostile or
7690
+ * accidental pathological string can never spend unbounded CPU/memory.
7691
+ */
7692
+ /** Max source length (chars) — checked BEFORE tokenizing so a huge string is
7693
+ * rejected without allocation. */
7694
+ var MAX_EXPRESSION_SOURCE_LENGTH = 2048;
7695
+ /** A legal binding / identifier name. */
7696
+ var EXPRESSION_IDENTIFIER_RE = /^[A-Za-z_][A-Za-z0-9_]*$/;
7697
+ /** Binding names an author may NOT use: `now` is auto-injected; the literal
7698
+ * keywords lex as values, not identifiers, so binding to them is meaningless. */
7699
+ var RESERVED_BINDING_NAMES = new Set([
7700
+ "now",
7701
+ "true",
7702
+ "false",
7703
+ "null"
7704
+ ]);
7705
+ /**
7706
+ * Tokenizer for the safe expression mini-language. Hand-rolled, single-pass,
7707
+ * zero-dependency. The grammar is deliberately boring: decimal numbers,
7708
+ * single/double-quoted strings with a tiny escape set, identifiers, the three
7709
+ * value keywords (`true`/`false`/`null`) and a fixed punctuator set. Anything
7710
+ * outside that — a bare `.`, `=`, `[`, `]`, `{`, `}`, `;`, backtick, `&`, `|` —
7711
+ * is a parse error with a source position, so member access / assignment /
7712
+ * template literals are lexically impossible.
7713
+ */
7714
+ var KEYWORDS = new Set([
7715
+ "true",
7716
+ "false",
7717
+ "null"
7718
+ ]);
7719
+ function isDigit(ch) {
7720
+ return ch >= "0" && ch <= "9";
7721
+ }
7722
+ function isIdentStart(ch) {
7723
+ return ch >= "A" && ch <= "Z" || ch >= "a" && ch <= "z" || ch === "_";
7724
+ }
7725
+ function isIdentPart(ch) {
7726
+ return isIdentStart(ch) || isDigit(ch);
7727
+ }
7728
+ function isWhitespace(ch) {
7729
+ return ch === " " || ch === " " || ch === "\n" || ch === "\r" || ch === "\f" || ch === "\v";
7730
+ }
7731
+ /** Tokenize `source` into a flat token list ending with a single `eof` token.
7732
+ * Throws `ExpressionParseError` on any illegal character or unterminated
7733
+ * string. */
7734
+ function tokenize(source) {
7735
+ if (source.length > 2048) throw new ExpressionParseError(`expression too long (${source.length} > ${MAX_EXPRESSION_SOURCE_LENGTH} chars)`, 0);
7736
+ const tokens = [];
7737
+ let i = 0;
7738
+ const n = source.length;
7739
+ while (i < n) {
7740
+ const ch = source[i];
7741
+ if (isWhitespace(ch)) {
7742
+ i += 1;
7743
+ continue;
7744
+ }
7745
+ if (isDigit(ch)) {
7746
+ const start = i;
7747
+ while (i < n && isDigit(source[i])) i += 1;
7748
+ if (i < n && source[i] === ".") {
7749
+ if (i + 1 >= n || !isDigit(source[i + 1])) throw new ExpressionParseError("malformed number: decimal point needs a digit", i);
7750
+ i += 1;
7751
+ while (i < n && isDigit(source[i])) i += 1;
7752
+ }
7753
+ const text = source.slice(start, i);
7754
+ const value = Number(text);
7755
+ if (!Number.isFinite(value)) throw new ExpressionParseError(`malformed number: '${text}'`, start);
7756
+ tokens.push({
7757
+ type: "number",
7758
+ value,
7759
+ pos: start
7760
+ });
7761
+ continue;
7762
+ }
7763
+ if (ch === "'" || ch === "\"") {
7764
+ const quote = ch;
7765
+ const start = i;
7766
+ i += 1;
7767
+ let out = "";
7768
+ let closed = false;
7769
+ while (i < n) {
7770
+ const c = source[i];
7771
+ if (c === "\\") {
7772
+ const next = i + 1 < n ? source[i + 1] : "";
7773
+ if (next === "\\" || next === "'" || next === "\"") {
7774
+ out += next;
7775
+ i += 2;
7776
+ continue;
7777
+ }
7778
+ throw new ExpressionParseError(`invalid string escape: '\\${next}'`, i);
7779
+ }
7780
+ if (c === quote) {
7781
+ closed = true;
7782
+ i += 1;
7783
+ break;
7784
+ }
7785
+ out += c;
7786
+ i += 1;
7787
+ }
7788
+ if (!closed) throw new ExpressionParseError("unterminated string literal", start);
7789
+ tokens.push({
7790
+ type: "string",
7791
+ value: out,
7792
+ pos: start
7793
+ });
7794
+ continue;
7795
+ }
7796
+ if (isIdentStart(ch)) {
7797
+ const start = i;
7798
+ while (i < n && isIdentPart(source[i])) i += 1;
7799
+ const text = source.slice(start, i);
7800
+ if (KEYWORDS.has(text)) tokens.push({
7801
+ type: "keyword",
7802
+ keyword: keywordOf(text),
7803
+ pos: start
7804
+ });
7805
+ else tokens.push({
7806
+ type: "identifier",
7807
+ name: text,
7808
+ pos: start
7809
+ });
7810
+ continue;
7811
+ }
7812
+ const two = i + 1 < n ? source.slice(i, i + 2) : "";
7813
+ if (two === "<=" || two === ">=" || two === "==" || two === "!=" || two === "&&" || two === "||") {
7814
+ tokens.push({
7815
+ type: "punct",
7816
+ punct: two,
7817
+ pos: i
7818
+ });
7819
+ i += 2;
7820
+ continue;
7821
+ }
7822
+ if (isSinglePunct(ch)) {
7823
+ tokens.push({
7824
+ type: "punct",
7825
+ punct: ch,
7826
+ pos: i
7827
+ });
7828
+ i += 1;
7829
+ continue;
7830
+ }
7831
+ throw new ExpressionParseError(`unexpected character '${ch}'`, i);
7832
+ }
7833
+ tokens.push({
7834
+ type: "eof",
7835
+ pos: n
7836
+ });
7837
+ return tokens;
7838
+ }
7839
+ function keywordOf(text) {
7840
+ if (text === "true") return "true";
7841
+ if (text === "false") return "false";
7842
+ return "null";
7843
+ }
7844
+ function isSinglePunct(ch) {
7845
+ return ch === "(" || ch === ")" || ch === "," || ch === "?" || ch === ":" || ch === "+" || ch === "-" || ch === "*" || ch === "/" || ch === "%" || ch === "!" || ch === "<" || ch === ">";
7846
+ }
7847
+ /**
7848
+ * Frozen, null-prototype builtin function table for the expression engine
7849
+ * (spec §4 rule 4). The table is the SOLE surface of callable functions: the
7850
+ * parser rejects any callee not in it, and the evaluator gates each call on an
7851
+ * own-property check against it.
7852
+ *
7853
+ * Because the object has a NULL prototype AND is `Object.freeze`d:
7854
+ * - it cannot be polluted (no `__proto__` / `constructor` write reaches it);
7855
+ * - a lookup for `toString` / `hasOwnProperty` / `constructor` finds NOTHING
7856
+ * (there is no `Object.prototype` in the chain), so those names are not
7857
+ * callable — they are simply "unknown function" at parse time.
7858
+ *
7859
+ * Every numeric argument is validated as a finite number and every numeric
7860
+ * RESULT is re-checked finite, so `/0`, `sqrt(-1)` (→ NaN) and overflow
7861
+ * (`pow(10,400)` → Infinity) all raise `ExpressionEvalError` and fail the link
7862
+ * closed rather than emitting a garbage value.
7863
+ */
7864
+ function asFiniteNumber(value, name, index) {
7865
+ if (typeof value !== "number" || !Number.isFinite(value)) throw new ExpressionEvalError(`${name}: argument ${index + 1} must be a finite number`);
7866
+ return value;
7867
+ }
7868
+ function asString$1(value, name, index) {
7869
+ if (typeof value !== "string") throw new ExpressionEvalError(`${name}: argument ${index + 1} must be a string`);
7870
+ return value;
7871
+ }
7872
+ function finiteResult(value, name) {
7873
+ if (!Number.isFinite(value)) throw new ExpressionEvalError(`${name}: produced a non-finite result`);
7874
+ return value;
7875
+ }
7876
+ function allFiniteNumbers(args, name) {
7877
+ return args.map((a, idx) => asFiniteNumber(a, name, idx));
7878
+ }
7879
+ var INF = Number.POSITIVE_INFINITY;
7880
+ var table = {
7881
+ min: {
7882
+ minArgs: 1,
7883
+ maxArgs: INF,
7884
+ apply: (args) => finiteResult(Math.min(...allFiniteNumbers(args, "min")), "min")
7885
+ },
7886
+ max: {
7887
+ minArgs: 1,
7888
+ maxArgs: INF,
7889
+ apply: (args) => finiteResult(Math.max(...allFiniteNumbers(args, "max")), "max")
7890
+ },
7891
+ abs: {
7892
+ minArgs: 1,
7893
+ maxArgs: 1,
7894
+ apply: (args) => finiteResult(Math.abs(asFiniteNumber(args[0], "abs", 0)), "abs")
7895
+ },
7896
+ floor: {
7897
+ minArgs: 1,
7898
+ maxArgs: 1,
7899
+ apply: (args) => finiteResult(Math.floor(asFiniteNumber(args[0], "floor", 0)), "floor")
7900
+ },
7901
+ ceil: {
7902
+ minArgs: 1,
7903
+ maxArgs: 1,
7904
+ apply: (args) => finiteResult(Math.ceil(asFiniteNumber(args[0], "ceil", 0)), "ceil")
7905
+ },
7906
+ sqrt: {
7907
+ minArgs: 1,
7908
+ maxArgs: 1,
7909
+ apply: (args) => finiteResult(Math.sqrt(asFiniteNumber(args[0], "sqrt", 0)), "sqrt")
7910
+ },
7911
+ round: {
7912
+ minArgs: 1,
7913
+ maxArgs: 2,
7914
+ apply: (args) => {
7915
+ const x = asFiniteNumber(args[0], "round", 0);
7916
+ const digits = args.length > 1 ? Math.trunc(asFiniteNumber(args[1], "round", 1)) : 0;
7917
+ if (digits < 0 || digits > 100) throw new ExpressionEvalError("round: digits must be between 0 and 100");
7918
+ const factor = 10 ** digits;
7919
+ return finiteResult(Math.round(x * factor) / factor, "round");
7920
+ }
7921
+ },
7922
+ pow: {
7923
+ minArgs: 2,
7924
+ maxArgs: 2,
7925
+ apply: (args) => finiteResult(asFiniteNumber(args[0], "pow", 0) ** asFiniteNumber(args[1], "pow", 1), "pow")
7926
+ },
7927
+ clamp: {
7928
+ minArgs: 3,
7929
+ maxArgs: 3,
7930
+ apply: (args) => {
7931
+ const x = asFiniteNumber(args[0], "clamp", 0);
7932
+ const lo = asFiniteNumber(args[1], "clamp", 1);
7933
+ const hi = asFiniteNumber(args[2], "clamp", 2);
7934
+ if (lo > hi) throw new ExpressionEvalError("clamp: lower bound is greater than upper bound");
7935
+ return finiteResult(Math.min(hi, Math.max(lo, x)), "clamp");
7936
+ }
7937
+ },
7938
+ avg: {
7939
+ minArgs: 1,
7940
+ maxArgs: INF,
7941
+ apply: (args) => {
7942
+ const nums = allFiniteNumbers(args, "avg");
7943
+ return finiteResult(nums.reduce((acc, v) => acc + v, 0) / nums.length, "avg");
7944
+ }
7945
+ },
7946
+ sum: {
7947
+ minArgs: 1,
7948
+ maxArgs: INF,
7949
+ apply: (args) => finiteResult(allFiniteNumbers(args, "sum").reduce((acc, v) => acc + v, 0), "sum")
7950
+ },
7951
+ coalesce: {
7952
+ minArgs: 1,
7953
+ maxArgs: INF,
7954
+ apply: (args) => {
7955
+ for (const a of args) if (a !== null) return a;
7956
+ return null;
7957
+ }
7958
+ },
7959
+ age: {
7960
+ minArgs: 2,
7961
+ maxArgs: 2,
7962
+ apply: (args) => finiteResult(asFiniteNumber(args[0], "age", 0) - asFiniteNumber(args[1], "age", 1), "age")
7963
+ },
7964
+ convert: {
7965
+ minArgs: 3,
7966
+ maxArgs: 3,
7967
+ apply: (args, hooks) => {
7968
+ const x = asFiniteNumber(args[0], "convert", 0);
7969
+ const from = asString$1(args[1], "convert", 1).trim();
7970
+ const to = asString$1(args[2], "convert", 2).trim();
7971
+ if (hooks.convert) {
7972
+ const out = hooks.convert(x, from, to);
7973
+ if (out === null) throw new ExpressionEvalError(`convert: cannot convert '${from}' to '${to}'`);
7974
+ return finiteResult(out, "convert");
7975
+ }
7976
+ if (from === to) return x;
7977
+ throw new ExpressionEvalError("convert: unit conversion table not installed");
7978
+ }
7979
+ }
7980
+ };
7981
+ Object.freeze(Object.assign(Object.create(null), table));
7982
+ /** The set of valid builtin names — used by the parser to reject unknown
7983
+ * callees at parse time (immediate author feedback). */
7984
+ var EXPRESSION_BUILTIN_NAMES = new Set(Object.keys(table));
7985
+ /**
7986
+ * Pratt (precedence-climbing) parser for the safe expression mini-language.
7987
+ *
7988
+ * Precedence (low → high): ternary `?:` (right-assoc) → `||` → `&&` → equality
7989
+ * → relational → additive → multiplicative → unary `! -` → call / primary.
7990
+ * Calls are ONLY `IDENT '(' args? ')'` at primary position — the callee is a
7991
+ * string validated against the builtin table at parse time, so an unknown
7992
+ * function is rejected immediately (author feedback) and a persisted expression
7993
+ * that references a since-removed builtin degrades at read.
7994
+ *
7995
+ * A node counter caps total AST size (`MAX_EXPRESSION_AST_NODES`) and call
7996
+ * arity is capped (`MAX_EXPRESSION_CALL_ARGS`) — both raise `ExpressionParseError`.
7997
+ */
7998
+ /** Binary/logical operator precedence (higher binds tighter). */
7999
+ var BINARY_PRECEDENCE = {
8000
+ "||": 1,
8001
+ "&&": 2,
8002
+ "==": 3,
8003
+ "!=": 3,
8004
+ "<": 4,
8005
+ "<=": 4,
8006
+ ">": 4,
8007
+ ">=": 4,
8008
+ "+": 5,
8009
+ "-": 5,
8010
+ "*": 6,
8011
+ "/": 6,
8012
+ "%": 6
8013
+ };
8014
+ function isLogicalOp(op) {
8015
+ return op === "&&" || op === "||";
8016
+ }
8017
+ function isBinaryOp(op) {
8018
+ return op === "+" || op === "-" || op === "*" || op === "/" || op === "%" || op === "==" || op === "!=" || op === "<" || op === "<=" || op === ">" || op === ">=";
8019
+ }
8020
+ var Parser = class {
8021
+ tokens;
8022
+ pos = 0;
8023
+ nodeCount = 0;
8024
+ identifiers = /* @__PURE__ */ new Set();
8025
+ callees = /* @__PURE__ */ new Set();
8026
+ constructor(tokens) {
8027
+ this.tokens = tokens;
8028
+ }
8029
+ parse() {
8030
+ const ast = this.parseTernary();
8031
+ const tok = this.peek();
8032
+ if (tok.type !== "eof") throw new ExpressionParseError("unexpected trailing input", tok.pos);
8033
+ return {
8034
+ ast,
8035
+ identifiers: this.identifiers,
8036
+ callees: this.callees,
8037
+ nodeCount: this.nodeCount
8038
+ };
8039
+ }
8040
+ peek() {
8041
+ return this.tokens[this.pos];
8042
+ }
8043
+ next() {
8044
+ return this.tokens[this.pos++];
8045
+ }
8046
+ /** Consume a punctuator token, erroring if the next token isn't it. */
8047
+ expectPunct(punct) {
8048
+ const tok = this.peek();
8049
+ if (tok.type !== "punct" || tok.punct !== punct) throw new ExpressionParseError(`expected '${punct}'`, tok.pos);
8050
+ this.pos += 1;
8051
+ }
8052
+ matchPunct(punct) {
8053
+ const tok = this.peek();
8054
+ if (tok.type === "punct" && tok.punct === punct) {
8055
+ this.pos += 1;
8056
+ return true;
8057
+ }
8058
+ return false;
8059
+ }
8060
+ countNode() {
8061
+ this.nodeCount += 1;
8062
+ if (this.nodeCount > 256) throw new ExpressionParseError("expression too complex", this.peek().pos);
8063
+ }
8064
+ parseTernary() {
8065
+ const test = this.parseBinary(1);
8066
+ if (this.matchPunct("?")) {
8067
+ const consequent = this.parseTernary();
8068
+ this.expectPunct(":");
8069
+ const alternate = this.parseTernary();
8070
+ this.countNode();
8071
+ return {
8072
+ kind: "conditional",
8073
+ test,
8074
+ consequent,
8075
+ alternate
8076
+ };
8077
+ }
8078
+ return test;
8079
+ }
8080
+ parseBinary(minPrec) {
8081
+ let left = this.parseUnary();
8082
+ for (;;) {
8083
+ const tok = this.peek();
8084
+ if (tok.type !== "punct") break;
8085
+ const prec = BINARY_PRECEDENCE[tok.punct];
8086
+ if (prec === void 0 || prec < minPrec) break;
8087
+ const op = tok.punct;
8088
+ this.pos += 1;
8089
+ const right = this.parseBinary(prec + 1);
8090
+ this.countNode();
8091
+ if (isLogicalOp(op)) left = {
8092
+ kind: "logical",
8093
+ op,
8094
+ left,
8095
+ right
8096
+ };
8097
+ else if (isBinaryOp(op)) left = {
8098
+ kind: "binary",
8099
+ op,
8100
+ left,
8101
+ right
8102
+ };
8103
+ else throw new ExpressionParseError(`unexpected operator '${op}'`, tok.pos);
8104
+ }
8105
+ return left;
8106
+ }
8107
+ parseUnary() {
8108
+ const tok = this.peek();
8109
+ if (tok.type === "punct" && (tok.punct === "!" || tok.punct === "-")) {
8110
+ const op = tok.punct;
8111
+ this.pos += 1;
8112
+ const operand = this.parseUnary();
8113
+ this.countNode();
8114
+ return {
8115
+ kind: "unary",
8116
+ op,
8117
+ operand
8118
+ };
8119
+ }
8120
+ return this.parsePrimary();
8121
+ }
8122
+ parsePrimary() {
8123
+ const tok = this.next();
8124
+ switch (tok.type) {
8125
+ case "number":
8126
+ this.countNode();
8127
+ return {
8128
+ kind: "literal",
8129
+ value: tok.value
8130
+ };
8131
+ case "string":
8132
+ this.countNode();
8133
+ return {
8134
+ kind: "literal",
8135
+ value: tok.value
8136
+ };
8137
+ case "keyword":
8138
+ this.countNode();
8139
+ return {
8140
+ kind: "literal",
8141
+ value: tok.keyword === "null" ? null : tok.keyword === "true"
8142
+ };
8143
+ case "identifier": {
8144
+ const nextTok = this.peek();
8145
+ if (nextTok.type === "punct" && nextTok.punct === "(") return this.parseCall(tok.name, tok.pos);
8146
+ this.identifiers.add(tok.name);
8147
+ this.countNode();
8148
+ return {
8149
+ kind: "identifier",
8150
+ name: tok.name
8151
+ };
8152
+ }
8153
+ case "punct":
8154
+ if (tok.punct === "(") {
8155
+ const inner = this.parseTernary();
8156
+ this.expectPunct(")");
8157
+ return inner;
8158
+ }
8159
+ throw new ExpressionParseError(`unexpected token '${tok.punct}'`, tok.pos);
8160
+ case "eof": throw new ExpressionParseError("unexpected end of expression", tok.pos);
8161
+ }
8162
+ }
8163
+ parseCall(callee, pos) {
8164
+ if (!EXPRESSION_BUILTIN_NAMES.has(callee)) throw new ExpressionParseError(`unknown function '${callee}'`, pos);
8165
+ this.expectPunct("(");
8166
+ const args = [];
8167
+ if (!this.matchPunct(")")) for (;;) {
8168
+ args.push(this.parseTernary());
8169
+ if (args.length > 16) throw new ExpressionParseError(`too many arguments to '${callee}'`, pos);
8170
+ if (this.matchPunct(",")) continue;
8171
+ this.expectPunct(")");
8172
+ break;
8173
+ }
8174
+ this.callees.add(callee);
8175
+ this.countNode();
8176
+ return {
8177
+ kind: "call",
8178
+ callee,
8179
+ args
8180
+ };
8181
+ }
8182
+ };
8183
+ /** Tokenize + parse `source` into a validated `ParsedExpression`. Throws
8184
+ * `ExpressionParseError` on any lexical or grammatical failure. */
8185
+ function parseExpression(source) {
8186
+ return new Parser(tokenize(source)).parse();
8187
+ }
8188
+ Object.freeze({});
8189
+ /**
8190
+ * LRU compile cache for parsed expressions (spec §2.4 "parse once … LRU keyed
8191
+ * by expr"). The cache stores BOTH successes and failures (negative caching),
8192
+ * so a corrupt persisted string costs exactly one tokenize+parse total — not
8193
+ * one per read on a hot resolve path.
8194
+ *
8195
+ * The cache is a module-level singleton: entries are pure, content-addressed
8196
+ * ASTs keyed by the raw source string, so sharing one instance across all
8197
+ * callers is safe and maximises hit rate.
8198
+ */
8199
+ var cache = /* @__PURE__ */ new Map();
8200
+ function getCached(source) {
8201
+ const hit = cache.get(source);
8202
+ if (hit !== void 0) {
8203
+ cache.delete(source);
8204
+ cache.set(source, hit);
8205
+ return hit;
8206
+ }
8207
+ let result;
8208
+ try {
8209
+ result = {
8210
+ ok: true,
8211
+ parsed: parseExpression(source)
8212
+ };
8213
+ } catch (err) {
8214
+ result = {
8215
+ ok: false,
8216
+ error: err instanceof ExpressionParseError ? err.message : String(err)
8217
+ };
8218
+ }
8219
+ cache.set(source, result);
8220
+ if (cache.size > 256) {
8221
+ const oldest = cache.keys().next().value;
8222
+ if (oldest !== void 0) cache.delete(oldest);
8223
+ }
8224
+ return result;
8225
+ }
8226
+ /** Compile `source`, returning a discriminated result instead of throwing.
8227
+ * Used by read paths that must degrade rather than raise. LRU/negative-cached. */
8228
+ function compileExpressionSafe(source) {
8229
+ return getCached(source);
8230
+ }
8231
+ /**
8232
+ * Author-time validation. Returns `null` when the source is valid, else a
8233
+ * human-readable error message. Checks: the expression compiles; binding count
8234
+ * is within `MAX_EXPRESSION_BINDINGS`; every binding name is a legal identifier,
8235
+ * is not reserved (`now`/keywords) and does not shadow a builtin; and every
8236
+ * FREE identifier of the AST is covered by a binding or the injected `now`.
8237
+ */
8238
+ function validateExpressionSource(src) {
8239
+ const names = Object.keys(src.bindings);
8240
+ if (names.length > 32) return `too many bindings (${names.length} > 32)`;
8241
+ for (const name of names) {
8242
+ if (!EXPRESSION_IDENTIFIER_RE.test(name)) return `invalid binding name '${name}'`;
8243
+ if (RESERVED_BINDING_NAMES.has(name)) return `binding name '${name}' is reserved`;
8244
+ if (EXPRESSION_BUILTIN_NAMES.has(name)) return `binding name '${name}' shadows a builtin function`;
8245
+ }
8246
+ const compiled = compileExpressionSafe(src.expr);
8247
+ if (!compiled.ok) return compiled.error;
8248
+ const bound = new Set(names);
8249
+ for (const id of compiled.parsed.identifiers) {
8250
+ if (id === "now") continue;
8251
+ if (!bound.has(id)) return `expression references unbound identifier '${id}'`;
8252
+ }
8253
+ return null;
8254
+ }
8255
+ /**
7492
8256
  * Accessory device helpers — shared across drivers.
7493
8257
  *
7494
8258
  * Many vendor-specific drivers register accessory child devices on
@@ -8333,7 +9097,13 @@ onStatusChanged: { data: object({
8333
9097
  }) } },
8334
9098
  status: {
8335
9099
  schema: BatteryStatusSchema,
8336
- kind: "push"
9100
+ kind: "push",
9101
+ empty: {
9102
+ percentage: 0,
9103
+ charging: "none",
9104
+ sleeping: false,
9105
+ lastUpdated: 0
9106
+ }
8337
9107
  },
8338
9108
  /**
8339
9109
  * Runtime-state slice — every provider that registers this cap
@@ -9276,21 +10046,38 @@ var connectivityCapability = {
9276
10046
  },
9277
10047
  runtimeState: ConnectivityStatusSchema
9278
10048
  };
10049
+ /**
10050
+ * Generic device-consumables capability — surfaces a device's
10051
+ * maintenance items (vacuum filters/brushes, replaceable cartridges,
10052
+ * descaling cycles, …) with their remaining life and an optional
10053
+ * "Replaced" reset action. Device-agnostic: any provider that knows its
10054
+ * device tracks consumables can register it; the cap declares no
10055
+ * vocabulary of its own — the provider names each item verbatim.
10056
+ *
10057
+ * Like `childLayout`, the cap is INERT until a provider sets items: no
10058
+ * provider populates it by guessing (no HA inference). The UI renders a
10059
+ * "No consumables reported" placeholder when `items` is empty.
10060
+ */
10061
+ /** A single consumable item. Either a continuous `level` (remaining
10062
+ * life %) or a discrete `status` may be known — both may be null when a
10063
+ * provider only knows the item exists. `level` and `status` are not
10064
+ * mutually exclusive; a provider may report both. */
10065
+ var ConsumableItemSchema = object({
10066
+ /** Stable id, e.g. 'main-brush'. */
10067
+ key: string().min(1),
10068
+ /** Display name. */
10069
+ label: string().min(1),
10070
+ /** Remaining life % when known (0..100). */
10071
+ level: number().min(0).max(100).nullable(),
10072
+ /** Discrete state when known (binary mode). */
10073
+ status: _enum(["ok", "replace"]).nullable(),
10074
+ /** Ms epoch of the last replace, when known. */
10075
+ lastResetAt: number().nullable(),
10076
+ /** Whether `reset()` is meaningful for this item. */
10077
+ resettable: boolean()
10078
+ });
9279
10079
  var ConsumablesStatusSchema = object({
9280
- items: array(object({
9281
- /** Stable id, e.g. 'main-brush'. */
9282
- key: string().min(1),
9283
- /** Display name. */
9284
- label: string().min(1),
9285
- /** Remaining life % when known (0..100). */
9286
- level: number().min(0).max(100).nullable(),
9287
- /** Discrete state when known (binary mode). */
9288
- status: _enum(["ok", "replace"]).nullable(),
9289
- /** Ms epoch of the last replace, when known. */
9290
- lastResetAt: number().nullable(),
9291
- /** Whether `reset()` is meaningful for this item. */
9292
- resettable: boolean()
9293
- })),
10080
+ items: array(ConsumableItemSchema),
9294
10081
  lastChangedAt: number()
9295
10082
  });
9296
10083
  var consumablesCapability = {
@@ -9349,7 +10136,25 @@ reset: method(object({
9349
10136
  }) },
9350
10137
  status: {
9351
10138
  schema: ConsumablesStatusSchema,
9352
- kind: "push"
10139
+ kind: "push",
10140
+ empty: {
10141
+ items: [],
10142
+ lastChangedAt: 0
10143
+ },
10144
+ itemArray: {
10145
+ path: "items",
10146
+ keyField: "key",
10147
+ labelField: "label",
10148
+ itemSchema: ConsumableItemSchema,
10149
+ emptyItem: {
10150
+ key: "",
10151
+ label: "",
10152
+ level: null,
10153
+ status: null,
10154
+ lastResetAt: null,
10155
+ resettable: false
10156
+ }
10157
+ }
9353
10158
  },
9354
10159
  runtimeState: ConsumablesStatusSchema.extend({ lastFetchedAt: number() })
9355
10160
  };
@@ -10591,7 +11396,8 @@ var MotionAnalysisResultSchema = object({
10591
11396
  });
10592
11397
  method(object({
10593
11398
  deviceId: number(),
10594
- frame: FrameInputSchema
11399
+ frame: FrameInputSchema.optional(),
11400
+ frameHandle: FrameHandleSchema.optional()
10595
11401
  }), MotionAnalysisResultSchema, { kind: "mutation" }), method(object({ deviceId: number() }), _void(), { kind: "mutation" }), method(_void(), _void(), { kind: "mutation" }), object({
10596
11402
  deviceId: number(),
10597
11403
  detected: boolean(),
@@ -10838,6 +11644,12 @@ method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngi
10838
11644
  engine: PipelineEngineChoiceSchema.optional(),
10839
11645
  steps: array(PipelineStepInputSchema).min(1),
10840
11646
  frame: FrameInputSchema.optional(),
11647
+ /**
11648
+ * CB5 shm passthrough — a `FrameHandle` naming the same ring slot
11649
+ * the decoded pixels live in. One more member of the one-of
11650
+ * frame/frameHandle/image/imageBase64/referenceImage group.
11651
+ */
11652
+ frameHandle: FrameHandleSchema.optional(),
10841
11653
  imageBase64: string().optional(),
10842
11654
  /**
10843
11655
  * Binary JPEG bytes — preferred over `imageBase64` on internal
@@ -11080,6 +11892,31 @@ var ReportMotionInputSchema = object({
11080
11892
  regions: array(MotionRegionSchema).readonly().optional()
11081
11893
  });
11082
11894
  /**
11895
+ * Where a runner gets a camera's decoded frames (cross-node Phase 2,
11896
+ * restream-owner model — P2c).
11897
+ *
11898
+ * - `local-broker` (DEFAULT): today's path — subscribe to the co-located
11899
+ * stream-broker's shm frame plane. Every pre-P2c attach payload (no
11900
+ * `frameSource` key) parses to this, so the field is additive with zero
11901
+ * behavior change.
11902
+ * - `remote-restream`: the detect node is NOT the camera's source-owner.
11903
+ * The runner acquires the owner's COMPRESSED passthrough restream
11904
+ * (`streamBroker.getStreamWithCodec({video:'copy'})` — refcounted, the
11905
+ * double-pull guard) and decodes LOCALLY via a satellite frame plane +
11906
+ * pull-mode decoder session pinned to its own node. The shm ring stays
11907
+ * node-local; only H.264/H.265 packets cross the wire.
11908
+ * `hubHostnameOverride` mirrors the recorder's `recordingHubHostname`:
11909
+ * when set it overrides the `CAMSTACK_HUB_URL`-derived host the runner
11910
+ * dials for the owner's restream.
11911
+ */
11912
+ var RunnerFrameSourceSchema = discriminatedUnion("kind", [object({ kind: literal("local-broker") }), object({
11913
+ kind: literal("remote-restream"),
11914
+ /** The camera's source-owner node (slice 1: always the hub). */
11915
+ ownerNodeId: string(),
11916
+ /** Operator override for the owner host the runner dials. */
11917
+ hubHostnameOverride: string().optional()
11918
+ })]).describe("Per-camera frame-source mode for the runner (P2c)");
11919
+ /**
11083
11920
  * Camera assignment payload sent by `addon-pipeline-orchestrator` to a
11084
11921
  * specific runner instance via `attachCamera`. Carries everything the
11085
11922
  * runner needs to subscribe to the local broker and execute inference.
@@ -11177,7 +12014,15 @@ var RunnerCameraConfigSchema = object({
11177
12014
  */
11178
12015
  onboardMotionDrivesAnalyzer: boolean().default(true),
11179
12016
  occupancyRecheckSec: number().min(occupancyRecheckSecField.min).max(occupancyRecheckSecField.max).default(occupancyRecheckSecField.default),
11180
- occupancyRecheckFrames: number().min(occupancyRecheckFramesField.min).max(occupancyRecheckFramesField.max).default(occupancyRecheckFramesField.default)
12017
+ occupancyRecheckFrames: number().min(occupancyRecheckFramesField.min).max(occupancyRecheckFramesField.max).default(occupancyRecheckFramesField.default),
12018
+ /**
12019
+ * Where this runner gets the camera's decoded frames (P2c). Defaulted so
12020
+ * every existing payload behaves as `local-broker` — the pre-Phase-2 path.
12021
+ * Populated with `remote-restream` by the orchestrator ONLY when the
12022
+ * camera's detect node differs from its source-owner (P2d, gated by the
12023
+ * `remoteSourcingNodes` rollout setting).
12024
+ */
12025
+ frameSource: RunnerFrameSourceSchema.default({ kind: "local-broker" })
11181
12026
  });
11182
12027
  motionFpsField.min, motionFpsField.max, motionFpsField.step, motionFpsField.default, detectionFpsField.min, detectionFpsField.max, detectionFpsField.step, detectionFpsField.default, motionCooldownMsField.min, motionCooldownMsField.max, motionCooldownMsField.step, motionCooldownMsField.default, occupancyRecheckSecField.min, occupancyRecheckSecField.max, occupancyRecheckSecField.step, occupancyRecheckSecField.default, occupancyRecheckFramesField.min, occupancyRecheckFramesField.max, occupancyRecheckFramesField.step, occupancyRecheckFramesField.default;
11183
12028
  /**
@@ -11741,6 +12586,157 @@ var numericSensorCapability = {
11741
12586
  runtimeState: NumericSensorStatusSchema
11742
12587
  };
11743
12588
  /**
12589
+ * Feeder connectivity / power status — mirrors the HA petkit device-status
12590
+ * enum: `normal` (online, mains), `offline` (not reaching PetKit cloud),
12591
+ * `on_batteries` (running on battery backup). `null` until first reported.
12592
+ */
12593
+ var PetFeederDeviceStatusSchema = _enum([
12594
+ "normal",
12595
+ "offline",
12596
+ "on_batteries"
12597
+ ]);
12598
+ var gramsPortion = number().int().min(4).max(200);
12599
+ var PetFeederStatusSchema = object({
12600
+ /** Food currently in the bowl (grams). Null when the device has not
12601
+ * reported a reading yet. On dual-hopper models this is the combined
12602
+ * bowl reading; per-hopper levels live in `food1`/`food2`. */
12603
+ foodLevel: number().nullable(),
12604
+ /** Hopper-1 food level (grams) on dual-hopper feeders; null on
12605
+ * single-hopper models. */
12606
+ food1: number().nullable(),
12607
+ /** Hopper-2 food level (grams) on dual-hopper feeders; null on
12608
+ * single-hopper models. */
12609
+ food2: number().nullable(),
12610
+ /** Derived low-food flag — mirrors the HA `food_level` binary_sensor
12611
+ * (`device_class: problem`, on = low). True when the bowl is empty /
12612
+ * below the feeder's low threshold. */
12613
+ lowFood: boolean(),
12614
+ /** Battery charge 0..100 (%). Null on mains-powered models or when the
12615
+ * device has no battery reading. */
12616
+ batteryPower: number().min(0).max(100).nullable(),
12617
+ /** Days of desiccant life remaining. Null when the model has no
12618
+ * desiccant sensor. */
12619
+ desiccantLeftDays: number().nullable(),
12620
+ /** True while a feed is in progress. */
12621
+ feeding: boolean(),
12622
+ /** Decoded connectivity / power status (HA petkit device-status enum).
12623
+ * Null until the device has reported a status. */
12624
+ status: PetFeederDeviceStatusSchema.nullable(),
12625
+ /** Decoded human-readable fault message. Null (or the device's `no_error`
12626
+ * sentinel) means healthy; a non-null string is an active fault. Pairs
12627
+ * with `errorCode` for consumers that want the raw integer. */
12628
+ error: string().nullable(),
12629
+ /** Raw device error code (0 / null = no error). */
12630
+ errorCode: number().nullable(),
12631
+ /** True for D4S/D4SH dual-hopper hardware — gates the per-hopper UI. */
12632
+ isDualHopper: boolean(),
12633
+ /** Child-lock (manual-lock) setting — buttons on the unit are disabled. */
12634
+ childLock: boolean(),
12635
+ /** Front indicator-light setting. */
12636
+ indicatorLight: boolean(),
12637
+ /** Play a chime when dispensing. */
12638
+ feedSound: boolean(),
12639
+ /** Speaker / prompt volume level (device-scaled integer). */
12640
+ volume: number(),
12641
+ /** Ms epoch when the slice was last refreshed from the cloud. */
12642
+ lastFetchedAt: number()
12643
+ });
12644
+ var petFeederCapability = {
12645
+ name: "pet-feeder",
12646
+ scope: "device",
12647
+ deviceNative: true,
12648
+ mode: "singleton",
12649
+ deviceTypes: [DeviceType.PetFeeder],
12650
+ methods: {
12651
+ /**
12652
+ * Dispense food now. Single-hopper feeders take `grams`; dual-hopper
12653
+ * feeders (D4S/D4SH) accept `hopper1`/`hopper2` to target one or both
12654
+ * hoppers. All portions honour the 4–200 g hardware range. At least
12655
+ * one of the three must be present — the provider rejects an empty
12656
+ * request.
12657
+ */
12658
+ feed: method(object({
12659
+ deviceId: number().int().nonnegative(),
12660
+ grams: gramsPortion.optional(),
12661
+ hopper1: gramsPortion.optional(),
12662
+ hopper2: gramsPortion.optional()
12663
+ }), _void(), {
12664
+ kind: "mutation",
12665
+ auth: "admin"
12666
+ }),
12667
+ /** Cancel an in-progress manual feed. */
12668
+ cancelFeed: method(object({ deviceId: number().int().nonnegative() }), _void(), {
12669
+ kind: "mutation",
12670
+ auth: "admin"
12671
+ }),
12672
+ /** Reset the desiccant "days remaining" counter after replacing it. */
12673
+ resetDesiccant: method(object({ deviceId: number().int().nonnegative() }), _void(), {
12674
+ kind: "mutation",
12675
+ auth: "admin"
12676
+ }),
12677
+ /** Mark a hopper as refilled (D4H/D4S/D4SH). */
12678
+ markFoodReplenished: method(object({ deviceId: number().int().nonnegative() }), _void(), {
12679
+ kind: "mutation",
12680
+ auth: "admin"
12681
+ }),
12682
+ /** Call the pet with the recorded prompt (D3). */
12683
+ callPet: method(object({ deviceId: number().int().nonnegative() }), _void(), {
12684
+ kind: "mutation",
12685
+ auth: "admin"
12686
+ }),
12687
+ /** Play a stored sound by id (D3 / D4H / D4SH). */
12688
+ playSound: method(object({
12689
+ deviceId: number().int().nonnegative(),
12690
+ soundId: number().int().nonnegative()
12691
+ }), _void(), {
12692
+ kind: "mutation",
12693
+ auth: "admin"
12694
+ }),
12695
+ /** Toggle the child-lock (manual-lock) setting. */
12696
+ setChildLock: method(object({
12697
+ deviceId: number().int().nonnegative(),
12698
+ on: boolean()
12699
+ }), _void(), {
12700
+ kind: "mutation",
12701
+ auth: "admin"
12702
+ }),
12703
+ /** Toggle the front indicator light. */
12704
+ setIndicatorLight: method(object({
12705
+ deviceId: number().int().nonnegative(),
12706
+ on: boolean()
12707
+ }), _void(), {
12708
+ kind: "mutation",
12709
+ auth: "admin"
12710
+ }),
12711
+ /** Toggle the dispense chime. */
12712
+ setFeedSound: method(object({
12713
+ deviceId: number().int().nonnegative(),
12714
+ on: boolean()
12715
+ }), _void(), {
12716
+ kind: "mutation",
12717
+ auth: "admin"
12718
+ }),
12719
+ /** Set the speaker / prompt volume level. */
12720
+ setVolume: method(object({
12721
+ deviceId: number().int().nonnegative(),
12722
+ level: number().int().nonnegative()
12723
+ }), _void(), {
12724
+ kind: "mutation",
12725
+ auth: "admin"
12726
+ })
12727
+ },
12728
+ status: {
12729
+ schema: PetFeederStatusSchema,
12730
+ kind: "poll"
12731
+ },
12732
+ /**
12733
+ * Runtime-state slice — mirrored by the kernel. UI feeder cards read
12734
+ * the full slice via `device.state.petFeeder.value` and refresh on
12735
+ * every poll without re-querying the provider.
12736
+ */
12737
+ runtimeState: PetFeederStatusSchema
12738
+ };
12739
+ /**
11744
12740
  * Multi-metric electrical meter. One slice can carry any combination
11745
12741
  * of instantaneous power (W), cumulative energy (kWh), voltage (V),
11746
12742
  * and current (A) — all fields optional so a single-metric source
@@ -13043,6 +14039,7 @@ var DEVICE_LOCAL_STATE_CAPS = {
13043
14039
  nativeObjectDetection: nativeObjectDetectionCapability,
13044
14040
  notifier: notifierCapability,
13045
14041
  numericSensor: numericSensorCapability,
14042
+ petFeeder: petFeederCapability,
13046
14043
  powerMeter: powerMeterCapability,
13047
14044
  presence: presenceCapability,
13048
14045
  pressureSensor: pressureSensorCapability,
@@ -14959,10 +15956,12 @@ method(object({ codec: string() }), boolean()), method(_void(), object({
14959
15956
  url: string()
14960
15957
  }), _void()), method(object({
14961
15958
  sessionId: string(),
14962
- maxCount: number().default(1)
15959
+ maxCount: number().default(1),
15960
+ waitMs: number().optional()
14963
15961
  }), array(DecodedFrameSchema)), method(object({
14964
15962
  sessionId: string(),
14965
- maxCount: number().default(1)
15963
+ maxCount: number().default(1),
15964
+ waitMs: number().optional()
14966
15965
  }), array(FrameHandleSchema)), method(object({ handle: FrameHandleSchema }), DecodedFrameSchema.nullable()), method(object({ sessionId: string() }), ShmRingStatsSchema.nullable()), method(object({
14967
15966
  sessionId: string(),
14968
15967
  config: DecoderSessionConfigSchema.partial()
@@ -15266,14 +16265,63 @@ var ChildLayoutEntrySchema = object({
15266
16265
  collapsed: boolean().optional()
15267
16266
  });
15268
16267
  /** Cap-wire shape of a DeviceLink — structurally mirrors `DeviceLink` in
15269
- * `device-management.ts`. */
16268
+ * `device-management.ts`. Source is a union: a FIELD source copies a sibling
16269
+ * accessory's status field (`kind` optional/absent for wire compat); a
16270
+ * LITERAL source carries a per-device constant (no sibling is read); a
16271
+ * GLOBAL source (P2e) copies ANY device's status field, addressed by the
16272
+ * source device's full re-sync-stable `stableId`. */
16273
+ var DeviceLinkFieldSourceSchema = object({
16274
+ kind: literal("field").optional(),
16275
+ sourceKey: string(),
16276
+ cap: string(),
16277
+ fieldPath: string()
16278
+ });
16279
+ var DeviceLinkLiteralSourceSchema = object({
16280
+ kind: literal("literal"),
16281
+ value: union([
16282
+ string(),
16283
+ number(),
16284
+ boolean(),
16285
+ _null()
16286
+ ])
16287
+ });
16288
+ var DeviceLinkGlobalSourceSchema = object({
16289
+ kind: literal("global"),
16290
+ sourceStableId: string(),
16291
+ cap: string(),
16292
+ fieldPath: string()
16293
+ });
16294
+ /** Expression source (Stage X): compute the target field from N named bindings
16295
+ * via the safe expression engine. Bindings are field | literal | global — never
16296
+ * another expression (no nesting). The `superRefine` runs the SAME author-time
16297
+ * validation as `validateExpressionSource` (compiles the expr, checks binding
16298
+ * names + identifier coverage) so every wire boundary that parses a DeviceLink
16299
+ * (tRPC mount, kernel create pre-seed, projection output) validates-at-write.
16300
+ * Compiles are LRU-cached, so repeated validation of the same expr is a hit. */
16301
+ var DeviceLinkExpressionSourceSchema = object({
16302
+ kind: literal("expression"),
16303
+ expr: string().min(1).max(MAX_EXPRESSION_SOURCE_LENGTH),
16304
+ bindings: record(string().regex(EXPRESSION_IDENTIFIER_RE), union([
16305
+ DeviceLinkFieldSourceSchema,
16306
+ DeviceLinkLiteralSourceSchema,
16307
+ DeviceLinkGlobalSourceSchema
16308
+ ]))
16309
+ }).superRefine((src, ctx) => {
16310
+ const err = validateExpressionSource(src);
16311
+ if (err !== null) ctx.addIssue({
16312
+ code: "custom",
16313
+ message: err,
16314
+ path: ["expr"]
16315
+ });
16316
+ });
15270
16317
  var DeviceLinkSchema = object({
15271
16318
  id: string(),
15272
- source: object({
15273
- sourceKey: string(),
15274
- cap: string(),
15275
- fieldPath: string()
15276
- }),
16319
+ source: union([
16320
+ DeviceLinkFieldSourceSchema,
16321
+ DeviceLinkLiteralSourceSchema,
16322
+ DeviceLinkGlobalSourceSchema,
16323
+ DeviceLinkExpressionSourceSchema
16324
+ ]),
15277
16325
  target: object({
15278
16326
  cap: string(),
15279
16327
  fieldPath: string(),
@@ -15302,6 +16350,31 @@ var DeviceLinkSchema = object({
15302
16350
  })
15303
16351
  ]).optional()
15304
16352
  });
16353
+ /** Cap-wire shape of a per-cap display refinement — mirrors
16354
+ * `DeviceCapDisplayOverride` in `device-management.ts`. */
16355
+ var DeviceCapDisplayOverrideSchema = object({
16356
+ unit: string().min(1).optional(),
16357
+ precision: number().int().min(0).max(10).optional()
16358
+ });
16359
+ /** Cap-wire shape of an operator-authored per-device display override —
16360
+ * mirrors `DeviceDisplayOverride` in `device-management.ts`. `precision`
16361
+ * bounds mirror `numeric-sensor.cap.ts` (`int 0-10`). */
16362
+ var DeviceDisplayOverrideSchema = object({
16363
+ icon: string().min(1).optional(),
16364
+ label: string().min(1).optional(),
16365
+ unit: string().min(1).optional(),
16366
+ precision: number().int().min(0).max(10).optional(),
16367
+ hidden: boolean().optional(),
16368
+ perCap: record(string(), DeviceCapDisplayOverrideSchema).optional()
16369
+ });
16370
+ /** Cap-wire shape of a per-role display default — mirrors `RoleDisplayDefault`
16371
+ * in `device-management.ts`. Keyed by `DeviceRole` string (role strings cross
16372
+ * the wire as plain strings everywhere else — cf. `DeviceInfoSchema.role`). */
16373
+ var RoleDisplayDefaultSchema = object({
16374
+ unit: string().min(1).optional(),
16375
+ precision: number().int().min(0).max(10).optional(),
16376
+ icon: string().min(1).optional()
16377
+ });
15305
16378
  /**
15306
16379
  * Serializable projection of a live IDevice.
15307
16380
  * Returned by listAll, getDevice, getChildren.
@@ -15357,7 +16430,9 @@ var DeviceInfoSchema = object({
15357
16430
  * `DeviceMeta.childLayout`. Absent ⇒ no layout declared. */
15358
16431
  childLayout: array(ChildLayoutEntrySchema).readonly().optional(),
15359
16432
  /** Operator-authored cross-device field wirings. See `DeviceMeta.deviceLinks`. */
15360
- deviceLinks: array(DeviceLinkSchema).readonly().optional()
16433
+ deviceLinks: array(DeviceLinkSchema).readonly().optional(),
16434
+ /** Operator-authored per-device display override. See `DeviceMeta.display`. */
16435
+ display: DeviceDisplayOverrideSchema.optional()
15361
16436
  });
15362
16437
  var ConfigEntrySchema = object({
15363
16438
  key: string(),
@@ -15422,7 +16497,9 @@ var DeviceMetaSchema = object({
15422
16497
  deviceLinks: array(DeviceLinkSchema).readonly().optional(),
15423
16498
  /** Semantic role string (`DeviceRole`) — propagated from the spawn pre-seed.
15424
16499
  * Optional: only present for accessory children that carry a known role. */
15425
- role: string().nullable().optional()
16500
+ role: string().nullable().optional(),
16501
+ /** Operator-authored per-device display override. See `DeviceMeta.display`. */
16502
+ display: DeviceDisplayOverrideSchema.optional()
15426
16503
  });
15427
16504
  /** ConfigUISchema passed through as unknown — mirrors device-provider's CreationSchemaOutputSchema */
15428
16505
  var ConfigUISchemaOutput = unknown().nullable();
@@ -15516,7 +16593,19 @@ method(object({
15516
16593
  }), _void(), {
15517
16594
  kind: "mutation",
15518
16595
  auth: "admin"
15519
- }), method(object({ deviceId: number() }), object({ caps: array(object({
16596
+ }), method(object({
16597
+ deviceId: number(),
16598
+ display: DeviceDisplayOverrideSchema.nullable()
16599
+ }), _void(), {
16600
+ kind: "mutation",
16601
+ auth: "admin"
16602
+ }), method(object({}), object({ defaults: record(string(), RoleDisplayDefaultSchema) }), { kind: "query" }), method(object({ defaults: record(string(), RoleDisplayDefaultSchema) }), _void(), {
16603
+ kind: "mutation",
16604
+ auth: "admin"
16605
+ }), method(object({
16606
+ deviceId: number(),
16607
+ includeSynthesizable: boolean().optional()
16608
+ }), object({ caps: array(object({
15520
16609
  cap: string(),
15521
16610
  fields: array(object({
15522
16611
  path: string(),
@@ -15526,8 +16615,13 @@ method(object({
15526
16615
  "boolean",
15527
16616
  "enum"
15528
16617
  ]),
15529
- enumValues: array(string()).optional()
15530
- })).readonly()
16618
+ enumValues: array(string()).optional(),
16619
+ item: boolean().optional()
16620
+ })).readonly(),
16621
+ itemArray: object({
16622
+ path: string(),
16623
+ keyField: string()
16624
+ }).optional()
15531
16625
  })).readonly() }), { kind: "query" }), method(object({
15532
16626
  deviceId: number(),
15533
16627
  role: string().nullable()
@@ -15597,7 +16691,11 @@ method(object({
15597
16691
  deviceId: number(),
15598
16692
  entries: array(object({
15599
16693
  capName: string(),
15600
- kind: _enum(["native", "wrapped"]),
16694
+ kind: _enum([
16695
+ "native",
16696
+ "wrapped",
16697
+ "linked"
16698
+ ]),
15601
16699
  providerAddonId: string(),
15602
16700
  providerNodeId: string(),
15603
16701
  nativeAddonId: string()
@@ -15606,7 +16704,11 @@ method(object({
15606
16704
  deviceId: number(),
15607
16705
  entries: array(object({
15608
16706
  capName: string(),
15609
- kind: _enum(["native", "wrapped"]),
16707
+ kind: _enum([
16708
+ "native",
16709
+ "wrapped",
16710
+ "linked"
16711
+ ]),
15610
16712
  providerAddonId: string(),
15611
16713
  providerNodeId: string(),
15612
16714
  nativeAddonId: string()
@@ -16848,7 +17950,10 @@ var AgentLoadSummarySchema = object({
16848
17950
  online: boolean(),
16849
17951
  load: RunnerLocalLoadSchema,
16850
17952
  /** Computed score used by the L2 capacity balancer (lower = less loaded). */
16851
- score: number()
17953
+ score: number(),
17954
+ /** This node's decode hwaccel backend (per-node `probedBestHwaccel`), or null
17955
+ * when not yet probed — for the cluster Pipeline table UI (P0.2). */
17956
+ decodeHwaccel: string().nullable()
16852
17957
  });
16853
17958
  /**
16854
17959
  * Aggregate metrics across the whole detection cluster. Replaces the legacy
@@ -19383,7 +20488,10 @@ var HwAccelBackendInputSchema = _enum([
19383
20488
  "webgpu",
19384
20489
  "none"
19385
20490
  ]).nullable().optional();
19386
- var HwAccelResolutionSchema = object({ preferred: array(string()).readonly() });
20491
+ var HwAccelResolutionSchema = object({
20492
+ preferred: array(string()).readonly(),
20493
+ rationale: string()
20494
+ });
19387
20495
  var HardwareEncoderIdSchema = _enum([
19388
20496
  "h264_videotoolbox",
19389
20497
  "hevc_videotoolbox",
@@ -19398,7 +20506,7 @@ var HardwareEncoderIdSchema = _enum([
19398
20506
  "libx264",
19399
20507
  "libx265"
19400
20508
  ]);
19401
- var HardwareEncodersSchema = object({
20509
+ object({
19402
20510
  encoders: array(object({
19403
20511
  encoder: HardwareEncoderIdSchema,
19404
20512
  codec: _enum(["H264", "H265"]),
@@ -19417,15 +20525,7 @@ var HardwareEncodersSchema = object({
19417
20525
  defaultH265: HardwareEncoderIdSchema,
19418
20526
  probedAt: number()
19419
20527
  });
19420
- /**
19421
- * Decode-side companion to {@link HardwareEncodersSchema}: the `-hwaccel`
19422
- * methods the configured ffmpeg binary actually supports (parsed from
19423
- * `ffmpeg -hwaccels`). Used to gate decode-hwaccel attempts so the transcode
19424
- * egress never spends a spawn on a backend this build cannot offer. Per-stream
19425
- * decode fragility (e.g. VideoToolbox HEVC) is still handled by the egress's
19426
- * software fallback — this only filters out wholly-unsupported backends.
19427
- */
19428
- var HardwareDecodeAccelsSchema = object({
20528
+ object({
19429
20529
  methods: array(string()).readonly(),
19430
20530
  probedAt: number()
19431
20531
  });
@@ -19488,16 +20588,7 @@ var ResolvedInferenceConfigSchema = object({
19488
20588
  format: ModelFormatSchema,
19489
20589
  reason: string()
19490
20590
  });
19491
- method(_void(), PlatformCapabilitiesSchema), method(_void(), HardwareInfoSchema), method(object({ requirements: array(ModelRequirementSchema).readonly() }), ResolvedInferenceConfigSchema), method(object({
19492
- prefer: HwAccelBackendInputSchema,
19493
- nodeId: string().optional()
19494
- }), HwAccelResolutionSchema), method(_void(), HardwareEncodersSchema), method(_void(), HardwareEncodersSchema, {
19495
- kind: "mutation",
19496
- auth: "admin"
19497
- }), method(_void(), HardwareDecodeAccelsSchema), method(_void(), HardwareDecodeAccelsSchema, {
19498
- kind: "mutation",
19499
- auth: "admin"
19500
- });
20591
+ method(_void(), PlatformCapabilitiesSchema), method(_void(), HardwareInfoSchema), method(object({ requirements: array(ModelRequirementSchema).readonly() }), ResolvedInferenceConfigSchema), method(object({ prefer: HwAccelBackendInputSchema }), HwAccelResolutionSchema);
19501
20592
  var PtzPresetSchema = object({
19502
20593
  id: string(),
19503
20594
  name: string()
@@ -19550,6 +20641,16 @@ DeviceType.Camera, DeviceType.Sensor, DeviceType.Switch, method(object({ deviceI
19550
20641
  kind: "mutation",
19551
20642
  auth: "admin"
19552
20643
  });
20644
+ /**
20645
+ * `recording` cap — footage availability + HLS playback manifests + per-device
20646
+ * recording config. NOTE on events (source of truth, R5/C3): this cap carries
20647
+ * NO event surface — `getPlaybackManifest` returns playlist URLs only. Timeline
20648
+ * events (motion/object/audio) come from `pipelineAnalytics` (durable SQLite
20649
+ * rows); the recorder's internal EventMap markers are ephemeral in-RAM
20650
+ * annotations that are not exposed here and must not be treated as an event
20651
+ * feed. Event<->footage joins are by time, padded with the shared `EVENT_PAD_MS`
20652
+ * (`interfaces/recording-config.ts`).
20653
+ */
19553
20654
  var RecordingStatusSchema = object({
19554
20655
  deviceId: number(),
19555
20656
  enabled: boolean(),
@@ -21186,6 +22287,12 @@ Object.freeze({
21186
22287
  addonId: null,
21187
22288
  access: "view"
21188
22289
  },
22290
+ "deviceManager.getRoleDisplayDefaults": {
22291
+ capName: "device-manager",
22292
+ capScope: "system",
22293
+ addonId: null,
22294
+ access: "view"
22295
+ },
21189
22296
  "deviceManager.getSettingsSchema": {
21190
22297
  capName: "device-manager",
21191
22298
  capScope: "system",
@@ -21336,6 +22443,12 @@ Object.freeze({
21336
22443
  addonId: null,
21337
22444
  access: "create"
21338
22445
  },
22446
+ "deviceManager.setDisplay": {
22447
+ capName: "device-manager",
22448
+ capScope: "system",
22449
+ addonId: null,
22450
+ access: "create"
22451
+ },
21339
22452
  "deviceManager.setIntegrationId": {
21340
22453
  capName: "device-manager",
21341
22454
  capScope: "system",
@@ -21378,6 +22491,12 @@ Object.freeze({
21378
22491
  addonId: null,
21379
22492
  access: "create"
21380
22493
  },
22494
+ "deviceManager.setRoleDisplayDefaults": {
22495
+ capName: "device-manager",
22496
+ capScope: "system",
22497
+ addonId: null,
22498
+ access: "create"
22499
+ },
21381
22500
  "deviceManager.setStreamProfileMap": {
21382
22501
  capName: "device-manager",
21383
22502
  capScope: "system",
@@ -22428,6 +23547,66 @@ Object.freeze({
22428
23547
  addonId: null,
22429
23548
  access: "create"
22430
23549
  },
23550
+ "petFeeder.callPet": {
23551
+ capName: "pet-feeder",
23552
+ capScope: "device",
23553
+ addonId: null,
23554
+ access: "create"
23555
+ },
23556
+ "petFeeder.cancelFeed": {
23557
+ capName: "pet-feeder",
23558
+ capScope: "device",
23559
+ addonId: null,
23560
+ access: "create"
23561
+ },
23562
+ "petFeeder.feed": {
23563
+ capName: "pet-feeder",
23564
+ capScope: "device",
23565
+ addonId: null,
23566
+ access: "create"
23567
+ },
23568
+ "petFeeder.markFoodReplenished": {
23569
+ capName: "pet-feeder",
23570
+ capScope: "device",
23571
+ addonId: null,
23572
+ access: "create"
23573
+ },
23574
+ "petFeeder.playSound": {
23575
+ capName: "pet-feeder",
23576
+ capScope: "device",
23577
+ addonId: null,
23578
+ access: "create"
23579
+ },
23580
+ "petFeeder.resetDesiccant": {
23581
+ capName: "pet-feeder",
23582
+ capScope: "device",
23583
+ addonId: null,
23584
+ access: "delete"
23585
+ },
23586
+ "petFeeder.setChildLock": {
23587
+ capName: "pet-feeder",
23588
+ capScope: "device",
23589
+ addonId: null,
23590
+ access: "create"
23591
+ },
23592
+ "petFeeder.setFeedSound": {
23593
+ capName: "pet-feeder",
23594
+ capScope: "device",
23595
+ addonId: null,
23596
+ access: "create"
23597
+ },
23598
+ "petFeeder.setIndicatorLight": {
23599
+ capName: "pet-feeder",
23600
+ capScope: "device",
23601
+ addonId: null,
23602
+ access: "create"
23603
+ },
23604
+ "petFeeder.setVolume": {
23605
+ capName: "pet-feeder",
23606
+ capScope: "device",
23607
+ addonId: null,
23608
+ access: "create"
23609
+ },
22431
23610
  "pipelineAnalytics.clearTracks": {
22432
23611
  capName: "pipeline-analytics",
22433
23612
  capScope: "device",
@@ -23034,30 +24213,6 @@ Object.freeze({
23034
24213
  addonId: null,
23035
24214
  access: "view"
23036
24215
  },
23037
- "platformProbe.getHardwareDecodeAccels": {
23038
- capName: "platform-probe",
23039
- capScope: "system",
23040
- addonId: null,
23041
- access: "view"
23042
- },
23043
- "platformProbe.getHardwareEncoders": {
23044
- capName: "platform-probe",
23045
- capScope: "system",
23046
- addonId: null,
23047
- access: "view"
23048
- },
23049
- "platformProbe.refreshHardwareDecodeAccels": {
23050
- capName: "platform-probe",
23051
- capScope: "system",
23052
- addonId: null,
23053
- access: "create"
23054
- },
23055
- "platformProbe.refreshHardwareEncoders": {
23056
- capName: "platform-probe",
23057
- capScope: "system",
23058
- addonId: null,
23059
- access: "create"
23060
- },
23061
24216
  "platformProbe.resolveHwAccel": {
23062
24217
  capName: "platform-probe",
23063
24218
  capScope: "system",
@@ -76545,12 +77700,16 @@ var DreameIntegrationManager = class {
76545
77700
  const facade = this.#makeFacade(this.#connection);
76546
77701
  this.#facade = facade;
76547
77702
  facade.on("error", (err) => {
76548
- this.#error = errMsg(err);
77703
+ const message = errMsg(err);
77704
+ const changed = message !== this.#error;
77705
+ this.#error = message;
76549
77706
  this.#lastCheckedAt = Date.now();
76550
- this.#logger.warn("DreameIntegrationManager: facade error", {
77707
+ const entry = {
76551
77708
  tags: { brokerId: this.#id },
76552
- meta: { error: errMsg(err) }
76553
- });
77709
+ meta: { error: message }
77710
+ };
77711
+ if (changed) this.#logger.warn("DreameIntegrationManager: facade error", entry);
77712
+ else this.#logger.debug("DreameIntegrationManager: facade error (repeat)", entry);
76554
77713
  });
76555
77714
  facade.on("stateChanged", (push) => {
76556
77715
  dreameFacades.emitStateChanged(this.#id, push.deviceId);