@camstack/addon-mqtt-broker 1.1.13 → 1.1.15

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.
@@ -4668,7 +4668,7 @@ function _instanceof(cls, params = {}) {
4668
4668
  return inst;
4669
4669
  }
4670
4670
  //#endregion
4671
- //#region ../types/dist/sleep-C2M2zF7x.mjs
4671
+ //#region ../types/dist/sleep-BiDFW0E7.mjs
4672
4672
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
4673
4673
  EventCategory["SystemBoot"] = "system.boot";
4674
4674
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -5481,6 +5481,100 @@ function createDurableState(deps) {
5481
5481
  };
5482
5482
  }
5483
5483
  /**
5484
+ * Per-node scoping for the shared addon-settings blob.
5485
+ *
5486
+ * An addon's settings store is hub-central (the `addon-settings` cap is
5487
+ * hub-routed — the hub instance answers for every node), so fields whose
5488
+ * value is a NODE fact (decoder backend, engine pick, probed hardware
5489
+ * capabilities) persist under the node-scoped key `<key>@<nodeId>` inside
5490
+ * the single shared blob. The SCHEMA field key stays bare: the write path
5491
+ * ({@link scopePatch}) maps the bare field onto the target node's scoped
5492
+ * key; the read/hydrate path ({@link projectStore}) maps THIS node's value
5493
+ * back, so UI forms and `resolveConfig` only ever see the bare key.
5494
+ *
5495
+ * Fields opt in via the `perNode: true` schema marker on `ConfigFieldBase`
5496
+ * (`interfaces/config-ui.ts`); `BaseAddon` derives the key set from the
5497
+ * schema and routes reads/writes through these helpers.
5498
+ *
5499
+ * ## No bare-key fallback — deliberate
5500
+ *
5501
+ * {@link readNodeValue} reads the node-scoped key ONLY. A node with no
5502
+ * scoped key resolves to `undefined` so the field's schema `default` wins —
5503
+ * NEVER `store[base]` and never another node's value. A bare legacy key in
5504
+ * the store is invisible to every node, hub included, so one node's
5505
+ * selection can never leak onto another. (This generalizes the
5506
+ * `decoder-backend-keys.ts` semantics — the no-fallback variant — over an
5507
+ * arbitrary set of per-node field keys.)
5508
+ *
5509
+ * Pure functions only — no I/O, no imports beyond the language. This is a
5510
+ * LEAF module: import it via its deep path, never from the root barrel.
5511
+ */
5512
+ /**
5513
+ * Normalize a raw kernel node id to the bare node id used for scoping.
5514
+ * `localNodeId` can carry a `<node>/<addon>` suffix on forked child
5515
+ * processes; per-node settings are per-NODE, so strip the addon segment.
5516
+ * `undefined` / `null` / empty falls back to `'hub'`.
5517
+ */
5518
+ function normalizeNodeId(raw) {
5519
+ if (raw === void 0 || raw === null || raw === "") return "hub";
5520
+ const slashIdx = raw.indexOf("/");
5521
+ if (slashIdx < 0) return raw;
5522
+ const bare = raw.slice(0, slashIdx);
5523
+ return bare === "" ? "hub" : bare;
5524
+ }
5525
+ /** The node-scoped store key for a per-node field: `<base>@<nodeId>`. */
5526
+ function nodeScopedKey(base, nodeId) {
5527
+ return `${base}@${normalizeNodeId(nodeId)}`;
5528
+ }
5529
+ /**
5530
+ * Read a node's value for a per-node field from the raw shared store:
5531
+ * the node-scoped key when present, otherwise `undefined`.
5532
+ * Deliberately NO bare-key fallback (see module doc) — the caller lets the
5533
+ * schema `default` win on `undefined`.
5534
+ */
5535
+ function readNodeValue(store, base, nodeId) {
5536
+ return store[nodeScopedKey(base, nodeId)];
5537
+ }
5538
+ /**
5539
+ * Re-map a UI/settings patch so every bare perNode field persists under the
5540
+ * TARGET node's scoped key; all other keys pass through unchanged. Used on
5541
+ * the write path so a save for one node never clobbers another node's value
5542
+ * (and the bare key is never written). Returns a new object — the input
5543
+ * patch is not mutated.
5544
+ */
5545
+ function scopePatch(patch, perNodeKeys, nodeId) {
5546
+ const out = {};
5547
+ for (const [key, value] of Object.entries(patch)) out[perNodeKeys.has(key) ? nodeScopedKey(key, nodeId) : key] = value;
5548
+ return out;
5549
+ }
5550
+ /**
5551
+ * Project the raw shared store onto the bare schema keys for ONE node so a
5552
+ * UI schema (whose field keys are bare) hydrates from that node's own
5553
+ * values:
5554
+ *
5555
+ * - EVERY `@`-scoped key (any node's) is dropped from the pass-through.
5556
+ * - Every bare perNode key is dropped from the pass-through (a stray bare
5557
+ * legacy key must never hydrate any node — no bare fallback).
5558
+ * - THIS node's effective value ({@link readNodeValue}) is then laid onto
5559
+ * each bare perNode key; when the node has no scoped key the bare key is
5560
+ * left ABSENT so the field's schema `default` wins.
5561
+ *
5562
+ * Returns a new object — the input store is not mutated.
5563
+ */
5564
+ function projectStore(store, perNodeKeys, nodeId) {
5565
+ const out = {};
5566
+ for (const [key, value] of Object.entries(store)) {
5567
+ if (key.includes("@")) continue;
5568
+ if (perNodeKeys.has(key)) continue;
5569
+ out[key] = value;
5570
+ }
5571
+ for (const base of perNodeKeys) {
5572
+ const value = readNodeValue(store, base, nodeId);
5573
+ if (value !== void 0) out[base] = value;
5574
+ }
5575
+ return out;
5576
+ }
5577
+ /**
5484
5578
  * Base class for CamStack addons. Eliminates settings boilerplate:
5485
5579
  *
5486
5580
  * - Typed `config` property with automatic resolution from store + defaults
@@ -5648,23 +5742,63 @@ var BaseAddon = class {
5648
5742
  deviceSettingsSchema() {
5649
5743
  return null;
5650
5744
  }
5651
- async getGlobalSettings(overlay, cap, _nodeId) {
5745
+ async getGlobalSettings(overlay, cap, nodeId) {
5652
5746
  const schema = this.globalSettingsSchema(cap);
5653
5747
  if (!schema) return { sections: [] };
5654
- const raw = await this._ctx?.settings?.readAddonStore() ?? {};
5748
+ const projected = await this.resolveGlobalStore(nodeId, cap);
5655
5749
  return hydrateSchema(schema, overlay ? {
5656
- ...raw,
5750
+ ...projected,
5657
5751
  ...overlay
5658
- } : raw);
5752
+ } : projected);
5659
5753
  }
5660
- async updateGlobalSettings(patch, _nodeId) {
5661
- await this._ctx?.settings?.writeAddonStore(patch);
5754
+ /**
5755
+ * The raw addon store PROJECTED onto the target node's bare per-node keys:
5756
+ * every `perNode: true` field carries THAT node's scoped value on its bare
5757
+ * key (absent scoped key ⇒ key absent, so the schema `default` wins — no
5758
+ * bare fallback), all `@`-scoped and stray bare per-node keys are dropped.
5759
+ * A no-op passthrough when the schema declares no `perNode` field.
5760
+ *
5761
+ * This is the sanctioned way for a `getGlobalSettings` OVERRIDE that needs
5762
+ * the store for custom option logic (option narrowing, value snapping) to
5763
+ * read it per-node — never `ctx.settings.readAddonStore()` directly.
5764
+ * `nodeId` omitted ⇒ the local node (node-blind injection from ctx).
5765
+ */
5766
+ async resolveGlobalStore(nodeId, cap) {
5767
+ const raw = await this._ctx?.settings?.readAddonStore() ?? {};
5768
+ const keys = this.perNodeKeys(cap);
5769
+ const node = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
5770
+ return keys.size > 0 ? projectStore(raw, keys, node) : raw;
5771
+ }
5772
+ async updateGlobalSettings(patch, nodeId) {
5773
+ const keys = this.perNodeKeys();
5774
+ const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
5775
+ const target = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
5776
+ const barePatch = patch;
5777
+ const scoped = keys.size > 0 ? scopePatch(barePatch, keys, target) : barePatch;
5778
+ await this._ctx?.settings?.writeAddonStore(scoped);
5779
+ if (target !== localNode) return;
5662
5780
  await this.resolveConfig();
5663
5781
  await this.onConfigChanged();
5664
5782
  this.emitLifecycle(EventCategory.AddonUpdated, { level: "global" });
5665
5783
  this.maybeAutoRestart(patch, this.globalSettingsSchema());
5666
5784
  }
5667
5785
  /**
5786
+ * The set of field keys the global settings schema declares `perNode: true`
5787
+ * — derived once per `cap` argument and memoized (schemas are static
5788
+ * declarations). Empty set ⇒ every per-node code path is bypassed and the
5789
+ * settings API behaves exactly like the legacy node-agnostic one.
5790
+ */
5791
+ _perNodeKeysCache = /* @__PURE__ */ new Map();
5792
+ perNodeKeys(cap) {
5793
+ const cacheKey = cap ?? "";
5794
+ const cached = this._perNodeKeysCache.get(cacheKey);
5795
+ if (cached) return cached;
5796
+ const schema = this.globalSettingsSchema(cap);
5797
+ const keys = new Set(schema ? schema.sections.flatMap((section) => collectPerNodeFieldKeys(section.fields)) : []);
5798
+ this._perNodeKeysCache.set(cacheKey, keys);
5799
+ return keys;
5800
+ }
5801
+ /**
5668
5802
  * If any field in `patch` is marked `requiresRestart` in `schema`,
5669
5803
  * schedule an addon restart for the next tick. Deferred via
5670
5804
  * `setImmediate` so the tRPC mutation that triggered the write has
@@ -5817,12 +5951,19 @@ var BaseAddon = class {
5817
5951
  * The merge is shallow: each key in `defaults` is checked against the store.
5818
5952
  * Only keys present in defaults are read — the store can contain extra keys
5819
5953
  * (e.g. from older versions) without polluting the typed config.
5954
+ *
5955
+ * Keys the global settings schema declares `perNode: true` resolve from
5956
+ * THIS node's scoped key (`<key>@<localNode>`) via `readNodeValue` — never
5957
+ * from the bare key — so a per-node field resolves to this node's own
5958
+ * selection at boot (absent scoped key ⇒ the constructor default wins).
5820
5959
  */
