@camstack/addon-export-ha-mqtt 1.1.13 → 1.1.14

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.
@@ -4677,7 +4677,7 @@ function number(params) {
4677
4677
  return /* @__PURE__ */ _coercedNumber(ZodNumber, params);
4678
4678
  }
4679
4679
  //#endregion
4680
- //#region ../types/dist/sleep-C2M2zF7x.mjs
4680
+ //#region ../types/dist/sleep-BiDFW0E7.mjs
4681
4681
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
4682
4682
  EventCategory["SystemBoot"] = "system.boot";
4683
4683
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -5490,6 +5490,100 @@ function createDurableState(deps) {
5490
5490
  };
5491
5491
  }
5492
5492
  /**
5493
+ * Per-node scoping for the shared addon-settings blob.
5494
+ *
5495
+ * An addon's settings store is hub-central (the `addon-settings` cap is
5496
+ * hub-routed — the hub instance answers for every node), so fields whose
5497
+ * value is a NODE fact (decoder backend, engine pick, probed hardware
5498
+ * capabilities) persist under the node-scoped key `<key>@<nodeId>` inside
5499
+ * the single shared blob. The SCHEMA field key stays bare: the write path
5500
+ * ({@link scopePatch}) maps the bare field onto the target node's scoped
5501
+ * key; the read/hydrate path ({@link projectStore}) maps THIS node's value
5502
+ * back, so UI forms and `resolveConfig` only ever see the bare key.
5503
+ *
5504
+ * Fields opt in via the `perNode: true` schema marker on `ConfigFieldBase`
5505
+ * (`interfaces/config-ui.ts`); `BaseAddon` derives the key set from the
5506
+ * schema and routes reads/writes through these helpers.
5507
+ *
5508
+ * ## No bare-key fallback — deliberate
5509
+ *
5510
+ * {@link readNodeValue} reads the node-scoped key ONLY. A node with no
5511
+ * scoped key resolves to `undefined` so the field's schema `default` wins —
5512
+ * NEVER `store[base]` and never another node's value. A bare legacy key in
5513
+ * the store is invisible to every node, hub included, so one node's
5514
+ * selection can never leak onto another. (This generalizes the
5515
+ * `decoder-backend-keys.ts` semantics — the no-fallback variant — over an
5516
+ * arbitrary set of per-node field keys.)
5517
+ *
5518
+ * Pure functions only — no I/O, no imports beyond the language. This is a
5519
+ * LEAF module: import it via its deep path, never from the root barrel.
5520
+ */
5521
+ /**
5522
+ * Normalize a raw kernel node id to the bare node id used for scoping.
5523
+ * `localNodeId` can carry a `<node>/<addon>` suffix on forked child
5524
+ * processes; per-node settings are per-NODE, so strip the addon segment.
5525
+ * `undefined` / `null` / empty falls back to `'hub'`.
5526
+ */
5527
+ function normalizeNodeId(raw) {
5528
+ if (raw === void 0 || raw === null || raw === "") return "hub";
5529
+ const slashIdx = raw.indexOf("/");
5530
+ if (slashIdx < 0) return raw;
5531
+ const bare = raw.slice(0, slashIdx);
5532
+ return bare === "" ? "hub" : bare;
5533
+ }
5534
+ /** The node-scoped store key for a per-node field: `<base>@<nodeId>`. */
5535
+ function nodeScopedKey(base, nodeId) {
5536
+ return `${base}@${normalizeNodeId(nodeId)}`;
5537
+ }
5538
+ /**
5539
+ * Read a node's value for a per-node field from the raw shared store:
5540
+ * the node-scoped key when present, otherwise `undefined`.
5541
+ * Deliberately NO bare-key fallback (see module doc) — the caller lets the
5542
+ * schema `default` win on `undefined`.
5543
+ */
5544
+ function readNodeValue(store, base, nodeId) {
5545
+ return store[nodeScopedKey(base, nodeId)];
5546
+ }
5547
+ /**
5548
+ * Re-map a UI/settings patch so every bare perNode field persists under the
5549
+ * TARGET node's scoped key; all other keys pass through unchanged. Used on
5550
+ * the write path so a save for one node never clobbers another node's value
5551
+ * (and the bare key is never written). Returns a new object — the input
5552
+ * patch is not mutated.
5553
+ */
5554
+ function scopePatch(patch, perNodeKeys, nodeId) {
5555
+ const out = {};
5556
+ for (const [key, value] of Object.entries(patch)) out[perNodeKeys.has(key) ? nodeScopedKey(key, nodeId) : key] = value;
5557
+ return out;
5558
+ }
5559
+ /**
5560
+ * Project the raw shared store onto the bare schema keys for ONE node so a
5561
+ * UI schema (whose field keys are bare) hydrates from that node's own
5562
+ * values:
5563
+ *
5564
+ * - EVERY `@`-scoped key (any node's) is dropped from the pass-through.
5565
+ * - Every bare perNode key is dropped from the pass-through (a stray bare
5566
+ * legacy key must never hydrate any node — no bare fallback).
5567
+ * - THIS node's effective value ({@link readNodeValue}) is then laid onto
5568
+ * each bare perNode key; when the node has no scoped key the bare key is
5569
+ * left ABSENT so the field's schema `default` wins.
5570
+ *
5571
+ * Returns a new object — the input store is not mutated.
5572
+ */
5573
+ function projectStore(store, perNodeKeys, nodeId) {
5574
+ const out = {};
5575
+ for (const [key, value] of Object.entries(store)) {
5576
+ if (key.includes("@")) continue;
5577
+ if (perNodeKeys.has(key)) continue;
5578
+ out[key] = value;
5579
+ }
5580
+ for (const base of perNodeKeys) {
5581
+ const value = readNodeValue(store, base, nodeId);
5582
+ if (value !== void 0) out[base] = value;
5583
+ }
5584
+ return out;
5585
+ }
5586
+ /**
5493
5587
  * Base class for CamStack addons. Eliminates settings boilerplate:
5494
5588
  *
5495
5589
  * - Typed `config` property with automatic resolution from store + defaults
@@ -5657,23 +5751,63 @@ var BaseAddon = class {
5657
5751
  deviceSettingsSchema() {
5658
5752
  return null;
5659
5753
  }
5660
- async getGlobalSettings(overlay, cap, _nodeId) {
5754
+ async getGlobalSettings(overlay, cap, nodeId) {
5661
5755
  const schema = this.globalSettingsSchema(cap);
5662
5756
  if (!schema) return { sections: [] };
5663
- const raw = await this._ctx?.settings?.readAddonStore() ?? {};
5757
+ const projected = await this.resolveGlobalStore(nodeId, cap);
5664
5758
  return hydrateSchema(schema, overlay ? {
5665
- ...raw,
5759
+ ...projected,
5666
5760
  ...overlay
5667
- } : raw);
5761
+ } : projected);
5668
5762
  }
5669
- async updateGlobalSettings(patch, _nodeId) {
5670
- await this._ctx?.settings?.writeAddonStore(patch);
5763
+ /**
5764
+ * The raw addon store PROJECTED onto the target node's bare per-node keys:
5765
+ * every `perNode: true` field carries THAT node's scoped value on its bare
5766
+ * key (absent scoped key ⇒ key absent, so the schema `default` wins — no
5767
+ * bare fallback), all `@`-scoped and stray bare per-node keys are dropped.
5768
+ * A no-op passthrough when the schema declares no `perNode` field.
5769
+ *
5770
+ * This is the sanctioned way for a `getGlobalSettings` OVERRIDE that needs
5771
+ * the store for custom option logic (option narrowing, value snapping) to
5772
+ * read it per-node — never `ctx.settings.readAddonStore()` directly.
5773
+ * `nodeId` omitted ⇒ the local node (node-blind injection from ctx).
5774
+ */
5775
+ async resolveGlobalStore(nodeId, cap) {
5776
+ const raw = await this._ctx?.settings?.readAddonStore() ?? {};
5777
+ const keys = this.perNodeKeys(cap);
5778
+ const node = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
5779
+ return keys.size > 0 ? projectStore(raw, keys, node) : raw;
5780
+ }
5781
+ async updateGlobalSettings(patch, nodeId) {
5782
+ const keys = this.perNodeKeys();
5783
+ const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
5784
+ const target = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
5785
+ const barePatch = patch;
5786
+ const scoped = keys.size > 0 ? scopePatch(barePatch, keys, target) : barePatch;
5787
+ await this._ctx?.settings?.writeAddonStore(scoped);
5788
+ if (target !== localNode) return;
5671
5789
  await this.resolveConfig();
5672
5790
  await this.onConfigChanged();
5673
5791
  this.emitLifecycle(EventCategory.AddonUpdated, { level: "global" });
5674
5792
  this.maybeAutoRestart(patch, this.globalSettingsSchema());
5675
5793
  }
5676
5794
  /**
5795
+ * The set of field keys the global settings schema declares `perNode: true`
5796
+ * — derived once per `cap` argument and memoized (schemas are static
5797
+ * declarations). Empty set ⇒ every per-node code path is bypassed and the
5798
+ * settings API behaves exactly like the legacy node-agnostic one.
5799
+ */
5800
+ _perNodeKeysCache = /* @__PURE__ */ new Map();
5801
+ perNodeKeys(cap) {
5802
+ const cacheKey = cap ?? "";
5803
+ const cached = this._perNodeKeysCache.get(cacheKey);
5804
+ if (cached) return cached;
5805
+ const schema = this.globalSettingsSchema(cap);
5806
+ const keys = new Set(schema ? schema.sections.flatMap((section) => collectPerNodeFieldKeys(section.fields)) : []);
5807
+ this._perNodeKeysCache.set(cacheKey, keys);
5808
+ return keys;
5809
+ }
5810
+ /**
5677
5811
  * If any field in `patch` is marked `requiresRestart` in `schema`,
5678
5812
  * schedule an addon restart for the next tick. Deferred via
5679
5813
  * `setImmediate` so the tRPC mutation that triggered the write has
@@ -5826,12 +5960,19 @@ var BaseAddon = class {
5826
5960
  * The merge is shallow: each key in `defaults` is checked against the store.
5827
5961
  * Only keys present in defaults are read — the store can contain extra keys
5828
5962
  * (e.g. from older versions) without polluting the typed config.
5963
+ *
5964
+ * Keys the global settings schema declares `perNode: true` resolve from
5965
+ * THIS node's scoped key (`<key>@<localNode>`) via `readNodeValue` — never
5966
+ * from the bare key — so a per-node field resolves to this node's own
5967
+ * selection at boot (absent scoped key ⇒ the constructor default wins).
5829
5968
  */
