@camstack/addon-provider-onvif 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.
Files changed (3) hide show
  1. package/dist/addon.js +1369 -95
  2. package/dist/addon.mjs +1369 -95
  3. package/package.json +1 -1
package/dist/addon.js CHANGED
@@ -4631,7 +4631,7 @@ function _instanceof(cls, params = {}) {
4631
4631
  return inst;
4632
4632
  }
4633
4633
  //#endregion
4634
- //#region ../types/dist/sleep-C2M2zF7x.mjs
4634
+ //#region ../types/dist/sleep-BiDFW0E7.mjs
4635
4635
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
4636
4636
  EventCategory["SystemBoot"] = "system.boot";
4637
4637
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -5444,6 +5444,100 @@ function createDurableState(deps) {
5444
5444
  };
5445
5445
  }
5446
5446
  /**
5447
+ * Per-node scoping for the shared addon-settings blob.
5448
+ *
5449
+ * An addon's settings store is hub-central (the `addon-settings` cap is
5450
+ * hub-routed — the hub instance answers for every node), so fields whose
5451
+ * value is a NODE fact (decoder backend, engine pick, probed hardware
5452
+ * capabilities) persist under the node-scoped key `<key>@<nodeId>` inside
5453
+ * the single shared blob. The SCHEMA field key stays bare: the write path
5454
+ * ({@link scopePatch}) maps the bare field onto the target node's scoped
5455
+ * key; the read/hydrate path ({@link projectStore}) maps THIS node's value
5456
+ * back, so UI forms and `resolveConfig` only ever see the bare key.
5457
+ *
5458
+ * Fields opt in via the `perNode: true` schema marker on `ConfigFieldBase`
5459
+ * (`interfaces/config-ui.ts`); `BaseAddon` derives the key set from the
5460
+ * schema and routes reads/writes through these helpers.
5461
+ *
5462
+ * ## No bare-key fallback — deliberate
5463
+ *
5464
+ * {@link readNodeValue} reads the node-scoped key ONLY. A node with no
5465
+ * scoped key resolves to `undefined` so the field's schema `default` wins —
5466
+ * NEVER `store[base]` and never another node's value. A bare legacy key in
5467
+ * the store is invisible to every node, hub included, so one node's
5468
+ * selection can never leak onto another. (This generalizes the
5469
+ * `decoder-backend-keys.ts` semantics — the no-fallback variant — over an
5470
+ * arbitrary set of per-node field keys.)
5471
+ *
5472
+ * Pure functions only — no I/O, no imports beyond the language. This is a
5473
+ * LEAF module: import it via its deep path, never from the root barrel.
5474
+ */
5475
+ /**
5476
+ * Normalize a raw kernel node id to the bare node id used for scoping.
5477
+ * `localNodeId` can carry a `<node>/<addon>` suffix on forked child
5478
+ * processes; per-node settings are per-NODE, so strip the addon segment.
5479
+ * `undefined` / `null` / empty falls back to `'hub'`.
5480
+ */
5481
+ function normalizeNodeId(raw) {
5482
+ if (raw === void 0 || raw === null || raw === "") return "hub";
5483
+ const slashIdx = raw.indexOf("/");
5484
+ if (slashIdx < 0) return raw;
5485
+ const bare = raw.slice(0, slashIdx);
5486
+ return bare === "" ? "hub" : bare;
5487
+ }
5488
+ /** The node-scoped store key for a per-node field: `<base>@<nodeId>`. */
5489
+ function nodeScopedKey(base, nodeId) {
5490
+ return `${base}@${normalizeNodeId(nodeId)}`;
5491
+ }
5492
+ /**
5493
+ * Read a node's value for a per-node field from the raw shared store:
5494
+ * the node-scoped key when present, otherwise `undefined`.
5495
+ * Deliberately NO bare-key fallback (see module doc) — the caller lets the
5496
+ * schema `default` win on `undefined`.
5497
+ */
5498
+ function readNodeValue(store, base, nodeId) {
5499
+ return store[nodeScopedKey(base, nodeId)];
5500
+ }
5501
+ /**
5502
+ * Re-map a UI/settings patch so every bare perNode field persists under the
5503
+ * TARGET node's scoped key; all other keys pass through unchanged. Used on
5504
+ * the write path so a save for one node never clobbers another node's value
5505
+ * (and the bare key is never written). Returns a new object — the input
5506
+ * patch is not mutated.
5507
+ */
5508
+ function scopePatch(patch, perNodeKeys, nodeId) {
5509
+ const out = {};
5510
+ for (const [key, value] of Object.entries(patch)) out[perNodeKeys.has(key) ? nodeScopedKey(key, nodeId) : key] = value;
5511
+ return out;
5512
+ }
5513
+ /**
5514
+ * Project the raw shared store onto the bare schema keys for ONE node so a
5515
+ * UI schema (whose field keys are bare) hydrates from that node's own
5516
+ * values:
5517
+ *
5518
+ * - EVERY `@`-scoped key (any node's) is dropped from the pass-through.
5519
+ * - Every bare perNode key is dropped from the pass-through (a stray bare
5520
+ * legacy key must never hydrate any node — no bare fallback).
5521
+ * - THIS node's effective value ({@link readNodeValue}) is then laid onto
5522
+ * each bare perNode key; when the node has no scoped key the bare key is
5523
+ * left ABSENT so the field's schema `default` wins.
5524
+ *
5525
+ * Returns a new object — the input store is not mutated.
5526
+ */
5527
+ function projectStore(store, perNodeKeys, nodeId) {
5528
+ const out = {};
5529
+ for (const [key, value] of Object.entries(store)) {
5530
+ if (key.includes("@")) continue;
5531
+ if (perNodeKeys.has(key)) continue;
5532
+ out[key] = value;
5533
+ }
5534
+ for (const base of perNodeKeys) {
5535
+ const value = readNodeValue(store, base, nodeId);
5536
+ if (value !== void 0) out[base] = value;
5537
+ }
5538
+ return out;
5539
+ }
5540
+ /**
5447
5541
  * Base class for CamStack addons. Eliminates settings boilerplate:
5448
5542
  *
5449
5543
  * - Typed `config` property with automatic resolution from store + defaults
@@ -5611,23 +5705,63 @@ var BaseAddon = class {
5611
5705
  deviceSettingsSchema() {
5612
5706
  return null;
5613
5707
  }
5614
- async getGlobalSettings(overlay, cap, _nodeId) {
5708
+ async getGlobalSettings(overlay, cap, nodeId) {
5615
5709
  const schema = this.globalSettingsSchema(cap);
5616
5710
  if (!schema) return { sections: [] };
5617
- const raw = await this._ctx?.settings?.readAddonStore() ?? {};
5711
+ const projected = await this.resolveGlobalStore(nodeId, cap);
5618
5712
  return hydrateSchema(schema, overlay ? {
5619
- ...raw,
5713
+ ...projected,
5620
5714
  ...overlay
5621
- } : raw);
5715
+ } : projected);
5716
+ }
5717
+ /**
5718
+ * The raw addon store PROJECTED onto the target node's bare per-node keys:
5719
+ * every `perNode: true` field carries THAT node's scoped value on its bare
5720
+ * key (absent scoped key ⇒ key absent, so the schema `default` wins — no
5721
+ * bare fallback), all `@`-scoped and stray bare per-node keys are dropped.
5722
+ * A no-op passthrough when the schema declares no `perNode` field.
5723
+ *
5724
+ * This is the sanctioned way for a `getGlobalSettings` OVERRIDE that needs
5725
+ * the store for custom option logic (option narrowing, value snapping) to
5726
+ * read it per-node — never `ctx.settings.readAddonStore()` directly.
5727
+ * `nodeId` omitted ⇒ the local node (node-blind injection from ctx).
5728
+ */
5729
+ async resolveGlobalStore(nodeId, cap) {
5730
+ const raw = await this._ctx?.settings?.readAddonStore() ?? {};
5731
+ const keys = this.perNodeKeys(cap);
5732
+ const node = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
5733
+ return keys.size > 0 ? projectStore(raw, keys, node) : raw;
5622
5734
  }
