@camstack/addon-export-hap 1.1.13 → 1.1.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4664,7 +4664,7 @@ function _instanceof(cls, params = {}) {
4664
4664
  return inst;
4665
4665
  }
4666
4666
  //#endregion
4667
- //#region ../types/dist/sleep-C2M2zF7x.mjs
4667
+ //#region ../types/dist/sleep-BiDFW0E7.mjs
4668
4668
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
4669
4669
  EventCategory["SystemBoot"] = "system.boot";
4670
4670
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -5477,6 +5477,100 @@ function createDurableState(deps) {
5477
5477
  };
5478
5478
  }
5479
5479
  /**
5480
+ * Per-node scoping for the shared addon-settings blob.
5481
+ *
5482
+ * An addon's settings store is hub-central (the `addon-settings` cap is
5483
+ * hub-routed — the hub instance answers for every node), so fields whose
5484
+ * value is a NODE fact (decoder backend, engine pick, probed hardware
5485
+ * capabilities) persist under the node-scoped key `<key>@<nodeId>` inside
5486
+ * the single shared blob. The SCHEMA field key stays bare: the write path
5487
+ * ({@link scopePatch}) maps the bare field onto the target node's scoped
5488
+ * key; the read/hydrate path ({@link projectStore}) maps THIS node's value
5489
+ * back, so UI forms and `resolveConfig` only ever see the bare key.
5490
+ *
5491
+ * Fields opt in via the `perNode: true` schema marker on `ConfigFieldBase`
5492
+ * (`interfaces/config-ui.ts`); `BaseAddon` derives the key set from the
5493
+ * schema and routes reads/writes through these helpers.
5494
+ *
5495
+ * ## No bare-key fallback — deliberate
5496
+ *
5497
+ * {@link readNodeValue} reads the node-scoped key ONLY. A node with no
5498
+ * scoped key resolves to `undefined` so the field's schema `default` wins —
5499
+ * NEVER `store[base]` and never another node's value. A bare legacy key in
5500
+ * the store is invisible to every node, hub included, so one node's
5501
+ * selection can never leak onto another. (This generalizes the
5502
+ * `decoder-backend-keys.ts` semantics — the no-fallback variant — over an
5503
+ * arbitrary set of per-node field keys.)
5504
+ *
5505
+ * Pure functions only — no I/O, no imports beyond the language. This is a
5506
+ * LEAF module: import it via its deep path, never from the root barrel.
5507
+ */
5508
+ /**
5509
+ * Normalize a raw kernel node id to the bare node id used for scoping.
5510
+ * `localNodeId` can carry a `<node>/<addon>` suffix on forked child
5511
+ * processes; per-node settings are per-NODE, so strip the addon segment.
5512
+ * `undefined` / `null` / empty falls back to `'hub'`.
5513
+ */
5514
+ function normalizeNodeId(raw) {
5515
+ if (raw === void 0 || raw === null || raw === "") return "hub";
5516
+ const slashIdx = raw.indexOf("/");
5517
+ if (slashIdx < 0) return raw;
5518
+ const bare = raw.slice(0, slashIdx);
5519
+ return bare === "" ? "hub" : bare;
5520
+ }
5521
+ /** The node-scoped store key for a per-node field: `<base>@<nodeId>`. */
5522
+ function nodeScopedKey(base, nodeId) {
5523
+ return `${base}@${normalizeNodeId(nodeId)}`;
5524
+ }
5525
+ /**
5526
+ * Read a node's value for a per-node field from the raw shared store:
5527
+ * the node-scoped key when present, otherwise `undefined`.
5528
+ * Deliberately NO bare-key fallback (see module doc) — the caller lets the
5529
+ * schema `default` win on `undefined`.
5530
+ */
5531
+ function readNodeValue(store, base, nodeId) {
5532
+ return store[nodeScopedKey(base, nodeId)];
5533
+ }
5534
+ /**
5535
+ * Re-map a UI/settings patch so every bare perNode field persists under the
5536
+ * TARGET node's scoped key; all other keys pass through unchanged. Used on
5537
+ * the write path so a save for one node never clobbers another node's value
5538
+ * (and the bare key is never written). Returns a new object — the input
5539
+ * patch is not mutated.
5540
+ */
5541
+ function scopePatch(patch, perNodeKeys, nodeId) {
5542
+ const out = {};
5543
+ for (const [key, value] of Object.entries(patch)) out[perNodeKeys.has(key) ? nodeScopedKey(key, nodeId) : key] = value;
5544
+ return out;
5545
+ }
5546
+ /**
5547
+ * Project the raw shared store onto the bare schema keys for ONE node so a
5548
+ * UI schema (whose field keys are bare) hydrates from that node's own
5549
+ * values:
5550
+ *
5551
+ * - EVERY `@`-scoped key (any node's) is dropped from the pass-through.
5552
+ * - Every bare perNode key is dropped from the pass-through (a stray bare
5553
+ * legacy key must never hydrate any node — no bare fallback).
5554
+ * - THIS node's effective value ({@link readNodeValue}) is then laid onto
5555
+ * each bare perNode key; when the node has no scoped key the bare key is
5556
+ * left ABSENT so the field's schema `default` wins.
5557
+ *
5558
+ * Returns a new object — the input store is not mutated.
5559
+ */
5560
+ function projectStore(store, perNodeKeys, nodeId) {
5561
+ const out = {};
5562
+ for (const [key, value] of Object.entries(store)) {
5563
+ if (key.includes("@")) continue;
5564
+ if (perNodeKeys.has(key)) continue;
5565
+ out[key] = value;
5566
+ }
5567
+ for (const base of perNodeKeys) {
5568
+ const value = readNodeValue(store, base, nodeId);
5569
+ if (value !== void 0) out[base] = value;
5570
+ }
5571
+ return out;
5572
+ }
5573
+ /**
5480
5574
  * Base class for CamStack addons. Eliminates settings boilerplate:
5481
5575
  *
5482
5576
  * - Typed `config` property with automatic resolution from store + defaults
@@ -5644,23 +5738,63 @@ var BaseAddon = class {
5644
5738
  deviceSettingsSchema() {
5645
5739
  return null;
5646
5740
  }
5647
- async getGlobalSettings(overlay, cap, _nodeId) {
5741
+ async getGlobalSettings(overlay, cap, nodeId) {
5648
5742
  const schema = this.globalSettingsSchema(cap);
5649
5743
  if (!schema) return { sections: [] };
5650
- const raw = await this._ctx?.settings?.readAddonStore() ?? {};
5744
+ const projected = await this.resolveGlobalStore(nodeId, cap);
5651
5745
  return hydrateSchema(schema, overlay ? {
5652
- ...raw,
5746
+ ...projected,
5653
5747
  ...overlay
5654
- } : raw);
5748
+ } : projected);
5655
5749
  }
5656
- async updateGlobalSettings(patch, _nodeId) {
5657
- await this._ctx?.settings?.writeAddonStore(patch);
5750
+ /**
5751
+ * The raw addon store PROJECTED onto the target node's bare per-node keys:
5752
+ * every `perNode: true` field carries THAT node's scoped value on its bare
5753
+ * key (absent scoped key ⇒ key absent, so the schema `default` wins — no
5754
+ * bare fallback), all `@`-scoped and stray bare per-node keys are dropped.
5755
+ * A no-op passthrough when the schema declares no `perNode` field.
5756
+ *
5757
+ * This is the sanctioned way for a `getGlobalSettings` OVERRIDE that needs
5758
+ * the store for custom option logic (option narrowing, value snapping) to
5759
+ * read it per-node — never `ctx.settings.readAddonStore()` directly.
5760
+ * `nodeId` omitted ⇒ the local node (node-blind injection from ctx).
5761
+ */
5762
+ async resolveGlobalStore(nodeId, cap) {
5763
+ const raw = await this._ctx?.settings?.readAddonStore() ?? {};
5764
+ const keys = this.perNodeKeys(cap);
5765
+ const node = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
5766
+ return keys.size > 0 ? projectStore(raw, keys, node) : raw;
5767
+ }
5768
+ async updateGlobalSettings(patch, nodeId) {
5769
+ const keys = this.perNodeKeys();
5770
+ const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
5771
+ const target = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
5772
+ const barePatch = patch;
5773
+ const scoped = keys.size > 0 ? scopePatch(barePatch, keys, target) : barePatch;
5774
+ await this._ctx?.settings?.writeAddonStore(scoped);
5775
+ if (target !== localNode) return;
5658
5776
  await this.resolveConfig();
5659
5777
  await this.onConfigChanged();
5660
5778
  this.emitLifecycle(EventCategory.AddonUpdated, { level: "global" });
5661
5779
  this.maybeAutoRestart(patch, this.globalSettingsSchema());
5662
5780
  }
5663
5781
  /**
5782
+ * The set of field keys the global settings schema declares `perNode: true`
5783
+ * — derived once per `cap` argument and memoized (schemas are static
5784
+ * declarations). Empty set ⇒ every per-node code path is bypassed and the
5785
+ * settings API behaves exactly like the legacy node-agnostic one.
5786
+ */
5787
+ _perNodeKeysCache = /* @__PURE__ */ new Map();
5788
+ perNodeKeys(cap) {
5789
+ const cacheKey = cap ?? "";
5790
+ const cached = this._perNodeKeysCache.get(cacheKey);
5791
+ if (cached) return cached;
5792
+ const schema = this.globalSettingsSchema(cap);
5793
+ const keys = new Set(schema ? schema.sections.flatMap((section) => collectPerNodeFieldKeys(section.fields)) : []);
5794
+ this._perNodeKeysCache.set(cacheKey, keys);
5795
+ return keys;
5796
+ }
5797
+ /**
5664
5798
  * If any field in `patch` is marked `requiresRestart` in `schema`,
5665
5799
  * schedule an addon restart for the next tick. Deferred via
5666
5800
  * `setImmediate` so the tRPC mutation that triggered the write has
@@ -5813,12 +5947,19 @@ var BaseAddon = class {
5813
5947
  * The merge is shallow: each key in `defaults` is checked against the store.
5814
5948
  * Only keys present in defaults are read — the store can contain extra keys
5815
5949
  * (e.g. from older versions) without polluting the typed config.
5950
+ *
5951
+ * Keys the global settings schema declares `perNode: true` resolve from
5952
+ * THIS node's scoped key (`<key>@<localNode>`) via `readNodeValue` — never
5953
+ * from the bare key — so a per-node field resolves to this node's own
5954
+ * selection at boot (absent scoped key ⇒ the constructor default wins).
5816
5955
  */
