@camstack/addon-mqtt-broker 1.1.12 → 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.
@@ -4673,7 +4673,7 @@ function _instanceof(cls, params = {}) {
4673
4673
  return inst;
4674
4674
  }
4675
4675
  //#endregion
4676
- //#region ../types/dist/sleep-C2M2zF7x.mjs
4676
+ //#region ../types/dist/sleep-BiDFW0E7.mjs
4677
4677
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
4678
4678
  EventCategory["SystemBoot"] = "system.boot";
4679
4679
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -5486,6 +5486,100 @@ function createDurableState(deps) {
5486
5486
  };
5487
5487
  }
5488
5488
  /**
5489
+ * Per-node scoping for the shared addon-settings blob.
5490
+ *
5491
+ * An addon's settings store is hub-central (the `addon-settings` cap is
5492
+ * hub-routed — the hub instance answers for every node), so fields whose
5493
+ * value is a NODE fact (decoder backend, engine pick, probed hardware
5494
+ * capabilities) persist under the node-scoped key `<key>@<nodeId>` inside
5495
+ * the single shared blob. The SCHEMA field key stays bare: the write path
5496
+ * ({@link scopePatch}) maps the bare field onto the target node's scoped
5497
+ * key; the read/hydrate path ({@link projectStore}) maps THIS node's value
5498
+ * back, so UI forms and `resolveConfig` only ever see the bare key.
5499
+ *
5500
+ * Fields opt in via the `perNode: true` schema marker on `ConfigFieldBase`
5501
+ * (`interfaces/config-ui.ts`); `BaseAddon` derives the key set from the
5502
+ * schema and routes reads/writes through these helpers.
5503
+ *
5504
+ * ## No bare-key fallback — deliberate
5505
+ *
5506
+ * {@link readNodeValue} reads the node-scoped key ONLY. A node with no
5507
+ * scoped key resolves to `undefined` so the field's schema `default` wins —
5508
+ * NEVER `store[base]` and never another node's value. A bare legacy key in
5509
+ * the store is invisible to every node, hub included, so one node's
5510
+ * selection can never leak onto another. (This generalizes the
5511
+ * `decoder-backend-keys.ts` semantics — the no-fallback variant — over an
5512
+ * arbitrary set of per-node field keys.)
5513
+ *
5514
+ * Pure functions only — no I/O, no imports beyond the language. This is a
5515
+ * LEAF module: import it via its deep path, never from the root barrel.
5516
+ */
5517
+ /**
5518
+ * Normalize a raw kernel node id to the bare node id used for scoping.
5519
+ * `localNodeId` can carry a `<node>/<addon>` suffix on forked child
5520
+ * processes; per-node settings are per-NODE, so strip the addon segment.
5521
+ * `undefined` / `null` / empty falls back to `'hub'`.
5522
+ */
5523
+ function normalizeNodeId(raw) {
5524
+ if (raw === void 0 || raw === null || raw === "") return "hub";
5525
+ const slashIdx = raw.indexOf("/");
5526
+ if (slashIdx < 0) return raw;
5527
+ const bare = raw.slice(0, slashIdx);
5528
+ return bare === "" ? "hub" : bare;
5529
+ }
5530
+ /** The node-scoped store key for a per-node field: `<base>@<nodeId>`. */
5531
+ function nodeScopedKey(base, nodeId) {
5532
+ return `${base}@${normalizeNodeId(nodeId)}`;
5533
+ }
5534
+ /**
5535
+ * Read a node's value for a per-node field from the raw shared store:
5536
+ * the node-scoped key when present, otherwise `undefined`.
5537
+ * Deliberately NO bare-key fallback (see module doc) — the caller lets the
5538
+ * schema `default` win on `undefined`.
5539
+ */
5540
+ function readNodeValue(store, base, nodeId) {
5541
+ return store[nodeScopedKey(base, nodeId)];
5542
+ }
5543
+ /**
5544
+ * Re-map a UI/settings patch so every bare perNode field persists under the
5545
+ * TARGET node's scoped key; all other keys pass through unchanged. Used on
5546
+ * the write path so a save for one node never clobbers another node's value
5547
+ * (and the bare key is never written). Returns a new object — the input
5548
+ * patch is not mutated.
5549
+ */
5550
+ function scopePatch(patch, perNodeKeys, nodeId) {
5551
+ const out = {};
5552
+ for (const [key, value] of Object.entries(patch)) out[perNodeKeys.has(key) ? nodeScopedKey(key, nodeId) : key] = value;
5553
+ return out;
5554
+ }
5555
+ /**
5556
+ * Project the raw shared store onto the bare schema keys for ONE node so a
5557
+ * UI schema (whose field keys are bare) hydrates from that node's own
5558
+ * values:
5559
+ *
5560
+ * - EVERY `@`-scoped key (any node's) is dropped from the pass-through.
5561
+ * - Every bare perNode key is dropped from the pass-through (a stray bare
5562
+ * legacy key must never hydrate any node — no bare fallback).
5563
+ * - THIS node's effective value ({@link readNodeValue}) is then laid onto
5564
+ * each bare perNode key; when the node has no scoped key the bare key is
5565
+ * left ABSENT so the field's schema `default` wins.
5566
+ *
5567
+ * Returns a new object — the input store is not mutated.
5568
+ */
5569
+ function projectStore(store, perNodeKeys, nodeId) {
5570
+ const out = {};
5571
+ for (const [key, value] of Object.entries(store)) {
5572
+ if (key.includes("@")) continue;
5573
+ if (perNodeKeys.has(key)) continue;
5574
+ out[key] = value;
5575
+ }
5576
+ for (const base of perNodeKeys) {
5577
+ const value = readNodeValue(store, base, nodeId);
5578
+ if (value !== void 0) out[base] = value;
5579
+ }
5580
+ return out;
5581
+ }
5582
+ /**
5489
5583
  * Base class for CamStack addons. Eliminates settings boilerplate:
5490
5584
  *
5491
5585
  * - Typed `config` property with automatic resolution from store + defaults
@@ -5653,23 +5747,63 @@ var BaseAddon = class {
5653
5747
  deviceSettingsSchema() {
5654
5748
  return null;
5655
5749
  }
5656
- async getGlobalSettings(overlay, cap, _nodeId) {
5750
+ async getGlobalSettings(overlay, cap, nodeId) {
5657
5751
  const schema = this.globalSettingsSchema(cap);
5658
5752
  if (!schema) return { sections: [] };
5659
- const raw = await this._ctx?.settings?.readAddonStore() ?? {};
5753
+ const projected = await this.resolveGlobalStore(nodeId, cap);
5660
5754
  return hydrateSchema(schema, overlay ? {
5661
- ...raw,
5755
+ ...projected,
5662
5756
  ...overlay
5663
- } : raw);
5757
+ } : projected);
5664
5758
  }
5665
- async updateGlobalSettings(patch, _nodeId) {
5666
- await this._ctx?.settings?.writeAddonStore(patch);
5759
+ /**
5760
+ * The raw addon store PROJECTED onto the target node's bare per-node keys:
5761
+ * every `perNode: true` field carries THAT node's scoped value on its bare
5762
+ * key (absent scoped key ⇒ key absent, so the schema `default` wins — no
5763
+ * bare fallback), all `@`-scoped and stray bare per-node keys are dropped.
5764
+ * A no-op passthrough when the schema declares no `perNode` field.
5765
+ *
5766
+ * This is the sanctioned way for a `getGlobalSettings` OVERRIDE that needs
5767
+ * the store for custom option logic (option narrowing, value snapping) to
5768
+ * read it per-node — never `ctx.settings.readAddonStore()` directly.
5769
+ * `nodeId` omitted ⇒ the local node (node-blind injection from ctx).
5770
+ */
5771
+ async resolveGlobalStore(nodeId, cap) {
5772
+ const raw = await this._ctx?.settings?.readAddonStore() ?? {};
5773
+ const keys = this.perNodeKeys(cap);
5774
+ const node = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
5775
+ return keys.size > 0 ? projectStore(raw, keys, node) : raw;
5776
+ }
5777
+ async updateGlobalSettings(patch, nodeId) {
5778
+ const keys = this.perNodeKeys();
5779
+ const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
5780
+ const target = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
5781
+ const barePatch = patch;
5782
+ const scoped = keys.size > 0 ? scopePatch(barePatch, keys, target) : barePatch;
5783
+ await this._ctx?.settings?.writeAddonStore(scoped);
5784
+ if (target !== localNode) return;
5667
5785
  await this.resolveConfig();
5668
5786
  await this.onConfigChanged();
5669
5787
  this.emitLifecycle(EventCategory.AddonUpdated, { level: "global" });
5670
5788
  this.maybeAutoRestart(patch, this.globalSettingsSchema());
5671
5789
  }
5672
5790
  /**
5791
+ * The set of field keys the global settings schema declares `perNode: true`
5792
+ * — derived once per `cap` argument and memoized (schemas are static
5793
+ * declarations). Empty set ⇒ every per-node code path is bypassed and the
5794
+ * settings API behaves exactly like the legacy node-agnostic one.
5795
+ */
5796
+ _perNodeKeysCache = /* @__PURE__ */ new Map();
5797
+ perNodeKeys(cap) {
5798
+ const cacheKey = cap ?? "";
5799
+ const cached = this._perNodeKeysCache.get(cacheKey);
5800
+ if (cached) return cached;
5801
+ const schema = this.globalSettingsSchema(cap);
5802
+ const keys = new Set(schema ? schema.sections.flatMap((section) => collectPerNodeFieldKeys(section.fields)) : []);
5803
+ this._perNodeKeysCache.set(cacheKey, keys);
5804
+ return keys;
5805
+ }
5806
+ /**
5673
5807
  * If any field in `patch` is marked `requiresRestart` in `schema`,
5674
5808
  * schedule an addon restart for the next tick. Deferred via
5675
5809
  * `setImmediate` so the tRPC mutation that triggered the write has
@@ -5822,12 +5956,19 @@ var BaseAddon = class {
5822
5956
  * The merge is shallow: each key in `defaults` is checked against the store.
5823
5957
  * Only keys present in defaults are read — the store can contain extra keys
5824
5958
  * (e.g. from older versions) without polluting the typed config.
5959
+ *
5960
+ * Keys the global settings schema declares `perNode: true` resolve from
5961
+ * THIS node's scoped key (`<key>@<localNode>`) via `readNodeValue` — never
5962
+ * from the bare key — so a per-node field resolves to this node's own
5963
+ * selection at boot (absent scoped key ⇒ the constructor default wins).
5825
5964
  */