5623
- async updateGlobalSettings(patch, _nodeId) {
5624
- await this._ctx?.settings?.writeAddonStore(patch);
5735
+ async updateGlobalSettings(patch, nodeId) {
5736
+ const keys = this.perNodeKeys();
5737
+ const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
5738
+ const target = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
5739
+ const barePatch = patch;
5740
+ const scoped = keys.size > 0 ? scopePatch(barePatch, keys, target) : barePatch;
5741
+ await this._ctx?.settings?.writeAddonStore(scoped);
5742
+ if (target !== localNode) return;
5625
5743
  await this.resolveConfig();
5626
5744
  await this.onConfigChanged();
5627
5745
  this.emitLifecycle(EventCategory.AddonUpdated, { level: "global" });
5628
5746
  this.maybeAutoRestart(patch, this.globalSettingsSchema());
5629
5747
  }
5630
5748
  /**
5749
+ * The set of field keys the global settings schema declares `perNode: true`
5750
+ * — derived once per `cap` argument and memoized (schemas are static
5751
+ * declarations). Empty set ⇒ every per-node code path is bypassed and the
5752
+ * settings API behaves exactly like the legacy node-agnostic one.
5753
+ */
5754
+ _perNodeKeysCache = /* @__PURE__ */ new Map();
5755
+ perNodeKeys(cap) {
5756
+ const cacheKey = cap ?? "";
5757
+ const cached = this._perNodeKeysCache.get(cacheKey);
5758
+ if (cached) return cached;
5759
+ const schema = this.globalSettingsSchema(cap);
5760
+ const keys = new Set(schema ? schema.sections.flatMap((section) => collectPerNodeFieldKeys(section.fields)) : []);
5761
+ this._perNodeKeysCache.set(cacheKey, keys);
5762
+ return keys;
5763
+ }
5764
+ /**
5631
5765
  * If any field in `patch` is marked `requiresRestart` in `schema`,
5632
5766
  * schedule an addon restart for the next tick. Deferred via
5633
5767
  * `setImmediate` so the tRPC mutation that triggered the write has
@@ -5780,12 +5914,19 @@ var BaseAddon = class {
5780
5914
  * The merge is shallow: each key in `defaults` is checked against the store.
5781
5915
  * Only keys present in defaults are read — the store can contain extra keys
5782
5916
  * (e.g. from older versions) without polluting the typed config.
5917
+ *
5918
+ * Keys the global settings schema declares `perNode: true` resolve from
5919
+ * THIS node's scoped key (`<key>@<localNode>`) via `readNodeValue` — never
5920
+ * from the bare key — so a per-node field resolves to this node's own
5921
+ * selection at boot (absent scoped key ⇒ the constructor default wins).
5783
5922
  */
5784
5923
  async resolveConfig() {
5785
5924
  const stored = await this.readAddonStoreWithRetry();
5925
+ const perNode = this.perNodeKeys();
5926
+ const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
5786
5927
  const resolved = { ...this.defaults };
5787
5928
  for (const key of Object.keys(this.defaults)) {
5788
- const storedValue = stored[key];
5929
+ const storedValue = perNode.has(key) ? readNodeValue(stored, key, localNode) : stored[key];
5789
5930
  if (storedValue !== void 0 && storedValue !== null) {
5790
5931
  const defaultType = typeof this.defaults[key];
5791
5932
  if (typeof storedValue === defaultType) resolved[key] = storedValue;
@@ -5869,6 +6010,27 @@ var BaseAddon = class {
5869
6010
  }
5870
6011
  };
5871
6012
  /**
6013
+ * Collect the keys of every field marked `perNode: true`, recursing into
6014
+ * layout containers (`group` fields and `sub-tabs` tabs) the same way
6015
+ * `hydrateSchema` does. Valueless structural fields (separator/info/…)
6016
+ * don't declare `perNode` and are excluded by the `in` narrowing.
6017
+ */
6018
+ function collectPerNodeFieldKeys(fields) {
6019
+ const collected = [];
6020
+ for (const field of fields) {
6021
+ if (field.type === "group") {
6022
+ collected.push(...collectPerNodeFieldKeys(field.fields));
6023
+ continue;
6024
+ }
6025
+ if (field.type === "sub-tabs") {
6026
+ for (const tab of field.tabs) collected.push(...collectPerNodeFieldKeys(tab.fields));
6027
+ continue;
6028
+ }
6029
+ if ("perNode" in field && field.perNode === true) collected.push(field.key);
6030
+ }
6031
+ return collected;
6032
+ }
6033
+ /**
5872
6034
  * Normalize an `ICamstackAddon.initialize()` return value into the
5873
6035
  * `AddonInitResult` envelope. Arrays are wrapped into `{ providers }`;
5874
6036
  * envelopes pass through; void stays void.
@@ -5893,6 +6055,7 @@ var CamStreamKindSchema = _enum([
5893
6055
  "pull-rtsp",
5894
6056
  "pull-rtmp",
5895
6057
  "pull-http",
6058
+ "pull-flv",
5896
6059
  "pull-rfc4571",
5897
6060
  "push-annexb",
5898
6061
  "derived"
@@ -6275,6 +6438,13 @@ var DeviceType = /* @__PURE__ */ function(DeviceType) {
6275
6438
  /** Single still-image entity (HA `image.*`). Read-only display of an
6276
6439
  * `entity_picture` signed URL the browser loads directly. `image` cap. */
6277
6440
  DeviceType["Image"] = "image";
6441
+ /** Smart pet feeder — cloud-connected food dispenser with a bowl food
6442
+ * level, battery, desiccant life, feeding state and manual-feed /
6443
+ * call-pet / maintenance actions. Installed with the `pet-feeder` cap;
6444
+ * dual-hopper models (D4S/D4SH) expose per-hopper portions. Sources:
6445
+ * native PetKit (`nodepetkit` `FeederDevice`), reusable by other feeder
6446
+ * integrations sharing the same food/desiccant/hopper surface. */
6447
+ DeviceType["PetFeeder"] = "pet-feeder";
6278
6448
  return DeviceType;
6279
6449
  }({});
6280
6450
  var DeviceFeature = /* @__PURE__ */ function(DeviceFeature) {
@@ -7435,6 +7605,601 @@ var _macroLookup = /* @__PURE__ */ new Map();
7435
7605
  for (const [k, v] of Object.entries(YAMNET_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
7436
7606
  for (const [k, v] of Object.entries(APPLE_SA_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
7437
7607
  /**
7608
+ * Error types for the safe expression engine. Two distinct classes so callers
7609
+ * can tell a compile-time (grammar) failure from a runtime (evaluation)
7610
+ * failure — both are non-fatal to the host: read paths degrade to "skip link".
7611
+ */
7612
+ /** Thrown by the tokenizer / parser. Carries a 0-based source `position` when
7613
+ * the failure is anchored to a character (author-facing inline feedback). */
7614
+ var ExpressionParseError = class extends Error {
7615
+ position;
7616
+ constructor(message, position) {
7617
+ super(message);
7618
+ this.name = "ExpressionParseError";
7619
+ this.position = position;
7620
+ }
7621
+ };
7622
+ /** Thrown by the evaluator (unknown identifier, type mismatch, non-finite
7623
+ * result, unknown builtin, step-budget exceeded). */
7624
+ var ExpressionEvalError = class extends Error {
7625
+ constructor(message) {
7626
+ super(message);
7627
+ this.name = "ExpressionEvalError";
7628
+ }
7629
+ };
7630
+ /**
7631
+ * Resource-bound constants for the safe expression engine.
7632
+ *
7633
+ * Every bound is defense-in-depth: the grammar is non-Turing-complete (no
7634
+ * loops, recursion, lambdas or member access — see `ast.ts`), so evaluation is
7635
+ * O(nodeCount) by construction. These caps merely put a hard ceiling on the
7636
+ * work a single author-supplied expression can request, so a hostile or
7637
+ * accidental pathological string can never spend unbounded CPU/memory.
7638
+ */
7639
+ /** Max source length (chars) — checked BEFORE tokenizing so a huge string is
7640
+ * rejected without allocation. */
7641
+ var MAX_EXPRESSION_SOURCE_LENGTH = 2048;
7642
+ /** A legal binding / identifier name. */
7643
+ var EXPRESSION_IDENTIFIER_RE = /^[A-Za-z_][A-Za-z0-9_]*$/;
7644
+ /** Binding names an author may NOT use: `now` is auto-injected; the literal
7645
+ * keywords lex as values, not identifiers, so binding to them is meaningless. */
7646
+ var RESERVED_BINDING_NAMES = new Set([
7647
+ "now",
7648
+ "true",
7649
+ "false",
7650
+ "null"
7651
+ ]);
7652
+ /**
7653
+ * Tokenizer for the safe expression mini-language. Hand-rolled, single-pass,
7654
+ * zero-dependency. The grammar is deliberately boring: decimal numbers,
7655
+ * single/double-quoted strings with a tiny escape set, identifiers, the three
7656
+ * value keywords (`true`/`false`/`null`) and a fixed punctuator set. Anything
7657
+ * outside that — a bare `.`, `=`, `[`, `]`, `{`, `}`, `;`, backtick, `&`, `|` —
7658
+ * is a parse error with a source position, so member access / assignment /
7659
+ * template literals are lexically impossible.
7660
+ */
7661
+ var KEYWORDS = new Set([
7662
+ "true",
7663
+ "false",
7664
+ "null"
7665
+ ]);
7666
+ function isDigit(ch) {
7667
+ return ch >= "0" && ch <= "9";
7668
+ }
7669
+ function isIdentStart(ch) {
7670
+ return ch >= "A" && ch <= "Z" || ch >= "a" && ch <= "z" || ch === "_";
7671
+ }
7672
+ function isIdentPart(ch) {
7673
+ return isIdentStart(ch) || isDigit(ch);
7674
+ }
7675
+ function isWhitespace(ch) {
7676
+ return ch === " " || ch === " " || ch === "\n" || ch === "\r" || ch === "\f" || ch === "\v";
7677
+ }
7678
+ /** Tokenize `source` into a flat token list ending with a single `eof` token.
7679
+ * Throws `ExpressionParseError` on any illegal character or unterminated
7680
+ * string. */
7681
+ function tokenize(source) {
7682
+ if (source.length > 2048) throw new ExpressionParseError(`expression too long (${source.length} > ${MAX_EXPRESSION_SOURCE_LENGTH} chars)`, 0);
7683
+ const tokens = [];
7684
+ let i = 0;
7685
+ const n = source.length;
7686
+ while (i < n) {
7687
+ const ch = source[i];
7688
+ if (isWhitespace(ch)) {
7689
+ i += 1;
7690
+ continue;
7691
+ }
7692
+ if (isDigit(ch)) {
7693
+ const start = i;
7694
+ while (i < n && isDigit(source[i])) i += 1;
7695
+ if (i < n && source[i] === ".") {
7696
+ if (i + 1 >= n || !isDigit(source[i + 1])) throw new ExpressionParseError("malformed number: decimal point needs a digit", i);
7697
+ i += 1;
7698
+ while (i < n && isDigit(source[i])) i += 1;
7699
+ }
7700
+ const text = source.slice(start, i);
7701
+ const value = Number(text);
7702
+ if (!Number.isFinite(value)) throw new ExpressionParseError(`malformed number: '${text}'`, start);
7703
+ tokens.push({
7704
+ type: "number",
7705
+ value,
7706
+ pos: start
7707
+ });
7708
+ continue;
7709
+ }
7710
+ if (ch === "'" || ch === "\"") {
7711
+ const quote = ch;
7712
+ const start = i;
7713
+ i += 1;
7714
+ let out = "";
7715
+ let closed = false;
7716
+ while (i < n) {
7717
+ const c = source[i];
7718
+ if (c === "\\") {
7719
+ const next = i + 1 < n ? source[i + 1] : "";
7720
+ if (next === "\\" || next === "'" || next === "\"") {
7721
+ out += next;
7722
+ i += 2;
7723
+ continue;
7724
+ }
7725
+ throw new ExpressionParseError(`invalid string escape: '\\${next}'`, i);
7726
+ }
7727
+ if (c === quote) {
7728
+ closed = true;
7729
+ i += 1;
7730
+ break;
7731
+ }
7732
+ out += c;
7733
+ i += 1;
7734
+ }
7735
+ if (!closed) throw new ExpressionParseError("unterminated string literal", start);
7736
+ tokens.push({
7737
+ type: "string",
7738
+ value: out,
7739
+ pos: start
7740
+ });
7741
+ continue;
7742
+ }
7743
+ if (isIdentStart(ch)) {
7744
+ const start = i;
7745
+ while (i < n && isIdentPart(source[i])) i += 1;
7746
+ const text = source.slice(start, i);
7747
+ if (KEYWORDS.has(text)) tokens.push({
7748
+ type: "keyword",
7749
+ keyword: keywordOf(text),
7750
+ pos: start
7751
+ });
7752
+ else tokens.push({
7753
+ type: "identifier",
7754
+ name: text,
7755
+ pos: start
7756
+ });
7757
+ continue;
7758
+ }
7759
+ const two = i + 1 < n ? source.slice(i, i + 2) : "";
7760
+ if (two === "<=" || two === ">=" || two === "==" || two === "!=" || two === "&&" || two === "||") {
7761
+ tokens.push({
7762
+ type: "punct",
7763
+ punct: two,
7764
+ pos: i
7765
+ });
7766
+ i += 2;
7767
+ continue;
7768
+ }
7769
+ if (isSinglePunct(ch)) {
7770
+ tokens.push({
7771
+ type: "punct",
7772
+ punct: ch,
7773
+ pos: i
7774
+ });
7775
+ i += 1;
7776
+ continue;
7777
+ }
7778
+ throw new ExpressionParseError(`unexpected character '${ch}'`, i);
7779
+ }
7780
+ tokens.push({
7781
+ type: "eof",
7782
+ pos: n
7783
+ });
7784
+ return tokens;
7785
+ }
7786
+ function keywordOf(text) {
7787
+ if (text === "true") return "true";
7788
+ if (text === "false") return "false";
7789
+ return "null";
7790
+ }
7791
+ function isSinglePunct(ch) {
7792
+ return ch === "(" || ch === ")" || ch === "," || ch === "?" || ch === ":" || ch === "+" || ch === "-" || ch === "*" || ch === "/" || ch === "%" || ch === "!" || ch === "<" || ch === ">";
7793
+ }
7794
+ /**
7795
+ * Frozen, null-prototype builtin function table for the expression engine
7796
+ * (spec §4 rule 4). The table is the SOLE surface of callable functions: the
7797
+ * parser rejects any callee not in it, and the evaluator gates each call on an
7798
+ * own-property check against it.
7799
+ *
7800
+ * Because the object has a NULL prototype AND is `Object.freeze`d:
7801
+ * - it cannot be polluted (no `__proto__` / `constructor` write reaches it);
7802
+ * - a lookup for `toString` / `hasOwnProperty` / `constructor` finds NOTHING
7803
+ * (there is no `Object.prototype` in the chain), so those names are not
7804
+ * callable — they are simply "unknown function" at parse time.
7805
+ *
7806
+ * Every numeric argument is validated as a finite number and every numeric
7807
+ * RESULT is re-checked finite, so `/0`, `sqrt(-1)` (→ NaN) and overflow
7808
+ * (`pow(10,400)` → Infinity) all raise `ExpressionEvalError` and fail the link
7809
+ * closed rather than emitting a garbage value.
7810
+ */
7811
+ function asFiniteNumber(value, name, index) {
7812
+ if (typeof value !== "number" || !Number.isFinite(value)) throw new ExpressionEvalError(`${name}: argument ${index + 1} must be a finite number`);
7813
+ return value;
7814
+ }
7815
+ function asString$1(value, name, index) {
7816
+ if (typeof value !== "string") throw new ExpressionEvalError(`${name}: argument ${index + 1} must be a string`);
7817
+ return value;
7818
+ }
7819
+ function finiteResult(value, name) {
7820
+ if (!Number.isFinite(value)) throw new ExpressionEvalError(`${name}: produced a non-finite result`);
7821
+ return value;
7822
+ }
7823
+ function allFiniteNumbers(args, name) {
7824
+ return args.map((a, idx) => asFiniteNumber(a, name, idx));
7825
+ }
7826
+ var INF = Number.POSITIVE_INFINITY;
7827
+ var table = {
7828
+ min: {
7829
+ minArgs: 1,
7830
+ maxArgs: INF,
7831
+ apply: (args) => finiteResult(Math.min(...allFiniteNumbers(args, "min")), "min")
7832
+ },
7833
+ max: {
7834
+ minArgs: 1,
7835
+ maxArgs: INF,
7836
+ apply: (args) => finiteResult(Math.max(...allFiniteNumbers(args, "max")), "max")
7837
+ },
7838
+ abs: {
7839
+ minArgs: 1,
7840
+ maxArgs: 1,
7841
+ apply: (args) => finiteResult(Math.abs(asFiniteNumber(args[0], "abs", 0)), "abs")
7842
+ },
7843
+ floor: {
7844
+ minArgs: 1,
7845
+ maxArgs: 1,
7846
+ apply: (args) => finiteResult(Math.floor(asFiniteNumber(args[0], "floor", 0)), "floor")
7847
+ },
7848
+ ceil: {
7849
+ minArgs: 1,
7850
+ maxArgs: 1,
7851
+ apply: (args) => finiteResult(Math.ceil(asFiniteNumber(args[0], "ceil", 0)), "ceil")
7852
+ },
7853
+ sqrt: {
7854
+ minArgs: 1,
7855
+ maxArgs: 1,
7856
+ apply: (args) => finiteResult(Math.sqrt(asFiniteNumber(args[0], "sqrt", 0)), "sqrt")
7857
+ },
7858
+ round: {
7859
+ minArgs: 1,
7860
+ maxArgs: 2,
7861
+ apply: (args) => {
7862
+ const x = asFiniteNumber(args[0], "round", 0);
7863
+ const digits = args.length > 1 ? Math.trunc(asFiniteNumber(args[1], "round", 1)) : 0;
7864
+ if (digits < 0 || digits > 100) throw new ExpressionEvalError("round: digits must be between 0 and 100");
7865
+ const factor = 10 ** digits;
7866
+ return finiteResult(Math.round(x * factor) / factor, "round");
7867
+ }
7868
+ },
7869
+ pow: {
7870
+ minArgs: 2,
7871
+ maxArgs: 2,
7872
+ apply: (args) => finiteResult(asFiniteNumber(args[0], "pow", 0) ** asFiniteNumber(args[1], "pow", 1), "pow")
7873
+ },
7874
+ clamp: {
7875
+ minArgs: 3,
7876
+ maxArgs: 3,
7877
+ apply: (args) => {
7878
+ const x = asFiniteNumber(args[0], "clamp", 0);
7879
+ const lo = asFiniteNumber(args[1], "clamp", 1);
7880
+ const hi = asFiniteNumber(args[2], "clamp", 2);
7881
+ if (lo > hi) throw new ExpressionEvalError("clamp: lower bound is greater than upper bound");
7882
+ return finiteResult(Math.min(hi, Math.max(lo, x)), "clamp");
7883
+ }
7884
+ },
7885
+ avg: {
7886
+ minArgs: 1,
7887
+ maxArgs: INF,
7888
+ apply: (args) => {
7889
+ const nums = allFiniteNumbers(args, "avg");
7890
+ return finiteResult(nums.reduce((acc, v) => acc + v, 0) / nums.length, "avg");
7891
+ }
7892
+ },
7893
+ sum: {
7894
+ minArgs: 1,
7895
+ maxArgs: INF,
7896
+ apply: (args) => finiteResult(allFiniteNumbers(args, "sum").reduce((acc, v) => acc + v, 0), "sum")
7897
+ },
7898
+ coalesce: {
7899
+ minArgs: 1,
7900
+ maxArgs: INF,
7901
+ apply: (args) => {
7902
+ for (const a of args) if (a !== null) return a;
7903
+ return null;
7904
+ }
7905
+ },
7906
+ age: {
7907
+ minArgs: 2,
7908
+ maxArgs: 2,
7909
+ apply: (args) => finiteResult(asFiniteNumber(args[0], "age", 0) - asFiniteNumber(args[1], "age", 1), "age")
7910
+ },
7911
+ convert: {
7912
+ minArgs: 3,
7913
+ maxArgs: 3,
7914
+ apply: (args, hooks) => {
7915
+ const x = asFiniteNumber(args[0], "convert", 0);
7916
+ const from = asString$1(args[1], "convert", 1).trim();
7917
+ const to = asString$1(args[2], "convert", 2).trim();
7918
+ if (hooks.convert) {
7919
+ const out = hooks.convert(x, from, to);
7920
+ if (out === null) throw new ExpressionEvalError(`convert: cannot convert '${from}' to '${to}'`);
7921
+ return finiteResult(out, "convert");
7922
+ }
7923
+ if (from === to) return x;
7924
+ throw new ExpressionEvalError("convert: unit conversion table not installed");
7925
+ }
7926
+ }
7927
+ };
7928
+ Object.freeze(Object.assign(Object.create(null), table));
7929
+ /** The set of valid builtin names — used by the parser to reject unknown
7930
+ * callees at parse time (immediate author feedback). */
7931
+ var EXPRESSION_BUILTIN_NAMES = new Set(Object.keys(table));
7932
+ /**
7933
+ * Pratt (precedence-climbing) parser for the safe expression mini-language.
7934
+ *
7935
+ * Precedence (low → high): ternary `?:` (right-assoc) → `||` → `&&` → equality
7936
+ * → relational → additive → multiplicative → unary `! -` → call / primary.
7937
+ * Calls are ONLY `IDENT '(' args? ')'` at primary position — the callee is a
7938
+ * string validated against the builtin table at parse time, so an unknown
7939
+ * function is rejected immediately (author feedback) and a persisted expression
7940
+ * that references a since-removed builtin degrades at read.
7941
+ *
7942
+ * A node counter caps total AST size (`MAX_EXPRESSION_AST_NODES`) and call
7943
+ * arity is capped (`MAX_EXPRESSION_CALL_ARGS`) — both raise `ExpressionParseError`.
7944
+ */
7945
+ /** Binary/logical operator precedence (higher binds tighter). */
7946
+ var BINARY_PRECEDENCE = {
7947
+ "||": 1,
7948
+ "&&": 2,
7949
+ "==": 3,
7950
+ "!=": 3,
7951
+ "<": 4,
7952
+ "<=": 4,
7953
+ ">": 4,
7954
+ ">=": 4,
7955
+ "+": 5,
7956
+ "-": 5,
7957
+ "*": 6,
7958
+ "/": 6,
7959
+ "%": 6
7960
+ };
7961
+ function isLogicalOp(op) {
7962
+ return op === "&&" || op === "||";
7963
+ }
7964
+ function isBinaryOp(op) {
7965
+ return op === "+" || op === "-" || op === "*" || op === "/" || op === "%" || op === "==" || op === "!=" || op === "<" || op === "<=" || op === ">" || op === ">=";
7966
+ }
7967
+ var Parser = class {
7968
+ tokens;
7969
+ pos = 0;
7970
+ nodeCount = 0;
7971
+ identifiers = /* @__PURE__ */ new Set();
7972
+ callees = /* @__PURE__ */ new Set();
7973
+ constructor(tokens) {
7974
+ this.tokens = tokens;
7975
+ }
7976
+ parse() {
7977
+ const ast = this.parseTernary();
7978
+ const tok = this.peek();
7979
+ if (tok.type !== "eof") throw new ExpressionParseError("unexpected trailing input", tok.pos);
7980
+ return {
7981
+ ast,
7982
+ identifiers: this.identifiers,
7983
+ callees: this.callees,
7984
+ nodeCount: this.nodeCount
7985
+ };
7986
+ }
7987
+ peek() {
7988
+ return this.tokens[this.pos];
7989
+ }
7990
+ next() {
7991
+ return this.tokens[this.pos++];
7992
+ }
7993
+ /** Consume a punctuator token, erroring if the next token isn't it. */
7994
+ expectPunct(punct) {
7995
+ const tok = this.peek();
7996
+ if (tok.type !== "punct" || tok.punct !== punct) throw new ExpressionParseError(`expected '${punct}'`, tok.pos);
7997
+ this.pos += 1;
7998
+ }
7999
+ matchPunct(punct) {
8000
+ const tok = this.peek();
8001
+ if (tok.type === "punct" && tok.punct === punct) {
8002
+ this.pos += 1;
8003
+ return true;
8004
+ }
8005
+ return false;
8006
+ }
8007
+ countNode() {
8008
+ this.nodeCount += 1;
8009
+ if (this.nodeCount > 256) throw new ExpressionParseError("expression too complex", this.peek().pos);
8010
+ }
8011
+ parseTernary() {
8012
+ const test = this.parseBinary(1);
8013
+ if (this.matchPunct("?")) {
8014
+ const consequent = this.parseTernary();
8015
+ this.expectPunct(":");
8016
+ const alternate = this.parseTernary();
8017
+ this.countNode();
8018
+ return {
8019
+ kind: "conditional",
8020
+ test,
8021
+ consequent,
8022
+ alternate
8023
+ };
8024
+ }
8025
+ return test;
8026
+ }
8027
+ parseBinary(minPrec) {
8028
+ let left = this.parseUnary();
8029
+ for (;;) {
8030
+ const tok = this.peek();
8031
+ if (tok.type !== "punct") break;
8032
+ const prec = BINARY_PRECEDENCE[tok.punct];
8033
+ if (prec === void 0 || prec < minPrec) break;
8034
+ const op = tok.punct;
8035
+ this.pos += 1;
8036
+ const right = this.parseBinary(prec + 1);
8037
+ this.countNode();
8038
+ if (isLogicalOp(op)) left = {
8039
+ kind: "logical",
8040
+ op,
8041
+ left,
8042
+ right
8043
+ };
8044
+ else if (isBinaryOp(op)) left = {
8045
+ kind: "binary",
8046
+ op,
8047
+ left,
8048
+ right
8049
+ };
8050
+ else throw new ExpressionParseError(`unexpected operator '${op}'`, tok.pos);
8051
+ }
8052
+ return left;
8053
+ }
8054
+ parseUnary() {
8055
+ const tok = this.peek();
8056
+ if (tok.type === "punct" && (tok.punct === "!" || tok.punct === "-")) {
8057
+ const op = tok.punct;
8058
+ this.pos += 1;
8059
+ const operand = this.parseUnary();
8060
+ this.countNode();
8061
+ return {
8062
+ kind: "unary",
8063
+ op,
8064
+ operand
8065
+ };
8066
+ }
8067
+ return this.parsePrimary();
8068
+ }
8069
+ parsePrimary() {
8070
+ const tok = this.next();
8071
+ switch (tok.type) {
8072
+ case "number":
8073
+ this.countNode();
8074
+ return {
8075
+ kind: "literal",
8076
+ value: tok.value
8077
+ };
8078
+ case "string":
8079
+ this.countNode();
8080
+ return {
8081
+ kind: "literal",
8082
+ value: tok.value
8083
+ };
8084
+ case "keyword":
8085
+ this.countNode();
8086
+ return {
8087
+ kind: "literal",
8088
+ value: tok.keyword === "null" ? null : tok.keyword === "true"
8089
+ };
8090
+ case "identifier": {
8091
+ const nextTok = this.peek();
8092
+ if (nextTok.type === "punct" && nextTok.punct === "(") return this.parseCall(tok.name, tok.pos);
8093
+ this.identifiers.add(tok.name);
8094
+ this.countNode();
8095
+ return {
8096
+ kind: "identifier",
8097
+ name: tok.name
8098
+ };
8099
+ }
8100
+ case "punct":
8101
+ if (tok.punct === "(") {
8102
+ const inner = this.parseTernary();
8103
+ this.expectPunct(")");
8104
+ return inner;
8105
+ }
8106
+ throw new ExpressionParseError(`unexpected token '${tok.punct}'`, tok.pos);
8107
+ case "eof": throw new ExpressionParseError("unexpected end of expression", tok.pos);
8108
+ }
8109
+ }
8110
+ parseCall(callee, pos) {
8111
+ if (!EXPRESSION_BUILTIN_NAMES.has(callee)) throw new ExpressionParseError(`unknown function '${callee}'`, pos);
8112
+ this.expectPunct("(");
8113
+ const args = [];
8114
+ if (!this.matchPunct(")")) for (;;) {
8115
+ args.push(this.parseTernary());
8116
+ if (args.length > 16) throw new ExpressionParseError(`too many arguments to '${callee}'`, pos);
8117
+ if (this.matchPunct(",")) continue;
8118
+ this.expectPunct(")");
8119
+ break;
8120
+ }
8121
+ this.callees.add(callee);
8122
+ this.countNode();
8123
+ return {
8124
+ kind: "call",
8125
+ callee,
8126
+ args
8127
+ };
8128
+ }
8129
+ };
8130
+ /** Tokenize + parse `source` into a validated `ParsedExpression`. Throws
8131
+ * `ExpressionParseError` on any lexical or grammatical failure. */
8132
+ function parseExpression(source) {
8133
+ return new Parser(tokenize(source)).parse();
8134
+ }
8135
+ Object.freeze({});
8136
+ /**
8137
+ * LRU compile cache for parsed expressions (spec §2.4 "parse once … LRU keyed
8138
+ * by expr"). The cache stores BOTH successes and failures (negative caching),
8139
+ * so a corrupt persisted string costs exactly one tokenize+parse total — not
8140
+ * one per read on a hot resolve path.
8141
+ *
8142
+ * The cache is a module-level singleton: entries are pure, content-addressed
8143
+ * ASTs keyed by the raw source string, so sharing one instance across all
8144
+ * callers is safe and maximises hit rate.
8145
+ */
8146
+ var cache = /* @__PURE__ */ new Map();
8147
+ function getCached(source) {
8148
+ const hit = cache.get(source);
8149
+ if (hit !== void 0) {
8150
+ cache.delete(source);
8151
+ cache.set(source, hit);
8152
+ return hit;
8153
+ }
8154
+ let result;
8155
+ try {
8156
+ result = {
8157
+ ok: true,
8158
+ parsed: parseExpression(source)
8159
+ };
8160
+ } catch (err) {
8161
+ result = {
8162
+ ok: false,
8163
+ error: err instanceof ExpressionParseError ? err.message : String(err)
8164
+ };
8165
+ }
8166
+ cache.set(source, result);
8167
+ if (cache.size > 256) {
8168
+ const oldest = cache.keys().next().value;
8169
+ if (oldest !== void 0) cache.delete(oldest);
8170
+ }
8171
+ return result;
8172
+ }
8173
+ /** Compile `source`, returning a discriminated result instead of throwing.
8174
+ * Used by read paths that must degrade rather than raise. LRU/negative-cached. */
8175
+ function compileExpressionSafe(source) {
8176
+ return getCached(source);
8177
+ }
8178
+ /**
8179
+ * Author-time validation. Returns `null` when the source is valid, else a
8180
+ * human-readable error message. Checks: the expression compiles; binding count
8181
+ * is within `MAX_EXPRESSION_BINDINGS`; every binding name is a legal identifier,
8182
+ * is not reserved (`now`/keywords) and does not shadow a builtin; and every
8183
+ * FREE identifier of the AST is covered by a binding or the injected `now`.
8184
+ */
8185
+ function validateExpressionSource(src) {
8186
+ const names = Object.keys(src.bindings);
8187
+ if (names.length > 32) return `too many bindings (${names.length} > 32)`;
8188
+ for (const name of names) {
8189
+ if (!EXPRESSION_IDENTIFIER_RE.test(name)) return `invalid binding name '${name}'`;
8190
+ if (RESERVED_BINDING_NAMES.has(name)) return `binding name '${name}' is reserved`;
8191
+ if (EXPRESSION_BUILTIN_NAMES.has(name)) return `binding name '${name}' shadows a builtin function`;
8192
+ }
8193
+ const compiled = compileExpressionSafe(src.expr);
8194
+ if (!compiled.ok) return compiled.error;
8195
+ const bound = new Set(names);
8196
+ for (const id of compiled.parsed.identifiers) {
8197
+ if (id === "now") continue;
8198
+ if (!bound.has(id)) return `expression references unbound identifier '${id}'`;
8199
+ }
8200
+ return null;
8201
+ }
8202
+ /**
7438
8203
  * Accessory device helpers — shared across drivers.
7439
8204
  *
7440
8205
  * Many vendor-specific drivers register accessory child devices on
@@ -9441,7 +10206,8 @@ var MotionAnalysisResultSchema = object({
9441
10206
  });
9442
10207
  method(object({
9443
10208
  deviceId: number(),
9444
- frame: FrameInputSchema
10209
+ frame: FrameInputSchema.optional(),
10210
+ frameHandle: FrameHandleSchema.optional()
9445
10211
  }), MotionAnalysisResultSchema, { kind: "mutation" }), method(object({ deviceId: number() }), _void(), { kind: "mutation" }), method(_void(), _void(), { kind: "mutation" }), object({
9446
10212
  deviceId: number(),
9447
10213
  detected: boolean(),
@@ -9688,6 +10454,12 @@ method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngi
9688
10454
  engine: PipelineEngineChoiceSchema.optional(),
9689
10455
  steps: array(PipelineStepInputSchema).min(1),
9690
10456
  frame: FrameInputSchema.optional(),
10457
+ /**
10458
+ * CB5 shm passthrough — a `FrameHandle` naming the same ring slot
10459
+ * the decoded pixels live in. One more member of the one-of
10460
+ * frame/frameHandle/image/imageBase64/referenceImage group.
10461
+ */
10462
+ frameHandle: FrameHandleSchema.optional(),
9691
10463
  imageBase64: string().optional(),
9692
10464
  /**
9693
10465
  * Binary JPEG bytes — preferred over `imageBase64` on internal
@@ -9897,6 +10669,31 @@ var ReportMotionInputSchema = object({
9897
10669
  regions: array(MotionRegionSchema).readonly().optional()
9898
10670
  });
9899
10671
  /**
10672
+ * Where a runner gets a camera's decoded frames (cross-node Phase 2,
10673
+ * restream-owner model — P2c).
10674
+ *
10675
+ * - `local-broker` (DEFAULT): today's path — subscribe to the co-located
10676
+ * stream-broker's shm frame plane. Every pre-P2c attach payload (no
10677
+ * `frameSource` key) parses to this, so the field is additive with zero
10678
+ * behavior change.
10679
+ * - `remote-restream`: the detect node is NOT the camera's source-owner.
10680
+ * The runner acquires the owner's COMPRESSED passthrough restream
10681
+ * (`streamBroker.getStreamWithCodec({video:'copy'})` — refcounted, the
10682
+ * double-pull guard) and decodes LOCALLY via a satellite frame plane +
10683
+ * pull-mode decoder session pinned to its own node. The shm ring stays
10684
+ * node-local; only H.264/H.265 packets cross the wire.
10685
+ * `hubHostnameOverride` mirrors the recorder's `recordingHubHostname`:
10686
+ * when set it overrides the `CAMSTACK_HUB_URL`-derived host the runner
10687
+ * dials for the owner's restream.
10688
+ */
10689
+ var RunnerFrameSourceSchema = discriminatedUnion("kind", [object({ kind: literal("local-broker") }), object({
10690
+ kind: literal("remote-restream"),
10691
+ /** The camera's source-owner node (slice 1: always the hub). */
10692
+ ownerNodeId: string(),
10693
+ /** Operator override for the owner host the runner dials. */
10694
+ hubHostnameOverride: string().optional()
10695
+ })]).describe("Per-camera frame-source mode for the runner (P2c)");
10696
+ /**
9900
10697
  * Camera assignment payload sent by `addon-pipeline-orchestrator` to a
9901
10698
  * specific runner instance via `attachCamera`. Carries everything the
9902
10699
  * runner needs to subscribe to the local broker and execute inference.
@@ -9994,7 +10791,15 @@ var RunnerCameraConfigSchema = object({
9994
10791
  */
9995
10792
  onboardMotionDrivesAnalyzer: boolean().default(true),
9996
10793
  occupancyRecheckSec: number().min(occupancyRecheckSecField.min).max(occupancyRecheckSecField.max).default(occupancyRecheckSecField.default),
9997
- occupancyRecheckFrames: number().min(occupancyRecheckFramesField.min).max(occupancyRecheckFramesField.max).default(occupancyRecheckFramesField.default)
10794
+ occupancyRecheckFrames: number().min(occupancyRecheckFramesField.min).max(occupancyRecheckFramesField.max).default(occupancyRecheckFramesField.default),
10795
+ /**
10796
+ * Where this runner gets the camera's decoded frames (P2c). Defaulted so
10797
+ * every existing payload behaves as `local-broker` — the pre-Phase-2 path.
10798
+ * Populated with `remote-restream` by the orchestrator ONLY when the
10799
+ * camera's detect node differs from its source-owner (P2d, gated by the
10800
+ * `remoteSourcingNodes` rollout setting).
10801
+ */
10802
+ frameSource: RunnerFrameSourceSchema.default({ kind: "local-broker" })
9998
10803
  });
9999
10804
  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;
10000
10805
  /**
@@ -10359,6 +11164,113 @@ object({
10359
11164
  lastFetchedAt: number()
10360
11165
  });
10361
11166
  DeviceType.Sensor;
11167
+ /**
11168
+ * Feeder connectivity / power status — mirrors the HA petkit device-status
11169
+ * enum: `normal` (online, mains), `offline` (not reaching PetKit cloud),
11170
+ * `on_batteries` (running on battery backup). `null` until first reported.
11171
+ */
11172
+ var PetFeederDeviceStatusSchema = _enum([
11173
+ "normal",
11174
+ "offline",
11175
+ "on_batteries"
11176
+ ]);
11177
+ var gramsPortion = number().int().min(4).max(200);
11178
+ object({
11179
+ /** Food currently in the bowl (grams). Null when the device has not
11180
+ * reported a reading yet. On dual-hopper models this is the combined
11181
+ * bowl reading; per-hopper levels live in `food1`/`food2`. */
11182
+ foodLevel: number().nullable(),
11183
+ /** Hopper-1 food level (grams) on dual-hopper feeders; null on
11184
+ * single-hopper models. */
11185
+ food1: number().nullable(),
11186
+ /** Hopper-2 food level (grams) on dual-hopper feeders; null on
11187
+ * single-hopper models. */
11188
+ food2: number().nullable(),
11189
+ /** Derived low-food flag — mirrors the HA `food_level` binary_sensor
11190
+ * (`device_class: problem`, on = low). True when the bowl is empty /
11191
+ * below the feeder's low threshold. */
11192
+ lowFood: boolean(),
11193
+ /** Battery charge 0..100 (%). Null on mains-powered models or when the
11194
+ * device has no battery reading. */
11195
+ batteryPower: number().min(0).max(100).nullable(),
11196
+ /** Days of desiccant life remaining. Null when the model has no
11197
+ * desiccant sensor. */
11198
+ desiccantLeftDays: number().nullable(),
11199
+ /** True while a feed is in progress. */
11200
+ feeding: boolean(),
11201
+ /** Decoded connectivity / power status (HA petkit device-status enum).
11202
+ * Null until the device has reported a status. */
11203
+ status: PetFeederDeviceStatusSchema.nullable(),
11204
+ /** Decoded human-readable fault message. Null (or the device's `no_error`
11205
+ * sentinel) means healthy; a non-null string is an active fault. Pairs
11206
+ * with `errorCode` for consumers that want the raw integer. */
11207
+ error: string().nullable(),
11208
+ /** Raw device error code (0 / null = no error). */
11209
+ errorCode: number().nullable(),
11210
+ /** True for D4S/D4SH dual-hopper hardware — gates the per-hopper UI. */
11211
+ isDualHopper: boolean(),
11212
+ /** Child-lock (manual-lock) setting — buttons on the unit are disabled. */
11213
+ childLock: boolean(),
11214
+ /** Front indicator-light setting. */
11215
+ indicatorLight: boolean(),
11216
+ /** Play a chime when dispensing. */
11217
+ feedSound: boolean(),
11218
+ /** Speaker / prompt volume level (device-scaled integer). */
11219
+ volume: number(),
11220
+ /** Ms epoch when the slice was last refreshed from the cloud. */
11221
+ lastFetchedAt: number()
11222
+ });
11223
+ DeviceType.PetFeeder, method(object({
11224
+ deviceId: number().int().nonnegative(),
11225
+ grams: gramsPortion.optional(),
11226
+ hopper1: gramsPortion.optional(),
11227
+ hopper2: gramsPortion.optional()
11228
+ }), _void(), {
11229
+ kind: "mutation",
11230
+ auth: "admin"
11231
+ }), method(object({ deviceId: number().int().nonnegative() }), _void(), {
11232
+ kind: "mutation",
11233
+ auth: "admin"
11234
+ }), method(object({ deviceId: number().int().nonnegative() }), _void(), {
11235
+ kind: "mutation",
11236
+ auth: "admin"
11237
+ }), method(object({ deviceId: number().int().nonnegative() }), _void(), {
11238
+ kind: "mutation",
11239
+ auth: "admin"
11240
+ }), method(object({ deviceId: number().int().nonnegative() }), _void(), {
11241
+ kind: "mutation",
11242
+ auth: "admin"
11243
+ }), method(object({
11244
+ deviceId: number().int().nonnegative(),
11245
+ soundId: number().int().nonnegative()
11246
+ }), _void(), {
11247
+ kind: "mutation",
11248
+ auth: "admin"
11249
+ }), method(object({
11250
+ deviceId: number().int().nonnegative(),
11251
+ on: boolean()
11252
+ }), _void(), {
11253
+ kind: "mutation",
11254
+ auth: "admin"
11255
+ }), method(object({
11256
+ deviceId: number().int().nonnegative(),
11257
+ on: boolean()
11258
+ }), _void(), {
11259
+ kind: "mutation",
11260
+ auth: "admin"
11261
+ }), method(object({
11262
+ deviceId: number().int().nonnegative(),
11263
+ on: boolean()
11264
+ }), _void(), {
11265
+ kind: "mutation",
11266
+ auth: "admin"
11267
+ }), method(object({
11268
+ deviceId: number().int().nonnegative(),
11269
+ level: number().int().nonnegative()
11270
+ }), _void(), {
11271
+ kind: "mutation",
11272
+ auth: "admin"
11273
+ });
10362
11274
  object({
10363
11275
  /** Instantaneous power draw in watts. */
10364
11276
  watts: number().optional(),
@@ -12480,10 +13392,12 @@ method(object({ codec: string() }), boolean()), method(_void(), object({
12480
13392
  url: string()
12481
13393
  }), _void()), method(object({
12482
13394
  sessionId: string(),
12483
- maxCount: number().default(1)
13395
+ maxCount: number().default(1),
13396
+ waitMs: number().optional()
12484
13397
  }), array(DecodedFrameSchema)), method(object({
12485
13398
  sessionId: string(),
12486
- maxCount: number().default(1)
13399
+ maxCount: number().default(1),
13400
+ waitMs: number().optional()
12487
13401
  }), array(FrameHandleSchema)), method(object({ handle: FrameHandleSchema }), DecodedFrameSchema.nullable()), method(object({ sessionId: string() }), ShmRingStatsSchema.nullable()), method(object({
12488
13402
  sessionId: string(),
12489
13403
  config: DecoderSessionConfigSchema.partial()
@@ -12770,14 +13684,63 @@ var ChildLayoutEntrySchema = object({
12770
13684
  collapsed: boolean().optional()
12771
13685
  });
12772
13686
  /** Cap-wire shape of a DeviceLink — structurally mirrors `DeviceLink` in
12773
- * `device-management.ts`. */
13687
+ * `device-management.ts`. Source is a union: a FIELD source copies a sibling
13688
+ * accessory's status field (`kind` optional/absent for wire compat); a
13689
+ * LITERAL source carries a per-device constant (no sibling is read); a
13690
+ * GLOBAL source (P2e) copies ANY device's status field, addressed by the
13691
+ * source device's full re-sync-stable `stableId`. */
13692
+ var DeviceLinkFieldSourceSchema = object({
13693
+ kind: literal("field").optional(),
13694
+ sourceKey: string(),
13695
+ cap: string(),
13696
+ fieldPath: string()
13697
+ });
13698
+ var DeviceLinkLiteralSourceSchema = object({
13699
+ kind: literal("literal"),
13700
+ value: union([
13701
+ string(),
13702
+ number(),
13703
+ boolean(),
13704
+ _null()
13705
+ ])
13706
+ });
13707
+ var DeviceLinkGlobalSourceSchema = object({
13708
+ kind: literal("global"),
13709
+ sourceStableId: string(),
13710
+ cap: string(),
13711
+ fieldPath: string()
13712
+ });
13713
+ /** Expression source (Stage X): compute the target field from N named bindings
13714
+ * via the safe expression engine. Bindings are field | literal | global — never
13715
+ * another expression (no nesting). The `superRefine` runs the SAME author-time
13716
+ * validation as `validateExpressionSource` (compiles the expr, checks binding
13717
+ * names + identifier coverage) so every wire boundary that parses a DeviceLink
13718
+ * (tRPC mount, kernel create pre-seed, projection output) validates-at-write.
13719
+ * Compiles are LRU-cached, so repeated validation of the same expr is a hit. */
13720
+ var DeviceLinkExpressionSourceSchema = object({
13721
+ kind: literal("expression"),
13722
+ expr: string().min(1).max(MAX_EXPRESSION_SOURCE_LENGTH),
13723
+ bindings: record(string().regex(EXPRESSION_IDENTIFIER_RE), union([
13724
+ DeviceLinkFieldSourceSchema,
13725
+ DeviceLinkLiteralSourceSchema,
13726
+ DeviceLinkGlobalSourceSchema
13727
+ ]))
13728
+ }).superRefine((src, ctx) => {
13729
+ const err = validateExpressionSource(src);
13730
+ if (err !== null) ctx.addIssue({
13731
+ code: "custom",
13732
+ message: err,
13733
+ path: ["expr"]
13734
+ });
13735
+ });
12774
13736
  var DeviceLinkSchema = object({
12775
13737
  id: string(),
12776
- source: object({
12777
- sourceKey: string(),
12778
- cap: string(),
12779
- fieldPath: string()
12780
- }),
13738
+ source: union([
13739
+ DeviceLinkFieldSourceSchema,
13740
+ DeviceLinkLiteralSourceSchema,
13741
+ DeviceLinkGlobalSourceSchema,
13742
+ DeviceLinkExpressionSourceSchema
13743
+ ]),
12781
13744
  target: object({
12782
13745
  cap: string(),
12783
13746
  fieldPath: string(),
@@ -12806,6 +13769,31 @@ var DeviceLinkSchema = object({
12806
13769
  })
12807
13770
  ]).optional()
12808
13771
  });
13772
+ /** Cap-wire shape of a per-cap display refinement — mirrors
13773
+ * `DeviceCapDisplayOverride` in `device-management.ts`. */
13774
+ var DeviceCapDisplayOverrideSchema = object({
13775
+ unit: string().min(1).optional(),
13776
+ precision: number().int().min(0).max(10).optional()
13777
+ });
13778
+ /** Cap-wire shape of an operator-authored per-device display override —
13779
+ * mirrors `DeviceDisplayOverride` in `device-management.ts`. `precision`
13780
+ * bounds mirror `numeric-sensor.cap.ts` (`int 0-10`). */
13781
+ var DeviceDisplayOverrideSchema = object({
13782
+ icon: string().min(1).optional(),
13783
+ label: string().min(1).optional(),
13784
+ unit: string().min(1).optional(),
13785
+ precision: number().int().min(0).max(10).optional(),
13786
+ hidden: boolean().optional(),
13787
+ perCap: record(string(), DeviceCapDisplayOverrideSchema).optional()
13788
+ });
13789
+ /** Cap-wire shape of a per-role display default — mirrors `RoleDisplayDefault`
13790
+ * in `device-management.ts`. Keyed by `DeviceRole` string (role strings cross
13791
+ * the wire as plain strings everywhere else — cf. `DeviceInfoSchema.role`). */
13792
+ var RoleDisplayDefaultSchema = object({
13793
+ unit: string().min(1).optional(),
13794
+ precision: number().int().min(0).max(10).optional(),
13795
+ icon: string().min(1).optional()
13796
+ });
12809
13797
  /**
12810
13798
  * Serializable projection of a live IDevice.
12811
13799
  * Returned by listAll, getDevice, getChildren.
@@ -12861,7 +13849,9 @@ var DeviceInfoSchema = object({
12861
13849
  * `DeviceMeta.childLayout`. Absent ⇒ no layout declared. */
12862
13850
  childLayout: array(ChildLayoutEntrySchema).readonly().optional(),
12863
13851
  /** Operator-authored cross-device field wirings. See `DeviceMeta.deviceLinks`. */
12864
- deviceLinks: array(DeviceLinkSchema).readonly().optional()
13852
+ deviceLinks: array(DeviceLinkSchema).readonly().optional(),
13853
+ /** Operator-authored per-device display override. See `DeviceMeta.display`. */
13854
+ display: DeviceDisplayOverrideSchema.optional()
12865
13855
  });
12866
13856
  var ConfigEntrySchema = object({
12867
13857
  key: string(),
@@ -12926,7 +13916,9 @@ var DeviceMetaSchema = object({
12926
13916
  deviceLinks: array(DeviceLinkSchema).readonly().optional(),
12927
13917
  /** Semantic role string (`DeviceRole`) — propagated from the spawn pre-seed.
12928
13918
  * Optional: only present for accessory children that carry a known role. */
12929
- role: string().nullable().optional()
13919
+ role: string().nullable().optional(),
13920
+ /** Operator-authored per-device display override. See `DeviceMeta.display`. */
13921
+ display: DeviceDisplayOverrideSchema.optional()
12930
13922
  });
12931
13923
  /** ConfigUISchema passed through as unknown — mirrors device-provider's CreationSchemaOutputSchema */
12932
13924
  var ConfigUISchemaOutput = unknown().nullable();
@@ -13020,7 +14012,19 @@ method(object({
13020
14012
  }), _void(), {
13021
14013
  kind: "mutation",
13022
14014
  auth: "admin"
13023
- }), method(object({ deviceId: number() }), object({ caps: array(object({
14015
+ }), method(object({
14016
+ deviceId: number(),
14017
+ display: DeviceDisplayOverrideSchema.nullable()
14018
+ }), _void(), {
14019
+ kind: "mutation",
14020
+ auth: "admin"
14021
+ }), method(object({}), object({ defaults: record(string(), RoleDisplayDefaultSchema) }), { kind: "query" }), method(object({ defaults: record(string(), RoleDisplayDefaultSchema) }), _void(), {
14022
+ kind: "mutation",
14023
+ auth: "admin"
14024
+ }), method(object({
14025
+ deviceId: number(),
14026
+ includeSynthesizable: boolean().optional()
14027
+ }), object({ caps: array(object({
13024
14028
  cap: string(),
13025
14029
  fields: array(object({
13026
14030
  path: string(),
@@ -13030,8 +14034,13 @@ method(object({
13030
14034
  "boolean",
13031
14035
  "enum"
13032
14036
  ]),
13033
- enumValues: array(string()).optional()
13034
- })).readonly()
14037
+ enumValues: array(string()).optional(),
14038
+ item: boolean().optional()
14039
+ })).readonly(),
14040
+ itemArray: object({
14041
+ path: string(),
14042
+ keyField: string()
14043
+ }).optional()
13035
14044
  })).readonly() }), { kind: "query" }), method(object({
13036
14045
  deviceId: number(),
13037
14046
  role: string().nullable()
@@ -13101,7 +14110,11 @@ method(object({
13101
14110
  deviceId: number(),
13102
14111
  entries: array(object({
13103
14112
  capName: string(),
13104
- kind: _enum(["native", "wrapped"]),
14113
+ kind: _enum([
14114
+ "native",
14115
+ "wrapped",
14116
+ "linked"
14117
+ ]),
13105
14118
  providerAddonId: string(),
13106
14119
  providerNodeId: string(),
13107
14120
  nativeAddonId: string()
@@ -13110,7 +14123,11 @@ method(object({
13110
14123
  deviceId: number(),
13111
14124
  entries: array(object({
13112
14125
  capName: string(),
13113
- kind: _enum(["native", "wrapped"]),
14126
+ kind: _enum([
14127
+ "native",
14128
+ "wrapped",
14129
+ "linked"
14130
+ ]),
13114
14131
  providerAddonId: string(),
13115
14132
  providerNodeId: string(),
13116
14133
  nativeAddonId: string()
@@ -13600,7 +14617,7 @@ var AddBrokerInputSchema = object({
13600
14617
  });
13601
14618
  var AddBrokerResultSchema = object({ id: string() });
13602
14619
  var IdInputSchema = object({ id: string() });
13603
- var TestResultSchema = discriminatedUnion("ok", [object({
14620
+ var TestResultSchema$1 = discriminatedUnion("ok", [object({
13604
14621
  ok: literal(true),
13605
14622
  latencyMs: number()
13606
14623
  }), object({
@@ -13623,7 +14640,7 @@ var StatusSchema = object({
13623
14640
  brokerCount: number(),
13624
14641
  embeddedRunning: boolean()
13625
14642
  });
13626
- 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);
14643
+ 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);
13627
14644
  var NetworkEndpointSchema = object({
13628
14645
  url: string(),
13629
14646
  hostname: string(),
@@ -13657,23 +14674,198 @@ var NetworkEndpointEntrySchema = NetworkEndpointSchema.extend({
13657
14674
  sourcePort: number().optional()
13658
14675
  });
13659
14676
  method(_void(), NetworkEndpointSchema, { kind: "mutation" }), method(_void(), _void(), { kind: "mutation" }), method(_void(), NetworkEndpointSchema.nullable()), method(_void(), NetworkAccessStatusSchema), method(_void(), array(NetworkEndpointEntrySchema).readonly());
13660
- method(object({
13661
- title: string(),
14677
+ /**
14678
+ * notification-output — canonical, capability-gated notification delivery.
14679
+ *
14680
+ * Apprise-derived model (see
14681
+ * `docs/superpowers/specs/2026-07-03-notification-output-notifier-matrix.md`):
14682
+ * callers emit ONE canonical `Notification`; each provider declares a
14683
+ * per-kind capability descriptor (`TargetKind`), and the pure degrade
14684
+ * engine (`@camstack/types` `prepareNotification`) transcodes / degrades the
14685
+ * message to what the kind supports — callers never special-case a service.
14686
+ *
14687
+ * DESIGN DECISIONS (locked):
14688
+ * - Target CRUD lives on THIS cap (`upsertTarget` / `deleteTarget` /
14689
+ * `setTargetEnabled`), each provider persisting via the `settings-store`
14690
+ * cap. Rationale: the admin UI needs one uniform surface across the
14691
+ * notifiers addon AND the HA addon; the addon-`globalSettingsSchema`-array
14692
+ * alternative would fork the UI per addon and cannot host the
14693
+ * discovery→adopt flow.
14694
+ * - `listTargetKinds` / `listTargets` / `discoverTargets` return arrays →
14695
+ * the generated cap-mount auto-`concatCollection`-fans them across every
14696
+ * registered provider (notifiers addon + HA addon) so one catalog is
14697
+ * routable. `send` / `testTarget` / CRUD route to ONE provider by the
14698
+ * `addonId` the generated collection router extracts from the call input.
14699
+ * - `Attachment.bytes` is `Uint8Array`. Transport-safe: superjson (the tRPC
14700
+ * transformer) + UDS MsgPack both round-trip typed arrays — already used by
14701
+ * `storage` / `storage-provider` / `recording` caps over the same path. No
14702
+ * base64 fallback needed.
14703
+ *
14704
+ * TODO (deferred, closed-set change — separate decision): add
14705
+ * `providerKind: 'notify'` so notification providers surface on the unified
14706
+ * admin "Integrations" page.
14707
+ */
14708
+ /**
14709
+ * Zentik-derived typed-media enum — the superset across every kind. Each
14710
+ * adapter picks what it supports and the degrade engine filters the rest.
14711
+ */
14712
+ var AttachmentMediaTypeSchema = _enum([
14713
+ "image",
14714
+ "video",
14715
+ "gif",
14716
+ "audio",
14717
+ "icon"
14718
+ ]);
14719
+ /**
14720
+ * A single attachment. Exactly one of `url` (remote source, most adapters
14721
+ * prefer this) or `bytes` (inline source; required for Pushover-style
14722
+ * bytes-only kinds) MUST be present — the degrade engine expresses a
14723
+ * url→bytes fetch as a `needsFetch` directive the adapter executes.
14724
+ */
14725
+ var AttachmentSchema = object({
14726
+ mediaType: AttachmentMediaTypeSchema,
14727
+ url: string().optional(),
14728
+ bytes: _instanceof(Uint8Array).optional(),
14729
+ mime: string().optional(),
14730
+ name: string().optional()
14731
+ }).refine((a) => a.url !== void 0 || a.bytes !== void 0, { message: "Attachment requires either `url` or `bytes`" });
14732
+ var NotificationFormatSchema = _enum([
14733
+ "text",
14734
+ "markdown",
14735
+ "html"
14736
+ ]);
14737
+ /** A single tap-through action button. */
14738
+ var NotificationActionSchema = object({
14739
+ id: string(),
14740
+ label: string(),
14741
+ url: string().optional()
14742
+ });
14743
+ /**
14744
+ * The canonical notification. `body` is the only hard field (Apprise model).
14745
+ * `priority` is a 5-level ORDINAL (1=lowest … 3=normal(default) … 5=urgent),
14746
+ * NOT a fixed severity enum — each kind declares its own `caps.levels` and
14747
+ * the adapter maps this ordinal onto its native level. `level?` is an
14748
+ * optional kind-native level id (`emergency`, `silent`, …) that overrides
14749
+ * `priority` for that one target.
14750
+ */
14751
+ var NotificationSchema = object({
13662
14752
  body: string(),
13663
- imageUrl: string().optional(),
14753
+ title: string().optional(),
14754
+ format: NotificationFormatSchema.default("text"),
14755
+ priority: number().int().min(1).max(5).default(3),
14756
+ level: string().optional(),
14757
+ attachments: array(AttachmentSchema).optional(),
14758
+ clickUrl: string().optional(),
14759
+ actions: array(NotificationActionSchema).optional(),
14760
+ sound: string().optional(),
14761
+ ttl: number().optional(),
14762
+ tag: string().optional(),
13664
14763
  deviceId: number().optional(),
13665
14764
  eventId: string().optional(),
13666
- priority: _enum([
13667
- "low",
13668
- "normal",
13669
- "high",
13670
- "critical"
13671
- ]).default("normal"),
13672
14765
  metadata: record(string(), unknown()).optional()
13673
- }), _void(), { kind: "mutation" }), method(_void(), object({
14766
+ });
14767
+ /** One declared native severity/priority level for a kind. */
14768
+ var TargetKindLevelSchema = object({
14769
+ id: string(),
14770
+ label: string(),
14771
+ /** Which canonical priority (1..5) this level maps to. `null` = qualitative-only. */
14772
+ ordinal: number().int().min(1).max(5).nullable(),
14773
+ flags: object({
14774
+ critical: boolean().optional(),
14775
+ silent: boolean().optional(),
14776
+ noPush: boolean().optional()
14777
+ }).optional(),
14778
+ /** e.g. Pushover `emergency` requires `retry` / `expire`. */
14779
+ requires: array(string()).optional(),
14780
+ description: string().optional()
14781
+ });
14782
+ /** The full capability block consulted before dispatch. */
14783
+ var TargetKindCapsSchema = object({
14784
+ attachments: object({
14785
+ mediaTypes: array(AttachmentMediaTypeSchema),
14786
+ mode: _enum([
14787
+ "url",
14788
+ "bytes",
14789
+ "both"
14790
+ ]),
14791
+ max: number().int().nonnegative(),
14792
+ maxBytes: number().int().positive().optional()
14793
+ }),
14794
+ /** Max action buttons (0 = none). */
14795
+ actions: number().int().nonnegative(),
14796
+ levels: array(TargetKindLevelSchema),
14797
+ format: array(NotificationFormatSchema),
14798
+ clickUrl: boolean(),
14799
+ sound: boolean(),
14800
+ ttl: boolean(),
14801
+ bodyMaxLen: number().int().positive()
14802
+ });
14803
+ /**
14804
+ * `configSchema` is a `ConfigUISchema` tree passed through to the admin
14805
+ * FormBuilder. Stored as `z.unknown()` at the cap seam (mirrors
14806
+ * `device-provider.getChildCreationSchema` `CreationSchemaOutputSchema`) —
14807
+ * the union is large and not meant for runtime validation here; the exported
14808
+ * `TargetKind` type re-tightens `configSchema` to `ConfigUISchema`.
14809
+ */
14810
+ var ConfigSchemaPassthrough = unknown();
14811
+ var TargetKindSchema = object({
14812
+ kind: string(),
14813
+ label: string(),
14814
+ icon: string(),
14815
+ /** Stamped by each provider so the concat-fanned catalog stays routable. */
14816
+ addonId: string(),
14817
+ configSchema: ConfigSchemaPassthrough,
14818
+ supportsDiscovery: boolean(),
14819
+ caps: TargetKindCapsSchema
14820
+ });
14821
+ /**
14822
+ * A persisted target. `config` holds secrets; providers REDACT secret fields
14823
+ * (return a presence marker only) when serving `listTargets` — never
14824
+ * round-trip a stored secret to the UI.
14825
+ */
14826
+ var TargetSchema = object({
14827
+ id: string(),
14828
+ name: string(),
14829
+ kind: string(),
14830
+ addonId: string(),
14831
+ enabled: boolean(),
14832
+ config: record(string(), unknown())
14833
+ });
14834
+ /** A discovery-surfaced candidate (config is partial + non-secret). */
14835
+ var DiscoveredTargetSchema = object({
14836
+ kind: string(),
14837
+ suggestedName: string(),
14838
+ config: record(string(), unknown())
14839
+ });
14840
+ /** The degrade engine's report — what was resolved / dropped / degraded. */
14841
+ var RenderedAsSchema = object({
14842
+ level: string(),
14843
+ format: NotificationFormatSchema,
14844
+ attachmentsSent: number().int().nonnegative(),
14845
+ actionsSent: number().int().nonnegative(),
14846
+ truncated: boolean(),
14847
+ dropped: array(string())
14848
+ });
14849
+ var SendResultSchema = object({
13674
14850
  success: boolean(),
13675
- error: string().optional()
13676
- }), { kind: "mutation" });
14851
+ error: string().optional(),
14852
+ renderedAs: RenderedAsSchema.optional()
14853
+ });
14854
+ /** Same shape as SendResult — kept as a distinct name for the test panel. */
14855
+ var TestResultSchema = SendResultSchema;
14856
+ method(object({}), array(TargetKindSchema)), method(object({}), array(TargetSchema)), method(object({
14857
+ kind: string(),
14858
+ config: record(string(), unknown()).optional()
14859
+ }), array(DiscoveredTargetSchema)), method(object({
14860
+ targetId: string(),
14861
+ notification: NotificationSchema
14862
+ }), SendResultSchema, { kind: "mutation" }), method(object({
14863
+ targetId: string(),
14864
+ sample: NotificationSchema.optional()
14865
+ }), TestResultSchema, { kind: "mutation" }), method(object({ target: TargetSchema }), TargetSchema, { kind: "mutation" }), method(object({ targetId: string() }), _void(), { kind: "mutation" }), method(object({
14866
+ targetId: string(),
14867
+ enabled: boolean()
14868
+ }), _void(), { kind: "mutation" });
13677
14869
  /**
13678
14870
  * Zod schemas for persisted record types.
13679
14871
  *
@@ -14177,7 +15369,10 @@ var AgentLoadSummarySchema = object({
14177
15369
  online: boolean(),
14178
15370
  load: RunnerLocalLoadSchema,
14179
15371
  /** Computed score used by the L2 capacity balancer (lower = less loaded). */
14180
- score: number()
15372
+ score: number(),
15373
+ /** This node's decode hwaccel backend (per-node `probedBestHwaccel`), or null
15374
+ * when not yet probed — for the cluster Pipeline table UI (P0.2). */
15375
+ decodeHwaccel: string().nullable()
14181
15376
  });
14182
15377
  /**
14183
15378
  * Aggregate metrics across the whole detection cluster. Replaces the legacy
@@ -16738,7 +17933,10 @@ var HwAccelBackendInputSchema = _enum([
16738
17933
  "webgpu",
16739
17934
  "none"
16740
17935
  ]).nullable().optional();
16741
- var HwAccelResolutionSchema = object({ preferred: array(string()).readonly() });
17936
+ var HwAccelResolutionSchema = object({
17937
+ preferred: array(string()).readonly(),
17938
+ rationale: string()
17939
+ });
16742
17940
  var HardwareEncoderIdSchema = _enum([
16743
17941
  "h264_videotoolbox",
16744
17942
  "hevc_videotoolbox",
@@ -16753,7 +17951,7 @@ var HardwareEncoderIdSchema = _enum([
16753
17951
  "libx264",
16754
17952
  "libx265"
16755
17953
  ]);
16756
- var HardwareEncodersSchema = object({
17954
+ object({
16757
17955
  encoders: array(object({
16758
17956
  encoder: HardwareEncoderIdSchema,
16759
17957
  codec: _enum(["H264", "H265"]),
@@ -16772,15 +17970,7 @@ var HardwareEncodersSchema = object({
16772
17970
  defaultH265: HardwareEncoderIdSchema,
16773
17971
  probedAt: number()
16774
17972
  });
16775
- /**
16776
- * Decode-side companion to {@link HardwareEncodersSchema}: the `-hwaccel`
16777
- * methods the configured ffmpeg binary actually supports (parsed from
16778
- * `ffmpeg -hwaccels`). Used to gate decode-hwaccel attempts so the transcode
16779
- * egress never spends a spawn on a backend this build cannot offer. Per-stream
16780
- * decode fragility (e.g. VideoToolbox HEVC) is still handled by the egress's
16781
- * software fallback — this only filters out wholly-unsupported backends.
16782
- */
16783
- var HardwareDecodeAccelsSchema = object({
17973
+ object({
16784
17974
  methods: array(string()).readonly(),
16785
17975
  probedAt: number()
16786
17976
  });
@@ -16843,16 +18033,7 @@ var ResolvedInferenceConfigSchema = object({
16843
18033
  format: ModelFormatSchema,
16844
18034
  reason: string()
16845
18035
  });
16846
- method(_void(), PlatformCapabilitiesSchema), method(_void(), HardwareInfoSchema), method(object({ requirements: array(ModelRequirementSchema).readonly() }), ResolvedInferenceConfigSchema), method(object({
16847
- prefer: HwAccelBackendInputSchema,
16848
- nodeId: string().optional()
16849
- }), HwAccelResolutionSchema), method(_void(), HardwareEncodersSchema), method(_void(), HardwareEncodersSchema, {
16850
- kind: "mutation",
16851
- auth: "admin"
16852
- }), method(_void(), HardwareDecodeAccelsSchema), method(_void(), HardwareDecodeAccelsSchema, {
16853
- kind: "mutation",
16854
- auth: "admin"
16855
- });
18036
+ method(_void(), PlatformCapabilitiesSchema), method(_void(), HardwareInfoSchema), method(object({ requirements: array(ModelRequirementSchema).readonly() }), ResolvedInferenceConfigSchema), method(object({ prefer: HwAccelBackendInputSchema }), HwAccelResolutionSchema);
16856
18037
  var PtzPresetSchema = object({
16857
18038
  id: string(),
16858
18039
  name: string()
@@ -16947,6 +18128,16 @@ DeviceType.Camera, DeviceType.Sensor, DeviceType.Switch, method(object({ deviceI
16947
18128
  kind: "mutation",
16948
18129
  auth: "admin"
16949
18130
  });
18131
+ /**
18132
+ * `recording` cap — footage availability + HLS playback manifests + per-device
18133
+ * recording config. NOTE on events (source of truth, R5/C3): this cap carries
18134
+ * NO event surface — `getPlaybackManifest` returns playlist URLs only. Timeline
18135
+ * events (motion/object/audio) come from `pipelineAnalytics` (durable SQLite
18136
+ * rows); the recorder's internal EventMap markers are ephemeral in-RAM
18137
+ * annotations that are not exposed here and must not be treated as an event
18138
+ * feed. Event<->footage joins are by time, padded with the shared `EVENT_PAD_MS`
18139
+ * (`interfaces/recording-config.ts`).
18140
+ */
16950
18141
  var RecordingStatusSchema = object({
16951
18142
  deviceId: number(),
16952
18143
  enabled: boolean(),
@@ -18583,6 +19774,12 @@ Object.freeze({
18583
19774
  addonId: null,
18584
19775
  access: "view"
18585
19776
  },
19777
+ "deviceManager.getRoleDisplayDefaults": {
19778
+ capName: "device-manager",
19779
+ capScope: "system",
19780
+ addonId: null,
19781
+ access: "view"
19782
+ },
18586
19783
  "deviceManager.getSettingsSchema": {
18587
19784
  capName: "device-manager",
18588
19785
  capScope: "system",
@@ -18733,6 +19930,12 @@ Object.freeze({
18733
19930
  addonId: null,
18734
19931
  access: "create"
18735
19932
  },
19933
+ "deviceManager.setDisplay": {
19934
+ capName: "device-manager",
19935
+ capScope: "system",
19936
+ addonId: null,
19937
+ access: "create"
19938
+ },
18736
19939
  "deviceManager.setIntegrationId": {
18737
19940
  capName: "device-manager",
18738
19941
  capScope: "system",
@@ -18775,6 +19978,12 @@ Object.freeze({
18775
19978
  addonId: null,
18776
19979
  access: "create"
18777
19980
  },
19981
+ "deviceManager.setRoleDisplayDefaults": {
19982
+ capName: "device-manager",
19983
+ capScope: "system",
19984
+ addonId: null,
19985
+ access: "create"
19986
+ },
18778
19987
  "deviceManager.setStreamProfileMap": {
18779
19988
  capName: "device-manager",
18780
19989
  capScope: "system",
@@ -19753,13 +20962,49 @@ Object.freeze({
19753
20962
  addonId: null,
19754
20963
  access: "create"
19755
20964
  },
20965
+ "notificationOutput.deleteTarget": {
20966
+ capName: "notification-output",
20967
+ capScope: "system",
20968
+ addonId: null,
20969
+ access: "delete"
20970
+ },
20971
+ "notificationOutput.discoverTargets": {
20972
+ capName: "notification-output",
20973
+ capScope: "system",
20974
+ addonId: null,
20975
+ access: "view"
20976
+ },
20977
+ "notificationOutput.listTargetKinds": {
20978
+ capName: "notification-output",
20979
+ capScope: "system",
20980
+ addonId: null,
20981
+ access: "view"
20982
+ },
20983
+ "notificationOutput.listTargets": {
20984
+ capName: "notification-output",
20985
+ capScope: "system",
20986
+ addonId: null,
20987
+ access: "view"
20988
+ },
19756
20989
  "notificationOutput.send": {
19757
20990
  capName: "notification-output",
19758
20991
  capScope: "system",
19759
20992
  addonId: null,
19760
20993
  access: "create"
19761
20994
  },
19762
- "notificationOutput.sendTest": {
20995
+ "notificationOutput.setTargetEnabled": {
20996
+ capName: "notification-output",
20997
+ capScope: "system",
20998
+ addonId: null,
20999
+ access: "create"
21000
+ },
21001
+ "notificationOutput.testTarget": {
21002
+ capName: "notification-output",
21003
+ capScope: "system",
21004
+ addonId: null,
21005
+ access: "create"
21006
+ },
21007
+ "notificationOutput.upsertTarget": {
19763
21008
  capName: "notification-output",
19764
21009
  capScope: "system",
19765
21010
  addonId: null,
@@ -19789,6 +21034,66 @@ Object.freeze({
19789
21034
  addonId: null,
19790
21035
  access: "create"
19791
21036
  },
21037
+ "petFeeder.callPet": {
21038
+ capName: "pet-feeder",
21039
+ capScope: "device",
21040
+ addonId: null,
21041
+ access: "create"
21042
+ },
21043
+ "petFeeder.cancelFeed": {
21044
+ capName: "pet-feeder",
21045
+ capScope: "device",
21046
+ addonId: null,
21047
+ access: "create"
21048
+ },
21049
+ "petFeeder.feed": {
21050
+ capName: "pet-feeder",
21051
+ capScope: "device",
21052
+ addonId: null,
21053
+ access: "create"
21054
+ },
21055
+ "petFeeder.markFoodReplenished": {
21056
+ capName: "pet-feeder",
21057
+ capScope: "device",
21058
+ addonId: null,
21059
+ access: "create"
21060
+ },
21061
+ "petFeeder.playSound": {
21062
+ capName: "pet-feeder",
21063
+ capScope: "device",
21064
+ addonId: null,
21065
+ access: "create"
21066
+ },
21067
+ "petFeeder.resetDesiccant": {
21068
+ capName: "pet-feeder",
21069
+ capScope: "device",
21070
+ addonId: null,
21071
+ access: "delete"
21072
+ },
21073
+ "petFeeder.setChildLock": {
21074
+ capName: "pet-feeder",
21075
+ capScope: "device",
21076
+ addonId: null,
21077
+ access: "create"
21078
+ },
21079
+ "petFeeder.setFeedSound": {
21080
+ capName: "pet-feeder",
21081
+ capScope: "device",
21082
+ addonId: null,
21083
+ access: "create"
21084
+ },
21085
+ "petFeeder.setIndicatorLight": {
21086
+ capName: "pet-feeder",
21087
+ capScope: "device",
21088
+ addonId: null,
21089
+ access: "create"
21090
+ },
21091
+ "petFeeder.setVolume": {
21092
+ capName: "pet-feeder",
21093
+ capScope: "device",
21094
+ addonId: null,
21095
+ access: "create"
21096
+ },
19792
21097
  "pipelineAnalytics.clearTracks": {
19793
21098
  capName: "pipeline-analytics",
19794
21099
  capScope: "device",
@@ -20395,30 +21700,6 @@ Object.freeze({
20395
21700
  addonId: null,
20396
21701
  access: "view"
20397
21702
  },
20398
- "platformProbe.getHardwareDecodeAccels": {
20399
- capName: "platform-probe",
20400
- capScope: "system",
20401
- addonId: null,
20402
- access: "view"
20403
- },
20404
- "platformProbe.getHardwareEncoders": {
20405
- capName: "platform-probe",
20406
- capScope: "system",
20407
- addonId: null,
20408
- access: "view"
20409
- },
20410
- "platformProbe.refreshHardwareDecodeAccels": {
20411
- capName: "platform-probe",
20412
- capScope: "system",
20413
- addonId: null,
20414
- access: "create"
20415
- },
20416
- "platformProbe.refreshHardwareEncoders": {
20417
- capName: "platform-probe",
20418
- capScope: "system",
20419
- addonId: null,
20420
- access: "create"
20421
- },
20422
21703
  "platformProbe.resolveHwAccel": {
20423
21704
  capName: "platform-probe",
20424
21705
  capScope: "system",
@@ -31156,18 +32437,11 @@ var OnvifProviderAddon = class extends BaseDeviceProvider {
31156
32437
  }] };
31157
32438
  }
31158
32439
  async getGlobalSettings() {
31159
- const raw = await this.ctx.settings?.readAddonStore() ?? {};
32440
+ const raw = await this.resolveGlobalStore();
31160
32441
  return hydrateSchema(this.buildGlobalSchema(), raw);
31161
32442
  }
31162
- async updateGlobalSettings(patch) {
31163
- await this.ctx.settings?.writeAddonStore(patch);
31164
- }
31165
32443
  async _getAddonConfig() {
31166
- if (!this.ctx.settings) return {
31167
- id: "onvif-default",
31168
- name: "ONVIF Cameras"
31169
- };
31170
- const raw = await this.ctx.settings.readAddonStore();
32444
+ const raw = await this.resolveGlobalStore();
31171
32445
  return {
31172
32446
  id: typeof raw["id"] === "string" ? raw["id"] : "onvif-default",
31173
32447
  name: typeof raw["name"] === "string" ? raw["name"] : "ONVIF Cameras",