5817
5956
  async resolveConfig() {
5818
5957
  const stored = await this.readAddonStoreWithRetry();
5958
+ const perNode = this.perNodeKeys();
5959
+ const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
5819
5960
  const resolved = { ...this.defaults };
5820
5961
  for (const key of Object.keys(this.defaults)) {
5821
- const storedValue = stored[key];
5962
+ const storedValue = perNode.has(key) ? readNodeValue(stored, key, localNode) : stored[key];
5822
5963
  if (storedValue !== void 0 && storedValue !== null) {
5823
5964
  const defaultType = typeof this.defaults[key];
5824
5965
  if (typeof storedValue === defaultType) resolved[key] = storedValue;
@@ -5902,6 +6043,27 @@ var BaseAddon = class {
5902
6043
  }
5903
6044
  };
5904
6045
  /**
6046
+ * Collect the keys of every field marked `perNode: true`, recursing into
6047
+ * layout containers (`group` fields and `sub-tabs` tabs) the same way
6048
+ * `hydrateSchema` does. Valueless structural fields (separator/info/…)
6049
+ * don't declare `perNode` and are excluded by the `in` narrowing.
6050
+ */
6051
+ function collectPerNodeFieldKeys(fields) {
6052
+ const collected = [];
6053
+ for (const field of fields) {
6054
+ if (field.type === "group") {
6055
+ collected.push(...collectPerNodeFieldKeys(field.fields));
6056
+ continue;
6057
+ }
6058
+ if (field.type === "sub-tabs") {
6059
+ for (const tab of field.tabs) collected.push(...collectPerNodeFieldKeys(tab.fields));
6060
+ continue;
6061
+ }
6062
+ if ("perNode" in field && field.perNode === true) collected.push(field.key);
6063
+ }
6064
+ return collected;
6065
+ }
6066
+ /**
5905
6067
  * Normalize an `ICamstackAddon.initialize()` return value into the
5906
6068
  * `AddonInitResult` envelope. Arrays are wrapped into `{ providers }`;
5907
6069
  * envelopes pass through; void stays void.
@@ -5926,6 +6088,7 @@ var CamStreamKindSchema = _enum([
5926
6088
  "pull-rtsp",
5927
6089
  "pull-rtmp",
5928
6090
  "pull-http",
6091
+ "pull-flv",
5929
6092
  "pull-rfc4571",
5930
6093
  "push-annexb",
5931
6094
  "derived"
@@ -6308,6 +6471,13 @@ var DeviceType = /* @__PURE__ */ function(DeviceType) {
6308
6471
  /** Single still-image entity (HA `image.*`). Read-only display of an
6309
6472
  * `entity_picture` signed URL the browser loads directly. `image` cap. */
6310
6473
  DeviceType["Image"] = "image";
6474
+ /** Smart pet feeder — cloud-connected food dispenser with a bowl food
6475
+ * level, battery, desiccant life, feeding state and manual-feed /
6476
+ * call-pet / maintenance actions. Installed with the `pet-feeder` cap;
6477
+ * dual-hopper models (D4S/D4SH) expose per-hopper portions. Sources:
6478
+ * native PetKit (`nodepetkit` `FeederDevice`), reusable by other feeder
6479
+ * integrations sharing the same food/desiccant/hopper surface. */
6480
+ DeviceType["PetFeeder"] = "pet-feeder";
6311
6481
  return DeviceType;
6312
6482
  }({});
6313
6483
  var DeviceFeature = /* @__PURE__ */ function(DeviceFeature) {
@@ -7510,6 +7680,601 @@ var _macroLookup = /* @__PURE__ */ new Map();
7510
7680
  for (const [k, v] of Object.entries(YAMNET_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
7511
7681
  for (const [k, v] of Object.entries(APPLE_SA_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
7512
7682
  /**
7683
+ * Error types for the safe expression engine. Two distinct classes so callers
7684
+ * can tell a compile-time (grammar) failure from a runtime (evaluation)
7685
+ * failure — both are non-fatal to the host: read paths degrade to "skip link".
7686
+ */
7687
+ /** Thrown by the tokenizer / parser. Carries a 0-based source `position` when
7688
+ * the failure is anchored to a character (author-facing inline feedback). */
7689
+ var ExpressionParseError = class extends Error {
7690
+ position;
7691
+ constructor(message, position) {
7692
+ super(message);
7693
+ this.name = "ExpressionParseError";
7694
+ this.position = position;
7695
+ }
7696
+ };
7697
+ /** Thrown by the evaluator (unknown identifier, type mismatch, non-finite
7698
+ * result, unknown builtin, step-budget exceeded). */
7699
+ var ExpressionEvalError = class extends Error {
7700
+ constructor(message) {
7701
+ super(message);
7702
+ this.name = "ExpressionEvalError";
7703
+ }
7704
+ };
7705
+ /**
7706
+ * Resource-bound constants for the safe expression engine.
7707
+ *
7708
+ * Every bound is defense-in-depth: the grammar is non-Turing-complete (no
7709
+ * loops, recursion, lambdas or member access — see `ast.ts`), so evaluation is
7710
+ * O(nodeCount) by construction. These caps merely put a hard ceiling on the
7711
+ * work a single author-supplied expression can request, so a hostile or
7712
+ * accidental pathological string can never spend unbounded CPU/memory.
7713
+ */
7714
+ /** Max source length (chars) — checked BEFORE tokenizing so a huge string is
7715
+ * rejected without allocation. */
7716
+ var MAX_EXPRESSION_SOURCE_LENGTH = 2048;
7717
+ /** A legal binding / identifier name. */
7718
+ var EXPRESSION_IDENTIFIER_RE = /^[A-Za-z_][A-Za-z0-9_]*$/;
7719
+ /** Binding names an author may NOT use: `now` is auto-injected; the literal
7720
+ * keywords lex as values, not identifiers, so binding to them is meaningless. */
7721
+ var RESERVED_BINDING_NAMES = new Set([
7722
+ "now",
7723
+ "true",
7724
+ "false",
7725
+ "null"
7726
+ ]);
7727
+ /**
7728
+ * Tokenizer for the safe expression mini-language. Hand-rolled, single-pass,
7729
+ * zero-dependency. The grammar is deliberately boring: decimal numbers,
7730
+ * single/double-quoted strings with a tiny escape set, identifiers, the three
7731
+ * value keywords (`true`/`false`/`null`) and a fixed punctuator set. Anything
7732
+ * outside that — a bare `.`, `=`, `[`, `]`, `{`, `}`, `;`, backtick, `&`, `|` —
7733
+ * is a parse error with a source position, so member access / assignment /
7734
+ * template literals are lexically impossible.
7735
+ */
7736
+ var KEYWORDS = new Set([
7737
+ "true",
7738
+ "false",
7739
+ "null"
7740
+ ]);
7741
+ function isDigit(ch) {
7742
+ return ch >= "0" && ch <= "9";
7743
+ }
7744
+ function isIdentStart(ch) {
7745
+ return ch >= "A" && ch <= "Z" || ch >= "a" && ch <= "z" || ch === "_";
7746
+ }
7747
+ function isIdentPart(ch) {
7748
+ return isIdentStart(ch) || isDigit(ch);
7749
+ }
7750
+ function isWhitespace(ch) {
7751
+ return ch === " " || ch === " " || ch === "\n" || ch === "\r" || ch === "\f" || ch === "\v";
7752
+ }
7753
+ /** Tokenize `source` into a flat token list ending with a single `eof` token.
7754
+ * Throws `ExpressionParseError` on any illegal character or unterminated
7755
+ * string. */
7756
+ function tokenize(source) {
7757
+ if (source.length > 2048) throw new ExpressionParseError(`expression too long (${source.length} > ${MAX_EXPRESSION_SOURCE_LENGTH} chars)`, 0);
7758
+ const tokens = [];
7759
+ let i = 0;
7760
+ const n = source.length;
7761
+ while (i < n) {
7762
+ const ch = source[i];
7763
+ if (isWhitespace(ch)) {
7764
+ i += 1;
7765
+ continue;
7766
+ }
7767
+ if (isDigit(ch)) {
7768
+ const start = i;
7769
+ while (i < n && isDigit(source[i])) i += 1;
7770
+ if (i < n && source[i] === ".") {
7771
+ if (i + 1 >= n || !isDigit(source[i + 1])) throw new ExpressionParseError("malformed number: decimal point needs a digit", i);
7772
+ i += 1;
7773
+ while (i < n && isDigit(source[i])) i += 1;
7774
+ }
7775
+ const text = source.slice(start, i);
7776
+ const value = Number(text);
7777
+ if (!Number.isFinite(value)) throw new ExpressionParseError(`malformed number: '${text}'`, start);
7778
+ tokens.push({
7779
+ type: "number",
7780
+ value,
7781
+ pos: start
7782
+ });
7783
+ continue;
7784
+ }
7785
+ if (ch === "'" || ch === "\"") {
7786
+ const quote = ch;
7787
+ const start = i;
7788
+ i += 1;
7789
+ let out = "";
7790
+ let closed = false;
7791
+ while (i < n) {
7792
+ const c = source[i];
7793
+ if (c === "\\") {
7794
+ const next = i + 1 < n ? source[i + 1] : "";
7795
+ if (next === "\\" || next === "'" || next === "\"") {
7796
+ out += next;
7797
+ i += 2;
7798
+ continue;
7799
+ }
7800
+ throw new ExpressionParseError(`invalid string escape: '\\${next}'`, i);
7801
+ }
7802
+ if (c === quote) {
7803
+ closed = true;
7804
+ i += 1;
7805
+ break;
7806
+ }
7807
+ out += c;
7808
+ i += 1;
7809
+ }
7810
+ if (!closed) throw new ExpressionParseError("unterminated string literal", start);
7811
+ tokens.push({
7812
+ type: "string",
7813
+ value: out,
7814
+ pos: start
7815
+ });
7816
+ continue;
7817
+ }
7818
+ if (isIdentStart(ch)) {
7819
+ const start = i;
7820
+ while (i < n && isIdentPart(source[i])) i += 1;
7821
+ const text = source.slice(start, i);
7822
+ if (KEYWORDS.has(text)) tokens.push({
7823
+ type: "keyword",
7824
+ keyword: keywordOf(text),
7825
+ pos: start
7826
+ });
7827
+ else tokens.push({
7828
+ type: "identifier",
7829
+ name: text,
7830
+ pos: start
7831
+ });
7832
+ continue;
7833
+ }
7834
+ const two = i + 1 < n ? source.slice(i, i + 2) : "";
7835
+ if (two === "<=" || two === ">=" || two === "==" || two === "!=" || two === "&&" || two === "||") {
7836
+ tokens.push({
7837
+ type: "punct",
7838
+ punct: two,
7839
+ pos: i
7840
+ });
7841
+ i += 2;
7842
+ continue;
7843
+ }
7844
+ if (isSinglePunct(ch)) {
7845
+ tokens.push({
7846
+ type: "punct",
7847
+ punct: ch,
7848
+ pos: i
7849
+ });
7850
+ i += 1;
7851
+ continue;
7852
+ }
7853
+ throw new ExpressionParseError(`unexpected character '${ch}'`, i);
7854
+ }
7855
+ tokens.push({
7856
+ type: "eof",
7857
+ pos: n
7858
+ });
7859
+ return tokens;
7860
+ }
7861
+ function keywordOf(text) {
7862
+ if (text === "true") return "true";
7863
+ if (text === "false") return "false";
7864
+ return "null";
7865
+ }
7866
+ function isSinglePunct(ch) {
7867
+ return ch === "(" || ch === ")" || ch === "," || ch === "?" || ch === ":" || ch === "+" || ch === "-" || ch === "*" || ch === "/" || ch === "%" || ch === "!" || ch === "<" || ch === ">";
7868
+ }
7869
+ /**
7870
+ * Frozen, null-prototype builtin function table for the expression engine
7871
+ * (spec §4 rule 4). The table is the SOLE surface of callable functions: the
7872
+ * parser rejects any callee not in it, and the evaluator gates each call on an
7873
+ * own-property check against it.
7874
+ *
7875
+ * Because the object has a NULL prototype AND is `Object.freeze`d:
7876
+ * - it cannot be polluted (no `__proto__` / `constructor` write reaches it);
7877
+ * - a lookup for `toString` / `hasOwnProperty` / `constructor` finds NOTHING
7878
+ * (there is no `Object.prototype` in the chain), so those names are not
7879
+ * callable — they are simply "unknown function" at parse time.
7880
+ *
7881
+ * Every numeric argument is validated as a finite number and every numeric
7882
+ * RESULT is re-checked finite, so `/0`, `sqrt(-1)` (→ NaN) and overflow
7883
+ * (`pow(10,400)` → Infinity) all raise `ExpressionEvalError` and fail the link
7884
+ * closed rather than emitting a garbage value.
7885
+ */
7886
+ function asFiniteNumber(value, name, index) {
7887
+ if (typeof value !== "number" || !Number.isFinite(value)) throw new ExpressionEvalError(`${name}: argument ${index + 1} must be a finite number`);
7888
+ return value;
7889
+ }
7890
+ function asString$1(value, name, index) {
7891
+ if (typeof value !== "string") throw new ExpressionEvalError(`${name}: argument ${index + 1} must be a string`);
7892
+ return value;
7893
+ }
7894
+ function finiteResult(value, name) {
7895
+ if (!Number.isFinite(value)) throw new ExpressionEvalError(`${name}: produced a non-finite result`);
7896
+ return value;
7897
+ }
7898
+ function allFiniteNumbers(args, name) {
7899
+ return args.map((a, idx) => asFiniteNumber(a, name, idx));
7900
+ }
7901
+ var INF = Number.POSITIVE_INFINITY;
7902
+ var table = {
7903
+ min: {
7904
+ minArgs: 1,
7905
+ maxArgs: INF,
7906
+ apply: (args) => finiteResult(Math.min(...allFiniteNumbers(args, "min")), "min")
7907
+ },
7908
+ max: {
7909
+ minArgs: 1,
7910
+ maxArgs: INF,
7911
+ apply: (args) => finiteResult(Math.max(...allFiniteNumbers(args, "max")), "max")
7912
+ },
7913
+ abs: {
7914
+ minArgs: 1,
7915
+ maxArgs: 1,
7916
+ apply: (args) => finiteResult(Math.abs(asFiniteNumber(args[0], "abs", 0)), "abs")
7917
+ },
7918
+ floor: {
7919
+ minArgs: 1,
7920
+ maxArgs: 1,
7921
+ apply: (args) => finiteResult(Math.floor(asFiniteNumber(args[0], "floor", 0)), "floor")
7922
+ },
7923
+ ceil: {
7924
+ minArgs: 1,
7925
+ maxArgs: 1,
7926
+ apply: (args) => finiteResult(Math.ceil(asFiniteNumber(args[0], "ceil", 0)), "ceil")
7927
+ },
7928
+ sqrt: {
7929
+ minArgs: 1,
7930
+ maxArgs: 1,
7931
+ apply: (args) => finiteResult(Math.sqrt(asFiniteNumber(args[0], "sqrt", 0)), "sqrt")
7932
+ },
7933
+ round: {
7934
+ minArgs: 1,
7935
+ maxArgs: 2,
7936
+ apply: (args) => {
7937
+ const x = asFiniteNumber(args[0], "round", 0);
7938
+ const digits = args.length > 1 ? Math.trunc(asFiniteNumber(args[1], "round", 1)) : 0;
7939
+ if (digits < 0 || digits > 100) throw new ExpressionEvalError("round: digits must be between 0 and 100");
7940
+ const factor = 10 ** digits;
7941
+ return finiteResult(Math.round(x * factor) / factor, "round");
7942
+ }
7943
+ },
7944
+ pow: {
7945
+ minArgs: 2,
7946
+ maxArgs: 2,
7947
+ apply: (args) => finiteResult(asFiniteNumber(args[0], "pow", 0) ** asFiniteNumber(args[1], "pow", 1), "pow")
7948
+ },
7949
+ clamp: {
7950
+ minArgs: 3,
7951
+ maxArgs: 3,
7952
+ apply: (args) => {
7953
+ const x = asFiniteNumber(args[0], "clamp", 0);
7954
+ const lo = asFiniteNumber(args[1], "clamp", 1);
7955
+ const hi = asFiniteNumber(args[2], "clamp", 2);
7956
+ if (lo > hi) throw new ExpressionEvalError("clamp: lower bound is greater than upper bound");
7957
+ return finiteResult(Math.min(hi, Math.max(lo, x)), "clamp");
7958
+ }
7959
+ },
7960
+ avg: {
7961
+ minArgs: 1,
7962
+ maxArgs: INF,
7963
+ apply: (args) => {
7964
+ const nums = allFiniteNumbers(args, "avg");
7965
+ return finiteResult(nums.reduce((acc, v) => acc + v, 0) / nums.length, "avg");
7966
+ }
7967
+ },
7968
+ sum: {
7969
+ minArgs: 1,
7970
+ maxArgs: INF,
7971
+ apply: (args) => finiteResult(allFiniteNumbers(args, "sum").reduce((acc, v) => acc + v, 0), "sum")
7972
+ },
7973
+ coalesce: {
7974
+ minArgs: 1,
7975
+ maxArgs: INF,
7976
+ apply: (args) => {
7977
+ for (const a of args) if (a !== null) return a;
7978
+ return null;
7979
+ }
7980
+ },
7981
+ age: {
7982
+ minArgs: 2,
7983
+ maxArgs: 2,
7984
+ apply: (args) => finiteResult(asFiniteNumber(args[0], "age", 0) - asFiniteNumber(args[1], "age", 1), "age")
7985
+ },
7986
+ convert: {
7987
+ minArgs: 3,
7988
+ maxArgs: 3,
7989
+ apply: (args, hooks) => {
7990
+ const x = asFiniteNumber(args[0], "convert", 0);
7991
+ const from = asString$1(args[1], "convert", 1).trim();
7992
+ const to = asString$1(args[2], "convert", 2).trim();
7993
+ if (hooks.convert) {
7994
+ const out = hooks.convert(x, from, to);
7995
+ if (out === null) throw new ExpressionEvalError(`convert: cannot convert '${from}' to '${to}'`);
7996
+ return finiteResult(out, "convert");
7997
+ }
7998
+ if (from === to) return x;
7999
+ throw new ExpressionEvalError("convert: unit conversion table not installed");
8000
+ }
8001
+ }
8002
+ };
8003
+ Object.freeze(Object.assign(Object.create(null), table));
8004
+ /** The set of valid builtin names — used by the parser to reject unknown
8005
+ * callees at parse time (immediate author feedback). */
8006
+ var EXPRESSION_BUILTIN_NAMES = new Set(Object.keys(table));
8007
+ /**
8008
+ * Pratt (precedence-climbing) parser for the safe expression mini-language.
8009
+ *
8010
+ * Precedence (low → high): ternary `?:` (right-assoc) → `||` → `&&` → equality
8011
+ * → relational → additive → multiplicative → unary `! -` → call / primary.
8012
+ * Calls are ONLY `IDENT '(' args? ')'` at primary position — the callee is a
8013
+ * string validated against the builtin table at parse time, so an unknown
8014
+ * function is rejected immediately (author feedback) and a persisted expression
8015
+ * that references a since-removed builtin degrades at read.
8016
+ *
8017
+ * A node counter caps total AST size (`MAX_EXPRESSION_AST_NODES`) and call
8018
+ * arity is capped (`MAX_EXPRESSION_CALL_ARGS`) — both raise `ExpressionParseError`.
8019
+ */
8020
+ /** Binary/logical operator precedence (higher binds tighter). */
8021
+ var BINARY_PRECEDENCE = {
8022
+ "||": 1,
8023
+ "&&": 2,
8024
+ "==": 3,
8025
+ "!=": 3,
8026
+ "<": 4,
8027
+ "<=": 4,
8028
+ ">": 4,
8029
+ ">=": 4,
8030
+ "+": 5,
8031
+ "-": 5,
8032
+ "*": 6,
8033
+ "/": 6,
8034
+ "%": 6
8035
+ };
8036
+ function isLogicalOp(op) {
8037
+ return op === "&&" || op === "||";
8038
+ }
8039
+ function isBinaryOp(op) {
8040
+ return op === "+" || op === "-" || op === "*" || op === "/" || op === "%" || op === "==" || op === "!=" || op === "<" || op === "<=" || op === ">" || op === ">=";
8041
+ }
8042
+ var Parser = class {
8043
+ tokens;
8044
+ pos = 0;
8045
+ nodeCount = 0;
8046
+ identifiers = /* @__PURE__ */ new Set();
8047
+ callees = /* @__PURE__ */ new Set();
8048
+ constructor(tokens) {
8049
+ this.tokens = tokens;
8050
+ }
8051
+ parse() {
8052
+ const ast = this.parseTernary();
8053
+ const tok = this.peek();
8054
+ if (tok.type !== "eof") throw new ExpressionParseError("unexpected trailing input", tok.pos);
8055
+ return {
8056
+ ast,
8057
+ identifiers: this.identifiers,
8058
+ callees: this.callees,
8059
+ nodeCount: this.nodeCount
8060
+ };
8061
+ }
8062
+ peek() {
8063
+ return this.tokens[this.pos];
8064
+ }
8065
+ next() {
8066
+ return this.tokens[this.pos++];
8067
+ }
8068
+ /** Consume a punctuator token, erroring if the next token isn't it. */
8069
+ expectPunct(punct) {
8070
+ const tok = this.peek();
8071
+ if (tok.type !== "punct" || tok.punct !== punct) throw new ExpressionParseError(`expected '${punct}'`, tok.pos);
8072
+ this.pos += 1;
8073
+ }
8074
+ matchPunct(punct) {
8075
+ const tok = this.peek();
8076
+ if (tok.type === "punct" && tok.punct === punct) {
8077
+ this.pos += 1;
8078
+ return true;
8079
+ }
8080
+ return false;
8081
+ }
8082
+ countNode() {
8083
+ this.nodeCount += 1;
8084
+ if (this.nodeCount > 256) throw new ExpressionParseError("expression too complex", this.peek().pos);
8085
+ }
8086
+ parseTernary() {
8087
+ const test = this.parseBinary(1);
8088
+ if (this.matchPunct("?")) {
8089
+ const consequent = this.parseTernary();
8090
+ this.expectPunct(":");
8091
+ const alternate = this.parseTernary();
8092
+ this.countNode();
8093
+ return {
8094
+ kind: "conditional",
8095
+ test,
8096
+ consequent,
8097
+ alternate
8098
+ };
8099
+ }
8100
+ return test;
8101
+ }
8102
+ parseBinary(minPrec) {
8103
+ let left = this.parseUnary();
8104
+ for (;;) {
8105
+ const tok = this.peek();
8106
+ if (tok.type !== "punct") break;
8107
+ const prec = BINARY_PRECEDENCE[tok.punct];
8108
+ if (prec === void 0 || prec < minPrec) break;
8109
+ const op = tok.punct;
8110
+ this.pos += 1;
8111
+ const right = this.parseBinary(prec + 1);
8112
+ this.countNode();
8113
+ if (isLogicalOp(op)) left = {
8114
+ kind: "logical",
8115
+ op,
8116
+ left,
8117
+ right
8118
+ };
8119
+ else if (isBinaryOp(op)) left = {
8120
+ kind: "binary",
8121
+ op,
8122
+ left,
8123
+ right
8124
+ };
8125
+ else throw new ExpressionParseError(`unexpected operator '${op}'`, tok.pos);
8126
+ }
8127
+ return left;
8128
+ }
8129
+ parseUnary() {
8130
+ const tok = this.peek();
8131
+ if (tok.type === "punct" && (tok.punct === "!" || tok.punct === "-")) {
8132
+ const op = tok.punct;
8133
+ this.pos += 1;
8134
+ const operand = this.parseUnary();
8135
+ this.countNode();
8136
+ return {
8137
+ kind: "unary",
8138
+ op,
8139
+ operand
8140
+ };
8141
+ }
8142
+ return this.parsePrimary();
8143
+ }
8144
+ parsePrimary() {
8145
+ const tok = this.next();
8146
+ switch (tok.type) {
8147
+ case "number":
8148
+ this.countNode();
8149
+ return {
8150
+ kind: "literal",
8151
+ value: tok.value
8152
+ };
8153
+ case "string":
8154
+ this.countNode();
8155
+ return {
8156
+ kind: "literal",
8157
+ value: tok.value
8158
+ };
8159
+ case "keyword":
8160
+ this.countNode();
8161
+ return {
8162
+ kind: "literal",
8163
+ value: tok.keyword === "null" ? null : tok.keyword === "true"
8164
+ };
8165
+ case "identifier": {
8166
+ const nextTok = this.peek();
8167
+ if (nextTok.type === "punct" && nextTok.punct === "(") return this.parseCall(tok.name, tok.pos);
8168
+ this.identifiers.add(tok.name);
8169
+ this.countNode();
8170
+ return {
8171
+ kind: "identifier",
8172
+ name: tok.name
8173
+ };
8174
+ }
8175
+ case "punct":
8176
+ if (tok.punct === "(") {
8177
+ const inner = this.parseTernary();
8178
+ this.expectPunct(")");
8179
+ return inner;
8180
+ }
8181
+ throw new ExpressionParseError(`unexpected token '${tok.punct}'`, tok.pos);
8182
+ case "eof": throw new ExpressionParseError("unexpected end of expression", tok.pos);
8183
+ }
8184
+ }
8185
+ parseCall(callee, pos) {
8186
+ if (!EXPRESSION_BUILTIN_NAMES.has(callee)) throw new ExpressionParseError(`unknown function '${callee}'`, pos);
8187
+ this.expectPunct("(");
8188
+ const args = [];
8189
+ if (!this.matchPunct(")")) for (;;) {
8190
+ args.push(this.parseTernary());
8191
+ if (args.length > 16) throw new ExpressionParseError(`too many arguments to '${callee}'`, pos);
8192
+ if (this.matchPunct(",")) continue;
8193
+ this.expectPunct(")");
8194
+ break;
8195
+ }
8196
+ this.callees.add(callee);
8197
+ this.countNode();
8198
+ return {
8199
+ kind: "call",
8200
+ callee,
8201
+ args
8202
+ };
8203
+ }
8204
+ };
8205
+ /** Tokenize + parse `source` into a validated `ParsedExpression`. Throws
8206
+ * `ExpressionParseError` on any lexical or grammatical failure. */
8207
+ function parseExpression(source) {
8208
+ return new Parser(tokenize(source)).parse();
8209
+ }
8210
+ Object.freeze({});
8211
+ /**
8212
+ * LRU compile cache for parsed expressions (spec §2.4 "parse once … LRU keyed
8213
+ * by expr"). The cache stores BOTH successes and failures (negative caching),
8214
+ * so a corrupt persisted string costs exactly one tokenize+parse total — not
8215
+ * one per read on a hot resolve path.
8216
+ *
8217
+ * The cache is a module-level singleton: entries are pure, content-addressed
8218
+ * ASTs keyed by the raw source string, so sharing one instance across all
8219
+ * callers is safe and maximises hit rate.
8220
+ */
8221
+ var cache = /* @__PURE__ */ new Map();
8222
+ function getCached(source) {
8223
+ const hit = cache.get(source);
8224
+ if (hit !== void 0) {
8225
+ cache.delete(source);
8226
+ cache.set(source, hit);
8227
+ return hit;
8228
+ }
8229
+ let result;
8230
+ try {
8231
+ result = {
8232
+ ok: true,
8233
+ parsed: parseExpression(source)
8234
+ };
8235
+ } catch (err) {
8236
+ result = {
8237
+ ok: false,
8238
+ error: err instanceof ExpressionParseError ? err.message : String(err)
8239
+ };
8240
+ }
8241
+ cache.set(source, result);
8242
+ if (cache.size > 256) {
8243
+ const oldest = cache.keys().next().value;
8244
+ if (oldest !== void 0) cache.delete(oldest);
8245
+ }
8246
+ return result;
8247
+ }
8248
+ /** Compile `source`, returning a discriminated result instead of throwing.
8249
+ * Used by read paths that must degrade rather than raise. LRU/negative-cached. */
8250
+ function compileExpressionSafe(source) {
8251
+ return getCached(source);
8252
+ }
8253
+ /**
8254
+ * Author-time validation. Returns `null` when the source is valid, else a
8255
+ * human-readable error message. Checks: the expression compiles; binding count
8256
+ * is within `MAX_EXPRESSION_BINDINGS`; every binding name is a legal identifier,
8257
+ * is not reserved (`now`/keywords) and does not shadow a builtin; and every
8258
+ * FREE identifier of the AST is covered by a binding or the injected `now`.
8259
+ */
8260
+ function validateExpressionSource(src) {
8261
+ const names = Object.keys(src.bindings);
8262
+ if (names.length > 32) return `too many bindings (${names.length} > 32)`;
8263
+ for (const name of names) {
8264
+ if (!EXPRESSION_IDENTIFIER_RE.test(name)) return `invalid binding name '${name}'`;
8265
+ if (RESERVED_BINDING_NAMES.has(name)) return `binding name '${name}' is reserved`;
8266
+ if (EXPRESSION_BUILTIN_NAMES.has(name)) return `binding name '${name}' shadows a builtin function`;
8267
+ }
8268
+ const compiled = compileExpressionSafe(src.expr);
8269
+ if (!compiled.ok) return compiled.error;
8270
+ const bound = new Set(names);
8271
+ for (const id of compiled.parsed.identifiers) {
8272
+ if (id === "now") continue;
8273
+ if (!bound.has(id)) return `expression references unbound identifier '${id}'`;
8274
+ }
8275
+ return null;
8276
+ }
8277
+ /**
7513
8278
  * Accessory device helpers — shared across drivers.
7514
8279
  *
7515
8280
  * Many vendor-specific drivers register accessory child devices on
@@ -9412,7 +10177,8 @@ var MotionAnalysisResultSchema = object({
9412
10177
  });
9413
10178
  method(object({
9414
10179
  deviceId: number(),
9415
- frame: FrameInputSchema
10180
+ frame: FrameInputSchema.optional(),
10181
+ frameHandle: FrameHandleSchema.optional()
9416
10182
  }), MotionAnalysisResultSchema, { kind: "mutation" }), method(object({ deviceId: number() }), _void(), { kind: "mutation" }), method(_void(), _void(), { kind: "mutation" }), object({
9417
10183
  deviceId: number(),
9418
10184
  detected: boolean(),
@@ -9659,6 +10425,12 @@ method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngi
9659
10425
  engine: PipelineEngineChoiceSchema.optional(),
9660
10426
  steps: array(PipelineStepInputSchema).min(1),
9661
10427
  frame: FrameInputSchema.optional(),
10428
+ /**
10429
+ * CB5 shm passthrough — a `FrameHandle` naming the same ring slot
10430
+ * the decoded pixels live in. One more member of the one-of
10431
+ * frame/frameHandle/image/imageBase64/referenceImage group.
10432
+ */
10433
+ frameHandle: FrameHandleSchema.optional(),
9662
10434
  imageBase64: string().optional(),
9663
10435
  /**
9664
10436
  * Binary JPEG bytes — preferred over `imageBase64` on internal
@@ -9868,6 +10640,31 @@ var ReportMotionInputSchema = object({
9868
10640
  regions: array(MotionRegionSchema).readonly().optional()
9869
10641
  });
9870
10642
  /**
10643
+ * Where a runner gets a camera's decoded frames (cross-node Phase 2,
10644
+ * restream-owner model — P2c).
10645
+ *
10646
+ * - `local-broker` (DEFAULT): today's path — subscribe to the co-located
10647
+ * stream-broker's shm frame plane. Every pre-P2c attach payload (no
10648
+ * `frameSource` key) parses to this, so the field is additive with zero
10649
+ * behavior change.
10650
+ * - `remote-restream`: the detect node is NOT the camera's source-owner.
10651
+ * The runner acquires the owner's COMPRESSED passthrough restream
10652
+ * (`streamBroker.getStreamWithCodec({video:'copy'})` — refcounted, the
10653
+ * double-pull guard) and decodes LOCALLY via a satellite frame plane +
10654
+ * pull-mode decoder session pinned to its own node. The shm ring stays
10655
+ * node-local; only H.264/H.265 packets cross the wire.
10656
+ * `hubHostnameOverride` mirrors the recorder's `recordingHubHostname`:
10657
+ * when set it overrides the `CAMSTACK_HUB_URL`-derived host the runner
10658
+ * dials for the owner's restream.
10659
+ */
10660
+ var RunnerFrameSourceSchema = discriminatedUnion("kind", [object({ kind: literal("local-broker") }), object({
10661
+ kind: literal("remote-restream"),
10662
+ /** The camera's source-owner node (slice 1: always the hub). */
10663
+ ownerNodeId: string(),
10664
+ /** Operator override for the owner host the runner dials. */
10665
+ hubHostnameOverride: string().optional()
10666
+ })]).describe("Per-camera frame-source mode for the runner (P2c)");
10667
+ /**
9871
10668
  * Camera assignment payload sent by `addon-pipeline-orchestrator` to a
9872
10669
  * specific runner instance via `attachCamera`. Carries everything the
9873
10670
  * runner needs to subscribe to the local broker and execute inference.
@@ -9965,7 +10762,15 @@ var RunnerCameraConfigSchema = object({
9965
10762
  */
9966
10763
  onboardMotionDrivesAnalyzer: boolean().default(true),
9967
10764
  occupancyRecheckSec: number().min(occupancyRecheckSecField.min).max(occupancyRecheckSecField.max).default(occupancyRecheckSecField.default),
9968
- occupancyRecheckFrames: number().min(occupancyRecheckFramesField.min).max(occupancyRecheckFramesField.max).default(occupancyRecheckFramesField.default)
10765
+ occupancyRecheckFrames: number().min(occupancyRecheckFramesField.min).max(occupancyRecheckFramesField.max).default(occupancyRecheckFramesField.default),
10766
+ /**
10767
+ * Where this runner gets the camera's decoded frames (P2c). Defaulted so
10768
+ * every existing payload behaves as `local-broker` — the pre-Phase-2 path.
10769
+ * Populated with `remote-restream` by the orchestrator ONLY when the
10770
+ * camera's detect node differs from its source-owner (P2d, gated by the
10771
+ * `remoteSourcingNodes` rollout setting).
10772
+ */
10773
+ frameSource: RunnerFrameSourceSchema.default({ kind: "local-broker" })
9969
10774
  });
9970
10775
  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;
9971
10776
  /**
@@ -10330,6 +11135,113 @@ object({
10330
11135
  lastFetchedAt: number()
10331
11136
  });
10332
11137
  DeviceType.Sensor;
11138
+ /**
11139
+ * Feeder connectivity / power status — mirrors the HA petkit device-status
11140
+ * enum: `normal` (online, mains), `offline` (not reaching PetKit cloud),
11141
+ * `on_batteries` (running on battery backup). `null` until first reported.
11142
+ */
11143
+ var PetFeederDeviceStatusSchema = _enum([
11144
+ "normal",
11145
+ "offline",
11146
+ "on_batteries"
11147
+ ]);
11148
+ var gramsPortion = number().int().min(4).max(200);
11149
+ object({
11150
+ /** Food currently in the bowl (grams). Null when the device has not
11151
+ * reported a reading yet. On dual-hopper models this is the combined
11152
+ * bowl reading; per-hopper levels live in `food1`/`food2`. */
11153
+ foodLevel: number().nullable(),
11154
+ /** Hopper-1 food level (grams) on dual-hopper feeders; null on
11155
+ * single-hopper models. */
11156
+ food1: number().nullable(),
11157
+ /** Hopper-2 food level (grams) on dual-hopper feeders; null on
11158
+ * single-hopper models. */
11159
+ food2: number().nullable(),
11160
+ /** Derived low-food flag — mirrors the HA `food_level` binary_sensor
11161
+ * (`device_class: problem`, on = low). True when the bowl is empty /
11162
+ * below the feeder's low threshold. */
11163
+ lowFood: boolean(),
11164
+ /** Battery charge 0..100 (%). Null on mains-powered models or when the
11165
+ * device has no battery reading. */
11166
+ batteryPower: number().min(0).max(100).nullable(),
11167
+ /** Days of desiccant life remaining. Null when the model has no
11168
+ * desiccant sensor. */
11169
+ desiccantLeftDays: number().nullable(),
11170
+ /** True while a feed is in progress. */
11171
+ feeding: boolean(),
11172
+ /** Decoded connectivity / power status (HA petkit device-status enum).
11173
+ * Null until the device has reported a status. */
11174
+ status: PetFeederDeviceStatusSchema.nullable(),
11175
+ /** Decoded human-readable fault message. Null (or the device's `no_error`
11176
+ * sentinel) means healthy; a non-null string is an active fault. Pairs
11177
+ * with `errorCode` for consumers that want the raw integer. */
11178
+ error: string().nullable(),
11179
+ /** Raw device error code (0 / null = no error). */
11180
+ errorCode: number().nullable(),
11181
+ /** True for D4S/D4SH dual-hopper hardware — gates the per-hopper UI. */
11182
+ isDualHopper: boolean(),
11183
+ /** Child-lock (manual-lock) setting — buttons on the unit are disabled. */
11184
+ childLock: boolean(),
11185
+ /** Front indicator-light setting. */
11186
+ indicatorLight: boolean(),
11187
+ /** Play a chime when dispensing. */
11188
+ feedSound: boolean(),
11189
+ /** Speaker / prompt volume level (device-scaled integer). */
11190
+ volume: number(),
11191
+ /** Ms epoch when the slice was last refreshed from the cloud. */
11192
+ lastFetchedAt: number()
11193
+ });
11194
+ DeviceType.PetFeeder, method(object({
11195
+ deviceId: number().int().nonnegative(),
11196
+ grams: gramsPortion.optional(),
11197
+ hopper1: gramsPortion.optional(),
11198
+ hopper2: gramsPortion.optional()
11199
+ }), _void(), {
11200
+ kind: "mutation",
11201
+ auth: "admin"
11202
+ }), method(object({ deviceId: number().int().nonnegative() }), _void(), {
11203
+ kind: "mutation",
11204
+ auth: "admin"
11205
+ }), method(object({ deviceId: number().int().nonnegative() }), _void(), {
11206
+ kind: "mutation",
11207
+ auth: "admin"
11208
+ }), method(object({ deviceId: number().int().nonnegative() }), _void(), {
11209
+ kind: "mutation",
11210
+ auth: "admin"
11211
+ }), method(object({ deviceId: number().int().nonnegative() }), _void(), {
11212
+ kind: "mutation",
11213
+ auth: "admin"
11214
+ }), method(object({
11215
+ deviceId: number().int().nonnegative(),
11216
+ soundId: number().int().nonnegative()
11217
+ }), _void(), {
11218
+ kind: "mutation",
11219
+ auth: "admin"
11220
+ }), method(object({
11221
+ deviceId: number().int().nonnegative(),
11222
+ on: boolean()
11223
+ }), _void(), {
11224
+ kind: "mutation",
11225
+ auth: "admin"
11226
+ }), method(object({
11227
+ deviceId: number().int().nonnegative(),
11228
+ on: boolean()
11229
+ }), _void(), {
11230
+ kind: "mutation",
11231
+ auth: "admin"
11232
+ }), method(object({
11233
+ deviceId: number().int().nonnegative(),
11234
+ on: boolean()
11235
+ }), _void(), {
11236
+ kind: "mutation",
11237
+ auth: "admin"
11238
+ }), method(object({
11239
+ deviceId: number().int().nonnegative(),
11240
+ level: number().int().nonnegative()
11241
+ }), _void(), {
11242
+ kind: "mutation",
11243
+ auth: "admin"
11244
+ });
10333
11245
  object({
10334
11246
  /** Instantaneous power draw in watts. */
10335
11247
  watts: number().optional(),
@@ -12157,10 +13069,12 @@ method(object({ codec: string() }), boolean()), method(_void(), object({
12157
13069
  url: string()
12158
13070
  }), _void()), method(object({
12159
13071
  sessionId: string(),
12160
- maxCount: number().default(1)
13072
+ maxCount: number().default(1),
13073
+ waitMs: number().optional()
12161
13074
  }), array(DecodedFrameSchema)), method(object({
12162
13075
  sessionId: string(),
12163
- maxCount: number().default(1)
13076
+ maxCount: number().default(1),
13077
+ waitMs: number().optional()
12164
13078
  }), array(FrameHandleSchema)), method(object({ handle: FrameHandleSchema }), DecodedFrameSchema.nullable()), method(object({ sessionId: string() }), ShmRingStatsSchema.nullable()), method(object({
12165
13079
  sessionId: string(),
12166
13080
  config: DecoderSessionConfigSchema.partial()
@@ -12472,14 +13386,63 @@ var ChildLayoutEntrySchema = object({
12472
13386
  collapsed: boolean().optional()
12473
13387
  });
12474
13388
  /** Cap-wire shape of a DeviceLink — structurally mirrors `DeviceLink` in
12475
- * `device-management.ts`. */
13389
+ * `device-management.ts`. Source is a union: a FIELD source copies a sibling
13390
+ * accessory's status field (`kind` optional/absent for wire compat); a
13391
+ * LITERAL source carries a per-device constant (no sibling is read); a
13392
+ * GLOBAL source (P2e) copies ANY device's status field, addressed by the
13393
+ * source device's full re-sync-stable `stableId`. */
13394
+ var DeviceLinkFieldSourceSchema = object({
13395
+ kind: literal("field").optional(),
13396
+ sourceKey: string(),
13397
+ cap: string(),
13398
+ fieldPath: string()
13399
+ });
13400
+ var DeviceLinkLiteralSourceSchema = object({
13401
+ kind: literal("literal"),
13402
+ value: union([
13403
+ string(),
13404
+ number(),
13405
+ boolean(),
13406
+ _null()
13407
+ ])
13408
+ });
13409
+ var DeviceLinkGlobalSourceSchema = object({
13410
+ kind: literal("global"),
13411
+ sourceStableId: string(),
13412
+ cap: string(),
13413
+ fieldPath: string()
13414
+ });
13415
+ /** Expression source (Stage X): compute the target field from N named bindings
13416
+ * via the safe expression engine. Bindings are field | literal | global — never
13417
+ * another expression (no nesting). The `superRefine` runs the SAME author-time
13418
+ * validation as `validateExpressionSource` (compiles the expr, checks binding
13419
+ * names + identifier coverage) so every wire boundary that parses a DeviceLink
13420
+ * (tRPC mount, kernel create pre-seed, projection output) validates-at-write.
13421
+ * Compiles are LRU-cached, so repeated validation of the same expr is a hit. */
13422
+ var DeviceLinkExpressionSourceSchema = object({
13423
+ kind: literal("expression"),
13424
+ expr: string().min(1).max(MAX_EXPRESSION_SOURCE_LENGTH),
13425
+ bindings: record(string().regex(EXPRESSION_IDENTIFIER_RE), union([
13426
+ DeviceLinkFieldSourceSchema,
13427
+ DeviceLinkLiteralSourceSchema,
13428
+ DeviceLinkGlobalSourceSchema
13429
+ ]))
13430
+ }).superRefine((src, ctx) => {
13431
+ const err = validateExpressionSource(src);
13432
+ if (err !== null) ctx.addIssue({
13433
+ code: "custom",
13434
+ message: err,
13435
+ path: ["expr"]
13436
+ });
13437
+ });
12476
13438
  var DeviceLinkSchema = object({
12477
13439
  id: string(),
12478
- source: object({
12479
- sourceKey: string(),
12480
- cap: string(),
12481
- fieldPath: string()
12482
- }),
13440
+ source: union([
13441
+ DeviceLinkFieldSourceSchema,
13442
+ DeviceLinkLiteralSourceSchema,
13443
+ DeviceLinkGlobalSourceSchema,
13444
+ DeviceLinkExpressionSourceSchema
13445
+ ]),
12483
13446
  target: object({
12484
13447
  cap: string(),
12485
13448
  fieldPath: string(),
@@ -12508,6 +13471,31 @@ var DeviceLinkSchema = object({
12508
13471
  })
12509
13472
  ]).optional()
12510
13473
  });
13474
+ /** Cap-wire shape of a per-cap display refinement — mirrors
13475
+ * `DeviceCapDisplayOverride` in `device-management.ts`. */
13476
+ var DeviceCapDisplayOverrideSchema = object({
13477
+ unit: string().min(1).optional(),
13478
+ precision: number().int().min(0).max(10).optional()
13479
+ });
13480
+ /** Cap-wire shape of an operator-authored per-device display override —
13481
+ * mirrors `DeviceDisplayOverride` in `device-management.ts`. `precision`
13482
+ * bounds mirror `numeric-sensor.cap.ts` (`int 0-10`). */
13483
+ var DeviceDisplayOverrideSchema = object({
13484
+ icon: string().min(1).optional(),
13485
+ label: string().min(1).optional(),
13486
+ unit: string().min(1).optional(),
13487
+ precision: number().int().min(0).max(10).optional(),
13488
+ hidden: boolean().optional(),
13489
+ perCap: record(string(), DeviceCapDisplayOverrideSchema).optional()
13490
+ });
13491
+ /** Cap-wire shape of a per-role display default — mirrors `RoleDisplayDefault`
13492
+ * in `device-management.ts`. Keyed by `DeviceRole` string (role strings cross
13493
+ * the wire as plain strings everywhere else — cf. `DeviceInfoSchema.role`). */
13494
+ var RoleDisplayDefaultSchema = object({
13495
+ unit: string().min(1).optional(),
13496
+ precision: number().int().min(0).max(10).optional(),
13497
+ icon: string().min(1).optional()
13498
+ });
12511
13499
  /**
12512
13500
  * Serializable projection of a live IDevice.
12513
13501
  * Returned by listAll, getDevice, getChildren.
@@ -12563,7 +13551,9 @@ var DeviceInfoSchema = object({
12563
13551
  * `DeviceMeta.childLayout`. Absent ⇒ no layout declared. */
12564
13552
  childLayout: array(ChildLayoutEntrySchema).readonly().optional(),
12565
13553
  /** Operator-authored cross-device field wirings. See `DeviceMeta.deviceLinks`. */
12566
- deviceLinks: array(DeviceLinkSchema).readonly().optional()
13554
+ deviceLinks: array(DeviceLinkSchema).readonly().optional(),
13555
+ /** Operator-authored per-device display override. See `DeviceMeta.display`. */
13556
+ display: DeviceDisplayOverrideSchema.optional()
12567
13557
  });
12568
13558
  var ConfigEntrySchema = object({
12569
13559
  key: string(),
@@ -12628,7 +13618,9 @@ var DeviceMetaSchema = object({
12628
13618
  deviceLinks: array(DeviceLinkSchema).readonly().optional(),
12629
13619
  /** Semantic role string (`DeviceRole`) — propagated from the spawn pre-seed.
12630
13620
  * Optional: only present for accessory children that carry a known role. */
12631
- role: string().nullable().optional()
13621
+ role: string().nullable().optional(),
13622
+ /** Operator-authored per-device display override. See `DeviceMeta.display`. */
13623
+ display: DeviceDisplayOverrideSchema.optional()
12632
13624
  });
12633
13625
  /** ConfigUISchema passed through as unknown — mirrors device-provider's CreationSchemaOutputSchema */
12634
13626
  var ConfigUISchemaOutput = unknown().nullable();
@@ -12722,7 +13714,19 @@ method(object({
12722
13714
  }), _void(), {
12723
13715
  kind: "mutation",
12724
13716
  auth: "admin"
12725
- }), method(object({ deviceId: number() }), object({ caps: array(object({
13717
+ }), method(object({
13718
+ deviceId: number(),
13719
+ display: DeviceDisplayOverrideSchema.nullable()
13720
+ }), _void(), {
13721
+ kind: "mutation",
13722
+ auth: "admin"
13723
+ }), method(object({}), object({ defaults: record(string(), RoleDisplayDefaultSchema) }), { kind: "query" }), method(object({ defaults: record(string(), RoleDisplayDefaultSchema) }), _void(), {
13724
+ kind: "mutation",
13725
+ auth: "admin"
13726
+ }), method(object({
13727
+ deviceId: number(),
13728
+ includeSynthesizable: boolean().optional()
13729
+ }), object({ caps: array(object({
12726
13730
  cap: string(),
12727
13731
  fields: array(object({
12728
13732
  path: string(),
@@ -12732,8 +13736,13 @@ method(object({
12732
13736
  "boolean",
12733
13737
  "enum"
12734
13738
  ]),
12735
- enumValues: array(string()).optional()
12736
- })).readonly()
13739
+ enumValues: array(string()).optional(),
13740
+ item: boolean().optional()
13741
+ })).readonly(),
13742
+ itemArray: object({
13743
+ path: string(),
13744
+ keyField: string()
13745
+ }).optional()
12737
13746
  })).readonly() }), { kind: "query" }), method(object({
12738
13747
  deviceId: number(),
12739
13748
  role: string().nullable()
@@ -12803,7 +13812,11 @@ method(object({
12803
13812
  deviceId: number(),
12804
13813
  entries: array(object({
12805
13814
  capName: string(),
12806
- kind: _enum(["native", "wrapped"]),
13815
+ kind: _enum([
13816
+ "native",
13817
+ "wrapped",
13818
+ "linked"
13819
+ ]),
12807
13820
  providerAddonId: string(),
12808
13821
  providerNodeId: string(),
12809
13822
  nativeAddonId: string()
@@ -12812,7 +13825,11 @@ method(object({
12812
13825
  deviceId: number(),
12813
13826
  entries: array(object({
12814
13827
  capName: string(),
12815
- kind: _enum(["native", "wrapped"]),
13828
+ kind: _enum([
13829
+ "native",
13830
+ "wrapped",
13831
+ "linked"
13832
+ ]),
12816
13833
  providerAddonId: string(),
12817
13834
  providerNodeId: string(),
12818
13835
  nativeAddonId: string()
@@ -13302,7 +14319,7 @@ var AddBrokerInputSchema = object({
13302
14319
  });
13303
14320
  var AddBrokerResultSchema = object({ id: string() });
13304
14321
  var IdInputSchema = object({ id: string() });
13305
- var TestResultSchema = discriminatedUnion("ok", [object({
14322
+ var TestResultSchema$1 = discriminatedUnion("ok", [object({
13306
14323
  ok: literal(true),
13307
14324
  latencyMs: number()
13308
14325
  }), object({
@@ -13325,7 +14342,7 @@ var StatusSchema = object({
13325
14342
  brokerCount: number(),
13326
14343
  embeddedRunning: boolean()
13327
14344
  });
13328
- 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);
14345
+ 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);
13329
14346
  var NetworkEndpointSchema = object({
13330
14347
  url: string(),
13331
14348
  hostname: string(),
@@ -13359,23 +14376,198 @@ var NetworkEndpointEntrySchema = NetworkEndpointSchema.extend({
13359
14376
  sourcePort: number().optional()
13360
14377
  });
13361
14378
  method(_void(), NetworkEndpointSchema, { kind: "mutation" }), method(_void(), _void(), { kind: "mutation" }), method(_void(), NetworkEndpointSchema.nullable()), method(_void(), NetworkAccessStatusSchema), method(_void(), array(NetworkEndpointEntrySchema).readonly());
13362
- method(object({
13363
- title: string(),
14379
+ /**
14380
+ * notification-output — canonical, capability-gated notification delivery.
14381
+ *
14382
+ * Apprise-derived model (see
14383
+ * `docs/superpowers/specs/2026-07-03-notification-output-notifier-matrix.md`):
14384
+ * callers emit ONE canonical `Notification`; each provider declares a
14385
+ * per-kind capability descriptor (`TargetKind`), and the pure degrade
14386
+ * engine (`@camstack/types` `prepareNotification`) transcodes / degrades the
14387
+ * message to what the kind supports — callers never special-case a service.
14388
+ *
14389
+ * DESIGN DECISIONS (locked):
14390
+ * - Target CRUD lives on THIS cap (`upsertTarget` / `deleteTarget` /
14391
+ * `setTargetEnabled`), each provider persisting via the `settings-store`
14392
+ * cap. Rationale: the admin UI needs one uniform surface across the
14393
+ * notifiers addon AND the HA addon; the addon-`globalSettingsSchema`-array
14394
+ * alternative would fork the UI per addon and cannot host the
14395
+ * discovery→adopt flow.
14396
+ * - `listTargetKinds` / `listTargets` / `discoverTargets` return arrays →
14397
+ * the generated cap-mount auto-`concatCollection`-fans them across every
14398
+ * registered provider (notifiers addon + HA addon) so one catalog is
14399
+ * routable. `send` / `testTarget` / CRUD route to ONE provider by the
14400
+ * `addonId` the generated collection router extracts from the call input.
14401
+ * - `Attachment.bytes` is `Uint8Array`. Transport-safe: superjson (the tRPC
14402
+ * transformer) + UDS MsgPack both round-trip typed arrays — already used by
14403
+ * `storage` / `storage-provider` / `recording` caps over the same path. No
14404
+ * base64 fallback needed.
14405
+ *
14406
+ * TODO (deferred, closed-set change — separate decision): add
14407
+ * `providerKind: 'notify'` so notification providers surface on the unified
14408
+ * admin "Integrations" page.
14409
+ */
14410
+ /**
14411
+ * Zentik-derived typed-media enum — the superset across every kind. Each
14412
+ * adapter picks what it supports and the degrade engine filters the rest.
14413
+ */
14414
+ var AttachmentMediaTypeSchema = _enum([
14415
+ "image",
14416
+ "video",
14417
+ "gif",
14418
+ "audio",
14419
+ "icon"
14420
+ ]);
14421
+ /**
14422
+ * A single attachment. Exactly one of `url` (remote source, most adapters
14423
+ * prefer this) or `bytes` (inline source; required for Pushover-style
14424
+ * bytes-only kinds) MUST be present — the degrade engine expresses a
14425
+ * url→bytes fetch as a `needsFetch` directive the adapter executes.
14426
+ */
14427
+ var AttachmentSchema = object({
14428
+ mediaType: AttachmentMediaTypeSchema,
14429
+ url: string().optional(),
14430
+ bytes: _instanceof(Uint8Array).optional(),
14431
+ mime: string().optional(),
14432
+ name: string().optional()
14433
+ }).refine((a) => a.url !== void 0 || a.bytes !== void 0, { message: "Attachment requires either `url` or `bytes`" });
14434
+ var NotificationFormatSchema = _enum([
14435
+ "text",
14436
+ "markdown",
14437
+ "html"
14438
+ ]);
14439
+ /** A single tap-through action button. */
14440
+ var NotificationActionSchema = object({
14441
+ id: string(),
14442
+ label: string(),
14443
+ url: string().optional()
14444
+ });
14445
+ /**
14446
+ * The canonical notification. `body` is the only hard field (Apprise model).
14447
+ * `priority` is a 5-level ORDINAL (1=lowest … 3=normal(default) … 5=urgent),
14448
+ * NOT a fixed severity enum — each kind declares its own `caps.levels` and
14449
+ * the adapter maps this ordinal onto its native level. `level?` is an
14450
+ * optional kind-native level id (`emergency`, `silent`, …) that overrides
14451
+ * `priority` for that one target.
14452
+ */
14453
+ var NotificationSchema = object({
13364
14454
  body: string(),
13365
- imageUrl: string().optional(),
14455
+ title: string().optional(),
14456
+ format: NotificationFormatSchema.default("text"),
14457
+ priority: number().int().min(1).max(5).default(3),
14458
+ level: string().optional(),
14459
+ attachments: array(AttachmentSchema).optional(),
14460
+ clickUrl: string().optional(),
14461
+ actions: array(NotificationActionSchema).optional(),
14462
+ sound: string().optional(),
14463
+ ttl: number().optional(),
14464
+ tag: string().optional(),
13366
14465
  deviceId: number().optional(),
13367
14466
  eventId: string().optional(),
13368
- priority: _enum([
13369
- "low",
13370
- "normal",
13371
- "high",
13372
- "critical"
13373
- ]).default("normal"),
13374
14467
  metadata: record(string(), unknown()).optional()
13375
- }), _void(), { kind: "mutation" }), method(_void(), object({
14468
+ });
14469
+ /** One declared native severity/priority level for a kind. */
14470
+ var TargetKindLevelSchema = object({
14471
+ id: string(),
14472
+ label: string(),
14473
+ /** Which canonical priority (1..5) this level maps to. `null` = qualitative-only. */
14474
+ ordinal: number().int().min(1).max(5).nullable(),
14475
+ flags: object({
14476
+ critical: boolean().optional(),
14477
+ silent: boolean().optional(),
14478
+ noPush: boolean().optional()
14479
+ }).optional(),
14480
+ /** e.g. Pushover `emergency` requires `retry` / `expire`. */
14481
+ requires: array(string()).optional(),
14482
+ description: string().optional()
14483
+ });
14484
+ /** The full capability block consulted before dispatch. */
14485
+ var TargetKindCapsSchema = object({
14486
+ attachments: object({
14487
+ mediaTypes: array(AttachmentMediaTypeSchema),
14488
+ mode: _enum([
14489
+ "url",
14490
+ "bytes",
14491
+ "both"
14492
+ ]),
14493
+ max: number().int().nonnegative(),
14494
+ maxBytes: number().int().positive().optional()
14495
+ }),
14496
+ /** Max action buttons (0 = none). */
14497
+ actions: number().int().nonnegative(),
14498
+ levels: array(TargetKindLevelSchema),
14499
+ format: array(NotificationFormatSchema),
14500
+ clickUrl: boolean(),
14501
+ sound: boolean(),
14502
+ ttl: boolean(),
14503
+ bodyMaxLen: number().int().positive()
14504
+ });
14505
+ /**
14506
+ * `configSchema` is a `ConfigUISchema` tree passed through to the admin
14507
+ * FormBuilder. Stored as `z.unknown()` at the cap seam (mirrors
14508
+ * `device-provider.getChildCreationSchema` `CreationSchemaOutputSchema`) —
14509
+ * the union is large and not meant for runtime validation here; the exported
14510
+ * `TargetKind` type re-tightens `configSchema` to `ConfigUISchema`.
14511
+ */
14512
+ var ConfigSchemaPassthrough = unknown();
14513
+ var TargetKindSchema = object({
14514
+ kind: string(),
14515
+ label: string(),
14516
+ icon: string(),
14517
+ /** Stamped by each provider so the concat-fanned catalog stays routable. */
14518
+ addonId: string(),
14519
+ configSchema: ConfigSchemaPassthrough,
14520
+ supportsDiscovery: boolean(),
14521
+ caps: TargetKindCapsSchema
14522
+ });
14523
+ /**
14524
+ * A persisted target. `config` holds secrets; providers REDACT secret fields
14525
+ * (return a presence marker only) when serving `listTargets` — never
14526
+ * round-trip a stored secret to the UI.
14527
+ */
14528
+ var TargetSchema = object({
14529
+ id: string(),
14530
+ name: string(),
14531
+ kind: string(),
14532
+ addonId: string(),
14533
+ enabled: boolean(),
14534
+ config: record(string(), unknown())
14535
+ });
14536
+ /** A discovery-surfaced candidate (config is partial + non-secret). */
14537
+ var DiscoveredTargetSchema = object({
14538
+ kind: string(),
14539
+ suggestedName: string(),
14540
+ config: record(string(), unknown())
14541
+ });
14542
+ /** The degrade engine's report — what was resolved / dropped / degraded. */
14543
+ var RenderedAsSchema = object({
14544
+ level: string(),
14545
+ format: NotificationFormatSchema,
14546
+ attachmentsSent: number().int().nonnegative(),
14547
+ actionsSent: number().int().nonnegative(),
14548
+ truncated: boolean(),
14549
+ dropped: array(string())
14550
+ });
14551
+ var SendResultSchema = object({
13376
14552
  success: boolean(),
13377
- error: string().optional()
13378
- }), { kind: "mutation" });
14553
+ error: string().optional(),
14554
+ renderedAs: RenderedAsSchema.optional()
14555
+ });
14556
+ /** Same shape as SendResult — kept as a distinct name for the test panel. */
14557
+ var TestResultSchema = SendResultSchema;
14558
+ method(object({}), array(TargetKindSchema)), method(object({}), array(TargetSchema)), method(object({
14559
+ kind: string(),
14560
+ config: record(string(), unknown()).optional()
14561
+ }), array(DiscoveredTargetSchema)), method(object({
14562
+ targetId: string(),
14563
+ notification: NotificationSchema
14564
+ }), SendResultSchema, { kind: "mutation" }), method(object({
14565
+ targetId: string(),
14566
+ sample: NotificationSchema.optional()
14567
+ }), TestResultSchema, { kind: "mutation" }), method(object({ target: TargetSchema }), TargetSchema, { kind: "mutation" }), method(object({ targetId: string() }), _void(), { kind: "mutation" }), method(object({
14568
+ targetId: string(),
14569
+ enabled: boolean()
14570
+ }), _void(), { kind: "mutation" });
13379
14571
  /**
13380
14572
  * Zod schemas for persisted record types.
13381
14573
  *
@@ -16397,7 +17589,10 @@ var HwAccelBackendInputSchema = _enum([
16397
17589
  "webgpu",
16398
17590
  "none"
16399
17591
  ]).nullable().optional();
16400
- var HwAccelResolutionSchema = object({ preferred: array(string()).readonly() });
17592
+ var HwAccelResolutionSchema = object({
17593
+ preferred: array(string()).readonly(),
17594
+ rationale: string()
17595
+ });
16401
17596
  var HardwareEncoderIdSchema = _enum([
16402
17597
  "h264_videotoolbox",
16403
17598
  "hevc_videotoolbox",
@@ -16502,10 +17697,7 @@ var ResolvedInferenceConfigSchema = object({
16502
17697
  format: ModelFormatSchema,
16503
17698
  reason: string()
16504
17699
  });
16505
- method(_void(), PlatformCapabilitiesSchema), method(_void(), HardwareInfoSchema), method(object({ requirements: array(ModelRequirementSchema).readonly() }), ResolvedInferenceConfigSchema), method(object({
16506
- prefer: HwAccelBackendInputSchema,
16507
- nodeId: string().optional()
16508
- }), HwAccelResolutionSchema), method(_void(), HardwareEncodersSchema), method(_void(), HardwareEncodersSchema, {
17700
+ method(_void(), PlatformCapabilitiesSchema), method(_void(), HardwareInfoSchema), method(object({ requirements: array(ModelRequirementSchema).readonly() }), ResolvedInferenceConfigSchema), method(object({ prefer: HwAccelBackendInputSchema }), HwAccelResolutionSchema), method(_void(), HardwareEncodersSchema), method(_void(), HardwareEncodersSchema, {
16509
17701
  kind: "mutation",
16510
17702
  auth: "admin"
16511
17703
  }), method(_void(), HardwareDecodeAccelsSchema), method(_void(), HardwareDecodeAccelsSchema, {
@@ -16564,6 +17756,16 @@ DeviceType.Camera, DeviceType.Sensor, DeviceType.Switch, method(object({ deviceI
16564
17756
  kind: "mutation",
16565
17757
  auth: "admin"
16566
17758
  });
17759
+ /**
17760
+ * `recording` cap — footage availability + HLS playback manifests + per-device
17761
+ * recording config. NOTE on events (source of truth, R5/C3): this cap carries
17762
+ * NO event surface — `getPlaybackManifest` returns playlist URLs only. Timeline
17763
+ * events (motion/object/audio) come from `pipelineAnalytics` (durable SQLite
17764
+ * rows); the recorder's internal EventMap markers are ephemeral in-RAM
17765
+ * annotations that are not exposed here and must not be treated as an event
17766
+ * feed. Event<->footage joins are by time, padded with the shared `EVENT_PAD_MS`
17767
+ * (`interfaces/recording-config.ts`).
17768
+ */
16567
17769
  var RecordingStatusSchema = object({
16568
17770
  deviceId: number(),
16569
17771
  enabled: boolean(),
@@ -18200,6 +19402,12 @@ Object.freeze({
18200
19402
  addonId: null,
18201
19403
  access: "view"
18202
19404
  },
19405
+ "deviceManager.getRoleDisplayDefaults": {
19406
+ capName: "device-manager",
19407
+ capScope: "system",
19408
+ addonId: null,
19409
+ access: "view"
19410
+ },
18203
19411
  "deviceManager.getSettingsSchema": {
18204
19412
  capName: "device-manager",
18205
19413
  capScope: "system",
@@ -18350,6 +19558,12 @@ Object.freeze({
18350
19558
  addonId: null,
18351
19559
  access: "create"
18352
19560
  },
19561
+ "deviceManager.setDisplay": {
19562
+ capName: "device-manager",
19563
+ capScope: "system",
19564
+ addonId: null,
19565
+ access: "create"
19566
+ },
18353
19567
  "deviceManager.setIntegrationId": {
18354
19568
  capName: "device-manager",
18355
19569
  capScope: "system",
@@ -18392,6 +19606,12 @@ Object.freeze({
18392
19606
  addonId: null,
18393
19607
  access: "create"
18394
19608
  },
19609
+ "deviceManager.setRoleDisplayDefaults": {
19610
+ capName: "device-manager",
19611
+ capScope: "system",
19612
+ addonId: null,
19613
+ access: "create"
19614
+ },
18395
19615
  "deviceManager.setStreamProfileMap": {
18396
19616
  capName: "device-manager",
18397
19617
  capScope: "system",
@@ -19370,13 +20590,49 @@ Object.freeze({
19370
20590
  addonId: null,
19371
20591
  access: "create"
19372
20592
  },
20593
+ "notificationOutput.deleteTarget": {
20594
+ capName: "notification-output",
20595
+ capScope: "system",
20596
+ addonId: null,
20597
+ access: "delete"
20598
+ },
20599
+ "notificationOutput.discoverTargets": {
20600
+ capName: "notification-output",
20601
+ capScope: "system",
20602
+ addonId: null,
20603
+ access: "view"
20604
+ },
20605
+ "notificationOutput.listTargetKinds": {
20606
+ capName: "notification-output",
20607
+ capScope: "system",
20608
+ addonId: null,
20609
+ access: "view"
20610
+ },
20611
+ "notificationOutput.listTargets": {
20612
+ capName: "notification-output",
20613
+ capScope: "system",
20614
+ addonId: null,
20615
+ access: "view"
20616
+ },
19373
20617
  "notificationOutput.send": {
19374
20618
  capName: "notification-output",
19375
20619
  capScope: "system",
19376
20620
  addonId: null,
19377
20621
  access: "create"
19378
20622
  },
19379
- "notificationOutput.sendTest": {
20623
+ "notificationOutput.setTargetEnabled": {
20624
+ capName: "notification-output",
20625
+ capScope: "system",
20626
+ addonId: null,
20627
+ access: "create"
20628
+ },
20629
+ "notificationOutput.testTarget": {
20630
+ capName: "notification-output",
20631
+ capScope: "system",
20632
+ addonId: null,
20633
+ access: "create"
20634
+ },
20635
+ "notificationOutput.upsertTarget": {
19380
20636
  capName: "notification-output",
19381
20637
  capScope: "system",
19382
20638
  addonId: null,
@@ -19406,6 +20662,66 @@ Object.freeze({
19406
20662
  addonId: null,
19407
20663
  access: "create"
19408
20664
  },
20665
+ "petFeeder.callPet": {
20666
+ capName: "pet-feeder",
20667
+ capScope: "device",
20668
+ addonId: null,
20669
+ access: "create"
20670
+ },
20671
+ "petFeeder.cancelFeed": {
20672
+ capName: "pet-feeder",
20673
+ capScope: "device",
20674
+ addonId: null,
20675
+ access: "create"
20676
+ },
20677
+ "petFeeder.feed": {
20678
+ capName: "pet-feeder",
20679
+ capScope: "device",
20680
+ addonId: null,
20681
+ access: "create"
20682
+ },
20683
+ "petFeeder.markFoodReplenished": {
20684
+ capName: "pet-feeder",
20685
+ capScope: "device",
20686
+ addonId: null,
20687
+ access: "create"
20688
+ },
20689
+ "petFeeder.playSound": {
20690
+ capName: "pet-feeder",
20691
+ capScope: "device",
20692
+ addonId: null,
20693
+ access: "create"
20694
+ },
20695
+ "petFeeder.resetDesiccant": {
20696
+ capName: "pet-feeder",
20697
+ capScope: "device",
20698
+ addonId: null,
20699
+ access: "delete"
20700
+ },
20701
+ "petFeeder.setChildLock": {
20702
+ capName: "pet-feeder",
20703
+ capScope: "device",
20704
+ addonId: null,
20705
+ access: "create"
20706
+ },
20707
+ "petFeeder.setFeedSound": {
20708
+ capName: "pet-feeder",
20709
+ capScope: "device",
20710
+ addonId: null,
20711
+ access: "create"
20712
+ },
20713
+ "petFeeder.setIndicatorLight": {
20714
+ capName: "pet-feeder",
20715
+ capScope: "device",
20716
+ addonId: null,
20717
+ access: "create"
20718
+ },
20719
+ "petFeeder.setVolume": {
20720
+ capName: "pet-feeder",
20721
+ capScope: "device",
20722
+ addonId: null,
20723
+ access: "create"
20724
+ },
19409
20725
  "pipelineAnalytics.clearTracks": {
19410
20726
  capName: "pipeline-analytics",
19411
20727
  capScope: "device",