5830
5969
  async resolveConfig() {
5831
5970
  const stored = await this.readAddonStoreWithRetry();
5971
+ const perNode = this.perNodeKeys();
5972
+ const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
5832
5973
  const resolved = { ...this.defaults };
5833
5974
  for (const key of Object.keys(this.defaults)) {
5834
- const storedValue = stored[key];
5975
+ const storedValue = perNode.has(key) ? readNodeValue(stored, key, localNode) : stored[key];
5835
5976
  if (storedValue !== void 0 && storedValue !== null) {
5836
5977
  const defaultType = typeof this.defaults[key];
5837
5978
  if (typeof storedValue === defaultType) resolved[key] = storedValue;
@@ -5915,6 +6056,27 @@ var BaseAddon = class {
5915
6056
  }
5916
6057
  };
5917
6058
  /**
6059
+ * Collect the keys of every field marked `perNode: true`, recursing into
6060
+ * layout containers (`group` fields and `sub-tabs` tabs) the same way
6061
+ * `hydrateSchema` does. Valueless structural fields (separator/info/…)
6062
+ * don't declare `perNode` and are excluded by the `in` narrowing.
6063
+ */
6064
+ function collectPerNodeFieldKeys(fields) {
6065
+ const collected = [];
6066
+ for (const field of fields) {
6067
+ if (field.type === "group") {
6068
+ collected.push(...collectPerNodeFieldKeys(field.fields));
6069
+ continue;
6070
+ }
6071
+ if (field.type === "sub-tabs") {
6072
+ for (const tab of field.tabs) collected.push(...collectPerNodeFieldKeys(tab.fields));
6073
+ continue;
6074
+ }
6075
+ if ("perNode" in field && field.perNode === true) collected.push(field.key);
6076
+ }
6077
+ return collected;
6078
+ }
6079
+ /**
5918
6080
  * Normalize an `ICamstackAddon.initialize()` return value into the
5919
6081
  * `AddonInitResult` envelope. Arrays are wrapped into `{ providers }`;
5920
6082
  * envelopes pass through; void stays void.
@@ -5939,6 +6101,7 @@ var CamStreamKindSchema = _enum([
5939
6101
  "pull-rtsp",
5940
6102
  "pull-rtmp",
5941
6103
  "pull-http",
6104
+ "pull-flv",
5942
6105
  "pull-rfc4571",
5943
6106
  "push-annexb",
5944
6107
  "derived"
@@ -6321,6 +6484,13 @@ var DeviceType = /* @__PURE__ */ function(DeviceType) {
6321
6484
  /** Single still-image entity (HA `image.*`). Read-only display of an
6322
6485
  * `entity_picture` signed URL the browser loads directly. `image` cap. */
6323
6486
  DeviceType["Image"] = "image";
6487
+ /** Smart pet feeder — cloud-connected food dispenser with a bowl food
6488
+ * level, battery, desiccant life, feeding state and manual-feed /
6489
+ * call-pet / maintenance actions. Installed with the `pet-feeder` cap;
6490
+ * dual-hopper models (D4S/D4SH) expose per-hopper portions. Sources:
6491
+ * native PetKit (`nodepetkit` `FeederDevice`), reusable by other feeder
6492
+ * integrations sharing the same food/desiccant/hopper surface. */
6493
+ DeviceType["PetFeeder"] = "pet-feeder";
6324
6494
  return DeviceType;
6325
6495
  }({});
6326
6496
  var DeviceFeature = /* @__PURE__ */ function(DeviceFeature) {
@@ -7469,6 +7639,601 @@ var _macroLookup = /* @__PURE__ */ new Map();
7469
7639
  for (const [k, v] of Object.entries(YAMNET_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
7470
7640
  for (const [k, v] of Object.entries(APPLE_SA_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
7471
7641
  /**
7642
+ * Error types for the safe expression engine. Two distinct classes so callers
7643
+ * can tell a compile-time (grammar) failure from a runtime (evaluation)
7644
+ * failure — both are non-fatal to the host: read paths degrade to "skip link".
7645
+ */
7646
+ /** Thrown by the tokenizer / parser. Carries a 0-based source `position` when
7647
+ * the failure is anchored to a character (author-facing inline feedback). */
7648
+ var ExpressionParseError = class extends Error {
7649
+ position;
7650
+ constructor(message, position) {
7651
+ super(message);
7652
+ this.name = "ExpressionParseError";
7653
+ this.position = position;
7654
+ }
7655
+ };
7656
+ /** Thrown by the evaluator (unknown identifier, type mismatch, non-finite
7657
+ * result, unknown builtin, step-budget exceeded). */
7658
+ var ExpressionEvalError = class extends Error {
7659
+ constructor(message) {
7660
+ super(message);
7661
+ this.name = "ExpressionEvalError";
7662
+ }
7663
+ };
7664
+ /**
7665
+ * Resource-bound constants for the safe expression engine.
7666
+ *
7667
+ * Every bound is defense-in-depth: the grammar is non-Turing-complete (no
7668
+ * loops, recursion, lambdas or member access — see `ast.ts`), so evaluation is
7669
+ * O(nodeCount) by construction. These caps merely put a hard ceiling on the
7670
+ * work a single author-supplied expression can request, so a hostile or
7671
+ * accidental pathological string can never spend unbounded CPU/memory.
7672
+ */
7673
+ /** Max source length (chars) — checked BEFORE tokenizing so a huge string is
7674
+ * rejected without allocation. */
7675
+ var MAX_EXPRESSION_SOURCE_LENGTH = 2048;
7676
+ /** A legal binding / identifier name. */
7677
+ var EXPRESSION_IDENTIFIER_RE = /^[A-Za-z_][A-Za-z0-9_]*$/;
7678
+ /** Binding names an author may NOT use: `now` is auto-injected; the literal
7679
+ * keywords lex as values, not identifiers, so binding to them is meaningless. */
7680
+ var RESERVED_BINDING_NAMES = new Set([
7681
+ "now",
7682
+ "true",
7683
+ "false",
7684
+ "null"
7685
+ ]);
7686
+ /**
7687
+ * Tokenizer for the safe expression mini-language. Hand-rolled, single-pass,
7688
+ * zero-dependency. The grammar is deliberately boring: decimal numbers,
7689
+ * single/double-quoted strings with a tiny escape set, identifiers, the three
7690
+ * value keywords (`true`/`false`/`null`) and a fixed punctuator set. Anything
7691
+ * outside that — a bare `.`, `=`, `[`, `]`, `{`, `}`, `;`, backtick, `&`, `|` —
7692
+ * is a parse error with a source position, so member access / assignment /
7693
+ * template literals are lexically impossible.
7694
+ */
7695
+ var KEYWORDS = new Set([
7696
+ "true",
7697
+ "false",
7698
+ "null"
7699
+ ]);
7700
+ function isDigit(ch) {
7701
+ return ch >= "0" && ch <= "9";
7702
+ }
7703
+ function isIdentStart(ch) {
7704
+ return ch >= "A" && ch <= "Z" || ch >= "a" && ch <= "z" || ch === "_";
7705
+ }
7706
+ function isIdentPart(ch) {
7707
+ return isIdentStart(ch) || isDigit(ch);
7708
+ }
7709
+ function isWhitespace(ch) {
7710
+ return ch === " " || ch === " " || ch === "\n" || ch === "\r" || ch === "\f" || ch === "\v";
7711
+ }
7712
+ /** Tokenize `source` into a flat token list ending with a single `eof` token.
7713
+ * Throws `ExpressionParseError` on any illegal character or unterminated
7714
+ * string. */
7715
+ function tokenize(source) {
7716
+ if (source.length > 2048) throw new ExpressionParseError(`expression too long (${source.length} > ${MAX_EXPRESSION_SOURCE_LENGTH} chars)`, 0);
7717
+ const tokens = [];
7718
+ let i = 0;
7719
+ const n = source.length;
7720
+ while (i < n) {
7721
+ const ch = source[i];
7722
+ if (isWhitespace(ch)) {
7723
+ i += 1;
7724
+ continue;
7725
+ }
7726
+ if (isDigit(ch)) {
7727
+ const start = i;
7728
+ while (i < n && isDigit(source[i])) i += 1;
7729
+ if (i < n && source[i] === ".") {
7730
+ if (i + 1 >= n || !isDigit(source[i + 1])) throw new ExpressionParseError("malformed number: decimal point needs a digit", i);
7731
+ i += 1;
7732
+ while (i < n && isDigit(source[i])) i += 1;
7733
+ }
7734
+ const text = source.slice(start, i);
7735
+ const value = Number(text);
7736
+ if (!Number.isFinite(value)) throw new ExpressionParseError(`malformed number: '${text}'`, start);
7737
+ tokens.push({
7738
+ type: "number",
7739
+ value,
7740
+ pos: start
7741
+ });
7742
+ continue;
7743
+ }
7744
+ if (ch === "'" || ch === "\"") {
7745
+ const quote = ch;
7746
+ const start = i;
7747
+ i += 1;
7748
+ let out = "";
7749
+ let closed = false;
7750
+ while (i < n) {
7751
+ const c = source[i];
7752
+ if (c === "\\") {
7753
+ const next = i + 1 < n ? source[i + 1] : "";
7754
+ if (next === "\\" || next === "'" || next === "\"") {
7755
+ out += next;
7756
+ i += 2;
7757
+ continue;
7758
+ }
7759
+ throw new ExpressionParseError(`invalid string escape: '\\${next}'`, i);
7760
+ }
7761
+ if (c === quote) {
7762
+ closed = true;
7763
+ i += 1;
7764
+ break;
7765
+ }
7766
+ out += c;
7767
+ i += 1;
7768
+ }
7769
+ if (!closed) throw new ExpressionParseError("unterminated string literal", start);
7770
+ tokens.push({
7771
+ type: "string",
7772
+ value: out,
7773
+ pos: start
7774
+ });
7775
+ continue;
7776
+ }
7777
+ if (isIdentStart(ch)) {
7778
+ const start = i;
7779
+ while (i < n && isIdentPart(source[i])) i += 1;
7780
+ const text = source.slice(start, i);
7781
+ if (KEYWORDS.has(text)) tokens.push({
7782
+ type: "keyword",
7783
+ keyword: keywordOf(text),
7784
+ pos: start
7785
+ });
7786
+ else tokens.push({
7787
+ type: "identifier",
7788
+ name: text,
7789
+ pos: start
7790
+ });
7791
+ continue;
7792
+ }
7793
+ const two = i + 1 < n ? source.slice(i, i + 2) : "";
7794
+ if (two === "<=" || two === ">=" || two === "==" || two === "!=" || two === "&&" || two === "||") {
7795
+ tokens.push({
7796
+ type: "punct",
7797
+ punct: two,
7798
+ pos: i
7799
+ });
7800
+ i += 2;
7801
+ continue;
7802
+ }
7803
+ if (isSinglePunct(ch)) {
7804
+ tokens.push({
7805
+ type: "punct",
7806
+ punct: ch,
7807
+ pos: i
7808
+ });
7809
+ i += 1;
7810
+ continue;
7811
+ }
7812
+ throw new ExpressionParseError(`unexpected character '${ch}'`, i);
7813
+ }
7814
+ tokens.push({
7815
+ type: "eof",
7816
+ pos: n
7817
+ });
7818
+ return tokens;
7819
+ }
7820
+ function keywordOf(text) {
7821
+ if (text === "true") return "true";
7822
+ if (text === "false") return "false";
7823
+ return "null";
7824
+ }
7825
+ function isSinglePunct(ch) {
7826
+ return ch === "(" || ch === ")" || ch === "," || ch === "?" || ch === ":" || ch === "+" || ch === "-" || ch === "*" || ch === "/" || ch === "%" || ch === "!" || ch === "<" || ch === ">";
7827
+ }
7828
+ /**
7829
+ * Frozen, null-prototype builtin function table for the expression engine
7830
+ * (spec §4 rule 4). The table is the SOLE surface of callable functions: the
7831
+ * parser rejects any callee not in it, and the evaluator gates each call on an
7832
+ * own-property check against it.
7833
+ *
7834
+ * Because the object has a NULL prototype AND is `Object.freeze`d:
7835
+ * - it cannot be polluted (no `__proto__` / `constructor` write reaches it);
7836
+ * - a lookup for `toString` / `hasOwnProperty` / `constructor` finds NOTHING
7837
+ * (there is no `Object.prototype` in the chain), so those names are not
7838
+ * callable — they are simply "unknown function" at parse time.
7839
+ *
7840
+ * Every numeric argument is validated as a finite number and every numeric
7841
+ * RESULT is re-checked finite, so `/0`, `sqrt(-1)` (→ NaN) and overflow
7842
+ * (`pow(10,400)` → Infinity) all raise `ExpressionEvalError` and fail the link
7843
+ * closed rather than emitting a garbage value.
7844
+ */
7845
+ function asFiniteNumber(value, name, index) {
7846
+ if (typeof value !== "number" || !Number.isFinite(value)) throw new ExpressionEvalError(`${name}: argument ${index + 1} must be a finite number`);
7847
+ return value;
7848
+ }
7849
+ function asString$1(value, name, index) {
7850
+ if (typeof value !== "string") throw new ExpressionEvalError(`${name}: argument ${index + 1} must be a string`);
7851
+ return value;
7852
+ }
7853
+ function finiteResult(value, name) {
7854
+ if (!Number.isFinite(value)) throw new ExpressionEvalError(`${name}: produced a non-finite result`);
7855
+ return value;
7856
+ }
7857
+ function allFiniteNumbers(args, name) {
7858
+ return args.map((a, idx) => asFiniteNumber(a, name, idx));
7859
+ }
7860
+ var INF = Number.POSITIVE_INFINITY;
7861
+ var table = {
7862
+ min: {
7863
+ minArgs: 1,
7864
+ maxArgs: INF,
7865
+ apply: (args) => finiteResult(Math.min(...allFiniteNumbers(args, "min")), "min")
7866
+ },
7867
+ max: {
7868
+ minArgs: 1,
7869
+ maxArgs: INF,
7870
+ apply: (args) => finiteResult(Math.max(...allFiniteNumbers(args, "max")), "max")
7871
+ },
7872
+ abs: {
7873
+ minArgs: 1,
7874
+ maxArgs: 1,
7875
+ apply: (args) => finiteResult(Math.abs(asFiniteNumber(args[0], "abs", 0)), "abs")
7876
+ },
7877
+ floor: {
7878
+ minArgs: 1,
7879
+ maxArgs: 1,
7880
+ apply: (args) => finiteResult(Math.floor(asFiniteNumber(args[0], "floor", 0)), "floor")
7881
+ },
7882
+ ceil: {
7883
+ minArgs: 1,
7884
+ maxArgs: 1,
7885
+ apply: (args) => finiteResult(Math.ceil(asFiniteNumber(args[0], "ceil", 0)), "ceil")
7886
+ },
7887
+ sqrt: {
7888
+ minArgs: 1,
7889
+ maxArgs: 1,
7890
+ apply: (args) => finiteResult(Math.sqrt(asFiniteNumber(args[0], "sqrt", 0)), "sqrt")
7891
+ },
7892
+ round: {
7893
+ minArgs: 1,
7894
+ maxArgs: 2,
7895
+ apply: (args) => {
7896
+ const x = asFiniteNumber(args[0], "round", 0);
7897
+ const digits = args.length > 1 ? Math.trunc(asFiniteNumber(args[1], "round", 1)) : 0;
7898
+ if (digits < 0 || digits > 100) throw new ExpressionEvalError("round: digits must be between 0 and 100");
7899
+ const factor = 10 ** digits;
7900
+ return finiteResult(Math.round(x * factor) / factor, "round");
7901
+ }
7902
+ },
7903
+ pow: {
7904
+ minArgs: 2,
7905
+ maxArgs: 2,
7906
+ apply: (args) => finiteResult(asFiniteNumber(args[0], "pow", 0) ** asFiniteNumber(args[1], "pow", 1), "pow")
7907
+ },
7908
+ clamp: {
7909
+ minArgs: 3,
7910
+ maxArgs: 3,
7911
+ apply: (args) => {
7912
+ const x = asFiniteNumber(args[0], "clamp", 0);
7913
+ const lo = asFiniteNumber(args[1], "clamp", 1);
7914
+ const hi = asFiniteNumber(args[2], "clamp", 2);
7915
+ if (lo > hi) throw new ExpressionEvalError("clamp: lower bound is greater than upper bound");
7916
+ return finiteResult(Math.min(hi, Math.max(lo, x)), "clamp");
7917
+ }
7918
+ },
7919
+ avg: {
7920
+ minArgs: 1,
7921
+ maxArgs: INF,
7922
+ apply: (args) => {
7923
+ const nums = allFiniteNumbers(args, "avg");
7924
+ return finiteResult(nums.reduce((acc, v) => acc + v, 0) / nums.length, "avg");
7925
+ }
7926
+ },
7927
+ sum: {
7928
+ minArgs: 1,
7929
+ maxArgs: INF,
7930
+ apply: (args) => finiteResult(allFiniteNumbers(args, "sum").reduce((acc, v) => acc + v, 0), "sum")
7931
+ },
7932
+ coalesce: {
7933
+ minArgs: 1,
7934
+ maxArgs: INF,
7935
+ apply: (args) => {
7936
+ for (const a of args) if (a !== null) return a;
7937
+ return null;
7938
+ }
7939
+ },
7940
+ age: {
7941
+ minArgs: 2,
7942
+ maxArgs: 2,
7943
+ apply: (args) => finiteResult(asFiniteNumber(args[0], "age", 0) - asFiniteNumber(args[1], "age", 1), "age")
7944
+ },
7945
+ convert: {
7946
+ minArgs: 3,
7947
+ maxArgs: 3,
7948
+ apply: (args, hooks) => {
7949
+ const x = asFiniteNumber(args[0], "convert", 0);
7950
+ const from = asString$1(args[1], "convert", 1).trim();
7951
+ const to = asString$1(args[2], "convert", 2).trim();
7952
+ if (hooks.convert) {
7953
+ const out = hooks.convert(x, from, to);
7954
+ if (out === null) throw new ExpressionEvalError(`convert: cannot convert '${from}' to '${to}'`);
7955
+ return finiteResult(out, "convert");
7956
+ }
7957
+ if (from === to) return x;
7958
+ throw new ExpressionEvalError("convert: unit conversion table not installed");
7959
+ }
7960
+ }
7961
+ };
7962
+ Object.freeze(Object.assign(Object.create(null), table));
7963
+ /** The set of valid builtin names — used by the parser to reject unknown
7964
+ * callees at parse time (immediate author feedback). */
7965
+ var EXPRESSION_BUILTIN_NAMES = new Set(Object.keys(table));
7966
+ /**
7967
+ * Pratt (precedence-climbing) parser for the safe expression mini-language.
7968
+ *
7969
+ * Precedence (low → high): ternary `?:` (right-assoc) → `||` → `&&` → equality
7970
+ * → relational → additive → multiplicative → unary `! -` → call / primary.
7971
+ * Calls are ONLY `IDENT '(' args? ')'` at primary position — the callee is a
7972
+ * string validated against the builtin table at parse time, so an unknown
7973
+ * function is rejected immediately (author feedback) and a persisted expression
7974
+ * that references a since-removed builtin degrades at read.
7975
+ *
7976
+ * A node counter caps total AST size (`MAX_EXPRESSION_AST_NODES`) and call
7977
+ * arity is capped (`MAX_EXPRESSION_CALL_ARGS`) — both raise `ExpressionParseError`.
7978
+ */
7979
+ /** Binary/logical operator precedence (higher binds tighter). */
7980
+ var BINARY_PRECEDENCE = {
7981
+ "||": 1,
7982
+ "&&": 2,
7983
+ "==": 3,
7984
+ "!=": 3,
7985
+ "<": 4,
7986
+ "<=": 4,
7987
+ ">": 4,
7988
+ ">=": 4,
7989
+ "+": 5,
7990
+ "-": 5,
7991
+ "*": 6,
7992
+ "/": 6,
7993
+ "%": 6
7994
+ };
7995
+ function isLogicalOp(op) {
7996
+ return op === "&&" || op === "||";
7997
+ }
7998
+ function isBinaryOp(op) {
7999
+ return op === "+" || op === "-" || op === "*" || op === "/" || op === "%" || op === "==" || op === "!=" || op === "<" || op === "<=" || op === ">" || op === ">=";
8000
+ }
8001
+ var Parser = class {
8002
+ tokens;
8003
+ pos = 0;
8004
+ nodeCount = 0;
8005
+ identifiers = /* @__PURE__ */ new Set();
8006
+ callees = /* @__PURE__ */ new Set();
8007
+ constructor(tokens) {
8008
+ this.tokens = tokens;
8009
+ }
8010
+ parse() {
8011
+ const ast = this.parseTernary();
8012
+ const tok = this.peek();
8013
+ if (tok.type !== "eof") throw new ExpressionParseError("unexpected trailing input", tok.pos);
8014
+ return {
8015
+ ast,
8016
+ identifiers: this.identifiers,
8017
+ callees: this.callees,
8018
+ nodeCount: this.nodeCount
8019
+ };
8020
+ }
8021
+ peek() {
8022
+ return this.tokens[this.pos];
8023
+ }
8024
+ next() {
8025
+ return this.tokens[this.pos++];
8026
+ }
8027
+ /** Consume a punctuator token, erroring if the next token isn't it. */
8028
+ expectPunct(punct) {
8029
+ const tok = this.peek();
8030
+ if (tok.type !== "punct" || tok.punct !== punct) throw new ExpressionParseError(`expected '${punct}'`, tok.pos);
8031
+ this.pos += 1;
8032
+ }
8033
+ matchPunct(punct) {
8034
+ const tok = this.peek();
8035
+ if (tok.type === "punct" && tok.punct === punct) {
8036
+ this.pos += 1;
8037
+ return true;
8038
+ }
8039
+ return false;
8040
+ }
8041
+ countNode() {
8042
+ this.nodeCount += 1;
8043
+ if (this.nodeCount > 256) throw new ExpressionParseError("expression too complex", this.peek().pos);
8044
+ }
8045
+ parseTernary() {
8046
+ const test = this.parseBinary(1);
8047
+ if (this.matchPunct("?")) {
8048
+ const consequent = this.parseTernary();
8049
+ this.expectPunct(":");
8050
+ const alternate = this.parseTernary();
8051
+ this.countNode();
8052
+ return {
8053
+ kind: "conditional",
8054
+ test,
8055
+ consequent,
8056
+ alternate
8057
+ };
8058
+ }
8059
+ return test;
8060
+ }
8061
+ parseBinary(minPrec) {
8062
+ let left = this.parseUnary();
8063
+ for (;;) {
8064
+ const tok = this.peek();
8065
+ if (tok.type !== "punct") break;
8066
+ const prec = BINARY_PRECEDENCE[tok.punct];
8067
+ if (prec === void 0 || prec < minPrec) break;
8068
+ const op = tok.punct;
8069
+ this.pos += 1;
8070
+ const right = this.parseBinary(prec + 1);
8071
+ this.countNode();
8072
+ if (isLogicalOp(op)) left = {
8073
+ kind: "logical",
8074
+ op,
8075
+ left,
8076
+ right
8077
+ };
8078
+ else if (isBinaryOp(op)) left = {
8079
+ kind: "binary",
8080
+ op,
8081
+ left,
8082
+ right
8083
+ };
8084
+ else throw new ExpressionParseError(`unexpected operator '${op}'`, tok.pos);
8085
+ }
8086
+ return left;
8087
+ }
8088
+ parseUnary() {
8089
+ const tok = this.peek();
8090
+ if (tok.type === "punct" && (tok.punct === "!" || tok.punct === "-")) {
8091
+ const op = tok.punct;
8092
+ this.pos += 1;
8093
+ const operand = this.parseUnary();
8094
+ this.countNode();
8095
+ return {
8096
+ kind: "unary",
8097
+ op,
8098
+ operand
8099
+ };
8100
+ }
8101
+ return this.parsePrimary();
8102
+ }
8103
+ parsePrimary() {
8104
+ const tok = this.next();
8105
+ switch (tok.type) {
8106
+ case "number":
8107
+ this.countNode();
8108
+ return {
8109
+ kind: "literal",
8110
+ value: tok.value
8111
+ };
8112
+ case "string":
8113
+ this.countNode();
8114
+ return {
8115
+ kind: "literal",
8116
+ value: tok.value
8117
+ };
8118
+ case "keyword":
8119
+ this.countNode();
8120
+ return {
8121
+ kind: "literal",
8122
+ value: tok.keyword === "null" ? null : tok.keyword === "true"
8123
+ };
8124
+ case "identifier": {
8125
+ const nextTok = this.peek();
8126
+ if (nextTok.type === "punct" && nextTok.punct === "(") return this.parseCall(tok.name, tok.pos);
8127
+ this.identifiers.add(tok.name);
8128
+ this.countNode();
8129
+ return {
8130
+ kind: "identifier",
8131
+ name: tok.name
8132
+ };
8133
+ }
8134
+ case "punct":
8135
+ if (tok.punct === "(") {
8136
+ const inner = this.parseTernary();
8137
+ this.expectPunct(")");
8138
+ return inner;
8139
+ }
8140
+ throw new ExpressionParseError(`unexpected token '${tok.punct}'`, tok.pos);
8141
+ case "eof": throw new ExpressionParseError("unexpected end of expression", tok.pos);
8142
+ }
8143
+ }
8144
+ parseCall(callee, pos) {
8145
+ if (!EXPRESSION_BUILTIN_NAMES.has(callee)) throw new ExpressionParseError(`unknown function '${callee}'`, pos);
8146
+ this.expectPunct("(");
8147
+ const args = [];
8148
+ if (!this.matchPunct(")")) for (;;) {
8149
+ args.push(this.parseTernary());
8150
+ if (args.length > 16) throw new ExpressionParseError(`too many arguments to '${callee}'`, pos);
8151
+ if (this.matchPunct(",")) continue;
8152
+ this.expectPunct(")");
8153
+ break;
8154
+ }
8155
+ this.callees.add(callee);
8156
+ this.countNode();
8157
+ return {
8158
+ kind: "call",
8159
+ callee,
8160
+ args
8161
+ };
8162
+ }
8163
+ };
8164
+ /** Tokenize + parse `source` into a validated `ParsedExpression`. Throws
8165
+ * `ExpressionParseError` on any lexical or grammatical failure. */
8166
+ function parseExpression(source) {
8167
+ return new Parser(tokenize(source)).parse();
8168
+ }
8169
+ Object.freeze({});
8170
+ /**
8171
+ * LRU compile cache for parsed expressions (spec §2.4 "parse once … LRU keyed
8172
+ * by expr"). The cache stores BOTH successes and failures (negative caching),
8173
+ * so a corrupt persisted string costs exactly one tokenize+parse total — not
8174
+ * one per read on a hot resolve path.
8175
+ *
8176
+ * The cache is a module-level singleton: entries are pure, content-addressed
8177
+ * ASTs keyed by the raw source string, so sharing one instance across all
8178
+ * callers is safe and maximises hit rate.
8179
+ */
8180
+ var cache = /* @__PURE__ */ new Map();
8181
+ function getCached(source) {
8182
+ const hit = cache.get(source);
8183
+ if (hit !== void 0) {
8184
+ cache.delete(source);
8185
+ cache.set(source, hit);
8186
+ return hit;
8187
+ }
8188
+ let result;
8189
+ try {
8190
+ result = {
8191
+ ok: true,
8192
+ parsed: parseExpression(source)
8193
+ };
8194
+ } catch (err) {
8195
+ result = {
8196
+ ok: false,
8197
+ error: err instanceof ExpressionParseError ? err.message : String(err)
8198
+ };
8199
+ }
8200
+ cache.set(source, result);
8201
+ if (cache.size > 256) {
8202
+ const oldest = cache.keys().next().value;
8203
+ if (oldest !== void 0) cache.delete(oldest);
8204
+ }
8205
+ return result;
8206
+ }
8207
+ /** Compile `source`, returning a discriminated result instead of throwing.
8208
+ * Used by read paths that must degrade rather than raise. LRU/negative-cached. */
8209
+ function compileExpressionSafe(source) {
8210
+ return getCached(source);
8211
+ }
8212
+ /**
8213
+ * Author-time validation. Returns `null` when the source is valid, else a
8214
+ * human-readable error message. Checks: the expression compiles; binding count
8215
+ * is within `MAX_EXPRESSION_BINDINGS`; every binding name is a legal identifier,
8216
+ * is not reserved (`now`/keywords) and does not shadow a builtin; and every
8217
+ * FREE identifier of the AST is covered by a binding or the injected `now`.
8218
+ */
8219
+ function validateExpressionSource(src) {
8220
+ const names = Object.keys(src.bindings);
8221
+ if (names.length > 32) return `too many bindings (${names.length} > 32)`;
8222
+ for (const name of names) {
8223
+ if (!EXPRESSION_IDENTIFIER_RE.test(name)) return `invalid binding name '${name}'`;
8224
+ if (RESERVED_BINDING_NAMES.has(name)) return `binding name '${name}' is reserved`;
8225
+ if (EXPRESSION_BUILTIN_NAMES.has(name)) return `binding name '${name}' shadows a builtin function`;
8226
+ }
8227
+ const compiled = compileExpressionSafe(src.expr);
8228
+ if (!compiled.ok) return compiled.error;
8229
+ const bound = new Set(names);
8230
+ for (const id of compiled.parsed.identifiers) {
8231
+ if (id === "now") continue;
8232
+ if (!bound.has(id)) return `expression references unbound identifier '${id}'`;
8233
+ }
8234
+ return null;
8235
+ }
8236
+ /**
7472
8237
  * Accessory device helpers — shared across drivers.
7473
8238
  *
7474
8239
  * Many vendor-specific drivers register accessory child devices on
@@ -9371,7 +10136,8 @@ var MotionAnalysisResultSchema = object({
9371
10136
  });
9372
10137
  method(object({
9373
10138
  deviceId: number$1(),
9374
- frame: FrameInputSchema
10139
+ frame: FrameInputSchema.optional(),
10140
+ frameHandle: FrameHandleSchema.optional()
9375
10141
  }), MotionAnalysisResultSchema, { kind: "mutation" }), method(object({ deviceId: number$1() }), _void(), { kind: "mutation" }), method(_void(), _void(), { kind: "mutation" }), object({
9376
10142
  deviceId: number$1(),
9377
10143
  detected: boolean(),
@@ -9618,6 +10384,12 @@ method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngi
9618
10384
  engine: PipelineEngineChoiceSchema.optional(),
9619
10385
  steps: array(PipelineStepInputSchema).min(1),
9620
10386
  frame: FrameInputSchema.optional(),
10387
+ /**
10388
+ * CB5 shm passthrough — a `FrameHandle` naming the same ring slot
10389
+ * the decoded pixels live in. One more member of the one-of
10390
+ * frame/frameHandle/image/imageBase64/referenceImage group.
10391
+ */
10392
+ frameHandle: FrameHandleSchema.optional(),
9621
10393
  imageBase64: string().optional(),
9622
10394
  /**
9623
10395
  * Binary JPEG bytes — preferred over `imageBase64` on internal
@@ -9827,6 +10599,31 @@ var ReportMotionInputSchema = object({
9827
10599
  regions: array(MotionRegionSchema).readonly().optional()
9828
10600
  });
9829
10601
  /**
10602
+ * Where a runner gets a camera's decoded frames (cross-node Phase 2,
10603
+ * restream-owner model — P2c).
10604
+ *
10605
+ * - `local-broker` (DEFAULT): today's path — subscribe to the co-located
10606
+ * stream-broker's shm frame plane. Every pre-P2c attach payload (no
10607
+ * `frameSource` key) parses to this, so the field is additive with zero
10608
+ * behavior change.
10609
+ * - `remote-restream`: the detect node is NOT the camera's source-owner.
10610
+ * The runner acquires the owner's COMPRESSED passthrough restream
10611
+ * (`streamBroker.getStreamWithCodec({video:'copy'})` — refcounted, the
10612
+ * double-pull guard) and decodes LOCALLY via a satellite frame plane +
10613
+ * pull-mode decoder session pinned to its own node. The shm ring stays
10614
+ * node-local; only H.264/H.265 packets cross the wire.
10615
+ * `hubHostnameOverride` mirrors the recorder's `recordingHubHostname`:
10616
+ * when set it overrides the `CAMSTACK_HUB_URL`-derived host the runner
10617
+ * dials for the owner's restream.
10618
+ */
10619
+ var RunnerFrameSourceSchema = discriminatedUnion("kind", [object({ kind: literal("local-broker") }), object({
10620
+ kind: literal("remote-restream"),
10621
+ /** The camera's source-owner node (slice 1: always the hub). */
10622
+ ownerNodeId: string(),
10623
+ /** Operator override for the owner host the runner dials. */
10624
+ hubHostnameOverride: string().optional()
10625
+ })]).describe("Per-camera frame-source mode for the runner (P2c)");
10626
+ /**
9830
10627
  * Camera assignment payload sent by `addon-pipeline-orchestrator` to a
9831
10628
  * specific runner instance via `attachCamera`. Carries everything the
9832
10629
  * runner needs to subscribe to the local broker and execute inference.
@@ -9924,7 +10721,15 @@ var RunnerCameraConfigSchema = object({
9924
10721
  */
9925
10722
  onboardMotionDrivesAnalyzer: boolean().default(true),
9926
10723
  occupancyRecheckSec: number$1().min(occupancyRecheckSecField.min).max(occupancyRecheckSecField.max).default(occupancyRecheckSecField.default),
9927
- occupancyRecheckFrames: number$1().min(occupancyRecheckFramesField.min).max(occupancyRecheckFramesField.max).default(occupancyRecheckFramesField.default)
10724
+ occupancyRecheckFrames: number$1().min(occupancyRecheckFramesField.min).max(occupancyRecheckFramesField.max).default(occupancyRecheckFramesField.default),
10725
+ /**
10726
+ * Where this runner gets the camera's decoded frames (P2c). Defaulted so
10727
+ * every existing payload behaves as `local-broker` — the pre-Phase-2 path.
10728
+ * Populated with `remote-restream` by the orchestrator ONLY when the
10729
+ * camera's detect node differs from its source-owner (P2d, gated by the
10730
+ * `remoteSourcingNodes` rollout setting).
10731
+ */
10732
+ frameSource: RunnerFrameSourceSchema.default({ kind: "local-broker" })
9928
10733
  });
9929
10734
  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;
9930
10735
  /**
@@ -10289,6 +11094,113 @@ object({
10289
11094
  lastFetchedAt: number$1()
10290
11095
  });
10291
11096
  DeviceType.Sensor;
11097
+ /**
11098
+ * Feeder connectivity / power status — mirrors the HA petkit device-status
11099
+ * enum: `normal` (online, mains), `offline` (not reaching PetKit cloud),
11100
+ * `on_batteries` (running on battery backup). `null` until first reported.
11101
+ */
11102
+ var PetFeederDeviceStatusSchema = _enum([
11103
+ "normal",
11104
+ "offline",
11105
+ "on_batteries"
11106
+ ]);
11107
+ var gramsPortion = number$1().int().min(4).max(200);
11108
+ object({
11109
+ /** Food currently in the bowl (grams). Null when the device has not
11110
+ * reported a reading yet. On dual-hopper models this is the combined
11111
+ * bowl reading; per-hopper levels live in `food1`/`food2`. */
11112
+ foodLevel: number$1().nullable(),
11113
+ /** Hopper-1 food level (grams) on dual-hopper feeders; null on
11114
+ * single-hopper models. */
11115
+ food1: number$1().nullable(),
11116
+ /** Hopper-2 food level (grams) on dual-hopper feeders; null on
11117
+ * single-hopper models. */
11118
+ food2: number$1().nullable(),
11119
+ /** Derived low-food flag — mirrors the HA `food_level` binary_sensor
11120
+ * (`device_class: problem`, on = low). True when the bowl is empty /
11121
+ * below the feeder's low threshold. */
11122
+ lowFood: boolean(),
11123
+ /** Battery charge 0..100 (%). Null on mains-powered models or when the
11124
+ * device has no battery reading. */
11125
+ batteryPower: number$1().min(0).max(100).nullable(),
11126
+ /** Days of desiccant life remaining. Null when the model has no
11127
+ * desiccant sensor. */
11128
+ desiccantLeftDays: number$1().nullable(),
11129
+ /** True while a feed is in progress. */
11130
+ feeding: boolean(),
11131
+ /** Decoded connectivity / power status (HA petkit device-status enum).
11132
+ * Null until the device has reported a status. */
11133
+ status: PetFeederDeviceStatusSchema.nullable(),
11134
+ /** Decoded human-readable fault message. Null (or the device's `no_error`
11135
+ * sentinel) means healthy; a non-null string is an active fault. Pairs
11136
+ * with `errorCode` for consumers that want the raw integer. */
11137
+ error: string().nullable(),
11138
+ /** Raw device error code (0 / null = no error). */
11139
+ errorCode: number$1().nullable(),
11140
+ /** True for D4S/D4SH dual-hopper hardware — gates the per-hopper UI. */
11141
+ isDualHopper: boolean(),
11142
+ /** Child-lock (manual-lock) setting — buttons on the unit are disabled. */
11143
+ childLock: boolean(),
11144
+ /** Front indicator-light setting. */
11145
+ indicatorLight: boolean(),
11146
+ /** Play a chime when dispensing. */
11147
+ feedSound: boolean(),
11148
+ /** Speaker / prompt volume level (device-scaled integer). */
11149
+ volume: number$1(),
11150
+ /** Ms epoch when the slice was last refreshed from the cloud. */
11151
+ lastFetchedAt: number$1()
11152
+ });
11153
+ DeviceType.PetFeeder, method(object({
11154
+ deviceId: number$1().int().nonnegative(),
11155
+ grams: gramsPortion.optional(),
11156
+ hopper1: gramsPortion.optional(),
11157
+ hopper2: gramsPortion.optional()
11158
+ }), _void(), {
11159
+ kind: "mutation",
11160
+ auth: "admin"
11161
+ }), method(object({ deviceId: number$1().int().nonnegative() }), _void(), {
11162
+ kind: "mutation",
11163
+ auth: "admin"
11164
+ }), method(object({ deviceId: number$1().int().nonnegative() }), _void(), {
11165
+ kind: "mutation",
11166
+ auth: "admin"
11167
+ }), method(object({ deviceId: number$1().int().nonnegative() }), _void(), {
11168
+ kind: "mutation",
11169
+ auth: "admin"
11170
+ }), method(object({ deviceId: number$1().int().nonnegative() }), _void(), {
11171
+ kind: "mutation",
11172
+ auth: "admin"
11173
+ }), method(object({
11174
+ deviceId: number$1().int().nonnegative(),
11175
+ soundId: number$1().int().nonnegative()
11176
+ }), _void(), {
11177
+ kind: "mutation",
11178
+ auth: "admin"
11179
+ }), method(object({
11180
+ deviceId: number$1().int().nonnegative(),
11181
+ on: boolean()
11182
+ }), _void(), {
11183
+ kind: "mutation",
11184
+ auth: "admin"
11185
+ }), method(object({
11186
+ deviceId: number$1().int().nonnegative(),
11187
+ on: boolean()
11188
+ }), _void(), {
11189
+ kind: "mutation",
11190
+ auth: "admin"
11191
+ }), method(object({
11192
+ deviceId: number$1().int().nonnegative(),
11193
+ on: boolean()
11194
+ }), _void(), {
11195
+ kind: "mutation",
11196
+ auth: "admin"
11197
+ }), method(object({
11198
+ deviceId: number$1().int().nonnegative(),
11199
+ level: number$1().int().nonnegative()
11200
+ }), _void(), {
11201
+ kind: "mutation",
11202
+ auth: "admin"
11203
+ });
10292
11204
  object({
10293
11205
  /** Instantaneous power draw in watts. */
10294
11206
  watts: number$1().optional(),
@@ -12116,10 +13028,12 @@ method(object({ codec: string() }), boolean()), method(_void(), object({
12116
13028
  url: string()
12117
13029
  }), _void()), method(object({
12118
13030
  sessionId: string(),
12119
- maxCount: number$1().default(1)
13031
+ maxCount: number$1().default(1),
13032
+ waitMs: number$1().optional()
12120
13033
  }), array(DecodedFrameSchema)), method(object({
12121
13034
  sessionId: string(),
12122
- maxCount: number$1().default(1)
13035
+ maxCount: number$1().default(1),
13036
+ waitMs: number$1().optional()
12123
13037
  }), array(FrameHandleSchema)), method(object({ handle: FrameHandleSchema }), DecodedFrameSchema.nullable()), method(object({ sessionId: string() }), ShmRingStatsSchema.nullable()), method(object({
12124
13038
  sessionId: string(),
12125
13039
  config: DecoderSessionConfigSchema.partial()
@@ -12431,14 +13345,63 @@ var ChildLayoutEntrySchema = object({
12431
13345
  collapsed: boolean().optional()
12432
13346
  });
12433
13347
  /** Cap-wire shape of a DeviceLink — structurally mirrors `DeviceLink` in
12434
- * `device-management.ts`. */
13348
+ * `device-management.ts`. Source is a union: a FIELD source copies a sibling
13349
+ * accessory's status field (`kind` optional/absent for wire compat); a
13350
+ * LITERAL source carries a per-device constant (no sibling is read); a
13351
+ * GLOBAL source (P2e) copies ANY device's status field, addressed by the
13352
+ * source device's full re-sync-stable `stableId`. */
13353
+ var DeviceLinkFieldSourceSchema = object({
13354
+ kind: literal("field").optional(),
13355
+ sourceKey: string(),
13356
+ cap: string(),
13357
+ fieldPath: string()
13358
+ });
13359
+ var DeviceLinkLiteralSourceSchema = object({
13360
+ kind: literal("literal"),
13361
+ value: union([
13362
+ string(),
13363
+ number$1(),
13364
+ boolean(),
13365
+ _null()
13366
+ ])
13367
+ });
13368
+ var DeviceLinkGlobalSourceSchema = object({
13369
+ kind: literal("global"),
13370
+ sourceStableId: string(),
13371
+ cap: string(),
13372
+ fieldPath: string()
13373
+ });
13374
+ /** Expression source (Stage X): compute the target field from N named bindings
13375
+ * via the safe expression engine. Bindings are field | literal | global — never
13376
+ * another expression (no nesting). The `superRefine` runs the SAME author-time
13377
+ * validation as `validateExpressionSource` (compiles the expr, checks binding
13378
+ * names + identifier coverage) so every wire boundary that parses a DeviceLink
13379
+ * (tRPC mount, kernel create pre-seed, projection output) validates-at-write.
13380
+ * Compiles are LRU-cached, so repeated validation of the same expr is a hit. */
13381
+ var DeviceLinkExpressionSourceSchema = object({
13382
+ kind: literal("expression"),
13383
+ expr: string().min(1).max(MAX_EXPRESSION_SOURCE_LENGTH),
13384
+ bindings: record(string().regex(EXPRESSION_IDENTIFIER_RE), union([
13385
+ DeviceLinkFieldSourceSchema,
13386
+ DeviceLinkLiteralSourceSchema,
13387
+ DeviceLinkGlobalSourceSchema
13388
+ ]))
13389
+ }).superRefine((src, ctx) => {
13390
+ const err = validateExpressionSource(src);
13391
+ if (err !== null) ctx.addIssue({
13392
+ code: "custom",
13393
+ message: err,
13394
+ path: ["expr"]
13395
+ });
13396
+ });
12435
13397
  var DeviceLinkSchema = object({
12436
13398
  id: string(),
12437
- source: object({
12438
- sourceKey: string(),
12439
- cap: string(),
12440
- fieldPath: string()
12441
- }),
13399
+ source: union([
13400
+ DeviceLinkFieldSourceSchema,
13401
+ DeviceLinkLiteralSourceSchema,
13402
+ DeviceLinkGlobalSourceSchema,
13403
+ DeviceLinkExpressionSourceSchema
13404
+ ]),
12442
13405
  target: object({
12443
13406
  cap: string(),
12444
13407
  fieldPath: string(),
@@ -12467,6 +13430,31 @@ var DeviceLinkSchema = object({
12467
13430
  })
12468
13431
  ]).optional()
12469
13432
  });
13433
+ /** Cap-wire shape of a per-cap display refinement — mirrors
13434
+ * `DeviceCapDisplayOverride` in `device-management.ts`. */
13435
+ var DeviceCapDisplayOverrideSchema = object({
13436
+ unit: string().min(1).optional(),
13437
+ precision: number$1().int().min(0).max(10).optional()
13438
+ });
13439
+ /** Cap-wire shape of an operator-authored per-device display override —
13440
+ * mirrors `DeviceDisplayOverride` in `device-management.ts`. `precision`
13441
+ * bounds mirror `numeric-sensor.cap.ts` (`int 0-10`). */
13442
+ var DeviceDisplayOverrideSchema = object({
13443
+ icon: string().min(1).optional(),
13444
+ label: string().min(1).optional(),
13445
+ unit: string().min(1).optional(),
13446
+ precision: number$1().int().min(0).max(10).optional(),
13447
+ hidden: boolean().optional(),
13448
+ perCap: record(string(), DeviceCapDisplayOverrideSchema).optional()
13449
+ });
13450
+ /** Cap-wire shape of a per-role display default — mirrors `RoleDisplayDefault`
13451
+ * in `device-management.ts`. Keyed by `DeviceRole` string (role strings cross
13452
+ * the wire as plain strings everywhere else — cf. `DeviceInfoSchema.role`). */
13453
+ var RoleDisplayDefaultSchema = object({
13454
+ unit: string().min(1).optional(),
13455
+ precision: number$1().int().min(0).max(10).optional(),
13456
+ icon: string().min(1).optional()
13457
+ });
12470
13458
  /**
12471
13459
  * Serializable projection of a live IDevice.
12472
13460
  * Returned by listAll, getDevice, getChildren.
@@ -12522,7 +13510,9 @@ var DeviceInfoSchema = object({
12522
13510
  * `DeviceMeta.childLayout`. Absent ⇒ no layout declared. */
12523
13511
  childLayout: array(ChildLayoutEntrySchema).readonly().optional(),
12524
13512
  /** Operator-authored cross-device field wirings. See `DeviceMeta.deviceLinks`. */
12525
- deviceLinks: array(DeviceLinkSchema).readonly().optional()
13513
+ deviceLinks: array(DeviceLinkSchema).readonly().optional(),
13514
+ /** Operator-authored per-device display override. See `DeviceMeta.display`. */
13515
+ display: DeviceDisplayOverrideSchema.optional()
12526
13516
  });
12527
13517
  var ConfigEntrySchema = object({
12528
13518
  key: string(),
@@ -12587,7 +13577,9 @@ var DeviceMetaSchema = object({
12587
13577
  deviceLinks: array(DeviceLinkSchema).readonly().optional(),
12588
13578
  /** Semantic role string (`DeviceRole`) — propagated from the spawn pre-seed.
12589
13579
  * Optional: only present for accessory children that carry a known role. */
12590
- role: string().nullable().optional()
13580
+ role: string().nullable().optional(),
13581
+ /** Operator-authored per-device display override. See `DeviceMeta.display`. */
13582
+ display: DeviceDisplayOverrideSchema.optional()
12591
13583
  });
12592
13584
  /** ConfigUISchema passed through as unknown — mirrors device-provider's CreationSchemaOutputSchema */
12593
13585
  var ConfigUISchemaOutput = unknown().nullable();
@@ -12681,7 +13673,19 @@ method(object({
12681
13673
  }), _void(), {
12682
13674
  kind: "mutation",
12683
13675
  auth: "admin"
12684
- }), method(object({ deviceId: number$1() }), object({ caps: array(object({
13676
+ }), method(object({
13677
+ deviceId: number$1(),
13678
+ display: DeviceDisplayOverrideSchema.nullable()
13679
+ }), _void(), {
13680
+ kind: "mutation",
13681
+ auth: "admin"
13682
+ }), method(object({}), object({ defaults: record(string(), RoleDisplayDefaultSchema) }), { kind: "query" }), method(object({ defaults: record(string(), RoleDisplayDefaultSchema) }), _void(), {
13683
+ kind: "mutation",
13684
+ auth: "admin"
13685
+ }), method(object({
13686
+ deviceId: number$1(),
13687
+ includeSynthesizable: boolean().optional()
13688
+ }), object({ caps: array(object({
12685
13689
  cap: string(),
12686
13690
  fields: array(object({
12687
13691
  path: string(),
@@ -12691,8 +13695,13 @@ method(object({
12691
13695
  "boolean",
12692
13696
  "enum"
12693
13697
  ]),
12694
- enumValues: array(string()).optional()
12695
- })).readonly()
13698
+ enumValues: array(string()).optional(),
13699
+ item: boolean().optional()
13700
+ })).readonly(),
13701
+ itemArray: object({
13702
+ path: string(),
13703
+ keyField: string()
13704
+ }).optional()
12696
13705
  })).readonly() }), { kind: "query" }), method(object({
12697
13706
  deviceId: number$1(),
12698
13707
  role: string().nullable()
@@ -12762,7 +13771,11 @@ method(object({
12762
13771
  deviceId: number$1(),
12763
13772
  entries: array(object({
12764
13773
  capName: string(),
12765
- kind: _enum(["native", "wrapped"]),
13774
+ kind: _enum([
13775
+ "native",
13776
+ "wrapped",
13777
+ "linked"
13778
+ ]),
12766
13779
  providerAddonId: string(),
12767
13780
  providerNodeId: string(),
12768
13781
  nativeAddonId: string()
@@ -12771,7 +13784,11 @@ method(object({
12771
13784
  deviceId: number$1(),
12772
13785
  entries: array(object({
12773
13786
  capName: string(),
12774
- kind: _enum(["native", "wrapped"]),
13787
+ kind: _enum([
13788
+ "native",
13789
+ "wrapped",
13790
+ "linked"
13791
+ ]),
12775
13792
  providerAddonId: string(),
12776
13793
  providerNodeId: string(),
12777
13794
  nativeAddonId: string()
@@ -13261,7 +14278,7 @@ var AddBrokerInputSchema = object({
13261
14278
  });
13262
14279
  var AddBrokerResultSchema = object({ id: string() });
13263
14280
  var IdInputSchema = object({ id: string() });
13264
- var TestResultSchema = discriminatedUnion("ok", [object({
14281
+ var TestResultSchema$1 = discriminatedUnion("ok", [object({
13265
14282
  ok: literal(true),
13266
14283
  latencyMs: number$1()
13267
14284
  }), object({
@@ -13284,7 +14301,7 @@ var StatusSchema = object({
13284
14301
  brokerCount: number$1(),
13285
14302
  embeddedRunning: boolean()
13286
14303
  });
13287
- method(_void(), array(BrokerInfoSchema)), method(IdInputSchema, BrokerConnectionDetailsSchema), method(AddBrokerInputSchema, AddBrokerResultSchema, { kind: "mutation" }), method(IdInputSchema, _void(), { kind: "mutation" }), method(IdInputSchema, TestResultSchema, { kind: "mutation" }), method(StartEmbeddedInputSchema, StartEmbeddedResultSchema, { kind: "mutation" }), method(IdInputSchema, _void(), { kind: "mutation" }), method(_void(), StatusSchema);
14304
+ method(_void(), array(BrokerInfoSchema)), method(IdInputSchema, BrokerConnectionDetailsSchema), method(AddBrokerInputSchema, AddBrokerResultSchema, { kind: "mutation" }), method(IdInputSchema, _void(), { kind: "mutation" }), method(IdInputSchema, TestResultSchema$1, { kind: "mutation" }), method(StartEmbeddedInputSchema, StartEmbeddedResultSchema, { kind: "mutation" }), method(IdInputSchema, _void(), { kind: "mutation" }), method(_void(), StatusSchema);
13288
14305
  var NetworkEndpointSchema = object({
13289
14306
  url: string(),
13290
14307
  hostname: string(),
@@ -13318,23 +14335,198 @@ var NetworkEndpointEntrySchema = NetworkEndpointSchema.extend({
13318
14335
  sourcePort: number$1().optional()
13319
14336
  });
13320
14337
  method(_void(), NetworkEndpointSchema, { kind: "mutation" }), method(_void(), _void(), { kind: "mutation" }), method(_void(), NetworkEndpointSchema.nullable()), method(_void(), NetworkAccessStatusSchema), method(_void(), array(NetworkEndpointEntrySchema).readonly());
13321
- method(object({
13322
- title: string(),
14338
+ /**
14339
+ * notification-output — canonical, capability-gated notification delivery.
14340
+ *
14341
+ * Apprise-derived model (see
14342
+ * `docs/superpowers/specs/2026-07-03-notification-output-notifier-matrix.md`):
14343
+ * callers emit ONE canonical `Notification`; each provider declares a
14344
+ * per-kind capability descriptor (`TargetKind`), and the pure degrade
14345
+ * engine (`@camstack/types` `prepareNotification`) transcodes / degrades the
14346
+ * message to what the kind supports — callers never special-case a service.
14347
+ *
14348
+ * DESIGN DECISIONS (locked):
14349
+ * - Target CRUD lives on THIS cap (`upsertTarget` / `deleteTarget` /
14350
+ * `setTargetEnabled`), each provider persisting via the `settings-store`
14351
+ * cap. Rationale: the admin UI needs one uniform surface across the
14352
+ * notifiers addon AND the HA addon; the addon-`globalSettingsSchema`-array
14353
+ * alternative would fork the UI per addon and cannot host the
14354
+ * discovery→adopt flow.
14355
+ * - `listTargetKinds` / `listTargets` / `discoverTargets` return arrays →
14356
+ * the generated cap-mount auto-`concatCollection`-fans them across every
14357
+ * registered provider (notifiers addon + HA addon) so one catalog is
14358
+ * routable. `send` / `testTarget` / CRUD route to ONE provider by the
14359
+ * `addonId` the generated collection router extracts from the call input.
14360
+ * - `Attachment.bytes` is `Uint8Array`. Transport-safe: superjson (the tRPC
14361
+ * transformer) + UDS MsgPack both round-trip typed arrays — already used by
14362
+ * `storage` / `storage-provider` / `recording` caps over the same path. No
14363
+ * base64 fallback needed.
14364
+ *
14365
+ * TODO (deferred, closed-set change — separate decision): add
14366
+ * `providerKind: 'notify'` so notification providers surface on the unified
14367
+ * admin "Integrations" page.
14368
+ */
14369
+ /**
14370
+ * Zentik-derived typed-media enum — the superset across every kind. Each
14371
+ * adapter picks what it supports and the degrade engine filters the rest.
14372
+ */
14373
+ var AttachmentMediaTypeSchema = _enum([
14374
+ "image",
14375
+ "video",
14376
+ "gif",
14377
+ "audio",
14378
+ "icon"
14379
+ ]);
14380
+ /**
14381
+ * A single attachment. Exactly one of `url` (remote source, most adapters
14382
+ * prefer this) or `bytes` (inline source; required for Pushover-style
14383
+ * bytes-only kinds) MUST be present — the degrade engine expresses a
14384
+ * url→bytes fetch as a `needsFetch` directive the adapter executes.
14385
+ */
14386
+ var AttachmentSchema = object({
14387
+ mediaType: AttachmentMediaTypeSchema,
14388
+ url: string().optional(),
14389
+ bytes: _instanceof(Uint8Array).optional(),
14390
+ mime: string().optional(),
14391
+ name: string().optional()
14392
+ }).refine((a) => a.url !== void 0 || a.bytes !== void 0, { message: "Attachment requires either `url` or `bytes`" });
14393
+ var NotificationFormatSchema = _enum([
14394
+ "text",
14395
+ "markdown",
14396
+ "html"
14397
+ ]);
14398
+ /** A single tap-through action button. */
14399
+ var NotificationActionSchema = object({
14400
+ id: string(),
14401
+ label: string(),
14402
+ url: string().optional()
14403
+ });
14404
+ /**
14405
+ * The canonical notification. `body` is the only hard field (Apprise model).
14406
+ * `priority` is a 5-level ORDINAL (1=lowest … 3=normal(default) … 5=urgent),
14407
+ * NOT a fixed severity enum — each kind declares its own `caps.levels` and
14408
+ * the adapter maps this ordinal onto its native level. `level?` is an
14409
+ * optional kind-native level id (`emergency`, `silent`, …) that overrides
14410
+ * `priority` for that one target.
14411
+ */
14412
+ var NotificationSchema = object({
13323
14413
  body: string(),
13324
- imageUrl: string().optional(),
14414
+ title: string().optional(),
14415
+ format: NotificationFormatSchema.default("text"),
14416
+ priority: number$1().int().min(1).max(5).default(3),
14417
+ level: string().optional(),
14418
+ attachments: array(AttachmentSchema).optional(),
14419
+ clickUrl: string().optional(),
14420
+ actions: array(NotificationActionSchema).optional(),
14421
+ sound: string().optional(),
14422
+ ttl: number$1().optional(),
14423
+ tag: string().optional(),
13325
14424
  deviceId: number$1().optional(),
13326
14425
  eventId: string().optional(),
13327
- priority: _enum([
13328
- "low",
13329
- "normal",
13330
- "high",
13331
- "critical"
13332
- ]).default("normal"),
13333
14426
  metadata: record(string(), unknown()).optional()
13334
- }), _void(), { kind: "mutation" }), method(_void(), object({
14427
+ });
14428
+ /** One declared native severity/priority level for a kind. */
14429
+ var TargetKindLevelSchema = object({
14430
+ id: string(),
14431
+ label: string(),
14432
+ /** Which canonical priority (1..5) this level maps to. `null` = qualitative-only. */
14433
+ ordinal: number$1().int().min(1).max(5).nullable(),
14434
+ flags: object({
14435
+ critical: boolean().optional(),
14436
+ silent: boolean().optional(),
14437
+ noPush: boolean().optional()
14438
+ }).optional(),
14439
+ /** e.g. Pushover `emergency` requires `retry` / `expire`. */
14440
+ requires: array(string()).optional(),
14441
+ description: string().optional()
14442
+ });
14443
+ /** The full capability block consulted before dispatch. */
14444
+ var TargetKindCapsSchema = object({
14445
+ attachments: object({
14446
+ mediaTypes: array(AttachmentMediaTypeSchema),
14447
+ mode: _enum([
14448
+ "url",
14449
+ "bytes",
14450
+ "both"
14451
+ ]),
14452
+ max: number$1().int().nonnegative(),
14453
+ maxBytes: number$1().int().positive().optional()
14454
+ }),
14455
+ /** Max action buttons (0 = none). */
14456
+ actions: number$1().int().nonnegative(),
14457
+ levels: array(TargetKindLevelSchema),
14458
+ format: array(NotificationFormatSchema),
14459
+ clickUrl: boolean(),
14460
+ sound: boolean(),
14461
+ ttl: boolean(),
14462
+ bodyMaxLen: number$1().int().positive()
14463
+ });
14464
+ /**
14465
+ * `configSchema` is a `ConfigUISchema` tree passed through to the admin
14466
+ * FormBuilder. Stored as `z.unknown()` at the cap seam (mirrors
14467
+ * `device-provider.getChildCreationSchema` `CreationSchemaOutputSchema`) —
14468
+ * the union is large and not meant for runtime validation here; the exported
14469
+ * `TargetKind` type re-tightens `configSchema` to `ConfigUISchema`.
14470
+ */
14471
+ var ConfigSchemaPassthrough = unknown();
14472
+ var TargetKindSchema = object({
14473
+ kind: string(),
14474
+ label: string(),
14475
+ icon: string(),
14476
+ /** Stamped by each provider so the concat-fanned catalog stays routable. */
14477
+ addonId: string(),
14478
+ configSchema: ConfigSchemaPassthrough,
14479
+ supportsDiscovery: boolean(),
14480
+ caps: TargetKindCapsSchema
14481
+ });
14482
+ /**
14483
+ * A persisted target. `config` holds secrets; providers REDACT secret fields
14484
+ * (return a presence marker only) when serving `listTargets` — never
14485
+ * round-trip a stored secret to the UI.
14486
+ */
14487
+ var TargetSchema = object({
14488
+ id: string(),
14489
+ name: string(),
14490
+ kind: string(),
14491
+ addonId: string(),
14492
+ enabled: boolean(),
14493
+ config: record(string(), unknown())
14494
+ });
14495
+ /** A discovery-surfaced candidate (config is partial + non-secret). */
14496
+ var DiscoveredTargetSchema = object({
14497
+ kind: string(),
14498
+ suggestedName: string(),
14499
+ config: record(string(), unknown())
14500
+ });
14501
+ /** The degrade engine's report — what was resolved / dropped / degraded. */
14502
+ var RenderedAsSchema = object({
14503
+ level: string(),
14504
+ format: NotificationFormatSchema,
14505
+ attachmentsSent: number$1().int().nonnegative(),
14506
+ actionsSent: number$1().int().nonnegative(),
14507
+ truncated: boolean(),
14508
+ dropped: array(string())
14509
+ });
14510
+ var SendResultSchema = object({
13335
14511
  success: boolean(),
13336
- error: string().optional()
13337
- }), { kind: "mutation" });
14512
+ error: string().optional(),
14513
+ renderedAs: RenderedAsSchema.optional()
14514
+ });
14515
+ /** Same shape as SendResult — kept as a distinct name for the test panel. */
14516
+ var TestResultSchema = SendResultSchema;
14517
+ method(object({}), array(TargetKindSchema)), method(object({}), array(TargetSchema)), method(object({
14518
+ kind: string(),
14519
+ config: record(string(), unknown()).optional()
14520
+ }), array(DiscoveredTargetSchema)), method(object({
14521
+ targetId: string(),
14522
+ notification: NotificationSchema
14523
+ }), SendResultSchema, { kind: "mutation" }), method(object({
14524
+ targetId: string(),
14525
+ sample: NotificationSchema.optional()
14526
+ }), TestResultSchema, { kind: "mutation" }), method(object({ target: TargetSchema }), TargetSchema, { kind: "mutation" }), method(object({ targetId: string() }), _void(), { kind: "mutation" }), method(object({
14527
+ targetId: string(),
14528
+ enabled: boolean()
14529
+ }), _void(), { kind: "mutation" });
13338
14530
  /**
13339
14531
  * Zod schemas for persisted record types.
13340
14532
  *
@@ -16356,7 +17548,10 @@ var HwAccelBackendInputSchema = _enum([
16356
17548
  "webgpu",
16357
17549
  "none"
16358
17550
  ]).nullable().optional();
16359
- var HwAccelResolutionSchema = object({ preferred: array(string()).readonly() });
17551
+ var HwAccelResolutionSchema = object({
17552
+ preferred: array(string()).readonly(),
17553
+ rationale: string()
17554
+ });
16360
17555
  var HardwareEncoderIdSchema = _enum([
16361
17556
  "h264_videotoolbox",
16362
17557
  "hevc_videotoolbox",
@@ -16461,10 +17656,7 @@ var ResolvedInferenceConfigSchema = object({
16461
17656
  format: ModelFormatSchema,
16462
17657
  reason: string()
16463
17658
  });
16464
- method(_void(), PlatformCapabilitiesSchema), method(_void(), HardwareInfoSchema), method(object({ requirements: array(ModelRequirementSchema).readonly() }), ResolvedInferenceConfigSchema), method(object({
16465
- prefer: HwAccelBackendInputSchema,
16466
- nodeId: string().optional()
16467
- }), HwAccelResolutionSchema), method(_void(), HardwareEncodersSchema), method(_void(), HardwareEncodersSchema, {
17659
+ method(_void(), PlatformCapabilitiesSchema), method(_void(), HardwareInfoSchema), method(object({ requirements: array(ModelRequirementSchema).readonly() }), ResolvedInferenceConfigSchema), method(object({ prefer: HwAccelBackendInputSchema }), HwAccelResolutionSchema), method(_void(), HardwareEncodersSchema), method(_void(), HardwareEncodersSchema, {
16468
17660
  kind: "mutation",
16469
17661
  auth: "admin"
16470
17662
  }), method(_void(), HardwareDecodeAccelsSchema), method(_void(), HardwareDecodeAccelsSchema, {
@@ -16523,6 +17715,16 @@ DeviceType.Camera, DeviceType.Sensor, DeviceType.Switch, method(object({ deviceI
16523
17715
  kind: "mutation",
16524
17716
  auth: "admin"
16525
17717
  });
17718
+ /**
17719
+ * `recording` cap — footage availability + HLS playback manifests + per-device
17720
+ * recording config. NOTE on events (source of truth, R5/C3): this cap carries
17721
+ * NO event surface — `getPlaybackManifest` returns playlist URLs only. Timeline
17722
+ * events (motion/object/audio) come from `pipelineAnalytics` (durable SQLite
17723
+ * rows); the recorder's internal EventMap markers are ephemeral in-RAM
17724
+ * annotations that are not exposed here and must not be treated as an event
17725
+ * feed. Event<->footage joins are by time, padded with the shared `EVENT_PAD_MS`
17726
+ * (`interfaces/recording-config.ts`).
17727
+ */
16526
17728
  var RecordingStatusSchema = object({
16527
17729
  deviceId: number$1(),
16528
17730
  enabled: boolean(),
@@ -18159,6 +19361,12 @@ Object.freeze({
18159
19361
  addonId: null,
18160
19362
  access: "view"
18161
19363
  },
19364
+ "deviceManager.getRoleDisplayDefaults": {
19365
+ capName: "device-manager",
19366
+ capScope: "system",
19367
+ addonId: null,
19368
+ access: "view"
19369
+ },
18162
19370
  "deviceManager.getSettingsSchema": {
18163
19371
  capName: "device-manager",
18164
19372
  capScope: "system",
@@ -18309,6 +19517,12 @@ Object.freeze({
18309
19517
  addonId: null,
18310
19518
  access: "create"
18311
19519
  },
19520
+ "deviceManager.setDisplay": {
19521
+ capName: "device-manager",
19522
+ capScope: "system",
19523
+ addonId: null,
19524
+ access: "create"
19525
+ },
18312
19526
  "deviceManager.setIntegrationId": {
18313
19527
  capName: "device-manager",
18314
19528
  capScope: "system",
@@ -18351,6 +19565,12 @@ Object.freeze({
18351
19565
  addonId: null,
18352
19566
  access: "create"
18353
19567
  },
19568
+ "deviceManager.setRoleDisplayDefaults": {
19569
+ capName: "device-manager",
19570
+ capScope: "system",
19571
+ addonId: null,
19572
+ access: "create"
19573
+ },
18354
19574
  "deviceManager.setStreamProfileMap": {
18355
19575
  capName: "device-manager",
18356
19576
  capScope: "system",
@@ -19329,13 +20549,49 @@ Object.freeze({
19329
20549
  addonId: null,
19330
20550
  access: "create"
19331
20551
  },
20552
+ "notificationOutput.deleteTarget": {
20553
+ capName: "notification-output",
20554
+ capScope: "system",
20555
+ addonId: null,
20556
+ access: "delete"
20557
+ },
20558
+ "notificationOutput.discoverTargets": {
20559
+ capName: "notification-output",
20560
+ capScope: "system",
20561
+ addonId: null,
20562
+ access: "view"
20563
+ },
20564
+ "notificationOutput.listTargetKinds": {
20565
+ capName: "notification-output",
20566
+ capScope: "system",
20567
+ addonId: null,
20568
+ access: "view"
20569
+ },
20570
+ "notificationOutput.listTargets": {
20571
+ capName: "notification-output",
20572
+ capScope: "system",
20573
+ addonId: null,
20574
+ access: "view"
20575
+ },
19332
20576
  "notificationOutput.send": {
19333
20577
  capName: "notification-output",
19334
20578
  capScope: "system",
19335
20579
  addonId: null,
19336
20580
  access: "create"
19337
20581
  },
19338
- "notificationOutput.sendTest": {
20582
+ "notificationOutput.setTargetEnabled": {
20583
+ capName: "notification-output",
20584
+ capScope: "system",
20585
+ addonId: null,
20586
+ access: "create"
20587
+ },
20588
+ "notificationOutput.testTarget": {
20589
+ capName: "notification-output",
20590
+ capScope: "system",
20591
+ addonId: null,
20592
+ access: "create"
20593
+ },
20594
+ "notificationOutput.upsertTarget": {
19339
20595
  capName: "notification-output",
19340
20596
  capScope: "system",
19341
20597
  addonId: null,
@@ -19365,6 +20621,66 @@ Object.freeze({
19365
20621
  addonId: null,
19366
20622
  access: "create"
19367
20623
  },
20624
+ "petFeeder.callPet": {
20625
+ capName: "pet-feeder",
20626
+ capScope: "device",
20627
+ addonId: null,
20628
+ access: "create"
20629
+ },
20630
+ "petFeeder.cancelFeed": {
20631
+ capName: "pet-feeder",
20632
+ capScope: "device",
20633
+ addonId: null,
20634
+ access: "create"
20635
+ },
20636
+ "petFeeder.feed": {
20637
+ capName: "pet-feeder",
20638
+ capScope: "device",
20639
+ addonId: null,
20640
+ access: "create"
20641
+ },
20642
+ "petFeeder.markFoodReplenished": {
20643
+ capName: "pet-feeder",
20644
+ capScope: "device",
20645
+ addonId: null,
20646
+ access: "create"
20647
+ },
20648
+ "petFeeder.playSound": {
20649
+ capName: "pet-feeder",
20650
+ capScope: "device",
20651
+ addonId: null,
20652
+ access: "create"
20653
+ },
20654
+ "petFeeder.resetDesiccant": {
20655
+ capName: "pet-feeder",
20656
+ capScope: "device",
20657
+ addonId: null,
20658
+ access: "delete"
20659
+ },
20660
+ "petFeeder.setChildLock": {
20661
+ capName: "pet-feeder",
20662
+ capScope: "device",
20663
+ addonId: null,
20664
+ access: "create"
20665
+ },
20666
+ "petFeeder.setFeedSound": {
20667
+ capName: "pet-feeder",
20668
+ capScope: "device",
20669
+ addonId: null,
20670
+ access: "create"
20671
+ },
20672
+ "petFeeder.setIndicatorLight": {
20673
+ capName: "pet-feeder",
20674
+ capScope: "device",
20675
+ addonId: null,
20676
+ access: "create"
20677
+ },
20678
+ "petFeeder.setVolume": {
20679
+ capName: "pet-feeder",
20680
+ capScope: "device",
20681
+ addonId: null,
20682
+ access: "create"
20683
+ },
19368
20684
  "pipelineAnalytics.clearTracks": {
19369
20685
  capName: "pipeline-analytics",
19370
20686
  capScope: "device",