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