@camstack/addon-remote-storage 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.
@@ -4629,7 +4629,7 @@ function _instanceof(cls, params = {}) {
4629
4629
  return inst;
4630
4630
  }
4631
4631
  //#endregion
4632
- //#region ../types/dist/sleep-C2M2zF7x.mjs
4632
+ //#region ../types/dist/sleep-BiDFW0E7.mjs
4633
4633
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
4634
4634
  EventCategory["SystemBoot"] = "system.boot";
4635
4635
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -5442,6 +5442,100 @@ function createDurableState(deps) {
5442
5442
  };
5443
5443
  }
5444
5444
  /**
5445
+ * Per-node scoping for the shared addon-settings blob.
5446
+ *
5447
+ * An addon's settings store is hub-central (the `addon-settings` cap is
5448
+ * hub-routed — the hub instance answers for every node), so fields whose
5449
+ * value is a NODE fact (decoder backend, engine pick, probed hardware
5450
+ * capabilities) persist under the node-scoped key `<key>@<nodeId>` inside
5451
+ * the single shared blob. The SCHEMA field key stays bare: the write path
5452
+ * ({@link scopePatch}) maps the bare field onto the target node's scoped
5453
+ * key; the read/hydrate path ({@link projectStore}) maps THIS node's value
5454
+ * back, so UI forms and `resolveConfig` only ever see the bare key.
5455
+ *
5456
+ * Fields opt in via the `perNode: true` schema marker on `ConfigFieldBase`
5457
+ * (`interfaces/config-ui.ts`); `BaseAddon` derives the key set from the
5458
+ * schema and routes reads/writes through these helpers.
5459
+ *
5460
+ * ## No bare-key fallback — deliberate
5461
+ *
5462
+ * {@link readNodeValue} reads the node-scoped key ONLY. A node with no
5463
+ * scoped key resolves to `undefined` so the field's schema `default` wins —
5464
+ * NEVER `store[base]` and never another node's value. A bare legacy key in
5465
+ * the store is invisible to every node, hub included, so one node's
5466
+ * selection can never leak onto another. (This generalizes the
5467
+ * `decoder-backend-keys.ts` semantics — the no-fallback variant — over an
5468
+ * arbitrary set of per-node field keys.)
5469
+ *
5470
+ * Pure functions only — no I/O, no imports beyond the language. This is a
5471
+ * LEAF module: import it via its deep path, never from the root barrel.
5472
+ */
5473
+ /**
5474
+ * Normalize a raw kernel node id to the bare node id used for scoping.
5475
+ * `localNodeId` can carry a `<node>/<addon>` suffix on forked child
5476
+ * processes; per-node settings are per-NODE, so strip the addon segment.
5477
+ * `undefined` / `null` / empty falls back to `'hub'`.
5478
+ */
5479
+ function normalizeNodeId(raw) {
5480
+ if (raw === void 0 || raw === null || raw === "") return "hub";
5481
+ const slashIdx = raw.indexOf("/");
5482
+ if (slashIdx < 0) return raw;
5483
+ const bare = raw.slice(0, slashIdx);
5484
+ return bare === "" ? "hub" : bare;
5485
+ }
5486
+ /** The node-scoped store key for a per-node field: `<base>@<nodeId>`. */
5487
+ function nodeScopedKey(base, nodeId) {
5488
+ return `${base}@${normalizeNodeId(nodeId)}`;
5489
+ }
5490
+ /**
5491
+ * Read a node's value for a per-node field from the raw shared store:
5492
+ * the node-scoped key when present, otherwise `undefined`.
5493
+ * Deliberately NO bare-key fallback (see module doc) — the caller lets the
5494
+ * schema `default` win on `undefined`.
5495
+ */
5496
+ function readNodeValue(store, base, nodeId) {
5497
+ return store[nodeScopedKey(base, nodeId)];
5498
+ }
5499
+ /**
5500
+ * Re-map a UI/settings patch so every bare perNode field persists under the
5501
+ * TARGET node's scoped key; all other keys pass through unchanged. Used on
5502
+ * the write path so a save for one node never clobbers another node's value
5503
+ * (and the bare key is never written). Returns a new object — the input
5504
+ * patch is not mutated.
5505
+ */
5506
+ function scopePatch(patch, perNodeKeys, nodeId) {
5507
+ const out = {};
5508
+ for (const [key, value] of Object.entries(patch)) out[perNodeKeys.has(key) ? nodeScopedKey(key, nodeId) : key] = value;
5509
+ return out;
5510
+ }
5511
+ /**
5512
+ * Project the raw shared store onto the bare schema keys for ONE node so a
5513
+ * UI schema (whose field keys are bare) hydrates from that node's own
5514
+ * values:
5515
+ *
5516
+ * - EVERY `@`-scoped key (any node's) is dropped from the pass-through.
5517
+ * - Every bare perNode key is dropped from the pass-through (a stray bare
5518
+ * legacy key must never hydrate any node — no bare fallback).
5519
+ * - THIS node's effective value ({@link readNodeValue}) is then laid onto
5520
+ * each bare perNode key; when the node has no scoped key the bare key is
5521
+ * left ABSENT so the field's schema `default` wins.
5522
+ *
5523
+ * Returns a new object — the input store is not mutated.
5524
+ */
5525
+ function projectStore(store, perNodeKeys, nodeId) {
5526
+ const out = {};
5527
+ for (const [key, value] of Object.entries(store)) {
5528
+ if (key.includes("@")) continue;
5529
+ if (perNodeKeys.has(key)) continue;
5530
+ out[key] = value;
5531
+ }
5532
+ for (const base of perNodeKeys) {
5533
+ const value = readNodeValue(store, base, nodeId);
5534
+ if (value !== void 0) out[base] = value;
5535
+ }
5536
+ return out;
5537
+ }
5538
+ /**
5445
5539
  * Base class for CamStack addons. Eliminates settings boilerplate:
5446
5540
  *
5447
5541
  * - Typed `config` property with automatic resolution from store + defaults
@@ -5609,23 +5703,63 @@ var BaseAddon = class {
5609
5703
  deviceSettingsSchema() {
5610
5704
  return null;
5611
5705
  }
5612
- async getGlobalSettings(overlay, cap, _nodeId) {
5706
+ async getGlobalSettings(overlay, cap, nodeId) {
5613
5707
  const schema = this.globalSettingsSchema(cap);
5614
5708
  if (!schema) return { sections: [] };
5615
- const raw = await this._ctx?.settings?.readAddonStore() ?? {};
5709
+ const projected = await this.resolveGlobalStore(nodeId, cap);
5616
5710
  return hydrateSchema(schema, overlay ? {
5617
- ...raw,
5711
+ ...projected,
5618
5712
  ...overlay
5619
- } : raw);
5713
+ } : projected);
5714
+ }
5715
+ /**
5716
+ * The raw addon store PROJECTED onto the target node's bare per-node keys:
5717
+ * every `perNode: true` field carries THAT node's scoped value on its bare
5718
+ * key (absent scoped key ⇒ key absent, so the schema `default` wins — no
5719
+ * bare fallback), all `@`-scoped and stray bare per-node keys are dropped.
5720
+ * A no-op passthrough when the schema declares no `perNode` field.
5721
+ *
5722
+ * This is the sanctioned way for a `getGlobalSettings` OVERRIDE that needs
5723
+ * the store for custom option logic (option narrowing, value snapping) to
5724
+ * read it per-node — never `ctx.settings.readAddonStore()` directly.
5725
+ * `nodeId` omitted ⇒ the local node (node-blind injection from ctx).
5726
+ */
5727
+ async resolveGlobalStore(nodeId, cap) {
5728
+ const raw = await this._ctx?.settings?.readAddonStore() ?? {};
5729
+ const keys = this.perNodeKeys(cap);
5730
+ const node = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
5731
+ return keys.size > 0 ? projectStore(raw, keys, node) : raw;
5620
5732
  }