5826
5965
  async resolveConfig() {
5827
5966
  const stored = await this.readAddonStoreWithRetry();
5967
+ const perNode = this.perNodeKeys();
5968
+ const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
5828
5969
  const resolved = { ...this.defaults };
5829
5970
  for (const key of Object.keys(this.defaults)) {
5830
- const storedValue = stored[key];
5971
+ const storedValue = perNode.has(key) ? readNodeValue(stored, key, localNode) : stored[key];
5831
5972
  if (storedValue !== void 0 && storedValue !== null) {
5832
5973
  const defaultType = typeof this.defaults[key];
5833
5974
  if (typeof storedValue === defaultType) resolved[key] = storedValue;
@@ -5911,6 +6052,27 @@ var BaseAddon = class {
5911
6052
  }
5912
6053
  };
5913
6054
  /**
6055
+ * Collect the keys of every field marked `perNode: true`, recursing into
6056
+ * layout containers (`group` fields and `sub-tabs` tabs) the same way
6057
+ * `hydrateSchema` does. Valueless structural fields (separator/info/…)
6058
+ * don't declare `perNode` and are excluded by the `in` narrowing.
6059
+ */
6060
+ function collectPerNodeFieldKeys(fields) {
6061
+ const collected = [];
6062
+ for (const field of fields) {
6063
+ if (field.type === "group") {
6064
+ collected.push(...collectPerNodeFieldKeys(field.fields));
6065
+ continue;
6066
+ }
6067
+ if (field.type === "sub-tabs") {
6068
+ for (const tab of field.tabs) collected.push(...collectPerNodeFieldKeys(tab.fields));
6069
+ continue;
6070
+ }
6071
+ if ("perNode" in field && field.perNode === true) collected.push(field.key);
6072
+ }
6073
+ return collected;
6074
+ }
6075
+ /**
5914
6076
  * Normalize an `ICamstackAddon.initialize()` return value into the
5915
6077
  * `AddonInitResult` envelope. Arrays are wrapped into `{ providers }`;
5916
6078
  * envelopes pass through; void stays void.
@@ -5935,6 +6097,7 @@ var CamStreamKindSchema = _enum([
5935
6097
  "pull-rtsp",
5936
6098
  "pull-rtmp",
5937
6099
  "pull-http",
6100
+ "pull-flv",
5938
6101
  "pull-rfc4571",
5939
6102
  "push-annexb",
5940
6103
  "derived"
@@ -6317,6 +6480,13 @@ var DeviceType = /* @__PURE__ */ function(DeviceType) {
6317
6480
  /** Single still-image entity (HA `image.*`). Read-only display of an
6318
6481
  * `entity_picture` signed URL the browser loads directly. `image` cap. */
6319
6482
  DeviceType["Image"] = "image";
6483
+ /** Smart pet feeder — cloud-connected food dispenser with a bowl food
6484
+ * level, battery, desiccant life, feeding state and manual-feed /
6485
+ * call-pet / maintenance actions. Installed with the `pet-feeder` cap;
6486
+ * dual-hopper models (D4S/D4SH) expose per-hopper portions. Sources:
6487
+ * native PetKit (`nodepetkit` `FeederDevice`), reusable by other feeder
6488
+ * integrations sharing the same food/desiccant/hopper surface. */
6489
+ DeviceType["PetFeeder"] = "pet-feeder";
6320
6490
  return DeviceType;
6321
6491
  }({});
6322
6492
  var DeviceFeature = /* @__PURE__ */ function(DeviceFeature) {
@@ -7078,7 +7248,21 @@ var StorageLocationDeclarationSchema = object({
7078
7248
  * slots (e.g. `recordingsLow` → `recordings`) so operators only need to
7079
7249
  * configure the primary location.
7080
7250
  */
7081
- defaultsTo: string().optional()
7251
+ defaultsTo: string().optional(),
7252
+ /**
7253
+ * Which node root the seeded `<id>:default` instance is placed under on a
7254
+ * FRESH install:
7255
+ * - `'data'` (default) — the node's data dir (`CAMSTACK_DATA` / boot dir),
7256
+ * the appData volume. Right for small/durable data (backups, logs, models).
7257
+ * - `'media'` — the dedicated media volume (`CAMSTACK_MEDIA_ROOT`) when that
7258
+ * env is set, else falls back to the data root. Right for bulky, hot media
7259
+ * (recordings, event media) that should stay off the appData disk.
7260
+ *
7261
+ * Only affects the seeded default's `basePath`; operators can repoint any
7262
+ * location afterwards, and a `defaultsTo` slot inherits its parent's root
7263
+ * regardless of this field. Absent (the common case) is treated as `'data'`.
7264
+ */
7265
+ defaultRoot: _enum(["data", "media"]).optional()
7082
7266
  });
7083
7267
  var DecoderStatsSchema = object({
7084
7268
  inputFps: number(),
@@ -7451,6 +7635,601 @@ var _macroLookup = /* @__PURE__ */ new Map();
7451
7635
  for (const [k, v] of Object.entries(YAMNET_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
7452
7636
  for (const [k, v] of Object.entries(APPLE_SA_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
7453
7637
  /**
7638
+ * Error types for the safe expression engine. Two distinct classes so callers
7639
+ * can tell a compile-time (grammar) failure from a runtime (evaluation)
7640
+ * failure — both are non-fatal to the host: read paths degrade to "skip link".
7641
+ */
7642
+ /** Thrown by the tokenizer / parser. Carries a 0-based source `position` when
7643
+ * the failure is anchored to a character (author-facing inline feedback). */
7644
+ var ExpressionParseError = class extends Error {
7645
+ position;
7646
+ constructor(message, position) {
7647
+ super(message);
7648
+ this.name = "ExpressionParseError";
7649
+ this.position = position;
7650
+ }
7651
+ };
7652
+ /** Thrown by the evaluator (unknown identifier, type mismatch, non-finite
7653
+ * result, unknown builtin, step-budget exceeded). */
7654
+ var ExpressionEvalError = class extends Error {
7655
+ constructor(message) {
7656
+ super(message);
7657
+ this.name = "ExpressionEvalError";
7658
+ }
7659
+ };
7660
+ /**
7661
+ * Resource-bound constants for the safe expression engine.
7662
+ *
7663
+ * Every bound is defense-in-depth: the grammar is non-Turing-complete (no
7664
+ * loops, recursion, lambdas or member access — see `ast.ts`), so evaluation is
7665
+ * O(nodeCount) by construction. These caps merely put a hard ceiling on the
7666
+ * work a single author-supplied expression can request, so a hostile or
7667
+ * accidental pathological string can never spend unbounded CPU/memory.
7668
+ */
7669
+ /** Max source length (chars) — checked BEFORE tokenizing so a huge string is
7670
+ * rejected without allocation. */
7671
+ var MAX_EXPRESSION_SOURCE_LENGTH = 2048;
7672
+ /** A legal binding / identifier name. */
7673
+ var EXPRESSION_IDENTIFIER_RE = /^[A-Za-z_][A-Za-z0-9_]*$/;
7674
+ /** Binding names an author may NOT use: `now` is auto-injected; the literal
7675
+ * keywords lex as values, not identifiers, so binding to them is meaningless. */
7676
+ var RESERVED_BINDING_NAMES = new Set([
7677
+ "now",
7678
+ "true",
7679
+ "false",
7680
+ "null"
7681
+ ]);
7682
+ /**
7683
+ * Tokenizer for the safe expression mini-language. Hand-rolled, single-pass,
7684
+ * zero-dependency. The grammar is deliberately boring: decimal numbers,
7685
+ * single/double-quoted strings with a tiny escape set, identifiers, the three
7686
+ * value keywords (`true`/`false`/`null`) and a fixed punctuator set. Anything
7687
+ * outside that — a bare `.`, `=`, `[`, `]`, `{`, `}`, `;`, backtick, `&`, `|` —
7688
+ * is a parse error with a source position, so member access / assignment /
7689
+ * template literals are lexically impossible.
7690
+ */
7691
+ var KEYWORDS = new Set([
7692
+ "true",
7693
+ "false",
7694
+ "null"
7695
+ ]);
7696
+ function isDigit(ch) {
7697
+ return ch >= "0" && ch <= "9";
7698
+ }
7699
+ function isIdentStart(ch) {
7700
+ return ch >= "A" && ch <= "Z" || ch >= "a" && ch <= "z" || ch === "_";
7701
+ }
7702
+ function isIdentPart(ch) {
7703
+ return isIdentStart(ch) || isDigit(ch);
7704
+ }
7705
+ function isWhitespace(ch) {
7706
+ return ch === " " || ch === " " || ch === "\n" || ch === "\r" || ch === "\f" || ch === "\v";
7707
+ }
7708
+ /** Tokenize `source` into a flat token list ending with a single `eof` token.
7709
+ * Throws `ExpressionParseError` on any illegal character or unterminated
7710
+ * string. */
7711
+ function tokenize(source) {
7712
+ if (source.length > 2048) throw new ExpressionParseError(`expression too long (${source.length} > ${MAX_EXPRESSION_SOURCE_LENGTH} chars)`, 0);
7713
+ const tokens = [];
7714
+ let i = 0;
7715
+ const n = source.length;
7716
+ while (i < n) {
7717
+ const ch = source[i];
7718
+ if (isWhitespace(ch)) {
7719
+ i += 1;
7720
+ continue;
7721
+ }
7722
+ if (isDigit(ch)) {
7723
+ const start = i;
7724
+ while (i < n && isDigit(source[i])) i += 1;
7725
+ if (i < n && source[i] === ".") {
7726
+ if (i + 1 >= n || !isDigit(source[i + 1])) throw new ExpressionParseError("malformed number: decimal point needs a digit", i);
7727
+ i += 1;
7728
+ while (i < n && isDigit(source[i])) i += 1;
7729
+ }
7730
+ const text = source.slice(start, i);
7731
+ const value = Number(text);
7732
+ if (!Number.isFinite(value)) throw new ExpressionParseError(`malformed number: '${text}'`, start);
7733
+ tokens.push({
7734
+ type: "number",
7735
+ value,
7736
+ pos: start
7737
+ });
7738
+ continue;
7739
+ }
7740
+ if (ch === "'" || ch === "\"") {
7741
+ const quote = ch;
7742
+ const start = i;
7743
+ i += 1;
7744
+ let out = "";
7745
+ let closed = false;
7746
+ while (i < n) {
7747
+ const c = source[i];
7748
+ if (c === "\\") {
7749
+ const next = i + 1 < n ? source[i + 1] : "";
7750
+ if (next === "\\" || next === "'" || next === "\"") {
7751
+ out += next;
7752
+ i += 2;
7753
+ continue;
7754
+ }
7755
+ throw new ExpressionParseError(`invalid string escape: '\\${next}'`, i);
7756
+ }
7757
+ if (c === quote) {
7758
+ closed = true;
7759
+ i += 1;
7760
+ break;
7761
+ }
7762
+ out += c;
7763
+ i += 1;
7764
+ }
7765
+ if (!closed) throw new ExpressionParseError("unterminated string literal", start);
7766
+ tokens.push({
7767
+ type: "string",
7768
+ value: out,
7769
+ pos: start
7770
+ });
7771
+ continue;
7772
+ }
7773
+ if (isIdentStart(ch)) {
7774
+ const start = i;
7775
+ while (i < n && isIdentPart(source[i])) i += 1;
7776
+ const text = source.slice(start, i);
7777
+ if (KEYWORDS.has(text)) tokens.push({
7778
+ type: "keyword",
7779
+ keyword: keywordOf(text),
7780
+ pos: start
7781
+ });
7782
+ else tokens.push({
7783
+ type: "identifier",
7784
+ name: text,
7785
+ pos: start
7786
+ });
7787
+ continue;
7788
+ }
7789
+ const two = i + 1 < n ? source.slice(i, i + 2) : "";
7790
+ if (two === "<=" || two === ">=" || two === "==" || two === "!=" || two === "&&" || two === "||") {
7791
+ tokens.push({
7792
+ type: "punct",
7793
+ punct: two,
7794
+ pos: i
7795
+ });
7796
+ i += 2;
7797
+ continue;
7798
+ }
7799
+ if (isSinglePunct(ch)) {
7800
+ tokens.push({
7801
+ type: "punct",
7802
+ punct: ch,
7803
+ pos: i
7804
+ });
7805
+ i += 1;
7806
+ continue;
7807
+ }
7808
+ throw new ExpressionParseError(`unexpected character '${ch}'`, i);
7809
+ }
7810
+ tokens.push({
7811
+ type: "eof",
7812
+ pos: n
7813
+ });
7814
+ return tokens;
7815
+ }
7816
+ function keywordOf(text) {
7817
+ if (text === "true") return "true";
7818
+ if (text === "false") return "false";
7819
+ return "null";
7820
+ }
7821
+ function isSinglePunct(ch) {
7822
+ return ch === "(" || ch === ")" || ch === "," || ch === "?" || ch === ":" || ch === "+" || ch === "-" || ch === "*" || ch === "/" || ch === "%" || ch === "!" || ch === "<" || ch === ">";
7823
+ }
7824
+ /**
7825
+ * Frozen, null-prototype builtin function table for the expression engine
7826
+ * (spec §4 rule 4). The table is the SOLE surface of callable functions: the
7827
+ * parser rejects any callee not in it, and the evaluator gates each call on an
7828
+ * own-property check against it.
7829
+ *
7830
+ * Because the object has a NULL prototype AND is `Object.freeze`d:
7831
+ * - it cannot be polluted (no `__proto__` / `constructor` write reaches it);
7832
+ * - a lookup for `toString` / `hasOwnProperty` / `constructor` finds NOTHING
7833
+ * (there is no `Object.prototype` in the chain), so those names are not
7834
+ * callable — they are simply "unknown function" at parse time.
7835
+ *
7836
+ * Every numeric argument is validated as a finite number and every numeric
7837
+ * RESULT is re-checked finite, so `/0`, `sqrt(-1)` (→ NaN) and overflow
7838
+ * (`pow(10,400)` → Infinity) all raise `ExpressionEvalError` and fail the link
7839
+ * closed rather than emitting a garbage value.
7840
+ */
7841
+ function asFiniteNumber(value, name, index) {
7842
+ if (typeof value !== "number" || !Number.isFinite(value)) throw new ExpressionEvalError(`${name}: argument ${index + 1} must be a finite number`);
7843
+ return value;
7844
+ }
7845
+ function asString$1(value, name, index) {
7846
+ if (typeof value !== "string") throw new ExpressionEvalError(`${name}: argument ${index + 1} must be a string`);
7847
+ return value;
7848
+ }
7849
+ function finiteResult(value, name) {
7850
+ if (!Number.isFinite(value)) throw new ExpressionEvalError(`${name}: produced a non-finite result`);
7851
+ return value;
7852
+ }
7853
+ function allFiniteNumbers(args, name) {
7854
+ return args.map((a, idx) => asFiniteNumber(a, name, idx));
7855
+ }
7856
+ var INF = Number.POSITIVE_INFINITY;
7857
+ var table = {
7858
+ min: {
7859
+ minArgs: 1,
7860
+ maxArgs: INF,
7861
+ apply: (args) => finiteResult(Math.min(...allFiniteNumbers(args, "min")), "min")
7862
+ },
7863
+ max: {
7864
+ minArgs: 1,
7865
+ maxArgs: INF,
7866
+ apply: (args) => finiteResult(Math.max(...allFiniteNumbers(args, "max")), "max")
7867
+ },
7868
+ abs: {
7869
+ minArgs: 1,
7870
+ maxArgs: 1,
7871
+ apply: (args) => finiteResult(Math.abs(asFiniteNumber(args[0], "abs", 0)), "abs")
7872
+ },
7873
+ floor: {
7874
+ minArgs: 1,
7875
+ maxArgs: 1,
7876
+ apply: (args) => finiteResult(Math.floor(asFiniteNumber(args[0], "floor", 0)), "floor")
7877
+ },
7878
+ ceil: {
7879
+ minArgs: 1,
7880
+ maxArgs: 1,
7881
+ apply: (args) => finiteResult(Math.ceil(asFiniteNumber(args[0], "ceil", 0)), "ceil")
7882
+ },
7883
+ sqrt: {
7884
+ minArgs: 1,
7885
+ maxArgs: 1,
7886
+ apply: (args) => finiteResult(Math.sqrt(asFiniteNumber(args[0], "sqrt", 0)), "sqrt")
7887
+ },
7888
+ round: {
7889
+ minArgs: 1,
7890
+ maxArgs: 2,
7891
+ apply: (args) => {
7892
+ const x = asFiniteNumber(args[0], "round", 0);
7893
+ const digits = args.length > 1 ? Math.trunc(asFiniteNumber(args[1], "round", 1)) : 0;
7894
+ if (digits < 0 || digits > 100) throw new ExpressionEvalError("round: digits must be between 0 and 100");
7895
+ const factor = 10 ** digits;
7896
+ return finiteResult(Math.round(x * factor) / factor, "round");
7897
+ }
7898
+ },
7899
+ pow: {
7900
+ minArgs: 2,
7901
+ maxArgs: 2,
7902
+ apply: (args) => finiteResult(asFiniteNumber(args[0], "pow", 0) ** asFiniteNumber(args[1], "pow", 1), "pow")
7903
+ },
7904
+ clamp: {
7905
+ minArgs: 3,
7906
+ maxArgs: 3,
7907
+ apply: (args) => {
7908
+ const x = asFiniteNumber(args[0], "clamp", 0);
7909
+ const lo = asFiniteNumber(args[1], "clamp", 1);
7910
+ const hi = asFiniteNumber(args[2], "clamp", 2);
7911
+ if (lo > hi) throw new ExpressionEvalError("clamp: lower bound is greater than upper bound");
7912
+ return finiteResult(Math.min(hi, Math.max(lo, x)), "clamp");
7913
+ }
7914
+ },
7915
+ avg: {
7916
+ minArgs: 1,
7917
+ maxArgs: INF,
7918
+ apply: (args) => {
7919
+ const nums = allFiniteNumbers(args, "avg");
7920
+ return finiteResult(nums.reduce((acc, v) => acc + v, 0) / nums.length, "avg");
7921
+ }
7922
+ },
7923
+ sum: {
7924
+ minArgs: 1,
7925
+ maxArgs: INF,
7926
+ apply: (args) => finiteResult(allFiniteNumbers(args, "sum").reduce((acc, v) => acc + v, 0), "sum")
7927
+ },
7928
+ coalesce: {
7929
+ minArgs: 1,
7930
+ maxArgs: INF,
7931
+ apply: (args) => {
7932
+ for (const a of args) if (a !== null) return a;
7933
+ return null;
7934
+ }
7935
+ },
7936
+ age: {
7937
+ minArgs: 2,
7938
+ maxArgs: 2,
7939
+ apply: (args) => finiteResult(asFiniteNumber(args[0], "age", 0) - asFiniteNumber(args[1], "age", 1), "age")
7940
+ },
7941
+ convert: {
7942
+ minArgs: 3,
7943
+ maxArgs: 3,
7944
+ apply: (args, hooks) => {
7945
+ const x = asFiniteNumber(args[0], "convert", 0);
7946
+ const from = asString$1(args[1], "convert", 1).trim();
7947
+ const to = asString$1(args[2], "convert", 2).trim();
7948
+ if (hooks.convert) {
7949
+ const out = hooks.convert(x, from, to);
7950
+ if (out === null) throw new ExpressionEvalError(`convert: cannot convert '${from}' to '${to}'`);
7951
+ return finiteResult(out, "convert");
7952
+ }
7953
+ if (from === to) return x;
7954
+ throw new ExpressionEvalError("convert: unit conversion table not installed");
7955
+ }
7956
+ }
7957
+ };
7958
+ Object.freeze(Object.assign(Object.create(null), table));
7959
+ /** The set of valid builtin names — used by the parser to reject unknown
7960
+ * callees at parse time (immediate author feedback). */
7961
+ var EXPRESSION_BUILTIN_NAMES = new Set(Object.keys(table));
7962
+ /**
7963
+ * Pratt (precedence-climbing) parser for the safe expression mini-language.
7964
+ *
7965
+ * Precedence (low → high): ternary `?:` (right-assoc) → `||` → `&&` → equality
7966
+ * → relational → additive → multiplicative → unary `! -` → call / primary.
7967
+ * Calls are ONLY `IDENT '(' args? ')'` at primary position — the callee is a
7968
+ * string validated against the builtin table at parse time, so an unknown
7969
+ * function is rejected immediately (author feedback) and a persisted expression
7970
+ * that references a since-removed builtin degrades at read.
7971
+ *
7972
+ * A node counter caps total AST size (`MAX_EXPRESSION_AST_NODES`) and call
7973
+ * arity is capped (`MAX_EXPRESSION_CALL_ARGS`) — both raise `ExpressionParseError`.
7974
+ */
7975
+ /** Binary/logical operator precedence (higher binds tighter). */
7976
+ var BINARY_PRECEDENCE = {
7977
+ "||": 1,
7978
+ "&&": 2,
7979
+ "==": 3,
7980
+ "!=": 3,
7981
+ "<": 4,
7982
+ "<=": 4,
7983
+ ">": 4,
7984
+ ">=": 4,
7985
+ "+": 5,
7986
+ "-": 5,
7987
+ "*": 6,
7988
+ "/": 6,
7989
+ "%": 6
7990
+ };
7991
+ function isLogicalOp(op) {
7992
+ return op === "&&" || op === "||";
7993
+ }
7994
+ function isBinaryOp(op) {
7995
+ return op === "+" || op === "-" || op === "*" || op === "/" || op === "%" || op === "==" || op === "!=" || op === "<" || op === "<=" || op === ">" || op === ">=";
7996
+ }
7997
+ var Parser = class {
7998
+ tokens;
7999
+ pos = 0;
8000
+ nodeCount = 0;
8001
+ identifiers = /* @__PURE__ */ new Set();
8002
+ callees = /* @__PURE__ */ new Set();
8003
+ constructor(tokens) {
8004
+ this.tokens = tokens;
8005
+ }
8006
+ parse() {
8007
+ const ast = this.parseTernary();
8008
+ const tok = this.peek();
8009
+ if (tok.type !== "eof") throw new ExpressionParseError("unexpected trailing input", tok.pos);
8010
+ return {
8011
+ ast,
8012
+ identifiers: this.identifiers,
8013
+ callees: this.callees,
8014
+ nodeCount: this.nodeCount
8015
+ };
8016
+ }
8017
+ peek() {
8018
+ return this.tokens[this.pos];
8019
+ }
8020
+ next() {
8021
+ return this.tokens[this.pos++];
8022
+ }
8023
+ /** Consume a punctuator token, erroring if the next token isn't it. */
8024
+ expectPunct(punct) {
8025
+ const tok = this.peek();
8026
+ if (tok.type !== "punct" || tok.punct !== punct) throw new ExpressionParseError(`expected '${punct}'`, tok.pos);
8027
+ this.pos += 1;
8028
+ }
8029
+ matchPunct(punct) {
8030
+ const tok = this.peek();
8031
+ if (tok.type === "punct" && tok.punct === punct) {
8032
+ this.pos += 1;
8033
+ return true;
8034
+ }
8035
+ return false;
8036
+ }
8037
+ countNode() {
8038
+ this.nodeCount += 1;
8039
+ if (this.nodeCount > 256) throw new ExpressionParseError("expression too complex", this.peek().pos);
8040
+ }
8041
+ parseTernary() {
8042
+ const test = this.parseBinary(1);
8043
+ if (this.matchPunct("?")) {
8044
+ const consequent = this.parseTernary();
8045
+ this.expectPunct(":");
8046
+ const alternate = this.parseTernary();
8047
+ this.countNode();
8048
+ return {
8049
+ kind: "conditional",
8050
+ test,
8051
+ consequent,
8052
+ alternate
8053
+ };
8054
+ }
8055
+ return test;
8056
+ }
8057
+ parseBinary(minPrec) {
8058
+ let left = this.parseUnary();
8059
+ for (;;) {
8060
+ const tok = this.peek();
8061
+ if (tok.type !== "punct") break;
8062
+ const prec = BINARY_PRECEDENCE[tok.punct];
8063
+ if (prec === void 0 || prec < minPrec) break;
8064
+ const op = tok.punct;
8065
+ this.pos += 1;
8066
+ const right = this.parseBinary(prec + 1);
8067
+ this.countNode();
8068
+ if (isLogicalOp(op)) left = {
8069
+ kind: "logical",
8070
+ op,
8071
+ left,
8072
+ right
8073
+ };
8074
+ else if (isBinaryOp(op)) left = {
8075
+ kind: "binary",
8076
+ op,
8077
+ left,
8078
+ right
8079
+ };
8080
+ else throw new ExpressionParseError(`unexpected operator '${op}'`, tok.pos);
8081
+ }
8082
+ return left;
8083
+ }
8084
+ parseUnary() {
8085
+ const tok = this.peek();
8086
+ if (tok.type === "punct" && (tok.punct === "!" || tok.punct === "-")) {
8087
+ const op = tok.punct;
8088
+ this.pos += 1;
8089
+ const operand = this.parseUnary();
8090
+ this.countNode();
8091
+ return {
8092
+ kind: "unary",
8093
+ op,
8094
+ operand
8095
+ };
8096
+ }
8097
+ return this.parsePrimary();
8098
+ }
8099
+ parsePrimary() {
8100
+ const tok = this.next();
8101
+ switch (tok.type) {
8102
+ case "number":
8103
+ this.countNode();
8104
+ return {
8105
+ kind: "literal",
8106
+ value: tok.value
8107
+ };
8108
+ case "string":
8109
+ this.countNode();
8110
+ return {
8111
+ kind: "literal",
8112
+ value: tok.value
8113
+ };
8114
+ case "keyword":
8115
+ this.countNode();
8116
+ return {
8117
+ kind: "literal",
8118
+ value: tok.keyword === "null" ? null : tok.keyword === "true"
8119
+ };
8120
+ case "identifier": {
8121
+ const nextTok = this.peek();
8122
+ if (nextTok.type === "punct" && nextTok.punct === "(") return this.parseCall(tok.name, tok.pos);
8123
+ this.identifiers.add(tok.name);
8124
+ this.countNode();
8125
+ return {
8126
+ kind: "identifier",
8127
+ name: tok.name
8128
+ };
8129
+ }
8130
+ case "punct":
8131
+ if (tok.punct === "(") {
8132
+ const inner = this.parseTernary();
8133
+ this.expectPunct(")");
8134
+ return inner;
8135
+ }
8136
+ throw new ExpressionParseError(`unexpected token '${tok.punct}'`, tok.pos);
8137
+ case "eof": throw new ExpressionParseError("unexpected end of expression", tok.pos);
8138
+ }
8139
+ }
8140
+ parseCall(callee, pos) {
8141
+ if (!EXPRESSION_BUILTIN_NAMES.has(callee)) throw new ExpressionParseError(`unknown function '${callee}'`, pos);
8142
+ this.expectPunct("(");
8143
+ const args = [];
8144
+ if (!this.matchPunct(")")) for (;;) {
8145
+ args.push(this.parseTernary());
8146
+ if (args.length > 16) throw new ExpressionParseError(`too many arguments to '${callee}'`, pos);
8147
+ if (this.matchPunct(",")) continue;
8148
+ this.expectPunct(")");
8149
+ break;
8150
+ }
8151
+ this.callees.add(callee);
8152
+ this.countNode();
8153
+ return {
8154
+ kind: "call",
8155
+ callee,
8156
+ args
8157
+ };
8158
+ }
8159
+ };
8160
+ /** Tokenize + parse `source` into a validated `ParsedExpression`. Throws
8161
+ * `ExpressionParseError` on any lexical or grammatical failure. */
8162
+ function parseExpression(source) {
8163
+ return new Parser(tokenize(source)).parse();
8164
+ }
8165
+ Object.freeze({});
8166
+ /**
8167
+ * LRU compile cache for parsed expressions (spec §2.4 "parse once … LRU keyed
8168
+ * by expr"). The cache stores BOTH successes and failures (negative caching),
8169
+ * so a corrupt persisted string costs exactly one tokenize+parse total — not
8170
+ * one per read on a hot resolve path.
8171
+ *
8172
+ * The cache is a module-level singleton: entries are pure, content-addressed
8173
+ * ASTs keyed by the raw source string, so sharing one instance across all
8174
+ * callers is safe and maximises hit rate.
8175
+ */
8176
+ var cache = /* @__PURE__ */ new Map();
8177
+ function getCached(source) {
8178
+ const hit = cache.get(source);
8179
+ if (hit !== void 0) {
8180
+ cache.delete(source);
8181
+ cache.set(source, hit);
8182
+ return hit;
8183
+ }
8184
+ let result;
8185
+ try {
8186
+ result = {
8187
+ ok: true,
8188
+ parsed: parseExpression(source)
8189
+ };
8190
+ } catch (err) {
8191
+ result = {
8192
+ ok: false,
8193
+ error: err instanceof ExpressionParseError ? err.message : String(err)
8194
+ };
8195
+ }
8196
+ cache.set(source, result);
8197
+ if (cache.size > 256) {
8198
+ const oldest = cache.keys().next().value;
8199
+ if (oldest !== void 0) cache.delete(oldest);
8200
+ }
8201
+ return result;
8202
+ }
8203
+ /** Compile `source`, returning a discriminated result instead of throwing.
8204
+ * Used by read paths that must degrade rather than raise. LRU/negative-cached. */
8205
+ function compileExpressionSafe(source) {
8206
+ return getCached(source);
8207
+ }
8208
+ /**
8209
+ * Author-time validation. Returns `null` when the source is valid, else a
8210
+ * human-readable error message. Checks: the expression compiles; binding count
8211
+ * is within `MAX_EXPRESSION_BINDINGS`; every binding name is a legal identifier,
8212
+ * is not reserved (`now`/keywords) and does not shadow a builtin; and every
8213
+ * FREE identifier of the AST is covered by a binding or the injected `now`.
8214
+ */
8215
+ function validateExpressionSource(src) {
8216
+ const names = Object.keys(src.bindings);
8217
+ if (names.length > 32) return `too many bindings (${names.length} > 32)`;
8218
+ for (const name of names) {
8219
+ if (!EXPRESSION_IDENTIFIER_RE.test(name)) return `invalid binding name '${name}'`;
8220
+ if (RESERVED_BINDING_NAMES.has(name)) return `binding name '${name}' is reserved`;
8221
+ if (EXPRESSION_BUILTIN_NAMES.has(name)) return `binding name '${name}' shadows a builtin function`;
8222
+ }
8223
+ const compiled = compileExpressionSafe(src.expr);
8224
+ if (!compiled.ok) return compiled.error;
8225
+ const bound = new Set(names);
8226
+ for (const id of compiled.parsed.identifiers) {
8227
+ if (id === "now") continue;
8228
+ if (!bound.has(id)) return `expression references unbound identifier '${id}'`;
8229
+ }
8230
+ return null;
8231
+ }
8232
+ /**
7454
8233
  * Accessory device helpers — shared across drivers.
7455
8234
  *
7456
8235
  * Many vendor-specific drivers register accessory child devices on
@@ -7925,6 +8704,10 @@ var RtspRestreamEntrySchema = object({
7925
8704
  var BrokerRtspClientSchema = object({
7926
8705
  sessionId: string(),
7927
8706
  remoteAddr: string(),
8707
+ /** Client `User-Agent` (e.g. `recorder` for the recorder's RTSP pull), or
8708
+ * null/absent when the client sent none. Lets the UI label a consumer by
8709
+ * purpose. Optional so a client built against an older schema stays valid. */
8710
+ userAgent: string().nullish(),
7928
8711
  playing: boolean(),
7929
8712
  muted: boolean(),
7930
8713
  connectedAt: number(),
@@ -9349,7 +10132,8 @@ var MotionAnalysisResultSchema = object({
9349
10132
  });
9350
10133
  method(object({
9351
10134
  deviceId: number(),
9352
- frame: FrameInputSchema
10135
+ frame: FrameInputSchema.optional(),
10136
+ frameHandle: FrameHandleSchema.optional()
9353
10137
  }), MotionAnalysisResultSchema, { kind: "mutation" }), method(object({ deviceId: number() }), _void(), { kind: "mutation" }), method(_void(), _void(), { kind: "mutation" }), object({
9354
10138
  deviceId: number(),
9355
10139
  detected: boolean(),
@@ -9596,6 +10380,12 @@ method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngi
9596
10380
  engine: PipelineEngineChoiceSchema.optional(),
9597
10381
  steps: array(PipelineStepInputSchema).min(1),
9598
10382
  frame: FrameInputSchema.optional(),
10383
+ /**
10384
+ * CB5 shm passthrough — a `FrameHandle` naming the same ring slot
10385
+ * the decoded pixels live in. One more member of the one-of
10386
+ * frame/frameHandle/image/imageBase64/referenceImage group.
10387
+ */
10388
+ frameHandle: FrameHandleSchema.optional(),
9599
10389
  imageBase64: string().optional(),
9600
10390
  /**
9601
10391
  * Binary JPEG bytes — preferred over `imageBase64` on internal
@@ -9805,6 +10595,31 @@ var ReportMotionInputSchema = object({
9805
10595
  regions: array(MotionRegionSchema).readonly().optional()
9806
10596
  });
9807
10597
  /**
10598
+ * Where a runner gets a camera's decoded frames (cross-node Phase 2,
10599
+ * restream-owner model — P2c).
10600
+ *
10601
+ * - `local-broker` (DEFAULT): today's path — subscribe to the co-located
10602
+ * stream-broker's shm frame plane. Every pre-P2c attach payload (no
10603
+ * `frameSource` key) parses to this, so the field is additive with zero
10604
+ * behavior change.
10605
+ * - `remote-restream`: the detect node is NOT the camera's source-owner.
10606
+ * The runner acquires the owner's COMPRESSED passthrough restream
10607
+ * (`streamBroker.getStreamWithCodec({video:'copy'})` — refcounted, the
10608
+ * double-pull guard) and decodes LOCALLY via a satellite frame plane +
10609
+ * pull-mode decoder session pinned to its own node. The shm ring stays
10610
+ * node-local; only H.264/H.265 packets cross the wire.
10611
+ * `hubHostnameOverride` mirrors the recorder's `recordingHubHostname`:
10612
+ * when set it overrides the `CAMSTACK_HUB_URL`-derived host the runner
10613
+ * dials for the owner's restream.
10614
+ */
10615
+ var RunnerFrameSourceSchema = discriminatedUnion("kind", [object({ kind: literal("local-broker") }), object({
10616
+ kind: literal("remote-restream"),
10617
+ /** The camera's source-owner node (slice 1: always the hub). */
10618
+ ownerNodeId: string(),
10619
+ /** Operator override for the owner host the runner dials. */
10620
+ hubHostnameOverride: string().optional()
10621
+ })]).describe("Per-camera frame-source mode for the runner (P2c)");
10622
+ /**
9808
10623
  * Camera assignment payload sent by `addon-pipeline-orchestrator` to a
9809
10624
  * specific runner instance via `attachCamera`. Carries everything the
9810
10625
  * runner needs to subscribe to the local broker and execute inference.
@@ -9902,7 +10717,15 @@ var RunnerCameraConfigSchema = object({
9902
10717
  */
9903
10718
  onboardMotionDrivesAnalyzer: boolean().default(true),
9904
10719
  occupancyRecheckSec: number().min(occupancyRecheckSecField.min).max(occupancyRecheckSecField.max).default(occupancyRecheckSecField.default),
9905
- occupancyRecheckFrames: number().min(occupancyRecheckFramesField.min).max(occupancyRecheckFramesField.max).default(occupancyRecheckFramesField.default)
10720
+ occupancyRecheckFrames: number().min(occupancyRecheckFramesField.min).max(occupancyRecheckFramesField.max).default(occupancyRecheckFramesField.default),
10721
+ /**
10722
+ * Where this runner gets the camera's decoded frames (P2c). Defaulted so
10723
+ * every existing payload behaves as `local-broker` — the pre-Phase-2 path.
10724
+ * Populated with `remote-restream` by the orchestrator ONLY when the
10725
+ * camera's detect node differs from its source-owner (P2d, gated by the
10726
+ * `remoteSourcingNodes` rollout setting).
10727
+ */
10728
+ frameSource: RunnerFrameSourceSchema.default({ kind: "local-broker" })
9906
10729
  });
9907
10730
  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;
9908
10731
  /**
@@ -10267,6 +11090,113 @@ object({
10267
11090
  lastFetchedAt: number()
10268
11091
  });
10269
11092
  DeviceType.Sensor;
11093
+ /**
11094
+ * Feeder connectivity / power status — mirrors the HA petkit device-status
11095
+ * enum: `normal` (online, mains), `offline` (not reaching PetKit cloud),
11096
+ * `on_batteries` (running on battery backup). `null` until first reported.
11097
+ */
11098
+ var PetFeederDeviceStatusSchema = _enum([
11099
+ "normal",
11100
+ "offline",
11101
+ "on_batteries"
11102
+ ]);
11103
+ var gramsPortion = number().int().min(4).max(200);
11104
+ object({
11105
+ /** Food currently in the bowl (grams). Null when the device has not
11106
+ * reported a reading yet. On dual-hopper models this is the combined
11107
+ * bowl reading; per-hopper levels live in `food1`/`food2`. */
11108
+ foodLevel: number().nullable(),
11109
+ /** Hopper-1 food level (grams) on dual-hopper feeders; null on
11110
+ * single-hopper models. */
11111
+ food1: number().nullable(),
11112
+ /** Hopper-2 food level (grams) on dual-hopper feeders; null on
11113
+ * single-hopper models. */
11114
+ food2: number().nullable(),
11115
+ /** Derived low-food flag — mirrors the HA `food_level` binary_sensor
11116
+ * (`device_class: problem`, on = low). True when the bowl is empty /
11117
+ * below the feeder's low threshold. */
11118
+ lowFood: boolean(),
11119
+ /** Battery charge 0..100 (%). Null on mains-powered models or when the
11120
+ * device has no battery reading. */
11121
+ batteryPower: number().min(0).max(100).nullable(),
11122
+ /** Days of desiccant life remaining. Null when the model has no
11123
+ * desiccant sensor. */
11124
+ desiccantLeftDays: number().nullable(),
11125
+ /** True while a feed is in progress. */
11126
+ feeding: boolean(),
11127
+ /** Decoded connectivity / power status (HA petkit device-status enum).
11128
+ * Null until the device has reported a status. */
11129
+ status: PetFeederDeviceStatusSchema.nullable(),
11130
+ /** Decoded human-readable fault message. Null (or the device's `no_error`
11131
+ * sentinel) means healthy; a non-null string is an active fault. Pairs
11132
+ * with `errorCode` for consumers that want the raw integer. */
11133
+ error: string().nullable(),
11134
+ /** Raw device error code (0 / null = no error). */
11135
+ errorCode: number().nullable(),
11136
+ /** True for D4S/D4SH dual-hopper hardware — gates the per-hopper UI. */
11137
+ isDualHopper: boolean(),
11138
+ /** Child-lock (manual-lock) setting — buttons on the unit are disabled. */
11139
+ childLock: boolean(),
11140
+ /** Front indicator-light setting. */
11141
+ indicatorLight: boolean(),
11142
+ /** Play a chime when dispensing. */
11143
+ feedSound: boolean(),
11144
+ /** Speaker / prompt volume level (device-scaled integer). */
11145
+ volume: number(),
11146
+ /** Ms epoch when the slice was last refreshed from the cloud. */
11147
+ lastFetchedAt: number()
11148
+ });
11149
+ DeviceType.PetFeeder, method(object({
11150
+ deviceId: number().int().nonnegative(),
11151
+ grams: gramsPortion.optional(),
11152
+ hopper1: gramsPortion.optional(),
11153
+ hopper2: gramsPortion.optional()
11154
+ }), _void(), {
11155
+ kind: "mutation",
11156
+ auth: "admin"
11157
+ }), method(object({ deviceId: number().int().nonnegative() }), _void(), {
11158
+ kind: "mutation",
11159
+ auth: "admin"
11160
+ }), method(object({ deviceId: number().int().nonnegative() }), _void(), {
11161
+ kind: "mutation",
11162
+ auth: "admin"
11163
+ }), method(object({ deviceId: number().int().nonnegative() }), _void(), {
11164
+ kind: "mutation",
11165
+ auth: "admin"
11166
+ }), method(object({ deviceId: number().int().nonnegative() }), _void(), {
11167
+ kind: "mutation",
11168
+ auth: "admin"
11169
+ }), method(object({
11170
+ deviceId: number().int().nonnegative(),
11171
+ soundId: number().int().nonnegative()
11172
+ }), _void(), {
11173
+ kind: "mutation",
11174
+ auth: "admin"
11175
+ }), method(object({
11176
+ deviceId: number().int().nonnegative(),
11177
+ on: boolean()
11178
+ }), _void(), {
11179
+ kind: "mutation",
11180
+ auth: "admin"
11181
+ }), method(object({
11182
+ deviceId: number().int().nonnegative(),
11183
+ on: boolean()
11184
+ }), _void(), {
11185
+ kind: "mutation",
11186
+ auth: "admin"
11187
+ }), method(object({
11188
+ deviceId: number().int().nonnegative(),
11189
+ on: boolean()
11190
+ }), _void(), {
11191
+ kind: "mutation",
11192
+ auth: "admin"
11193
+ }), method(object({
11194
+ deviceId: number().int().nonnegative(),
11195
+ level: number().int().nonnegative()
11196
+ }), _void(), {
11197
+ kind: "mutation",
11198
+ auth: "admin"
11199
+ });
10270
11200
  object({
10271
11201
  /** Instantaneous power draw in watts. */
10272
11202
  watts: number().optional(),
@@ -12143,10 +13073,12 @@ method(object({ codec: string() }), boolean()), method(_void(), object({
12143
13073
  url: string()
12144
13074
  }), _void()), method(object({
12145
13075
  sessionId: string(),
12146
- maxCount: number().default(1)
13076
+ maxCount: number().default(1),
13077
+ waitMs: number().optional()
12147
13078
  }), array(DecodedFrameSchema)), method(object({
12148
13079
  sessionId: string(),
12149
- maxCount: number().default(1)
13080
+ maxCount: number().default(1),
13081
+ waitMs: number().optional()
12150
13082
  }), array(FrameHandleSchema)), method(object({ handle: FrameHandleSchema }), DecodedFrameSchema.nullable()), method(object({ sessionId: string() }), ShmRingStatsSchema.nullable()), method(object({
12151
13083
  sessionId: string(),
12152
13084
  config: DecoderSessionConfigSchema.partial()
@@ -12433,14 +13365,63 @@ var ChildLayoutEntrySchema = object({
12433
13365
  collapsed: boolean().optional()
12434
13366
  });
12435
13367
  /** Cap-wire shape of a DeviceLink — structurally mirrors `DeviceLink` in
12436
- * `device-management.ts`. */
13368
+ * `device-management.ts`. Source is a union: a FIELD source copies a sibling
13369
+ * accessory's status field (`kind` optional/absent for wire compat); a
13370
+ * LITERAL source carries a per-device constant (no sibling is read); a
13371
+ * GLOBAL source (P2e) copies ANY device's status field, addressed by the
13372
+ * source device's full re-sync-stable `stableId`. */
13373
+ var DeviceLinkFieldSourceSchema = object({
13374
+ kind: literal("field").optional(),
13375
+ sourceKey: string(),
13376
+ cap: string(),
13377
+ fieldPath: string()
13378
+ });
13379
+ var DeviceLinkLiteralSourceSchema = object({
13380
+ kind: literal("literal"),
13381
+ value: union([
13382
+ string(),
13383
+ number(),
13384
+ boolean(),
13385
+ _null()
13386
+ ])
13387
+ });
13388
+ var DeviceLinkGlobalSourceSchema = object({
13389
+ kind: literal("global"),
13390
+ sourceStableId: string(),
13391
+ cap: string(),
13392
+ fieldPath: string()
13393
+ });
13394
+ /** Expression source (Stage X): compute the target field from N named bindings
13395
+ * via the safe expression engine. Bindings are field | literal | global — never
13396
+ * another expression (no nesting). The `superRefine` runs the SAME author-time
13397
+ * validation as `validateExpressionSource` (compiles the expr, checks binding
13398
+ * names + identifier coverage) so every wire boundary that parses a DeviceLink
13399
+ * (tRPC mount, kernel create pre-seed, projection output) validates-at-write.
13400
+ * Compiles are LRU-cached, so repeated validation of the same expr is a hit. */
13401
+ var DeviceLinkExpressionSourceSchema = object({
13402
+ kind: literal("expression"),
13403
+ expr: string().min(1).max(MAX_EXPRESSION_SOURCE_LENGTH),
13404
+ bindings: record(string().regex(EXPRESSION_IDENTIFIER_RE), union([
13405
+ DeviceLinkFieldSourceSchema,
13406
+ DeviceLinkLiteralSourceSchema,
13407
+ DeviceLinkGlobalSourceSchema
13408
+ ]))
13409
+ }).superRefine((src, ctx) => {
13410
+ const err = validateExpressionSource(src);
13411
+ if (err !== null) ctx.addIssue({
13412
+ code: "custom",
13413
+ message: err,
13414
+ path: ["expr"]
13415
+ });
13416
+ });
12437
13417
  var DeviceLinkSchema = object({
12438
13418
  id: string(),
12439
- source: object({
12440
- sourceKey: string(),
12441
- cap: string(),
12442
- fieldPath: string()
12443
- }),
13419
+ source: union([
13420
+ DeviceLinkFieldSourceSchema,
13421
+ DeviceLinkLiteralSourceSchema,
13422
+ DeviceLinkGlobalSourceSchema,
13423
+ DeviceLinkExpressionSourceSchema
13424
+ ]),
12444
13425
  target: object({
12445
13426
  cap: string(),
12446
13427
  fieldPath: string(),
@@ -12469,6 +13450,31 @@ var DeviceLinkSchema = object({
12469
13450
  })
12470
13451
  ]).optional()
12471
13452
  });
13453
+ /** Cap-wire shape of a per-cap display refinement — mirrors
13454
+ * `DeviceCapDisplayOverride` in `device-management.ts`. */
13455
+ var DeviceCapDisplayOverrideSchema = object({
13456
+ unit: string().min(1).optional(),
13457
+ precision: number().int().min(0).max(10).optional()
13458
+ });
13459
+ /** Cap-wire shape of an operator-authored per-device display override —
13460
+ * mirrors `DeviceDisplayOverride` in `device-management.ts`. `precision`
13461
+ * bounds mirror `numeric-sensor.cap.ts` (`int 0-10`). */
13462
+ var DeviceDisplayOverrideSchema = object({
13463
+ icon: string().min(1).optional(),
13464
+ label: string().min(1).optional(),
13465
+ unit: string().min(1).optional(),
13466
+ precision: number().int().min(0).max(10).optional(),
13467
+ hidden: boolean().optional(),
13468
+ perCap: record(string(), DeviceCapDisplayOverrideSchema).optional()
13469
+ });
13470
+ /** Cap-wire shape of a per-role display default — mirrors `RoleDisplayDefault`
13471
+ * in `device-management.ts`. Keyed by `DeviceRole` string (role strings cross
13472
+ * the wire as plain strings everywhere else — cf. `DeviceInfoSchema.role`). */
13473
+ var RoleDisplayDefaultSchema = object({
13474
+ unit: string().min(1).optional(),
13475
+ precision: number().int().min(0).max(10).optional(),
13476
+ icon: string().min(1).optional()
13477
+ });
12472
13478
  /**
12473
13479
  * Serializable projection of a live IDevice.
12474
13480
  * Returned by listAll, getDevice, getChildren.
@@ -12524,7 +13530,9 @@ var DeviceInfoSchema = object({
12524
13530
  * `DeviceMeta.childLayout`. Absent ⇒ no layout declared. */
12525
13531
  childLayout: array(ChildLayoutEntrySchema).readonly().optional(),
12526
13532
  /** Operator-authored cross-device field wirings. See `DeviceMeta.deviceLinks`. */
12527
- deviceLinks: array(DeviceLinkSchema).readonly().optional()
13533
+ deviceLinks: array(DeviceLinkSchema).readonly().optional(),
13534
+ /** Operator-authored per-device display override. See `DeviceMeta.display`. */
13535
+ display: DeviceDisplayOverrideSchema.optional()
12528
13536
  });
12529
13537
  var ConfigEntrySchema = object({
12530
13538
  key: string(),
@@ -12589,7 +13597,9 @@ var DeviceMetaSchema = object({
12589
13597
  deviceLinks: array(DeviceLinkSchema).readonly().optional(),
12590
13598
  /** Semantic role string (`DeviceRole`) — propagated from the spawn pre-seed.
12591
13599
  * Optional: only present for accessory children that carry a known role. */
12592
- role: string().nullable().optional()
13600
+ role: string().nullable().optional(),
13601
+ /** Operator-authored per-device display override. See `DeviceMeta.display`. */
13602
+ display: DeviceDisplayOverrideSchema.optional()
12593
13603
  });
12594
13604
  /** ConfigUISchema passed through as unknown — mirrors device-provider's CreationSchemaOutputSchema */
12595
13605
  var ConfigUISchemaOutput = unknown().nullable();
@@ -12683,7 +13693,19 @@ method(object({
12683
13693
  }), _void(), {
12684
13694
  kind: "mutation",
12685
13695
  auth: "admin"
12686
- }), method(object({ deviceId: number() }), object({ caps: array(object({
13696
+ }), method(object({
13697
+ deviceId: number(),
13698
+ display: DeviceDisplayOverrideSchema.nullable()
13699
+ }), _void(), {
13700
+ kind: "mutation",
13701
+ auth: "admin"
13702
+ }), method(object({}), object({ defaults: record(string(), RoleDisplayDefaultSchema) }), { kind: "query" }), method(object({ defaults: record(string(), RoleDisplayDefaultSchema) }), _void(), {
13703
+ kind: "mutation",
13704
+ auth: "admin"
13705
+ }), method(object({
13706
+ deviceId: number(),
13707
+ includeSynthesizable: boolean().optional()
13708
+ }), object({ caps: array(object({
12687
13709
  cap: string(),
12688
13710
  fields: array(object({
12689
13711
  path: string(),
@@ -12693,8 +13715,13 @@ method(object({
12693
13715
  "boolean",
12694
13716
  "enum"
12695
13717
  ]),
12696
- enumValues: array(string()).optional()
12697
- })).readonly()
13718
+ enumValues: array(string()).optional(),
13719
+ item: boolean().optional()
13720
+ })).readonly(),
13721
+ itemArray: object({
13722
+ path: string(),
13723
+ keyField: string()
13724
+ }).optional()
12698
13725
  })).readonly() }), { kind: "query" }), method(object({
12699
13726
  deviceId: number(),
12700
13727
  role: string().nullable()
@@ -12764,7 +13791,11 @@ method(object({
12764
13791
  deviceId: number(),
12765
13792
  entries: array(object({
12766
13793
  capName: string(),
12767
- kind: _enum(["native", "wrapped"]),
13794
+ kind: _enum([
13795
+ "native",
13796
+ "wrapped",
13797
+ "linked"
13798
+ ]),
12768
13799
  providerAddonId: string(),
12769
13800
  providerNodeId: string(),
12770
13801
  nativeAddonId: string()
@@ -12773,7 +13804,11 @@ method(object({
12773
13804
  deviceId: number(),
12774
13805
  entries: array(object({
12775
13806
  capName: string(),
12776
- kind: _enum(["native", "wrapped"]),
13807
+ kind: _enum([
13808
+ "native",
13809
+ "wrapped",
13810
+ "linked"
13811
+ ]),
12777
13812
  providerAddonId: string(),
12778
13813
  providerNodeId: string(),
12779
13814
  nativeAddonId: string()
@@ -13263,7 +14298,7 @@ var AddBrokerInputSchema = object({
13263
14298
  });
13264
14299
  var AddBrokerResultSchema = object({ id: string() });
13265
14300
  var IdInputSchema = object({ id: string() });
13266
- var TestResultSchema = discriminatedUnion("ok", [object({
14301
+ var TestResultSchema$1 = discriminatedUnion("ok", [object({
13267
14302
  ok: literal(true),
13268
14303
  latencyMs: number()
13269
14304
  }), object({
@@ -13300,7 +14335,7 @@ var mqttBrokerCapability = {
13300
14335
  getBrokerConfig: method(IdInputSchema, BrokerConnectionDetailsSchema),
13301
14336
  addBroker: method(AddBrokerInputSchema, AddBrokerResultSchema, { kind: "mutation" }),
13302
14337
  removeBroker: method(IdInputSchema, _void(), { kind: "mutation" }),
13303
- testConnection: method(IdInputSchema, TestResultSchema, { kind: "mutation" }),
14338
+ testConnection: method(IdInputSchema, TestResultSchema$1, { kind: "mutation" }),
13304
14339
  startEmbeddedBroker: method(StartEmbeddedInputSchema, StartEmbeddedResultSchema, { kind: "mutation" }),
13305
14340
  stopEmbeddedBroker: method(IdInputSchema, _void(), { kind: "mutation" }),
13306
14341
  getStatus: method(_void(), StatusSchema)
@@ -13339,23 +14374,198 @@ var NetworkEndpointEntrySchema = NetworkEndpointSchema.extend({
13339
14374
  sourcePort: number().optional()
13340
14375
  });
13341
14376
  method(_void(), NetworkEndpointSchema, { kind: "mutation" }), method(_void(), _void(), { kind: "mutation" }), method(_void(), NetworkEndpointSchema.nullable()), method(_void(), NetworkAccessStatusSchema), method(_void(), array(NetworkEndpointEntrySchema).readonly());
13342
- method(object({
13343
- title: string(),
14377
+ /**
14378
+ * notification-output — canonical, capability-gated notification delivery.
14379
+ *
14380
+ * Apprise-derived model (see
14381
+ * `docs/superpowers/specs/2026-07-03-notification-output-notifier-matrix.md`):
14382
+ * callers emit ONE canonical `Notification`; each provider declares a
14383
+ * per-kind capability descriptor (`TargetKind`), and the pure degrade
14384
+ * engine (`@camstack/types` `prepareNotification`) transcodes / degrades the
14385
+ * message to what the kind supports — callers never special-case a service.
14386
+ *
14387
+ * DESIGN DECISIONS (locked):
14388
+ * - Target CRUD lives on THIS cap (`upsertTarget` / `deleteTarget` /
14389
+ * `setTargetEnabled`), each provider persisting via the `settings-store`
14390
+ * cap. Rationale: the admin UI needs one uniform surface across the
14391
+ * notifiers addon AND the HA addon; the addon-`globalSettingsSchema`-array
14392
+ * alternative would fork the UI per addon and cannot host the
14393
+ * discovery→adopt flow.
14394
+ * - `listTargetKinds` / `listTargets` / `discoverTargets` return arrays →
14395
+ * the generated cap-mount auto-`concatCollection`-fans them across every
14396
+ * registered provider (notifiers addon + HA addon) so one catalog is
14397
+ * routable. `send` / `testTarget` / CRUD route to ONE provider by the
14398
+ * `addonId` the generated collection router extracts from the call input.
14399
+ * - `Attachment.bytes` is `Uint8Array`. Transport-safe: superjson (the tRPC
14400
+ * transformer) + UDS MsgPack both round-trip typed arrays — already used by
14401
+ * `storage` / `storage-provider` / `recording` caps over the same path. No
14402
+ * base64 fallback needed.
14403
+ *
14404
+ * TODO (deferred, closed-set change — separate decision): add
14405
+ * `providerKind: 'notify'` so notification providers surface on the unified
14406
+ * admin "Integrations" page.
14407
+ */
14408
+ /**
14409
+ * Zentik-derived typed-media enum — the superset across every kind. Each
14410
+ * adapter picks what it supports and the degrade engine filters the rest.
14411
+ */
14412
+ var AttachmentMediaTypeSchema = _enum([
14413
+ "image",
14414
+ "video",
14415
+ "gif",
14416
+ "audio",
14417
+ "icon"
14418
+ ]);
14419
+ /**
14420
+ * A single attachment. Exactly one of `url` (remote source, most adapters
14421
+ * prefer this) or `bytes` (inline source; required for Pushover-style
14422
+ * bytes-only kinds) MUST be present — the degrade engine expresses a
14423
+ * url→bytes fetch as a `needsFetch` directive the adapter executes.
14424
+ */
14425
+ var AttachmentSchema = object({
14426
+ mediaType: AttachmentMediaTypeSchema,
14427
+ url: string().optional(),
14428
+ bytes: _instanceof(Uint8Array).optional(),
14429
+ mime: string().optional(),
14430
+ name: string().optional()
14431
+ }).refine((a) => a.url !== void 0 || a.bytes !== void 0, { message: "Attachment requires either `url` or `bytes`" });
14432
+ var NotificationFormatSchema = _enum([
14433
+ "text",
14434
+ "markdown",
14435
+ "html"
14436
+ ]);
14437
+ /** A single tap-through action button. */
14438
+ var NotificationActionSchema = object({
14439
+ id: string(),
14440
+ label: string(),
14441
+ url: string().optional()
14442
+ });
14443
+ /**
14444
+ * The canonical notification. `body` is the only hard field (Apprise model).
14445
+ * `priority` is a 5-level ORDINAL (1=lowest … 3=normal(default) … 5=urgent),
14446
+ * NOT a fixed severity enum — each kind declares its own `caps.levels` and
14447
+ * the adapter maps this ordinal onto its native level. `level?` is an
14448
+ * optional kind-native level id (`emergency`, `silent`, …) that overrides
14449
+ * `priority` for that one target.
14450
+ */
14451
+ var NotificationSchema = object({
13344
14452
  body: string(),
13345
- imageUrl: string().optional(),
14453
+ title: string().optional(),
14454
+ format: NotificationFormatSchema.default("text"),
14455
+ priority: number().int().min(1).max(5).default(3),
14456
+ level: string().optional(),
14457
+ attachments: array(AttachmentSchema).optional(),
14458
+ clickUrl: string().optional(),
14459
+ actions: array(NotificationActionSchema).optional(),
14460
+ sound: string().optional(),
14461
+ ttl: number().optional(),
14462
+ tag: string().optional(),
13346
14463
  deviceId: number().optional(),
13347
14464
  eventId: string().optional(),
13348
- priority: _enum([
13349
- "low",
13350
- "normal",
13351
- "high",
13352
- "critical"
13353
- ]).default("normal"),
13354
14465
  metadata: record(string(), unknown()).optional()
13355
- }), _void(), { kind: "mutation" }), method(_void(), object({
14466
+ });
14467
+ /** One declared native severity/priority level for a kind. */
14468
+ var TargetKindLevelSchema = object({
14469
+ id: string(),
14470
+ label: string(),
14471
+ /** Which canonical priority (1..5) this level maps to. `null` = qualitative-only. */
14472
+ ordinal: number().int().min(1).max(5).nullable(),
14473
+ flags: object({
14474
+ critical: boolean().optional(),
14475
+ silent: boolean().optional(),
14476
+ noPush: boolean().optional()
14477
+ }).optional(),
14478
+ /** e.g. Pushover `emergency` requires `retry` / `expire`. */
14479
+ requires: array(string()).optional(),
14480
+ description: string().optional()
14481
+ });
14482
+ /** The full capability block consulted before dispatch. */
14483
+ var TargetKindCapsSchema = object({
14484
+ attachments: object({
14485
+ mediaTypes: array(AttachmentMediaTypeSchema),
14486
+ mode: _enum([
14487
+ "url",
14488
+ "bytes",
14489
+ "both"
14490
+ ]),
14491
+ max: number().int().nonnegative(),
14492
+ maxBytes: number().int().positive().optional()
14493
+ }),
14494
+ /** Max action buttons (0 = none). */
14495
+ actions: number().int().nonnegative(),
14496
+ levels: array(TargetKindLevelSchema),
14497
+ format: array(NotificationFormatSchema),
14498
+ clickUrl: boolean(),
14499
+ sound: boolean(),
14500
+ ttl: boolean(),
14501
+ bodyMaxLen: number().int().positive()
14502
+ });
14503
+ /**
14504
+ * `configSchema` is a `ConfigUISchema` tree passed through to the admin
14505
+ * FormBuilder. Stored as `z.unknown()` at the cap seam (mirrors
14506
+ * `device-provider.getChildCreationSchema` `CreationSchemaOutputSchema`) —
14507
+ * the union is large and not meant for runtime validation here; the exported
14508
+ * `TargetKind` type re-tightens `configSchema` to `ConfigUISchema`.
14509
+ */
14510
+ var ConfigSchemaPassthrough = unknown();
14511
+ var TargetKindSchema = object({
14512
+ kind: string(),
14513
+ label: string(),
14514
+ icon: string(),
14515
+ /** Stamped by each provider so the concat-fanned catalog stays routable. */
14516
+ addonId: string(),
14517
+ configSchema: ConfigSchemaPassthrough,
14518
+ supportsDiscovery: boolean(),
14519
+ caps: TargetKindCapsSchema
14520
+ });
14521
+ /**
14522
+ * A persisted target. `config` holds secrets; providers REDACT secret fields
14523
+ * (return a presence marker only) when serving `listTargets` — never
14524
+ * round-trip a stored secret to the UI.
14525
+ */
14526
+ var TargetSchema = object({
14527
+ id: string(),
14528
+ name: string(),
14529
+ kind: string(),
14530
+ addonId: string(),
14531
+ enabled: boolean(),
14532
+ config: record(string(), unknown())
14533
+ });
14534
+ /** A discovery-surfaced candidate (config is partial + non-secret). */
14535
+ var DiscoveredTargetSchema = object({
14536
+ kind: string(),
14537
+ suggestedName: string(),
14538
+ config: record(string(), unknown())
14539
+ });
14540
+ /** The degrade engine's report — what was resolved / dropped / degraded. */
14541
+ var RenderedAsSchema = object({
14542
+ level: string(),
14543
+ format: NotificationFormatSchema,
14544
+ attachmentsSent: number().int().nonnegative(),
14545
+ actionsSent: number().int().nonnegative(),
14546
+ truncated: boolean(),
14547
+ dropped: array(string())
14548
+ });
14549
+ var SendResultSchema = object({
13356
14550
  success: boolean(),
13357
- error: string().optional()
13358
- }), { kind: "mutation" });
14551
+ error: string().optional(),
14552
+ renderedAs: RenderedAsSchema.optional()
14553
+ });
14554
+ /** Same shape as SendResult — kept as a distinct name for the test panel. */
14555
+ var TestResultSchema = SendResultSchema;
14556
+ method(object({}), array(TargetKindSchema)), method(object({}), array(TargetSchema)), method(object({
14557
+ kind: string(),
14558
+ config: record(string(), unknown()).optional()
14559
+ }), array(DiscoveredTargetSchema)), method(object({
14560
+ targetId: string(),
14561
+ notification: NotificationSchema
14562
+ }), SendResultSchema, { kind: "mutation" }), method(object({
14563
+ targetId: string(),
14564
+ sample: NotificationSchema.optional()
14565
+ }), TestResultSchema, { kind: "mutation" }), method(object({ target: TargetSchema }), TargetSchema, { kind: "mutation" }), method(object({ targetId: string() }), _void(), { kind: "mutation" }), method(object({
14566
+ targetId: string(),
14567
+ enabled: boolean()
14568
+ }), _void(), { kind: "mutation" });
13359
14569
  /**
13360
14570
  * Zod schemas for persisted record types.
13361
14571
  *
@@ -16377,7 +17587,10 @@ var HwAccelBackendInputSchema = _enum([
16377
17587
  "webgpu",
16378
17588
  "none"
16379
17589
  ]).nullable().optional();
16380
- var HwAccelResolutionSchema = object({ preferred: array(string()).readonly() });
17590
+ var HwAccelResolutionSchema = object({
17591
+ preferred: array(string()).readonly(),
17592
+ rationale: string()
17593
+ });
16381
17594
  var HardwareEncoderIdSchema = _enum([
16382
17595
  "h264_videotoolbox",
16383
17596
  "hevc_videotoolbox",
@@ -16482,10 +17695,7 @@ var ResolvedInferenceConfigSchema = object({
16482
17695
  format: ModelFormatSchema,
16483
17696
  reason: string()
16484
17697
  });
16485
- method(_void(), PlatformCapabilitiesSchema), method(_void(), HardwareInfoSchema), method(object({ requirements: array(ModelRequirementSchema).readonly() }), ResolvedInferenceConfigSchema), method(object({
16486
- prefer: HwAccelBackendInputSchema,
16487
- nodeId: string().optional()
16488
- }), HwAccelResolutionSchema), method(_void(), HardwareEncodersSchema), method(_void(), HardwareEncodersSchema, {
17698
+ method(_void(), PlatformCapabilitiesSchema), method(_void(), HardwareInfoSchema), method(object({ requirements: array(ModelRequirementSchema).readonly() }), ResolvedInferenceConfigSchema), method(object({ prefer: HwAccelBackendInputSchema }), HwAccelResolutionSchema), method(_void(), HardwareEncodersSchema), method(_void(), HardwareEncodersSchema, {
16489
17699
  kind: "mutation",
16490
17700
  auth: "admin"
16491
17701
  }), method(_void(), HardwareDecodeAccelsSchema), method(_void(), HardwareDecodeAccelsSchema, {
@@ -16544,6 +17754,16 @@ DeviceType.Camera, DeviceType.Sensor, DeviceType.Switch, method(object({ deviceI
16544
17754
  kind: "mutation",
16545
17755
  auth: "admin"
16546
17756
  });
17757
+ /**
17758
+ * `recording` cap — footage availability + HLS playback manifests + per-device
17759
+ * recording config. NOTE on events (source of truth, R5/C3): this cap carries
17760
+ * NO event surface — `getPlaybackManifest` returns playlist URLs only. Timeline
17761
+ * events (motion/object/audio) come from `pipelineAnalytics` (durable SQLite
17762
+ * rows); the recorder's internal EventMap markers are ephemeral in-RAM
17763
+ * annotations that are not exposed here and must not be treated as an event
17764
+ * feed. Event<->footage joins are by time, padded with the shared `EVENT_PAD_MS`
17765
+ * (`interfaces/recording-config.ts`).
17766
+ */
16547
17767
  var RecordingStatusSchema = object({
16548
17768
  deviceId: number(),
16549
17769
  enabled: boolean(),
@@ -18180,6 +19400,12 @@ Object.freeze({
18180
19400
  addonId: null,
18181
19401
  access: "view"
18182
19402
  },
19403
+ "deviceManager.getRoleDisplayDefaults": {
19404
+ capName: "device-manager",
19405
+ capScope: "system",
19406
+ addonId: null,
19407
+ access: "view"
19408
+ },
18183
19409
  "deviceManager.getSettingsSchema": {
18184
19410
  capName: "device-manager",
18185
19411
  capScope: "system",
@@ -18330,6 +19556,12 @@ Object.freeze({
18330
19556
  addonId: null,
18331
19557
  access: "create"
18332
19558
  },
19559
+ "deviceManager.setDisplay": {
19560
+ capName: "device-manager",
19561
+ capScope: "system",
19562
+ addonId: null,
19563
+ access: "create"
19564
+ },
18333
19565
  "deviceManager.setIntegrationId": {
18334
19566
  capName: "device-manager",
18335
19567
  capScope: "system",
@@ -18372,6 +19604,12 @@ Object.freeze({
18372
19604
  addonId: null,
18373
19605
  access: "create"
18374
19606
  },
19607
+ "deviceManager.setRoleDisplayDefaults": {
19608
+ capName: "device-manager",
19609
+ capScope: "system",
19610
+ addonId: null,
19611
+ access: "create"
19612
+ },
18375
19613
  "deviceManager.setStreamProfileMap": {
18376
19614
  capName: "device-manager",
18377
19615
  capScope: "system",
@@ -19350,13 +20588,49 @@ Object.freeze({
19350
20588
  addonId: null,
19351
20589
  access: "create"
19352
20590
  },
20591
+ "notificationOutput.deleteTarget": {
20592
+ capName: "notification-output",
20593
+ capScope: "system",
20594
+ addonId: null,
20595
+ access: "delete"
20596
+ },
20597
+ "notificationOutput.discoverTargets": {
20598
+ capName: "notification-output",
20599
+ capScope: "system",
20600
+ addonId: null,
20601
+ access: "view"
20602
+ },
20603
+ "notificationOutput.listTargetKinds": {
20604
+ capName: "notification-output",
20605
+ capScope: "system",
20606
+ addonId: null,
20607
+ access: "view"
20608
+ },
20609
+ "notificationOutput.listTargets": {
20610
+ capName: "notification-output",
20611
+ capScope: "system",
20612
+ addonId: null,
20613
+ access: "view"
20614
+ },
19353
20615
  "notificationOutput.send": {
19354
20616
  capName: "notification-output",
19355
20617
  capScope: "system",
19356
20618
  addonId: null,
19357
20619
  access: "create"
19358
20620
  },
19359
- "notificationOutput.sendTest": {
20621
+ "notificationOutput.setTargetEnabled": {
20622
+ capName: "notification-output",
20623
+ capScope: "system",
20624
+ addonId: null,
20625
+ access: "create"
20626
+ },
20627
+ "notificationOutput.testTarget": {
20628
+ capName: "notification-output",
20629
+ capScope: "system",
20630
+ addonId: null,
20631
+ access: "create"
20632
+ },
20633
+ "notificationOutput.upsertTarget": {
19360
20634
  capName: "notification-output",
19361
20635
  capScope: "system",
19362
20636
  addonId: null,
@@ -19386,6 +20660,66 @@ Object.freeze({
19386
20660
  addonId: null,
19387
20661
  access: "create"
19388
20662
  },
20663
+ "petFeeder.callPet": {
20664
+ capName: "pet-feeder",
20665
+ capScope: "device",
20666
+ addonId: null,
20667
+ access: "create"
20668
+ },
20669
+ "petFeeder.cancelFeed": {
20670
+ capName: "pet-feeder",
20671
+ capScope: "device",
20672
+ addonId: null,
20673
+ access: "create"
20674
+ },
20675
+ "petFeeder.feed": {
20676
+ capName: "pet-feeder",
20677
+ capScope: "device",
20678
+ addonId: null,
20679
+ access: "create"
20680
+ },
20681
+ "petFeeder.markFoodReplenished": {
20682
+ capName: "pet-feeder",
20683
+ capScope: "device",
20684
+ addonId: null,
20685
+ access: "create"
20686
+ },
20687
+ "petFeeder.playSound": {
20688
+ capName: "pet-feeder",
20689
+ capScope: "device",
20690
+ addonId: null,
20691
+ access: "create"
20692
+ },
20693
+ "petFeeder.resetDesiccant": {
20694
+ capName: "pet-feeder",
20695
+ capScope: "device",
20696
+ addonId: null,
20697
+ access: "delete"
20698
+ },
20699
+ "petFeeder.setChildLock": {
20700
+ capName: "pet-feeder",
20701
+ capScope: "device",
20702
+ addonId: null,
20703
+ access: "create"
20704
+ },
20705
+ "petFeeder.setFeedSound": {
20706
+ capName: "pet-feeder",
20707
+ capScope: "device",
20708
+ addonId: null,
20709
+ access: "create"
20710
+ },
20711
+ "petFeeder.setIndicatorLight": {
20712
+ capName: "pet-feeder",
20713
+ capScope: "device",
20714
+ addonId: null,
20715
+ access: "create"
20716
+ },
20717
+ "petFeeder.setVolume": {
20718
+ capName: "pet-feeder",
20719
+ capScope: "device",
20720
+ addonId: null,
20721
+ access: "create"
20722
+ },
19389
20723
  "pipelineAnalytics.clearTracks": {
19390
20724
  capName: "pipeline-analytics",
19391
20725
  capScope: "device",