5821
5960
  async resolveConfig() {
5822
5961
  const stored = await this.readAddonStoreWithRetry();
5962
+ const perNode = this.perNodeKeys();
5963
+ const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
5823
5964
  const resolved = { ...this.defaults };
5824
5965
  for (const key of Object.keys(this.defaults)) {
5825
- const storedValue = stored[key];
5966
+ const storedValue = perNode.has(key) ? readNodeValue(stored, key, localNode) : stored[key];
5826
5967
  if (storedValue !== void 0 && storedValue !== null) {
5827
5968
  const defaultType = typeof this.defaults[key];
5828
5969
  if (typeof storedValue === defaultType) resolved[key] = storedValue;
@@ -5906,6 +6047,27 @@ var BaseAddon = class {
5906
6047
  }
5907
6048
  };
5908
6049
  /**
6050
+ * Collect the keys of every field marked `perNode: true`, recursing into
6051
+ * layout containers (`group` fields and `sub-tabs` tabs) the same way
6052
+ * `hydrateSchema` does. Valueless structural fields (separator/info/…)
6053
+ * don't declare `perNode` and are excluded by the `in` narrowing.
6054
+ */
6055
+ function collectPerNodeFieldKeys(fields) {
6056
+ const collected = [];
6057
+ for (const field of fields) {
6058
+ if (field.type === "group") {
6059
+ collected.push(...collectPerNodeFieldKeys(field.fields));
6060
+ continue;
6061
+ }
6062
+ if (field.type === "sub-tabs") {
6063
+ for (const tab of field.tabs) collected.push(...collectPerNodeFieldKeys(tab.fields));
6064
+ continue;
6065
+ }
6066
+ if ("perNode" in field && field.perNode === true) collected.push(field.key);
6067
+ }
6068
+ return collected;
6069
+ }
6070
+ /**
5909
6071
  * Normalize an `ICamstackAddon.initialize()` return value into the
5910
6072
  * `AddonInitResult` envelope. Arrays are wrapped into `{ providers }`;
5911
6073
  * envelopes pass through; void stays void.
@@ -5930,6 +6092,7 @@ var CamStreamKindSchema = _enum([
5930
6092
  "pull-rtsp",
5931
6093
  "pull-rtmp",
5932
6094
  "pull-http",
6095
+ "pull-flv",
5933
6096
  "pull-rfc4571",
5934
6097
  "push-annexb",
5935
6098
  "derived"
@@ -6312,6 +6475,13 @@ var DeviceType = /* @__PURE__ */ function(DeviceType) {
6312
6475
  /** Single still-image entity (HA `image.*`). Read-only display of an
6313
6476
  * `entity_picture` signed URL the browser loads directly. `image` cap. */
6314
6477
  DeviceType["Image"] = "image";
6478
+ /** Smart pet feeder — cloud-connected food dispenser with a bowl food
6479
+ * level, battery, desiccant life, feeding state and manual-feed /
6480
+ * call-pet / maintenance actions. Installed with the `pet-feeder` cap;
6481
+ * dual-hopper models (D4S/D4SH) expose per-hopper portions. Sources:
6482
+ * native PetKit (`nodepetkit` `FeederDevice`), reusable by other feeder
6483
+ * integrations sharing the same food/desiccant/hopper surface. */
6484
+ DeviceType["PetFeeder"] = "pet-feeder";
6315
6485
  return DeviceType;
6316
6486
  }({});
6317
6487
  var DeviceFeature = /* @__PURE__ */ function(DeviceFeature) {
@@ -7460,6 +7630,601 @@ var _macroLookup = /* @__PURE__ */ new Map();
7460
7630
  for (const [k, v] of Object.entries(YAMNET_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
7461
7631
  for (const [k, v] of Object.entries(APPLE_SA_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
7462
7632
  /**
7633
+ * Error types for the safe expression engine. Two distinct classes so callers
7634
+ * can tell a compile-time (grammar) failure from a runtime (evaluation)
7635
+ * failure — both are non-fatal to the host: read paths degrade to "skip link".
7636
+ */
7637
+ /** Thrown by the tokenizer / parser. Carries a 0-based source `position` when
7638
+ * the failure is anchored to a character (author-facing inline feedback). */
7639
+ var ExpressionParseError = class extends Error {
7640
+ position;
7641
+ constructor(message, position) {
7642
+ super(message);
7643
+ this.name = "ExpressionParseError";
7644
+ this.position = position;
7645
+ }
7646
+ };
7647
+ /** Thrown by the evaluator (unknown identifier, type mismatch, non-finite
7648
+ * result, unknown builtin, step-budget exceeded). */
7649
+ var ExpressionEvalError = class extends Error {
7650
+ constructor(message) {
7651
+ super(message);
7652
+ this.name = "ExpressionEvalError";
7653
+ }
7654
+ };
7655
+ /**
7656
+ * Resource-bound constants for the safe expression engine.
7657
+ *
7658
+ * Every bound is defense-in-depth: the grammar is non-Turing-complete (no
7659
+ * loops, recursion, lambdas or member access — see `ast.ts`), so evaluation is
7660
+ * O(nodeCount) by construction. These caps merely put a hard ceiling on the
7661
+ * work a single author-supplied expression can request, so a hostile or
7662
+ * accidental pathological string can never spend unbounded CPU/memory.
7663
+ */
7664
+ /** Max source length (chars) — checked BEFORE tokenizing so a huge string is
7665
+ * rejected without allocation. */
7666
+ var MAX_EXPRESSION_SOURCE_LENGTH = 2048;
7667
+ /** A legal binding / identifier name. */
7668
+ var EXPRESSION_IDENTIFIER_RE = /^[A-Za-z_][A-Za-z0-9_]*$/;
7669
+ /** Binding names an author may NOT use: `now` is auto-injected; the literal
7670
+ * keywords lex as values, not identifiers, so binding to them is meaningless. */
7671
+ var RESERVED_BINDING_NAMES = new Set([
7672
+ "now",
7673
+ "true",
7674
+ "false",
7675
+ "null"
7676
+ ]);
7677
+ /**
7678
+ * Tokenizer for the safe expression mini-language. Hand-rolled, single-pass,
7679
+ * zero-dependency. The grammar is deliberately boring: decimal numbers,
7680
+ * single/double-quoted strings with a tiny escape set, identifiers, the three
7681
+ * value keywords (`true`/`false`/`null`) and a fixed punctuator set. Anything
7682
+ * outside that — a bare `.`, `=`, `[`, `]`, `{`, `}`, `;`, backtick, `&`, `|` —
7683
+ * is a parse error with a source position, so member access / assignment /
7684
+ * template literals are lexically impossible.
7685
+ */
7686
+ var KEYWORDS = new Set([
7687
+ "true",
7688
+ "false",
7689
+ "null"
7690
+ ]);
7691
+ function isDigit(ch) {
7692
+ return ch >= "0" && ch <= "9";
7693
+ }
7694
+ function isIdentStart(ch) {
7695
+ return ch >= "A" && ch <= "Z" || ch >= "a" && ch <= "z" || ch === "_";
7696
+ }
7697
+ function isIdentPart(ch) {
7698
+ return isIdentStart(ch) || isDigit(ch);
7699
+ }
7700
+ function isWhitespace(ch) {
7701
+ return ch === " " || ch === " " || ch === "\n" || ch === "\r" || ch === "\f" || ch === "\v";
7702
+ }
7703
+ /** Tokenize `source` into a flat token list ending with a single `eof` token.
7704
+ * Throws `ExpressionParseError` on any illegal character or unterminated
7705
+ * string. */
7706
+ function tokenize(source) {
7707
+ if (source.length > 2048) throw new ExpressionParseError(`expression too long (${source.length} > ${MAX_EXPRESSION_SOURCE_LENGTH} chars)`, 0);
7708
+ const tokens = [];
7709
+ let i = 0;
7710
+ const n = source.length;
7711
+ while (i < n) {
7712
+ const ch = source[i];
7713
+ if (isWhitespace(ch)) {
7714
+ i += 1;
7715
+ continue;
7716
+ }
7717
+ if (isDigit(ch)) {
7718
+ const start = i;
7719
+ while (i < n && isDigit(source[i])) i += 1;
7720
+ if (i < n && source[i] === ".") {
7721
+ if (i + 1 >= n || !isDigit(source[i + 1])) throw new ExpressionParseError("malformed number: decimal point needs a digit", i);
7722
+ i += 1;
7723
+ while (i < n && isDigit(source[i])) i += 1;
7724
+ }
7725
+ const text = source.slice(start, i);
7726
+ const value = Number(text);
7727
+ if (!Number.isFinite(value)) throw new ExpressionParseError(`malformed number: '${text}'`, start);
7728
+ tokens.push({
7729
+ type: "number",
7730
+ value,
7731
+ pos: start
7732
+ });
7733
+ continue;
7734
+ }
7735
+ if (ch === "'" || ch === "\"") {
7736
+ const quote = ch;
7737
+ const start = i;
7738
+ i += 1;
7739
+ let out = "";
7740
+ let closed = false;
7741
+ while (i < n) {
7742
+ const c = source[i];
7743
+ if (c === "\\") {
7744
+ const next = i + 1 < n ? source[i + 1] : "";
7745
+ if (next === "\\" || next === "'" || next === "\"") {
7746
+ out += next;
7747
+ i += 2;
7748
+ continue;
7749
+ }
7750
+ throw new ExpressionParseError(`invalid string escape: '\\${next}'`, i);
7751
+ }
7752
+ if (c === quote) {
7753
+ closed = true;
7754
+ i += 1;
7755
+ break;
7756
+ }
7757
+ out += c;
7758
+ i += 1;
7759
+ }
7760
+ if (!closed) throw new ExpressionParseError("unterminated string literal", start);
7761
+ tokens.push({
7762
+ type: "string",
7763
+ value: out,
7764
+ pos: start
7765
+ });
7766
+ continue;
7767
+ }
7768
+ if (isIdentStart(ch)) {
7769
+ const start = i;
7770
+ while (i < n && isIdentPart(source[i])) i += 1;
7771
+ const text = source.slice(start, i);
7772
+ if (KEYWORDS.has(text)) tokens.push({
7773
+ type: "keyword",
7774
+ keyword: keywordOf(text),
7775
+ pos: start
7776
+ });
7777
+ else tokens.push({
7778
+ type: "identifier",
7779
+ name: text,
7780
+ pos: start
7781
+ });
7782
+ continue;
7783
+ }
7784
+ const two = i + 1 < n ? source.slice(i, i + 2) : "";
7785
+ if (two === "<=" || two === ">=" || two === "==" || two === "!=" || two === "&&" || two === "||") {
7786
+ tokens.push({
7787
+ type: "punct",
7788
+ punct: two,
7789
+ pos: i
7790
+ });
7791
+ i += 2;
7792
+ continue;
7793
+ }
7794
+ if (isSinglePunct(ch)) {
7795
+ tokens.push({
7796
+ type: "punct",
7797
+ punct: ch,
7798
+ pos: i
7799
+ });
7800
+ i += 1;
7801
+ continue;
7802
+ }
7803
+ throw new ExpressionParseError(`unexpected character '${ch}'`, i);
7804
+ }
7805
+ tokens.push({
7806
+ type: "eof",
7807
+ pos: n
7808
+ });
7809
+ return tokens;
7810
+ }
7811
+ function keywordOf(text) {
7812
+ if (text === "true") return "true";
7813
+ if (text === "false") return "false";
7814
+ return "null";
7815
+ }
7816
+ function isSinglePunct(ch) {
7817
+ return ch === "(" || ch === ")" || ch === "," || ch === "?" || ch === ":" || ch === "+" || ch === "-" || ch === "*" || ch === "/" || ch === "%" || ch === "!" || ch === "<" || ch === ">";
7818
+ }
7819
+ /**
7820
+ * Frozen, null-prototype builtin function table for the expression engine
7821
+ * (spec §4 rule 4). The table is the SOLE surface of callable functions: the
7822
+ * parser rejects any callee not in it, and the evaluator gates each call on an
7823
+ * own-property check against it.
7824
+ *
7825
+ * Because the object has a NULL prototype AND is `Object.freeze`d:
7826
+ * - it cannot be polluted (no `__proto__` / `constructor` write reaches it);
7827
+ * - a lookup for `toString` / `hasOwnProperty` / `constructor` finds NOTHING
7828
+ * (there is no `Object.prototype` in the chain), so those names are not
7829
+ * callable — they are simply "unknown function" at parse time.
7830
+ *
7831
+ * Every numeric argument is validated as a finite number and every numeric
7832
+ * RESULT is re-checked finite, so `/0`, `sqrt(-1)` (→ NaN) and overflow
7833
+ * (`pow(10,400)` → Infinity) all raise `ExpressionEvalError` and fail the link
7834
+ * closed rather than emitting a garbage value.
7835
+ */
7836
+ function asFiniteNumber(value, name, index) {
7837
+ if (typeof value !== "number" || !Number.isFinite(value)) throw new ExpressionEvalError(`${name}: argument ${index + 1} must be a finite number`);
7838
+ return value;
7839
+ }
7840
+ function asString$1(value, name, index) {
7841
+ if (typeof value !== "string") throw new ExpressionEvalError(`${name}: argument ${index + 1} must be a string`);
7842
+ return value;
7843
+ }
7844
+ function finiteResult(value, name) {
7845
+ if (!Number.isFinite(value)) throw new ExpressionEvalError(`${name}: produced a non-finite result`);
7846
+ return value;
7847
+ }
7848
+ function allFiniteNumbers(args, name) {
7849
+ return args.map((a, idx) => asFiniteNumber(a, name, idx));
7850
+ }
7851
+ var INF = Number.POSITIVE_INFINITY;
7852
+ var table = {
7853
+ min: {
7854
+ minArgs: 1,
7855
+ maxArgs: INF,
7856
+ apply: (args) => finiteResult(Math.min(...allFiniteNumbers(args, "min")), "min")
7857
+ },
7858
+ max: {
7859
+ minArgs: 1,
7860
+ maxArgs: INF,
7861
+ apply: (args) => finiteResult(Math.max(...allFiniteNumbers(args, "max")), "max")
7862
+ },
7863
+ abs: {
7864
+ minArgs: 1,
7865
+ maxArgs: 1,
7866
+ apply: (args) => finiteResult(Math.abs(asFiniteNumber(args[0], "abs", 0)), "abs")
7867
+ },
7868
+ floor: {
7869
+ minArgs: 1,
7870
+ maxArgs: 1,
7871
+ apply: (args) => finiteResult(Math.floor(asFiniteNumber(args[0], "floor", 0)), "floor")
7872
+ },
7873
+ ceil: {
7874
+ minArgs: 1,
7875
+ maxArgs: 1,
7876
+ apply: (args) => finiteResult(Math.ceil(asFiniteNumber(args[0], "ceil", 0)), "ceil")
7877
+ },
7878
+ sqrt: {
7879
+ minArgs: 1,
7880
+ maxArgs: 1,
7881
+ apply: (args) => finiteResult(Math.sqrt(asFiniteNumber(args[0], "sqrt", 0)), "sqrt")
7882
+ },
7883
+ round: {
7884
+ minArgs: 1,
7885
+ maxArgs: 2,
7886
+ apply: (args) => {
7887
+ const x = asFiniteNumber(args[0], "round", 0);
7888
+ const digits = args.length > 1 ? Math.trunc(asFiniteNumber(args[1], "round", 1)) : 0;
7889
+ if (digits < 0 || digits > 100) throw new ExpressionEvalError("round: digits must be between 0 and 100");
7890
+ const factor = 10 ** digits;
7891
+ return finiteResult(Math.round(x * factor) / factor, "round");
7892
+ }
7893
+ },
7894
+ pow: {
7895
+ minArgs: 2,
7896
+ maxArgs: 2,
7897
+ apply: (args) => finiteResult(asFiniteNumber(args[0], "pow", 0) ** asFiniteNumber(args[1], "pow", 1), "pow")
7898
+ },
7899
+ clamp: {
7900
+ minArgs: 3,
7901
+ maxArgs: 3,
7902
+ apply: (args) => {
7903
+ const x = asFiniteNumber(args[0], "clamp", 0);
7904
+ const lo = asFiniteNumber(args[1], "clamp", 1);
7905
+ const hi = asFiniteNumber(args[2], "clamp", 2);
7906
+ if (lo > hi) throw new ExpressionEvalError("clamp: lower bound is greater than upper bound");
7907
+ return finiteResult(Math.min(hi, Math.max(lo, x)), "clamp");
7908
+ }
7909
+ },
7910
+ avg: {
7911
+ minArgs: 1,
7912
+ maxArgs: INF,
7913
+ apply: (args) => {
7914
+ const nums = allFiniteNumbers(args, "avg");
7915
+ return finiteResult(nums.reduce((acc, v) => acc + v, 0) / nums.length, "avg");
7916
+ }
7917
+ },
7918
+ sum: {
7919
+ minArgs: 1,
7920
+ maxArgs: INF,
7921
+ apply: (args) => finiteResult(allFiniteNumbers(args, "sum").reduce((acc, v) => acc + v, 0), "sum")
7922
+ },
7923
+ coalesce: {
7924
+ minArgs: 1,
7925
+ maxArgs: INF,
7926
+ apply: (args) => {
7927
+ for (const a of args) if (a !== null) return a;
7928
+ return null;
7929
+ }
7930
+ },
7931
+ age: {
7932
+ minArgs: 2,
7933
+ maxArgs: 2,
7934
+ apply: (args) => finiteResult(asFiniteNumber(args[0], "age", 0) - asFiniteNumber(args[1], "age", 1), "age")
7935
+ },
7936
+ convert: {
7937
+ minArgs: 3,
7938
+ maxArgs: 3,
7939
+ apply: (args, hooks) => {
7940
+ const x = asFiniteNumber(args[0], "convert", 0);
7941
+ const from = asString$1(args[1], "convert", 1).trim();
7942
+ const to = asString$1(args[2], "convert", 2).trim();
7943
+ if (hooks.convert) {
7944
+ const out = hooks.convert(x, from, to);
7945
+ if (out === null) throw new ExpressionEvalError(`convert: cannot convert '${from}' to '${to}'`);
7946
+ return finiteResult(out, "convert");
7947
+ }
7948
+ if (from === to) return x;
7949
+ throw new ExpressionEvalError("convert: unit conversion table not installed");
7950
+ }
7951
+ }
7952
+ };
7953
+ Object.freeze(Object.assign(Object.create(null), table));
7954
+ /** The set of valid builtin names — used by the parser to reject unknown
7955
+ * callees at parse time (immediate author feedback). */
7956
+ var EXPRESSION_BUILTIN_NAMES = new Set(Object.keys(table));
7957
+ /**
7958
+ * Pratt (precedence-climbing) parser for the safe expression mini-language.
7959
+ *
7960
+ * Precedence (low → high): ternary `?:` (right-assoc) → `||` → `&&` → equality
7961
+ * → relational → additive → multiplicative → unary `! -` → call / primary.
7962
+ * Calls are ONLY `IDENT '(' args? ')'` at primary position — the callee is a
7963
+ * string validated against the builtin table at parse time, so an unknown
7964
+ * function is rejected immediately (author feedback) and a persisted expression
7965
+ * that references a since-removed builtin degrades at read.
7966
+ *
7967
+ * A node counter caps total AST size (`MAX_EXPRESSION_AST_NODES`) and call
7968
+ * arity is capped (`MAX_EXPRESSION_CALL_ARGS`) — both raise `ExpressionParseError`.
7969
+ */
7970
+ /** Binary/logical operator precedence (higher binds tighter). */
7971
+ var BINARY_PRECEDENCE = {
7972
+ "||": 1,
7973
+ "&&": 2,
7974
+ "==": 3,
7975
+ "!=": 3,
7976
+ "<": 4,
7977
+ "<=": 4,
7978
+ ">": 4,
7979
+ ">=": 4,
7980
+ "+": 5,
7981
+ "-": 5,
7982
+ "*": 6,
7983
+ "/": 6,
7984
+ "%": 6
7985
+ };
7986
+ function isLogicalOp(op) {
7987
+ return op === "&&" || op === "||";
7988
+ }
7989
+ function isBinaryOp(op) {
7990
+ return op === "+" || op === "-" || op === "*" || op === "/" || op === "%" || op === "==" || op === "!=" || op === "<" || op === "<=" || op === ">" || op === ">=";
7991
+ }
7992
+ var Parser = class {
7993
+ tokens;
7994
+ pos = 0;
7995
+ nodeCount = 0;
7996
+ identifiers = /* @__PURE__ */ new Set();
7997
+ callees = /* @__PURE__ */ new Set();
7998
+ constructor(tokens) {
7999
+ this.tokens = tokens;
8000
+ }
8001
+ parse() {
8002
+ const ast = this.parseTernary();
8003
+ const tok = this.peek();
8004
+ if (tok.type !== "eof") throw new ExpressionParseError("unexpected trailing input", tok.pos);
8005
+ return {
8006
+ ast,
8007
+ identifiers: this.identifiers,
8008
+ callees: this.callees,
8009
+ nodeCount: this.nodeCount
8010
+ };
8011
+ }
8012
+ peek() {
8013
+ return this.tokens[this.pos];
8014
+ }
8015
+ next() {
8016
+ return this.tokens[this.pos++];
8017
+ }
8018
+ /** Consume a punctuator token, erroring if the next token isn't it. */
8019
+ expectPunct(punct) {
8020
+ const tok = this.peek();
8021
+ if (tok.type !== "punct" || tok.punct !== punct) throw new ExpressionParseError(`expected '${punct}'`, tok.pos);
8022
+ this.pos += 1;
8023
+ }
8024
+ matchPunct(punct) {
8025
+ const tok = this.peek();
8026
+ if (tok.type === "punct" && tok.punct === punct) {
8027
+ this.pos += 1;
8028
+ return true;
8029
+ }
8030
+ return false;
8031
+ }
8032
+ countNode() {
8033
+ this.nodeCount += 1;
8034
+ if (this.nodeCount > 256) throw new ExpressionParseError("expression too complex", this.peek().pos);
8035
+ }
8036
+ parseTernary() {
8037
+ const test = this.parseBinary(1);
8038
+ if (this.matchPunct("?")) {
8039
+ const consequent = this.parseTernary();
8040
+ this.expectPunct(":");
8041
+ const alternate = this.parseTernary();
8042
+ this.countNode();
8043
+ return {
8044
+ kind: "conditional",
8045
+ test,
8046
+ consequent,
8047
+ alternate
8048
+ };
8049
+ }
8050
+ return test;
8051
+ }
8052
+ parseBinary(minPrec) {
8053
+ let left = this.parseUnary();
8054
+ for (;;) {
8055
+ const tok = this.peek();
8056
+ if (tok.type !== "punct") break;
8057
+ const prec = BINARY_PRECEDENCE[tok.punct];
8058
+ if (prec === void 0 || prec < minPrec) break;
8059
+ const op = tok.punct;
8060
+ this.pos += 1;
8061
+ const right = this.parseBinary(prec + 1);
8062
+ this.countNode();
8063
+ if (isLogicalOp(op)) left = {
8064
+ kind: "logical",
8065
+ op,
8066
+ left,
8067
+ right
8068
+ };
8069
+ else if (isBinaryOp(op)) left = {
8070
+ kind: "binary",
8071
+ op,
8072
+ left,
8073
+ right
8074
+ };
8075
+ else throw new ExpressionParseError(`unexpected operator '${op}'`, tok.pos);
8076
+ }
8077
+ return left;
8078
+ }
8079
+ parseUnary() {
8080
+ const tok = this.peek();
8081
+ if (tok.type === "punct" && (tok.punct === "!" || tok.punct === "-")) {
8082
+ const op = tok.punct;
8083
+ this.pos += 1;
8084
+ const operand = this.parseUnary();
8085
+ this.countNode();
8086
+ return {
8087
+ kind: "unary",
8088
+ op,
8089
+ operand
8090
+ };
8091
+ }
8092
+ return this.parsePrimary();
8093
+ }
8094
+ parsePrimary() {
8095
+ const tok = this.next();
8096
+ switch (tok.type) {
8097
+ case "number":
8098
+ this.countNode();
8099
+ return {
8100
+ kind: "literal",
8101
+ value: tok.value
8102
+ };
8103
+ case "string":
8104
+ this.countNode();
8105
+ return {
8106
+ kind: "literal",
8107
+ value: tok.value
8108
+ };
8109
+ case "keyword":
8110
+ this.countNode();
8111
+ return {
8112
+ kind: "literal",
8113
+ value: tok.keyword === "null" ? null : tok.keyword === "true"
8114
+ };
8115
+ case "identifier": {
8116
+ const nextTok = this.peek();
8117
+ if (nextTok.type === "punct" && nextTok.punct === "(") return this.parseCall(tok.name, tok.pos);
8118
+ this.identifiers.add(tok.name);
8119
+ this.countNode();
8120
+ return {
8121
+ kind: "identifier",
8122
+ name: tok.name
8123
+ };
8124
+ }
8125
+ case "punct":
8126
+ if (tok.punct === "(") {
8127
+ const inner = this.parseTernary();
8128
+ this.expectPunct(")");
8129
+ return inner;
8130
+ }
8131
+ throw new ExpressionParseError(`unexpected token '${tok.punct}'`, tok.pos);
8132
+ case "eof": throw new ExpressionParseError("unexpected end of expression", tok.pos);
8133
+ }
8134
+ }
8135
+ parseCall(callee, pos) {
8136
+ if (!EXPRESSION_BUILTIN_NAMES.has(callee)) throw new ExpressionParseError(`unknown function '${callee}'`, pos);
8137
+ this.expectPunct("(");
8138
+ const args = [];
8139
+ if (!this.matchPunct(")")) for (;;) {
8140
+ args.push(this.parseTernary());
8141
+ if (args.length > 16) throw new ExpressionParseError(`too many arguments to '${callee}'`, pos);
8142
+ if (this.matchPunct(",")) continue;
8143
+ this.expectPunct(")");
8144
+ break;
8145
+ }
8146
+ this.callees.add(callee);
8147
+ this.countNode();
8148
+ return {
8149
+ kind: "call",
8150
+ callee,
8151
+ args
8152
+ };
8153
+ }
8154
+ };
8155
+ /** Tokenize + parse `source` into a validated `ParsedExpression`. Throws
8156
+ * `ExpressionParseError` on any lexical or grammatical failure. */
8157
+ function parseExpression(source) {
8158
+ return new Parser(tokenize(source)).parse();
8159
+ }
8160
+ Object.freeze({});
8161
+ /**
8162
+ * LRU compile cache for parsed expressions (spec §2.4 "parse once … LRU keyed
8163
+ * by expr"). The cache stores BOTH successes and failures (negative caching),
8164
+ * so a corrupt persisted string costs exactly one tokenize+parse total — not
8165
+ * one per read on a hot resolve path.
8166
+ *
8167
+ * The cache is a module-level singleton: entries are pure, content-addressed
8168
+ * ASTs keyed by the raw source string, so sharing one instance across all
8169
+ * callers is safe and maximises hit rate.
8170
+ */
8171
+ var cache = /* @__PURE__ */ new Map();
8172
+ function getCached(source) {
8173
+ const hit = cache.get(source);
8174
+ if (hit !== void 0) {
8175
+ cache.delete(source);
8176
+ cache.set(source, hit);
8177
+ return hit;
8178
+ }
8179
+ let result;
8180
+ try {
8181
+ result = {
8182
+ ok: true,
8183
+ parsed: parseExpression(source)
8184
+ };
8185
+ } catch (err) {
8186
+ result = {
8187
+ ok: false,
8188
+ error: err instanceof ExpressionParseError ? err.message : String(err)
8189
+ };
8190
+ }
8191
+ cache.set(source, result);
8192
+ if (cache.size > 256) {
8193
+ const oldest = cache.keys().next().value;
8194
+ if (oldest !== void 0) cache.delete(oldest);
8195
+ }
8196
+ return result;
8197
+ }
8198
+ /** Compile `source`, returning a discriminated result instead of throwing.
8199
+ * Used by read paths that must degrade rather than raise. LRU/negative-cached. */
8200
+ function compileExpressionSafe(source) {
8201
+ return getCached(source);
8202
+ }
8203
+ /**
8204
+ * Author-time validation. Returns `null` when the source is valid, else a
8205
+ * human-readable error message. Checks: the expression compiles; binding count
8206
+ * is within `MAX_EXPRESSION_BINDINGS`; every binding name is a legal identifier,
8207
+ * is not reserved (`now`/keywords) and does not shadow a builtin; and every
8208
+ * FREE identifier of the AST is covered by a binding or the injected `now`.
8209
+ */
8210
+ function validateExpressionSource(src) {
8211
+ const names = Object.keys(src.bindings);
8212
+ if (names.length > 32) return `too many bindings (${names.length} > 32)`;
8213
+ for (const name of names) {
8214
+ if (!EXPRESSION_IDENTIFIER_RE.test(name)) return `invalid binding name '${name}'`;
8215
+ if (RESERVED_BINDING_NAMES.has(name)) return `binding name '${name}' is reserved`;
8216
+ if (EXPRESSION_BUILTIN_NAMES.has(name)) return `binding name '${name}' shadows a builtin function`;
8217
+ }
8218
+ const compiled = compileExpressionSafe(src.expr);
8219
+ if (!compiled.ok) return compiled.error;
8220
+ const bound = new Set(names);
8221
+ for (const id of compiled.parsed.identifiers) {
8222
+ if (id === "now") continue;
8223
+ if (!bound.has(id)) return `expression references unbound identifier '${id}'`;
8224
+ }
8225
+ return null;
8226
+ }
8227
+ /**
7463
8228
  * Accessory device helpers — shared across drivers.
7464
8229
  *
7465
8230
  * Many vendor-specific drivers register accessory child devices on
@@ -9362,7 +10127,8 @@ var MotionAnalysisResultSchema = object({
9362
10127
  });
9363
10128
  method(object({
9364
10129
  deviceId: number(),
9365
- frame: FrameInputSchema
10130
+ frame: FrameInputSchema.optional(),
10131
+ frameHandle: FrameHandleSchema.optional()
9366
10132
  }), MotionAnalysisResultSchema, { kind: "mutation" }), method(object({ deviceId: number() }), _void(), { kind: "mutation" }), method(_void(), _void(), { kind: "mutation" }), object({
9367
10133
  deviceId: number(),
9368
10134
  detected: boolean(),
@@ -9609,6 +10375,12 @@ method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngi
9609
10375
  engine: PipelineEngineChoiceSchema.optional(),
9610
10376
  steps: array(PipelineStepInputSchema).min(1),
9611
10377
  frame: FrameInputSchema.optional(),
10378
+ /**
10379
+ * CB5 shm passthrough — a `FrameHandle` naming the same ring slot
10380
+ * the decoded pixels live in. One more member of the one-of
10381
+ * frame/frameHandle/image/imageBase64/referenceImage group.
10382
+ */
10383
+ frameHandle: FrameHandleSchema.optional(),
9612
10384
  imageBase64: string().optional(),
9613
10385
  /**
9614
10386
  * Binary JPEG bytes — preferred over `imageBase64` on internal
@@ -9818,6 +10590,31 @@ var ReportMotionInputSchema = object({
9818
10590
  regions: array(MotionRegionSchema).readonly().optional()
9819
10591
  });
9820
10592
  /**
10593
+ * Where a runner gets a camera's decoded frames (cross-node Phase 2,
10594
+ * restream-owner model — P2c).
10595
+ *
10596
+ * - `local-broker` (DEFAULT): today's path — subscribe to the co-located
10597
+ * stream-broker's shm frame plane. Every pre-P2c attach payload (no
10598
+ * `frameSource` key) parses to this, so the field is additive with zero
10599
+ * behavior change.
10600
+ * - `remote-restream`: the detect node is NOT the camera's source-owner.
10601
+ * The runner acquires the owner's COMPRESSED passthrough restream
10602
+ * (`streamBroker.getStreamWithCodec({video:'copy'})` — refcounted, the
10603
+ * double-pull guard) and decodes LOCALLY via a satellite frame plane +
10604
+ * pull-mode decoder session pinned to its own node. The shm ring stays
10605
+ * node-local; only H.264/H.265 packets cross the wire.
10606
+ * `hubHostnameOverride` mirrors the recorder's `recordingHubHostname`:
10607
+ * when set it overrides the `CAMSTACK_HUB_URL`-derived host the runner
10608
+ * dials for the owner's restream.
10609
+ */
10610
+ var RunnerFrameSourceSchema = discriminatedUnion("kind", [object({ kind: literal("local-broker") }), object({
10611
+ kind: literal("remote-restream"),
10612
+ /** The camera's source-owner node (slice 1: always the hub). */
10613
+ ownerNodeId: string(),
10614
+ /** Operator override for the owner host the runner dials. */
10615
+ hubHostnameOverride: string().optional()
10616
+ })]).describe("Per-camera frame-source mode for the runner (P2c)");
10617
+ /**
9821
10618
  * Camera assignment payload sent by `addon-pipeline-orchestrator` to a
9822
10619
  * specific runner instance via `attachCamera`. Carries everything the
9823
10620
  * runner needs to subscribe to the local broker and execute inference.
@@ -9915,7 +10712,15 @@ var RunnerCameraConfigSchema = object({
9915
10712
  */
9916
10713
  onboardMotionDrivesAnalyzer: boolean().default(true),
9917
10714
  occupancyRecheckSec: number().min(occupancyRecheckSecField.min).max(occupancyRecheckSecField.max).default(occupancyRecheckSecField.default),
9918
- occupancyRecheckFrames: number().min(occupancyRecheckFramesField.min).max(occupancyRecheckFramesField.max).default(occupancyRecheckFramesField.default)
10715
+ occupancyRecheckFrames: number().min(occupancyRecheckFramesField.min).max(occupancyRecheckFramesField.max).default(occupancyRecheckFramesField.default),
10716
+ /**
10717
+ * Where this runner gets the camera's decoded frames (P2c). Defaulted so
10718
+ * every existing payload behaves as `local-broker` — the pre-Phase-2 path.
10719
+ * Populated with `remote-restream` by the orchestrator ONLY when the
10720
+ * camera's detect node differs from its source-owner (P2d, gated by the
10721
+ * `remoteSourcingNodes` rollout setting).
10722
+ */
10723
+ frameSource: RunnerFrameSourceSchema.default({ kind: "local-broker" })
9919
10724
  });
9920
10725
  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;
9921
10726
  /**
@@ -10280,6 +11085,113 @@ object({
10280
11085
  lastFetchedAt: number()
10281
11086
  });
10282
11087
  DeviceType.Sensor;
11088
+ /**
11089
+ * Feeder connectivity / power status — mirrors the HA petkit device-status
11090
+ * enum: `normal` (online, mains), `offline` (not reaching PetKit cloud),
11091
+ * `on_batteries` (running on battery backup). `null` until first reported.
11092
+ */
11093
+ var PetFeederDeviceStatusSchema = _enum([
11094
+ "normal",
11095
+ "offline",
11096
+ "on_batteries"
11097
+ ]);
11098
+ var gramsPortion = number().int().min(4).max(200);
11099
+ object({
11100
+ /** Food currently in the bowl (grams). Null when the device has not
11101
+ * reported a reading yet. On dual-hopper models this is the combined
11102
+ * bowl reading; per-hopper levels live in `food1`/`food2`. */
11103
+ foodLevel: number().nullable(),
11104
+ /** Hopper-1 food level (grams) on dual-hopper feeders; null on
11105
+ * single-hopper models. */
11106
+ food1: number().nullable(),
11107
+ /** Hopper-2 food level (grams) on dual-hopper feeders; null on
11108
+ * single-hopper models. */
11109
+ food2: number().nullable(),
11110
+ /** Derived low-food flag — mirrors the HA `food_level` binary_sensor
11111
+ * (`device_class: problem`, on = low). True when the bowl is empty /
11112
+ * below the feeder's low threshold. */
11113
+ lowFood: boolean(),
11114
+ /** Battery charge 0..100 (%). Null on mains-powered models or when the
11115
+ * device has no battery reading. */
11116
+ batteryPower: number().min(0).max(100).nullable(),
11117
+ /** Days of desiccant life remaining. Null when the model has no
11118
+ * desiccant sensor. */
11119
+ desiccantLeftDays: number().nullable(),
11120
+ /** True while a feed is in progress. */
11121
+ feeding: boolean(),
11122
+ /** Decoded connectivity / power status (HA petkit device-status enum).
11123
+ * Null until the device has reported a status. */
11124
+ status: PetFeederDeviceStatusSchema.nullable(),
11125
+ /** Decoded human-readable fault message. Null (or the device's `no_error`
11126
+ * sentinel) means healthy; a non-null string is an active fault. Pairs
11127
+ * with `errorCode` for consumers that want the raw integer. */
11128
+ error: string().nullable(),
11129
+ /** Raw device error code (0 / null = no error). */
11130
+ errorCode: number().nullable(),
11131
+ /** True for D4S/D4SH dual-hopper hardware — gates the per-hopper UI. */
11132
+ isDualHopper: boolean(),
11133
+ /** Child-lock (manual-lock) setting — buttons on the unit are disabled. */
11134
+ childLock: boolean(),
11135
+ /** Front indicator-light setting. */
11136
+ indicatorLight: boolean(),
11137
+ /** Play a chime when dispensing. */
11138
+ feedSound: boolean(),
11139
+ /** Speaker / prompt volume level (device-scaled integer). */
11140
+ volume: number(),
11141
+ /** Ms epoch when the slice was last refreshed from the cloud. */
11142
+ lastFetchedAt: number()
11143
+ });
11144
+ DeviceType.PetFeeder, method(object({
11145
+ deviceId: number().int().nonnegative(),
11146
+ grams: gramsPortion.optional(),
11147
+ hopper1: gramsPortion.optional(),
11148
+ hopper2: gramsPortion.optional()
11149
+ }), _void(), {
11150
+ kind: "mutation",
11151
+ auth: "admin"
11152
+ }), method(object({ deviceId: number().int().nonnegative() }), _void(), {
11153
+ kind: "mutation",
11154
+ auth: "admin"
11155
+ }), method(object({ deviceId: number().int().nonnegative() }), _void(), {
11156
+ kind: "mutation",
11157
+ auth: "admin"
11158
+ }), method(object({ deviceId: number().int().nonnegative() }), _void(), {
11159
+ kind: "mutation",
11160
+ auth: "admin"
11161
+ }), method(object({ deviceId: number().int().nonnegative() }), _void(), {
11162
+ kind: "mutation",
11163
+ auth: "admin"
11164
+ }), method(object({
11165
+ deviceId: number().int().nonnegative(),
11166
+ soundId: number().int().nonnegative()
11167
+ }), _void(), {
11168
+ kind: "mutation",
11169
+ auth: "admin"
11170
+ }), method(object({
11171
+ deviceId: number().int().nonnegative(),
11172
+ on: boolean()
11173
+ }), _void(), {
11174
+ kind: "mutation",
11175
+ auth: "admin"
11176
+ }), method(object({
11177
+ deviceId: number().int().nonnegative(),
11178
+ on: boolean()
11179
+ }), _void(), {
11180
+ kind: "mutation",
11181
+ auth: "admin"
11182
+ }), method(object({
11183
+ deviceId: number().int().nonnegative(),
11184
+ on: boolean()
11185
+ }), _void(), {
11186
+ kind: "mutation",
11187
+ auth: "admin"
11188
+ }), method(object({
11189
+ deviceId: number().int().nonnegative(),
11190
+ level: number().int().nonnegative()
11191
+ }), _void(), {
11192
+ kind: "mutation",
11193
+ auth: "admin"
11194
+ });
10283
11195
  object({
10284
11196
  /** Instantaneous power draw in watts. */
10285
11197
  watts: number().optional(),
@@ -12156,10 +13068,12 @@ method(object({ codec: string() }), boolean()), method(_void(), object({
12156
13068
  url: string()
12157
13069
  }), _void()), method(object({
12158
13070
  sessionId: string(),
12159
- maxCount: number().default(1)
13071
+ maxCount: number().default(1),
13072
+ waitMs: number().optional()
12160
13073
  }), array(DecodedFrameSchema)), method(object({
12161
13074
  sessionId: string(),
12162
- maxCount: number().default(1)
13075
+ maxCount: number().default(1),
13076
+ waitMs: number().optional()
12163
13077
  }), array(FrameHandleSchema)), method(object({ handle: FrameHandleSchema }), DecodedFrameSchema.nullable()), method(object({ sessionId: string() }), ShmRingStatsSchema.nullable()), method(object({
12164
13078
  sessionId: string(),
12165
13079
  config: DecoderSessionConfigSchema.partial()
@@ -12446,14 +13360,63 @@ var ChildLayoutEntrySchema = object({
12446
13360
  collapsed: boolean().optional()
12447
13361
  });
12448
13362
  /** Cap-wire shape of a DeviceLink — structurally mirrors `DeviceLink` in
12449
- * `device-management.ts`. */
13363
+ * `device-management.ts`. Source is a union: a FIELD source copies a sibling
13364
+ * accessory's status field (`kind` optional/absent for wire compat); a
13365
+ * LITERAL source carries a per-device constant (no sibling is read); a
13366
+ * GLOBAL source (P2e) copies ANY device's status field, addressed by the
13367
+ * source device's full re-sync-stable `stableId`. */
13368
+ var DeviceLinkFieldSourceSchema = object({
13369
+ kind: literal("field").optional(),
13370
+ sourceKey: string(),
13371
+ cap: string(),
13372
+ fieldPath: string()
13373
+ });
13374
+ var DeviceLinkLiteralSourceSchema = object({
13375
+ kind: literal("literal"),
13376
+ value: union([
13377
+ string(),
13378
+ number(),
13379
+ boolean(),
13380
+ _null()
13381
+ ])
13382
+ });
13383
+ var DeviceLinkGlobalSourceSchema = object({
13384
+ kind: literal("global"),
13385
+ sourceStableId: string(),
13386
+ cap: string(),
13387
+ fieldPath: string()
13388
+ });
13389
+ /** Expression source (Stage X): compute the target field from N named bindings
13390
+ * via the safe expression engine. Bindings are field | literal | global — never
13391
+ * another expression (no nesting). The `superRefine` runs the SAME author-time
13392
+ * validation as `validateExpressionSource` (compiles the expr, checks binding
13393
+ * names + identifier coverage) so every wire boundary that parses a DeviceLink
13394
+ * (tRPC mount, kernel create pre-seed, projection output) validates-at-write.
13395
+ * Compiles are LRU-cached, so repeated validation of the same expr is a hit. */
13396
+ var DeviceLinkExpressionSourceSchema = object({
13397
+ kind: literal("expression"),
13398
+ expr: string().min(1).max(MAX_EXPRESSION_SOURCE_LENGTH),
13399
+ bindings: record(string().regex(EXPRESSION_IDENTIFIER_RE), union([
13400
+ DeviceLinkFieldSourceSchema,
13401
+ DeviceLinkLiteralSourceSchema,
13402
+ DeviceLinkGlobalSourceSchema
13403
+ ]))
13404
+ }).superRefine((src, ctx) => {
13405
+ const err = validateExpressionSource(src);
13406
+ if (err !== null) ctx.addIssue({
13407
+ code: "custom",
13408
+ message: err,
13409
+ path: ["expr"]
13410
+ });
13411
+ });
12450
13412
  var DeviceLinkSchema = object({
12451
13413
  id: string(),
12452
- source: object({
12453
- sourceKey: string(),
12454
- cap: string(),
12455
- fieldPath: string()
12456
- }),
13414
+ source: union([
13415
+ DeviceLinkFieldSourceSchema,
13416
+ DeviceLinkLiteralSourceSchema,
13417
+ DeviceLinkGlobalSourceSchema,
13418
+ DeviceLinkExpressionSourceSchema
13419
+ ]),
12457
13420
  target: object({
12458
13421
  cap: string(),
12459
13422
  fieldPath: string(),
@@ -12482,6 +13445,31 @@ var DeviceLinkSchema = object({
12482
13445
  })
12483
13446
  ]).optional()
12484
13447
  });
13448
+ /** Cap-wire shape of a per-cap display refinement — mirrors
13449
+ * `DeviceCapDisplayOverride` in `device-management.ts`. */
13450
+ var DeviceCapDisplayOverrideSchema = object({
13451
+ unit: string().min(1).optional(),
13452
+ precision: number().int().min(0).max(10).optional()
13453
+ });
13454
+ /** Cap-wire shape of an operator-authored per-device display override —
13455
+ * mirrors `DeviceDisplayOverride` in `device-management.ts`. `precision`
13456
+ * bounds mirror `numeric-sensor.cap.ts` (`int 0-10`). */
13457
+ var DeviceDisplayOverrideSchema = object({
13458
+ icon: string().min(1).optional(),
13459
+ label: string().min(1).optional(),
13460
+ unit: string().min(1).optional(),
13461
+ precision: number().int().min(0).max(10).optional(),
13462
+ hidden: boolean().optional(),
13463
+ perCap: record(string(), DeviceCapDisplayOverrideSchema).optional()
13464
+ });
13465
+ /** Cap-wire shape of a per-role display default — mirrors `RoleDisplayDefault`
13466
+ * in `device-management.ts`. Keyed by `DeviceRole` string (role strings cross
13467
+ * the wire as plain strings everywhere else — cf. `DeviceInfoSchema.role`). */
13468
+ var RoleDisplayDefaultSchema = object({
13469
+ unit: string().min(1).optional(),
13470
+ precision: number().int().min(0).max(10).optional(),
13471
+ icon: string().min(1).optional()
13472
+ });
12485
13473
  /**
12486
13474
  * Serializable projection of a live IDevice.
12487
13475
  * Returned by listAll, getDevice, getChildren.
@@ -12537,7 +13525,9 @@ var DeviceInfoSchema = object({
12537
13525
  * `DeviceMeta.childLayout`. Absent ⇒ no layout declared. */
12538
13526
  childLayout: array(ChildLayoutEntrySchema).readonly().optional(),
12539
13527
  /** Operator-authored cross-device field wirings. See `DeviceMeta.deviceLinks`. */
12540
- deviceLinks: array(DeviceLinkSchema).readonly().optional()
13528
+ deviceLinks: array(DeviceLinkSchema).readonly().optional(),
13529
+ /** Operator-authored per-device display override. See `DeviceMeta.display`. */
13530
+ display: DeviceDisplayOverrideSchema.optional()
12541
13531
  });
12542
13532
  var ConfigEntrySchema = object({
12543
13533
  key: string(),
@@ -12602,7 +13592,9 @@ var DeviceMetaSchema = object({
12602
13592
  deviceLinks: array(DeviceLinkSchema).readonly().optional(),
12603
13593
  /** Semantic role string (`DeviceRole`) — propagated from the spawn pre-seed.
12604
13594
  * Optional: only present for accessory children that carry a known role. */
12605
- role: string().nullable().optional()
13595
+ role: string().nullable().optional(),
13596
+ /** Operator-authored per-device display override. See `DeviceMeta.display`. */
13597
+ display: DeviceDisplayOverrideSchema.optional()
12606
13598
  });
12607
13599
  /** ConfigUISchema passed through as unknown — mirrors device-provider's CreationSchemaOutputSchema */
12608
13600
  var ConfigUISchemaOutput = unknown().nullable();
@@ -12696,7 +13688,19 @@ method(object({
12696
13688
  }), _void(), {
12697
13689
  kind: "mutation",
12698
13690
  auth: "admin"
12699
- }), method(object({ deviceId: number() }), object({ caps: array(object({
13691
+ }), method(object({
13692
+ deviceId: number(),
13693
+ display: DeviceDisplayOverrideSchema.nullable()
13694
+ }), _void(), {
13695
+ kind: "mutation",
13696
+ auth: "admin"
13697
+ }), method(object({}), object({ defaults: record(string(), RoleDisplayDefaultSchema) }), { kind: "query" }), method(object({ defaults: record(string(), RoleDisplayDefaultSchema) }), _void(), {
13698
+ kind: "mutation",
13699
+ auth: "admin"
13700
+ }), method(object({
13701
+ deviceId: number(),
13702
+ includeSynthesizable: boolean().optional()
13703
+ }), object({ caps: array(object({
12700
13704
  cap: string(),
12701
13705
  fields: array(object({
12702
13706
  path: string(),
@@ -12706,8 +13710,13 @@ method(object({
12706
13710
  "boolean",
12707
13711
  "enum"
12708
13712
  ]),
12709
- enumValues: array(string()).optional()
12710
- })).readonly()
13713
+ enumValues: array(string()).optional(),
13714
+ item: boolean().optional()
13715
+ })).readonly(),
13716
+ itemArray: object({
13717
+ path: string(),
13718
+ keyField: string()
13719
+ }).optional()
12711
13720
  })).readonly() }), { kind: "query" }), method(object({
12712
13721
  deviceId: number(),
12713
13722
  role: string().nullable()
@@ -12777,7 +13786,11 @@ method(object({
12777
13786
  deviceId: number(),
12778
13787
  entries: array(object({
12779
13788
  capName: string(),
12780
- kind: _enum(["native", "wrapped"]),
13789
+ kind: _enum([
13790
+ "native",
13791
+ "wrapped",
13792
+ "linked"
13793
+ ]),
12781
13794
  providerAddonId: string(),
12782
13795
  providerNodeId: string(),
12783
13796
  nativeAddonId: string()
@@ -12786,7 +13799,11 @@ method(object({
12786
13799
  deviceId: number(),
12787
13800
  entries: array(object({
12788
13801
  capName: string(),
12789
- kind: _enum(["native", "wrapped"]),
13802
+ kind: _enum([
13803
+ "native",
13804
+ "wrapped",
13805
+ "linked"
13806
+ ]),
12790
13807
  providerAddonId: string(),
12791
13808
  providerNodeId: string(),
12792
13809
  nativeAddonId: string()
@@ -13276,7 +14293,7 @@ var AddBrokerInputSchema = object({
13276
14293
  });
13277
14294
  var AddBrokerResultSchema = object({ id: string() });
13278
14295
  var IdInputSchema = object({ id: string() });
13279
- var TestResultSchema = discriminatedUnion("ok", [object({
14296
+ var TestResultSchema$1 = discriminatedUnion("ok", [object({
13280
14297
  ok: literal(true),
13281
14298
  latencyMs: number()
13282
14299
  }), object({
@@ -13313,7 +14330,7 @@ var mqttBrokerCapability = {
13313
14330
  getBrokerConfig: method(IdInputSchema, BrokerConnectionDetailsSchema),
13314
14331
  addBroker: method(AddBrokerInputSchema, AddBrokerResultSchema, { kind: "mutation" }),
13315
14332
  removeBroker: method(IdInputSchema, _void(), { kind: "mutation" }),
13316
- testConnection: method(IdInputSchema, TestResultSchema, { kind: "mutation" }),
14333
+ testConnection: method(IdInputSchema, TestResultSchema$1, { kind: "mutation" }),
13317
14334
  startEmbeddedBroker: method(StartEmbeddedInputSchema, StartEmbeddedResultSchema, { kind: "mutation" }),
13318
14335
  stopEmbeddedBroker: method(IdInputSchema, _void(), { kind: "mutation" }),
13319
14336
  getStatus: method(_void(), StatusSchema)
@@ -13352,23 +14369,198 @@ var NetworkEndpointEntrySchema = NetworkEndpointSchema.extend({
13352
14369
  sourcePort: number().optional()
13353
14370
  });
13354
14371
  method(_void(), NetworkEndpointSchema, { kind: "mutation" }), method(_void(), _void(), { kind: "mutation" }), method(_void(), NetworkEndpointSchema.nullable()), method(_void(), NetworkAccessStatusSchema), method(_void(), array(NetworkEndpointEntrySchema).readonly());
13355
- method(object({
13356
- title: string(),
14372
+ /**
14373
+ * notification-output — canonical, capability-gated notification delivery.
14374
+ *
14375
+ * Apprise-derived model (see
14376
+ * `docs/superpowers/specs/2026-07-03-notification-output-notifier-matrix.md`):
14377
+ * callers emit ONE canonical `Notification`; each provider declares a
14378
+ * per-kind capability descriptor (`TargetKind`), and the pure degrade
14379
+ * engine (`@camstack/types` `prepareNotification`) transcodes / degrades the
14380
+ * message to what the kind supports — callers never special-case a service.
14381
+ *
14382
+ * DESIGN DECISIONS (locked):
14383
+ * - Target CRUD lives on THIS cap (`upsertTarget` / `deleteTarget` /
14384
+ * `setTargetEnabled`), each provider persisting via the `settings-store`
14385
+ * cap. Rationale: the admin UI needs one uniform surface across the
14386
+ * notifiers addon AND the HA addon; the addon-`globalSettingsSchema`-array
14387
+ * alternative would fork the UI per addon and cannot host the
14388
+ * discovery→adopt flow.
14389
+ * - `listTargetKinds` / `listTargets` / `discoverTargets` return arrays →
14390
+ * the generated cap-mount auto-`concatCollection`-fans them across every
14391
+ * registered provider (notifiers addon + HA addon) so one catalog is
14392
+ * routable. `send` / `testTarget` / CRUD route to ONE provider by the
14393
+ * `addonId` the generated collection router extracts from the call input.
14394
+ * - `Attachment.bytes` is `Uint8Array`. Transport-safe: superjson (the tRPC
14395
+ * transformer) + UDS MsgPack both round-trip typed arrays — already used by
14396
+ * `storage` / `storage-provider` / `recording` caps over the same path. No
14397
+ * base64 fallback needed.
14398
+ *
14399
+ * TODO (deferred, closed-set change — separate decision): add
14400
+ * `providerKind: 'notify'` so notification providers surface on the unified
14401
+ * admin "Integrations" page.
14402
+ */
14403
+ /**
14404
+ * Zentik-derived typed-media enum — the superset across every kind. Each
14405
+ * adapter picks what it supports and the degrade engine filters the rest.
14406
+ */
14407
+ var AttachmentMediaTypeSchema = _enum([
14408
+ "image",
14409
+ "video",
14410
+ "gif",
14411
+ "audio",
14412
+ "icon"
14413
+ ]);
14414
+ /**
14415
+ * A single attachment. Exactly one of `url` (remote source, most adapters
14416
+ * prefer this) or `bytes` (inline source; required for Pushover-style
14417
+ * bytes-only kinds) MUST be present — the degrade engine expresses a
14418
+ * url→bytes fetch as a `needsFetch` directive the adapter executes.
14419
+ */
14420
+ var AttachmentSchema = object({
14421
+ mediaType: AttachmentMediaTypeSchema,
14422
+ url: string().optional(),
14423
+ bytes: _instanceof(Uint8Array).optional(),
14424
+ mime: string().optional(),
14425
+ name: string().optional()
14426
+ }).refine((a) => a.url !== void 0 || a.bytes !== void 0, { message: "Attachment requires either `url` or `bytes`" });
14427
+ var NotificationFormatSchema = _enum([
14428
+ "text",
14429
+ "markdown",
14430
+ "html"
14431
+ ]);
14432
+ /** A single tap-through action button. */
14433
+ var NotificationActionSchema = object({
14434
+ id: string(),
14435
+ label: string(),
14436
+ url: string().optional()
14437
+ });
14438
+ /**
14439
+ * The canonical notification. `body` is the only hard field (Apprise model).
14440
+ * `priority` is a 5-level ORDINAL (1=lowest … 3=normal(default) … 5=urgent),
14441
+ * NOT a fixed severity enum — each kind declares its own `caps.levels` and
14442
+ * the adapter maps this ordinal onto its native level. `level?` is an
14443
+ * optional kind-native level id (`emergency`, `silent`, …) that overrides
14444
+ * `priority` for that one target.
14445
+ */
14446
+ var NotificationSchema = object({
13357
14447
  body: string(),
13358
- imageUrl: string().optional(),
14448
+ title: string().optional(),
14449
+ format: NotificationFormatSchema.default("text"),
14450
+ priority: number().int().min(1).max(5).default(3),
14451
+ level: string().optional(),
14452
+ attachments: array(AttachmentSchema).optional(),
14453
+ clickUrl: string().optional(),
14454
+ actions: array(NotificationActionSchema).optional(),
14455
+ sound: string().optional(),
14456
+ ttl: number().optional(),
14457
+ tag: string().optional(),
13359
14458
  deviceId: number().optional(),
13360
14459
  eventId: string().optional(),
13361
- priority: _enum([
13362
- "low",
13363
- "normal",
13364
- "high",
13365
- "critical"
13366
- ]).default("normal"),
13367
14460
  metadata: record(string(), unknown()).optional()
13368
- }), _void(), { kind: "mutation" }), method(_void(), object({
14461
+ });
14462
+ /** One declared native severity/priority level for a kind. */
14463
+ var TargetKindLevelSchema = object({
14464
+ id: string(),
14465
+ label: string(),
14466
+ /** Which canonical priority (1..5) this level maps to. `null` = qualitative-only. */
14467
+ ordinal: number().int().min(1).max(5).nullable(),
14468
+ flags: object({
14469
+ critical: boolean().optional(),
14470
+ silent: boolean().optional(),
14471
+ noPush: boolean().optional()
14472
+ }).optional(),
14473
+ /** e.g. Pushover `emergency` requires `retry` / `expire`. */
14474
+ requires: array(string()).optional(),
14475
+ description: string().optional()
14476
+ });
14477
+ /** The full capability block consulted before dispatch. */
14478
+ var TargetKindCapsSchema = object({
14479
+ attachments: object({
14480
+ mediaTypes: array(AttachmentMediaTypeSchema),
14481
+ mode: _enum([
14482
+ "url",
14483
+ "bytes",
14484
+ "both"
14485
+ ]),
14486
+ max: number().int().nonnegative(),
14487
+ maxBytes: number().int().positive().optional()
14488
+ }),
14489
+ /** Max action buttons (0 = none). */
14490
+ actions: number().int().nonnegative(),
14491
+ levels: array(TargetKindLevelSchema),
14492
+ format: array(NotificationFormatSchema),
14493
+ clickUrl: boolean(),
14494
+ sound: boolean(),
14495
+ ttl: boolean(),
14496
+ bodyMaxLen: number().int().positive()
14497
+ });
14498
+ /**
14499
+ * `configSchema` is a `ConfigUISchema` tree passed through to the admin
14500
+ * FormBuilder. Stored as `z.unknown()` at the cap seam (mirrors
14501
+ * `device-provider.getChildCreationSchema` `CreationSchemaOutputSchema`) —
14502
+ * the union is large and not meant for runtime validation here; the exported
14503
+ * `TargetKind` type re-tightens `configSchema` to `ConfigUISchema`.
14504
+ */
14505
+ var ConfigSchemaPassthrough = unknown();
14506
+ var TargetKindSchema = object({
14507
+ kind: string(),
14508
+ label: string(),
14509
+ icon: string(),
14510
+ /** Stamped by each provider so the concat-fanned catalog stays routable. */
14511
+ addonId: string(),
14512
+ configSchema: ConfigSchemaPassthrough,
14513
+ supportsDiscovery: boolean(),
14514
+ caps: TargetKindCapsSchema
14515
+ });
14516
+ /**
14517
+ * A persisted target. `config` holds secrets; providers REDACT secret fields
14518
+ * (return a presence marker only) when serving `listTargets` — never
14519
+ * round-trip a stored secret to the UI.
14520
+ */
14521
+ var TargetSchema = object({
14522
+ id: string(),
14523
+ name: string(),
14524
+ kind: string(),
14525
+ addonId: string(),
14526
+ enabled: boolean(),
14527
+ config: record(string(), unknown())
14528
+ });
14529
+ /** A discovery-surfaced candidate (config is partial + non-secret). */
14530
+ var DiscoveredTargetSchema = object({
14531
+ kind: string(),
14532
+ suggestedName: string(),
14533
+ config: record(string(), unknown())
14534
+ });
14535
+ /** The degrade engine's report — what was resolved / dropped / degraded. */
14536
+ var RenderedAsSchema = object({
14537
+ level: string(),
14538
+ format: NotificationFormatSchema,
14539
+ attachmentsSent: number().int().nonnegative(),
14540
+ actionsSent: number().int().nonnegative(),
14541
+ truncated: boolean(),
14542
+ dropped: array(string())
14543
+ });
14544
+ var SendResultSchema = object({
13369
14545
  success: boolean(),
13370
- error: string().optional()
13371
- }), { kind: "mutation" });
14546
+ error: string().optional(),
14547
+ renderedAs: RenderedAsSchema.optional()
14548
+ });
14549
+ /** Same shape as SendResult — kept as a distinct name for the test panel. */
14550
+ var TestResultSchema = SendResultSchema;
14551
+ method(object({}), array(TargetKindSchema)), method(object({}), array(TargetSchema)), method(object({
14552
+ kind: string(),
14553
+ config: record(string(), unknown()).optional()
14554
+ }), array(DiscoveredTargetSchema)), method(object({
14555
+ targetId: string(),
14556
+ notification: NotificationSchema
14557
+ }), SendResultSchema, { kind: "mutation" }), method(object({
14558
+ targetId: string(),
14559
+ sample: NotificationSchema.optional()
14560
+ }), TestResultSchema, { kind: "mutation" }), method(object({ target: TargetSchema }), TargetSchema, { kind: "mutation" }), method(object({ targetId: string() }), _void(), { kind: "mutation" }), method(object({
14561
+ targetId: string(),
14562
+ enabled: boolean()
14563
+ }), _void(), { kind: "mutation" });
13372
14564
  /**
13373
14565
  * Zod schemas for persisted record types.
13374
14566
  *
@@ -13872,7 +15064,10 @@ var AgentLoadSummarySchema = object({
13872
15064
  online: boolean(),
13873
15065
  load: RunnerLocalLoadSchema,
13874
15066
  /** Computed score used by the L2 capacity balancer (lower = less loaded). */
13875
- score: number()
15067
+ score: number(),
15068
+ /** This node's decode hwaccel backend (per-node `probedBestHwaccel`), or null
15069
+ * when not yet probed — for the cluster Pipeline table UI (P0.2). */
15070
+ decodeHwaccel: string().nullable()
13876
15071
  });
13877
15072
  /**
13878
15073
  * Aggregate metrics across the whole detection cluster. Replaces the legacy
@@ -16390,7 +17585,10 @@ var HwAccelBackendInputSchema = _enum([
16390
17585
  "webgpu",
16391
17586
  "none"
16392
17587
  ]).nullable().optional();
16393
- var HwAccelResolutionSchema = object({ preferred: array(string()).readonly() });
17588
+ var HwAccelResolutionSchema = object({
17589
+ preferred: array(string()).readonly(),
17590
+ rationale: string()
17591
+ });
16394
17592
  var HardwareEncoderIdSchema = _enum([
16395
17593
  "h264_videotoolbox",
16396
17594
  "hevc_videotoolbox",
@@ -16405,7 +17603,7 @@ var HardwareEncoderIdSchema = _enum([
16405
17603
  "libx264",
16406
17604
  "libx265"
16407
17605
  ]);
16408
- var HardwareEncodersSchema = object({
17606
+ object({
16409
17607
  encoders: array(object({
16410
17608
  encoder: HardwareEncoderIdSchema,
16411
17609
  codec: _enum(["H264", "H265"]),
@@ -16424,15 +17622,7 @@ var HardwareEncodersSchema = object({
16424
17622
  defaultH265: HardwareEncoderIdSchema,
16425
17623
  probedAt: number()
16426
17624
  });
16427
- /**
16428
- * Decode-side companion to {@link HardwareEncodersSchema}: the `-hwaccel`
16429
- * methods the configured ffmpeg binary actually supports (parsed from
16430
- * `ffmpeg -hwaccels`). Used to gate decode-hwaccel attempts so the transcode
16431
- * egress never spends a spawn on a backend this build cannot offer. Per-stream
16432
- * decode fragility (e.g. VideoToolbox HEVC) is still handled by the egress's
16433
- * software fallback — this only filters out wholly-unsupported backends.
16434
- */
16435
- var HardwareDecodeAccelsSchema = object({
17625
+ object({
16436
17626
  methods: array(string()).readonly(),
16437
17627
  probedAt: number()
16438
17628
  });
@@ -16495,16 +17685,7 @@ var ResolvedInferenceConfigSchema = object({
16495
17685
  format: ModelFormatSchema,
16496
17686
  reason: string()
16497
17687
  });
16498
- method(_void(), PlatformCapabilitiesSchema), method(_void(), HardwareInfoSchema), method(object({ requirements: array(ModelRequirementSchema).readonly() }), ResolvedInferenceConfigSchema), method(object({
16499
- prefer: HwAccelBackendInputSchema,
16500
- nodeId: string().optional()
16501
- }), HwAccelResolutionSchema), method(_void(), HardwareEncodersSchema), method(_void(), HardwareEncodersSchema, {
16502
- kind: "mutation",
16503
- auth: "admin"
16504
- }), method(_void(), HardwareDecodeAccelsSchema), method(_void(), HardwareDecodeAccelsSchema, {
16505
- kind: "mutation",
16506
- auth: "admin"
16507
- });
17688
+ method(_void(), PlatformCapabilitiesSchema), method(_void(), HardwareInfoSchema), method(object({ requirements: array(ModelRequirementSchema).readonly() }), ResolvedInferenceConfigSchema), method(object({ prefer: HwAccelBackendInputSchema }), HwAccelResolutionSchema);
16508
17689
  var PtzPresetSchema = object({
16509
17690
  id: string(),
16510
17691
  name: string()
@@ -16557,6 +17738,16 @@ DeviceType.Camera, DeviceType.Sensor, DeviceType.Switch, method(object({ deviceI
16557
17738
  kind: "mutation",
16558
17739
  auth: "admin"
16559
17740
  });
17741
+ /**
17742
+ * `recording` cap — footage availability + HLS playback manifests + per-device
17743
+ * recording config. NOTE on events (source of truth, R5/C3): this cap carries
17744
+ * NO event surface — `getPlaybackManifest` returns playlist URLs only. Timeline
17745
+ * events (motion/object/audio) come from `pipelineAnalytics` (durable SQLite
17746
+ * rows); the recorder's internal EventMap markers are ephemeral in-RAM
17747
+ * annotations that are not exposed here and must not be treated as an event
17748
+ * feed. Event<->footage joins are by time, padded with the shared `EVENT_PAD_MS`
17749
+ * (`interfaces/recording-config.ts`).
17750
+ */
16560
17751
  var RecordingStatusSchema = object({
16561
17752
  deviceId: number(),
16562
17753
  enabled: boolean(),
@@ -18193,6 +19384,12 @@ Object.freeze({
18193
19384
  addonId: null,
18194
19385
  access: "view"
18195
19386
  },
19387
+ "deviceManager.getRoleDisplayDefaults": {
19388
+ capName: "device-manager",
19389
+ capScope: "system",
19390
+ addonId: null,
19391
+ access: "view"
19392
+ },
18196
19393
  "deviceManager.getSettingsSchema": {
18197
19394
  capName: "device-manager",
18198
19395
  capScope: "system",
@@ -18343,6 +19540,12 @@ Object.freeze({
18343
19540
  addonId: null,
18344
19541
  access: "create"
18345
19542
  },
19543
+ "deviceManager.setDisplay": {
19544
+ capName: "device-manager",
19545
+ capScope: "system",
19546
+ addonId: null,
19547
+ access: "create"
19548
+ },
18346
19549
  "deviceManager.setIntegrationId": {
18347
19550
  capName: "device-manager",
18348
19551
  capScope: "system",
@@ -18385,6 +19588,12 @@ Object.freeze({
18385
19588
  addonId: null,
18386
19589
  access: "create"
18387
19590
  },
19591
+ "deviceManager.setRoleDisplayDefaults": {
19592
+ capName: "device-manager",
19593
+ capScope: "system",
19594
+ addonId: null,
19595
+ access: "create"
19596
+ },
18388
19597
  "deviceManager.setStreamProfileMap": {
18389
19598
  capName: "device-manager",
18390
19599
  capScope: "system",
@@ -19363,13 +20572,49 @@ Object.freeze({
19363
20572
  addonId: null,
19364
20573
  access: "create"
19365
20574
  },
20575
+ "notificationOutput.deleteTarget": {
20576
+ capName: "notification-output",
20577
+ capScope: "system",
20578
+ addonId: null,
20579
+ access: "delete"
20580
+ },
20581
+ "notificationOutput.discoverTargets": {
20582
+ capName: "notification-output",
20583
+ capScope: "system",
20584
+ addonId: null,
20585
+ access: "view"
20586
+ },
20587
+ "notificationOutput.listTargetKinds": {
20588
+ capName: "notification-output",
20589
+ capScope: "system",
20590
+ addonId: null,
20591
+ access: "view"
20592
+ },
20593
+ "notificationOutput.listTargets": {
20594
+ capName: "notification-output",
20595
+ capScope: "system",
20596
+ addonId: null,
20597
+ access: "view"
20598
+ },
19366
20599
  "notificationOutput.send": {
19367
20600
  capName: "notification-output",
19368
20601
  capScope: "system",
19369
20602
  addonId: null,
19370
20603
  access: "create"
19371
20604
  },
19372
- "notificationOutput.sendTest": {
20605
+ "notificationOutput.setTargetEnabled": {
20606
+ capName: "notification-output",
20607
+ capScope: "system",
20608
+ addonId: null,
20609
+ access: "create"
20610
+ },
20611
+ "notificationOutput.testTarget": {
20612
+ capName: "notification-output",
20613
+ capScope: "system",
20614
+ addonId: null,
20615
+ access: "create"
20616
+ },
20617
+ "notificationOutput.upsertTarget": {
19373
20618
  capName: "notification-output",
19374
20619
  capScope: "system",
19375
20620
  addonId: null,
@@ -19399,6 +20644,66 @@ Object.freeze({
19399
20644
  addonId: null,
19400
20645
  access: "create"
19401
20646
  },
20647
+ "petFeeder.callPet": {
20648
+ capName: "pet-feeder",
20649
+ capScope: "device",
20650
+ addonId: null,
20651
+ access: "create"
20652
+ },
20653
+ "petFeeder.cancelFeed": {
20654
+ capName: "pet-feeder",
20655
+ capScope: "device",
20656
+ addonId: null,
20657
+ access: "create"
20658
+ },
20659
+ "petFeeder.feed": {
20660
+ capName: "pet-feeder",
20661
+ capScope: "device",
20662
+ addonId: null,
20663
+ access: "create"
20664
+ },
20665
+ "petFeeder.markFoodReplenished": {
20666
+ capName: "pet-feeder",
20667
+ capScope: "device",
20668
+ addonId: null,
20669
+ access: "create"
20670
+ },
20671
+ "petFeeder.playSound": {
20672
+ capName: "pet-feeder",
20673
+ capScope: "device",
20674
+ addonId: null,
20675
+ access: "create"
20676
+ },
20677
+ "petFeeder.resetDesiccant": {
20678
+ capName: "pet-feeder",
20679
+ capScope: "device",
20680
+ addonId: null,
20681
+ access: "delete"
20682
+ },
20683
+ "petFeeder.setChildLock": {
20684
+ capName: "pet-feeder",
20685
+ capScope: "device",
20686
+ addonId: null,
20687
+ access: "create"
20688
+ },
20689
+ "petFeeder.setFeedSound": {
20690
+ capName: "pet-feeder",
20691
+ capScope: "device",
20692
+ addonId: null,
20693
+ access: "create"
20694
+ },
20695
+ "petFeeder.setIndicatorLight": {
20696
+ capName: "pet-feeder",
20697
+ capScope: "device",
20698
+ addonId: null,
20699
+ access: "create"
20700
+ },
20701
+ "petFeeder.setVolume": {
20702
+ capName: "pet-feeder",
20703
+ capScope: "device",
20704
+ addonId: null,
20705
+ access: "create"
20706
+ },
19402
20707
  "pipelineAnalytics.clearTracks": {
19403
20708
  capName: "pipeline-analytics",
19404
20709
  capScope: "device",
@@ -20005,30 +21310,6 @@ Object.freeze({
20005
21310
  addonId: null,
20006
21311
  access: "view"
20007
21312
  },
20008
- "platformProbe.getHardwareDecodeAccels": {
20009
- capName: "platform-probe",
20010
- capScope: "system",
20011
- addonId: null,
20012
- access: "view"
20013
- },
20014
- "platformProbe.getHardwareEncoders": {
20015
- capName: "platform-probe",
20016
- capScope: "system",
20017
- addonId: null,
20018
- access: "view"
20019
- },
20020
- "platformProbe.refreshHardwareDecodeAccels": {
20021
- capName: "platform-probe",
20022
- capScope: "system",
20023
- addonId: null,
20024
- access: "create"
20025
- },
20026
- "platformProbe.refreshHardwareEncoders": {
20027
- capName: "platform-probe",
20028
- capScope: "system",
20029
- addonId: null,
20030
- access: "create"
20031
- },
20032
21313
  "platformProbe.resolveHwAccel": {
20033
21314
  capName: "platform-probe",
20034
21315
  capScope: "system",