5621
- async updateGlobalSettings(patch, _nodeId) {
5622
- await this._ctx?.settings?.writeAddonStore(patch);
5733
+ async updateGlobalSettings(patch, nodeId) {
5734
+ const keys = this.perNodeKeys();
5735
+ const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
5736
+ const target = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
5737
+ const barePatch = patch;
5738
+ const scoped = keys.size > 0 ? scopePatch(barePatch, keys, target) : barePatch;
5739
+ await this._ctx?.settings?.writeAddonStore(scoped);
5740
+ if (target !== localNode) return;
5623
5741
  await this.resolveConfig();
5624
5742
  await this.onConfigChanged();
5625
5743
  this.emitLifecycle(EventCategory.AddonUpdated, { level: "global" });
5626
5744
  this.maybeAutoRestart(patch, this.globalSettingsSchema());
5627
5745
  }
5628
5746
  /**
5747
+ * The set of field keys the global settings schema declares `perNode: true`
5748
+ * — derived once per `cap` argument and memoized (schemas are static
5749
+ * declarations). Empty set ⇒ every per-node code path is bypassed and the
5750
+ * settings API behaves exactly like the legacy node-agnostic one.
5751
+ */
5752
+ _perNodeKeysCache = /* @__PURE__ */ new Map();
5753
+ perNodeKeys(cap) {
5754
+ const cacheKey = cap ?? "";
5755
+ const cached = this._perNodeKeysCache.get(cacheKey);
5756
+ if (cached) return cached;
5757
+ const schema = this.globalSettingsSchema(cap);
5758
+ const keys = new Set(schema ? schema.sections.flatMap((section) => collectPerNodeFieldKeys(section.fields)) : []);
5759
+ this._perNodeKeysCache.set(cacheKey, keys);
5760
+ return keys;
5761
+ }
5762
+ /**
5629
5763
  * If any field in `patch` is marked `requiresRestart` in `schema`,
5630
5764
  * schedule an addon restart for the next tick. Deferred via
5631
5765
  * `setImmediate` so the tRPC mutation that triggered the write has
@@ -5778,12 +5912,19 @@ var BaseAddon = class {
5778
5912
  * The merge is shallow: each key in `defaults` is checked against the store.
5779
5913
  * Only keys present in defaults are read — the store can contain extra keys
5780
5914
  * (e.g. from older versions) without polluting the typed config.
5915
+ *
5916
+ * Keys the global settings schema declares `perNode: true` resolve from
5917
+ * THIS node's scoped key (`<key>@<localNode>`) via `readNodeValue` — never
5918
+ * from the bare key — so a per-node field resolves to this node's own
5919
+ * selection at boot (absent scoped key ⇒ the constructor default wins).
5781
5920
  */
5782
5921
  async resolveConfig() {
5783
5922
  const stored = await this.readAddonStoreWithRetry();
5923
+ const perNode = this.perNodeKeys();
5924
+ const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
5784
5925
  const resolved = { ...this.defaults };
5785
5926
  for (const key of Object.keys(this.defaults)) {
5786
- const storedValue = stored[key];
5927
+ const storedValue = perNode.has(key) ? readNodeValue(stored, key, localNode) : stored[key];
5787
5928
  if (storedValue !== void 0 && storedValue !== null) {
5788
5929
  const defaultType = typeof this.defaults[key];
5789
5930
  if (typeof storedValue === defaultType) resolved[key] = storedValue;
@@ -5867,6 +6008,27 @@ var BaseAddon = class {
5867
6008
  }
5868
6009
  };
5869
6010
  /**
6011
+ * Collect the keys of every field marked `perNode: true`, recursing into
6012
+ * layout containers (`group` fields and `sub-tabs` tabs) the same way
6013
+ * `hydrateSchema` does. Valueless structural fields (separator/info/…)
6014
+ * don't declare `perNode` and are excluded by the `in` narrowing.
6015
+ */
6016
+ function collectPerNodeFieldKeys(fields) {
6017
+ const collected = [];
6018
+ for (const field of fields) {
6019
+ if (field.type === "group") {
6020
+ collected.push(...collectPerNodeFieldKeys(field.fields));
6021
+ continue;
6022
+ }
6023
+ if (field.type === "sub-tabs") {
6024
+ for (const tab of field.tabs) collected.push(...collectPerNodeFieldKeys(tab.fields));
6025
+ continue;
6026
+ }
6027
+ if ("perNode" in field && field.perNode === true) collected.push(field.key);
6028
+ }
6029
+ return collected;
6030
+ }
6031
+ /**
5870
6032
  * Normalize an `ICamstackAddon.initialize()` return value into the
5871
6033
  * `AddonInitResult` envelope. Arrays are wrapped into `{ providers }`;
5872
6034
  * envelopes pass through; void stays void.
@@ -5891,6 +6053,7 @@ var CamStreamKindSchema = _enum([
5891
6053
  "pull-rtsp",
5892
6054
  "pull-rtmp",
5893
6055
  "pull-http",
6056
+ "pull-flv",
5894
6057
  "pull-rfc4571",
5895
6058
  "push-annexb",
5896
6059
  "derived"
@@ -6273,6 +6436,13 @@ var DeviceType = /* @__PURE__ */ function(DeviceType) {
6273
6436
  /** Single still-image entity (HA `image.*`). Read-only display of an
6274
6437
  * `entity_picture` signed URL the browser loads directly. `image` cap. */
6275
6438
  DeviceType["Image"] = "image";
6439
+ /** Smart pet feeder — cloud-connected food dispenser with a bowl food
6440
+ * level, battery, desiccant life, feeding state and manual-feed /
6441
+ * call-pet / maintenance actions. Installed with the `pet-feeder` cap;
6442
+ * dual-hopper models (D4S/D4SH) expose per-hopper portions. Sources:
6443
+ * native PetKit (`nodepetkit` `FeederDevice`), reusable by other feeder
6444
+ * integrations sharing the same food/desiccant/hopper surface. */
6445
+ DeviceType["PetFeeder"] = "pet-feeder";
6276
6446
  return DeviceType;
6277
6447
  }({});
6278
6448
  var DeviceFeature = /* @__PURE__ */ function(DeviceFeature) {
@@ -7421,6 +7591,601 @@ var _macroLookup = /* @__PURE__ */ new Map();
7421
7591
  for (const [k, v] of Object.entries(YAMNET_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
7422
7592
  for (const [k, v] of Object.entries(APPLE_SA_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
7423
7593
  /**
7594
+ * Error types for the safe expression engine. Two distinct classes so callers
7595
+ * can tell a compile-time (grammar) failure from a runtime (evaluation)
7596
+ * failure — both are non-fatal to the host: read paths degrade to "skip link".
7597
+ */
7598
+ /** Thrown by the tokenizer / parser. Carries a 0-based source `position` when
7599
+ * the failure is anchored to a character (author-facing inline feedback). */
7600
+ var ExpressionParseError = class extends Error {
7601
+ position;
7602
+ constructor(message, position) {
7603
+ super(message);
7604
+ this.name = "ExpressionParseError";
7605
+ this.position = position;
7606
+ }
7607
+ };
7608
+ /** Thrown by the evaluator (unknown identifier, type mismatch, non-finite
7609
+ * result, unknown builtin, step-budget exceeded). */
7610
+ var ExpressionEvalError = class extends Error {
7611
+ constructor(message) {
7612
+ super(message);
7613
+ this.name = "ExpressionEvalError";
7614
+ }
7615
+ };
7616
+ /**
7617
+ * Resource-bound constants for the safe expression engine.
7618
+ *
7619
+ * Every bound is defense-in-depth: the grammar is non-Turing-complete (no
7620
+ * loops, recursion, lambdas or member access — see `ast.ts`), so evaluation is
7621
+ * O(nodeCount) by construction. These caps merely put a hard ceiling on the
7622
+ * work a single author-supplied expression can request, so a hostile or
7623
+ * accidental pathological string can never spend unbounded CPU/memory.
7624
+ */
7625
+ /** Max source length (chars) — checked BEFORE tokenizing so a huge string is
7626
+ * rejected without allocation. */
7627
+ var MAX_EXPRESSION_SOURCE_LENGTH = 2048;
7628
+ /** A legal binding / identifier name. */
7629
+ var EXPRESSION_IDENTIFIER_RE = /^[A-Za-z_][A-Za-z0-9_]*$/;
7630
+ /** Binding names an author may NOT use: `now` is auto-injected; the literal
7631
+ * keywords lex as values, not identifiers, so binding to them is meaningless. */
7632
+ var RESERVED_BINDING_NAMES = new Set([
7633
+ "now",
7634
+ "true",
7635
+ "false",
7636
+ "null"
7637
+ ]);
7638
+ /**
7639
+ * Tokenizer for the safe expression mini-language. Hand-rolled, single-pass,
7640
+ * zero-dependency. The grammar is deliberately boring: decimal numbers,
7641
+ * single/double-quoted strings with a tiny escape set, identifiers, the three
7642
+ * value keywords (`true`/`false`/`null`) and a fixed punctuator set. Anything
7643
+ * outside that — a bare `.`, `=`, `[`, `]`, `{`, `}`, `;`, backtick, `&`, `|` —
7644
+ * is a parse error with a source position, so member access / assignment /
7645
+ * template literals are lexically impossible.
7646
+ */
7647
+ var KEYWORDS = new Set([
7648
+ "true",
7649
+ "false",
7650
+ "null"
7651
+ ]);
7652
+ function isDigit(ch) {
7653
+ return ch >= "0" && ch <= "9";
7654
+ }
7655
+ function isIdentStart(ch) {
7656
+ return ch >= "A" && ch <= "Z" || ch >= "a" && ch <= "z" || ch === "_";
7657
+ }
7658
+ function isIdentPart(ch) {
7659
+ return isIdentStart(ch) || isDigit(ch);
7660
+ }
7661
+ function isWhitespace(ch) {
7662
+ return ch === " " || ch === " " || ch === "\n" || ch === "\r" || ch === "\f" || ch === "\v";
7663
+ }
7664
+ /** Tokenize `source` into a flat token list ending with a single `eof` token.
7665
+ * Throws `ExpressionParseError` on any illegal character or unterminated
7666
+ * string. */
7667
+ function tokenize(source) {
7668
+ if (source.length > 2048) throw new ExpressionParseError(`expression too long (${source.length} > ${MAX_EXPRESSION_SOURCE_LENGTH} chars)`, 0);
7669
+ const tokens = [];
7670
+ let i = 0;
7671
+ const n = source.length;
7672
+ while (i < n) {
7673
+ const ch = source[i];
7674
+ if (isWhitespace(ch)) {
7675
+ i += 1;
7676
+ continue;
7677
+ }
7678
+ if (isDigit(ch)) {
7679
+ const start = i;
7680
+ while (i < n && isDigit(source[i])) i += 1;
7681
+ if (i < n && source[i] === ".") {
7682
+ if (i + 1 >= n || !isDigit(source[i + 1])) throw new ExpressionParseError("malformed number: decimal point needs a digit", i);
7683
+ i += 1;
7684
+ while (i < n && isDigit(source[i])) i += 1;
7685
+ }
7686
+ const text = source.slice(start, i);
7687
+ const value = Number(text);
7688
+ if (!Number.isFinite(value)) throw new ExpressionParseError(`malformed number: '${text}'`, start);
7689
+ tokens.push({
7690
+ type: "number",
7691
+ value,
7692
+ pos: start
7693
+ });
7694
+ continue;
7695
+ }
7696
+ if (ch === "'" || ch === "\"") {
7697
+ const quote = ch;
7698
+ const start = i;
7699
+ i += 1;
7700
+ let out = "";
7701
+ let closed = false;
7702
+ while (i < n) {
7703
+ const c = source[i];
7704
+ if (c === "\\") {
7705
+ const next = i + 1 < n ? source[i + 1] : "";
7706
+ if (next === "\\" || next === "'" || next === "\"") {
7707
+ out += next;
7708
+ i += 2;
7709
+ continue;
7710
+ }
7711
+ throw new ExpressionParseError(`invalid string escape: '\\${next}'`, i);
7712
+ }
7713
+ if (c === quote) {
7714
+ closed = true;
7715
+ i += 1;
7716
+ break;
7717
+ }
7718
+ out += c;
7719
+ i += 1;
7720
+ }
7721
+ if (!closed) throw new ExpressionParseError("unterminated string literal", start);
7722
+ tokens.push({
7723
+ type: "string",
7724
+ value: out,
7725
+ pos: start
7726
+ });
7727
+ continue;
7728
+ }
7729
+ if (isIdentStart(ch)) {
7730
+ const start = i;
7731
+ while (i < n && isIdentPart(source[i])) i += 1;
7732
+ const text = source.slice(start, i);
7733
+ if (KEYWORDS.has(text)) tokens.push({
7734
+ type: "keyword",
7735
+ keyword: keywordOf(text),
7736
+ pos: start
7737
+ });
7738
+ else tokens.push({
7739
+ type: "identifier",
7740
+ name: text,
7741
+ pos: start
7742
+ });
7743
+ continue;
7744
+ }
7745
+ const two = i + 1 < n ? source.slice(i, i + 2) : "";
7746
+ if (two === "<=" || two === ">=" || two === "==" || two === "!=" || two === "&&" || two === "||") {
7747
+ tokens.push({
7748
+ type: "punct",
7749
+ punct: two,
7750
+ pos: i
7751
+ });
7752
+ i += 2;
7753
+ continue;
7754
+ }
7755
+ if (isSinglePunct(ch)) {
7756
+ tokens.push({
7757
+ type: "punct",
7758
+ punct: ch,
7759
+ pos: i
7760
+ });
7761
+ i += 1;
7762
+ continue;
7763
+ }
7764
+ throw new ExpressionParseError(`unexpected character '${ch}'`, i);
7765
+ }
7766
+ tokens.push({
7767
+ type: "eof",
7768
+ pos: n
7769
+ });
7770
+ return tokens;
7771
+ }
7772
+ function keywordOf(text) {
7773
+ if (text === "true") return "true";
7774
+ if (text === "false") return "false";
7775
+ return "null";
7776
+ }
7777
+ function isSinglePunct(ch) {
7778
+ return ch === "(" || ch === ")" || ch === "," || ch === "?" || ch === ":" || ch === "+" || ch === "-" || ch === "*" || ch === "/" || ch === "%" || ch === "!" || ch === "<" || ch === ">";
7779
+ }
7780
+ /**
7781
+ * Frozen, null-prototype builtin function table for the expression engine
7782
+ * (spec §4 rule 4). The table is the SOLE surface of callable functions: the
7783
+ * parser rejects any callee not in it, and the evaluator gates each call on an
7784
+ * own-property check against it.
7785
+ *
7786
+ * Because the object has a NULL prototype AND is `Object.freeze`d:
7787
+ * - it cannot be polluted (no `__proto__` / `constructor` write reaches it);
7788
+ * - a lookup for `toString` / `hasOwnProperty` / `constructor` finds NOTHING
7789
+ * (there is no `Object.prototype` in the chain), so those names are not
7790
+ * callable — they are simply "unknown function" at parse time.
7791
+ *
7792
+ * Every numeric argument is validated as a finite number and every numeric
7793
+ * RESULT is re-checked finite, so `/0`, `sqrt(-1)` (→ NaN) and overflow
7794
+ * (`pow(10,400)` → Infinity) all raise `ExpressionEvalError` and fail the link
7795
+ * closed rather than emitting a garbage value.
7796
+ */
7797
+ function asFiniteNumber(value, name, index) {
7798
+ if (typeof value !== "number" || !Number.isFinite(value)) throw new ExpressionEvalError(`${name}: argument ${index + 1} must be a finite number`);
7799
+ return value;
7800
+ }
7801
+ function asString$1(value, name, index) {
7802
+ if (typeof value !== "string") throw new ExpressionEvalError(`${name}: argument ${index + 1} must be a string`);
7803
+ return value;
7804
+ }
7805
+ function finiteResult(value, name) {
7806
+ if (!Number.isFinite(value)) throw new ExpressionEvalError(`${name}: produced a non-finite result`);
7807
+ return value;
7808
+ }
7809
+ function allFiniteNumbers(args, name) {
7810
+ return args.map((a, idx) => asFiniteNumber(a, name, idx));
7811
+ }
7812
+ var INF = Number.POSITIVE_INFINITY;
7813
+ var table = {
7814
+ min: {
7815
+ minArgs: 1,
7816
+ maxArgs: INF,
7817
+ apply: (args) => finiteResult(Math.min(...allFiniteNumbers(args, "min")), "min")
7818
+ },
7819
+ max: {
7820
+ minArgs: 1,
7821
+ maxArgs: INF,
7822
+ apply: (args) => finiteResult(Math.max(...allFiniteNumbers(args, "max")), "max")
7823
+ },
7824
+ abs: {
7825
+ minArgs: 1,
7826
+ maxArgs: 1,
7827
+ apply: (args) => finiteResult(Math.abs(asFiniteNumber(args[0], "abs", 0)), "abs")
7828
+ },
7829
+ floor: {
7830
+ minArgs: 1,
7831
+ maxArgs: 1,
7832
+ apply: (args) => finiteResult(Math.floor(asFiniteNumber(args[0], "floor", 0)), "floor")
7833
+ },
7834
+ ceil: {
7835
+ minArgs: 1,
7836
+ maxArgs: 1,
7837
+ apply: (args) => finiteResult(Math.ceil(asFiniteNumber(args[0], "ceil", 0)), "ceil")
7838
+ },
7839
+ sqrt: {
7840
+ minArgs: 1,
7841
+ maxArgs: 1,
7842
+ apply: (args) => finiteResult(Math.sqrt(asFiniteNumber(args[0], "sqrt", 0)), "sqrt")
7843
+ },
7844
+ round: {
7845
+ minArgs: 1,
7846
+ maxArgs: 2,
7847
+ apply: (args) => {
7848
+ const x = asFiniteNumber(args[0], "round", 0);
7849
+ const digits = args.length > 1 ? Math.trunc(asFiniteNumber(args[1], "round", 1)) : 0;
7850
+ if (digits < 0 || digits > 100) throw new ExpressionEvalError("round: digits must be between 0 and 100");
7851
+ const factor = 10 ** digits;
7852
+ return finiteResult(Math.round(x * factor) / factor, "round");
7853
+ }
7854
+ },
7855
+ pow: {
7856
+ minArgs: 2,
7857
+ maxArgs: 2,
7858
+ apply: (args) => finiteResult(asFiniteNumber(args[0], "pow", 0) ** asFiniteNumber(args[1], "pow", 1), "pow")
7859
+ },
7860
+ clamp: {
7861
+ minArgs: 3,
7862
+ maxArgs: 3,
7863
+ apply: (args) => {
7864
+ const x = asFiniteNumber(args[0], "clamp", 0);
7865
+ const lo = asFiniteNumber(args[1], "clamp", 1);
7866
+ const hi = asFiniteNumber(args[2], "clamp", 2);
7867
+ if (lo > hi) throw new ExpressionEvalError("clamp: lower bound is greater than upper bound");
7868
+ return finiteResult(Math.min(hi, Math.max(lo, x)), "clamp");
7869
+ }
7870
+ },
7871
+ avg: {
7872
+ minArgs: 1,
7873
+ maxArgs: INF,
7874
+ apply: (args) => {
7875
+ const nums = allFiniteNumbers(args, "avg");
7876
+ return finiteResult(nums.reduce((acc, v) => acc + v, 0) / nums.length, "avg");
7877
+ }
7878
+ },
7879
+ sum: {
7880
+ minArgs: 1,
7881
+ maxArgs: INF,
7882
+ apply: (args) => finiteResult(allFiniteNumbers(args, "sum").reduce((acc, v) => acc + v, 0), "sum")
7883
+ },
7884
+ coalesce: {
7885
+ minArgs: 1,
7886
+ maxArgs: INF,
7887
+ apply: (args) => {
7888
+ for (const a of args) if (a !== null) return a;
7889
+ return null;
7890
+ }
7891
+ },
7892
+ age: {
7893
+ minArgs: 2,
7894
+ maxArgs: 2,
7895
+ apply: (args) => finiteResult(asFiniteNumber(args[0], "age", 0) - asFiniteNumber(args[1], "age", 1), "age")
7896
+ },
7897
+ convert: {
7898
+ minArgs: 3,
7899
+ maxArgs: 3,
7900
+ apply: (args, hooks) => {
7901
+ const x = asFiniteNumber(args[0], "convert", 0);
7902
+ const from = asString$1(args[1], "convert", 1).trim();
7903
+ const to = asString$1(args[2], "convert", 2).trim();
7904
+ if (hooks.convert) {
7905
+ const out = hooks.convert(x, from, to);
7906
+ if (out === null) throw new ExpressionEvalError(`convert: cannot convert '${from}' to '${to}'`);
7907
+ return finiteResult(out, "convert");
7908
+ }
7909
+ if (from === to) return x;
7910
+ throw new ExpressionEvalError("convert: unit conversion table not installed");
7911
+ }
7912
+ }
7913
+ };
7914
+ Object.freeze(Object.assign(Object.create(null), table));
7915
+ /** The set of valid builtin names — used by the parser to reject unknown
7916
+ * callees at parse time (immediate author feedback). */
7917
+ var EXPRESSION_BUILTIN_NAMES = new Set(Object.keys(table));
7918
+ /**
7919
+ * Pratt (precedence-climbing) parser for the safe expression mini-language.
7920
+ *
7921
+ * Precedence (low → high): ternary `?:` (right-assoc) → `||` → `&&` → equality
7922
+ * → relational → additive → multiplicative → unary `! -` → call / primary.
7923
+ * Calls are ONLY `IDENT '(' args? ')'` at primary position — the callee is a
7924
+ * string validated against the builtin table at parse time, so an unknown
7925
+ * function is rejected immediately (author feedback) and a persisted expression
7926
+ * that references a since-removed builtin degrades at read.
7927
+ *
7928
+ * A node counter caps total AST size (`MAX_EXPRESSION_AST_NODES`) and call
7929
+ * arity is capped (`MAX_EXPRESSION_CALL_ARGS`) — both raise `ExpressionParseError`.
7930
+ */
7931
+ /** Binary/logical operator precedence (higher binds tighter). */
7932
+ var BINARY_PRECEDENCE = {
7933
+ "||": 1,
7934
+ "&&": 2,
7935
+ "==": 3,
7936
+ "!=": 3,
7937
+ "<": 4,
7938
+ "<=": 4,
7939
+ ">": 4,
7940
+ ">=": 4,
7941
+ "+": 5,
7942
+ "-": 5,
7943
+ "*": 6,
7944
+ "/": 6,
7945
+ "%": 6
7946
+ };
7947
+ function isLogicalOp(op) {
7948
+ return op === "&&" || op === "||";
7949
+ }
7950
+ function isBinaryOp(op) {
7951
+ return op === "+" || op === "-" || op === "*" || op === "/" || op === "%" || op === "==" || op === "!=" || op === "<" || op === "<=" || op === ">" || op === ">=";
7952
+ }
7953
+ var Parser = class {
7954
+ tokens;
7955
+ pos = 0;
7956
+ nodeCount = 0;
7957
+ identifiers = /* @__PURE__ */ new Set();
7958
+ callees = /* @__PURE__ */ new Set();
7959
+ constructor(tokens) {
7960
+ this.tokens = tokens;
7961
+ }
7962
+ parse() {
7963
+ const ast = this.parseTernary();
7964
+ const tok = this.peek();
7965
+ if (tok.type !== "eof") throw new ExpressionParseError("unexpected trailing input", tok.pos);
7966
+ return {
7967
+ ast,
7968
+ identifiers: this.identifiers,
7969
+ callees: this.callees,
7970
+ nodeCount: this.nodeCount
7971
+ };
7972
+ }
7973
+ peek() {
7974
+ return this.tokens[this.pos];
7975
+ }
7976
+ next() {
7977
+ return this.tokens[this.pos++];
7978
+ }
7979
+ /** Consume a punctuator token, erroring if the next token isn't it. */
7980
+ expectPunct(punct) {
7981
+ const tok = this.peek();
7982
+ if (tok.type !== "punct" || tok.punct !== punct) throw new ExpressionParseError(`expected '${punct}'`, tok.pos);
7983
+ this.pos += 1;
7984
+ }
7985
+ matchPunct(punct) {
7986
+ const tok = this.peek();
7987
+ if (tok.type === "punct" && tok.punct === punct) {
7988
+ this.pos += 1;
7989
+ return true;
7990
+ }
7991
+ return false;
7992
+ }
7993
+ countNode() {
7994
+ this.nodeCount += 1;
7995
+ if (this.nodeCount > 256) throw new ExpressionParseError("expression too complex", this.peek().pos);
7996
+ }
7997
+ parseTernary() {
7998
+ const test = this.parseBinary(1);
7999
+ if (this.matchPunct("?")) {
8000
+ const consequent = this.parseTernary();
8001
+ this.expectPunct(":");
8002
+ const alternate = this.parseTernary();
8003
+ this.countNode();
8004
+ return {
8005
+ kind: "conditional",
8006
+ test,
8007
+ consequent,
8008
+ alternate
8009
+ };
8010
+ }
8011
+ return test;
8012
+ }
8013
+ parseBinary(minPrec) {
8014
+ let left = this.parseUnary();
8015
+ for (;;) {
8016
+ const tok = this.peek();
8017
+ if (tok.type !== "punct") break;
8018
+ const prec = BINARY_PRECEDENCE[tok.punct];
8019
+ if (prec === void 0 || prec < minPrec) break;
8020
+ const op = tok.punct;
8021
+ this.pos += 1;
8022
+ const right = this.parseBinary(prec + 1);
8023
+ this.countNode();
8024
+ if (isLogicalOp(op)) left = {
8025
+ kind: "logical",
8026
+ op,
8027
+ left,
8028
+ right
8029
+ };
8030
+ else if (isBinaryOp(op)) left = {
8031
+ kind: "binary",
8032
+ op,
8033
+ left,
8034
+ right
8035
+ };
8036
+ else throw new ExpressionParseError(`unexpected operator '${op}'`, tok.pos);
8037
+ }
8038
+ return left;
8039
+ }
8040
+ parseUnary() {
8041
+ const tok = this.peek();
8042
+ if (tok.type === "punct" && (tok.punct === "!" || tok.punct === "-")) {
8043
+ const op = tok.punct;
8044
+ this.pos += 1;
8045
+ const operand = this.parseUnary();
8046
+ this.countNode();
8047
+ return {
8048
+ kind: "unary",
8049
+ op,
8050
+ operand
8051
+ };
8052
+ }
8053
+ return this.parsePrimary();
8054
+ }
8055
+ parsePrimary() {
8056
+ const tok = this.next();
8057
+ switch (tok.type) {
8058
+ case "number":
8059
+ this.countNode();
8060
+ return {
8061
+ kind: "literal",
8062
+ value: tok.value
8063
+ };
8064
+ case "string":
8065
+ this.countNode();
8066
+ return {
8067
+ kind: "literal",
8068
+ value: tok.value
8069
+ };
8070
+ case "keyword":
8071
+ this.countNode();
8072
+ return {
8073
+ kind: "literal",
8074
+ value: tok.keyword === "null" ? null : tok.keyword === "true"
8075
+ };
8076
+ case "identifier": {
8077
+ const nextTok = this.peek();
8078
+ if (nextTok.type === "punct" && nextTok.punct === "(") return this.parseCall(tok.name, tok.pos);
8079
+ this.identifiers.add(tok.name);
8080
+ this.countNode();
8081
+ return {
8082
+ kind: "identifier",
8083
+ name: tok.name
8084
+ };
8085
+ }
8086
+ case "punct":
8087
+ if (tok.punct === "(") {
8088
+ const inner = this.parseTernary();
8089
+ this.expectPunct(")");
8090
+ return inner;
8091
+ }
8092
+ throw new ExpressionParseError(`unexpected token '${tok.punct}'`, tok.pos);
8093
+ case "eof": throw new ExpressionParseError("unexpected end of expression", tok.pos);
8094
+ }
8095
+ }
8096
+ parseCall(callee, pos) {
8097
+ if (!EXPRESSION_BUILTIN_NAMES.has(callee)) throw new ExpressionParseError(`unknown function '${callee}'`, pos);
8098
+ this.expectPunct("(");
8099
+ const args = [];
8100
+ if (!this.matchPunct(")")) for (;;) {
8101
+ args.push(this.parseTernary());
8102
+ if (args.length > 16) throw new ExpressionParseError(`too many arguments to '${callee}'`, pos);
8103
+ if (this.matchPunct(",")) continue;
8104
+ this.expectPunct(")");
8105
+ break;
8106
+ }
8107
+ this.callees.add(callee);
8108
+ this.countNode();
8109
+ return {
8110
+ kind: "call",
8111
+ callee,
8112
+ args
8113
+ };
8114
+ }
8115
+ };
8116
+ /** Tokenize + parse `source` into a validated `ParsedExpression`. Throws
8117
+ * `ExpressionParseError` on any lexical or grammatical failure. */
8118
+ function parseExpression(source) {
8119
+ return new Parser(tokenize(source)).parse();
8120
+ }
8121
+ Object.freeze({});
8122
+ /**
8123
+ * LRU compile cache for parsed expressions (spec §2.4 "parse once … LRU keyed
8124
+ * by expr"). The cache stores BOTH successes and failures (negative caching),
8125
+ * so a corrupt persisted string costs exactly one tokenize+parse total — not
8126
+ * one per read on a hot resolve path.
8127
+ *
8128
+ * The cache is a module-level singleton: entries are pure, content-addressed
8129
+ * ASTs keyed by the raw source string, so sharing one instance across all
8130
+ * callers is safe and maximises hit rate.
8131
+ */
8132
+ var cache = /* @__PURE__ */ new Map();
8133
+ function getCached(source) {
8134
+ const hit = cache.get(source);
8135
+ if (hit !== void 0) {
8136
+ cache.delete(source);
8137
+ cache.set(source, hit);
8138
+ return hit;
8139
+ }
8140
+ let result;
8141
+ try {
8142
+ result = {
8143
+ ok: true,
8144
+ parsed: parseExpression(source)
8145
+ };
8146
+ } catch (err) {
8147
+ result = {
8148
+ ok: false,
8149
+ error: err instanceof ExpressionParseError ? err.message : String(err)
8150
+ };
8151
+ }
8152
+ cache.set(source, result);
8153
+ if (cache.size > 256) {
8154
+ const oldest = cache.keys().next().value;
8155
+ if (oldest !== void 0) cache.delete(oldest);
8156
+ }
8157
+ return result;
8158
+ }
8159
+ /** Compile `source`, returning a discriminated result instead of throwing.
8160
+ * Used by read paths that must degrade rather than raise. LRU/negative-cached. */
8161
+ function compileExpressionSafe(source) {
8162
+ return getCached(source);
8163
+ }
8164
+ /**
8165
+ * Author-time validation. Returns `null` when the source is valid, else a
8166
+ * human-readable error message. Checks: the expression compiles; binding count
8167
+ * is within `MAX_EXPRESSION_BINDINGS`; every binding name is a legal identifier,
8168
+ * is not reserved (`now`/keywords) and does not shadow a builtin; and every
8169
+ * FREE identifier of the AST is covered by a binding or the injected `now`.
8170
+ */
8171
+ function validateExpressionSource(src) {
8172
+ const names = Object.keys(src.bindings);
8173
+ if (names.length > 32) return `too many bindings (${names.length} > 32)`;
8174
+ for (const name of names) {
8175
+ if (!EXPRESSION_IDENTIFIER_RE.test(name)) return `invalid binding name '${name}'`;
8176
+ if (RESERVED_BINDING_NAMES.has(name)) return `binding name '${name}' is reserved`;
8177
+ if (EXPRESSION_BUILTIN_NAMES.has(name)) return `binding name '${name}' shadows a builtin function`;
8178
+ }
8179
+ const compiled = compileExpressionSafe(src.expr);
8180
+ if (!compiled.ok) return compiled.error;
8181
+ const bound = new Set(names);
8182
+ for (const id of compiled.parsed.identifiers) {
8183
+ if (id === "now") continue;
8184
+ if (!bound.has(id)) return `expression references unbound identifier '${id}'`;
8185
+ }
8186
+ return null;
8187
+ }
8188
+ /**
7424
8189
  * Accessory device helpers — shared across drivers.
7425
8190
  *
7426
8191
  * Many vendor-specific drivers register accessory child devices on
@@ -9323,7 +10088,8 @@ var MotionAnalysisResultSchema = object({
9323
10088
  });
9324
10089
  method(object({
9325
10090
  deviceId: number(),
9326
- frame: FrameInputSchema
10091
+ frame: FrameInputSchema.optional(),
10092
+ frameHandle: FrameHandleSchema.optional()
9327
10093
  }), MotionAnalysisResultSchema, { kind: "mutation" }), method(object({ deviceId: number() }), _void(), { kind: "mutation" }), method(_void(), _void(), { kind: "mutation" }), object({
9328
10094
  deviceId: number(),
9329
10095
  detected: boolean(),
@@ -9570,6 +10336,12 @@ method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngi
9570
10336
  engine: PipelineEngineChoiceSchema.optional(),
9571
10337
  steps: array(PipelineStepInputSchema).min(1),
9572
10338
  frame: FrameInputSchema.optional(),
10339
+ /**
10340
+ * CB5 shm passthrough — a `FrameHandle` naming the same ring slot
10341
+ * the decoded pixels live in. One more member of the one-of
10342
+ * frame/frameHandle/image/imageBase64/referenceImage group.
10343
+ */
10344
+ frameHandle: FrameHandleSchema.optional(),
9573
10345
  imageBase64: string().optional(),
9574
10346
  /**
9575
10347
  * Binary JPEG bytes — preferred over `imageBase64` on internal
@@ -9779,6 +10551,31 @@ var ReportMotionInputSchema = object({
9779
10551
  regions: array(MotionRegionSchema).readonly().optional()
9780
10552
  });
9781
10553
  /**
10554
+ * Where a runner gets a camera's decoded frames (cross-node Phase 2,
10555
+ * restream-owner model — P2c).
10556
+ *
10557
+ * - `local-broker` (DEFAULT): today's path — subscribe to the co-located
10558
+ * stream-broker's shm frame plane. Every pre-P2c attach payload (no
10559
+ * `frameSource` key) parses to this, so the field is additive with zero
10560
+ * behavior change.
10561
+ * - `remote-restream`: the detect node is NOT the camera's source-owner.
10562
+ * The runner acquires the owner's COMPRESSED passthrough restream
10563
+ * (`streamBroker.getStreamWithCodec({video:'copy'})` — refcounted, the
10564
+ * double-pull guard) and decodes LOCALLY via a satellite frame plane +
10565
+ * pull-mode decoder session pinned to its own node. The shm ring stays
10566
+ * node-local; only H.264/H.265 packets cross the wire.
10567
+ * `hubHostnameOverride` mirrors the recorder's `recordingHubHostname`:
10568
+ * when set it overrides the `CAMSTACK_HUB_URL`-derived host the runner
10569
+ * dials for the owner's restream.
10570
+ */
10571
+ var RunnerFrameSourceSchema = discriminatedUnion("kind", [object({ kind: literal("local-broker") }), object({
10572
+ kind: literal("remote-restream"),
10573
+ /** The camera's source-owner node (slice 1: always the hub). */
10574
+ ownerNodeId: string(),
10575
+ /** Operator override for the owner host the runner dials. */
10576
+ hubHostnameOverride: string().optional()
10577
+ })]).describe("Per-camera frame-source mode for the runner (P2c)");
10578
+ /**
9782
10579
  * Camera assignment payload sent by `addon-pipeline-orchestrator` to a
9783
10580
  * specific runner instance via `attachCamera`. Carries everything the
9784
10581
  * runner needs to subscribe to the local broker and execute inference.
@@ -9876,7 +10673,15 @@ var RunnerCameraConfigSchema = object({
9876
10673
  */
9877
10674
  onboardMotionDrivesAnalyzer: boolean().default(true),
9878
10675
  occupancyRecheckSec: number().min(occupancyRecheckSecField.min).max(occupancyRecheckSecField.max).default(occupancyRecheckSecField.default),
9879
- occupancyRecheckFrames: number().min(occupancyRecheckFramesField.min).max(occupancyRecheckFramesField.max).default(occupancyRecheckFramesField.default)
10676
+ occupancyRecheckFrames: number().min(occupancyRecheckFramesField.min).max(occupancyRecheckFramesField.max).default(occupancyRecheckFramesField.default),
10677
+ /**
10678
+ * Where this runner gets the camera's decoded frames (P2c). Defaulted so
10679
+ * every existing payload behaves as `local-broker` — the pre-Phase-2 path.
10680
+ * Populated with `remote-restream` by the orchestrator ONLY when the
10681
+ * camera's detect node differs from its source-owner (P2d, gated by the
10682
+ * `remoteSourcingNodes` rollout setting).
10683
+ */
10684
+ frameSource: RunnerFrameSourceSchema.default({ kind: "local-broker" })
9880
10685
  });
9881
10686
  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;
9882
10687
  /**
@@ -10241,6 +11046,113 @@ object({
10241
11046
  lastFetchedAt: number()
10242
11047
  });
10243
11048
  DeviceType.Sensor;
11049
+ /**
11050
+ * Feeder connectivity / power status — mirrors the HA petkit device-status
11051
+ * enum: `normal` (online, mains), `offline` (not reaching PetKit cloud),
11052
+ * `on_batteries` (running on battery backup). `null` until first reported.
11053
+ */
11054
+ var PetFeederDeviceStatusSchema = _enum([
11055
+ "normal",
11056
+ "offline",
11057
+ "on_batteries"
11058
+ ]);
11059
+ var gramsPortion = number().int().min(4).max(200);
11060
+ object({
11061
+ /** Food currently in the bowl (grams). Null when the device has not
11062
+ * reported a reading yet. On dual-hopper models this is the combined
11063
+ * bowl reading; per-hopper levels live in `food1`/`food2`. */
11064
+ foodLevel: number().nullable(),
11065
+ /** Hopper-1 food level (grams) on dual-hopper feeders; null on
11066
+ * single-hopper models. */
11067
+ food1: number().nullable(),
11068
+ /** Hopper-2 food level (grams) on dual-hopper feeders; null on
11069
+ * single-hopper models. */
11070
+ food2: number().nullable(),
11071
+ /** Derived low-food flag — mirrors the HA `food_level` binary_sensor
11072
+ * (`device_class: problem`, on = low). True when the bowl is empty /
11073
+ * below the feeder's low threshold. */
11074
+ lowFood: boolean(),
11075
+ /** Battery charge 0..100 (%). Null on mains-powered models or when the
11076
+ * device has no battery reading. */
11077
+ batteryPower: number().min(0).max(100).nullable(),
11078
+ /** Days of desiccant life remaining. Null when the model has no
11079
+ * desiccant sensor. */
11080
+ desiccantLeftDays: number().nullable(),
11081
+ /** True while a feed is in progress. */
11082
+ feeding: boolean(),
11083
+ /** Decoded connectivity / power status (HA petkit device-status enum).
11084
+ * Null until the device has reported a status. */
11085
+ status: PetFeederDeviceStatusSchema.nullable(),
11086
+ /** Decoded human-readable fault message. Null (or the device's `no_error`
11087
+ * sentinel) means healthy; a non-null string is an active fault. Pairs
11088
+ * with `errorCode` for consumers that want the raw integer. */
11089
+ error: string().nullable(),
11090
+ /** Raw device error code (0 / null = no error). */
11091
+ errorCode: number().nullable(),
11092
+ /** True for D4S/D4SH dual-hopper hardware — gates the per-hopper UI. */
11093
+ isDualHopper: boolean(),
11094
+ /** Child-lock (manual-lock) setting — buttons on the unit are disabled. */
11095
+ childLock: boolean(),
11096
+ /** Front indicator-light setting. */
11097
+ indicatorLight: boolean(),
11098
+ /** Play a chime when dispensing. */
11099
+ feedSound: boolean(),
11100
+ /** Speaker / prompt volume level (device-scaled integer). */
11101
+ volume: number(),
11102
+ /** Ms epoch when the slice was last refreshed from the cloud. */
11103
+ lastFetchedAt: number()
11104
+ });
11105
+ DeviceType.PetFeeder, method(object({
11106
+ deviceId: number().int().nonnegative(),
11107
+ grams: gramsPortion.optional(),
11108
+ hopper1: gramsPortion.optional(),
11109
+ hopper2: gramsPortion.optional()
11110
+ }), _void(), {
11111
+ kind: "mutation",
11112
+ auth: "admin"
11113
+ }), method(object({ deviceId: number().int().nonnegative() }), _void(), {
11114
+ kind: "mutation",
11115
+ auth: "admin"
11116
+ }), method(object({ deviceId: number().int().nonnegative() }), _void(), {
11117
+ kind: "mutation",
11118
+ auth: "admin"
11119
+ }), method(object({ deviceId: number().int().nonnegative() }), _void(), {
11120
+ kind: "mutation",
11121
+ auth: "admin"
11122
+ }), method(object({ deviceId: number().int().nonnegative() }), _void(), {
11123
+ kind: "mutation",
11124
+ auth: "admin"
11125
+ }), method(object({
11126
+ deviceId: number().int().nonnegative(),
11127
+ soundId: number().int().nonnegative()
11128
+ }), _void(), {
11129
+ kind: "mutation",
11130
+ auth: "admin"
11131
+ }), method(object({
11132
+ deviceId: number().int().nonnegative(),
11133
+ on: boolean()
11134
+ }), _void(), {
11135
+ kind: "mutation",
11136
+ auth: "admin"
11137
+ }), method(object({
11138
+ deviceId: number().int().nonnegative(),
11139
+ on: boolean()
11140
+ }), _void(), {
11141
+ kind: "mutation",
11142
+ auth: "admin"
11143
+ }), method(object({
11144
+ deviceId: number().int().nonnegative(),
11145
+ on: boolean()
11146
+ }), _void(), {
11147
+ kind: "mutation",
11148
+ auth: "admin"
11149
+ }), method(object({
11150
+ deviceId: number().int().nonnegative(),
11151
+ level: number().int().nonnegative()
11152
+ }), _void(), {
11153
+ kind: "mutation",
11154
+ auth: "admin"
11155
+ });
10244
11156
  object({
10245
11157
  /** Instantaneous power draw in watts. */
10246
11158
  watts: number().optional(),
@@ -12068,10 +12980,12 @@ method(object({ codec: string() }), boolean()), method(_void(), object({
12068
12980
  url: string()
12069
12981
  }), _void()), method(object({
12070
12982
  sessionId: string(),
12071
- maxCount: number().default(1)
12983
+ maxCount: number().default(1),
12984
+ waitMs: number().optional()
12072
12985
  }), array(DecodedFrameSchema)), method(object({
12073
12986
  sessionId: string(),
12074
- maxCount: number().default(1)
12987
+ maxCount: number().default(1),
12988
+ waitMs: number().optional()
12075
12989
  }), array(FrameHandleSchema)), method(object({ handle: FrameHandleSchema }), DecodedFrameSchema.nullable()), method(object({ sessionId: string() }), ShmRingStatsSchema.nullable()), method(object({
12076
12990
  sessionId: string(),
12077
12991
  config: DecoderSessionConfigSchema.partial()
@@ -12358,14 +13272,63 @@ var ChildLayoutEntrySchema = object({
12358
13272
  collapsed: boolean().optional()
12359
13273
  });
12360
13274
  /** Cap-wire shape of a DeviceLink — structurally mirrors `DeviceLink` in
12361
- * `device-management.ts`. */
13275
+ * `device-management.ts`. Source is a union: a FIELD source copies a sibling
13276
+ * accessory's status field (`kind` optional/absent for wire compat); a
13277
+ * LITERAL source carries a per-device constant (no sibling is read); a
13278
+ * GLOBAL source (P2e) copies ANY device's status field, addressed by the
13279
+ * source device's full re-sync-stable `stableId`. */
13280
+ var DeviceLinkFieldSourceSchema = object({
13281
+ kind: literal("field").optional(),
13282
+ sourceKey: string(),
13283
+ cap: string(),
13284
+ fieldPath: string()
13285
+ });
13286
+ var DeviceLinkLiteralSourceSchema = object({
13287
+ kind: literal("literal"),
13288
+ value: union([
13289
+ string(),
13290
+ number(),
13291
+ boolean(),
13292
+ _null()
13293
+ ])
13294
+ });
13295
+ var DeviceLinkGlobalSourceSchema = object({
13296
+ kind: literal("global"),
13297
+ sourceStableId: string(),
13298
+ cap: string(),
13299
+ fieldPath: string()
13300
+ });
13301
+ /** Expression source (Stage X): compute the target field from N named bindings
13302
+ * via the safe expression engine. Bindings are field | literal | global — never
13303
+ * another expression (no nesting). The `superRefine` runs the SAME author-time
13304
+ * validation as `validateExpressionSource` (compiles the expr, checks binding
13305
+ * names + identifier coverage) so every wire boundary that parses a DeviceLink
13306
+ * (tRPC mount, kernel create pre-seed, projection output) validates-at-write.
13307
+ * Compiles are LRU-cached, so repeated validation of the same expr is a hit. */
13308
+ var DeviceLinkExpressionSourceSchema = object({
13309
+ kind: literal("expression"),
13310
+ expr: string().min(1).max(MAX_EXPRESSION_SOURCE_LENGTH),
13311
+ bindings: record(string().regex(EXPRESSION_IDENTIFIER_RE), union([
13312
+ DeviceLinkFieldSourceSchema,
13313
+ DeviceLinkLiteralSourceSchema,
13314
+ DeviceLinkGlobalSourceSchema
13315
+ ]))
13316
+ }).superRefine((src, ctx) => {
13317
+ const err = validateExpressionSource(src);
13318
+ if (err !== null) ctx.addIssue({
13319
+ code: "custom",
13320
+ message: err,
13321
+ path: ["expr"]
13322
+ });
13323
+ });
12362
13324
  var DeviceLinkSchema = object({
12363
13325
  id: string(),
12364
- source: object({
12365
- sourceKey: string(),
12366
- cap: string(),
12367
- fieldPath: string()
12368
- }),
13326
+ source: union([
13327
+ DeviceLinkFieldSourceSchema,
13328
+ DeviceLinkLiteralSourceSchema,
13329
+ DeviceLinkGlobalSourceSchema,
13330
+ DeviceLinkExpressionSourceSchema
13331
+ ]),
12369
13332
  target: object({
12370
13333
  cap: string(),
12371
13334
  fieldPath: string(),
@@ -12394,6 +13357,31 @@ var DeviceLinkSchema = object({
12394
13357
  })
12395
13358
  ]).optional()
12396
13359
  });
13360
+ /** Cap-wire shape of a per-cap display refinement — mirrors
13361
+ * `DeviceCapDisplayOverride` in `device-management.ts`. */
13362
+ var DeviceCapDisplayOverrideSchema = object({
13363
+ unit: string().min(1).optional(),
13364
+ precision: number().int().min(0).max(10).optional()
13365
+ });
13366
+ /** Cap-wire shape of an operator-authored per-device display override —
13367
+ * mirrors `DeviceDisplayOverride` in `device-management.ts`. `precision`
13368
+ * bounds mirror `numeric-sensor.cap.ts` (`int 0-10`). */
13369
+ var DeviceDisplayOverrideSchema = object({
13370
+ icon: string().min(1).optional(),
13371
+ label: string().min(1).optional(),
13372
+ unit: string().min(1).optional(),
13373
+ precision: number().int().min(0).max(10).optional(),
13374
+ hidden: boolean().optional(),
13375
+ perCap: record(string(), DeviceCapDisplayOverrideSchema).optional()
13376
+ });
13377
+ /** Cap-wire shape of a per-role display default — mirrors `RoleDisplayDefault`
13378
+ * in `device-management.ts`. Keyed by `DeviceRole` string (role strings cross
13379
+ * the wire as plain strings everywhere else — cf. `DeviceInfoSchema.role`). */
13380
+ var RoleDisplayDefaultSchema = object({
13381
+ unit: string().min(1).optional(),
13382
+ precision: number().int().min(0).max(10).optional(),
13383
+ icon: string().min(1).optional()
13384
+ });
12397
13385
  /**
12398
13386
  * Serializable projection of a live IDevice.
12399
13387
  * Returned by listAll, getDevice, getChildren.
@@ -12449,7 +13437,9 @@ var DeviceInfoSchema = object({
12449
13437
  * `DeviceMeta.childLayout`. Absent ⇒ no layout declared. */
12450
13438
  childLayout: array(ChildLayoutEntrySchema).readonly().optional(),
12451
13439
  /** Operator-authored cross-device field wirings. See `DeviceMeta.deviceLinks`. */
12452
- deviceLinks: array(DeviceLinkSchema).readonly().optional()
13440
+ deviceLinks: array(DeviceLinkSchema).readonly().optional(),
13441
+ /** Operator-authored per-device display override. See `DeviceMeta.display`. */
13442
+ display: DeviceDisplayOverrideSchema.optional()
12453
13443
  });
12454
13444
  var ConfigEntrySchema = object({
12455
13445
  key: string(),
@@ -12514,7 +13504,9 @@ var DeviceMetaSchema = object({
12514
13504
  deviceLinks: array(DeviceLinkSchema).readonly().optional(),
12515
13505
  /** Semantic role string (`DeviceRole`) — propagated from the spawn pre-seed.
12516
13506
  * Optional: only present for accessory children that carry a known role. */
12517
- role: string().nullable().optional()
13507
+ role: string().nullable().optional(),
13508
+ /** Operator-authored per-device display override. See `DeviceMeta.display`. */
13509
+ display: DeviceDisplayOverrideSchema.optional()
12518
13510
  });
12519
13511
  /** ConfigUISchema passed through as unknown — mirrors device-provider's CreationSchemaOutputSchema */
12520
13512
  var ConfigUISchemaOutput = unknown().nullable();
@@ -12608,7 +13600,19 @@ method(object({
12608
13600
  }), _void(), {
12609
13601
  kind: "mutation",
12610
13602
  auth: "admin"
12611
- }), method(object({ deviceId: number() }), object({ caps: array(object({
13603
+ }), method(object({
13604
+ deviceId: number(),
13605
+ display: DeviceDisplayOverrideSchema.nullable()
13606
+ }), _void(), {
13607
+ kind: "mutation",
13608
+ auth: "admin"
13609
+ }), method(object({}), object({ defaults: record(string(), RoleDisplayDefaultSchema) }), { kind: "query" }), method(object({ defaults: record(string(), RoleDisplayDefaultSchema) }), _void(), {
13610
+ kind: "mutation",
13611
+ auth: "admin"
13612
+ }), method(object({
13613
+ deviceId: number(),
13614
+ includeSynthesizable: boolean().optional()
13615
+ }), object({ caps: array(object({
12612
13616
  cap: string(),
12613
13617
  fields: array(object({
12614
13618
  path: string(),
@@ -12618,8 +13622,13 @@ method(object({
12618
13622
  "boolean",
12619
13623
  "enum"
12620
13624
  ]),
12621
- enumValues: array(string()).optional()
12622
- })).readonly()
13625
+ enumValues: array(string()).optional(),
13626
+ item: boolean().optional()
13627
+ })).readonly(),
13628
+ itemArray: object({
13629
+ path: string(),
13630
+ keyField: string()
13631
+ }).optional()
12623
13632
  })).readonly() }), { kind: "query" }), method(object({
12624
13633
  deviceId: number(),
12625
13634
  role: string().nullable()
@@ -12689,7 +13698,11 @@ method(object({
12689
13698
  deviceId: number(),
12690
13699
  entries: array(object({
12691
13700
  capName: string(),
12692
- kind: _enum(["native", "wrapped"]),
13701
+ kind: _enum([
13702
+ "native",
13703
+ "wrapped",
13704
+ "linked"
13705
+ ]),
12693
13706
  providerAddonId: string(),
12694
13707
  providerNodeId: string(),
12695
13708
  nativeAddonId: string()
@@ -12698,7 +13711,11 @@ method(object({
12698
13711
  deviceId: number(),
12699
13712
  entries: array(object({
12700
13713
  capName: string(),
12701
- kind: _enum(["native", "wrapped"]),
13714
+ kind: _enum([
13715
+ "native",
13716
+ "wrapped",
13717
+ "linked"
13718
+ ]),
12702
13719
  providerAddonId: string(),
12703
13720
  providerNodeId: string(),
12704
13721
  nativeAddonId: string()
@@ -13188,7 +14205,7 @@ var AddBrokerInputSchema = object({
13188
14205
  });
13189
14206
  var AddBrokerResultSchema = object({ id: string() });
13190
14207
  var IdInputSchema = object({ id: string() });
13191
- var TestResultSchema = discriminatedUnion("ok", [object({
14208
+ var TestResultSchema$1 = discriminatedUnion("ok", [object({
13192
14209
  ok: literal(true),
13193
14210
  latencyMs: number()
13194
14211
  }), object({
@@ -13211,7 +14228,7 @@ var StatusSchema = object({
13211
14228
  brokerCount: number(),
13212
14229
  embeddedRunning: boolean()
13213
14230
  });
13214
- 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);
14231
+ 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);
13215
14232
  var NetworkEndpointSchema = object({
13216
14233
  url: string(),
13217
14234
  hostname: string(),
@@ -13245,23 +14262,198 @@ var NetworkEndpointEntrySchema = NetworkEndpointSchema.extend({
13245
14262
  sourcePort: number().optional()
13246
14263
  });
13247
14264
  method(_void(), NetworkEndpointSchema, { kind: "mutation" }), method(_void(), _void(), { kind: "mutation" }), method(_void(), NetworkEndpointSchema.nullable()), method(_void(), NetworkAccessStatusSchema), method(_void(), array(NetworkEndpointEntrySchema).readonly());
13248
- method(object({
13249
- title: string(),
14265
+ /**
14266
+ * notification-output — canonical, capability-gated notification delivery.
14267
+ *
14268
+ * Apprise-derived model (see
14269
+ * `docs/superpowers/specs/2026-07-03-notification-output-notifier-matrix.md`):
14270
+ * callers emit ONE canonical `Notification`; each provider declares a
14271
+ * per-kind capability descriptor (`TargetKind`), and the pure degrade
14272
+ * engine (`@camstack/types` `prepareNotification`) transcodes / degrades the
14273
+ * message to what the kind supports — callers never special-case a service.
14274
+ *
14275
+ * DESIGN DECISIONS (locked):
14276
+ * - Target CRUD lives on THIS cap (`upsertTarget` / `deleteTarget` /
14277
+ * `setTargetEnabled`), each provider persisting via the `settings-store`
14278
+ * cap. Rationale: the admin UI needs one uniform surface across the
14279
+ * notifiers addon AND the HA addon; the addon-`globalSettingsSchema`-array
14280
+ * alternative would fork the UI per addon and cannot host the
14281
+ * discovery→adopt flow.
14282
+ * - `listTargetKinds` / `listTargets` / `discoverTargets` return arrays →
14283
+ * the generated cap-mount auto-`concatCollection`-fans them across every
14284
+ * registered provider (notifiers addon + HA addon) so one catalog is
14285
+ * routable. `send` / `testTarget` / CRUD route to ONE provider by the
14286
+ * `addonId` the generated collection router extracts from the call input.
14287
+ * - `Attachment.bytes` is `Uint8Array`. Transport-safe: superjson (the tRPC
14288
+ * transformer) + UDS MsgPack both round-trip typed arrays — already used by
14289
+ * `storage` / `storage-provider` / `recording` caps over the same path. No
14290
+ * base64 fallback needed.
14291
+ *
14292
+ * TODO (deferred, closed-set change — separate decision): add
14293
+ * `providerKind: 'notify'` so notification providers surface on the unified
14294
+ * admin "Integrations" page.
14295
+ */
14296
+ /**
14297
+ * Zentik-derived typed-media enum — the superset across every kind. Each
14298
+ * adapter picks what it supports and the degrade engine filters the rest.
14299
+ */
14300
+ var AttachmentMediaTypeSchema = _enum([
14301
+ "image",
14302
+ "video",
14303
+ "gif",
14304
+ "audio",
14305
+ "icon"
14306
+ ]);
14307
+ /**
14308
+ * A single attachment. Exactly one of `url` (remote source, most adapters
14309
+ * prefer this) or `bytes` (inline source; required for Pushover-style
14310
+ * bytes-only kinds) MUST be present — the degrade engine expresses a
14311
+ * url→bytes fetch as a `needsFetch` directive the adapter executes.
14312
+ */
14313
+ var AttachmentSchema = object({
14314
+ mediaType: AttachmentMediaTypeSchema,
14315
+ url: string().optional(),
14316
+ bytes: _instanceof(Uint8Array).optional(),
14317
+ mime: string().optional(),
14318
+ name: string().optional()
14319
+ }).refine((a) => a.url !== void 0 || a.bytes !== void 0, { message: "Attachment requires either `url` or `bytes`" });
14320
+ var NotificationFormatSchema = _enum([
14321
+ "text",
14322
+ "markdown",
14323
+ "html"
14324
+ ]);
14325
+ /** A single tap-through action button. */
14326
+ var NotificationActionSchema = object({
14327
+ id: string(),
14328
+ label: string(),
14329
+ url: string().optional()
14330
+ });
14331
+ /**
14332
+ * The canonical notification. `body` is the only hard field (Apprise model).
14333
+ * `priority` is a 5-level ORDINAL (1=lowest … 3=normal(default) … 5=urgent),
14334
+ * NOT a fixed severity enum — each kind declares its own `caps.levels` and
14335
+ * the adapter maps this ordinal onto its native level. `level?` is an
14336
+ * optional kind-native level id (`emergency`, `silent`, …) that overrides
14337
+ * `priority` for that one target.
14338
+ */
14339
+ var NotificationSchema = object({
13250
14340
  body: string(),
13251
- imageUrl: string().optional(),
14341
+ title: string().optional(),
14342
+ format: NotificationFormatSchema.default("text"),
14343
+ priority: number().int().min(1).max(5).default(3),
14344
+ level: string().optional(),
14345
+ attachments: array(AttachmentSchema).optional(),
14346
+ clickUrl: string().optional(),
14347
+ actions: array(NotificationActionSchema).optional(),
14348
+ sound: string().optional(),
14349
+ ttl: number().optional(),
14350
+ tag: string().optional(),
13252
14351
  deviceId: number().optional(),
13253
14352
  eventId: string().optional(),
13254
- priority: _enum([
13255
- "low",
13256
- "normal",
13257
- "high",
13258
- "critical"
13259
- ]).default("normal"),
13260
14353
  metadata: record(string(), unknown()).optional()
13261
- }), _void(), { kind: "mutation" }), method(_void(), object({
14354
+ });
14355
+ /** One declared native severity/priority level for a kind. */
14356
+ var TargetKindLevelSchema = object({
14357
+ id: string(),
14358
+ label: string(),
14359
+ /** Which canonical priority (1..5) this level maps to. `null` = qualitative-only. */
14360
+ ordinal: number().int().min(1).max(5).nullable(),
14361
+ flags: object({
14362
+ critical: boolean().optional(),
14363
+ silent: boolean().optional(),
14364
+ noPush: boolean().optional()
14365
+ }).optional(),
14366
+ /** e.g. Pushover `emergency` requires `retry` / `expire`. */
14367
+ requires: array(string()).optional(),
14368
+ description: string().optional()
14369
+ });
14370
+ /** The full capability block consulted before dispatch. */
14371
+ var TargetKindCapsSchema = object({
14372
+ attachments: object({
14373
+ mediaTypes: array(AttachmentMediaTypeSchema),
14374
+ mode: _enum([
14375
+ "url",
14376
+ "bytes",
14377
+ "both"
14378
+ ]),
14379
+ max: number().int().nonnegative(),
14380
+ maxBytes: number().int().positive().optional()
14381
+ }),
14382
+ /** Max action buttons (0 = none). */
14383
+ actions: number().int().nonnegative(),
14384
+ levels: array(TargetKindLevelSchema),
14385
+ format: array(NotificationFormatSchema),
14386
+ clickUrl: boolean(),
14387
+ sound: boolean(),
14388
+ ttl: boolean(),
14389
+ bodyMaxLen: number().int().positive()
14390
+ });
14391
+ /**
14392
+ * `configSchema` is a `ConfigUISchema` tree passed through to the admin
14393
+ * FormBuilder. Stored as `z.unknown()` at the cap seam (mirrors
14394
+ * `device-provider.getChildCreationSchema` `CreationSchemaOutputSchema`) —
14395
+ * the union is large and not meant for runtime validation here; the exported
14396
+ * `TargetKind` type re-tightens `configSchema` to `ConfigUISchema`.
14397
+ */
14398
+ var ConfigSchemaPassthrough = unknown();
14399
+ var TargetKindSchema = object({
14400
+ kind: string(),
14401
+ label: string(),
14402
+ icon: string(),
14403
+ /** Stamped by each provider so the concat-fanned catalog stays routable. */
14404
+ addonId: string(),
14405
+ configSchema: ConfigSchemaPassthrough,
14406
+ supportsDiscovery: boolean(),
14407
+ caps: TargetKindCapsSchema
14408
+ });
14409
+ /**
14410
+ * A persisted target. `config` holds secrets; providers REDACT secret fields
14411
+ * (return a presence marker only) when serving `listTargets` — never
14412
+ * round-trip a stored secret to the UI.
14413
+ */
14414
+ var TargetSchema = object({
14415
+ id: string(),
14416
+ name: string(),
14417
+ kind: string(),
14418
+ addonId: string(),
14419
+ enabled: boolean(),
14420
+ config: record(string(), unknown())
14421
+ });
14422
+ /** A discovery-surfaced candidate (config is partial + non-secret). */
14423
+ var DiscoveredTargetSchema = object({
14424
+ kind: string(),
14425
+ suggestedName: string(),
14426
+ config: record(string(), unknown())
14427
+ });
14428
+ /** The degrade engine's report — what was resolved / dropped / degraded. */
14429
+ var RenderedAsSchema = object({
14430
+ level: string(),
14431
+ format: NotificationFormatSchema,
14432
+ attachmentsSent: number().int().nonnegative(),
14433
+ actionsSent: number().int().nonnegative(),
14434
+ truncated: boolean(),
14435
+ dropped: array(string())
14436
+ });
14437
+ var SendResultSchema = object({
13262
14438
  success: boolean(),
13263
- error: string().optional()
13264
- }), { kind: "mutation" });
14439
+ error: string().optional(),
14440
+ renderedAs: RenderedAsSchema.optional()
14441
+ });
14442
+ /** Same shape as SendResult — kept as a distinct name for the test panel. */
14443
+ var TestResultSchema = SendResultSchema;
14444
+ method(object({}), array(TargetKindSchema)), method(object({}), array(TargetSchema)), method(object({
14445
+ kind: string(),
14446
+ config: record(string(), unknown()).optional()
14447
+ }), array(DiscoveredTargetSchema)), method(object({
14448
+ targetId: string(),
14449
+ notification: NotificationSchema
14450
+ }), SendResultSchema, { kind: "mutation" }), method(object({
14451
+ targetId: string(),
14452
+ sample: NotificationSchema.optional()
14453
+ }), TestResultSchema, { kind: "mutation" }), method(object({ target: TargetSchema }), TargetSchema, { kind: "mutation" }), method(object({ targetId: string() }), _void(), { kind: "mutation" }), method(object({
14454
+ targetId: string(),
14455
+ enabled: boolean()
14456
+ }), _void(), { kind: "mutation" });
13265
14457
  /**
13266
14458
  * Zod schemas for persisted record types.
13267
14459
  *
@@ -16328,7 +17520,10 @@ var HwAccelBackendInputSchema = _enum([
16328
17520
  "webgpu",
16329
17521
  "none"
16330
17522
  ]).nullable().optional();
16331
- var HwAccelResolutionSchema = object({ preferred: array(string()).readonly() });
17523
+ var HwAccelResolutionSchema = object({
17524
+ preferred: array(string()).readonly(),
17525
+ rationale: string()
17526
+ });
16332
17527
  var HardwareEncoderIdSchema = _enum([
16333
17528
  "h264_videotoolbox",
16334
17529
  "hevc_videotoolbox",
@@ -16433,10 +17628,7 @@ var ResolvedInferenceConfigSchema = object({
16433
17628
  format: ModelFormatSchema,
16434
17629
  reason: string()
16435
17630
  });
16436
- method(_void(), PlatformCapabilitiesSchema), method(_void(), HardwareInfoSchema), method(object({ requirements: array(ModelRequirementSchema).readonly() }), ResolvedInferenceConfigSchema), method(object({
16437
- prefer: HwAccelBackendInputSchema,
16438
- nodeId: string().optional()
16439
- }), HwAccelResolutionSchema), method(_void(), HardwareEncodersSchema), method(_void(), HardwareEncodersSchema, {
17631
+ method(_void(), PlatformCapabilitiesSchema), method(_void(), HardwareInfoSchema), method(object({ requirements: array(ModelRequirementSchema).readonly() }), ResolvedInferenceConfigSchema), method(object({ prefer: HwAccelBackendInputSchema }), HwAccelResolutionSchema), method(_void(), HardwareEncodersSchema), method(_void(), HardwareEncodersSchema, {
16440
17632
  kind: "mutation",
16441
17633
  auth: "admin"
16442
17634
  }), method(_void(), HardwareDecodeAccelsSchema), method(_void(), HardwareDecodeAccelsSchema, {
@@ -16495,6 +17687,16 @@ DeviceType.Camera, DeviceType.Sensor, DeviceType.Switch, method(object({ deviceI
16495
17687
  kind: "mutation",
16496
17688
  auth: "admin"
16497
17689
  });
17690
+ /**
17691
+ * `recording` cap — footage availability + HLS playback manifests + per-device
17692
+ * recording config. NOTE on events (source of truth, R5/C3): this cap carries
17693
+ * NO event surface — `getPlaybackManifest` returns playlist URLs only. Timeline
17694
+ * events (motion/object/audio) come from `pipelineAnalytics` (durable SQLite
17695
+ * rows); the recorder's internal EventMap markers are ephemeral in-RAM
17696
+ * annotations that are not exposed here and must not be treated as an event
17697
+ * feed. Event<->footage joins are by time, padded with the shared `EVENT_PAD_MS`
17698
+ * (`interfaces/recording-config.ts`).
17699
+ */
16498
17700
  var RecordingStatusSchema = object({
16499
17701
  deviceId: number(),
16500
17702
  enabled: boolean(),
@@ -18131,6 +19333,12 @@ Object.freeze({
18131
19333
  addonId: null,
18132
19334
  access: "view"
18133
19335
  },
19336
+ "deviceManager.getRoleDisplayDefaults": {
19337
+ capName: "device-manager",
19338
+ capScope: "system",
19339
+ addonId: null,
19340
+ access: "view"
19341
+ },
18134
19342
  "deviceManager.getSettingsSchema": {
18135
19343
  capName: "device-manager",
18136
19344
  capScope: "system",
@@ -18281,6 +19489,12 @@ Object.freeze({
18281
19489
  addonId: null,
18282
19490
  access: "create"
18283
19491
  },
19492
+ "deviceManager.setDisplay": {
19493
+ capName: "device-manager",
19494
+ capScope: "system",
19495
+ addonId: null,
19496
+ access: "create"
19497
+ },
18284
19498
  "deviceManager.setIntegrationId": {
18285
19499
  capName: "device-manager",
18286
19500
  capScope: "system",
@@ -18323,6 +19537,12 @@ Object.freeze({
18323
19537
  addonId: null,
18324
19538
  access: "create"
18325
19539
  },
19540
+ "deviceManager.setRoleDisplayDefaults": {
19541
+ capName: "device-manager",
19542
+ capScope: "system",
19543
+ addonId: null,
19544
+ access: "create"
19545
+ },
18326
19546
  "deviceManager.setStreamProfileMap": {
18327
19547
  capName: "device-manager",
18328
19548
  capScope: "system",
@@ -19301,13 +20521,49 @@ Object.freeze({
19301
20521
  addonId: null,
19302
20522
  access: "create"
19303
20523
  },
20524
+ "notificationOutput.deleteTarget": {
20525
+ capName: "notification-output",
20526
+ capScope: "system",
20527
+ addonId: null,
20528
+ access: "delete"
20529
+ },
20530
+ "notificationOutput.discoverTargets": {
20531
+ capName: "notification-output",
20532
+ capScope: "system",
20533
+ addonId: null,
20534
+ access: "view"
20535
+ },
20536
+ "notificationOutput.listTargetKinds": {
20537
+ capName: "notification-output",
20538
+ capScope: "system",
20539
+ addonId: null,
20540
+ access: "view"
20541
+ },
20542
+ "notificationOutput.listTargets": {
20543
+ capName: "notification-output",
20544
+ capScope: "system",
20545
+ addonId: null,
20546
+ access: "view"
20547
+ },
19304
20548
  "notificationOutput.send": {
19305
20549
  capName: "notification-output",
19306
20550
  capScope: "system",
19307
20551
  addonId: null,
19308
20552
  access: "create"
19309
20553
  },
19310
- "notificationOutput.sendTest": {
20554
+ "notificationOutput.setTargetEnabled": {
20555
+ capName: "notification-output",
20556
+ capScope: "system",
20557
+ addonId: null,
20558
+ access: "create"
20559
+ },
20560
+ "notificationOutput.testTarget": {
20561
+ capName: "notification-output",
20562
+ capScope: "system",
20563
+ addonId: null,
20564
+ access: "create"
20565
+ },
20566
+ "notificationOutput.upsertTarget": {
19311
20567
  capName: "notification-output",
19312
20568
  capScope: "system",
19313
20569
  addonId: null,
@@ -19337,6 +20593,66 @@ Object.freeze({
19337
20593
  addonId: null,
19338
20594
  access: "create"
19339
20595
  },
20596
+ "petFeeder.callPet": {
20597
+ capName: "pet-feeder",
20598
+ capScope: "device",
20599
+ addonId: null,
20600
+ access: "create"
20601
+ },
20602
+ "petFeeder.cancelFeed": {
20603
+ capName: "pet-feeder",
20604
+ capScope: "device",
20605
+ addonId: null,
20606
+ access: "create"
20607
+ },
20608
+ "petFeeder.feed": {
20609
+ capName: "pet-feeder",
20610
+ capScope: "device",
20611
+ addonId: null,
20612
+ access: "create"
20613
+ },
20614
+ "petFeeder.markFoodReplenished": {
20615
+ capName: "pet-feeder",
20616
+ capScope: "device",
20617
+ addonId: null,
20618
+ access: "create"
20619
+ },
20620
+ "petFeeder.playSound": {
20621
+ capName: "pet-feeder",
20622
+ capScope: "device",
20623
+ addonId: null,
20624
+ access: "create"
20625
+ },
20626
+ "petFeeder.resetDesiccant": {
20627
+ capName: "pet-feeder",
20628
+ capScope: "device",
20629
+ addonId: null,
20630
+ access: "delete"
20631
+ },
20632
+ "petFeeder.setChildLock": {
20633
+ capName: "pet-feeder",
20634
+ capScope: "device",
20635
+ addonId: null,
20636
+ access: "create"
20637
+ },
20638
+ "petFeeder.setFeedSound": {
20639
+ capName: "pet-feeder",
20640
+ capScope: "device",
20641
+ addonId: null,
20642
+ access: "create"
20643
+ },
20644
+ "petFeeder.setIndicatorLight": {
20645
+ capName: "pet-feeder",
20646
+ capScope: "device",
20647
+ addonId: null,
20648
+ access: "create"
20649
+ },
20650
+ "petFeeder.setVolume": {
20651
+ capName: "pet-feeder",
20652
+ capScope: "device",
20653
+ addonId: null,
20654
+ access: "create"
20655
+ },
19340
20656
  "pipelineAnalytics.clearTracks": {
19341
20657
  capName: "pipeline-analytics",
19342
20658
  capScope: "device",